Format paired execution refactor files

This commit is contained in:
ejclaw
2026-04-07 00:45:55 +09:00
parent cbb6bc97c7
commit 48592d97ed
4 changed files with 21 additions and 17 deletions

View File

@@ -28,10 +28,11 @@ export function createInitialStreamedOutputState(): StreamedOutputState {
export function createEvaluatedOutputHandler(args: {
agentType: EvaluateStreamedOutputOptions['agentType'];
provider: string;
evaluationOptions?: Omit<EvaluateStreamedOutputOptions, 'agentType' | 'provider'>;
onEvaluatedOutput?: (
output: EvaluatedAgentOutput,
) => Promise<void> | void;
evaluationOptions?: Omit<
EvaluateStreamedOutputOptions,
'agentType' | 'provider'
>;
onEvaluatedOutput?: (output: EvaluatedAgentOutput) => Promise<void> | void;
}): {
handleOutput: (output: AgentOutput) => Promise<void>;
getState: () => StreamedOutputState;

View File

@@ -3,9 +3,7 @@ import path from 'path';
import { getErrorMessage } from './utils.js';
import {
getAgentOutputText,
} from './agent-output.js';
import { getAgentOutputText } from './agent-output.js';
import { createEvaluatedOutputHandler } from './agent-attempt.js';
import {
AgentOutput,
@@ -493,7 +491,11 @@ export async function runAgentForGroup(
) {
pairedExecutionSummary = output.error.slice(0, 500);
}
if (evaluation.newTrigger && outputText && output.status === 'success') {
if (
evaluation.newTrigger &&
outputText &&
output.status === 'success'
) {
log.warn(
{
reason: evaluation.newTrigger.reason,
@@ -501,10 +503,7 @@ export async function runAgentForGroup(
},
'Detected Claude rotation trigger in successful output',
);
} else if (
evaluation.newTrigger &&
typeof output.error === 'string'
) {
} else if (evaluation.newTrigger && typeof output.error === 'string') {
log.warn(
{
reason: evaluation.newTrigger.reason,

View File

@@ -51,8 +51,12 @@ export function buildPendingPairedTurn(args: {
timezone: string;
task: PairedTask;
rawMissedMessages: Array<{ seq?: number | null; timestamp?: string | null }>;
recentHumanMessages: Parameters<typeof buildReviewerPendingPrompt>[0]['recentHumanMessages'];
labeledRecentMessages: Parameters<typeof buildArbiterPromptForTask>[0]['labeledRecentMessages'];
recentHumanMessages: Parameters<
typeof buildReviewerPendingPrompt
>[0]['recentHumanMessages'];
labeledRecentMessages: Parameters<
typeof buildArbiterPromptForTask
>[0]['labeledRecentMessages'];
resolveChannel: (taskStatus?: string | null) => Channel | null;
}): PendingPairedTurn {
const {
@@ -215,7 +219,8 @@ export function resolveBotOnlyPairedFollowUpAction(args: {
return { kind: 'none' };
}
const cursor = pendingCursorSource?.seq ?? pendingCursorSource?.timestamp ?? null;
const cursor =
pendingCursorSource?.seq ?? pendingCursorSource?.timestamp ?? null;
const lastTurnOutput = getPairedTurnOutputs(task.id).at(-1);
const nextTurnAction = resolveNextTurnAction({
taskStatus: task.status,

View File

@@ -17,8 +17,7 @@ export function classifyVerdict(summary: string | null | undefined): Verdict {
if (!cleaned) return 'continue';
const firstLine = cleaned.split('\n')[0].trim();
if (/^\*{0,2}BLOCKED\*{0,2}\b/i.test(firstLine)) return 'blocked';
if (/^\*{0,2}NEEDS_CONTEXT\*{0,2}\b/i.test(firstLine))
return 'needs_context';
if (/^\*{0,2}NEEDS_CONTEXT\*{0,2}\b/i.test(firstLine)) return 'needs_context';
if (/^\*{0,2}DONE_WITH_CONCERNS\*{0,2}\b/i.test(firstLine))
return 'done_with_concerns';
if (/^\*{0,2}DONE\*{0,2}\b/i.test(firstLine)) return 'done';