approval-md 0.1.0 → 0.2.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 (266) hide show
  1. package/README.md +584 -553
  2. package/SPEC.md +42 -13
  3. package/dist/src/adapters/agentmail.d.ts +426 -0
  4. package/dist/src/adapters/agentmail.js +2 -2
  5. package/dist/src/adapters/conformance.d.ts +149 -0
  6. package/dist/src/adapters/contract.d.ts +628 -0
  7. package/dist/src/adapters/contract.js +110 -16
  8. package/dist/src/adapters/contract.js.map +1 -1
  9. package/dist/src/adapters/email.d.ts +324 -0
  10. package/dist/src/adapters/env-passphrase.d.ts +93 -0
  11. package/dist/src/adapters/public.d.ts +11 -0
  12. package/dist/src/adapters/public.js +11 -0
  13. package/dist/src/adapters/public.js.map +1 -0
  14. package/dist/src/adapters/registry.d.ts +59 -0
  15. package/dist/src/adapters/registry.js +2 -1
  16. package/dist/src/adapters/registry.js.map +1 -1
  17. package/dist/src/adapters/smtp.d.ts +213 -0
  18. package/dist/src/adapters/vault-provider.d.ts +114 -0
  19. package/dist/src/adapters/vault-provider.js +3 -3
  20. package/dist/src/adapters/zzz.d.ts +66 -0
  21. package/dist/src/adapters/zzz.js +299 -0
  22. package/dist/src/adapters/zzz.js.map +1 -0
  23. package/dist/src/channels/batch.d.ts +109 -0
  24. package/dist/src/channels/cli.d.ts +193 -0
  25. package/dist/src/channels/conformance.d.ts +92 -0
  26. package/dist/src/channels/contract.d.ts +623 -0
  27. package/dist/src/channels/payload-view.d.ts +35 -0
  28. package/dist/src/channels/render-queue.d.ts +149 -0
  29. package/dist/src/channels/tagging.d.ts +196 -0
  30. package/dist/src/channels/telegram.d.ts +1832 -0
  31. package/dist/src/channels/web.d.ts +341 -0
  32. package/dist/src/cli/adapter.d.ts +90 -0
  33. package/dist/src/cli/adapter.js +25 -15
  34. package/dist/src/cli/adapter.js.map +1 -1
  35. package/dist/src/cli/amend.d.ts +59 -0
  36. package/dist/src/cli/args.d.ts +43 -0
  37. package/dist/src/cli/attest.d.ts +41 -0
  38. package/dist/src/cli/audit-card.d.ts +62 -0
  39. package/dist/src/cli/audit.d.ts +59 -0
  40. package/dist/src/cli/channel-telegram.d.ts +806 -0
  41. package/dist/src/cli/channel-web.d.ts +131 -0
  42. package/dist/src/cli/channel.d.ts +71 -0
  43. package/dist/src/cli/checkpoint-tap.d.ts +169 -0
  44. package/dist/src/cli/codex.d.ts +2 -0
  45. package/dist/src/cli/codex.js +172 -0
  46. package/dist/src/cli/codex.js.map +1 -0
  47. package/dist/src/cli/coverage.d.ts +61 -0
  48. package/dist/src/cli/daemon.d.ts +120 -0
  49. package/dist/src/cli/doctor.d.ts +129 -0
  50. package/dist/src/cli/doctor.js +119 -5
  51. package/dist/src/cli/doctor.js.map +1 -1
  52. package/dist/src/cli/env.d.ts +65 -0
  53. package/dist/src/cli/execute.d.ts +202 -0
  54. package/dist/src/cli/exit-codes.d.ts +73 -0
  55. package/dist/src/cli/feedback.d.ts +60 -0
  56. package/dist/src/cli/gate-window.d.ts +40 -0
  57. package/dist/src/cli/gate.d.ts +68 -0
  58. package/dist/src/cli/git-scope.d.ts +190 -0
  59. package/dist/src/cli/gloss-attach.d.ts +85 -0
  60. package/dist/src/cli/gloss-codex-child.d.ts +9 -0
  61. package/dist/src/cli/gloss-codex.d.ts +24 -0
  62. package/dist/src/cli/gloss-options.d.ts +42 -0
  63. package/dist/src/cli/gloss.d.ts +265 -0
  64. package/dist/src/cli/help.d.ts +103 -0
  65. package/dist/src/cli/help.js +173 -51
  66. package/dist/src/cli/help.js.map +1 -1
  67. package/dist/src/cli/hook-codex.d.ts +78 -0
  68. package/dist/src/cli/hook-codex.js +167 -0
  69. package/dist/src/cli/hook-codex.js.map +1 -0
  70. package/dist/src/cli/hook.d.ts +331 -0
  71. package/dist/src/cli/hook.js +186 -80
  72. package/dist/src/cli/hook.js.map +1 -1
  73. package/dist/src/cli/import.d.ts +35 -0
  74. package/dist/src/cli/init.d.ts +84 -0
  75. package/dist/src/cli/init.js +2 -2
  76. package/dist/src/cli/init.js.map +1 -1
  77. package/dist/src/cli/instructions.d.ts +23 -0
  78. package/dist/src/cli/journal.d.ts +41 -0
  79. package/dist/src/cli/log-advance.d.ts +287 -0
  80. package/dist/src/cli/log-advance.js +102 -11
  81. package/dist/src/cli/log-advance.js.map +1 -1
  82. package/dist/src/cli/log-anchor.d.ts +176 -0
  83. package/dist/src/cli/log-checkpoint.d.ts +22 -0
  84. package/dist/src/cli/log-sync.d.ts +243 -0
  85. package/dist/src/cli/log-verbs.d.ts +16 -0
  86. package/dist/src/cli/log-verbs.js +7 -1
  87. package/dist/src/cli/log-verbs.js.map +1 -1
  88. package/dist/src/cli/long-help.d.ts +70 -0
  89. package/dist/src/cli/main.d.ts +77 -0
  90. package/dist/src/cli/main.js +155 -5
  91. package/dist/src/cli/main.js.map +1 -1
  92. package/dist/src/cli/mcp.d.ts +52 -0
  93. package/dist/src/cli/paths.d.ts +56 -0
  94. package/dist/src/cli/payload.d.ts +58 -0
  95. package/dist/src/cli/policy.d.ts +43 -0
  96. package/dist/src/cli/preflight.d.ts +363 -0
  97. package/dist/src/cli/preflight.js +294 -7
  98. package/dist/src/cli/preflight.js.map +1 -1
  99. package/dist/src/cli/progress.d.ts +78 -0
  100. package/dist/src/cli/prompt.d.ts +209 -0
  101. package/dist/src/cli/quickstart.d.ts +46 -0
  102. package/dist/src/cli/quickstart.js +297 -0
  103. package/dist/src/cli/quickstart.js.map +1 -0
  104. package/dist/src/cli/records.d.ts +34 -0
  105. package/dist/src/cli/render.d.ts +22 -0
  106. package/dist/src/cli/sandbox.d.ts +51 -0
  107. package/dist/src/cli/scaffold.d.ts +79 -0
  108. package/dist/src/cli/setup-adapter.d.ts +137 -0
  109. package/dist/src/cli/setup-adapter.js +38 -4
  110. package/dist/src/cli/setup-adapter.js.map +1 -1
  111. package/dist/src/cli/setup-channel.d.ts +117 -0
  112. package/dist/src/cli/setup-checkpoint.d.ts +57 -0
  113. package/dist/src/cli/setup-common.d.ts +275 -0
  114. package/dist/src/cli/setup-flow.d.ts +287 -0
  115. package/dist/src/cli/setup-service.d.ts +96 -0
  116. package/dist/src/cli/setup.d.ts +202 -0
  117. package/dist/src/cli/style.d.ts +320 -0
  118. package/dist/src/cli/token.d.ts +39 -0
  119. package/dist/src/cli/up.d.ts +155 -0
  120. package/dist/src/cli/up.js +4 -2
  121. package/dist/src/cli/up.js.map +1 -1
  122. package/dist/src/cli/usage.d.ts +37 -0
  123. package/dist/src/cli/values.d.ts +40 -0
  124. package/dist/src/cli/vault.d.ts +59 -0
  125. package/dist/src/cli/vault.js +2 -2
  126. package/dist/src/cli/vault.js.map +1 -1
  127. package/dist/src/cli/verb-registry.d.ts +76 -0
  128. package/dist/src/cli/verb-registry.js +176 -8
  129. package/dist/src/cli/verb-registry.js.map +1 -1
  130. package/dist/src/cli/wordmark.d.ts +31 -0
  131. package/dist/src/cli/wordmark.js +2 -2
  132. package/dist/src/codex/doctor.d.ts +13 -0
  133. package/dist/src/codex/doctor.js +41 -0
  134. package/dist/src/codex/doctor.js.map +1 -0
  135. package/dist/src/codex/manifest.d.ts +49 -0
  136. package/dist/src/codex/manifest.js +103 -0
  137. package/dist/src/codex/manifest.js.map +1 -0
  138. package/dist/src/codex/templates.d.ts +41 -0
  139. package/dist/src/codex/templates.js +319 -0
  140. package/dist/src/codex/templates.js.map +1 -0
  141. package/dist/src/codex/trust.d.ts +19 -0
  142. package/dist/src/codex/trust.js +183 -0
  143. package/dist/src/codex/trust.js.map +1 -0
  144. package/dist/src/codex/workspace-plan.d.ts +131 -0
  145. package/dist/src/codex/workspace-plan.js +561 -0
  146. package/dist/src/codex/workspace-plan.js.map +1 -0
  147. package/dist/src/core/actor.d.ts +2 -0
  148. package/dist/src/core/actor.js +5 -0
  149. package/dist/src/core/actor.js.map +1 -0
  150. package/dist/src/core/advance-cycle.d.ts +170 -0
  151. package/dist/src/core/agents-md.d.ts +276 -0
  152. package/dist/src/core/apply-patch.d.ts +49 -0
  153. package/dist/src/core/apply-patch.js +266 -0
  154. package/dist/src/core/apply-patch.js.map +1 -0
  155. package/dist/src/core/attest.d.ts +420 -0
  156. package/dist/src/core/attest.js +13 -1
  157. package/dist/src/core/attest.js.map +1 -1
  158. package/dist/src/core/audit.d.ts +492 -0
  159. package/dist/src/core/budgets.d.ts +238 -0
  160. package/dist/src/core/checkpoint.d.ts +500 -0
  161. package/dist/src/core/child-env.d.ts +88 -0
  162. package/dist/src/core/clock.d.ts +52 -0
  163. package/dist/src/core/command-class.d.ts +543 -0
  164. package/dist/src/core/command-class.js +43 -8
  165. package/dist/src/core/command-class.js.map +1 -1
  166. package/dist/src/core/coverage-sources/adapter.d.ts +40 -0
  167. package/dist/src/core/coverage-sources/gh.d.ts +48 -0
  168. package/dist/src/core/coverage-sources/git.d.ts +101 -0
  169. package/dist/src/core/coverage.d.ts +217 -0
  170. package/dist/src/core/credential-spec.d.ts +72 -0
  171. package/dist/src/core/dark-session.d.ts +331 -0
  172. package/dist/src/core/decision-refusal.d.ts +185 -0
  173. package/dist/src/core/env-file.d.ts +450 -0
  174. package/dist/src/core/execute.d.ts +858 -0
  175. package/dist/src/core/execute.js +44 -6
  176. package/dist/src/core/execute.js.map +1 -1
  177. package/dist/src/core/frontmatter.d.ts +78 -0
  178. package/dist/src/core/gate-window.d.ts +312 -0
  179. package/dist/src/core/gate.d.ts +1364 -0
  180. package/dist/src/core/gate.js +68 -13
  181. package/dist/src/core/gate.js.map +1 -1
  182. package/dist/src/core/git-run.d.ts +73 -0
  183. package/dist/src/core/harness-version.d.ts +157 -0
  184. package/dist/src/core/harness-version.js +2 -1
  185. package/dist/src/core/harness-version.js.map +1 -1
  186. package/dist/src/core/harness-wait.d.ts +55 -0
  187. package/dist/src/core/head-retry.d.ts +107 -0
  188. package/dist/src/core/instance.d.ts +253 -0
  189. package/dist/src/core/intake-limits.d.ts +247 -0
  190. package/dist/src/core/jcs.d.ts +52 -0
  191. package/dist/src/core/journal.d.ts +144 -0
  192. package/dist/src/core/live-draw.d.ts +436 -0
  193. package/dist/src/core/log-reconcile.d.ts +89 -0
  194. package/dist/src/core/log-subscribe.d.ts +36 -0
  195. package/dist/src/core/log-subscribe.js +162 -0
  196. package/dist/src/core/log-subscribe.js.map +1 -0
  197. package/dist/src/core/log.d.ts +278 -0
  198. package/dist/src/core/loop.d.ts +274 -0
  199. package/dist/src/core/loop.js +11 -0
  200. package/dist/src/core/loop.js.map +1 -1
  201. package/dist/src/core/md-fence.d.ts +41 -0
  202. package/dist/src/core/money.d.ts +147 -0
  203. package/dist/src/core/payload-census.d.ts +74 -0
  204. package/dist/src/core/payload-store.d.ts +175 -0
  205. package/dist/src/core/payload.d.ts +71 -0
  206. package/dist/src/core/policy-diff.d.ts +292 -0
  207. package/dist/src/core/policy-diff.js +27 -4
  208. package/dist/src/core/policy-diff.js.map +1 -1
  209. package/dist/src/core/policy-expectations.d.ts +199 -0
  210. package/dist/src/core/policy-explain.d.ts +150 -0
  211. package/dist/src/core/policy-explain.js +31 -3
  212. package/dist/src/core/policy-explain.js.map +1 -1
  213. package/dist/src/core/policy-load.d.ts +527 -0
  214. package/dist/src/core/policy-load.js +15 -3
  215. package/dist/src/core/policy-load.js.map +1 -1
  216. package/dist/src/core/policy-match.d.ts +281 -0
  217. package/dist/src/core/policy-match.js +20 -9
  218. package/dist/src/core/policy-match.js.map +1 -1
  219. package/dist/src/core/policy-proposal.d.ts +265 -0
  220. package/dist/src/core/prompt-layout.d.ts +221 -0
  221. package/dist/src/core/protected-path-guard.d.ts +453 -0
  222. package/dist/src/core/protected-path-guard.js +514 -35
  223. package/dist/src/core/protected-path-guard.js.map +1 -1
  224. package/dist/src/core/registration.d.ts +25 -0
  225. package/dist/src/core/reindex.d.ts +99 -0
  226. package/dist/src/core/sampler.d.ts +313 -0
  227. package/dist/src/core/sandbox.d.ts +290 -0
  228. package/dist/src/core/seal.d.ts +165 -0
  229. package/dist/src/core/state.d.ts +505 -0
  230. package/dist/src/core/task-file.d.ts +185 -0
  231. package/dist/src/core/telegram-config.d.ts +93 -0
  232. package/dist/src/core/token.d.ts +409 -0
  233. package/dist/src/core/token.js +21 -38
  234. package/dist/src/core/token.js.map +1 -1
  235. package/dist/src/core/validate.d.ts +138 -0
  236. package/dist/src/core/values.d.ts +137 -0
  237. package/dist/src/core/vault.d.ts +291 -0
  238. package/dist/src/core/verified-snapshot.d.ts +204 -0
  239. package/dist/src/core/verify.d.ts +336 -0
  240. package/dist/src/core/version.d.ts +8 -0
  241. package/dist/src/core/wysiwys.d.ts +370 -0
  242. package/dist/src/daemon/advance-child.d.ts +39 -0
  243. package/dist/src/daemon/advance.d.ts +466 -0
  244. package/dist/src/daemon/audit.d.ts +87 -0
  245. package/dist/src/daemon/daemon.d.ts +1180 -0
  246. package/dist/src/daemon/dark-session.d.ts +64 -0
  247. package/dist/src/daemon/draw-child.d.ts +36 -0
  248. package/dist/src/daemon/draw.d.ts +154 -0
  249. package/dist/src/daemon/git-evidence.d.ts +173 -0
  250. package/dist/src/daemon/git-evidence.js +1 -1
  251. package/dist/src/daemon/projection.d.ts +180 -0
  252. package/dist/src/daemon/prune.d.ts +207 -0
  253. package/dist/src/mcp/http.d.ts +113 -0
  254. package/dist/src/mcp/server.d.ts +265 -0
  255. package/dist/src/mcp/server.js +9 -1
  256. package/dist/src/mcp/server.js.map +1 -1
  257. package/docs/adapter-api.md +106 -0
  258. package/docs/cli-reference.md +389 -36
  259. package/docs/codex-enforced-session.md +30 -0
  260. package/package.json +12 -2
  261. package/schema/codex-instance.schema.json +82 -0
  262. package/schema/event.schema.json +2 -1
  263. package/schema/fixtures/codex-instance/invalid/unpinned-codex-version.json +40 -0
  264. package/schema/fixtures/codex-instance/valid/canonical.json +40 -0
  265. package/schema/policy.schema.json +21 -1
  266. package/templates/codex/README.md +9 -0
