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.
Files changed (254) hide show
  1. package/CONTRIBUTING.md +1 -1
  2. package/THIRD_PARTY_NOTICES +2 -2
  3. package/client/dist/assets/{PhosphorBackdrop-CHXVFLGT.js → PhosphorBackdrop-YsHTmZJh.js} +1 -1
  4. package/client/dist/assets/{ThemedBackgroundShaderImpl-Bhs4I9jA.js → ThemedBackgroundShaderImpl-BEjpgoBW.js} +1 -1
  5. package/client/dist/assets/{XtermView-CdfurwFx.js → XtermView-wh7jNKvk.js} +1 -1
  6. package/client/dist/assets/{galleryEditor-DYjZZ4cf.js → galleryEditor-CaOS2mmM.js} +1 -1
  7. package/client/dist/assets/{index-BjDmFvqG.js → index-j68SfA-l.js} +271 -271
  8. package/client/dist/index.html +1 -1
  9. package/client/src/App.tsx +2 -2
  10. package/client/src/components/AuthReloginNotice.tsx +7 -6
  11. package/client/src/components/ChatMessage.tsx +41 -29
  12. package/client/src/components/ChatPanel.tsx +17 -4
  13. package/client/src/components/ClaudeNativeAccountPicker.tsx +32 -0
  14. package/client/src/components/ClaudeNativeAuthRow.tsx +71 -19
  15. package/client/src/components/ClusterRightPanel/AddWorkerSection.tsx +11 -281
  16. package/client/src/components/ClusterRightPanel/AutoPickupControl.tsx +1 -1
  17. package/client/src/components/ClusterRightPanel/FreshMemberForm.tsx +315 -0
  18. package/client/src/components/ClusterRightPanel/ReplaceMemberDialog.tsx +17 -7
  19. package/client/src/components/ClusterRightPanel/index.tsx +1 -1
  20. package/client/src/components/ClusterRightPanel/useFreshMemberPicker.ts +6 -4
  21. package/client/src/components/ClusterTab.tsx +2 -2
  22. package/client/src/components/Connections/Connections.tsx +5 -9
  23. package/client/src/components/Connections/model.ts +3 -1
  24. package/client/src/components/FileViewerModal.tsx +54 -17
  25. package/client/src/components/GitHubPanel/index.tsx +9 -5
  26. package/client/src/components/HandoffDialog.tsx +5 -3
  27. package/client/src/components/MobileShell.tsx +1 -33
  28. package/client/src/components/OperatorQuestionNotice.tsx +5 -4
  29. package/client/src/components/ProvidersPopover.tsx +6 -2
  30. package/client/src/components/RightPanel/ActivityTab.tsx +2 -1
  31. package/client/src/components/RightPanel/ConfigTab.tsx +23 -5
  32. package/client/src/components/RightPanel/OutputsPanel.tsx +21 -9
  33. package/client/src/components/RightPanel/outputsReconcile.ts +31 -0
  34. package/client/src/components/SettingsPanel.tsx +7 -10
  35. package/client/src/components/SpawnDialog.tsx +14 -3
  36. package/client/src/components/TabBar.tsx +2 -2
  37. package/client/src/components/TabContextMenu.tsx +73 -133
  38. package/client/src/components/TerminalInput.tsx +4 -3
  39. package/client/src/components/TranscriptWorkerDialog.tsx +14 -4
  40. package/client/src/components/UpdateAction.tsx +30 -7
  41. package/client/src/components/UsageBar.tsx +37 -18
  42. package/client/src/components/WorkflowCreator/ClusterMembersSection.tsx +29 -3
  43. package/client/src/components/WorkflowCreator/index.tsx +29 -15
  44. package/client/src/components/WorkflowView.tsx +1 -1
  45. package/client/src/components/providerIndicator.ts +7 -3
  46. package/client/src/components/settings/GitHubAuthRow.tsx +34 -0
  47. package/client/src/explorer/ArtifactsLens.tsx +17 -8
  48. package/client/src/explorer/ExplorerApp.tsx +3 -3
  49. package/client/src/explorer/types.ts +3 -1
  50. package/client/src/help/content/cluster.tsx +10 -4
  51. package/client/src/help/content/composer.tsx +3 -2
  52. package/client/src/help/content/header.tsx +11 -4
  53. package/client/src/help/content/misc.tsx +7 -5
  54. package/client/src/help/content/rightPanel.tsx +8 -4
  55. package/client/src/help/content/settings.tsx +15 -4
  56. package/client/src/help/content/tabbar.tsx +1 -1
  57. package/client/src/help/manualSections/actions.tsx +5 -1
  58. package/client/src/help/manualSections/clusters.tsx +20 -14
  59. package/client/src/help/manualSections/configuration.tsx +6 -4
  60. package/client/src/help/manualSections/gettingStarted.tsx +4 -2
  61. package/client/src/help/manualSections/maintenance.tsx +31 -0
  62. package/client/src/help/manualSections/powerFeatures.tsx +1 -0
  63. package/client/src/help/manualSections/providers.tsx +11 -4
  64. package/client/src/help/manualSections/workspace.tsx +3 -3
  65. package/client/src/hooks/useClaudeNativeCatalog.ts +26 -0
  66. package/client/src/hooks/useClaudeNativeLogin.ts +16 -11
  67. package/client/src/hooks/useWebSocket.ts +4 -2
  68. package/client/src/layout/layoutRange.ts +4 -5
  69. package/client/src/questions/waitingQuestion.ts +2 -0
  70. package/client/src/stores/appStore.ts +5 -1
  71. package/client/src/stores/appStore.types.ts +2 -0
  72. package/client/src/stores/replayContext.ts +20 -0
  73. package/client/src/utils/chatFileLinks.ts +34 -3
  74. package/client/src/utils/claudeAuth.ts +9 -1
  75. package/client/src/ws/handleServerMessage.ts +11 -3
  76. package/docs/ARCHITECTURE.md +3 -3
  77. package/docs/BACKUP.md +1 -1
  78. package/docs/CLIENT.md +10 -5
  79. package/docs/EXTENDING.md +1 -1
  80. package/docs/FEATURES.md +3 -3
  81. package/docs/GETTING_STARTED.md +5 -4
  82. package/docs/GIT_WORKBENCH.md +8 -0
  83. package/docs/GLOSSARY.md +2 -2
  84. package/docs/GOTCHAS.md +4 -4
  85. package/docs/HTTP_API.md +54 -23
  86. package/docs/OPERATIONS.md +17 -1
  87. package/docs/OPERATOR_ACTIONS.md +2 -2
  88. package/docs/OUTPUTS.md +48 -6
  89. package/docs/PERSISTENCE.md +1 -1
  90. package/docs/PRIMITIVES.md +4 -2
  91. package/docs/PROTOCOL_CLUSTER.md +12 -6
  92. package/docs/PROTOCOL_PRIMITIVES.md +1 -1
  93. package/docs/PROVIDERS.md +46 -9
  94. package/docs/RESEARCH.md +1 -1
  95. package/docs/SETTINGS.md +9 -4
  96. package/node_modules/@arco/shared/dist/protocol/clusters.d.ts +15 -3
  97. package/node_modules/@arco/shared/dist/protocol/clusters.js +1 -1
  98. package/node_modules/@arco/shared/dist/protocol/models.d.ts +6 -1
  99. package/node_modules/@arco/shared/dist/protocol/operatorQuestions.d.ts +2 -1
  100. package/node_modules/@arco/shared/dist/protocol/settings.d.ts +3 -0
  101. package/node_modules/@arco/shared/dist/protocol/settings.js +5 -0
  102. package/node_modules/@arco/shared/dist/protocol/workflows.d.ts +1 -0
  103. package/node_modules/@arco/shared/dist/protocol/workflows.js +0 -2
  104. package/node_modules/@arco/shared/package.json +1 -1
  105. package/package.json +2 -2
  106. package/scripts/packaging/services.mjs +20 -1
  107. package/scripts/packaging/update.mjs +37 -2
  108. package/server/dist/attention.d.ts +6 -0
  109. package/server/dist/attention.js +6 -0
  110. package/server/dist/auth.d.ts +5 -0
  111. package/server/dist/auth.js +31 -20
  112. package/server/dist/clusterAutoTurn.d.ts +5 -1
  113. package/server/dist/clusterAutoTurn.js +31 -9
  114. package/server/dist/clusterPresets.js +3 -3
  115. package/server/dist/effortValidation.d.ts +2 -2
  116. package/server/dist/effortValidation.js +4 -4
  117. package/server/dist/explorerArtifacts.d.ts +1 -0
  118. package/server/dist/explorerArtifacts.js +12 -1
  119. package/server/dist/geminiMembers.d.ts +7 -1
  120. package/server/dist/geminiMembers.js +28 -14
  121. package/server/dist/http/conversationFiles.d.ts +36 -0
  122. package/server/dist/http/conversationFiles.js +222 -0
  123. package/server/dist/http/fileBytes.d.ts +3 -0
  124. package/server/dist/http/fileBytes.js +33 -0
  125. package/server/dist/http/fileContentRoute.d.ts +2 -0
  126. package/server/dist/http/fileContentRoute.js +139 -0
  127. package/server/dist/http/fileRead.d.ts +54 -2
  128. package/server/dist/http/fileRead.js +31 -24
  129. package/server/dist/http/outputRoutes.js +14 -21
  130. package/server/dist/http/readConfinement.d.ts +0 -11
  131. package/server/dist/http/readConfinement.js +4 -30
  132. package/server/dist/http/router.js +40 -66
  133. package/server/dist/index.js +26 -12
  134. package/server/dist/management/initHubLink.js +1 -1
  135. package/server/dist/outputs.js +8 -0
  136. package/server/dist/primitives/exportContext.d.ts +2 -0
  137. package/server/dist/primitives/exportContext.js +13 -2
  138. package/server/dist/primitives/runCompare.d.ts +7 -1
  139. package/server/dist/primitives/runCompare.js +44 -20
  140. package/server/dist/project/taskLedger.js +46 -34
  141. package/server/dist/providerAccounts.d.ts +4 -0
  142. package/server/dist/providerAccounts.js +20 -1
  143. package/server/dist/providers/antigravity/artifacts.d.ts +23 -0
  144. package/server/dist/providers/antigravity/artifacts.js +140 -0
  145. package/server/dist/providers/antigravity/index.js +85 -7
  146. package/server/dist/providers/antigravity/questions.d.ts +2 -0
  147. package/server/dist/providers/antigravity/questions.js +58 -0
  148. package/server/dist/providers/claude-native/auth.d.ts +9 -8
  149. package/server/dist/providers/claude-native/auth.js +50 -58
  150. package/server/dist/providers/claude-native/authStatus.d.ts +2 -2
  151. package/server/dist/providers/claude-native/authStatus.js +9 -7
  152. package/server/dist/providers/claude-native/catalog.d.ts +6 -5
  153. package/server/dist/providers/claude-native/catalog.js +50 -39
  154. package/server/dist/providers/claude-native/oauth.d.ts +10 -9
  155. package/server/dist/providers/claude-native/oauth.js +120 -96
  156. package/server/dist/providers/claude-native/worker.d.ts +1 -0
  157. package/server/dist/providers/claude-native/worker.js +38 -23
  158. package/server/dist/providers/codex-appserver/operatorQuestions.d.ts +5 -3
  159. package/server/dist/providers/codex-appserver/operatorQuestions.js +27 -13
  160. package/server/dist/server/broadcast.js +6 -0
  161. package/server/dist/settings.d.ts +1 -0
  162. package/server/dist/settings.js +39 -7
  163. package/server/dist/skills.js +1 -1
  164. package/server/dist/smartPickupAdapters.d.ts +1 -0
  165. package/server/dist/smartPickupAdapters.js +2 -2
  166. package/server/dist/smartPickupObserver.js +8 -5
  167. package/server/dist/thirdPartySkills.js +11 -5
  168. package/server/dist/usage.d.ts +1 -1
  169. package/server/dist/usage.js +39 -27
  170. package/server/dist/workers/WorkerManager.d.ts +1 -0
  171. package/server/dist/workers/WorkerManager.js +1 -0
  172. package/server/dist/workers/processKill.js +37 -24
  173. package/server/dist/workflowMeta.js +2 -2
  174. package/server/dist/ws/clusterHandlers.d.ts +2 -2
  175. package/server/dist/ws/clusterHandlers.js +127 -113
  176. package/server/dist/ws/clusterMembers.d.ts +1 -1
  177. package/server/dist/ws/clusterMembers.js +34 -4
  178. package/server/dist/ws/compactHandlers.js +30 -14
  179. package/server/dist/ws/compareHandlers.js +53 -21
  180. package/server/dist/ws/gateHandlers.js +2 -0
  181. package/server/dist/ws/genesisHandlers.js +5 -3
  182. package/server/dist/ws/handoffHandlers.d.ts +1 -1
  183. package/server/dist/ws/handoffHandlers.js +115 -39
  184. package/server/dist/ws/transcriptWorkerHandlers.js +7 -2
  185. package/server/dist/ws/turnEngine.js +33 -18
  186. package/server/dist/ws/updatePrimaryConfig.d.ts +3 -2
  187. package/server/dist/ws/updatePrimaryConfig.js +236 -133
  188. package/server/dist/ws/workflowHandlers.js +21 -4
  189. package/server/package.json +1 -1
  190. package/server/src/attention.ts +7 -0
  191. package/server/src/auth.ts +33 -20
  192. package/server/src/clusterAutoTurn.ts +31 -11
  193. package/server/src/clusterPresets.ts +2 -2
  194. package/server/src/effortValidation.ts +4 -4
  195. package/server/src/explorerArtifacts.ts +12 -1
  196. package/server/src/geminiMembers.ts +26 -15
  197. package/server/src/http/conversationFiles.ts +231 -0
  198. package/server/src/http/fileBytes.ts +34 -0
  199. package/server/src/http/fileContentRoute.ts +123 -0
  200. package/server/src/http/fileRead.ts +30 -25
  201. package/server/src/http/outputRoutes.ts +13 -13
  202. package/server/src/http/readConfinement.ts +3 -30
  203. package/server/src/http/router.ts +38 -62
  204. package/server/src/index.ts +27 -18
  205. package/server/src/management/initHubLink.ts +1 -1
  206. package/server/src/outputs.ts +8 -0
  207. package/server/src/primitives/exportContext.ts +14 -2
  208. package/server/src/primitives/runCompare.ts +73 -46
  209. package/server/src/project/taskLedger.ts +47 -30
  210. package/server/src/providerAccounts.ts +20 -1
  211. package/server/src/providers/antigravity/artifacts.ts +121 -0
  212. package/server/src/providers/antigravity/index.ts +64 -6
  213. package/server/src/providers/antigravity/questions.ts +52 -0
  214. package/server/src/providers/claude-native/auth.ts +45 -60
  215. package/server/src/providers/claude-native/authStatus.ts +9 -8
  216. package/server/src/providers/claude-native/catalog.ts +52 -35
  217. package/server/src/providers/claude-native/oauth.ts +101 -77
  218. package/server/src/providers/claude-native/worker.ts +38 -22
  219. package/server/src/providers/codex-appserver/operatorQuestions.ts +26 -12
  220. package/server/src/server/broadcast.ts +4 -0
  221. package/server/src/settings.ts +36 -8
  222. package/server/src/skills.ts +1 -1
  223. package/server/src/smartPickupAdapters.ts +3 -2
  224. package/server/src/smartPickupObserver.ts +8 -5
  225. package/server/src/thirdPartySkills.ts +11 -5
  226. package/server/src/usage.ts +30 -22
  227. package/server/src/workers/WorkerManager.ts +2 -0
  228. package/server/src/workers/processKill.ts +37 -23
  229. package/server/src/workflowMeta.ts +2 -2
  230. package/server/src/ws/clusterHandlers.ts +107 -104
  231. package/server/src/ws/clusterMembers.ts +25 -6
  232. package/server/src/ws/compactHandlers.ts +29 -15
  233. package/server/src/ws/compareHandlers.ts +59 -25
  234. package/server/src/ws/gateHandlers.ts +2 -0
  235. package/server/src/ws/genesisHandlers.ts +5 -4
  236. package/server/src/ws/handoffHandlers.ts +105 -37
  237. package/server/src/ws/transcriptWorkerHandlers.ts +6 -2
  238. package/server/src/ws/turnEngine.ts +32 -17
  239. package/server/src/ws/updatePrimaryConfig.ts +230 -132
  240. package/server/src/ws/workflowHandlers.ts +20 -4
  241. package/shared/dist/protocol/clusters.d.ts +15 -3
  242. package/shared/dist/protocol/clusters.js +1 -1
  243. package/shared/dist/protocol/models.d.ts +6 -1
  244. package/shared/dist/protocol/operatorQuestions.d.ts +2 -1
  245. package/shared/dist/protocol/settings.d.ts +3 -0
  246. package/shared/dist/protocol/settings.js +5 -0
  247. package/shared/dist/protocol/workflows.d.ts +1 -0
  248. package/shared/dist/protocol/workflows.js +0 -2
  249. package/shared/src/protocol/clusters.ts +23 -5
  250. package/shared/src/protocol/compare.ts +2 -2
  251. package/shared/src/protocol/models.ts +8 -4
  252. package/shared/src/protocol/operatorQuestions.ts +2 -1
  253. package/shared/src/protocol/settings.ts +8 -1
  254. package/shared/src/protocol/workflows.ts +1 -1
