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
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { create } from 'zustand';
|
|
3
|
-
import type
|
|
3
|
+
import { DEFAULT_CLAUDE_NATIVE_ACCOUNT, type AuthStatusByProvider, type ClaudeCredentialBinding, type ClaudeNativeAuthFlow } from '@arco/shared';
|
|
4
4
|
import { useAppStore } from '../stores/appStore';
|
|
5
|
+
import { nativeAccountStatus } from '../utils/claudeAuth';
|
|
5
6
|
import { refreshClaudeAllowance } from '../utils/claudeAllowance';
|
|
6
7
|
|
|
7
8
|
type Session = { generation: number; busy: boolean; flow?: ClaudeNativeAuthFlow; authorizationUrl?: string; hint?: string; error?: string };
|
|
8
9
|
let latestStart = 0;
|
|
10
|
+
const latestAccountStart = new Map<string, number>();
|
|
9
11
|
export const useNativeLoginStore = create<{ sessions: Record<string, Session> }>(() => ({ sessions: {} }));
|
|
10
12
|
function update(owner: string, generation: number, patch: Partial<Session>): boolean {
|
|
11
13
|
const state = useNativeLoginStore.getState(), previous = state.sessions[owner];
|
|
@@ -21,7 +23,7 @@ export function nativeFlowPending(flow?: ClaudeNativeAuthFlow): boolean { return
|
|
|
21
23
|
async function acceptFlow(owner: string, generation: number, flow: ClaudeNativeAuthFlow): Promise<void> {
|
|
22
24
|
const previous = useNativeLoginStore.getState().sessions[owner];
|
|
23
25
|
if (previous?.generation !== generation || previous.flow?.id !== flow.id || !sameRecoveryBinding(previous.flow.bindingBefore, flow.bindingBefore)
|
|
24
|
-
|| previous.flow.workflowId !== flow.workflowId || !nativeFlowPending(previous.flow)) return;
|
|
26
|
+
|| previous.flow.workflowId !== flow.workflowId || previous.flow.accountRef !== flow.accountRef || !nativeFlowPending(previous.flow)) return;
|
|
25
27
|
if (previous.flow.status === 'exchanging' && flow.status === 'pending') return;
|
|
26
28
|
if (flow.status === 'complete') {
|
|
27
29
|
// Completion proves this grant was exchanged, not that a workflow ran.
|
|
@@ -30,30 +32,31 @@ async function acceptFlow(owner: string, generation: number, flow: ClaudeNativeA
|
|
|
30
32
|
const auth = await res.json() as AuthStatusByProvider;
|
|
31
33
|
const current = useNativeLoginStore.getState().sessions[owner];
|
|
32
34
|
if (current?.generation !== generation || current.flow?.id !== flow.id || !nativeFlowPending(current.flow)) return;
|
|
33
|
-
|
|
35
|
+
const account = nativeAccountStatus(auth.claude, flow.accountRef);
|
|
36
|
+
if (!sameRecoveryBinding(account?.binding, flow.binding)) {
|
|
34
37
|
update(owner, generation, { flow: { ...flow, status: 'superseded' }, busy: false, error: 'Native credentials changed after this flow. Review the current sign-in.' });
|
|
35
38
|
return;
|
|
36
39
|
}
|
|
37
|
-
const observed = useAppStore.getState().authStatus?.claude
|
|
38
|
-
if (observed &&
|
|
40
|
+
const observed = nativeAccountStatus(useAppStore.getState().authStatus?.claude, flow.accountRef);
|
|
41
|
+
if (observed && account && observed.checkedAt > account.checkedAt && !sameRecoveryBinding(observed.binding, account.binding)) {
|
|
39
42
|
update(owner, generation, { flow: { ...flow, status: 'superseded' }, busy: false, error: 'A newer Native credential observation replaced this flow.' });
|
|
40
43
|
return;
|
|
41
44
|
}
|
|
42
45
|
useAppStore.getState().setAuthStatus(auth);
|
|
43
46
|
// A completed, verified sign-in is an explicit connection action.
|
|
44
|
-
if (owner
|
|
47
|
+
if (owner.startsWith('native-account:')) {
|
|
45
48
|
void fetch('/api/connections/check?provider=claude', { method: 'POST' }).then(async connection => {
|
|
46
49
|
if (!connection.ok) return;
|
|
47
50
|
const body = await connection.json();
|
|
48
51
|
if (body?.settings?.enabledProviders) useAppStore.getState().setSettings(body.settings);
|
|
49
52
|
}).catch(() => { /* the provider can be enabled manually */ });
|
|
50
53
|
}
|
|
51
|
-
void refreshClaudeAllowance(true).then(usage => { if (usage) useAppStore.getState().setUsage(usage); }).catch(() => {});
|
|
54
|
+
if (!flow.accountRef) void refreshClaudeAllowance(true).then(usage => { if (usage) useAppStore.getState().setUsage(usage); }).catch(() => {});
|
|
52
55
|
}
|
|
53
56
|
update(owner, generation, { flow, busy: false, error: flow.error });
|
|
54
57
|
}
|
|
55
58
|
|
|
56
|
-
export function useClaudeNativeLogin(owner: string, workflowId?: string, binding?: ClaudeCredentialBinding) {
|
|
59
|
+
export function useClaudeNativeLogin(owner: string, workflowId?: string, binding?: ClaudeCredentialBinding, accountRef?: string) {
|
|
57
60
|
const session = useNativeLoginStore(s => s.sessions[owner]);
|
|
58
61
|
useEffect(() => {
|
|
59
62
|
if (!nativeFlowPending(session?.flow)) return;
|
|
@@ -77,18 +80,20 @@ export function useClaudeNativeLogin(owner: string, workflowId?: string, binding
|
|
|
77
80
|
|
|
78
81
|
const start = async () => {
|
|
79
82
|
const sequence = ++latestStart;
|
|
83
|
+
const accountKey = accountRef ?? DEFAULT_CLAUDE_NATIVE_ACCOUNT;
|
|
84
|
+
latestAccountStart.set(accountKey, sequence);
|
|
80
85
|
const generation = (useNativeLoginStore.getState().sessions[owner]?.generation ?? 0) + 1;
|
|
81
86
|
const sessions = { ...useNativeLoginStore.getState().sessions, [owner]: { generation, busy: true } };
|
|
82
87
|
// Bound in-memory UI history; OAuth authorization URLs are never persisted.
|
|
83
88
|
for (const key of Object.keys(sessions).slice(0, Math.max(0, Object.keys(sessions).length - 32))) if (key !== owner) delete sessions[key];
|
|
84
89
|
useNativeLoginStore.setState({ sessions });
|
|
85
90
|
try {
|
|
86
|
-
const res = await fetch('/api/auth/claude-native/login', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ binding, workflowId }) });
|
|
91
|
+
const res = await fetch('/api/auth/claude-native/login', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ binding, workflowId, accountRef }) });
|
|
87
92
|
const data = await res.json() as { flow?: ClaudeNativeAuthFlow; authorizationUrl?: string; manualReason?: string; error?: string };
|
|
88
93
|
if (!res.ok || !data.flow || !data.authorizationUrl) throw new Error(data.error || 'Could not start Native sign-in.');
|
|
89
|
-
if (sequence !==
|
|
94
|
+
if (sequence !== latestAccountStart.get(accountKey)) { update(owner, generation, { busy: false, error: 'Another Native sign-in request replaced this start. Review its status.' }); return; }
|
|
90
95
|
const current = useNativeLoginStore.getState().sessions;
|
|
91
|
-
useNativeLoginStore.setState({ sessions: Object.fromEntries(Object.entries(current).map(([key, value]) => [key, key !== owner && nativeFlowPending(value.flow) ? { ...value, flow: { ...value.flow!, status: 'superseded' }, busy: false } : value])) });
|
|
96
|
+
useNativeLoginStore.setState({ sessions: Object.fromEntries(Object.entries(current).map(([key, value]) => [key, key !== owner && (value.flow?.accountRef ?? DEFAULT_CLAUDE_NATIVE_ACCOUNT) === accountKey && nativeFlowPending(value.flow) ? { ...value, flow: { ...value.flow!, status: 'superseded' }, busy: false } : value])) });
|
|
92
97
|
if (!update(owner, generation, { flow: data.flow, authorizationUrl: data.authorizationUrl, busy: false, hint: data.manualReason })) return;
|
|
93
98
|
try { window.open(data.authorizationUrl, '_blank', 'noopener'); } catch { /* link and manual paste remain available */ }
|
|
94
99
|
} catch (err) { update(owner, generation, { busy: false, error: err instanceof Error ? err.message : 'Could not start Native sign-in.' }); }
|
|
@@ -2,7 +2,7 @@ import { checkBuild } from '../buildCheck';
|
|
|
2
2
|
import type { SpawnMemberIdentity } from '@arco/shared';
|
|
3
3
|
import { useEffect, useRef, useCallback, useState } from 'react';
|
|
4
4
|
import { useAppStore } from '../stores/appStore';
|
|
5
|
-
import type { ClientMessage, ServerMessage, WorkflowConfig, ModelName, EffortLevel, ChatMessage, ProviderName, ReviewContextRef, MemberTier, ClusterEfficiencyLevel, ClusterProgressMode, ClusterTaskBoardMode, ClusterMemberProvider, LedgerTaskStatus, TaskLink, GenesisSeed, GenesisGithubParams, GenesisAssistField, GenesisAssistIntent, PreviewCaptureKind, PreviewViewport, WorkbenchNoticeCategory, ArcoSkillRef, BakeoffAttemptSpec } from '@arco/shared';
|
|
5
|
+
import type { ClientMessage, ServerMessage, WorkflowConfig, ModelName, EffortLevel, ChatMessage, ProviderName, ReviewContextRef, MemberTier, ClusterEfficiencyLevel, ClusterProgressMode, ClusterTaskBoardMode, ClusterMemberProvider, ClusterFreshMemberSpec, LedgerTaskStatus, TaskLink, GenesisSeed, GenesisGithubParams, GenesisAssistField, GenesisAssistIntent, PreviewCaptureKind, PreviewViewport, WorkbenchNoticeCategory, ArcoSkillRef, BakeoffAttemptSpec } from '@arco/shared';
|
|
6
6
|
// Phase 6 extraction — the per-message dispatch (the former ws.onmessage body)
|
|
7
7
|
// and the streaming-state singletons live under ../ws now. Importing
|
|
8
8
|
// streamState here also loads its module-level useAppStore.subscribe prune
|
|
@@ -1051,7 +1051,7 @@ export function useWebSocket() {
|
|
|
1051
1051
|
const createClusterWithFreshWorkers = useCallback((
|
|
1052
1052
|
sourceWorkflowId: string,
|
|
1053
1053
|
additionalCount: number,
|
|
1054
|
-
opts?: { name?: string; provider?: ClusterMemberProvider; model?: string; effort?: string; providerAccountRef?: string },
|
|
1054
|
+
opts?: { name?: string; provider?: ClusterMemberProvider; model?: string; effort?: string; providerAccountRef?: string; members?: ClusterFreshMemberSpec[] },
|
|
1055
1055
|
) => {
|
|
1056
1056
|
if (wsRef.current?.readyState !== WebSocket.OPEN) return;
|
|
1057
1057
|
const name = opts?.name;
|
|
@@ -1060,6 +1060,8 @@ export function useWebSocket() {
|
|
|
1060
1060
|
sourceWorkflowId,
|
|
1061
1061
|
additionalCount,
|
|
1062
1062
|
...(name && name.trim().length > 0 ? { name: name.trim() } : {}),
|
|
1063
|
+
// One entry per fresh worker, each with its own choices.
|
|
1064
|
+
...(opts?.members ? { members: opts.members } : {}),
|
|
1063
1065
|
// provider/model/effort picker at spawn time. Undefined =
|
|
1064
1066
|
// server inherits from anchor (legacy behaviour).
|
|
1065
1067
|
...(opts?.provider ? { provider: opts.provider } : {}),
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
// browser, so a laptop and a desktop each keep their own; nothing is stored
|
|
3
3
|
// per project. See docs/CLIENT.md "Layout ranges".
|
|
4
4
|
//
|
|
5
|
-
// Automatic
|
|
6
|
-
// and Standard from 2000. Fixed modes apply at every width.
|
|
5
|
+
// Automatic uses the effective interface width. Fixed modes apply at every width.
|
|
7
6
|
|
|
8
7
|
import { useEffect, useState } from 'react';
|
|
9
8
|
|
|
@@ -13,8 +12,8 @@ export type LayoutRange = 'standard' | 'narrow' | 'medium';
|
|
|
13
12
|
export const LAYOUT_MODE_KEY = 'arco.layoutMode';
|
|
14
13
|
export const LAYOUT_MODE_EVENT = 'arco:layout-mode';
|
|
15
14
|
export const UI_SCALE_EVENT = 'arco:ui-scale';
|
|
16
|
-
export const COMPACT_FROM =
|
|
17
|
-
export const STANDARD_FROM =
|
|
15
|
+
export const COMPACT_FROM = 1200;
|
|
16
|
+
export const STANDARD_FROM = 1380;
|
|
18
17
|
// The mobile view (docs/CLIENT.md "Mobile view") is the separate /mobile
|
|
19
18
|
// address: one conversation at a time, a directory of tabs and full-screen
|
|
20
19
|
// panels, drawn from the same stores and theme as the desktop workbench.
|
|
@@ -24,6 +23,16 @@ export function isMobilePath(pathname: string): boolean {
|
|
|
24
23
|
return pathname === MOBILE_PATH || pathname.startsWith(`${MOBILE_PATH}/`);
|
|
25
24
|
}
|
|
26
25
|
|
|
26
|
+
// A shortcut installed from the phone view must open the phone view. The page
|
|
27
|
+
// at /mobile points at a manifest whose start_url is /mobile; every other
|
|
28
|
+
// address keeps the manifest that starts at /.
|
|
29
|
+
export const MANIFEST_HREF = '/manifest.webmanifest';
|
|
30
|
+
export const MOBILE_MANIFEST_HREF = '/manifest-mobile.webmanifest';
|
|
31
|
+
|
|
32
|
+
export function manifestHrefFor(pathname: string): string {
|
|
33
|
+
return isMobilePath(pathname) ? MOBILE_MANIFEST_HREF : MANIFEST_HREF;
|
|
34
|
+
}
|
|
35
|
+
|
|
27
36
|
function mobileRoute(): boolean {
|
|
28
37
|
return typeof window !== 'undefined' && isMobilePath(window.location.pathname);
|
|
29
38
|
}
|
|
@@ -42,7 +51,7 @@ export function isPhoneWidth(width: number, height = Infinity, coarsePointer = f
|
|
|
42
51
|
function coarsePointer(): boolean {
|
|
43
52
|
try { return typeof window !== 'undefined' && !!window.matchMedia?.('(pointer: coarse)').matches && !window.matchMedia('(any-pointer: fine)').matches; } catch { return false; }
|
|
44
53
|
}
|
|
45
|
-
export const AUTOMATIC_LAYOUT_DESCRIPTION =
|
|
54
|
+
export const AUTOMATIC_LAYOUT_DESCRIPTION = `Automatic picks by window width: Narrow under ${COMPACT_FROM}, Compact from ${COMPACT_FROM}, Standard from ${STANDARD_FROM} (interface pixels: browser viewport width divided by the Arco text scale).`;
|
|
46
55
|
|
|
47
56
|
export const LAYOUT_MODES: Array<{ id: LayoutMode; label: string; hint: string }> = [
|
|
48
57
|
{ id: 'auto', label: 'Automatic', hint: AUTOMATIC_LAYOUT_DESCRIPTION },
|
package/client/src/main.tsx
CHANGED
|
@@ -10,12 +10,14 @@ import { TerminalPopout } from './components/Terminal/TerminalPopout';
|
|
|
10
10
|
import { ExplorerApp } from './explorer/ExplorerApp';
|
|
11
11
|
import { installSessionFetch, startSessionRefresh } from './utils/wsSession';
|
|
12
12
|
import { startRecoveryGuard } from './buildCheck';
|
|
13
|
+
import { manifestHrefFor } from './layout/layoutRange';
|
|
13
14
|
|
|
14
15
|
// Apply cached theme synchronously before React mounts so the first paint
|
|
15
16
|
// matches the operator's saved theme. Without this the :root defaults
|
|
16
17
|
// (matrix green) render for ~100–500ms while /api/settings fetches. The pop-out
|
|
17
18
|
// route (below) inherits this for free — it is same-origin / same-localStorage.
|
|
18
19
|
bootstrapCachedTheme();
|
|
20
|
+
document.querySelector('link[rel="manifest"]')?.setAttribute('href', manifestHrefFor(window.location.pathname));
|
|
19
21
|
|
|
20
22
|
// WORKBENCH_EXPANSION §K4 — terminal pop-out route. There is NO router in this
|
|
21
23
|
// app; main.tsx mounts a single <App/>. The pop-out is a `window.open` to
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { JobState } from '../stores/appStore';
|
|
2
2
|
import type { ClusterStatePayload } from '@arco/shared';
|
|
3
3
|
import { useAppStore } from '../stores/appStore';
|
|
4
|
+
import { isReplaying } from '../stores/replayContext';
|
|
4
5
|
|
|
5
6
|
export function hasWaitingQuestion(job: JobState | undefined): boolean {
|
|
6
7
|
return !!job && ((job.claudeNativePendingQuestionIds?.length ?? 0) > 0 || job.messages.some((m) => m.operatorQuestion?.status === 'pending'));
|
|
@@ -29,6 +30,7 @@ export function questionToastText(workflowId: string): string {
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
export function notifyQuestion(workflowId: string, requestId?: string): void {
|
|
33
|
+
if (isReplaying()) return;
|
|
32
34
|
if (!requestId) { useAppStore.getState().pushNotification('info', questionToastText(workflowId), workflowId); return; }
|
|
33
35
|
useAppStore.setState((s) => ({ notifications: [...s.notifications.slice(-9), { id: `question-${requestId}`, level: 'info', message: questionToastText(workflowId), workflowId, createdAt: Date.now() }] }));
|
|
34
36
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isReplaying } from './replayContext';
|
|
1
2
|
import { phoneUploadRequest } from '../utils/phoneUploadApi';
|
|
2
3
|
import { validateSettings } from '../utils/settingsResponse';
|
|
3
4
|
import { create } from 'zustand';
|
|
@@ -851,7 +852,8 @@ export const useAppStore = create<AppState>()(persist((set, get) => ({
|
|
|
851
852
|
takeCreatorPrefill: () => { const prefill = get().creatorPrefill; if (prefill) set({ creatorPrefill: null }); return prefill; },
|
|
852
853
|
|
|
853
854
|
pushNotification: (level, message, workflowId, action) =>
|
|
854
|
-
|
|
855
|
+
// Restored history raises no toast (stores/replayContext.ts).
|
|
856
|
+
isReplaying() ? undefined : set((s) => ({
|
|
855
857
|
notifications: [
|
|
856
858
|
...s.notifications.slice(-9),
|
|
857
859
|
{ id: crypto.randomUUID(), level, message, createdAt: Date.now(), ...(workflowId ? { workflowId } : {}), ...(action ? { action } : {}) },
|
|
@@ -1884,6 +1886,7 @@ export const useAppStore = create<AppState>()(persist((set, get) => ({
|
|
|
1884
1886
|
);
|
|
1885
1887
|
const isEarlierPageRow = typeof msg.timestamp === 'number' && msg.timestamp < oldestExistingTs;
|
|
1886
1888
|
return {
|
|
1889
|
+
...(entry.kind === 'tool_use' && entry.filePath ? { writtenFilePaths: [...new Set([...(j.writtenFilePaths ?? []), entry.filePath])].slice(-1000) } : {}),
|
|
1887
1890
|
sessionChat: capSessionChat(next, {
|
|
1888
1891
|
preserveOldestCount: isEarlierPageRow ? LOADED_HISTORY_PIN : 0,
|
|
1889
1892
|
}),
|
|
@@ -1971,6 +1974,7 @@ export const useAppStore = create<AppState>()(persist((set, get) => ({
|
|
|
1971
1974
|
// Older messages are rehydratable from the Claude transcript on the
|
|
1972
1975
|
// disk if the operator picks RESUME on a long session.
|
|
1973
1976
|
messages: j.messages.slice(-200),
|
|
1977
|
+
...(j.writtenFilePaths?.length ? { writtenFilePaths: j.writtenFilePaths } : {}),
|
|
1974
1978
|
totalCost: j.totalCost,
|
|
1975
1979
|
totalTokens: j.totalTokens,
|
|
1976
1980
|
totalWorkers: j.totalWorkers,
|
|
@@ -313,6 +313,8 @@ export interface JobState {
|
|
|
313
313
|
// (not from events.jsonl). Empty for non-Claude providers. Not persisted —
|
|
314
314
|
// rebuilt via session_entry WS messages on every connect/reconnect.
|
|
315
315
|
sessionChat: ChatMessage[];
|
|
316
|
+
// Bounded paths recorded by session tools for conversation file links.
|
|
317
|
+
writtenFilePaths?: string[];
|
|
316
318
|
providerConversation?: 'unavailable' | 'awaiting-reading';
|
|
317
319
|
// Phase 2 context robustness — byte-count context fill estimate. Updated
|
|
318
320
|
// after each primary_complete and on rehydrate. Not persisted (derived).
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// History being restored after a connect or reconnect, as opposed to events
|
|
2
|
+
// that happen now. The server marks each replayed event (`replayed: true`) and
|
|
3
|
+
// the client treats the inside of a `replay_batch` the same way. While a
|
|
4
|
+
// replayed event is handled, its chat rows, activity and history are rebuilt
|
|
5
|
+
// as usual, but nothing is raised: no toast and no question alert. A live
|
|
6
|
+
// event that arrives during catch-up is not marked and still alerts, once.
|
|
7
|
+
let depth = 0;
|
|
8
|
+
|
|
9
|
+
export function isReplaying(): boolean {
|
|
10
|
+
return depth > 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function whileReplaying<T>(run: () => T): T {
|
|
14
|
+
depth += 1;
|
|
15
|
+
try { return run(); } finally { depth -= 1; }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function isReplayedMessage(msg: unknown): boolean {
|
|
19
|
+
return !!msg && typeof msg === 'object' && (msg as { replayed?: unknown }).replayed === true;
|
|
20
|
+
}
|
|
@@ -31,17 +31,49 @@ export interface WrittenFilesIndex {
|
|
|
31
31
|
// the file somewhere else; the server-side fallback in /api/file-content
|
|
32
32
|
// then tries the workflow's artifacts dir before giving up).
|
|
33
33
|
// Returns null for things we can't or shouldn't open (URLs, anchors, ~/…).
|
|
34
|
+
// A local `file:` URL as a path: `file:///a/b` -> `/a/b`, `file:///C:/a` ->
|
|
35
|
+
// `C:/a`. A URL naming another host, or one that does not decode, is null.
|
|
36
|
+
export function fileUrlToPath(url: string): string | null {
|
|
37
|
+
const match = /^file:\/\/(localhost)?(\/[^?#]*)$/i.exec(url.trim());
|
|
38
|
+
if (!match) return null;
|
|
39
|
+
let decoded: string;
|
|
40
|
+
try { decoded = decodeURIComponent(match[2]); } catch { return null; }
|
|
41
|
+
return /^\/[A-Za-z]:[\\/]/.test(decoded) ? decoded.slice(1) : decoded;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// The text of a Markdown link target to resolve. A `file:` URL is decoded once,
|
|
45
|
+
// by fileUrlToPath, so an escaped `%23` or `%25` in a filename survives; any
|
|
46
|
+
// other target is decoded here because Markdown encodes spaces and the like.
|
|
47
|
+
export function chatLinkTarget(href: string): string {
|
|
48
|
+
if (/^file:/i.test(href)) return href;
|
|
49
|
+
try { return decodeURIComponent(href); } catch { return href; }
|
|
50
|
+
}
|
|
51
|
+
|
|
34
52
|
export function resolveChatFilePath(
|
|
35
53
|
raw: string,
|
|
36
54
|
cwd: string | undefined,
|
|
37
55
|
index?: WrittenFilesIndex,
|
|
38
56
|
): string | null {
|
|
39
|
-
|
|
57
|
+
let t = raw.trim();
|
|
40
58
|
if (!t) return null;
|
|
59
|
+
if (/^file:/i.test(t)) {
|
|
60
|
+
const local = fileUrlToPath(t);
|
|
61
|
+
if (!local) return null;
|
|
62
|
+
t = local;
|
|
63
|
+
}
|
|
41
64
|
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(t)) return null; // http://, file://, etc.
|
|
42
65
|
if (t.startsWith('#') || t.startsWith('mailto:')) return null;
|
|
43
66
|
if (t.startsWith('~/')) return null;
|
|
44
67
|
|
|
68
|
+
// A link into an Antigravity session folder names one session's file. The
|
|
69
|
+
// viewer request reads that session's registered file (docs/OUTPUTS.md); a
|
|
70
|
+
// same-named file of another session in the index must not stand in for it.
|
|
71
|
+
if (/[\\/]\.gemini[\\/]antigravity-cli[\\/]brain[\\/]/i.test(t)) return t;
|
|
72
|
+
|
|
73
|
+
// An explicit path identifies a particular file and must not be replaced by
|
|
74
|
+
// an unrelated indexed file with the same basename.
|
|
75
|
+
if (t.startsWith('/') || WINDOWS_ABSOLUTE_RE.test(t)) return t;
|
|
76
|
+
|
|
45
77
|
if (index) {
|
|
46
78
|
const stripped = t.startsWith('./') ? t.slice(2) : t;
|
|
47
79
|
const tailHit = index.byTail.get(stripped.replace(/\\/g, '/'));
|
|
@@ -51,12 +83,11 @@ export function resolveChatFilePath(
|
|
|
51
83
|
if (baseHit) return baseHit;
|
|
52
84
|
}
|
|
53
85
|
|
|
54
|
-
if (t.startsWith('/') || WINDOWS_ABSOLUTE_RE.test(t)) return t;
|
|
55
86
|
if (!cwd) return null;
|
|
56
87
|
// Relative names are sent as written. The server resolves them against the
|
|
57
88
|
// bound project folder and then the workflow's artifacts folder, and reports
|
|
58
89
|
// the path it actually read; the viewer never shows a guessed join.
|
|
59
|
-
return t
|
|
90
|
+
return t;
|
|
60
91
|
}
|
|
61
92
|
|
|
62
93
|
const WINDOWS_ABSOLUTE_RE = /^(?:[A-Za-z]:[\\/]|\\\\)/;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { DEFAULT_CLAUDE_NATIVE_ACCOUNT, type AuthStatus, type ClaudeNativeAuthStatus } from '@arco/shared';
|
|
2
2
|
|
|
3
3
|
const STATUS_STALE_MS = 6 * 60 * 1000;
|
|
4
4
|
|
|
@@ -67,8 +67,16 @@ export function claudeConnection(status: AuthStatus | undefined, transport: 'nat
|
|
|
67
67
|
}
|
|
68
68
|
const view = claudeAuthPresentation(status, 'native', now);
|
|
69
69
|
if (view.nativeAvailable) return { connected: true, needsNativeSignIn: false, cliSignedIn, text: 'Native credentials detected' };
|
|
70
|
+
if (Object.values(status.nativeAccounts ?? {}).some(profile => profile.credentialsPresent
|
|
71
|
+
&& ['present', 'refresh-needed'].includes(profile.state) && !profile.probeFailed && !profile.stale)) {
|
|
72
|
+
return { connected: true, needsNativeSignIn: false, cliSignedIn, text: 'A Native account is connected' };
|
|
73
|
+
}
|
|
70
74
|
if (view.attention === 'native') {
|
|
71
75
|
return { connected: false, needsNativeSignIn: true, cliSignedIn, text: status.native.state === 'needs-attention' ? 'Native needs attention' : 'Native: sign-in needed' };
|
|
72
76
|
}
|
|
73
77
|
return { connected: !!status.loggedIn && !status.probeFailed, needsNativeSignIn: false, cliSignedIn, text: 'Status unknown' };
|
|
74
78
|
}
|
|
79
|
+
|
|
80
|
+
export function nativeAccountStatus(status: AuthStatus | undefined, accountRef?: string): ClaudeNativeAuthStatus | undefined {
|
|
81
|
+
return !accountRef || accountRef === DEFAULT_CLAUDE_NATIVE_ACCOUNT ? status?.native : status?.nativeAccounts?.[accountRef];
|
|
82
|
+
}
|
|
@@ -12,6 +12,7 @@ import { useComputerStore } from '../stores/computerStore';
|
|
|
12
12
|
import { useVoiceStore } from '../voice/store';
|
|
13
13
|
import { dispatchVoiceToolCall } from '../voice/toolBridge';
|
|
14
14
|
import { setClaudeQuestionIds, notifyQuestion } from '../questions/waitingQuestion';
|
|
15
|
+
import { isReplayedMessage, whileReplaying } from '../stores/replayContext';
|
|
15
16
|
import { markAskNoticeAnswered, parseAskNotice } from '../components/AskUserQuestionNotice';
|
|
16
17
|
import { handleAttentionEvent, clearQuestionAlert } from '../alerts/desktopAlerts';
|
|
17
18
|
import { applyOperatorQuestion, reconcileOperatorQuestions, questionMessageId } from './operatorQuestions';
|
|
@@ -176,6 +177,11 @@ function appendNativeActivity(workflowId: string, label: string, text: string):
|
|
|
176
177
|
// reads `deps.wsRef.current`; nothing else changed. The `const store`
|
|
177
178
|
// snapshot semantics (one snapshot per message) are preserved exactly.
|
|
178
179
|
export function handleServerMessage(msg: ServerMessage, deps: WsDeps): void {
|
|
180
|
+
if (isReplayedMessage(msg)) whileReplaying(() => handleMessage(msg, deps));
|
|
181
|
+
else handleMessage(msg, deps);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function handleMessage(msg: ServerMessage, deps: WsDeps): void {
|
|
179
185
|
const store = useAppStore.getState();
|
|
180
186
|
|
|
181
187
|
// Slot 5 — advance lastSeq for any workflow-scoped message carrying a
|
|
@@ -1487,7 +1493,7 @@ export function handleServerMessage(msg: ServerMessage, deps: WsDeps): void {
|
|
|
1487
1493
|
// the ingest is all-or-nothing (persisted lastSeq can never outrun
|
|
1488
1494
|
// persisted chat — the blank-workers bug), React batches
|
|
1489
1495
|
// it into one render, and the debounced persist flushes once.
|
|
1490
|
-
for (const ev of msg.events) {
|
|
1496
|
+
whileReplaying(() => { for (const ev of msg.events) {
|
|
1491
1497
|
const inner = ev as ServerMessage;
|
|
1492
1498
|
// Defense-in-depth: the server filters embedded workflow_created
|
|
1493
1499
|
// lines, but a replayed one here would clobber the freshly-built
|
|
@@ -1500,7 +1506,7 @@ export function handleServerMessage(msg: ServerMessage, deps: WsDeps): void {
|
|
|
1500
1506
|
// member's history.
|
|
1501
1507
|
console.error('[arco] replay_batch event failed:', err);
|
|
1502
1508
|
}
|
|
1503
|
-
}
|
|
1509
|
+
} });
|
|
1504
1510
|
break;
|
|
1505
1511
|
}
|
|
1506
1512
|
|
|
@@ -2103,7 +2109,9 @@ export function handleServerMessage(msg: ServerMessage, deps: WsDeps): void {
|
|
|
2103
2109
|
case 'operator_question': {
|
|
2104
2110
|
const known = store.jobs[msg.workflowId]?.messages.some((m) => m.id === questionMessageId(msg.question.requestId));
|
|
2105
2111
|
applyOperatorQuestion(msg.workflowId, msg.question, (msg as { seq?: number }).seq);
|
|
2106
|
-
|
|
2112
|
+
// Restored history is replayed quietly (notifyQuestion checks), so no clock
|
|
2113
|
+
// comparison is needed: a phone whose clock runs fast no longer misses a live question.
|
|
2114
|
+
if (msg.question.status === 'pending' && !known) notifyQuestion(msg.workflowId, msg.question.requestId);
|
|
2107
2115
|
break;
|
|
2108
2116
|
}
|
|
2109
2117
|
case 'computer_activity_changed':
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -425,7 +425,7 @@ All three primitives accept a `broadcast` callback so events can be stamped to a
|
|
|
425
425
|
- `llamacpp.ts` + `llamacppManager.ts` + `llamacppRecovery.ts` - singleton manager owns the `llama-server` daemon, OpenAI-compatible chat-completions endpoint, in-place auto-recovery for reasoning runaway / stall / tool-cap / context fill
|
|
426
426
|
- `lmstudio.ts` - LM Studio provider via its OpenAI-compatible `/v1` endpoint
|
|
427
427
|
- `cursor/` - Cursor via `cursor-agent` over the Agent Client Protocol (ACP). Default `acp` transport is a long-lived per-workflow JSON-RPC 2.0 worker (`worker.ts` / `acpJsonRpc.ts`); `print.ts` is the stateless `cursor-agent -p --mode ask` read-only one-shot used for reviewer / fresh-summarizer / DOCS / research / SECOND OPINION primitives (routed when `config.sandbox === 'read-only'` so a primitive never hijacks the live ACP session). `catalog.ts` enumerates the family×effort model roster via a short-lived `cursor-agent models` spawn - Cursor bakes reasoning effort into the model id (`-low` / `-high` / `-xhigh` / `-max`), so there is no separate effort surface. Cluster peer tools ride an in-process loopback StreamableHTTP MCP (`mcp/clusterMcpLoopback.ts`), since Cursor ACP honors MCP only over http/sse, not stdio.
|
|
428
|
-
- `antigravity/` - Antigravity CLI (Gemini) through Google's own `agy acp` on the operator's sign-in, interactive tabs only (`index.ts`), with `researchSignIn.ts` for the separate Gemini for research sign-in and `status.ts` for the provider status. Gemini members
|
|
428
|
+
- `antigravity/` - Antigravity CLI (Gemini) through Google's own `agy acp` on the operator's sign-in, interactive tabs only (`index.ts`), with `researchSignIn.ts` for the separate Gemini for research sign-in and `status.ts` for the provider status. Ordinary Gemini members can use AUTO-PICKUP and Gemini researchers wait for NUDGE; see [Gemini members](PROTOCOL_CLUSTER.md#gemini-members) and [Gemini researchers](RESEARCH.md#gemini-researchers).
|
|
429
429
|
- `strata.ts`, `deepseek.ts` - Strata and DeepSeek through Xolotl, separate HTTP connections that reuse the `lmstudio.ts` worker (see the paragraphs under "What Arco is").
|
|
430
430
|
- `codex-stream.ts` - streaming JSONL parsers
|
|
431
431
|
|
|
@@ -807,7 +807,7 @@ copies them into the recipient's `.arco/peer-artifacts/<msgId>/`.
|
|
|
807
807
|
- **Codex `exec` + `app-server`** - same MCP child registered via Codex's `-c mcp_servers.arco-cluster.*` TOML overrides (no `--mcp-config` flag in Codex CLI). The `app-server` transport's MCP child lives for the appserver's lifetime, not per-turn; cluster-context-change recycle in `acquireWorker`.
|
|
808
808
|
- **Ollama / llama.cpp** - local members run peer tools through Arco's in-process tool runtime (no MCP child). `isClusterMemberProvider` accepts `claude` / `codex` / `ollama` / `llamacpp` / `cursor` / `antigravity-cli`; the membership guard `assertAllMembersClaudeOrCodex` (name is historical - it now delegates to `isClusterMemberProvider`) rejects anything outside that set (other providers have no peer-wiring path Arco can drive). How many members may use each local runtime is `localClusterCapacity` (`{ ollama?, llamacpp? }`, integers 1-16, default 1 each; set as "Cluster members that may use this runtime at once" on the Ollama or llama.cpp page of the Connections window). Create/add/replace refuse with `rejected: local_capacity: <reason>` when a change would exceed it; set `ARCO_CLUSTER_ALLOW_MULTIPLE_LOCAL=1` to lift the check.
|
|
809
809
|
- **Cursor** - peer tools ride an in-process loopback StreamableHTTP MCP server (`mcp/clusterMcpLoopback.ts`) whose URL is handed to Cursor in `session/new` / `session/load` `mcpServers`; Cursor ACP honors MCP only over http/sse, not stdio. Fresh-only membership; the server list is refreshed each turn so a mid-life board attach/detach reflects on the next tool call.
|
|
810
|
-
- **Antigravity CLI** - the cluster tools reach `agy acp` through the same loopback StreamableHTTP MCP server as Cursor, alongside Arco's file and plan tools. Its member turns start
|
|
810
|
+
- **Antigravity CLI** - the cluster tools reach `agy acp` through the same loopback StreamableHTTP MCP server as Cursor, alongside Arco's file and plan tools. Its member turns start on operator input or an admitted ordinary-cluster AUTO-PICKUP wake (see [Gemini members](PROTOCOL_CLUSTER.md#gemini-members)).
|
|
811
811
|
|
|
812
812
|
**Plan + role propagation.** Native injects via forced system blocks (`FORCED_FIRST_BLOCK -> cluster plan -> cluster role -> appendSystemPrompt -> systemPrompt -> output style`). CLI Claude and Codex `exec` fold the same blocks into `WorkerConfig.appendSystemPrompt` under a 16 KB soft cap; Codex app-server uses a bounded 48 KB fold so its JSON-RPC path can carry the full 32 KB maximum plan plus small cluster blocks. App-server also sends stable role, Director contract, and code-mode tool mapping as `developerInstructions`, so Codex's built-in `/root` framing cannot outrank the assigned Arco role.
|
|
813
813
|
|
|
@@ -1086,6 +1086,6 @@ The availability instruction is added only after its tool configuration is prepa
|
|
|
1086
1086
|
|
|
1087
1087
|
### Native Task admission and durable rows
|
|
1088
1088
|
|
|
1089
|
-
Claude Native captures `nativeSubagents` once per parent turn. `NativeTaskAdmission` maintains an abortable per-parent FIFO and a separate cumulative turn budget. Queued reservations prevent concurrent callbacks from exceeding
|
|
1089
|
+
Claude Native captures `nativeSubagents` once per parent turn. `NativeTaskAdmission` maintains an abortable per-parent FIFO and a separate cumulative turn budget. Model validation precedes admission, so FIFO order starts at reservation. Queued reservations prevent concurrent callbacks from exceeding the turn budget. A running permit spans asynchronous child initialization through final-result settlement; release is idempotent. A background child (`run_in_background`) keeps its running place across later parent turns until it ends. Generation/abort and current Chat/cluster/depth guards are checked before allocation and before starting inference. Cancellation during initialization cancels the eventual handle instead of registering a late live child. `nativeSubagents.background` Off makes every call wait for its result.
|
|
1090
1090
|
|
|
1091
1091
|
`task_started` can carry `phase: queued`, an effective `model`, `background`, and no `childWorkflowId`; a later start attaches the real child and starts elapsed timing. `task_status` carries concrete model updates and final status. WorkerManager, seedWorker, persisted replay and the client store retain those fields. A parent-scoped `cancel` with `taskId` cancels queued or running work after observer ownership checks. Reload preserves live queued calls and settles orphaned rows. RuntimeStateBanner derives waiting counts from unresolved task rows; the final completion refreshes ordinary silence timing. A foreground `Task` call waits for the child's final reply; a background call returns at once with the task id, and the finished result reaches the parent as an automatic `subagent` notice.
|
package/docs/BACKUP.md
CHANGED
|
@@ -135,7 +135,7 @@ better to under-capture than to silently include something unexamined or leak it
|
|
|
135
135
|
|---|---|---|
|
|
136
136
|
| Invalid `settings.json` | `malformed-settings` | The settings cannot be parsed as a JSON object. |
|
|
137
137
|
| `auth.json` | `secret` | Claude Native OAuth tokens (`server/src/providers/claude-native/auth.ts`). |
|
|
138
|
-
| `provider-accounts/` | `secret` | Codex `CODEX_HOME` credential
|
|
138
|
+
| `provider-accounts/` | `secret` | Claude Native profile and Codex `CODEX_HOME` credential stores. |
|
|
139
139
|
| `cli-snapshots/`, `llamacpp.json`, `models/`, `camoufox-chatgpt-profile/`, `antigravity-data/`, `checkpoints/`, `known-cwds.json` | `regenerable` | Caches / derived state / downloaded blobs, re-derived by the running server; some are large. |
|
|
140
140
|
| `logs/`, `llamacpp.log` | `large-volatile` | Regenerated by the server; large; never valuable to restore. |
|
|
141
141
|
| `clusters/<id>/mailbox/**` | `transient` | Budgeted file-per-message drop box, drained on delivery (`docs/GOTCHAS.md Cluster mode`); restoring it would replay stale/in-flight peer messages. |
|
package/docs/CHECKPOINTS.md
CHANGED
|
@@ -16,7 +16,44 @@ Both checkpoint backends exclude the actual Arco state folder, including when AR
|
|
|
16
16
|
- A unique `GIT_INDEX_FILE=$TMPDIR/arco-snapshot-<cwd-hash>-<pid>-<uuid>.index` for every operation
|
|
17
17
|
(the isolation is load-bearing; uniqueness prevents concurrent workflows in one cwd contending on the
|
|
18
18
|
same index lock, and keeping it outside the worktree prevents one capture staging another's scratch).
|
|
19
|
-
-
|
|
19
|
+
- The snap index starts as a copy of the user's index (its timestamp kept, so racy-clean detection
|
|
20
|
+
still applies) merged with `read-tree -m HEAD`: the content is exactly the HEAD tree, and entries that
|
|
21
|
+
match HEAD borrow the user's stat data, so unchanged files are not read again. The user's index is
|
|
22
|
+
only read. If the copy or merge fails, plain `read-tree HEAD` is used. An unborn HEAD starts empty.
|
|
23
|
+
- **Scope before staging.** `diff-files` against the snap index lists paths that may differ from HEAD
|
|
24
|
+
(entries without borrowed stat data are listed too), and `ls-files --others --exclude-standard`
|
|
25
|
+
lists untracked, non-ignored files. Only those are measured. A file over the per-file cap (32 MiB by
|
|
26
|
+
default) is left out of `add -A` and the snapshot tree, counted as `skippedLargeFiles`, and recorded
|
|
27
|
+
in the `<wfid>.<seq>.skipped.json` manifest. An unchanged committed large file keeps its committed
|
|
28
|
+
entry without being read. When the remaining new or changed bytes exceed the included-total cap
|
|
29
|
+
(1 GiB by default), the snapshot is skipped with the checkpoint skip notice; unchanged committed data
|
|
30
|
+
never counts. The same `ARCO_CHECKPOINT_FILE_CAP_BYTES` / `ARCO_CHECKPOINT_TOTAL_CAP_BYTES` overrides
|
|
31
|
+
apply (`0` disables either). Then `add -A` and `write-tree`.
|
|
32
|
+
- **Measured staging.** Only the measured paths are staged, and the staged blobs are checked against
|
|
33
|
+
the same caps before anything is kept, so a file that appears or grows after the scan cannot enter
|
|
34
|
+
the checkpoint unmeasured; such a capture fails and the next turn captures again. A tracked path
|
|
35
|
+
that is gone, or is now a folder or special file, is recorded as a deletion before staging, and the
|
|
36
|
+
files of a replacing folder are measured on their own. If staging leaves any index entry that was
|
|
37
|
+
neither seeded nor measured (a measured file replaced by a folder meanwhile), the capture fails and
|
|
38
|
+
its objects are discarded with the quarantine. The shadow store checks its staged paths the same way.
|
|
39
|
+
- **Object quarantine.** New objects go to an operation-owned directory, `<objects>/arco-incoming-*`,
|
|
40
|
+
through `GIT_OBJECT_DIRECTORY`, with the real object store as `GIT_ALTERNATE_OBJECT_DIRECTORIES` so
|
|
41
|
+
existing objects still dedupe. `GIT_QUARANTINE_PATH` makes Git refuse ref updates meanwhile. On
|
|
42
|
+
success, finished objects are moved into the real store before the ref is written: each by a hard
|
|
43
|
+
link, or by a copy to a `tmp_obj_*` name and a rename, so no partial object is ever visible. Pack data
|
|
44
|
+
goes before its index. Nothing placed under a final name is removed again, even when a later step
|
|
45
|
+
fails, because another operation may already reference it. A failed or cancelled move can therefore
|
|
46
|
+
leave unreferenced loose objects, or pack data without its index, bounded by the caps. Git's own
|
|
47
|
+
`tmp_*` files are never moved. On failure, timeout or cancellation the operation removes its own
|
|
48
|
+
directory. A server crash can leave that directory behind. It is never swept automatically: its
|
|
49
|
+
name, its age and a moment without activity do not prove that no other process owns it. Treat it
|
|
50
|
+
like the leftovers described under [Repositories used with earlier versions](#repositories-used-with-earlier-versions).
|
|
51
|
+
- **Cancellation.** `createCheckpoint` takes an `AbortSignal`. Cancelling stops running Git commands,
|
|
52
|
+
stops moving objects between files, discards the quarantine and publishes no ref. A kept capture
|
|
53
|
+
finishes its cleanup before a last cancellation check; if the deadline passed by then, the ref is
|
|
54
|
+
withdrawn with a conditional `update-ref -d`. Nothing awaits between that check and the result, so
|
|
55
|
+
the caller sees a result exactly when the ref stays. Pruning of older checkpoints starts only after
|
|
56
|
+
a capture is kept, so a discarded attempt never removes a usable one.
|
|
20
57
|
- `commit-tree` wraps the tree in a **parentless** commit (checkpoints are a flat series, not a branch).
|
|
21
58
|
- `update-ref refs/arco/<workflowId>/<seq>` stores it. The user's `git status`, index, branch, and
|
|
22
59
|
HEAD are **byte-identical** afterward.
|
|
@@ -32,7 +69,8 @@ Both checkpoint backends exclude the actual Arco state folder, including when AR
|
|
|
32
69
|
videos are inert ballast no per-turn snapshot scheme can afford to copy. A **1 GiB included-total cap**
|
|
33
70
|
backstops many-small-file trees; over it the snapshot is skipped entirely (logged, returns null).
|
|
34
71
|
Overrides: `ARCO_CHECKPOINT_FILE_CAP_BYTES` / `ARCO_CHECKPOINT_TOTAL_CAP_BYTES` (`0` disables
|
|
35
|
-
either).
|
|
72
|
+
either). Git-backed snapshots apply the same caps before staging (see above). The shadow store uses
|
|
73
|
+
the same object quarantine. Every ref has a small
|
|
36
74
|
`<wfid>.<seq>.skipped.json` sidecar recording the exact out-of-scope paths: a target-skipped file remains
|
|
37
75
|
untouched even if it later shrinks, and revert aborts before writing when a currently over-cap path
|
|
38
76
|
overlaps the target tree. The safety snapshot cannot recover those bytes, so abort is the only safe path.
|
|
@@ -55,6 +93,25 @@ revert.
|
|
|
55
93
|
Returns `{ ref, fileCount, ts, backend, skippedLargeFiles? }`, or `null` if it skipped/failed (never throws
|
|
56
94
|
into the turn).
|
|
57
95
|
|
|
96
|
+
## Repositories used with earlier versions
|
|
97
|
+
|
|
98
|
+
Before this scoping and quarantine, a Git-backed capture hashed every untracked, non-ignored file. A
|
|
99
|
+
capture that timed out could leave `tmp_pack_*` files in `.git/objects/pack/` (Git streams files over
|
|
100
|
+
`core.bigFileThreshold`, 512 MiB by default, into a temporary pack) or loose objects, once per turn.
|
|
101
|
+
|
|
102
|
+
Containment and recovery are separate. Updating stops new growth; it does not remove what is already on
|
|
103
|
+
disk. Keeping large read-only inputs outside the work tree, or listing them in `.gitignore` or
|
|
104
|
+
`.git/info/exclude`, keeps any version from staging them.
|
|
105
|
+
|
|
106
|
+
Recovery deletes nothing automatically. A file's name, its location and a moment without open handles
|
|
107
|
+
do not prove it is abandoned. Before deleting a `tmp_pack_*` file or an `arco-incoming-*` directory,
|
|
108
|
+
stop every Arco turn and every other process that writes to that object store, attribute the file to a
|
|
109
|
+
known failed or interrupted capture (its time matching that failure), check again that nothing is
|
|
110
|
+
running, back up the project, and delete only the files individually identified this way. Leave
|
|
111
|
+
doubtful files. Finished `pack-*` files are never deleted by name; ordinary `git gc` handles
|
|
112
|
+
unreferenced objects. Immediate pruning such as `git gc --prune=now` can remove objects another writer
|
|
113
|
+
has not yet referenced and is not a recovery step.
|
|
114
|
+
|
|
58
115
|
## Hook (`server/src/ws/turnEngine.ts`)
|
|
59
116
|
|
|
60
117
|
The snapshot fires in `handleUserMessage`, immediately before `runPrimaryTurn(...)`, **only for operator
|
|
@@ -63,7 +120,7 @@ primitive also used by reviewers, handoff seeds, `exportContext`, and Task child
|
|
|
63
120
|
checkpoint the operator's working tree. It is:
|
|
64
121
|
|
|
65
122
|
- **Skipped when `armPlanMode` is true** (plan-mode turns are read-only until `ExitPlanMode`), for chat and isolated scratch sessions, and for an explicit Ollama allowlist containing only known read-only tools. Unknown or dynamic tools are treated as potentially mutating.
|
|
66
|
-
- **Bounded pre-capture**: wait up to two seconds before starting the provider. A timeout or failure lets the turn proceed and omits its changed-files line
|
|
123
|
+
- **Bounded pre-capture**: wait up to two seconds before starting the provider. A timeout or failure lets the turn proceed and omits its changed-files line. A capture that misses the cutoff is cancelled: it stops its Git commands, discards its objects and publishes no ref, so it never becomes a baseline or an undo point and cannot pile up behind later turns. The end-of-turn capture is not cut off; the workflow stays busy until it finishes, and each Git step it runs has the existing timeout.
|
|
67
124
|
- Followed by a `checkpoint_created { workflowId, checkpointSeq, ref, label, ts, fileCount, skippedLargeFiles? }`
|
|
68
125
|
broadcast (`shared/src/protocol/checkpoints.ts`). `checkpointSeq` is the **guard seq** (the turn the
|
|
69
126
|
checkpoint protects, from `currentSeq()`); the event gets its own next events.jsonl `seq`. `skippedLargeFiles` appears on shadow-store snapshots that excluded per-file-capped
|
|
@@ -133,6 +190,13 @@ reservation does not replace isolation through a separate worktree.
|
|
|
133
190
|
REFUSES ("ignored by one of your .gitignore files"), failing every revert in a repo containing
|
|
134
191
|
`.arco` (found 2026-08-19). Both seed steps must succeed: a seeded `.arco` would be swept from the
|
|
135
192
|
working tree by `read-tree -u --reset` (it's absent from every checkpoint tree).
|
|
193
|
+
- The seed applies the same size scope. Current files over the per-file cap and paths in the target's
|
|
194
|
+
skipped-path manifest stay out of it, so the restore neither hashes nor deletes them. If the target
|
|
195
|
+
tree would write a changed or untracked path that is now over the cap, the current file must match
|
|
196
|
+
the target blob (`hash-object` without `-w`) and is recorded with that blob; otherwise preview and
|
|
197
|
+
revert refuse (`capped-overlap`) before any write. An unchanged committed large file is held by HEAD
|
|
198
|
+
and the safety snapshot, so the restore may replace it. New or changed bytes over the total cap refuse
|
|
199
|
+
as `too-large`. Seed and comparison objects go to an operation quarantine that is always discarded.
|
|
136
200
|
- `read-tree -u --reset <tree>` against the scratch index updates the working tree to match the
|
|
137
201
|
checkpoint tree AND **deletes files the scratch index tracked but the target tree lacks**, that's
|
|
138
202
|
what makes "files created after the checkpoint are removed" a TRUE revert.
|