approval-md 0.0.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +176 -0
- package/NOTICE +5 -0
- package/README.md +940 -4
- package/SPEC.md +476 -34
- package/cli.js +29 -3
- package/dist/src/adapters/agentmail.d.ts +426 -0
- package/dist/src/adapters/agentmail.js +1200 -0
- package/dist/src/adapters/agentmail.js.map +1 -0
- package/dist/src/adapters/conformance.d.ts +149 -0
- package/dist/src/adapters/conformance.js +461 -0
- package/dist/src/adapters/conformance.js.map +1 -0
- package/dist/src/adapters/contract.d.ts +628 -0
- package/dist/src/adapters/contract.js +1035 -0
- package/dist/src/adapters/contract.js.map +1 -0
- package/dist/src/adapters/email.d.ts +324 -0
- package/dist/src/adapters/email.js +749 -0
- package/dist/src/adapters/email.js.map +1 -0
- package/dist/src/adapters/env-passphrase.d.ts +93 -0
- package/dist/src/adapters/env-passphrase.js +132 -0
- package/dist/src/adapters/env-passphrase.js.map +1 -0
- package/dist/src/adapters/public.d.ts +11 -0
- package/dist/src/adapters/public.js +11 -0
- package/dist/src/adapters/public.js.map +1 -0
- package/dist/src/adapters/registry.d.ts +59 -0
- package/dist/src/adapters/registry.js +77 -0
- package/dist/src/adapters/registry.js.map +1 -0
- package/dist/src/adapters/smtp.d.ts +213 -0
- package/dist/src/adapters/smtp.js +499 -0
- package/dist/src/adapters/smtp.js.map +1 -0
- package/dist/src/adapters/vault-provider.d.ts +114 -0
- package/dist/src/adapters/vault-provider.js +161 -0
- package/dist/src/adapters/vault-provider.js.map +1 -0
- package/dist/src/adapters/zzz.d.ts +66 -0
- package/dist/src/adapters/zzz.js +299 -0
- package/dist/src/adapters/zzz.js.map +1 -0
- package/dist/src/channels/batch.d.ts +109 -0
- package/dist/src/channels/batch.js +121 -0
- package/dist/src/channels/batch.js.map +1 -0
- package/dist/src/channels/cli.d.ts +193 -0
- package/dist/src/channels/cli.js +468 -0
- package/dist/src/channels/cli.js.map +1 -0
- package/dist/src/channels/conformance.d.ts +92 -0
- package/dist/src/channels/conformance.js +445 -0
- package/dist/src/channels/conformance.js.map +1 -0
- package/dist/src/channels/contract.d.ts +623 -0
- package/dist/src/channels/contract.js +494 -0
- package/dist/src/channels/contract.js.map +1 -0
- package/dist/src/channels/payload-view.d.ts +35 -0
- package/dist/src/channels/payload-view.js +43 -0
- package/dist/src/channels/payload-view.js.map +1 -0
- package/dist/src/channels/render-queue.d.ts +149 -0
- package/dist/src/channels/render-queue.js +564 -0
- package/dist/src/channels/render-queue.js.map +1 -0
- package/dist/src/channels/tagging.d.ts +196 -0
- package/dist/src/channels/tagging.js +723 -0
- package/dist/src/channels/tagging.js.map +1 -0
- package/dist/src/channels/telegram.d.ts +1832 -0
- package/dist/src/channels/telegram.js +3190 -0
- package/dist/src/channels/telegram.js.map +1 -0
- package/dist/src/channels/web.d.ts +341 -0
- package/dist/src/channels/web.js +903 -0
- package/dist/src/channels/web.js.map +1 -0
- package/dist/src/cli/adapter.d.ts +90 -0
- package/dist/src/cli/adapter.js +288 -0
- package/dist/src/cli/adapter.js.map +1 -0
- package/dist/src/cli/amend.d.ts +59 -0
- package/dist/src/cli/amend.js +2171 -0
- package/dist/src/cli/amend.js.map +1 -0
- package/dist/src/cli/args.d.ts +43 -0
- package/dist/src/cli/args.js +86 -0
- package/dist/src/cli/args.js.map +1 -0
- package/dist/src/cli/attest.d.ts +41 -0
- package/dist/src/cli/attest.js +307 -0
- package/dist/src/cli/attest.js.map +1 -0
- package/dist/src/cli/audit-card.d.ts +62 -0
- package/dist/src/cli/audit-card.js +201 -0
- package/dist/src/cli/audit-card.js.map +1 -0
- package/dist/src/cli/audit.d.ts +59 -0
- package/dist/src/cli/audit.js +460 -0
- package/dist/src/cli/audit.js.map +1 -0
- package/dist/src/cli/channel-telegram.d.ts +806 -0
- package/dist/src/cli/channel-telegram.js +2063 -0
- package/dist/src/cli/channel-telegram.js.map +1 -0
- package/dist/src/cli/channel-web.d.ts +131 -0
- package/dist/src/cli/channel-web.js +357 -0
- package/dist/src/cli/channel-web.js.map +1 -0
- package/dist/src/cli/channel.d.ts +71 -0
- package/dist/src/cli/channel.js +438 -0
- package/dist/src/cli/channel.js.map +1 -0
- package/dist/src/cli/checkpoint-tap.d.ts +169 -0
- package/dist/src/cli/checkpoint-tap.js +238 -0
- package/dist/src/cli/checkpoint-tap.js.map +1 -0
- package/dist/src/cli/codex.d.ts +2 -0
- package/dist/src/cli/codex.js +172 -0
- package/dist/src/cli/codex.js.map +1 -0
- package/dist/src/cli/coverage.d.ts +61 -0
- package/dist/src/cli/coverage.js +343 -0
- package/dist/src/cli/coverage.js.map +1 -0
- package/dist/src/cli/daemon.d.ts +120 -0
- package/dist/src/cli/daemon.js +631 -0
- package/dist/src/cli/daemon.js.map +1 -0
- package/dist/src/cli/doctor.d.ts +129 -0
- package/dist/src/cli/doctor.js +2762 -0
- package/dist/src/cli/doctor.js.map +1 -0
- package/dist/src/cli/env.d.ts +65 -0
- package/dist/src/cli/env.js +302 -0
- package/dist/src/cli/env.js.map +1 -0
- package/dist/src/cli/execute.d.ts +202 -0
- package/dist/src/cli/execute.js +1682 -0
- package/dist/src/cli/execute.js.map +1 -0
- package/dist/src/cli/exit-codes.d.ts +73 -0
- package/dist/src/cli/exit-codes.js +82 -0
- package/dist/src/cli/exit-codes.js.map +1 -0
- package/dist/src/cli/feedback.d.ts +60 -0
- package/dist/src/cli/feedback.js +205 -0
- package/dist/src/cli/feedback.js.map +1 -0
- package/dist/src/cli/gate-window.d.ts +40 -0
- package/dist/src/cli/gate-window.js +294 -0
- package/dist/src/cli/gate-window.js.map +1 -0
- package/dist/src/cli/gate.d.ts +68 -0
- package/dist/src/cli/gate.js +557 -0
- package/dist/src/cli/gate.js.map +1 -0
- package/dist/src/cli/git-scope.d.ts +190 -0
- package/dist/src/cli/git-scope.js +295 -0
- package/dist/src/cli/git-scope.js.map +1 -0
- package/dist/src/cli/gloss-attach.d.ts +85 -0
- package/dist/src/cli/gloss-attach.js +107 -0
- package/dist/src/cli/gloss-attach.js.map +1 -0
- package/dist/src/cli/gloss-codex-child.d.ts +9 -0
- package/dist/src/cli/gloss-codex-child.js +149 -0
- package/dist/src/cli/gloss-codex-child.js.map +1 -0
- package/dist/src/cli/gloss-codex.d.ts +24 -0
- package/dist/src/cli/gloss-codex.js +255 -0
- package/dist/src/cli/gloss-codex.js.map +1 -0
- package/dist/src/cli/gloss-options.d.ts +42 -0
- package/dist/src/cli/gloss-options.js +79 -0
- package/dist/src/cli/gloss-options.js.map +1 -0
- package/dist/src/cli/gloss.d.ts +265 -0
- package/dist/src/cli/gloss.js +362 -0
- package/dist/src/cli/gloss.js.map +1 -0
- package/dist/src/cli/help.d.ts +103 -0
- package/dist/src/cli/help.js +2339 -0
- package/dist/src/cli/help.js.map +1 -0
- package/dist/src/cli/hook-codex.d.ts +78 -0
- package/dist/src/cli/hook-codex.js +167 -0
- package/dist/src/cli/hook-codex.js.map +1 -0
- package/dist/src/cli/hook.d.ts +331 -0
- package/dist/src/cli/hook.js +2849 -0
- package/dist/src/cli/hook.js.map +1 -0
- package/dist/src/cli/import.d.ts +35 -0
- package/dist/src/cli/import.js +175 -0
- package/dist/src/cli/import.js.map +1 -0
- package/dist/src/cli/init.d.ts +84 -0
- package/dist/src/cli/init.js +336 -0
- package/dist/src/cli/init.js.map +1 -0
- package/dist/src/cli/instructions.d.ts +23 -0
- package/dist/src/cli/instructions.js +262 -0
- package/dist/src/cli/instructions.js.map +1 -0
- package/dist/src/cli/journal.d.ts +41 -0
- package/dist/src/cli/journal.js +238 -0
- package/dist/src/cli/journal.js.map +1 -0
- package/dist/src/cli/log-advance.d.ts +287 -0
- package/dist/src/cli/log-advance.js +840 -0
- package/dist/src/cli/log-advance.js.map +1 -0
- package/dist/src/cli/log-anchor.d.ts +176 -0
- package/dist/src/cli/log-anchor.js +387 -0
- package/dist/src/cli/log-anchor.js.map +1 -0
- package/dist/src/cli/log-checkpoint.d.ts +22 -0
- package/dist/src/cli/log-checkpoint.js +128 -0
- package/dist/src/cli/log-checkpoint.js.map +1 -0
- package/dist/src/cli/log-sync.d.ts +243 -0
- package/dist/src/cli/log-sync.js +849 -0
- package/dist/src/cli/log-sync.js.map +1 -0
- package/dist/src/cli/log-verbs.d.ts +16 -0
- package/dist/src/cli/log-verbs.js +360 -0
- package/dist/src/cli/log-verbs.js.map +1 -0
- package/dist/src/cli/long-help.d.ts +70 -0
- package/dist/src/cli/long-help.js +148 -0
- package/dist/src/cli/long-help.js.map +1 -0
- package/dist/src/cli/main.d.ts +77 -0
- package/dist/src/cli/main.js +1206 -0
- package/dist/src/cli/main.js.map +1 -0
- package/dist/src/cli/mcp.d.ts +52 -0
- package/dist/src/cli/mcp.js +306 -0
- package/dist/src/cli/mcp.js.map +1 -0
- package/dist/src/cli/paths.d.ts +56 -0
- package/dist/src/cli/paths.js +79 -0
- package/dist/src/cli/paths.js.map +1 -0
- package/dist/src/cli/payload.d.ts +58 -0
- package/dist/src/cli/payload.js +253 -0
- package/dist/src/cli/payload.js.map +1 -0
- package/dist/src/cli/policy.d.ts +43 -0
- package/dist/src/cli/policy.js +229 -0
- package/dist/src/cli/policy.js.map +1 -0
- package/dist/src/cli/preflight.d.ts +363 -0
- package/dist/src/cli/preflight.js +1175 -0
- package/dist/src/cli/preflight.js.map +1 -0
- package/dist/src/cli/progress.d.ts +78 -0
- package/dist/src/cli/progress.js +112 -0
- package/dist/src/cli/progress.js.map +1 -0
- package/dist/src/cli/prompt.d.ts +209 -0
- package/dist/src/cli/prompt.js +312 -0
- package/dist/src/cli/prompt.js.map +1 -0
- package/dist/src/cli/quickstart.d.ts +46 -0
- package/dist/src/cli/quickstart.js +297 -0
- package/dist/src/cli/quickstart.js.map +1 -0
- package/dist/src/cli/records.d.ts +34 -0
- package/dist/src/cli/records.js +66 -0
- package/dist/src/cli/records.js.map +1 -0
- package/dist/src/cli/render.d.ts +22 -0
- package/dist/src/cli/render.js +132 -0
- package/dist/src/cli/render.js.map +1 -0
- package/dist/src/cli/sandbox.d.ts +51 -0
- package/dist/src/cli/sandbox.js +150 -0
- package/dist/src/cli/sandbox.js.map +1 -0
- package/dist/src/cli/scaffold.d.ts +79 -0
- package/dist/src/cli/scaffold.js +137 -0
- package/dist/src/cli/scaffold.js.map +1 -0
- package/dist/src/cli/setup-adapter.d.ts +137 -0
- package/dist/src/cli/setup-adapter.js +509 -0
- package/dist/src/cli/setup-adapter.js.map +1 -0
- package/dist/src/cli/setup-channel.d.ts +117 -0
- package/dist/src/cli/setup-channel.js +635 -0
- package/dist/src/cli/setup-channel.js.map +1 -0
- package/dist/src/cli/setup-checkpoint.d.ts +57 -0
- package/dist/src/cli/setup-checkpoint.js +196 -0
- package/dist/src/cli/setup-checkpoint.js.map +1 -0
- package/dist/src/cli/setup-common.d.ts +275 -0
- package/dist/src/cli/setup-common.js +376 -0
- package/dist/src/cli/setup-common.js.map +1 -0
- package/dist/src/cli/setup-flow.d.ts +287 -0
- package/dist/src/cli/setup-flow.js +476 -0
- package/dist/src/cli/setup-flow.js.map +1 -0
- package/dist/src/cli/setup-service.d.ts +96 -0
- package/dist/src/cli/setup-service.js +308 -0
- package/dist/src/cli/setup-service.js.map +1 -0
- package/dist/src/cli/setup.d.ts +202 -0
- package/dist/src/cli/setup.js +473 -0
- package/dist/src/cli/setup.js.map +1 -0
- package/dist/src/cli/style.d.ts +320 -0
- package/dist/src/cli/style.js +469 -0
- package/dist/src/cli/style.js.map +1 -0
- package/dist/src/cli/token.d.ts +39 -0
- package/dist/src/cli/token.js +274 -0
- package/dist/src/cli/token.js.map +1 -0
- package/dist/src/cli/up.d.ts +155 -0
- package/dist/src/cli/up.js +849 -0
- package/dist/src/cli/up.js.map +1 -0
- package/dist/src/cli/usage.d.ts +37 -0
- package/dist/src/cli/usage.js +91 -0
- package/dist/src/cli/usage.js.map +1 -0
- package/dist/src/cli/values.d.ts +40 -0
- package/dist/src/cli/values.js +189 -0
- package/dist/src/cli/values.js.map +1 -0
- package/dist/src/cli/vault.d.ts +59 -0
- package/dist/src/cli/vault.js +362 -0
- package/dist/src/cli/vault.js.map +1 -0
- package/dist/src/cli/verb-registry.d.ts +76 -0
- package/dist/src/cli/verb-registry.js +2341 -0
- package/dist/src/cli/verb-registry.js.map +1 -0
- package/dist/src/cli/wordmark.d.ts +31 -0
- package/dist/src/cli/wordmark.js +52 -0
- package/dist/src/cli/wordmark.js.map +1 -0
- package/dist/src/codex/doctor.d.ts +13 -0
- package/dist/src/codex/doctor.js +41 -0
- package/dist/src/codex/doctor.js.map +1 -0
- package/dist/src/codex/manifest.d.ts +49 -0
- package/dist/src/codex/manifest.js +103 -0
- package/dist/src/codex/manifest.js.map +1 -0
- package/dist/src/codex/templates.d.ts +41 -0
- package/dist/src/codex/templates.js +319 -0
- package/dist/src/codex/templates.js.map +1 -0
- package/dist/src/codex/trust.d.ts +19 -0
- package/dist/src/codex/trust.js +183 -0
- package/dist/src/codex/trust.js.map +1 -0
- package/dist/src/codex/workspace-plan.d.ts +131 -0
- package/dist/src/codex/workspace-plan.js +561 -0
- package/dist/src/codex/workspace-plan.js.map +1 -0
- package/dist/src/core/actor.d.ts +2 -0
- package/dist/src/core/actor.js +5 -0
- package/dist/src/core/actor.js.map +1 -0
- package/dist/src/core/advance-cycle.d.ts +170 -0
- package/dist/src/core/advance-cycle.js +200 -0
- package/dist/src/core/advance-cycle.js.map +1 -0
- package/dist/src/core/agents-md.d.ts +276 -0
- package/dist/src/core/agents-md.js +747 -0
- package/dist/src/core/agents-md.js.map +1 -0
- package/dist/src/core/apply-patch.d.ts +49 -0
- package/dist/src/core/apply-patch.js +266 -0
- package/dist/src/core/apply-patch.js.map +1 -0
- package/dist/src/core/attest.d.ts +420 -0
- package/dist/src/core/attest.js +589 -0
- package/dist/src/core/attest.js.map +1 -0
- package/dist/src/core/audit.d.ts +492 -0
- package/dist/src/core/audit.js +882 -0
- package/dist/src/core/audit.js.map +1 -0
- package/dist/src/core/budgets.d.ts +238 -0
- package/dist/src/core/budgets.js +449 -0
- package/dist/src/core/budgets.js.map +1 -0
- package/dist/src/core/checkpoint.d.ts +500 -0
- package/dist/src/core/checkpoint.js +738 -0
- package/dist/src/core/checkpoint.js.map +1 -0
- package/dist/src/core/child-env.d.ts +88 -0
- package/dist/src/core/child-env.js +86 -0
- package/dist/src/core/child-env.js.map +1 -0
- package/dist/src/core/clock.d.ts +52 -0
- package/dist/src/core/clock.js +43 -0
- package/dist/src/core/clock.js.map +1 -0
- package/dist/src/core/command-class.d.ts +543 -0
- package/dist/src/core/command-class.js +2356 -0
- package/dist/src/core/command-class.js.map +1 -0
- package/dist/src/core/coverage-sources/adapter.d.ts +40 -0
- package/dist/src/core/coverage-sources/adapter.js +71 -0
- package/dist/src/core/coverage-sources/adapter.js.map +1 -0
- package/dist/src/core/coverage-sources/gh.d.ts +48 -0
- package/dist/src/core/coverage-sources/gh.js +136 -0
- package/dist/src/core/coverage-sources/gh.js.map +1 -0
- package/dist/src/core/coverage-sources/git.d.ts +101 -0
- package/dist/src/core/coverage-sources/git.js +269 -0
- package/dist/src/core/coverage-sources/git.js.map +1 -0
- package/dist/src/core/coverage.d.ts +217 -0
- package/dist/src/core/coverage.js +337 -0
- package/dist/src/core/coverage.js.map +1 -0
- package/dist/src/core/credential-spec.d.ts +72 -0
- package/dist/src/core/credential-spec.js +23 -0
- package/dist/src/core/credential-spec.js.map +1 -0
- package/dist/src/core/dark-session.d.ts +331 -0
- package/dist/src/core/dark-session.js +714 -0
- package/dist/src/core/dark-session.js.map +1 -0
- package/dist/src/core/decision-refusal.d.ts +185 -0
- package/dist/src/core/decision-refusal.js +265 -0
- package/dist/src/core/decision-refusal.js.map +1 -0
- package/dist/src/core/env-file.d.ts +450 -0
- package/dist/src/core/env-file.js +837 -0
- package/dist/src/core/env-file.js.map +1 -0
- package/dist/src/core/execute.d.ts +858 -0
- package/dist/src/core/execute.js +1271 -0
- package/dist/src/core/execute.js.map +1 -0
- package/dist/src/core/frontmatter.d.ts +78 -0
- package/dist/src/core/frontmatter.js +100 -0
- package/dist/src/core/frontmatter.js.map +1 -0
- package/dist/src/core/gate-window.d.ts +312 -0
- package/dist/src/core/gate-window.js +506 -0
- package/dist/src/core/gate-window.js.map +1 -0
- package/dist/src/core/gate.d.ts +1364 -0
- package/dist/src/core/gate.js +3002 -0
- package/dist/src/core/gate.js.map +1 -0
- package/dist/src/core/git-run.d.ts +73 -0
- package/dist/src/core/git-run.js +93 -0
- package/dist/src/core/git-run.js.map +1 -0
- package/dist/src/core/harness-version.d.ts +157 -0
- package/dist/src/core/harness-version.js +211 -0
- package/dist/src/core/harness-version.js.map +1 -0
- package/dist/src/core/harness-wait.d.ts +55 -0
- package/dist/src/core/harness-wait.js +58 -0
- package/dist/src/core/harness-wait.js.map +1 -0
- package/dist/src/core/head-retry.d.ts +107 -0
- package/dist/src/core/head-retry.js +121 -0
- package/dist/src/core/head-retry.js.map +1 -0
- package/dist/src/core/instance.d.ts +253 -0
- package/dist/src/core/instance.js +319 -0
- package/dist/src/core/instance.js.map +1 -0
- package/dist/src/core/intake-limits.d.ts +247 -0
- package/dist/src/core/intake-limits.js +350 -0
- package/dist/src/core/intake-limits.js.map +1 -0
- package/dist/src/core/jcs.d.ts +52 -0
- package/dist/src/core/jcs.js +132 -0
- package/dist/src/core/jcs.js.map +1 -0
- package/dist/src/core/journal.d.ts +144 -0
- package/dist/src/core/journal.js +200 -0
- package/dist/src/core/journal.js.map +1 -0
- package/dist/src/core/live-draw.d.ts +436 -0
- package/dist/src/core/live-draw.js +703 -0
- package/dist/src/core/live-draw.js.map +1 -0
- package/dist/src/core/log-reconcile.d.ts +89 -0
- package/dist/src/core/log-reconcile.js +136 -0
- package/dist/src/core/log-reconcile.js.map +1 -0
- package/dist/src/core/log-subscribe.d.ts +36 -0
- package/dist/src/core/log-subscribe.js +162 -0
- package/dist/src/core/log-subscribe.js.map +1 -0
- package/dist/src/core/log.d.ts +278 -0
- package/dist/src/core/log.js +546 -0
- package/dist/src/core/log.js.map +1 -0
- package/dist/src/core/loop.d.ts +274 -0
- package/dist/src/core/loop.js +487 -0
- package/dist/src/core/loop.js.map +1 -0
- package/dist/src/core/md-fence.d.ts +41 -0
- package/dist/src/core/md-fence.js +74 -0
- package/dist/src/core/md-fence.js.map +1 -0
- package/dist/src/core/money.d.ts +147 -0
- package/dist/src/core/money.js +195 -0
- package/dist/src/core/money.js.map +1 -0
- package/dist/src/core/payload-census.d.ts +74 -0
- package/dist/src/core/payload-census.js +146 -0
- package/dist/src/core/payload-census.js.map +1 -0
- package/dist/src/core/payload-store.d.ts +175 -0
- package/dist/src/core/payload-store.js +340 -0
- package/dist/src/core/payload-store.js.map +1 -0
- package/dist/src/core/payload.d.ts +71 -0
- package/dist/src/core/payload.js +80 -0
- package/dist/src/core/payload.js.map +1 -0
- package/dist/src/core/policy-diff.d.ts +292 -0
- package/dist/src/core/policy-diff.js +588 -0
- package/dist/src/core/policy-diff.js.map +1 -0
- package/dist/src/core/policy-expectations.d.ts +199 -0
- package/dist/src/core/policy-expectations.js +394 -0
- package/dist/src/core/policy-expectations.js.map +1 -0
- package/dist/src/core/policy-explain.d.ts +150 -0
- package/dist/src/core/policy-explain.js +258 -0
- package/dist/src/core/policy-explain.js.map +1 -0
- package/dist/src/core/policy-load.d.ts +527 -0
- package/dist/src/core/policy-load.js +536 -0
- package/dist/src/core/policy-load.js.map +1 -0
- package/dist/src/core/policy-match.d.ts +281 -0
- package/dist/src/core/policy-match.js +478 -0
- package/dist/src/core/policy-match.js.map +1 -0
- package/dist/src/core/policy-proposal.d.ts +265 -0
- package/dist/src/core/policy-proposal.js +458 -0
- package/dist/src/core/policy-proposal.js.map +1 -0
- package/dist/src/core/prompt-layout.d.ts +221 -0
- package/dist/src/core/prompt-layout.js +422 -0
- package/dist/src/core/prompt-layout.js.map +1 -0
- package/dist/src/core/protected-path-guard.d.ts +453 -0
- package/dist/src/core/protected-path-guard.js +1566 -0
- package/dist/src/core/protected-path-guard.js.map +1 -0
- package/dist/src/core/registration.d.ts +25 -0
- package/dist/src/core/registration.js +39 -0
- package/dist/src/core/registration.js.map +1 -0
- package/dist/src/core/reindex.d.ts +99 -0
- package/dist/src/core/reindex.js +336 -0
- package/dist/src/core/reindex.js.map +1 -0
- package/dist/src/core/sampler.d.ts +313 -0
- package/dist/src/core/sampler.js +388 -0
- package/dist/src/core/sampler.js.map +1 -0
- package/dist/src/core/sandbox.d.ts +290 -0
- package/dist/src/core/sandbox.js +424 -0
- package/dist/src/core/sandbox.js.map +1 -0
- package/dist/src/core/seal.d.ts +165 -0
- package/dist/src/core/seal.js +290 -0
- package/dist/src/core/seal.js.map +1 -0
- package/dist/src/core/state.d.ts +505 -0
- package/dist/src/core/state.js +1009 -0
- package/dist/src/core/state.js.map +1 -0
- package/dist/src/core/task-file.d.ts +185 -0
- package/dist/src/core/task-file.js +464 -0
- package/dist/src/core/task-file.js.map +1 -0
- package/dist/src/core/telegram-config.d.ts +93 -0
- package/dist/src/core/telegram-config.js +114 -0
- package/dist/src/core/telegram-config.js.map +1 -0
- package/dist/src/core/token.d.ts +409 -0
- package/dist/src/core/token.js +561 -0
- package/dist/src/core/token.js.map +1 -0
- package/dist/src/core/validate.d.ts +138 -0
- package/dist/src/core/validate.js +0 -0
- package/dist/src/core/validate.js.map +1 -0
- package/dist/src/core/values.d.ts +137 -0
- package/dist/src/core/values.js +153 -0
- package/dist/src/core/values.js.map +1 -0
- package/dist/src/core/vault.d.ts +291 -0
- package/dist/src/core/vault.js +612 -0
- package/dist/src/core/vault.js.map +1 -0
- package/dist/src/core/verified-snapshot.d.ts +204 -0
- package/dist/src/core/verified-snapshot.js +506 -0
- package/dist/src/core/verified-snapshot.js.map +1 -0
- package/dist/src/core/verify.d.ts +336 -0
- package/dist/src/core/verify.js +549 -0
- package/dist/src/core/verify.js.map +1 -0
- package/dist/src/core/version.d.ts +8 -0
- package/dist/src/core/version.js +9 -0
- package/dist/src/core/version.js.map +1 -0
- package/dist/src/core/wysiwys.d.ts +370 -0
- package/dist/src/core/wysiwys.js +728 -0
- package/dist/src/core/wysiwys.js.map +1 -0
- package/dist/src/daemon/advance-child.d.ts +39 -0
- package/dist/src/daemon/advance-child.js +78 -0
- package/dist/src/daemon/advance-child.js.map +1 -0
- package/dist/src/daemon/advance.d.ts +466 -0
- package/dist/src/daemon/advance.js +849 -0
- package/dist/src/daemon/advance.js.map +1 -0
- package/dist/src/daemon/audit.d.ts +87 -0
- package/dist/src/daemon/audit.js +90 -0
- package/dist/src/daemon/audit.js.map +1 -0
- package/dist/src/daemon/daemon.d.ts +1180 -0
- package/dist/src/daemon/daemon.js +1988 -0
- package/dist/src/daemon/daemon.js.map +1 -0
- package/dist/src/daemon/dark-session.d.ts +64 -0
- package/dist/src/daemon/dark-session.js +119 -0
- package/dist/src/daemon/dark-session.js.map +1 -0
- package/dist/src/daemon/draw-child.d.ts +36 -0
- package/dist/src/daemon/draw-child.js +132 -0
- package/dist/src/daemon/draw-child.js.map +1 -0
- package/dist/src/daemon/draw.d.ts +154 -0
- package/dist/src/daemon/draw.js +458 -0
- package/dist/src/daemon/draw.js.map +1 -0
- package/dist/src/daemon/git-evidence.d.ts +173 -0
- package/dist/src/daemon/git-evidence.js +345 -0
- package/dist/src/daemon/git-evidence.js.map +1 -0
- package/dist/src/daemon/projection.d.ts +180 -0
- package/dist/src/daemon/projection.js +233 -0
- package/dist/src/daemon/projection.js.map +1 -0
- package/dist/src/daemon/prune.d.ts +207 -0
- package/dist/src/daemon/prune.js +376 -0
- package/dist/src/daemon/prune.js.map +1 -0
- package/dist/src/mcp/http.d.ts +113 -0
- package/dist/src/mcp/http.js +343 -0
- package/dist/src/mcp/http.js.map +1 -0
- package/dist/src/mcp/server.d.ts +265 -0
- package/dist/src/mcp/server.js +602 -0
- package/dist/src/mcp/server.js.map +1 -0
- package/docs/adapter-api.md +106 -0
- package/docs/cli-reference.md +5716 -0
- package/docs/codex-enforced-session.md +30 -0
- package/package.json +53 -4
- package/schema/.gitkeep +0 -0
- package/schema/LICENSE +117 -0
- package/schema/codex-instance.schema.json +82 -0
- package/schema/envelope.schema.json +137 -0
- package/schema/event.schema.json +1811 -0
- package/schema/fixtures/codex-instance/invalid/unpinned-codex-version.json +40 -0
- package/schema/fixtures/codex-instance/valid/canonical.json +40 -0
- package/schema/fixtures/envelope/invalid/action-missing-idempotency-key.json +15 -0
- package/schema/fixtures/envelope/invalid/action-unknown-class-format.json +14 -0
- package/schema/fixtures/envelope/invalid/confidence-out-of-range.json +11 -0
- package/schema/fixtures/envelope/invalid/est-cost-bare-number.json +14 -0
- package/schema/fixtures/envelope/invalid/est-cost-noncanonical-string.json +14 -0
- package/schema/fixtures/envelope/invalid/malformed-assignee.json +10 -0
- package/schema/fixtures/envelope/invalid/malformed-created-by.json +7 -0
- package/schema/fixtures/envelope/invalid/malformed-max-latency.json +11 -0
- package/schema/fixtures/envelope/invalid/malformed-payload-hash.json +14 -0
- package/schema/fixtures/envelope/invalid/max-cost-bare-number.json +11 -0
- package/schema/fixtures/envelope/invalid/missing-origin.json +3 -0
- package/schema/fixtures/envelope/invalid/negative-est-cost.json +14 -0
- package/schema/fixtures/envelope/invalid/unknown-state.json +7 -0
- package/schema/fixtures/envelope/invalid/unknown-top-level-field.json +8 -0
- package/schema/fixtures/envelope/valid/action-payload-hash.json +17 -0
- package/schema/fixtures/envelope/valid/actions-without-budget.json +18 -0
- package/schema/fixtures/envelope/valid/canonical.json +25 -0
- package/schema/fixtures/envelope/valid/minimal.json +7 -0
- package/schema/fixtures/envelope/valid/multi-action-executed.json +30 -0
- package/schema/fixtures/envelope/valid/record-write-stage.json +22 -0
- package/schema/fixtures/event/invalid/approval-granted-agent-actor.json +15 -0
- package/schema/fixtures/event/invalid/approval-granted-empty-batch-delivery-id.json +17 -0
- package/schema/fixtures/event/invalid/approval-granted-fifth-reaction.json +16 -0
- package/schema/fixtures/event/invalid/approval-granted-missing-actor.json +14 -0
- package/schema/fixtures/event/invalid/approval-requested-missing-action-key.json +14 -0
- package/schema/fixtures/event/invalid/approval-withdrawn-agent-policy-drift.json +15 -0
- package/schema/fixtures/event/invalid/approval-withdrawn-missing-reason.json +15 -0
- package/schema/fixtures/event/invalid/approval-withdrawn-system-actor.json +15 -0
- package/schema/fixtures/event/invalid/audit-decision-refused-human-actor.json +17 -0
- package/schema/fixtures/event/invalid/audit-decision-refused-missing-code.json +16 -0
- package/schema/fixtures/event/invalid/audit-reviewed-agent-actor.json +15 -0
- package/schema/fixtures/event/invalid/audit-reviewed-loved-no-note.json +16 -0
- package/schema/fixtures/event/invalid/audit-reviewed-system-actor.json +15 -0
- package/schema/fixtures/event/invalid/bad-actor-prefix.json +15 -0
- package/schema/fixtures/event/invalid/est-cost-bare-number.json +17 -0
- package/schema/fixtures/event/invalid/execution-completed-fabricated-exit-code.json +16 -0
- package/schema/fixtures/event/invalid/execution-completed-provider-ref-empty-id.json +18 -0
- package/schema/fixtures/event/invalid/execution-completed-provider-ref-extra-field.json +19 -0
- package/schema/fixtures/event/invalid/execution-completed-provider-ref-id-not-string.json +18 -0
- package/schema/fixtures/event/invalid/execution-completed-provider-ref-missing-adapter.json +17 -0
- package/schema/fixtures/event/invalid/execution-failed-open-reported-by.json +16 -0
- package/schema/fixtures/event/invalid/execution-indeterminate-open-reason.json +14 -0
- package/schema/fixtures/event/invalid/execution-reconciled-agent-actor.json +17 -0
- package/schema/fixtures/event/invalid/execution-started-negative-env-stripped.json +16 -0
- package/schema/fixtures/event/invalid/gate-bypassed-missing-opened-seq.json +15 -0
- package/schema/fixtures/event/invalid/gate-closed-non-integer-opened-seq.json +13 -0
- package/schema/fixtures/event/invalid/gate-opened-agent-actor.json +16 -0
- package/schema/fixtures/event/invalid/gate-organ-attested-absolute-path.json +14 -0
- package/schema/fixtures/event/invalid/gate-organ-attested-agent-actor.json +14 -0
- package/schema/fixtures/event/invalid/gate-organ-attested-missing-organ-path.json +13 -0
- package/schema/fixtures/event/invalid/harness-unknown-kind.json +18 -0
- package/schema/fixtures/event/invalid/harness-version-multiline.json +16 -0
- package/schema/fixtures/event/invalid/log-checkpoint-agent-actor.json +17 -0
- package/schema/fixtures/event/invalid/log-checkpoint-missing-signature.json +16 -0
- package/schema/fixtures/event/invalid/log-checkpoint-short-signed-hash.json +17 -0
- package/schema/fixtures/event/invalid/log-checkpoint-unknown-signature-alg.json +17 -0
- package/schema/fixtures/event/invalid/malformed-ts.json +15 -0
- package/schema/fixtures/event/invalid/missing-alg.json +14 -0
- package/schema/fixtures/event/invalid/missing-hash.json +14 -0
- package/schema/fixtures/event/invalid/non-integer-seq.json +15 -0
- package/schema/fixtures/event/invalid/payload-pruned-human-actor.json +14 -0
- package/schema/fixtures/event/invalid/payload-pruned-missing-hash.json +14 -0
- package/schema/fixtures/event/invalid/policy-declined-agent-actor.json +15 -0
- package/schema/fixtures/event/invalid/policy-proposed-missing-diff.json +19 -0
- package/schema/fixtures/event/invalid/policy-proposed-system-actor.json +26 -0
- package/schema/fixtures/event/invalid/short-hash.json +15 -0
- package/schema/fixtures/event/invalid/unknown-alg.json +15 -0
- package/schema/fixtures/event/invalid/unknown-event-type.json +15 -0
- package/schema/fixtures/event/invalid/unknown-top-level-field.json +16 -0
- package/schema/fixtures/event/valid/approval-expired.json +15 -0
- package/schema/fixtures/event/valid/approval-granted-batch.json +19 -0
- package/schema/fixtures/event/valid/approval-granted-reaction.json +16 -0
- package/schema/fixtures/event/valid/approval-granted.json +15 -0
- package/schema/fixtures/event/valid/approval-rejected.json +15 -0
- package/schema/fixtures/event/valid/approval-requested.json +19 -0
- package/schema/fixtures/event/valid/approval-revoked.json +15 -0
- package/schema/fixtures/event/valid/approval-withdrawn-policy-drift.json +17 -0
- package/schema/fixtures/event/valid/approval-withdrawn.json +16 -0
- package/schema/fixtures/event/valid/audit-decision-refused.json +20 -0
- package/schema/fixtures/event/valid/audit-reviewed-reaction.json +17 -0
- package/schema/fixtures/event/valid/audit-reviewed.json +15 -0
- package/schema/fixtures/event/valid/audit-sampled.json +14 -0
- package/schema/fixtures/event/valid/budget-exceeded.json +21 -0
- package/schema/fixtures/event/valid/envelope-drift.json +16 -0
- package/schema/fixtures/event/valid/execution-completed-harness-report.json +16 -0
- package/schema/fixtures/event/valid/execution-completed-provider-ref.json +18 -0
- package/schema/fixtures/event/valid/execution-completed.json +15 -0
- package/schema/fixtures/event/valid/execution-failed-harness-report.json +16 -0
- package/schema/fixtures/event/valid/execution-failed.json +15 -0
- package/schema/fixtures/event/valid/execution-indeterminate.json +15 -0
- package/schema/fixtures/event/valid/execution-reconciled.json +17 -0
- package/schema/fixtures/event/valid/execution-started-env-stripped.json +17 -0
- package/schema/fixtures/event/valid/execution-started.json +14 -0
- package/schema/fixtures/event/valid/gate-bypassed-harness-version.json +18 -0
- package/schema/fixtures/event/valid/gate-bypassed.json +19 -0
- package/schema/fixtures/event/valid/gate-closed.json +14 -0
- package/schema/fixtures/event/valid/gate-opened.json +16 -0
- package/schema/fixtures/event/valid/gate-organ-attested.json +14 -0
- package/schema/fixtures/event/valid/genesis-null-prev.json +14 -0
- package/schema/fixtures/event/valid/log-checkpoint.json +17 -0
- package/schema/fixtures/event/valid/payload-pruned-orphan.json +13 -0
- package/schema/fixtures/event/valid/payload-pruned.json +17 -0
- package/schema/fixtures/event/valid/policy-declined.json +16 -0
- package/schema/fixtures/event/valid/policy-proposed.json +35 -0
- package/schema/fixtures/event/valid/policy-updated.json +14 -0
- package/schema/fixtures/event/valid/reconciliation-required.json +18 -0
- package/schema/fixtures/event/valid/reconciliation-satisfied.json +17 -0
- package/schema/fixtures/event/valid/route-accepted.json +15 -0
- package/schema/fixtures/event/valid/route-proposed.json +16 -0
- package/schema/fixtures/event/valid/spec-example.json +15 -0
- package/schema/fixtures/event/valid/task-registered-harness-version.json +23 -0
- package/schema/fixtures/event/valid/task-registered.json +14 -0
- package/schema/fixtures/hash/known-answer-pre-121.json +74 -0
- package/schema/fixtures/hash/known-answer.json +74 -0
- package/schema/fixtures/policy/invalid/bad-approval-ttl.json +7 -0
- package/schema/fixtures/policy/invalid/bad-web-port.json +4 -0
- package/schema/fixtures/policy/invalid/checkpoint-key-not-base64.json +6 -0
- package/schema/fixtures/policy/invalid/class-rule-missing-autonomy.json +9 -0
- package/schema/fixtures/policy/invalid/empty-class-key.json +6 -0
- package/schema/fixtures/policy/invalid/live-rate-on-human-only.json +7 -0
- package/schema/fixtures/policy/invalid/malformed-class-key.json +6 -0
- package/schema/fixtures/policy/invalid/missing-version.json +8 -0
- package/schema/fixtures/policy/invalid/negative-limit.json +9 -0
- package/schema/fixtures/policy/invalid/non-numeric-limit.json +9 -0
- package/schema/fixtures/policy/invalid/non-positive-max-pending.json +9 -0
- package/schema/fixtures/policy/invalid/on-expiry-grant.json +8 -0
- package/schema/fixtures/policy/invalid/payload-retention-bare-number.json +4 -0
- package/schema/fixtures/policy/invalid/payload-retention-compound.json +4 -0
- package/schema/fixtures/policy/invalid/payload-retention-fractional.json +4 -0
- package/schema/fixtures/policy/invalid/payload-retention-zero.json +4 -0
- package/schema/fixtures/policy/invalid/protected-paths-escape.json +4 -0
- package/schema/fixtures/policy/invalid/protected-paths-glob.json +4 -0
- package/schema/fixtures/policy/invalid/retro-rate-on-human-only.json +7 -0
- package/schema/fixtures/policy/invalid/retro-rate-on-manual.json +7 -0
- package/schema/fixtures/policy/invalid/retro-rate-zero.json +7 -0
- package/schema/fixtures/policy/invalid/sample-rate-too-high.json +5 -0
- package/schema/fixtures/policy/invalid/sampling-secret-env-empty.json +7 -0
- package/schema/fixtures/policy/invalid/sampling-secret-env-not-string.json +6 -0
- package/schema/fixtures/policy/invalid/skew-tolerance-compound.json +6 -0
- package/schema/fixtures/policy/invalid/unknown-autonomy.json +7 -0
- package/schema/fixtures/policy/invalid/unknown-class-rule-key.json +6 -0
- package/schema/fixtures/policy/invalid/unknown-top-level-key.json +7 -0
- package/schema/fixtures/policy/invalid/vault-passphrase-env-empty.json +6 -0
- package/schema/fixtures/policy/invalid/vault-passphrase-literal.json +6 -0
- package/schema/fixtures/policy/invalid/version-not-string.json +4 -0
- package/schema/fixtures/policy/valid/canonical.json +47 -0
- package/schema/fixtures/policy/valid/checkpoint-keys.json +18 -0
- package/schema/fixtures/policy/valid/class-approvers-limits.json +25 -0
- package/schema/fixtures/policy/valid/class-retro-rate.json +17 -0
- package/schema/fixtures/policy/valid/global-budgets.json +19 -0
- package/schema/fixtures/policy/valid/human-only.json +9 -0
- package/schema/fixtures/policy/valid/minimal.json +6 -0
- package/schema/fixtures/policy/valid/protected-paths.json +10 -0
- package/schema/fixtures/policy/valid/record-namespace.json +13 -0
- package/schema/fixtures/policy/valid/request-volume-limits.json +26 -0
- package/schema/fixtures/policy/valid/retention-and-sampling-secret.json +16 -0
- package/schema/fixtures/policy/valid/skew-tolerance.json +15 -0
- package/schema/fixtures/policy/valid/vault-passphrase-env.json +14 -0
- package/schema/fixtures/policy/valid/wildcards.json +15 -0
- package/schema/fixtures/policy-md/invalid/alias-bomb.md +15 -0
- package/schema/fixtures/policy-md/invalid/no-fence.md +7 -0
- package/schema/fixtures/policy-md/invalid/protected-route-not-a-subclass.md +16 -0
- package/schema/fixtures/policy-md/invalid/schema-invalid-autonomy.md +16 -0
- package/schema/fixtures/policy-md/invalid/schema-invalid-read-proof.md +17 -0
- package/schema/fixtures/policy-md/invalid/two-fences.md +19 -0
- package/schema/fixtures/policy-md/invalid/unclosed-fence.md +11 -0
- package/schema/fixtures/policy-md/invalid/wrong-info-string.md +11 -0
- package/schema/fixtures/policy-md/invalid/yaml-syntax-error.md +13 -0
- package/schema/fixtures/policy-md/precedence/both/APPROVAL.md +7 -0
- package/schema/fixtures/policy-md/precedence/both/APPROVALS.md +7 -0
- package/schema/fixtures/policy-md/precedence/fallback-only/APPROVALS.md +7 -0
- package/schema/fixtures/policy-md/valid/canonical.md +50 -0
- package/schema/fixtures/policy-md/valid/daemon-read-proof.md +18 -0
- package/schema/fixtures/policy-md/valid/minimal.md +3 -0
- package/schema/fixtures/policy-md/valid/prose-lookalikes.md +54 -0
- package/schema/fixtures/policy-md/valid/routed-protected-paths.md +49 -0
- package/schema/fixtures/policy-md/valid/with-values.md +79 -0
- package/schema/fixtures/sample-record/invalid/bad-date-time.json +4 -0
- package/schema/fixtures/sample-record/invalid/missing-required-field.json +3 -0
- package/schema/fixtures/sample-record/invalid/unknown-top-level-field.json +5 -0
- package/schema/fixtures/sample-record/invalid/wrong-type.json +4 -0
- package/schema/fixtures/sample-record/valid/minimal.json +4 -0
- package/schema/fixtures/sample-record/valid/with-note.json +5 -0
- package/schema/fixtures/values/invalid/class-shaped.json +9 -0
- package/schema/fixtures/values/invalid/duplicate-entry.json +4 -0
- package/schema/fixtures/values/invalid/non-string-item.json +4 -0
- package/schema/fixtures/values/invalid/over-cap.json +26 -0
- package/schema/fixtures/values/invalid/unknown-key.json +5 -0
- package/schema/fixtures/values/invalid/version-string.json +1 -0
- package/schema/fixtures/values/valid/empty-lists.json +7 -0
- package/schema/fixtures/values/valid/full.json +20 -0
- package/schema/fixtures/values/valid/minimal.json +1 -0
- package/schema/fixtures/values-md/invalid/schema-invalid.md +62 -0
- package/schema/fixtures/values-md/invalid/two-blocks.md +69 -0
- package/schema/fixtures/values-md/invalid/unterminated.md +61 -0
- package/schema/fixtures/values-md/invalid/yaml-error.md +63 -0
- package/schema/fixtures/values-md/valid/absent.md +50 -0
- package/schema/fixtures/values-md/valid/with-values.md +79 -0
- package/schema/policy.schema.json +501 -0
- package/schema/sample-record.schema.json +26 -0
- package/schema/values.schema.json +55 -0
- package/templates/codex/README.md +9 -0
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The channel plugin contract (SPEC.md §9, §10.3, §10.4, §11).
|
|
3
|
+
*
|
|
4
|
+
* A channel is **transport**. It takes a render-ready request from the runtime,
|
|
5
|
+
* puts it in front of a human, and hands back the gesture the human made. It
|
|
6
|
+
* holds no state (§10.3: "Decisions become log events; channels hold no state"),
|
|
7
|
+
* it never reads the log, it never writes the log, and it never decides
|
|
8
|
+
* anything. Everything a channel could get wrong about *authority* is therefore
|
|
9
|
+
* removed from a channel by construction:
|
|
10
|
+
*
|
|
11
|
+
* - **It cannot invent a field.** Every displayable datum on {@link
|
|
12
|
+
* ChannelRequest} is a {@link TaggedField}: either `computed` (the runtime
|
|
13
|
+
* derived it, and `source` names the derivation) or `claimed` (the party under
|
|
14
|
+
* oversight authored it, and `author` names them). There is no untagged
|
|
15
|
+
* member, so "render this string" is not a thing a channel can do without
|
|
16
|
+
* first knowing which side of the verification boundary the string came from.
|
|
17
|
+
* SPEC.md §9 and §10.3 both say the same sentence twice: rendering claimed
|
|
18
|
+
* fields with the visual authority of computed fields is a conformance
|
|
19
|
+
* failure. This type makes the mistake require deliberate effort.
|
|
20
|
+
* - **It cannot approve anything.** {@link ChannelDecision} is a *report* of a
|
|
21
|
+
* human gesture. Turning it into an `approval.granted` is
|
|
22
|
+
* {@link recordChannelDecision}'s job, and that function does exactly one
|
|
23
|
+
* thing: call `core/gate.ts`'s human-only `decide()`. Every gate rule — human
|
|
24
|
+
* actor, attestation on grant, TTL lapse, budget re-check, compare-and-append,
|
|
25
|
+
* idempotency — applies unchanged, because there is no second path.
|
|
26
|
+
* - **It cannot hold a secret.** A grant mints a single-use execution token.
|
|
27
|
+
* {@link recordChannelDecision} returns it to *its caller* (the runtime) in a
|
|
28
|
+
* field that is deliberately not part of {@link DecisionOutcome}, which is the
|
|
29
|
+
* only value handed back to the channel. A channel that logged its own
|
|
30
|
+
* outcomes would log nothing sensitive.
|
|
31
|
+
*
|
|
32
|
+
* ## Manual requests and the full payload (SPEC.md §10.4)
|
|
33
|
+
*
|
|
34
|
+
* > For `manual` actions, channels MUST present the full payload or a faithful
|
|
35
|
+
* > rendering of it, clearly delineated from any agent-written summary, before
|
|
36
|
+
* > collecting a decision.
|
|
37
|
+
*
|
|
38
|
+
* {@link createChannelRequest} refuses to build a `manual` request whose
|
|
39
|
+
* `fullPayload` is null. A channel therefore cannot be handed a manual request
|
|
40
|
+
* that has nothing to show; the failure surfaces at construction, inside the
|
|
41
|
+
* runtime, rather than as a channel silently rendering a summary alone.
|
|
42
|
+
*
|
|
43
|
+
* ## What is deliberately not here
|
|
44
|
+
*
|
|
45
|
+
* No I/O beyond {@link recordChannelDecision}'s delegation to the gate; no
|
|
46
|
+
* clock; no rendering. Building a {@link ChannelRequest} from a log is
|
|
47
|
+
* `channels/tagging.ts`, batching is `channels/batch.ts`, and the shared
|
|
48
|
+
* pass/fail suite every channel implementation must survive is
|
|
49
|
+
* `channels/conformance.ts`.
|
|
50
|
+
*/
|
|
51
|
+
import { recordRefusedDecision } from "../core/decision-refusal.js";
|
|
52
|
+
import { decide } from "../core/gate.js";
|
|
53
|
+
import { attestationKeySha256, decideAttestation, isAttestationActionKey, openProposalFor, proposalPolicyPath, } from "../core/policy-proposal.js";
|
|
54
|
+
import { readVerifiedRecords } from "../core/state.js";
|
|
55
|
+
import { tick } from "../core/clock.js";
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
// Truth labelling
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
/**
|
|
60
|
+
* The canonical `source` values the runtime tagger stamps on computed fields.
|
|
61
|
+
*
|
|
62
|
+
* `TaggedField`'s `source` is typed `string` rather than this union on purpose:
|
|
63
|
+
* an adapter or a satellite runtime may derive a field from a derivation this
|
|
64
|
+
* repo has not named, and forcing it to lie about the provenance would be worse
|
|
65
|
+
* than admitting a name we do not recognize. These are the names
|
|
66
|
+
* `channels/tagging.ts` uses, and the ones a reviewer should expect to see.
|
|
67
|
+
*/
|
|
68
|
+
export const COMPUTED_SOURCES = [
|
|
69
|
+
/** Read from a verified log record (`core/state.ts`). */
|
|
70
|
+
"log",
|
|
71
|
+
/** Resolved against the attested policy (`core/policy-match.ts`, `policy-explain.ts`). */
|
|
72
|
+
"policy-match",
|
|
73
|
+
/** Evaluated by `core/budgets.ts` at display time. */
|
|
74
|
+
"budgets",
|
|
75
|
+
/** Compared against the latest attestation (`core/attest.ts`). */
|
|
76
|
+
"attestation",
|
|
77
|
+
/**
|
|
78
|
+
* Loaded and validated by `core/policy-load.ts` at display time (APRV-109) —
|
|
79
|
+
* the advisory on an attestation prompt, recomputed from the live policy
|
|
80
|
+
* bytes rather than read back off the proposal that recorded one.
|
|
81
|
+
*/
|
|
82
|
+
"policy-load",
|
|
83
|
+
/** Recomputed from the payload bytes and checked against the bound hash. */
|
|
84
|
+
"payload-binding",
|
|
85
|
+
/**
|
|
86
|
+
* Re-derived from the hash-checked payload bytes by `core/command-class.ts`
|
|
87
|
+
* — the same module whose answer selected the class (APRV-143).
|
|
88
|
+
*
|
|
89
|
+
* Distinct from `payload-binding`, which names the hash agreement itself.
|
|
90
|
+
* This names the classifier's reading OF those bytes, which is a second
|
|
91
|
+
* derivation over the same material and can be wrong in ways the hash cannot
|
|
92
|
+
* catch: a channel that labelled it `payload-binding` would be borrowing the
|
|
93
|
+
* binding's authority for an answer the binding does not cover.
|
|
94
|
+
*/
|
|
95
|
+
"classifier",
|
|
96
|
+
/** Arithmetic on the display-time instant (TTL remaining). */
|
|
97
|
+
"clock",
|
|
98
|
+
];
|
|
99
|
+
/**
|
|
100
|
+
* The words that ride beside a rendered `gloss`, on every channel that renders
|
|
101
|
+
* one (APRV-144 for Telegram, APRV-197 for the terminal).
|
|
102
|
+
*
|
|
103
|
+
* Belt and braces with the `(author)` parenthetical: a reader skimming a wall
|
|
104
|
+
* of lines sees the word "model" inside the sentence they are about to believe,
|
|
105
|
+
* not only in the small print at the end of it. It lives here, next to the
|
|
106
|
+
* field it labels, because two channels rendering the same field under two
|
|
107
|
+
* different labels is how one of them ends up looking authoritative.
|
|
108
|
+
*/
|
|
109
|
+
export const GLOSS_UNVERIFIED_SUFFIX = "(model, unverified)";
|
|
110
|
+
/**
|
|
111
|
+
* What a person is told, in one line, when the gate would not take their
|
|
112
|
+
* decision (APRV-235).
|
|
113
|
+
*
|
|
114
|
+
* One function, every surface. A Telegram message edit, a web page and a
|
|
115
|
+
* terminal are three renderings of one fact, and before this they were three
|
|
116
|
+
* sentences — or, on the terminal that watched a `policy-drift` refusal on
|
|
117
|
+
* 2026-09-02, one sentence in a place the person who had tapped could not see.
|
|
118
|
+
* A human who taps on their phone and then reads the operator's terminal should
|
|
119
|
+
* find the same words in both, because the alternative is deciding which one to
|
|
120
|
+
* believe.
|
|
121
|
+
*
|
|
122
|
+
* Written to the approver, not to the log: it says what happened to THEIR
|
|
123
|
+
* answer and what, if anything, they should do next. The machine-readable fact
|
|
124
|
+
* is `code`, which every caller has and none of them should be paraphrasing.
|
|
125
|
+
* The wording of the first three is APRV-206's, moved here unchanged.
|
|
126
|
+
*/
|
|
127
|
+
export function refusedDecisionLine(code) {
|
|
128
|
+
if (code === "already-decided") {
|
|
129
|
+
return "Already decided — the first answer stands; nothing was recorded.";
|
|
130
|
+
}
|
|
131
|
+
// APRV-106. The tap that races the withdrawal, or lands on a message whose
|
|
132
|
+
// edit did not go through. Nothing is appended and the human is told why in
|
|
133
|
+
// the terms that matter to them: the asker is gone, so there is nothing their
|
|
134
|
+
// answer could do.
|
|
135
|
+
if (code === "request-withdrawn") {
|
|
136
|
+
return "Withdrawn — the requester took this back and is no longer waiting; nothing was recorded.";
|
|
137
|
+
}
|
|
138
|
+
if (code === "expired")
|
|
139
|
+
return "Expired — the approval window has closed.";
|
|
140
|
+
// APRV-235, and the reason this helper exists. The distinction the line has to
|
|
141
|
+
// carry is that nothing is wrong with the ACTION: the policy was re-attested
|
|
142
|
+
// after the question was asked, so the rules on the approver's screen are not
|
|
143
|
+
// the rules in force, and the answer cannot be recorded under either. The
|
|
144
|
+
// request is void and has been withdrawn, so this is not a "try again" — the
|
|
145
|
+
// caller asks again, and a fresh question arrives under the current rules.
|
|
146
|
+
if (code === "policy-drift") {
|
|
147
|
+
return "Policy changed after this was asked — the rules you were shown are no longer in force, so your answer could not be recorded. The request has been withdrawn; the caller will ask again under the current policy.";
|
|
148
|
+
}
|
|
149
|
+
return `Refused by the runtime: ${code}.`;
|
|
150
|
+
}
|
|
151
|
+
/** Tag `value` as runtime-derived, naming the derivation that produced it. */
|
|
152
|
+
export function computed(value, source) {
|
|
153
|
+
return { kind: "computed", value, source };
|
|
154
|
+
}
|
|
155
|
+
/** Tag `value` as authored by `author`, the party under oversight. */
|
|
156
|
+
export function claimed(value, author) {
|
|
157
|
+
return { kind: "claimed", value, author };
|
|
158
|
+
}
|
|
159
|
+
/** Is `value` a well-formed {@link TaggedField}? Used by the conformance suite. */
|
|
160
|
+
export function isTaggedField(value) {
|
|
161
|
+
if (typeof value !== "object" || value === null)
|
|
162
|
+
return false;
|
|
163
|
+
const field = value;
|
|
164
|
+
if (!("value" in field))
|
|
165
|
+
return false;
|
|
166
|
+
if (field["kind"] === "computed")
|
|
167
|
+
return typeof field["source"] === "string";
|
|
168
|
+
if (field["kind"] === "claimed")
|
|
169
|
+
return typeof field["author"] === "string";
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
/** Refusals {@link createChannelRequest} can return. Frozen, per §11.1(6). */
|
|
173
|
+
export const CHANNEL_REQUEST_REFUSAL_CODES = [
|
|
174
|
+
/** A `manual` request was built with no full payload to present (§10.4). */
|
|
175
|
+
"manual-payload-required",
|
|
176
|
+
/** A member arrived that is not a {@link TaggedField}. */
|
|
177
|
+
"untagged-field",
|
|
178
|
+
];
|
|
179
|
+
/**
|
|
180
|
+
* Build a {@link ChannelRequest}, enforcing the two invariants a type alone
|
|
181
|
+
* cannot.
|
|
182
|
+
*
|
|
183
|
+
* 1. **§10.4**: a `manual` request MUST carry a full payload. A manual request
|
|
184
|
+
* with `fullPayload.value === null` is refused `manual-payload-required` and
|
|
185
|
+
* no object is produced, so no channel can be handed one.
|
|
186
|
+
* 2. **§9**: every member is tagged. The interface says so, but a JavaScript
|
|
187
|
+
* caller (a satellite runtime, a test, an adapter compiled from looser
|
|
188
|
+
* sources) can still hand over a bare value; that is refused
|
|
189
|
+
* `untagged-field` rather than passed through to a renderer that would
|
|
190
|
+
* display it with unearned authority.
|
|
191
|
+
*/
|
|
192
|
+
export function createChannelRequest(fields) {
|
|
193
|
+
for (const [name, field] of Object.entries(fields)) {
|
|
194
|
+
if (field === undefined)
|
|
195
|
+
continue;
|
|
196
|
+
if (!isTaggedField(field)) {
|
|
197
|
+
return {
|
|
198
|
+
ok: false,
|
|
199
|
+
code: "untagged-field",
|
|
200
|
+
message: `channel request field ${JSON.stringify(name)} is not a tagged field. SPEC.md §9 requires every displayed field to be visibly computed or claimed; an untagged value would be rendered with whatever authority the channel's stylesheet happens to give it.`,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (fields.autonomy.value === "manual" && fields.fullPayload.value === null) {
|
|
205
|
+
return {
|
|
206
|
+
ok: false,
|
|
207
|
+
code: "manual-payload-required",
|
|
208
|
+
message: `action ${fields.action_key.value} resolves to manual and carries no full payload. SPEC.md §10.4: for manual actions a channel MUST present the full payload or a faithful rendering of it, clearly delineated from any agent-written summary, before collecting a decision. A request with nothing to present would put a human's decision behind an agent's summary alone, so it is refused here rather than rendered.`,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
return { ok: true, request: fields };
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Every displayable member of `request` is a {@link TaggedField}.
|
|
215
|
+
*
|
|
216
|
+
* The runtime half of "untagged fields are unrepresentable": the type says it
|
|
217
|
+
* at compile time, this says it at run time, and `channels/conformance.ts`
|
|
218
|
+
* calls it on both the request handed to a channel and the split the channel
|
|
219
|
+
* reports having rendered. Throws (rather than returning) because it is an
|
|
220
|
+
* assertion helper used inside test suites.
|
|
221
|
+
*/
|
|
222
|
+
export function assertTagged(request) {
|
|
223
|
+
for (const [name, field] of Object.entries(request)) {
|
|
224
|
+
if (field === undefined)
|
|
225
|
+
continue;
|
|
226
|
+
if (!isTaggedField(field)) {
|
|
227
|
+
throw new Error(`channel request field ${JSON.stringify(name)} is not tagged computed/claimed (SPEC.md §9)`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* The event payload field carrying a batch's channel delivery id (SPEC.md
|
|
233
|
+
* §10.3: each event carries "the batch's channel delivery id in its payload").
|
|
234
|
+
*
|
|
235
|
+
* First-class since APRV-38: `decide()` takes `batchDeliveryId` and writes this
|
|
236
|
+
* field on `approval.granted` / `approval.rejected`, and the event schema
|
|
237
|
+
* constrains it. What it replaced is described at
|
|
238
|
+
* {@link BATCH_DELIVERY_NOTE_PREFIX}.
|
|
239
|
+
*/
|
|
240
|
+
export const BATCH_DELIVERY_ID_FIELD = "batch_delivery_id";
|
|
241
|
+
/**
|
|
242
|
+
* The legacy `note` prefix that carried a batch delivery id before APRV-38.
|
|
243
|
+
*
|
|
244
|
+
* ## The dual-read window (amended SPEC.md §10.3)
|
|
245
|
+
*
|
|
246
|
+
* APRV-22 had no gate parameter and no schema entry to work with, so the id
|
|
247
|
+
* rode inside the one caller-controlled payload field there was: `note`, whose
|
|
248
|
+
* first line read `batch_delivery_id=<id>`, optionally followed by a newline
|
|
249
|
+
* and the human's own words. Logs written by those builds exist and are
|
|
250
|
+
* append-only, so the encoding cannot be migrated away: it can only stop being
|
|
251
|
+
* written. That is exactly what happens now. {@link recordChannelDecision}
|
|
252
|
+
* writes the first-class field and leaves `note` to the human, while
|
|
253
|
+
* {@link batchDeliveryIdOf} reads both and prefers the field. Readers MUST
|
|
254
|
+
* accept both encodings for the life of v0.1.
|
|
255
|
+
*
|
|
256
|
+
* {@link batchNote} is retained so a caller with a v0.1-era log to reproduce
|
|
257
|
+
* can still produce the old shape. Nothing in this repository calls it on the
|
|
258
|
+
* write path.
|
|
259
|
+
*/
|
|
260
|
+
export const BATCH_DELIVERY_NOTE_PREFIX = "batch_delivery_id=";
|
|
261
|
+
/**
|
|
262
|
+
* Encode `batchDeliveryId` (and an optional human note) into a `note` string.
|
|
263
|
+
*
|
|
264
|
+
* The pre-APRV-38 encoding, kept for round-trip fidelity with logs that carry
|
|
265
|
+
* it. New decisions use the first-class payload field instead.
|
|
266
|
+
*/
|
|
267
|
+
export function batchNote(batchDeliveryId, note) {
|
|
268
|
+
const head = `${BATCH_DELIVERY_NOTE_PREFIX}${batchDeliveryId}`;
|
|
269
|
+
return note === undefined ? head : `${head}\n${note}`;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* The batch delivery id recorded on `record`, or `null` for a unit decision.
|
|
273
|
+
*
|
|
274
|
+
* Reads both encodings (see {@link BATCH_DELIVERY_NOTE_PREFIX}), preferring the
|
|
275
|
+
* first-class `batch_delivery_id` field. The fallback is what keeps audit
|
|
276
|
+
* granularity intact across a log that spans the change: a batch grant written
|
|
277
|
+
* last month and one written today resolve to the same id here.
|
|
278
|
+
*/
|
|
279
|
+
export function batchDeliveryIdOf(record) {
|
|
280
|
+
const payload = record.payload;
|
|
281
|
+
if (typeof payload !== "object" || payload === null)
|
|
282
|
+
return null;
|
|
283
|
+
const field = payload[BATCH_DELIVERY_ID_FIELD];
|
|
284
|
+
if (typeof field === "string" && field.length > 0)
|
|
285
|
+
return field;
|
|
286
|
+
const note = payload["note"];
|
|
287
|
+
if (typeof note !== "string")
|
|
288
|
+
return null;
|
|
289
|
+
const first = note.split("\n", 1)[0] ?? "";
|
|
290
|
+
if (!first.startsWith(BATCH_DELIVERY_NOTE_PREFIX))
|
|
291
|
+
return null;
|
|
292
|
+
const id = first.slice(BATCH_DELIVERY_NOTE_PREFIX.length);
|
|
293
|
+
return id.length === 0 ? null : id;
|
|
294
|
+
}
|
|
295
|
+
/** Is this channel introspectable by the conformance suite? */
|
|
296
|
+
export function isTestableChannel(channel) {
|
|
297
|
+
return typeof channel.lastRendered === "function";
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Turn a reported gesture into a log event — by calling the gate, and by doing
|
|
301
|
+
* nothing else.
|
|
302
|
+
*
|
|
303
|
+
* There is no second decision path in this codebase and this function is not
|
|
304
|
+
* one: it is a translation from {@link ChannelDecision} to `decide()`'s
|
|
305
|
+
* arguments. Every gate rule therefore still holds, and every gate refusal code
|
|
306
|
+
* still surfaces verbatim in {@link DecisionOutcome}:
|
|
307
|
+
*
|
|
308
|
+
* - `actor-not-human` — the configured actor is not `human:…`. A channel cannot
|
|
309
|
+
* escalate itself by claiming to be one, because the actor comes from the
|
|
310
|
+
* runtime's configuration, not from the {@link ChannelDecision}.
|
|
311
|
+
* - `already-decided` — the duplicate-callback case every push channel has
|
|
312
|
+
* (a Telegram button pressed twice, a webhook redelivered). It refuses, and
|
|
313
|
+
* the log keeps the first human answer.
|
|
314
|
+
* - `expired`, `budget-exceeded`, `policy-not-attested`, `append-failed`
|
|
315
|
+
* (`head-moved`) — unchanged, all of them.
|
|
316
|
+
*
|
|
317
|
+
* `batchDeliveryId`, when present, is passed to the gate as such and lands in
|
|
318
|
+
* the event payload as `batch_delivery_id` (amended SPEC.md §10.3). The human's
|
|
319
|
+
* `note` is left carrying the human's words alone. See
|
|
320
|
+
* {@link BATCH_DELIVERY_NOTE_PREFIX} for the encoding this replaced and for the
|
|
321
|
+
* dual-read window readers stay inside for the life of v0.1.
|
|
322
|
+
*/
|
|
323
|
+
export function recordChannelDecision(logPath, decision, actorOptions, gateOptions = {}) {
|
|
324
|
+
// APRV-109. A gesture becomes one of TWO human-only gate verbs, chosen by the
|
|
325
|
+
// request's own key and by nothing a channel says. An attestation prompt's key
|
|
326
|
+
// is `policy.attest:<sha256>` — derived from the policy bytes by
|
|
327
|
+
// `core/policy-proposal.ts` — so a channel cannot steer a gesture from one
|
|
328
|
+
// verb to the other, and neither can a caller: the key comes off the verified
|
|
329
|
+
// log with the request it was rendered from.
|
|
330
|
+
//
|
|
331
|
+
// The routing lives here rather than in each channel runner for the reason
|
|
332
|
+
// this function exists at all: there is one place a reported gesture becomes a
|
|
333
|
+
// log event, and adding a second would be adding a second decision path.
|
|
334
|
+
if (isAttestationActionKey(decision.action_key)) {
|
|
335
|
+
return recordAttestationDecision(logPath, decision, actorOptions, gateOptions);
|
|
336
|
+
}
|
|
337
|
+
const options = { ...gateOptions };
|
|
338
|
+
if (decision.note !== undefined)
|
|
339
|
+
options.note = decision.note;
|
|
340
|
+
if (decision.batchDeliveryId !== undefined) {
|
|
341
|
+
options.batchDeliveryId = decision.batchDeliveryId;
|
|
342
|
+
}
|
|
343
|
+
const result = decide(logPath, decision.action_key, decision.decision, actorOptions.actor, options);
|
|
344
|
+
if (!result.ok) {
|
|
345
|
+
// APRV-235. A human tapped and the gate would not take it. The gate itself
|
|
346
|
+
// appends nothing on a refusal, by design; this surface knows something the
|
|
347
|
+
// gate does not, which is that a PERSON produced the gesture, and that is
|
|
348
|
+
// the fact the log was missing. `core/decision-refusal.ts` states the
|
|
349
|
+
// argument in full, including why an agent's refusal is not recorded.
|
|
350
|
+
//
|
|
351
|
+
// Best effort, deliberately last, and it changes nothing about what the
|
|
352
|
+
// channel is handed back: the decision has already been refused, and a
|
|
353
|
+
// failed audit append must not turn one refusal into two.
|
|
354
|
+
noteRefusedDecision(logPath, decision, actorOptions, gateOptions, result);
|
|
355
|
+
return { outcome: result };
|
|
356
|
+
}
|
|
357
|
+
const outcome = {
|
|
358
|
+
ok: true,
|
|
359
|
+
action_key: decision.action_key,
|
|
360
|
+
decision: decision.decision,
|
|
361
|
+
state: result.state,
|
|
362
|
+
record: result.record,
|
|
363
|
+
tokenIssued: result.token !== undefined,
|
|
364
|
+
};
|
|
365
|
+
return result.token === undefined ? { outcome } : { outcome, token: result.token };
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Append the audit trail of a refused human decision, and swallow whatever goes
|
|
369
|
+
* wrong doing it (APRV-235).
|
|
370
|
+
*
|
|
371
|
+
* The swallowing is the point. Every caller of {@link recordChannelDecision} is
|
|
372
|
+
* on a path that has already produced its answer — a Telegram listener about to
|
|
373
|
+
* edit a message, a web handler about to render one, a terminal about to print
|
|
374
|
+
* one — and an unreadable log or a lost append race here must not take that
|
|
375
|
+
* answer away from the human who is waiting for it. What a failure costs is the
|
|
376
|
+
* record, which is exactly what the caller had before this existed.
|
|
377
|
+
*/
|
|
378
|
+
function noteRefusedDecision(logPath, decision, actorOptions, gateOptions, refusal) {
|
|
379
|
+
try {
|
|
380
|
+
recordRefusedDecision(logPath, {
|
|
381
|
+
actionKey: decision.action_key,
|
|
382
|
+
decision: decision.decision,
|
|
383
|
+
actor: actorOptions.actor,
|
|
384
|
+
// Every surface in this repository names itself. The fallback is the
|
|
385
|
+
// local process, which is what a decision that reached the runtime
|
|
386
|
+
// through no channel at all came through.
|
|
387
|
+
channel: actorOptions.channel ?? "cli",
|
|
388
|
+
}, {
|
|
389
|
+
code: refusal.code,
|
|
390
|
+
message: refusal.message,
|
|
391
|
+
...(refusal.drift === undefined ? {} : { drift: refusal.drift }),
|
|
392
|
+
}, gateOptions);
|
|
393
|
+
}
|
|
394
|
+
catch {
|
|
395
|
+
// Nothing in `core/decision-refusal.ts` throws; this is the belt on the
|
|
396
|
+
// braces, so that a surprise from the append path cannot become an
|
|
397
|
+
// exception on a decision path that had already finished deciding.
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Turn a tap on an attestation prompt into the attestation itself (APRV-109).
|
|
402
|
+
*
|
|
403
|
+
* The half of {@link recordChannelDecision} that answers a `policy.proposed`.
|
|
404
|
+
* Approve appends `policy.updated` under the human identity the listener holds,
|
|
405
|
+
* which is the same identity, from the same configuration, that a grant lands
|
|
406
|
+
* under today: the trust boundary of SPEC.md §11 is unchanged, and what this
|
|
407
|
+
* adds is that the human act it collects is a tap rather than a terminal
|
|
408
|
+
* session. Reject appends `policy.declined` and attests nothing.
|
|
409
|
+
*
|
|
410
|
+
* Every refusal `core/policy-proposal.ts` can make surfaces verbatim, and three
|
|
411
|
+
* of them are the fail-closed ones this ceremony turns on:
|
|
412
|
+
*
|
|
413
|
+
* - `proposal-stale` — the file changed after the prompt was rendered, so the
|
|
414
|
+
* hash on the approver's screen is not the hash on disk. Nothing is attested.
|
|
415
|
+
* - `already-decided` — the duplicate-callback case every push channel has. The
|
|
416
|
+
* first human answer stands.
|
|
417
|
+
* - `expired` — the proposer stopped waiting. Nothing is attested, and nothing
|
|
418
|
+
* is appended: a lapsed prompt leaves the policy as unattested as it was.
|
|
419
|
+
*
|
|
420
|
+
* No token is minted on any path. An attestation authorizes no side effect; it
|
|
421
|
+
* says which rules are in force, so there is nothing for a token to be spent on
|
|
422
|
+
* and `tokenIssued` is always false.
|
|
423
|
+
*/
|
|
424
|
+
/**
|
|
425
|
+
* Where THIS process believes `APPROVAL.md` is (APRV-109).
|
|
426
|
+
*
|
|
427
|
+
* `policy.file` names it outright; `policy.dir` is discovery, run through the
|
|
428
|
+
* same walk `loadPolicy` uses so the attested file and the enforced file are
|
|
429
|
+
* never two different files. Neither present means the caller has not said, and
|
|
430
|
+
* `core/policy-proposal.ts` falls back to its own default.
|
|
431
|
+
*/
|
|
432
|
+
function listenerPolicyPath(options) {
|
|
433
|
+
const policy = options.policy;
|
|
434
|
+
if (policy === undefined)
|
|
435
|
+
return null;
|
|
436
|
+
if (policy.file !== undefined)
|
|
437
|
+
return policy.file;
|
|
438
|
+
return policy.dir === undefined ? null : proposalPolicyPath(policy.dir);
|
|
439
|
+
}
|
|
440
|
+
export function recordAttestationDecision(logPath, decision, actorOptions, gateOptions = {}) {
|
|
441
|
+
const sha256 = attestationKeySha256(decision.action_key);
|
|
442
|
+
if (sha256 === null) {
|
|
443
|
+
return {
|
|
444
|
+
outcome: {
|
|
445
|
+
ok: false,
|
|
446
|
+
code: "proposal-not-found",
|
|
447
|
+
message: `${JSON.stringify(decision.action_key)} is not a well-formed attestation key (policy.attest:<64 hex>); no attestation prompt could be resolved from it and nothing was appended`,
|
|
448
|
+
},
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
const now = tick(gateOptions);
|
|
452
|
+
const read = readVerifiedRecords(logPath, gateOptions.schemaDir === undefined ? {} : { schemaDir: gateOptions.schemaDir });
|
|
453
|
+
if (!read.ok)
|
|
454
|
+
return { outcome: { ok: false, code: read.code, message: read.message } };
|
|
455
|
+
const proposal = openProposalFor(read.records, sha256, now);
|
|
456
|
+
if (proposal === null) {
|
|
457
|
+
return {
|
|
458
|
+
outcome: {
|
|
459
|
+
ok: false,
|
|
460
|
+
code: "proposal-not-found",
|
|
461
|
+
message: `no open policy.proposed record proposes ${sha256}; the prompt was answered, superseded, or its proposer's deadline passed. Nothing was appended.`,
|
|
462
|
+
},
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
const options = { ...gateOptions };
|
|
466
|
+
if (decision.note !== undefined)
|
|
467
|
+
options.note = decision.note;
|
|
468
|
+
if (decision.batchDeliveryId !== undefined)
|
|
469
|
+
options.batchDeliveryId = decision.batchDeliveryId;
|
|
470
|
+
// The FILE the tap re-hashes, resolved from the listener's own policy
|
|
471
|
+
// location rather than from the proposal. A proposal records the policy's
|
|
472
|
+
// BASENAME (a log is meant to be copied, and an absolute path would name the
|
|
473
|
+
// proposer's home directory), so resolving from the record would make the
|
|
474
|
+
// check depend on this process's working directory. `core/policy-proposal.ts`
|
|
475
|
+
// refuses `proposal-stale` when it cannot read the file, so the wrong path
|
|
476
|
+
// fails closed either way; this is what makes it the RIGHT path.
|
|
477
|
+
const policyPath = listenerPolicyPath(gateOptions);
|
|
478
|
+
if (policyPath !== null)
|
|
479
|
+
options.policyPath = policyPath;
|
|
480
|
+
const result = decideAttestation(logPath, proposal.seq, decision.decision === "grant" ? "attest" : "decline", actorOptions.actor, options);
|
|
481
|
+
if (!result.ok)
|
|
482
|
+
return { outcome: result };
|
|
483
|
+
return {
|
|
484
|
+
outcome: {
|
|
485
|
+
ok: true,
|
|
486
|
+
action_key: decision.action_key,
|
|
487
|
+
decision: decision.decision,
|
|
488
|
+
state: decision.decision === "grant" ? "granted" : "rejected",
|
|
489
|
+
record: result.record,
|
|
490
|
+
tokenIssued: false,
|
|
491
|
+
},
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","s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
+
/**
|
|
2
|
+
* The channel-side facade over the canonical renderer (APRV-119).
|
|
3
|
+
*
|
|
4
|
+
* Everything this module used to hold — the email view (APRV-100), the diff view
|
|
5
|
+
* (APRV-124), the command view and its injective escape marking (APRV-126), the
|
|
6
|
+
* classifier-derived breakdown and protected-path lines (APRV-143, APRV-144) —
|
|
7
|
+
* now lives in `core/wysiwys.ts`, absorbed into {@link canonicalRender}. It
|
|
8
|
+
* moved because the gate consults it: `core/gate.ts` computes the
|
|
9
|
+
* `display_hash` a request records at the write boundary from the same function
|
|
10
|
+
* the channels render with, and core cannot import channels.
|
|
11
|
+
*
|
|
12
|
+
* What is left here is the one function that needs a channel type, plus the
|
|
13
|
+
* re-exports that keep every existing import path working. A channel imports
|
|
14
|
+
* this; nothing else does.
|
|
15
|
+
*/
|
|
16
|
+
import type { PayloadRendering } from "./contract.js";
|
|
17
|
+
export * from "../core/wysiwys.js";
|
|
18
|
+
/**
|
|
19
|
+
* The text a channel puts inside its payload region (SPEC.md §10.4, §9).
|
|
20
|
+
*
|
|
21
|
+
* For a whole payload this is {@link canonicalRender}'s text verbatim, so the
|
|
22
|
+
* three channels present the same reading of the same bytes and the log's
|
|
23
|
+
* `display_hash` names it. Claimed material — the summary, the estimate, the
|
|
24
|
+
* rationale, a model's gloss — is never inside this region; each channel renders
|
|
25
|
+
* it above, under its own claimed heading.
|
|
26
|
+
*
|
|
27
|
+
* A **truncated** rendering has no canonical form and does not get one. The
|
|
28
|
+
* tagging layer cut `text` short at the caller's `maxPayloadChars`, so the bytes
|
|
29
|
+
* on screen are not the bytes the token will execute, and giving a partial
|
|
30
|
+
* payload the canonical block's authority is exactly the substitution WYSIWYS
|
|
31
|
+
* forbids. The pre-existing truncated text is returned unchanged, the channel's
|
|
32
|
+
* own "TRUNCATED — do not grant on it" marker still surrounds it, and
|
|
33
|
+
* `channels/batch.ts` still refuses to fold such a member into a batch.
|
|
34
|
+
*/
|
|
35
|
+
export declare function payloadRegionText(rendering: PayloadRendering, actionClass: string): string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The channel-side facade over the canonical renderer (APRV-119).
|
|
3
|
+
*
|
|
4
|
+
* Everything this module used to hold — the email view (APRV-100), the diff view
|
|
5
|
+
* (APRV-124), the command view and its injective escape marking (APRV-126), the
|
|
6
|
+
* classifier-derived breakdown and protected-path lines (APRV-143, APRV-144) —
|
|
7
|
+
* now lives in `core/wysiwys.ts`, absorbed into {@link canonicalRender}. It
|
|
8
|
+
* moved because the gate consults it: `core/gate.ts` computes the
|
|
9
|
+
* `display_hash` a request records at the write boundary from the same function
|
|
10
|
+
* the channels render with, and core cannot import channels.
|
|
11
|
+
*
|
|
12
|
+
* What is left here is the one function that needs a channel type, plus the
|
|
13
|
+
* re-exports that keep every existing import path working. A channel imports
|
|
14
|
+
* this; nothing else does.
|
|
15
|
+
*/
|
|
16
|
+
import { canonicalRender } from "../core/wysiwys.js";
|
|
17
|
+
// The canonical renderer and every view it is built from. Re-exported rather
|
|
18
|
+
// than re-implemented: a second definition of any of these would be a second
|
|
19
|
+
// rendering of the same bytes, which is the failure APRV-119 exists to remove.
|
|
20
|
+
export * from "../core/wysiwys.js";
|
|
21
|
+
/**
|
|
22
|
+
* The text a channel puts inside its payload region (SPEC.md §10.4, §9).
|
|
23
|
+
*
|
|
24
|
+
* For a whole payload this is {@link canonicalRender}'s text verbatim, so the
|
|
25
|
+
* three channels present the same reading of the same bytes and the log's
|
|
26
|
+
* `display_hash` names it. Claimed material — the summary, the estimate, the
|
|
27
|
+
* rationale, a model's gloss — is never inside this region; each channel renders
|
|
28
|
+
* it above, under its own claimed heading.
|
|
29
|
+
*
|
|
30
|
+
* A **truncated** rendering has no canonical form and does not get one. The
|
|
31
|
+
* tagging layer cut `text` short at the caller's `maxPayloadChars`, so the bytes
|
|
32
|
+
* on screen are not the bytes the token will execute, and giving a partial
|
|
33
|
+
* payload the canonical block's authority is exactly the substitution WYSIWYS
|
|
34
|
+
* forbids. The pre-existing truncated text is returned unchanged, the channel's
|
|
35
|
+
* own "TRUNCATED — do not grant on it" marker still surrounds it, and
|
|
36
|
+
* `channels/batch.ts` still refuses to fold such a member into a batch.
|
|
37
|
+
*/
|
|
38
|
+
export function payloadRegionText(rendering, actionClass) {
|
|
39
|
+
if (rendering.truncated)
|
|
40
|
+
return rendering.text;
|
|
41
|
+
return canonicalRender(rendering.value, actionClass).text;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=payload-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload-view.js","sourceRoot":"","sources":["../../../src/channels/payload-view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,6EAA6E;AAC7E,6EAA6E;AAC7E,+EAA+E;AAC/E,cAAc,oBAAoB,CAAC;AAEnC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAA2B,EAAE,WAAmB;IAChF,IAAI,SAAS,CAAC,SAAS;QAAE,OAAO,SAAS,CAAC,IAAI,CAAC;IAC/C,OAAO,eAAe,CAAC,SAAS,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC;AAC5D,CAAC"}
|