@iowarp/clio-coder 0.3.7 → 0.3.8

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 (223) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +7 -2
  3. package/dist/{acp-SK4MD6MM.js → acp-U67UHUK2.js} +13 -13
  4. package/dist/{agents-2FN2K6ME.js → agents-YU6SGALZ.js} +35 -33
  5. package/dist/assets/codewiki.json +1 -1
  6. package/dist/{auth-QIYZWM5I.js → auth-5ZPJOIVG.js} +32 -24
  7. package/dist/builtins-C6JMZVV6.js +17 -0
  8. package/dist/{chunk-YD734TPH.js → chunk-26LEYJZH.js} +2 -2
  9. package/dist/{chunk-TSHXZTOQ.js → chunk-2HEJ2F35.js} +5 -5
  10. package/dist/{chunk-WJHBC77E.js → chunk-2HFZQUHL.js} +5 -5
  11. package/dist/{chunk-FO5ZOVUY.js → chunk-3BINW3FP.js} +5 -5
  12. package/dist/{chunk-EOOQZZDE.js → chunk-4SPRNWDE.js} +18 -18
  13. package/dist/{chunk-EBEFWSGL.js → chunk-5DHKRSMQ.js} +7 -7
  14. package/dist/{chunk-OBMAI2DP.js → chunk-5H3GB5BO.js} +11 -9
  15. package/dist/{chunk-JTSEDYVQ.js → chunk-5Q2VVUKB.js} +7 -7
  16. package/dist/{chunk-VQNODYQ4.js → chunk-7RFXX52T.js} +294 -3704
  17. package/dist/{chunk-XEGB6BCN.js → chunk-7RGZWPB6.js} +5 -5
  18. package/dist/{chunk-GH5622CP.js → chunk-A2NJGIB3.js} +2 -2
  19. package/dist/{chunk-CEYBNUGC.js → chunk-A3WNZD3P.js} +323 -27
  20. package/dist/{chunk-D4MDIG46.js → chunk-B5CSFE7B.js} +7 -7
  21. package/dist/{chunk-2SFS6XQE.js → chunk-DGSYXYMX.js} +3 -2
  22. package/dist/{chunk-ZWLZP4ZT.js → chunk-DYIM5TJT.js} +98 -12
  23. package/dist/{chunk-KCMKRQX4.js → chunk-E77JEWSD.js} +42 -49
  24. package/dist/{chunk-J7PIKKWC.js → chunk-EMYUUSFG.js} +7 -7
  25. package/dist/{chunk-JRIO5UD2.js → chunk-EQ63NRB7.js} +5 -5
  26. package/dist/{chunk-UVDSQ6LW.js → chunk-FBVTI2TJ.js} +74 -28
  27. package/dist/{chunk-BMWK7ZIZ.js → chunk-FHJEP5SW.js} +13 -13
  28. package/dist/{chunk-FOT2FX5J.js → chunk-GN57SG4G.js} +7 -7
  29. package/dist/{chunk-SROCI7ZU.js → chunk-GPIEI3LY.js} +5 -5
  30. package/dist/{chunk-UFQ3F4FW.js → chunk-GU2UIAFZ.js} +4 -4
  31. package/dist/{chunk-UND3GU2L.js → chunk-H7IXIC72.js} +2 -2
  32. package/dist/{chunk-VREKEFLL.js → chunk-HLE42MG7.js} +3 -3
  33. package/dist/{chunk-465YSENW.js → chunk-IFBNV6H6.js} +3 -3
  34. package/dist/{chunk-LADCF22A.js → chunk-IGWKHNIQ.js} +113 -54
  35. package/dist/chunk-IIZWH4XA.js +172 -0
  36. package/dist/{chunk-UHXRNZ2J.js → chunk-IJ7RPIYJ.js} +4 -4
  37. package/dist/{chunk-M4AKACEO.js → chunk-J3YUBZWY.js} +2 -2
  38. package/dist/{chunk-AB4XIIVB.js → chunk-JOZYP4GM.js} +6 -6
  39. package/dist/{chunk-ZGH7FGS5.js → chunk-K4XHGFR5.js} +742 -12
  40. package/dist/{chunk-EELBMBT6.js → chunk-KTYTFRMB.js} +62 -5
  41. package/dist/chunk-LU7P4LHA.js +33 -0
  42. package/dist/{chunk-DQA7QLMD.js → chunk-ME6CCNFO.js} +9 -24
  43. package/dist/{chunk-KZ2H5X4G.js → chunk-MXKJU4JB.js} +88 -14
  44. package/dist/{chunk-DMD2AGVS.js → chunk-N22QMJKY.js} +20 -18
  45. package/dist/chunk-NMPKI6XL.js +3006 -0
  46. package/dist/chunk-NUGM5KR6.js +165 -0
  47. package/dist/{chunk-5C77SEEY.js → chunk-P43ETTHK.js} +2 -2
  48. package/dist/{chunk-JNXPYBB4.js → chunk-PMDBGQSJ.js} +2 -2
  49. package/dist/chunk-PT7HYKEM.js +165 -0
  50. package/dist/{chunk-GEYXPTRF.js → chunk-RWSI4YD7.js} +2 -2
  51. package/dist/{chunk-C4JBQ5SR.js → chunk-TANS5ZJS.js} +6 -6
  52. package/dist/{chunk-YTYFXUI3.js → chunk-TB5666IT.js} +9 -9
  53. package/dist/{chunk-UUANF5CR.js → chunk-TLQJPP24.js} +375 -687
  54. package/dist/{chunk-OB5HIGJY.js → chunk-TT36MB5S.js} +2 -1
  55. package/dist/{chunk-DJNLUABN.js → chunk-TTHACPOM.js} +135 -17
  56. package/dist/{chunk-6M7VS3J3.js → chunk-TYPGUK6W.js} +4 -4
  57. package/dist/{chunk-THKY7CD7.js → chunk-U6MBIEMB.js} +108 -24
  58. package/dist/{chunk-PD3MESLB.js → chunk-VAWNZU7Z.js} +4 -4
  59. package/dist/{chunk-IR4CFBFN.js → chunk-VCBR6CU7.js} +12 -12
  60. package/dist/{chunk-WHJYKASB.js → chunk-VHN4MY6O.js} +2 -2
  61. package/dist/{chunk-MXI6J5JF.js → chunk-VWZOAB7K.js} +10 -10
  62. package/dist/{chunk-QCTRSGHQ.js → chunk-WLFILSD5.js} +36 -36
  63. package/dist/{chunk-5UJ6ECTS.js → chunk-WNIJTQQK.js} +6 -6
  64. package/dist/{chunk-4DWFMQDR.js → chunk-WSB3FPX7.js} +68 -20
  65. package/dist/{chunk-3HAPLH5M.js → chunk-WWCZ5F23.js} +112 -10
  66. package/dist/{chunk-X2KV5FXT.js → chunk-WXY7KU3G.js} +2 -2
  67. package/dist/{chunk-PPAMZ32Z.js → chunk-XK56QHLX.js} +6 -1
  68. package/dist/{chunk-DOOEX22V.js → chunk-XWSF374K.js} +4 -4
  69. package/dist/{chunk-6TUKSZVF.js → chunk-YS5VLNH5.js} +8 -8
  70. package/dist/{chunk-ZZMN5OM4.js → chunk-ZNLWCMVZ.js} +2 -2
  71. package/dist/{chunk-WHGPSPT5.js → chunk-ZVJ5BLO2.js} +2 -2
  72. package/dist/cli/index.js +31 -31
  73. package/dist/{clio-WBVQEBKO.js → clio-QVTYJ57A.js} +8 -8
  74. package/dist/code-nav-FGGFIE7L.js +2 -2
  75. package/dist/codewiki/build-worker.js +4 -4
  76. package/dist/{components-F7OEATSO.js → components-ZFA3SAER.js} +8 -8
  77. package/dist/{config-TRBL3RCF.js → config-LW5IJFQN.js} +58 -53
  78. package/dist/{configure-OLCVPHNM.js → configure-7XIZCOU4.js} +26 -21
  79. package/dist/{context-XEWE3MOJ.js → context-L3WL3X7K.js} +47 -41
  80. package/dist/{context-WFPKQSM6.js → context-N52ZA626.js} +22 -22
  81. package/dist/{context-MJIJ6GOX.js → context-Y6Y7QPR6.js} +12 -12
  82. package/dist/{context-clear-KNOS2JPB.js → context-clear-MBQRLSDQ.js} +47 -41
  83. package/dist/{context-index-SSR5ECNE.js → context-index-HVMFQHK3.js} +5 -5
  84. package/dist/{context-working-set-EUXAZI6N.js → context-working-set-GS6DSO7F.js} +14 -14
  85. package/dist/{dispatch-runner-B7MTOVKL.js → dispatch-runner-22ZCNOM3.js} +83 -55
  86. package/dist/{docs-FLJTIDSE.js → docs-7LQ23DLM.js} +8 -8
  87. package/dist/{doctor-RN4YKO2X.js → doctor-M7YEDGAE.js} +24 -20
  88. package/dist/{eval-RUBJVSNQ.js → eval-BEC2WHDA.js} +71 -19
  89. package/dist/{evidence-JZNBUOQZ.js → evidence-REJUMSKM.js} +62 -56
  90. package/dist/{evolve-FJVC4KKI.js → evolve-PY5ZBA5K.js} +41 -35
  91. package/dist/{extensions-IQL36S7K.js → extensions-HVKU65YU.js} +6 -6
  92. package/dist/{fleet-BDKYJFCP.js → fleet-7WZEWRFA.js} +72 -67
  93. package/dist/{fleet-commands-ZFIWZSB3.js → fleet-commands-UVHWM76J.js} +10 -10
  94. package/dist/{fleet-graph-Y6HPXIVF.js → fleet-graph-6ULH7PES.js} +13 -13
  95. package/dist/{fleet-preflight-BHSNPBMH.js → fleet-preflight-J53T6CCE.js} +5 -5
  96. package/dist/{fleet-validate-BIYREGIK.js → fleet-validate-72PC4SLA.js} +17 -17
  97. package/dist/{init-LQUB5COQ.js → init-OG3TPGQG.js} +61 -56
  98. package/dist/{library-NJAHIGG4.js → library-CNTMPLRF.js} +18 -18
  99. package/dist/{memory-OG6HOYKM.js → memory-6IS7F275.js} +43 -37
  100. package/dist/{models-5ZG5XY7J.js → models-ENRJDA5W.js} +33 -28
  101. package/dist/{monitor-TJ7AMTGB.js → monitor-XLDVO7TN.js} +56 -38
  102. package/dist/{orchestrator-WZYB54DM.js → orchestrator-6KSPYRHA.js} +421 -303
  103. package/dist/{paths-XUC7GS6E.js → paths-DBXMZMDU.js} +5 -5
  104. package/dist/registry-LG64LTF4.js +11 -0
  105. package/dist/{reset-PXQT45IY.js → reset-RZ4ER727.js} +10 -10
  106. package/dist/{run-FQ74YF62.js → run-Y2CNK5RU.js} +79 -74
  107. package/dist/{share-FW7SVCL3.js → share-A55GYP6Z.js} +16 -16
  108. package/dist/{skills-7E7IRB3R.js → skills-ALC5J6AT.js} +19 -19
  109. package/dist/{skills-eval-LI75W6OK.js → skills-eval-JPBEBYQU.js} +52 -47
  110. package/dist/support-MIETYA5E.js +38 -0
  111. package/dist/{targets-4CIFKCTW.js → targets-VGNXIR3S.js} +42 -33
  112. package/dist/{terminal-lease-WUZY7ZV5.js → terminal-lease-WOBR64YA.js} +3 -3
  113. package/dist/{uninstall-7FV7IP4E.js → uninstall-ZJF5H5ZN.js} +8 -8
  114. package/dist/{upgrade-K2HVIVMQ.js → upgrade-FUSUAGHR.js} +27 -25
  115. package/dist/{usage-GTZELZQX.js → usage-N4MKVHKD.js} +51 -46
  116. package/dist/{verifiers-RLAHT27O.js → verifiers-YAWOJ3H2.js} +13 -13
  117. package/dist/{verify-BX3BRKH5.js → verify-LTDHYBGY.js} +9 -9
  118. package/dist/{wiki-generate-ASIFASCN.js → wiki-generate-6M7GHTBJ.js} +66 -61
  119. package/dist/worker/entry.js +68 -61
  120. package/docs/alcf-provider.md +1 -1
  121. package/docs/architecture.md +1 -1
  122. package/docs/artifact-versions.md +6 -5
  123. package/docs/built-in-agents.md +1 -1
  124. package/docs/commands-and-modes.md +2 -2
  125. package/docs/configuration-and-targets.md +8 -3
  126. package/docs/context-engine.md +1 -1
  127. package/docs/documentation-guide.md +1 -1
  128. package/docs/eval-runner.md +1 -1
  129. package/docs/evals-internal.md +1 -1
  130. package/docs/evidence-and-memory.md +70 -6
  131. package/docs/evolution.md +1 -1
  132. package/docs/extensions-and-sharing.md +1 -1
  133. package/docs/fleet-dispatch.md +34 -9
  134. package/docs/glossary.md +21 -1
  135. package/docs/installation-and-lifecycle.md +1 -1
  136. package/docs/middleware-and-components.md +1 -1
  137. package/docs/model-catalog.md +1 -1
  138. package/docs/observability.md +2 -2
  139. package/docs/proactive-memory.md +1 -1
  140. package/docs/prompt-envelope-and-tools.md +4 -2
  141. package/docs/provider-adapter-cookbook.md +1 -1
  142. package/docs/release-cut-checklist.md +41 -38
  143. package/docs/safety-model.md +1 -1
  144. package/docs/scientific-validation.md +1 -1
  145. package/docs/skills-marketplace.md +1 -1
  146. package/docs/tool-usage.md +1 -1
  147. package/docs/trace-store.md +1 -1
  148. package/docs/tui-design.md +1 -1
  149. package/docs/worker-dispatch-mechanics.md +1 -1
  150. package/package.json +1 -2
  151. package/src/cli/argv.ts +5 -0
  152. package/src/cli/configure.ts +107 -23
  153. package/src/cli/doctor.ts +5 -1
  154. package/src/cli/evidence.ts +30 -25
  155. package/src/cli/fleet-preflight.ts +2 -12
  156. package/src/cli/shared.ts +1 -0
  157. package/src/cli/targets.ts +4 -1
  158. package/src/cli/validate-model.ts +60 -5
  159. package/src/core/bus-events.ts +25 -0
  160. package/src/core/commit-attribution.ts +4 -4
  161. package/src/core/path-boundary.ts +100 -0
  162. package/src/domains/agents/extension.ts +2 -11
  163. package/src/domains/agents/fleet-contract.ts +30 -12
  164. package/src/domains/agents/recipe.ts +7 -1
  165. package/src/domains/agents/registry.ts +73 -5
  166. package/src/domains/agents/result-contract.ts +128 -17
  167. package/src/domains/agents/write-boundary.ts +15 -50
  168. package/src/domains/context/project-rules.ts +51 -1
  169. package/src/domains/dispatch/assignment-reconcile.ts +22 -5
  170. package/src/domains/dispatch/assignment-store.ts +151 -14
  171. package/src/domains/dispatch/contract.ts +15 -1
  172. package/src/domains/dispatch/delegation-plan.ts +2 -5
  173. package/src/domains/dispatch/execution-role.ts +9 -1
  174. package/src/domains/dispatch/extension.ts +156 -67
  175. package/src/domains/dispatch/fleet-run.ts +57 -3
  176. package/src/domains/dispatch/gate-role-prompts.ts +38 -0
  177. package/src/domains/dispatch/index.ts +3 -1
  178. package/src/domains/dispatch/intent-requirements.ts +40 -0
  179. package/src/domains/dispatch/intent.ts +84 -8
  180. package/src/domains/dispatch/path-scope.ts +370 -0
  181. package/src/domains/dispatch/receipt-integrity.ts +2 -1
  182. package/src/domains/dispatch/types.ts +14 -7
  183. package/src/domains/dispatch/validation.ts +6 -3
  184. package/src/domains/dispatch/write-boundary-enforcer.ts +45 -0
  185. package/src/domains/dispatch/write-boundary.ts +201 -22
  186. package/src/domains/eval/metrics/evidence.ts +79 -2
  187. package/src/domains/eval/runners/clio-run.ts +12 -2
  188. package/src/domains/evidence/build.ts +69 -11
  189. package/src/domains/evidence/index.ts +21 -0
  190. package/src/domains/evidence/provenance.ts +46 -11
  191. package/src/domains/evidence/trust-projection.ts +274 -0
  192. package/src/domains/evidence/trust-status.ts +145 -17
  193. package/src/domains/evidence/types.ts +4 -0
  194. package/src/domains/extensions/discovery.ts +88 -1
  195. package/src/domains/extensions/resources.ts +20 -8
  196. package/src/domains/extensions/state.ts +6 -2
  197. package/src/domains/extensions/types.ts +4 -1
  198. package/src/domains/lifecycle/doctor.ts +140 -1
  199. package/src/domains/prompts/contract.ts +3 -5
  200. package/src/domains/providers/extension.ts +30 -2
  201. package/src/domains/resources/common-loader.ts +3 -0
  202. package/src/domains/resources/prompts/loader.ts +119 -14
  203. package/src/domains/safety/policy-engine.ts +5 -5
  204. package/src/domains/safety/run-effects.ts +64 -1
  205. package/src/domains/safety/scope.ts +7 -12
  206. package/src/engine/acp/server.ts +4 -1
  207. package/src/engine/prompt-templates.ts +18 -1
  208. package/src/engine/worker-runtime.ts +6 -3
  209. package/src/interactive/dispatch-board.ts +53 -3
  210. package/src/interactive/interactive-event-projection.ts +14 -0
  211. package/src/interactive/overlays/settings.ts +141 -47
  212. package/src/interactive/slash-commands.ts +7 -2
  213. package/src/interactive/view/artifacts.ts +42 -9
  214. package/src/interactive/view/view-overlay.ts +15 -3
  215. package/src/interactive/worker-receipts.ts +14 -2
  216. package/src/interactive/worker-stream.ts +8 -0
  217. package/src/tools/dispatch-admission.ts +12 -13
  218. package/src/tools/dispatch-arguments.ts +27 -0
  219. package/src/tools/dispatch-plan.ts +29 -0
  220. package/src/tools/dispatch-runner.ts +48 -13
  221. package/src/tools/monitor.ts +13 -0
  222. package/src/tools/worker-evidence.ts +19 -13
  223. package/src/worker/spec-contract.ts +2 -1
