approval-md 0.1.0 → 0.3.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 (416) hide show
  1. package/README.md +629 -559
  2. package/SPEC.md +99 -24
  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 +656 -0
  27. package/dist/src/channels/contract.js +200 -7
  28. package/dist/src/channels/contract.js.map +1 -1
  29. package/dist/src/channels/payload-view.d.ts +35 -0
  30. package/dist/src/channels/render-queue.d.ts +149 -0
  31. package/dist/src/channels/tagging.d.ts +196 -0
  32. package/dist/src/channels/telegram.d.ts +1944 -0
  33. package/dist/src/channels/telegram.js +218 -23
  34. package/dist/src/channels/telegram.js.map +1 -1
  35. package/dist/src/channels/web.d.ts +350 -0
  36. package/dist/src/channels/web.js +17 -0
  37. package/dist/src/channels/web.js.map +1 -1
  38. package/dist/src/cli/adapter.d.ts +90 -0
  39. package/dist/src/cli/adapter.js +25 -15
  40. package/dist/src/cli/adapter.js.map +1 -1
  41. package/dist/src/cli/amend.d.ts +59 -0
  42. package/dist/src/cli/amend.js +214 -30
  43. package/dist/src/cli/amend.js.map +1 -1
  44. package/dist/src/cli/args.d.ts +43 -0
  45. package/dist/src/cli/attest.d.ts +50 -0
  46. package/dist/src/cli/attest.js +134 -7
  47. package/dist/src/cli/attest.js.map +1 -1
  48. package/dist/src/cli/audit-card.d.ts +62 -0
  49. package/dist/src/cli/audit.d.ts +59 -0
  50. package/dist/src/cli/channel-telegram.d.ts +879 -0
  51. package/dist/src/cli/channel-telegram.js +311 -13
  52. package/dist/src/cli/channel-telegram.js.map +1 -1
  53. package/dist/src/cli/channel-web.d.ts +131 -0
  54. package/dist/src/cli/channel.d.ts +80 -0
  55. package/dist/src/cli/channel.js +9 -0
  56. package/dist/src/cli/channel.js.map +1 -1
  57. package/dist/src/cli/checkpoint-tap.d.ts +169 -0
  58. package/dist/src/cli/codex-bridge.d.ts +819 -0
  59. package/dist/src/cli/codex-bridge.js +1607 -0
  60. package/dist/src/cli/codex-bridge.js.map +1 -0
  61. package/dist/src/cli/codex.d.ts +2 -0
  62. package/dist/src/cli/codex.js +469 -0
  63. package/dist/src/cli/codex.js.map +1 -0
  64. package/dist/src/cli/coverage.d.ts +61 -0
  65. package/dist/src/cli/daemon.d.ts +120 -0
  66. package/dist/src/cli/daemon.js +4 -1
  67. package/dist/src/cli/daemon.js.map +1 -1
  68. package/dist/src/cli/doctor.d.ts +129 -0
  69. package/dist/src/cli/doctor.js +586 -17
  70. package/dist/src/cli/doctor.js.map +1 -1
  71. package/dist/src/cli/env.d.ts +65 -0
  72. package/dist/src/cli/execute.d.ts +202 -0
  73. package/dist/src/cli/execute.js +25 -2
  74. package/dist/src/cli/execute.js.map +1 -1
  75. package/dist/src/cli/exit-codes.d.ts +73 -0
  76. package/dist/src/cli/feedback.d.ts +60 -0
  77. package/dist/src/cli/gate-window.d.ts +40 -0
  78. package/dist/src/cli/gate.d.ts +68 -0
  79. package/dist/src/cli/git-scope.d.ts +190 -0
  80. package/dist/src/cli/gloss-attach.d.ts +85 -0
  81. package/dist/src/cli/gloss-codex-child.d.ts +9 -0
  82. package/dist/src/cli/gloss-codex.d.ts +24 -0
  83. package/dist/src/cli/gloss-options.d.ts +42 -0
  84. package/dist/src/cli/gloss.d.ts +265 -0
  85. package/dist/src/cli/help.d.ts +107 -0
  86. package/dist/src/cli/help.js +320 -93
  87. package/dist/src/cli/help.js.map +1 -1
  88. package/dist/src/cli/hook-codex.d.ts +126 -0
  89. package/dist/src/cli/hook-codex.js +226 -0
  90. package/dist/src/cli/hook-codex.js.map +1 -0
  91. package/dist/src/cli/hook.d.ts +787 -0
  92. package/dist/src/cli/hook.js +1235 -181
  93. package/dist/src/cli/hook.js.map +1 -1
  94. package/dist/src/cli/import.d.ts +35 -0
  95. package/dist/src/cli/import.js +1 -1
  96. package/dist/src/cli/import.js.map +1 -1
  97. package/dist/src/cli/init.d.ts +84 -0
  98. package/dist/src/cli/init.js +2 -2
  99. package/dist/src/cli/init.js.map +1 -1
  100. package/dist/src/cli/instructions.d.ts +23 -0
  101. package/dist/src/cli/journal.d.ts +41 -0
  102. package/dist/src/cli/log-advance.d.ts +287 -0
  103. package/dist/src/cli/log-advance.js +102 -11
  104. package/dist/src/cli/log-advance.js.map +1 -1
  105. package/dist/src/cli/log-anchor.d.ts +176 -0
  106. package/dist/src/cli/log-checkpoint.d.ts +22 -0
  107. package/dist/src/cli/log-sync.d.ts +243 -0
  108. package/dist/src/cli/log-verbs.d.ts +16 -0
  109. package/dist/src/cli/log-verbs.js +7 -1
  110. package/dist/src/cli/log-verbs.js.map +1 -1
  111. package/dist/src/cli/long-help.d.ts +70 -0
  112. package/dist/src/cli/main.d.ts +77 -0
  113. package/dist/src/cli/main.js +159 -7
  114. package/dist/src/cli/main.js.map +1 -1
  115. package/dist/src/cli/mcp.d.ts +52 -0
  116. package/dist/src/cli/paths.d.ts +56 -0
  117. package/dist/src/cli/payload.d.ts +58 -0
  118. package/dist/src/cli/policy-apply.d.ts +195 -0
  119. package/dist/src/cli/policy-apply.js +573 -0
  120. package/dist/src/cli/policy-apply.js.map +1 -0
  121. package/dist/src/cli/policy.d.ts +43 -0
  122. package/dist/src/cli/policy.js +14 -1
  123. package/dist/src/cli/policy.js.map +1 -1
  124. package/dist/src/cli/preflight.d.ts +501 -0
  125. package/dist/src/cli/preflight.js +689 -45
  126. package/dist/src/cli/preflight.js.map +1 -1
  127. package/dist/src/cli/progress.d.ts +78 -0
  128. package/dist/src/cli/prompt.d.ts +209 -0
  129. package/dist/src/cli/quickstart.d.ts +46 -0
  130. package/dist/src/cli/quickstart.js +297 -0
  131. package/dist/src/cli/quickstart.js.map +1 -0
  132. package/dist/src/cli/records.d.ts +34 -0
  133. package/dist/src/cli/render.d.ts +22 -0
  134. package/dist/src/cli/sandbox.d.ts +51 -0
  135. package/dist/src/cli/sandbox.js +17 -1
  136. package/dist/src/cli/sandbox.js.map +1 -1
  137. package/dist/src/cli/scaffold.d.ts +79 -0
  138. package/dist/src/cli/scaffold.js +1 -1
  139. package/dist/src/cli/setup-adapter.d.ts +137 -0
  140. package/dist/src/cli/setup-adapter.js +38 -4
  141. package/dist/src/cli/setup-adapter.js.map +1 -1
  142. package/dist/src/cli/setup-channel.d.ts +126 -0
  143. package/dist/src/cli/setup-channel.js +28 -1
  144. package/dist/src/cli/setup-channel.js.map +1 -1
  145. package/dist/src/cli/setup-checkpoint.d.ts +57 -0
  146. package/dist/src/cli/setup-common.d.ts +277 -0
  147. package/dist/src/cli/setup-common.js +3 -2
  148. package/dist/src/cli/setup-common.js.map +1 -1
  149. package/dist/src/cli/setup-flow.d.ts +287 -0
  150. package/dist/src/cli/setup-service.d.ts +96 -0
  151. package/dist/src/cli/setup.d.ts +204 -0
  152. package/dist/src/cli/setup.js +94 -2
  153. package/dist/src/cli/setup.js.map +1 -1
  154. package/dist/src/cli/style.d.ts +320 -0
  155. package/dist/src/cli/token.d.ts +39 -0
  156. package/dist/src/cli/up.d.ts +155 -0
  157. package/dist/src/cli/up.js +119 -53
  158. package/dist/src/cli/up.js.map +1 -1
  159. package/dist/src/cli/usage.d.ts +37 -0
  160. package/dist/src/cli/values.d.ts +40 -0
  161. package/dist/src/cli/values.js +3 -4
  162. package/dist/src/cli/values.js.map +1 -1
  163. package/dist/src/cli/vault.d.ts +59 -0
  164. package/dist/src/cli/vault.js +2 -2
  165. package/dist/src/cli/vault.js.map +1 -1
  166. package/dist/src/cli/verb-registry.d.ts +76 -0
  167. package/dist/src/cli/verb-registry.js +344 -11
  168. package/dist/src/cli/verb-registry.js.map +1 -1
  169. package/dist/src/cli/wordmark.d.ts +31 -0
  170. package/dist/src/cli/wordmark.js +2 -2
  171. package/dist/src/codex/broker.d.ts +229 -0
  172. package/dist/src/codex/broker.js +548 -0
  173. package/dist/src/codex/broker.js.map +1 -0
  174. package/dist/src/codex/doctor.d.ts +13 -0
  175. package/dist/src/codex/doctor.js +41 -0
  176. package/dist/src/codex/doctor.js.map +1 -0
  177. package/dist/src/codex/manifest.d.ts +49 -0
  178. package/dist/src/codex/manifest.js +103 -0
  179. package/dist/src/codex/manifest.js.map +1 -0
  180. package/dist/src/codex/runner.d.ts +178 -0
  181. package/dist/src/codex/runner.js +231 -0
  182. package/dist/src/codex/runner.js.map +1 -0
  183. package/dist/src/codex/serve.d.ts +56 -0
  184. package/dist/src/codex/serve.js +98 -0
  185. package/dist/src/codex/serve.js.map +1 -0
  186. package/dist/src/codex/templates.d.ts +41 -0
  187. package/dist/src/codex/templates.js +319 -0
  188. package/dist/src/codex/templates.js.map +1 -0
  189. package/dist/src/codex/trust.d.ts +19 -0
  190. package/dist/src/codex/trust.js +183 -0
  191. package/dist/src/codex/trust.js.map +1 -0
  192. package/dist/src/codex/workspace-commit.d.ts +219 -0
  193. package/dist/src/codex/workspace-commit.js +549 -0
  194. package/dist/src/codex/workspace-commit.js.map +1 -0
  195. package/dist/src/codex/workspace-plan.d.ts +131 -0
  196. package/dist/src/codex/workspace-plan.js +561 -0
  197. package/dist/src/codex/workspace-plan.js.map +1 -0
  198. package/dist/src/core/actor.d.ts +2 -0
  199. package/dist/src/core/actor.js +5 -0
  200. package/dist/src/core/actor.js.map +1 -0
  201. package/dist/src/core/advance-cycle.d.ts +221 -0
  202. package/dist/src/core/advance-cycle.js +66 -2
  203. package/dist/src/core/advance-cycle.js.map +1 -1
  204. package/dist/src/core/agents-md.d.ts +278 -0
  205. package/dist/src/core/agents-md.js +33 -31
  206. package/dist/src/core/agents-md.js.map +1 -1
  207. package/dist/src/core/apply-patch.d.ts +49 -0
  208. package/dist/src/core/apply-patch.js +266 -0
  209. package/dist/src/core/apply-patch.js.map +1 -0
  210. package/dist/src/core/attest.d.ts +635 -0
  211. package/dist/src/core/attest.js +326 -4
  212. package/dist/src/core/attest.js.map +1 -1
  213. package/dist/src/core/audit.d.ts +510 -0
  214. package/dist/src/core/audit.js +13 -0
  215. package/dist/src/core/audit.js.map +1 -1
  216. package/dist/src/core/budgets.d.ts +238 -0
  217. package/dist/src/core/channel-owner.d.ts +213 -0
  218. package/dist/src/core/channel-owner.js +358 -0
  219. package/dist/src/core/channel-owner.js.map +1 -0
  220. package/dist/src/core/checkpoint.d.ts +500 -0
  221. package/dist/src/core/child-env.d.ts +88 -0
  222. package/dist/src/core/clock.d.ts +52 -0
  223. package/dist/src/core/command-class.d.ts +697 -0
  224. package/dist/src/core/command-class.js +713 -25
  225. package/dist/src/core/command-class.js.map +1 -1
  226. package/dist/src/core/commit-guard.d.ts +272 -0
  227. package/dist/src/core/commit-guard.js +424 -0
  228. package/dist/src/core/commit-guard.js.map +1 -0
  229. package/dist/src/core/coverage-sources/adapter.d.ts +40 -0
  230. package/dist/src/core/coverage-sources/gh.d.ts +48 -0
  231. package/dist/src/core/coverage-sources/git.d.ts +101 -0
  232. package/dist/src/core/coverage.d.ts +217 -0
  233. package/dist/src/core/credential-spec.d.ts +72 -0
  234. package/dist/src/core/daemon-actor.d.ts +45 -0
  235. package/dist/src/core/daemon-actor.js +54 -0
  236. package/dist/src/core/daemon-actor.js.map +1 -0
  237. package/dist/src/core/dark-session.d.ts +432 -0
  238. package/dist/src/core/dark-session.js +266 -82
  239. package/dist/src/core/dark-session.js.map +1 -1
  240. package/dist/src/core/decision-refusal.d.ts +206 -0
  241. package/dist/src/core/decision-refusal.js +24 -2
  242. package/dist/src/core/decision-refusal.js.map +1 -1
  243. package/dist/src/core/env-file.d.ts +455 -0
  244. package/dist/src/core/env-file.js +60 -1
  245. package/dist/src/core/env-file.js.map +1 -1
  246. package/dist/src/core/execute.d.ts +871 -0
  247. package/dist/src/core/execute.js +59 -8
  248. package/dist/src/core/execute.js.map +1 -1
  249. package/dist/src/core/frontmatter.d.ts +78 -0
  250. package/dist/src/core/gate-window.d.ts +312 -0
  251. package/dist/src/core/gate.d.ts +1449 -0
  252. package/dist/src/core/gate.js +149 -14
  253. package/dist/src/core/gate.js.map +1 -1
  254. package/dist/src/core/gesture-refusal.d.ts +166 -0
  255. package/dist/src/core/gesture-refusal.js +188 -0
  256. package/dist/src/core/gesture-refusal.js.map +1 -0
  257. package/dist/src/core/git-run.d.ts +73 -0
  258. package/dist/src/core/harness-version.d.ts +157 -0
  259. package/dist/src/core/harness-version.js +4 -1
  260. package/dist/src/core/harness-version.js.map +1 -1
  261. package/dist/src/core/harness-wait.d.ts +55 -0
  262. package/dist/src/core/head-retry.d.ts +107 -0
  263. package/dist/src/core/instance.d.ts +310 -0
  264. package/dist/src/core/instance.js +113 -0
  265. package/dist/src/core/instance.js.map +1 -1
  266. package/dist/src/core/intake-limits.d.ts +247 -0
  267. package/dist/src/core/jcs.d.ts +52 -0
  268. package/dist/src/core/journal.d.ts +144 -0
  269. package/dist/src/core/live-draw.d.ts +436 -0
  270. package/dist/src/core/log-reconcile.d.ts +89 -0
  271. package/dist/src/core/log-subscribe.d.ts +36 -0
  272. package/dist/src/core/log-subscribe.js +162 -0
  273. package/dist/src/core/log-subscribe.js.map +1 -0
  274. package/dist/src/core/log.d.ts +316 -0
  275. package/dist/src/core/log.js.map +1 -1
  276. package/dist/src/core/loop.d.ts +274 -0
  277. package/dist/src/core/loop.js +11 -0
  278. package/dist/src/core/loop.js.map +1 -1
  279. package/dist/src/core/md-fence.d.ts +41 -0
  280. package/dist/src/core/money.d.ts +147 -0
  281. package/dist/src/core/payload-census.d.ts +74 -0
  282. package/dist/src/core/payload-store.d.ts +175 -0
  283. package/dist/src/core/payload.d.ts +71 -0
  284. package/dist/src/core/policy-diff.d.ts +292 -0
  285. package/dist/src/core/policy-diff.js +27 -4
  286. package/dist/src/core/policy-diff.js.map +1 -1
  287. package/dist/src/core/policy-expectations.d.ts +199 -0
  288. package/dist/src/core/policy-explain.d.ts +160 -0
  289. package/dist/src/core/policy-explain.js +63 -3
  290. package/dist/src/core/policy-explain.js.map +1 -1
  291. package/dist/src/core/policy-load.d.ts +567 -0
  292. package/dist/src/core/policy-load.js +36 -6
  293. package/dist/src/core/policy-load.js.map +1 -1
  294. package/dist/src/core/policy-match.d.ts +324 -0
  295. package/dist/src/core/policy-match.js +72 -9
  296. package/dist/src/core/policy-match.js.map +1 -1
  297. package/dist/src/core/policy-proposal.d.ts +317 -0
  298. package/dist/src/core/policy-proposal.js +102 -2
  299. package/dist/src/core/policy-proposal.js.map +1 -1
  300. package/dist/src/core/prompt-layout.d.ts +221 -0
  301. package/dist/src/core/protected-path-guard.d.ts +566 -0
  302. package/dist/src/core/protected-path-guard.js +848 -55
  303. package/dist/src/core/protected-path-guard.js.map +1 -1
  304. package/dist/src/core/question-preempted.d.ts +141 -0
  305. package/dist/src/core/question-preempted.js +152 -0
  306. package/dist/src/core/question-preempted.js.map +1 -0
  307. package/dist/src/core/read-scope.d.ts +172 -0
  308. package/dist/src/core/read-scope.js +252 -0
  309. package/dist/src/core/read-scope.js.map +1 -0
  310. package/dist/src/core/registration.d.ts +25 -0
  311. package/dist/src/core/reindex.d.ts +99 -0
  312. package/dist/src/core/sampler.d.ts +313 -0
  313. package/dist/src/core/sandbox.d.ts +371 -0
  314. package/dist/src/core/sandbox.js +190 -1
  315. package/dist/src/core/sandbox.js.map +1 -1
  316. package/dist/src/core/seal.d.ts +165 -0
  317. package/dist/src/core/sender-identity.d.ts +476 -0
  318. package/dist/src/core/sender-identity.js +572 -0
  319. package/dist/src/core/sender-identity.js.map +1 -0
  320. package/dist/src/core/shlex.d.ts +102 -0
  321. package/dist/src/core/shlex.js +159 -0
  322. package/dist/src/core/shlex.js.map +1 -0
  323. package/dist/src/core/state.d.ts +505 -0
  324. package/dist/src/core/task-file.d.ts +185 -0
  325. package/dist/src/core/telegram-config.d.ts +93 -0
  326. package/dist/src/core/token.d.ts +409 -0
  327. package/dist/src/core/token.js +21 -38
  328. package/dist/src/core/token.js.map +1 -1
  329. package/dist/src/core/validate.d.ts +138 -0
  330. package/dist/src/core/values.d.ts +147 -0
  331. package/dist/src/core/values.js +36 -1
  332. package/dist/src/core/values.js.map +1 -1
  333. package/dist/src/core/vault.d.ts +291 -0
  334. package/dist/src/core/verified-snapshot.d.ts +204 -0
  335. package/dist/src/core/verify.d.ts +336 -0
  336. package/dist/src/core/version.d.ts +8 -0
  337. package/dist/src/core/wysiwys.d.ts +370 -0
  338. package/dist/src/daemon/advance-child.d.ts +39 -0
  339. package/dist/src/daemon/advance.d.ts +476 -0
  340. package/dist/src/daemon/advance.js +25 -4
  341. package/dist/src/daemon/advance.js.map +1 -1
  342. package/dist/src/daemon/audit.d.ts +87 -0
  343. package/dist/src/daemon/daemon.d.ts +1180 -0
  344. package/dist/src/daemon/daemon.js +9 -0
  345. package/dist/src/daemon/daemon.js.map +1 -1
  346. package/dist/src/daemon/dark-session.d.ts +64 -0
  347. package/dist/src/daemon/draw-child.d.ts +36 -0
  348. package/dist/src/daemon/draw.d.ts +154 -0
  349. package/dist/src/daemon/git-evidence.d.ts +173 -0
  350. package/dist/src/daemon/git-evidence.js +1 -1
  351. package/dist/src/daemon/projection.d.ts +180 -0
  352. package/dist/src/daemon/prune.d.ts +207 -0
  353. package/dist/src/mcp/http.d.ts +113 -0
  354. package/dist/src/mcp/server.d.ts +265 -0
  355. package/dist/src/mcp/server.js +17 -1
  356. package/dist/src/mcp/server.js.map +1 -1
  357. package/docs/adapter-api.md +106 -0
  358. package/docs/cli-reference.md +1316 -63
  359. package/docs/codex-enforced-session.md +103 -0
  360. package/docs/codex-workspace-broker.md +118 -0
  361. package/package.json +14 -2
  362. package/schema/codex-instance.schema.json +82 -0
  363. package/schema/event.schema.json +539 -9
  364. package/schema/fixtures/codex-instance/invalid/unpinned-codex-version.json +40 -0
  365. package/schema/fixtures/codex-instance/valid/canonical.json +40 -0
  366. package/schema/fixtures/event/invalid/approval-granted-sender-hashed-false.json +20 -0
  367. package/schema/fixtures/event/invalid/approval-granted-sender-hashed-raw-id.json +20 -0
  368. package/schema/fixtures/event/invalid/audit-gesture-refused-human-actor.json +16 -0
  369. package/schema/fixtures/event/invalid/audit-gesture-refused-no-actor-no-sender.json +15 -0
  370. package/schema/fixtures/event/invalid/audit-gesture-refused-unknown-gesture.json +16 -0
  371. package/schema/fixtures/event/invalid/audit-question-preempted-agent-actor.json +16 -0
  372. package/schema/fixtures/event/invalid/audit-question-preempted-no-question-id.json +16 -0
  373. package/schema/fixtures/event/invalid/audit-question-preempted-unknown-source.json +15 -0
  374. package/schema/fixtures/event/invalid/gate-path-signed-off-absolute-path.json +14 -0
  375. package/schema/fixtures/event/invalid/gate-path-signed-off-agent-actor.json +14 -0
  376. package/schema/fixtures/event/invalid/gate-path-signed-off-missing-path.json +13 -0
  377. package/schema/fixtures/event/valid/approval-granted-sender-hashed.json +20 -0
  378. package/schema/fixtures/event/valid/audit-gesture-refused-review-note.json +21 -0
  379. package/schema/fixtures/event/valid/audit-gesture-refused-sender-key-unavailable.json +19 -0
  380. package/schema/fixtures/event/valid/audit-gesture-refused.json +19 -0
  381. package/schema/fixtures/event/valid/audit-question-preempted-no-verdict.json +16 -0
  382. package/schema/fixtures/event/valid/audit-question-preempted.json +20 -0
  383. package/schema/fixtures/event/valid/gate-path-signed-off.json +14 -0
  384. package/schema/fixtures/event/valid/harness-kind-claude-code.json +23 -0
  385. package/schema/fixtures/event/valid/harness-kind-codex.json +23 -0
  386. package/schema/fixtures/event/valid/harness-kind-cursor.json +23 -0
  387. package/schema/fixtures/event/valid/harness-kind-grok.json +23 -0
  388. package/schema/fixtures/event/valid/harness-kind-muse.json +23 -0
  389. package/schema/fixtures/policy/invalid/senders-half-keyed.json +20 -0
  390. package/schema/fixtures/policy/valid/canonical.json +1 -1
  391. package/schema/fixtures/policy/valid/senders-keyed.json +24 -0
  392. package/schema/fixtures/policy-md/valid/canonical.md +1 -1
  393. package/schema/fixtures/policy-md/valid/with-values.md +5 -7
  394. package/schema/fixtures/values/invalid/class-shaped.json +1 -1
  395. package/schema/fixtures/values/invalid/duplicate-entry.json +1 -1
  396. package/schema/fixtures/values/invalid/non-string-item.json +1 -1
  397. package/schema/fixtures/values/invalid/over-cap.json +1 -1
  398. package/schema/fixtures/values/invalid/unknown-key.json +1 -1
  399. package/schema/fixtures/values/invalid/version-float.json +1 -0
  400. package/schema/fixtures/values/invalid/version-integer.json +1 -0
  401. package/schema/fixtures/values/invalid/version-wrong-string.json +1 -0
  402. package/schema/fixtures/values/valid/empty-lists.json +2 -3
  403. package/schema/fixtures/values/valid/full.json +5 -7
  404. package/schema/fixtures/values/valid/minimal.json +1 -1
  405. package/schema/fixtures/values-md/invalid/schema-invalid.md +5 -3
  406. package/schema/fixtures/values-md/invalid/two-blocks.md +3 -3
  407. package/schema/fixtures/values-md/invalid/unterminated.md +2 -2
  408. package/schema/fixtures/values-md/invalid/version-1.md +69 -0
  409. package/schema/fixtures/values-md/invalid/version-unquoted.md +64 -0
  410. package/schema/fixtures/values-md/invalid/yaml-error.md +2 -2
  411. package/schema/fixtures/values-md/valid/absent.md +1 -1
  412. package/schema/fixtures/values-md/valid/with-values.md +5 -7
  413. package/schema/policy.schema.json +75 -3
  414. package/schema/values.schema.json +7 -11
  415. package/templates/codex/README.md +9 -0
  416. package/schema/fixtures/values/invalid/version-string.json +0 -1