@@ -0,0 +1,341 @@
1
+ /**
2
+ * The local web queue channel (SPEC.md §5.1 `channels.web.port`, §9, §10.3,
3
+ * §10.4, §11 — APRV-25).
4
+ *
5
+ * The third reference channel, and the only *pull* one. `cli` asks a question
6
+ * and waits for an answer; `telegram` pushes a message at a human who is
7
+ * elsewhere. This one serves a page: the queue sits at
8
+ * `http://127.0.0.1:4680/` and a human looks at it when they choose to. That
9
+ * difference is the design, not an accident of the transport — see "notify is a
10
+ * no-op" below.
11
+ *
12
+ * Everything the contract says about a channel still holds:
13
+ *
14
+ * - **It decides nothing.** A submitted form becomes a {@link ChannelDecision}
15
+ * handed to the handler the runtime registered, and that handler calls
16
+ * `recordChannelDecision` / `recordBatchDecisions`, which call the human-only
17
+ * `decide()` in `core/gate.ts`. TTL lapse, budget re-check, attestation,
18
+ * idempotency and compare-and-append apply to a button on a web page exactly
19
+ * as they apply to `approval grant`.
20
+ * - **It writes no log line and holds no decision state.** The only memory here
21
+ * is the map from action key to delivery id, which is delivery bookkeeping.
22
+ * It dies with the process; the approvals live in the log.
23
+ * - **It renders the computed/claimed split** (§9) and the full payload for
24
+ * manual actions (§10.4), and reports what it rendered through
25
+ * {@link WebChannel.lastRendered} so `channels/conformance.ts` can check it.
26
+ *
27
+ * ## 127.0.0.1 ONLY, and there is deliberately no --host
28
+ *
29
+ * {@link WebChannel.start} calls `listen(port, "127.0.0.1")` with the host
30
+ * **hard-coded**. There is no option, no flag and no environment variable that
31
+ * widens it, and adding one would be a SPEC.md amendment rather than a feature:
32
+ * this server has **no authentication at all** (see below), so the loopback
33
+ * interface is the entire access-control mechanism. A `--host 0.0.0.0` would
34
+ * turn "anyone with local access can approve" into "anyone on the coffee shop
35
+ * wifi can approve", silently, from a flag that reads like a convenience. The
36
+ * bound address is asserted by `tests/channels-web.test.ts`.
37
+ *
38
+ * ## No auth in v0.1 — the trust boundary, stated twice
39
+ *
40
+ * SPEC.md §11: *"Human identity in v0.1 is config-declared (an environment
41
+ * variable or flag); the trust boundary is the local machine, and anyone who
42
+ * can set that configuration and write to the log is inside it."*
43
+ *
44
+ * This channel authenticates nobody. Every decision it collects is recorded
45
+ * against the human actor the **runtime** was started with (`--as` /
46
+ * `APPROVAL_HUMAN`), so the guarantee is "someone with access to this machine
47
+ * approved", never "that specific person approved". Because the page *is* the
48
+ * decision surface, that caveat is printed on the page itself
49
+ * ({@link TRUST_BANNER}) as well as in `--help` and here: a human reading a
50
+ * queue in a browser tab should not have to have read the source to know what
51
+ * their click proves.
52
+ *
53
+ * ## CSRF — inside the stated boundary, with cheap hardening. FLAGGED.
54
+ *
55
+ * There is no CSRF token in v0.1, and the reasoning is worth writing down
56
+ * because it is a deliberate omission rather than an oversight. A CSRF token
57
+ * defends a *session* — it stops a page on another origin from acting as an
58
+ * authenticated user. Here there is no session and no authentication: anything
59
+ * that can open a socket to 127.0.0.1:4680 can already POST directly, token or
60
+ * no token, because the trust boundary is the whole local machine. A token
61
+ * would defend against exactly one attacker: a web page, in a browser on this
62
+ * machine, that the human visited, that guessed the port. That attacker is
63
+ * inside the §11 boundary as written — and is also the most realistic one, so:
64
+ *
65
+ * - A same-origin **soft check** rejects (403) any POST whose `Origin` (or
66
+ * failing that, `Referer`) names something other than this server's own
67
+ * loopback origins. It is best effort: a request with neither header is
68
+ * allowed, because `curl`, `fetch` in a test, and a form POST from an older
69
+ * browser all send neither, and refusing them would break the documented
70
+ * scripting path to buy nothing (an attacker can omit a header too).
71
+ * - **Flagged for human review**: if v0.2 puts this server behind anything
72
+ * resembling a session, or widens the bind address, this stance must be
73
+ * revisited and a real anti-CSRF token added. The soft check is a speed bump,
74
+ * not a control.
75
+ *
76
+ * ## The token IS shown on the page — FLAGGED, and it differs from telegram
77
+ *
78
+ * `channels/telegram.ts` refuses to put an execution token in the chat, and
79
+ * prints it on the listener's stdout instead: a chat transcript lives on
80
+ * someone else's servers and is readable by anyone later added to the chat.
81
+ * This channel does the opposite and shows the raw token **once**, in the
82
+ * response page for the grant that minted it. The asymmetry is the point:
83
+ *
84
+ * - the page is served over loopback to the human who is deciding, right now;
85
+ * - the response is generated per request and persisted nowhere — no file, no
86
+ * log line, no `lastRendered()` entry (the notice is rendered and dropped);
87
+ * - the alternative is worse. On telegram the approver and the terminal are
88
+ * often the same person one room apart; here the browser *is* the surface the
89
+ * human is looking at, and sending them to hunt for a token on a daemon's
90
+ * stdout would push them toward copying tokens out of log files.
91
+ *
92
+ * The token is never written to the log (which holds only its SHA-256), never
93
+ * put in a URL (a query string lands in history), and never repeated: reload
94
+ * the response and it is gone. The channel itself does not even hold it — the
95
+ * runtime returns the notice text through {@link WebChannelOptions.decisionNotice}
96
+ * at render time, so a channel that logged its own outcomes would log nothing
97
+ * sensitive. **Flagged for human review** all the same: it is the one place in
98
+ * this codebase where a credential is rendered into a document a browser
99
+ * handles, and browsers cache, autofill and sync more than one expects.
100
+ *
101
+ * ## notify() is a no-op — pull, not push
102
+ *
103
+ * The queue *is* the notification surface. `notify()` records the request as
104
+ * deliverable (so a decision can be routed back to it), returns a synthetic
105
+ * delivery id, and sends nothing anywhere: there is nowhere to send it, since a
106
+ * web page is fetched rather than delivered. Everything the human sees is
107
+ * produced by `GET /`, which re-renders from the runtime's live queue
108
+ * ({@link WebChannelOptions.refresh}) whenever one is supplied. This is why
109
+ * `lastRendered()` reflects the most recent *render* — a GET when there has
110
+ * been one, the last `notify()` otherwise — and why both go through the same
111
+ * {@link renderWebRequest}: the conformance suite must be inspecting the thing a
112
+ * browser was actually served.
113
+ *
114
+ * ## Zero JavaScript required
115
+ *
116
+ * Every flow — grant, reject with a note, select-and-batch — is plain
117
+ * `<form method="post" enctype="application/x-www-form-urlencoded">`. The batch
118
+ * checkboxes live outside the batch form and are attached to it with the HTML5
119
+ * `form=` attribute (nested forms are illegal), so one page can carry per-request
120
+ * forms *and* a batch gesture with no script at all. A four-line inline script
121
+ * offers "select all" as a convenience; disable scripting and every flow still
122
+ * works, which is checked by the tests driving the server with `fetch` alone.
123
+ */
124
+ import { type Server } from "node:http";
125
+ import type { AddressInfo } from "node:net";
126
+ import { type PromptLayout } from "../core/prompt-layout.js";
127
+ import type { ChannelBatch, ChannelDecision, ChannelHealth, ChannelRequest, DecisionOutcome, DeliveryId, RenderedRequest, TestableChannel } from "./contract.js";
128
+ /** SPEC.md §5.1 `channels.web.port`. Used when policy and flags say nothing. */
129
+ export declare const WEB_DEFAULT_PORT = 4680;
130
+ /**
131
+ * The only address this server ever binds. Hard-coded; see the module header.
132
+ *
133
+ * Exported so the tests can assert the bound address against a constant rather
134
+ * than a literal they could drift from — not so a caller can substitute one.
135
+ */
136
+ export declare const WEB_LOOPBACK_HOST = "127.0.0.1";
137
+ /** The largest form body accepted. A queue page's POST is a few hundred bytes. */
138
+ export declare const WEB_MAX_BODY_BYTES: number;
139
+ /** The §11 caveat, rendered at the top of every page. */
140
+ export declare const TRUST_BANNER: string;
141
+ /** The full-payload delimiters (SPEC.md §10.4). Pinned by tests. */
142
+ export declare const PAYLOAD_BEGIN = "--- BEGIN FULL PAYLOAD";
143
+ export declare const PAYLOAD_END = "--- END FULL PAYLOAD ---";
144
+ /** Section headings. The computed/claimed split a reader must not have to infer. */
145
+ export declare const COMPUTED_HEADING = "COMPUTED \u2014 derived by the runtime from the verified log, the attested policy, the budget evaluator, the payload bytes and the clock";
146
+ export declare const CLAIMED_HEADING_PREFIX = "CLAIMED \u2014 authored by";
147
+ export declare const CLAIMED_HEADING_SUFFIX = "NOT verified by the runtime";
148
+ /** Badge markers, mirroring `channels/cli.ts` so the two channels read alike. */
149
+ export declare const COMPUTED_MARKER = "[computed]";
150
+ export declare const CLAIMED_MARKER = "[claimed]";
151
+ /**
152
+ * Escape every character that could change the structure of the document.
153
+ *
154
+ * A superset of `channels/telegram.ts`'s three: this channel interpolates into
155
+ * HTML **attribute** positions (checkbox values carry action keys, form ids
156
+ * carry them too), where a bare quote is as dangerous as a bare `<`. Applied
157
+ * uniformly to every interpolated value without exception — the claimed fields
158
+ * and the payload are authored by the party under oversight, and they are the
159
+ * entire injection surface of this page.
160
+ */
161
+ export declare function escapeHtml(text: string): string;
162
+ /**
163
+ * One field's value as display text. Deliberately total: an unrecognized shape
164
+ * is JSON-stringified rather than dropped, because a field the runtime tagged
165
+ * and the channel silently omitted is a field the approver did not see.
166
+ */
167
+ export declare function formatValue(field: string, value: unknown): string;
168
+ /** One rendered line, and the request member it came from. */
169
+ export interface WebLine {
170
+ field: string;
171
+ kind: "computed" | "claimed";
172
+ text: string;
173
+ origin: string;
174
+ }
175
+ /** The rendering split for one request; the HTML below is built from exactly this. */
176
+ export interface WebRendering {
177
+ actionKey: string;
178
+ computed: WebLine[];
179
+ claimed: WebLine[];
180
+ /** The claimed author, for the section heading. */
181
+ author: string;
182
+ /** The delimited payload region, or `null` when the request carries none. */
183
+ payloadText: string | null;
184
+ }
185
+ /** Build the split. Pure: no I/O, no clock, no HTML. */
186
+ export declare function renderWebRequest(request: ChannelRequest, layout?: PromptLayout): WebRendering;
187
+ /**
188
+ * The runtime's per-decision notice: text shown ONCE on the response page and
189
+ * kept nowhere.
190
+ *
191
+ * This is how a grant's raw execution token reaches the human without the
192
+ * channel ever holding it: `recordChannelDecision` returns the token to the
193
+ * *runtime*, the runtime returns this string at render time, the channel
194
+ * escapes it into one response and forgets it. It is not stored, not repeated
195
+ * on the next GET, and never included in {@link WebChannel.lastRendered}.
196
+ */
197
+ export type WebDecisionNotice = (decision: ChannelDecision, outcome: DecisionOutcome) => string | null | undefined;
198
+ /** One batch member's result, as the runtime reports it back to the channel. */
199
+ export interface WebBatchOutcome {
200
+ action_key: string;
201
+ outcome: DecisionOutcome;
202
+ /** Shown once on the response page (the token). Never stored. */
203
+ notice?: string;
204
+ }
205
+ /**
206
+ * The runtime's batch recorder. Registered with
207
+ * {@link WebChannel.onBatchDecision}; its body is a call to
208
+ * `channels/batch.ts`'s `recordBatchDecisions`, which is one `decide()` per
209
+ * member. When no batch handler is registered the channel falls back to the
210
+ * unit handler once per member with `batchDeliveryId` set — identical
211
+ * semantics, since `recordChannelDecision` encodes the id the same way.
212
+ */
213
+ export type WebBatchHandler = (decisions: ChannelDecision[], batchDeliveryId: DeliveryId) => WebBatchOutcome[] | Promise<WebBatchOutcome[]>;
214
+ export interface WebChannelOptions {
215
+ /** Port to bind. `0` asks the OS for an ephemeral one (tests). */
216
+ port?: number;
217
+ /** Channel name recorded for audit. Defaults to `web`. */
218
+ name?: string;
219
+ /**
220
+ * Which rows the page shows (APRV-218), from `channels.web.prompt`.
221
+ *
222
+ * Resolved by the verb, which has already loaded the policy; this channel
223
+ * neither reads a policy file nor holds an opinion about what an operator
224
+ * should see. Defaults to {@link WEB_PROMPT_LAYOUT}, so a channel constructed
225
+ * without one renders exactly what it rendered before the key existed.
226
+ */
227
+ layout?: PromptLayout;
228
+ /**
229
+ * The runtime's live pending queue, re-read on every GET.
230
+ *
231
+ * Optional: without it the page shows whatever was `notify`d. With it the
232
+ * page is a projection of the log as of the moment it was fetched, which is
233
+ * what makes a decided request disappear from the queue on the next reload.
234
+ * The channel never reads the log itself — this function belongs to the
235
+ * runtime, which is the only thing allowed to.
236
+ */
237
+ refresh?: () => ChannelRequest[];
238
+ /** Per-decision one-shot notice (the execution token). See {@link WebDecisionNotice}. */
239
+ decisionNotice?: WebDecisionNotice;
240
+ /** The configured approver, for display only. Never used to authorize. */
241
+ actorLabel?: string;
242
+ /** Where operational complaints go. Defaults to stderr. */
243
+ log?: (message: string) => void;
244
+ }
245
+ /** Delivery and traffic counters. Never decision state. */
246
+ export interface WebStats {
247
+ /** Requests registered by `notify`. */
248
+ notified: number;
249
+ /** `GET /` renders served. */
250
+ views: number;
251
+ /** Gestures handed to the runtime's handler. */
252
+ decisions: number;
253
+ /** POSTs refused before the handler: bad form, missing note, cross-origin. */
254
+ refused: number;
255
+ }
256
+ export declare class WebChannel implements TestableChannel {
257
+ readonly name: string;
258
+ private readonly configuredPort;
259
+ private readonly refresh;
260
+ private readonly notice;
261
+ private readonly actorLabel;
262
+ private readonly complain;
263
+ private handler;
264
+ private batchHandler;
265
+ /** Everything ever delivered, by action key. Delivery bookkeeping only. */
266
+ private readonly deliveries;
267
+ /** What the last render showed, in order. */
268
+ private pending;
269
+ private rendered;
270
+ private httpServer;
271
+ private counter;
272
+ private readonly counters;
273
+ /** The policy's row layout for this channel (APRV-218). Pure input to the rendering. */
274
+ private readonly layout;
275
+ constructor(options?: WebChannelOptions);
276
+ /**
277
+ * Register a request (or a batch) as deliverable and return its delivery id.
278
+ *
279
+ * Sends nothing: the queue page is pulled, not pushed (see the module
280
+ * header). The rendering split is computed here anyway, so `lastRendered()`
281
+ * is meaningful before anyone has opened a browser — and it is computed by
282
+ * the same {@link renderWebRequest} that produces the served HTML.
283
+ */
284
+ notify(target: ChannelRequest | ChannelBatch): DeliveryId;
285
+ onDecision(handler: (decision: ChannelDecision) => DecisionOutcome): void;
286
+ /** Register the runtime's batch recorder. Optional; see {@link WebBatchHandler}. */
287
+ onBatchDecision(handler: WebBatchHandler): void;
288
+ health(): ChannelHealth;
289
+ /** The most recent rendering — a GET when there has been one, else `notify`. */
290
+ lastRendered(): RenderedRequest[];
291
+ stats(): WebStats;
292
+ /** The bound address, or `null` when the server is not listening. */
293
+ address(): AddressInfo | null;
294
+ /** The bound port, or the configured one before {@link start}. */
295
+ get port(): number;
296
+ /** The underlying server, for tests that assert on the socket itself. */
297
+ get server(): Server | null;
298
+ /** The page's own origin, as a browser would send it. */
299
+ get origin(): string;
300
+ /**
301
+ * Bind and serve — on `127.0.0.1` and nowhere else.
302
+ *
303
+ * The host argument is a constant. See the module header for why there is
304
+ * deliberately no option to widen it.
305
+ */
306
+ start(): Promise<AddressInfo>;
307
+ /** Stop listening. Safe when never started. */
308
+ close(): Promise<void>;
309
+ private handle;
310
+ /**
311
+ * The best-effort same-origin check. Returns the offending origin, or `null`
312
+ * when the POST is acceptable.
313
+ *
314
+ * A request with neither `Origin` nor `Referer` is accepted: `curl`, a test's
315
+ * `fetch` and some browsers' form posts all send neither, and an attacker can
316
+ * omit a header as easily as anyone else — refusing them would cost the
317
+ * documented scripting path and buy nothing. See the module header's CSRF
318
+ * section, which is flagged for review.
319
+ */
320
+ private checkOrigin;
321
+ private readBody;
322
+ /** The live pending set: the runtime's queue when one is supplied. */
323
+ private currentRequests;
324
+ /**
325
+ * Render the queue. The `lastRendered()` report is built here, from the same
326
+ * values the HTML is built from — not from a parallel description of it.
327
+ */
328
+ private queuePage;
329
+ private decide;
330
+ private decideBatch;
331
+ /**
332
+ * The response page for a gesture.
333
+ *
334
+ * Not a redirect. A redirect-after-POST would either drop the one-shot notice
335
+ * or put an execution token in a URL, and a URL is exactly the place a
336
+ * credential must never be: it lands in history, in referrers, and in every
337
+ * proxy log between here and nowhere.
338
+ */
339
+ private outcomePage;
340
+ private send;
341
+ }
@@ -0,0 +1,90 @@
1
+ /**
2
+ * `approval adapter <name>` — execute an action through the adapter
3
+ * contract (SPEC.md §10.4; APRV-69, generalized in APRV-221).
4
+ *
5
+ * This is the CLI face of the adapters in {@link ADAPTER_CLIS} (`email` at
6
+ * v0.1), and it is deliberately the thinnest one in the repository. The name is
7
+ * a table lookup and the body below it is adapter-agnostic: a second adapter is
8
+ * an entry in the table and nothing else in this file.
9
+ *
10
+ * It resolves paths and identity, reads the
11
+ * payload bytes at the edge, builds the vault-backed credential provider, calls
12
+ * {@link executeThroughAdapter} once, and maps the result onto the frozen exit
13
+ * table. It does not verify a token, hash a payload, append an event, or open a
14
+ * socket: every one of those belongs to a layer that already owns it, and a verb
15
+ * that reimplemented any of them would be a second implementation of the rule.
16
+ *
17
+ * **Why the payload is a file (or stdin) and never a flag.** The bytes are the
18
+ * thing the grant or registered declaration bound, they routinely contain newlines, quotes and a
19
+ * £-sign, and a message body on a command line is a message body in the shell
20
+ * history and in `ps` output. `approval payload hash <file|->` and
21
+ * `approval request --payload <file>` take the same argument in the same form,
22
+ * so the same file travels from declaration to request to execution.
23
+ *
24
+ * **What `--json` prints is the contract's own result shape**, unmodified:
25
+ * `AdapterExecuteSuccess` on stdout for a completed send,
26
+ * `AdapterRefusal` on stderr for anything else. There is no CLI-flavoured
27
+ * summary, because a caller parsing this is a caller who wants to know
28
+ * `started_seq`, `outcome_seq` and `adapter_code` — and inventing a second
29
+ * vocabulary for them here would be a second thing to keep in step with
30
+ * `contract.ts`.
31
+ *
32
+ * ## Exit codes
33
+ *
34
+ * The `approval run` table, unchanged and shared with it through
35
+ * {@link executeRefusalExitCode}:
36
+ *
37
+ * | Situation | Code |
38
+ * |---|---|
39
+ * | the message was accepted by the far side | 0 |
40
+ * | usage: a missing required flag, a bad identity, an unparseable payload | 2 |
41
+ * | I/O: the payload file or the log could not be read | 4 |
42
+ * | `token-required` — no token was presented | 5 |
43
+ * | `log-torn-tail`, or an append that hit a torn tail | 3 |
44
+ * | anything else the runtime decided: `token-mismatch`, `token-consumed`, `payload-mismatch`, `adapter-class-mismatch`, `adapter-precheck-refused` (a drifted draft), `adapter-failed` (an SMTP refusal), `adapter-act-threw` | 1 |
45
+ *
46
+ * A refused SEND is exit 1 and not 5: the command was well-formed and the
47
+ * answer from the world was no. Exit 5 is the manual-path redirection to obtain
48
+ * a grant token, which is the distinction `run` already draws and the one an
49
+ * agent's retry logic keys on.
50
+ */
51
+ import { type Adapter } from "../adapters/contract.js";
52
+ import type { Streams } from "./main.js";
53
+ /** One adapter, as `approval adapter <name>` needs to see it. */
54
+ export interface AdapterCliEntry {
55
+ /** The verb's own help: printed for --help, and beside every usage error. */
56
+ help: string;
57
+ /**
58
+ * The adapter instance to execute through, built per invocation because
59
+ * `--timeout` is per invocation. Nothing else about the adapter is this
60
+ * verb's business: the contract routes, hashes, spends and appends.
61
+ */
62
+ build(options: {
63
+ timeoutMs?: number;
64
+ }): Adapter;
65
+ }
66
+ /**
67
+ * Every adapter this verb can execute, keyed by the `adapter <name>` name.
68
+ *
69
+ * The table IS the dispatch (APRV-221): a second adapter is a second entry
70
+ * here, and no line below this one names an adapter. `cli/setup-adapter.ts`
71
+ * holds the matching table for the credential side and `adapters/registry.ts`
72
+ * the roster the credential scrub reads. An adapter that ships is an entry in
73
+ * all three, which is three small tables rather than one import cycle between
74
+ * the CLI and the adapters.
75
+ */
76
+ export declare const ADAPTER_CLIS: Record<string, AdapterCliEntry>;
77
+ /** The known names, sorted, for a usage error and for the help text. */
78
+ export declare function knownAdapterNames(): string[];
79
+ /**
80
+ * `approval adapter <name> <action-key> [--token <t>] --payload <file|->`.
81
+ *
82
+ * One implementation for every entry in {@link ADAPTER_CLIS}: the name and the
83
+ * entry are arguments, and everything this function does (the flags, the
84
+ * payload read, the identity check, the vault, the exit table) is the same
85
+ * whichever adapter is on the other end. What differs between adapters is the
86
+ * contract's business, and the contract is not here.
87
+ */
88
+ export declare function commandAdapterExecute(name: string, entry: AdapterCliEntry, argv: string[], streams: Streams, cwd: string): Promise<number>;
89
+ /** `approval adapter <name>` — resolve the name through {@link ADAPTER_CLIS}. */
90
+ export declare function commandAdapter(argv: string[], streams: Streams, cwd: string): Promise<number>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `approval adapter <name>` — execute an approved action through the adapter
2
+ * `approval adapter <name>` — execute an action through the adapter
3
3
  * contract (SPEC.md §10.4; APRV-69, generalized in APRV-221).
