approval-md 0.2.0 → 0.4.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 (378) hide show
  1. package/README.md +85 -877
  2. package/SPEC.md +150 -19
  3. package/cli.js +66 -7
  4. package/dist/src/adapters/smtp.d.ts +18 -0
  5. package/dist/src/adapters/smtp.js +24 -3
  6. package/dist/src/adapters/smtp.js.map +1 -1
  7. package/dist/src/channels/contract.d.ts +53 -1
  8. package/dist/src/channels/contract.js +304 -7
  9. package/dist/src/channels/contract.js.map +1 -1
  10. package/dist/src/channels/relay-server.d.ts +90 -0
  11. package/dist/src/channels/relay-server.js +295 -0
  12. package/dist/src/channels/relay-server.js.map +1 -0
  13. package/dist/src/channels/relay.d.ts +273 -0
  14. package/dist/src/channels/relay.js +564 -0
  15. package/dist/src/channels/relay.js.map +1 -0
  16. package/dist/src/channels/tagging.js +6 -1
  17. package/dist/src/channels/tagging.js.map +1 -1
  18. package/dist/src/channels/telegram-webhook.d.ts +273 -0
  19. package/dist/src/channels/telegram-webhook.js +536 -0
  20. package/dist/src/channels/telegram-webhook.js.map +1 -0
  21. package/dist/src/channels/telegram.d.ts +394 -12
  22. package/dist/src/channels/telegram.js +621 -68
  23. package/dist/src/channels/telegram.js.map +1 -1
  24. package/dist/src/channels/web.d.ts +9 -0
  25. package/dist/src/channels/web.js +17 -0
  26. package/dist/src/channels/web.js.map +1 -1
  27. package/dist/src/cli/amend.js +564 -34
  28. package/dist/src/cli/amend.js.map +1 -1
  29. package/dist/src/cli/attest.d.ts +9 -0
  30. package/dist/src/cli/attest.js +177 -13
  31. package/dist/src/cli/attest.js.map +1 -1
  32. package/dist/src/cli/channel-relay.d.ts +108 -0
  33. package/dist/src/cli/channel-relay.js +334 -0
  34. package/dist/src/cli/channel-relay.js.map +1 -0
  35. package/dist/src/cli/channel-telegram-webhook.d.ts +273 -0
  36. package/dist/src/cli/channel-telegram-webhook.js +709 -0
  37. package/dist/src/cli/channel-telegram-webhook.js.map +1 -0
  38. package/dist/src/cli/channel-telegram.d.ts +347 -28
  39. package/dist/src/cli/channel-telegram.js +763 -28
  40. package/dist/src/cli/channel-telegram.js.map +1 -1
  41. package/dist/src/cli/channel.d.ts +10 -1
  42. package/dist/src/cli/channel.js +14 -1
  43. package/dist/src/cli/channel.js.map +1 -1
  44. package/dist/src/cli/codex-bridge.d.ts +819 -0
  45. package/dist/src/cli/codex-bridge.js +1607 -0
  46. package/dist/src/cli/codex-bridge.js.map +1 -0
  47. package/dist/src/cli/codex.d.ts +1 -1
  48. package/dist/src/cli/codex.js +304 -7
  49. package/dist/src/cli/codex.js.map +1 -1
  50. package/dist/src/cli/daemon.js +41 -6
  51. package/dist/src/cli/daemon.js.map +1 -1
  52. package/dist/src/cli/doctor.d.ts +63 -0
  53. package/dist/src/cli/doctor.js +1322 -122
  54. package/dist/src/cli/doctor.js.map +1 -1
  55. package/dist/src/cli/execute.d.ts +17 -1
  56. package/dist/src/cli/execute.js +366 -22
  57. package/dist/src/cli/execute.js.map +1 -1
  58. package/dist/src/cli/exit-codes.d.ts +12 -0
  59. package/dist/src/cli/exit-codes.js +13 -0
  60. package/dist/src/cli/exit-codes.js.map +1 -1
  61. package/dist/src/cli/gate.d.ts +2 -0
  62. package/dist/src/cli/gate.js +233 -2
  63. package/dist/src/cli/gate.js.map +1 -1
  64. package/dist/src/cli/help.d.ts +14 -2
  65. package/dist/src/cli/help.js +395 -82
  66. package/dist/src/cli/help.js.map +1 -1
  67. package/dist/src/cli/hook-codex.d.ts +49 -1
  68. package/dist/src/cli/hook-codex.js +60 -1
  69. package/dist/src/cli/hook-codex.js.map +1 -1
  70. package/dist/src/cli/hook.d.ts +828 -4
  71. package/dist/src/cli/hook.js +2972 -142
  72. package/dist/src/cli/hook.js.map +1 -1
  73. package/dist/src/cli/import.js +1 -1
  74. package/dist/src/cli/import.js.map +1 -1
  75. package/dist/src/cli/init.js +16 -7
  76. package/dist/src/cli/init.js.map +1 -1
  77. package/dist/src/cli/instructions.js +24 -3
  78. package/dist/src/cli/instructions.js.map +1 -1
  79. package/dist/src/cli/log-anchor.d.ts +55 -0
  80. package/dist/src/cli/log-anchor.js +199 -60
  81. package/dist/src/cli/log-anchor.js.map +1 -1
  82. package/dist/src/cli/main.d.ts +0 -12
  83. package/dist/src/cli/main.js +56 -3
  84. package/dist/src/cli/main.js.map +1 -1
  85. package/dist/src/cli/muse.d.ts +2 -0
  86. package/dist/src/cli/muse.js +62 -0
  87. package/dist/src/cli/muse.js.map +1 -0
  88. package/dist/src/cli/payload.js +79 -1
  89. package/dist/src/cli/payload.js.map +1 -1
  90. package/dist/src/cli/policy-apply.d.ts +195 -0
  91. package/dist/src/cli/policy-apply.js +573 -0
  92. package/dist/src/cli/policy-apply.js.map +1 -0
  93. package/dist/src/cli/policy.js +14 -1
  94. package/dist/src/cli/policy.js.map +1 -1
  95. package/dist/src/cli/preflight.d.ts +151 -13
  96. package/dist/src/cli/preflight.js +398 -41
  97. package/dist/src/cli/preflight.js.map +1 -1
  98. package/dist/src/cli/sandbox.js +17 -1
  99. package/dist/src/cli/sandbox.js.map +1 -1
  100. package/dist/src/cli/scaffold.d.ts +1 -1
  101. package/dist/src/cli/scaffold.js +7 -1
  102. package/dist/src/cli/scaffold.js.map +1 -1
  103. package/dist/src/cli/serve.d.ts +53 -0
  104. package/dist/src/cli/serve.js +270 -0
  105. package/dist/src/cli/serve.js.map +1 -0
  106. package/dist/src/cli/setup-channel.d.ts +9 -0
  107. package/dist/src/cli/setup-channel.js +28 -1
  108. package/dist/src/cli/setup-channel.js.map +1 -1
  109. package/dist/src/cli/setup-common.d.ts +3 -1
  110. package/dist/src/cli/setup-common.js +3 -2
  111. package/dist/src/cli/setup-common.js.map +1 -1
  112. package/dist/src/cli/setup.d.ts +2 -0
  113. package/dist/src/cli/setup.js +94 -2
  114. package/dist/src/cli/setup.js.map +1 -1
  115. package/dist/src/cli/up.js +134 -51
  116. package/dist/src/cli/up.js.map +1 -1
  117. package/dist/src/cli/values.js +3 -4
  118. package/dist/src/cli/values.js.map +1 -1
  119. package/dist/src/cli/verb-registry.d.ts +2 -0
  120. package/dist/src/cli/verb-registry.js +510 -47
  121. package/dist/src/cli/verb-registry.js.map +1 -1
  122. package/dist/src/cli/wordmark.d.ts +2 -2
  123. package/dist/src/cli/wordmark.js +2 -2
  124. package/dist/src/codex/broker.d.ts +229 -0
  125. package/dist/src/codex/broker.js +548 -0
  126. package/dist/src/codex/broker.js.map +1 -0
  127. package/dist/src/codex/runner.d.ts +178 -0
  128. package/dist/src/codex/runner.js +231 -0
  129. package/dist/src/codex/runner.js.map +1 -0
  130. package/dist/src/codex/serve.d.ts +56 -0
  131. package/dist/src/codex/serve.js +98 -0
  132. package/dist/src/codex/serve.js.map +1 -0
  133. package/dist/src/codex/workspace-commit.d.ts +219 -0
  134. package/dist/src/codex/workspace-commit.js +549 -0
  135. package/dist/src/codex/workspace-commit.js.map +1 -0
  136. package/dist/src/core/advance-cycle.d.ts +51 -0
  137. package/dist/src/core/advance-cycle.js +66 -2
  138. package/dist/src/core/advance-cycle.js.map +1 -1
  139. package/dist/src/core/agents-md.d.ts +20 -18
  140. package/dist/src/core/agents-md.js +33 -31
  141. package/dist/src/core/agents-md.js.map +1 -1
  142. package/dist/src/core/attest-bootstrap.d.ts +95 -0
  143. package/dist/src/core/attest-bootstrap.js +135 -0
  144. package/dist/src/core/attest-bootstrap.js.map +1 -0
  145. package/dist/src/core/attest.d.ts +234 -2
  146. package/dist/src/core/attest.js +342 -7
  147. package/dist/src/core/attest.js.map +1 -1
  148. package/dist/src/core/audit.d.ts +73 -3
  149. package/dist/src/core/audit.js +65 -5
  150. package/dist/src/core/audit.js.map +1 -1
  151. package/dist/src/core/channel-lease.d.ts +322 -0
  152. package/dist/src/core/channel-lease.js +663 -0
  153. package/dist/src/core/channel-lease.js.map +1 -0
  154. package/dist/src/core/channel-owner.d.ts +213 -0
  155. package/dist/src/core/channel-owner.js +358 -0
  156. package/dist/src/core/channel-owner.js.map +1 -0
  157. package/dist/src/core/command-class.d.ts +205 -0
  158. package/dist/src/core/command-class.js +1433 -28
  159. package/dist/src/core/command-class.js.map +1 -1
  160. package/dist/src/core/commit-guard.d.ts +272 -0
  161. package/dist/src/core/commit-guard.js +424 -0
  162. package/dist/src/core/commit-guard.js.map +1 -0
  163. package/dist/src/core/daemon-actor.d.ts +45 -0
  164. package/dist/src/core/daemon-actor.js +54 -0
  165. package/dist/src/core/daemon-actor.js.map +1 -0
  166. package/dist/src/core/daemon-host.d.ts +178 -0
  167. package/dist/src/core/daemon-host.js +228 -0
  168. package/dist/src/core/daemon-host.js.map +1 -0
  169. package/dist/src/core/daemon-identity.d.ts +238 -0
  170. package/dist/src/core/daemon-identity.js +252 -0
  171. package/dist/src/core/daemon-identity.js.map +1 -0
  172. package/dist/src/core/dark-session.d.ts +109 -8
  173. package/dist/src/core/dark-session.js +266 -82
  174. package/dist/src/core/dark-session.js.map +1 -1
  175. package/dist/src/core/decision-refusal.d.ts +23 -2
  176. package/dist/src/core/decision-refusal.js +24 -2
  177. package/dist/src/core/decision-refusal.js.map +1 -1
  178. package/dist/src/core/env-file.d.ts +5 -0
  179. package/dist/src/core/env-file.js +60 -1
  180. package/dist/src/core/env-file.js.map +1 -1
  181. package/dist/src/core/execute.d.ts +15 -2
  182. package/dist/src/core/execute.js +15 -2
  183. package/dist/src/core/execute.js.map +1 -1
  184. package/dist/src/core/gate.d.ts +392 -6
  185. package/dist/src/core/gate.js +852 -24
  186. package/dist/src/core/gate.js.map +1 -1
  187. package/dist/src/core/gesture-refusal.d.ts +166 -0
  188. package/dist/src/core/gesture-refusal.js +188 -0
  189. package/dist/src/core/gesture-refusal.js.map +1 -0
  190. package/dist/src/core/harness-version.d.ts +128 -4
  191. package/dist/src/core/harness-version.js +181 -12
  192. package/dist/src/core/harness-version.js.map +1 -1
  193. package/dist/src/core/harness-wait.d.ts +82 -3
  194. package/dist/src/core/harness-wait.js +89 -3
  195. package/dist/src/core/harness-wait.js.map +1 -1
  196. package/dist/src/core/instance.d.ts +59 -2
  197. package/dist/src/core/instance.js +113 -0
  198. package/dist/src/core/instance.js.map +1 -1
  199. package/dist/src/core/log-subscribe.d.ts +21 -0
  200. package/dist/src/core/log-subscribe.js +16 -6
  201. package/dist/src/core/log-subscribe.js.map +1 -1
  202. package/dist/src/core/log-write-layer.d.ts +55 -0
  203. package/dist/src/core/log-write-layer.js +91 -0
  204. package/dist/src/core/log-write-layer.js.map +1 -0
  205. package/dist/src/core/log.d.ts +89 -22
  206. package/dist/src/core/log.js +197 -19
  207. package/dist/src/core/log.js.map +1 -1
  208. package/dist/src/core/payload-census.d.ts +51 -0
  209. package/dist/src/core/payload-census.js +125 -2
  210. package/dist/src/core/payload-census.js.map +1 -1
  211. package/dist/src/core/payload-store.d.ts +31 -0
  212. package/dist/src/core/payload-store.js +113 -8
  213. package/dist/src/core/payload-store.js.map +1 -1
  214. package/dist/src/core/payload.d.ts +18 -3
  215. package/dist/src/core/payload.js +20 -4
  216. package/dist/src/core/payload.js.map +1 -1
  217. package/dist/src/core/policy-diff.d.ts +10 -0
  218. package/dist/src/core/policy-diff.js +10 -2
  219. package/dist/src/core/policy-diff.js.map +1 -1
  220. package/dist/src/core/policy-explain.d.ts +17 -1
  221. package/dist/src/core/policy-explain.js +48 -1
  222. package/dist/src/core/policy-explain.js.map +1 -1
  223. package/dist/src/core/policy-load.d.ts +65 -1
  224. package/dist/src/core/policy-load.js +21 -3
  225. package/dist/src/core/policy-load.js.map +1 -1
  226. package/dist/src/core/policy-match.d.ts +81 -0
  227. package/dist/src/core/policy-match.js +87 -0
  228. package/dist/src/core/policy-match.js.map +1 -1
  229. package/dist/src/core/policy-proposal.d.ts +75 -0
  230. package/dist/src/core/policy-proposal.js +110 -4
  231. package/dist/src/core/policy-proposal.js.map +1 -1
  232. package/dist/src/core/protected-path-guard.d.ts +117 -4
  233. package/dist/src/core/protected-path-guard.js +362 -48
  234. package/dist/src/core/protected-path-guard.js.map +1 -1
  235. package/dist/src/core/question-preempted.d.ts +141 -0
  236. package/dist/src/core/question-preempted.js +152 -0
  237. package/dist/src/core/question-preempted.js.map +1 -0
  238. package/dist/src/core/read-scope.d.ts +182 -0
  239. package/dist/src/core/read-scope.js +256 -0
  240. package/dist/src/core/read-scope.js.map +1 -0
  241. package/dist/src/core/run-payload.d.ts +160 -0
  242. package/dist/src/core/run-payload.js +304 -0
  243. package/dist/src/core/run-payload.js.map +1 -0
  244. package/dist/src/core/sandbox.d.ts +81 -0
  245. package/dist/src/core/sandbox.js +190 -1
  246. package/dist/src/core/sandbox.js.map +1 -1
  247. package/dist/src/core/sender-identity.d.ts +501 -0
  248. package/dist/src/core/sender-identity.js +609 -0
  249. package/dist/src/core/sender-identity.js.map +1 -0
  250. package/dist/src/core/shlex.d.ts +102 -0
  251. package/dist/src/core/shlex.js +159 -0
  252. package/dist/src/core/shlex.js.map +1 -0
  253. package/dist/src/core/state.d.ts +52 -1
  254. package/dist/src/core/state.js +52 -6
  255. package/dist/src/core/state.js.map +1 -1
  256. package/dist/src/core/telegram-config.d.ts +79 -0
  257. package/dist/src/core/telegram-config.js +108 -0
  258. package/dist/src/core/telegram-config.js.map +1 -1
  259. package/dist/src/core/values.d.ts +18 -8
  260. package/dist/src/core/values.js +36 -1
  261. package/dist/src/core/values.js.map +1 -1
  262. package/dist/src/core/verify.d.ts +23 -1
  263. package/dist/src/core/verify.js +20 -2
  264. package/dist/src/core/verify.js.map +1 -1
  265. package/dist/src/daemon/advance.d.ts +10 -0
  266. package/dist/src/daemon/advance.js +25 -4
  267. package/dist/src/daemon/advance.js.map +1 -1
  268. package/dist/src/daemon/audit.d.ts +80 -5
  269. package/dist/src/daemon/audit.js +126 -6
  270. package/dist/src/daemon/audit.js.map +1 -1
  271. package/dist/src/daemon/daemon.d.ts +174 -2
  272. package/dist/src/daemon/daemon.js +307 -7
  273. package/dist/src/daemon/daemon.js.map +1 -1
  274. package/dist/src/daemon/git-evidence.d.ts +2 -2
  275. package/dist/src/daemon/git-evidence.js +1 -1
  276. package/dist/src/daemon/projection.d.ts +13 -2
  277. package/dist/src/daemon/projection.js +39 -6
  278. package/dist/src/daemon/projection.js.map +1 -1
  279. package/dist/src/mcp/server.d.ts +39 -3
  280. package/dist/src/mcp/server.js +30 -3
  281. package/dist/src/mcp/server.js.map +1 -1
  282. package/dist/src/muse/server.d.ts +16 -0
  283. package/dist/src/muse/server.js +238 -0
  284. package/dist/src/muse/server.js.map +1 -0
  285. package/dist/src/serve/archive.d.ts +158 -0
  286. package/dist/src/serve/archive.js +354 -0
  287. package/dist/src/serve/archive.js.map +1 -0
  288. package/dist/src/serve/arguments.d.ts +93 -0
  289. package/dist/src/serve/arguments.js +228 -0
  290. package/dist/src/serve/arguments.js.map +1 -0
  291. package/dist/src/serve/credentials.d.ts +91 -0
  292. package/dist/src/serve/credentials.js +143 -0
  293. package/dist/src/serve/credentials.js.map +1 -0
  294. package/dist/src/serve/follow.d.ts +86 -0
  295. package/dist/src/serve/follow.js +101 -0
  296. package/dist/src/serve/follow.js.map +1 -0
  297. package/dist/src/serve/hook-thread.d.ts +134 -0
  298. package/dist/src/serve/hook-thread.js +333 -0
  299. package/dist/src/serve/hook-thread.js.map +1 -0
  300. package/dist/src/serve/hook-worker.d.ts +134 -0
  301. package/dist/src/serve/hook-worker.js +173 -0
  302. package/dist/src/serve/hook-worker.js.map +1 -0
  303. package/dist/src/serve/server.d.ts +412 -0
  304. package/dist/src/serve/server.js +1251 -0
  305. package/dist/src/serve/server.js.map +1 -0
  306. package/docs/README-extended.md +766 -0
  307. package/docs/cli-reference.md +2563 -73
  308. package/docs/codex-enforced-session.md +75 -2
  309. package/docs/codex-workspace-broker.md +118 -0
  310. package/package.json +6 -2
  311. package/schema/event.schema.json +595 -9
  312. package/schema/fixtures/event/invalid/approval-granted-sender-hashed-false.json +20 -0
  313. package/schema/fixtures/event/invalid/approval-granted-sender-hashed-raw-id.json +20 -0
  314. package/schema/fixtures/event/invalid/audit-gesture-refused-human-actor.json +16 -0
  315. package/schema/fixtures/event/invalid/audit-gesture-refused-no-actor-no-sender.json +15 -0
  316. package/schema/fixtures/event/invalid/audit-gesture-refused-unknown-gesture.json +16 -0
  317. package/schema/fixtures/event/invalid/audit-question-preempted-agent-actor.json +16 -0
  318. package/schema/fixtures/event/invalid/audit-question-preempted-no-question-id.json +16 -0
  319. package/schema/fixtures/event/invalid/audit-question-preempted-unknown-source.json +15 -0
  320. package/schema/fixtures/event/invalid/daemon-id-malformed.json +15 -0
  321. package/schema/fixtures/event/invalid/execution-started-truncated-policy-sha256.json +18 -0
  322. package/schema/fixtures/event/invalid/gate-path-signed-off-absolute-path.json +14 -0
  323. package/schema/fixtures/event/invalid/gate-path-signed-off-agent-actor.json +14 -0
  324. package/schema/fixtures/event/invalid/gate-path-signed-off-missing-path.json +13 -0
  325. package/schema/fixtures/event/invalid/harness-cap-at-margin.json +16 -0
  326. package/schema/fixtures/event/invalid/harness-cap-fractional.json +16 -0
  327. package/schema/fixtures/event/invalid/harness-cap-negative.json +16 -0
  328. package/schema/fixtures/event/invalid/harness-cap-string.json +16 -0
  329. package/schema/fixtures/event/invalid/harness-cap-without-harness-execution.json +16 -0
  330. package/schema/fixtures/event/invalid/harness-cap-zero.json +16 -0
  331. package/schema/fixtures/event/valid/approval-granted-sender-hashed.json +20 -0
  332. package/schema/fixtures/event/valid/approval-requested-harness-cap.json +18 -0
  333. package/schema/fixtures/event/valid/audit-gesture-refused-review-note.json +21 -0
  334. package/schema/fixtures/event/valid/audit-gesture-refused-sender-key-unavailable.json +19 -0
  335. package/schema/fixtures/event/valid/audit-gesture-refused.json +19 -0
  336. package/schema/fixtures/event/valid/audit-question-preempted-no-verdict.json +16 -0
  337. package/schema/fixtures/event/valid/audit-question-preempted.json +20 -0
  338. package/schema/fixtures/event/valid/daemon-identity-declared.json +17 -0
  339. package/schema/fixtures/event/valid/daemon-identity.json +15 -0
  340. package/schema/fixtures/event/valid/execution-started-policy-sha256.json +18 -0
  341. package/schema/fixtures/event/valid/gate-path-signed-off.json +14 -0
  342. package/schema/fixtures/event/valid/harness-kind-claude-code.json +23 -0
  343. package/schema/fixtures/event/valid/harness-kind-codex.json +23 -0
  344. package/schema/fixtures/event/valid/harness-kind-cursor.json +23 -0
  345. package/schema/fixtures/event/valid/harness-kind-grok.json +23 -0
  346. package/schema/fixtures/event/valid/harness-kind-hermes.json +23 -0
  347. package/schema/fixtures/event/valid/harness-kind-muse.json +23 -0
  348. package/schema/fixtures/policy/invalid/daemons-malformed-id.json +10 -0
  349. package/schema/fixtures/policy/invalid/senders-half-keyed.json +20 -0
  350. package/schema/fixtures/policy/valid/canonical.json +1 -1
  351. package/schema/fixtures/policy/valid/daemons-allowlist.json +19 -0
  352. package/schema/fixtures/policy/valid/senders-keyed.json +24 -0
  353. package/schema/fixtures/policy-md/invalid/schema-invalid-agent-may-request.md +21 -0
  354. package/schema/fixtures/policy-md/valid/agent-may-request.md +24 -0
  355. package/schema/fixtures/policy-md/valid/canonical.md +1 -1
  356. package/schema/fixtures/policy-md/valid/with-values.md +5 -7
  357. package/schema/fixtures/values/invalid/class-shaped.json +1 -1
  358. package/schema/fixtures/values/invalid/duplicate-entry.json +1 -1
  359. package/schema/fixtures/values/invalid/non-string-item.json +1 -1
  360. package/schema/fixtures/values/invalid/over-cap.json +1 -1
  361. package/schema/fixtures/values/invalid/unknown-key.json +1 -1
  362. package/schema/fixtures/values/invalid/version-float.json +1 -0
  363. package/schema/fixtures/values/invalid/version-integer.json +1 -0
  364. package/schema/fixtures/values/invalid/version-wrong-string.json +1 -0
  365. package/schema/fixtures/values/valid/empty-lists.json +2 -3
  366. package/schema/fixtures/values/valid/full.json +5 -7
  367. package/schema/fixtures/values/valid/minimal.json +1 -1
  368. package/schema/fixtures/values-md/invalid/schema-invalid.md +5 -3
  369. package/schema/fixtures/values-md/invalid/two-blocks.md +3 -3
  370. package/schema/fixtures/values-md/invalid/unterminated.md +2 -2
  371. package/schema/fixtures/values-md/invalid/version-1.md +69 -0
  372. package/schema/fixtures/values-md/invalid/version-unquoted.md +64 -0
  373. package/schema/fixtures/values-md/invalid/yaml-error.md +2 -2
  374. package/schema/fixtures/values-md/valid/absent.md +1 -1
  375. package/schema/fixtures/values-md/valid/with-values.md +5 -7
  376. package/schema/policy.schema.json +100 -4
  377. package/schema/values.schema.json +7 -11
  378. package/schema/fixtures/values/invalid/version-string.json +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channel-telegram-webhook.js","sourceRoot":"","sources":["../../../src/cli/channel-telegram-webhook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,EAAE,UAAU,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC7B,6BAA6B,EAC7B,sBAAsB,GAEvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC1B,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,UAAU,EAAE,aAAa,EAA0B,MAAM,wBAAwB,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAiB,MAAM,WAAW,CAAC;AAC5E,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,aAAa,EACb,WAAW,EACX,YAAY,GAGb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oB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
