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
@@ -0,0 +1,277 @@
1
+ /**
2
+ * What every `approval setup` subcommand shares (SPEC.md §5.2, §10.1; APRV-79).
3
+ *
4
+ * `setup` began as one file with four subcommands in it. APRV-78 added
5
+ * `setup adapter <name>` in a file of its own, and it had to reach back into
6
+ * `cli/setup.ts` for the front matter — which made a cycle: `setup.ts` imports
7
+ * the adapter verb to dispatch it, and the adapter verb imports `front`,
8
+ * `requireHuman` and `SetupDeps` back. ESM tolerates that until the day an
9
+ * initialisation order changes and a `const` at module scope is `undefined` in
10
+ * one direction only. APRV-79 adds a THIRD such file (`setup-channel.ts`), so
11
+ * the cycle is broken by extraction rather than tolerated a second time.
12
+ *
13
+ * The rule this file exists to enforce, asserted in `tests/layering.test.ts`:
14
+ *
15
+ * ```
16
+ * setup.ts ──┬─> setup-adapter.ts ──┐
17
+ * └─> setup-channel.ts ──┴─> setup-common.ts (and no arrow back)
18
+ * ```
19
+ *
20
+ * What lives here is what more than one of those three needs: the dependency
21
+ * bag, the keystore seam, the flag table, the front matter (`--help`, the paths,
22
+ * the policy, the terminal check), the human-only gate, the `.approval/env`
23
+ * refusal mapping, the service names, and the plaintext-literal offer. What does
24
+ * NOT live here is anything one subcommand alone uses: the chat picker is
25
+ * `setup-channel.ts`'s, the manifest hint generator is `setup-adapter.ts`'s, and
26
+ * the generated-secret path (`storeGeneratedSecret`) stays with `vault` and
27
+ * `sampling` in `setup.ts`.
28
+ *
29
+ * The reasoning for each decision this file encodes — why the token is never
30
+ * handled by this process, why a generated value may reach an argv and an
31
+ * operator's own may not, why every subcommand refuses a non-terminal stdin —
32
+ * is in `cli/setup.ts`'s module doc, which is the family's front page. It is not
33
+ * repeated here; this file is the mechanism.
34
+ */
35
+ import { type EnvFileRefusal } from "../core/env-file.js";
36
+ import { type PolicyLoadResult } from "../core/policy-load.js";
37
+ import type { CredentialProvider } from "../adapters/contract.js";
38
+ import type { probeSmtp } from "../adapters/smtp.js";
39
+ import { type TelegramFetch } from "../channels/telegram.js";
40
+ import { type FlagKind } from "./args.js";
41
+ import type { Streams } from "./main.js";
42
+ import { type Prompter } from "./prompt.js";
43
+ /**
44
+ * The keystore item names, one per secret, SCOPED TO THIS INSTANCE (APRV-178).
45
+ *
46
+ * They were three fixed strings until a demo gate in another directory stored
47
+ * its bot token over the production gate's item, read the production token
48
+ * back, and had a human's approval tap consumed by the wrong listener. A
49
+ * keystore is machine-global and the filesystem scoping every other part of an
50
+ * instance has was simply missing here; `core/instance.ts` carries the whole
51
+ * reasoning and the shape of the suffix.
52
+ *
53
+ * Still not a flag. An operator reading `.approval/env` sees the service name
54
+ * in the file itself (`keychain:approval-tg-token-3f2a9c11`), so the name is
55
+ * discoverable, and a `--service-prefix` would add a way for two checkouts to
56
+ * disagree about which item is which — which is the bug, not the fix.
57
+ */
58
+ export interface ServiceNames {
59
+ telegramToken: string;
60
+ vaultPassphrase: string;
61
+ samplingSecret: string;
62
+ /** The key that hashes channel sender ids (APRV-370). */
63
+ senderKey: string;
64
+ }
65
+ /** The four item names the instance owning `logPath` reads and writes. */
66
+ export declare function servicesFor(logPath: string): ServiceNames;
67
+ /**
68
+ * The variable a sampling secret goes into when the policy names none. The
69
+ * value is stored either way; what the operator is then told to do is add the
70
+ * `audit.sampling_secret_env` line, because until the POLICY names a variable
71
+ * the sampler stays off (SPEC.md §5.2) and no amount of environment fixes that.
72
+ */
73
+ export declare const DEFAULT_SAMPLING_ENV = "APPROVAL_SAMPLING_SECRET";
74
+ /** The long-poll `getUpdates` asks for, in seconds. */
75
+ export declare const POLL_TIMEOUT_SECONDS = 10;
76
+ /** doctor's probe timeout, for the calls that answer immediately. */
77
+ export declare const PROBE_TIMEOUT_MS = 10000;
78
+ /** The flags every subcommand accepts. One table, so none of them drifts. */
79
+ export declare const FLAGS: Record<string, FlagKind>;
80
+ /** Which credential store this machine has, as a closed set. */
81
+ export type KeystoreKind = "keychain" | "secret-service" | "none";
82
+ /** What a store attempt did. `viaArgv` is reported, never hidden. */
83
+ export type StoreOutcome = {
84
+ ok: true;
85
+ /**
86
+ * The value passed through the helper's argv rather than its stdin. True
87
+ * only on the generated-secret fallback path; see `cli/setup.ts`.
88
+ */
89
+ viaArgv: boolean;
90
+ } | {
91
+ ok: false;
92
+ message: string;
93
+ };
94
+ /**
95
+ * The keystore operations `setup` needs, injectable for exactly the reason
96
+ * {@link defaultSourceRunner}'s seam exists: no test in this repository may
97
+ * touch a real Keychain or a real secret service, and the way to guarantee that
98
+ * is for the tests to hand over a fake rather than for the runtime to grow a
99
+ * test-only flag.
100
+ */
101
+ export interface KeystoreRunner {
102
+ /** What is available here. Consulted once per run. */
103
+ kind(): KeystoreKind;
104
+ /**
105
+ * Store a value THIS PROCESS GENERATED. Prefers the helper's stdin; may fall
106
+ * back to its argv, and says which it did.
107
+ */
108
+ storeGenerated(service: string, value: string): StoreOutcome;
109
+ /**
110
+ * Have the HELPER'S OWN no-echo prompt collect the value from the terminal.
111
+ * The value never enters this process. macOS and `secret-tool` both support
112
+ * this; there is no such thing on a machine with neither.
113
+ */
114
+ storePrompted(service: string): StoreOutcome;
115
+ /** Read a stored value back. The value arrives on stdout, never in an argv. */
116
+ read(service: string): {
117
+ ok: true;
118
+ value: string;
119
+ } | {
120
+ ok: false;
121
+ message: string;
122
+ };
123
+ }
124
+ /** A thrown thing, as a sentence. */
125
+ export declare function detail(cause: unknown): string;
126
+ /** The real one. Nothing in the test suite constructs it. */
127
+ export declare const defaultKeystoreRunner: KeystoreRunner;
128
+ /** The `.approval/env` scheme a backend writes. */
129
+ export declare function schemeFor(kind: KeystoreKind, service: string): string | null;
130
+ /** The command an operator runs by hand to see that the item is really there. */
131
+ export declare function retrievalCommand(kind: KeystoreKind, service: string): string;
132
+ /** The command an operator runs by hand to STORE the item, with no value in it. */
133
+ export declare function storageCommand(kind: KeystoreKind, service: string): string;
134
+ /** Everything this verb reaches the world through. Defaults are the real ones. */
135
+ export interface SetupDeps {
136
+ prompter?: Prompter | null;
137
+ keystore?: KeystoreRunner;
138
+ fetch?: TelegramFetch;
139
+ apiBase?: string;
140
+ /** Overridable so a test can assert on a value it chose. */
141
+ generate?: () => string;
142
+ /**
143
+ * The `getUpdates` long poll, in seconds. Overridable for one reason: the
144
+ * "nobody messaged the bot" path polls three times, and a suite that spent
145
+ * thirty seconds proving a refusal is a suite people stop running. Not a
146
+ * flag — no operator has a reason to change it.
147
+ */
148
+ pollTimeoutSeconds?: number;
149
+ /**
150
+ * The environment the passphrase is read from. `process.env` by default.
151
+ *
152
+ * A seam and not a back door: it is read through `passphraseFrom`, which is
153
+ * the same function `approval vault set` uses, and it never resolves
154
+ * `.approval/env` (§11.1 invariant 7). Injectable so a test can prove both
155
+ * the unset refusal and the happy path without mutating the suite's own
156
+ * environment, which is shared by every other test in the process.
157
+ */
158
+ env?: NodeJS.ProcessEnv;
159
+ /**
160
+ * The SMTP probe `setup adapter email` verifies with. The real one by
161
+ * default; a test injects a wrapper so that the only TLS relaxation in this
162
+ * repository stays inside the test that needs it (`tests/smtp-mock.ts`'s
163
+ * self-signed fixture on 127.0.0.1).
164
+ */
165
+ probe?: typeof probeSmtp;
166
+ /**
167
+ * The vault read `setup adapter email` probes a partial re-run through
168
+ * (APRV-99). The real {@link vaultCredentialProvider} by default — the same
169
+ * provider `approval adapter email` hands to `act` — and injectable for one
170
+ * reason: the fallback for a vault that will not open is unreachable
171
+ * otherwise, because the flow proved the passphrase at its preflight and the
172
+ * writes have already landed by the time verification runs.
173
+ */
174
+ credentials?: CredentialProvider;
175
+ }
176
+ export declare function usageError(streams: Streams, json: boolean, message: string, helpText: string): number;
177
+ /**
178
+ * A refused PROMPT, as one line and no help page (APRV-90).
179
+ *
180
+ * The distinction this function exists to draw: {@link usageError} answers a
181
+ * mangled command line, so it names the shape that line should have had, which
182
+ * is the thing the operator got wrong. A prompt that was aborted or answered
183
+ * wrongly five times is not a command line at all — the operator was in a
184
+ * conversation, the question was on screen, and a usage block under it teaches
185
+ * nothing. Same exit code (the frozen table is unchanged), one line of output,
186
+ * and not even the `--help` pointer a usage error carries.
187
+ */
188
+ export declare function promptRefusal(streams: Streams, message: string): number;
189
+ export declare function absolute(value: string, cwd: string): string;
190
+ export declare function refusalExitCode(refusal: EnvFileRefusal): number;
191
+ export declare function emitRefusal(streams: Streams, refusal: EnvFileRefusal): number;
192
+ export interface Context {
193
+ flags: Record<string, string | boolean>;
194
+ positionals: string[];
195
+ prompter: Prompter;
196
+ keystore: KeystoreRunner;
197
+ /**
198
+ * Which keystore this machine has. Named `backend` rather than `kind` because
199
+ * the outcome union around this context already discriminates on `kind`.
200
+ */
201
+ backend: KeystoreKind;
202
+ load: PolicyLoadResult;
203
+ logPath: string;
204
+ envPath: string;
205
+ /** This instance's keystore item names (APRV-178). */
206
+ services: ServiceNames;
207
+ apiBase: string;
208
+ generate: () => string;
209
+ pollTimeoutSeconds: number;
210
+ }
211
+ export type FrontOutcome = {
212
+ kind: "handled";
213
+ code: number;
214
+ } | ({
215
+ kind: "run";
216
+ } & Context);
217
+ /**
218
+ * What a non-interactive hint needs: where the map lives, which keystore is
219
+ * present, and the variable NAMES the loaded policy resolves to. The hints
220
+ * must print the names the interactive path would write, or an operator on a
221
+ * renamed policy copies a line the runtime never reads.
222
+ */
223
+ export interface HintContext {
224
+ envPath: string;
225
+ kind: KeystoreKind;
226
+ /**
227
+ * The instance's item names. A hint that printed the unscoped legacy name
228
+ * would teach the operator to create by hand exactly the shared item
229
+ * APRV-178 exists to stop.
230
+ */
231
+ services: ServiceNames;
232
+ passphraseEnv: string;
233
+ samplingEnv: string;
234
+ tokenEnv: string;
235
+ chatEnv: string;
236
+ }
237
+ /** The policy's `audit.sampling_secret_env`, or `null`. */
238
+ export declare function samplingEnvName(load: PolicyLoadResult): string | null;
239
+ export declare function hintContextFor(load: PolicyLoadResult, envPath: string, kind: KeystoreKind, services: ServiceNames): HintContext;
240
+ /**
241
+ * `--help`, the paths, the policy, the terminal check.
242
+ *
243
+ * The terminal check has no `process.stdin.isTTY` in it, deliberately: the real
244
+ * prompter refuses to construct without one ({@link createPrompter}), so "there
245
+ * is no prompter" IS "there is no terminal", and a test that injects one has
246
+ * not bypassed a check that a CI job could also bypass — it has supplied the
247
+ * human's side of the conversation, which is the only thing a test can honestly
248
+ * do here.
249
+ */
250
+ export declare function front(subcommand: string, argv: string[], streams: Streams, cwd: string, deps: SetupDeps, helpText: string, nonInteractiveHint: (context: HintContext) => string,
251
+ /**
252
+ * Flags this subcommand accepts on top of the shared table (APRV-110).
253
+ *
254
+ * `setup service` is the first subcommand whose subject is not a credential,
255
+ * so it needs words the other four have no use for (a platform, a unit label,
256
+ * a log directory). They are passed in rather than added to {@link FLAGS},
257
+ * because a flag every subcommand silently accepts is a flag an operator will
258
+ * eventually pass to the one that ignores it.
259
+ */
260
+ extraFlags?: Record<string, FlagKind>): FrontOutcome;
261
+ /** The human-only rule, spelled exactly as `vault set` spells it. */
262
+ export declare function requireHuman(flags: Record<string, string | boolean>, streams: Streams, helpText: string, verb: string): {
263
+ ok: true;
264
+ actor: string;
265
+ } | {
266
+ ok: false;
267
+ code: number;
268
+ };
269
+ /**
270
+ * The plaintext-literal offer, for a machine with no keystore.
271
+ *
272
+ * An explicit typed `yes` — not `y`, not Enter — because the whole content of
273
+ * this question is that the operator understood it. The warning is worded to
274
+ * match what `approval env --check` will print at them on every run afterwards,
275
+ * so the two never read as different claims about the same file.
276
+ */
277
+ export declare function offerLiteral(streams: Streams, prompter: Prompter, envPath: string, what: string): boolean;
@@ -38,7 +38,7 @@ import { userInfo } from "node:os";
38
38
  import { isAbsolute, resolve as resolvePathSegments } from "node:path";
