arco-workbench 0.1.7 → 0.1.9

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 (301) hide show
  1. package/CONTRIBUTING.md +63 -12
  2. package/README.md +21 -17
  3. package/client/dist/assets/{PhosphorBackdrop-DVQdBrTw.js → PhosphorBackdrop-DRu16-Is.js} +1 -1
  4. package/client/dist/assets/{ThemedBackgroundShaderImpl-BfSs2tB4.js → ThemedBackgroundShaderImpl-BLdwwQ4D.js} +1 -1
  5. package/client/dist/assets/{XtermView-DaMjC8Ny.js → XtermView-Xk7_9JaH.js} +1 -1
  6. package/client/dist/assets/{galleryEditor-BCQnXj7R.js → galleryEditor-CI8ClzBa.js} +1 -1
  7. package/client/dist/assets/{index-DD9kFGsF.css → index-BEFgrUJJ.css} +1 -1
  8. package/client/dist/assets/{index-COfbHCYv.js → index-C7WzZfsr.js} +257 -255
  9. package/client/dist/index.html +2 -2
  10. package/client/src/App.tsx +2 -0
  11. package/client/src/components/ChatMessage.tsx +33 -8
  12. package/client/src/components/ChatModeView.tsx +2 -0
  13. package/client/src/components/ClusterRightPanel/ReplaceMemberDialog.tsx +65 -15
  14. package/client/src/components/ClusterRightPanel/SkillsControl.tsx +124 -0
  15. package/client/src/components/ClusterRightPanel/index.tsx +4 -0
  16. package/client/src/components/ClusterTaskBoardTab.tsx +9 -22
  17. package/client/src/components/CodexLateCommand.tsx +34 -0
  18. package/client/src/components/DialogShell.tsx +2 -0
  19. package/client/src/components/MemberCard.tsx +4 -1
  20. package/client/src/components/MemberPane.tsx +3 -1
  21. package/client/src/components/NeedsYouBadge.tsx +3 -3
  22. package/client/src/components/PhoneUpload.tsx +288 -0
  23. package/client/src/components/PrimaryStatus.tsx +14 -6
  24. package/client/src/components/ProviderReleasesModal.tsx +8 -4
  25. package/client/src/components/ProvidersPopover.tsx +28 -23
  26. package/client/src/components/RuntimeStateBanner.tsx +5 -0
  27. package/client/src/components/SettingsPanel.tsx +2 -2
  28. package/client/src/components/SkillEditorDialog.tsx +2 -2
  29. package/client/src/components/SkillsSettings.tsx +21 -4
  30. package/client/src/components/TabBar.tsx +91 -9
  31. package/client/src/components/TerminalInput.tsx +15 -11
  32. package/client/src/components/TranscriptSendDialog.tsx +12 -8
  33. package/client/src/components/TranscriptWorkerDialog.tsx +119 -0
  34. package/client/src/components/WorkflowView.tsx +2 -0
  35. package/client/src/components/clusterNeedsYou.ts +11 -18
  36. package/client/src/explorer/ArtifactsLens.tsx +37 -28
  37. package/client/src/explorer/ExplorerApp.tsx +5 -4
  38. package/client/src/explorer/types.ts +8 -3
  39. package/client/src/help/content/cluster.tsx +48 -17
  40. package/client/src/help/content/composer.tsx +40 -1
  41. package/client/src/help/content/header.tsx +18 -1
  42. package/client/src/help/content/misc.tsx +9 -1
  43. package/client/src/help/content/settings.tsx +18 -4
  44. package/client/src/help/content/tabbar.tsx +5 -0
  45. package/client/src/help/manualSections/actions.tsx +31 -0
  46. package/client/src/help/manualSections/clusters.tsx +44 -20
  47. package/client/src/help/manualSections/configuration.tsx +20 -0
  48. package/client/src/help/manualSections/gettingStarted.tsx +4 -4
  49. package/client/src/help/manualSections/maintenance.tsx +25 -6
  50. package/client/src/help/manualSections/powerFeatures.tsx +3 -2
  51. package/client/src/help/manualSections/providers.tsx +32 -8
  52. package/client/src/help/manualSections/troubleshooting.tsx +2 -1
  53. package/client/src/help/manualSections/workflows.tsx +12 -0
  54. package/client/src/help/manualSections/workspace.tsx +36 -0
  55. package/client/src/stores/appStore.ts +7 -0
  56. package/client/src/stores/appStore.types.ts +4 -0
  57. package/client/src/styles/global.css +109 -0
  58. package/client/src/utils/phoneTheme.ts +38 -0
  59. package/client/src/utils/phoneUploadApi.ts +10 -0
  60. package/client/src/utils/transcriptWorkerRequest.ts +24 -0
  61. package/client/src/ws/handleServerMessage.ts +31 -8
  62. package/docs/ARCHITECTURE.md +1 -1
  63. package/docs/CLIENT.md +16 -9
  64. package/docs/FEATURES.md +13 -7
  65. package/docs/GETTING_STARTED.md +12 -6
  66. package/docs/GOTCHAS.md +2 -1
  67. package/docs/INDEX.md +1 -1
  68. package/docs/OPERATIONS.md +213 -52
  69. package/docs/PERSISTENCE.md +7 -2
  70. package/docs/PRIMITIVES.md +42 -0
  71. package/docs/PROTOCOL_CLUSTER.md +51 -4
  72. package/docs/PROTOCOL_PRIMITIVES.md +39 -0
  73. package/docs/PROVIDERS.md +84 -13
  74. package/docs/SETTINGS.md +29 -3
  75. package/docs/TASK_LEDGER.md +7 -15
  76. package/native/linux-x64/manifest.json +1 -1
  77. package/native/win32-x64/manifest.json +1 -1
  78. package/node_modules/@arco/shared/dist/clusterCoordination.d.ts +2 -0
  79. package/node_modules/@arco/shared/dist/clusterCoordination.js +5 -1
  80. package/node_modules/@arco/shared/dist/protocol/chat.d.ts +1 -0
  81. package/node_modules/@arco/shared/dist/protocol/clientMessages.d.ts +3 -2
  82. package/node_modules/@arco/shared/dist/protocol/clusters.d.ts +15 -1
  83. package/node_modules/@arco/shared/dist/protocol/index.d.ts +1 -0
  84. package/node_modules/@arco/shared/dist/protocol/index.js +1 -0
  85. package/node_modules/@arco/shared/dist/protocol/models.d.ts +4 -3
  86. package/node_modules/@arco/shared/dist/protocol/models.js +26 -2
  87. package/node_modules/@arco/shared/dist/protocol/serverMessages.d.ts +13 -1
  88. package/node_modules/@arco/shared/dist/protocol/tasks.d.ts +4 -0
  89. package/node_modules/@arco/shared/dist/protocol/transcriptWorker.d.ts +47 -0
  90. package/node_modules/@arco/shared/dist/protocol/transcriptWorker.js +2 -0
  91. package/node_modules/@arco/shared/dist/protocol/workflows.d.ts +1 -0
  92. package/node_modules/@arco/shared/dist/runtimeVersions.d.ts +1 -0
  93. package/node_modules/@arco/shared/dist/runtimeVersions.js +14 -0
  94. package/node_modules/@arco/shared/package.json +1 -1
  95. package/package.json +2 -2
  96. package/scripts/packaging/arco.mjs +1 -1
  97. package/scripts/packaging/native-repair.mjs +32 -4
  98. package/server/dist/atomicFile.js +1 -2
  99. package/server/dist/capabilities.d.ts +5 -2
  100. package/server/dist/capabilities.js +59 -9
  101. package/server/dist/cliUpdateDecision.d.ts +1 -1
  102. package/server/dist/cliUpdateDecision.js +5 -3
  103. package/server/dist/clusterDirector.js +2 -1
  104. package/server/dist/clusterPeerOps.js +14 -8
  105. package/server/dist/clusterProgress.js +1 -1
  106. package/server/dist/clusterRehydrate.js +2 -0
  107. package/server/dist/clusterSkills.d.ts +13 -0
  108. package/server/dist/clusterSkills.js +81 -0
  109. package/server/dist/clusterSnapshots.js +2 -0
  110. package/server/dist/clusterStore.d.ts +7 -2
  111. package/server/dist/clusterStore.js +42 -1
  112. package/server/dist/diagnostics/codeSkew.js +1 -0
  113. package/server/dist/eventLog.d.ts +7 -0
  114. package/server/dist/eventLog.js +70 -13
  115. package/server/dist/explorerDocs.d.ts +10 -6
  116. package/server/dist/explorerDocs.js +75 -34
  117. package/server/dist/historyLimits.d.ts +1 -0
  118. package/server/dist/historyLimits.js +3 -0
  119. package/server/dist/http/attachmentUpload.d.ts +13 -0
  120. package/server/dist/http/attachmentUpload.js +38 -0
  121. package/server/dist/http/browserWorktrees.d.ts +23 -0
  122. package/server/dist/http/browserWorktrees.js +120 -0
  123. package/server/dist/http/phoneUploadDrafts.d.ts +13 -0
  124. package/server/dist/http/phoneUploadDrafts.js +125 -0
  125. package/server/dist/http/phoneUploadListener.d.ts +17 -0
  126. package/server/dist/http/phoneUploadListener.js +81 -0
  127. package/server/dist/http/phoneUploadNetwork.d.ts +9 -0
  128. package/server/dist/http/phoneUploadNetwork.js +106 -0
  129. package/server/dist/http/phoneUploadPage.d.ts +2 -0
  130. package/server/dist/http/phoneUploadPage.js +136 -0
  131. package/server/dist/http/phoneUploadRouteHistory.d.ts +4 -0
  132. package/server/dist/http/phoneUploadRouteHistory.js +72 -0
  133. package/server/dist/http/phoneUploadRoutes.d.ts +4 -0
  134. package/server/dist/http/phoneUploadRoutes.js +419 -0
  135. package/server/dist/http/phoneUploadTheme.d.ts +17 -0
  136. package/server/dist/http/phoneUploadTheme.js +96 -0
  137. package/server/dist/http/projectBinding.d.ts +1 -0
  138. package/server/dist/http/projectBinding.js +3 -2
  139. package/server/dist/http/readConfinement.js +5 -1
  140. package/server/dist/http/router.js +14 -25
  141. package/server/dist/http/writeConfinement.js +19 -2
  142. package/server/dist/index.js +24 -1
  143. package/server/dist/jsonlLines.d.ts +4 -0
  144. package/server/dist/jsonlLines.js +53 -0
  145. package/server/dist/management/identity.js +1 -0
  146. package/server/dist/mcp/clusterMcpTools.js +4 -4
  147. package/server/dist/primitives/seedWorker.d.ts +1 -0
  148. package/server/dist/primitives/seedWorker.js +2 -1
  149. package/server/dist/project/taskLedger.d.ts +4 -0
  150. package/server/dist/project/taskLedger.js +7 -4
  151. package/server/dist/providerConversation.d.ts +1 -0
  152. package/server/dist/providerConversation.js +17 -0
  153. package/server/dist/providers/claude-native/resumeSummary.d.ts +9 -0
  154. package/server/dist/providers/claude-native/resumeSummary.js +102 -49
  155. package/server/dist/providers/claude-native/worker.js +8 -4
  156. package/server/dist/providers/claude.js +2 -1
  157. package/server/dist/providers/clusterTaskToolDefinitions.js +4 -4
  158. package/server/dist/providers/codex-appserver/catalog.js +16 -1
  159. package/server/dist/providers/codex-appserver/heldCommands.d.ts +14 -0
  160. package/server/dist/providers/codex-appserver/heldCommands.js +54 -0
  161. package/server/dist/providers/codex-appserver/index.d.ts +52 -2
  162. package/server/dist/providers/codex-appserver/index.js +239 -21
  163. package/server/dist/providers/codex-appserver/lateCommands.d.ts +62 -0
  164. package/server/dist/providers/codex-appserver/lateCommands.js +195 -0
  165. package/server/dist/providers/codex-appserver/worker.d.ts +23 -1
  166. package/server/dist/providers/codex-appserver/worker.js +89 -20
  167. package/server/dist/providers/codex.js +2 -1
  168. package/server/dist/providers/codexCodeMode.d.ts +2 -1
  169. package/server/dist/providers/codexCodeMode.js +8 -3
  170. package/server/dist/providers/cursor/print.js +2 -1
  171. package/server/dist/providers/cursor/worker.js +2 -1
  172. package/server/dist/providers/llamacpp.js +17 -8
  173. package/server/dist/providers/ollamaRecovery.js +6 -6
  174. package/server/dist/providers/ollamaResilience.js +3 -3
  175. package/server/dist/providers/ollamaTokens.js +1 -1
  176. package/server/dist/quota.d.ts +0 -18
  177. package/server/dist/quota.js +0 -44
  178. package/server/dist/replacementHistory.d.ts +19 -0
  179. package/server/dist/replacementHistory.js +49 -0
  180. package/server/dist/server/broadcast.d.ts +2 -1
  181. package/server/dist/server/broadcast.js +1 -0
  182. package/server/dist/server/prompts.d.ts +1 -0
  183. package/server/dist/server/prompts.js +6 -1
  184. package/server/dist/sessionJsonl.d.ts +1 -1
  185. package/server/dist/sessionJsonl.js +115 -40
  186. package/server/dist/smartPickupAdapters.js +15 -2
  187. package/server/dist/transcriptWorker.d.ts +34 -0
  188. package/server/dist/transcriptWorker.js +201 -0
  189. package/server/dist/workers/WorkerManager.d.ts +1 -0
  190. package/server/dist/workers/WorkerManager.js +1 -0
  191. package/server/dist/workers/processKill.d.ts +9 -1
  192. package/server/dist/workers/processKill.js +26 -10
  193. package/server/dist/workflowStore.d.ts +1 -0
  194. package/server/dist/workflowStore.js +31 -0
  195. package/server/dist/ws/clusterHandlers.d.ts +1 -0
  196. package/server/dist/ws/clusterHandlers.js +62 -26
  197. package/server/dist/ws/handoffHandlers.js +7 -2
  198. package/server/dist/ws/transcriptWorkerHandlers.d.ts +25 -0
  199. package/server/dist/ws/transcriptWorkerHandlers.js +139 -0
  200. package/server/dist/ws/turnEngine.js +40 -9
  201. package/server/dist/ws/updatePrimaryConfig.js +27 -8
  202. package/server/dist/ws/workflowHandlers.d.ts +4 -1
  203. package/server/dist/ws/workflowHandlers.js +3 -1
  204. package/server/package.json +1 -1
  205. package/server/src/atomicFile.ts +1 -2
  206. package/server/src/capabilities.ts +58 -17
  207. package/server/src/cliUpdateDecision.ts +5 -4
  208. package/server/src/clusterDirector.ts +2 -1
  209. package/server/src/clusterPeerOps.ts +15 -9
  210. package/server/src/clusterProgress.ts +1 -1
  211. package/server/src/clusterRehydrate.ts +2 -0
  212. package/server/src/clusterSkills.ts +79 -0
  213. package/server/src/clusterSnapshots.ts +1 -0
  214. package/server/src/clusterStore.ts +38 -0
  215. package/server/src/diagnostics/codeSkew.ts +1 -0
  216. package/server/src/eventLog.ts +73 -13
  217. package/server/src/explorerDocs.ts +75 -34
  218. package/server/src/historyLimits.ts +2 -0
  219. package/server/src/http/attachmentUpload.ts +49 -0
  220. package/server/src/http/browserWorktrees.ts +124 -0
  221. package/server/src/http/phoneUploadDrafts.ts +118 -0
  222. package/server/src/http/phoneUploadListener.ts +96 -0
  223. package/server/src/http/phoneUploadNetwork.ts +117 -0
  224. package/server/src/http/phoneUploadPage.ts +137 -0
  225. package/server/src/http/phoneUploadRouteHistory.ts +73 -0
  226. package/server/src/http/phoneUploadRoutes.ts +398 -0
  227. package/server/src/http/phoneUploadTheme.ts +97 -0
  228. package/server/src/http/projectBinding.ts +3 -2
  229. package/server/src/http/readConfinement.ts +5 -1
  230. package/server/src/http/router.ts +12 -26
  231. package/server/src/http/writeConfinement.ts +13 -2
  232. package/server/src/index.ts +23 -0
  233. package/server/src/jsonlLines.ts +52 -0
  234. package/server/src/management/identity.ts +1 -0
  235. package/server/src/mcp/clusterMcpTools.ts +4 -4
  236. package/server/src/primitives/seedWorker.ts +3 -1
  237. package/server/src/project/taskLedger.ts +7 -5
  238. package/server/src/providerConversation.ts +15 -0
  239. package/server/src/providers/claude-native/resumeSummary.ts +98 -50
  240. package/server/src/providers/claude-native/worker.ts +8 -4
  241. package/server/src/providers/claude.ts +2 -1
  242. package/server/src/providers/clusterTaskToolDefinitions.ts +4 -4
  243. package/server/src/providers/codex-appserver/catalog.ts +14 -1
  244. package/server/src/providers/codex-appserver/heldCommands.ts +58 -0
  245. package/server/src/providers/codex-appserver/index.ts +222 -20
  246. package/server/src/providers/codex-appserver/lateCommands.ts +225 -0
  247. package/server/src/providers/codex-appserver/worker.ts +85 -21
  248. package/server/src/providers/codex.ts +2 -1
  249. package/server/src/providers/codexCodeMode.ts +9 -4
  250. package/server/src/providers/cursor/print.ts +2 -1
  251. package/server/src/providers/cursor/worker.ts +2 -1
  252. package/server/src/providers/llamacpp.ts +18 -7
  253. package/server/src/providers/llamacppRecovery.ts +2 -0
  254. package/server/src/providers/ollamaRecovery.ts +6 -6
  255. package/server/src/providers/ollamaResilience.ts +3 -3
  256. package/server/src/providers/ollamaTokens.ts +1 -1
  257. package/server/src/providers/ollamaToolSubset.ts +3 -3
  258. package/server/src/quota.ts +0 -50
  259. package/server/src/replacementHistory.ts +44 -0
  260. package/server/src/server/broadcast.ts +2 -0
  261. package/server/src/server/prompts.ts +8 -1
  262. package/server/src/sessionJsonl.ts +92 -32
  263. package/server/src/smartPickupAdapters.ts +17 -3
  264. package/server/src/transcriptWorker.ts +182 -0
  265. package/server/src/workers/WorkerManager.ts +2 -0
  266. package/server/src/workers/processKill.ts +35 -7
  267. package/server/src/workflowStore.ts +21 -0
  268. package/server/src/ws/clusterHandlers.ts +43 -25
  269. package/server/src/ws/handoffHandlers.ts +7 -1
  270. package/server/src/ws/transcriptWorkerHandlers.ts +126 -0
  271. package/server/src/ws/turnEngine.ts +35 -8
  272. package/server/src/ws/updatePrimaryConfig.ts +25 -6
  273. package/server/src/ws/workflowHandlers.ts +3 -1
  274. package/shared/dist/clusterCoordination.d.ts +2 -0
  275. package/shared/dist/clusterCoordination.js +5 -1
  276. package/shared/dist/protocol/chat.d.ts +1 -0
  277. package/shared/dist/protocol/clientMessages.d.ts +3 -2
  278. package/shared/dist/protocol/clusters.d.ts +15 -1
  279. package/shared/dist/protocol/index.d.ts +1 -0
  280. package/shared/dist/protocol/index.js +1 -0
  281. package/shared/dist/protocol/models.d.ts +4 -3
  282. package/shared/dist/protocol/models.js +26 -2
  283. package/shared/dist/protocol/serverMessages.d.ts +13 -1
  284. package/shared/dist/protocol/tasks.d.ts +4 -0
  285. package/shared/dist/protocol/transcriptWorker.d.ts +47 -0
  286. package/shared/dist/protocol/transcriptWorker.js +2 -0
  287. package/shared/dist/protocol/workflows.d.ts +1 -0
  288. package/shared/dist/runtimeVersions.d.ts +1 -0
  289. package/shared/dist/runtimeVersions.js +14 -0
  290. package/shared/src/clusterCoordination.ts +7 -1
  291. package/shared/src/protocol/chat.ts +1 -0
  292. package/shared/src/protocol/clientMessages.ts +5 -0
  293. package/shared/src/protocol/clusters.ts +20 -6
  294. package/shared/src/protocol/index.ts +1 -0
  295. package/shared/src/protocol/models.ts +31 -5
  296. package/shared/src/protocol/serverMessages.ts +13 -0
  297. package/shared/src/protocol/settings.ts +2 -3
  298. package/shared/src/protocol/tasks.ts +4 -7
  299. package/shared/src/protocol/transcriptWorker.ts +49 -0
  300. package/shared/src/protocol/workflows.ts +4 -0
  301. package/shared/src/runtimeVersions.ts +14 -0