4
4
  *
5
5
  * This is the CLI face of the adapters in {@link ADAPTER_CLIS} (`email` at
@@ -15,7 +15,7 @@
15
15
  * that reimplemented any of them would be a second implementation of the rule.
16
16
  *
17
17
  * **Why the payload is a file (or stdin) and never a flag.** The bytes are the
18
- * thing the grant approved, they routinely contain newlines, quotes and a
18
+ * thing the grant or registered declaration bound, they routinely contain newlines, quotes and a
19
19
  * £-sign, and a message body on a command line is a message body in the shell
20
20
  * history and in `ps` output. `approval payload hash <file|->` and
21
21
  * `approval request --payload <file>` take the same argument in the same form,
@@ -37,21 +37,22 @@
37
37
  * | Situation | Code |
38
38
  * |---|---|
39
39
  * | the message was accepted by the far side | 0 |
40
- * | usage: a missing flag, a bad identity, an unparseable payload | 2 |
40
+ * | usage: a missing required flag, a bad identity, an unparseable payload | 2 |
41
41
  * | I/O: the payload file or the log could not be read | 4 |
42
42
  * | `token-required` — no token was presented | 5 |
43
43
  * | `log-torn-tail`, or an append that hit a torn tail | 3 |
44
44
  * | anything else the runtime decided: `token-mismatch`, `token-consumed`, `payload-mismatch`, `adapter-class-mismatch`, `adapter-precheck-refused` (a drifted draft), `adapter-failed` (an SMTP refusal), `adapter-act-threw` | 1 |
45
45
  *
46
- * A refused SEND is exit 1 and not 5: the command was well-formed, the token was
47
- * good, and the answer from the world was no. Only the absence of a valid token
48
- * earns 5, which is the distinction `run` already draws and the one an agent's
49
- * retry logic keys on.
46
+ * A refused SEND is exit 1 and not 5: the command was well-formed and the
47
+ * answer from the world was no. Exit 5 is the manual-path redirection to obtain
48
+ * a grant token, which is the distinction `run` already draws and the one an
49
+ * agent's retry logic keys on.
50
50
  */
51
51
  import { readFileSync } from "node:fs";
52
52
  import { isAbsolute, resolve as resolvePathSegments } from "node:path";
53
53
  import { agentmailAdapter } from "../adapters/agentmail.js";
54
54
  import { emailAdapter } from "../adapters/email.js";
55
+ import { zzzAdapter } from "../adapters/zzz.js";
55
56
  import { vaultCredentialProvider } from "../adapters/vault-provider.js";
56
57
  import { executeThroughAdapter, } from "../adapters/contract.js";
57
58
  import { HUMAN_ACTOR_ENV, resolveHumanActor } from "../core/attest.js";
@@ -61,7 +62,7 @@ import { passphraseEnvFor, vaultPathFor } from "../core/vault.js";
61
62
  import { boolFlag, parseFlags, stringFlag } from "./args.js";
62
63
  import { EXIT_INTEGRITY, EXIT_IO, EXIT_OK, EXIT_USAGE } from "./exit-codes.js";
63
64
  import { executeRefusalExitCode } from "./execute.js";
64
- import { ADAPTER_AGENTMAIL_HELP, ADAPTER_EMAIL_HELP, ADAPTER_HELP } from "./help.js";
65
+ import { ADAPTER_AGENTMAIL_HELP, ADAPTER_EMAIL_HELP, ADAPTER_HELP, ADAPTER_ZZZ_HELP } from "./help.js";
65
66
  import { DEFAULT_LOG_PATH, resolvePath } from "./paths.js";
66
67
  import { refusal as renderRefusal, style } from "./style.js";
67
68
  import { usageErrorText } from "./usage.js";
@@ -84,6 +85,10 @@ export const ADAPTER_CLIS = {
84
85
  help: ADAPTER_AGENTMAIL_HELP,
85
86
  build: (options) => agentmailAdapter(options),
86
87
  },
88
+ zzz: {
89
+ help: ADAPTER_ZZZ_HELP,
90
+ build: (options) => zzzAdapter(options),
91
+ },
87
92
  };
