Format paired execution refactor files
This commit is contained in:
@@ -28,10 +28,11 @@ export function createInitialStreamedOutputState(): StreamedOutputState {
|
|||||||
export function createEvaluatedOutputHandler(args: {
|
export function createEvaluatedOutputHandler(args: {
|
||||||
agentType: EvaluateStreamedOutputOptions['agentType'];
|
agentType: EvaluateStreamedOutputOptions['agentType'];
|
||||||
provider: string;
|
provider: string;
|
||||||
evaluationOptions?: Omit<EvaluateStreamedOutputOptions, 'agentType' | 'provider'>;
|
evaluationOptions?: Omit<
|
||||||
onEvaluatedOutput?: (
|
EvaluateStreamedOutputOptions,
|
||||||
output: EvaluatedAgentOutput,
|
'agentType' | 'provider'
|
||||||
) => Promise<void> | void;
|
>;
|
||||||
|
onEvaluatedOutput?: (output: EvaluatedAgentOutput) => Promise<void> | void;
|
||||||
}): {
|
}): {
|
||||||
handleOutput: (output: AgentOutput) => Promise<void>;
|
handleOutput: (output: AgentOutput) => Promise<void>;
|
||||||
getState: () => StreamedOutputState;
|
getState: () => StreamedOutputState;
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ import path from 'path';
|
|||||||
|
|
||||||
import { getErrorMessage } from './utils.js';
|
import { getErrorMessage } from './utils.js';
|
||||||
|
|
||||||
import {
|
import { getAgentOutputText } from './agent-output.js';
|
||||||
getAgentOutputText,
|
|
||||||
} from './agent-output.js';
|
|
||||||
import { createEvaluatedOutputHandler } from './agent-attempt.js';
|
import { createEvaluatedOutputHandler } from './agent-attempt.js';
|
||||||
import {
|
import {
|
||||||
AgentOutput,
|
AgentOutput,
|
||||||
@@ -493,7 +491,11 @@ export async function runAgentForGroup(
|
|||||||
) {
|
) {
|
||||||
pairedExecutionSummary = output.error.slice(0, 500);
|
pairedExecutionSummary = output.error.slice(0, 500);
|
||||||
}
|
}
|
||||||
if (evaluation.newTrigger && outputText && output.status === 'success') {
|
if (
|
||||||
|
evaluation.newTrigger &&
|
||||||
|
outputText &&
|
||||||
|
output.status === 'success'
|
||||||
|
) {
|
||||||
log.warn(
|
log.warn(
|
||||||
{
|
{
|
||||||
reason: evaluation.newTrigger.reason,
|
reason: evaluation.newTrigger.reason,
|
||||||
@@ -501,10 +503,7 @@ export async function runAgentForGroup(
|
|||||||
},
|
},
|
||||||
'Detected Claude rotation trigger in successful output',
|
'Detected Claude rotation trigger in successful output',
|
||||||
);
|
);
|
||||||
} else if (
|
} else if (evaluation.newTrigger && typeof output.error === 'string') {
|
||||||
evaluation.newTrigger &&
|
|
||||||
typeof output.error === 'string'
|
|
||||||
) {
|
|
||||||
log.warn(
|
log.warn(
|
||||||
{
|
{
|
||||||
reason: evaluation.newTrigger.reason,
|
reason: evaluation.newTrigger.reason,
|
||||||
|
|||||||
@@ -51,8 +51,12 @@ export function buildPendingPairedTurn(args: {
|
|||||||
timezone: string;
|
timezone: string;
|
||||||
task: PairedTask;
|
task: PairedTask;
|
||||||
rawMissedMessages: Array<{ seq?: number | null; timestamp?: string | null }>;
|
rawMissedMessages: Array<{ seq?: number | null; timestamp?: string | null }>;
|
||||||
recentHumanMessages: Parameters<typeof buildReviewerPendingPrompt>[0]['recentHumanMessages'];
|
recentHumanMessages: Parameters<
|
||||||
labeledRecentMessages: Parameters<typeof buildArbiterPromptForTask>[0]['labeledRecentMessages'];
|
typeof buildReviewerPendingPrompt
|
||||||
|
>[0]['recentHumanMessages'];
|
||||||
|
labeledRecentMessages: Parameters<
|
||||||
|
typeof buildArbiterPromptForTask
|
||||||
|
>[0]['labeledRecentMessages'];
|
||||||
resolveChannel: (taskStatus?: string | null) => Channel | null;
|
resolveChannel: (taskStatus?: string | null) => Channel | null;
|
||||||
}): PendingPairedTurn {
|
}): PendingPairedTurn {
|
||||||
const {
|
const {
|
||||||
@@ -215,7 +219,8 @@ export function resolveBotOnlyPairedFollowUpAction(args: {
|
|||||||
return { kind: 'none' };
|
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 lastTurnOutput = getPairedTurnOutputs(task.id).at(-1);
|
||||||
const nextTurnAction = resolveNextTurnAction({
|
const nextTurnAction = resolveNextTurnAction({
|
||||||
taskStatus: task.status,
|
taskStatus: task.status,
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ export function classifyVerdict(summary: string | null | undefined): Verdict {
|
|||||||
if (!cleaned) return 'continue';
|
if (!cleaned) return 'continue';
|
||||||
const firstLine = cleaned.split('\n')[0].trim();
|
const firstLine = cleaned.split('\n')[0].trim();
|
||||||
if (/^\*{0,2}BLOCKED\*{0,2}\b/i.test(firstLine)) return 'blocked';
|
if (/^\*{0,2}BLOCKED\*{0,2}\b/i.test(firstLine)) return 'blocked';
|
||||||
if (/^\*{0,2}NEEDS_CONTEXT\*{0,2}\b/i.test(firstLine))
|
if (/^\*{0,2}NEEDS_CONTEXT\*{0,2}\b/i.test(firstLine)) return 'needs_context';
|
||||||
return 'needs_context';
|
|
||||||
if (/^\*{0,2}DONE_WITH_CONCERNS\*{0,2}\b/i.test(firstLine))
|
if (/^\*{0,2}DONE_WITH_CONCERNS\*{0,2}\b/i.test(firstLine))
|
||||||
return 'done_with_concerns';
|
return 'done_with_concerns';
|
||||||
if (/^\*{0,2}DONE\*{0,2}\b/i.test(firstLine)) return 'done';
|
if (/^\*{0,2}DONE\*{0,2}\b/i.test(firstLine)) return 'done';
|
||||||
|
|||||||
Reference in New Issue
Block a user