@@ -7,18 +7,22 @@ import {
7
7
  cloneDispatchBudgetRequest,
8
8
  isApprovedAssignmentRoute,
9
9
  isDispatchIntent,
10
- isToolProfileName
11
- } from "./chunk-CEYBNUGC.js";
10
+ isToolProfileName,
11
+ resolveDispatchPathScope
12
+ } from "./chunk-A3WNZD3P.js";
12
13
  import {
13
14
  ROUTE_POLICY_VERSION,
14
15
  isRouteDecisionAgentSelection,
15
16
  isRoutingIntent,
16
17
  parseRoutingIntent
17
- } from "./chunk-5C77SEEY.js";
18
+ } from "./chunk-P43ETTHK.js";
18
19
  import {
19
20
  isExecutionRole,
20
21
  requestExecutionRole
21
- } from "./chunk-UND3GU2L.js";
22
+ } from "./chunk-H7IXIC72.js";
23
+ import {
24
+ pathBoundaryCovers
25
+ } from "./chunk-TTHACPOM.js";
22
26
  import {
23
27
  AGENT_AUTOMATION_AUTHORITIES
24
28
  } from "./chunk-AOCYTWAV.js";
@@ -217,8 +221,34 @@ function dispatchRequestsFromArgs(args, options) {
217
221
  for (let index = 0; index < tasks.length; index += 1) {
218
222
  const item = tasks[index];
219
223
  const itemArgs = isRecord(item) ? { ...shared, ...item } : { ...shared, task: item };
224
+ const sharedIntent = isRecord(shared.intent) ? shared.intent : null;
225
+ const itemIntent = isRecord(item) && Object.hasOwn(item, "intent") && isRecord(item.intent) ? item.intent : null;
226
+ if (sharedIntent !== null && itemIntent !== null) itemArgs.intent = { ...sharedIntent, ...itemIntent };
220
227
  const parsed = dispatchRequestFromArgs(itemArgs, options);
221
228
  if (!parsed.ok) return { ok: false, message: `dispatch: task ${index + 1}: ${parsed.message}` };
229
+ if (sharedIntent !== null && itemIntent !== null) {
230
+ if (options.resolveIntent === void 0) {
231
+ return { ok: false, message: `dispatch: task ${index + 1}: intent resolver is unavailable` };
232
+ }
233
+ const ceiling = options.resolveIntent(sharedIntent, parsed.request.cwd);
234
+ if (!ceiling.ok) return { ok: false, message: `dispatch: task ${index + 1}: ${ceiling.message}` };
235
+ const pathCeilings = {
236
+ readRoots: [...ceiling.intent.readRoots, ...ceiling.intent.writeRoots],
237
+ writeRoots: ceiling.intent.writeRoots,
238
+ relevantPaths: [...ceiling.intent.readRoots, ...ceiling.intent.writeRoots, ...ceiling.intent.relevantPaths]
239
+ };
240
+ for (const field of ["readRoots", "writeRoots", "relevantPaths"]) {
241
+ const outside = parsed.request.intent?.[field].find(
242
+ (candidate) => !pathBoundaryCovers(pathCeilings[field], candidate)
243
+ );
244
+ if (outside !== void 0) {
245
+ return {
246
+ ok: false,
247
+ message: `dispatch: task ${index + 1}: intent_scope_widening: ${field} entry '${outside}' is outside the top-level intent ceiling`
248
+ };
249
+ }
250
+ }
251
+ }
222
252
  requests.push(parsed.request);
223
253
  }
224
254
  return { ok: true, requests };
@@ -308,6 +338,32 @@ function safeField(value) {
308
338
  }
309
339
  return result;
310
340
  }
