harnery 0.41.0 → 0.43.0

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 (269) hide show
  1. package/dist/commander.d.ts +16 -0
  2. package/dist/commander.d.ts.map +1 -1
  3. package/dist/commander.js +21 -0
  4. package/dist/commands/agents.d.ts.map +1 -1
  5. package/dist/commands/agents.js +63 -5
  6. package/dist/commands/artifacts.d.ts.map +1 -1
  7. package/dist/commands/artifacts.js +113 -12
  8. package/dist/commands/browse.d.ts +164 -0
  9. package/dist/commands/browse.d.ts.map +1 -1
  10. package/dist/commands/browse.js +263 -51
  11. package/dist/commands/claude-desktop.d.ts.map +1 -1
  12. package/dist/commands/claude-desktop.js +52 -0
  13. package/dist/commands/disk.d.ts +6 -0
  14. package/dist/commands/disk.d.ts.map +1 -0
  15. package/dist/commands/disk.js +80 -0
  16. package/dist/commands/doctor.d.ts +8 -0
  17. package/dist/commands/doctor.d.ts.map +1 -1
  18. package/dist/commands/doctor.js +48 -1
  19. package/dist/commands/files.d.ts +16 -0
  20. package/dist/commands/files.d.ts.map +1 -1
  21. package/dist/commands/files.js +54 -2
  22. package/dist/commands/init.d.ts +2 -2
  23. package/dist/commands/init.d.ts.map +1 -1
  24. package/dist/commands/init.js +43 -9
  25. package/dist/commands/rm.d.ts +4 -0
  26. package/dist/commands/rm.d.ts.map +1 -0
  27. package/dist/commands/rm.js +87 -0
  28. package/dist/commands/servers.d.ts +7 -0
  29. package/dist/commands/servers.d.ts.map +1 -0
  30. package/dist/commands/servers.js +394 -0
  31. package/dist/commands/tunnel.d.ts +65 -0
  32. package/dist/commands/tunnel.d.ts.map +1 -1
  33. package/dist/commands/tunnel.js +372 -103
  34. package/dist/commands/web-fetch.d.ts +3 -2
  35. package/dist/commands/web-fetch.d.ts.map +1 -1
  36. package/dist/commands/web-fetch.js +25 -19
  37. package/dist/commands/web.d.ts +7 -1
  38. package/dist/commands/web.d.ts.map +1 -1
  39. package/dist/commands/web.js +9 -3
  40. package/dist/core/adapters/profiles.d.ts +9 -0
  41. package/dist/core/adapters/profiles.d.ts.map +1 -1
  42. package/dist/core/adapters/profiles.js +22 -1
  43. package/dist/core/adapters/types.d.ts +9 -0
  44. package/dist/core/adapters/types.d.ts.map +1 -1
  45. package/dist/core/agents/cli.js +13 -6
  46. package/dist/core/agents/render/prompt-context.d.ts.map +1 -1
  47. package/dist/core/agents/render/prompt-context.js +11 -5
  48. package/dist/core/agents/render/session-context.d.ts.map +1 -1
  49. package/dist/core/agents/render/session-context.js +59 -13
  50. package/dist/core/agents/state/live-coordination-view.d.ts +20 -0
  51. package/dist/core/agents/state/live-coordination-view.d.ts.map +1 -1
  52. package/dist/core/agents/state/live-coordination-view.js +60 -0
  53. package/dist/core/agents/state/names.d.ts +43 -3
  54. package/dist/core/agents/state/names.d.ts.map +1 -1
  55. package/dist/core/agents/state/names.js +87 -3
  56. package/dist/core/artifacts/delivery-card.js +9 -2
  57. package/dist/core/artifacts/index.d.ts +140 -4
  58. package/dist/core/artifacts/index.d.ts.map +1 -1
  59. package/dist/core/artifacts/index.js +522 -49
  60. package/dist/core/config.d.ts +68 -11
  61. package/dist/core/config.d.ts.map +1 -1
  62. package/dist/core/config.js +128 -3
  63. package/dist/core/diagnostics/bundle.d.ts.map +1 -1
  64. package/dist/core/diagnostics/bundle.js +2 -2
  65. package/dist/core/events/v3/producers/recorder.d.ts.map +1 -1
  66. package/dist/core/events/v3/producers/recorder.js +16 -0
  67. package/dist/core/events/v3/projection.js +9 -1
  68. package/dist/core/events/v3/support-storage/pack-reader.d.ts.map +1 -1
  69. package/dist/core/events/v3/support-storage/pack-reader.js +42 -16
  70. package/dist/core/hooks/adapter/events.d.ts +17 -0
  71. package/dist/core/hooks/adapter/events.d.ts.map +1 -1
  72. package/dist/core/hooks/adapter/events.js +5 -0
  73. package/dist/core/hooks/adapter/runtime-telemetry.js +3 -1
  74. package/dist/core/hooks/adapter/wiring.d.ts +37 -7
  75. package/dist/core/hooks/adapter/wiring.d.ts.map +1 -1
  76. package/dist/core/hooks/adapter/wiring.js +62 -4
  77. package/dist/core/hooks/cli.js +131 -23
  78. package/dist/core/hooks/fork-lineage.d.ts +40 -0
  79. package/dist/core/hooks/fork-lineage.d.ts.map +1 -0
  80. package/dist/core/hooks/fork-lineage.js +62 -0
  81. package/dist/core/hooks/resolve/transcript.d.ts +16 -0
  82. package/dist/core/hooks/resolve/transcript.d.ts.map +1 -1
  83. package/dist/core/hooks/resolve/transcript.js +84 -0
  84. package/dist/core/hooks/run-markers.d.ts +37 -0
  85. package/dist/core/hooks/run-markers.d.ts.map +1 -0
  86. package/dist/core/hooks/run-markers.js +109 -0
  87. package/dist/core/hooks/shell-rm.d.ts +2 -0
  88. package/dist/core/hooks/shell-rm.d.ts.map +1 -0
  89. package/dist/core/hooks/shell-rm.js +105 -0
  90. package/dist/core/hooks/shell-tokens.d.ts +12 -0
  91. package/dist/core/hooks/shell-tokens.d.ts.map +1 -0
  92. package/dist/core/hooks/shell-tokens.js +97 -0
  93. package/dist/core/hooks/shell-waiter.d.ts.map +1 -1
  94. package/dist/core/hooks/shell-waiter.js +3 -93
  95. package/dist/core/semantic/contract.d.ts +5 -5
  96. package/dist/core/servers/index.d.ts +211 -0
  97. package/dist/core/servers/index.d.ts.map +1 -0
  98. package/dist/core/servers/index.js +560 -0
  99. package/dist/core/servers/net.d.ts +58 -0
  100. package/dist/core/servers/net.d.ts.map +1 -0
  101. package/dist/core/servers/net.js +270 -0
  102. package/dist/core/servers/tunnels.d.ts +14 -0
  103. package/dist/core/servers/tunnels.d.ts.map +1 -0
  104. package/dist/core/servers/tunnels.js +33 -0
  105. package/dist/core/storage/builtins.js +1 -0
  106. package/dist/core/storage/process-log.d.ts +12 -0
  107. package/dist/core/storage/process-log.d.ts.map +1 -1
  108. package/dist/core/storage/process-log.js +10 -2
  109. package/dist/core/workflow/engine.d.ts.map +1 -1
  110. package/dist/core/workflow/engine.js +30 -1
  111. package/dist/core/workflow/sandbox-projection.d.ts +13 -2
  112. package/dist/core/workflow/sandbox-projection.d.ts.map +1 -1
  113. package/dist/core/workflow/sandbox-projection.js +23 -0
  114. package/dist/core/workflow/spawn-claude.d.ts.map +1 -1
  115. package/dist/core/workflow/spawn-claude.js +6 -1
  116. package/dist/core/workflow/spawn-codex.d.ts +2 -0
  117. package/dist/core/workflow/spawn-codex.d.ts.map +1 -1
  118. package/dist/core/workflow/spawn-codex.js +20 -1
  119. package/dist/core/workflow/spawn-cursor.d.ts.map +1 -1
  120. package/dist/core/workflow/spawn-cursor.js +6 -1
  121. package/dist/core/workflow/spawn-opencode.d.ts.map +1 -1
  122. package/dist/core/workflow/spawn-opencode.js +4 -1
  123. package/dist/core/workflow/types.d.ts +47 -2
  124. package/dist/core/workflow/types.d.ts.map +1 -1
  125. package/dist/core/workflow/worker-access.d.ts +92 -0
  126. package/dist/core/workflow/worker-access.d.ts.map +1 -0
  127. package/dist/core/workflow/worker-access.js +450 -0
  128. package/dist/lib/browser/batch-steps.d.ts +18 -0
  129. package/dist/lib/browser/batch-steps.d.ts.map +1 -0
  130. package/dist/lib/browser/batch-steps.js +82 -0
  131. package/dist/lib/browser/collect/collector.d.ts +99 -0
  132. package/dist/lib/browser/collect/collector.d.ts.map +1 -0
  133. package/dist/lib/browser/collect/collector.js +202 -0
  134. package/dist/lib/browser/collect/fields.d.ts +31 -0
  135. package/dist/lib/browser/collect/fields.d.ts.map +1 -0
  136. package/dist/lib/browser/collect/fields.js +75 -0
  137. package/dist/lib/browser/collect/index.d.ts +6 -0
  138. package/dist/lib/browser/collect/index.d.ts.map +1 -0
  139. package/dist/lib/browser/collect/index.js +5 -0
  140. package/dist/lib/browser/collect/page-driver.d.ts +14 -0
  141. package/dist/lib/browser/collect/page-driver.d.ts.map +1 -0
  142. package/dist/lib/browser/collect/page-driver.js +306 -0
  143. package/dist/lib/browser/collect/presets.d.ts +52 -0
  144. package/dist/lib/browser/collect/presets.d.ts.map +1 -0
  145. package/dist/lib/browser/collect/presets.js +176 -0
  146. package/dist/lib/browser/collect/scroll-plan.d.ts +85 -0
  147. package/dist/lib/browser/collect/scroll-plan.d.ts.map +1 -0
  148. package/dist/lib/browser/collect/scroll-plan.js +118 -0
  149. package/dist/lib/browser/index.d.ts +1 -1
  150. package/dist/lib/browser/index.d.ts.map +1 -1
  151. package/dist/lib/browser/page-review-judge.d.ts +2 -0
  152. package/dist/lib/browser/page-review-judge.d.ts.map +1 -1
  153. package/dist/lib/browser/page-review-judge.js +13 -0
  154. package/dist/lib/browser/qa-run-contracts.d.ts +10 -0
  155. package/dist/lib/browser/qa-run-contracts.d.ts.map +1 -1
  156. package/dist/lib/browser/qa-run.d.ts.map +1 -1
  157. package/dist/lib/browser/qa-run.js +1 -0
  158. package/dist/lib/browser/windows-chrome.d.ts +59 -0
  159. package/dist/lib/browser/windows-chrome.d.ts.map +1 -0
  160. package/dist/lib/browser/windows-chrome.js +179 -0
  161. package/dist/lib/claude-desktop-share.d.ts +136 -0
  162. package/dist/lib/claude-desktop-share.d.ts.map +1 -0
  163. package/dist/lib/claude-desktop-share.js +394 -0
  164. package/dist/lib/disk-usage.d.ts +50 -0
  165. package/dist/lib/disk-usage.d.ts.map +1 -0
  166. package/dist/lib/disk-usage.js +303 -0
  167. package/dist/lib/docs-lint.d.ts +6 -0
  168. package/dist/lib/docs-lint.d.ts.map +1 -1
  169. package/dist/lib/docs-lint.js +8 -3
  170. package/dist/lib/guarded-remove.d.ts +34 -0
  171. package/dist/lib/guarded-remove.d.ts.map +1 -0
  172. package/dist/lib/guarded-remove.js +310 -0
  173. package/dist/lib/instructions/templates.js +8 -8
  174. package/dist/lib/tunnel/allowlist.d.ts +44 -0
  175. package/dist/lib/tunnel/allowlist.d.ts.map +1 -0
  176. package/dist/lib/tunnel/allowlist.js +204 -0
  177. package/dist/lib/tunnel/current-address.d.ts +41 -0
  178. package/dist/lib/tunnel/current-address.d.ts.map +1 -0
  179. package/dist/lib/tunnel/current-address.js +123 -0
  180. package/dist/lib/tunnel/error-page.d.ts +1 -1
  181. package/dist/lib/tunnel/error-page.d.ts.map +1 -1
  182. package/dist/lib/tunnel/error-page.js +19 -8
  183. package/dist/lib/tunnel/gate.js +33 -7
  184. package/dist/lib/tunnel/path-scope.d.ts +22 -0
  185. package/dist/lib/tunnel/path-scope.d.ts.map +1 -0
  186. package/dist/lib/tunnel/path-scope.js +62 -0
  187. package/dist/lib/tunnel/processes.d.ts +39 -0
  188. package/dist/lib/tunnel/processes.d.ts.map +1 -0
  189. package/dist/lib/tunnel/processes.js +121 -0
  190. package/dist/lib/tunnel/state.d.ts +33 -3
  191. package/dist/lib/tunnel/state.d.ts.map +1 -1
  192. package/dist/lib/tunnel/state.js +115 -30
  193. package/package.json +7 -1
  194. package/schemas/config.schema.json +91 -0
  195. package/src/commander.ts +51 -0
  196. package/src/commands/agents.ts +111 -11
  197. package/src/commands/artifacts.ts +171 -19
  198. package/src/commands/browse.ts +400 -57
  199. package/src/commands/claude-desktop.ts +61 -0
  200. package/src/commands/disk.ts +114 -0
  201. package/src/commands/doctor.ts +52 -1
  202. package/src/commands/files.ts +93 -2
  203. package/src/commands/init.ts +55 -5
  204. package/src/commands/rm.ts +115 -0
  205. package/src/commands/servers.ts +506 -0
  206. package/src/commands/tunnel.ts +494 -116
  207. package/src/commands/web-fetch.ts +30 -19
  208. package/src/commands/web.ts +9 -3
  209. package/src/core/adapters/profiles.ts +22 -1
  210. package/src/core/adapters/types.ts +10 -0
  211. package/src/core/agents/cli.ts +14 -6
  212. package/src/core/agents/render/prompt-context.ts +25 -8
  213. package/src/core/agents/render/session-context.ts +84 -16
  214. package/src/core/agents/state/live-coordination-view.ts +73 -0
  215. package/src/core/agents/state/names.ts +117 -6
  216. package/src/core/artifacts/delivery-card.ts +10 -2
  217. package/src/core/artifacts/index.ts +697 -44
  218. package/src/core/config.ts +183 -4
  219. package/src/core/diagnostics/bundle.ts +2 -1
  220. package/src/core/events/v3/producers/recorder.ts +16 -0
  221. package/src/core/events/v3/projection.ts +11 -1
  222. package/src/core/events/v3/support-storage/pack-reader.ts +45 -19
  223. package/src/core/hooks/adapter/events.ts +19 -0
  224. package/src/core/hooks/adapter/runtime-telemetry.ts +3 -1
  225. package/src/core/hooks/adapter/wiring.ts +116 -8
  226. package/src/core/hooks/cli.ts +152 -22
  227. package/src/core/hooks/fork-lineage.ts +82 -0
  228. package/src/core/hooks/resolve/transcript.ts +88 -0
  229. package/src/core/hooks/run-markers.ts +132 -0
  230. package/src/core/hooks/shell-rm.ts +103 -0
  231. package/src/core/hooks/shell-tokens.ts +96 -0
  232. package/src/core/hooks/shell-waiter.ts +4 -91
  233. package/src/core/servers/index.ts +712 -0
  234. package/src/core/servers/net.ts +283 -0
  235. package/src/core/servers/tunnels.ts +39 -0
  236. package/src/core/storage/builtins.ts +1 -0
  237. package/src/core/storage/process-log.ts +17 -2
  238. package/src/core/workflow/engine.ts +38 -1
  239. package/src/core/workflow/sandbox-projection.ts +38 -2
  240. package/src/core/workflow/spawn-claude.ts +5 -1
  241. package/src/core/workflow/spawn-codex.ts +18 -1
  242. package/src/core/workflow/spawn-cursor.ts +5 -1
  243. package/src/core/workflow/spawn-opencode.ts +4 -1
  244. package/src/core/workflow/types.ts +62 -2
  245. package/src/core/workflow/worker-access.ts +525 -0
  246. package/src/lib/browser/batch-steps.ts +79 -0
  247. package/src/lib/browser/collect/collector.ts +306 -0
  248. package/src/lib/browser/collect/fields.ts +87 -0
  249. package/src/lib/browser/collect/index.ts +47 -0
  250. package/src/lib/browser/collect/page-driver.ts +327 -0
  251. package/src/lib/browser/collect/presets.ts +237 -0
  252. package/src/lib/browser/collect/scroll-plan.ts +179 -0
  253. package/src/lib/browser/index.ts +1 -0
  254. package/src/lib/browser/page-review-judge.ts +16 -0
  255. package/src/lib/browser/qa-run-contracts.ts +11 -0
  256. package/src/lib/browser/qa-run.ts +1 -0
  257. package/src/lib/browser/windows-chrome.ts +227 -0
  258. package/src/lib/claude-desktop-share.ts +511 -0
  259. package/src/lib/disk-usage.ts +347 -0
  260. package/src/lib/docs-lint.ts +8 -3
  261. package/src/lib/guarded-remove.ts +376 -0
  262. package/src/lib/instructions/templates.ts +8 -8
  263. package/src/lib/tunnel/allowlist.ts +208 -0
  264. package/src/lib/tunnel/current-address.ts +158 -0
  265. package/src/lib/tunnel/error-page.ts +25 -9
  266. package/src/lib/tunnel/gate.ts +38 -9
  267. package/src/lib/tunnel/path-scope.ts +73 -0
  268. package/src/lib/tunnel/processes.ts +149 -0
  269. package/src/lib/tunnel/state.ts +143 -30