14
14
  * are read here and passed to the channel as values (SPEC.md §5.1: policy
15
15
  * carries the env-var *names*, never the secrets). Nothing in `channels/`
16
16
  * touches `process.env`.
17
- * 2. **It declares who is approving.** The decision is recorded against the
18
- * human actor from `--as` / `APPROVAL_HUMAN`, never against anything the
19
- * callback carried. SPEC.md §11: identity in v0.1 is config-declared, the
20
- * trust boundary is the local machine, and everyone who can reach the
21
- * configured chat can approve as that actor. This is stated in `--help`
22
- * because an operator has to be able to see it without reading the source.
17
+ * 2. **It declares the identity the process itself acts under.** `--as` /
18
+ * `APPROVAL_HUMAN` is what this listener is, and it is what a decision is
19
+ * recorded as whenever the policy maps no sender for this channel: SPEC.md
20
+ * §11's config-declared identity, where the trust boundary is the local
21
+ * machine and everyone who can reach the configured chat can approve as that
22
+ * actor. Since APRV-324 a policy MAY map Telegram account ids to approvers,
23
+ * and then the decision is recorded against the person the operator attested
24
+ * the tapping account to, and an unmapped account is refused rather than
25
+ * recorded as this listener. Either way the choosing happens in
26
+ * `channels/contract.ts` against the attested policy, never here and never
27
+ * in the channel. Both settings are stated in `--help` because an operator
28
+ * has to be able to see which one they are in without reading the source.
23
29
  * 3. **It holds the token.** A grant mints a single-use execution token;