@@ -1,7 +1,8 @@
1
1
  import { localRuntimeStatusService } from '../localRuntimeStatus.js';
2
2
  import { tryHandleHandoffHistoryRoute } from './handoffHistoryRoutes.js';
3
- import { shrinkUploadedImage } from '../uploadImages.js';
4
- import { ensureStorageRoot, UnsafeStorageRootError } from '../storageRoot.js';
3
+ import { UnsafeStorageRootError } from '../storageRoot.js';
4
+ import { readAttachmentBody, storeAttachment } from './attachmentUpload.js';
5
+ import { tryHandlePhoneOperator, tryHandlePhonePage } from './phoneUploadRoutes.js';
5
6
  import { requireProjectBinding } from './projectBinding.js';
6
7
  import { tryHandleStorageRoutes } from './storageRoutes.js';
7
8
  import { tryHandleArchitectureReviewRoutes } from './architectureReviewRoutes.js';
@@ -24,9 +25,9 @@ import { tryHandleDeepSeekRoutes } from './deepseekRoutes.js';
24
25
  import { tryHandleVoiceRoutes } from './voiceRoutes.js';
25
26
  import { spawn } from 'child_process';
26
27
  import { chmodSync, writeFileSync } from 'fs';
27
- import { mkdir, readdir, readFile, writeFile } from 'fs/promises';
28
+ import { mkdir, readdir, readFile } from 'fs/promises';
28
29
  import { homedir, tmpdir } from 'os';