@@ -204,5 +204,21 @@ export interface HarneryLogStorageCommandOptions extends Pick<HarneryContextOpts
204
204
  commands?: readonly ("storage" | "logs")[];
205
205
  }
206
206
  export declare function registerHarneryLogStorageCommands(parent: Command, options?: HarneryLogStorageCommandOptions): Promise<Command>;
207
+ export interface HarneryTunnelCommandOptions {
208
+ emit?: EmitContext;
209
+ context?: HarneryProgramContext;
210
+ }
211
+ /**
212
+ * Mount `tunnel` under `parent`, for a host whose own program does not come
213
+ * from `createHarneryProgram` (a host CLI that exposes the tunnel as one of its
214
+ * command families).
215
+ */
216
+ export declare function registerHarneryTunnelCommand(parent: Command, options?: HarneryTunnelCommandOptions): Promise<Command>;
217
+ export type { RefreshCurrentOptions, RefreshCurrentResult } from "./commands/tunnel.js";
218
+ /**
219
+ * `tunnel allow add --current` as a function: allow this machine's public
220
+ * addresses and optionally reload running gates, keeping their URLs.
221
+ */
222
+ export declare function refreshTunnelCurrentAddress(options: import("./commands/tunnel.js").RefreshCurrentOptions): Promise<import("./commands/tunnel.js").RefreshCurrentResult>;
207
223
  export declare function createHarneryProgram(opts?: HarneryContextOpts): Command;
