arco-workbench 0.2.4 → 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-CHXVFLGT.js → PhosphorBackdrop-CLILIwOQ.js} +1 -1
- package/client/dist/assets/{ThemedBackgroundShaderImpl-Bhs4I9jA.js → ThemedBackgroundShaderImpl-B87chcb5.js} +1 -1
- package/client/dist/assets/{XtermView-CdfurwFx.js → XtermView-BP_j7WSN.js} +1 -1
- package/client/dist/assets/{galleryEditor-DYjZZ4cf.js → galleryEditor-B90phoBI.js} +1 -1
- package/client/dist/assets/{index-BjDmFvqG.js → index-BfPp1Oup.js} +269 -269
- package/client/dist/index.html +1 -1
- 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 +5 -9
- 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/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 +7 -5
- package/client/src/help/content/rightPanel.tsx +8 -4
- 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 +20 -14
- 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 +1 -0
- 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 +4 -5
- 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/CLIENT.md +10 -5
- 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 +54 -23
- 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 +46 -9
- package/docs/RESEARCH.md +1 -1
- 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/geminiMembers.d.ts +7 -1
- package/server/dist/geminiMembers.js +28 -14
- 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 +40 -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/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/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 +33 -18
- 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/geminiMembers.ts +26 -15
- 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 +38 -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/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/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 +32 -17
- 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
|
@@ -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) {
|
|
@@ -29,7 +29,8 @@ import { createCheckpoint } from '../gitSnapshots.js';
|
|
|
29
29
|
import { summarizeTurnChanges, timelyCheckpoint, shouldCaptureTurn } from '../turnChanges.js';
|
|
30
30
|
import { isManagedBakeoffWorktree } from '../gitBakeoff.js';
|
|
31
31
|
import * as clusterMailbox from '../clusterMailbox.js';
|
|
32
|
-
import
|
|
32
|
+
import * as clusterAutoTurn from '../clusterAutoTurn.js';
|
|
33
|
+
import { consumeGeminiSend, geminiClusterInstructions, geminiPickupAllowed, geminiSendValid, GEMINI_OPERATOR_ONLY_REFUSAL, isGeminiMember } from '../geminiMembers.js';
|
|
33
34
|
import { setTurnOrigin } from '../clusterTurnOrigin.js';
|
|
34
35
|
import * as clusterPlanBridge from '../clusterPlanBridge.js';
|
|
35
36
|
import { clusterToolsPending, CLUSTER_TOOLS_PENDING_NOTICE, CLUSTER_TOOLS_PENDING_AGENT } from '../clusterTurnTools.js';
|
|
@@ -343,7 +344,7 @@ export function startSessionWatcher(workflowId, wf, cwd, initialWs) {
|
|
|
343
344
|
});
|
|
344
345
|
}
|
|
345
346
|
export function derivePrimaryConfig(config) {
|
|
346
|
-
config.primaryEffort = normalizedWorkflowEffort(config.primaryProvider, config.primaryModel, config.primaryEffort);
|
|
347
|
+
config.primaryEffort = normalizedWorkflowEffort(config.primaryProvider, config.primaryModel, config.primaryEffort, config.providerAccountRef);
|
|
347
348
|
return {
|
|
348
349
|
provider: config.primaryProvider ?? 'claude',
|
|
349
350
|
model: config.primaryModel,
|
|
@@ -860,7 +861,7 @@ export async function autoHandoffAvailableFor(workflowId, wf, cwd, cascade) {
|
|
|
860
861
|
});
|
|
861
862
|
}
|
|
862
863
|
export function freshAutoCompactionPercent(provider, transport, outcome) {
|
|
863
|
-
if (outcome.error || !((provider === 'claude' && transport === 'native') || (provider === 'codex' && transport === 'appserver')))
|
|
864
|
+
if (outcome.error || !(provider === 'antigravity-cli' || (provider === 'claude' && transport === 'native') || (provider === 'codex' && transport === 'appserver')))
|
|
864
865
|
return undefined;
|
|
865
866
|
const numerator = outcome.lastPromptTokens;
|
|
866
867
|
const denominator = provider === 'codex' ? outcome.freshContextWindow : outcome.modelContextWindow;
|
|
@@ -878,9 +879,16 @@ export async function maybeAutoCompactPolicy(workflowId, wf, cwd, policy, readin
|
|
|
878
879
|
return false;
|
|
879
880
|
if (reading.provider !== wf.primary.provider || reading.sessionId !== wf.primarySessionId)
|
|
880
881
|
return false;
|
|
881
|
-
|
|
882
|
+
const gemini = reading.provider === 'antigravity-cli';
|
|
883
|
+
if (reading.provider !== 'claude' && reading.provider !== 'codex' && !gemini)
|
|
882
884
|
return false;
|
|
883
|
-
if (reading.provider === 'codex' && !reading.sessionId)
|
|
885
|
+
if ((reading.provider === 'codex' || gemini) && !reading.sessionId)
|
|
886
|
+
return false;
|
|
887
|
+
const isFencedGemini = () => {
|
|
888
|
+
const clusterId = clusterStore.getClusterIdForWorkflow(workflowId);
|
|
889
|
+
return gemini && !!clusterId && isIsolatedAccessMode(clusterStore.getMemberAccessMode(clusterId, workflowId));
|
|
890
|
+
};
|
|
891
|
+
if (isFencedGemini())
|
|
884
892
|
return false;
|
|
885
893
|
let state = policyAttempts.get(wf);
|
|
886
894
|
if (!state || state.sessionId !== reading.sessionId || state.provider !== reading.provider) {
|
|
@@ -916,11 +924,13 @@ export async function maybeAutoCompactPolicy(workflowId, wf, cwd, policy, readin
|
|
|
916
924
|
if (reading.provider === 'claude' && reading.transport && await resolveClaudeTransport(wf, cwd) !== reading.transport)
|
|
917
925
|
return false;
|
|
918
926
|
const current = resolveProviderAutoCompaction(wf.config.autoCompaction, clusterId ? clusterStore.getAutoCompaction(clusterId) : undefined, wf.primary.provider, reading.transport ?? (wf.primary.provider === 'claude' ? 'native' : ''), wf.config.claudeNativeCompact === true);
|
|
919
|
-
if (wf.busy || lastBusyClaim.get(wf) !== observedClaim || wf.primarySessionId !== reading.sessionId || wf.primary.provider !== reading.provider || !current?.enabled || current.thresholdPercent !== policy.thresholdPercent)
|
|
927
|
+
if (isFencedGemini() || wf.busy || lastBusyClaim.get(wf) !== observedClaim || wf.primarySessionId !== reading.sessionId || wf.primary.provider !== reading.provider || !current?.enabled || current.thresholdPercent !== policy.thresholdPercent)
|
|
920
928
|
return false;
|
|
921
929
|
return claim();
|
|
922
930
|
}, `context ${reading.percent}% >= ${policy.thresholdPercent}%`, () => {
|
|
923
|
-
|
|
931
|
+
// The CLI may accept /compact without confirming a smaller retained
|
|
932
|
+
// context. Require a fresh drop before another Gemini attempt.
|
|
933
|
+
if (!gemini && policyAttempts.get(wf) === state) {
|
|
924
934
|
state.fired = false;
|
|
925
935
|
state.awaitingReading = true;
|
|
926
936
|
}
|
|
@@ -1367,13 +1377,15 @@ opts) {
|
|
|
1367
1377
|
return;
|
|
1368
1378
|
}
|
|
1369
1379
|
// docs/PROTOCOL_CLUSTER.md "Gemini members": a Gemini member turn needs the
|
|
1370
|
-
// single-use ticket
|
|
1371
|
-
//
|
|
1372
|
-
//
|
|
1380
|
+
// single-use ticket for this member and this exact text, checked here and
|
|
1381
|
+
// again when queued input is taken. Other Antigravity turns accept only
|
|
1382
|
+
// operator messages.
|
|
1373
1383
|
const geminiMember = wf.primary.provider === 'antigravity-cli' && isGeminiMember(workflowId);
|
|
1374
|
-
const antigravityInputOk = (item, check) =>
|
|
1375
|
-
? (!item.automaticKind || item.automaticKind === 'nudge')
|
|
1376
|
-
|
|
1384
|
+
const antigravityInputOk = (item, check) => geminiMember
|
|
1385
|
+
? ((item.operatorInitiated === true && (!item.automaticKind || item.automaticKind === 'nudge'))
|
|
1386
|
+
|| (item.automaticKind === 'auto-pickup' && geminiPickupAllowed(workflowId)))
|
|
1387
|
+
&& check(item.geminiSend, workflowId, item.content)
|
|
1388
|
+
: item.operatorInitiated === true && !item.automaticKind;
|
|
1377
1389
|
const queuedOperatorInput = fromQueue && [...wf.queue.steering, ...wf.queue.followUp].length > 0
|
|
1378
1390
|
&& [...wf.queue.steering, ...wf.queue.followUp].every(item => antigravityInputOk(item, geminiSendValid));
|
|
1379
1391
|
const directOperatorInput = !fromQueue && antigravityInputOk({ operatorInitiated: opts?.operatorInitiated, automaticKind: opts?.automaticKind, geminiSend: opts?.geminiSend, content }, geminiSendValid);
|
|
@@ -2638,6 +2650,10 @@ opts) {
|
|
|
2638
2650
|
// the sync modelImagePath() and can't wait themselves.
|
|
2639
2651
|
if (promptAttachments && promptAttachments.length > 0)
|
|
2640
2652
|
await awaitModelImages(promptAttachments);
|
|
2653
|
+
const geminiWake = opts?.automaticKind === 'nudge' || opts?.automaticKind === 'auto-pickup';
|
|
2654
|
+
const firstMemberRole = geminiMember && memberClusterId && !wf.primarySessionId && !geminiWake
|
|
2655
|
+
&& clusterStore.getMemberAccessMode(memberClusterId, workflowId) === 'standard'
|
|
2656
|
+
? await geminiClusterInstructions(memberClusterId, workflowId) : '';
|
|
2641
2657
|
// STOP landed during the pre-spawn awaits above (killAll had nothing to
|
|
2642
2658
|
// kill yet). Spawning now would run a turn nobody owns.
|
|
2643
2659
|
if (!ownsBusy(wf, busyToken))
|
|
@@ -2701,8 +2717,8 @@ opts) {
|
|
|
2701
2717
|
}
|
|
2702
2718
|
});
|
|
2703
2719
|
const dispatchCurrent = () => workflows.get(workflowId) === wf && ownsBusy(wf, busyToken) && (dispatchedWorkerId === undefined || primaryTurn.workerId === dispatchedWorkerId);
|
|
2704
|
-
const geminiSkills = wf.primary.provider === 'antigravity-cli' && (!memberClusterId ||
|
|
2705
|
-
const geminiAdditions = [visibleGeminiPlan, geminiSkills].filter(Boolean).join('\n\n');
|
|
2720
|
+
const geminiSkills = wf.primary.provider === 'antigravity-cli' && (!memberClusterId || !geminiWake) && !wf.primarySessionId ? primarySkillsManifest : '';
|
|
2721
|
+
const geminiAdditions = [firstMemberRole, visibleGeminiPlan, geminiSkills].filter(Boolean).join('\n\n');
|
|
2706
2722
|
if (geminiAdditions && dispatchCurrent())
|
|
2707
2723
|
broadcastWorkflow(workflowId, { type: 'system_notice', workflowId, content: geminiAdditions });
|
|
2708
2724
|
const turn = runPrimaryTurn({
|
|
@@ -2780,7 +2796,7 @@ opts) {
|
|
|
2780
2796
|
},
|
|
2781
2797
|
codexTransport,
|
|
2782
2798
|
codexContextPolicy: wf.config.codexContextPolicy,
|
|
2783
|
-
providerAccountRef: providerAccount?.profile.id,
|
|
2799
|
+
providerAccountRef: claudeTransport === 'native' ? wf.config.providerAccountRef : providerAccount?.profile.id,
|
|
2784
2800
|
codexHome: providerAccount?.codexHome,
|
|
2785
2801
|
claudeTransport,
|
|
2786
2802
|
ultracode,
|
|
@@ -2935,6 +2951,7 @@ opts) {
|
|
|
2935
2951
|
}).catch((error) => console.warn('[arco] scratch reminder could not be cleared:', error));
|
|
2936
2952
|
}
|
|
2937
2953
|
lastTurnErrored = !!outcome.error;
|
|
2954
|
+
clusterAutoTurn.noteTurnOutcome(workflowId, outcome.error);
|
|
2938
2955
|
watchHadError ||= lastTurnErrored;
|
|
2939
2956
|
if (firstIteration && opts?.backgroundEvent)
|
|
2940
2957
|
opts.onBackgroundSettled?.(outcome.error ?? undefined);
|
|
@@ -3153,8 +3170,6 @@ opts) {
|
|
|
3153
3170
|
// replaces any fold or compaction of this boundary; otherwise the cheap
|
|
3154
3171
|
// deterministic Fold, then the auto-compaction policy.
|
|
3155
3172
|
context: async () => {
|
|
3156
|
-
if (wf.primary.provider === 'antigravity-cli')
|
|
3157
|
-
return 'continue';
|
|
3158
3173
|
const clusterIdForPolicy = clusterStore.getClusterIdForWorkflow(workflowId);
|
|
3159
3174
|
const explicitPolicy = resolveProviderAutoCompaction(wf.config.autoCompaction, clusterIdForPolicy ? clusterStore.getAutoCompaction(clusterIdForPolicy) : undefined, wf.primary.provider, claudeTransport, wf.config.claudeNativeCompact === true, cascade?.ollama?.compaction?.enabled !== undefined || cascade?.ollama?.compaction?.threshold !== undefined);
|
|
3160
3175
|
if (explicitPolicy) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { WebSocket } from 'ws';
|
|
2
2
|
import { type UpdatePrimaryConfigMessage } from '@arco/shared';
|
|
3
|
-
import type { Session } from '../workflows/types.js';
|
|
4
|
-
export declare function
|
|
3
|
+
import type { Session, WorkflowState } from '../workflows/types.js';
|
|
4
|
+
export declare function isUpdatingNativeAccount(wf: WorkflowState): boolean;
|
|
5
|
+
export declare function handleUpdatePrimaryConfig(ws: WebSocket, _session: Session, msg: UpdatePrimaryConfigMessage): Promise<void>;
|