arco-workbench 0.1.3 → 0.1.4

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 (296) hide show
  1. package/CONTRIBUTING.md +1 -1
  2. package/README.md +5 -1
  3. package/client/dist/assets/{PhosphorBackdrop-CkVIGkeX.js → PhosphorBackdrop-CNumba2X.js} +1 -1
  4. package/client/dist/assets/{ThemedBackgroundShaderImpl-DHF7CnpE.js → ThemedBackgroundShaderImpl-DX5KyCt3.js} +1 -1
  5. package/client/dist/assets/{XtermView-SY0UcZUS.js → XtermView-DhS5g8Rt.js} +1 -1
  6. package/client/dist/assets/{galleryEditor-Ca4F8HiM.js → galleryEditor-fPb76Cjv.js} +1 -1
  7. package/client/dist/assets/index-CjkHb-_n.js +592 -0
  8. package/client/dist/assets/index-DIbh3ae5.css +1 -0
  9. package/client/dist/index.html +2 -2
  10. package/client/src/App.tsx +2 -0
  11. package/client/src/alerts/desktopAlerts.ts +13 -1
  12. package/client/src/brief/briefFacts.ts +22 -0
  13. package/client/src/brief/briefFromStore.ts +7 -2
  14. package/client/src/components/ArtifactMoveDialog.tsx +64 -0
  15. package/client/src/components/BriefControl.tsx +38 -47
  16. package/client/src/components/CatchMeUp.tsx +25 -25
  17. package/client/src/components/CheckpointActions.tsx +7 -4
  18. package/client/src/components/ClusterComposerButtons.tsx +6 -3
  19. package/client/src/components/ClusterPlanTab.tsx +15 -1
  20. package/client/src/components/ClusterRightPanel/AutoPickupControl.tsx +6 -2
  21. package/client/src/components/ClusterTab.tsx +33 -3
  22. package/client/src/components/ClusterTaskBoardTab.tsx +62 -8
  23. package/client/src/components/DialogShell.tsx +115 -0
  24. package/client/src/components/DocsUpdateDialog.tsx +16 -42
  25. package/client/src/components/ForwardMessages.tsx +28 -32
  26. package/client/src/components/GitDialog.tsx +52 -52
  27. package/client/src/components/GitOtherWork.tsx +4 -2
  28. package/client/src/components/HandoffDialog.tsx +19 -45
  29. package/client/src/components/Home/HomeView.tsx +36 -8
  30. package/client/src/components/Home/home.css +7 -0
  31. package/client/src/components/KeepButton.tsx +23 -0
  32. package/client/src/components/MdTuneupDialog.tsx +52 -51
  33. package/client/src/components/MemberCard.tsx +4 -1
  34. package/client/src/components/MemberPane.tsx +1 -1
  35. package/client/src/components/NotificationCenter.tsx +4 -3
  36. package/client/src/components/NotificationChannelsSettings.tsx +25 -7
  37. package/client/src/components/PlanCandidateBanner.tsx +111 -57
  38. package/client/src/components/PlanComposerDialog.tsx +55 -87
  39. package/client/src/components/ProjectStateNotice.tsx +60 -0
  40. package/client/src/components/PublicProjectBox.tsx +25 -0
  41. package/client/src/components/ResearchDialog.tsx +15 -24
  42. package/client/src/components/ReviewDialog.tsx +32 -57
  43. package/client/src/components/RightPanel/OutputsPanel.tsx +4 -0
  44. package/client/src/components/RightPanel/PlanTab.tsx +24 -2
  45. package/client/src/components/RightPanel/UsageTab.tsx +77 -1
  46. package/client/src/components/SkillEditorDialog.tsx +38 -73
  47. package/client/src/components/SpawnDialog.tsx +19 -41
  48. package/client/src/components/StorageWarnings.tsx +21 -0
  49. package/client/src/components/SystemHeader.tsx +2 -2
  50. package/client/src/components/TerminalInput.tsx +6 -2
  51. package/client/src/components/TidyComposer.tsx +24 -41
  52. package/client/src/components/TranscriptSendDialog.tsx +151 -202
  53. package/client/src/components/UtilityAgentPicker.tsx +4 -2
  54. package/client/src/components/WorkflowCreator/index.tsx +2 -0
  55. package/client/src/components/WorkflowView.tsx +4 -1
  56. package/client/src/components/clusterNeedsYou.ts +35 -3
  57. package/client/src/components/compare/CompareDialog.tsx +26 -2
  58. package/client/src/components/terminalInput/planDraft.ts +33 -4
  59. package/client/src/components/utilityResult.ts +5 -1
  60. package/client/src/explorer/ExplorerApp.tsx +5 -2
  61. package/client/src/explorer/PlansLens.tsx +60 -19
  62. package/client/src/explorer/StorageLens.tsx +275 -0
  63. package/client/src/explorer/launch.ts +3 -3
  64. package/client/src/explorer/plansGrouping.ts +15 -0
  65. package/client/src/help/content/cluster.tsx +42 -7
  66. package/client/src/help/content/composer.tsx +26 -6
  67. package/client/src/help/content/header.tsx +16 -14
  68. package/client/src/help/content/misc.tsx +141 -6
  69. package/client/src/help/content/rightPanel.tsx +16 -0
  70. package/client/src/help/content/settings.tsx +4 -4
  71. package/client/src/help/manualSections/actions.tsx +19 -4
  72. package/client/src/help/manualSections/clusters.tsx +29 -16
  73. package/client/src/help/manualSections/configuration.tsx +6 -4
  74. package/client/src/help/manualSections/maintenance.tsx +27 -5
  75. package/client/src/help/manualSections/plans.tsx +96 -2
  76. package/client/src/help/manualSections/powerFeatures.tsx +2 -2
  77. package/client/src/help/manualSections/reference.tsx +6 -0
  78. package/client/src/help/manualSections/workspace.tsx +9 -5
  79. package/client/src/stores/appStore.ts +10 -1
  80. package/client/src/stores/appStore.types.ts +2 -0
  81. package/client/src/stores/mdTuneupStore.ts +5 -4
  82. package/client/src/stores/memoryTrim.ts +18 -2
  83. package/client/src/stores/storageWarningStore.ts +18 -0
  84. package/client/src/utils/gitDialogMemory.ts +26 -0
  85. package/client/src/utils/historyEvents.ts +1 -0
  86. package/client/src/utils/homeModel.ts +19 -0
  87. package/client/src/utils/publicProject.ts +56 -0
  88. package/client/src/ws/handleServerMessage.ts +7 -2
  89. package/docs/ARCHITECTURE.md +1 -1
  90. package/docs/CHECKPOINTS.md +2 -0
  91. package/docs/CLIENT.md +29 -11
  92. package/docs/FEATURES.md +14 -11
  93. package/docs/GETTING_STARTED.md +7 -7
  94. package/docs/GLOSSARY.md +3 -3
  95. package/docs/GOTCHAS.md +3 -2
  96. package/docs/HTTP_API.md +31 -1
  97. package/docs/NOTIFICATIONS.md +13 -14
  98. package/docs/OPERATIONS.md +27 -1
  99. package/docs/OPERATOR_ACTIONS.md +1 -1
  100. package/docs/OUTPUTS.md +9 -0
  101. package/docs/PERSISTENCE.md +34 -4
  102. package/docs/PLAN_OR_BOARD.md +7 -0
  103. package/docs/PRIMITIVES.md +3 -3
  104. package/docs/PROTOCOL.md +14 -4
  105. package/docs/PROTOCOL_CLUSTER.md +3 -2
  106. package/docs/SERVICE_MODE.md +5 -1
  107. package/docs/SETTINGS.md +8 -6
  108. package/docs/STORAGE_PLAN.md +324 -0
  109. package/docs/TASK_LEDGER.md +5 -4
  110. package/native/linux-arm64/manifest.json +1 -1
  111. package/node_modules/@arco/shared/dist/index.d.ts +2 -0
  112. package/node_modules/@arco/shared/dist/index.js +2 -0
  113. package/node_modules/@arco/shared/dist/protocol/autoPickup.d.ts +1 -1
  114. package/node_modules/@arco/shared/dist/protocol/autoPickup.js +1 -1
  115. package/node_modules/@arco/shared/dist/protocol/checkpoints.d.ts +1 -0
  116. package/node_modules/@arco/shared/dist/protocol/clusters.d.ts +2 -1
  117. package/node_modules/@arco/shared/dist/protocol/index.d.ts +1 -0
  118. package/node_modules/@arco/shared/dist/protocol/index.js +1 -0
  119. package/node_modules/@arco/shared/dist/protocol/mdTuneup.d.ts +6 -0
  120. package/node_modules/@arco/shared/dist/protocol/notifications.d.ts +2 -1
  121. package/node_modules/@arco/shared/dist/protocol/notifications.js +3 -2
  122. package/node_modules/@arco/shared/dist/protocol/plans.d.ts +2 -0
  123. package/node_modules/@arco/shared/dist/protocol/serverMessages.d.ts +2 -1
  124. package/node_modules/@arco/shared/dist/protocol/storage.d.ts +21 -0
  125. package/node_modules/@arco/shared/dist/protocol/storage.js +3 -0
  126. package/node_modules/@arco/shared/dist/protocol/tasks.d.ts +3 -0
  127. package/node_modules/@arco/shared/dist/protocol/utilityAgent.d.ts +2 -2
  128. package/node_modules/@arco/shared/dist/protocol/utilityAgent.js +2 -2
  129. package/node_modules/@arco/shared/dist/publicGuardrails.d.ts +7 -0
  130. package/node_modules/@arco/shared/dist/publicGuardrails.js +47 -0
  131. package/node_modules/@arco/shared/dist/publicSafetyRules.d.ts +1 -0
  132. package/node_modules/@arco/shared/dist/publicSafetyRules.js +6 -0
  133. package/node_modules/@arco/shared/package.json +1 -1
  134. package/package.json +3 -2
  135. package/scripts/packaging/arco.mjs +17 -1
  136. package/scripts/packaging/services.mjs +35 -5
  137. package/scripts/packaging/storage.mjs +125 -0
  138. package/scripts/packaging/update.mjs +3 -3
  139. package/server/dist/artifactCopy.d.ts +26 -0
  140. package/server/dist/artifactCopy.js +398 -0
  141. package/server/dist/atomicFile.d.ts +1 -0
  142. package/server/dist/atomicFile.js +1 -1
  143. package/server/dist/attention.d.ts +1 -1
  144. package/server/dist/attention.js +10 -13
  145. package/server/dist/catchUp.d.ts +2 -0
  146. package/server/dist/catchUp.js +46 -23
  147. package/server/dist/clusterPeerOps.d.ts +2 -0
  148. package/server/dist/clusterPeerOps.js +2 -0
  149. package/server/dist/clusterSnapshots.js +22 -12
  150. package/server/dist/eventLog.d.ts +55 -0
  151. package/server/dist/eventLog.js +792 -0
  152. package/server/dist/explorerLaunch.d.ts +4 -1
  153. package/server/dist/explorerLaunch.js +3 -2
  154. package/server/dist/explorerPlans.d.ts +4 -0
  155. package/server/dist/explorerPlans.js +27 -2
  156. package/server/dist/http/clusterRoutes.js +2 -0
  157. package/server/dist/http/explorerRoutes.js +2 -1
  158. package/server/dist/http/publicProjectRoutes.d.ts +2 -0
  159. package/server/dist/http/publicProjectRoutes.js +68 -0
  160. package/server/dist/http/router.js +6 -0
  161. package/server/dist/http/storageRoutes.d.ts +2 -0
  162. package/server/dist/http/storageRoutes.js +254 -0
  163. package/server/dist/http/usageStatsRoutes.js +3 -12
  164. package/server/dist/index.js +4 -0
  165. package/server/dist/keepStore.d.ts +16 -0
  166. package/server/dist/keepStore.js +119 -0
  167. package/server/dist/management/clusterActivity.js +6 -20
  168. package/server/dist/management/initHubLink.js +10 -43
  169. package/server/dist/mcp/clusterMcpTools.js +8 -1
  170. package/server/dist/notifications.d.ts +3 -1
  171. package/server/dist/notifications.js +5 -4
  172. package/server/dist/outputStore.d.ts +1 -0
  173. package/server/dist/outputStore.js +1 -1
  174. package/server/dist/outputs.js +39 -8
  175. package/server/dist/planHistory.d.ts +3 -0
  176. package/server/dist/planHistory.js +60 -0
  177. package/server/dist/primitives/runMdTuneup.d.ts +5 -1
  178. package/server/dist/primitives/runMdTuneup.js +43 -2
  179. package/server/dist/project/taskLedger.d.ts +4 -0
  180. package/server/dist/project/taskLedger.js +19 -0
  181. package/server/dist/providers/claude-native/peerTools.js +4 -0
  182. package/server/dist/providers/claude-native/resumeSummary.js +30 -19
  183. package/server/dist/providers/index.js +8 -13
  184. package/server/dist/providers/localProviderQueue.d.ts +2 -0
  185. package/server/dist/providers/localProviderQueue.js +11 -0
  186. package/server/dist/publicProject.d.ts +54 -0
  187. package/server/dist/publicProject.js +135 -0
  188. package/server/dist/recall/index.js +22 -23
  189. package/server/dist/server/broadcast.d.ts +2 -1
  190. package/server/dist/server/broadcast.js +56 -1
  191. package/server/dist/smartPickupAdapters.d.ts +7 -0
  192. package/server/dist/smartPickupAdapters.js +172 -8
  193. package/server/dist/storageActions.d.ts +50 -0
  194. package/server/dist/storageActions.js +326 -0
  195. package/server/dist/storageArchive.d.ts +24 -0
  196. package/server/dist/storageArchive.js +358 -0
  197. package/server/dist/storageOverview.d.ts +47 -0
  198. package/server/dist/storageOverview.js +197 -0
  199. package/server/dist/storageReport.d.ts +48 -0
  200. package/server/dist/storageReport.js +185 -0
  201. package/server/dist/storageWarnings.d.ts +4 -0
  202. package/server/dist/storageWarnings.js +96 -0
  203. package/server/dist/workers/limits.js +4 -1
  204. package/server/dist/workflowStore.d.ts +2 -0
  205. package/server/dist/workflowStore.js +88 -72
  206. package/server/dist/workflows/purgeWorkflow.d.ts +1 -0
  207. package/server/dist/workflows/purgeWorkflow.js +15 -2
  208. package/server/dist/workflows/sessionDiscovery.js +5 -17
  209. package/server/dist/workflows/sessionIndex.js +22 -17
  210. package/server/dist/ws/taskLedgerHandlers.js +8 -3
  211. package/server/dist/ws/workflowHandlers.js +5 -4
  212. package/server/package.json +1 -1
  213. package/server/src/artifactCopy.ts +254 -0
  214. package/server/src/atomicFile.ts +1 -1
  215. package/server/src/attention.ts +9 -10
  216. package/server/src/catchUp.ts +37 -15
  217. package/server/src/clusterPeerOps.ts +5 -0
  218. package/server/src/clusterSnapshots.ts +20 -13
  219. package/server/src/eventLog.ts +571 -0
  220. package/server/src/explorerLaunch.ts +3 -2
  221. package/server/src/explorerPlans.ts +22 -2
  222. package/server/src/http/clusterRoutes.ts +4 -1
  223. package/server/src/http/explorerRoutes.ts +2 -1
  224. package/server/src/http/publicProjectRoutes.ts +54 -0
  225. package/server/src/http/router.ts +4 -0
  226. package/server/src/http/storageRoutes.ts +187 -0
  227. package/server/src/http/usageStatsRoutes.ts +3 -11
  228. package/server/src/index.ts +4 -0
  229. package/server/src/keepStore.ts +102 -0
  230. package/server/src/management/clusterActivity.ts +6 -16
  231. package/server/src/management/initHubLink.ts +10 -39
  232. package/server/src/mcp/clusterMcpTools.ts +8 -2
  233. package/server/src/notifications.ts +4 -3
  234. package/server/src/outputStore.ts +5 -2
  235. package/server/src/outputs.ts +30 -6
  236. package/server/src/planHistory.ts +48 -0
  237. package/server/src/primitives/runMdTuneup.ts +32 -2
  238. package/server/src/project/taskLedger.ts +20 -0
  239. package/server/src/providers/claude-native/peerTools.ts +4 -0
  240. package/server/src/providers/claude-native/resumeSummary.ts +32 -18
  241. package/server/src/providers/index.ts +2 -16
  242. package/server/src/providers/localProviderQueue.ts +13 -0
  243. package/server/src/publicProject.ts +142 -0
  244. package/server/src/recall/index.ts +4 -9
  245. package/server/src/server/broadcast.ts +53 -1
  246. package/server/src/smartPickupAdapters.ts +128 -5
  247. package/server/src/storageActions.ts +216 -0
  248. package/server/src/storageArchive.ts +277 -0
  249. package/server/src/storageOverview.ts +184 -0
  250. package/server/src/storageReport.ts +210 -0
  251. package/server/src/storageWarnings.ts +84 -0
  252. package/server/src/workers/limits.ts +4 -1
  253. package/server/src/workflowStore.ts +78 -61
  254. package/server/src/workflows/purgeWorkflow.ts +12 -3
  255. package/server/src/workflows/sessionDiscovery.ts +5 -13
  256. package/server/src/workflows/sessionIndex.ts +5 -9
  257. package/server/src/ws/taskLedgerHandlers.ts +8 -3
  258. package/server/src/ws/workflowHandlers.ts +5 -4
  259. package/shared/dist/index.d.ts +2 -0
  260. package/shared/dist/index.js +2 -0
  261. package/shared/dist/protocol/autoPickup.d.ts +1 -1
  262. package/shared/dist/protocol/autoPickup.js +1 -1
  263. package/shared/dist/protocol/checkpoints.d.ts +1 -0
  264. package/shared/dist/protocol/clusters.d.ts +2 -1
  265. package/shared/dist/protocol/index.d.ts +1 -0
  266. package/shared/dist/protocol/index.js +1 -0
  267. package/shared/dist/protocol/mdTuneup.d.ts +6 -0
  268. package/shared/dist/protocol/notifications.d.ts +2 -1
  269. package/shared/dist/protocol/notifications.js +3 -2
  270. package/shared/dist/protocol/plans.d.ts +2 -0
  271. package/shared/dist/protocol/serverMessages.d.ts +2 -1
  272. package/shared/dist/protocol/storage.d.ts +21 -0
  273. package/shared/dist/protocol/storage.js +3 -0
  274. package/shared/dist/protocol/tasks.d.ts +3 -0
  275. package/shared/dist/protocol/utilityAgent.d.ts +2 -2
  276. package/shared/dist/protocol/utilityAgent.js +2 -2
  277. package/shared/dist/publicGuardrails.d.ts +7 -0
  278. package/shared/dist/publicGuardrails.js +47 -0
  279. package/shared/dist/publicSafetyRules.d.ts +1 -0
  280. package/shared/dist/publicSafetyRules.js +6 -0
  281. package/shared/src/index.ts +3 -0
  282. package/shared/src/protocol/autoPickup.ts +1 -1
  283. package/shared/src/protocol/checkpoints.ts +4 -0
  284. package/shared/src/protocol/clusters.ts +6 -1
  285. package/shared/src/protocol/index.ts +1 -0
  286. package/shared/src/protocol/mdTuneup.ts +5 -0
  287. package/shared/src/protocol/notifications.ts +6 -2
  288. package/shared/src/protocol/plans.ts +2 -0
  289. package/shared/src/protocol/serverMessages.ts +2 -0
  290. package/shared/src/protocol/storage.ts +35 -0
  291. package/shared/src/protocol/tasks.ts +6 -0
  292. package/shared/src/protocol/utilityAgent.ts +2 -2
  293. package/shared/src/publicGuardrails.ts +50 -0
  294. package/shared/src/publicSafetyRules.ts +5 -0
  295. package/client/dist/assets/index-CcNtMA2y.js +0 -546
  296. package/client/dist/assets/index-Dl8tYsSp.css +0 -1