39
39
  import { HUMAN_ACTOR_ENV, resolveHumanActor } from "../core/attest.js";
40
40
  import { defaultSourceRunner, envFilePathFor, } from "../core/env-file.js";
41
- import { LEGACY_SERVICE_SAMPLING_SECRET, LEGACY_SERVICE_TELEGRAM_TOKEN, LEGACY_SERVICE_VAULT_PASSPHRASE, scopedService, } from "../core/instance.js";
41
+ import { LEGACY_SERVICE_SAMPLING_SECRET, SERVICE_SENDER_KEY, LEGACY_SERVICE_TELEGRAM_TOKEN, LEGACY_SERVICE_VAULT_PASSPHRASE, scopedService, } from "../core/instance.js";
42
42
  import { loadPolicy } from "../core/policy-load.js";
43
43
  import { telegramChatEnvFor, telegramTokenEnvFor } from "../core/telegram-config.js";
44
44
  import { passphraseEnvFor } from "../core/vault.js";
@@ -49,12 +49,13 @@ import { DEFAULT_LOG_PATH, resolvePath } from "./paths.js";
49
49
  import { createPrompter } from "./prompt.js";
50
50
  import { refusal as renderRefusal, style } from "./style.js";
51
51
  import { usageErrorText } from "./usage.js";