24
30
  * `recordChannelDecision` returns it to *this* handler, which prints it on
25
31
  * **stdout** and never hands it back to the channel. It is never sent to
@@ -101,12 +107,15 @@
101
107
  * a send failure: an operator who has just mistyped a chat id or a token should
102
108
  * learn it immediately rather than watch a listener retry forever.
103
109
  */
104
- import type { DecideOptions } from "../core/gate.js";
110
+ import { type DecideOptions } from "../core/gate.js";
105
111
  import { type ChannelRequest, type DeliveryId } from "../channels/contract.js";
106
112
  import { type ChannelTagRefusalCode, type TagOptions } from "../channels/tagging.js";
107
113
  import { type CheckpointTap } from "./checkpoint-tap.js";
108
114
  import { TelegramChannel, type CheckpointTapResponse, type ReviewCard, type ReviewTapResponse, type TelegramCommand, type TelegramTerminalState } from "../channels/telegram.js";
109
115
  import { type TelegramDelivery } from "../core/telegram-config.js";
116
+ import { type ChannelLease, type ChannelLeaseMode } from "../core/channel-lease.js";
117
+ import { type InstanceFinding } from "../core/instance.js";
118
+ import { type ChannelSender } from "../core/sender-identity.js";
110
119
  import { type ParsedFlags } from "./args.js";
