arco-workbench 0.2.4 → 0.2.6
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-YsHTmZJh.js} +1 -1
- package/client/dist/assets/{ThemedBackgroundShaderImpl-Bhs4I9jA.js → ThemedBackgroundShaderImpl-BEjpgoBW.js} +1 -1
- package/client/dist/assets/{XtermView-CdfurwFx.js → XtermView-wh7jNKvk.js} +1 -1
- package/client/dist/assets/{galleryEditor-DYjZZ4cf.js → galleryEditor-CaOS2mmM.js} +1 -1
- package/client/dist/assets/{index-BjDmFvqG.js → index-j68SfA-l.js} +271 -271
- 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/UpdateAction.tsx +30 -7
- 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 +11 -4
- 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 +15 -4
- 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 +31 -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 +17 -1
- 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
|
@@ -33,6 +33,7 @@ import { basename, join } from 'node:path';
|
|
|
33
33
|
import Anthropic from '@anthropic-ai/sdk';
|
|
34
34
|
import { supportsClaudeAdaptiveThinking, isClaudeModelAlias, enforcesPreservedThinking, supportsMidConversationSystemMessages, supportsMidConversationToolChanges } from '@arco/shared';
|
|
35
35
|
import { loadTokens, nativeCredentialBinding } from './auth.js';
|
|
36
|
+
import { ClaudeNativeAccountUnavailableError } from '../../providerAccounts.js';
|
|
36
37
|
import { ensureLiveTokens, forceRefreshTokens, markClaudeAuthProblem, ClaudeNativeNoAuthError } from './oauth.js';
|
|
37
38
|
import { resolveTrustStatus } from '../../projectTrust.js';
|
|
38
39
|
import { isShellToolName } from '@arco/shared';
|
|
@@ -42,7 +43,7 @@ import { checkPartialReadFullWrite } from './pretoolGuards.js';
|
|
|
42
43
|
import { firstBlockingGuard, postToolSteps, runPostToolSteps } from './toolChecks.js';
|
|
43
44
|
import { evaluateGate, gateOutcome, gateSignature } from './gateReview.js';
|
|
44
45
|
import { recordPendingGate, clearPendingGate, readGateStore, hasStandingApproval, addStandingApproval } from './gateStore.js';
|
|
45
|
-
import { getCachedModelCapabilities, getCatalog,
|
|
46
|
+
import { getCachedModelCapabilities, getCatalog, resolveClaudeAliasFromCatalog } from './catalog.js';
|
|
46
47
|
import { filterToolResult } from './filterToolResult.js';
|
|
47
48
|
import { planTurnSpill, toolEvictEnabled, turnToolTokenBudget } from './toolResultEviction.js';
|
|
48
49
|
import { outputHash } from '../outputSignature.js';
|
|
@@ -188,6 +189,7 @@ export class ClaudeNativeWorker extends EventEmitter {
|
|
|
188
189
|
// against on-disk tokens and rebuild the client transparently.
|
|
189
190
|
authRecovery = { transport: 'native', binding: nativeCredentialBinding() };
|
|
190
191
|
clientTokenObtainedAt = null;
|
|
192
|
+
clientBinding;
|
|
191
193
|
messages = [];
|
|
192
194
|
heldSteerNotices = new WeakSet();
|
|
193
195
|
hooks = { byEvent: {} };
|
|
@@ -621,6 +623,10 @@ export class ClaudeNativeWorker extends EventEmitter {
|
|
|
621
623
|
// shouldn't change without a worker tear-down, but
|
|
622
624
|
// appendSystemPrompt rotates per turn (skills manifest, transcript)
|
|
623
625
|
// and effort/model can be live-edited.
|
|
626
|
+
if (this.config.providerAccountRef !== next.providerAccountRef) {
|
|
627
|
+
this.catalogWarmAttempted = false;
|
|
628
|
+
this.authFailureCount = 0;
|
|
629
|
+
}
|
|
624
630
|
this.config = next;
|
|
625
631
|
this.taskDisabled = this.taskDisabled || next.claudeNativeTaskDisabled === true;
|
|
626
632
|
}
|
|
@@ -1339,20 +1345,22 @@ export class ClaudeNativeWorker extends EventEmitter {
|
|
|
1339
1345
|
// worker built its client, ensureLiveTokens() returns the fresh set
|
|
1340
1346
|
// and the obtainedAt mismatch below forces a client rebuild. Cheap:
|
|
1341
1347
|
// ensureLiveTokens is a single disk read on the happy path.
|
|
1342
|
-
const
|
|
1343
|
-
|
|
1348
|
+
const accountRef = this.config.providerAccountRef;
|
|
1349
|
+
const tokens = await ensureLiveTokens(accountRef);
|
|
1350
|
+
const binding = nativeCredentialBinding(tokens, accountRef);
|
|
1351
|
+
this.authRecovery = { transport: 'native', binding, ...(accountRef ? { accountRef } : {}) };
|
|
1344
1352
|
// An alias tab can't be dispatched until the alias resolves to a concrete
|
|
1345
1353
|
// id. Warm the catalog once per worker so the resolution is catalog-backed
|
|
1346
1354
|
// (newest family member) rather than the static CLAUDE_ALIAS_FALLBACK.
|
|
1347
1355
|
// Failure is non-fatal — the fallback still yields a real, dispatchable id.
|
|
1348
|
-
if (!this.catalogWarmAttempted && isClaudeModelAlias(this.config.model)
|
|
1356
|
+
if ((!this.catalogWarmAttempted || this.clientBinding?.revision !== binding.revision) && isClaudeModelAlias(this.config.model)) {
|
|
1349
1357
|
this.catalogWarmAttempted = true;
|
|
1350
|
-
await getCatalog(false).catch((err) => {
|
|
1358
|
+
await getCatalog(false, this.config.providerAccountRef).catch((err) => {
|
|
1351
1359
|
console.warn(`[claude-native:${this.workflowId.slice(0, 8)}] catalog warm for alias '${this.config.model}' failed; using static fallback:`, err instanceof Error ? err.message : err);
|
|
1352
1360
|
});
|
|
1353
1361
|
}
|
|
1354
1362
|
const baseURL = await nativeOAuthBaseUrl();
|
|
1355
|
-
if (this.client && this.
|
|
1363
|
+
if (this.client && this.clientBinding?.storeId === binding.storeId && this.clientBinding.revision === binding.revision && this.client.baseURL === baseURL)
|
|
1356
1364
|
return;
|
|
1357
1365
|
const isRebuild = this.client !== null;
|
|
1358
1366
|
if (isRebuild) {
|
|
@@ -1371,6 +1379,7 @@ export class ClaudeNativeWorker extends EventEmitter {
|
|
|
1371
1379
|
maxRetries: 0,
|
|
1372
1380
|
});
|
|
1373
1381
|
this.clientTokenObtainedAt = tokens.obtainedAt;
|
|
1382
|
+
this.clientBinding = binding;
|
|
1374
1383
|
// Token-rotation rebuilds reuse the existing hooks + replayed state
|
|
1375
1384
|
// and skip the worker-init emit. Hooks come from CLAUDE.md files,
|
|
1376
1385
|
// unrelated to auth; replay only ever runs once per worker; 'init'
|
|
@@ -1411,7 +1420,7 @@ export class ClaudeNativeWorker extends EventEmitter {
|
|
|
1411
1420
|
// `not_found_error: model: opus`. Resolved per call, not cached: the operator
|
|
1412
1421
|
// can live-swap the model through updateConfig mid-session.
|
|
1413
1422
|
requestModel() {
|
|
1414
|
-
return resolveClaudeAliasFromCatalog(this.config.model);
|
|
1423
|
+
return resolveClaudeAliasFromCatalog(this.config.model, this.config.providerAccountRef);
|
|
1415
1424
|
}
|
|
1416
1425
|
// Opus-5 plan Phase 2 — the model id capability decisions key on. For a
|
|
1417
1426
|
// pinned concrete id this is always config.model; for an alias tab it is
|
|
@@ -1456,7 +1465,7 @@ export class ClaudeNativeWorker extends EventEmitter {
|
|
|
1456
1465
|
const parts = ['claude-code-20250219', 'oauth-2025-04-20'];
|
|
1457
1466
|
if (shouldSendInterleavedThinkingBeta(this.capModel(), this.config.claudeNativeForceInterleavedThinkingBeta === true))
|
|
1458
1467
|
parts.push('interleaved-thinking-2025-05-14');
|
|
1459
|
-
const caps = getCachedModelCapabilities(this.capModel());
|
|
1468
|
+
const caps = getCachedModelCapabilities(this.capModel(), this.config.providerAccountRef);
|
|
1460
1469
|
// compact is OFF by default for Native (NATIVE_COMPACTION_PLAN §1); the
|
|
1461
1470
|
// beta is only attached when WorkflowConfig.claudeNativeCompact is the
|
|
1462
1471
|
// explicit per-tab/global opt-in true. Once a server compaction block is
|
|
@@ -1624,7 +1633,7 @@ export class ClaudeNativeWorker extends EventEmitter {
|
|
|
1624
1633
|
// an empty object when no context-management feature is active so the
|
|
1625
1634
|
// call site can spread it unconditionally.
|
|
1626
1635
|
buildContextManagementBody() {
|
|
1627
|
-
const caps = getCachedModelCapabilities(this.capModel());
|
|
1636
|
+
const caps = getCachedModelCapabilities(this.capModel(), this.config.providerAccountRef);
|
|
1628
1637
|
const edits = buildContextManagementEditsForRequest(caps, this.config.claudeNativeCompact === true && !hasLeadingServerFoldBlock(this.messages));
|
|
1629
1638
|
// Anthropic's server-managed compaction is an edit strategy, not a sibling
|
|
1630
1639
|
// `context_management.compact` object. Let the model+server pick the
|
|
@@ -1634,17 +1643,17 @@ export class ClaudeNativeWorker extends EventEmitter {
|
|
|
1634
1643
|
}
|
|
1635
1644
|
async hydrateContextManagementCapabilities() {
|
|
1636
1645
|
const model = this.capModel();
|
|
1637
|
-
if (getCachedModelCapabilities(model))
|
|
1646
|
+
if (getCachedModelCapabilities(model, this.config.providerAccountRef))
|
|
1638
1647
|
return;
|
|
1639
|
-
await getCatalog(false).catch((err) => {
|
|
1648
|
+
await getCatalog(false, this.config.providerAccountRef).catch((err) => {
|
|
1640
1649
|
console.warn(`[claude-native:${this.workflowId.slice(0, 8)}] catalog warm-up failed:`, err instanceof Error ? err.message : err);
|
|
1641
1650
|
});
|
|
1642
|
-
if (getCachedModelCapabilities(model))
|
|
1651
|
+
if (getCachedModelCapabilities(model, this.config.providerAccountRef))
|
|
1643
1652
|
return;
|
|
1644
1653
|
if (this.forcedCatalogRefreshModels.has(model))
|
|
1645
1654
|
return;
|
|
1646
1655
|
this.forcedCatalogRefreshModels.add(model);
|
|
1647
|
-
await getCatalog(true).catch((err) => {
|
|
1656
|
+
await getCatalog(true, this.config.providerAccountRef).catch((err) => {
|
|
1648
1657
|
console.warn(`[claude-native:${this.workflowId.slice(0, 8)}] catalog force-refresh failed for ${model}:`, err instanceof Error ? err.message : err);
|
|
1649
1658
|
});
|
|
1650
1659
|
}
|
|
@@ -2591,22 +2600,28 @@ export class ClaudeNativeWorker extends EventEmitter {
|
|
|
2591
2600
|
await this.ensureStarted();
|
|
2592
2601
|
}
|
|
2593
2602
|
catch (err) {
|
|
2603
|
+
const accountRef = this.config.providerAccountRef;
|
|
2604
|
+
if (err instanceof ClaudeNativeAccountUnavailableError) {
|
|
2605
|
+
this.emit('system_notice', `[AUTH:claude] ${err.message}`, { transport: 'native', accountRef, accountUnavailable: true });
|
|
2606
|
+
this.emit('error', 'claude account unavailable');
|
|
2607
|
+
return;
|
|
2608
|
+
}
|
|
2594
2609
|
try {
|
|
2595
|
-
this.authRecovery = { transport: 'native', binding: nativeCredentialBinding(await loadTokens()) };
|
|
2610
|
+
this.authRecovery = { transport: 'native', ...(accountRef ? { accountRef } : {}), binding: nativeCredentialBinding(await loadTokens(accountRef), accountRef) };
|
|
2596
2611
|
}
|
|
2597
2612
|
catch {
|
|
2598
|
-
this.authRecovery = { transport: 'native' };
|
|
2613
|
+
this.authRecovery = { transport: 'native', ...(accountRef ? { accountRef } : {}) };
|
|
2599
2614
|
}
|
|
2600
2615
|
// Pre-flight auth surface: emit the [AUTH:claude] sentinel so the
|
|
2601
2616
|
// chat renderer offers RE-LOGIN instead of a raw error string.
|
|
2602
2617
|
if (err instanceof ClaudeNativeNoAuthError) {
|
|
2603
|
-
markClaudeAuthProblem('not authenticated'); // A2 — phone banner + notice
|
|
2618
|
+
markClaudeAuthProblem('not authenticated', accountRef); // A2 — phone banner + notice
|
|
2604
2619
|
this.emit('system_notice', '[AUTH:claude] Claude Native is not authenticated. Re-login to continue.', this.authRecovery);
|
|
2605
2620
|
this.emit('error', 'claude auth required');
|
|
2606
2621
|
return;
|
|
2607
2622
|
}
|
|
2608
2623
|
const detail = err instanceof Error ? err.message : String(err);
|
|
2609
|
-
markClaudeAuthProblem(detail); // A2 — pre-flight refresh failure
|
|
2624
|
+
markClaudeAuthProblem(detail, accountRef); // A2 — pre-flight refresh failure
|
|
2610
2625
|
this.emit('system_notice', `[AUTH:claude] Claude Native auth failed: ${detail}. Re-login to continue.`, this.authRecovery);
|
|
2611
2626
|
this.emit('error', 'claude auth failed');
|
|
2612
2627
|
return;
|
|
@@ -4101,7 +4116,7 @@ export class ClaudeNativeWorker extends EventEmitter {
|
|
|
4101
4116
|
const cwd = this.config.persistenceCwd ?? this.config.cwd;
|
|
4102
4117
|
return !this.config.incognito && cwd && WFID_PATTERN.test(this.workflowId) ? join(workflowDir(cwd, this.workflowId), 'pending-subagent-approval.json') : null;
|
|
4103
4118
|
}
|
|
4104
|
-
async batchCatalog(force) { return await getCatalog(force); }
|
|
4119
|
+
async batchCatalog(force) { return await getCatalog(force, this.config.providerAccountRef); }
|
|
4105
4120
|
async approveTaskBatch(blocks) {
|
|
4106
4121
|
if (!blocks.length)
|
|
4107
4122
|
return true;
|
|
@@ -4167,7 +4182,7 @@ export class ClaudeNativeWorker extends EventEmitter {
|
|
|
4167
4182
|
}
|
|
4168
4183
|
const available = current.models.map((m) => m.id);
|
|
4169
4184
|
const proposed = selected ? [selected] : entries.map((e) => e.effective);
|
|
4170
|
-
if (proposed.some((model) => !available.includes(model) && !available.includes(resolveClaudeAliasFromCatalog(model)))) {
|
|
4185
|
+
if (proposed.some((model) => !available.includes(model) && !available.includes(resolveClaudeAliasFromCatalog(model, this.config.providerAccountRef)))) {
|
|
4171
4186
|
this.taskBatchRefusal = 'Task not started: a selected model is no longer available.';
|
|
4172
4187
|
this.emit('system_notice', 'Sub-agent batch not started: a selected model is no longer available.');
|
|
4173
4188
|
return false;
|
|
@@ -4301,7 +4316,7 @@ export class ClaudeNativeWorker extends EventEmitter {
|
|
|
4301
4316
|
summary: finalText.slice(0, 200),
|
|
4302
4317
|
});
|
|
4303
4318
|
const overridden = spawnPolicy.model && args.model
|
|
4304
|
-
&& resolveClaudeAliasFromCatalog(spawnPolicy.model) !== resolveClaudeAliasFromCatalog(args.model);
|
|
4319
|
+
&& resolveClaudeAliasFromCatalog(spawnPolicy.model, this.config.providerAccountRef) !== resolveClaudeAliasFromCatalog(args.model, this.config.providerAccountRef);
|
|
4305
4320
|
return overridden
|
|
4306
4321
|
? `${finalText}\n\nSub-agent used ${chosenModel ?? handle.model ?? spawnPolicy.model}: the operator's model selection overrides the requested ${args.model}.`
|
|
4307
4322
|
: finalText;
|
|
@@ -4370,7 +4385,7 @@ export class ClaudeNativeWorker extends EventEmitter {
|
|
|
4370
4385
|
if (!this.forcedAuthRefreshThisTurn && attempt < MAX_RETRY_ATTEMPTS - 1) {
|
|
4371
4386
|
this.forcedAuthRefreshThisTurn = true;
|
|
4372
4387
|
try {
|
|
4373
|
-
await forceRefreshTokens(this.clientTokenObtainedAt ?? 0);
|
|
4388
|
+
await forceRefreshTokens(this.clientTokenObtainedAt ?? 0, this.config.providerAccountRef);
|
|
4374
4389
|
// On-disk tokens rotated → obtainedAt mismatch → client rebuild.
|
|
4375
4390
|
await this.ensureStarted();
|
|
4376
4391
|
console.log(`[claude-native:${this.workflowId.slice(0, 8)}] 401 on unexpired token — forced refresh ok, retrying`);
|
|
@@ -4385,10 +4400,10 @@ export class ClaudeNativeWorker extends EventEmitter {
|
|
|
4385
4400
|
}
|
|
4386
4401
|
}
|
|
4387
4402
|
this.authFailureCount += 1;
|
|
4388
|
-
const detail =
|
|
4403
|
+
const detail = 'The provider rejected this account credentials';
|
|
4389
4404
|
// A2 — flip the live auth-problem flag (phone console banner + one
|
|
4390
4405
|
// auth-expired notice). Cleared by a successful refresh/bootstrap.
|
|
4391
|
-
markClaudeAuthProblem(detail);
|
|
4406
|
+
markClaudeAuthProblem(detail, this.config.providerAccountRef);
|
|
4392
4407
|
const loud = this.authFailureCount >= AUTH_FAILURE_LOUD_THRESHOLD;
|
|
4393
4408
|
const prefix = loud
|
|
4394
4409
|
? `[AUTH:claude] Repeated Claude auth failures (${this.authFailureCount}). Re-login required to continue.`
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import type { OperatorQuestionState } from '@arco/shared';
|
|
1
|
+
import type { OperatorQuestionState, OperatorQuestion } from '@arco/shared';
|
|
2
2
|
import type { JsonRpcId, JsonRpcServerRequest } from './jsonRpc.js';
|
|
3
|
+
type Answers = Record<string, string[]>;
|
|
3
4
|
type SendInput = (content: string, question: OperatorQuestionState) => Promise<void>;
|
|
4
5
|
interface Pending {
|
|
5
6
|
workflowId: string;
|
|
6
7
|
state: OperatorQuestionState;
|
|
7
8
|
rpcId?: JsonRpcId;
|
|
8
|
-
respond?: (
|
|
9
|
+
respond?: (answers: Answers | null) => boolean | void;
|
|
9
10
|
publish: (state: OperatorQuestionState) => void;
|
|
10
|
-
|
|
11
|
+
finish: (state: OperatorQuestionState) => void;
|
|
11
12
|
sending: boolean;
|
|
12
13
|
}
|
|
13
14
|
declare let publisher: ((workflowId: string, state: OperatorQuestionState) => void) | undefined;
|
|
14
15
|
export declare function setOperatorQuestionPublisher(publish: NonNullable<typeof publisher>): void;
|
|
15
16
|
export declare function pendingOperatorQuestions(workflowId: string): OperatorQuestionState[];
|
|
17
|
+
export declare function openGeminiOperatorQuestion(workflowId: string, sessionId: string, questions: OperatorQuestion[], respond: NonNullable<Pending['respond']>): () => void;
|
|
16
18
|
export declare function replyToOperatorQuestion(workflowId: string, requestId: string, value: unknown, sendInput?: SendInput): Promise<{
|
|
17
19
|
ok: boolean;
|
|
18
20
|
error?: string;
|
|
@@ -26,17 +26,32 @@ function parseQuestions(value) {
|
|
|
26
26
|
export function pendingOperatorQuestions(workflowId) {
|
|
27
27
|
return [...pending.values()].filter((p) => p.workflowId === workflowId).map((p) => p.state);
|
|
28
28
|
}
|
|
29
|
+
export function openGeminiOperatorQuestion(workflowId, sessionId, questions, respond) {
|
|
30
|
+
const requestId = randomUUID();
|
|
31
|
+
const state = { requestId, provider: 'antigravity-cli', threadId: sessionId, turnId: requestId,
|
|
32
|
+
itemId: requestId, mode: 'blocking', questions, status: 'pending', createdAt: Date.now() };
|
|
33
|
+
const publish = (next) => publisher?.(workflowId, next);
|
|
34
|
+
const finish = (next) => { pending.delete(requestId); publish(next); };
|
|
35
|
+
pending.set(requestId, { workflowId, state, respond, publish, finish, sending: false });
|
|
36
|
+
publish(state);
|
|
37
|
+
return () => {
|
|
38
|
+
if (pending.has(requestId))
|
|
39
|
+
finish({ ...state, status: 'cancelled', reason: 'Gemini closed this question.' });
|
|
40
|
+
};
|
|
41
|
+
}
|
|
29
42
|
export async function replyToOperatorQuestion(workflowId, requestId, value, sendInput) {
|
|
30
43
|
const entry = pending.get(requestId);
|
|
31
44
|
if (!entry || entry.workflowId !== workflowId)
|
|
32
45
|
return { ok: false, error: 'This question is no longer pending.' };
|
|
33
46
|
if (entry.sending)
|
|
34
47
|
return { ok: false, error: 'An answer is already being delivered.' };
|
|
35
|
-
if (!record(value) || Object.keys(value).
|
|
36
|
-
return { ok: false, error: 'Answer every question.' };
|
|
48
|
+
if (!record(value) || Object.keys(value).some(id => !entry.state.questions.some(q => q.id === id)))
|
|
49
|
+
return { ok: false, error: 'Answer every required question.' };
|
|
37
50
|
const answers = Object.create(null);
|
|
38
51
|
for (const q of entry.state.questions) {
|
|
39
52
|
const a = Object.hasOwn(value, q.id) ? value[q.id] : undefined;
|
|
53
|
+
if (a === undefined && q.optional)
|
|
54
|
+
continue;
|
|
40
55
|
if (!Array.isArray(a) || a.length !== 1 || !text(a[0], 16384) || !a[0].trim())
|
|
41
56
|
return { ok: false, error: 'Each question needs an answer.' };
|
|
42
57
|
if (q.options?.length && !q.allowOther && !q.options.some((o) => o.label === a[0]))
|
|
@@ -46,9 +61,8 @@ export async function replyToOperatorQuestion(workflowId, requestId, value, send
|
|
|
46
61
|
entry.sending = true;
|
|
47
62
|
try {
|
|
48
63
|
if (entry.respond) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
throw new Error('Codex connection closed.');
|
|
64
|
+
if (entry.respond(answers) === false)
|
|
65
|
+
throw new Error('Agent connection closed.');
|
|
52
66
|
}
|
|
53
67
|
else {
|
|
54
68
|
if (!sendInput)
|
|
@@ -58,8 +72,8 @@ export async function replyToOperatorQuestion(workflowId, requestId, value, send
|
|
|
58
72
|
await sendInput('Answers to your questions:\n' + entry.state.questions.map((q) => `${q.question}\nAnswer: ${answers[q.id][0]}`).join('\n\n'), entry.state);
|
|
59
73
|
}
|
|
60
74
|
if (pending.get(requestId) === entry) {
|
|
61
|
-
const publicAnswers = Object.fromEntries(entry.state.questions.
|
|
62
|
-
entry.
|
|
75
|
+
const publicAnswers = Object.fromEntries(entry.state.questions.filter(q => Object.hasOwn(answers, q.id)).map(q => [q.id, q.secret ? ['[redacted]'] : answers[q.id]]));
|
|
76
|
+
entry.finish({ ...entry.state, status: 'answered', answers: publicAnswers });
|
|
63
77
|
}
|
|
64
78
|
return { ok: true };
|
|
65
79
|
}
|
|
@@ -78,11 +92,11 @@ export function dismissOperatorQuestion(workflowId, requestId) {
|
|
|
78
92
|
return { ok: false, error: 'An answer is already being delivered.' };
|
|
79
93
|
entry.sending = true;
|
|
80
94
|
try {
|
|
81
|
-
if (entry.respond
|
|
82
|
-
throw new Error('
|
|
95
|
+
if (entry.respond?.(null) === false)
|
|
96
|
+
throw new Error('Agent connection closed.');
|
|
83
97
|
if (pending.get(requestId) !== entry)
|
|
84
98
|
return { ok: false, error: 'This question is no longer pending.' };
|
|
85
|
-
entry.
|
|
99
|
+
entry.finish({ ...entry.state, status: 'cancelled', reason: 'Dismissed by the operator.' });
|
|
86
100
|
return { ok: true };
|
|
87
101
|
}
|
|
88
102
|
catch {
|
|
@@ -112,7 +126,7 @@ export class CodexOperatorQuestions {
|
|
|
112
126
|
if ([...this.ids].some((id) => pending.get(id)?.rpcId === req.id))
|
|
113
127
|
throw new Error('Duplicate question request.');
|
|
114
128
|
const questions = parseQuestions(p.questions);
|
|
115
|
-
this.add({ threadId: p.threadId, turnId: p.turnId, itemId: p.itemId, mode: p.isBlocking === false ? 'async' : 'blocking', questions }, respond, req.id);
|
|
129
|
+
this.add({ threadId: p.threadId, turnId: p.turnId, itemId: p.itemId, mode: p.isBlocking === false ? 'async' : 'blocking', questions }, (answers) => respond({ answers: Object.fromEntries(Object.entries(answers ?? {}).map(([id, a]) => [id, { answers: a }])) }), req.id);
|
|
116
130
|
}
|
|
117
131
|
acceptAsync(threadId, turnId, item) {
|
|
118
132
|
if (this.asyncItems.has(item.id) || !Array.isArray(item.questions) || !item.questions.length)
|
|
@@ -136,7 +150,7 @@ export class CodexOperatorQuestions {
|
|
|
136
150
|
if (this.ids.size >= 16)
|
|
137
151
|
throw new Error('Too many pending questions.');
|
|
138
152
|
const state = { ...data, requestId: randomUUID(), provider: this.provider, status: 'pending', createdAt: Date.now() };
|
|
139
|
-
const entry = { workflowId: this.workflowId, state, respond, rpcId, publish: this.publish,
|
|
153
|
+
const entry = { workflowId: this.workflowId, state, respond, rpcId, publish: this.publish, finish: (next) => this.finish(entry, next), sending: false };
|
|
140
154
|
this.ids.add(state.requestId);
|
|
141
155
|
pending.set(state.requestId, entry);
|
|
142
156
|
this.publish(state);
|
|
@@ -167,7 +181,7 @@ export class CodexOperatorQuestions {
|
|
|
167
181
|
if (!p || (rpcOnly && p.rpcId === undefined))
|
|
168
182
|
continue;
|
|
169
183
|
this.finish(p, { ...p.state, status: 'cancelled', reason });
|
|
170
|
-
p.respond?.(
|
|
184
|
+
p.respond?.(null);
|
|
171
185
|
}
|
|
172
186
|
}
|
|
173
187
|
}
|
|
@@ -475,6 +475,12 @@ function observeTurnBoundary(workflowId, wf, message) {
|
|
|
475
475
|
// attention.ts sees every message (questions, gates and errors too) and
|
|
476
476
|
// ignores a repeated start or end itself.
|
|
477
477
|
attention.observeAttention(workflowId, message, { name: wf.config.name ?? '', incognito: !!wf.config.incognito });
|
|
478
|
+
// A finished handoff or fold leaves a smaller conversation in the same member: automatic pickup may resume.
|
|
479
|
+
if (message.type === 'handoff_complete' || message.type === 'context_folded')
|
|
480
|
+
clusterAutoTurn.noteTurnOutcome(workflowId, null);
|
|
481
|
+
// A terminal request_too_large stops automatic pickup for this member before its turn-end sweep.
|
|
482
|
+
if (message.type === 'error' && typeof message.message === 'string' && clusterAutoTurn.isOversizeError(message.message))
|
|
483
|
+
clusterAutoTurn.noteTurnOutcome(workflowId, message.message);
|
|
478
484
|
if (message.type === 'primary_turn_started') {
|
|
479
485
|
if (turnBoundaryState.get(workflowId) === 'open')
|
|
480
486
|
return;
|
|
@@ -8,6 +8,7 @@ export declare function readSettings(cwd?: string, opts?: {
|
|
|
8
8
|
export declare function writeSettings(next: ArcoSettings): Promise<void>;
|
|
9
9
|
export declare function initializeProviderSettings(detect: () => Promise<ArcoSettings['enabledProviders']>): Promise<boolean>;
|
|
10
10
|
export declare function patchSettings(patch: Partial<ArcoSettings>): Promise<ArcoSettings>;
|
|
11
|
+
export declare function saveClaudeNativeProfile(label: string, id?: string): Promise<ArcoSettings>;
|
|
11
12
|
type SettingsChangeKind = 'global' | 'project';
|
|
12
13
|
type SettingsChangeListener = (kind: SettingsChangeKind, cwd?: string) => void;
|
|
13
14
|
export declare function onSettingsChange(listener: SettingsChangeListener): () => void;
|
package/server/dist/settings.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
1
2
|
import { sanitizeNativeSubagents } from '@arco/shared';
|
|
2
3
|
import { scanBeforeDeadline } from './scanDeadline.js';
|
|
3
4
|
import { parsePreviewPorts } from './previewProxy.js';
|
|
@@ -22,7 +23,7 @@ import { promises as fs } from 'fs';
|
|
|
22
23
|
import { mkdirSync, realpathSync, watch as fsWatch } from 'fs';
|
|
23
24
|
import path from 'path';
|
|
24
25
|
import { homedir } from 'os';
|
|
25
|
-
import { VALID_THEME_IDS, VALID_FONT_PACK_IDS, normalizeLegacyThemeId, DEFAULT_UI_SCALE, normalizeUiScale } from '@arco/shared';
|
|
26
|
+
import { isClaudeNativeProfileId, VALID_THEME_IDS, VALID_FONT_PACK_IDS, normalizeLegacyThemeId, DEFAULT_UI_SCALE, normalizeUiScale } from '@arco/shared';
|
|
26
27
|
import { describeConfigValue } from './configValue.js';
|
|
27
28
|
import { atomicWriteFile, withFileLock } from './atomicFile.js';
|
|
28
29
|
import { arcoHome } from './arcoHome.js';
|
|
@@ -309,7 +310,7 @@ function sanitizeAccountProfile(raw, provider) {
|
|
|
309
310
|
return null;
|
|
310
311
|
const r = raw;
|
|
311
312
|
const id = typeof r.id === 'string' ? r.id.trim() : '';
|
|
312
|
-
if (!ACCOUNT_ID_PATTERN.test(id))
|
|
313
|
+
if (provider === 'claudeNative' ? !isClaudeNativeProfileId(id) : !ACCOUNT_ID_PATTERN.test(id))
|
|
313
314
|
return null;
|
|
314
315
|
const labelRaw = typeof r.label === 'string' ? r.label.trim().replace(/[\r\n\t]+/g, ' ') : id;
|
|
315
316
|
const label = (labelRaw || id).slice(0, 32);
|
|
@@ -324,7 +325,7 @@ function sanitizeAccountProfile(raw, provider) {
|
|
|
324
325
|
if (codexHome && codexHome.length <= 512 && !/[\r\n]/.test(codexHome))
|
|
325
326
|
out.codexHome = codexHome;
|
|
326
327
|
}
|
|
327
|
-
const authBrowser = sanitizeAccountBrowser(r.authBrowser);
|
|
328
|
+
const authBrowser = provider === 'claudeNative' ? undefined : sanitizeAccountBrowser(r.authBrowser);
|
|
328
329
|
if (authBrowser)
|
|
329
330
|
out.authBrowser = authBrowser;
|
|
330
331
|
return out;
|
|
@@ -334,7 +335,7 @@ function sanitizeProviderAccounts(raw) {
|
|
|
334
335
|
return undefined;
|
|
335
336
|
const r = raw;
|
|
336
337
|
const out = {};
|
|
337
|
-
for (const provider of ['codex', 'claude']) {
|
|
338
|
+
for (const provider of ['codex', 'claude', 'claudeNative']) {
|
|
338
339
|
const arr = r[provider];
|
|
339
340
|
if (!Array.isArray(arr))
|
|
340
341
|
continue;
|
|
@@ -933,8 +934,21 @@ export async function readSettings(cwd, opts) {
|
|
|
933
934
|
if (opts?.includeProject === false)
|
|
934
935
|
return mergeWithDefaults(global);
|
|
935
936
|
const project = await readJsonFile(projectSettingsPath(cwd), 'project');
|
|
936
|
-
const merged = deepMerge(global, project);
|
|
937
|
-
|
|
937
|
+
const merged = mergeWithDefaults(deepMerge(global, project));
|
|
938
|
+
// A project can tune its transport. The Native profile names and IDs are
|
|
939
|
+
// global operator settings because the same IDs select paid credentials.
|
|
940
|
+
const operatorAccounts = sanitizeProviderAccounts(global.providerAccounts);
|
|
941
|
+
if (merged.providerAccounts || operatorAccounts) {
|
|
942
|
+
const accounts = { ...merged.providerAccounts };
|
|
943
|
+
delete accounts.claude;
|
|
944
|
+
delete accounts.claudeNative;
|
|
945
|
+
if (operatorAccounts?.claude)
|
|
946
|
+
accounts.claude = operatorAccounts.claude;
|
|
947
|
+
if (operatorAccounts?.claudeNative)
|
|
948
|
+
accounts.claudeNative = operatorAccounts.claudeNative;
|
|
949
|
+
merged.providerAccounts = Object.keys(accounts).length ? accounts : undefined;
|
|
950
|
+
}
|
|
951
|
+
return merged;
|
|
938
952
|
}
|
|
939
953
|
export async function writeSettings(next) {
|
|
940
954
|
await atomicWriteFile(GLOBAL_SETTINGS_PATH, JSON.stringify(next, null, 2) + '\n');
|
|
@@ -992,7 +1006,7 @@ async function patchSettingsUnlocked(patch) {
|
|
|
992
1006
|
merged.localClusterCapacity = current.localClusterCapacity;
|
|
993
1007
|
}
|
|
994
1008
|
if ('providerAccounts' in patch) {
|
|
995
|
-
const sanitized = sanitizeProviderAccounts(patch.providerAccounts);
|
|
1009
|
+
const sanitized = sanitizeProviderAccounts(patch.providerAccounts ? { ...current.providerAccounts, ...patch.providerAccounts } : patch.providerAccounts);
|
|
996
1010
|
if (sanitized)
|
|
997
1011
|
merged.providerAccounts = sanitized;
|
|
998
1012
|
}
|
|
@@ -1395,6 +1409,24 @@ export async function patchSettings(patch) {
|
|
|
1395
1409
|
parsePreviewPorts(patch.previewPorts, Math.min(await hostTemporaryPortStart(), 32768));
|
|
1396
1410
|
return withFileLock(GLOBAL_SETTINGS_PATH, () => patchSettingsUnlocked(patch));
|
|
1397
1411
|
}
|
|
1412
|
+
export async function saveClaudeNativeProfile(label, id) {
|
|
1413
|
+
const cleanLabel = label.trim();
|
|
1414
|
+
if (!cleanLabel || cleanLabel.length > 32 || /[\r\n\t]/.test(cleanLabel))
|
|
1415
|
+
throw new Error('Enter an account name of 1 to 32 characters.');
|
|
1416
|
+
return withFileLock(GLOBAL_SETTINGS_PATH, async () => {
|
|
1417
|
+
const current = await readSettings();
|
|
1418
|
+
const accounts = current.providerAccounts ?? {};
|
|
1419
|
+
const profiles = accounts.claudeNative ?? [];
|
|
1420
|
+
if (id && !profiles.some(profile => profile.id === id))
|
|
1421
|
+
throw new Error('Claude Native account unavailable.');
|
|
1422
|
+
if (!id && profiles.length >= 8)
|
|
1423
|
+
throw new Error('Up to 8 additional Claude Native accounts are supported.');
|
|
1424
|
+
const next = id
|
|
1425
|
+
? profiles.map(profile => profile.id === id ? { ...profile, label: cleanLabel } : profile)
|
|
1426
|
+
: [...profiles, { id: `native-${randomBytes(12).toString('hex')}`, label: cleanLabel }];
|
|
1427
|
+
return patchSettingsUnlocked({ providerAccounts: { ...accounts, claudeNative: next } });
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1398
1430
|
const listeners = new Set();
|
|
1399
1431
|
export function onSettingsChange(listener) {
|
|
1400
1432
|
listeners.add(listener);
|
package/server/dist/skills.js
CHANGED
|
@@ -29,7 +29,7 @@ import { ARCHITECTURE_REVIEW_SKILL } from './architectureSkill.js';
|
|
|
29
29
|
import { PROPORTIONATE_TESTING_SKILL } from './proportionateTestingSkill.js';
|
|
30
30
|
import { THIRD_PARTY_SKILL_FILES } from './thirdPartySkills.js';
|
|
31
31
|
const ARCO_BUILTIN_SKILLS = [ARCHITECTURE_REVIEW_SKILL, PROPORTIONATE_TESTING_SKILL];
|
|
32
|
-
const OPERATOR_BUILTINS = new Set(['grill-me', 'grill-with-docs', 'wait-what', 'retro']);
|
|
32
|
+
const OPERATOR_BUILTINS = new Set(['grill-me', 'grill-with-docs', 'wait-what', 'retro', 'code-review']);
|
|
33
33
|
export function listBuiltinSkills() {
|
|
34
34
|
return [...ARCO_BUILTIN_SKILLS.map(s => ({ slug: s.slug, name: s.name, description: s.description, scope: 'builtin', operatorOnly: s.operatorOnly })), ...THIRD_PARTY_SKILL_FILES.map(({ slug, files }) => {
|
|
35
35
|
const parsed = parseSkillFile(files['SKILL.md']);
|
|
@@ -152,7 +152,7 @@ export function claudeAdapter(opts = {}) {
|
|
|
152
152
|
async evaluate(req) {
|
|
153
153
|
const { signal, done } = deadline(req);
|
|
154
154
|
try {
|
|
155
|
-
const { accessToken } = await tokens().catch(() => { throw new EvaluatorRefused('not_signed_in'); });
|
|
155
|
+
const { accessToken } = await tokens(req.providerAccountRef).catch(() => { throw new EvaluatorRefused('not_signed_in'); });
|
|
156
156
|
const client = new Anthropic({
|
|
157
157
|
authToken: accessToken,
|
|
158
158
|
apiKey: null,
|
|
@@ -161,7 +161,7 @@ export function claudeAdapter(opts = {}) {
|
|
|
161
161
|
defaultHeaders: { 'anthropic-beta': 'claude-code-20250219,oauth-2025-04-20', 'anthropic-dangerous-direct-browser-access': 'true', 'user-agent': CLAUDE_CLI_USER_AGENT, 'x-app': 'cli' },
|
|
162
162
|
...(opts.fetchImpl ? { fetch: opts.fetchImpl } : {}),
|
|
163
163
|
});
|
|
164
|
-
const model = resolveClaudeAliasFromCatalog(req.model);
|
|
164
|
+
const model = resolveClaudeAliasFromCatalog(req.model, req.providerAccountRef);
|
|
165
165
|
const resp = await client.messages.create({
|
|
166
166
|
model,
|
|
167
167
|
...shortTextRequestParams(model, req.maxOutputTokens),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { workflows } from './server/state.js';
|
|
1
2
|
// Smart AUTO-PICKUP observer: decides, for one idle member at a time, what
|
|
2
3
|
// the chosen evaluator proposes for its waiting mail, and records it. In
|
|
3
4
|
// Observe-only mode that record is the whole effect. In Automatic mode a wake
|
|
@@ -20,7 +21,7 @@ import { withFileLock } from './atomicFile.js';
|
|
|
20
21
|
import { buildClusterAutoPickup } from '@arco/shared';
|
|
21
22
|
import { evaluatorAdapter, isStartupFailure } from './smartPickupAdapters.js';
|
|
22
23
|
import { recentSentTo } from './smartPickupThread.js';
|
|
23
|
-
import { isGeminiMember } from './geminiMembers.js';
|
|
24
|
+
import { geminiPickupAllowed, isGeminiMember } from './geminiMembers.js';
|
|
24
25
|
const defaultDebounce = (() => {
|
|
25
26
|
const raw = Number(process.env.ARCO_SMART_PICKUP_DEBOUNCE_MS);
|
|
26
27
|
return Number.isInteger(raw) && raw >= 0 ? raw : 2000;
|
|
@@ -177,9 +178,7 @@ export async function evaluateOnce(clusterId, workflowId) {
|
|
|
177
178
|
if (!deferLapsed && !prior.retryEvaluation)
|
|
178
179
|
return null;
|
|
179
180
|
}
|
|
180
|
-
|
|
181
|
-
// NUDGE; Smart pickup neither evaluates nor wakes it.
|
|
182
|
-
if (isGeminiMember(workflowId)) {
|
|
181
|
+
if (isGeminiMember(workflowId) && !geminiPickupAllowed(workflowId)) {
|
|
183
182
|
const d = { ...base, action: null, reason: 'operator_send_only', outcome: 'skipped' };
|
|
184
183
|
await record(d);
|
|
185
184
|
return d;
|
|
@@ -219,7 +218,11 @@ export async function evaluateOnce(clusterId, workflowId) {
|
|
|
219
218
|
return null;
|
|
220
219
|
}
|
|
221
220
|
try {
|
|
221
|
+
const recipient = workflows.get(workflowId);
|
|
222
|
+
const providerAccountRef = evaluator.provider === 'claude' && recipient?.primary.provider === 'claude'
|
|
223
|
+
&& recipient.config.claudeTransport !== 'cli' && !recipient.config.ultracode ? recipient.config.providerAccountRef : undefined;
|
|
222
224
|
raw = await evaluatorAdapter(evaluator.provider).evaluate({
|
|
225
|
+
providerAccountRef,
|
|
223
226
|
model: evaluator.model,
|
|
224
227
|
instructions: EVALUATOR_INSTRUCTIONS,
|
|
225
228
|
prompt: evaluatorUserPrompt(snapshot.payload),
|
|
@@ -282,7 +285,7 @@ export async function evaluateOnce(clusterId, workflowId) {
|
|
|
282
285
|
return d;
|
|
283
286
|
}
|
|
284
287
|
// Conditions that pass with time; a wake blocked by one stays owed.
|
|
285
|
-
const TRANSIENT = new Set(['busy', 'cooldown', 'rate_capped', 'limit_wakes_member_hour']);
|
|
288
|
+
const TRANSIENT = new Set(['busy', 'cooldown', 'rate_capped', 'limit_wakes_member_hour', 'member_blocked']);
|
|
286
289
|
async function gateAndRecord(proposal, arm) {
|
|
287
290
|
const result = await gateWake(proposal, arm);
|
|
288
291
|
const fallback = proposal.action === null;
|