@@ -1,7 +1,8 @@
1
+ import type { FileHandle } from 'fs/promises';
1
2
  export declare function readFileForExplorer(path: string): Promise<{
2
3
  type: "too-large";
3
4
  size: number;
4
- kind: "image";
5
+ kind: string;
5
6
  dataUrl?: undefined;
6
7
  content?: undefined;
7
8
  } | {
@@ -11,11 +12,30 @@ export declare function readFileForExplorer(path: string): Promise<{
11
12
  kind?: undefined;
12
13
  content?: undefined;
13
14
  } | {
15
+ type: "binary";
16
+ size: number;
17
+ kind?: undefined;
18
+ dataUrl?: undefined;
19
+ content?: undefined;
20
+ } | {
21
+ type: "text";
22
+ content: string;
23
+ size: number;
24
+ kind?: undefined;
25
+ dataUrl?: undefined;
26
+ }>;
27
+ export declare function readExplorerHandle(path: string, handle: FileHandle, size: number): Promise<{
14
28
  type: "too-large";
15
29
  size: number;
16
- kind: "text";
30
+ kind: string;
17
31
  dataUrl?: undefined;
18
32
  content?: undefined;
33
+ } | {
34
+ type: "image";
35
+ dataUrl: string;
36
+ size: number;
37
+ kind?: undefined;
38
+ content?: undefined;
19
39
  } | {
20
40
  type: "binary";
21
41
  size: number;
@@ -29,4 +49,36 @@ export declare function readFileForExplorer(path: string): Promise<{
29
49
  kind?: undefined;
30
50
  dataUrl?: undefined;
31
51
  }>;
52
+ export declare function readGeminiPreview(file: string, handle: FileHandle, size: number, ctx: {
53
+ cwd: string;
54
+ workflowId: string;
55
+ }, id: string): Promise<{
56
+ type: "too-large";
57
+ size: number;
58
+ kind: string;
59
+ dataUrl?: undefined;
60
+ content?: undefined;
61
+ } | {
62
+ type: "image";
63
+ dataUrl: string;
64
+ size: number;
65
+ kind?: undefined;
66
+ content?: undefined;
67
+ } | {
68
+ type: "binary";
69
+ size: number;
70
+ kind?: undefined;
71
+ dataUrl?: undefined;
72
+ content?: undefined;
73
+ } | {
74
+ type: "text";
75
+ content: string;
76
+ size: number;
77
+ kind?: undefined;
78
+ dataUrl?: undefined;
79
+ }> | {
80
+ type: string;
81
+ size: number;
82
+ url: string;
83
+ };
32
84
  export declare function encodeProjectDir(cwd: string): string;
@@ -1,5 +1,4 @@
1
1
  import { openCheckedFile } from '../checkedFile.js';
2
- import { FileAccessError } from '../fileAccessPolicy.js';
3
2
  import { extname, resolve } from 'path';
4
3
  import { MAX_TEXT_SIZE, MAX_IMAGE_SIZE } from '../server/constants.js';
5
4
  const IMAGE_MIME = {
@@ -13,36 +12,44 @@ const IMAGE_MIME = {
13
12
  '.ico': 'image/x-icon',
14
13
  };
15
14
  export async function readFileForExplorer(path) {
16
- const ext = extname(path).toLowerCase();
17
15
  const handle = await openCheckedFile(path);
18
16
  try {
19
- const stats = await handle.stat();
20
- if (!stats.isFile())
21
- throw new FileAccessError();
22
- const size = stats.size;
23
- if (IMAGE_MIME[ext]) {
24
- if (size > MAX_IMAGE_SIZE)
25
- return { type: 'too-large', size, kind: 'image' };
26
- const buf = await handle.readFile();
27
- return {
28
- type: 'image',
29
- dataUrl: `data:${IMAGE_MIME[ext]};base64,${buf.toString('base64')}`,
30
- size,
31
- };
32
- }
33
- if (size > MAX_TEXT_SIZE)
34
- return { type: 'too-large', size, kind: 'text' };
35
- const buf = await handle.readFile();
36
- const sample = buf.subarray(0, Math.min(8192, buf.length));
37
- if (sample.includes(0)) {
38
- return { type: 'binary', size };
39
- }
40
- return { type: 'text', content: buf.toString('utf-8'), size };
17
+ return await readExplorerHandle(path, handle, (await handle.stat()).size);
41
18
  }
42
19
  finally {
43
20
  await handle.close();
44
21
  }
45
22
  }
23
+ // Use the handle that passed authorization and stop at the inspected length,
24
+ // even if the producer appends bytes while the preview is loading.
25
+ export async function readExplorerHandle(path, handle, size) {
26
+ const mime = IMAGE_MIME[extname(path).toLowerCase()];
27
+ if (size > (mime ? MAX_IMAGE_SIZE : MAX_TEXT_SIZE))
28
+ return { type: 'too-large', size, kind: mime ? 'image' : 'text' };
29
+ const buffer = Buffer.alloc(size);
30
+ let offset = 0;
31
+ while (offset < size) {
32
+ const { bytesRead } = await handle.read(buffer, offset, size - offset, offset);
33
+ if (!bytesRead)
34
+ break;
35
+ offset += bytesRead;
36
+ }
37
+ const bytes = buffer.subarray(0, offset);
38
+ if (mime)
39
+ return { type: 'image', dataUrl: `data:${mime};base64,${bytes.toString('base64')}`, size: offset };
40
+ if (bytes.subarray(0, 8192).includes(0))
41
+ return { type: 'binary', size: offset };
42
+ return { type: 'text', content: bytes.toString('utf8'), size: offset };
43
+ }
44
+ // Media playback uses the same exact output id and bounded download handle.
45
+ export function readGeminiPreview(file, handle, size, ctx, id) {
46
+ const ext = extname(file).toLowerCase();
47
+ const type = ['.mp3', '.wav', '.ogg', '.m4a', '.flac', '.opus'].includes(ext) ? 'audio'
48
+ : ['.mp4', '.webm', '.mov'].includes(ext) ? 'video' : null;
49
+ if (type)
50
+ return { type, size, url: '/api/outputs/file?' + new URLSearchParams({ cwd: ctx.cwd, workflowId: ctx.workflowId, id }) };
51
+ return readExplorerHandle(file, handle, size);
52
+ }
46
53
  // Claude CLI stores historical transcripts at
47
54
  // ~/.claude/projects/<encoded-cwd>/<sessionId>.jsonl
48
55
  // Encoding replaces every non-[A-Za-z0-9-] char with `-`, not just `/` — see
@@ -1,14 +1,15 @@
1
1
  import { openCheckedFile } from '../checkedFile.js';
2
2
  import { lstat } from 'node:fs/promises';
3
- import { pipeline } from 'node:stream/promises';
4
3
  import { getClusterCached, displayNameFor } from '../clusterStore.js';
5
4
  import { listOutputs, outputContext, readOutput, saveOutputText, transferOutput } from '../outputs.js';
6
5
  import { outputDirectory, readOutputIndex } from '../outputStore.js';
7
6
  import { keepCovering, readKeep } from '../keepStore.js';
8
7
  import path from 'node:path';
9
- import { readFileForExplorer } from '../http/fileRead.js';
8
+ import { openGeminiArtifact } from '../providers/antigravity/artifacts.js';
9
+ import { readExplorerHandle, readGeminiPreview } from './fileRead.js';
10
+ import { sendFileBytes } from './fileBytes.js';
10
11
  import { REFUSED_EXTENSIONS, desktopOpenAvailable, isLoopbackAddress, launchOpener, openerCommand, refusalFor } from './outputOpen.js';
11
- const MIME = { png: 'image/png', jpg: 'image/jpeg', jpeg: 'image/jpeg', gif: 'image/gif', webp: 'image/webp', wav: 'audio/wav', mp3: 'audio/mpeg', ogg: 'audio/ogg', flac: 'audio/flac', m4a: 'audio/mp4', mp4: 'video/mp4', webm: 'video/webm', mov: 'video/quicktime' };
12
+ const MIME = { png: 'image/png', jpg: 'image/jpeg', jpeg: 'image/jpeg', gif: 'image/gif', webp: 'image/webp', opus: 'audio/ogg', wav: 'audio/wav', mp3: 'audio/mpeg', ogg: 'audio/ogg', flac: 'audio/flac', m4a: 'audio/mp4', mp4: 'video/mp4', webm: 'video/webm', mov: 'video/quicktime' };
12
13
  function json(res, status, body) { res.writeHead(status, { 'Content-Type': 'application/json', 'Cache-Control': 'no-store' }); res.end(JSON.stringify(body)); return true; }
13
14
  async function bodyOf(req) {
14
15
  let text = '';
@@ -59,29 +60,21 @@ export async function tryHandleOutputRoutes(req, res) {
59
60
  if (inline)
60
61
  return json(res, 200, { type: 'text', content: inline.content, size: Buffer.byteLength(inline.content) });
61
62
  }
62
- const { entry, file } = await readOutput(ctx, id);
63
- if (url.pathname === '/api/outputs/content')
64
- return json(res, 200, await readFileForExplorer(file));
65
- const handle = await openCheckedFile(file);
63
+ const gemini = id.startsWith('gemini-') ? await openGeminiArtifact(ctx.cwd, ctx.workflowId, { id }) : null;
64
+ const file = gemini?.file ?? (await readOutput(ctx, id)).file;
65
+ const name = path.basename(file);
66
+ const handle = gemini?.handle ?? await openCheckedFile(file);
66
67
  try {
67
- const info = await handle.stat();
68
+ const info = gemini?.info ?? await handle.stat();
68
69
  if (!info.isFile())
69
70
  throw new Error('Output is not a regular file.');
70
- const ext = entry.name.split('.').pop()?.toLowerCase() || '';
71
+ if (url.pathname === '/api/outputs/content')
72
+ return json(res, 200, gemini
73
+ ? await readGeminiPreview(file, handle, info.size, ctx, id) : await readExplorerHandle(file, handle, info.size));
74
+ const ext = name.split('.').pop()?.toLowerCase() || '';
71
75
  // Active formats and unknown binaries are downloads, never executable previews.
72
76
  const preview = url.searchParams.get('download') !== '1' && !!MIME[ext];
73
- const range = /^bytes=(\d+)-(\d*)$/.exec(req.headers.range || '');
74
- const start = range ? Number(range[1]) : 0, end = range?.[2] ? Math.min(Number(range[2]), info.size - 1) : info.size - 1;
75
- if (range && (start > end || start >= info.size)) {
76
- res.writeHead(416, { 'Content-Range': `bytes */${info.size}` });
77
- res.end();
78
- return true;
79
- }
80
- res.writeHead(range ? 206 : 200, { 'Content-Type': preview ? MIME[ext] : 'application/octet-stream', 'Cache-Control': 'no-store', 'X-Content-Type-Options': 'nosniff', 'Content-Security-Policy': "sandbox; default-src 'none'", 'Content-Disposition': `${preview ? 'inline' : 'attachment'}; filename*=UTF-8''${encodeURIComponent(entry.name)}`, 'Accept-Ranges': 'bytes', 'Content-Length': range ? end - start + 1 : info.size, ...(range ? { 'Content-Range': `bytes ${start}-${end}/${info.size}` } : {}) });
81
- if (info.size)
82
- await pipeline(handle.createReadStream({ autoClose: false, emitClose: false, start, end }), res);
83
- else
84
- res.end();
77
+ await sendFileBytes(req, res, handle, info.size, name, preview ? MIME[ext] : undefined);
85
78
  return true;
86
79
  }
87
80
  finally {
@@ -1,17 +1,6 @@
1
1
  import { type ReadAccessContext } from '../fileAccessPolicy.js';
2
2
  export declare function readRoots(cwd?: string | null, workflowId?: string | null): Promise<string[]>;
3
3
  export declare function resolveBrowserRead(p: string, cwd?: string | null, workflowId?: string | null, kind?: 'file' | 'directory'): Promise<string>;
4
- export declare function clusterArtifactMatches(cwd: string, workflowId: string, name: string): Promise<{
5
- searched: Array<{
6
- workflowId: string;
7
- name: string;
8
- }>;
9
- matches: Array<{
10
- workflowId: string;
11
- name: string;
12
- path: string;
13
- }>;
14
- } | null>;
15
4
  export declare function listBrowserDirectory(dir: string, directoriesOnly: boolean, access?: ReadAccessContext): Promise<{
16
5
  root: string;
17
6
  entries: {
@@ -8,7 +8,7 @@ import { UPLOADS_DIR } from '../server/constants.js';
8
8
  import { SCRATCH_ROOT } from '../media/scratch.js';
9
9
  import { artifactsDir } from '../workers/limits.js';
10
10
  import { resolveWorktreeFile } from './browserWorktrees.js';
11
- import * as clusterStore from '../clusterStore.js';
11
+ import { geminiSessionKey } from '../providers/antigravity/artifacts.js';
12
12
  export async function readRoots(cwd, workflowId) {
13
13
  const bound = await resolveBoundCwd(cwd, workflowId);
14
14
  if (!bound.ok && bound.reason !== 'none')
@@ -18,6 +18,9 @@ export async function readRoots(cwd, workflowId) {
18
18
  export async function resolveBrowserRead(p, cwd, workflowId, kind = 'file') {
19
19
  if (!p || p.includes('\0'))
20
20
  throw new FileAccessError();
21
+ // Session files are served only by the workflow-bound handle reader.
22
+ if (geminiSessionKey(p) !== undefined)
23
+ throw new FileAccessError();
21
24
  if (workflowId && cwd && kind === 'file') {
22
25
  assertSafePath(path.resolve(cwd, p));
23
26
  const tracked = await import('../outputs.js').then(m => m.resolveTrackedOutput(cwd, workflowId, p)).catch(() => null);
@@ -50,35 +53,6 @@ export async function resolveBrowserRead(p, cwd, workflowId, kind = 'file') {
50
53
  return confinedPath(path.join(artifactsDir(bound.cwd, workflowId), p), [bound.cwd]);
51
54
  }
52
55
  }
53
- // Search only a bound conversation's cluster members after ordinary resolution
54
- // has failed. Every candidate goes through the existing workflow-document guard.
55
- export async function clusterArtifactMatches(cwd, workflowId, name) {
56
- if (!name || path.basename(name) !== name || name.includes('\\') || name.startsWith('.'))
57
- return null;
58
- const bound = await resolveBoundCwd(cwd, workflowId);
59
- const clusterId = clusterStore.getClusterIdForWorkflow(workflowId);
60
- const cluster = clusterId ? await clusterStore.readCluster(clusterId) : null;
61
- if (!bound.ok || !cluster || !cluster.members.includes(workflowId))
62
- return null;
63
- const searched = cluster.members.map((id) => ({ workflowId: id, name: clusterStore.displayNameFor(id) }));
64
- const matches = [];
65
- for (const member of searched) {
66
- try {
67
- const memberBound = await resolveBoundCwd(cluster.cwd, member.workflowId);
68
- const memberCwd = memberBound.ok ? memberBound.cwd : cluster.cwd;
69
- const resolved = await resolveWorkflowDocument(memberCwd, member.workflowId, 'artifacts', name);
70
- const root = artifactsDir(memberCwd, member.workflowId);
71
- // Tracked outputs can resolve outside artifacts; this fallback cannot.
72
- const checked = confinedPath(resolved, [root]);
73
- matches.push({ ...member, path: checked });
74
- }
75
- catch (err) {
76
- if (err.code !== 'ENOENT' && !(err instanceof FileAccessError))
77
- throw err;
78
- }
79
- }
80
- return { searched, matches };
81
- }
82
56
  // The project picker grants directory names only, not file content. Ordinary
83
57
  // absolute locations may be navigated without pre-registering every ancestor
84
58
  // (mounts, network shares, Windows drives); protected roots are never listed.
@@ -44,13 +44,13 @@ import { probeOnce as probePreviewPort } from '../previewAutoDetect.js';
44
44
  import { PreviewGateways } from '../previewProxy.js';
45
45
  import { previewPortRange } from '../previewPortConfiguration.js';
46
46
  import { HOST } from '../server/constants.js';
47
- import { clearTokens as clearClaudeNativeTokens } from '../providers/claude-native/auth.js';
48
47
  import { getClaudeNativeAuthStatus } from '../providers/claude-native/authStatus.js';
49
- import { getCatalog as getClaudeNativeCatalog } from '../providers/claude-native/catalog.js';
48
+ import { getCatalog as getClaudeNativeCatalog, forgetCatalog as forgetClaudeNativeCatalog } from '../providers/claude-native/catalog.js';
50
49
  import { CLAUDE_CLI_USER_AGENT } from '../providers/claude-native/wireFingerprint.js';
51
- import { completeBootstrap as claudeNativeCompleteBootstrap, startBootstrap as claudeNativeStartBootstrap, getBootstrapFlow as claudeNativeGetFlow, cancelBootstrap as claudeNativeCancelFlow, cancelActiveBootstrap as claudeNativeCancelActiveFlow, ensureLiveTokens as ensureClaudeNativeTokens, } from '../providers/claude-native/oauth.js';
50
+ import { completeBootstrap as claudeNativeCompleteBootstrap, startBootstrap as claudeNativeStartBootstrap, getBootstrapFlow as claudeNativeGetFlow, cancelBootstrap as claudeNativeCancelFlow, logout as claudeNativeLogout, ensureLiveTokens as ensureClaudeNativeTokens, } from '../providers/claude-native/oauth.js';
52
51
  import { getCodexCatalog } from '../providers/codex-appserver/catalog.js';
53
- import { resolveProviderAccount, ensureCodexAccountHome } from '../providerAccounts.js';
52
+ import { saveClaudeNativeProfile } from '../settings.js';
53
+ import { requireClaudeNativeAccount, resolveProviderAccount, ensureCodexAccountHome } from '../providerAccounts.js';
54
54
  import { getCursorCatalog } from '../providers/cursor/catalog.js';
55
55
  import { probeLlamacppLive } from '../providers/llamacpp.js';
56
56
  import { llamacppManager } from '../providers/llamacppManager.js';
@@ -68,9 +68,9 @@ import { auditSkillContent } from '../skillAudit.js';
68
68
  import { getUsage } from '../usage.js';
69
69
  import { listAllListeningProcesses } from '../workers/procListeningAll.js';
70
70
  import { flushAll as flushAllWorkflowEvents } from '../workflowStore.js';
71
- import { readFileForExplorer } from './fileRead.js';
71
+ import { tryHandleFileContent } from './fileContentRoute.js';
72
72
  import { explorerRoot } from './explorerRoot.js';
73
- import { clusterArtifactMatches, listBrowserDirectory, resolveBrowserRead } from './readConfinement.js';
73
+ import { listBrowserDirectory } from './readConfinement.js';
74
74
  import { confinedPath, safeDirectory, createReadAccessContext } from '../fileAccessPolicy.js';
75
75
  import { tryHandleClusterRoutes } from './clusterRoutes.js';
76
76
  import { tryHandleClusterSnapshotRoutes } from './clusterSnapshotRoutes.js';
@@ -1562,9 +1562,28 @@ export async function handleHttpRequest(req, res, deps) {
1562
1562
  // logout. The OAuth bootstrap server-side spawns its own local callback
1563
1563
  // listener on port 53692 when possible; on EADDRINUSE we surface a
1564
1564
  // manual-paste flag and accept the redirect URL via /callback.
1565
- if (req.url === '/api/auth/claude-native' && req.method === 'GET') {
1565
+ if (req.url === '/api/auth/claude-native/profiles' && req.method === 'POST') {
1566
1566
  try {
1567
- const status = await getClaudeNativeAuthStatus();
1567
+ let raw = '';
1568
+ for await (const chunk of req)
1569
+ raw += chunk;
1570
+ const body = JSON.parse(raw || '{}');
1571
+ if (typeof body.label !== 'string' || (body.id !== undefined && typeof body.id !== 'string'))
1572
+ throw new Error('Invalid Claude Native profile.');
1573
+ const settings = await saveClaudeNativeProfile(body.label, body.id);
1574
+ res.writeHead(200, { 'Content-Type': 'application/json', 'Cache-Control': 'no-store' });
1575
+ res.end(JSON.stringify(settings));
1576
+ }
1577
+ catch (err) {
1578
+ res.writeHead(400, { 'Content-Type': 'application/json' });
1579
+ res.end(JSON.stringify({ error: err instanceof Error ? err.message : 'Could not save Claude Native account.' }));
1580
+ }
1581
+ return;
1582
+ }
1583
+ if (req.url?.split('?')[0] === '/api/auth/claude-native' && req.method === 'GET') {
1584
+ try {
1585
+ const ref = new URL(req.url, 'http://localhost').searchParams.get('account');
1586
+ const status = await getClaudeNativeAuthStatus(await requireClaudeNativeAccount(ref ?? undefined));
1568
1587
  const body = { ...status, loggedIn: status.credentialsPresent };
1569
1588
  res.writeHead(200, { 'Content-Type': 'application/json' });
1570
1589
  res.end(JSON.stringify(body));
@@ -1591,7 +1610,9 @@ export async function handleHttpRequest(req, res, deps) {
1591
1610
  const body = JSON.parse(raw || '{}');
1592
1611
  if (body.workflowId !== undefined && (typeof body.workflowId !== 'string' || body.workflowId.length > 128))
1593
1612
  throw new Error('Invalid originating workflow id.');
1594
- const result = await claudeNativeStartBootstrap(body.binding, body.workflowId);
1613
+ if (body.accountRef !== undefined && typeof body.accountRef !== 'string')
1614
+ throw new Error('Invalid Claude Native account.');
1615
+ const result = await claudeNativeStartBootstrap(body.binding, body.workflowId, body.accountRef);
1595
1616
  res.writeHead(200, { 'Content-Type': 'application/json' });
1596
1617
  res.end(JSON.stringify(result));
1597
1618
  }
@@ -1624,10 +1645,12 @@ export async function handleHttpRequest(req, res, deps) {
1624
1645
  }
1625
1646
  return;
1626
1647
  }
1627
- if (req.url === '/api/auth/claude-native/logout' && req.method === 'POST') {
1648
+ if (req.url?.split('?')[0] === '/api/auth/claude-native/logout' && req.method === 'POST') {
1628
1649
  try {
1629
- await claudeNativeCancelActiveFlow();
1630
- await clearClaudeNativeTokens();
1650
+ const ref = new URL(req.url, 'http://localhost').searchParams.get('account');
1651
+ const account = await requireClaudeNativeAccount(ref ?? undefined);
1652
+ await claudeNativeLogout(account);
1653
+ forgetClaudeNativeCatalog(account);
1631
1654
  res.writeHead(200, { 'Content-Type': 'application/json' });
1632
1655
  res.end(JSON.stringify({ ok: true }));
1633
1656
  }
@@ -1647,7 +1670,7 @@ export async function handleHttpRequest(req, res, deps) {
1647
1670
  try {
1648
1671
  const url = new URL(req.url, `http://localhost:${PORT}`);
1649
1672
  const force = url.searchParams.get('force') === '1';
1650
- const snapshot = await getClaudeNativeCatalog(force);
1673
+ const snapshot = await getClaudeNativeCatalog(force, url.searchParams.get('account') ?? undefined);
1651
1674
  res.writeHead(200, { 'Content-Type': 'application/json' });
1652
1675
  res.end(JSON.stringify(snapshot));
1653
1676
  }
@@ -1718,7 +1741,7 @@ export async function handleHttpRequest(req, res, deps) {
1718
1741
  res.end(JSON.stringify({ error: 'expected { model: string, beta?: string[], maxTokens?: number, prompt?: string }' }));
1719
1742
  return;
1720
1743
  }
1721
- const tokens = await ensureClaudeNativeTokens();
1744
+ const tokens = await ensureClaudeNativeTokens(parsed.accountRef);
1722
1745
  // Match the worker's wire fingerprint exactly so a probe-passing
1723
1746
  // model translates 1:1 to a real-turn-passing model. Caller-supplied
1724
1747
  // beta entries append (don't replace) the standard ones.
@@ -2105,8 +2128,8 @@ export async function handleHttpRequest(req, res, deps) {
2105
2128
  return;
2106
2129
  }
2107
2130
  if (req.url?.startsWith('/api/usage') && req.method === 'GET') {
2108
- const force = new URL(req.url, `http://localhost:${PORT}`).searchParams.get('force') === '1';
2109
- const usage = await getUsage(force);
2131
+ const params = new URL(req.url, `http://localhost:${PORT}`).searchParams;
2132
+ const usage = await getUsage(params.get('force') === '1', params.get('account') ?? undefined);
2110
2133
  res.writeHead(200, { 'Content-Type': 'application/json', 'Cache-Control': 'no-store' });
2111
2134
  res.end(JSON.stringify(usage));
2112
2135
  return;
@@ -2133,57 +2156,8 @@ export async function handleHttpRequest(req, res, deps) {
2133
2156
  res.end(JSON.stringify(usage));
2134
2157
  return;
2135
2158
  }
2136
- if (req.url?.startsWith('/api/file-content') && req.method === 'GET') {
2137
- const url = new URL(req.url, `http://localhost:${PORT}`);
2138
- const asked = url.searchParams.get('path') || '';
2139
- const cwd = url.searchParams.get('cwd') || '';
2140
- const workflowId = url.searchParams.get('workflowId') || '';
2141
- const owner = url.searchParams.get('artifactOwner') || '';
2142
- try {
2143
- let target;
2144
- let artifactOwner;
2145
- try {
2146
- target = await resolveBrowserRead(asked, cwd, workflowId);
2147
- if (owner)
2148
- throw Object.assign(new Error('Artifact choice is no longer available.'), { code: 'EACCES' });
2149
- }
2150
- catch (err) {
2151
- if (err.code !== 'ENOENT' || !workflowId || !cwd)
2152
- throw err;
2153
- const found = await clusterArtifactMatches(cwd, workflowId, asked);
2154
- if (!found)
2155
- throw err;
2156
- const choices = found.matches.map(({ workflowId: id, name }) => ({ workflowId: id, name }));
2157
- if (!owner && choices.length > 1) {
2158
- res.writeHead(200, { 'Content-Type': 'application/json' });
2159
- res.end(JSON.stringify({ type: 'choices', choices }));
2160
- return;
2161
- }
2162
- const chosen = owner ? found.matches.find((match) => match.workflowId === owner) : found.matches[0];
2163
- if (!chosen) {
2164
- if (owner)
2165
- throw Object.assign(new Error('Artifact choice is no longer available.'), { code: 'EACCES' });
2166
- res.writeHead(404, { 'Content-Type': 'application/json' });
2167
- res.end(JSON.stringify({ type: 'error', error: `File not found: ${asked}. Searched the project and artifacts of: ${found.searched.map((m) => m.name).join(', ')}.` }));
2168
- return;
2169
- }
2170
- target = chosen.path;
2171
- artifactOwner = chosen.name;
2172
- }
2173
- const payload = await readFileForExplorer(target);
2174
- res.writeHead(200, { 'Content-Type': 'application/json' });
2175
- res.end(JSON.stringify({ ...payload, resolvedPath: target, ...(artifactOwner ? { artifactOwner } : {}) }));
2176
- }
2177
- catch (err) {
2178
- const code = err.code;
2179
- // A missing file is reported by the name that was asked for, never by a
2180
- // path the server or client composed.
2181
- const message = code === 'ENOENT' ? `File not found: ${asked}` : (err instanceof Error ? err.message : String(err));
2182
- res.writeHead(code === 'EACCES' ? 403 : 404, { 'Content-Type': 'application/json' });
2183
- res.end(JSON.stringify({ type: 'error', error: message }));
2184
- }
2159
+ if (await tryHandleFileContent(req, res))
2185
2160
  return;
2186
- }
2187
2161
  if (req.url?.startsWith('/api/files') && req.method === 'GET') {
2188
2162
  try {
2189
2163
  const url = new URL(req.url, `http://localhost:${PORT}`);
@@ -30,7 +30,7 @@ import { handleOperatorQuestionReply, handleOperatorQuestionDismiss } from './ws
30
30
  import { loadWorkspace, onWorkspaceChange, syncWorkspace } from './workspace.js';
31
31
  import './net/forceIpv4.js';
32
32
  import { hydrateProcessPathFromUserEnv } from './runtimeEnv.js';
33
- import { GEMINI_OPERATOR_ONLY_REFUSAL, geminiNudgeText, isGeminiMember, issueGeminiSend } from './geminiMembers.js';
33
+ import { GEMINI_OPERATOR_ONLY_REFUSAL, geminiNudgeText, isGeminiMember, issueGeminiSend, prepareGeminiPickup } from './geminiMembers.js';
34
34
  import { hasGuardrails, isClusterMemberProvider, resolveOutputStyle } from '@arco/shared';
35
35
  import { getEffectivePublicProjectChoice } from './publicProjectChoice.js';
36
36
  import { spawnSync } from 'child_process';
@@ -797,7 +797,7 @@ wss.on('connection', (ws) => {
797
797
  });
798
798
  break;
799
799
  case 'handoff_request':
800
- handleHandoffRequest(ws, session, msg).catch((err) => {
800
+ handleHandoffRequest(ws, session, msg, true).catch((err) => {
801
801
  console.error('[arco] handoff_request handler failed:', err);
802
802
  });
803
803
  break;
@@ -2171,7 +2171,7 @@ setClaudeNativeTaskHandler(async ({ parentWorkflowId, description, prompt, subag
2171
2171
  const policy = resolveNativeSubagents(defaults?.nativeSubagents, capturedPolicy ?? parent.config.nativeSubagents);
2172
2172
  const effectiveModel = policy.model || model || parent.config.primaryModel;
2173
2173
  if (policy.model) {
2174
- const catalog = await getNativeTaskCatalog();
2174
+ const catalog = await getNativeTaskCatalog(false, parent.config.providerAccountRef);
2175
2175
  assertActive();
2176
2176
  const ids = catalog.models.length ? catalog.models.map((m) => m.id) : [...CLAUDE_MODELS];
2177
2177
  if (!ids.includes(policy.model))
@@ -2299,6 +2299,7 @@ setClaudeNativeTaskHandler(async ({ parentWorkflowId, description, prompt, subag
2299
2299
  resumeSessionId: undefined,
2300
2300
  // Task children use the Native transport, including inherited settings.
2301
2301
  claudeTransport: 'native',
2302
+ providerAccountRef: parent.config.providerAccountRef,
2302
2303
  claudeNativeCompact: parent.config.claudeNativeCompact === true,
2303
2304
  claudeNativeForceInterleavedThinkingBeta: parent.config.claudeNativeForceInterleavedThinkingBeta === true,
2304
2305
  claudeNativeThinkingDisplay: parent.config.claudeNativeThinkingDisplay,
@@ -2469,13 +2470,18 @@ function onListening() {
2469
2470
  clusterIds: new Set(),
2470
2471
  clusterObserved: new Map(),
2471
2472
  };
2472
- handleUserMessage(fakeWs, fakeSession, wfid, content, undefined, // no clientMessageId — this is server-originated
2473
- undefined, // no attachments
2474
- false, // not an interjection — auto-turn only fires on idle
2475
- undefined, // kind: default ('follow-up' path is for busy recipients)
2476
- undefined, // no DOCS/GIT primitive
2477
- undefined, // no picked skills
2478
- { automaticKind: 'auto-pickup' }).catch((err) => {
2473
+ const dispatch = async () => {
2474
+ const gemini = isGeminiMember(wfid);
2475
+ const pickup = gemini ? await prepareGeminiPickup(wfid, content, 'rule') : undefined;
2476
+ if (gemini && !pickup)
2477
+ return;
2478
+ return handleUserMessage(fakeWs, fakeSession, wfid, pickup?.content ?? content, undefined, undefined, false, undefined, undefined, undefined, {
2479
+ automaticKind: 'auto-pickup',
2480
+ geminiSend: pickup?.ticket,
2481
+ ...(pickup && { claimGuard: async (claim) => pickup.isCurrent() && claim() }),
2482
+ });
2483
+ };
2484
+ void dispatch().catch((err) => {
2479
2485
  console.error(`[arco] auto-turn handleUserMessage failed for ${wfid.slice(0, 8)}:`, err);
2480
2486
  });
2481
2487
  },
@@ -2542,11 +2548,12 @@ function onListening() {
2542
2548
  const pending = workflows.get(wfid)?.config.incognito ? withoutOperationalLogging(run) : run();
2543
2549
  void pending.then(() => { resolve(false); settled(); }, () => { resolve(false); settled('Computer activity turn failed or was interrupted.'); });
2544
2550
  }));
2545
- const conditionalTurn = (wfid, content, guard, automaticKind) => new Promise((resolve) => {
2551
+ const conditionalTurn = (wfid, content, guard, automaticKind, geminiSend) => new Promise((resolve) => {
2546
2552
  const fakeWs = { readyState: WebSocket.CLOSED, send: () => undefined };
2547
2553
  const fakeSession = { id: 'computer-mail-rule', workflowIds: new Set([wfid]), clusterIds: new Set(), clusterObserved: new Map() };
2548
2554
  void handleUserMessage(fakeWs, fakeSession, wfid, content, undefined, undefined, false, undefined, undefined, undefined, {
2549
2555
  automaticKind,
2556
+ geminiSend,
2550
2557
  claimGuard: async (claim) => {
2551
2558
  const accepted = await guard(claim);
2552
2559
  resolve(accepted);
@@ -2565,7 +2572,14 @@ function onListening() {
2565
2572
  // Smart: Automatic wakes use the same conditional admission; an ask
2566
2573
  // proposal raises one operator notice.
2567
2574
  configureSmartPickupObserver({
2568
- dispatchGuarded: (wfid, content, guard) => conditionalTurn(wfid, content, guard, 'auto-pickup'),
2575
+ dispatchGuarded: async (wfid, content, guard) => {
2576
+ if (!isGeminiMember(wfid))
2577
+ return conditionalTurn(wfid, content, guard, 'auto-pickup');
2578
+ const pickup = await prepareGeminiPickup(wfid, content, 'smart-auto');
2579
+ if (!pickup)
2580
+ return false;
2581
+ return conditionalTurn(wfid, pickup.content, (claim) => guard(() => pickup.isCurrent() && claim()), 'auto-pickup', pickup.ticket);
2582
+ },
2569
2583
  notifyAsk: (d) => emitNotice({
2570
2584
  category: 'cluster-nudge',
2571
2585
  severity: 'warning',
@@ -366,7 +366,7 @@ export async function applyAction(action, actionId) {
366
366
  type: 'handoff_request',
367
367
  workflowId: action.workflowId,
368
368
  mode: 'quick',
369
- }).catch((err) => console.error(`[hub-link] handoff failed for ${action.workflowId.slice(0, 8)}:`, err));
369
+ }, true).catch((err) => console.error(`[hub-link] handoff failed for ${action.workflowId.slice(0, 8)}:`, err));
370
370
  return { ...base, ok: true, applied: 'handoff' };
371
371
  }
372
372
  case 'reply':
@@ -13,6 +13,7 @@ import { workflows } from './server/state.js';
13
13
  import { matchFileEvent } from './recentFilesLedger.js';
14
14
  import { outputDirectory, readOutputIndex, writeOutputIndex, mappedOutputPath } from './outputStore.js';
15
15
  import { readLogLines, sealedThroughSeq } from './eventLog.js';
16
+ import { listGeminiArtifacts } from './providers/antigravity/artifacts.js';
16
17
  import { addOutputGrant, hasOutputGrant, removeOutputGrant } from './outputGrants.js';
17
18
  const LIMIT = 2000;
18
19
  const EXTENSIONS = {
@@ -24,6 +25,7 @@ export function outputCategory(file) {
24
25
  const ext = path.extname(file).slice(1).toLowerCase();
25
26
  return Object.keys(EXTENSIONS).find(kind => EXTENSIONS[kind].includes(ext)) ?? 'other';
26
27
  }
28
+ const GEMINI_ARTIFACT_SOURCE = 'Gemini artifact';
27
29
  const CODE_EXTENSIONS = new Set(['ts', 'tsx', 'js', 'jsx', 'mjs', 'py', 'rs', 'go', 'java', 'css', 'sh', 'sql', 'diff', 'patch']);
28
30
  const EXPORT_SOURCES = new Set(['editor export', 'media export', 'saved copy']);
29
31
  // Whether an output is something made for the operator (shown by default) or a
@@ -376,6 +378,12 @@ export async function listOutputs(ctx) {
376
378
  }
377
379
  if (JSON.stringify(index) !== before)
378
380
  await writeOutputIndex(ctx.cwd, ctx.workflowId, index);
381
+ for (const row of await listGeminiArtifacts(ctx.cwd, ctx.workflowId)) {
382
+ const category = outputCategory(row.name);
383
+ out.push({ ...ctx, id: row.id, name: row.name, title: row.name, path: row.path, category,
384
+ source: GEMINI_ARTIFACT_SOURCE, size: row.size, createdAt: row.mtime, updatedAt: row.mtime,
385
+ primary: !CODE_EXTENSIONS.has(path.extname(row.name).toLowerCase()) && category !== 'other', missing: false });
386
+ }
379
387
  return out.sort((a, b) => b.updatedAt - a.updatedAt);
380
388
  });
381
389
  }
@@ -7,9 +7,11 @@ export interface SummarizerConfig {
7
7
  effort: EffortLevel;
8
8
  providerAccountRef?: string;
9
9
  codexHome?: string;
10
+ claudeTransport?: 'native';
10
11
  goal?: string;
11
12
  }
12
13
  export interface ExportContext {
14
+ allowGeminiHandoffWriter?: boolean;
13
15
  workflowId: string;
14
16
  cwd: string;
15
17
  manager: WorkerManager;