111
120
  import { type GlossRunner } from "./gloss.js";
112
121
  import { type GlossRunnerFactoryOptions } from "./gloss-options.js";
@@ -151,6 +160,32 @@ export interface ListenSetup {
151
160
  * `core/telegram-config.ts` beside the other Telegram policy readings.
152
161
  */
153
162
  delivery: TelegramDelivery;
163
+ /**
164
+ * Cross-instance findings `--allow-cross-instance` let through (APRV-390).
165
+ *
166
+ * Empty on every ordinary start, because a finding without the flag is a
167
+ * refusal. Carried on the setup rather than printed inside `prepareListen`
168
+ * for the reason that function prints nothing at all: `approval up` and
169
+ * `approval channel telegram listen` choose their own stream, and this is
170
+ * the one thing an overridden refusal still owes the operator.
171
+ */
172
+ crossInstance: readonly InstanceFinding[];
173
+ /**
174
+ * `--allow-cross-instance` as passed (APRV-390).
175
+ *
176
+ * Carried as well as applied, because the flag overrides TWO refusals and
177
+ * only one of them can be decided synchronously. The credential check is
178
+ * `prepareListen`'s; the bot-ownership claim needs a `getMe`, so it happens
179
+ * later and has to be able to ask whether the operator already said yes.
180
+ */
181
+ allowCrossInstance: boolean;
182
+ /**
183
+ * The Bot API base this listener talks to (APRV-390).
184
+ *
185
+ * Part of the bot's identity in the ownership registry, because a bot id is
186
+ * unique within one Bot API deployment and nothing more.
187
+ */
188
+ apiBase: string;
154
189
  /**
155
190
  * How the one-sentence model gloss is obtained (APRV-144).
156
191
  *
@@ -178,6 +213,103 @@ export interface ListenSetup {
178
213
  */
179
214
  checkpoint: CheckpointTap;
180
215
  }