@@ -49,8 +49,11 @@
49
49
  * `channels/conformance.ts`.
50
50
  */
51
51
  import { recordRefusedDecision } from "../core/decision-refusal.js";
52
- import { decide } from "../core/gate.js";
53
- import { attestationKeySha256, decideAttestation, isAttestationActionKey, openProposalFor, proposalPolicyPath, } from "../core/policy-proposal.js";
52
+ import { decide, readGatePolicy, } from "../core/gate.js";
53
+ import { actorForSender, isChannelDecisionRefusalCode, mapsSendersFor, recordedSenderFor, senderKeyFrom, senderRefusalLine, sendersDiffer, } from "../core/sender-identity.js";
54
+ import { attestationKeySha256, decideAttestation, inForcePolicyText, isAttestationActionKey, openProposalFor, proposalPolicyPath, } from "../core/policy-proposal.js";
55
+ import { payloadStoreDirFor } from "../core/payload-store.js";
56
+ import { loadPolicyText } from "../core/policy-load.js";
54
57
  import { readVerifiedRecords } from "../core/state.js";
55
58
  import { tick } from "../core/clock.js";
56
59
  // ---------------------------------------------------------------------------
@@ -125,6 +128,13 @@ export const GLOSS_UNVERIFIED_SUFFIX = "(model, unverified)";
125
128
  * The wording of the first three is APRV-206's, moved here unchanged.
