arco-workbench 0.2.2 → 0.2.5
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 +1 -1
- package/THIRD_PARTY_NOTICES +2 -2
- package/client/dist/assets/{PhosphorBackdrop-BbR3xmfD.js → PhosphorBackdrop-CLILIwOQ.js} +1 -1
- package/client/dist/assets/{ThemedBackgroundShaderImpl-UMjbs9ZN.js → ThemedBackgroundShaderImpl-B87chcb5.js} +1 -1
- package/client/dist/assets/{XtermView-n135qz-f.js → XtermView-BP_j7WSN.js} +1 -1
- package/client/dist/assets/{galleryEditor-CFSke4by.js → galleryEditor-B90phoBI.js} +1 -1
- package/client/dist/assets/{index-DeoJbjI3.js → index-BfPp1Oup.js} +270 -270
- package/client/dist/index.html +1 -1
- package/client/dist/manifest-mobile.webmanifest +1 -0
- package/client/src/App.tsx +2 -2
- package/client/src/components/AuthReloginNotice.tsx +7 -6
- package/client/src/components/ChatMessage.tsx +41 -29
- package/client/src/components/ChatPanel.tsx +17 -4
- package/client/src/components/ClaudeNativeAccountPicker.tsx +32 -0
- package/client/src/components/ClaudeNativeAuthRow.tsx +71 -19
- package/client/src/components/ClusterRightPanel/AddWorkerSection.tsx +11 -281
- package/client/src/components/ClusterRightPanel/AutoPickupControl.tsx +1 -1
- package/client/src/components/ClusterRightPanel/FreshMemberForm.tsx +315 -0
- package/client/src/components/ClusterRightPanel/ReplaceMemberDialog.tsx +17 -7
- package/client/src/components/ClusterRightPanel/index.tsx +1 -1
- package/client/src/components/ClusterRightPanel/useFreshMemberPicker.ts +6 -4
- package/client/src/components/ClusterTab.tsx +2 -2
- package/client/src/components/Connections/Connections.tsx +7 -11
- package/client/src/components/Connections/model.ts +3 -1
- package/client/src/components/FileViewerModal.tsx +54 -17
- package/client/src/components/GitHubPanel/index.tsx +9 -5
- package/client/src/components/HandoffDialog.tsx +5 -3
- package/client/src/components/MobileShell.tsx +1 -33
- package/client/src/components/OperatorQuestionNotice.tsx +5 -4
- package/client/src/components/ProvidersPopover.tsx +6 -2
- package/client/src/components/RightPanel/ActivityTab.tsx +2 -1
- package/client/src/components/RightPanel/ConfigTab.tsx +23 -5
- package/client/src/components/RightPanel/OutputsPanel.tsx +21 -9
- package/client/src/components/RightPanel/outputsReconcile.ts +31 -0
- package/client/src/components/SettingsPanel.tsx +7 -10
- package/client/src/components/SpawnDialog.tsx +14 -3
- package/client/src/components/TabBar.tsx +2 -2
- package/client/src/components/TabContextMenu.tsx +73 -133
- package/client/src/components/TerminalInput.tsx +4 -3
- package/client/src/components/TranscriptWorkerDialog.tsx +14 -4
- package/client/src/components/UsageBar.tsx +37 -18
- package/client/src/components/WorkflowCreator/ClusterMembersSection.tsx +29 -3
- package/client/src/components/WorkflowCreator/index.tsx +29 -15
- package/client/src/components/WorkflowView.tsx +1 -1
- package/client/src/components/providerIndicator.ts +7 -3
- package/client/src/components/research/QuickResearchOverview.tsx +7 -3
- package/client/src/components/research/SavedQuickKeep.tsx +7 -3
- package/client/src/components/settings/GitHubAuthRow.tsx +34 -0
- package/client/src/explorer/ArtifactsLens.tsx +17 -8
- package/client/src/explorer/ExplorerApp.tsx +3 -3
- package/client/src/explorer/types.ts +3 -1
- package/client/src/help/content/cluster.tsx +10 -4
- package/client/src/help/content/composer.tsx +3 -2
- package/client/src/help/content/header.tsx +6 -3
- package/client/src/help/content/misc.tsx +9 -7
- package/client/src/help/content/rightPanel.tsx +11 -6
- package/client/src/help/content/settings.tsx +14 -3
- package/client/src/help/content/tabbar.tsx +1 -1
- package/client/src/help/manualSections/actions.tsx +5 -1
- package/client/src/help/manualSections/clusters.tsx +21 -15
- package/client/src/help/manualSections/configuration.tsx +6 -4
- package/client/src/help/manualSections/gettingStarted.tsx +4 -2
- package/client/src/help/manualSections/maintenance.tsx +24 -0
- package/client/src/help/manualSections/powerFeatures.tsx +4 -2
- package/client/src/help/manualSections/providers.tsx +11 -4
- package/client/src/help/manualSections/workspace.tsx +3 -3
- package/client/src/hooks/useClaudeNativeCatalog.ts +26 -0
- package/client/src/hooks/useClaudeNativeLogin.ts +16 -11
- package/client/src/hooks/useWebSocket.ts +4 -2
- package/client/src/layout/layoutRange.ts +14 -5
- package/client/src/main.tsx +2 -0
- package/client/src/questions/waitingQuestion.ts +2 -0
- package/client/src/stores/appStore.ts +5 -1
- package/client/src/stores/appStore.types.ts +2 -0
- package/client/src/stores/replayContext.ts +20 -0
- package/client/src/utils/chatFileLinks.ts +34 -3
- package/client/src/utils/claudeAuth.ts +9 -1
- package/client/src/ws/handleServerMessage.ts +11 -3
- package/docs/ARCHITECTURE.md +3 -3
- package/docs/BACKUP.md +1 -1
- package/docs/CHECKPOINTS.md +67 -3
- package/docs/CLIENT.md +11 -6
- package/docs/EXTENDING.md +1 -1
- package/docs/FEATURES.md +3 -3
- package/docs/GETTING_STARTED.md +5 -4
- package/docs/GIT_WORKBENCH.md +8 -0
- package/docs/GLOSSARY.md +2 -2
- package/docs/GOTCHAS.md +4 -4
- package/docs/HTTP_API.md +63 -30
- package/docs/OPERATIONS.md +11 -0
- package/docs/OPERATOR_ACTIONS.md +2 -2
- package/docs/OUTPUTS.md +48 -6
- package/docs/PERSISTENCE.md +1 -1
- package/docs/PRIMITIVES.md +4 -2
- package/docs/PROTOCOL_CLUSTER.md +12 -6
- package/docs/PROTOCOL_PRIMITIVES.md +1 -1
- package/docs/PROVIDERS.md +47 -10
- package/docs/RESEARCH.md +3 -3
- package/docs/SETTINGS.md +9 -4
- package/node_modules/@arco/shared/dist/protocol/clusters.d.ts +15 -3
- package/node_modules/@arco/shared/dist/protocol/clusters.js +1 -1
- package/node_modules/@arco/shared/dist/protocol/models.d.ts +6 -1
- package/node_modules/@arco/shared/dist/protocol/operatorQuestions.d.ts +2 -1
- package/node_modules/@arco/shared/dist/protocol/settings.d.ts +3 -0
- package/node_modules/@arco/shared/dist/protocol/settings.js +5 -0
- package/node_modules/@arco/shared/dist/protocol/workflows.d.ts +1 -0
- package/node_modules/@arco/shared/dist/protocol/workflows.js +0 -2
- package/node_modules/@arco/shared/package.json +1 -1
- package/package.json +2 -2
- package/scripts/packaging/services.mjs +20 -1
- package/scripts/packaging/update.mjs +37 -2
- package/server/dist/attention.d.ts +6 -0
- package/server/dist/attention.js +6 -0
- package/server/dist/auth.d.ts +5 -0
- package/server/dist/auth.js +31 -20
- package/server/dist/clusterAutoTurn.d.ts +5 -1
- package/server/dist/clusterAutoTurn.js +31 -9
- package/server/dist/clusterPresets.js +3 -3
- package/server/dist/effortValidation.d.ts +2 -2
- package/server/dist/effortValidation.js +4 -4
- package/server/dist/explorerArtifacts.d.ts +1 -0
- package/server/dist/explorerArtifacts.js +12 -1
- package/server/dist/explorerDocs.d.ts +1 -0
- package/server/dist/explorerDocs.js +4 -4
- package/server/dist/geminiMembers.d.ts +7 -1
- package/server/dist/geminiMembers.js +28 -14
- package/server/dist/gitSnapshots.d.ts +1 -0
- package/server/dist/gitSnapshots.js +547 -83
- package/server/dist/http/clusterRoutes.js +9 -3
- package/server/dist/http/conversationFiles.d.ts +36 -0
- package/server/dist/http/conversationFiles.js +222 -0
- package/server/dist/http/fileBytes.d.ts +3 -0
- package/server/dist/http/fileBytes.js +33 -0
- package/server/dist/http/fileContentRoute.d.ts +2 -0
- package/server/dist/http/fileContentRoute.js +139 -0
- package/server/dist/http/fileRead.d.ts +54 -2
- package/server/dist/http/fileRead.js +31 -24
- package/server/dist/http/outputRoutes.js +14 -21
- package/server/dist/http/readConfinement.d.ts +0 -11
- package/server/dist/http/readConfinement.js +4 -30
- package/server/dist/http/router.js +41 -66
- package/server/dist/index.js +26 -12
- package/server/dist/management/initHubLink.js +1 -1
- package/server/dist/outputs.js +8 -0
- package/server/dist/primitives/exportContext.d.ts +2 -0
- package/server/dist/primitives/exportContext.js +13 -2
- package/server/dist/primitives/runCompare.d.ts +7 -1
- package/server/dist/primitives/runCompare.js +44 -20
- package/server/dist/project/taskLedger.js +46 -34
- package/server/dist/providerAccounts.d.ts +4 -0
- package/server/dist/providerAccounts.js +20 -1
- package/server/dist/providers/antigravity/artifacts.d.ts +23 -0
- package/server/dist/providers/antigravity/artifacts.js +140 -0
- package/server/dist/providers/antigravity/index.js +85 -7
- package/server/dist/providers/antigravity/questions.d.ts +2 -0
- package/server/dist/providers/antigravity/questions.js +58 -0
- package/server/dist/providers/claude-native/auth.d.ts +9 -8
- package/server/dist/providers/claude-native/auth.js +50 -58
- package/server/dist/providers/claude-native/authStatus.d.ts +2 -2
- package/server/dist/providers/claude-native/authStatus.js +9 -7
- package/server/dist/providers/claude-native/catalog.d.ts +6 -5
- package/server/dist/providers/claude-native/catalog.js +50 -39
- package/server/dist/providers/claude-native/oauth.d.ts +10 -9
- package/server/dist/providers/claude-native/oauth.js +120 -96
- package/server/dist/providers/claude-native/worker.d.ts +1 -0
- package/server/dist/providers/claude-native/worker.js +38 -23
- package/server/dist/providers/codex-appserver/operatorQuestions.d.ts +5 -3
- package/server/dist/providers/codex-appserver/operatorQuestions.js +27 -13
- package/server/dist/providers/codexChatBoundary.js +6 -1
- package/server/dist/research/quickPromotion.d.ts +3 -0
- package/server/dist/research/quickPromotion.js +26 -9
- package/server/dist/research/savedQuickPromotion.js +2 -11
- package/server/dist/server/broadcast.js +6 -0
- package/server/dist/settings.d.ts +1 -0
- package/server/dist/settings.js +39 -7
- package/server/dist/skills.js +1 -1
- package/server/dist/smartPickupAdapters.d.ts +1 -0
- package/server/dist/smartPickupAdapters.js +2 -2
- package/server/dist/smartPickupObserver.js +8 -5
- package/server/dist/thirdPartySkills.js +11 -5
- package/server/dist/turnChanges.d.ts +1 -1
- package/server/dist/turnChanges.js +5 -4
- package/server/dist/usage.d.ts +1 -1
- package/server/dist/usage.js +39 -27
- package/server/dist/workers/WorkerManager.d.ts +1 -0
- package/server/dist/workers/WorkerManager.js +1 -0
- package/server/dist/workers/processKill.js +37 -24
- package/server/dist/workflowMeta.js +2 -2
- package/server/dist/ws/clusterHandlers.d.ts +2 -2
- package/server/dist/ws/clusterHandlers.js +127 -113
- package/server/dist/ws/clusterMembers.d.ts +1 -1
- package/server/dist/ws/clusterMembers.js +34 -4
- package/server/dist/ws/compactHandlers.js +30 -14
- package/server/dist/ws/compareHandlers.js +53 -21
- package/server/dist/ws/gateHandlers.js +2 -0
- package/server/dist/ws/genesisHandlers.js +5 -3
- package/server/dist/ws/handoffHandlers.d.ts +1 -1
- package/server/dist/ws/handoffHandlers.js +115 -39
- package/server/dist/ws/transcriptWorkerHandlers.js +7 -2
- package/server/dist/ws/turnEngine.js +37 -19
- package/server/dist/ws/updatePrimaryConfig.d.ts +3 -2
- package/server/dist/ws/updatePrimaryConfig.js +236 -133
- package/server/dist/ws/workflowHandlers.js +21 -4
- package/server/package.json +1 -1
- package/server/src/attention.ts +7 -0
- package/server/src/auth.ts +33 -20
- package/server/src/clusterAutoTurn.ts +31 -11
- package/server/src/clusterPresets.ts +2 -2
- package/server/src/effortValidation.ts +4 -4
- package/server/src/explorerArtifacts.ts +12 -1
- package/server/src/explorerDocs.ts +5 -5
- package/server/src/geminiMembers.ts +26 -15
- package/server/src/gitSnapshots.ts +538 -82
- package/server/src/http/clusterRoutes.ts +10 -3
- package/server/src/http/conversationFiles.ts +231 -0
- package/server/src/http/fileBytes.ts +34 -0
- package/server/src/http/fileContentRoute.ts +123 -0
- package/server/src/http/fileRead.ts +30 -25
- package/server/src/http/outputRoutes.ts +13 -13
- package/server/src/http/readConfinement.ts +3 -30
- package/server/src/http/router.ts +39 -62
- package/server/src/index.ts +27 -18
- package/server/src/management/initHubLink.ts +1 -1
- package/server/src/outputs.ts +8 -0
- package/server/src/primitives/exportContext.ts +14 -2
- package/server/src/primitives/runCompare.ts +73 -46
- package/server/src/project/taskLedger.ts +47 -30
- package/server/src/providerAccounts.ts +20 -1
- package/server/src/providers/antigravity/artifacts.ts +121 -0
- package/server/src/providers/antigravity/index.ts +64 -6
- package/server/src/providers/antigravity/questions.ts +52 -0
- package/server/src/providers/claude-native/auth.ts +45 -60
- package/server/src/providers/claude-native/authStatus.ts +9 -8
- package/server/src/providers/claude-native/catalog.ts +52 -35
- package/server/src/providers/claude-native/oauth.ts +101 -77
- package/server/src/providers/claude-native/worker.ts +38 -22
- package/server/src/providers/codex-appserver/operatorQuestions.ts +26 -12
- package/server/src/providers/codexChatBoundary.ts +6 -1
- package/server/src/research/quickPromotion.ts +24 -6
- package/server/src/research/savedQuickPromotion.ts +2 -8
- package/server/src/server/broadcast.ts +4 -0
- package/server/src/settings.ts +36 -8
- package/server/src/skills.ts +1 -1
- package/server/src/smartPickupAdapters.ts +3 -2
- package/server/src/smartPickupObserver.ts +8 -5
- package/server/src/thirdPartySkills.ts +11 -5
- package/server/src/turnChanges.ts +5 -4
- package/server/src/usage.ts +30 -22
- package/server/src/workers/WorkerManager.ts +2 -0
- package/server/src/workers/processKill.ts +37 -23
- package/server/src/workflowMeta.ts +2 -2
- package/server/src/ws/clusterHandlers.ts +107 -104
- package/server/src/ws/clusterMembers.ts +25 -6
- package/server/src/ws/compactHandlers.ts +29 -15
- package/server/src/ws/compareHandlers.ts +59 -25
- package/server/src/ws/gateHandlers.ts +2 -0
- package/server/src/ws/genesisHandlers.ts +5 -4
- package/server/src/ws/handoffHandlers.ts +105 -37
- package/server/src/ws/transcriptWorkerHandlers.ts +6 -2
- package/server/src/ws/turnEngine.ts +36 -18
- package/server/src/ws/updatePrimaryConfig.ts +230 -132
- package/server/src/ws/workflowHandlers.ts +20 -4
- package/shared/dist/protocol/clusters.d.ts +15 -3
- package/shared/dist/protocol/clusters.js +1 -1
- package/shared/dist/protocol/models.d.ts +6 -1
- package/shared/dist/protocol/operatorQuestions.d.ts +2 -1
- package/shared/dist/protocol/settings.d.ts +3 -0
- package/shared/dist/protocol/settings.js +5 -0
- package/shared/dist/protocol/workflows.d.ts +1 -0
- package/shared/dist/protocol/workflows.js +0 -2
- package/shared/src/protocol/clusters.ts +23 -5
- package/shared/src/protocol/compare.ts +2 -2
- package/shared/src/protocol/models.ts +8 -4
- package/shared/src/protocol/operatorQuestions.ts +2 -1
- package/shared/src/protocol/settings.ts +8 -1
- package/shared/src/protocol/workflows.ts +1 -1
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
// Owns the request → fan-out, the operator vote, the operator-chosen synthesize
|
|
5
5
|
// follow-up, and cancel. The bounded-job fan-out itself lives in
|
|
6
6
|
// server/src/primitives/runCompare.ts (modeled on runReviewer/runResearch).
|
|
7
|
-
import { COMPARE_MIN_LEGS, COMPARE_MAX_LEGS, TERMINAL_CODEX_ACCOUNT } from '@arco/shared';
|
|
7
|
+
import { COMPARE_MIN_LEGS, COMPARE_MAX_LEGS, DEFAULT_CLAUDE_NATIVE_ACCOUNT, isClaudeNativeProfileId, TERMINAL_CODEX_ACCOUNT } from '@arco/shared';
|
|
8
8
|
import { send } from '../server/broadcast.js';
|
|
9
9
|
import { workflows } from '../server/state.js';
|
|
10
|
-
import { resolveProviderAccount } from '../providerAccounts.js';
|
|
11
|
-
import { buildReplyDraftTask, runCompare } from '../primitives/runCompare.js';
|
|
10
|
+
import { requireClaudeNativeAccount, resolveProviderAccount } from '../providerAccounts.js';
|
|
11
|
+
import { buildReplyDraftTask, runCompare, spawnCompareLeg } from '../primitives/runCompare.js';
|
|
12
|
+
import { resolveClaudeTransport } from '../claudeTransport.js';
|
|
12
13
|
// Active races, keyed by compareId. Kept alive after the race settles so the
|
|
13
14
|
// operator vote can resolve the winning leg's identity and the optional
|
|
14
15
|
// synthesize follow-up can seed one more bounded leg with every answer. The
|
|
@@ -31,6 +32,18 @@ export async function resolveCompareLegs(legs, resolve, fallbackRef) {
|
|
|
31
32
|
}));
|
|
32
33
|
return { resolvedLegs: resolutions.map(result => result.leg), codexHomes: resolutions.map(result => result.codexHome) };
|
|
33
34
|
}
|
|
35
|
+
async function resolveCompareClaudeLeg(leg, parentClaudeRef, parentNativeRef) {
|
|
36
|
+
if (leg.provider !== 'claude')
|
|
37
|
+
return leg;
|
|
38
|
+
const ref = leg.providerAccountRef ?? parentNativeRef;
|
|
39
|
+
// An old CLI label or the tab's parked Native choice on CLI is not an
|
|
40
|
+
// account selection for a Native request. An unavailable Native binding
|
|
41
|
+
// must instead be refused, including a legacy label on a Native tab.
|
|
42
|
+
const parked = !parentNativeRef && ref === parentClaudeRef;
|
|
43
|
+
const native = ref !== undefined && !parked
|
|
44
|
+
&& (ref === parentNativeRef || ref === DEFAULT_CLAUDE_NATIVE_ACCOUNT || isClaudeNativeProfileId(ref));
|
|
45
|
+
return { ...leg, providerAccountRef: native ? await requireClaudeNativeAccount(ref) : undefined };
|
|
46
|
+
}
|
|
34
47
|
// Fan ONE prompt out to N read-only legs. Resolves each leg's config like the
|
|
35
48
|
// reviewer/research paths (Codex legs get their account routed), clamps the leg
|
|
36
49
|
// count, and hands off to runCompare. Returns immediately; per-leg streaming +
|
|
@@ -60,14 +73,34 @@ export async function handleCompareRequest(ws, session, msg) {
|
|
|
60
73
|
send(ws, { type: 'error', message: `Compare needs at least ${COMPARE_MIN_LEGS} legs.` });
|
|
61
74
|
return;
|
|
62
75
|
}
|
|
63
|
-
// Resolve
|
|
64
|
-
//
|
|
76
|
+
// Resolve all bindings before dispatch. Only a matching provider may
|
|
77
|
+
// inherit the parent tab's account.
|
|
78
|
+
let selectedLegs;
|
|
79
|
+
try {
|
|
80
|
+
const parentClaudeRef = wf.primary.provider === 'claude' && legs.some(leg => leg.provider === 'claude')
|
|
81
|
+
? wf.config.providerAccountRef : undefined;
|
|
82
|
+
const parentNativeRef = parentClaudeRef && await resolveClaudeTransport(wf, cwd) === 'native'
|
|
83
|
+
? parentClaudeRef : undefined;
|
|
84
|
+
selectedLegs = await Promise.all(legs.map(leg => resolveCompareClaudeLeg(leg, parentClaudeRef, parentNativeRef)));
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
send(ws, { type: 'error', workflowId: msg.workflowId,
|
|
88
|
+
message: err instanceof Error ? err.message : 'The selected Claude Native account is unavailable.' });
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (replyDraft && msg.fileAccess && selectedLegs.some(leg => leg.provider === 'claude' && leg.providerAccountRef)) {
|
|
92
|
+
send(ws, { type: 'error', workflowId: msg.workflowId,
|
|
93
|
+
message: 'Second Opinion with a Claude Native account uses text only. Turn off Let the models read project files and try again.' });
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
65
96
|
let resolved;
|
|
66
97
|
try {
|
|
67
|
-
|
|
98
|
+
const codexFallback = wf.primary.provider === 'codex' ? wf.config.providerAccountRef : undefined;
|
|
99
|
+
resolved = await resolveCompareLegs(selectedLegs, ref => resolveProviderAccount('codex', ref, cwd), codexFallback);
|
|
68
100
|
}
|
|
69
101
|
catch {
|
|
70
|
-
send(ws, { type: 'error',
|
|
102
|
+
send(ws, { type: 'error', workflowId: msg.workflowId,
|
|
103
|
+
message: 'A selected Codex account is unavailable. Check the account and try again.' });
|
|
71
104
|
return;
|
|
72
105
|
}
|
|
73
106
|
const { resolvedLegs, codexHomes } = resolved;
|
|
@@ -134,7 +167,7 @@ export async function handleCompareSynthesize(ws, msg) {
|
|
|
134
167
|
send(ws, { type: 'error', message: 'Synthesize references an out-of-range leg.' });
|
|
135
168
|
return;
|
|
136
169
|
}
|
|
137
|
-
|
|
170
|
+
let synthLeg = rec.legs[idx];
|
|
138
171
|
// Seed the synthesizer with the prompt + every (non-empty) answer, labeled by
|
|
139
172
|
// their position. No cross-leg session — this is a fresh bounded leg whose
|
|
140
173
|
// ENTIRE input is this assembled brief.
|
|
@@ -144,13 +177,17 @@ export async function handleCompareSynthesize(ws, msg) {
|
|
|
144
177
|
.join('\n\n');
|
|
145
178
|
const synthPrompt = `You are synthesizing the single best ${rec.task ? 'reply (written to the worker, ready to paste)' : 'response'} to a prompt from several independent answers below. Read them all, keep what each got right, drop what's wrong or redundant, and write ONE improved, self-contained answer. Do not mention that you are merging answers — just produce the best response.\n\n--- ORIGINAL PROMPT ---\n\n${rec.task ?? rec.prompt}\n\n--- CANDIDATE ANSWERS ---\n\n${answersBlock}`;
|
|
146
179
|
let codexHome;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
180
|
+
if (synthLeg.provider === 'codex') {
|
|
181
|
+
try {
|
|
182
|
+
const resolved = await resolveCompareLegs([synthLeg], ref => resolveProviderAccount('codex', ref, cwd));
|
|
183
|
+
synthLeg = resolved.resolvedLegs[0];
|
|
184
|
+
codexHome = resolved.codexHomes[0];
|
|
185
|
+
}
|
|
186
|
+
catch {
|
|
187
|
+
send(ws, { type: 'error', workflowId: msg.workflowId,
|
|
188
|
+
message: 'The selected Codex account is unavailable. Check the account and try again.' });
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
154
191
|
}
|
|
155
192
|
// Spawn directly (not via runCompare) so we can stamp the synthesis pane index
|
|
156
193
|
// and reuse the SAME compareId for the events. Mirrors runCompare's leg spawn:
|
|
@@ -163,7 +200,7 @@ export async function handleCompareSynthesize(ws, msg) {
|
|
|
163
200
|
type: 'compare_leg_delta', workflowId: msg.workflowId, compareId: msg.compareId,
|
|
164
201
|
legIndex: synthLegIndex, text: '',
|
|
165
202
|
});
|
|
166
|
-
|
|
203
|
+
spawnCompareLeg({ cwd, workflowId: msg.workflowId, manager: wf.manager }, synthLeg, { id: legId, task: synthPrompt, codexHome }, (ev) => {
|
|
167
204
|
if (ev.type === 'worker_text') {
|
|
168
205
|
collected += ev.text;
|
|
169
206
|
send(ws, { type: 'compare_leg_delta', workflowId: msg.workflowId, compareId: msg.compareId, legIndex: synthLegIndex, text: ev.text });
|
|
@@ -171,11 +208,6 @@ export async function handleCompareSynthesize(ws, msg) {
|
|
|
171
208
|
else if (ev.type === 'worker_system_notice') {
|
|
172
209
|
send(ws, { type: 'system_notice', workflowId: msg.workflowId, content: ev.notice, authRecovery: ev.authRecovery });
|
|
173
210
|
}
|
|
174
|
-
}, {
|
|
175
|
-
cwd, workflowId: msg.workflowId,
|
|
176
|
-
skipPermissions: synthLeg.provider === 'ollama',
|
|
177
|
-
sandbox: 'read-only', outputStyle: 'normal',
|
|
178
|
-
...(synthLeg.provider === 'codex' && codexHome ? { providerAccountRef: synthLeg.providerAccountRef, codexHome } : {}),
|
|
179
211
|
}).then((r) => {
|
|
180
212
|
send(ws, {
|
|
181
213
|
type: 'compare_leg_complete', workflowId: msg.workflowId, compareId: msg.compareId,
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
// (the approve click), deterministic, logged, and reversible → within the
|
|
19
19
|
// fence. The discontinuity is documented in docs/GOTCHAS.md.
|
|
20
20
|
import { workflows } from '../server/state.js';
|
|
21
|
+
import { acknowledgeSighting } from '../attention.js';
|
|
21
22
|
import { broadcastWorkflow } from '../server/broadcast.js';
|
|
22
23
|
import { handleUserMessage } from './turnEngine.js';
|
|
23
24
|
import { readGateStore, clearPendingGate, removeStandingApproval } from '../providers/claude-native/gateStore.js';
|
|
@@ -55,6 +56,7 @@ export async function rehydrateGatesOnce(workflowId, cwd) {
|
|
|
55
56
|
if (!store || store.pending.length === 0)
|
|
56
57
|
return;
|
|
57
58
|
for (const g of store.pending) {
|
|
59
|
+
acknowledgeSighting(g.gateId);
|
|
58
60
|
console.log(`[arco] [${workflowId.slice(0, 8)}] re-surfacing pending review gate ${g.gateId.slice(0, 8)} after restart`);
|
|
59
61
|
broadcastWorkflow(workflowId, {
|
|
60
62
|
type: 'gate_required',
|
|
@@ -26,6 +26,7 @@ import { initWorkflowStore, flushWorkflowBuffer, forgetWorkflowBuffer } from '..
|
|
|
26
26
|
import { rememberCwd } from '../crashRecovery.js';
|
|
27
27
|
import { createPlan, recordAttachment } from '../planStore.js';
|
|
28
28
|
import { resolveProviderAccount } from '../providerAccounts.js';
|
|
29
|
+
import { effectiveClaudeTransport } from '../claudeTransport.js';
|
|
29
30
|
import { readSettings } from '../settings.js';
|
|
30
31
|
import { assessGenesisReadiness } from '../genesis/stages.js';
|
|
31
32
|
import { nextFieldPrompt } from '../genesis/prompts.js';
|
|
@@ -376,9 +377,7 @@ export async function handleGenesisAssistRequest(ws, msg) {
|
|
|
376
377
|
? await resolveProviderAccount('codex', wf.config.providerAccountRef, cwd).catch(() => null)
|
|
377
378
|
: null;
|
|
378
379
|
const cascade = await readSettings(cwd).catch(() => null);
|
|
379
|
-
const claudeTransport = wf.config
|
|
380
|
-
? wf.config.claudeTransport
|
|
381
|
-
: cascade?.claude?.transport === 'native' ? 'native' : 'cli';
|
|
380
|
+
const claudeTransport = effectiveClaudeTransport(wf.config, cascade);
|
|
382
381
|
const codexTransport = wf.config.codexTransport === 'appserver' || wf.config.codexTransport === 'exec'
|
|
383
382
|
? wf.config.codexTransport
|
|
384
383
|
: cascade?.codex?.transport === 'appserver' ? 'appserver' : 'exec';
|
|
@@ -406,6 +405,9 @@ export async function handleGenesisAssistRequest(ws, msg) {
|
|
|
406
405
|
skipPermissions: wf.primary.provider === 'ollama',
|
|
407
406
|
outputStyle: 'normal',
|
|
408
407
|
...(wf.primary.provider === 'claude' ? { claudeTransport } : {}),
|
|
408
|
+
...(wf.primary.provider === 'claude' && claudeTransport === 'native'
|
|
409
|
+
? { providerAccountRef: wf.config.providerAccountRef }
|
|
410
|
+
: {}),
|
|
409
411
|
...(wf.primary.provider === 'codex' ? { codexTransport, codexContextPolicy: wf.config.codexContextPolicy } : {}),
|
|
410
412
|
...(wf.primary.provider === 'codex' && account
|
|
411
413
|
? { providerAccountRef: account.profile.id, codexHome: account.codexHome }
|
|
@@ -10,7 +10,7 @@ export interface HandoffHandlerDeps {
|
|
|
10
10
|
assertAllMembersClaudeOrCodex: (memberIds: string[]) => Promise<string | null>;
|
|
11
11
|
}
|
|
12
12
|
export declare function initHandoffHandlers(d: HandoffHandlerDeps): void;
|
|
13
|
-
export declare function handleHandoffRequest(ws: WebSocket, session: Session, msg: import('@arco/shared').HandoffRequestMessage): Promise<{
|
|
13
|
+
export declare function handleHandoffRequest(ws: WebSocket, session: Session, msg: import('@arco/shared').HandoffRequestMessage, operatorRequested?: boolean): Promise<{
|
|
14
14
|
artifactName: string;
|
|
15
15
|
} | void>;
|
|
16
16
|
/** Reasons a spawn-into-cluster identity is refused before anything is created; null when it is fine. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { geminiClusterInstructions } from '../geminiMembers.js';
|
|
1
2
|
import { allowedWorkflowEfforts, normalizedWorkflowEffort } from '../effortValidation.js';
|
|
2
3
|
import * as directorContinue from '../directorContinue.js';
|
|
3
4
|
import { runningCodexLateCommands } from '../providers/codex-appserver/index.js';
|
|
@@ -28,7 +29,7 @@ import { nextFieldPrompt } from '../genesis/prompts.js';
|
|
|
28
29
|
import { readPlanSummary, recordAttachment, } from '../planStore.js';
|
|
29
30
|
import { runExportContext } from '../primitives/exportContext.js';
|
|
30
31
|
import { runPrimaryTurn } from '../primitives/seedWorker.js';
|
|
31
|
-
import { resolveProviderAccount } from '../providerAccounts.js';
|
|
32
|
+
import { requireClaudeNativeAccount, resolveProviderAccount } from '../providerAccounts.js';
|
|
32
33
|
import { catalogDriftProbe } from './clusterHandlers.js';
|
|
33
34
|
import { checkModelDrift, driftFlag } from '../primitiveDrift.js';
|
|
34
35
|
import { disposeClaudeNativeWorker, getClaudeNativePendingInteractions } from '../providers/claude-native/index.js';
|
|
@@ -39,7 +40,7 @@ import { acquirePlansWatcher, broadcastCluster, broadcastHandoffLockSnapshot, br
|
|
|
39
40
|
import { buildLocalClusterSystemPrompt, withLocalTurnWaitInstructions, LLAMACPP_PRIMARY_SYSTEM_PROMPT, OLLAMA_PRIMARY_SYSTEM_PROMPT, withPreviewNudge, } from '../server/prompts.js';
|
|
40
41
|
import { cwdHandoffChain, workflowCwds, workflows, } from '../server/state.js';
|
|
41
42
|
import { acquireProjectSettingsWatcher, readSettings, } from '../settings.js';
|
|
42
|
-
import { appendHistoryEntry, readMeta, workflowConfigFromMeta, writeMeta, } from '../workflowMeta.js';
|
|
43
|
+
import { appendHistoryEntry, clearProviderCliSessions, readMeta, workflowConfigFromMeta, writeMeta, } from '../workflowMeta.js';
|
|
43
44
|
import { getHeadSeq as getWorkflowHeadSeq, initWorkflowStore, readFirstSeq as readWorkflowFirstSeq, replayEvents as replayWorkflowEvents, replayTailEvents, scanEventsOfTypes, } from '../workflowStore.js';
|
|
44
45
|
import { ptyManager } from '../terminal/ptyManager.js';
|
|
45
46
|
import { sendTaskLedgerSnapshot } from './taskLedgerHandlers.js';
|
|
@@ -55,13 +56,22 @@ import { resetCompactions, restoreCompactions } from '../compactionCounter.js';
|
|
|
55
56
|
const LOCAL_SELF_SUMMARY_LIMIT_PERCENT = 90;
|
|
56
57
|
let deps;
|
|
57
58
|
export function initHandoffHandlers(d) { deps = d; }
|
|
58
|
-
export async function handleHandoffRequest(ws, session, msg) {
|
|
59
|
+
export async function handleHandoffRequest(ws, session, msg, operatorRequested = false) {
|
|
59
60
|
const wf = workflows.get(msg.workflowId);
|
|
60
61
|
if (!wf) {
|
|
61
62
|
send(ws, { type: 'error', message: `Unknown workflow ${msg.workflowId.slice(0, 8)}` });
|
|
62
63
|
return;
|
|
63
64
|
}
|
|
64
|
-
if (msg.newPrimary &&
|
|
65
|
+
if (msg.newPrimary?.provider === 'claude' && msg.newPrimary.providerAccountRef !== undefined) {
|
|
66
|
+
try {
|
|
67
|
+
await requireClaudeNativeAccount(msg.newPrimary.providerAccountRef);
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
send(ws, { type: 'error', message: 'Choose an available Claude Native account for the new session.' });
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (msg.newPrimary && !allowedWorkflowEfforts(msg.newPrimary.provider, msg.newPrimary.model, msg.newPrimary.providerAccountRef ?? (wf.primary.provider === msg.newPrimary.provider ? wf.config.providerAccountRef : undefined)).includes(msg.newPrimary.effort)) {
|
|
65
75
|
send(ws, { type: 'error', message: 'The selected effort is not supported by this provider and model.' });
|
|
66
76
|
return;
|
|
67
77
|
}
|
|
@@ -71,6 +81,14 @@ export async function handleHandoffRequest(ws, session, msg) {
|
|
|
71
81
|
send(ws, { type: 'error', message: 'Handoff is not available in Chat tabs.' });
|
|
72
82
|
return;
|
|
73
83
|
}
|
|
84
|
+
const involvesGemini = [wf.primary.provider, msg.newPrimary?.provider, msg.summarizer?.provider].includes('antigravity-cli');
|
|
85
|
+
const clusterId = clusterStore.getClusterIdForWorkflow(msg.workflowId);
|
|
86
|
+
const geminiHandoffAllowed = operatorRequested && !isComputer(wf) && (!clusterId ||
|
|
87
|
+
(clusterStore.getMemberAccessMode(clusterId, msg.workflowId) === 'standard' && !clusterStore.getClusterCached(clusterId)?.research));
|
|
88
|
+
if (involvesGemini && !geminiHandoffAllowed) {
|
|
89
|
+
send(ws, { type: 'error', workflowId: msg.workflowId, message: 'Gemini HANDOFF requires an operator request in an Agent tab or a standard member outside Research.' });
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
74
92
|
if (wf.busy) {
|
|
75
93
|
send(ws, { type: 'error', message: 'Primary agent is busy — cancel or wait before rotating.' });
|
|
76
94
|
return;
|
|
@@ -201,7 +219,7 @@ export async function handleHandoffRequest(ws, session, msg) {
|
|
|
201
219
|
if (currentCodexAccount?.profile.id && wf.config.providerAccountRef !== currentCodexAccount.profile.id) {
|
|
202
220
|
wf.config.providerAccountRef = currentCodexAccount.profile.id;
|
|
203
221
|
}
|
|
204
|
-
|
|
222
|
+
let effectiveSummarizer = summarizer.provider === 'codex' && currentCodexAccount
|
|
205
223
|
? { ...summarizer, providerAccountRef: currentCodexAccount.profile.id, codexHome: currentCodexAccount.codexHome }
|
|
206
224
|
: summarizer;
|
|
207
225
|
// §5.1 — drift guard. The summarizer model often defaults to the tab's LIVE
|
|
@@ -227,8 +245,8 @@ export async function handleHandoffRequest(ws, session, msg) {
|
|
|
227
245
|
let claudeTransport = 'cli';
|
|
228
246
|
if (wf.primary.provider === 'claude') {
|
|
229
247
|
const tab = wf.config.claudeTransport;
|
|
230
|
-
if (tab === 'native' || tab === 'cli') {
|
|
231
|
-
claudeTransport = tab;
|
|
248
|
+
if (wf.config.ultracode || tab === 'native' || tab === 'cli') {
|
|
249
|
+
claudeTransport = wf.config.ultracode ? 'cli' : tab;
|
|
232
250
|
}
|
|
233
251
|
else {
|
|
234
252
|
const cascade = await readSettings(cwd).catch(() => null);
|
|
@@ -237,6 +255,9 @@ export async function handleHandoffRequest(ws, session, msg) {
|
|
|
237
255
|
claudeTransport = cascade?.claude?.transport === 'native' ? 'native' : 'cli';
|
|
238
256
|
}
|
|
239
257
|
}
|
|
258
|
+
if (!wf.config.ultracode && wf.primary.provider === 'claude' && claudeTransport === 'native' && effectiveSummarizer.provider === 'claude') {
|
|
259
|
+
effectiveSummarizer = { ...effectiveSummarizer, claudeTransport: 'native', providerAccountRef: wf.config.providerAccountRef };
|
|
260
|
+
}
|
|
240
261
|
// For 'original-worker' mode the reflection turn runs on the workflow's
|
|
241
262
|
// current primary session via --resume (CLI) or via in-memory messages
|
|
242
263
|
// replay (Native); we pass that context through. For 'fresh-summarizer'
|
|
@@ -248,7 +269,7 @@ export async function handleHandoffRequest(ws, session, msg) {
|
|
|
248
269
|
sessionId: wf.primarySessionId ?? '',
|
|
249
270
|
cwd,
|
|
250
271
|
...(currentCodexAccount ? { providerAccountRef: currentCodexAccount.profile.id, codexHome: currentCodexAccount.codexHome } : {}),
|
|
251
|
-
...(wf.primary.provider === 'claude' ? { transport: claudeTransport } : {}),
|
|
272
|
+
...(wf.primary.provider === 'claude' ? { transport: claudeTransport, providerAccountRef: wf.config.providerAccountRef } : {}),
|
|
252
273
|
}
|
|
253
274
|
: undefined;
|
|
254
275
|
const resumable = wf.primary.provider === 'claude' || wf.primary.provider === 'codex';
|
|
@@ -258,7 +279,13 @@ export async function handleHandoffRequest(ws, session, msg) {
|
|
|
258
279
|
// operator's "original worker" choice by having the same model reread the
|
|
259
280
|
// transcript through the summarizer path, with the configured summarizer as
|
|
260
281
|
// a fallback when the transcript is too large for that model.
|
|
261
|
-
if (effectiveMode === 'original-worker' &&
|
|
282
|
+
if (effectiveMode === 'original-worker' && wf.primary.provider === 'antigravity-cli') {
|
|
283
|
+
effectiveMode = 'fresh-summarizer';
|
|
284
|
+
translatedSummarizer = { provider: wf.primary.provider, model: wf.primary.model, effort: msg.summarizer?.effort ?? 'medium' };
|
|
285
|
+
send(ws, { type: 'system_notice', workflowId: msg.workflowId,
|
|
286
|
+
content: 'Gemini writes the handoff with the same model in a fresh reply-only session using the saved transcript.' });
|
|
287
|
+
}
|
|
288
|
+
else if (effectiveMode === 'original-worker' && !resumable) {
|
|
262
289
|
// Overflow heuristic: the summarizer must re-read roughly the whole
|
|
263
290
|
// conversation. If live context is already near full, a same-sized local
|
|
264
291
|
// model can't fit the transcript back into its own window. lastContextPercent
|
|
@@ -316,6 +343,7 @@ export async function handleHandoffRequest(ws, session, msg) {
|
|
|
316
343
|
if (!handoffOwned())
|
|
317
344
|
return;
|
|
318
345
|
const handle = runExportContext({
|
|
346
|
+
allowGeminiHandoffWriter: geminiHandoffAllowed,
|
|
319
347
|
workflowId: msg.workflowId,
|
|
320
348
|
cwd,
|
|
321
349
|
manager: wf.manager,
|
|
@@ -435,9 +463,18 @@ export async function handleHandoffRequest(ws, session, msg) {
|
|
|
435
463
|
// Update in-memory state + persist to meta.json BEFORE the pre-warm spawn
|
|
436
464
|
// so the new session is minted against the chosen CLI.
|
|
437
465
|
if (msg.newPrimary) {
|
|
438
|
-
const
|
|
439
|
-
|
|
466
|
+
const previousProvider = wf.primary.provider;
|
|
467
|
+
const nextProviderAccountRef = msg.newPrimary.provider === 'codex' || msg.newPrimary.provider === 'claude'
|
|
468
|
+
? msg.newPrimary.providerAccountRef ?? (previousProvider === msg.newPrimary.provider ? wf.config.providerAccountRef : undefined)
|
|
440
469
|
: undefined;
|
|
470
|
+
if (msg.newPrimary.provider === 'claude' && msg.newPrimary.providerAccountRef !== undefined) {
|
|
471
|
+
claudeTransport = 'native';
|
|
472
|
+
wf.config.claudeTransport = 'native';
|
|
473
|
+
wf.config.ultracode = false;
|
|
474
|
+
}
|
|
475
|
+
else if (msg.newPrimary.provider === 'claude' && previousProvider !== 'claude') {
|
|
476
|
+
claudeTransport = wf.config.ultracode ? 'cli' : wf.config.claudeTransport ?? summarizerSettings?.claude?.transport ?? 'native';
|
|
477
|
+
}
|
|
441
478
|
wf.primary.provider = msg.newPrimary.provider;
|
|
442
479
|
wf.primary.model = msg.newPrimary.model;
|
|
443
480
|
wf.primary.effort = msg.newPrimary.effort;
|
|
@@ -454,6 +491,10 @@ export async function handleHandoffRequest(ws, session, msg) {
|
|
|
454
491
|
meta.primaryModel = msg.newPrimary.model;
|
|
455
492
|
meta.primaryEffort = msg.newPrimary.effort;
|
|
456
493
|
meta.providerAccountRef = nextProviderAccountRef;
|
|
494
|
+
if (msg.newPrimary.provider === 'claude' && msg.newPrimary.providerAccountRef !== undefined) {
|
|
495
|
+
meta.claudeTransport = 'native';
|
|
496
|
+
meta.ultracode = false;
|
|
497
|
+
}
|
|
457
498
|
meta.lastActiveAt = Date.now();
|
|
458
499
|
if (!handoffOwned())
|
|
459
500
|
return;
|
|
@@ -500,21 +541,16 @@ export async function handleHandoffRequest(ws, session, msg) {
|
|
|
500
541
|
if (!handoffOwned())
|
|
501
542
|
return;
|
|
502
543
|
if (wf.primary.provider === 'antigravity-cli') {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
draft: `Read the handoff document at ${handoffPath} and continue.`,
|
|
508
|
-
completedAt: Date.now(),
|
|
509
|
-
});
|
|
510
|
-
resetCompactions(msg.workflowId, wf);
|
|
511
|
-
wf.calibration = undefined;
|
|
512
|
-
wf.lastContextPercent = 0;
|
|
513
|
-
resetAutoCompactionCycle(wf);
|
|
514
|
-
releaseHandoffBusy();
|
|
515
|
-
return { artifactName: handle.artifactName };
|
|
544
|
+
// A failed opening turn must not resume an archived Gemini session after restart.
|
|
545
|
+
await clearProviderCliSessions(cwd, msg.workflowId, wf.primary.provider);
|
|
546
|
+
if (!handoffOwned())
|
|
547
|
+
return;
|
|
516
548
|
}
|
|
517
|
-
const
|
|
549
|
+
const geminiRole = wf.primary.provider === 'antigravity-cli' && clusterId
|
|
550
|
+
? await geminiClusterInstructions(clusterId, msg.workflowId) : '';
|
|
551
|
+
if (!handoffOwned())
|
|
552
|
+
return;
|
|
553
|
+
const seedPrompt = `[HANDOFF — new session initialized for this tab. Read the document below carefully. Then in 2-3 sentences: (1) state where the project stands right now, and (2) what you believe the most useful next step is. Await the operator's instruction before beginning any work.]\n\n${geminiRole ? geminiRole + '\n\n' : ''}${handoffBody}`;
|
|
518
554
|
send(ws, {
|
|
519
555
|
type: 'user_message_echo',
|
|
520
556
|
workflowId: msg.workflowId,
|
|
@@ -603,12 +639,13 @@ export async function handleHandoffRequest(ws, session, msg) {
|
|
|
603
639
|
}, {
|
|
604
640
|
primary: wf.primary,
|
|
605
641
|
prompt: seedPrompt,
|
|
642
|
+
...(wf.primary.provider === 'antigravity-cli' ? { interactionMode: 'agent', antigravityInteractive: operatorRequested } : {}),
|
|
606
643
|
resumeSessionId: undefined,
|
|
607
644
|
disableRssGuard: wf.disableRssGuard,
|
|
608
645
|
appendSystemPrompt: prewarmAppend,
|
|
609
646
|
systemPrompt: prewarmSystemPrompt,
|
|
610
647
|
...(handoffAccount ? { providerAccountRef: handoffAccount.profile.id, codexHome: handoffAccount.codexHome } : {}),
|
|
611
|
-
...(wf.primary.provider === 'claude' ? { claudeTransport } : {}),
|
|
648
|
+
...(wf.primary.provider === 'claude' ? { claudeTransport, providerAccountRef: wf.config.providerAccountRef } : {}),
|
|
612
649
|
clusterId: prewarmClusterId,
|
|
613
650
|
clusterTaskBoardAttached: prewarmClusterTaskBoardAttached,
|
|
614
651
|
clusterPlan: prewarmClusterPlan,
|
|
@@ -643,14 +680,23 @@ export async function handleHandoffRequest(ws, session, msg) {
|
|
|
643
680
|
console.error(`[arco] handoff ${handle.handoffId} meta reconcile (${wf.primary.provider}) failed:`, err);
|
|
644
681
|
});
|
|
645
682
|
});
|
|
683
|
+
let openingError;
|
|
646
684
|
try {
|
|
647
|
-
await primaryTurn.settled;
|
|
685
|
+
openingError = (await primaryTurn.settled).error;
|
|
648
686
|
}
|
|
649
687
|
catch (err) {
|
|
688
|
+
openingError = err instanceof Error ? err.message : String(err);
|
|
650
689
|
console.error(`[arco] handoff ${handle.handoffId} pre-warm settle error:`, err);
|
|
651
690
|
}
|
|
652
691
|
if (!handoffOwned())
|
|
653
692
|
return;
|
|
693
|
+
if (openingError && wf.primary.provider === 'antigravity-cli') {
|
|
694
|
+
const error = `Handoff saved as ${handle.artifactName}. Gemini could not finish the opening turn: ${openingError}`;
|
|
695
|
+
send(ws, { type: 'handoff_artifact_ready', workflowId: msg.workflowId, handoffId: handle.handoffId,
|
|
696
|
+
artifactName: handle.artifactName, error, completedAt: Date.now() });
|
|
697
|
+
send(ws, { type: 'system_notice', workflowId: msg.workflowId, content: error });
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
654
700
|
send(ws, {
|
|
655
701
|
type: 'handoff_complete',
|
|
656
702
|
workflowId: msg.workflowId,
|
|
@@ -750,7 +796,7 @@ export async function handleSpawnFromHere(ws, session, msg) {
|
|
|
750
796
|
send(ws, { type: 'error', message: `Unknown parent workflow ${msg.parentWorkflowId.slice(0, 8)}` });
|
|
751
797
|
return;
|
|
752
798
|
}
|
|
753
|
-
if (!allowedWorkflowEfforts(msg.newConfig.primaryProvider, msg.newConfig.primaryModel).includes(msg.newConfig.primaryEffort)) {
|
|
799
|
+
if (!allowedWorkflowEfforts(msg.newConfig.primaryProvider, msg.newConfig.primaryModel, msg.newConfig.providerAccountRef).includes(msg.newConfig.primaryEffort)) {
|
|
754
800
|
send(ws, { type: 'error', message: 'The selected effort is not supported by this provider and model.' });
|
|
755
801
|
return;
|
|
756
802
|
}
|
|
@@ -783,6 +829,17 @@ export async function handleSpawnFromHere(ws, session, msg) {
|
|
|
783
829
|
}
|
|
784
830
|
const newCwd = msg.newConfig.workingDirectory || parentCwd;
|
|
785
831
|
const newPrimary = derivePrimaryConfig(msg.newConfig);
|
|
832
|
+
if (newPrimary.provider === 'claude' && msg.newConfig.providerAccountRef !== undefined) {
|
|
833
|
+
try {
|
|
834
|
+
await requireClaudeNativeAccount(msg.newConfig.providerAccountRef);
|
|
835
|
+
msg.newConfig.claudeTransport = 'native';
|
|
836
|
+
msg.newConfig.ultracode = false;
|
|
837
|
+
}
|
|
838
|
+
catch {
|
|
839
|
+
send(ws, { type: 'error', message: 'Choose an available Claude Native account for the new tab.' });
|
|
840
|
+
return;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
786
843
|
const initialSpawnAccount = newPrimary.provider === 'codex'
|
|
787
844
|
? await resolveProviderAccount('codex', msg.newConfig.providerAccountRef, newCwd).catch(() => null)
|
|
788
845
|
: null;
|
|
@@ -957,8 +1014,8 @@ export async function handleSpawnFromHere(ws, session, msg) {
|
|
|
957
1014
|
let parentClaudeTransport = 'cli';
|
|
958
1015
|
if (parent.primary.provider === 'claude') {
|
|
959
1016
|
const tab = parent.config.claudeTransport;
|
|
960
|
-
if (tab === 'native' || tab === 'cli') {
|
|
961
|
-
parentClaudeTransport = tab;
|
|
1017
|
+
if (parent.config.ultracode || tab === 'native' || tab === 'cli') {
|
|
1018
|
+
parentClaudeTransport = parent.config.ultracode ? 'cli' : tab;
|
|
962
1019
|
}
|
|
963
1020
|
else {
|
|
964
1021
|
const cascade = await readSettings(parentCwd).catch(() => null);
|
|
@@ -979,7 +1036,7 @@ export async function handleSpawnFromHere(ws, session, msg) {
|
|
|
979
1036
|
cwd: parentCwd,
|
|
980
1037
|
sourceWorkflowId: msg.parentWorkflowId,
|
|
981
1038
|
...(parentCodexAccount ? { providerAccountRef: parentCodexAccount.profile.id, codexHome: parentCodexAccount.codexHome } : {}),
|
|
982
|
-
...(parent.primary.provider === 'claude' ? { transport: parentClaudeTransport } : {}),
|
|
1039
|
+
...(parent.primary.provider === 'claude' ? { transport: parentClaudeTransport, providerAccountRef: parent.config.providerAccountRef } : {}),
|
|
983
1040
|
// Native + Spawn: hydrate the child's worker from the parent's
|
|
984
1041
|
// events.jsonl. Skipped for Handoff (target == parent → existing
|
|
985
1042
|
// worker carries history) and for CLI (uses --resume instead).
|
|
@@ -998,7 +1055,9 @@ export async function handleSpawnFromHere(ws, session, msg) {
|
|
|
998
1055
|
: undefined;
|
|
999
1056
|
const parentResumable = parent.primary.provider === 'claude' || parent.primary.provider === 'codex';
|
|
1000
1057
|
let effectiveMode = msg.mode;
|
|
1001
|
-
let translatedSummarizer = summarizer
|
|
1058
|
+
let translatedSummarizer = parentNativeOriginalEligible && summarizer.provider === 'claude'
|
|
1059
|
+
? { ...summarizer, claudeTransport: 'native', providerAccountRef: parent.config.providerAccountRef }
|
|
1060
|
+
: summarizer;
|
|
1002
1061
|
if (effectiveMode === 'original-worker' && !parentResumable) {
|
|
1003
1062
|
const tooBig = typeof parent.lastContextPercent === 'number'
|
|
1004
1063
|
&& parent.lastContextPercent >= LOCAL_SELF_SUMMARY_LIMIT_PERCENT;
|
|
@@ -1273,7 +1332,7 @@ export async function handleSpawnFromHere(ws, session, msg) {
|
|
|
1273
1332
|
disableRssGuard: parent.disableRssGuard,
|
|
1274
1333
|
appendSystemPrompt: withPreviewNudge(undefined),
|
|
1275
1334
|
...(spawnAccount ? { providerAccountRef: spawnAccount.profile.id, codexHome: spawnAccount.codexHome } : {}),
|
|
1276
|
-
...(newPrimary.provider === 'claude' ? { claudeTransport: newClaudeTransport } : {}),
|
|
1335
|
+
...(newPrimary.provider === 'claude' ? { claudeTransport: newClaudeTransport, providerAccountRef: msg.newConfig.providerAccountRef } : {}),
|
|
1277
1336
|
});
|
|
1278
1337
|
const spawnedWf = workflows.get(newWorkflowId);
|
|
1279
1338
|
// Persist parent's RSS-guard opt-out onto the spawned workflow so
|
|
@@ -1374,10 +1433,27 @@ function enforceIncognitoOnRehydrate(config) {
|
|
|
1374
1433
|
}
|
|
1375
1434
|
export async function handleRehydrateWorkflows(ws, session, entries) {
|
|
1376
1435
|
for (const entry of entries) {
|
|
1436
|
+
const existing = workflows.get(entry.workflowId);
|
|
1437
|
+
const configCwd = entry.config.workingDirectory;
|
|
1438
|
+
let accountRestored = false;
|
|
1439
|
+
if ((!existing || existing.bootMaterialized) && configCwd && !entry.config.incognito) {
|
|
1440
|
+
try {
|
|
1441
|
+
const saved = await readMeta(configCwd, entry.workflowId);
|
|
1442
|
+
if (saved?.primaryProvider === 'claude') {
|
|
1443
|
+
accountRestored = entry.config.providerAccountRef !== saved.providerAccountRef
|
|
1444
|
+
|| (!!saved.claudeTransport && entry.config.claudeTransport !== saved.claudeTransport);
|
|
1445
|
+
entry.config = { ...entry.config, providerAccountRef: saved.providerAccountRef,
|
|
1446
|
+
...(saved.claudeTransport ? { claudeTransport: saved.claudeTransport } : {}) };
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
catch {
|
|
1450
|
+
send(ws, { type: 'error', workflowId: entry.workflowId, message: 'Saved workflow settings could not be read. Reopen the tab before sending.' });
|
|
1451
|
+
continue;
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1377
1454
|
const originalEffort = entry.config.primaryEffort;
|
|
1378
|
-
entry.config.primaryEffort = normalizedWorkflowEffort(entry.config.primaryProvider, entry.config.primaryModel, originalEffort);
|
|
1455
|
+
entry.config.primaryEffort = normalizedWorkflowEffort(entry.config.primaryProvider, entry.config.primaryModel, originalEffort, entry.config.providerAccountRef);
|
|
1379
1456
|
const repairedEffort = entry.config.primaryEffort !== originalEffort;
|
|
1380
|
-
const existing = workflows.get(entry.workflowId);
|
|
1381
1457
|
if (!existing && entry.config.incognito) {
|
|
1382
1458
|
// Register before anything below can log the wfid.
|
|
1383
1459
|
registerPrivateLogToken(entry.workflowId);
|
|
@@ -1431,7 +1507,7 @@ export async function handleRehydrateWorkflows(ws, session, entries) {
|
|
|
1431
1507
|
}
|
|
1432
1508
|
session.workflowIds.add(entry.workflowId);
|
|
1433
1509
|
const wf = workflows.get(entry.workflowId);
|
|
1434
|
-
if (repairedEffort)
|
|
1510
|
+
if (repairedEffort || accountRestored || wf.config.providerAccountRef !== entry.config.providerAccountRef)
|
|
1435
1511
|
send(ws, { type: 'workflow_config_synced', workflowId: entry.workflowId, config: wf.config });
|
|
1436
1512
|
if (!existing && wf.config.incognito && wf.config.voiceOperator) {
|
|
1437
1513
|
// A new server epoch has no private history, even if the reconnecting
|
|
@@ -1773,7 +1849,7 @@ export async function rehydrateOneWorkflow(ws, workflowId, wf, clientLastSeq, op
|
|
|
1773
1849
|
break;
|
|
1774
1850
|
if (ws.readyState !== WebSocket.OPEN)
|
|
1775
1851
|
break;
|
|
1776
|
-
ws.send(JSON.stringify(ev));
|
|
1852
|
+
ws.send(JSON.stringify({ ...ev, replayed: true }));
|
|
1777
1853
|
}
|
|
1778
1854
|
}
|
|
1779
1855
|
}
|
|
@@ -1816,7 +1892,7 @@ export async function rehydrateOneWorkflow(ws, workflowId, wf, clientLastSeq, op
|
|
|
1816
1892
|
for (const ev of events) {
|
|
1817
1893
|
if (ws.readyState !== WebSocket.OPEN)
|
|
1818
1894
|
break;
|
|
1819
|
-
ws.send(JSON.stringify(ev));
|
|
1895
|
+
ws.send(JSON.stringify({ ...ev, replayed: true }));
|
|
1820
1896
|
}
|
|
1821
1897
|
}
|
|
1822
1898
|
}
|
|
@@ -1841,7 +1917,7 @@ export async function rehydrateOneWorkflow(ws, workflowId, wf, clientLastSeq, op
|
|
|
1841
1917
|
continue;
|
|
1842
1918
|
if (ws.readyState !== WebSocket.OPEN)
|
|
1843
1919
|
break;
|
|
1844
|
-
ws.send(JSON.stringify(ev));
|
|
1920
|
+
ws.send(JSON.stringify({ ...ev, replayed: true }));
|
|
1845
1921
|
}
|
|
1846
1922
|
}
|
|
1847
1923
|
}
|
|
@@ -7,7 +7,7 @@ import { workflows } from '../server/state.js';
|
|
|
7
7
|
import { safeDirectory } from '../fileAccessPolicy.js';
|
|
8
8
|
import { readSettings } from '../settings.js';
|
|
9
9
|
import { isKnownProvider } from '../providers/index.js';
|
|
10
|
-
import { configuredAccounts } from '../providerAccounts.js';
|
|
10
|
+
import { configuredAccounts, requireClaudeNativeAccount } from '../providerAccounts.js';
|
|
11
11
|
import { buildTranscriptWorkerSlice } from '../transcriptWorker.js';
|
|
12
12
|
import { TERMINAL_CODEX_ACCOUNT } from '@arco/shared';
|
|
13
13
|
let deps;
|
|
@@ -81,12 +81,17 @@ async function destinationConfig(message) {
|
|
|
81
81
|
const settings = await readSettings(workingDirectory);
|
|
82
82
|
if (settings.enabledProviders?.[target.provider] === false)
|
|
83
83
|
throw new Error('That provider is turned off. Enable it or choose another provider.');
|
|
84
|
-
|
|
84
|
+
let nativeAccount;
|
|
85
|
+
if (target.provider === 'claude' && target.providerAccountRef !== undefined) {
|
|
86
|
+
nativeAccount = await requireClaudeNativeAccount(target.providerAccountRef);
|
|
87
|
+
}
|
|
88
|
+
else if (target.providerAccountRef && !(target.provider === 'codex' && target.providerAccountRef === TERMINAL_CODEX_ACCOUNT)) {
|
|
85
89
|
if (target.provider !== 'codex' || !(await configuredAccounts('codex', workingDirectory)).some(account => account.id === target.providerAccountRef))
|
|
86
90
|
throw new Error('Choose an available account for the new worker.');
|
|
87
91
|
}
|
|
88
92
|
return { kind: 'workflow', name: typeof target.name === 'string' && target.name.trim() ? target.name.trim().slice(0, 120) : 'Transcript worker', workingDirectory,
|
|
89
93
|
primaryProvider: target.provider, primaryModel: target.model.trim(), primaryEffort: target.effort,
|
|
94
|
+
...(nativeAccount ? { providerAccountRef: nativeAccount, claudeTransport: 'native' } : {}),
|
|
90
95
|
...(target.provider === 'codex' && target.providerAccountRef ? { providerAccountRef: target.providerAccountRef } : {}), skipPermissions: target.skipPermissions === true };
|
|
91
96
|
}
|
|
92
97
|
export async function handleTranscriptWorkerCreate(ws, session, message) {
|