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,9 +1,10 @@
|
|
|
1
1
|
import { AntigravityProvider, registerAntigravityCompact, clearAntigravityCompact } from '../providers/antigravity/index.js';
|
|
2
2
|
import { antigravityChatWorkspace } from '../chatMode.js';
|
|
3
|
+
import { promptContextEstimate } from '../contextEstimator.js';
|
|
3
4
|
import { hasConversationHistory } from '../providerConversation.js';
|
|
4
5
|
import { supportsManualCompact } from '../manualCompactCapability.js';
|
|
5
6
|
import { publishActivity } from '../voice/activityBus.js';
|
|
6
|
-
import { resolveOutputStyle } from '@arco/shared';
|
|
7
|
+
import { isIsolatedAccessMode, resolveOutputStyle } from '@arco/shared';
|
|
7
8
|
import { claimBusy, ownsBusy, drainQueueIfIdle, maybeAutoContinueAfterCompact, releaseBusy, resetCodexContextAfterCompact, resetAutoCompactionCycle, } from './turnEngine.js';
|
|
8
9
|
import { send, broadcastWorkflow, broadcastTransient, notifyClusterStateForWorkflow } from '../server/broadcast.js';
|
|
9
10
|
import { workflows, workflowCwds } from '../server/state.js';
|
|
@@ -183,10 +184,14 @@ export async function handleCompactWorkflow(ws, session, msg, claimGuard, autoDe
|
|
|
183
184
|
}
|
|
184
185
|
}
|
|
185
186
|
else if (provider === 'antigravity-cli') {
|
|
187
|
+
const clusterId = clusterStore.getClusterIdForWorkflow(workflowId);
|
|
188
|
+
const accessMode = clusterId ? clusterStore.getMemberAccessMode(clusterId, workflowId) : undefined;
|
|
186
189
|
if (!expectedSessionId || !cwd)
|
|
187
190
|
result = { ok: false, error: 'No saved Gemini session; run a turn first.' };
|
|
188
191
|
else if (wf.config.incognito)
|
|
189
192
|
result = { ok: false, error: 'Gemini compact is unavailable in Incognito.' };
|
|
193
|
+
else if (isIsolatedAccessMode(accessMode) && (accessMode !== 'researcher' || autoDetail))
|
|
194
|
+
result = { ok: false, error: 'Gemini compact is unavailable for this isolated worker.' };
|
|
190
195
|
else if (!ownsBusy(wf, busyToken) || wf.primarySessionId !== expectedSessionId || wf.primary.provider !== provider)
|
|
191
196
|
result = { ok: false, error: 'compaction cancelled before dispatch' };
|
|
192
197
|
else {
|
|
@@ -196,20 +201,25 @@ export async function handleCompactWorkflow(ws, session, msg, claimGuard, autoDe
|
|
|
196
201
|
cwd: chat ? antigravityChatWorkspace(workflowId) : cwd, workflowId,
|
|
197
202
|
skipPermissions: wf.primary.skipPermissions, resumeSessionId: expectedSessionId,
|
|
198
203
|
interactionMode: 'agent', antigravityInteractive: true, antigravityChatWorkspace: chat,
|
|
204
|
+
clusterId, clusterAccessMode: accessMode,
|
|
205
|
+
clusterWebAccess: clusterId ? clusterStore.getMemberWebAccess(clusterId, workflowId) : undefined,
|
|
199
206
|
});
|
|
200
207
|
registerAntigravityCompact(workflowId, process);
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
208
|
+
try {
|
|
209
|
+
result = await new Promise((resolve) => {
|
|
210
|
+
const timer = setTimeout(() => process.kill(), 120_000);
|
|
211
|
+
process.once('error', (error) => { clearTimeout(timer); resolve({ ok: false, error }); });
|
|
212
|
+
process.once('result', (outcome) => {
|
|
213
|
+
clearTimeout(timer);
|
|
214
|
+
const geminiContext = promptContextEstimate(outcome.lastPromptTokens, outcome.modelContextWindow, Date.now()) ?? undefined;
|
|
215
|
+
resolve({ ok: true, geminiContext, geminiText: outcome.text.trim().slice(0, 2000) });
|
|
216
|
+
});
|
|
217
|
+
process.spawn('/compact');
|
|
209
218
|
});
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
219
|
+
}
|
|
220
|
+
finally {
|
|
221
|
+
clearAntigravityCompact(workflowId, process);
|
|
222
|
+
}
|
|
213
223
|
}
|
|
214
224
|
}
|
|
215
225
|
else {
|
|
@@ -225,6 +235,7 @@ export async function handleCompactWorkflow(ws, session, msg, claimGuard, autoDe
|
|
|
225
235
|
additionalDirectories: wf.primary.additionalDirectories,
|
|
226
236
|
fallbackModel: wf.primary.fallbackModel,
|
|
227
237
|
claudeTransport: 'native',
|
|
238
|
+
providerAccountRef: wf.config.providerAccountRef,
|
|
228
239
|
claudeNativeCompact: wf.config.claudeNativeCompact === true,
|
|
229
240
|
claudeNativeForceInterleavedThinkingBeta: wf.config.claudeNativeForceInterleavedThinkingBeta === true,
|
|
230
241
|
claudeNativeThinkingDisplay: wf.config.claudeNativeThinkingDisplay,
|
|
@@ -253,20 +264,24 @@ export async function handleCompactWorkflow(ws, session, msg, claimGuard, autoDe
|
|
|
253
264
|
else
|
|
254
265
|
resetAutoCompactionCycle(wf);
|
|
255
266
|
}
|
|
256
|
-
if (result.ok && owned && autoDetail) {
|
|
267
|
+
if (result.ok && owned && autoDetail && provider !== 'antigravity-cli') {
|
|
257
268
|
if (provider === 'codex')
|
|
258
269
|
resetCodexContextAfterCompact(workflowId, wf);
|
|
259
270
|
else
|
|
260
271
|
wf.lastContextPercent = 0;
|
|
261
272
|
wf.lastContextBudgetPct = undefined;
|
|
262
273
|
}
|
|
274
|
+
if (result.ok && owned && result.geminiContext) {
|
|
275
|
+
wf.lastContextPercent = result.geminiContext.percentOfWindow;
|
|
276
|
+
broadcastTransient(workflowId, { type: 'context_usage', workflowId, ...result.geminiContext });
|
|
277
|
+
}
|
|
263
278
|
if (result.ok) {
|
|
264
279
|
const foldedNote = typeof result.foldedTurns === 'number' ? ` (${result.foldedTurns} turn(s) folded)` : '';
|
|
265
280
|
broadcastWorkflow(workflowId, {
|
|
266
281
|
type: 'system_notice',
|
|
267
282
|
workflowId,
|
|
268
283
|
content: provider === 'antigravity-cli'
|
|
269
|
-
? `${tag} Compaction sent to Gemini. ${result.
|
|
284
|
+
? `${tag} ${result.geminiText || 'Compaction sent to Gemini.'} ${result.geminiContext === undefined ? 'Gemini did not report a new context size' : `context ${typeof beforeContext === 'number' ? `${beforeContext}% → ` : ''}${result.geminiContext.percentOfWindow}%`}.`
|
|
270
285
|
: provider === 'cursor'
|
|
271
286
|
? `${tag} Conversation compressed — Cursor summarized older context in place. The same ACP session continues with a smaller retained history.`
|
|
272
287
|
: provider === 'codex'
|
|
@@ -379,6 +394,7 @@ export async function handleFoldWorkflow(ws, _session, msg) {
|
|
|
379
394
|
additionalDirectories: wf.primary.additionalDirectories,
|
|
380
395
|
fallbackModel: wf.primary.fallbackModel,
|
|
381
396
|
claudeTransport: 'native',
|
|
397
|
+
providerAccountRef: wf.config.providerAccountRef,
|
|
382
398
|
claudeNativeCompact: wf.config.claudeNativeCompact === true,
|
|
383
399
|
claudeNativeForceInterleavedThinkingBeta: wf.config.claudeNativeForceInterleavedThinkingBeta === true,
|
|
384
400
|
claudeNativeThinkingDisplay: wf.config.claudeNativeThinkingDisplay,
|
|
@@ -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. */
|