126
129
  */
127
130
  export function refusedDecisionLine(code) {
131
+ // APRV-324. The two the surface itself makes, worded where they are defined
132
+ // so one rule about what a refusal may disclose covers every channel: they
133
+ // name the code and nothing about the mapping — not who is mapped, not how
134
+ // many are, and not the id that was seen. The id is on the record, where an
135
+ // operator reads it deliberately; a chat is read by everyone in it.
136
+ if (isChannelDecisionRefusalCode(code))
137
+ return senderRefusalLine(code);
128
138
  if (code === "already-decided") {
129
139
  return "Already decided — the first answer stands; nothing was recorded.";
130
140
  }
@@ -137,6 +147,14 @@ export function refusedDecisionLine(code) {
137
147
  }
138
148
  if (code === "expired")
139
149
  return "Expired — the approval window has closed.";
150
+ // APRV-324 follow-up. The gate has always been able to return this; what
151
+ // changed is that a checkpoint signature and a review can too, because the
152
+ // sender mapping they resolve against is only in force once a human has
153
+ // attested the file it is written in. One sentence, every surface, and it
154
+ // names the repair rather than the check.
155
+ if (code === "policy-not-attested") {
156
+ return "Not recorded — APPROVAL.md has changed and nobody has attested it yet, so its rules are not in force. Re-attest it, or do this from a terminal.";
157
+ }
140
158
  // APRV-235, and the reason this helper exists. The distinction the line has to
141
159
  // carry is that nothing is wrong with the ACTION: the policy was re-attested
142
160
  // after the question was asked, so the rules on the approver's screen are not
@@ -340,7 +358,42 @@ export function recordChannelDecision(logPath, decision, actorOptions, gateOptio
340
358
  if (decision.batchDeliveryId !== undefined) {
341
359
  options.batchDeliveryId = decision.batchDeliveryId;
342
360
  }
343
- const result = decide(logPath, decision.action_key, decision.decision, actorOptions.actor, options);
361
+ // APRV-324. Every surface names itself on the record it writes, so a reader
362
+ // of a grant can tell a tap on a phone from a line typed into a terminal. The
363
+ // fallback matches `noteRefusedDecision`'s below.
364
+ options.channel = actorOptions.channel ?? "cli";
365
+ // APRV-324, and before anything is decided: the actor a decision is recorded
366
+ // under is chosen HERE, from the sender the transport authenticated and the
367
+ // mapping the operator attested, and the gate's own authorization logic is
368
+ // untouched by it. `namesApprover` and `actor-not-approver` then run exactly
369
+ // as they always have, over an identity that is better evidenced.
370
+ const resolution = actorForSender(readGatePolicy(gateOptions), actorOptions.actor, decision.sender,
371
+ // APRV-370. The operator's sender key, where the policy's mapping is keyed.
372
+ // `null` when it is unset, which is a REFUSAL of the whole channel rather
373
+ // than a fallback to the raw comparison; `sender-key-unavailable` carries
374
+ // the reasoning.
375
+ senderKeyFrom());
376
+ if (!resolution.ok) {
377
+ const refusal = {
378
+ ok: false,
379
+ code: resolution.code,
380
+ message: `decision on ${decision.action_key} refused: ${resolution.message}`,
381
+ };
382
+ // The refusal is the record. Nothing is decided, no token is minted, and
383
+ // the one append is the audit-tier statement that somebody tapped from an
384
+ // account this policy names nobody for — carrying the observed id, because
385
+ // an operator investigating who tried needs the number, and a transport
386
+ // account id is not a credential.
387
+ noteRefusedDecision(logPath, decision, { ...actorOptions, actor: null }, gateOptions, refusal, { sender: resolution.sender });
388
+ return { outcome: refusal };
389
+ }
390
+ const actor = resolution.actor;
391
+ if (resolution.sender !== undefined) {
392
+ options.sender = resolution.sender;
393
+ if (resolution.source !== undefined)
394
+ options.senderSource = resolution.source;
395
+ }
396
+ const result = decide(logPath, decision.action_key, decision.decision, actor, options);
344
397
  if (!result.ok) {
345
398
  // APRV-235. A human tapped and the gate would not take it. The gate itself
346
399
  // appends nothing on a refusal, by design; this surface knows something the
@@ -351,7 +404,24 @@ export function recordChannelDecision(logPath, decision, actorOptions, gateOptio
351
404
  // Best effort, deliberately last, and it changes nothing about what the
352
405
  // channel is handed back: the decision has already been refused, and a
353
406
  // failed audit append must not turn one refusal into two.
354
- noteRefusedDecision(logPath, decision, actorOptions, gateOptions, result);
407
+ noteRefusedDecision(logPath, decision, { ...actorOptions, actor }, gateOptions, result,
408
+ // APRV-324, and §11.1 invariant 9 is the reason for the exception. A
409
+ // `class-human-only` refusal says the policy does not transact in this
410
+ // class at all, so the runtime records no identity resolution for it: a
411
+ // refusal record naming the account a human-only tap came from would read
412
+ // afterwards as a class this gate resolves senders for. Every other
413
+ // refusal names the account, because the attention it accounts for was
414
+ // spent by whoever holds it.
415
+ // APRV-370: `resolution.sender`, never `decision.sender`. The resolution
416
+ // carries the sender in the form the record takes, which under a keyed
417
+ // mapping is the digest; writing the observed id here would put the raw
418
+ // account back in the log on exactly the refusals nobody looks at.
419
+ result.code === "class-human-only" || resolution.sender === undefined
420
+ ? {}
421
+ : {
422
+ sender: resolution.sender,
423
+ ...(resolution.source === undefined ? {} : { senderSource: resolution.source }),
424
+ });
355
425
  return { outcome: result };
356
426
  }
357
427
  const outcome = {
@@ -375,7 +445,7 @@ export function recordChannelDecision(logPath, decision, actorOptions, gateOptio
375
445
  * answer away from the human who is waiting for it. What a failure costs is the
376
446
  * record, which is exactly what the caller had before this existed.
377
447
  */
378
- function noteRefusedDecision(logPath, decision, actorOptions, gateOptions, refusal) {
448
+ function noteRefusedDecision(logPath, decision, actorOptions, gateOptions, refusal, sender = {}) {
379
449
  try {
380
450
  recordRefusedDecision(logPath, {
381
451
  actionKey: decision.action_key,
@@ -385,10 +455,13 @@ function noteRefusedDecision(logPath, decision, actorOptions, gateOptions, refus
385
455
  // local process, which is what a decision that reached the runtime
386
456
  // through no channel at all came through.
387
457
  channel: actorOptions.channel ?? "cli",
458
+ ...sender,
388
459
  }, {
389
460
  code: refusal.code,
390
461
  message: refusal.message,
391
- ...(refusal.drift === undefined ? {} : { drift: refusal.drift }),
462
+ // A surface-side refusal has made no policy comparison, so it carries no
463
+ // hashes; `in` rather than a cast, so the narrowing is the type system's.
464
+ ...("drift" in refusal && refusal.drift !== undefined ? { drift: refusal.drift } : {}),
392
465
  }, gateOptions);
393
466
  }
394
467
  catch {
@@ -437,6 +510,103 @@ function listenerPolicyPath(options) {
437
510
  return policy.file;
438
511
  return policy.dir === undefined ? null : proposalPolicyPath(policy.dir);
439
512
  }
513
+ /**
514
+ * Who may attest, from a phone, and under whose rules (APRV-324 follow-up,
515
+ * amended SPEC.md §10.3).
516
+ *
517
+ * ## Why this is not the decision rule
518
+ *
519
+ * A decision is resolved against the policy in force, and so is this — but for
520
+ * an attestation the two candidate policies are different documents, and the
521
+ * difference is the whole problem. The tap answers a prompt about the LIVE
522
+ * file, which is the amendment; the amendment may add, remove or repoint the
523
+ * `senders` mapping itself. Resolving against the proposed file would let
524
+ * whoever edited it name their own account as the approver of their own edit,
525
+ * which is a gate that authorizes its own widening. So the oracle is the policy
526
+ * IN FORCE — the bytes the latest attestation names — and never the bytes being
527
+ * attested.
528
+ *
529
+ * ## The ladder
530
+ *
531
+ * 1. **No sender.** The terminal and the web page, which authenticate nobody.
532
+ * Unchanged, and this is the path that keeps a repository recoverable: a
533
+ * `policy.core` edit happens at a terminal anyway, so no mapping, however
534
+ * broken, can strand the repair.
535
+ * 2. **In-force bytes recovered, and the amendment changes the mapping.** Only
536
+ * an account the IN-FORCE policy maps may answer. Where the policy in force
537
+ * maps nobody on this channel, nobody qualifies and the answer is
538
+ * `attest-requires-terminal`: an amendment that introduces the identity
539
+ * system cannot be signed for by the identity system it introduces.
540
+ * 3. **In-force bytes recovered, mapping unchanged.** The ordinary rule, run
541
+ * against the policy in force: mapped answers, unmapped is refused.
542
+ * 4. **In-force bytes NOT recovered.** They frequently are not — an attestation
543
+ * records only a digest, and a terminal attestation stores nothing
544
+ * ({@link inForcePolicyText} says so in full). Then the runtime cannot tell
545
+ * whether this amendment touches the mapping, so it refuses
546
+ * `attest-requires-terminal` whenever the PROPOSED policy maps senders for
547
+ * this channel, and otherwise behaves exactly as it did before this rule.
548
+ *
549
+ * The residual, stated rather than hidden: in case 4 an amendment that REMOVES
550
+ * a mapping is indistinguishable from a policy that never had one, so it falls
551
+ * to the pre-mapping behaviour. Closing that would need the in-force bytes,
552
+ * which is case 2; and reaching it requires an attacker who can already write
553
+ * `APPROVAL.md`, whom SPEC.md §11 already places inside the trust boundary.
554
+ */
555
+ function resolveAttestationSender(logPath, records, decision, actorOptions, gateOptions, policyPath) {
556
+ const sender = decision.sender;
557
+ if (sender === undefined)
558
+ return { ok: true, actor: actorOptions.actor };
559
+ // APRV-370. Resolved ONCE for this whole ladder: the operator's sender key,
560
+ // and with it the form the refusals below record the account in. The form
561
+ // follows the FILE and the mapping follows the ATTESTATION
562
+ // (`recordedSenderFor` carries the reasoning), so a refusal that never
563
+ // reaches the in-force mapping still honours the disclosure preference the
564
+ // operator wrote down, and grants nobody anything by doing so.
565
+ const key = senderKeyFrom();
566
+ const proposed = readGatePolicy(gateOptions);
567
+ // The same store `proposeAttestation` wrote the policy text to, resolved the
568
+ // same way, so the bytes a prompt displayed and the bytes this reads back are
569
+ // never two different files.
570
+ const inForce = inForcePolicyText(records, gateOptions.payloadStoreDir ?? payloadStoreDirFor(logPath));
571
+ if (!inForce.ok) {
572
+ if (!mapsSendersFor(proposed.ok ? proposed.policy.approvers : undefined, sender.channel)) {
573
+ return { ok: true, actor: actorOptions.actor };
574
+ }
575
+ return {
576
+ ok: false,
577
+ code: "attest-requires-terminal",
578
+ sender: recordedSenderFor(proposed, sender, key),
579
+ message: `the policy being attested maps ${sender.channel} senders and the policy IN FORCE cannot be read to check who may sign for that: ${inForce.reason}. Resolving this tap against the file it is attesting would let whoever wrote that file name the account that approves it, so nothing was attested. Attest from a terminal, which authenticates no sender and is where a policy.core edit happens anyway.`,
580
+ };
581
+ }
582
+ const before = loadPolicyText(policyPath ?? "APPROVAL.md", inForce.text, gateOptions.schemaDir === undefined ? {} : { schemaDir: gateOptions.schemaDir });
583
+ if (sendersDiffer(before, proposed)) {
584
+ if (!mapsSendersFor(before.ok ? before.policy.approvers : undefined, sender.channel)) {
585
+ return {
586
+ ok: false,
587
+ code: "attest-requires-terminal",
588
+ sender: recordedSenderFor(before, sender, key),
589
+ message: `this amendment changes the sender mapping, and the policy in force maps no ${sender.channel} sender, so there is no account it could recognize as entitled to sign for that change. An amendment that introduces the identity system cannot be signed for by the identity system it introduces. Nothing was attested; attest from a terminal.`,
590
+ };
591
+ }
592
+ const resolution = actorForSender(before, actorOptions.actor, sender, key);
593
+ if (!resolution.ok)
594
+ return resolution;
595
+ // A mapped account under the policy in force. Belt and braces on the mode
596
+ // the ladder above already excluded: an amendment that changes the mapping
597
+ // is never answered on the configured identity.
598
+ if (resolution.sender === undefined) {
599
+ return {
600
+ ok: false,
601
+ code: "attest-requires-terminal",
602
+ sender: recordedSenderFor(before, sender, key),
603
+ message: `this amendment changes the sender mapping and this tap resolved to no account under the policy in force. Nothing was attested; attest from a terminal.`,
604
+ };
605
+ }
606
+ return resolution;
607
+ }
608
+ return actorForSender(before, actorOptions.actor, sender, key);
609
+ }
440
610
  export function recordAttestationDecision(logPath, decision, actorOptions, gateOptions = {}) {
441
611
  const sha256 = attestationKeySha256(decision.action_key);
442
612
  if (sha256 === null) {
@@ -477,7 +647,30 @@ export function recordAttestationDecision(logPath, decision, actorOptions, gateO
477
647
  const policyPath = listenerPolicyPath(gateOptions);
478
648
  if (policyPath !== null)
479
649
  options.policyPath = policyPath;
480
- const result = decideAttestation(logPath, proposal.seq, decision.decision === "grant" ? "attest" : "decline", actorOptions.actor, options);
650
+ // APRV-324 follow-up. The privileged gesture, resolved last and most
651
+ // carefully: an attestation decides which rules are in force, and the rules
652
+ // it can decide include the sender mapping itself.
653
+ const resolved = resolveAttestationSender(logPath, read.records, decision, actorOptions, gateOptions, policyPath);
654
+ if (!resolved.ok) {
655
+ const refusal = {
656
+ ok: false,
657
+ code: resolved.code,
658
+ message: `attestation of ${sha256} refused: ${resolved.message}`,
659
+ };
660
+ // The same audit-tier record a refused decision writes, and it fits without
661
+ // straining: the attestation prompt HAS an action key the log carries
662
+ // (`policy.attest:<sha256>`), and the gesture IS one of the two decision
663
+ // words this event's payload admits, because that is exactly how a tap on a
664
+ // prompt is routed to `attest` or `decline` above.
665
+ noteRefusedDecision(logPath, decision, { ...actorOptions, actor: null }, gateOptions, refusal, { sender: resolved.sender });
666
+ return { outcome: refusal };
667
+ }
668
+ if (resolved.sender !== undefined) {
669
+ options.sender = resolved.sender;
670
+ if (resolved.source !== undefined)
671
+ options.senderSource = resolved.source;
672
+ }
673
+ const result = decideAttestation(logPath, proposal.seq, decision.decision === "grant" ? "attest" : "decline", resolved.actor, options);
481
674
  if (!result.ok)
482
675
  return { outcome: result };
483
676
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../src/channels/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAIH,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,MAAM,EAAwC,MAAM,iBAAiB,CAAC;AAE/E,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,kBAA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,CAAC,KAAK,EACd,OAAO,CACR,CAAC;IACF,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAE3C,OAAO;QACL,OAAO,EAAE;YACP,EAAE,EAAE,IAAI;YACR,UAAU,EAAE,QAAQ,CAAC,UAAU;YAC/B,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,KAAK,EAAE,QAAQ,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU;YAC7D,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,WAAW,EAAE,KAAK;SACnB;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * The channel-side facade over the canonical renderer (APRV-119).
3
+ *
4
+ * Everything this module used to hold — the email view (APRV-100), the diff view
5
+ * (APRV-124), the command view and its injective escape marking (APRV-126), the
6
+ * classifier-derived breakdown and protected-path lines (APRV-143, APRV-144) —
7
+ * now lives in `core/wysiwys.ts`, absorbed into {@link canonicalRender}. It
8
+ * moved because the gate consults it: `core/gate.ts` computes the
9
+ * `display_hash` a request records at the write boundary from the same function
10
+ * the channels render with, and core cannot import channels.
11
+ *
12
+ * What is left here is the one function that needs a channel type, plus the
13
+ * re-exports that keep every existing import path working. A channel imports
14
+ * this; nothing else does.
15
+ */
16
+ import type { PayloadRendering } from "./contract.js";
17
+ export * from "../core/wysiwys.js";
18
+ /**
19
+ * The text a channel puts inside its payload region (SPEC.md §10.4, §9).
20
+ *
21
+ * For a whole payload this is {@link canonicalRender}'s text verbatim, so the
22
+ * three channels present the same reading of the same bytes and the log's
23
+ * `display_hash` names it. Claimed material — the summary, the estimate, the
24
+ * rationale, a model's gloss — is never inside this region; each channel renders
25
+ * it above, under its own claimed heading.
26
+ *
27
+ * A **truncated** rendering has no canonical form and does not get one. The
28
+ * tagging layer cut `text` short at the caller's `maxPayloadChars`, so the bytes
29
+ * on screen are not the bytes the token will execute, and giving a partial
30
+ * payload the canonical block's authority is exactly the substitution WYSIWYS
31
+ * forbids. The pre-existing truncated text is returned unchanged, the channel's
32
+ * own "TRUNCATED — do not grant on it" marker still surrounds it, and
33
+ * `channels/batch.ts` still refuses to fold such a member into a batch.
34
+ */
35
+ export declare function payloadRegionText(rendering: PayloadRendering, actionClass: string): string;
@@ -0,0 +1,149 @@
1
+ /**
2
+ * `.approval/QUEUE.md` — the queue projection of SPEC.md §9.1.
3
+ *
4
+ * > **The queue** (`.approval/QUEUE.md`): a rendered, read-only markdown view of
5
+ * > pending requests (task, actions, declared effects, cost, TTL countdown) plus
6
+ * > the sampled-audit backlog. Regenerated on every relevant event. This is the
7
+ * > screenshot; it is never the truth.
8
+ *
9
+ * Three properties are the whole point of this module.
10
+ *
11
+ * **It is a pure function of (verified log, policy, `now`).** No ambient clock,
12
+ * no locale, no hostname, no environment, no random temp name in the bytes. The
13
+ * evaluation instant is a parameter — the same discipline `channels/tagging.ts`
14
+ * already keeps — so an identical log rendered at an identical `now` produces
15
+ * identical bytes, and a rendering can be reproduced later from the log alone.
16
+ * Every number here is formatted by hand with integer arithmetic for the same
17
+ * reason: `toLocaleString` would make the output depend on the machine.
18
+ *
19
+ * **It re-derives nothing.** Entries come from
20
+ * {@link buildPendingQueue}, which is the one place a {@link ChannelRequest} is
21
+ * built. So the class, the autonomy, the provenance, the budgets, the
22
+ * attestation and the TTL a reader sees in QUEUE.md are the same answers the
23
+ * gate itself would give — not a second implementation that could drift. This
24
+ * module's entire job is text.
25
+ *
26
+ * **It never writes the log.** {@link writeQueue} writes exactly one file, and
27
+ * it is `QUEUE.md`.
28
+ *
29
+ * ## Why this lives in `src/channels/`, not `src/core/`
30
+ *
31
+ * It consumes `channels/contract.ts`'s tagged requests through
32
+ * `channels/tagging.ts`. Putting it in `core/` would make core import channels,
33
+ * inverting the dependency the codebase is built on: core decides, channels
34
+ * display, and this file is display — a read-only markdown surface that collects
35
+ * no gesture and holds no authority. It sits beside `tagging.ts` and `batch.ts`
36
+ * because it is the third consumer of the same tagged data, and it deliberately
37
+ * does not implement {@link ../channels/contract.js Channel}: QUEUE.md notifies
38
+ * nobody and answers nothing.
39
+ *
40
+ * ## B3: computed vs claimed
41
+ *
42
+ * SPEC.md §9: "Every displayed field is one of two kinds and MUST be visibly
43
+ * distinguished". Here that is structural, not typographic: computed fields are
44
+ * rendered as `computed · <source>` lines under **Computed by the runtime**, and
45
+ * claimed fields under a separate **Claimed by `<actor>` (not verified)** block
46
+ * that names its author. A reader skimming the file cannot mistake an agent's
47
+ * cost estimate for a budget verdict, because they are not in the same list.
48
+ *
49
+ * ## The full payload is NOT in this file — flagged for human review
50
+ *
51
+ * SPEC.md §10.4 requires channels to present the full payload before collecting
52
+ * a decision. QUEUE.md collects no decision: it is a read-only summary, and the
53
+ * decision surfaces are the channels (`approval grant`, the web page, Telegram),
54
+ * each of which presents the bytes at decision time. Inlining payloads here
55
+ * would put every pending payload — recipients, bodies, argv — into a file that
56
+ * is regenerated on every event, checked into nothing, and read by anyone with
57
+ * the working directory, with no gesture ever collected from it. So the queue
58
+ * carries the **binding** (`payload_hash`) and points at the channels for the
59
+ * bytes, and the rendered header says exactly that to the human reading it.
60
+ *
61
+ * Which is a different statement from "the renderer cannot see the payload".
62
+ * Since APRV-28 it can: `channels/tagging.ts` reads the payload store beside the
63
+ * log (SPEC.md §6.2's "the payload itself is stored or referenced by the request
64
+ * so channels can display it"), so a request whose bytes were supplied at intake
65
+ * is *summarizable* here and appears in the pending section — which is why this
66
+ * file's pending count now agrees with the queue every channel shows, where
67
+ * before it silently disagreed. The bytes still do not appear in this file.
68
+ * Requests whose material nobody holds remain in {@link QueueRender.skipped},
69
+ * rendered in their own section with the reason, never silently dropped.
70
+ */
71
+ import type { LogHead } from "../core/log.js";
72
+ import { type TagOptions } from "./tagging.js";
73
+ /**
74
+ * Rendering options. A superset of {@link TagOptions} with nothing added: the
75
+ * renderer's inputs are exactly the tagger's inputs, plus `now`, because it
76
+ * derives nothing the tagger does not already derive.
77
+ */
78
+ export type RenderQueueOptions = TagOptions;
79
+ /**
80
+ * Why the renderer refused.
81
+ *
82
+ * The three log codes are `channels/tagging.ts`'s and `core/state.ts`'s,
83
+ * verbatim, so a corrupt log is reported as corruption by every layer with one
84
+ * vocabulary. `write-failed` is {@link writeQueue}'s alone — the renderer itself
85
+ * cannot fail for any other reason, because it is a pure function.
86
+ */
87
+ export declare const RENDER_QUEUE_REFUSAL_CODES: readonly ["log-unreadable", "log-torn-tail", "log-corrupt", "write-failed"];
88
+ export type RenderQueueRefusalCode = (typeof RENDER_QUEUE_REFUSAL_CODES)[number];
89
+ export interface RenderQueueRefusal {
90
+ ok: false;
91
+ code: RenderQueueRefusalCode;
92
+ message: string;
93
+ }
94
+ /** A successful render: the bytes, plus what went into them. */
95
+ export interface QueueRender {
96
+ ok: true;
97
+ /** The complete file contents. Deterministic for a given (log, policy, now). */
98
+ markdown: string;
99
+ /** The chain head the render derives from; `null` for an empty log. */
100
+ head: LogHead | null;
101
+ /** Pending requests rendered, in log order. */
102
+ pending: number;
103
+ /** Live requests that could not be tagged, listed with their reason. */
104
+ skipped: number;
105
+ /** `audit.sampled` events with no later `audit.reviewed`. */
106
+ auditBacklog: number;
107
+ }
108
+ export type RenderQueueResult = QueueRender | RenderQueueRefusal;
109
+ export interface QueueWrite extends Omit<QueueRender, "markdown"> {
110
+ /** Where the file was written. */
111
+ path: string;
112
+ /** Bytes written (UTF-8). */
113
+ bytes: number;
114
+ }
115
+ export type WriteQueueResult = QueueWrite | RenderQueueRefusal;
116
+ /**
117
+ * Render the queue.
118
+ *
119
+ * Deterministic in the strong sense: for a fixed log, policy and `now`, the
120
+ * returned string is byte-identical across processes and machines. Nothing here
121
+ * reads a clock, a locale, an environment variable, or a hostname.
122
+ *
123
+ * Expiry is not this module's judgment: `channels/tagging.ts` derives state
124
+ * through `core/state.ts` with the policy TTL and the same `now`, so a request
125
+ * whose TTL has elapsed is `expired`, not `requested`, and never reaches the
126
+ * pending section. The countdown a reader sees therefore never reaches zero on
127
+ * a listed entry.
128
+ *
129
+ * The verified read happens twice — once here for the head and the audit
130
+ * records, once inside {@link buildPendingQueue} — which is a deliberate trade:
131
+ * a second walk of the chain costs a few milliseconds on a rendering path, and
132
+ * the alternative is widening the tagger's public result to carry records it
133
+ * has no other reason to expose.
134
+ */
135
+ export declare function renderQueue(logPath: string, options: RenderQueueOptions, now: string): RenderQueueResult;
136
+ /**
137
+ * Render and write `.approval/QUEUE.md` atomically.
138
+ *
139
+ * Temp file in the destination directory, `fsync`, then `rename` — a reader
140
+ * either sees the previous complete rendering or the new one, never a half-
141
+ * written queue. The temp name is the only non-deterministic byte anywhere in
142
+ * this module and it never reaches the file's contents; it is removed on every
143
+ * failure path, so a failed render leaves no debris beside the queue.
144
+ *
145
+ * Writes this one file and nothing else. In particular it does not touch the
146
+ * log: the log is opened read-only by the verified read and is not reopened
147
+ * here.
148
+ */
149
+ export declare function writeQueue(logPath: string, queuePath: string, options: RenderQueueOptions, now: string): WriteQueueResult;