208
224
  //# sourceMappingURL=commander.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"commander.d.ts","sourceRoot":"","sources":["../src/commander.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,OAAO,EACL,KAAK,iBAAiB,E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AYlB;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,OAAO,CAAC,EAAE,qBAAqB,CAAC;CACjC;AAED;;;;GAIG;AACH,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,OAAO,EACf,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,OAAO,CAAC,CAIlB;AAED,YAAY,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAExF;;;GAGG;AACH,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,OAAO,sBAAsB,EAAE,qBAAqB,GAC5D,OAAO,CAAC,OAAO,sBAAsB,EAAE,oBAAoB,CAAC,CAG9D;AAED,wBAAgB,oBAAoB,CAAC,IAAI,GAAE,kBAAuB,GAAG,OAAO,CAiB3E"}
package/dist/commander.js CHANGED
@@ -67,6 +67,24 @@ export async function registerHarneryLogStorageCommands(parent, options = {}) {
67
67
  }
68
68
  return parent;
69
69
  }
70
+ /**
71
+ * Mount `tunnel` under `parent`, for a host whose own program does not come
72
+ * from `createHarneryProgram` (a host CLI that exposes the tunnel as one of its
73
+ * command families).
74
+ */
75
+ export async function registerHarneryTunnelCommand(parent, options = {}) {
76
+ const { registerTunnelCommand } = await import("./commands/tunnel.js");
77
+ registerTunnelCommand(parent, options.emit ?? defaultEmit, options.context);
78
+ return parent;
79
+ }
80
+ /**
81
+ * `tunnel allow add --current` as a function: allow this machine's public
82
+ * addresses and optionally reload running gates, keeping their URLs.
83
+ */
84
+ export async function refreshTunnelCurrentAddress(options) {
85
+ const { refreshCurrentAddress } = await import("./commands/tunnel.js");
86
+ return refreshCurrentAddress(options);
87
+ }
70
88
  export function createHarneryProgram(opts = {}) {
71
89
  const program = new Command();
72
90
  const emit = opts.emit ?? defaultEmit;
@@ -85,6 +103,7 @@ function lazy(command, description, load, options = {}) {
85
103
  }
86
104
  function harneryCommandBundles({ emit, context, binName, }) {
87
105
  return [
106
+ lazy("disk [path]", "Measure checkout disk usage, including nested repositories and ignored files", async (program) => (await import("./commands/disk.js")).registerDiskCommand(program, emit), { hasOptions: true }),
88
107
  lazy("tokens <files...>", "Count tokens in text/markdown files (offline, uses o200k_base as Claude proxy)", async (program) => (await import("./commands/tokens.js")).registerTokensCommand(program, emit), { hasOptions: true }),
89
108
  lazy("eml <file>", "Parse a Gmail .eml file into a clean chronological markdown thread", async (program) => (await import("./commands/eml.js")).registerEmlCommand(program, emit), { hasOptions: true }),
90
109
  lazy("env [section]", "Show environment status (runtimes, docker, git; hosts can add sections)", async (program) => (await import("./commands/env.js")).registerEnvCommand(program, emit, context)),
@@ -144,6 +163,7 @@ function harneryCommandBundles({ emit, context, binName, }) {
144
163
  lazy("supervisor", "Run Harnery's optional local diagnostic supervisor", async (program) => (await import("./commands/supervisor.js")).registerSupervisorCommand(program, emit, context)),
145
164
  lazy("diagnostics", "Inspect, capture, and replay bounded local diagnostic findings", async (program) => (await import("./commands/diagnostics.js")).registerDiagnosticsCommand(program, emit, context), { hasOptions: true }),
146
165
  lazy("storage", "Inspect registered Harnery storage without reading file bodies", async (program) => (await import("./commands/storage.js")).registerStorageCommand(program, emit, context)),
166
+ lazy("rm <paths...>", "Preview guarded removal of untracked files; --yes applies permanent deletion", async (program) => (await import("./commands/rm.js")).registerRmCommand(program, emit, context), { hasOptions: true }),
147
167
  lazy("logs", "List and query bounded Harnery log families", async (program) => (await import("./commands/logs.js")).registerLogsCommand(program, emit, context)),
148
168
  lazy("inbox", "Inspect private coordination inbox state", async (program) => (await import("./commands/inbox.js")).registerInboxCommand(program, emit, context?.coordinationInbox)),
149
169
  lazy("messages", "Queue a durable coordination message; dry-run unless --yes", async (program) => (await import("./commands/messages.js")).registerMessagesCommand(program, emit, context?.coordinationInbox), { hasOptions: true }),
@@ -161,6 +181,7 @@ function harneryCommandBundles({ emit, context, binName, }) {
161
181
  lazy("decision", "Decision docket: file a decision an agent would otherwise escalate, deliberate it, resolve with cited evidence, review async.", async (program) => (await import("./commands/decision.js")).registerDecisionCommand(program, emit), { aliases: ["decisions"] }),
162
182
  lazy("devtools", "Local status of the AI coding agents (Claude Code, Codex, Cursor)", async (program) => (await import("./commands/devtools.js")).registerDevtoolsCommand(program, emit), { hasOptions: true }),
163
183
  lazy("tunnel", "Provider-backed tunnel(s) in front of a local upstream (default upstream: 127.0.0.1:8001). Run several at once with --name <instance>.", async (program) => (await import("./commands/tunnel.js")).registerTunnelCommand(program, emit, context)),
184
+ lazy("servers", "Every local server started in this project: list, stop, clean up idle session servers, read logs", async (program) => (await import("./commands/servers.js")).registerServersCommand(program, emit, context)),
164
185
  lazy("docs", "Documentation tooling: freshness report, metadata, lint, sweep, index", async (program) => (await import("./commands/docs.js")).registerDocsCommand(program, emit, context), { hasOptions: true }),
165
186
  lazy("agents", "The live agent sessions in this project: who is running now, what they hold, and their coordination state (whoami / list / status / health).", async (program) => (await import("./commands/agents.js")).registerAgentsCommand(program, emit, context, binName)),
166
187
  lazy("council", "Multi-agent deliberation: convene a temporary group around an objective, run N rounds of contribution, emit a transcript.", async (program) => (await import("./commands/agents.js")).registerCouncilCommands(program)),
@@ -1 +1 @@
1
- {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/commands/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAcH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAS1E,OAAO,EAGL,qBAAqB,EAMtB,MAAM,yBAAyB,CAAC;AAejC,OAAO,EAKL,KAAK,4BAA4B,EAClC,MAAM,wCAAwC,CAAC;AAMhD,OAAO,EAGL,KAAK,SAAS,EAEf,MAAM,0CAA0C,CAAC;AAsBlD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AA8FjE;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG;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U,EAAE,CAQd;AA8KD,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,KAAK,EAAE,MAAM,CAAC;CACf;AAED,KAAK,qBAAqB,GAAG;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,KAAK,SAAa,EAClB,QAAQ,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,qBAAqB,EAA6B,EAC9E,gBAAgB,SAAwB,GACvC,wBAAwB,CA0C1B;AAED,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,mBAAmB,GAAG,WAAW,CAAC;AAEhF,wFAAwF;AACxF,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,CAAC,EACrD,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,GACjB,mBAAmB,GAAG,IAAI,CAO5B"}
@@ -27,7 +27,8 @@ import { listSessionFinalizationRequestsV3, observeHostDisappearedV3, reconcileS
27
27
  import { SESSION_NAME_DISPLAY_NOTE, sessionNameDisplayPending, } from "../core/agents/session-name-display.js";
28
28
  import { agentDisplayName } from "../core/agents/state/activity-log.js";
29
29
  import { buildLifecycleSuggestedName, buildSuggestedName, readHeartbeat as readHeartbeatCache, } from "../core/agents/state/heartbeat-writer.js";
30
- import { readLiveCoordinationRow, readLiveCoordinationRows, } from "../core/agents/state/live-coordination-view.js";
30
+ import { describeLiveAuthorityBlockV3, liveAuthorityBlockHintV3, liveAuthorityBlockV3, readLiveCoordinationRow, readLiveCoordinationRows, } from "../core/agents/state/live-coordination-view.js";
31
+ import { forkRelationLabels, resolveForkAncestry } from "../core/agents/state/names.js";
31
32
  import { foldSessionState, } from "../core/agents/state/session-state.js";
32
33
  import { turnChangesStatusRow } from "../core/agents/turn-changes.js";
33
34
  import { turnElapsedStatusRow } from "../core/agents/turn-elapsed.js";
@@ -35,6 +36,7 @@ import { coordFreshnessSeconds, resolveBinName, sessionFinalizationConfig, } fro
35
36
  import { EVENT_ADAPTER_IDS_V3, normalizeEventAdapterIdV3, } from "../core/events/v3/adapter-id.js";
36
37
  import { readEventV3ControlState } from "../core/events/v3/control.js";
37
38
  import { projectCoordinationViewV3, readCoordinationViewV3, } from "../core/events/v3/coordination-view.js";
39
+ import { nativeInstanceIdV3 } from "../core/events/v3/live-route-observer.js";
38
40
  import { liveInstanceIdV3 } from "../core/events/v3/live-routing.js";
39
41
  import { countSummarizedSinceV3, listDiagnosticSummariesV3, } from "../core/events/v3/producers/diagnostic-summaries.js";
40
42
  import { listHookIntakeGroupsV3, listHookIntakeRecordsV3, } from "../core/events/v3/producers/intake.js";
@@ -227,6 +229,7 @@ export function registerAgentsCommand(program, emitParam, programContext, binNam
227
229
  .description("Declare this session's task lifecycle: active, blocked, or done")
228
230
  .option("--reason <text>", "Explain the lifecycle declaration")
229
231
  .option("--session-id <id>", "Target the heartbeat with this session_id directly, bypassing the ppid walk.")
232
+ .option("--force-ancestor", "Allow a fork to change its fork ancestor's lifecycle (only on explicit operator instruction)")
230
233
  .action((state, opts) => {
231
234
  runLifecycle(state, opts);
232
235
  });
@@ -236,6 +239,7 @@ export function registerAgentsCommand(program, emitParam, programContext, binNam
236
239
  .option("--session-id <id>", "Native adapter session id to finalize")
237
240
  .option("--instance-id <id>", "Canonical V3 instance id to finalize")
238
241
  .option("--outcome <outcome>", "succeeded | failed | cancelled | timed_out | denied | interrupted | unknown", "succeeded")
242
+ .option("--force-ancestor", "Allow a fork to finalize its fork ancestor's session (only on explicit operator instruction)")
239
243
  .action((opts) => {
240
244
  runEndSession(opts);
241
245
  });
@@ -361,6 +365,30 @@ const SESSION_OUTCOMES = new Set([
361
365
  "interrupted",
362
366
  "unknown",
363
367
  ]);
368
+ /**
369
+ * Refuse when the calling session targets one of its recorded fork ancestors.
370
+ * A fork's transcript is full of its parent's name, task, and claims, so a
371
+ * fork that "cleans up its earlier self" is usually cutting off a live parent
372
+ * (2026-10-07: a fork offered to close its running parent). Returns the
373
+ * refusal message, or null when the call may proceed.
374
+ */
375
+ function forkAncestorRefusal(root, targetIds, force, action) {
376
+ if (force)
377
+ return null;
378
+ const ids = new Set(targetIds.filter((id) => !!id));
379
+ if (ids.size === 0)
380
+ return null;
381
+ const self = resolveOwner() ?? sessionIdentityFromEnv();
382
+ if (!self || ids.has(self))
383
+ return null;
384
+ const ancestor = resolveForkAncestry(root, self).find((a) => ids.has(a.instance_id));
385
+ if (!ancestor)
386
+ return null;
387
+ const label = ancestor.name ? `agent-${ancestor.name}` : ancestor.instance_id;
388
+ return (`${label} is this session's fork ancestor: this conversation was branched from it, so its ` +
389
+ `name, task, and files in your context are its own, and it may still be running. Refusing to ` +
390
+ `${action} it. Rerun with --force-ancestor only when the operator explicitly asked for that.`);
391
+ }
364
392
  function runEndSession(opts) {
365
393
  const root = monorepoRoot();
366
394
  if (!root)
@@ -386,6 +414,11 @@ function runEndSession(opts) {
386
414
  return failCommand("session_identity_missing", "live V3 generation disappeared");
387
415
  }
388
416
  const state = record.state;
417
+ if (opts.instanceId || opts.sessionId) {
418
+ const refusal = forkAncestorRefusal(root, [target, state.session_id, nativeInstanceIdV3(state.instance_id)], opts.forceAncestor, "finalize");
419
+ if (refusal)
420
+ return failCommand("session_is_fork_ancestor", refusal);
421
+ }
389
422
  if (state.delegations.length > 0) {
390
423
  return failCommand("session_work_open", `cannot finalize while ${state.delegations.length} delegated child(ren) remain open`);
391
424
  }
@@ -1003,6 +1036,10 @@ function normalizeKind(kind) {
1003
1036
  * command refuses in turn and the caller has no way to guess the path back.
1004
1037
  */
1005
1038
  function noLiveGenerationMessage(root, owner) {
1039
+ const block = liveAuthorityBlockV3(root, owner);
1040
+ if (block) {
1041
+ return `resolved owner=${owner}; ${describeLiveAuthorityBlockV3(block)}; ${liveAuthorityBlockHintV3(resolveBinName(root))}`;
1042
+ }
1006
1043
  return `resolved owner=${owner} but no authority-safe live V3 generation exists for it; ${lifecycleReopenHint(root)}`;
1007
1044
  }
1008
1045
  function lifecycleReopenHint(root) {
@@ -1468,6 +1505,14 @@ function runLifecycle(rawState, opts) {
1468
1505
  }
1469
1506
  if (!opts.sessionId)
1470
1507
  ensureAdapterSession(root);
1508
+ if (opts.sessionId) {
1509
+ const refusal = forkAncestorRefusal(root, [opts.sessionId], opts.forceAncestor, "change the lifecycle of");
1510
+ if (refusal) {
1511
+ emit.error({ code: "session_is_fork_ancestor", message: refusal });
1512
+ process.exitCode = 1;
1513
+ return;
1514
+ }
1515
+ }
1471
1516
  const myOwner = opts.sessionId ?? resolveOwner() ?? sessionIdentityFromEnv();
1472
1517
  if (!myOwner) {
1473
1518
  emit.error(sessionResolutionFailure(root, "not in an agent session; ppid walk found no pid-map entry (pass --session-id to bypass)"));
@@ -1786,8 +1831,16 @@ function runStatus(opts) {
1786
1831
  ? Math.max(0, Math.floor((Date.now() - startedAtMs) / 1000))
1787
1832
  : 0;
1788
1833
  const { livePeers, stale: peersStale } = collectStatusPeerHealth(root, myOwner);
1789
- // Sort: file-holders first (by file count desc), then idle peers by recency.
1834
+ // Recorded fork relations label the parent and forks so a fork cannot read
1835
+ // its live parent as its own earlier session; they sort first.
1836
+ const relations = forkRelationLabels(root, myOwner, new Set(livePeers.map((p) => p.instance_id)));
1837
+ // Sort: related sessions, then file-holders (by file count desc), then idle
1838
+ // peers by recency.
1790
1839
  livePeers.sort((a, b) => {
1840
+ const ar = relations.has(a.instance_id) ? 1 : 0;
1841
+ const br = relations.has(b.instance_id) ? 1 : 0;
1842
+ if (ar !== br)
1843
+ return br - ar;
1791
1844
  const af = a.files_touched?.length ?? 0;
1792
1845
  const bf = b.files_touched?.length ?? 0;
1793
1846
  if (af !== bf)
@@ -1798,7 +1851,7 @@ function runStatus(opts) {
1798
1851
  const filesStr = formatList(filesHeld.map((p) => basename(p)), 4, "0 held");
1799
1852
  // Cross-machine presence (ADR 0016): sessions on other machines, advisory.
1800
1853
  const remoteMachines = readRemoteMachines(root);
1801
- const peersStr = formatPeers(livePeers, 4, peersStale, remoteMachines);
1854
+ const peersStr = formatPeers(livePeers, 4, peersStale, remoteMachines, relations);
1802
1855
  const ctxUsage = readContextUsage(hb.native_session_id ?? hb.session_id, hb.platform);
1803
1856
  let ctxStr;
1804
1857
  if (!ctxUsage) {
@@ -1967,14 +2020,15 @@ function formatList(items, cap, emptyLabel) {
1967
2020
  const shown = items.slice(0, cap).join(", ");
1968
2021
  return `${shown}, +${items.length - cap} more`;
1969
2022
  }
1970
- function formatPeers(peers, cap, staleCount, remoteMachines = []) {
2023
+ function formatPeers(peers, cap, staleCount, remoteMachines = [], relations = new Map()) {
1971
2024
  if (peers.length === 0 && staleCount === 0 && remoteMachines.length === 0)
1972
2025
  return "none";
1973
2026
  const labels = peers.map((p) => {
1974
2027
  const name = p.name || "unnamed";
1975
2028
  const plat = formatPlatformLabel(p.platform);
1976
2029
  const files = p.files_touched?.length ?? 0;
1977
- const base = `${name} (${plat})`;
2030
+ const relation = relations.get(p.instance_id);
2031
+ const base = relation ? `${name} (${plat}, ${relation})` : `${name} (${plat})`;
1978
2032
  return files > 0 ? `${base}, ${files} files` : base;
1979
2033
  });
1980
2034
  let main;
@@ -4152,6 +4206,10 @@ function runHeal(opts) {
4152
4206
  });
4153
4207
  }
4154
4208
  if (proc.status !== 0) {
4209
+ const block = liveAuthorityBlockV3(root, owner);
4210
+ if (block) {
4211
+ emitHealFailure("authority_blocked", `${describeLiveAuthorityBlockV3(block)}; a cache rebuild cannot restore authority the ledger withholds; ${liveAuthorityBlockHintV3(resolveBinName(root))}`);
4212
+ }
4155
4213
  emitHealFailure(healFailureReason(root, owner, sessionId, healAdapter), spawnFailureMessage(proc, `agent-coord ${action}`));
4156
4214
  }
4157
4215
  // Read the derived cache to surface post-action state.
@@ -1 +1 @@
1
- {"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../src/commands/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAkC1E,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,IAAI,CAqSN"}
1
+ {"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../src/commands/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AA2C1E,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,IAAI,CAqYN"}
@@ -1,7 +1,7 @@
1
1
  import { monorepoRoot, resolveOwner } from "../core/agents/index.js";
2
2
  import { readLiveCoordinationRow } from "../core/agents/state/live-coordination-view.js";
3
- import { adoptUnmanagedArtifactFiles, artifactCapabilities, artifactReviewGuidance, artifactsRoot, autoCleanArtifacts, cleanArtifacts, createArtifact, discardArtifact, holdArtifact, inventoryArtifacts, migrateArtifacts, parseArtifactDeliverySpec, releaseArtifact, renderArtifactDeliveryCard, renewArtifact, repairArtifactActivity, resolveArtifactDeliveryManifest, showArtifact, unholdArtifact, writeArtifactDeliveryManifest, } from "../core/artifacts/index.js";
4
- import { artifactDefaultRetentionDays, coordFreshnessSeconds, reviewPackAutoCleanEnabled, } from "../core/config.js";
3
+ import { adoptUnmanagedArtifactFiles, allowBigArtifact, artifactCapabilities, artifactQuickUsage, artifactReviewGuidance, artifactsRoot, artifactUsageReport, assertArtifactDiskFloor, autoCleanArtifacts, cleanArtifacts, createArtifact, discardArtifact, holdArtifact, inventoryArtifacts, migrateArtifacts, parseArtifactDeliverySpec, readArtifactDeletions, releaseArtifact, removeArtifact, renderArtifactDeliveryCard, renewArtifact, repairArtifactActivity, resolveArtifactDeliveryManifest, showArtifact, unholdArtifact, writeArtifactDeliveryManifest, } from "../core/artifacts/index.js";
4
+ import { artifactDefaultRetentionDays, artifactIdleGraceHours, artifactMaxUnitBytes, coordFreshnessSeconds, resolveBinName, reviewPackAutoCleanEnabled, } from "../core/config.js";
5
5
  import { deleteExpiredPacks } from "../lib/browser/page-review-pack.js";
6
6
  export function registerArtifactsCommand(program, emit, context) {
7
7
  const root = program
@@ -15,8 +15,10 @@ export function registerArtifactsCommand(program, emit, context) {
15
15
  .option("--days <n>", "Retention in days (default from artifacts.default_retention_days)")
16
16
  .option("--minutes <n>", "Retention in minutes; cannot be combined with --days")
17
17
  .option("--big", "Acknowledge that this workspace may exceed the per-bundle size ceiling")
18
+ .option("--allow-low-disk", "Create a --big workspace even though free disk is below artifacts.min_free_bytes")
18
19
  .option("--hold <id>", "Create the workspace with this hold already present")
19
20
  .option("--hold-reason <text>", "Why the initial hold is required")
21
+ .option("--hold-persistent", "Make the initial hold persistent: it never lapses and counts toward the held budget. Only for a hold that mirrors an external lease, such as an open checkout with unsynchronized work")
20
22
  .option("--actor <instance-id>", "Stable owner identity for the initial hold")
21
23
  .action((slug, opts) => {
22
24
  run(emit, () => {
@@ -26,6 +28,8 @@ export function registerArtifactsCommand(program, emit, context) {
26
28
  const actor = opts.actor ? { instance_id: opts.actor } : currentActor(repoRoot);
27
29
  if (!!opts.hold !== !!opts.holdReason)
28
30
  throw new Error("--hold and --hold-reason must be used together");
31
+ if (opts.holdPersistent && !opts.hold)
32
+ throw new Error("--hold-persistent requires --hold");
29
33
  const retentionDays = opts.days
30
34
  ? parseDays(opts.days)
31
35
  : artifactDefaultRetentionDays(repoRoot);
@@ -36,6 +40,8 @@ export function registerArtifactsCommand(program, emit, context) {
36
40
  catch (error) {
37
41
  emit.log(`artifact cleanup skipped: ${error instanceof Error ? error.message : String(error)}`, "warn");
38
42
  }
43
+ if (opts.big && !opts.allowLowDisk)
44
+ assertArtifactDiskFloor(repoRoot);
39
45
  const created = createArtifact(repoRoot, {
40
46
  slug,
41
47
  purpose: opts.purpose,
@@ -43,7 +49,15 @@ export function registerArtifactsCommand(program, emit, context) {
43
49
  retentionMinutes,
44
50
  actor,
45
51
  big: opts.big,
46
- holds: opts.hold ? [{ id: opts.hold, reason: opts.holdReason }] : [],
52
+ holds: opts.hold
53
+ ? [
54
+ {
55
+ id: opts.hold,
56
+ reason: opts.holdReason,
57
+ ...(opts.holdPersistent ? { persistent: true } : {}),
58
+ },
59
+ ]
60
+ : [],
47
61
  });
48
62
  emit.data({
49
63
  path: created.path,
@@ -51,6 +65,13 @@ export function registerArtifactsCommand(program, emit, context) {
51
65
  expires_at: created.manifest.retention.expires_at,
52
66
  owner_instance_id: actor?.instance_id ?? null,
53
67
  holds: created.manifest.holds,
68
+ ...usageFields(emit, repoRoot),
69
+ ...(opts.big
70
+ ? {}
71
+ : {
72
+ size_ceiling_bytes: artifactMaxUnitBytes(repoRoot),
73
+ size_note: `Cleanup deletes this workspace before it expires if it grows past ${artifactMaxUnitBytes(repoRoot)} bytes on disk and then sits idle for ${artifactIdleGraceHours(repoRoot)}h. Create it with --big, or run ${resolveBinName(repoRoot)} artifacts allow-big later, if it will grow that large.`,
74
+ }),
54
75
  after_review: artifactReviewGuidance(repoRoot, created.manifest.artifact_id),
55
76
  });
56
77
  });
@@ -85,7 +106,14 @@ export function registerArtifactsCommand(program, emit, context) {
85
106
  const rows = inventoryArtifacts(repoRoot, {
86
107
  freshnessSeconds: coordFreshnessSeconds(repoRoot),
87
108
  });
88
- emit.data({ rows, meta: summarize(rows) });
109
+ const recentDeletions = readArtifactDeletions(repoRoot, {
110
+ since: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
111
+ });
112
+ emit.data({
113
+ rows,
114
+ meta: inventoryMeta(emit, repoRoot, rows),
115
+ recent_deletions: recentDeletions,
116
+ });
89
117
  });
90
118
  });
91
119
  root
@@ -94,9 +122,19 @@ export function registerArtifactsCommand(program, emit, context) {
94
122
  .action((ref) => {
95
123
  run(emit, () => {
96
124
  const repoRoot = requireRepoRoot(context);
97
- emit.data(showArtifact(repoRoot, ref, {
98
- freshnessSeconds: coordFreshnessSeconds(repoRoot),
99
- }));
125
+ try {
126
+ emit.data(showArtifact(repoRoot, ref, {
127
+ freshnessSeconds: coordFreshnessSeconds(repoRoot),
128
+ }));
129
+ }
130
+ catch (error) {
131
+ const deleted = readArtifactDeletions(repoRoot)
132
+ .reverse()
133
+ .find((record) => [record.artifact_id, record.name].includes(ref));
134
+ if (!deleted)
135
+ throw error;
136
+ throw new Error(`artifact "${ref}" was deleted by cleanup at ${deleted.deleted_at} as ${deleted.classification}: ${deleted.reason}`);
137
+ }
100
138
  });
101
139
  });
102
140
  root
@@ -151,6 +189,15 @@ export function registerArtifactsCommand(program, emit, context) {
151
189
  emit.data(manifest);
152
190
  });
153
191
  });
192
+ root
193
+ .command("allow-big <ref>")
194
+ .description("Exempt an existing workspace from the per-bundle size ceiling, as create --big would; expiry still applies.")
195
+ .action((ref) => {
196
+ run(emit, () => {
197
+ const repoRoot = requireRepoRoot(context);
198
+ emit.data(allowBigArtifact(repoRoot, ref, { actor: currentActor(repoRoot) }));
199
+ });
200
+ });
154
201
  root
155
202
  .command("release <ref>")
156
203
  .description("Release active-owner protection without shortening retention.")
@@ -179,6 +226,17 @@ export function registerArtifactsCommand(program, emit, context) {
179
226
  emit.data({ manifest, entry: showArtifact(repoRoot, ref).entry, deleted: false });
180
227
  });
181
228
  });
229
+ root
230
+ .command("remove <ref>")
231
+ .description("Preview immediate removal of one owned artifact; --yes permanently deletes it.")
232
+ .requiredOption("--reason <text>", "Why these reviewed files are no longer needed")
233
+ .option("--yes", "Permanently delete this one workspace after safety checks")
234
+ .action((ref, opts) => {
235
+ run(emit, () => {
236
+ const repoRoot = requireRepoRoot(context);
237
+ emit.data(removeArtifact(repoRoot, ref, opts.reason, { ...opts, actor: currentActor(repoRoot) }));
238
+ });
239
+ });
182
240
  root
183
241
  .command("capabilities")
184
242
  .description("Report artifact schema and hold capabilities for embedding clients.")
@@ -196,17 +254,28 @@ export function registerArtifactsCommand(program, emit, context) {
196
254
  .action((opts) => run(emit, () => emit.data({ rows: repairArtifactActivity(requireRepoRoot(context), opts) })));
197
255
  root
198
256
  .command("hold <ref>")
199
- .description("Protect an artifact from cleanup until its owner removes this exact hold.")
257
+ .description("Protect an artifact from cleanup until the hold lapses or its owner removes it; repeating the same id and reason renews it.")
200
258
  .requiredOption("--id <id>", "Unique hold id within this artifact")
201
259
  .requiredOption("--reason <text>", "Why cleanup must retain these files")
202
260
  .option("--actor <instance-id>", "Stable hold owner; defaults to the current agent")
261
+ .option("--days <n>", "Hold lifetime in days, 1 to 365 (default from artifacts.hold_days)")
262
+ .option("--minutes <n>", "Hold lifetime in minutes; cannot be combined with --days")
263
+ .option("--persistent", "Never lapse; counts toward the held budget. Only for a hold that mirrors an external lease, such as an open checkout with unsynchronized work")
203
264
  .action((ref, opts) => run(emit, () => {
204
265
  const repoRoot = requireRepoRoot(context);
205
- emit.data(holdArtifact(repoRoot, ref, {
266
+ if (opts.days !== undefined && opts.minutes !== undefined)
267
+ throw new Error("choose either --days or --minutes");
268
+ if (opts.persistent && (opts.days !== undefined || opts.minutes !== undefined))
269
+ throw new Error("--persistent cannot be combined with --days or --minutes");
270
+ const manifest = holdArtifact(repoRoot, ref, {
206
271
  id: opts.id,
207
272
  reason: opts.reason,
208
273
  actor: requireHoldActor(repoRoot, opts.actor),
209
- }));
274
+ ...(opts.days !== undefined ? { days: parseHoldDays(opts.days) } : {}),
275
+ ...(opts.minutes !== undefined ? { minutes: parseHoldMinutes(opts.minutes) } : {}),
276
+ ...(opts.persistent ? { persistent: true } : {}),
277
+ });
278
+ emit.data({ ...manifest, ...usageFields(emit, repoRoot) });
210
279
  }));
211
280
  root
212
281
  .command("unhold <ref>")
@@ -233,7 +302,7 @@ export function registerArtifactsCommand(program, emit, context) {
233
302
  : undefined;
234
303
  emit.data({
235
304
  rows,
236
- meta: summarize(rows),
305
+ meta: inventoryMeta(emit, repoRoot, rows),
237
306
  ...(reviewPacks ? { review_packs: reviewPacks } : {}),
238
307
  });
239
308
  });
@@ -275,6 +344,32 @@ function parseMinutes(value) {
275
344
  throw new Error("--minutes must be between 1 and 5256000");
276
345
  return parsed;
277
346
  }
347
+ function parseHoldDays(value) {
348
+ const parsed = Number(value);
349
+ if (!Number.isInteger(parsed) || parsed <= 0 || parsed > 365)
350
+ throw new Error("--days must be between 1 and 365 for a hold");
351
+ return parsed;
352
+ }
353
+ function parseHoldMinutes(value) {
354
+ const parsed = Number(value);
355
+ if (!Number.isInteger(parsed) || parsed < 1 || parsed > 525600)
356
+ throw new Error("--minutes must be between 1 and 525600 for a hold");
357
+ return parsed;
358
+ }
359
+ /** Cheap usage for create and hold: cached held bytes plus live free disk. */
360
+ function usageFields(emit, repoRoot) {
361
+ const quick = artifactQuickUsage(repoRoot);
362
+ for (const warning of quick.warnings)
363
+ emit.log(warning, "warn");
364
+ return { usage: quick.usage, warnings: quick.warnings };
365
+ }
366
+ /** Summary plus held budget and free disk for a full inventory; warnings also go to stderr. */
367
+ function inventoryMeta(emit, repoRoot, rows) {
368
+ const report = artifactUsageReport(repoRoot, rows);
369
+ for (const warning of report.warnings)
370
+ emit.log(warning, "warn");
371
+ return { ...summarize(rows), ...report };
372
+ }
278
373
  function collect(value, previous) {
279
374
  return [...previous, value];
280
375
  }
@@ -283,9 +378,15 @@ function summarize(rows) {
283
378
  for (const row of rows) {
284
379
  classifications[row.classification] = (classifications[row.classification] ?? 0) + 1;
285
380
  }
381
+ const bytes = rows.reduce((sum, row) => sum + (row.bytes ?? 0), 0);
286
382
  return {
287
383
  total: rows.length,
288
- bytes: rows.reduce((sum, row) => sum + (row.bytes ?? 0), 0),
384
+ // Disk use. `apparent_bytes` is the sum of file lengths; a large gap
385
+ // between the two means sparse or hard-linked files.
386
+ bytes,
387
+ apparent_bytes: rows.reduce((sum, row) => sum + (row.apparent_bytes ?? 0), 0),
388
+ // Rows carrying a per-row `warning`; `warnings` holds store-level sentences.
389
+ row_warnings: rows.filter((row) => row.warning).length,
289
390
  classifications,
290
391
  would_delete: rows.filter((row) => row.action === "would-delete").length,
291
392
  deleted: rows.filter((row) => row.action === "deleted").length,