orquesta-agent 0.2.241 → 0.2.242
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/executor.d.ts +26 -1
- package/dist/executor.d.ts.map +1 -1
- package/dist/executor.js +66 -9
- package/dist/executor.js.map +1 -1
- package/dist/index.js +128 -42
- package/dist/index.js.map +1 -1
- package/dist/socketio-transport.d.ts +2 -0
- package/dist/socketio-transport.d.ts.map +1 -1
- package/dist/socketio-transport.js.map +1 -1
- package/dist/supabase.d.ts +17 -0
- package/dist/supabase.d.ts.map +1 -1
- package/dist/supabase.js.map +1 -1
- package/package.json +1 -1
package/dist/executor.d.ts
CHANGED
|
@@ -222,8 +222,27 @@ export interface GeneratePlanItemsOptions {
|
|
|
222
222
|
* This runs Claude to analyze the request and generate actionable tasks.
|
|
223
223
|
*/
|
|
224
224
|
export declare function generatePlanItems(options: GeneratePlanItemsOptions): Promise<void>;
|
|
225
|
+
/** The assisted-run item an interactive session was claimed against. */
|
|
226
|
+
export interface AssistedSessionEnvelope {
|
|
227
|
+
runId: string;
|
|
228
|
+
itemId: string;
|
|
229
|
+
branch: string;
|
|
230
|
+
/** The prompt row the claim minted, and the subject of the exit report. */
|
|
231
|
+
promptId: string;
|
|
232
|
+
/**
|
|
233
|
+
* HEAD when the session started, captured agent-side. The exit report diffs
|
|
234
|
+
* against it, so commits the person made by hand mid-session are counted too.
|
|
235
|
+
*/
|
|
236
|
+
baseSha?: string;
|
|
237
|
+
}
|
|
238
|
+
/** What `setOnSessionEnded` receives about the session that just ended. */
|
|
239
|
+
export interface SessionEndInfo {
|
|
240
|
+
sessionId: string;
|
|
241
|
+
workingDirectory: string;
|
|
242
|
+
assisted?: AssistedSessionEnvelope;
|
|
243
|
+
}
|
|
225
244
|
/** Register a callback to be called when an interactive session ends (PTY exits). */
|
|
226
|
-
export declare function setOnSessionEnded(cb: () => void): void;
|
|
245
|
+
export declare function setOnSessionEnded(cb: (info?: SessionEndInfo) => void): void;
|
|
227
246
|
export interface StartSessionOptions {
|
|
228
247
|
sessionId: string;
|
|
229
248
|
workingDirectory?: string;
|
|
@@ -246,6 +265,12 @@ export interface StartSessionOptions {
|
|
|
246
265
|
* per-id resume, so they fall back to --continue.
|
|
247
266
|
*/
|
|
248
267
|
resumeSessionId?: string;
|
|
268
|
+
/**
|
|
269
|
+
* Set when this session is a claimed item of an assisted QA run. Suppresses
|
|
270
|
+
* every deploy instruction in the system prompt (same rule as a dispatched
|
|
271
|
+
* assisted prompt) and is handed back on exit so the diff can be reported.
|
|
272
|
+
*/
|
|
273
|
+
assisted?: AssistedSessionEnvelope;
|
|
249
274
|
}
|
|
250
275
|
export interface ResumableSession {
|
|
251
276
|
sessionId: string;
|
package/dist/executor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAkItD,OAAO,EAAgG,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAkItD,OAAO,EAAgG,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AAoP7I,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAOhF;AAGD,wBAAgB,sBAAsB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAE/D;AAGD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,YAAY,CAAA;AAOlD,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,WAAW,CAAC,EAAE,O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SAAS,EAAE,MAAM,GAAG,OAAO,CAoDrD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAWpF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAG1C;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAMvE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAGlD;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,gBAAgB,EAAE,MAAM,CAAA;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAA;CACpD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,WAAW,EAAE,CAe9C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC;IAAC,QAAQ,EAAE,WAAW,EAAE,CAAA;CAAE,CAetN;AAsBD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CA+BzD"}
|
package/dist/executor.js
CHANGED
|
@@ -235,6 +235,10 @@ const promptCostCents = new Map();
|
|
|
235
235
|
// ever saw logs, and panels that read prompts.result (architecture extraction,
|
|
236
236
|
// auto-agent polling) found it empty.
|
|
237
237
|
const promptFinalResult = new Map();
|
|
238
|
+
// The CLI's own verdict for a run, from its `end` event. Kept per prompt because
|
|
239
|
+
// several prompts stream through the same process concurrently. See QA-76: an
|
|
240
|
+
// exit code is not evidence that the work succeeded.
|
|
241
|
+
const promptCliReportedFailure = new Map();
|
|
238
242
|
function trackFileModified(promptId, filePath) {
|
|
239
243
|
if (!executionFilesModified.has(promptId)) {
|
|
240
244
|
executionFilesModified.set(promptId, new Set());
|
|
@@ -2466,9 +2470,22 @@ ${userRequestBody}`;
|
|
|
2466
2470
|
promptFinalResult.set(promptId, String(content));
|
|
2467
2471
|
}
|
|
2468
2472
|
}
|
|
2473
|
+
else if (json.event === 'error') {
|
|
2474
|
+
// orquesta-cli emits this when a run ends badly. There was no branch
|
|
2475
|
+
// for it, so the reason a run failed never reached the timeline —
|
|
2476
|
+
// only the (misleading) completion line did.
|
|
2477
|
+
const { message } = json.data;
|
|
2478
|
+
if (message) {
|
|
2479
|
+
output += `\n❌ ${message}\n`;
|
|
2480
|
+
logs.push(createErrorLog(String(message), false, 'error', promptId, json.data?.code));
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2469
2483
|
else if (json.event === 'end') {
|
|
2470
2484
|
const { success, duration_ms, usage } = json.data;
|
|
2471
2485
|
const duration = (duration_ms / 1000).toFixed(1);
|
|
2486
|
+
// Remember the CLI's answer. It knows things the exit code does not.
|
|
2487
|
+
if (success === false && promptId)
|
|
2488
|
+
promptCliReportedFailure.set(promptId, true);
|
|
2472
2489
|
output += `\n${success ? '✅' : '❌'} Completed in ${duration}s\n`;
|
|
2473
2490
|
if (usage) {
|
|
2474
2491
|
output += `📊 Tokens: ${usage.total_tokens || 0}\n`;
|
|
@@ -2891,7 +2908,18 @@ ${userRequestBody}`;
|
|
|
2891
2908
|
addLog(promptId, 'error', 'system', `Claude CLI unavailable (no fallback): ${claudeApiError}`);
|
|
2892
2909
|
sendOutput(channel, commandId, 'stderr', `\n❌ Claude CLI unavailable: ${claudeApiError}\n`);
|
|
2893
2910
|
}
|
|
2894
|
-
|
|
2911
|
+
// A CLI that swallowed a fatal error and still exited 0 is exactly how a
|
|
2912
|
+
// revoked-token run ended up wearing a green "Completed" badge (QA-76).
|
|
2913
|
+
// When the CLI told us in its `end` event that the run failed, that beats
|
|
2914
|
+
// the exit code — same shape as the claudeApiError rule above, which
|
|
2915
|
+
// exists because `claude` also exits 0 on an account-level failure.
|
|
2916
|
+
const cliReportedFailure = promptId ? promptCliReportedFailure.get(promptId) === true : false;
|
|
2917
|
+
if (promptId)
|
|
2918
|
+
promptCliReportedFailure.delete(promptId);
|
|
2919
|
+
if (cliReportedFailure && (code ?? 0) === 0) {
|
|
2920
|
+
logger.warn('CLI reported a failed run but exited 0 — recording it as failed');
|
|
2921
|
+
}
|
|
2922
|
+
const exitCode = (claudeApiError || cliReportedFailure) ? (code || 1) : (code ?? 0);
|
|
2895
2923
|
const duration = Date.now() - startTime;
|
|
2896
2924
|
const status = exitCode === 0 ? 'completed' : 'failed';
|
|
2897
2925
|
if (exitCode === 0) {
|
|
@@ -3774,7 +3802,7 @@ export function listResumableSessions(workingDir, subAgentId, limit = 12) {
|
|
|
3774
3802
|
* The session runs with --dangerously-skip-permissions for uninterrupted interaction.
|
|
3775
3803
|
*/
|
|
3776
3804
|
export async function startSession(options) {
|
|
3777
|
-
const { sessionId, workingDirectory, channel, cols = 120, rows = 40, subAgentId, subAgentName, resume, resumeSessionId } = options;
|
|
3805
|
+
const { sessionId, workingDirectory, channel, cols = 120, rows = 40, subAgentId, subAgentName, resume, resumeSessionId, assisted } = options;
|
|
3778
3806
|
// If this exact sessionId is already live, terminate it before re-creating.
|
|
3779
3807
|
// Sessions on OTHER workstreams are left untouched — they run concurrently.
|
|
3780
3808
|
if (sessions.has(sessionId)) {
|
|
@@ -3903,7 +3931,15 @@ export async function startSession(options) {
|
|
|
3903
3931
|
catch { /* file not found — try next */ }
|
|
3904
3932
|
}
|
|
3905
3933
|
const browserBlockPart = globalBrowserEnabled ? `${BROWSER_TOOLS_PROMPT_BLOCK}\n\n` : '';
|
|
3906
|
-
|
|
3934
|
+
// An assisted session is on a QA branch whose diff a reviewer has to read, so
|
|
3935
|
+
// it gets the same deploy suppression a dispatched assisted prompt gets. It
|
|
3936
|
+
// leads the block rather than trailing it: the operator can type anything
|
|
3937
|
+
// here, and a rule buried under 14KB of capabilities is a rule the model has
|
|
3938
|
+
// already stopped weighting by the time it matters.
|
|
3939
|
+
const assistedBlockPart = assisted
|
|
3940
|
+
? `## Assisted QA run\n\nYou are on branch \`${assisted.branch}\`, working one item of an assisted QA run. Deployment is DISABLED: do NOT deploy, do NOT call the Orquesta Deploy API, and do NOT push to the main branch. A reviewer reads this diff before anything ships.\n\n`
|
|
3941
|
+
: '';
|
|
3942
|
+
const systemPromptBlock = `${assistedBlockPart}${browserBlockPart}${ORQUESTA_CAPABILITIES_PROMPT_BLOCK}${liveCoordination}${projectMdContent}`;
|
|
3907
3943
|
// On Windows the prompt (~38KB) + a big CLAUDE.md can exceed CreateProcess's
|
|
3908
3944
|
// 32767-char command-line cap and the interactive session fails to spawn. Both
|
|
3909
3945
|
// orquesta-cli and claude support --append-system-prompt-file, so we ALWAYS write
|
|
@@ -4077,6 +4113,7 @@ export async function startSession(options) {
|
|
|
4077
4113
|
lastPtyOutputAt: Date.now(),
|
|
4078
4114
|
rogerthatWatcher: null,
|
|
4079
4115
|
transcriptTail: null,
|
|
4116
|
+
assisted,
|
|
4080
4117
|
};
|
|
4081
4118
|
sessions.set(sessionId, session);
|
|
4082
4119
|
ensureSessionReaper(); // reap this session if it's later abandoned without session:end
|
|
@@ -4200,9 +4237,14 @@ export async function startSession(options) {
|
|
|
4200
4237
|
sessions.delete(sessionId);
|
|
4201
4238
|
// Note: do NOT clear rogerthatLogOffsets here — the map is shared with
|
|
4202
4239
|
// one-shot execute() prompts and persists for the agent process lifetime.
|
|
4203
|
-
// Notify index.ts to drain any queued prompts
|
|
4240
|
+
// Notify index.ts to drain any queued prompts — and, when this terminal
|
|
4241
|
+
// was a claimed assisted item, to commit and report its diff.
|
|
4204
4242
|
if (onSessionEndedCallback)
|
|
4205
|
-
onSessionEndedCallback(
|
|
4243
|
+
onSessionEndedCallback({
|
|
4244
|
+
sessionId,
|
|
4245
|
+
workingDirectory: exitingSession.workingDirectory,
|
|
4246
|
+
assisted: exitingSession.assisted,
|
|
4247
|
+
});
|
|
4206
4248
|
}
|
|
4207
4249
|
});
|
|
4208
4250
|
return true;
|
|
@@ -4374,7 +4416,11 @@ export function endSession(sessionId) {
|
|
|
4374
4416
|
// Manually send session:ended — onExit won't do it since we removed the session
|
|
4375
4417
|
sendSessionEnded(ch, sessionId, -1, duration).catch(() => { });
|
|
4376
4418
|
if (onSessionEndedCallback)
|
|
4377
|
-
onSessionEndedCallback(
|
|
4419
|
+
onSessionEndedCallback({
|
|
4420
|
+
sessionId,
|
|
4421
|
+
workingDirectory: sessionRef.workingDirectory,
|
|
4422
|
+
assisted: sessionRef.assisted,
|
|
4423
|
+
});
|
|
4378
4424
|
}
|
|
4379
4425
|
}, 2000);
|
|
4380
4426
|
}
|
|
@@ -4506,6 +4552,14 @@ export function terminateSession(sessionId) {
|
|
|
4506
4552
|
const targets = sessionId
|
|
4507
4553
|
? (sessions.has(sessionId) ? [sessions.get(sessionId)] : [])
|
|
4508
4554
|
: [...sessions.values()];
|
|
4555
|
+
// Captured before the loop kills them: a reaped or force-ended assisted
|
|
4556
|
+
// session still has to report, or its item stays `in_progress` forever and
|
|
4557
|
+
// the whole run is wedged behind a terminal nobody is sitting at.
|
|
4558
|
+
const ended = targets.map(t => ({
|
|
4559
|
+
sessionId: t.sessionId,
|
|
4560
|
+
workingDirectory: t.workingDirectory,
|
|
4561
|
+
assisted: t.assisted,
|
|
4562
|
+
}));
|
|
4509
4563
|
for (const s of targets) {
|
|
4510
4564
|
const { sessionId: sid, channel, startTime, ptyProcess } = s;
|
|
4511
4565
|
const duration = Date.now() - startTime;
|
|
@@ -4529,8 +4583,11 @@ export function terminateSession(sessionId) {
|
|
|
4529
4583
|
// because we already removed the session above
|
|
4530
4584
|
sendSessionEnded(channel, sid, -1, duration).catch(() => { });
|
|
4531
4585
|
}
|
|
4532
|
-
// Drain any queued prompts once
|
|
4533
|
-
|
|
4534
|
-
|
|
4586
|
+
// Drain any queued prompts after terminating, once per session so an
|
|
4587
|
+
// assisted envelope is never dropped when several are killed together.
|
|
4588
|
+
if (onSessionEndedCallback) {
|
|
4589
|
+
for (const info of ended)
|
|
4590
|
+
onSessionEndedCallback(info);
|
|
4591
|
+
}
|
|
4535
4592
|
}
|
|
4536
4593
|
//# sourceMappingURL=executor.js.map
|