216
+ /**
217
+ * Claim this listener's bot before it polls (APRV-390, extended by APRV-424).
218
+ *
219
+ * Three questions, in order, and each one has its own authority:
220
+ *
221
+ * 1. **Does anything else in THIS gate already hold the Telegram transport?**
222
+ * A lockfile in the gate's own `daemon/` directory (`core/channel-lease.ts`)
223
+ * answers it, and the answer is per PROCESS. This is the check the review of
224
+ * APRV-424 added, and the hole it closes is the one neither of the other two
225
+ * could see: an `approval up` long-polling and an `approval channel telegram
226
+ * webhook` started in the same project pass both of them — `getWebhookInfo`
227
+ * is empty while the poller is the one running, and the ownership registry
228
+ * compares instance ids, which are equal because it IS the same instance —
229
+ * and then each runs its own dispatch cycle over its own state against one
230
+ * log, so every request reaches the phone twice under two nonces and only
231
+ * one copy can resolve a tap.
232
+ * 2. **What is the Bot API delivering this bot's updates to?** `getWebhookInfo`
233
+ * answers it, and it is the only thing that can see a webhook registered
234
+ * from another machine. A webhook beats a poller outright — `getUpdates` is
235
+ * refused while one is set — so any registration refuses a poller.
236
+ * 3. **Does another INSTANCE on this machine hold this bot?** `getMe` plus the
237
+ * per-machine registry answers it (APRV-390's incident: two gates, one
238
+ * token, two names, a 409 on every poll).
239
+ *
240
+ * ## An unreachable Bot API: fail-soft for a poller, fail-closed for a webhook
241
+ *
242
+ * A `getMe` or a `getWebhookInfo` that fails says nothing about ownership. The
243
+ * machine may be behind a captive portal, the API may be rate-limiting, the
244
+ * network may be down for four seconds. For a POLLER, refusing on that would
245
+ * mean a transient network fault took the phone channel down until somebody
246
+ * noticed, in exchange for no safety: an unreachable Bot API is also a
247
+ * `getUpdates` that cannot conflict with anything, and the HTTP 409 the loop
248
+ * already reports is the backstop. So the poller says what happened and starts.
249
+ *
250
+ * For the WEBHOOK VERB there is no such backstop, and the review of APRV-424
251
+ * turned this direction around. Its next act is `setWebhook`, which overwrites
252
+ * whatever registration exists without asking, so proceeding on an unknown
253
+ * answer is proceeding to take another host's taps with no error anywhere. A
254
+ * probe it could not make is therefore a refusal (`webhook-probe-failed`), and
255
+ * the operator retries or passes `--reclaim` deliberately.
256
+ */
257
+ export declare function claimListenerBot(setup: ListenSetup, report: (message: string) => void, options?: {
258
+ /**
259
+ * The webhook URL THIS process is about to register, when it is a webhook
260
+ * runner rather than a poller (APRV-424).
261
+ *
262
+ * Absent for a poller. Present for the webhook verb, and then it is the
263
+ * url a `--reclaim` is measured against: `setWebhook` is idempotent, so a
264
+ * restart re-registering its own url is the ordinary case, while a
265
+ * DIFFERENT url is a second host about to take the first host's taps.
266
+ */
267
+ webhookUrl?: string;
268
+ /**
269
+ * Register over an existing webhook (`--reclaim`, APRV-424 review finding
270
+ * 6).
271
+ *
272
+ * Without it, ANY registration refuses — including one at the same url,
273
+ * which used to be waved through on a bare string compare. Two hosts
274
+ * sharing one configuration both passed that check, the second overwrote
275
+ * the first's `secret_token`, and from then on every real tap arrived at
276
+ * the first host with a secret it did not recognise: a forgery, as far as
277
+ * it could tell, on every press of a button that had worked an hour
278
+ * earlier. So taking over is now a thing the operator says out loud.
279
+ */
280
+ reclaim?: boolean;
281
+ /**
282
+ * Which transport this process is about to run, for the lease.
283
+ *
284
+ * Derived from {@link webhookUrl} when it is not given, because the two
285
+ * callers that pass a url are the two that run a webhook.
286
+ */
287
+ mode?: ChannelLeaseMode;
288
+ }): Promise<ClaimedListenerBot>;
289
+ /**
290
+ * What {@link claimListenerBot} answers.
291
+ *
292
+ * The lease travels with the success, because the caller is the only thing
293
+ * that knows when this process has stopped receiving: `runListener`,
294
+ * `approval up` and `runWebhook` each release it on their way out, and a
295
+ * refusal releases nothing because it took nothing.
296
+ */
297
+ export type ClaimedListenerBot = {
298
+ ok: true;
299
+ lease: ChannelLease;
300
+ } | {
301
+ ok: false;
302
+ code: ListenRefusalCode;
303
+ message: string;
304
+ };
305
+ /**
306
+ * What to append to a runtime 409, naming the other instance if one is known.
307
+ *
308
+ * Read at the moment of the conflict rather than captured at start-up, because
309
+ * the other gate may have claimed the bot in between: the registry is the only
310
+ * thing that knows, and it is cheap to re-read.
311
+ */
312
+ export declare function conflictAdviceFor(setup: ListenSetup): () => string | null;
181
313
  /**
182
314
  * Why a listener could not be built. A closed union, because more than one
183
315
  * caller now branches on it: the verb turns each into an exit code, and
@@ -194,7 +326,70 @@ export declare const LISTEN_REFUSAL_CODES: readonly [
194
326
  /** The log could not be read (or its directory does not exist). */
