arco-workbench 0.1.7 → 0.1.8
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/CONTRIBUTING.md +52 -12
- package/README.md +14 -12
- package/client/dist/assets/{PhosphorBackdrop-DVQdBrTw.js → PhosphorBackdrop-D7jdAV_G.js} +1 -1
- package/client/dist/assets/{ThemedBackgroundShaderImpl-BfSs2tB4.js → ThemedBackgroundShaderImpl-DrDm60h8.js} +1 -1
- package/client/dist/assets/{XtermView-DaMjC8Ny.js → XtermView-BGFujb1e.js} +1 -1
- package/client/dist/assets/{galleryEditor-BCQnXj7R.js → galleryEditor-D951A2sE.js} +1 -1
- package/client/dist/assets/{index-COfbHCYv.js → index-CsVy3eZm.js} +246 -246
- package/client/dist/index.html +1 -1
- package/client/src/components/ClusterRightPanel/ReplaceMemberDialog.tsx +65 -15
- package/client/src/components/ClusterRightPanel/SkillsControl.tsx +107 -0
- package/client/src/components/ClusterRightPanel/index.tsx +4 -0
- package/client/src/components/ClusterTaskBoardTab.tsx +9 -22
- package/client/src/components/NeedsYouBadge.tsx +3 -3
- package/client/src/components/ProviderReleasesModal.tsx +8 -4
- package/client/src/components/ProvidersPopover.tsx +28 -23
- package/client/src/components/SettingsPanel.tsx +2 -2
- package/client/src/components/SkillsSettings.tsx +5 -0
- package/client/src/components/TabBar.tsx +91 -9
- package/client/src/components/TerminalInput.tsx +12 -10
- package/client/src/components/TranscriptSendDialog.tsx +12 -8
- package/client/src/components/TranscriptWorkerDialog.tsx +119 -0
- package/client/src/components/clusterNeedsYou.ts +11 -18
- package/client/src/help/content/cluster.tsx +38 -17
- package/client/src/help/content/composer.tsx +22 -0
- package/client/src/help/content/header.tsx +16 -0
- package/client/src/help/content/misc.tsx +8 -0
- package/client/src/help/content/settings.tsx +18 -4
- package/client/src/help/content/tabbar.tsx +5 -0
- package/client/src/help/manualSections/actions.tsx +31 -0
- package/client/src/help/manualSections/clusters.tsx +41 -20
- package/client/src/help/manualSections/configuration.tsx +18 -0
- package/client/src/help/manualSections/maintenance.tsx +18 -0
- package/client/src/help/manualSections/providers.tsx +32 -8
- package/client/src/help/manualSections/troubleshooting.tsx +2 -1
- package/client/src/help/manualSections/workflows.tsx +12 -0
- package/client/src/help/manualSections/workspace.tsx +6 -0
- package/client/src/utils/transcriptWorkerRequest.ts +24 -0
- package/client/src/ws/handleServerMessage.ts +8 -2
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/CLIENT.md +9 -8
- package/docs/FEATURES.md +8 -5
- package/docs/GETTING_STARTED.md +4 -3
- package/docs/GOTCHAS.md +2 -1
- package/docs/OPERATIONS.md +14 -4
- package/docs/PERSISTENCE.md +7 -2
- package/docs/PRIMITIVES.md +42 -0
- package/docs/PROTOCOL_CLUSTER.md +42 -3
- package/docs/PROTOCOL_PRIMITIVES.md +39 -0
- package/docs/PROVIDERS.md +50 -13
- package/docs/SETTINGS.md +27 -3
- package/docs/TASK_LEDGER.md +7 -15
- package/native/darwin-arm64/manifest.json +1 -1
- package/node_modules/@arco/shared/dist/clusterCoordination.d.ts +2 -0
- package/node_modules/@arco/shared/dist/clusterCoordination.js +5 -1
- package/node_modules/@arco/shared/dist/protocol/clientMessages.d.ts +3 -2
- package/node_modules/@arco/shared/dist/protocol/clusters.d.ts +13 -1
- package/node_modules/@arco/shared/dist/protocol/index.d.ts +1 -0
- package/node_modules/@arco/shared/dist/protocol/index.js +1 -0
- package/node_modules/@arco/shared/dist/protocol/models.d.ts +4 -3
- package/node_modules/@arco/shared/dist/protocol/models.js +26 -2
- package/node_modules/@arco/shared/dist/protocol/serverMessages.d.ts +2 -1
- package/node_modules/@arco/shared/dist/protocol/tasks.d.ts +4 -0
- package/node_modules/@arco/shared/dist/protocol/transcriptWorker.d.ts +47 -0
- package/node_modules/@arco/shared/dist/protocol/transcriptWorker.js +2 -0
- package/node_modules/@arco/shared/dist/runtimeVersions.d.ts +1 -0
- package/node_modules/@arco/shared/dist/runtimeVersions.js +14 -0
- package/node_modules/@arco/shared/package.json +1 -1
- package/package.json +2 -2
- package/scripts/packaging/arco.mjs +1 -1
- package/scripts/packaging/native-repair.mjs +32 -4
- package/server/dist/atomicFile.js +1 -2
- package/server/dist/capabilities.d.ts +5 -2
- package/server/dist/capabilities.js +59 -9
- package/server/dist/cliUpdateDecision.d.ts +1 -1
- package/server/dist/cliUpdateDecision.js +5 -3
- package/server/dist/clusterDirector.js +1 -1
- package/server/dist/clusterPeerOps.js +10 -7
- package/server/dist/clusterProgress.js +1 -1
- package/server/dist/clusterSkills.d.ts +13 -0
- package/server/dist/clusterSkills.js +81 -0
- package/server/dist/clusterSnapshots.js +2 -0
- package/server/dist/clusterStore.d.ts +7 -2
- package/server/dist/clusterStore.js +42 -1
- package/server/dist/diagnostics/codeSkew.js +1 -0
- package/server/dist/eventLog.d.ts +7 -0
- package/server/dist/eventLog.js +70 -13
- package/server/dist/historyLimits.d.ts +1 -0
- package/server/dist/historyLimits.js +3 -0
- package/server/dist/http/router.js +1 -1
- package/server/dist/index.js +24 -1
- package/server/dist/jsonlLines.d.ts +4 -0
- package/server/dist/jsonlLines.js +53 -0
- package/server/dist/management/identity.js +1 -0
- package/server/dist/mcp/clusterMcpTools.js +4 -4
- package/server/dist/project/taskLedger.d.ts +4 -0
- package/server/dist/project/taskLedger.js +7 -4
- package/server/dist/providerConversation.d.ts +1 -0
- package/server/dist/providerConversation.js +17 -0
- package/server/dist/providers/claude-native/resumeSummary.d.ts +9 -0
- package/server/dist/providers/claude-native/resumeSummary.js +102 -49
- package/server/dist/providers/claude-native/worker.js +8 -4
- package/server/dist/providers/claude.js +2 -1
- package/server/dist/providers/clusterTaskToolDefinitions.js +4 -4
- package/server/dist/providers/codex-appserver/catalog.js +16 -1
- package/server/dist/providers/codex.js +2 -1
- package/server/dist/providers/codexCodeMode.d.ts +1 -1
- package/server/dist/providers/codexCodeMode.js +4 -3
- package/server/dist/providers/cursor/print.js +2 -1
- package/server/dist/providers/cursor/worker.js +2 -1
- package/server/dist/providers/llamacpp.js +17 -8
- package/server/dist/providers/ollamaRecovery.js +6 -6
- package/server/dist/providers/ollamaResilience.js +3 -3
- package/server/dist/providers/ollamaTokens.js +1 -1
- package/server/dist/quota.d.ts +0 -18
- package/server/dist/quota.js +0 -44
- package/server/dist/replacementHistory.d.ts +19 -0
- package/server/dist/replacementHistory.js +49 -0
- package/server/dist/server/broadcast.d.ts +2 -1
- package/server/dist/server/broadcast.js +1 -0
- package/server/dist/server/prompts.d.ts +1 -0
- package/server/dist/server/prompts.js +6 -1
- package/server/dist/sessionJsonl.d.ts +1 -1
- package/server/dist/sessionJsonl.js +115 -40
- package/server/dist/smartPickupAdapters.js +15 -2
- package/server/dist/transcriptWorker.d.ts +34 -0
- package/server/dist/transcriptWorker.js +201 -0
- package/server/dist/workflowStore.d.ts +1 -0
- package/server/dist/workflowStore.js +31 -0
- package/server/dist/ws/clusterHandlers.d.ts +1 -0
- package/server/dist/ws/clusterHandlers.js +62 -26
- package/server/dist/ws/handoffHandlers.js +5 -2
- package/server/dist/ws/transcriptWorkerHandlers.d.ts +25 -0
- package/server/dist/ws/transcriptWorkerHandlers.js +139 -0
- package/server/dist/ws/turnEngine.js +23 -9
- package/server/dist/ws/updatePrimaryConfig.js +27 -8
- package/server/dist/ws/workflowHandlers.d.ts +4 -1
- package/server/dist/ws/workflowHandlers.js +3 -1
- package/server/package.json +1 -1
- package/server/src/atomicFile.ts +1 -2
- package/server/src/capabilities.ts +58 -17
- package/server/src/cliUpdateDecision.ts +5 -4
- package/server/src/clusterDirector.ts +1 -1
- package/server/src/clusterPeerOps.ts +11 -8
- package/server/src/clusterProgress.ts +1 -1
- package/server/src/clusterSkills.ts +79 -0
- package/server/src/clusterSnapshots.ts +1 -0
- package/server/src/clusterStore.ts +38 -0
- package/server/src/diagnostics/codeSkew.ts +1 -0
- package/server/src/eventLog.ts +73 -13
- package/server/src/historyLimits.ts +2 -0
- package/server/src/http/router.ts +1 -1
- package/server/src/index.ts +23 -0
- package/server/src/jsonlLines.ts +52 -0
- package/server/src/management/identity.ts +1 -0
- package/server/src/mcp/clusterMcpTools.ts +4 -4
- package/server/src/project/taskLedger.ts +7 -5
- package/server/src/providerConversation.ts +15 -0
- package/server/src/providers/claude-native/resumeSummary.ts +98 -50
- package/server/src/providers/claude-native/worker.ts +8 -4
- package/server/src/providers/claude.ts +2 -1
- package/server/src/providers/clusterTaskToolDefinitions.ts +4 -4
- package/server/src/providers/codex-appserver/catalog.ts +14 -1
- package/server/src/providers/codex.ts +2 -1
- package/server/src/providers/codexCodeMode.ts +4 -4
- package/server/src/providers/cursor/print.ts +2 -1
- package/server/src/providers/cursor/worker.ts +2 -1
- package/server/src/providers/llamacpp.ts +18 -7
- package/server/src/providers/llamacppRecovery.ts +2 -0
- package/server/src/providers/ollamaRecovery.ts +6 -6
- package/server/src/providers/ollamaResilience.ts +3 -3
- package/server/src/providers/ollamaTokens.ts +1 -1
- package/server/src/providers/ollamaToolSubset.ts +3 -3
- package/server/src/quota.ts +0 -50
- package/server/src/replacementHistory.ts +44 -0
- package/server/src/server/broadcast.ts +2 -0
- package/server/src/server/prompts.ts +8 -1
- package/server/src/sessionJsonl.ts +92 -32
- package/server/src/smartPickupAdapters.ts +17 -3
- package/server/src/transcriptWorker.ts +182 -0
- package/server/src/workflowStore.ts +21 -0
- package/server/src/ws/clusterHandlers.ts +43 -25
- package/server/src/ws/handoffHandlers.ts +5 -1
- package/server/src/ws/transcriptWorkerHandlers.ts +126 -0
- package/server/src/ws/turnEngine.ts +20 -8
- package/server/src/ws/updatePrimaryConfig.ts +25 -6
- package/server/src/ws/workflowHandlers.ts +3 -1
- package/shared/dist/clusterCoordination.d.ts +2 -0
- package/shared/dist/clusterCoordination.js +5 -1
- package/shared/dist/protocol/clientMessages.d.ts +3 -2
- package/shared/dist/protocol/clusters.d.ts +13 -1
- package/shared/dist/protocol/index.d.ts +1 -0
- package/shared/dist/protocol/index.js +1 -0
- package/shared/dist/protocol/models.d.ts +4 -3
- package/shared/dist/protocol/models.js +26 -2
- package/shared/dist/protocol/serverMessages.d.ts +2 -1
- package/shared/dist/protocol/tasks.d.ts +4 -0
- package/shared/dist/protocol/transcriptWorker.d.ts +47 -0
- package/shared/dist/protocol/transcriptWorker.js +2 -0
- package/shared/dist/runtimeVersions.d.ts +1 -0
- package/shared/dist/runtimeVersions.js +14 -0
- package/shared/src/clusterCoordination.ts +7 -1
- package/shared/src/protocol/clientMessages.ts +5 -0
- package/shared/src/protocol/clusters.ts +16 -1
- package/shared/src/protocol/index.ts +1 -0
- package/shared/src/protocol/models.ts +31 -5
- package/shared/src/protocol/serverMessages.ts +2 -0
- package/shared/src/protocol/settings.ts +2 -3
- package/shared/src/protocol/tasks.ts +4 -7
- package/shared/src/protocol/transcriptWorker.ts +49 -0
- package/shared/src/runtimeVersions.ts +14 -0
package/server/dist/quota.d.ts
CHANGED
|
@@ -26,22 +26,4 @@ export declare function wireSnapshot(): Record<ProviderName, {
|
|
|
26
26
|
throttled: boolean;
|
|
27
27
|
resetsAt?: number;
|
|
28
28
|
}>;
|
|
29
|
-
/**
|
|
30
|
-
* Legacy PROVIDER STATUS formatter, currently without live callers. Returns empty string when every
|
|
31
|
-
* provider is available — no need to clutter the prompt when routing is
|
|
32
|
-
* unconstrained. See §6.4 for the format.
|
|
33
|
-
*/
|
|
34
|
-
export declare function buildQuotaInjection(): string;
|
|
35
|
-
/**
|
|
36
|
-
* §5.4 cross-family reviewer fallback. Maps a primary model to a cross-family
|
|
37
|
-
* reviewer used when the preferred reviewer's provider is throttled. Returns
|
|
38
|
-
* null for models that intentionally skip review (ollama / heretic).
|
|
39
|
-
*
|
|
40
|
-
* Legacy helper, currently without live callers. Kept for a separate cleanup.
|
|
41
|
-
*/
|
|
42
|
-
export interface ReviewerFallback {
|
|
43
|
-
model: string;
|
|
44
|
-
provider: ProviderName;
|
|
45
|
-
}
|
|
46
|
-
export declare function crossFamilyFallback(primaryModel: string): ReviewerFallback | null;
|
|
47
29
|
export {};
|
package/server/dist/quota.js
CHANGED
|
@@ -119,48 +119,4 @@ export function wireSnapshot() {
|
|
|
119
119
|
}
|
|
120
120
|
return out;
|
|
121
121
|
}
|
|
122
|
-
/**
|
|
123
|
-
* Legacy PROVIDER STATUS formatter, currently without live callers. Returns empty string when every
|
|
124
|
-
* provider is available — no need to clutter the prompt when routing is
|
|
125
|
-
* unconstrained. See §6.4 for the format.
|
|
126
|
-
*/
|
|
127
|
-
export function buildQuotaInjection() {
|
|
128
|
-
const snap = snapshot();
|
|
129
|
-
const anyThrottled = PROVIDERS.some((p) => snap[p].throttled);
|
|
130
|
-
if (!anyThrottled)
|
|
131
|
-
return '';
|
|
132
|
-
const lines = ['## PROVIDER STATUS'];
|
|
133
|
-
for (const p of PROVIDERS) {
|
|
134
|
-
const s = snap[p];
|
|
135
|
-
if (s.throttled) {
|
|
136
|
-
const suffix = s.resetsAt
|
|
137
|
-
? ` until ${new Date(s.resetsAt).toISOString()}`
|
|
138
|
-
: ' (no reset time known)';
|
|
139
|
-
lines.push(`- ${p}: THROTTLED${suffix}`);
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
lines.push(`- ${p}: available`);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
lines.push('');
|
|
146
|
-
lines.push('Dispatch AWAY from throttled providers. If a capable worker from an available provider can cover the task, pick that one. Throttled-provider spawns will fail — the cost of retrying is wasted tokens and a stuck workflow.');
|
|
147
|
-
return lines.join('\n');
|
|
148
|
-
}
|
|
149
|
-
export function crossFamilyFallback(primaryModel) {
|
|
150
|
-
// Codex → Claude
|
|
151
|
-
if (primaryModel === 'gpt-5.4-mini')
|
|
152
|
-
return { model: 'opus', provider: 'claude' };
|
|
153
|
-
if (primaryModel === 'gpt-5.3-codex')
|
|
154
|
-
return { model: 'opus', provider: 'claude' };
|
|
155
|
-
if (primaryModel === 'gpt-5.2-codex')
|
|
156
|
-
return { model: 'opus', provider: 'claude' };
|
|
157
|
-
if (primaryModel === 'gpt-5.5')
|
|
158
|
-
return { model: 'opus', provider: 'claude' };
|
|
159
|
-
if (primaryModel === 'gpt-5.4')
|
|
160
|
-
return { model: 'opus', provider: 'claude' };
|
|
161
|
-
if (primaryModel === 'gpt-5.1-codex-max')
|
|
162
|
-
return { model: 'opus', provider: 'claude' };
|
|
163
|
-
// Heretic (ollama) — review intentionally skipped.
|
|
164
|
-
return null;
|
|
165
|
-
}
|
|
166
122
|
//# sourceMappingURL=quota.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type TranscriptSliceOptions } from './transcriptWorker.js';
|
|
2
|
+
export declare const REPLACEMENT_FULL_BYTES: number;
|
|
3
|
+
export declare const REPLACEMENT_RECENT_BYTES: number;
|
|
4
|
+
export type ReplacementHistoryMode = 'recent' | 'full';
|
|
5
|
+
export declare function buildReplacementHistory(cwd: string, workflowId: string, mode: ReplacementHistoryMode, options: TranscriptSliceOptions): Promise<{
|
|
6
|
+
seed: string;
|
|
7
|
+
bytes: number;
|
|
8
|
+
selectedTurns: number;
|
|
9
|
+
digest: string;
|
|
10
|
+
historyMode: ReplacementHistoryMode;
|
|
11
|
+
requestedTurns: number;
|
|
12
|
+
truncated: boolean;
|
|
13
|
+
historyFallback: boolean;
|
|
14
|
+
availableTurns: number;
|
|
15
|
+
partialIncluded: boolean;
|
|
16
|
+
cutoffSeq: number;
|
|
17
|
+
branchKey: string;
|
|
18
|
+
}>;
|
|
19
|
+
export declare function replacementHistoryNotice(preview: Awaited<ReturnType<typeof buildReplacementHistory>>): string | undefined;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { buildTranscriptSlice } from './transcriptWorker.js';
|
|
3
|
+
import { replayEvents } from './workflowStore.js';
|
|
4
|
+
import { renderTranscript, summarizePriorTurns } from './primitives/exportContext.js';
|
|
5
|
+
import { RECENT_HISTORY_MAX_BYTES } from './historyLimits.js';
|
|
6
|
+
export const REPLACEMENT_FULL_BYTES = 512 * 1024;
|
|
7
|
+
export const REPLACEMENT_RECENT_BYTES = RECENT_HISTORY_MAX_BYTES;
|
|
8
|
+
export async function buildReplacementHistory(cwd, workflowId, mode, options) {
|
|
9
|
+
if (mode !== 'recent' && mode !== 'full')
|
|
10
|
+
throw new Error('Choose NO HISTORY, RECENT HISTORY or FULL HISTORY.');
|
|
11
|
+
const slice = await buildTranscriptSlice(cwd, workflowId, { ...options, turns: mode === 'full' ? Number.MAX_SAFE_INTEGER : options.turns }, {
|
|
12
|
+
maxBytes: mode === 'full' ? REPLACEMENT_FULL_BYTES : REPLACEMENT_RECENT_BYTES,
|
|
13
|
+
fitWholeTurns: true, allTurns: mode === 'full',
|
|
14
|
+
});
|
|
15
|
+
let seed = slice.seed, selectedTurns = slice.selectedTurns, historyFallback = false;
|
|
16
|
+
if (mode === 'full') {
|
|
17
|
+
// Preserve the existing full-history transcript and action digest while
|
|
18
|
+
// they fit. Only the oversized fallback uses the shared recent-turn form.
|
|
19
|
+
const events = (await replayEvents(cwd, workflowId, 0)).filter(event => !('seq' in event) || typeof event.seq !== 'number' || event.seq <= slice.cutoffSeq);
|
|
20
|
+
const transcript = renderTranscript(events).trim(), actions = summarizePriorTurns(events).trim();
|
|
21
|
+
const full = [
|
|
22
|
+
'[REPLACEMENT CONTEXT — copied by explicit operator request; this is a new provider session]',
|
|
23
|
+
transcript,
|
|
24
|
+
actions ? `\n[Prior-turn action digest]\n${actions}` : '',
|
|
25
|
+
'\nAcknowledge this imported context briefly, then wait for the operator.',
|
|
26
|
+
].filter(Boolean).join('\n\n');
|
|
27
|
+
if (Buffer.byteLength(full, 'utf8') <= REPLACEMENT_FULL_BYTES) {
|
|
28
|
+
seed = full;
|
|
29
|
+
selectedTurns = slice.availableTurns;
|
|
30
|
+
}
|
|
31
|
+
else
|
|
32
|
+
historyFallback = true;
|
|
33
|
+
}
|
|
34
|
+
const bytes = Buffer.byteLength(seed, 'utf8');
|
|
35
|
+
const digest = createHash('sha256').update(JSON.stringify({ source: slice.digest, seed, mode, turns: options.turns })).digest('hex');
|
|
36
|
+
return { ...slice, seed, bytes, selectedTurns, digest, historyMode: mode,
|
|
37
|
+
requestedTurns: mode === 'full' ? slice.availableTurns : options.turns,
|
|
38
|
+
truncated: selectedTurns < slice.availableTurns, historyFallback };
|
|
39
|
+
}
|
|
40
|
+
export function replacementHistoryNotice(preview) {
|
|
41
|
+
if (!preview.truncated && !preview.historyFallback)
|
|
42
|
+
return;
|
|
43
|
+
if (!preview.selectedTurns)
|
|
44
|
+
return 'No whole recent turn fit the replacement history limit. No earlier history was copied; it remains in the previous member conversation.';
|
|
45
|
+
if (preview.truncated)
|
|
46
|
+
return `Only the most recent ${preview.selectedTurns} of ${preview.availableTurns} turns were copied from the previous member. Earlier turns were not copied; they remain in its conversation.`;
|
|
47
|
+
return `The full history exceeded 512 KiB. All ${preview.selectedTurns} turns were copied as text and tool/file receipts; the full action digest was not copied.`;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=replacementHistory.js.map
|
|
@@ -17,10 +17,11 @@ export declare function releasePlansWatcher(cwd: string): void;
|
|
|
17
17
|
export declare function fsWatchEnsureDir(dir: string): void;
|
|
18
18
|
export declare function flushPlansWatcher(cwd: string, state: PlansWatcher): Promise<void>;
|
|
19
19
|
export declare function broadcastWorkflow(workflowId: string, message: ServerMessage): void;
|
|
20
|
-
export declare const CLUSTER_STATE_TRIGGERS: Set<"error" | "provider_fell_back" | "checkpoint_created" | "turn_changes" | "checkpoint_reverted" | "operator_question" | "operator_question_reply_result" | "operator_question_dismiss_result" | "mcp_registry_snapshot" | "mcp_probe_result" | "mcp_allow_snapshot" | "mcp_malware_warning" | "genesis_seed_updated" | "genesis_assist_started" | "genesis_assist_proposed" | "workflow_cwd_bound" | "genesis_scaffolded" | "genesis_creative_armed" | "genesis_plan_saved" | "computer_context_updated" | "voice_tool_call" | "computer_activity_changed" | "output_saved" | "peer_message_sent" | "peer_message_received" | "peer_send_rejected" | "cluster_snapshot_list" | "cluster_snapshot_saved" | "cluster_snapshot_conflict" | "cluster_snapshot_error" | "workflow_rename_result" | "workflow_renamed" | "cluster_state" | "cluster_not_found" | "cluster_creation_finished" | "cluster_created" | "cluster_deleted" | "cluster_member_added" | "cluster_member_removed" | "cluster_member_replaced" | "cluster_plan_changed" | "codebase_memory_state" | "cluster_broadcast_dispatched" | "cluster_dispatch_result" | "cluster_swarm_created" | "cluster_member_nudged" | "cluster_auto_turn_fired" | "hub_link_status" | "bakeoff_list_result" | "bakeoff_state" | "bakeoff_error" | "bakeoff_attempts_removed" | "review_started" | "review_artifact_ready" | "research_started" | "research_progress" | "research_complete" | "compare_started" | "compare_leg_delta" | "compare_leg_complete" | "compare_complete" | "compare_vote_recorded" | "diagnostics" | "doc_edit_started" | "doc_edit_proposed" | "md_tuneup_candidates" | "md_tuneup_started" | "md_tuneup_proposed" | "md_tuneup_applied" | "md_tuneup_undone" | "knowledge_distill_started" | "knowledge_distill_proposed" | "recall_summary_ready" | "workbench_notice" | "notification_mutes" | "attention_event" | "attention_question_closed" | "handoff_started" | "handoff_artifact_ready" | "handoff_complete" | "handoff_lock_snapshot" | "spawn_from_here_complete" | "live_changes_snapshot" | "storage_warning" | "git_op_result" | "media_stems_result" | "media_op_result" | "terminal_opened" | "terminal_sessions" | "terminal_killed" | "shutdown" | "terminal_command_logged" | "task_ledger_snapshot" | "task_ledger_event" | "cluster_orchestration_assist_started" | "cluster_orchestration_proposal_started" | "cluster_orchestration_proposals_snapshot" | "cluster_orchestration_proposal_proposed" | "cluster_orchestration_proposal_rejected" | "cluster_orchestration_proposal_applied" | "preview_capture_started" | "preview_capture_ready" | "plan_attached" | "plan_detached" | "plan_set" | "plan_exited" | "plan_candidate_ready" | "connected" | "workspace_snapshot" | "workspace_changed" | "workflow_config_synced" | "workflow_created" | "user_message_echo" | "primary_text" | "primary_complete" | "hook_rewrote_input" | "tool_gate_triggered" | "tool_posture_set" | "goal_set" | "goal_run_state" | "pinned_skills_set" | "project_trust_prompt" | "project_trust_set" | "worker_stuck" | "tool_loop_warning" | "file_mutation_queued" | "model_resolved" | "primary_refusal" | "primary_tool_counter" | "sandbox_chunk_added" | "sandbox_db_cleared" | "ctx_action" | "native_compacting" | "native_compacted" | "context_folded" | "tool_filtered" | "tool_evicted" | "primary_turn_token_usage" | "primary_model" | "primary_thinking" | "primary_tool_use" | "primary_activity" | "primary_turn_started" | "primary_turn_ended" | "worker_model" | "worker_spawned" | "worker_text" | "worker_thinking" | "worker_tool_use" | "worker_complete" | "worker_activity" | "worker_error" | "file_uploaded" | "file_context" | "worker_file_context" | "primary_artifact" | "quota_status" | "turn_cancelled" | "conversation_changed" | "provider_conversation_state" | "workflow_state_snapshot" | "workflow_session_metadata" | "replay_batch" | "capabilities_updated" | "capabilities_changed" | "settings_updated" | "session_entry" | "queued_message_edit_result" | "queued_message_cancelled" | "queued_messages_drained" | "system_notice" | "claude_native_question_settled" | "session_history_status" | "codex_token_snapshot" | "gate_required" | "gate_resolved" | "gate_standing" | "preview_set" | "preview_cleared" | "preview_history" | "context_usage" | "ultracode_fleet_progress" | "context_budget" | "operator_label" | "queue_update" | "todos_updated" | "task_started" | "task_status" | "branch_summary" | "leaf_move" | "app_update_available" | "turn_messages_delivered">;
|
|
20
|
+
export declare const CLUSTER_STATE_TRIGGERS: Set<"error" | "provider_fell_back" | "checkpoint_created" | "turn_changes" | "checkpoint_reverted" | "operator_question" | "operator_question_reply_result" | "operator_question_dismiss_result" | "mcp_registry_snapshot" | "mcp_probe_result" | "mcp_allow_snapshot" | "mcp_malware_warning" | "genesis_seed_updated" | "genesis_assist_started" | "genesis_assist_proposed" | "workflow_cwd_bound" | "genesis_scaffolded" | "genesis_creative_armed" | "genesis_plan_saved" | "computer_context_updated" | "voice_tool_call" | "computer_activity_changed" | "output_saved" | "transcript_worker_result" | "peer_message_sent" | "peer_message_received" | "peer_send_rejected" | "cluster_snapshot_list" | "cluster_snapshot_saved" | "cluster_snapshot_conflict" | "cluster_snapshot_error" | "workflow_rename_result" | "workflow_renamed" | "cluster_state" | "cluster_not_found" | "cluster_creation_finished" | "cluster_created" | "cluster_deleted" | "cluster_member_added" | "cluster_member_removed" | "cluster_member_replaced" | "cluster_plan_changed" | "codebase_memory_state" | "cluster_broadcast_dispatched" | "cluster_dispatch_result" | "cluster_swarm_created" | "cluster_member_nudged" | "cluster_auto_turn_fired" | "hub_link_status" | "bakeoff_list_result" | "bakeoff_state" | "bakeoff_error" | "bakeoff_attempts_removed" | "review_started" | "review_artifact_ready" | "research_started" | "research_progress" | "research_complete" | "compare_started" | "compare_leg_delta" | "compare_leg_complete" | "compare_complete" | "compare_vote_recorded" | "diagnostics" | "doc_edit_started" | "doc_edit_proposed" | "md_tuneup_candidates" | "md_tuneup_started" | "md_tuneup_proposed" | "md_tuneup_applied" | "md_tuneup_undone" | "knowledge_distill_started" | "knowledge_distill_proposed" | "recall_summary_ready" | "workbench_notice" | "notification_mutes" | "attention_event" | "attention_question_closed" | "handoff_started" | "handoff_artifact_ready" | "handoff_complete" | "handoff_lock_snapshot" | "spawn_from_here_complete" | "live_changes_snapshot" | "storage_warning" | "git_op_result" | "media_stems_result" | "media_op_result" | "terminal_opened" | "terminal_sessions" | "terminal_killed" | "shutdown" | "terminal_command_logged" | "task_ledger_snapshot" | "task_ledger_event" | "cluster_orchestration_assist_started" | "cluster_orchestration_proposal_started" | "cluster_orchestration_proposals_snapshot" | "cluster_orchestration_proposal_proposed" | "cluster_orchestration_proposal_rejected" | "cluster_orchestration_proposal_applied" | "preview_capture_started" | "preview_capture_ready" | "plan_attached" | "plan_detached" | "plan_set" | "plan_exited" | "plan_candidate_ready" | "connected" | "workspace_snapshot" | "workspace_changed" | "workflow_config_synced" | "workflow_created" | "user_message_echo" | "primary_text" | "primary_complete" | "hook_rewrote_input" | "tool_gate_triggered" | "tool_posture_set" | "goal_set" | "goal_run_state" | "pinned_skills_set" | "project_trust_prompt" | "project_trust_set" | "worker_stuck" | "tool_loop_warning" | "file_mutation_queued" | "model_resolved" | "primary_refusal" | "primary_tool_counter" | "sandbox_chunk_added" | "sandbox_db_cleared" | "ctx_action" | "native_compacting" | "native_compacted" | "context_folded" | "tool_filtered" | "tool_evicted" | "primary_turn_token_usage" | "primary_model" | "primary_thinking" | "primary_tool_use" | "primary_activity" | "primary_turn_started" | "primary_turn_ended" | "worker_model" | "worker_spawned" | "worker_text" | "worker_thinking" | "worker_tool_use" | "worker_complete" | "worker_activity" | "worker_error" | "file_uploaded" | "file_context" | "worker_file_context" | "primary_artifact" | "quota_status" | "turn_cancelled" | "conversation_changed" | "provider_conversation_state" | "workflow_state_snapshot" | "workflow_session_metadata" | "replay_batch" | "capabilities_updated" | "capabilities_changed" | "settings_updated" | "session_entry" | "queued_message_edit_result" | "queued_message_cancelled" | "queued_messages_drained" | "system_notice" | "claude_native_question_settled" | "session_history_status" | "codex_token_snapshot" | "gate_required" | "gate_resolved" | "gate_standing" | "preview_set" | "preview_cleared" | "preview_history" | "context_usage" | "ultracode_fleet_progress" | "context_budget" | "operator_label" | "queue_update" | "todos_updated" | "task_started" | "task_status" | "branch_summary" | "leaf_move" | "app_update_available" | "turn_messages_delivered">;
|
|
21
21
|
export declare function broadcastCluster(clusterId: string, message: ServerMessage): void;
|
|
22
22
|
export declare function sendWorkflowLive(workflowId: string, message: ServerMessage, sent?: Set<WebSocket>): void;
|
|
23
23
|
export declare function buildClusterStatePayload(clusterId: string): Promise<{
|
|
24
|
+
skillPins?: import('@arco/shared').ClusterSkillPin[];
|
|
24
25
|
clusterId: string;
|
|
25
26
|
cwd: string;
|
|
26
27
|
members: Array<{
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const PREVIEW_NUDGE: string;
|
|
2
2
|
export declare function withPreviewNudge(existing: string | undefined): string;
|
|
3
|
+
export declare function withLocalTurnWaitInstructions(base: string | undefined, role?: string): string;
|
|
3
4
|
export declare function buildLocalClusterSystemPrompt(opts: {
|
|
4
5
|
base?: string;
|
|
5
6
|
clusterPlan?: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { buildTurnWaitInstructions } from '@arco/shared';
|
|
1
2
|
// Tells the agent the operator can see a live iframe of any dev server it
|
|
2
3
|
// runs. Static text — appended verbatim to every primary turn so the prefix
|
|
3
4
|
// cache keeps hitting (Claude / Codex caches; Ollama prefix cache). The
|
|
@@ -13,6 +14,11 @@ export const PREVIEW_NUDGE = [
|
|
|
13
14
|
export function withPreviewNudge(existing) {
|
|
14
15
|
return existing && existing.length > 0 ? `${PREVIEW_NUDGE}\n\n${existing}` : PREVIEW_NUDGE;
|
|
15
16
|
}
|
|
17
|
+
// Local baselines are role-neutral. Add the wait rule once, after the turn's
|
|
18
|
+
// membership is resolved, before wrapping any cluster coordination around it.
|
|
19
|
+
export function withLocalTurnWaitInstructions(base, role) {
|
|
20
|
+
return [buildTurnWaitInstructions(role), base].filter(Boolean).join('\n\n');
|
|
21
|
+
}
|
|
16
22
|
export function buildLocalClusterSystemPrompt(opts) {
|
|
17
23
|
const localBlocks = [];
|
|
18
24
|
localBlocks.push([
|
|
@@ -59,7 +65,6 @@ export const OLLAMA_PRIMARY_SYSTEM_PROMPT = [
|
|
|
59
65
|
'When the operator asks about the project, start by exploring (Glob the top-level files, Read the README or CLAUDE.md, Grep for relevant terms) before answering. When they ask about something specific, go straight to the file.',
|
|
60
66
|
'Be concise. Default to plain prose. Only use headers, tables, or executive-summary formatting when the operator explicitly asks for that format.',
|
|
61
67
|
'Honor the safety reminders appended to each user message: cap unknown-size shell output, no `find /` without `-maxdepth`, no unbounded scans.',
|
|
62
|
-
'Finishing the request does not mean waiting for it: do not sleep or poll for more than 60 seconds at a time for builds, test suites or CI; report what is running and end the turn.',
|
|
63
68
|
].join(' ');
|
|
64
69
|
// llama.cpp-specific system prompt. Same baseline as Ollama plus extra
|
|
65
70
|
// directives tuned for Qwen3.6's specific failure modes observed in real
|
|
@@ -15,4 +15,4 @@ export declare function loadSessionJsonl(path: string): Promise<{
|
|
|
15
15
|
entries: SessionJsonlEntry[];
|
|
16
16
|
byteLength: number;
|
|
17
17
|
}>;
|
|
18
|
-
export declare function watchSessionJsonl(path: string, initialOffset: number, onEntry: (entry: SessionJsonlEntry) => void): () => void;
|
|
18
|
+
export declare function watchSessionJsonl(path: string, initialOffset: number | null, onEntry: (entry: SessionJsonlEntry) => void): () => void;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { watch } from 'fs';
|
|
2
|
-
import {
|
|
3
|
-
import { join, resolve } from 'path';
|
|
1
|
+
import { watch, statSync } from 'fs';
|
|
2
|
+
import { open } from 'fs/promises';
|
|
3
|
+
import { basename, dirname, join, resolve } from 'path';
|
|
4
4
|
import { homedir } from 'os';
|
|
5
|
+
import { jsonlLines } from './jsonlLines.js';
|
|
5
6
|
export function resolveSessionJsonlPath(cwd, sessionId) {
|
|
6
7
|
// Claude's CLI encodes cwd by replacing any non-[A-Za-z0-9-] char with '-',
|
|
7
8
|
// not just '/'. So `/home/operator/Projects/Sample_Project` becomes
|
|
@@ -21,30 +22,64 @@ export function resolveSubagentsWorkflowsDir(cwd, sessionId) {
|
|
|
21
22
|
return join(homedir(), '.claude', 'projects', encoded, sessionId, 'subagents', 'workflows');
|
|
22
23
|
}
|
|
23
24
|
export async function loadSessionJsonl(path) {
|
|
24
|
-
let
|
|
25
|
+
let fh;
|
|
25
26
|
try {
|
|
26
|
-
|
|
27
|
+
fh = await open(path, 'r');
|
|
27
28
|
}
|
|
28
|
-
catch {
|
|
29
|
-
|
|
29
|
+
catch (err) {
|
|
30
|
+
if (err.code === 'ENOENT')
|
|
31
|
+
return { entries: [], byteLength: 0 };
|
|
32
|
+
throw err;
|
|
30
33
|
}
|
|
31
34
|
const entries = [];
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
let complete = 0;
|
|
36
|
+
try {
|
|
37
|
+
const size = (await fh.stat()).size;
|
|
38
|
+
async function* chunks() {
|
|
39
|
+
for (let position = 0; position < size;) {
|
|
40
|
+
const buffer = Buffer.alloc(Math.min(64 * 1024, size - position));
|
|
41
|
+
const { bytesRead } = await fh.read(buffer, 0, buffer.length, position);
|
|
42
|
+
if (!bytesRead)
|
|
43
|
+
break;
|
|
44
|
+
const chunk = buffer.subarray(0, bytesRead);
|
|
45
|
+
const newline = chunk.lastIndexOf(0x0a);
|
|
46
|
+
if (newline >= 0)
|
|
47
|
+
complete = position + newline + 1;
|
|
48
|
+
position += bytesRead;
|
|
49
|
+
yield chunk;
|
|
50
|
+
}
|
|
40
51
|
}
|
|
41
|
-
|
|
52
|
+
for await (const line of jsonlLines(chunks(), path, { finalLine: false, carriageReturns: false })) {
|
|
53
|
+
if (!line.trim())
|
|
54
|
+
continue;
|
|
55
|
+
try {
|
|
56
|
+
const e = JSON.parse(line);
|
|
57
|
+
if (e && typeof e.type === 'string')
|
|
58
|
+
entries.push(e);
|
|
59
|
+
}
|
|
60
|
+
catch { /* skip malformed lines */ }
|
|
61
|
+
}
|
|
62
|
+
return { entries, byteLength: complete };
|
|
63
|
+
}
|
|
64
|
+
finally {
|
|
65
|
+
await fh.close();
|
|
42
66
|
}
|
|
43
|
-
|
|
67
|
+
}
|
|
68
|
+
async function lastCompleteOffset(fh, size) {
|
|
69
|
+
for (let end = size; end > 0;) {
|
|
70
|
+
const start = Math.max(0, end - 64 * 1024), buffer = Buffer.alloc(end - start);
|
|
71
|
+
const { bytesRead } = await fh.read(buffer, 0, buffer.length, start);
|
|
72
|
+
const newline = buffer.subarray(0, bytesRead).lastIndexOf(0x0a);
|
|
73
|
+
if (newline >= 0)
|
|
74
|
+
return start + newline + 1;
|
|
75
|
+
end = start;
|
|
76
|
+
}
|
|
77
|
+
return 0;
|
|
44
78
|
}
|
|
45
79
|
// Tail the session JSONL for new entries, emitting each one via `onEntry`.
|
|
46
80
|
// `initialOffset` should be the byteLength from loadSessionJsonl so we
|
|
47
|
-
// don't re-emit history.
|
|
81
|
+
// don't re-emit history. Null anchors at the first readable complete boundary
|
|
82
|
+
// after initial loading failed. Returns a dispose function.
|
|
48
83
|
export function watchSessionJsonl(path, initialOffset, onEntry) {
|
|
49
84
|
let lastOffset = initialOffset;
|
|
50
85
|
let active = true;
|
|
@@ -52,6 +87,12 @@ export function watchSessionJsonl(path, initialOffset, onEntry) {
|
|
|
52
87
|
let restartTimer = null;
|
|
53
88
|
let reading = false;
|
|
54
89
|
let requested = false;
|
|
90
|
+
let identity;
|
|
91
|
+
try {
|
|
92
|
+
const st = statSync(path);
|
|
93
|
+
identity = `${st.dev}:${st.ino}`;
|
|
94
|
+
}
|
|
95
|
+
catch { /* not created yet */ }
|
|
55
96
|
const readNew = async () => {
|
|
56
97
|
if (!active)
|
|
57
98
|
return;
|
|
@@ -63,30 +104,59 @@ export function watchSessionJsonl(path, initialOffset, onEntry) {
|
|
|
63
104
|
while (active && requested) {
|
|
64
105
|
requested = false;
|
|
65
106
|
try {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
return;
|
|
69
|
-
if (buf.length < lastOffset)
|
|
70
|
-
lastOffset = 0;
|
|
71
|
-
const end = buf.lastIndexOf(10) + 1;
|
|
72
|
-
if (end <= lastOffset)
|
|
73
|
-
continue;
|
|
74
|
-
const slice = buf.subarray(lastOffset, end).toString('utf-8');
|
|
75
|
-
lastOffset = end;
|
|
76
|
-
for (const line of slice.split('\n')) {
|
|
107
|
+
const fh = await open(path, 'r');
|
|
108
|
+
try {
|
|
77
109
|
if (!active)
|
|
78
110
|
return;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
111
|
+
const st = await fh.stat();
|
|
112
|
+
const nextIdentity = `${st.dev}:${st.ino}`;
|
|
113
|
+
// After an initial-load failure, anchor to the first readable
|
|
114
|
+
// complete boundary. Old terminal rows must not look like new
|
|
115
|
+
// concurrent-session writes; an unfinished last row stays pending.
|
|
116
|
+
if (lastOffset === null) {
|
|
117
|
+
lastOffset = await lastCompleteOffset(fh, st.size);
|
|
118
|
+
identity = nextIdentity;
|
|
84
119
|
}
|
|
85
|
-
|
|
86
|
-
|
|
120
|
+
if ((identity !== undefined && identity !== nextIdentity) || st.size < lastOffset)
|
|
121
|
+
lastOffset = 0;
|
|
122
|
+
identity = nextIdentity;
|
|
123
|
+
const startOffset = lastOffset;
|
|
124
|
+
let completeOffset = startOffset;
|
|
125
|
+
// Read only the appended range. An unfinished record is left at
|
|
126
|
+
// lastOffset and completed by the next notification, as before.
|
|
127
|
+
async function* chunks() {
|
|
128
|
+
for (let position = startOffset; active && position < st.size;) {
|
|
129
|
+
const buffer = Buffer.alloc(Math.min(64 * 1024, st.size - position));
|
|
130
|
+
const { bytesRead } = await fh.read(buffer, 0, buffer.length, position);
|
|
131
|
+
if (!bytesRead)
|
|
132
|
+
break;
|
|
133
|
+
const chunk = buffer.subarray(0, bytesRead);
|
|
134
|
+
const newline = chunk.lastIndexOf(0x0a);
|
|
135
|
+
if (newline >= 0)
|
|
136
|
+
completeOffset = position + newline + 1;
|
|
137
|
+
position += bytesRead;
|
|
138
|
+
yield chunk;
|
|
139
|
+
}
|
|
87
140
|
}
|
|
88
|
-
|
|
89
|
-
|
|
141
|
+
for await (const line of jsonlLines(chunks(), path, { finalLine: false, carriageReturns: false })) {
|
|
142
|
+
if (!active)
|
|
143
|
+
return;
|
|
144
|
+
if (!line.trim())
|
|
145
|
+
continue;
|
|
146
|
+
let e;
|
|
147
|
+
try {
|
|
148
|
+
e = JSON.parse(line);
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
if (e && typeof e.type === 'string')
|
|
154
|
+
onEntry(e);
|
|
155
|
+
}
|
|
156
|
+
lastOffset = completeOffset;
|
|
157
|
+
}
|
|
158
|
+
finally {
|
|
159
|
+
await fh.close();
|
|
90
160
|
}
|
|
91
161
|
}
|
|
92
162
|
catch { /* file unavailable; retry at the next notification */ }
|
|
@@ -112,7 +182,12 @@ export function watchSessionJsonl(path, initialOffset, onEntry) {
|
|
|
112
182
|
if (!active || watcher)
|
|
113
183
|
return;
|
|
114
184
|
try {
|
|
115
|
-
|
|
185
|
+
// Watching the directory survives replacement of the session file;
|
|
186
|
+
// an inode-bound watcher would keep watching the removed file.
|
|
187
|
+
watcher = watch(dirname(path), { persistent: false }, (_event, name) => {
|
|
188
|
+
if (name === null || name === basename(path))
|
|
189
|
+
void readNew();
|
|
190
|
+
});
|
|
116
191
|
void readNew();
|
|
117
192
|
watcher.on('error', () => {
|
|
118
193
|
watcher = null;
|
|
@@ -120,7 +195,7 @@ export function watchSessionJsonl(path, initialOffset, onEntry) {
|
|
|
120
195
|
});
|
|
121
196
|
}
|
|
122
197
|
catch {
|
|
123
|
-
//
|
|
198
|
+
// Session directory not yet created — retry after 2s (happens for brand-new sessions)
|
|
124
199
|
scheduleRestart();
|
|
125
200
|
}
|
|
126
201
|
};
|
|
@@ -215,6 +215,19 @@ export function claudeAdapter(opts = {}) {
|
|
|
215
215
|
},
|
|
216
216
|
};
|
|
217
217
|
}
|
|
218
|
+
// A terminating child can still hold its cwd open on Windows. Allow up to
|
|
219
|
+
// 250 ms for exit, then at most 600 ms of removal retries. Cleanup must never
|
|
220
|
+
// change the evaluator's answer or refusal.
|
|
221
|
+
async function removeEvaluatorFolder(proc, cwd) {
|
|
222
|
+
if (proc.pid && proc.exitCode === null && proc.signalCode === null) {
|
|
223
|
+
await new Promise((resolve) => {
|
|
224
|
+
const done = () => { clearTimeout(timer); proc.off('close', done); resolve(); };
|
|
225
|
+
const timer = setTimeout(done, 250);
|
|
226
|
+
proc.once('close', done);
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
await rm(cwd, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }).catch(() => undefined);
|
|
230
|
+
}
|
|
218
231
|
export function cursorAdapter(opts = {}) {
|
|
219
232
|
// `cursor-agent acp` ignores `--model`; the model is selected over ACP after
|
|
220
233
|
// session/new and confirmed, and the evaluator refuses rather than answer
|
|
@@ -357,7 +370,7 @@ export function cursorAdapter(opts = {}) {
|
|
|
357
370
|
clearTimeout(timer);
|
|
358
371
|
req.signal?.removeEventListener('abort', onAbort);
|
|
359
372
|
stop();
|
|
360
|
-
await
|
|
373
|
+
await removeEvaluatorFolder(proc, cwd);
|
|
361
374
|
}
|
|
362
375
|
},
|
|
363
376
|
};
|
|
@@ -504,7 +517,7 @@ export function codexAdapter(opts = {}) {
|
|
|
504
517
|
clearTimeout(timer);
|
|
505
518
|
req.signal?.removeEventListener('abort', onAbort);
|
|
506
519
|
stop();
|
|
507
|
-
await
|
|
520
|
+
await removeEvaluatorFolder(proc, cwd);
|
|
508
521
|
}
|
|
509
522
|
},
|
|
510
523
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const TRANSCRIPT_WORKER_MAX_BYTES: number;
|
|
2
|
+
export declare const TRANSCRIPT_WORKER_PREFACE_BYTES: number;
|
|
3
|
+
export interface TranscriptSliceOptions {
|
|
4
|
+
turns: number;
|
|
5
|
+
includePartial: boolean;
|
|
6
|
+
preface: string;
|
|
7
|
+
cutoffSeq?: number;
|
|
8
|
+
wasBusy: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function buildTranscriptWorkerSlice(cwd: string, workflowId: string, options: TranscriptSliceOptions): Promise<{
|
|
11
|
+
seed: string;
|
|
12
|
+
bytes: number;
|
|
13
|
+
availableTurns: number;
|
|
14
|
+
selectedTurns: number;
|
|
15
|
+
partialIncluded: boolean;
|
|
16
|
+
cutoffSeq: number;
|
|
17
|
+
digest: string;
|
|
18
|
+
branchKey: string;
|
|
19
|
+
}>;
|
|
20
|
+
export interface TranscriptSelectionPolicy {
|
|
21
|
+
maxBytes: number;
|
|
22
|
+
fitWholeTurns: boolean;
|
|
23
|
+
allTurns?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare function buildTranscriptSlice(cwd: string, workflowId: string, options: TranscriptSliceOptions, policy?: TranscriptSelectionPolicy): Promise<{
|
|
26
|
+
seed: string;
|
|
27
|
+
bytes: number;
|
|
28
|
+
availableTurns: number;
|
|
29
|
+
selectedTurns: number;
|
|
30
|
+
partialIncluded: boolean;
|
|
31
|
+
cutoffSeq: number;
|
|
32
|
+
digest: string;
|
|
33
|
+
branchKey: string;
|
|
34
|
+
}>;
|