341
+ function renderLegacyPathScope(task) {
342
+ if (task.intent !== void 0) return [];
343
+ const scope = resolveDispatchPathScope({
344
+ agentId: task.agent,
345
+ executionRole: task.executionRole,
346
+ task: task.task,
347
+ ...task.briefing !== void 0 ? { briefing: task.briefing } : {}
348
+ });
349
+ const lines = [" scope mode=legacy-inferred"];
350
+ for (const [policy, entries] of [
351
+ ["working_context", scope.provenance.workingContextPaths],
352
+ ["write_boundary", scope.provenance.writeBoundaries]
353
+ ]) {
354
+ for (const entry of entries) {
355
+ for (const evidence of entry.evidence) {
356
+ lines.push(
357
+ ` scope ${policy} path=${JSON.stringify(safeField(entry.path))} provenance=${evidence.provenance} source=${evidence.source} confidence=${evidence.confidence} reason=${evidence.reason}`
358
+ );
359
+ }
360
+ }
361
+ }
362
+ if (scope.provenance.workingContextPaths.length === 0 && scope.provenance.writeBoundaries.length === 0) {
363
+ lines.push(" scope policy_paths=none");
364
+ }
365
+ return lines;
366
+ }
311
367
  function taskViews(args) {
312
368
  const tasks = Array.isArray(args.tasks) ? args.tasks : [];
313
369
  const sharedAgent = str(args.agent) ?? "coder";
@@ -452,6 +508,7 @@ function renderPlanText(topology, tasks, costCeilingUsd, deadlineMs, source, max
452
508
  const serialized = JSON.stringify(task.intent);
453
509
  lines.push(` intent_sha256=${createHash("sha256").update(serialized, "utf8").digest("hex")}`);
454
510
  }
511
+ lines.push(...renderLegacyPathScope(task));
455
512
  for (const check of task.resolvedVerification ?? []) {
456
513
  lines.push(
457
514
  ` verification check=${safeField(check.check)} argv=${JSON.stringify(check.argv)} cwd=${JSON.stringify(check.cwd)} timeout_ms=${check.timeoutMs}`
@@ -756,4 +813,4 @@ export {
756
813
  withResolvedDispatchPlan,
757
814
  describeDispatchPlan
758
815
  };
759
- //# sourceMappingURL=chunk-EELBMBT6.js.map
816
+ //# sourceMappingURL=chunk-KTYTFRMB.js.map
@@ -0,0 +1,33 @@
1
+ import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
2
+ import {
3
+ openAuthStorage
4
+ } from "./chunk-EQ63NRB7.js";
5
+ import {
6
+ getRuntimeRegistry
7
+ } from "./chunk-NUGM5KR6.js";
8
+ import {
9
+ init_esm_shims
10
+ } from "./chunk-3R73A4XB.js";
11
+
12
+ // src/domains/providers/credentials.ts
13
+ init_esm_shims();
14
+ function credentialsPresent() {
15
+ const present = /* @__PURE__ */ new Set();
16
+ const registry = getRuntimeRegistry();
17
+ const auth = openAuthStorage();
18
+ for (const desc of registry.list()) {
19
+ const envVar = desc.credentialsEnvVar;
20
+ if (!envVar) continue;
21
+ const providerId = desc.id;
22
+ const status = auth.status(providerId, { explicitEnvVar: envVar, includeFallback: false });
23
+ if (status.available) {
24
+ present.add(envVar);
25
+ }
26
+ }
27
+ return present;
28
+ }
29
+
30
+ export {
31
+ credentialsPresent
32
+ };
33
+ //# sourceMappingURL=chunk-LU7P4LHA.js.map
@@ -1,48 +1,33 @@
1
1
  import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
2
2
  import {
3
- compileFleetExecutionPlan
4
- } from "./chunk-M4AKACEO.js";
3
+ discoverAgentRecipes
4
+ } from "./chunk-FBVTI2TJ.js";
5
5
  import {
6
- loadRecipesFromDir,
7
- mergeRecipes
8
- } from "./chunk-UVDSQ6LW.js";
6
+ compileFleetExecutionPlan
7
+ } from "./chunk-J3YUBZWY.js";
9
8
  import {
10
9
  loadFleetCommands,
11
10
  loadFleetContract,
12
11
  renderFleetPrompt
13
- } from "./chunk-KCMKRQX4.js";
12
+ } from "./chunk-E77JEWSD.js";
14
13
  import {
15
14
  requestExecutionRole,
16
15
  withAttemptRole
17
- } from "./chunk-UND3GU2L.js";
16
+ } from "./chunk-H7IXIC72.js";
18
17
  import {
19
18
  normalizeAgentSpec
20
19
  } from "./chunk-AOCYTWAV.js";