195
327
  "log-unreadable",
196
328
  /** `--payloads` did not hold a JSON object of action key -> payload. */
197
- "payloads-unreadable"];
329
+ "payloads-unreadable",
330
+ /**
331
+ * A credential variable holds a value this instance did not configure
332
+ * (APRV-390): it was exported before the process started and is not this
333
+ * instance's own `approval env` export, or `.approval/env` names another
334
+ * instance's keystore item. Refused rather than warned since APRV-390 — the
335
+ * warning is what let a demo gate spend an evening on the production bot.
336
+ * `--allow-cross-instance` is the deliberate case.
337
+ */
338
+ "cross-instance-credential",
339
+ /**
340
+ * `getMe` named a bot another instance on this machine has already claimed
341
+ * (APRV-390). Refused BEFORE the first `getUpdates`, so the operator reads
342
+ * which two gates are involved instead of an HTTP 409 loop.
343
+ */
344
+ "bot-owned-elsewhere",
345
+ /**
346
+ * This bot's updates are being delivered to a webhook (APRV-424).
347
+ *
348
+ * The two transports are alternatives per bot: the Bot API refuses
349
+ * `getUpdates` outright while a webhook is set, so a listener that started
350
+ * here would print a 409 every few seconds and receive not one tap. Refused
351
+ * BEFORE the first poll, in the same preflight and for the same reason
352
+ * `bot-owned-elsewhere` is, so the operator reads which transport owns the
353
+ * bot instead of a status code.
354
+ *
355
+ * Since the review of APRV-424 it carries a second, local source: the
356
+ * transport lease in this gate's own `daemon/` directory, when the process
357
+ * holding it is a webhook runner. Same fact, same repair, so the same code.
358
+ */
359
+ "webhook-registered",
360
+ /**
361
+ * A long-poll listener in THIS gate already holds the Telegram transport
362
+ * (APRV-424 review finding 1).
363
+ *
364
+ * The counterpart to `webhook-registered`, from the same lease. It is what
365
+ * the webhook verb meets when an `approval up` or an `approval channel
366
+ * telegram listen` is already running in the same project — the case
367
+ * `getWebhookInfo` cannot see (nothing is registered yet) and the ownership
368
+ * registry cannot see either (it is the same instance). Two of them on one
369
+ * log put every prompt on the phone twice, under two nonces, and only one
370
+ * copy can resolve a tap.
371
+ */
372
+ "telegram-poller-running",
373
+ /**
374
+ * The transport lease could not be taken at all (APRV-424 review finding 1).
375
+ *
376
+ * A `daemon/` directory that cannot be created, a lockfile that cannot be
377
+ * written. Unlike the bot registry, whose absence is the status quo, this
378
+ * file is the only thing keeping one gate from running two transports, so a
379
+ * gate that cannot hold one does not start.
380
+ */
381
+ "telegram-lease-unavailable",
382
+ /**
383
+ * The webhook verb could not learn what already holds this bot (APRV-424
384
+ * review finding 8).
385
+ *
386
+ * `getMe` or `getWebhookInfo` failed, and the next act would have been a
387
+ * `setWebhook` that overwrites a registration nobody saw. A poller keeps its
388
+ * fail-soft on the same failure, because an unreachable Bot API is also a
389
+ * `getUpdates` that cannot conflict and the HTTP 409 loop is its backstop;
390
+ * this verb has no backstop, so it refuses.
391
+ */
392
+ "webhook-probe-failed"];
198
393
  export type ListenRefusalCode = (typeof LISTEN_REFUSAL_CODES)[number];