@@ -6,7 +6,7 @@
6
6
  // events.jsonl — read-only, deterministic, capped. Tool calls are folded into
7
7
  // their turn's completion row (a count, not one row per call) so the feed
8
8
  // stays scannable on a phone.
9
- import { openSync, fstatSync, readSync, closeSync } from 'node:fs';
9
+ import { readLogTailSync } from '../eventLog.js';
10
10
  import { join } from 'node:path';
11
11
  const TAIL_BYTES = 256 * 1024; // per member
12
12
  const PREVIEW_CHARS = 160;
@@ -14,19 +14,13 @@ export const ACTIVITY_MAX_ROWS = 200; // merged cap (most recent kept)
14
14
  // Bounded tail read of one member's events.jsonl → activity rows. Best-effort:
15
15
  // unreadable/absent logs yield []. Exported for the unit test.
16
16
  export function readMemberActivity(cwd, wfid) {
17
- let fd;
18
17
  try {
19
- const path = join(cwd, '.arco', 'workflows', wfid, 'events.jsonl');
20
- fd = openSync(path, 'r');
21
- const size = fstatSync(fd).size;
22
- if (size === 0)
18
+ // Live tail, plus sealed segments when the live file is short (P7.3).
19
+ const tail = readLogTailSync(join(cwd, '.arco', 'workflows', wfid), TAIL_BYTES);
20
+ if (!tail.text)
23
21
  return [];
24
- const start = Math.max(0, size - TAIL_BYTES);
25
- const len = size - start;
26
- const buf = Buffer.allocUnsafe(len);
27
- readSync(fd, buf, 0, len, start);
28
- const lines = buf.toString('utf8').split('\n');
29
- if (start > 0)
22
+ const lines = tail.text.split('\n');
23
+ if (tail.truncated)
30
24
  lines.shift(); // drop the partial first line
31
25
  const rows = [];
32
26
  let toolCount = 0;
@@ -84,14 +78,6 @@ export function readMemberActivity(cwd, wfid) {
84
78
  catch {
85
79
  return [];
86
80
  }
87
- finally {
88
- if (fd !== undefined) {
89
- try {
90
- closeSync(fd);
91
- }
92
- catch { /* ignore */ }
93
- }
94
- }
95
81
  }
96
82
  // Merge every member's rows chronologically, keeping the most recent
97
83
  // ACTIVITY_MAX_ROWS. Pure so the unit test can drive it with canned rows.
@@ -7,7 +7,6 @@
7
7
  // registers to the hub as a 'service', pushes its workflow snapshot, and applies
8
8
  // routed reply/stop/continue actions — re-validating against current state.
9
9
  import { WebSocket } from 'ws';
10
- import { openSync, fstatSync, readSync, closeSync } from 'node:fs';
11
10
  import { join } from 'node:path';
12
11
  import { workflows, workflowCwds } from '../server/state.js';
13
12
  import { handleUserMessage } from '../ws/turnEngine.js';
@@ -31,6 +30,7 @@ import { mergeActivity, readMemberActivity } from './clusterActivity.js';
31
30
  import * as taskLedger from '../project/taskLedger.js';
32
31
  import { createHubLink } from './hubLink.js';
33
32
  import { buildServiceInstanceDescriptor } from './identity.js';
33
+ import { readLogTailSync } from '../eventLog.js';
34
34
  // Bounded read of the events.jsonl tail. Generous because ledger-snapshot
35
35
  // events (task_ledger_snapshot can be large + frequent) crowd the tail and push
36
36
  // the last assistant message back; 1MB covers a lot of that noise AND lets us
@@ -44,19 +44,13 @@ const MAX_MESSAGE_CHARS = 200_000;
44
44
  // tail. The assistant's words are `primary_text` events between the most recent
45
45
  // `primary_turn_started` and the turn end. Bounded + best-effort — never throws.
46
46
  function readLastMessage(cwd, wfid) {
47
- let fd;
48
47
  try {
49
- const path = join(cwd, '.arco', 'workflows', wfid, 'events.jsonl');
50
- fd = openSync(path, 'r');
51
- const size = fstatSync(fd).size;
52
- if (size === 0)
48
+ // Live tail, plus sealed segments when the live file is short (P7.3).
49
+ const tail = readLogTailSync(join(cwd, '.arco', 'workflows', wfid), TAIL_BYTES);
50
+ if (!tail.text)
53
51
  return undefined;
54
- const start = Math.max(0, size - TAIL_BYTES);
55
- const len = size - start;
56
- const buf = Buffer.allocUnsafe(len);
57
- readSync(fd, buf, 0, len, start);
58
- const lines = buf.toString('utf8').split('\n');
59
- if (start > 0)
52
+ const lines = tail.text.split('\n');
53
+ if (tail.truncated)
60
54
  lines.shift(); // drop the partial first line
61
55
  const chunks = [];
62
56
  let at = 0;
@@ -101,16 +95,6 @@ function readLastMessage(cwd, wfid) {
101
95
  catch {
102
96
  return undefined;
103
97
  }
104
- finally {
105
- if (fd !== undefined) {
106
- try {
107
- closeSync(fd);
108
- }
109
- catch {
110
- /* ignore */
111
- }
112
- }
113
- }
114
98
  }
115
99
  // R1 — context pressure for the phone's WHEN-to-compact/handoff judgment.
116
100
  // 2026-07-18 fix: PRIMARY source is the stashed context_usage numbers — the
@@ -478,19 +462,12 @@ function readFullTranscript(wfid) {
478
462
  const cwd = workflowCwds.get(wfid) ?? wf?.config.workingDirectory;
479
463
  if (!cwd)
480
464
  return { ...(title ? { title } : {}), turns: [] };
481
- let fd;
482
465
  try {
483
- const path = join(cwd, '.arco', 'workflows', wfid, 'events.jsonl');
484
- fd = openSync(path, 'r');
485
- const size = fstatSync(fd).size;
486
- if (size === 0)
466
+ const tail = readLogTailSync(join(cwd, '.arco', 'workflows', wfid), MAX_TRANSCRIPT_BYTES);
467
+ if (!tail.text)
487
468
  return { ...(title ? { title } : {}), turns: [] };
488
- const start = Math.max(0, size - MAX_TRANSCRIPT_BYTES);
489
- const len = size - start;
490
- const buf = Buffer.allocUnsafe(len);
491
- readSync(fd, buf, 0, len, start);
492
- const lines = buf.toString('utf8').split('\n');
493
- if (start > 0)
469
+ const lines = tail.text.split('\n');
470
+ if (tail.truncated)
494
471
  lines.shift();
495
472
  const turns = [];
496
473
  let asst = [];
@@ -533,16 +510,6 @@ function readFullTranscript(wfid) {
533
510
  catch {
534
511
  return { ...(title ? { title } : {}), turns: [] };
535
512
  }
536
- finally {
537
- if (fd !== undefined) {
538
- try {
539
- closeSync(fd);
540
- }
541
- catch {
542
- /* ignore */
543
- }
544
- }
545
- }
546
513
  }
547
514
  const LEDGER_STATUSES = [
548
515
  'triage', 'todo', 'ready', 'in_progress', 'blocked', 'review', 'done', 'archived',
@@ -121,6 +121,8 @@ export function registerClusterTools(server, ctx) {
121
121
  payload.goalMode = args.goalMode;
122
122
  if (typeof args.goalMaxTurns === 'number')
123
123
  payload.goalMaxTurns = args.goalMaxTurns;
124
+ if (typeof args.release === 'string')
125
+ payload.release = args.release;
124
126
  const r = await fetch(`${BASE_URL}/task-create`, {
125
127
  method: 'POST',
126
128
  headers: { 'Content-Type': 'application/json' },
@@ -148,6 +150,8 @@ export function registerClusterTools(server, ctx) {
148
150
  payload.status = args.status;
149
151
  if (typeof args.notes === 'string')
150
152
  payload.notes = args.notes;
153
+ if (typeof args.release === 'string')
154
+ payload.release = args.release;
151
155
  if (args.signoff && typeof args.signoff === 'object')
152
156
  payload.signoff = args.signoff;
153
157
  const r = await fetch(`${BASE_URL}/task-update`, {
@@ -389,6 +393,7 @@ export function registerClusterTools(server, ctx) {
389
393
  reviewRequired: z.boolean().optional(),
390
394
  goalMode: z.boolean().optional(),
391
395
  goalMaxTurns: z.number().optional(),
396
+ release: z.string().optional().describe('Optional release label such as 0.1.4.'),
392
397
  },
393
398
  }, async (args) => {
394
399
  try {
@@ -403,6 +408,7 @@ export function registerClusterTools(server, ctx) {
403
408
  reviewRequired: args.reviewRequired,
404
409
  goalMode: args.goalMode,
405
410
  goalMaxTurns: args.goalMaxTurns,
411
+ release: args.release,
406
412
  });
407
413
  if (!r.ok) {
408
414
  const detail = r.err.message ?? r.err.error ?? 'unknown_error';
@@ -459,6 +465,7 @@ export function registerClusterTools(server, ctx) {
459
465
  id: z.string().min(1).describe('Task id from cluster_task_list.'),
460
466
  status: z.enum(['triage', 'todo', 'ready', 'in_progress', 'blocked', 'review']).optional().describe("New status. 'done' and 'archived' are rejected — operator-only."),
461
467
  notes: z.string().optional().describe('Replacement notes body for the task.'),
468
+ release: z.string().optional().describe('Release label such as 0.1.4; an empty string clears it.'),
462
469
  signoff: z.object({
463
470
  state: z.enum(['met', 'not_met', 'partial']).describe('Your verdict: met / not_met / partial.'),
464
471
  summary: z.string().optional().describe('One-line reason shown on the board card.'),
@@ -466,7 +473,7 @@ export function registerClusterTools(server, ctx) {
466
473
  },
467
474
  }, async (args) => {
468
475
  try {
469
- const r = await callTaskUpdate({ id: args.id, status: args.status, notes: args.notes, signoff: args.signoff });
476
+ const r = await callTaskUpdate({ id: args.id, status: args.status, notes: args.notes, release: args.release, signoff: args.signoff });
470
477
  if (!r.ok) {
471
478
  const detail = r.err.message ?? r.err.error ?? 'unknown_error';
472
479
  return textResult(`[error] ${r.err.error ?? 'task_update_failed'}: ${detail}`, true);
@@ -17,8 +17,10 @@ export declare function setMutes(muted: WorkbenchNoticeCategory[]): void;
17
17
  */
18
18
  export declare function emit(n: Omit<WorkbenchNotice, 'id' | 'ts'> & {
19
19
  ts?: number;
20
+ }, options?: {
21
+ transportOnly?: boolean;
20
22
  }): WorkbenchNotice | null;
21
- /** Long-turn detection. Pair onTurnStarted / onTurnEnded around a primary turn. */
23
+ /** Keep long-turn events for legacy external transports, without a second BELL entry. */
22
24
  export declare function onTurnStarted(workflowId: string): void;
23
25
  export declare function onTurnEnded(workflowId: string, opts?: {
24
26
  provider?: ProviderName;
@@ -79,7 +79,7 @@ export function setMutes(muted) {
79
79
  * is muted (suppressed before it reaches any client). The id + ts are filled in
80
80
  * here so callers pass only the semantic fields.
81
81
  */
82
- export function emit(n) {
82
+ export function emit(n, options = {}) {
83
83
  if (mutedCategories.has(n.category))
84
84
  return null;
85
85
  const notice = {
@@ -87,7 +87,8 @@ export function emit(n) {
87
87
  id: `wn_${Date.now().toString(36)}_${(idCounter++).toString(36)}`,
88
88
  ts: n.ts ?? Date.now(),
89
89
  };
90
- broadcast?.({ type: 'workbench_notice', notice });
90
+ if (!options.transportOnly)
91
+ broadcast?.({ type: 'workbench_notice', notice });
91
92
  // Fan out to external transports AFTER the in-app broadcast and only for
92
93
  // non-muted notices (muted ones returned above). Fire-and-forget: a slow or
93
94
  // failing transport must never delay or break the in-app surface.
@@ -104,7 +105,7 @@ export function emit(n) {
104
105
  // ── Source helpers ─────────────────────────────────────────────────────────
105
106
  // Thin wrappers so callsites stay a one-liner and the category/severity/copy
106
107
  // conventions live in one place.
107
- /** Long-turn detection. Pair onTurnStarted / onTurnEnded around a primary turn. */
108
+ /** Keep long-turn events for legacy external transports, without a second BELL entry. */
108
109
  export function onTurnStarted(workflowId) {
109
110
  turnStarts.set(workflowId, Date.now());
110
111
  }
@@ -126,7 +127,7 @@ export function onTurnEnded(workflowId, opts) {
126
127
  body: `Ran ${dur}.`,
127
128
  workflowId,
128
129
  provider: opts?.provider,
129
- });
130
+ }, { transportOnly: true });
130
131
  }
131
132
  /** A throttled provider became available again. */
132
133
  export function notifyQuotaRecovered(provider) {
@@ -11,6 +11,7 @@ export interface StoredOutput extends Omit<WorkflowOutput, 'missing' | 'size'> {
11
11
  export interface OutputIndex {
12
12
  version: 1;
13
13
  offset: number;
14
+ seq?: number;
14
15
  entries: StoredOutput[];
15
16
  }
16
17
  export declare function outputDirectory(cwd: string, workflowId: string): Promise<string>;
@@ -24,7 +24,7 @@ export async function readOutputIndex(cwd, workflowId) {
24
24
  if (!st.isFile() || st.isSymbolicLink() || st.size > 8 * 1024 * 1024)
25
25
  throw new Error();
26
26
  const index = JSON.parse(await readFile(file, 'utf8'));
27
- if (index.version !== 1 || !Number.isSafeInteger(index.offset) || index.offset < 0 || !Array.isArray(index.entries) || index.entries.length > 2000
27
+ if (index.version !== 1 || !Number.isSafeInteger(index.offset) || index.offset < 0 || (index.seq !== undefined && (!Number.isSafeInteger(index.seq) || index.seq < 0)) || !Array.isArray(index.entries) || index.entries.length > 2000
28
28
  || index.entries.some(e => !e || !/^[a-f0-9]{32}$/.test(e.id) || e.workflowId !== workflowId || typeof e.title !== 'string'
29
29
  || typeof e.name !== 'string' || typeof e.cwd !== 'string' || typeof e.producer !== 'string' || typeof e.source !== 'string'
30
30
  || !['images', 'documents', 'audio', 'video', 'other'].includes(e.category) || !Number.isFinite(e.createdAt) || !Number.isFinite(e.updatedAt)
@@ -10,6 +10,7 @@ import { knownRoots, resolveBoundCwd } from './http/writeConfinement.js';
10
10
  import { workflows } from './server/state.js';
11
11
  import { matchFileEvent } from './recentFilesLedger.js';
12
12
  import { outputDirectory, readOutputIndex, writeOutputIndex, mappedOutputPath } from './outputStore.js';
13
+ import { readLogLines, sealedThroughSeq } from './eventLog.js';
13
14
  const LIMIT = 2000;
14
15
  const EXTENSIONS = {
15
16
  images: ['png', 'jpg', 'jpeg', 'webp', 'gif', 'bmp', 'svg', 'ico'],
@@ -220,6 +221,41 @@ async function reconcile(ctx, index) {
220
221
  }
221
222
  };
222
223
  await walk(root);
224
+ const handle = async (event, fallbackTime) => {
225
+ const timestamp = typeof event.ts === 'number' ? event.ts : fallbackTime;
226
+ for (const output of outputEventPaths(event, ctx.cwd, root)) {
227
+ if (output.path)
228
+ await record(output.path, output.title, output.source, timestamp, output.inputPath);
229
+ else if (output.inline && !index.entries.some(e => e.id === idFor(`inline:${output.key}`)) && index.entries.length < LIMIT)
230
+ index.entries.push({ ...ctx, id: idFor(`inline:${output.key}`), title: output.title || 'Inline artifact', name: output.title || 'Inline artifact', category: 'documents', createdAt: timestamp, updatedAt: timestamp, inline: output.inline, source: output.source });
231
+ }
232
+ };
233
+ const noteSeq = (event) => { if (typeof event.seq === 'number' && event.seq > (index.seq ?? 0))
234
+ index.seq = event.seq; };
235
+ // Records sealed into compressed segments since the last read (P7.3): read
236
+ // them by sequence number, then restart the live file from its beginning.
237
+ const sealedThrough = await sealedThroughSeq(dir);
238
+ if (sealedThrough > (index.seq ?? 0)) {
239
+ const after = index.seq ?? 0;
240
+ for await (const line of readLogLines(dir, { fromSeq: after })) {
241
+ if (Buffer.byteLength(line) > 2 * 1024 * 1024)
242
+ continue;
243
+ let event = null;
244
+ try {
245
+ event = JSON.parse(line);
246
+ }
247
+ catch { /* malformed event */ }
248
+ if (!event || typeof event.seq !== 'number' || event.seq <= after)
249
+ continue;
250
+ if (event.seq > sealedThrough)
251
+ break;
252
+ await handle(event, Date.now());
253
+ noteSeq(event);
254
+ }
255
+ index.seq = Math.max(index.seq ?? 0, sealedThrough);
256
+ index.offset = 0;
257
+ }
258
+ const skipThrough = index.seq ?? 0;
223
259
  const events = path.join(dir, 'events.jsonl');
224
260
  let info;
225
261
  try {
@@ -258,14 +294,9 @@ async function reconcile(ctx, index) {
258
294
  event = JSON.parse(Buffer.concat(pending).toString('utf8'));
259
295
  }
260
296
  catch { /* malformed event */ }
261
- if (event) {
262
- const timestamp = typeof event.ts === 'number' ? event.ts : info.mtimeMs;
263
- for (const output of outputEventPaths(event, ctx.cwd, root)) {
264
- if (output.path)
265
- await record(output.path, output.title, output.source, timestamp, output.inputPath);
266
- else if (output.inline && !index.entries.some(e => e.id === idFor(`inline:${output.key}`)) && index.entries.length < LIMIT)
267
- index.entries.push({ ...ctx, id: idFor(`inline:${output.key}`), title: output.title || 'Inline artifact', name: output.title || 'Inline artifact', category: 'documents', createdAt: timestamp, updatedAt: timestamp, inline: output.inline, source: output.source });
268
- }
297
+ if (event && !(typeof event.seq === 'number' && event.seq <= skipThrough)) {
298
+ await handle(event, info.mtimeMs);
299
+ noteSeq(event);
269
300
  }
270
301
  }
271
302
  consumed += lineBytes;
@@ -0,0 +1,3 @@
1
+ export declare function planHistoryDir(cwd: string): string;
2
+ export declare function planBodyHash(body: string): string;
3
+ export declare function rememberPlanBody(cwd: string, body: string): string | null;
@@ -0,0 +1,60 @@
1
+ import { createHash, randomUUID } from 'node:crypto';
2
+ import { closeSync, fsyncSync, lstatSync, mkdirSync, openSync, renameSync, unlinkSync, writeSync } from 'node:fs';
3
+ import path from 'node:path';
4
+ import { ensureProjectStateIgnore } from './projectStateIgnore.js';
5
+ // Content-addressed plan history (P7.2, docs/STORAGE_PLAN.md). Each distinct
6
+ // cluster plan body is written once to <cwd>/.arco/plans/.history/<sha256>.md
7
+ // so the per-member audit copy of `cluster_plan_changed` can carry the hash
8
+ // instead of the whole body. The folder sits inside plans/, which no cleanup,
9
+ // archive or delete ever touches. Plan listing reads index.json and the plans
10
+ // watcher only reacts to top-level <id>.md files, so history files never show
11
+ // up as plans.
12
+ export function planHistoryDir(cwd) {
13
+ return path.join(cwd, '.arco', 'plans', '.history');
14
+ }
15
+ export function planBodyHash(body) {
16
+ return createHash('sha256').update(body, 'utf8').digest('hex');
17
+ }
18
+ // Write the body once (temporary file, flush, rename) and return its hash.
19
+ // Returns null for an empty body (a cleared plan) or when the write fails;
20
+ // callers then keep the body in the logged event so nothing is lost.
21
+ export function rememberPlanBody(cwd, body) {
22
+ if (!cwd || !body)
23
+ return null;
24
+ const hash = planBodyHash(body);
25
+ const dir = planHistoryDir(cwd);
26
+ const file = path.join(dir, `${hash}.md`);
27
+ try {
28
+ const st = lstatSync(file);
29
+ if (st.isFile())
30
+ return hash;
31
+ return null;
32
+ }
33
+ catch (err) {
34
+ if (err.code !== 'ENOENT')
35
+ return null;
36
+ }
37
+ const tmp = path.join(dir, `.${hash}.${randomUUID()}.tmp`);
38
+ try {
39
+ ensureProjectStateIgnore(cwd);
40
+ mkdirSync(dir, { recursive: true });
41
+ const fd = openSync(tmp, 'wx', 0o600);
42
+ try {
43
+ writeSync(fd, body, null, 'utf8');
44
+ fsyncSync(fd);
45
+ }
46
+ finally {
47
+ closeSync(fd);
48
+ }
49
+ renameSync(tmp, file);
50
+ return hash;
51
+ }
52
+ catch {
53
+ try {
54
+ unlinkSync(tmp);
55
+ }
56
+ catch { /* not created */ }
57
+ return null;
58
+ }
59
+ }
60
+ //# sourceMappingURL=planHistory.js.map
@@ -1,7 +1,11 @@
1
1
  import type { FileHandle } from 'fs/promises';
2
2
  import { WorkerManager } from '../workers/WorkerManager.js';
3
- import { type ServerMessage, type ProviderName, type ModelName, type EffortLevel, type MdTuneupCandidate } from '@arco/shared';
3
+ import { type ServerMessage, type ProviderName, type ModelName, type EffortLevel, type MdTuneupCandidate, type MdTuneupSkippedLink } from '@arco/shared';
4
4
  export declare function instructionMetrics(text: string, bytes: number): Pick<MdTuneupCandidate, 'lines' | 'approximateTokens' | 'hints'>;
5
+ export declare function discoverInstructionFilesWithLinks(cwd: string): Promise<{
6
+ candidates: MdTuneupCandidate[];
7
+ skippedLinks: MdTuneupSkippedLink[];
8
+ }>;
5
9
  export declare function discoverInstructionFiles(cwd: string): Promise<MdTuneupCandidate[]>;
6
10
  export interface MdTuneupEditorConfig {
7
11
  provider: ProviderName;
@@ -71,8 +71,10 @@ async function candidateMetrics(abs, bytes) {
71
71
  // Discover recognized instruction files at the project root and in nested
72
72
  // folders. Results use project-relative paths and sort shallowest-first so
73
73
  // likely top-level guidance appears before files scoped to subdirectories.
74
- export async function discoverInstructionFiles(cwd) {
74
+ export async function discoverInstructionFilesWithLinks(cwd) {
75
75
  const found = [];
76
+ const links = [];
77
+ const root = await fs.realpath(cwd);
76
78
  const walk = async (dir, depth) => {
77
79
  if (depth > DISCOVERY_MAX_DEPTH)
78
80
  return;
@@ -89,6 +91,9 @@ export async function discoverInstructionFiles(cwd) {
89
91
  continue;
90
92
  await walk(path.join(dir, ent.name), depth + 1);
91
93
  }
94
+ else if (ent.isSymbolicLink() && INSTRUCTION_NAME_SET.has(ent.name)) {
95
+ links.push(path.join(dir, ent.name));
96
+ }
92
97
  else if (ent.isFile() && INSTRUCTION_NAME_SET.has(ent.name)) {
93
98
  const abs = path.join(dir, ent.name);
94
99
  let bytes = 0;
@@ -108,7 +113,43 @@ export async function discoverInstructionFiles(cwd) {
108
113
  const db = b.path.split(path.sep).length;
109
114
  return da !== db ? da - db : a.path.localeCompare(b.path);
110
115
  });
111
- return found;
116
+ const targets = new Map();
117
+ for (const candidate of found) {
118
+ const abs = path.join(cwd, candidate.path);
119
+ try {
120
+ const stat = await fs.lstat(abs), real = await fs.realpath(abs);
121
+ if (stat.isFile() && !stat.isSymbolicLink() && withinRoot(root, real))
122
+ targets.set(real, candidate);
123
+ }
124
+ catch { /* candidate disappeared during the scan */ }
125
+ }
126
+ const skippedLinks = [];
127
+ for (const link of links) {
128
+ const relative = path.relative(cwd, link);
129
+ try {
130
+ const real = await fs.realpath(link);
131
+ if (!withinRoot(root, real)) {
132
+ skippedLinks.push({ path: relative, reason: 'Target is outside this project.' });
133
+ continue;
134
+ }
135
+ const target = targets.get(real);
136
+ if (!target) {
137
+ skippedLinks.push({ path: relative, reason: 'Target is not a discovered instruction file.' });
138
+ continue;
139
+ }
140
+ (target.alsoReadAs ??= []).push(relative);
141
+ }
142
+ catch {
143
+ skippedLinks.push({ path: relative, reason: 'Target cannot be resolved.' });
144
+ }
145
+ }
146
+ for (const candidate of found)
147
+ candidate.alsoReadAs?.sort();
148
+ skippedLinks.sort((a, b) => a.path.localeCompare(b.path));
149
+ return { candidates: found, skippedLinks };
150
+ }
151
+ export async function discoverInstructionFiles(cwd) {
152
+ return (await discoverInstructionFilesWithLinks(cwd)).candidates;
112
153
  }
113
154
  // Read-only local tool sets — same posture as runDocEdit. The agent gets NO
114
155
  // Write/Edit/Bash; it may Read/Grep/Glob to confirm a referenced file still
@@ -6,6 +6,8 @@ interface TaskKernelState {
6
6
  comments: TaskComment[];
7
7
  runs: TaskRun[];
8
8
  }
9
+ export declare const RELEASE_MAX = 24;
10
+ export declare function sanitizeRelease(value: unknown): string;
9
11
  export declare function load(cwd: string, boardKey?: TaskBoardKey): Promise<LedgerTask[]>;
10
12
  export declare function save(cwd: string, tasks: LedgerTask[], boardKey?: TaskBoardKey): Promise<void>;
11
13
  export declare function loadKernel(cwd: string, boardKey?: TaskBoardKey): Promise<TaskKernelState>;
@@ -27,6 +29,7 @@ export declare function newTask(input: {
27
29
  goalMode?: boolean;
28
30
  goalMaxTurns?: number;
29
31
  worktreeRequired?: boolean;
32
+ release?: string;
30
33
  createdBy?: string;
31
34
  }): LedgerTask;
32
35
  export declare function newTaskComment(input: {
@@ -69,6 +72,7 @@ export declare function applyUpdate(tasks: LedgerTask[], id: string, patch: {
69
72
  goalMaxTurns?: number | null;
70
73
  assignee?: string;
71
74
  worktreeRequired?: boolean;
75
+ release?: string;
72
76
  worktree?: TaskWorktree | null;
73
77
  signoff?: TaskSignoff | null;
74
78
  updatedBy?: string;
@@ -131,6 +131,11 @@ function sanitizeParentIds(parentIds) {
131
131
  function sanitizePriority(priority) {
132
132
  return typeof priority === 'number' && Number.isFinite(priority) ? Math.trunc(priority) : 0;
133
133
  }
134
+ export const RELEASE_MAX = 24;
135
+ // Release label: one trimmed line, bounded. Empty means no label.
136
+ export function sanitizeRelease(value) {
137
+ return typeof value === 'string' ? value.replace(/\s+/g, ' ').trim().slice(0, RELEASE_MAX) : '';
138
+ }
134
139
  function sanitizeGoalMaxTurns(value) {
135
140
  return typeof value === 'number' && Number.isFinite(value) && value > 0
136
141
  ? { goalMaxTurns: Math.trunc(value) }
@@ -168,6 +173,11 @@ function normalizeTask(task) {
168
173
  ...sanitizeGoalMaxTurns(raw.goalMaxTurns),
169
174
  ...sanitizeAssignee(raw.assignee),
170
175
  };
176
+ const release = sanitizeRelease(raw.release);
177
+ if (release)
178
+ next.release = release;
179
+ else
180
+ delete next.release;
171
181
  if (!(typeof raw.assignee === 'string' && raw.assignee.trim().length > 0))
172
182
  delete next.assignee;
173
183
  if (!(typeof raw.goalMaxTurns === 'number' && Number.isFinite(raw.goalMaxTurns) && raw.goalMaxTurns > 0)) {
@@ -388,6 +398,7 @@ function toBoardRow(t) {
388
398
  ...(t.parentIds?.length ? { parentIds: t.parentIds } : {}),
389
399
  ...(t.links?.length ? { links: t.links } : {}),
390
400
  ...(t.reviewRequired ? { reviewRequired: true } : {}),
401
+ ...(t.release ? { release: t.release } : {}),
391
402
  ...(preview ? { notesPreview: preview } : {}),
392
403
  ...(notes.length > BOARD_NOTES_PREVIEW ? { notesLength: notes.length } : {}),
393
404
  createdAt: t.createdAt,
@@ -532,6 +543,7 @@ export function newTask(input) {
532
543
  goalMode: input.goalMode === true,
533
544
  worktreeRequired: input.worktreeRequired === true,
534
545
  ...sanitizeGoalMaxTurns(input.goalMaxTurns),
546
+ ...(sanitizeRelease(input.release) ? { release: sanitizeRelease(input.release) } : {}),
535
547
  ...(typeof input.createdBy === 'string' && input.createdBy.trim().length > 0
536
548
  ? { createdBy: input.createdBy.trim(), updatedBy: input.createdBy.trim() }
537
549
  : {}),
@@ -651,6 +663,13 @@ patch) {
651
663
  : {}),
652
664
  updatedAt: Date.now(),
653
665
  };
666
+ if (typeof patch.release === 'string') {
667
+ const label = sanitizeRelease(patch.release);
668
+ if (label)
669
+ next.release = label;
670
+ else
671
+ delete next.release;
672
+ }
654
673
  if (patch.goalMaxTurns !== undefined) {
655
674
  if (patch.goalMaxTurns === null)
656
675
  delete next.goalMaxTurns;
@@ -156,6 +156,7 @@ export function getPeerToolDefinitions(opts) {
156
156
  reviewRequired: { type: 'boolean' },
157
157
  goalMode: { type: 'boolean' },
158
158
  goalMaxTurns: { type: 'number' },
159
+ release: { type: 'string', description: 'Optional release label such as 0.1.4.' },
159
160
  },
160
161
  required: ['title'],
161
162
  },
@@ -180,6 +181,7 @@ export function getPeerToolDefinitions(opts) {
180
181
  id: { type: 'string', description: 'Task id from cluster_task_list.' },
181
182
  status: { type: 'string', enum: ['triage', 'todo', 'ready', 'in_progress', 'blocked', 'review'], description: "New status. 'done' and 'archived' are rejected — operator-only." },
182
183
  notes: { type: 'string', description: 'Replacement notes body for the task.' },
184
+ release: { type: 'string', description: 'Release label such as 0.1.4; an empty string clears it.' },
183
185
  signoff: {
184
186
  type: 'object',
185
187
  description: 'Advisory director verdict on whether the task met its target. Does NOT mark it done.',
@@ -386,6 +388,7 @@ export async function executePeerTool(name, args, ctx) {
386
388
  ...(typeof args.reviewRequired === 'boolean' ? { reviewRequired: args.reviewRequired } : {}),
387
389
  ...(typeof args.goalMode === 'boolean' ? { goalMode: args.goalMode } : {}),
388
390
  ...(typeof args.goalMaxTurns === 'number' ? { goalMaxTurns: args.goalMaxTurns } : {}),
391
+ ...(typeof args.release === 'string' ? { release: args.release } : {}),
389
392
  ...(typeof args.status === 'string' ? { status: args.status } : {}),
390
393
  }, bcastCluster);
391
394
  if (!result.ok)
@@ -462,6 +465,7 @@ export async function executePeerTool(name, args, ctx) {
462
465
  // non-status string falls through to applyUpdate's VALID_STATUS gate).
463
466
  ...(typeof args.status === 'string' ? { status: args.status } : {}),
464
467
  ...(typeof args.notes === 'string' ? { notes: args.notes } : {}),
468
+ ...(typeof args.release === 'string' ? { release: args.release } : {}),
465
469
  // §D3 — advisory sign-off; peerTaskUpdate validates state + stamps author.
466
470
  ...(args.signoff !== undefined ? { signoff: args.signoff } : {}),
467
471
  }, bcastCluster);