52
- /** The three item names the instance owning `logPath` reads and writes. */
52
+ /** The four item names the instance owning `logPath` reads and writes. */
53
53
  export function servicesFor(logPath) {
54
54
  return {
55
55
  telegramToken: scopedService(LEGACY_SERVICE_TELEGRAM_TOKEN, logPath),
56
56
  vaultPassphrase: scopedService(LEGACY_SERVICE_VAULT_PASSPHRASE, logPath),
57
57
  samplingSecret: scopedService(LEGACY_SERVICE_SAMPLING_SECRET, logPath),
58
+ senderKey: scopedService(SERVICE_SENDER_KEY, logPath),
58
59
  };
59
60
  }
60
61
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"setup-common.js","sourceRoot":"","sources":["../../../src/cli/setup-common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,SAAS,EAA2C,MAAM,oBAAoB,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,mBAA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ACf,IAAY;IAEZ,OAAO,CAAC,GAAG,CACT,2KAA2K,IAAI,WAAW,OAAO,sZAAsZ,CACxlB,CAAC;IACF,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,iDAAiD,CAAC,CAAC;IACpF,MAAM,KAAK,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACpC,IAAI,KAAK,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC;IACjC,OAAO,CAAC,GAAG,CAAC,6DAA6D,CAAC,CAAC;IAC3E,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,287 @@
1
+ /**
2
+ * The credential-collection flow (SPEC.md §5.2, §10.1, §10.4; APRV-78).
3
+ *
4
+ * `setup identity|vault|sampling|telegram` each hand-rolled their own
5
+ * conversation, and that was right while there were four of them and each was
6
+ * different. `setup adapter <name>` was the first verb whose conversation is
7
+ * DERIVED — from a manifest of {@link CredentialSpec}s an adapter declares — so
8
+ * the conversation itself becomes a function, and this file is that function.
9
+ * APRV-79 made it the second caller's too: `setup channel telegram` runs this
10
+ * flow over the Telegram channel's manifest, into `.approval/env` instead of
11
+ * into the vault, which is what the destination seam was built for.
12
+ *
13
+ * It knows nothing about email, SMTP, Telegram, or the vault's file format. It
14
+ * is handed a list of specs, somewhere to put the values
15
+ * ({@link FlowDestination}), and up to four hooks, and it runs one fixed order:
16
+ *
17
+ * 1. the title and the prerequisite line;
18
+ * 2. **the checklist** — one line per spec, before a single question is asked,
19
+ * so an operator can see the whole shape of what is about to be demanded and
20
+ * where it will land, and abandon at zero cost if it is the wrong vault;
21
+ * 3. **the preflight** ({@link FlowDestination.present}), which for a vault
22
+ * means OPENING it. This is why it is step three and not step six: a wrong
23
+ * passphrase must refuse before the operator has typed a password, not
24
+ * after. The set it returns is also what step four reads;
25
+ * 4. **the replacement plan** ({@link planWrites}), asked up front for the same
26
+ * reason `setup`'s own does: a confirmation asked after the value had been
27
+ * replaced is a question whose "no" no longer means anything. A name the
28
+ * operator declines is never even asked for;
29
+ * 5. **collection**, in manifest order;
30
+ * 6. **the cross-field check** ({@link FlowHooks.check}), before any write, so
31
+ * a half-configured pair costs nothing;
32
+ * 7. **the writes**, in manifest order — which is why an adapter puts its
33
+ * secret last: a destination that refuses half way reports exactly which
34
+ * names landed and stops. **There is no rollback**, deliberately: deleting
35
+ * credentials in response to a write failure is a destructive act taken by a
36
+ * wizard on its own authority, over a store whose previous contents it
37
+ * cannot restore;
38
+ * 8. **verification** ({@link FlowHooks.verify}), after the write, because the
39
+ * thing being verified is the stored configuration; and
40
+ * 9. **the report** — where, how many, which names — and the next steps.
41
+ *
42
+ * **Values are held in this process and printed by nothing.** The flow must
43
+ * hold them: it collected them and it is about to write them. Every line it
44
+ * emits names a CREDENTIAL NAME, a kind, a count, or a path, and the suite in
45
+ * `tests/cli-setup.test.ts` sweeps every captured byte for the fixture secrets
46
+ * with no exemption on this path.
47
+ */
48
+ import type { CredentialSpec } from "../core/credential-spec.js";
49
+ import { envFilePathFor } from "../core/env-file.js";
50
+ import type { Streams } from "./main.js";
51
+ import { type Prompter } from "./prompt.js";
52
+ /**
53
+ * A refusal from a destination, already carrying its exit code.
54
+ *
55
+ * The code is decided by the destination and not by this file, because the
56
+ * frozen exit table's split (4 is a filesystem fact, 1 is the runtime deciding
57
+ * no) is a property of the STORE's vocabulary — `cli/vault.ts` and
58
+ * `cli/setup.ts` each already map their own refusals that way, and a flow that
59
+ * re-derived the mapping would be a third opinion about the same table.
60
+ */
61
+ export interface FlowRefusal {
62
+ code: string;
63
+ message: string;
64
+ exitCode: number;
65
+ }
66
+ /** Where a flow puts what it collected. Two implementations live below. */
67
+ export interface FlowDestination {
68
+ kind: "vault" | "env-file";
69
+ /** The path, for the checklist and the report. Never a value. */
70
+ where(): string;
71
+ /**
72
+ * Which of the names are ALREADY there — and, for a store that must be
73
+ * unlocked, the act of unlocking it. Called once, before anything is asked.
74
+ */
75
+ present(): {
76
+ ok: true;
77
+ names: ReadonlySet<string>;
78
+ } | ({
79
+ ok: false;
80
+ } & FlowRefusal);
81
+ /** Store one value. Called once per name, in manifest order. */
82
+ write(name: string, value: string): {
83
+ ok: true;
84
+ } | ({
85
+ ok: false;
86
+ } & FlowRefusal);
87
+ }
88
+ /**
89
+ * The encrypted credential store (SPEC.md §10.4).
90
+ *
91
+ * `present()` is where the passphrase is proved. A vault that does not exist
92
+ * yet holds nothing and refuses nothing: the first `write` creates it, which is
93
+ * what `approval vault set` does too. A vault that DOES exist is opened here
94
+ * and nowhere later, so a wrong passphrase costs the operator one line of
95
+ * output rather than five typed values.
96
+ */
97
+ export declare function vaultDestination(vaultPath: string, passphrase: string): FlowDestination;
98
+ /**
99
+ * The `.approval/env` source map (SPEC.md §5.2).
100
+ *
101
+ * Unused by `setup adapter` — an adapter's credentials go to the vault, never
102
+ * to this file — and used by `setup channel telegram`, which is what a channel's
103
+ * two values are: a source for the token and a literal chat id, both of them
104
+ * things that unlock the machine rather than things an adapter spends.
105
+ *
106
+ * The value written is whatever the caller collected, which on this path is a
107
+ * SOURCE (`keychain:<service>`), an identity, or a chat id. Nothing here decides
108
+ * that; {@link upsertEnvFileEntries} preserves every other line and comment.
109
+ */
110
+ export declare function envFileDestination(envPath: string): FlowDestination;
111
+ /** The env file for a log path, re-exported so a caller needs one import. */
112
+ export { envFilePathFor };
113
+ /** How a destination talks about what it already holds. */
114
+ export interface PlanPhrases {
115
+ /** `<name> already has a line in <path> (its value is not printed here).` */
116
+ present(name: string, where: string): string;
117
+ /** The confirm question. Defaults to no, like every other one in `setup`. */
118
+ replace(name: string): string;
119
+ /** The "left alone" report, or `null` when nothing was left alone. */
120
+ leftAlone(names: string[], where: string): string;
121
+ }
122
+ /**
123
+ * The two phrasings, kept as data.
124
+ *
125
+ * The env-file wording is BYTE-FOR-BYTE what `setup identity|vault|sampling|
126
+ * telegram` printed before this file existed, because those sentences are
127
+ * asserted on and, more to the point, an operator who has run `setup` before
128
+ * should not be told the same fact in new words for no reason.
129
+ */
130
+ export declare const PLAN_PHRASES: Record<FlowDestination["kind"], PlanPhrases>;
131
+ /**
132
+ * Which names to ask for, given which are already there.
133
+ *
134
+ * Asked BEFORE any work is done, and no previous VALUE is ever printed — not
135
+ * even one that is not a secret. A store may legitimately hold anything under
136
+ * any name, the operator put it there, and a verb that echoed "replacing
137
+ * smtp.user (you@example.net)?" would publish it into a terminal on their
138
+ * behalf.
139
+ */
140
+ export declare function planWrites(streams: Streams, prompter: Prompter, present: ReadonlySet<string>, where: string, names: readonly string[], phrases: PlanPhrases): {
141
+ write: string[];
142
+ skipped: string[];
143
+ };
144
+ /** Report what was left alone, so a re-run's "no" is visible in the output. */
145
+ export declare function reportLeftAlone(streams: Streams, where: string, skipped: readonly string[], phrases: PlanPhrases): void;
146
+ /**
147
+ * A numbered picker over a closed list.
148
+ *
149
+ * Extracted from the Telegram chat picker, which is the same conversation over
150
+ * different nouns: print the options with an index and read a number. Both
151
+ * callers use this one (APRV-79).
152
+ *
153
+ * **An unparseable answer is asked again** (APRV-90). It used to be a refusal,
154
+ * on the argument that a wizard which loops on one question and not the others
155
+ * is unpredictable — the answer to which turned out to be that every question
156
+ * loops, not that none of them does. The options are printed once; only the
157
+ * question repeats, under one line saying which number was not on the list.
158
+ * `ok: false` now means the human withdrew (Ctrl-D) or ran out of attempts, and
159
+ * the message says which.
160
+ */
161
+ export declare function pickOne<T>(streams: Streams, prompter: Prompter, options: {
162
+ heading: string;
163
+ items: readonly T[];
164
+ label(item: T): string;
165
+ prompt: string;
166
+ /** Index of the item an empty answer takes, or `null` for no default. */
167
+ defaultIndex: number | null;
168
+ }): {
169
+ ok: true;
170
+ item: T;
171
+ } | {
172
+ ok: false;
173
+ message: string;
174
+ };
175
+ /** What a verification attempt reports back. Never carries a value. */
176
+ export interface VerifyOutcome {
177
+ /** Did the far end accept the stored configuration? */
178
+ ok: boolean;
179
+ /** The operator declined to verify. `ok` is ignored when this is true. */
180
+ declined?: boolean;
181
+ /** Lines to print, already redacted by whoever built them. */
182
+ detail: string;
183
+ }
184
+ /** What the flow has done by the time {@link FlowHooks.verify} is called. */
185
+ export interface FlowProgress {
186
+ /** Names stored this run, in the order they landed. */
187
+ written: readonly string[];
188
+ /** Names the operator declined to replace, so this run never saw them. */
189
+ skipped: readonly string[];
190
+ }
191
+ /**
192
+ * What a {@link FlowHooks.collect} or {@link FlowHooks.discover} attempt did.
193
+ *
194
+ * `refused` carries an exit code and nothing else, because the hook has already
195
+ * printed its own sentences. A channel's refusals are specific to the far end
196
+ * it just talked to — an invalid bot token, a 409 from a running listener, no
197
+ * message reaching the bot after three attempts, each with its own repair and
198
+ * its own code from the frozen table — and a flow that re-derived them from a
199
+ * message string would be a second opinion about what went wrong.
200
+ */
201
+ export type HookOutcome = {
202
+ kind: "value";
203
+ value: string;
204
+ }
205
+ /** Nothing to store for this spec. A required spec may not do this. */
206
+ | {
207
+ kind: "skip";
208
+ } | {
209
+ kind: "refused";
210
+ code: number;
211
+ };
212
+ export interface FlowHooks {
213
+ /**
214
+ * Collect one value, overriding the built-in prompts.
215
+ *
216
+ * Async because a hook may need to prove what it collected before the flow
217
+ * writes anything: `setup channel telegram` calls `getMe` at the end of its
218
+ * token collection, so an invalid token refuses at step five and no line is
219
+ * ever written. Handed what has been collected so far, in manifest order.
220
+ */
221
+ collect?(spec: CredentialSpec, state: Readonly<Record<string, string>>): Promise<HookOutcome>;
222
+ /**
223
+ * The cross-field rule, run over everything collected, before any write.
224
+ * Returns the refusal sentence, or `null`. `kept` names the values already
225
+ * in the store that the operator declined to replace this run (APRV-98): the
226
+ * flow never reads a value back, so a rule that needs to know whether a
227
+ * kept name is PRESENT gets that from here rather than from `values`.
228
+ */
229
+ check?(values: Record<string, string>, kept: readonly string[]): string | null;
230
+ /**
231
+ * Prove the stored configuration against the far end. Runs after the write.
232
+ *
233
+ * It is handed what the run DID as well as what it collected, because
234
+ * "verify" and "verify what is in the store" are different questions on a
235
+ * re-run: a hook that only saw the values would probe a partial
236
+ * configuration and report a failure about a deployment that is fine. The
237
+ * flow will not read the store back to complete the picture, and neither
238
+ * should a hook — there is no verb in this CLI that reads a credential out.
239
+ */
240
+ verify?(values: Record<string, string>, progress: FlowProgress): Promise<VerifyOutcome>;
241
+ /**
242
+ * Ask the SERVICE what a value is, rather than asking the human to type it.
243
+ *
244
+ * Called for one spec at a time, and only when {@link FlowHooks.collect}
245
+ * skipped it (or there is no `collect` and the spec is optional and empty),
246
+ * so the two compose: a manifest can have some values typed and some
247
+ * discovered without the flow knowing which is which. It is handed what has
248
+ * been collected so far, because discovery generally needs it — Telegram's
249
+ * chat discovery cannot happen before the token it polls with.
250
+ *
251
+ * APRV-78 reserved this hook and called nothing; APRV-79 is the caller.
252
+ */
253
+ discover?(spec: CredentialSpec, state: Readonly<Record<string, string>>): Promise<HookOutcome>;
254
+ }
255
+ export interface FlowLabels {
256
+ /** The first line: what this verb is about to do. */
257
+ title: string;
258
+ /** The prerequisite sentence, printed under the title. */
259
+ prereq?: string;
260
+ /** Printed last, after the report. One line each. */
261
+ nextSteps?: readonly string[];
262
+ }
263
+ export interface FlowResult {
264
+ /** The exit code, from the frozen table. */
265
+ code: number;
266
+ /** Names actually stored, in the order they landed. */
267
+ written: string[];
268
+ /** Names the operator declined to replace. */
269
+ skipped: string[];
270
+ verified: "passed" | "failed" | "declined" | "not-attempted";
271
+ }
272
+ export interface CredentialFlow {
273
+ streams: Streams;
274
+ prompter: Prompter;
275
+ specs: readonly CredentialSpec[];
276
+ destination: FlowDestination;
277
+ labels: FlowLabels;
278
+ hooks?: FlowHooks;
279
+ }
280
+ /**
281
+ * Run one credential conversation, start to finish. Never throws.
282
+ *
283
+ * The caller has already done everything that is its own business: flags, the
284
+ * terminal check, the human-only gate, and resolving the passphrase out of the
285
+ * environment. What arrives here is a manifest and somewhere to put it.
286
+ */
287
+ export declare function runCredentialFlow(flow: CredentialFlow): Promise<FlowResult>;