199
394
  /** Everything {@link prepareListen} needs, already resolved to absolute paths. */
200
395
  export interface ListenRequest {
@@ -215,6 +410,11 @@ export interface ListenRequest {
215
410
  pollTimeout: string | null;
216
411
  once: boolean;
217
412
  json: boolean;
413
+ /**
414
+ * `--allow-cross-instance` (APRV-390): start on a credential this instance
415
+ * did not configure, saying so, instead of refusing.
416
+ */
417
+ allowCrossInstance?: boolean;
218
418
  /** Where the channel's operational complaints go. Ordinarily stderr. */
219
419
  log(message: string): void;
220
420
  /** The gloss runner, if the caller wants one. See {@link ListenSetup.gloss}. */
@@ -353,9 +553,15 @@ export interface PacedState {
353
553
  /**
354
554
  * Every pending action key, in the order this process will show them.
355
555
  *
356
- * Seeded from log order (oldest first, which is what `buildPendingQueue`
357
- * returns) and rearranged by `/skip` alone. Keys the log no longer calls
358
- * pending are dropped on every cycle, and newly pending ones join the back.
556
+ * Seeded from `orderPending`'s order (live newest first, then stale oldest
557
+ * first, attestation prompts last — APRV-425; it was log order before that)
558
+ * and rearranged by `/skip` alone. Keys the log no longer calls pending are
559
+ * dropped on every cycle, and newly pending ones join the back.
560
+ *
561
+ * The ordering reaches this only through the SEEDING, which is the property
562
+ * that matters for `/skip`: a key already in the list keeps the place the
563
+ * approver's own navigation gave it, and only keys this process has not seen
564
+ * before are inserted in the new order.
359
565
  */
360
566
  order: string[];
361
567
  /**
@@ -576,10 +782,12 @@ export interface DispatchResult {
576
782
  * Action keys dropped from the delivery bookkeeping this cycle (APRV-196),
577
783
  * with why. Neither kind can cost a re-send: the pending queue is the log's
578
784
  * answer, and a dropped key that is still pending is simply re-delivered.
785
+ * `released` (APRV-442) is the one kind that is dropped BECAUSE it is still
786
+ * pending: a refused tap disarmed its card, and this cycle re-offers it.
579
787
  */
580
788
  pruned: {
581
789
  action_key: string;
582
- reason: "settled" | "stale";
790
+ reason: "settled" | "stale" | "released";
583
791
  }[];
584
792
  /**
585
793
  * The collapsed re-delivery this cycle sent, when it sent one (APRV-287):
@@ -658,33 +866,125 @@ export declare function dispatchPending(setup: ListenSetup, streams: Streams, st
658
866
  * it takes to say they are there.
659
867
  */
660
868
  export declare const COLLAPSE_STALE_AFTER_MS: number;
661
- /** The computed lines a collapsed re-delivery leads with (APRV-287). */
662
- export declare function staleLines(requests: ChannelRequest[], now: string): string[];
663
869
  /**
664
- * What a checkpoint tap does, on the machine the listener runs on (APRV-257).
870
+ * Pending requests a NEWER pending request has superseded (APRV-425).
871
+ *
872
+ * Two requests naming the same payload bytes and the same class are two askings
873
+ * of one question, and only the newer one has an asker. The shape that produces
874
+ * them is APRV-287's own: a hook whose wait ran out leaves its request open for
875
+ * the retry grace, the grace runs out, the hook withdraws it on its NEXT
876
+ * invocation — and if that next invocation never comes while a later session
877
+ * asks the same thing, both sit in the queue. Dogfooding produced exactly this
878
+ * complaint (APRV-118): a live prompt buried behind dead ones, and an approver
879
+ * rejecting the one they wanted.
880
+ *
881
+ * Keyed by `(payload_hash, class)` and not by task, because the task id a
882
+ * harness adapter mints is fresh per tool call (SPEC.md §10.2), so two askings
883
+ * of one command never share one. The bytes and the class are what a decision
884
+ * binds to, which is what makes them the right identity here.
885
+ *
886
+ * Computed from the pending set alone, which is re-derived from the verified log
887
+ * every cycle, so this decides nothing and remembers nothing. A superseded
888
+ * request is COLLAPSED, never closed: it stays pending in the log, listable, and
889
+ * decidable from any copy already delivered. Only a human's decision or the
890
+ * requester's own withdrawal ends it.
891
+ */
892
+ export declare function supersededPending(requests: ChannelRequest[]): Set<string>;
893
+ /**
894
+ * The pending set in the order an approver should meet it (APRV-425).
665
895
  *
666
- * The signing happens HERE, in the listener's process, and that is the whole
667
- * point of the tap: this process holds the vault passphrase because a HUMAN
668
- * exported it into the shell they started it from, and `core/child-env.ts`
669
- * strips that variable from every child an agent's session spawns. No agent can
670
- * arrange for a process that reaches this function with a key.
896
+ * Three rules, in this order, and each is a complaint from running the gate:
671
897
  *
672
- * Nothing about the head is re-derived. The `(seq, hash)` comes back from the
673
- * channel exactly as it was put on the screen, and
674
- * {@link ../core/checkpoint.js appendCheckpointAt} signs that and checks the
675
- * log still carries it. A handler that quietly re-read the head would be
676
- * putting a human's key over bytes nobody looked at.
898
+ * 1. **Attestation prompts last.** `buildPendingQueue` puts them there on
899
+ * purpose: a policy amendment changes the rules every entry above it was
900
+ * routed by, so an approver reading top to bottom answers the questions asked
901
+ * under the current policy before changing what the current policy is. That
902
+ * placement is not this function's to relitigate, so proposals are lifted
903
+ * out, ordered among themselves by nothing at all (log order), and put back
904
+ * at the end.
905
+ * 2. **Live requests first, newest first.** Live means younger than
906
+ * {@link COLLAPSE_STALE_AFTER_MS}, the hook's wait plus its retry grace,
907
+ * which is the same boundary the collapse uses — one number, one meaning of
908
+ * "somebody may still be holding this". Newest first because the newest is
909
+ * the one most likely to have a tool call blocked on it right now, and the
910
+ * observed failure was a live prompt buried behind dead ones.
911
+ * 3. **Stale requests after them, oldest first.** They are what the collapse
912
+ * takes on a first cycle, and where the collapse does not apply (fewer than
913
+ * {@link COLLAPSE_MIN} of them) oldest-first is the order to work through a
914
+ * backlog in.
677
915
  *
678
- * `Not now` appends nothing and says so. It is not a rejection: there is no
679
- * request here to reject, and a checkpoint that is owed is a warning at every
680
- * layer and a refusal at none.
916
+ * Stable inside each bucket, so log order breaks every tie and the result is
917
+ * deterministic for one log and one instant. It is an ORDER and nothing else:
918
+ * no request is dropped, none is decided, and the set that comes out is the set
919
+ * that went in.
681
920
  */
921
+ export declare function orderPending(requests: ChannelRequest[], now: string): ChannelRequest[];
922
+ /**
923
+ * The computed lines a collapsed re-delivery leads with (APRV-287).
924
+ *
925
+ * `superseded` is the subset a newer pending request replaced (APRV-425), and
926
+ * the first line states the split rather than claiming every member is old.
927
+ * Before this the line said "all older than the hook's wait plus its retry
928
+ * grace", which stopped being true the moment the collapse widened: a message
929
+ * that overstates what it collapsed is the stale-documentation failure in
930
+ * message form, and this one is read by the person deciding.
931
+ */
932
+ export declare function staleLines(requests: ChannelRequest[], now: string, superseded?: ReadonlySet<string>): string[];
933
+ /**
934
+ * Put the requests nobody is waiting on into ONE message, and hand back the
935
+ * ones that still get a message each (APRV-287, widened by APRV-425).
936
+ *
937
+ * Called on a process's first cycle only, which is exactly a daemon start or a
938
+ * listener reconnect. Everything it does is bookkeeping in the sense SPEC.md
939
+ * §10.3 fixes: the pending set is re-derived from the verified log every cycle,
940
+ * so a summary that fails to send, or a process that forgets it sent one,
941
+ * degrades to showing those requests again, and never to a pending request
942
+ * nobody is shown.
943
+ *
944
+ * ## Two ways in, one exit (APRV-425)
945
+ *
946
+ * A request is collapsed when it is older than the hook's wait plus its retry
947
+ * grace (nobody is holding it), or when a NEWER pending request names the same
948
+ * payload bytes and class ({@link supersededPending} — the newer one is the live
949
+ * asking, whatever the age of either). The second is what answers the observed
950
+ * complaint that a live prompt arrives buried behind dead ones.
951
+ *
952
+ * ## This is where the sent-record is rebuilt from the log (AC3)
953
+ *
954
+ * Every collapsed member is written into `state.delivered` and `state.sentAtMs`
955
+ * below, and the set it is written from is the pending set re-derived from the
956
+ * verified log. That is the whole of the rebuilding, and it is deliberately not
957
+ * a second mechanism: the log is the only place the question "what is pending"
958
+ * is answered.
959
+ *
960
+ * What it is NOT is evidence of delivery, and the difference is load-bearing.
961
+ * Nothing reads this record to conclude that an approver saw anything: a
962
+ * collapsed request stays pending in the log, is listed by `/queue`, and is
963
+ * decidable from any copy already delivered, because APRV-196 made
964
+ * `callback_data` carry a restart-stable action ref so a button on a
965
+ * pre-restart copy still decides the request. Lose the record and the next
966
+ * cycle shows the requests again, which is the degradation SPEC.md §10.3
967
+ * requires and the one this code takes.
968
+ */
969
+ /**
970
+ * The members a first-cycle collapse would put into one message: stale or
971
+ * superseded, and never a proposal (APRV-445 refutation, S2). Proposals are
972
+ * long-lived by design, so after a six-minute outage every one of them would
973
+ * otherwise land in one digest whose only bulk answer is reject-all.
974
+ */
975
+ export declare function collapsibleStale(undecided: readonly ChannelRequest[], now: string, superseded?: ReadonlySet<string>): ChannelRequest[];
976
+ /**
977
+ * Report a steady-state cycle's problems on stderr. Startup reports its own,
978
+ * as exit codes, in {@link runListener}.
979
+ */
980
+ export declare function reportCycle(result: DispatchResult, streams: Streams): void;
682
981
  export declare function checkpointHandlerFor(setup: ListenSetup, streams: Streams): (tap: {
683
982
  sign: boolean;
684
983
  head: {
685
984
  seq: number;
686
985
  hash: string;
687
986
  };
987
+ sender?: ChannelSender;
688
988
  }) => CheckpointTapResponse;
689
989
  /**
690
990
  * What a review tap does: the human-only `reviewSample`, and nothing else
@@ -712,6 +1012,7 @@ export declare function reviewHandlerFor(setup: ListenSetup, streams: Streams):
712
1012
  verdict: "ok" | "denied";
713
1013
  reaction?: "disliked" | "indifferent" | "liked" | "loved";
714
1014
  note?: string;
1015
+ sender?: ChannelSender;
715
1016
  }) => ReviewTapResponse;
716
1017
  /**
717
1018
  * `/queue`, `/skip`, `/next` — the paced walkthrough's three verbs (APRV-216).
@@ -784,6 +1085,24 @@ export interface RunningListener {
784
1085
  * queue from the verified log and re-sends everything still pending, exactly as
785
1086
  * a restarted process would. A duplicate on the phone, never a silence.
786
1087
  */
1088
+ /**
1089
+ * Give the channel every handler the runtime answers a gesture with, and hand
1090
+ * back the fresh dispatch bookkeeping (APRV-424).
1091
+ *
1092
+ * Extracted from {@link startListener} so the webhook runner wires the SAME
1093
+ * four handlers rather than a second set that looks like them. This is the
1094
+ * CLI-side half of the property APRV-424 is about: the transport decides where
1095
+ * an update arrives, and nothing else. A tap that arrives by webhook is
1096
+ * recorded by `handlerFor`'s `recordChannelDecision` — the same actor, the
1097
+ * same sender resolution, the same gate — because it is the same function
1098
+ * object, registered here.
1099
+ *
1100
+ * A FRESH {@link DispatchState} per call, which is the whole of the restart
1101
+ * story: a supervisor that restarts a fallen runner re-derives the pending
1102
+ * queue from the verified log and re-sends everything still pending. A
1103
+ * duplicate on the phone, never a silence.
1104
+ */
1105
+ export declare function wireListener(setup: ListenSetup, streams: Streams): DispatchState;
787
1106
  export declare function startListener(setup: ListenSetup, streams: Streams): RunningListener;
788
1107
  /**
789
1108
  * The listener verb. Returns a promise, which is why `main` treats `channel`