arco-workbench 0.2.2 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +1 -1
- package/THIRD_PARTY_NOTICES +2 -2
- package/client/dist/assets/{PhosphorBackdrop-BbR3xmfD.js → PhosphorBackdrop-CLILIwOQ.js} +1 -1
- package/client/dist/assets/{ThemedBackgroundShaderImpl-UMjbs9ZN.js → ThemedBackgroundShaderImpl-B87chcb5.js} +1 -1
- package/client/dist/assets/{XtermView-n135qz-f.js → XtermView-BP_j7WSN.js} +1 -1
- package/client/dist/assets/{galleryEditor-CFSke4by.js → galleryEditor-B90phoBI.js} +1 -1
- package/client/dist/assets/{index-DeoJbjI3.js → index-BfPp1Oup.js} +270 -270
- package/client/dist/index.html +1 -1
- package/client/dist/manifest-mobile.webmanifest +1 -0
- package/client/src/App.tsx +2 -2
- package/client/src/components/AuthReloginNotice.tsx +7 -6
- package/client/src/components/ChatMessage.tsx +41 -29
- package/client/src/components/ChatPanel.tsx +17 -4
- package/client/src/components/ClaudeNativeAccountPicker.tsx +32 -0
- package/client/src/components/ClaudeNativeAuthRow.tsx +71 -19
- package/client/src/components/ClusterRightPanel/AddWorkerSection.tsx +11 -281
- package/client/src/components/ClusterRightPanel/AutoPickupControl.tsx +1 -1
- package/client/src/components/ClusterRightPanel/FreshMemberForm.tsx +315 -0
- package/client/src/components/ClusterRightPanel/ReplaceMemberDialog.tsx +17 -7
- package/client/src/components/ClusterRightPanel/index.tsx +1 -1
- package/client/src/components/ClusterRightPanel/useFreshMemberPicker.ts +6 -4
- package/client/src/components/ClusterTab.tsx +2 -2
- package/client/src/components/Connections/Connections.tsx +7 -11
- package/client/src/components/Connections/model.ts +3 -1
- package/client/src/components/FileViewerModal.tsx +54 -17
- package/client/src/components/GitHubPanel/index.tsx +9 -5
- package/client/src/components/HandoffDialog.tsx +5 -3
- package/client/src/components/MobileShell.tsx +1 -33
- package/client/src/components/OperatorQuestionNotice.tsx +5 -4
- package/client/src/components/ProvidersPopover.tsx +6 -2
- package/client/src/components/RightPanel/ActivityTab.tsx +2 -1
- package/client/src/components/RightPanel/ConfigTab.tsx +23 -5
- package/client/src/components/RightPanel/OutputsPanel.tsx +21 -9
- package/client/src/components/RightPanel/outputsReconcile.ts +31 -0
- package/client/src/components/SettingsPanel.tsx +7 -10
- package/client/src/components/SpawnDialog.tsx +14 -3
- package/client/src/components/TabBar.tsx +2 -2
- package/client/src/components/TabContextMenu.tsx +73 -133
- package/client/src/components/TerminalInput.tsx +4 -3
- package/client/src/components/TranscriptWorkerDialog.tsx +14 -4
- package/client/src/components/UsageBar.tsx +37 -18
- package/client/src/components/WorkflowCreator/ClusterMembersSection.tsx +29 -3
- package/client/src/components/WorkflowCreator/index.tsx +29 -15
- package/client/src/components/WorkflowView.tsx +1 -1
- package/client/src/components/providerIndicator.ts +7 -3
- package/client/src/components/research/QuickResearchOverview.tsx +7 -3
- package/client/src/components/research/SavedQuickKeep.tsx +7 -3
- package/client/src/components/settings/GitHubAuthRow.tsx +34 -0
- package/client/src/explorer/ArtifactsLens.tsx +17 -8
- package/client/src/explorer/ExplorerApp.tsx +3 -3
- package/client/src/explorer/types.ts +3 -1
- package/client/src/help/content/cluster.tsx +10 -4
- package/client/src/help/content/composer.tsx +3 -2
- package/client/src/help/content/header.tsx +6 -3
- package/client/src/help/content/misc.tsx +9 -7
- package/client/src/help/content/rightPanel.tsx +11 -6
- package/client/src/help/content/settings.tsx +14 -3
- package/client/src/help/content/tabbar.tsx +1 -1
- package/client/src/help/manualSections/actions.tsx +5 -1
- package/client/src/help/manualSections/clusters.tsx +21 -15
- package/client/src/help/manualSections/configuration.tsx +6 -4
- package/client/src/help/manualSections/gettingStarted.tsx +4 -2
- package/client/src/help/manualSections/maintenance.tsx +24 -0
- package/client/src/help/manualSections/powerFeatures.tsx +4 -2
- package/client/src/help/manualSections/providers.tsx +11 -4
- package/client/src/help/manualSections/workspace.tsx +3 -3
- package/client/src/hooks/useClaudeNativeCatalog.ts +26 -0
- package/client/src/hooks/useClaudeNativeLogin.ts +16 -11
- package/client/src/hooks/useWebSocket.ts +4 -2
- package/client/src/layout/layoutRange.ts +14 -5
- package/client/src/main.tsx +2 -0
- package/client/src/questions/waitingQuestion.ts +2 -0
- package/client/src/stores/appStore.ts +5 -1
- package/client/src/stores/appStore.types.ts +2 -0
- package/client/src/stores/replayContext.ts +20 -0
- package/client/src/utils/chatFileLinks.ts +34 -3
- package/client/src/utils/claudeAuth.ts +9 -1
- package/client/src/ws/handleServerMessage.ts +11 -3
- package/docs/ARCHITECTURE.md +3 -3
- package/docs/BACKUP.md +1 -1
- package/docs/CHECKPOINTS.md +67 -3
- package/docs/CLIENT.md +11 -6
- package/docs/EXTENDING.md +1 -1
- package/docs/FEATURES.md +3 -3
- package/docs/GETTING_STARTED.md +5 -4
- package/docs/GIT_WORKBENCH.md +8 -0
- package/docs/GLOSSARY.md +2 -2
- package/docs/GOTCHAS.md +4 -4
- package/docs/HTTP_API.md +63 -30
- package/docs/OPERATIONS.md +11 -0
- package/docs/OPERATOR_ACTIONS.md +2 -2
- package/docs/OUTPUTS.md +48 -6
- package/docs/PERSISTENCE.md +1 -1
- package/docs/PRIMITIVES.md +4 -2
- package/docs/PROTOCOL_CLUSTER.md +12 -6
- package/docs/PROTOCOL_PRIMITIVES.md +1 -1
- package/docs/PROVIDERS.md +47 -10
- package/docs/RESEARCH.md +3 -3
- package/docs/SETTINGS.md +9 -4
- package/node_modules/@arco/shared/dist/protocol/clusters.d.ts +15 -3
- package/node_modules/@arco/shared/dist/protocol/clusters.js +1 -1
- package/node_modules/@arco/shared/dist/protocol/models.d.ts +6 -1
- package/node_modules/@arco/shared/dist/protocol/operatorQuestions.d.ts +2 -1
- package/node_modules/@arco/shared/dist/protocol/settings.d.ts +3 -0
- package/node_modules/@arco/shared/dist/protocol/settings.js +5 -0
- package/node_modules/@arco/shared/dist/protocol/workflows.d.ts +1 -0
- package/node_modules/@arco/shared/dist/protocol/workflows.js +0 -2
- package/node_modules/@arco/shared/package.json +1 -1
- package/package.json +2 -2
- package/scripts/packaging/services.mjs +20 -1
- package/scripts/packaging/update.mjs +37 -2
- package/server/dist/attention.d.ts +6 -0
- package/server/dist/attention.js +6 -0
- package/server/dist/auth.d.ts +5 -0
- package/server/dist/auth.js +31 -20
- package/server/dist/clusterAutoTurn.d.ts +5 -1
- package/server/dist/clusterAutoTurn.js +31 -9
- package/server/dist/clusterPresets.js +3 -3
- package/server/dist/effortValidation.d.ts +2 -2
- package/server/dist/effortValidation.js +4 -4
- package/server/dist/explorerArtifacts.d.ts +1 -0
- package/server/dist/explorerArtifacts.js +12 -1
- package/server/dist/explorerDocs.d.ts +1 -0
- package/server/dist/explorerDocs.js +4 -4
- package/server/dist/geminiMembers.d.ts +7 -1
- package/server/dist/geminiMembers.js +28 -14
- package/server/dist/gitSnapshots.d.ts +1 -0
- package/server/dist/gitSnapshots.js +547 -83
- package/server/dist/http/clusterRoutes.js +9 -3
- package/server/dist/http/conversationFiles.d.ts +36 -0
- package/server/dist/http/conversationFiles.js +222 -0
- package/server/dist/http/fileBytes.d.ts +3 -0
- package/server/dist/http/fileBytes.js +33 -0
- package/server/dist/http/fileContentRoute.d.ts +2 -0
- package/server/dist/http/fileContentRoute.js +139 -0
- package/server/dist/http/fileRead.d.ts +54 -2
- package/server/dist/http/fileRead.js +31 -24
- package/server/dist/http/outputRoutes.js +14 -21
- package/server/dist/http/readConfinement.d.ts +0 -11
- package/server/dist/http/readConfinement.js +4 -30
- package/server/dist/http/router.js +41 -66
- package/server/dist/index.js +26 -12
- package/server/dist/management/initHubLink.js +1 -1
- package/server/dist/outputs.js +8 -0
- package/server/dist/primitives/exportContext.d.ts +2 -0
- package/server/dist/primitives/exportContext.js +13 -2
- package/server/dist/primitives/runCompare.d.ts +7 -1
- package/server/dist/primitives/runCompare.js +44 -20
- package/server/dist/project/taskLedger.js +46 -34
- package/server/dist/providerAccounts.d.ts +4 -0
- package/server/dist/providerAccounts.js +20 -1
- package/server/dist/providers/antigravity/artifacts.d.ts +23 -0
- package/server/dist/providers/antigravity/artifacts.js +140 -0
- package/server/dist/providers/antigravity/index.js +85 -7
- package/server/dist/providers/antigravity/questions.d.ts +2 -0
- package/server/dist/providers/antigravity/questions.js +58 -0
- package/server/dist/providers/claude-native/auth.d.ts +9 -8
- package/server/dist/providers/claude-native/auth.js +50 -58
- package/server/dist/providers/claude-native/authStatus.d.ts +2 -2
- package/server/dist/providers/claude-native/authStatus.js +9 -7
- package/server/dist/providers/claude-native/catalog.d.ts +6 -5
- package/server/dist/providers/claude-native/catalog.js +50 -39
- package/server/dist/providers/claude-native/oauth.d.ts +10 -9
- package/server/dist/providers/claude-native/oauth.js +120 -96
- package/server/dist/providers/claude-native/worker.d.ts +1 -0
- package/server/dist/providers/claude-native/worker.js +38 -23
- package/server/dist/providers/codex-appserver/operatorQuestions.d.ts +5 -3
- package/server/dist/providers/codex-appserver/operatorQuestions.js +27 -13
- package/server/dist/providers/codexChatBoundary.js +6 -1
- package/server/dist/research/quickPromotion.d.ts +3 -0
- package/server/dist/research/quickPromotion.js +26 -9
- package/server/dist/research/savedQuickPromotion.js +2 -11
- package/server/dist/server/broadcast.js +6 -0
- package/server/dist/settings.d.ts +1 -0
- package/server/dist/settings.js +39 -7
- package/server/dist/skills.js +1 -1
- package/server/dist/smartPickupAdapters.d.ts +1 -0
- package/server/dist/smartPickupAdapters.js +2 -2
- package/server/dist/smartPickupObserver.js +8 -5
- package/server/dist/thirdPartySkills.js +11 -5
- package/server/dist/turnChanges.d.ts +1 -1
- package/server/dist/turnChanges.js +5 -4
- package/server/dist/usage.d.ts +1 -1
- package/server/dist/usage.js +39 -27
- package/server/dist/workers/WorkerManager.d.ts +1 -0
- package/server/dist/workers/WorkerManager.js +1 -0
- package/server/dist/workers/processKill.js +37 -24
- package/server/dist/workflowMeta.js +2 -2
- package/server/dist/ws/clusterHandlers.d.ts +2 -2
- package/server/dist/ws/clusterHandlers.js +127 -113
- package/server/dist/ws/clusterMembers.d.ts +1 -1
- package/server/dist/ws/clusterMembers.js +34 -4
- package/server/dist/ws/compactHandlers.js +30 -14
- package/server/dist/ws/compareHandlers.js +53 -21
- package/server/dist/ws/gateHandlers.js +2 -0
- package/server/dist/ws/genesisHandlers.js +5 -3
- package/server/dist/ws/handoffHandlers.d.ts +1 -1
- package/server/dist/ws/handoffHandlers.js +115 -39
- package/server/dist/ws/transcriptWorkerHandlers.js +7 -2
- package/server/dist/ws/turnEngine.js +37 -19
- package/server/dist/ws/updatePrimaryConfig.d.ts +3 -2
- package/server/dist/ws/updatePrimaryConfig.js +236 -133
- package/server/dist/ws/workflowHandlers.js +21 -4
- package/server/package.json +1 -1
- package/server/src/attention.ts +7 -0
- package/server/src/auth.ts +33 -20
- package/server/src/clusterAutoTurn.ts +31 -11
- package/server/src/clusterPresets.ts +2 -2
- package/server/src/effortValidation.ts +4 -4
- package/server/src/explorerArtifacts.ts +12 -1
- package/server/src/explorerDocs.ts +5 -5
- package/server/src/geminiMembers.ts +26 -15
- package/server/src/gitSnapshots.ts +538 -82
- package/server/src/http/clusterRoutes.ts +10 -3
- package/server/src/http/conversationFiles.ts +231 -0
- package/server/src/http/fileBytes.ts +34 -0
- package/server/src/http/fileContentRoute.ts +123 -0
- package/server/src/http/fileRead.ts +30 -25
- package/server/src/http/outputRoutes.ts +13 -13
- package/server/src/http/readConfinement.ts +3 -30
- package/server/src/http/router.ts +39 -62
- package/server/src/index.ts +27 -18
- package/server/src/management/initHubLink.ts +1 -1
- package/server/src/outputs.ts +8 -0
- package/server/src/primitives/exportContext.ts +14 -2
- package/server/src/primitives/runCompare.ts +73 -46
- package/server/src/project/taskLedger.ts +47 -30
- package/server/src/providerAccounts.ts +20 -1
- package/server/src/providers/antigravity/artifacts.ts +121 -0
- package/server/src/providers/antigravity/index.ts +64 -6
- package/server/src/providers/antigravity/questions.ts +52 -0
- package/server/src/providers/claude-native/auth.ts +45 -60
- package/server/src/providers/claude-native/authStatus.ts +9 -8
- package/server/src/providers/claude-native/catalog.ts +52 -35
- package/server/src/providers/claude-native/oauth.ts +101 -77
- package/server/src/providers/claude-native/worker.ts +38 -22
- package/server/src/providers/codex-appserver/operatorQuestions.ts +26 -12
- package/server/src/providers/codexChatBoundary.ts +6 -1
- package/server/src/research/quickPromotion.ts +24 -6
- package/server/src/research/savedQuickPromotion.ts +2 -8
- package/server/src/server/broadcast.ts +4 -0
- package/server/src/settings.ts +36 -8
- package/server/src/skills.ts +1 -1
- package/server/src/smartPickupAdapters.ts +3 -2
- package/server/src/smartPickupObserver.ts +8 -5
- package/server/src/thirdPartySkills.ts +11 -5
- package/server/src/turnChanges.ts +5 -4
- package/server/src/usage.ts +30 -22
- package/server/src/workers/WorkerManager.ts +2 -0
- package/server/src/workers/processKill.ts +37 -23
- package/server/src/workflowMeta.ts +2 -2
- package/server/src/ws/clusterHandlers.ts +107 -104
- package/server/src/ws/clusterMembers.ts +25 -6
- package/server/src/ws/compactHandlers.ts +29 -15
- package/server/src/ws/compareHandlers.ts +59 -25
- package/server/src/ws/gateHandlers.ts +2 -0
- package/server/src/ws/genesisHandlers.ts +5 -4
- package/server/src/ws/handoffHandlers.ts +105 -37
- package/server/src/ws/transcriptWorkerHandlers.ts +6 -2
- package/server/src/ws/turnEngine.ts +36 -18
- package/server/src/ws/updatePrimaryConfig.ts +230 -132
- package/server/src/ws/workflowHandlers.ts +20 -4
- package/shared/dist/protocol/clusters.d.ts +15 -3
- package/shared/dist/protocol/clusters.js +1 -1
- package/shared/dist/protocol/models.d.ts +6 -1
- package/shared/dist/protocol/operatorQuestions.d.ts +2 -1
- package/shared/dist/protocol/settings.d.ts +3 -0
- package/shared/dist/protocol/settings.js +5 -0
- package/shared/dist/protocol/workflows.d.ts +1 -0
- package/shared/dist/protocol/workflows.js +0 -2
- package/shared/src/protocol/clusters.ts +23 -5
- package/shared/src/protocol/compare.ts +2 -2
- package/shared/src/protocol/models.ts +8 -4
- package/shared/src/protocol/operatorQuestions.ts +2 -1
- package/shared/src/protocol/settings.ts +8 -1
- package/shared/src/protocol/workflows.ts +1 -1
package/server/dist/usage.js
CHANGED
|
@@ -2,6 +2,7 @@ import { readFile } from 'fs/promises';
|
|
|
2
2
|
import { join } from 'path';
|
|
3
3
|
import { homedir } from 'os';
|
|
4
4
|
import { createHash } from 'node:crypto';
|
|
5
|
+
import { requireClaudeNativeAccount } from './providerAccounts.js';
|
|
5
6
|
import { loadTokens, nativeCredentialBinding } from './providers/claude-native/auth.js';
|
|
6
7
|
import { ensureLiveTokens as ensureClaudeNativeTokens, REFRESH_LEAD_MS_EXPORT } from './providers/claude-native/oauth.js';
|
|
7
8
|
const CREDENTIALS_PATH = join(process.env.CLAUDE_CONFIG_DIR || join(homedir(), '.claude'), '.credentials.json');
|
|
@@ -13,13 +14,13 @@ const inFlight = new Map();
|
|
|
13
14
|
let checkSequence = 0;
|
|
14
15
|
// Read current revisions before considering cached data. Native refresh stays
|
|
15
16
|
// with its credential owner and happens only on a cache miss before a request.
|
|
16
|
-
async function readNativeCredentials() {
|
|
17
|
-
const tokens = await loadTokens();
|
|
17
|
+
async function readNativeCredentials(accountRef) {
|
|
18
|
+
const tokens = await loadTokens(accountRef);
|
|
18
19
|
if (!tokens)
|
|
19
20
|
return null;
|
|
20
21
|
if (typeof tokens.accessToken !== 'string' || !tokens.accessToken || typeof tokens.refreshToken !== 'string' || !tokens.refreshToken || !Number.isFinite(tokens.expiresAt))
|
|
21
22
|
throw new Error('Invalid Native credentials');
|
|
22
|
-
return { accessToken: tokens.accessToken, expiresAt: tokens.expiresAt, subscriptionType: 'claude-native', source: 'claude-native', binding: nativeCredentialBinding(tokens) };
|
|
23
|
+
return { accessToken: tokens.accessToken, expiresAt: tokens.expiresAt, subscriptionType: 'claude-native', source: 'claude-native', binding: nativeCredentialBinding(tokens, accountRef) };
|
|
23
24
|
}
|
|
24
25
|
async function readCliCredentials() {
|
|
25
26
|
let raw;
|
|
@@ -46,25 +47,27 @@ async function getCliTokens() { return readCliCredentials(); }
|
|
|
46
47
|
export async function getCliUsageBinding() {
|
|
47
48
|
return (await getCliTokens().catch(() => null))?.binding ?? { source: 'claude-cli', storeId: 'claude-cli-default' };
|
|
48
49
|
}
|
|
49
|
-
async function getTokenCandidates() {
|
|
50
|
+
async function getTokenCandidates(accountRef) {
|
|
50
51
|
const tokens = [], errors = [];
|
|
51
52
|
try {
|
|
52
|
-
const native = await readNativeCredentials();
|
|
53
|
+
const native = await readNativeCredentials(accountRef);
|
|
53
54
|
if (native)
|
|
54
55
|
tokens.push(native);
|
|
55
56
|
}
|
|
56
57
|
catch {
|
|
57
58
|
errors.push('Native allowance credentials could not be read');
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
if (accountRef === undefined) {
|
|
61
|
+
try {
|
|
62
|
+
const cli = await getCliTokens();
|
|
63
|
+
if (cli)
|
|
64
|
+
tokens.push(cli);
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
errors.push('CLI allowance credentials could not be read');
|
|
68
|
+
}
|
|
66
69
|
}
|
|
67
|
-
return { tokens, errors, key: JSON.stringify([tokens.map(t => t.binding), errors]) };
|
|
70
|
+
return { tokens, errors, key: JSON.stringify([accountRef, tokens.map(t => t.binding), errors]) };
|
|
68
71
|
}
|
|
69
72
|
function unavailable(checkedAt, error, stale = false) {
|
|
70
73
|
return { session: null, weekly: null, subscriptionType: null, fetchedAt: Date.now(), checkedAt,
|
|
@@ -74,9 +77,9 @@ function unavailable(checkedAt, error, stale = false) {
|
|
|
74
77
|
function changed(checkedAt) {
|
|
75
78
|
return unavailable(checkedAt, 'Credentials changed while checking allowance. Check again for the current credential source.', true);
|
|
76
79
|
}
|
|
77
|
-
function credentialContext(context) {
|
|
80
|
+
function credentialContext(context, accountRef) {
|
|
78
81
|
return {
|
|
79
|
-
native: context.tokens.find(t => t.source === 'claude-native')?.binding ??
|
|
82
|
+
native: context.tokens.find(t => t.source === 'claude-native')?.binding ?? nativeCredentialBinding(null, accountRef),
|
|
80
83
|
cli: context.tokens.find(t => t.source === 'claude-cli')?.binding ?? { source: 'claude-cli', storeId: 'claude-cli-default' },
|
|
81
84
|
};
|
|
82
85
|
}
|
|
@@ -101,20 +104,20 @@ function windowValue(raw) {
|
|
|
101
104
|
throw new Error('Invalid allowance window');
|
|
102
105
|
return { utilization: value.utilization, resetsAt: typeof value.resets_at === 'string' ? value.resets_at : null };
|
|
103
106
|
}
|
|
104
|
-
async function checkUsage(initial, sequence) {
|
|
107
|
+
async function checkUsage(initial, sequence, accountRef) {
|
|
105
108
|
let context = initial;
|
|
106
109
|
const checkedAt = Date.now(), errors = [...initial.errors];
|
|
107
110
|
for (let index = 0; index < initial.tokens.length; index++) {
|
|
108
111
|
let tokens = initial.tokens[index];
|
|
109
|
-
if (index && (await getTokenCandidates()).key !== context.key)
|
|
112
|
+
if (index && (await getTokenCandidates(accountRef)).key !== context.key)
|
|
110
113
|
return changed(checkedAt);
|
|
111
114
|
try {
|
|
112
115
|
if (tokens.source === 'claude-native' && tokens.expiresAt <= Date.now() + REFRESH_LEAD_MS_EXPORT) {
|
|
113
116
|
// Preserve the Native owner's existing locking and expiry refresh.
|
|
114
117
|
// No allowance failure marks execution auth or invokes forced refresh.
|
|
115
|
-
const refreshed = await ensureClaudeNativeTokens();
|
|
116
|
-
const binding = nativeCredentialBinding(refreshed);
|
|
117
|
-
const next = await getTokenCandidates();
|
|
118
|
+
const refreshed = await ensureClaudeNativeTokens(accountRef);
|
|
119
|
+
const binding = nativeCredentialBinding(refreshed, accountRef);
|
|
120
|
+
const next = await getTokenCandidates(accountRef);
|
|
118
121
|
if (next.tokens.find(t => t.source === 'claude-native')?.binding.revision !== binding.revision
|
|
119
122
|
|| next.tokens.find(t => t.source === 'claude-cli')?.binding.revision !== context.tokens.find(t => t.source === 'claude-cli')?.binding.revision)
|
|
120
123
|
return changed(checkedAt);
|
|
@@ -133,11 +136,11 @@ async function checkUsage(initial, sequence) {
|
|
|
133
136
|
continue;
|
|
134
137
|
}
|
|
135
138
|
// Reading the revisions AFTER parsing also fences delayed response bodies.
|
|
136
|
-
if ((await getTokenCandidates()).key !== context.key)
|
|
139
|
+
if ((await getTokenCandidates(accountRef)).key !== context.key)
|
|
137
140
|
return changed(checkedAt);
|
|
138
141
|
const info = { session, weekly, subscriptionType: tokens.subscriptionType, fetchedAt: Date.now(), checkedAt,
|
|
139
142
|
source: tokens.source, binding: tokens.binding, identity: { state: 'unknown' }, available: true, stale: false,
|
|
140
|
-
credentialContext: credentialContext(context),
|
|
143
|
+
credentialContext: credentialContext(context, accountRef),
|
|
141
144
|
freshness: 'fresh', fallback: tokens.source === 'claude-cli' && (index > 0 || initial.errors.length > 0) };
|
|
142
145
|
return remember(context.key, info, sequence);
|
|
143
146
|
}
|
|
@@ -145,17 +148,26 @@ async function checkUsage(initial, sequence) {
|
|
|
145
148
|
errors.push(`Allowance request failed (${tokens.source}); execution authentication is unchanged`);
|
|
146
149
|
}
|
|
147
150
|
}
|
|
148
|
-
if ((await getTokenCandidates()).key !== context.key)
|
|
151
|
+
if ((await getTokenCandidates(accountRef)).key !== context.key)
|
|
149
152
|
return changed(checkedAt);
|
|
150
153
|
const error = `${errors.join('; ') || 'No suitable Claude OAuth allowance credentials found'}. Allowance availability is separate from execution authentication.`;
|
|
151
154
|
const previous = cache.get(context.key)?.value;
|
|
152
155
|
const info = previous?.binding && (previous.session || previous.weekly)
|
|
153
156
|
? { ...previous, available: false, stale: true, freshness: 'stale', checkedAt, error }
|
|
154
|
-
: { ...unavailable(checkedAt, error), credentialContext: credentialContext(context) };
|
|
157
|
+
: { ...unavailable(checkedAt, error), credentialContext: credentialContext(context, accountRef) };
|
|
155
158
|
return remember(context.key, info, sequence);
|
|
156
159
|
}
|
|
157
|
-
export async function getUsage(force = false) {
|
|
158
|
-
|
|
160
|
+
export async function getUsage(force = false, requestedAccount) {
|
|
161
|
+
let accountRef;
|
|
162
|
+
if (requestedAccount !== undefined) {
|
|
163
|
+
try {
|
|
164
|
+
accountRef = await requireClaudeNativeAccount(requestedAccount);
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
return unavailable(Date.now(), 'The selected Claude Native account is unavailable.');
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const candidates = await getTokenCandidates(accountRef);
|
|
159
171
|
const pending = inFlight.get(candidates.key);
|
|
160
172
|
if (pending)
|
|
161
173
|
return pending;
|
|
@@ -163,7 +175,7 @@ export async function getUsage(force = false) {
|
|
|
163
175
|
if (!force && cached && Date.now() - cached.cachedAt < CACHE_TTL_MS)
|
|
164
176
|
return fromCache(cached);
|
|
165
177
|
const sequence = ++checkSequence;
|
|
166
|
-
const promise = Promise.resolve().then(() => checkUsage(candidates, sequence)).finally(() => {
|
|
178
|
+
const promise = Promise.resolve().then(() => checkUsage(candidates, sequence, accountRef)).finally(() => {
|
|
167
179
|
if (inFlight.get(candidates.key) === promise)
|
|
168
180
|
inFlight.delete(candidates.key);
|
|
169
181
|
});
|
|
@@ -44,6 +44,7 @@ export declare class WorkerManager {
|
|
|
44
44
|
sandbox?: WorkerConfig['sandbox'];
|
|
45
45
|
interactionMode?: WorkerConfig['interactionMode'];
|
|
46
46
|
antigravityInteractive?: boolean;
|
|
47
|
+
antigravityHandoffWriter?: boolean;
|
|
47
48
|
antigravityChatWorkspace?: boolean;
|
|
48
49
|
disableProviderHooks?: boolean;
|
|
49
50
|
chatWebAccess?: boolean;
|
|
@@ -60,6 +60,7 @@ export class WorkerManager {
|
|
|
60
60
|
sandbox: options?.sandbox,
|
|
61
61
|
interactionMode: options?.interactionMode,
|
|
62
62
|
antigravityInteractive: options?.antigravityInteractive,
|
|
63
|
+
antigravityHandoffWriter: options?.antigravityHandoffWriter,
|
|
63
64
|
antigravityChatWorkspace: options?.antigravityChatWorkspace,
|
|
64
65
|
disableProviderHooks: options?.disableProviderHooks,
|
|
65
66
|
chatWebAccess: options?.chatWebAccess,
|
|
@@ -165,28 +165,41 @@ export function spawnShellChild(run, options) {
|
|
|
165
165
|
export function _shellTreeTagForTest(child) {
|
|
166
166
|
return msysTrees.get(child)?.tag;
|
|
167
167
|
}
|
|
168
|
-
//
|
|
169
|
-
//
|
|
170
|
-
//
|
|
171
|
-
//
|
|
168
|
+
// Print only the process IDs of matching entries. A readable MSYS /proc
|
|
169
|
+
// entry can still fail when opened. Put both virtual-file reads in a
|
|
170
|
+
// subshell so a failed probe cannot discard the rest of the scan.
|
|
171
|
+
// Diagnostic output contains only process IDs, stages and exit status.
|
|
172
172
|
export const MSYS_TREE_SWEEP = [
|
|
173
173
|
'tag=$1',
|
|
174
|
-
'
|
|
175
|
-
'
|
|
176
|
-
'
|
|
177
|
-
'
|
|
178
|
-
'
|
|
174
|
+
'observe=$2',
|
|
175
|
+
'platform=$3',
|
|
176
|
+
'proc=${4:-/proc}',
|
|
177
|
+
'if [ -n "$observe" ]; then exec 3>&2; fi',
|
|
178
|
+
'for d in "$proc"/[0-9]*; do',
|
|
179
|
+
' entry=${d##*/}',
|
|
180
|
+
' [[ "$entry" =~ ^[1-9][0-9]*$ ]] || continue',
|
|
181
|
+
' if (',
|
|
182
|
+
' [ -r "$d/environ" ] || exit 0',
|
|
183
|
+
` if [ -n "$observe" ]; then printf 'probe %s stage=environ\\n' "$entry" >&3; fi`,
|
|
184
|
+
' hit=',
|
|
185
|
+
` while IFS= read -r -d '' e || [ -n "$e" ]; do`,
|
|
186
|
+
' if [ "$e" = "' + PROCESS_TREE_ENV + '=$tag" ]; then hit=1; break; fi',
|
|
187
|
+
' done < "$d/environ" || exit "$?"',
|
|
188
|
+
' [ -n "$hit" ] || exit 0',
|
|
189
|
+
' pid=$entry',
|
|
190
|
+
' if [ "$platform" = win32 ]; then',
|
|
191
|
+
` if [ -n "$observe" ]; then printf 'probe %s stage=winpid\\n' "$entry" >&3; fi`,
|
|
192
|
+
' pid=',
|
|
193
|
+
' IFS= read -r pid < "$d/winpid" || [ -n "$pid" ] || exit 1',
|
|
194
|
+
' [[ "$pid" =~ ^[1-9][0-9]*$ ]] || exit 1',
|
|
195
|
+
' fi',
|
|
196
|
+
` printf '%s\\n' "$pid"`,
|
|
197
|
+
' ); then',
|
|
198
|
+
' :',
|
|
199
|
+
' else',
|
|
200
|
+
' status=$?',
|
|
201
|
+
` if [ -n "$observe" ]; then printf 'probe-failed %s status=%s\\n' "$entry" "$status" >&3; fi`,
|
|
179
202
|
' fi',
|
|
180
|
-
' [ -r "$d/environ" ] || continue',
|
|
181
|
-
' hit=',
|
|
182
|
-
' while IFS= read -r -d \'\' e || [ -n "$e" ]; do',
|
|
183
|
-
' if [ "$e" = "' + PROCESS_TREE_ENV + '=$tag" ]; then hit=1; break; fi',
|
|
184
|
-
' done < "$d/environ"',
|
|
185
|
-
' [ -n "$hit" ] || continue',
|
|
186
|
-
' w=',
|
|
187
|
-
' [ -r "$d/winpid" ] && read -r w < "$d/winpid"',
|
|
188
|
-
' if [ -n "$2" ]; then printf \'match %s pid=%s\\n\' "${d#/proc/}" "$w" >&3; fi',
|
|
189
|
-
' printf \'%s\\n\' "${w:-${d#/proc/}}"',
|
|
190
203
|
'done 2>/dev/null',
|
|
191
204
|
'',
|
|
192
205
|
].join('\n');
|
|
@@ -209,8 +222,10 @@ export async function msysTreeSweepRetrying(bash, tag, platform, sweep) {
|
|
|
209
222
|
let seen;
|
|
210
223
|
const found = await sweep(bash, tag, platform, (r) => { seen = r; });
|
|
211
224
|
const failed = !seen || seen.error !== undefined || seen.code !== 0;
|
|
212
|
-
|
|
213
|
-
|
|
225
|
+
const diagnostics = (seen?.stderr ?? '').trim().split(/\r?\n/);
|
|
226
|
+
const failedProbes = diagnostics.filter(line => line.startsWith('probe-failed '));
|
|
227
|
+
if (failed || found.length === 0 || failedProbes.length) {
|
|
228
|
+
const last = (failed || found.length === 0 ? diagnostics : failedProbes).slice(-3).join(' | ');
|
|
214
229
|
console.log(`[arco] msys tree sweep attempt ${attempt}: code=${seen?.code} signal=${seen?.signal} error=${seen?.error ?? 'none'} found=${found.length} ${Date.now() - started}ms${last ? ` stderr: ${last}` : ''}`);
|
|
215
230
|
}
|
|
216
231
|
if (!failed || seen?.error === 'sweep timed out' || attempt >= 2)
|
|
@@ -241,9 +256,7 @@ export function msysTreeSweep(bash, tag, platform = process.platform, observe) {
|
|
|
241
256
|
}, SWEEP_TIMEOUT_MS);
|
|
242
257
|
let sweeper;
|
|
243
258
|
try {
|
|
244
|
-
const args = ['-c', MSYS_TREE_SWEEP, 'arco-sweep', tag];
|
|
245
|
-
if (observe)
|
|
246
|
-
args.push('observe');
|
|
259
|
+
const args = ['-c', MSYS_TREE_SWEEP, 'arco-sweep', tag, observe ? 'observe' : '', platform];
|
|
247
260
|
const plan = shellSpawnPlan({ file: bash, args, msys: true }, { env, stdio: ['ignore', 'pipe', observe ? 'pipe' : 'ignore'] }, platform);
|
|
248
261
|
// The sweep itself must not carry a tag, or it would list itself.
|
|
249
262
|
if (plan.options.env)
|
|
@@ -66,7 +66,7 @@ export function workflowConfigFromMeta(meta, cwd) {
|
|
|
66
66
|
// Preserve the default-claude invariant (undefined ≡ claude).
|
|
67
67
|
primaryProvider: meta.primaryProvider === 'claude' ? undefined : meta.primaryProvider,
|
|
68
68
|
primaryModel: meta.primaryModel,
|
|
69
|
-
primaryEffort: normalizedWorkflowEffort(meta.primaryProvider, meta.primaryModel, meta.primaryEffort),
|
|
69
|
+
primaryEffort: normalizedWorkflowEffort(meta.primaryProvider, meta.primaryModel, meta.primaryEffort, meta.providerAccountRef),
|
|
70
70
|
skipPermissions: meta.primaryProvider === 'antigravity-cli' ? meta.antigravitySkipPermissions === true : true,
|
|
71
71
|
...(meta.providerAccountRef ? { providerAccountRef: meta.providerAccountRef } : {}),
|
|
72
72
|
// — transport overrides (HIGH: dropping these runs the WRONG transport) —
|
|
@@ -129,7 +129,7 @@ export async function readMeta(cwd, wfid) {
|
|
|
129
129
|
delete parsed.orchestratorProvider;
|
|
130
130
|
delete parsed.orchestratorModel;
|
|
131
131
|
delete parsed.orchestratorEffort;
|
|
132
|
-
parsed.primaryEffort = normalizedWorkflowEffort(parsed.primaryProvider, parsed.primaryModel, parsed.primaryEffort);
|
|
132
|
+
parsed.primaryEffort = normalizedWorkflowEffort(parsed.primaryProvider, parsed.primaryModel, parsed.primaryEffort, parsed.providerAccountRef);
|
|
133
133
|
return parsed;
|
|
134
134
|
}
|
|
135
135
|
catch (err) {
|
|
@@ -5,7 +5,7 @@ import * as taskDispatcher from '../taskDispatcher.js';
|
|
|
5
5
|
import { inferClusterProviderFromModel } from './clusterMembers.js';
|
|
6
6
|
import type { Session } from '../workflows/types.js';
|
|
7
7
|
export interface ClusterHandlerDeps {
|
|
8
|
-
handleUserMessage: (
|
|
8
|
+
handleUserMessage: typeof import('./turnEngine.js').handleUserMessage;
|
|
9
9
|
handleRemoveWorkflow: (workflowId: string) => void;
|
|
10
10
|
createBlankNativeWorkflow: (ws: WebSocket, session: Session, config: WorkflowConfig, options?: {
|
|
11
11
|
clusterMemberPending?: boolean;
|
|
@@ -41,7 +41,7 @@ export declare function handleClusterRename(ws: WebSocket, clusterId: string, na
|
|
|
41
41
|
export declare function dropClusterWorkflowState(workflowId: string): void;
|
|
42
42
|
export declare function handleClusterMemberRemove(clusterId: string, workflowId: string): Promise<void>;
|
|
43
43
|
export declare function handleClusterMemberAdd(ws: WebSocket, clusterId: string, workflowId: string): Promise<void>;
|
|
44
|
-
export declare function isKnownCatalogModel(provider: ClusterMemberProvider, modelId: string): Promise<boolean>;
|
|
44
|
+
export declare function isKnownCatalogModel(provider: ClusterMemberProvider, modelId: string, nativeAccount?: string): Promise<boolean>;
|
|
45
45
|
export declare function catalogDriftProbe(provider: string, model: string): Promise<boolean>;
|
|
46
46
|
export { inferClusterProviderFromModel };
|
|
47
47
|
export declare function resolveClusterOverrideProvider(inheritedProvider: ClusterMemberProvider, requestedProvider: ClusterMemberProvider | undefined, requestedModel: string | undefined): {
|