21
20
  import {
22
21
  readSettings
23
- } from "./chunk-UHXRNZ2J.js";
24
- import {
25
- clioConfigDir
26
- } from "./chunk-BNAZZHFG.js";
27
- import {
28
- resolvePackageRoot
29
- } from "./chunk-IWHMRKLL.js";
22
+ } from "./chunk-IJ7RPIYJ.js";
30
23
  import {
31
24
  init_esm_shims
32
25
  } from "./chunk-3R73A4XB.js";
33
26
 
34
27
  // src/cli/fleet-preflight.ts
35
28
  init_esm_shims();
36
- import { join } from "node:path";
37
29
  function discoverSpecs(cwd) {
38
- const diagnostics = [];
39
- const builtin = loadRecipesFromDir(
40
- { dir: join(resolvePackageRoot(), "src", "domains", "agents", "builtins"), source: "builtin" },
41
- diagnostics
42
- );
43
- const user = loadRecipesFromDir({ dir: join(clioConfigDir(), "agents"), source: "user" }, diagnostics);
44
- const project = loadRecipesFromDir({ dir: join(cwd, ".clio-coder", "agents"), source: "project" }, diagnostics);
45
- return mergeRecipes(builtin, user, project).map(normalizeAgentSpec);
30
+ return discoverAgentRecipes(cwd).map(normalizeAgentSpec);
46
31
  }
