arco-workbench 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +1 -1
- package/THIRD_PARTY_NOTICES +2 -2
- package/client/dist/assets/{PhosphorBackdrop-CHXVFLGT.js → PhosphorBackdrop-YsHTmZJh.js} +1 -1
- package/client/dist/assets/{ThemedBackgroundShaderImpl-Bhs4I9jA.js → ThemedBackgroundShaderImpl-BEjpgoBW.js} +1 -1
- package/client/dist/assets/{XtermView-CdfurwFx.js → XtermView-wh7jNKvk.js} +1 -1
- package/client/dist/assets/{galleryEditor-DYjZZ4cf.js → galleryEditor-CaOS2mmM.js} +1 -1
- package/client/dist/assets/{index-BjDmFvqG.js → index-j68SfA-l.js} +271 -271
- package/client/dist/index.html +1 -1
- package/client/src/App.tsx +2 -2
- package/client/src/components/AuthReloginNotice.tsx +7 -6
- package/client/src/components/ChatMessage.tsx +41 -29
- package/client/src/components/ChatPanel.tsx +17 -4
- package/client/src/components/ClaudeNativeAccountPicker.tsx +32 -0
- package/client/src/components/ClaudeNativeAuthRow.tsx +71 -19
- package/client/src/components/ClusterRightPanel/AddWorkerSection.tsx +11 -281
- package/client/src/components/ClusterRightPanel/AutoPickupControl.tsx +1 -1
- package/client/src/components/ClusterRightPanel/FreshMemberForm.tsx +315 -0
- package/client/src/components/ClusterRightPanel/ReplaceMemberDialog.tsx +17 -7
- package/client/src/components/ClusterRightPanel/index.tsx +1 -1
- package/client/src/components/ClusterRightPanel/useFreshMemberPicker.ts +6 -4
- package/client/src/components/ClusterTab.tsx +2 -2
- package/client/src/components/Connections/Connections.tsx +5 -9
- package/client/src/components/Connections/model.ts +3 -1
- package/client/src/components/FileViewerModal.tsx +54 -17
- package/client/src/components/GitHubPanel/index.tsx +9 -5
- package/client/src/components/HandoffDialog.tsx +5 -3
- package/client/src/components/MobileShell.tsx +1 -33
- package/client/src/components/OperatorQuestionNotice.tsx +5 -4
- package/client/src/components/ProvidersPopover.tsx +6 -2
- package/client/src/components/RightPanel/ActivityTab.tsx +2 -1
- package/client/src/components/RightPanel/ConfigTab.tsx +23 -5
- package/client/src/components/RightPanel/OutputsPanel.tsx +21 -9
- package/client/src/components/RightPanel/outputsReconcile.ts +31 -0
- package/client/src/components/SettingsPanel.tsx +7 -10
- package/client/src/components/SpawnDialog.tsx +14 -3
- package/client/src/components/TabBar.tsx +2 -2
- package/client/src/components/TabContextMenu.tsx +73 -133
- package/client/src/components/TerminalInput.tsx +4 -3
- package/client/src/components/TranscriptWorkerDialog.tsx +14 -4
- package/client/src/components/UpdateAction.tsx +30 -7
- package/client/src/components/UsageBar.tsx +37 -18
- package/client/src/components/WorkflowCreator/ClusterMembersSection.tsx +29 -3
- package/client/src/components/WorkflowCreator/index.tsx +29 -15
- package/client/src/components/WorkflowView.tsx +1 -1
- package/client/src/components/providerIndicator.ts +7 -3
- package/client/src/components/settings/GitHubAuthRow.tsx +34 -0
- package/client/src/explorer/ArtifactsLens.tsx +17 -8
- package/client/src/explorer/ExplorerApp.tsx +3 -3
- package/client/src/explorer/types.ts +3 -1
- package/client/src/help/content/cluster.tsx +10 -4
- package/client/src/help/content/composer.tsx +3 -2
- package/client/src/help/content/header.tsx +11 -4
- package/client/src/help/content/misc.tsx +7 -5
- package/client/src/help/content/rightPanel.tsx +8 -4
- package/client/src/help/content/settings.tsx +15 -4
- package/client/src/help/content/tabbar.tsx +1 -1
- package/client/src/help/manualSections/actions.tsx +5 -1
- package/client/src/help/manualSections/clusters.tsx +20 -14
- package/client/src/help/manualSections/configuration.tsx +6 -4
- package/client/src/help/manualSections/gettingStarted.tsx +4 -2
- package/client/src/help/manualSections/maintenance.tsx +31 -0
- package/client/src/help/manualSections/powerFeatures.tsx +1 -0
- package/client/src/help/manualSections/providers.tsx +11 -4
- package/client/src/help/manualSections/workspace.tsx +3 -3
- package/client/src/hooks/useClaudeNativeCatalog.ts +26 -0
- package/client/src/hooks/useClaudeNativeLogin.ts +16 -11
- package/client/src/hooks/useWebSocket.ts +4 -2
- package/client/src/layout/layoutRange.ts +4 -5
- package/client/src/questions/waitingQuestion.ts +2 -0
- package/client/src/stores/appStore.ts +5 -1
- package/client/src/stores/appStore.types.ts +2 -0
- package/client/src/stores/replayContext.ts +20 -0
- package/client/src/utils/chatFileLinks.ts +34 -3
- package/client/src/utils/claudeAuth.ts +9 -1
- package/client/src/ws/handleServerMessage.ts +11 -3
- package/docs/ARCHITECTURE.md +3 -3
- package/docs/BACKUP.md +1 -1
- package/docs/CLIENT.md +10 -5
- package/docs/EXTENDING.md +1 -1
- package/docs/FEATURES.md +3 -3
- package/docs/GETTING_STARTED.md +5 -4
- package/docs/GIT_WORKBENCH.md +8 -0
- package/docs/GLOSSARY.md +2 -2
- package/docs/GOTCHAS.md +4 -4
- package/docs/HTTP_API.md +54 -23
- package/docs/OPERATIONS.md +17 -1
- package/docs/OPERATOR_ACTIONS.md +2 -2
- package/docs/OUTPUTS.md +48 -6
- package/docs/PERSISTENCE.md +1 -1
- package/docs/PRIMITIVES.md +4 -2
- package/docs/PROTOCOL_CLUSTER.md +12 -6
- package/docs/PROTOCOL_PRIMITIVES.md +1 -1
- package/docs/PROVIDERS.md +46 -9
- package/docs/RESEARCH.md +1 -1
- package/docs/SETTINGS.md +9 -4
- package/node_modules/@arco/shared/dist/protocol/clusters.d.ts +15 -3
- package/node_modules/@arco/shared/dist/protocol/clusters.js +1 -1
- package/node_modules/@arco/shared/dist/protocol/models.d.ts +6 -1
- package/node_modules/@arco/shared/dist/protocol/operatorQuestions.d.ts +2 -1
- package/node_modules/@arco/shared/dist/protocol/settings.d.ts +3 -0
- package/node_modules/@arco/shared/dist/protocol/settings.js +5 -0
- package/node_modules/@arco/shared/dist/protocol/workflows.d.ts +1 -0
- package/node_modules/@arco/shared/dist/protocol/workflows.js +0 -2
- package/node_modules/@arco/shared/package.json +1 -1
- package/package.json +2 -2
- package/scripts/packaging/services.mjs +20 -1
- package/scripts/packaging/update.mjs +37 -2
- package/server/dist/attention.d.ts +6 -0
- package/server/dist/attention.js +6 -0
- package/server/dist/auth.d.ts +5 -0
- package/server/dist/auth.js +31 -20
- package/server/dist/clusterAutoTurn.d.ts +5 -1
- package/server/dist/clusterAutoTurn.js +31 -9
- package/server/dist/clusterPresets.js +3 -3
- package/server/dist/effortValidation.d.ts +2 -2
- package/server/dist/effortValidation.js +4 -4
- package/server/dist/explorerArtifacts.d.ts +1 -0
- package/server/dist/explorerArtifacts.js +12 -1
- package/server/dist/geminiMembers.d.ts +7 -1
- package/server/dist/geminiMembers.js +28 -14
- package/server/dist/http/conversationFiles.d.ts +36 -0
- package/server/dist/http/conversationFiles.js +222 -0
- package/server/dist/http/fileBytes.d.ts +3 -0
- package/server/dist/http/fileBytes.js +33 -0
- package/server/dist/http/fileContentRoute.d.ts +2 -0
- package/server/dist/http/fileContentRoute.js +139 -0
- package/server/dist/http/fileRead.d.ts +54 -2
- package/server/dist/http/fileRead.js +31 -24
- package/server/dist/http/outputRoutes.js +14 -21
- package/server/dist/http/readConfinement.d.ts +0 -11
- package/server/dist/http/readConfinement.js +4 -30
- package/server/dist/http/router.js +40 -66
- package/server/dist/index.js +26 -12
- package/server/dist/management/initHubLink.js +1 -1
- package/server/dist/outputs.js +8 -0
- package/server/dist/primitives/exportContext.d.ts +2 -0
- package/server/dist/primitives/exportContext.js +13 -2
- package/server/dist/primitives/runCompare.d.ts +7 -1
- package/server/dist/primitives/runCompare.js +44 -20
- package/server/dist/project/taskLedger.js +46 -34
- package/server/dist/providerAccounts.d.ts +4 -0
- package/server/dist/providerAccounts.js +20 -1
- package/server/dist/providers/antigravity/artifacts.d.ts +23 -0
- package/server/dist/providers/antigravity/artifacts.js +140 -0
- package/server/dist/providers/antigravity/index.js +85 -7
- package/server/dist/providers/antigravity/questions.d.ts +2 -0
- package/server/dist/providers/antigravity/questions.js +58 -0
- package/server/dist/providers/claude-native/auth.d.ts +9 -8
- package/server/dist/providers/claude-native/auth.js +50 -58
- package/server/dist/providers/claude-native/authStatus.d.ts +2 -2
- package/server/dist/providers/claude-native/authStatus.js +9 -7
- package/server/dist/providers/claude-native/catalog.d.ts +6 -5
- package/server/dist/providers/claude-native/catalog.js +50 -39
- package/server/dist/providers/claude-native/oauth.d.ts +10 -9
- package/server/dist/providers/claude-native/oauth.js +120 -96
- package/server/dist/providers/claude-native/worker.d.ts +1 -0
- package/server/dist/providers/claude-native/worker.js +38 -23
- package/server/dist/providers/codex-appserver/operatorQuestions.d.ts +5 -3
- package/server/dist/providers/codex-appserver/operatorQuestions.js +27 -13
- package/server/dist/server/broadcast.js +6 -0
- package/server/dist/settings.d.ts +1 -0
- package/server/dist/settings.js +39 -7
- package/server/dist/skills.js +1 -1
- package/server/dist/smartPickupAdapters.d.ts +1 -0
- package/server/dist/smartPickupAdapters.js +2 -2
- package/server/dist/smartPickupObserver.js +8 -5
- package/server/dist/thirdPartySkills.js +11 -5
- package/server/dist/usage.d.ts +1 -1
- package/server/dist/usage.js +39 -27
- package/server/dist/workers/WorkerManager.d.ts +1 -0
- package/server/dist/workers/WorkerManager.js +1 -0
- package/server/dist/workers/processKill.js +37 -24
- package/server/dist/workflowMeta.js +2 -2
- package/server/dist/ws/clusterHandlers.d.ts +2 -2
- package/server/dist/ws/clusterHandlers.js +127 -113
- package/server/dist/ws/clusterMembers.d.ts +1 -1
- package/server/dist/ws/clusterMembers.js +34 -4
- package/server/dist/ws/compactHandlers.js +30 -14
- package/server/dist/ws/compareHandlers.js +53 -21
- package/server/dist/ws/gateHandlers.js +2 -0
- package/server/dist/ws/genesisHandlers.js +5 -3
- package/server/dist/ws/handoffHandlers.d.ts +1 -1
- package/server/dist/ws/handoffHandlers.js +115 -39
- package/server/dist/ws/transcriptWorkerHandlers.js +7 -2
- package/server/dist/ws/turnEngine.js +33 -18
- package/server/dist/ws/updatePrimaryConfig.d.ts +3 -2
- package/server/dist/ws/updatePrimaryConfig.js +236 -133
- package/server/dist/ws/workflowHandlers.js +21 -4
- package/server/package.json +1 -1
- package/server/src/attention.ts +7 -0
- package/server/src/auth.ts +33 -20
- package/server/src/clusterAutoTurn.ts +31 -11
- package/server/src/clusterPresets.ts +2 -2
- package/server/src/effortValidation.ts +4 -4
- package/server/src/explorerArtifacts.ts +12 -1
- package/server/src/geminiMembers.ts +26 -15
- package/server/src/http/conversationFiles.ts +231 -0
- package/server/src/http/fileBytes.ts +34 -0
- package/server/src/http/fileContentRoute.ts +123 -0
- package/server/src/http/fileRead.ts +30 -25
- package/server/src/http/outputRoutes.ts +13 -13
- package/server/src/http/readConfinement.ts +3 -30
- package/server/src/http/router.ts +38 -62
- package/server/src/index.ts +27 -18
- package/server/src/management/initHubLink.ts +1 -1
- package/server/src/outputs.ts +8 -0
- package/server/src/primitives/exportContext.ts +14 -2
- package/server/src/primitives/runCompare.ts +73 -46
- package/server/src/project/taskLedger.ts +47 -30
- package/server/src/providerAccounts.ts +20 -1
- package/server/src/providers/antigravity/artifacts.ts +121 -0
- package/server/src/providers/antigravity/index.ts +64 -6
- package/server/src/providers/antigravity/questions.ts +52 -0
- package/server/src/providers/claude-native/auth.ts +45 -60
- package/server/src/providers/claude-native/authStatus.ts +9 -8
- package/server/src/providers/claude-native/catalog.ts +52 -35
- package/server/src/providers/claude-native/oauth.ts +101 -77
- package/server/src/providers/claude-native/worker.ts +38 -22
- package/server/src/providers/codex-appserver/operatorQuestions.ts +26 -12
- package/server/src/server/broadcast.ts +4 -0
- package/server/src/settings.ts +36 -8
- package/server/src/skills.ts +1 -1
- package/server/src/smartPickupAdapters.ts +3 -2
- package/server/src/smartPickupObserver.ts +8 -5
- package/server/src/thirdPartySkills.ts +11 -5
- package/server/src/usage.ts +30 -22
- package/server/src/workers/WorkerManager.ts +2 -0
- package/server/src/workers/processKill.ts +37 -23
- package/server/src/workflowMeta.ts +2 -2
- package/server/src/ws/clusterHandlers.ts +107 -104
- package/server/src/ws/clusterMembers.ts +25 -6
- package/server/src/ws/compactHandlers.ts +29 -15
- package/server/src/ws/compareHandlers.ts +59 -25
- package/server/src/ws/gateHandlers.ts +2 -0
- package/server/src/ws/genesisHandlers.ts +5 -4
- package/server/src/ws/handoffHandlers.ts +105 -37
- package/server/src/ws/transcriptWorkerHandlers.ts +6 -2
- package/server/src/ws/turnEngine.ts +32 -17
- package/server/src/ws/updatePrimaryConfig.ts +230 -132
- package/server/src/ws/workflowHandlers.ts +20 -4
- package/shared/dist/protocol/clusters.d.ts +15 -3
- package/shared/dist/protocol/clusters.js +1 -1
- package/shared/dist/protocol/models.d.ts +6 -1
- package/shared/dist/protocol/operatorQuestions.d.ts +2 -1
- package/shared/dist/protocol/settings.d.ts +3 -0
- package/shared/dist/protocol/settings.js +5 -0
- package/shared/dist/protocol/workflows.d.ts +1 -0
- package/shared/dist/protocol/workflows.js +0 -2
- package/shared/src/protocol/clusters.ts +23 -5
- package/shared/src/protocol/compare.ts +2 -2
- package/shared/src/protocol/models.ts +8 -4
- package/shared/src/protocol/operatorQuestions.ts +2 -1
- package/shared/src/protocol/settings.ts +8 -1
- package/shared/src/protocol/workflows.ts +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
import { contentSurfaceSize, WorkSurfaceControls } from './workSurface/WorkSurfaceControls';
|
|
4
|
+
import { usePhoneLayout } from '../layout/layoutRange';
|
|
4
5
|
import ReactMarkdown from 'react-markdown';
|
|
5
6
|
import remarkGfm from 'remark-gfm';
|
|
6
7
|
import rehypeHighlight from 'rehype-highlight';
|
|
@@ -11,9 +12,10 @@ import { AiEditAffordance } from './editor/AiEditAffordance';
|
|
|
11
12
|
type FilePayload =
|
|
12
13
|
| { type: 'text'; content: string; size: number; resolvedPath?: string }
|
|
13
14
|
| { type: 'image'; dataUrl: string; size: number; resolvedPath?: string }
|
|
14
|
-
| { type: '
|
|
15
|
+
| { type: 'audio' | 'video' | 'pdf'; url: string; size: number; resolvedPath?: string; downloadUrl?: string }
|
|
16
|
+
| { type: 'binary'; size: number; resolvedPath?: string; downloadUrl?: string }
|
|
15
17
|
| { type: 'too-large'; size: number; kind: 'text' | 'image'; resolvedPath?: string }
|
|
16
|
-
| { type: 'choices'; choices: Array<{ workflowId
|
|
18
|
+
| { type: 'choices'; choices: Array<{ workflowId?: string; name: string; resolvedPath?: string; readUrl?: string }>; truncated?: boolean }
|
|
17
19
|
| { type: 'error'; error: string };
|
|
18
20
|
type ViewerPayload = FilePayload & { artifactOwner?: string };
|
|
19
21
|
|
|
@@ -27,7 +29,9 @@ interface Props {
|
|
|
27
29
|
// artifacts dir if these are supplied. Lets chat-text filename clicks
|
|
28
30
|
// (which guess at locations) recover when the agent wrote the file as an
|
|
29
31
|
// artifact rather than into the cwd-relative slot we predicted.
|
|
30
|
-
|
|
32
|
+
// The viewing workflow authorizes the read; the source identifies the
|
|
33
|
+
// member whose message mentioned the file.
|
|
34
|
+
fallback?: { cwd: string; workflowId: string; sourceWorkflowId?: string };
|
|
31
35
|
// A6 — supplied only by callers whose file is known to live under a real
|
|
32
36
|
// workflow cwd (the FILES explorer). Presence enables the Edit/Lock toggle;
|
|
33
37
|
// its cwd is what the server resolves the write against (path-escape guard).
|
|
@@ -39,6 +43,13 @@ interface Props {
|
|
|
39
43
|
// keeps it working across the markdown / code / plain render paths. Absent ⇒
|
|
40
44
|
// open at the top, today's behavior.
|
|
41
45
|
startLine?: number;
|
|
46
|
+
// A note shown above the content, such as a file that changed or was removed
|
|
47
|
+
// while open. RELOAD appears with it when `onReload` is given and there are
|
|
48
|
+
// no unsaved edits; raising `reloadToken` reads the file again in place.
|
|
49
|
+
notice?: string;
|
|
50
|
+
onReload?: () => void;
|
|
51
|
+
reloadToken?: number;
|
|
52
|
+
onSaved?: () => void;
|
|
42
53
|
}
|
|
43
54
|
|
|
44
55
|
// Map file extensions to the highlight.js language tag we wrap them with
|
|
@@ -77,12 +88,15 @@ function classifyFile(path: string, content: string): { kind: RenderKind; lang?:
|
|
|
77
88
|
return { kind: 'plain' };
|
|
78
89
|
}
|
|
79
90
|
|
|
80
|
-
export function FileViewerModal({ path, onClose, fallback, editContext, startLine, readUrl, saveRequest, initialEditing = false }: Props) {
|
|
91
|
+
export function FileViewerModal({ path, onClose, fallback, editContext, startLine, readUrl, saveRequest, initialEditing = false, notice, onReload, reloadToken, onSaved }: Props) {
|
|
81
92
|
const surface = useRef<HTMLDivElement>(null);
|
|
93
|
+
const phone = usePhoneLayout();
|
|
82
94
|
const [payload, setPayload] = useState<ViewerPayload | null>(null);
|
|
83
95
|
const [rawMode, setRawMode] = useState(false);
|
|
84
96
|
const [artifactChoice, setArtifactChoice] = useState<string | null>(null);
|
|
85
|
-
|
|
97
|
+
const [choiceUrl, setChoiceUrl] = useState<string | null>(null);
|
|
98
|
+
const [mediaError, setMediaError] = useState(false);
|
|
99
|
+
useEffect(() => { setArtifactChoice(null); setChoiceUrl(null); setMediaError(false); }, [path, fallback?.workflowId, fallback?.cwd, fallback?.sourceWorkflowId]);
|
|
86
100
|
// A6 editing state. `editing` flips the buffer writable + reveals Save;
|
|
87
101
|
// default is Locked (read-only). `buffer` holds the live edit; `loadedText`
|
|
88
102
|
// is the last-saved/loaded baseline so the dirty flag is a simple compare.
|
|
@@ -107,9 +121,10 @@ export function FileViewerModal({ path, onClose, fallback, editContext, startLin
|
|
|
107
121
|
if (fallback) {
|
|
108
122
|
params.set('cwd', fallback.cwd);
|
|
109
123
|
params.set('workflowId', fallback.workflowId);
|
|
124
|
+
if (fallback.sourceWorkflowId) params.set('sourceWorkflowId', fallback.sourceWorkflowId);
|
|
110
125
|
if (artifactChoice) params.set('artifactOwner', artifactChoice);
|
|
111
126
|
}
|
|
112
|
-
fetch(readUrl || `/api/file-content?${params.toString()}`)
|
|
127
|
+
fetch(choiceUrl || readUrl || `/api/file-content?${params.toString()}`)
|
|
113
128
|
.then((r) => r.json() as Promise<ViewerPayload>)
|
|
114
129
|
.then((p) => {
|
|
115
130
|
if (cancelled) return;
|
|
@@ -121,7 +136,7 @@ export function FileViewerModal({ path, onClose, fallback, editContext, startLin
|
|
|
121
136
|
})
|
|
122
137
|
.catch((e) => { if (!cancelled) setPayload({ type: 'error', error: String(e) }); });
|
|
123
138
|
return () => { cancelled = true; };
|
|
124
|
-
}, [path, fallback?.cwd, fallback?.workflowId, readUrl, initialEditing, artifactChoice]);
|
|
139
|
+
}, [path, fallback?.cwd, fallback?.workflowId, fallback?.sourceWorkflowId, readUrl, initialEditing, artifactChoice, choiceUrl, reloadToken]);
|
|
125
140
|
|
|
126
141
|
const dirty = editing && buffer !== loadedText;
|
|
127
142
|
|
|
@@ -204,6 +219,7 @@ export function FileViewerModal({ path, onClose, fallback, editContext, startLin
|
|
|
204
219
|
setLoadedText(buffer);
|
|
205
220
|
setPayload((p) => (p && p.type === 'text' ? { ...p, content: buffer, size: new Blob([buffer]).size } : p));
|
|
206
221
|
setEditing(currentBuffer.current !== buffer);
|
|
222
|
+
onSaved?.();
|
|
207
223
|
} catch (e) {
|
|
208
224
|
setSaveError(e instanceof Error ? e.message : String(e));
|
|
209
225
|
} finally {
|
|
@@ -255,6 +271,13 @@ export function FileViewerModal({ path, onClose, fallback, editContext, startLin
|
|
|
255
271
|
}, [payload, classification, rawMode, editing]);
|
|
256
272
|
|
|
257
273
|
const canFormat = classification && classification.kind !== 'plain';
|
|
274
|
+
const mediaKind = !phone && (payload?.type === 'audio' || payload?.type === 'video') ? payload.type : null;
|
|
275
|
+
const surfaceKind = mediaKind || 'document';
|
|
276
|
+
const mediaSize: React.CSSProperties = mediaKind === 'audio'
|
|
277
|
+
? { width: 'min(calc(96vw / var(--ui-scale, 1)), 38em)', height: 'auto' }
|
|
278
|
+
: mediaKind === 'video'
|
|
279
|
+
? { width: 'min(calc(90vw / var(--ui-scale, 1)), 100em)', height: 'calc(85vh / var(--ui-scale, 1))' }
|
|
280
|
+
: {};
|
|
258
281
|
|
|
259
282
|
return createPortal(
|
|
260
283
|
<div
|
|
@@ -273,11 +296,13 @@ export function FileViewerModal({ path, onClose, fallback, editContext, startLin
|
|
|
273
296
|
<div
|
|
274
297
|
onClick={(e) => e.stopPropagation()}
|
|
275
298
|
className="glow-border"
|
|
299
|
+
key={surfaceKind}
|
|
276
300
|
ref={surface}
|
|
277
301
|
data-dialog-surface="viewer"
|
|
278
302
|
style={{
|
|
279
303
|
...contentSurfaceSize,
|
|
280
304
|
width: 'var(--file-viewer-width, min(calc(90vw / var(--ui-scale, 1)), 140em))',
|
|
305
|
+
...mediaSize,
|
|
281
306
|
background: 'var(--color-bg)',
|
|
282
307
|
border: '1px solid var(--color-border-bright)',
|
|
283
308
|
borderRadius: '6px',
|
|
@@ -297,7 +322,7 @@ export function FileViewerModal({ path, onClose, fallback, editContext, startLin
|
|
|
297
322
|
flexShrink: 0,
|
|
298
323
|
}}
|
|
299
324
|
>
|
|
300
|
-
<div style={{ overflow: '
|
|
325
|
+
<div style={{ minWidth: 0, overflow: 'auto' }}>
|
|
301
326
|
<div
|
|
302
327
|
className="display-font glow-text-cyan"
|
|
303
328
|
style={{ fontSize: '12px', letterSpacing: '1px' }}
|
|
@@ -309,9 +334,9 @@ export function FileViewerModal({ path, onClose, fallback, editContext, startLin
|
|
|
309
334
|
fontSize: '10px',
|
|
310
335
|
color: 'var(--color-fg-muted)',
|
|
311
336
|
marginTop: '2px',
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
337
|
+
overflowWrap: 'anywhere',
|
|
338
|
+
whiteSpace: 'normal',
|
|
339
|
+
userSelect: 'text',
|
|
315
340
|
}}
|
|
316
341
|
title={shownPath}
|
|
317
342
|
>
|
|
@@ -319,7 +344,7 @@ export function FileViewerModal({ path, onClose, fallback, editContext, startLin
|
|
|
319
344
|
</div>
|
|
320
345
|
</div>
|
|
321
346
|
<div style={{ display: 'flex', gap: '6px', flexShrink: 0, alignItems: 'center' }}>
|
|
322
|
-
<WorkSurfaceControls storageKey=
|
|
347
|
+
<WorkSurfaceControls key={surfaceKind} storageKey={mediaKind ? `file-viewer-${mediaKind}` : 'file-viewer'} surface={surface} />
|
|
323
348
|
{dirty && (
|
|
324
349
|
<span
|
|
325
350
|
title="Unsaved edits"
|
|
@@ -455,6 +480,13 @@ export function FileViewerModal({ path, onClose, fallback, editContext, startLin
|
|
|
455
480
|
</div>
|
|
456
481
|
)}
|
|
457
482
|
|
|
483
|
+
{notice && (
|
|
484
|
+
<div role="status" data-testid="file-viewer-notice" style={{ display: 'flex', flexWrap: 'wrap', alignItems: 'center', gap: '8px', padding: '6px 16px', borderBottom: '1px solid var(--color-border-hairline)', fontSize: '11px', color: 'var(--color-warning)', flexShrink: 0 }}>
|
|
485
|
+
<span style={{ flex: 1, minWidth: 0 }}>{notice}</span>
|
|
486
|
+
{onReload && !dirty && <button type="button" data-help="rightpanel.outputs.reload" onClick={onReload}>RELOAD</button>}
|
|
487
|
+
</div>
|
|
488
|
+
)}
|
|
489
|
+
|
|
458
490
|
{/* Editing surface: CodeMirror takes over the whole body. No inner
|
|
459
491
|
padding so the gutter sits flush; the editor scrolls itself. */}
|
|
460
492
|
{editing && payload?.type === 'text' ? (
|
|
@@ -486,7 +518,7 @@ export function FileViewerModal({ path, onClose, fallback, editContext, startLin
|
|
|
486
518
|
)}
|
|
487
519
|
</div>
|
|
488
520
|
) : (
|
|
489
|
-
<div ref={scrollBodyRef} className="arco-file-body" style={{ flex: 1, overflow: 'auto', padding: '14px 18px' }}>
|
|
521
|
+
<div ref={scrollBodyRef} className="arco-file-body" style={{ flex: mediaKind === 'audio' ? '0 1 auto' : 1, minHeight: 0, overflow: 'auto', padding: '14px 18px', ...(mediaKind === 'video' ? { display: 'flex', flexDirection: 'column' } : {}) }}>
|
|
490
522
|
{payload === null && (
|
|
491
523
|
<div style={{ color: 'var(--color-fg-muted)', fontSize: '12px', fontStyle: 'italic' }}>
|
|
492
524
|
Loading…
|
|
@@ -537,6 +569,11 @@ export function FileViewerModal({ path, onClose, fallback, editContext, startLin
|
|
|
537
569
|
</div>
|
|
538
570
|
)}
|
|
539
571
|
|
|
572
|
+
{payload?.type === 'audio' && <audio controls src={payload.url} onError={() => setMediaError(true)} style={{ maxWidth: '100%' }} />}
|
|
573
|
+
{payload?.type === 'video' && <video controls src={payload.url} onError={() => setMediaError(true)} style={mediaKind === 'video' ? { width: '100%', height: '100%', minHeight: 0, flex: '1 1 0', objectFit: 'contain', alignSelf: 'center' } : { maxWidth: '100%' }} />}
|
|
574
|
+
{payload?.type === 'pdf' && <iframe title={filename} src={payload.url} style={{ width: '100%', height: 'calc(70vh / var(--ui-scale, 1))', border: 0 }} />}
|
|
575
|
+
{mediaError && <p style={infoStyle}>This browser cannot play this file. Download it to open it elsewhere.</p>}
|
|
576
|
+
{payload && 'downloadUrl' in payload && (payload.downloadUrl || ('url' in payload && payload.url)) && <p><a href={payload.downloadUrl || ('url' in payload ? payload.url : undefined)} download>DOWNLOAD FILE</a></p>}
|
|
540
577
|
{payload?.type === 'binary' && (
|
|
541
578
|
<div style={infoStyle}>
|
|
542
579
|
Binary file ({formatSize(payload.size)}): no preview available.
|
|
@@ -551,16 +588,16 @@ export function FileViewerModal({ path, onClose, fallback, editContext, startLin
|
|
|
551
588
|
|
|
552
589
|
{payload?.type === 'choices' && (
|
|
553
590
|
<div style={infoStyle}>
|
|
554
|
-
<p>
|
|
591
|
+
<p>{payload.truncated ? 'Search reached its limit. Use a more specific path if the file is not listed.' : 'Several files match. Choose one:'}</p>
|
|
555
592
|
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start', gap: '8px' }}>
|
|
556
593
|
{payload.choices.map((choice) => (
|
|
557
594
|
<button
|
|
558
|
-
key={choice.workflowId}
|
|
595
|
+
key={choice.readUrl || choice.workflowId || choice.resolvedPath}
|
|
559
596
|
type="button"
|
|
560
|
-
onClick={() => { setPayload(null); setArtifactChoice(choice.workflowId); }}
|
|
597
|
+
onClick={() => { setPayload(null); if (choice.readUrl) setChoiceUrl(choice.readUrl); else if (choice.workflowId) setArtifactChoice(choice.workflowId); }}
|
|
561
598
|
style={{ background: 'transparent', border: '1px solid var(--color-border-hairline)', borderRadius: '3px', color: 'var(--color-fg)', cursor: 'pointer', minHeight: '40px', padding: '8px 12px', textAlign: 'left' }}
|
|
562
599
|
>
|
|
563
|
-
{choice.name} ({choice.workflowId.slice(0, 8)})
|
|
600
|
+
{choice.name}{choice.workflowId ? ` (${choice.workflowId.slice(0, 8)})` : ''}{choice.resolvedPath && <span style={{ display: 'block', overflowWrap: 'anywhere' }}>{choice.resolvedPath}</span>}
|
|
564
601
|
</button>
|
|
565
602
|
))}
|
|
566
603
|
</div>
|
|
@@ -9,6 +9,7 @@ import { PullView } from './PullView';
|
|
|
9
9
|
import { IssueView } from './IssueView';
|
|
10
10
|
import { RunView } from './RunView';
|
|
11
11
|
import { CommitView } from './CommitView';
|
|
12
|
+
import { checkProviderStatus } from '../../utils/providerStatusCheck';
|
|
12
13
|
|
|
13
14
|
// Comprehensive GitHub view. Mounts as a full-screen takeover of the main
|
|
14
15
|
// content area when `showGithub` is true. Internally a tiny state machine
|
|
@@ -89,7 +90,7 @@ export function GitHubPanel({ initialCwd }: GitHubPanelProps = {}) {
|
|
|
89
90
|
{/* Body */}
|
|
90
91
|
<div style={{ flex: 1, overflow: 'hidden', display: 'flex', flexDirection: 'column', minHeight: 0 }}>
|
|
91
92
|
{!loggedIn ? (
|
|
92
|
-
<NotLoggedIn />
|
|
93
|
+
<NotLoggedIn status={authStatus?.github} />
|
|
93
94
|
) : userError ? (
|
|
94
95
|
<ErrorBox message={`Couldn't fetch user: ${userError}`} />
|
|
95
96
|
) : view.kind === 'repos' ? (
|
|
@@ -112,13 +113,16 @@ export function GitHubPanel({ initialCwd }: GitHubPanelProps = {}) {
|
|
|
112
113
|
|
|
113
114
|
// ── Shared bits ─────────────────────────────────────────────────────────
|
|
114
115
|
|
|
115
|
-
function NotLoggedIn() {
|
|
116
|
+
function NotLoggedIn({ status }: { status?: import('@arco/shared').AuthStatus }) {
|
|
116
117
|
const setShowSettings = useAppStore((s) => s.setShowSettings);
|
|
117
118
|
const setShowGithub = useAppStore((s) => s.setShowGithub);
|
|
119
|
+
const recoveryButtonStyle = { ...mergeBtnStyle, background: 'var(--color-bg-dialog)', color: 'var(--color-control-fg)', border: '1px solid var(--color-control-fg)' };
|
|
118
120
|
return (
|
|
119
|
-
<div data-help="header.github" style={{ padding: '40px 60px', textAlign: 'center', color: 'var(--color-
|
|
120
|
-
<div style={{ fontSize: '14px', marginBottom: '14px' }}>GitHub CLI is not authenticated
|
|
121
|
-
<
|
|
121
|
+
<div data-help="header.github" data-testid="github-recovery" style={{ flex: 1, overflow: 'auto', padding: '40px 60px', textAlign: 'center', background: 'var(--color-bg-dialog)', color: 'var(--color-control-fg)', fontFamily: 'var(--font-body)' }}>
|
|
122
|
+
<div style={{ fontSize: '14px', marginBottom: '14px' }}>{status?.error ?? (status ? 'GitHub CLI is not authenticated.' : 'Checking GitHub CLI status...')}</div>
|
|
123
|
+
{status?.githubState === 'missing' && <p><a href="https://cli.github.com/" target="_blank" rel="noreferrer" style={{ color: 'inherit' }}>Install GitHub CLI</a></p>}
|
|
124
|
+
{status && <button onClick={() => void checkProviderStatus('github')} style={recoveryButtonStyle}>CHECK CONNECTION</button>}{' '}
|
|
125
|
+
{status && !status.githubState?.match(/^(missing|probe-failed)$/) && <button onClick={() => { setShowGithub(false); setShowSettings(true); }} style={recoveryButtonStyle}>OPEN SETTINGS TO LOG IN</button>}
|
|
122
126
|
</div>
|
|
123
127
|
);
|
|
124
128
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useClaudeNativeCatalogFor } from '../hooks/useClaudeNativeCatalog';
|
|
1
2
|
import { useEffect, useState, type CSSProperties } from 'react';
|
|
2
3
|
import type { WorkflowConfig, ProviderName, ModelName, EffortLevel } from '@arco/shared';
|
|
3
4
|
import { useAppStore } from '../stores/appStore';
|
|
@@ -37,7 +38,8 @@ export function HandoffDialog({ currentConfig, onConfirm, onCancel }: Props) {
|
|
|
37
38
|
const authStatus = useAppStore((s) => s.authStatus);
|
|
38
39
|
const isProviderEnabled = useAppStore((s) => s.isProviderEnabled);
|
|
39
40
|
const settings = useAppStore((s) => s.settings);
|
|
40
|
-
const
|
|
41
|
+
const claude = useClaudeNativeCatalogFor((currentConfig.primaryProvider ?? 'claude') === 'claude' ? currentConfig.providerAccountRef : undefined);
|
|
42
|
+
const catalogs = useModelCatalogs({ claude });
|
|
41
43
|
const { claude: claudeNativeCatalog, codex: codexCatalog, cursor: cursorCatalog, ollamaModels, llamacppModels, lmstudioModels, strataModels, deepseekModels = [] } = catalogs;
|
|
42
44
|
|
|
43
45
|
const [mode, setMode] = useState<Mode>('quick');
|
|
@@ -162,7 +164,7 @@ export function HandoffDialog({ currentConfig, onConfirm, onCancel }: Props) {
|
|
|
162
164
|
<ModePill
|
|
163
165
|
active={mode === 'original-worker'}
|
|
164
166
|
label="ORIGINAL WORKER"
|
|
165
|
-
hint="Claude and Codex resume the live session without project tools. Claude CLI administrator-managed hooks can still run. Local providers re-read the transcript and may fall back to the configured summarizer."
|
|
167
|
+
hint="Claude and Codex resume the live session without project tools. Gemini uses the same model in a fresh reply-only session to summarize the saved transcript. Claude CLI administrator-managed hooks can still run. Local providers re-read the transcript and may fall back to the configured summarizer."
|
|
166
168
|
onClick={() => setMode('original-worker')}
|
|
167
169
|
/>
|
|
168
170
|
<ModePill
|
|
@@ -273,7 +275,7 @@ export function HandoffDialog({ currentConfig, onConfirm, onCancel }: Props) {
|
|
|
273
275
|
className="display-font"
|
|
274
276
|
style={{ fontSize: '9px', color: 'var(--color-fg-muted)', marginBottom: '10px', letterSpacing: '0.5px', lineHeight: 1.5 }}
|
|
275
277
|
>
|
|
276
|
-
Swap provider / model / effort for the post-handoff session.
|
|
278
|
+
Swap provider / model / effort for the post-handoff session. The new session receives the handoff document as its opening turn.
|
|
277
279
|
</div>
|
|
278
280
|
|
|
279
281
|
<Field label="PROVIDER" helpKey="handoff.provider">
|
|
@@ -20,7 +20,6 @@ import { focusNoticeWorkflow } from '../alerts/focusNotice';
|
|
|
20
20
|
import { useTerminalTarget } from '../hooks/useTerminalTarget';
|
|
21
21
|
import { usePhoneOverlay } from '../layout/phoneOverlay';
|
|
22
22
|
import { PhoneBottomSheet } from '../layout/PhoneBottomSheet';
|
|
23
|
-
import { firstQuestionText } from './MobileQuestionBar';
|
|
24
23
|
import { PhonePage } from '../layout/PhonePage';
|
|
25
24
|
import { MobileNotices } from './MobileNotices';
|
|
26
25
|
import { MobileManualContent } from './UserManual/MobileManualContent';
|
|
@@ -504,24 +503,7 @@ function Row({ onClick, label, detail, state, busy = false, current = false, tes
|
|
|
504
503
|
);
|
|
505
504
|
}
|
|
506
505
|
|
|
507
|
-
/**
|
|
508
|
-
* opens the questions sheet over that conversation. */
|
|
509
|
-
function NeedsRow({ id, label, why, busy, decision, onOpen }: { id: string; label: string; why: string; busy: boolean; decision: boolean; onOpen: () => void }) {
|
|
510
|
-
const questions = usePendingQuestions(id, true);
|
|
511
|
-
const text = decision ? firstQuestionText(questions) : '';
|
|
512
|
-
return (
|
|
513
|
-
<button type="button" onClick={onOpen} data-testid="mobile-needs" aria-label={`${label}, ${text || why}: ${stateText('NEEDS YOU', busy).toLowerCase()}${decision ? '. Answer.' : ''}`} style={rowStyle(false, false)}>
|
|
514
|
-
<StateMark state="NEEDS YOU" />
|
|
515
|
-
<span style={{ flex: 1, minWidth: 0 }}>
|
|
516
|
-
<span className="display-font" style={{ display: 'block', fontSize: '12px', fontWeight: 700, letterSpacing: '0.5px', color: 'var(--color-fg)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{label}{busy ? ' \u00B7 WORKING' : ''}</span>
|
|
517
|
-
<span style={{ display: 'block', fontSize: '16px', fontFamily: 'var(--font-body)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{text || why}</span>
|
|
518
|
-
</span>
|
|
519
|
-
{decision && <span className="display-font" aria-hidden="true" style={{ flexShrink: 0, minHeight: '44px', display: 'inline-flex', alignItems: 'center', padding: '0 12px', border: '2px solid var(--color-warning)', color: 'var(--color-warning)', fontSize: '13px', fontWeight: 700, letterSpacing: '1px' }}>ANSWER</span>}
|
|
520
|
-
</button>
|
|
521
|
-
);
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
/** The first screen: what needs the operator, then every open tab. */
|
|
506
|
+
/** The first screen: every open tab, each with its own state. */
|
|
525
507
|
export function MobileDirectory() {
|
|
526
508
|
const jobs = useAppStore((s) => s.jobs);
|
|
527
509
|
const clusters = useAppStore((s) => s.clusters);
|
|
@@ -543,13 +525,6 @@ export function MobileDirectory() {
|
|
|
543
525
|
const ordinaryClusters = clusterList.filter(c => !c.research);
|
|
544
526
|
const researchProjects = clusterList.filter(c => c.research && !c.research.quick);
|
|
545
527
|
const quickResearch = clusterList.filter(c => c.research?.quick);
|
|
546
|
-
const needs = [
|
|
547
|
-
...clusterList.flatMap((c) => c.members.filter((m) => memberState(c, m.workflowId, jobs[m.workflowId]) === 'NEEDS YOU').map((m) => ({
|
|
548
|
-
id: m.workflowId, label: m.displayName, where: clusterDisplayName(c), busy: memberBusy(c, m.workflowId, jobs[m.workflowId]),
|
|
549
|
-
decision: !!decisionKind(jobs[m.workflowId]), why: decisionKind(jobs[m.workflowId]) ?? 'Idle with unread mail',
|
|
550
|
-
}))),
|
|
551
|
-
...[...agents, ...chats].filter((j) => decisionKind(j)).map((j) => ({ id: j.id, label: j.config.name || j.id.slice(0, 8), where: j.config.kind === 'chat' ? 'Chat' : 'Agent', busy: !!j.busy, decision: true, why: decisionKind(j)! })),
|
|
552
|
-
];
|
|
553
528
|
const provider = (j: JobState) => String(j.config.primaryProvider ?? '').toUpperCase();
|
|
554
529
|
// The conversation stays mounted underneath (its draft is kept) but cannot
|
|
555
530
|
// take focus or touch while the directory covers it.
|
|
@@ -567,13 +542,6 @@ export function MobileDirectory() {
|
|
|
567
542
|
return (
|
|
568
543
|
<div ref={dirRef} style={{ position: 'absolute', inset: 0, zIndex: 30 }}>
|
|
569
544
|
<div ref={scrollRef} data-testid="mobile-directory" data-help="mobile.directory" style={{ position: 'absolute', inset: 0, overflowY: 'auto', background: 'var(--color-bg)', paddingBottom: 'calc(76px + env(safe-area-inset-bottom))' }}>
|
|
570
|
-
{needs.length > 0 && <>
|
|
571
|
-
<div className="display-font" style={sectionHeading}><span aria-hidden="true" style={{ color: 'var(--color-warning)' }}>{'\u25B2'}</span> NEEDS YOU ({needs.length})</div>
|
|
572
|
-
{needs.map((n) => (
|
|
573
|
-
<NeedsRow key={`needs-${n.id}`} id={n.id} label={`${n.label} \u00B7 ${n.where}`} why={n.why} busy={n.busy} decision={n.decision}
|
|
574
|
-
onOpen={() => { openConversation(() => focusNoticeWorkflow(n.id)); if (n.decision) usePhoneStore.getState().openSheet('questions', n.id); }} />
|
|
575
|
-
))}
|
|
576
|
-
</>}
|
|
577
545
|
{ordinaryClusters.length > 0 && <div className="display-font" style={sectionHeading}>CLUSTERS</div>}
|
|
578
546
|
{ordinaryClusters.map((c) => {
|
|
579
547
|
const states = c.members.map((m) => memberState(c, m.workflowId, jobs[m.workflowId]));
|
|
@@ -11,14 +11,15 @@ export function OperatorQuestionNotice({ workflowId, question, error }: { workfl
|
|
|
11
11
|
useEffect(() => { if (error || !connected || question.status !== 'pending') setSending(false); }, [error, question.status, connected]);
|
|
12
12
|
useEffect(() => { if (question.status !== 'pending') setAnswers({}); }, [question.status]);
|
|
13
13
|
const pending = question.status === 'pending';
|
|
14
|
-
const
|
|
14
|
+
const answered = question.questions.filter(q => answers[q.id]?.trim());
|
|
15
|
+
const ready = question.questions.every(q => q.optional || answers[q.id]?.trim());
|
|
15
16
|
const disabled = !pending || !connected || !send || sending;
|
|
16
17
|
const submit = () => {
|
|
17
18
|
if (disabled || !ready) return;
|
|
18
19
|
updateMessage(workflowId, `operator-question-${question.requestId}`, { operatorQuestionError: undefined });
|
|
19
20
|
setSending(true);
|
|
20
21
|
send!({ type: 'operator_question_reply', workflowId, requestId: question.requestId,
|
|
21
|
-
answers: Object.fromEntries(
|
|
22
|
+
answers: Object.fromEntries(answered.map(q => [q.id, [answers[q.id]]])) });
|
|
22
23
|
};
|
|
23
24
|
const dismiss = () => {
|
|
24
25
|
if (disabled) return;
|
|
@@ -28,11 +29,11 @@ export function OperatorQuestionNotice({ workflowId, question, error }: { workfl
|
|
|
28
29
|
};
|
|
29
30
|
return <div id={`operator-question-${question.requestId}`} data-question-card="" style={{ borderLeft: '2px solid var(--color-accent-secondary)', padding: '10px 12px', background: 'var(--color-bg-sunken)', marginBottom: 12 }}>
|
|
30
31
|
<div className="display-font" style={{ color: 'var(--color-accent-secondary)', fontSize: 11, letterSpacing: 1, marginBottom: 8 }}>
|
|
31
|
-
{question.provider
|
|
32
|
+
{question.provider === 'antigravity-cli' ? 'GEMINI' : 'CODEX'} · {pending ? question.mode === 'blocking' ? 'WAITING FOR YOUR ANSWER' : 'QUESTION · AGENT CAN CONTINUE' : question.status.toUpperCase()}
|
|
32
33
|
</div>
|
|
33
34
|
<form onSubmit={(e) => { e.preventDefault(); submit(); }}>
|
|
34
35
|
{question.questions.map((q, i) => <fieldset key={q.id} disabled={disabled} style={{ border: 0, padding: 0, margin: '0 0 12px', minWidth: 0 }}>
|
|
35
|
-
<legend data-question-prose="" style={{ color: 'var(--color-text-primary)', fontSize: 13, whiteSpace: 'pre-wrap', marginBottom: 6 }}>{q.header && <strong>{q.header} · </strong>}{q.question}</legend>
|
|
36
|
+
<legend data-question-prose="" style={{ color: 'var(--color-text-primary)', fontSize: 13, whiteSpace: 'pre-wrap', marginBottom: 6 }}>{q.header && <strong>{q.header} · </strong>}{q.question}{q.optional && ' (optional)'}</legend>
|
|
36
37
|
{pending ? <>
|
|
37
38
|
{q.options?.length ? <div style={{ display: 'flex', flexDirection: 'column', gap: 6, marginBottom: 6 }}>
|
|
38
39
|
{q.options.map((o, index) => <button key={index} type="button" onClick={() => setAnswers((a) => ({ ...a, [q.id]: o.label }))}
|
|
@@ -315,7 +315,8 @@ export function ProvidersPopover({ open: controlledOpen, onOpenChange }: { open?
|
|
|
315
315
|
// For llama.cpp the lifecycle manager owns the spawned server, so we
|
|
316
316
|
// know exactly which model is in VRAM — surface it on the row.
|
|
317
317
|
const llamacppLoadedAlias = isLlamacpp ? (llamacppLive?.loadedModel ?? null) : null;
|
|
318
|
-
const
|
|
318
|
+
const latestAntigravity = latest ? `Latest v${latest}` : 'Latest unavailable';
|
|
319
|
+
const baseTitle = isAntigravity ? `agy ${broken ? 'not running' : `v${version}`} · ${latestAntigravity} (click to run agy update)` : broken
|
|
319
320
|
? `${label} is installed but is not responding to --version: click for update options and the error`
|
|
320
321
|
: isDeepSeek
|
|
321
322
|
? `Xolotl checkout ${version}${outdated ? ' · upstream revision differs' : ''}. Click for source changes inside Arco. This does not update or rebuild the engine.`
|
|
@@ -375,7 +376,10 @@ export function ProvidersPopover({ open: controlledOpen, onOpenChange }: { open?
|
|
|
375
376
|
}}
|
|
376
377
|
>
|
|
377
378
|
<span style={{ fontSize: '9px', letterSpacing: '1.5px', color: 'var(--color-fg-muted)', whiteSpace: 'nowrap' }}>{label}</span>
|
|
378
|
-
<span style={{ fontSize: '10px', color: versionColor }}>
|
|
379
|
+
<span style={{ fontSize: '10px', color: versionColor, textAlign: 'right' }}>
|
|
380
|
+
{versionDisplay}
|
|
381
|
+
{isAntigravity && <span style={{ display: 'block', color: 'var(--color-fg-muted)', letterSpacing: 'normal' }}>{latestAntigravity}</span>}
|
|
382
|
+
</span>
|
|
379
383
|
</button>
|
|
380
384
|
{isCursor && <a href="https://cursor.com/docs/cli/changelog" target="_blank" rel="noopener noreferrer" aria-label="Cursor CLI changelog" data-help="header.cursor-changelog" style={{ alignSelf: 'flex-end', padding: '4px', fontSize: '9px', lineHeight: 1.4 }}>CURSOR CHANGELOG ↗</a>}
|
|
381
385
|
</span>
|
|
@@ -684,7 +684,8 @@ function ActivityRow({ entry }: { entry: ActivityEntry }) {
|
|
|
684
684
|
fontSize: '9px',
|
|
685
685
|
letterSpacing: '1.5px',
|
|
686
686
|
color: 'var(--color-accent-secondary)',
|
|
687
|
-
flex: '0 1
|
|
687
|
+
flex: '0 1 auto',
|
|
688
|
+
maxWidth: '45%',
|
|
688
689
|
minWidth: 0,
|
|
689
690
|
overflowWrap: 'anywhere',
|
|
690
691
|
whiteSpace: 'normal',
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { ClaudeNativeAccountPicker } from '../ClaudeNativeAccountPicker';
|
|
2
|
+
import { useClaudeNativeCatalogFor } from '../../hooks/useClaudeNativeCatalog';
|
|
3
|
+
import { selectedClaudeTransport } from '../../utils/claudeAuth';
|
|
1
4
|
import { NativeSubagentControls } from '../NativeSubagentControls';
|
|
2
5
|
import { queueSettingsPatch } from '../../utils/settingsRequests';
|
|
3
6
|
import { confirmationSurfaceSize, WorkSurfaceControls } from '../workSurface/WorkSurfaceControls';
|
|
@@ -34,7 +37,7 @@ export function ConfigTab({
|
|
|
34
37
|
}: {
|
|
35
38
|
job: JobState;
|
|
36
39
|
hideCwd?: boolean;
|
|
37
|
-
onUpdatePrimary?: (update: { model?: ModelName; effort?: EffortLevel; autoHandoff?: import('@arco/shared').AutoHandoffConfig; autoFold?: { enabled: boolean; foldAt: number; tailBudget?: number }; autoCompaction?: import('@arco/shared').AutoCompactionPolicy | null; codexTransport?: 'exec' | 'appserver'; codexContextPolicy?: 'max' | 'standard'; claudeTransport?: 'cli' | 'native'; ultracode?: boolean; webSearchMaxUses?: number; claudeNativeCompact?: boolean; claudeNativeForceInterleavedThinkingBeta?: boolean; claudeNativeThinkingDisplay?: 'omitted' | 'summarized' | 'updates'; nativeSubagents?: import('@arco/shared').NativeSubagentPolicy | null; nativeCompactAutoContinue?: boolean; efficiencyToolFilter?: 'off' | 'conservative' | 'aggressive'; efficiencyFactForce?: 'on' | 'off'; efficiencyConfigProtection?: 'on' | 'off'; efficiencySandbox?: 'off' | 'on'; reviewSafeMode?: 'off' | 'on'; outputStyle?: import('@arco/shared').OutputStyle; goal?: string; ollamaParams?: Record<string, unknown> }) => void;
|
|
40
|
+
onUpdatePrimary?: (update: { model?: ModelName; effort?: EffortLevel; providerAccountRef?: string; autoHandoff?: import('@arco/shared').AutoHandoffConfig; autoFold?: { enabled: boolean; foldAt: number; tailBudget?: number }; autoCompaction?: import('@arco/shared').AutoCompactionPolicy | null; codexTransport?: 'exec' | 'appserver'; codexContextPolicy?: 'max' | 'standard'; claudeTransport?: 'cli' | 'native'; ultracode?: boolean; webSearchMaxUses?: number; claudeNativeCompact?: boolean; claudeNativeForceInterleavedThinkingBeta?: boolean; claudeNativeThinkingDisplay?: 'omitted' | 'summarized' | 'updates'; nativeSubagents?: import('@arco/shared').NativeSubagentPolicy | null; nativeCompactAutoContinue?: boolean; efficiencyToolFilter?: 'off' | 'conservative' | 'aggressive'; efficiencyFactForce?: 'on' | 'off'; efficiencyConfigProtection?: 'on' | 'off'; efficiencySandbox?: 'off' | 'on'; reviewSafeMode?: 'off' | 'on'; outputStyle?: import('@arco/shared').OutputStyle; goal?: string; ollamaParams?: Record<string, unknown> }) => void;
|
|
38
41
|
onAttachCodebaseMemory?: (workflowId: string, indexPath?: string) => void;
|
|
39
42
|
onDetachCodebaseMemory?: (workflowId: string) => void;
|
|
40
43
|
mcp?: McpSenders;
|
|
@@ -78,7 +81,8 @@ export function ConfigTab({
|
|
|
78
81
|
? [['RESUMED FROM', c.resumeSessionId.slice(0, 8) + '…'] as [string, string]]
|
|
79
82
|
: []),
|
|
80
83
|
];
|
|
81
|
-
const
|
|
84
|
+
const native = provider === 'claude' && selectedClaudeTransport(c.claudeTransport, settings?.claude?.transport, c.ultracode) === 'native';
|
|
85
|
+
const claudeNativeCatalog = useClaudeNativeCatalogFor(native ? c.providerAccountRef : undefined);
|
|
82
86
|
// Account-scoped: the CONFIG MODEL list reflects the workflow's selected
|
|
83
87
|
// Codex profile, so flipping the ACCOUNT PROFILE toggle re-filters models to
|
|
84
88
|
// that account's entitlements (e.g. WORK sees GPT-5.6 Sol, HOME doesn't).
|
|
@@ -165,6 +169,13 @@ export function ConfigTab({
|
|
|
165
169
|
<StaticRow key={k} k={k} v={v} />
|
|
166
170
|
))}
|
|
167
171
|
|
|
172
|
+
{native && (
|
|
173
|
+
<tr><td colSpan={2} style={{ padding: '6px 0' }}>
|
|
174
|
+
<ClaudeNativeAccountPicker value={c.providerAccountRef} disabled={job.busy}
|
|
175
|
+
onChange={canEdit ? providerAccountRef => onUpdatePrimary?.({ providerAccountRef }) : undefined} />
|
|
176
|
+
</td></tr>
|
|
177
|
+
)}
|
|
178
|
+
|
|
168
179
|
{claudeSessionId && (
|
|
169
180
|
<CopyableRow
|
|
170
181
|
k="SESSION"
|
|
@@ -580,19 +591,26 @@ function AutoCompactionSection({ job, onUpdatePrimary }: {
|
|
|
580
591
|
const own = job.config.autoCompaction;
|
|
581
592
|
const effective = own ?? cluster?.autoCompaction;
|
|
582
593
|
const provider = job.config.primaryProvider ?? 'claude';
|
|
594
|
+
if (provider === 'antigravity-cli' && isIsolatedAccessMode(cluster?.members.find((m) => m.workflowId === job.id)?.accessMode)) {
|
|
595
|
+
return <section data-help="rightpanel.config.auto-compaction">
|
|
596
|
+
<div className="display-font">AUTO-COMPACTION</div>
|
|
597
|
+
<p>Use COMPACT in an isolated Gemini researcher's conversation.</p>
|
|
598
|
+
</section>;
|
|
599
|
+
}
|
|
583
600
|
const supported = (provider === 'claude' && (job.config.claudeTransport ?? settings?.claude?.transport) === 'native')
|
|
584
601
|
|| (provider === 'codex' && (job.config.codexTransport ?? settings?.codex?.transport) === 'appserver')
|
|
585
|
-
|| (provider === 'ollama' && job.config.kind !== 'chat');
|
|
602
|
+
|| ((provider === 'ollama' || provider === 'antigravity-cli') && job.config.kind !== 'chat');
|
|
586
603
|
return <section data-help="rightpanel.config.auto-compaction" style={{ marginTop: 18, fontSize: 11, color: 'var(--color-fg)' }}>
|
|
587
604
|
<div className="display-font">AUTO-COMPACTION</div>
|
|
588
605
|
<p>Compaction summarizes older context in place. Fold creates a deterministic digest; handoff starts a fresh session. Codex needs an existing app-server thread. Ollama compacts before the next turn using its configured context window; completed executions are summarized durably. Legacy or partial history without a safe boundary defers compaction. Auto-handoff below counts these compactions and hands off after the number set there; manual handoff remains available. Unknown usage does not trigger this policy.</p>
|
|
606
|
+
{provider === 'antigravity-cli' && supported && <p>Arco sends /compact after a Gemini turn reaches the selected threshold. Off leaves Gemini's own compaction enabled.</p>}
|
|
589
607
|
{!supported && <p>Automatic compaction is unavailable for this provider or transport. Handoff remains available.</p>}
|
|
590
|
-
<label className="arco-field-label">Policy <select title="Provider: Claude CLI and
|
|
608
|
+
<label className="arco-field-label">Policy <select title="Provider: Claude CLI, Codex and Gemini compact themselves; Claude Native and Ollama compact automatically near the limit." className="arco-field" aria-label="Worker auto-compaction" value={own ? own.enabled ? 'on' : 'off' : 'inherit'} onChange={(e) => onUpdatePrimary({ autoCompaction: e.target.value === 'inherit' ? null : { enabled: e.target.value === 'on', thresholdPercent: effective?.thresholdPercent ?? 80 } })}>
|
|
591
609
|
<option value="inherit">{cluster ? 'No worker override' : 'Provider'}</option>
|
|
592
610
|
<option value="off">Off</option><option value="on" disabled={!supported}>On</option>
|
|
593
611
|
</select></label>
|
|
594
612
|
{own && <label> Threshold <AutoCompactionThreshold key={`${job.id}:${own.enabled}`} label="Worker auto-compaction threshold percent" value={own.thresholdPercent} onCommit={(thresholdPercent) => onUpdatePrimary({ autoCompaction: { ...own, thresholdPercent } })} /></label>}
|
|
595
|
-
{!own && cluster && <p>{effective ? `No worker override. Using the cluster policy: ${effective.enabled ? `on at ${effective.thresholdPercent}%` : 'off'}.` : 'No worker or cluster policy is set. Claude CLI and
|
|
613
|
+
{!own && cluster && <p>{effective ? `No worker override. Using the cluster policy: ${effective.enabled ? `on at ${effective.thresholdPercent}%` : 'off'}.` : 'No worker or cluster policy is set. Claude CLI, Codex and Gemini compact themselves; Claude Native and Ollama use Arco compaction near the context limit.'} Change the cluster policy in the cluster panel under AUTO-COMPACTION.</p>}
|
|
596
614
|
</section>;
|
|
597
615
|
}
|
|
598
616
|
|
|
@@ -8,9 +8,11 @@ import { ArtifactMoveDialog, artifactRelative } from '../ArtifactMoveDialog';
|
|
|
8
8
|
import { ArchitectureReviewDialog, isArchitectureReport } from '../ArchitectureReviewDialog';
|
|
9
9
|
import { UnkeepButton } from '../KeepButton';
|
|
10
10
|
import { pickerSurfaceSize, WorkSurfaceControls } from '../workSurface/WorkSurfaceControls';
|
|
11
|
+
import { previewChange, reconcileOutputs } from './outputsReconcile';
|
|
11
12
|
const CATEGORIES = ['all', 'images', 'documents', 'audio', 'video', 'other'] as const;
|
|
12
13
|
const joinFolder = (folder: string, name: string) => folder.replace(/[\\/]+$/, '') + (folder.includes('\\') ? '\\' : '/') + name;
|
|
13
14
|
const paramsFor = (output: WorkflowOutput) => new URLSearchParams({ cwd: output.cwd, workflowId: output.workflowId, id: output.id });
|
|
15
|
+
const isGemini = (output: WorkflowOutput) => output.id.startsWith('gemini-');
|
|
14
16
|
const labelFor = (output: WorkflowOutput) => output.title || output.name;
|
|
15
17
|
const isImageFile = (output: WorkflowOutput) =>
|
|
16
18
|
!!output.path && output.category === 'images' && /\.(png|jpe?g|gif|webp)$/i.test(output.name) && !output.missing;
|
|
@@ -80,6 +82,7 @@ export function OutputsPanel({ cwd, workflowId, clusterId }: { cwd: string; work
|
|
|
80
82
|
const [showAll, setShowAll] = useState(false);
|
|
81
83
|
const [viewerEditing, setViewerEditing] = useState(false);
|
|
82
84
|
const [viewer, setViewer] = useState<WorkflowOutput | null>(null);
|
|
85
|
+
const [viewerReload, setViewerReload] = useState(0);
|
|
83
86
|
const [transfer, setTransfer] = useState<{ output: WorkflowOutput; action: 'copy' | 'move'; destination?: string } | null>(null);
|
|
84
87
|
const [transferError, setTransferError] = useState(''), [transferResult, setTransferResult] = useState('');
|
|
85
88
|
const [busy, setBusy] = useState(false);
|
|
@@ -99,7 +102,7 @@ export function OutputsPanel({ cwd, workflowId, clusterId }: { cwd: string; work
|
|
|
99
102
|
const res = await fetch(`/api/outputs?${params}`, { cache: 'no-store', signal: ac.signal });
|
|
100
103
|
const body = await res.json();
|
|
101
104
|
if (!res.ok || !Array.isArray(body.outputs)) throw new Error(body.error || 'Outputs could not be loaded.');
|
|
102
|
-
if (request.current === attempt) { setOutputs(body.outputs); setError(''); if (typeof body.desktopOpen === 'boolean') setDesktopOpen(body.desktopOpen); if (Array.isArray(body.refusedExtensions)) setRefusedExt(body.refusedExtensions); }
|
|
105
|
+
if (request.current === attempt) { setOutputs(previous => reconcileOutputs(previous, body.outputs)); setError(''); if (typeof body.desktopOpen === 'boolean') setDesktopOpen(body.desktopOpen); if (Array.isArray(body.refusedExtensions)) setRefusedExt(body.refusedExtensions); }
|
|
103
106
|
} catch (err) { if (request.current === attempt) setError(err instanceof Error ? err.message : 'Outputs could not be loaded.'); }
|
|
104
107
|
finally { if (controller.current === ac) controller.current = null; if (request.current === attempt) setLoading(false); }
|
|
105
108
|
}, [cwd, workflowId, clusterId]);
|
|
@@ -109,22 +112,28 @@ export function OutputsPanel({ cwd, workflowId, clusterId }: { cwd: string; work
|
|
|
109
112
|
const focus = () => void load(); window.addEventListener('focus', focus);
|
|
110
113
|
return () => { request.current++; controller.current?.abort(); controller.current = null; window.clearInterval(interval); window.removeEventListener('focus', focus); };
|
|
111
114
|
}, [load]);
|
|
115
|
+
const viewerChange = viewer ? previewChange(viewer, outputs) : null;
|
|
112
116
|
const shown = outputs.filter(o => (showAll || o.primary !== false) && (category === 'all' || o.category === category) && `${o.title} ${o.name} ${o.producer} ${o.path || ''}`.toLowerCase().includes(query.trim().toLowerCase()));
|
|
113
117
|
const hiddenCount = showAll ? 0 : outputs.filter(o => o.primary === false).length;
|
|
114
118
|
const open = (output: WorkflowOutput, edit = false) => {
|
|
115
119
|
if (output.missing) return;
|
|
116
|
-
if (output.path && ['images', 'audio', 'video'].includes(output.category)) {
|
|
120
|
+
if (!isGemini(output) && output.path && ['images', 'audio', 'video'].includes(output.category)) {
|
|
117
121
|
const context = { cwd: output.cwd, workflowId: output.workflowId };
|
|
118
122
|
if (edit && output.category === 'images') openImageForEdit(output.path, context);
|
|
119
123
|
else openMediaFile(output.path, context);
|
|
120
124
|
} else { setViewer(output); setViewerEditing(edit); }
|
|
121
125
|
};
|
|
122
126
|
const refusedType = (o: WorkflowOutput) => { const ext = (o.name.split('.').pop() || '').toLowerCase(); return !o.name.includes('.') || refusedExt.includes(ext); };
|
|
123
|
-
const canOpen = (o: WorkflowOutput) => !!o.path && !o.inline && desktopOpen && !refusedType(o);
|
|
127
|
+
const canOpen = (o: WorkflowOutput) => !!o.path && !isGemini(o) && !o.inline && desktopOpen && !refusedType(o);
|
|
124
128
|
async function openInDefaultApp(output: WorkflowOutput) {
|
|
125
|
-
if (output.missing) return;
|
|
129
|
+
if (!output.path || output.missing) return;
|
|
130
|
+
if (refusedType(output)) {
|
|
131
|
+
setNote('');
|
|
132
|
+
setError(`${output.name} can run code, so Arco does not open it. Use Download instead.`);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (!canOpen(output)) return;
|
|
126
136
|
setError(''); setNote('');
|
|
127
|
-
if (refusedType(output)) { setError(`${output.name} can run code, so Arco does not open it. Use Download instead.`); return; }
|
|
128
137
|
try {
|
|
129
138
|
const res = await fetch('/api/outputs/open', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ cwd: output.cwd, workflowId: output.workflowId, id: output.id }) });
|
|
130
139
|
const body = await res.json().catch(() => ({}));
|
|
@@ -189,9 +198,9 @@ export function OutputsPanel({ cwd, workflowId, clusterId }: { cwd: string; work
|
|
|
189
198
|
{output.missing && <p role="status">File missing. Its original provenance is retained.</p>}
|
|
190
199
|
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 6 }}>
|
|
191
200
|
{previewable(output) && <button type="button" disabled={output.missing} onClick={() => open(output)}>Preview</button>}
|
|
192
|
-
{output.path && previewable(output) && ['images', 'documents', 'audio', 'video'].includes(output.category) && <button type="button" disabled={output.missing} onClick={() => open(output, true)}>Open in editor</button>}
|
|
193
|
-
<button type="button" data-help="rightpanel.outputs.transfer" disabled={output.missing} onClick={() => { setTransferError(''); setTransferResult(''); setTransfer({ output, action: 'copy' }); }}>Save a copy</button>
|
|
194
|
-
{output.path && <button type="button" data-help="rightpanel.outputs.transfer" disabled={output.missing} onClick={() => { setTransferError(''); setTransferResult(''); setTransfer({ output, action: 'move' }); }}>Move</button>}
|
|
201
|
+
{!isGemini(output) && output.path && previewable(output) && ['images', 'documents', 'audio', 'video'].includes(output.category) && <button type="button" disabled={output.missing} onClick={() => open(output, true)}>Open in editor</button>}
|
|
202
|
+
{!isGemini(output) && <button type="button" data-help="rightpanel.outputs.transfer" disabled={output.missing} onClick={() => { setTransferError(''); setTransferResult(''); setTransfer({ output, action: 'copy' }); }}>Save a copy</button>}
|
|
203
|
+
{!isGemini(output) && output.path && <button type="button" data-help="rightpanel.outputs.transfer" disabled={output.missing} onClick={() => { setTransferError(''); setTransferResult(''); setTransfer({ output, action: 'move' }); }}>Move</button>}
|
|
195
204
|
{output.path && artifactRelative(output.path, output.workflowId) && isArchitectureReport(output.name) && <button type="button" data-help="architecture-review.candidates" disabled={output.missing} onClick={() => setArchitectureReport(output)}>CANDIDATES</button>}
|
|
196
205
|
{output.path && artifactRelative(output.path, output.workflowId) && <button data-help="storage.move-project" disabled={output.missing} onClick={() => setArtifactMove(output)}>MOVE TO PROJECT</button>}
|
|
197
206
|
{output.keptBy && <><span data-help="storage.unkeep" style={{ color: 'var(--color-accent-primary)', alignSelf: 'center' }}>Kept</span>
|
|
@@ -205,7 +214,10 @@ export function OutputsPanel({ cwd, workflowId, clusterId }: { cwd: string; work
|
|
|
205
214
|
})}</ul>
|
|
206
215
|
<p style={{ color: 'var(--color-fg-muted)', fontSize: 10 }}>For files that do not appear automatically, save them in this workflow's artifacts folder and refresh. Up to 2,000 entries.</p>
|
|
207
216
|
</div>
|
|
208
|
-
{viewer && <FileViewerModal initialEditing={viewerEditing} path={viewer.path || viewer.name} fallback={{ cwd: viewer.cwd, workflowId: viewer.workflowId }} readUrl={`/api/outputs/content?${paramsFor(viewer)}`} editContext={viewer.path ? { cwd: viewer.cwd, workflowId: viewer.workflowId } : undefined} saveRequest={{ url: '/api/outputs/text', body: { cwd: viewer.cwd, workflowId: viewer.workflowId, id: viewer.id } }} onClose={() => { setViewer(null); void load(true); }}
|
|
217
|
+
{viewer && <FileViewerModal initialEditing={viewerEditing} path={viewer.path || viewer.name} fallback={{ cwd: viewer.cwd, workflowId: viewer.workflowId }} readUrl={`/api/outputs/content?${paramsFor(viewer)}`} editContext={!isGemini(viewer) && viewer.path ? { cwd: viewer.cwd, workflowId: viewer.workflowId } : undefined} saveRequest={{ url: '/api/outputs/text', body: { cwd: viewer.cwd, workflowId: viewer.workflowId, id: viewer.id } }} onClose={() => { setViewer(null); void load(true); }}
|
|
218
|
+
reloadToken={viewerReload} onSaved={() => setViewer(current => current && { ...current, updatedAt: Date.now() })}
|
|
219
|
+
notice={viewerChange === 'removed' ? 'This file was removed or moved after it was opened. The preview shows the copy loaded before.' : viewerChange === 'changed' ? 'This file changed after it was opened.' : undefined}
|
|
220
|
+
onReload={viewerChange === 'changed' ? () => { const now = outputs.find(o => o.workflowId === viewer.workflowId && o.id === viewer.id); if (now) { setViewer(now); setViewerReload(n => n + 1); } } : undefined} />}
|
|
209
221
|
{architectureReport?.path && <ArchitectureReviewDialog cwd={architectureReport.cwd} workflowId={architectureReport.workflowId} report={artifactRelative(architectureReport.path, architectureReport.workflowId)!} onClose={() => setArchitectureReport(null)} />}
|
|
210
222
|
{artifactMove?.path && <ArtifactMoveDialog cwd={artifactMove.cwd} workflowId={artifactMove.workflowId} itemPath={artifactRelative(artifactMove.path, artifactMove.workflowId)!} onClose={() => setArtifactMove(null)} />}
|
|
211
223
|
{transfer && <TransferDialog transfer={transfer} roots={roots} busy={busy} error={transferError} result={transferResult} onDestination={destination => setTransfer({ ...transfer, destination })} onConfirm={() => void finishTransfer()} onClose={() => { if (!busy) setTransfer(null); }} />}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { WorkflowOutput } from '@arco/shared';
|
|
2
|
+
|
|
3
|
+
const keyOf = (output: WorkflowOutput) => `${output.workflowId}:${output.id}`;
|
|
4
|
+
|
|
5
|
+
// Merge a refreshed Outputs list into the one on screen (docs/CLIENT.md
|
|
6
|
+
// "Outputs"). Items that are still listed keep their place, and keep their
|
|
7
|
+
// object when nothing about them changed, so a background refresh never moves
|
|
8
|
+
// the row being read. New items go first; items no longer listed drop out.
|
|
9
|
+
// Returns `previous` itself when nothing changed.
|
|
10
|
+
export function reconcileOutputs(previous: WorkflowOutput[], next: WorkflowOutput[]): WorkflowOutput[] {
|
|
11
|
+
if (!previous.length) return next;
|
|
12
|
+
const fresh = new Map(next.map(output => [keyOf(output), output]));
|
|
13
|
+
const known = new Set(previous.map(keyOf));
|
|
14
|
+
let changed = false;
|
|
15
|
+
const kept: WorkflowOutput[] = [];
|
|
16
|
+
for (const old of previous) {
|
|
17
|
+
const now = fresh.get(keyOf(old));
|
|
18
|
+
if (!now) { changed = true; continue; }
|
|
19
|
+
if (JSON.stringify(now) === JSON.stringify(old)) kept.push(old);
|
|
20
|
+
else { kept.push(now); changed = true; }
|
|
21
|
+
}
|
|
22
|
+
const added = next.filter(output => !known.has(keyOf(output)));
|
|
23
|
+
return changed || added.length ? [...added, ...kept] : previous;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// What happened to the file open in the preview since it was opened.
|
|
27
|
+
export function previewChange(open: WorkflowOutput, list: WorkflowOutput[]): 'removed' | 'changed' | null {
|
|
28
|
+
const now = list.find(output => keyOf(output) === keyOf(open));
|
|
29
|
+
if (!now || now.missing) return 'removed';
|
|
30
|
+
return now.updatedAt > open.updatedAt ? 'changed' : null;
|
|
31
|
+
}
|