orcastrator 0.2.8 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/codex/session.js +36 -3
- package/package.json +1 -1
|
@@ -26,9 +26,11 @@ function buildTaskExecutionPrompt(task, runId, cwd, systemContext) {
|
|
|
26
26
|
"Acceptance Criteria:",
|
|
27
27
|
...task.acceptance_criteria.map((criterion, index) => `${index + 1}. ${criterion}`),
|
|
28
28
|
"Execute this task. You have full shell access — run commands, read/write files, and do whatever is needed.",
|
|
29
|
-
"When done, output
|
|
30
|
-
'{"outcome":"done"
|
|
31
|
-
"
|
|
29
|
+
"IMPORTANT: When done, you MUST output the following JSON on its own line as the very last line of your response (no trailing text after it):",
|
|
30
|
+
'{"outcome":"done"}',
|
|
31
|
+
"Or if the task failed:",
|
|
32
|
+
'{"outcome":"failed","error":"short reason"}',
|
|
33
|
+
"Do not wrap it in markdown fences. Do not add any text after the JSON line. The JSON line is required.",
|
|
32
34
|
].join("\n\n");
|
|
33
35
|
}
|
|
34
36
|
function extractAgentText(result) {
|
|
@@ -83,6 +85,21 @@ const POSITIVE_COMPLETION_PATTERNS = [
|
|
|
83
85
|
/\bwritten\b/i,
|
|
84
86
|
/\bcreated\b/i,
|
|
85
87
|
/\bfinished\b/i,
|
|
88
|
+
// Additional patterns to catch natural-language Codex narration
|
|
89
|
+
/\bapplied\b/i,
|
|
90
|
+
/\bimplemented\b/i,
|
|
91
|
+
/\badded\b/i,
|
|
92
|
+
/\bupdated\b/i,
|
|
93
|
+
/\bmodified\b/i,
|
|
94
|
+
/\binstalled\b/i,
|
|
95
|
+
/\bfixed\b/i,
|
|
96
|
+
/\brefactored\b/i,
|
|
97
|
+
/\bchanges?\s+(?:have\s+been\s+)?made\b/i,
|
|
98
|
+
/\bthe\s+task\s+(?:has\s+been|is)\b/i,
|
|
99
|
+
/\bi\s+have\b/i,
|
|
100
|
+
/\ball\s+(?:tasks?|steps?|criteria)\b/i,
|
|
101
|
+
/\btest(?:s|ing)?\s+pass/i,
|
|
102
|
+
/\bno\s+(?:errors?|issues?|failures?)\b/i,
|
|
86
103
|
];
|
|
87
104
|
const FAILURE_PATTERNS = [
|
|
88
105
|
/\berror\b/i,
|
|
@@ -176,6 +193,22 @@ export async function createCodexSession(cwd, config) {
|
|
|
176
193
|
],
|
|
177
194
|
});
|
|
178
195
|
const rawResponse = extractAgentText(result);
|
|
196
|
+
// Primary signal: use the SDK's structured turn status.
|
|
197
|
+
const status = result.turn.status;
|
|
198
|
+
if (status === "completed") {
|
|
199
|
+
return { outcome: "done", rawResponse };
|
|
200
|
+
}
|
|
201
|
+
if (status === "failed") {
|
|
202
|
+
return {
|
|
203
|
+
outcome: "failed",
|
|
204
|
+
error: result.turn.error?.message ?? "Turn failed",
|
|
205
|
+
rawResponse,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
if (status === "interrupted") {
|
|
209
|
+
return { outcome: "failed", error: "Turn was interrupted", rawResponse };
|
|
210
|
+
}
|
|
211
|
+
// Fallback: status is unexpected/missing — parse text as before.
|
|
179
212
|
return parseTaskExecution(rawResponse);
|
|
180
213
|
},
|
|
181
214
|
async consultTaskGraph(tasks) {
|