47
32
  function inspectFleet(name, vars) {
48
33
  const cwd = process.cwd();
@@ -120,4 +105,4 @@ function inspectFleet(name, vars) {
120
105
  export {
121
106
  inspectFleet
122
107
  };
123
- //# sourceMappingURL=chunk-DQA7QLMD.js.map
108
+ //# sourceMappingURL=chunk-ME6CCNFO.js.map
@@ -2,11 +2,16 @@ import { createRequire as __clioCreateRequire } from "node:module"; const requir
2
2
  import {
3
3
  describeWriteBoundary,
4
4
  normalizeWriteBoundary,
5
+ normalizeWriteBoundaryEntry,
5
6
  writeBoundaryCovers
6
- } from "./chunk-KCMKRQX4.js";
7
+ } from "./chunk-E77JEWSD.js";
8
+ import {
9
+ asDirectoryPathBoundary,
10
+ pathBoundaryEntryCovers
11
+ } from "./chunk-TTHACPOM.js";
7
12
  import {
8
13
  atomicWrite
9
- } from "./chunk-FO5ZOVUY.js";
14
+ } from "./chunk-3BINW3FP.js";
10
15
  import {
11
16
  clioStateDir
12
17
  } from "./chunk-BNAZZHFG.js";
@@ -730,7 +735,7 @@ init_esm_shims();
730
735
  import { execFileSync as execFileSync3 } from "node:child_process";