29
- import { basename, extname, join, resolve, sep } from 'path';
30
+ import { extname, join, resolve, sep } from 'path';
30
31
  import { unloadLocalModels } from '../localModels.js';
31
32
  import { getAuthStatus, triggerAuthLogin } from '../auth.js';
32
33
  import { cliSnapshotDir, runCliUpdate, refreshRuntimeVersions } from '../capabilities.js';
@@ -56,8 +57,7 @@ import { probeOllamaLive, aggregateOllamaPs, unloadOllamaModel } from '../provid
56
57
  import { computeVramReport, computeOllamaFit } from '../providers/ollamaVram.js';
57
58
  import { markAvailable as quotaMarkAvailable, markThrottled as quotaMarkThrottled, wireSnapshot as quotaWireSnapshot } from '../quota.js';
58
59
  import { broadcastWorkflow, send } from '../server/broadcast.js';
59
- import { compareDirectoryNames, PORT, PROJECT_ROOT, UPLOAD_IMAGE_EXT, UPLOADS_DIR } from '../server/constants.js';
60
- import { queueModelImage } from '../providers/attachments.js';
60
+ import { compareDirectoryNames, PORT, PROJECT_ROOT } from '../server/constants.js';
61
61
  import { sessions, workflows } from '../server/state.js';