88
93
  /** The known names, sorted, for a usage error and for the help text. */
89
94
  export function knownAdapterNames() {
@@ -93,7 +98,7 @@ export function knownAdapterNames() {
93
98
  const PRINCIPAL_ACTOR = /^(human|agent):.+/u;
94
99
  /**
95
100
  * The flags every adapter verb takes. One set and not one per adapter: what the
96
- * runtime needs in order to execute an approved action (the token, the bytes,
101
+ * runtime needs in order to execute an action (the optional token, the bytes,
97
102
  * the identity, the log, the vault) is the same question whoever answers it,
98
103
  * and a per-adapter flag table would be a per-adapter way to drift from
99
104
  * `approval run`. An adapter with a flag of its own adds it here, beside these.
@@ -143,7 +148,7 @@ function refusalExit(result) {
143
148
  return result.execute === undefined ? EXIT_INTEGRITY : executeRefusalExitCode(result.execute);
144
149
  }
145
150
  /**
146
- * `approval adapter <name> <action-key> --token <t> --payload <file|->`.
151
+ * `approval adapter <name> <action-key> [--token <t>] --payload <file|->`.
147
152
  *
148
153
  * One implementation for every entry in {@link ADAPTER_CLIS}: the name and the
149
154
  * entry are arguments, and everything this function does (the flags, the
@@ -170,13 +175,14 @@ export async function commandAdapterExecute(name, entry, argv, streams, cwd) {
170
175
  if (extra !== undefined) {
171
176
  return usageError(streams, json, `unexpected argument ${JSON.stringify(extra)}`, help);
172
177
  }
178
+ // Optional for the same reason it is optional on `approval run`: the core
179
+ // admits an explicitly policy-authorized supervised/autonomous execution
180
+ // without minting a grant. Manual and selected-live paths still reach
181
+ // `startExecution` and refuse `token-required`; this CLI never invents one.
173
182
  const token = stringFlag(flags, "--token");
174
- if (token === null) {
175
- return usageError(streams, json, "missing --token <t>: an adapter executes only against the single-use token `approval grant` printed", help);
176
- }
177
183
  const payloadFlag = stringFlag(flags, "--payload");
178
184
  if (payloadFlag === null) {
179
- return usageError(streams, json, "missing --payload <file|->: the bytes the grant approved. There is no flag that takes the message inline — a body on a command line is a body in the shell history", help);
185
+ return usageError(streams, json, "missing --payload <file|->: the bytes the grant or registered declaration bound. There is no flag that takes the message inline — a body on a command line is a body in the shell history", help);
180
186
  }
181
187
  const asFlag = stringFlag(flags, "--as");
182
188
  const actor = asFlag === null ? resolveHumanActor() : asFlag;
@@ -233,7 +239,11 @@ export async function commandAdapterExecute(name, entry, argv, streams, cwd) {
233
239
  // this and keeps the old behaviour exactly.
234
240
  envFilePath: envFilePathFor(logPath),
235
241
  });
236
- const result = await executeThroughAdapter(entry.build(timeoutMs === null ? {} : { timeoutMs }), { logPath, actionKey, payload, actor }, { token, policy: policyLocation, credentials });
242
+ const result = await executeThroughAdapter(entry.build(timeoutMs === null ? {} : { timeoutMs }), { logPath, actionKey, payload, actor }, {
243
+ ...(token === null ? {} : { token }),
244
+ policy: policyLocation,
245
+ credentials,
246
+ });
237
247
  if (!result.ok) {
238
248
  if (json)
239
249
  streams.err(`${JSON.stringify(result)}\n`);
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../src/cli/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EACL,qBAAqB,GAItB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBA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C,CAAC;IAC3B,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAErC,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,6CAA6C,EAAE,YAAY,CAAC,CAAC;IAChG,CAAC;IACD,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;QACvD,OAAO,CAAC,GAAG,CAAC,GAAG,YAAY,IAAI,CAAC,CAAC;QACjC,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,2EAA2E;IAC3E,2EAA2E;IAC3E,4EAA4E;IAC5E,6EAA6E;IAC7E,wDAAwD;IACxD,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/E,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,qBAAqB,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IACtF,OAAO,UAAU,CACf,OAAO,EACP,IAAI,EACJ,mBAAmB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,8CAA8C,iBAAiB,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EACpH,YAAY,CACb,CAAC;AACJ,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * `approval policy amend` (APRV-30) — the one verb that owns the whole
3
+ * amendment ceremony: diff, advise, confirm, attest, commit.
4
+ *
5
+ * ## The two incidents this verb exists to prevent
6
+ *
7
+ * **seq 2 of this repository's own log — the seven-minute amendment.** A
8
+ * policy edit was attested and superseded seven minutes later (seq 2 at
9
+ * 11:56:07Z, seq 3 at 12:03:35Z), because the
10
+ * edit broke a pinned dogfood assertion and nobody found out until the test
11
+ * suite ran. The operator attested bytes whose *consequences* had never been
12
+ * shown to them. `amend` shows the semantic diff and the load advisory BEFORE
13
+ * asking for the sign-off, so the failure that superseded seq 2 would have been
14
+ * on screen while the human was deciding — and with `--require-load` it would
15
+ * have refused to attest at all.
16
+ *
17
+ * **The unsigned interregnum — commit `f829e6c` and its attestation.** The
18
+ * policy-editing commit and the attestation that made the edit operative landed
19
+ * as two separate commits. In between, the repository carried an inoperative
20
+ * policy: `checkAttestation` said `hash-mismatch` and every gate operation
21
+ * refused. `amend` closes that window by making the attestation and the git
22
+ * commit one ceremony — it prints, or with `--commit` runs, the exact two-file
23
+ * `git add` + `git commit` that lands the policy edit and its attestation
24
+ * together, and it validates the `--commit` preconditions BEFORE it attests, so
25
+ * a refusal can never leave a half-finished amendment behind.
26
+ *
27
+ * ## The baseline problem, stated plainly (FLAGGED FOR HUMAN REVIEW)
28
+ *
29
+ * A semantic diff needs the previously-attested policy *text*. The log does not
30
+ * have it. An attestation records only the SHA-256 of the bytes — deliberately,
31
+ * since the log is meant to be exported and copied and a policy body in it
32
+ * would be a second source of truth. So the attested bytes are **not
33
+ * recoverable from the log**, and this verb does not pretend otherwise.
34
+ *
35
+ * What it does instead, at v0.1: when the policy file lives in a git
36
+ * repository, it recovers `HEAD:<path>` and hashes it. **Only if that blob's
37
+ * hash equals the attested hash** is it used as the diff baseline — the point
38
+ * being that we can then prove the text we are diffing against is exactly the
39
+ * text that was signed for. Anything else (not a git repo, no such blob, or a
40
+ * blob whose hash differs from the attestation) drops to **hash-only mode**: a
41
+ * loud notice that the semantic diff is unavailable, followed by the load
42
+ * advisory and the attestation, which still work. No `--baseline` flag is
43
+ * offered; a baseline the operator supplies by hand is a baseline nobody can
44
+ * verify, which is exactly the assurance this design refuses to fake.
45
+ *
46
+ * The limitation is real and worth a human's judgment: an amendment made
47
+ * outside git, or one made on top of an unattested working-tree edit, gets no
48
+ * semantic diff. Flagged rather than smoothed over.
49
+ *
50
+ * ## What this file does and does not decide
51
+ *
52
+ * As everywhere else in the CLI: the diff is `core/policy-diff.ts`, loading is
53
+ * `core/policy-load.ts`, matching is `core/policy-match.ts`, hashing and the
54
+ * append are `core/attest.ts`. This file resolves paths and identity, shells out
55
+ * to git, decides exit codes, and formats output.
56
+ */
57
+ import type { Streams } from "./main.js";
58
+ /** `approval policy amend …` — the whole ceremony, in one verb. */
59
+ export declare function commandPolicyAmend(argv: string[], streams: Streams, cwd: string): number;