731
736
  import { createHash as createHash2 } from "node:crypto";
732
737
  import { existsSync as existsSync3, lstatSync as lstatSync2, mkdirSync as mkdirSync3, readlinkSync, realpathSync as realpathSync3, rmSync as rmSync3, writeFileSync as writeFileSync3 } from "node:fs";
733
- import { dirname, join as join3, relative as relative3, resolve as resolve3, sep as sep2 } from "node:path";
738
+ import { dirname, isAbsolute as isAbsolute2, join as join3, relative as relative3, resolve as resolve3, sep as sep2 } from "node:path";
734
739
  var WRITE_BOUNDARY_VIOLATION_REASON = "writes_boundary_violation";
735
740
  var ABSENT = "absent";
736
741
  var GIT_TIMEOUT_MS = 3e4;
@@ -876,10 +881,25 @@ function rollbackPath(snapshot, change) {
876
881
  }
877
882
  return { rolledBack: { path: change.path, action: "restored", restoredFrom: `${snapshot.head}:${change.path}` } };
878
883
  }
884
+ function withinRecordedWrite(recorded, path) {
885
+ if (recorded.has(path)) return true;
886
+ for (const target of recorded) {
887
+ if (path.startsWith(`${target}/`)) return true;
888
+ }
889
+ return false;
890
+ }
879
891
  function enforceWriteBoundary(input) {
880
892
  const allow = normalizeWriteBoundary(input.allow);
881
893
  const changes = diffWorkspace(input.snapshot);
882
- const violations = changes.filter((change) => !writeBoundaryCovers(allow, change.path));
894
+ const outside = changes.filter((change) => !writeBoundaryCovers(allow, change.path));
895
+ const attributionComplete = input.attribution?.complete === true;
896
+ const recorded = /* @__PURE__ */ new Set();
897
+ for (const target of input.attribution?.recorded ?? []) {
898
+ const relativeTarget = repoRelative(input.snapshot.root, target);
899
+ if (relativeTarget !== null) recorded.add(relativeTarget);
900
+ }
901
+ const violations = attributionComplete ? outside.filter((change) => withinRecordedWrite(recorded, change.path)) : outside;
902
+ const unattributed = attributionComplete ? outside.filter((change) => !withinRecordedWrite(recorded, change.path)) : [];
883
903
  const rolledBack = [];
884
904
  const unrecoverable = [];
885
905
  for (const change of violations) {
@@ -888,14 +908,20 @@ function enforceWriteBoundary(input) {
888
908
  if (outcome.unrecoverable !== void 0) unrecoverable.push(outcome.unrecoverable);
889
909
  }
890
910
  const status = violations.length === 0 ? "clean" : unrecoverable.length === 0 ? "rolled-back" : "rollback-incomplete";
891
- const attribution = input.stepIds.length === 1 ? `step '${input.stepIds[0]}'` : `steps ${input.stepIds.map((id) => `'${id}'`).join(", ")} ran concurrently in one checkout, so the write cannot be attributed to one of them`;
892
- const detail = violations.length === 0 ? null : [
893
- `${attribution} wrote outside its declared boundary.`,
911
+ const who = input.stepIds.length === 1 ? `step '${input.stepIds[0]}'` : `steps ${input.stepIds.map((id) => `'${id}'`).join(", ")} ran concurrently in one checkout, so the write cannot be attributed to one of them`;
912
+ const violationDetail = violations.length === 0 ? [] : [
913
+ `${who} wrote outside its declared boundary.`,
894
914
  `Unauthorized paths: ${violations.map((change) => change.path).join(", ")}.`,
895
915
  `Declared writes: ${describeWriteBoundary(allow)}.`,
896
916
  status === "rolled-back" ? "Those paths were rolled back to the baseline commit." : `Rollback is incomplete; the working tree is left as the step made it. Unrestorable: ${unrecoverable.map((entry) => `${entry.path} (${entry.reason})`).join("; ")}.`,
917
+ attributionComplete ? "Each was blamed on this window because a run in it recorded writing that path." : "This window had no complete write record, so every change outside the declaration was blamed on it.",
897
918
  "If the change was legitimate, widen the step's `writes:` declaration to cover it."
898
- ].join(" ");
919
+ ];
920
+ const concurrentDetail = unattributed.length === 0 ? [] : [
921
+ `Concurrent changes were seen in this window that no run in it recorded writing: ${unattributed.map((change) => change.path).join(", ")}.`,
922
+ "They were left untouched, because a path this window did not write is not this window's to restore."
923
+ ];
924
+ const detail = [...violationDetail, ...concurrentDetail];
899
925
  const body = {
900
926
  version: 1,
901
927
  window: input.window,
@@ -906,11 +932,13 @@ function enforceWriteBoundary(input) {
906
932
  checkedAt: (/* @__PURE__ */ new Date()).toISOString(),
907
933
  changedPaths: changes.map((change) => change.path),
908
934
  violations: violations.map((change) => change.path),
935
+ unattributed: unattributed.map((change) => change.path),
936
+ attributionComplete,
909
937
  rolledBack,
910
938
  unrecoverable,
911
939
  status,
912
940
  reason: violations.length === 0 ? null : WRITE_BOUNDARY_VIOLATION_REASON,
913
- detail
941
+ detail: detail.length === 0 ? null : detail.join(" ")
914
942
  };
915
943
  return { ...body, digest: createHash2("sha256").update(canonicalVerdict(body), "utf8").digest("hex") };
916
944
  }
@@ -921,14 +949,41 @@ function assertWriteBoundaryInsideRoot(root, allow) {
921
949
  let probe = join3(realRoot, relativeEntry);
922
950
  while (probe !== realRoot && !existsSync3(probe)) probe = dirname(probe);
923
951
  const resolved = realpathSync3(probe);
924
- if (resolved !== realRoot && !resolved.startsWith(realRoot + sep2)) {
952
+ if (resolved !== realRoot && !pathBoundaryEntryCovers(asDirectoryPathBoundary(realRoot), resolved)) {
925
953
  throw new Error(`write boundary: entry '${entry}' resolves to ${resolved}, outside the workspace at ${realRoot}`);
926
954
  }
927
955
  }
928
956
  }
957
+ function assertWriteBoundaryVisibleToGit(root, allow) {
958
+ const entries = [...new Set(allow.map(normalizeWriteBoundaryEntry))].sort();
959
+ if (entries.length === 0) return;
960
+ const absolute = resolve3(root);
961
+ let raw;
962
+ try {
963
+ raw = git3(absolute, ["check-ignore", "-v", "-z", "--stdin"], `${entries.join("\0")}\0`);
964
+ } catch (error) {
965
+ const status = error.status;
966
+ if (status === 1) return;
967
+ throw new Error(
968
+ `write boundary: could not determine whether ${describeWriteBoundary(entries)} is ignored by git in ${absolute}: ${error.message}`
969
+ );
970
+ }
971
+ const fields = raw.split("\0");
972
+ const refusals = [];
973
+ for (let index = 0; index + 3 < fields.length; index += 4) {
974
+ const [source, line, pattern, path] = fields.slice(index, index + 4);
975
+ if (path === void 0 || path.length === 0) continue;
976
+ refusals.push(`'${path}' is ignored by ${source}:${line}:${pattern}`);
977
+ }
978
+ if (refusals.length === 0) return;
979
+ throw new Error(
980
+ `write boundary: ${refusals.join(", ")}. git status never reports an ignored path, so a boundary declared over one is verified against nothing and every window would be certified clean without an observation. Declare a path the repository tracks, or stop ignoring this one.`
981
+ );
982
+ }
929
983
  function repoRelative(root, path) {
930
- const rel = relative3(resolve3(root), resolve3(path));
931
- if (rel.length === 0 || rel.startsWith("..") || rel.startsWith(`..${sep2}`)) return null;
984
+ const base = resolve3(root);
985
+ const rel = relative3(base, resolve3(base, path));
986
+ if (rel.length === 0 || rel === ".." || rel.startsWith(`..${sep2}`) || isAbsolute2(rel)) return null;
932
987
  return rel.split(sep2).join("/");
933
988
  }
934
989
  function writeBoundaryDir(rootId) {
@@ -956,6 +1011,7 @@ function preflightWriteBoundaries(plan, root) {
956
1011
  );
957
1012
  }
958
1013
  for (const step of declared) assertWriteBoundaryInsideRoot(root, step.writes ?? []);
1014
+ assertWriteBoundaryVisibleToGit(root, [...new Set(declared.flatMap((step) => [...step.writes ?? []]))]);
959
1015
  }
960
1016
  function createWriteBoundaryEnforcer(input) {
961
1017
  const open = /* @__PURE__ */ new Map();
@@ -964,10 +1020,26 @@ function createWriteBoundaryEnforcer(input) {
964
1020
  for (const stepId of stepIds) for (const entry of input.boundaryFor(stepId) ?? []) allow.add(entry);
965
1021
  return [...allow].sort();
966
1022
  };
1023
+ const attributionFor = (stepIds) => {
1024
+ const recordedWritesFor = input.recordedWritesFor;
1025
+ if (recordedWritesFor === void 0) return void 0;
1026
+ const recorded = /* @__PURE__ */ new Set();
1027
+ let complete = true;
1028
+ for (const stepId of stepIds) {
1029
+ const observed = recordedWritesFor(stepId);
1030
+ if (observed === null) {
1031
+ complete = false;
1032
+ continue;
1033
+ }
1034
+ for (const target of observed) recorded.add(target);
1035
+ }
1036
+ return { recorded: [...recorded].sort(), complete };
1037
+ };
967
1038
  return {
968
1039
  begin(window, stepIds) {
969
1040
  const allow = allowFor(stepIds);
970
1041
  assertWriteBoundaryInsideRoot(input.root, allow);
1042
+ assertWriteBoundaryVisibleToGit(input.root, allow);
971
1043
  open.set(window, { snapshot: captureWorkspaceSnapshot(input.root), allow });
972
1044
  },
973
1045
  async verify(window, stepIds) {
@@ -976,11 +1048,13 @@ function createWriteBoundaryEnforcer(input) {
976
1048
  throw new Error(`write boundary: window '${window}' was verified without a snapshot`);
977
1049
  }
978
1050
  open.delete(window);
1051
+ const attribution = attributionFor(stepIds);
979
1052
  const verdict = enforceWriteBoundary({
980
1053
  snapshot: pending.snapshot,
981
1054
  window,
982
1055
  stepIds,
983
- allow: pending.allow
1056
+ allow: pending.allow,
1057
+ ...attribution === void 0 ? {} : { attribution }
984
1058
  });
985
1059
  const path = writeWriteBoundaryVerdict(input.rootId, verdict);
986
1060
  input.onVerdict?.(verdict, path);
@@ -1023,4 +1097,4 @@ export {
1023
1097
  preflightWriteBoundaries,
1024
1098
  createWriteBoundaryEnforcer
1025
1099
  };
1026
- //# sourceMappingURL=chunk-KZ2H5X4G.js.map
1100
+ //# sourceMappingURL=chunk-MXKJU4JB.js.map
@@ -1,16 +1,18 @@
1
1
  import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
2
2
  import {
3
3
  receiptResponseModelIdObservationLabel
4
- } from "./chunk-VREKEFLL.js";
4
+ } from "./chunk-HLE42MG7.js";
5
5
  import {
6
- adaptRunReceiptTrustStatus
7
- } from "./chunk-UUANF5CR.js";
6
+ adaptRunReceiptTrustStatus,
7
+ formatTrustAxes,
8
+ formatTrustSummary
9
+ } from "./chunk-K4XHGFR5.js";
8
10
  import {
9
11
  formatBudgetPolicy,
10
12
  formatBudgetReasons,
11
13
  formatBudgetRequest,
12
14
  formatEffectiveBudget
13
- } from "./chunk-CEYBNUGC.js";
15
+ } from "./chunk-A3WNZD3P.js";
14
16
  import {
15
17
  mentionsWorkerToolCallCap
16
18
  } from "./chunk-4ZG3XFUR.js";
@@ -73,9 +75,9 @@ function receiptActivityLabels(receipt, status) {
73
75
  }
74
76
  function receiptEvidenceLabels(receipt, verification, integrity) {
75
77
  const status = adaptRunReceiptTrustStatus({ ...receipt, verification }, { integrity });
76
- const canonical = canonicalTrustLabel(status);
78
+ const canonical = canonicalTrustLabels(status);
77
79
  if (!integrity.ok) {
78
- return [canonical, `receipt_integrity=FAILED reason=${JSON.stringify(integrity.reason)}`];
80
+ return [...canonical, `receipt_integrity=FAILED reason=${JSON.stringify(integrity.reason)}`];
79
81
  }
80
82
  const briefing = receipt.briefing === void 0 ? "briefing=none" : `briefing=bytes:${receipt.briefing.bytes} sha256:${receipt.briefing.contentHash}`;
81
83
  let projectContext = "project_context=absent";
@@ -91,7 +93,7 @@ function receiptEvidenceLabels(receipt, verification, integrity) {
91
93
  `budget_reason=${JSON.stringify(formatBudgetReasons(receipt.budget))}`
92
94
  ];
93
95
  return [
94
- canonical,
96
+ ...canonical,
95
97
  `receipt_integrity=verified/v${receipt.integrity.version}/${receipt.integrity.algorithm}`,
96
98
  `evidence_verification=${verification.state}/${verification.basis}`,
97
99
  `host_verification=${receipt.hostVerification?.status ?? "not_requested"}`,
@@ -103,16 +105,8 @@ function receiptEvidenceLabels(receipt, verification, integrity) {
103
105
  projectContext
104
106
  ];
105
107
  }
106
- function canonicalTrustLabel(status) {
107
- return [
108
- `trust_status=v${status.version}`,
109
- `artifactIntegrity:${status.artifactIntegrity.state}`,
110
- `validationGrounding:${status.validationGrounding.state}`,
111
- `independentReview:${status.independentReview.state}`,
112
- `contextProvenance:${status.contextProvenance.state}`,
113
- `autonomyEnforcement:${status.autonomyEnforcement.state}`,
114
- `completionEvidence:${status.completionEvidence.state}`
115
- ].join(" ");
108
+ function canonicalTrustLabels(status) {
109
+ return [`trust=${JSON.stringify(formatTrustSummary(status))}`, formatTrustAxes(status)];
116
110
  }
117
111
  function workerTextLabel(status) {
118
112
  switch (status.validationGrounding.state) {
@@ -122,6 +116,14 @@ function workerTextLabel(status) {
122
116
  return "reconnaissance output (advisory leads, not validation evidence):";
123
117
  case "unknown":
124
118
  return "worker claims (validation not observable at this layer):";
119
+ // The three remaining states were one label. The evidence bundle tells
120
+ // a failed check, an inferred claim, and no validation at all apart, so
121
+ // the terminal must too or it hands the operator a coarser verdict than
122
+ // the report for the same run.
123
+ case "failed":
124
+ return "worker claims (validation failed; a check ran and did not pass):";
125
+ case "ungrounded":
126
+ return "worker claims (inferred; validation claimed, none observed):";
125
127
  default:
126
128
  return "worker claims (unverified prose):";
127
129
  }
@@ -171,4 +173,4 @@ export {
171
173
  workerTextLabel,
172
174
  workerTextNonEvidenceNotices
173
175
  };
174
- //# sourceMappingURL=chunk-DMD2AGVS.js.map
176
+ //# sourceMappingURL=chunk-N22QMJKY.js.map