62
62
  import { patchSettings, readSettings, readListingSettings } from '../settings.js';
63
63
  import { deleteSkill, isValidSlug, listSkills, readSkillBody, readBuiltinSkill, copyBuiltinSkill, writeSkill } from '../skills.js';
@@ -155,6 +155,8 @@ export async function handleHttpRequest(req, res, deps) {
155
155
  res.end(JSON.stringify({ error: 'Forbidden origin' }));
156
156
  return;
157
157
  }
158
+ if (await tryHandlePhonePage(req, res))
159
+ return;
158
160
  if (guard.origin) {
159
161
  res.setHeader('Access-Control-Allow-Origin', guard.origin);
160
162
  res.setHeader('Vary', 'Origin');
@@ -230,6 +232,8 @@ export async function handleHttpRequest(req, res, deps) {
230
232
  }
231
233
  // Operator routes in their own modules: behind the session gate like every
232
234
  // other /api route (they read or change settings and can call providers).
235
+ if (await tryHandlePhoneOperator(req, res))
236
+ return;
233
237
  if (await tryHandleProviderThrottleRoutes(req, res))
234
238
  return;
235
239
  if (await tryHandleSmartPickupRoutes(req, res))
@@ -323,10 +327,7 @@ export async function handleHttpRequest(req, res, deps) {
323
327
  }
324
328
  if (req.url === '/upload' && req.method === 'POST') {
325
329
  try {
326
- const chunks = [];
327
- for await (const chunk of req)
328
- chunks.push(chunk);
329
- const body = Buffer.concat(chunks);
330
+ const body = await readAttachmentBody(req);
330
331
  // Reject empty uploads so they cannot produce invalid image blocks in
331
332
  // a worker's persistent history.
332
333
  if (body.length === 0) {
@@ -338,21 +339,9 @@ export async function handleHttpRequest(req, res, deps) {
338
339
  ? req.headers['x-filename'].trim()
339
340
  : `upload-${Date.now()}`;
340
341
  const contentType = typeof req.headers['content-type'] === 'string' ? req.headers['content-type'].split(';')[0].trim().toLowerCase() : '';
341
- const ext = extname(rawFilename);
342
- const inferredExt = !ext && contentType ? UPLOAD_IMAGE_EXT[contentType] : undefined;
343
- const filename = basename(rawFilename) + (inferredExt ?? '');
344
- const fileId = crypto.randomUUID().slice(0, 8);
345
- const uploadRoot = await ensureStorageRoot(UPLOADS_DIR);
346
- const savePath = join(uploadRoot, `${fileId}-${filename}`);
347
- await writeFile(savePath, body, { flag: 'wx' });
348
- console.log(`[arco] File uploaded: ${filename} -> ${savePath}`);
349
- // Finish upload-only replacement before publishing the stable path.
350
- // Failure retains the original; project files never enter this path.
351
- await shrinkUploadedImage(savePath);
352
- // Other formats still use a separate model-compatible copy.
353
- queueModelImage(savePath);
342
+ const stored = await storeAttachment(body, rawFilename, contentType);
354
343
  res.writeHead(200, { 'Content-Type': 'application/json' });
355
- res.end(JSON.stringify({ fileId, filename, path: savePath }));
344
+ res.end(JSON.stringify(stored));
356
345
  }
357
346
  catch (error) {
358
347
  res.writeHead(500, { 'Content-Type': 'application/json' });
@@ -1850,7 +1839,7 @@ export async function handleHttpRequest(req, res, deps) {
1850
1839
  res.end(JSON.stringify({ error: retired }));
1851
1840
  return;
1852
1841
  }
1853
- const provider = providerParam === 'codex'
1842
+ const provider = providerParam === 'codex' || providerParam === 'cursor'
1854
1843
  ? providerParam
1855
1844
  : 'claude';
1856
1845
  const result = await runCliUpdate(deps.getCapabilities(), provider);
@@ -112,7 +112,7 @@ export async function resolveBoundCwd(callerCwd, workflowId) {
112
112
  ...clusterStore.listKnownClusterIds().map(id => clusterStore.getClusterCached(id)?.cwd)];
113
113
  for (const root of live) {
114
114
  try {
115
- if (root && safeDirectory(root) === canonical)
115
+ if (root && sameDirectory(canonical, root))
116
116
  return { ok: true, cwd: callerCwd };
117
117
  }
118
118
  catch { /* protected or stale root */ }
@@ -120,13 +120,30 @@ export async function resolveBoundCwd(callerCwd, workflowId) {
120
120
  const roots = await knownRoots();
121
121
  for (const root of roots) {
122
122
  try {
123
- if (safeDirectory(root) === canonical)
123
+ if (sameDirectory(canonical, root))
124
124
  return { ok: true, cwd: callerCwd };
125
125
  }
126
126
  catch { /* protected or stale root */ }
127
127
  }
128
128
  return { ok: false, reason: 'unknown-cwd' };
129
129
  }
130
+ // Node's JavaScript realpath keeps a Windows 8.3 short name and the letter
131
+ // case as written, while the native resolver (used by the document list)
132
+ // expands both. A known root and a caller cwd that name the same directory in
133
+ // different spellings still match; both sides pass safeDirectory first.
134
+ function sameDirectory(canonical, root) {
135
+ const other = safeDirectory(root);
136
+ if (other === canonical)
137
+ return true;
138
+ if (process.platform !== 'win32')
139
+ return false;
140
+ try {
141
+ return realpathSync.native(other) === realpathSync.native(canonical);
142
+ }
143
+ catch {
144
+ return false;
145
+ }
146
+ }
130
147
  export function boundCwdError(reason) {
131
148
  switch (reason) {
132
149
  case 'none': return 'cwd or a workflow id with a bound cwd is required';
@@ -1,4 +1,5 @@
1
1
  import { releaseProjectSettingsWatcher } from './settings.js';
2
+ import { initTranscriptWorkerHandlers, handleTranscriptWorkerPreview, handleTranscriptWorkerCreate } from './ws/transcriptWorkerHandlers.js';
2
3
  import { NativeTaskAdmission, assertNativeTaskAllowed } from './providers/claude-native/taskAdmission.js';
3
4
  import { resolveNativeSubagents, CLAUDE_MODELS } from '@arco/shared';
4
5
  import { getCatalog as getNativeTaskCatalog } from './providers/claude-native/catalog.js';
@@ -70,7 +71,7 @@ import { startMemoryMonitor, logMemorySample } from './memoryMonitor.js';
70
71
  import { listeningPortsForPidFamily } from './workers/procListening.js';
71
72
  import { updateMeta, } from './workflowMeta.js';
72
73
  import { flushAll as flushAllWorkflowEvents, initWorkflowStore } from './workflowStore.js';
73
- import { detachClusterObservers, handleClusterAddFreshWorkers, handleClusterAutoTurnToggle, handleClusterAutoPickupSet, handleClusterBroadcast, handleClusterCreate, handleClusterCreateFromScratch, handleClusterCreateWithFreshWorkers, handleClusterDelete, handleClusterDispatchSettingsUpdate, handleClusterDispatchOnce, handleClusterDispatchToggle, handleClusterSwarmCreate, handleClusterOrchestrationAssistRequest, handleClusterOrchestrationProposalApply, handleClusterOrchestrationProposalList, handleClusterOrchestrationProposalReject, handleClusterIdleNudgerToggle, handleClusterEfficiencySet, handleClusterAutoCompactionSet, handleClusterRemoteSet, handleClusterGatesSet, handleClusterMemberReorder, handleClusterProgressSet, handleClusterTaskBoardAttachSet, handleClusterTaskBoardModeSet, handleClusterMemberAdd, handleClusterMemberFocusSet, handleClusterMemberRemove, handleClusterMemberReplace, handleClusterMemberRoleSet, handleClusterMemberTierSet, handleClusterPlanAttach, handleClusterPlanClear, handleClusterPlanSet, handleClusterRename, handleClusterSnapshotSave, handleClusterSnapshotList, handleClusterSnapshotRestore, handleClusterSnapshotDelete, handleClusterSubscribe, handleOperatorPeerSend, dispatchTaskTurnSynthetic, broadcastTaskDispatchResult, initClusterHandlers, } from './ws/clusterHandlers.js';
74
+ import { detachClusterObservers, handleClusterAddFreshWorkers, handleClusterAutoTurnToggle, handleClusterAutoPickupSet, handleClusterBroadcast, handleClusterCreate, handleClusterCreateFromScratch, handleClusterCreateWithFreshWorkers, handleClusterDelete, handleClusterDispatchSettingsUpdate, handleClusterDispatchOnce, handleClusterDispatchToggle, handleClusterSwarmCreate, handleClusterOrchestrationAssistRequest, handleClusterOrchestrationProposalApply, handleClusterOrchestrationProposalList, handleClusterOrchestrationProposalReject, handleClusterIdleNudgerToggle, handleClusterEfficiencySet, handleClusterSkillsSet, handleClusterAutoCompactionSet, handleClusterRemoteSet, handleClusterGatesSet, handleClusterMemberReorder, handleClusterProgressSet, handleClusterTaskBoardAttachSet, handleClusterTaskBoardModeSet, handleClusterMemberAdd, handleClusterMemberFocusSet, handleClusterMemberRemove, handleClusterMemberReplace, handleClusterMemberRoleSet, handleClusterMemberTierSet, handleClusterPlanAttach, handleClusterPlanClear, handleClusterPlanSet, handleClusterRename, handleClusterSnapshotSave, handleClusterSnapshotList, handleClusterSnapshotRestore, handleClusterSnapshotDelete, handleClusterSubscribe, handleOperatorPeerSend, dispatchTaskTurnSynthetic, broadcastTaskDispatchResult, initClusterHandlers, } from './ws/clusterHandlers.js';
74
75
  import { deriveAutoHandoff, derivePrimaryConfig, handleUserMessage, enqueueBusyReminder, initTurnEngine, maybeAutoCompactPolicy, claimBusy, releaseBusy, persistInitialMeta, writeCalibrationToMeta, broadcastQueueUpdate, drainQueueIfIdle } from './ws/turnEngine.js';
75
76
  import { handleBakeoffCleanup, handleBakeoffList, handleBakeoffPromote, handleBakeoffStart, initBakeoffHandlers, } from './ws/bakeoffHandlers.js';
76
77
  import { createBlankNativeWorkflow, handleAttachCodebaseMemory, handleCancel, handleCancelQueuedMessage, handleCancelResearch, handleCancelReview, handleClearPreviewPort, handleCreateLabelRequest, handleCreateWorkflow, handleDetachCodebaseMemory, handleDocEditRequest, handleMdTuneupRequest, handleMdTuneupAccept, handleMdTuneupUndo, handleMdTuneupCandidatesRequest, handleHandoffCancel, handleHandoffLockClear, handleLoadEarlierMessages, handleRemoveWorkflow, handleRenameWorkflow, handleRevertToCheckpoint, handleRevertToPointRequest, handleResearchRequest, handleRecallSummaryRequest, handleReviewRequest, handleSetPreviewPort, handleUpdatePrimaryConfig, initWorkflowHandlers, } from './ws/workflowHandlers.js';
@@ -424,6 +425,19 @@ const previewAutoDetect = new PreviewAutoDetect({
424
425
  });
425
426
  initTurnEngine({ previewAutoDetect, handleCreateWorkflow, handleHandoffRequest, handleCompactWorkflow });
426
427
  initWorkflowHandlers({ previewAutoDetect, handleRehydrateWorkflows });
428
+ initTranscriptWorkerHandlers({
429
+ create: async (ws, session, config) => {
430
+ let id;
431
+ await handleCreateWorkflow(ws, session, config, { backgroundCreated: true, onCreated: created => { id = created; } });
432
+ if (!id)
433
+ throw new Error('The new worker could not be created. Review its settings and try again.');
434
+ return id;
435
+ },
436
+ seed: (ws, session, workflowId, content) => {
437
+ void handleUserMessage(ws, session, workflowId, content, crypto.randomUUID(), undefined, false, undefined, undefined)
438
+ .catch(() => send(ws, { type: 'error', workflowId, message: 'Could not start the new worker. Open its tab to review the request and retry.' }));
439
+ },
440
+ });
427
441
  setStrataSwitchActivityCheck(() => [...workflows.values()].some((wf) => (wf.busy && ['ollama', 'llamacpp', 'lmstudio', 'deepseek'].includes(wf.primary.provider)) ||
428
442
  Object.values(wf.manager.snapshotWorkers()).some((w) => ['ollama', 'llamacpp', 'lmstudio', 'deepseek'].includes(w.provider ?? '') && (w.status === 'running' || w.status === 'spawning'))));
429
443
  setDeepSeekActivityCheck((includeDeepSeek) => [...workflows.values()].some((wf) => (wf.busy && ['ollama', 'llamacpp', 'lmstudio', 'strata', ...(includeDeepSeek ? ['deepseek'] : [])].includes(wf.primary.provider)) ||
@@ -532,6 +546,12 @@ wss.on('connection', (ws) => {
532
546
  return;
533
547
  }
534
548
  switch (msg.type) {
549
+ case 'transcript_worker_preview':
550
+ void handleTranscriptWorkerPreview(ws, msg);
551
+ break;
552
+ case 'transcript_worker_create':
553
+ void handleTranscriptWorkerCreate(ws, session, msg);
554
+ break;
535
555
  case 'create_workflow':
536
556
  (msg.config.incognito ? withoutOperationalLogging : (fn) => fn())(() => handleCreateWorkflow(ws, session, msg.config).catch((err) => {
537
557
  console.error('[arco] create_workflow handler failed:', err);
@@ -1121,6 +1141,9 @@ wss.on('connection', (ws) => {
1121
1141
  console.error('[arco] cluster_efficiency_set handler failed:', err);
1122
1142
  });
1123
1143
  break;
1144
+ case 'cluster_skills_set':
1145
+ void handleClusterSkillsSet(ws, msg.clusterId, msg.pins);
1146
+ break;
1124
1147
  case 'cluster_remote_set':
1125
1148
  handleClusterRemoteSet(ws, msg.clusterId, msg.enabled).catch((err) => {
1126
1149
  console.error('[arco] cluster_remote_set handler failed:', err);
@@ -0,0 +1,4 @@
1
+ export declare function jsonlLines(input: AsyncIterable<Buffer>, source: string, options?: {
2
+ finalLine?: boolean;
3
+ carriageReturns?: boolean;
4
+ }): AsyncGenerator<string>;
@@ -0,0 +1,53 @@
1
+ import { basename } from 'node:path';
2
+ const LARGE_RECORD_BYTES = 16 * 1024 * 1024;
3
+ const warnedSources = new Set();
4
+ // Retain only the current record's bytes. Decode once at its boundary so a
5
+ // split UTF-8 character is never replaced and a long record does not build a
6
+ // chain of decoded string fragments. Large records stay readable as before.
7
+ export async function* jsonlLines(input, source, options = {}) {
8
+ let parts = [];
9
+ let bytes = 0;
10
+ let afterCr = false;
11
+ const add = (part) => {
12
+ if (!part.length)
13
+ return;
14
+ parts.push(part);
15
+ bytes += part.length;
16
+ if (bytes > LARGE_RECORD_BYTES && !warnedSources.has(source)) {
17
+ warnedSources.add(source);
18
+ console.warn(`[arco] A record in ${basename(source)} exceeds 16 MiB; reading it in full.`);
19
+ }
20
+ };
21
+ const take = () => {
22
+ const line = parts.length === 1 ? parts[0].toString('utf8') : Buffer.concat(parts, bytes).toString('utf8');
23
+ parts = [];
24
+ bytes = 0;
25
+ return line;
26
+ };
27
+ for await (const chunk of input) {
28
+ let start = 0;
29
+ const hasCr = options.carriageReturns !== false && chunk.includes(0x0d);
30
+ while (start < chunk.length) {
31
+ if (afterCr) {
32
+ afterCr = false;
33
+ if (chunk[start] === 0x0a) {
34
+ start++;
35
+ continue;
36
+ }
37
+ }
38
+ const lf = chunk.indexOf(0x0a, start);
39
+ const cr = hasCr ? chunk.indexOf(0x0d, start) : -1;
40
+ const end = lf < 0 ? cr : cr < 0 ? lf : Math.min(lf, cr);
41
+ if (end < 0)
42
+ break;
43
+ add(chunk.subarray(start, end));
44
+ yield take();
45
+ afterCr = chunk[end] === 0x0d;
46
+ start = end + 1;
47
+ }
48
+ add(chunk.subarray(start));
49
+ }
50
+ if (bytes && options.finalLine !== false)
51
+ yield take();
52
+ }
53
+ //# sourceMappingURL=jsonlLines.js.map
@@ -58,6 +58,7 @@ function shortGitRevision(repoRoot) {
58
58
  return execFileSync('git', ['rev-parse', '--short', 'HEAD'], {
59
59
  cwd: repoRoot,
60
60
  encoding: 'utf8',
61
+ stdio: 'pipe',
61
62
  }).trim();
62
63
  }
63
64
  catch {
@@ -376,7 +376,7 @@ export function registerClusterTools(server, ctx) {
376
376
  }
377
377
  });
378
378
  registerTool('cluster_task_create', {
379
- description: 'Create a non-terminal task on the shared cluster board. New tasks start as todo; done/archived remain operator-only. Use title plus optional body/notes, assignee, priority, parentIds, links, reviewRequired, goalMode, and goalMaxTurns. parentIds must refer to existing tasks. When the task implements a plan item, start the title with that item\'s id or text (e.g. \'P6.9 Live tab drag follow on X11\'): cluster_task_show then resolves the item\'s reference docs (its own ref links, its sub-bullets, its phase intro) for whoever works it. Add any extra ref:slug links the task needs to notes.',
379
+ description: 'Create a non-terminal task on the shared cluster board. New tasks start as todo; terminal statuses cannot be set when creating a task. Use title plus optional body/notes, assignee, priority, parentIds, links, reviewRequired, goalMode, and goalMaxTurns. parentIds must refer to existing tasks. When the task implements a plan item, start the title with that item\'s id or text (e.g. \'P6.9 Live tab drag follow on X11\'): cluster_task_show then resolves the item\'s reference docs (its own ref links, its sub-bullets, its phase intro) for whoever works it. Add any extra ref:slug links the task needs to notes.',
380
380
  inputSchema: {
381
381
  title: z.string().min(1).describe('Task title. Required and non-empty.'),
382
382
  body: z.string().optional().describe('Initial task body. Alias for notes when notes is absent.'),
@@ -459,7 +459,7 @@ export function registerClusterTools(server, ctx) {
459
459
  }
460
460
  });
461
461
  registerTool('cluster_task_update', {
462
- description: "Update a task on the shared cluster board. Change its `status` (triage / todo / ready / in_progress / blocked / review), replace `notes`, and/or record a `signoff` verdict. IMPORTANT: `done` and `archived` are OPERATOR-ONLY — those statuses are REJECTED here (operator_gated). When you finish work, move the task to review or report completion via peer_send to the director; the operator marks done from the LEDGER tab.\n\nSIGN-OFF (director): when you review a peer's completed task, set `signoff` to your verdict — `met`, `not_met`, or `partial` — with a one-line `summary`. ADVISORY only: it does NOT mark the task done; it surfaces a recommendation on the board so the operator can accept at a glance. Only the reviewing member (the director) should set this.",
462
+ description: "Update a task on the shared cluster board. Workers move completed work to review. Only the director signs off: set signoff to met, partial, or not_met with a plain one-line summary for the operator, without commit hashes. A director's met sign-off closes the task unless Board auto-done is off in Settings; partial and not_met leave the task status unchanged unless you set a status. Tell the operator in chat what to try. Direct status changes to done or archived remain operator-only.",
463
463
  inputSchema: {
464
464
  id: z.string().min(1).describe('Task id from cluster_task_list.'),
465
465
  status: z.enum(['triage', 'todo', 'ready', 'in_progress', 'blocked', 'review']).optional().describe("New status. 'done' and 'archived' are rejected — operator-only."),
@@ -468,7 +468,7 @@ export function registerClusterTools(server, ctx) {
468
468
  signoff: z.object({
469
469
  state: z.enum(['met', 'not_met', 'partial']).describe('Your verdict: met / not_met / partial.'),
470
470
  summary: z.string().optional().describe('One-line reason shown on the board card.'),
471
- }).optional().describe('Advisory director verdict on whether the task met its target. Does NOT mark it done.'),
471
+ }).optional().describe('Director verdict: met closes the task unless Board auto-done is off.'),
472
472
  },
473
473
  }, async (args) => {
474
474
  try {
@@ -570,7 +570,7 @@ export function registerClusterTools(server, ctx) {
570
570
  }
571
571
  });
572
572
  registerTool('cluster_task_complete', {
573
- description: "Submit a completion report for a task. Moves the task to review and appends a durable COMPLETION REPORT comment. It does NOT mark done; done remains operator-only.",
573
+ description: "Submit a completion report for a task. Moves the task to review and appends a durable COMPLETION REPORT comment. It does not mark done; the director reviews the report.",
574
574
  inputSchema: {
575
575
  id: z.string().min(1).describe('Task id from cluster_task_list.'),
576
576
  summary: z.string().min(1).describe('What changed, tests run, files touched, and follow-ups.'),
@@ -50,6 +50,7 @@ export declare function runPrimaryTurn(ctx: TurnContext, args: {
50
50
  incognito?: boolean;
51
51
  drainSteer?: () => SteerItem[];
52
52
  peekSteer?: () => readonly SteerItem[];
53
+ pendingInput?: WorkerConfig['pendingInput'];
53
54
  requeueSteer?: (items: SteerItem[], bucket: 'steer' | 'follow-up') => void;
54
55
  onSteerDelivered?: (items: SteerItem[]) => void;
55
56
  codexTransport?: 'exec' | 'appserver';
@@ -129,7 +129,7 @@ function emitWorkerStuck(ctx, toolName, verdict) {
129
129
  }
130
130
  }
131
131
  export function runPrimaryTurn(ctx, args) {
132
- const { primary, prompt, resumeSessionId, attachments, disableRssGuard, appendSystemPrompt, systemPrompt, interactionMode, disableProviderHooks, chatWebAccess, voiceOperator, incognito, drainSteer, peekSteer, requeueSteer, onSteerDelivered, codexTransport, codexContextPolicy, providerAccountRef, codexHome, claudeTransport, ultracode, claudeNativeTaskDisabled, claudeNativeSubagent, claudeNativeCompact, claudeNativeInTurnCompactPercent, claudeNativeForceInterleavedThinkingBeta, claudeNativeThinkingDisplay, nativeSubagents, claudeNativePlanModeArmed, turnNotice, efficiencyToolFilter, efficiencyFactForce, efficiencyConfigProtection, efficiencySandbox, reviewSafeMode, outputStyle, goal, toolPosture, clusterId, clusterAccessMode, executionCwd, persistenceCwd, clusterTaskBoardAttached, clusterPlan, clusterRole, clusterEfficiencyDoctrine, clusterProgressDoctrine, clusterMcpConfigPath, codebaseMemoryAttached, codebaseMemoryIndexPath, mcpRegistryServers, mcpDisallowedTools, ollamaParams, webSearchMaxUses } = args;
132
+ const { primary, prompt, resumeSessionId, attachments, disableRssGuard, appendSystemPrompt, systemPrompt, interactionMode, disableProviderHooks, chatWebAccess, voiceOperator, incognito, drainSteer, peekSteer, pendingInput, requeueSteer, onSteerDelivered, codexTransport, codexContextPolicy, providerAccountRef, codexHome, claudeTransport, ultracode, claudeNativeTaskDisabled, claudeNativeSubagent, claudeNativeCompact, claudeNativeInTurnCompactPercent, claudeNativeForceInterleavedThinkingBeta, claudeNativeThinkingDisplay, nativeSubagents, claudeNativePlanModeArmed, turnNotice, efficiencyToolFilter, efficiencyFactForce, efficiencyConfigProtection, efficiencySandbox, reviewSafeMode, outputStyle, goal, toolPosture, clusterId, clusterAccessMode, executionCwd, persistenceCwd, clusterTaskBoardAttached, clusterPlan, clusterRole, clusterEfficiencyDoctrine, clusterProgressDoctrine, clusterMcpConfigPath, codebaseMemoryAttached, codebaseMemoryIndexPath, mcpRegistryServers, mcpDisallowedTools, ollamaParams, webSearchMaxUses } = args;
133
133
  const workerId = `primary-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`;
134
134
  // Claude: pre-mint on first turn so meta.json can pin it before the CLI
135
135
  // even starts. Codex mints its own; we'll learn it via the init event.
@@ -169,6 +169,7 @@ export function runPrimaryTurn(ctx, args) {
169
169
  disableRssGuard,
170
170
  drainSteer,
171
171
  peekSteer,
172
+ pendingInput,
172
173
  requeueSteer,
173
174
  onSteerDelivered,
174
175
  codexTransport,
@@ -76,6 +76,10 @@ export declare function applyUpdate(tasks: LedgerTask[], id: string, patch: {
76
76
  release?: string;
77
77
  worktree?: TaskWorktree | null;
78
78
  signoff?: TaskSignoff | null;
79
+ directorClosure?: {
80
+ byWorkflowId: string;
81
+ at: number;
82
+ };
79
83
  updatedBy?: string;
80
84
  }): {
81
85
  tasks: LedgerTask[];
@@ -14,10 +14,9 @@ import { ensureProjectStateIgnore } from '../projectStateIgnore.js';
14
14
  // need — is documented in docs/TASK_LEDGER.md, not assumed). The working set is
15
15
  // small + single-writer, so query() is load-all + filter-in-JS.
16
16
  //
17
- // LOAD-BEARING INVARIANT (§D1 acceptance): there is NO code path that sets
18
- // status: 'done' except an explicit operator-originated update (applyUpdate
19
- // below). create() never accepts a status; rebuildFromEvents only replays
20
- // recorded operator events; there is no auto-done / no inference anywhere.
17
+ // Direct terminal-status updates are operator-controlled. A director's met
18
+ // sign-off may close a task when Board auto-done is enabled; replay uses the
19
+ // recorded result and never infers a new status.
21
20
  import { promises as fs, existsSync } from 'fs';
22
21
  import path from 'path';
23
22
  import { randomUUID } from 'crypto';
@@ -711,6 +710,10 @@ patch) {
711
710
  else
712
711
  delete next.signoff;
713
712
  }
713
+ if (patch.directorClosure)
714
+ next.directorClosure = patch.directorClosure;
715
+ else if (patch.status && patch.status !== 'done')
716
+ delete next.directorClosure;
714
717
  const out = [...tasks];
715
718
  out[i] = next;
716
719
  return { tasks: out, updated: next };
@@ -1,5 +1,6 @@
1
1
  import type { ProviderName } from '@arco/shared';
2
2
  import type { WorkflowState } from './workflows/types.js';
3
+ export declare function reportHistoryLoadFailure(workflowId: string, owner: object, provider: 'native' | 'cli', emit?: (content: string) => void, nativeLimitBytes?: number): void;
3
4
  export declare function hasConversationHistory(cwd: string, workflowId: string, afterSeq?: number): Promise<boolean>;
4
5
  export declare function reportConversationSaveFailure(workflowId: string, err: unknown): void;
5
6
  export declare function ensureWorkflowMetadata(cwd: string, workflowId: string, wf: WorkflowState): Promise<void>;
@@ -2,6 +2,23 @@ import { resolveClaudeTransport } from './claudeTransport.js';
2
2
  import { readMeta, persistInitialMeta, reconcileLatestCliSession, workflowMetaSeed, updateMeta } from './workflowMeta.js';
3
3
  import { scanEventsOfTypes } from './workflowStore.js';
4
4
  import { broadcastWorkflow, broadcastTransient } from './server/broadcast.js';
5
+ const historyLoadNotices = new WeakMap();
6
+ export function reportHistoryLoadFailure(workflowId, owner, provider, emit, nativeLimitBytes) {
7
+ const shown = historyLoadNotices.get(owner) ?? new Set();
8
+ if (shown.has(provider))
9
+ return;
10
+ shown.add(provider);
11
+ historyLoadNotices.set(owner, shown);
12
+ const content = provider === 'native'
13
+ ? nativeLimitBytes !== undefined
14
+ ? `Earlier context could not be rebuilt within the ${nativeLimitBytes / (1024 * 1024)} MiB reconstruction limit, so the agent continues without it. Earlier messages remain in this tab.`
15
+ : 'Earlier context could not be rebuilt for this conversation, so the agent continues without it. Earlier messages remain in this tab.'
16
+ : 'Earlier Claude CLI session history could not be loaded in this tab. The saved conversation is intact; new session messages will appear when the file can be read.';
17
+ if (emit)
18
+ emit(content);
19
+ else
20
+ broadcastWorkflow(workflowId, { type: 'system_notice', workflowId, content });
21
+ }
5
22
  export async function hasConversationHistory(cwd, workflowId, afterSeq = 0) {
6
23
  let found = false;
7
24
  await scanEventsOfTypes(cwd, workflowId, ['primary_complete', 'primary_text'], event => { if ((('seq' in event && typeof event.seq === 'number') ? event.seq : 0) > afterSeq)
@@ -1,4 +1,11 @@
1
1
  import { type ServerCompactionBlock } from './serverFold.js';
2
+ export declare const NATIVE_RECONSTRUCTION_MAX_BYTES: number;
3
+ export declare class NativeReconstructionLimitError extends Error {
4
+ readonly rangeBytes: number;
5
+ readonly code = "NATIVE_RECONSTRUCTION_LIMIT";
6
+ readonly limitBytes: number;
7
+ constructor(rangeBytes: number);
8
+ }
2
9
  export declare const RESUME_EXACT_REPLAY_BYTES: number;
3
10
  export declare const RESUME_RECENT_TAIL_BYTES: number;
4
11
  export type ClaudeResumeMessage = {
@@ -57,10 +64,12 @@ export type ResumeReplayResult = {
57
64
  summaryThroughSeq?: number;
58
65
  summaryBytes?: number;
59
66
  tailEvents?: number;
67
+ summaryNotice?: string;
60
68
  reconstructed?: boolean;
61
69
  };
62
70
  type SummaryBuild = {
63
71
  summary: string;
72
+ summaryNotice?: string;
64
73
  throughSeq: number | null;
65
74
  lastHandoffSeq: number | null;
66
75
  };