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.
- package/README.md +629 -559
- package/SPEC.md +99 -24
- package/dist/src/adapters/agentmail.d.ts +426 -0
- package/dist/src/adapters/agentmail.js +2 -2
- package/dist/src/adapters/conformance.d.ts +149 -0
- package/dist/src/adapters/contract.d.ts +628 -0
- package/dist/src/adapters/contract.js +110 -16
- package/dist/src/adapters/contract.js.map +1 -1
- package/dist/src/adapters/email.d.ts +324 -0
- package/dist/src/adapters/env-passphrase.d.ts +93 -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 +2 -1
- package/dist/src/adapters/registry.js.map +1 -1
- package/dist/src/adapters/smtp.d.ts +213 -0
- package/dist/src/adapters/vault-provider.d.ts +114 -0
- package/dist/src/adapters/vault-provider.js +3 -3
- 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/cli.d.ts +193 -0
- package/dist/src/channels/conformance.d.ts +92 -0
- package/dist/src/channels/contract.d.ts +656 -0
- package/dist/src/channels/contract.js +200 -7
- package/dist/src/channels/contract.js.map +1 -1
- package/dist/src/channels/payload-view.d.ts +35 -0
- package/dist/src/channels/render-queue.d.ts +149 -0
- package/dist/src/channels/tagging.d.ts +196 -0
- package/dist/src/channels/telegram.d.ts +1944 -0
- package/dist/src/channels/telegram.js +218 -23
- package/dist/src/channels/telegram.js.map +1 -1
- package/dist/src/channels/web.d.ts +350 -0
- package/dist/src/channels/web.js +17 -0
- package/dist/src/channels/web.js.map +1 -1
- package/dist/src/cli/adapter.d.ts +90 -0
- package/dist/src/cli/adapter.js +25 -15
- package/dist/src/cli/adapter.js.map +1 -1
- package/dist/src/cli/amend.d.ts +59 -0
- package/dist/src/cli/amend.js +214 -30
- package/dist/src/cli/amend.js.map +1 -1
- package/dist/src/cli/args.d.ts +43 -0
- package/dist/src/cli/attest.d.ts +50 -0
- package/dist/src/cli/attest.js +134 -7
- package/dist/src/cli/attest.js.map +1 -1
- package/dist/src/cli/audit-card.d.ts +62 -0
- package/dist/src/cli/audit.d.ts +59 -0
- package/dist/src/cli/channel-telegram.d.ts +879 -0
- package/dist/src/cli/channel-telegram.js +311 -13
- package/dist/src/cli/channel-telegram.js.map +1 -1
- package/dist/src/cli/channel-web.d.ts +131 -0
- package/dist/src/cli/channel.d.ts +80 -0
- package/dist/src/cli/channel.js +9 -0
- package/dist/src/cli/channel.js.map +1 -1
- package/dist/src/cli/checkpoint-tap.d.ts +169 -0
- package/dist/src/cli/codex-bridge.d.ts +819 -0
- package/dist/src/cli/codex-bridge.js +1607 -0
- package/dist/src/cli/codex-bridge.js.map +1 -0
- package/dist/src/cli/codex.d.ts +2 -0
- package/dist/src/cli/codex.js +469 -0
- package/dist/src/cli/codex.js.map +1 -0
- package/dist/src/cli/coverage.d.ts +61 -0
- package/dist/src/cli/daemon.d.ts +120 -0
- package/dist/src/cli/daemon.js +4 -1
- package/dist/src/cli/daemon.js.map +1 -1
- package/dist/src/cli/doctor.d.ts +129 -0
- package/dist/src/cli/doctor.js +586 -17
- package/dist/src/cli/doctor.js.map +1 -1
- package/dist/src/cli/env.d.ts +65 -0
- package/dist/src/cli/execute.d.ts +202 -0
- package/dist/src/cli/execute.js +25 -2
- package/dist/src/cli/execute.js.map +1 -1
- package/dist/src/cli/exit-codes.d.ts +73 -0
- package/dist/src/cli/feedback.d.ts +60 -0
- package/dist/src/cli/gate-window.d.ts +40 -0
- package/dist/src/cli/gate.d.ts +68 -0
- package/dist/src/cli/git-scope.d.ts +190 -0
- package/dist/src/cli/gloss-attach.d.ts +85 -0
- package/dist/src/cli/gloss-codex-child.d.ts +9 -0
- package/dist/src/cli/gloss-codex.d.ts +24 -0
- package/dist/src/cli/gloss-options.d.ts +42 -0
- package/dist/src/cli/gloss.d.ts +265 -0
- package/dist/src/cli/help.d.ts +107 -0
- package/dist/src/cli/help.js +320 -93
- package/dist/src/cli/help.js.map +1 -1
- package/dist/src/cli/hook-codex.d.ts +126 -0
- package/dist/src/cli/hook-codex.js +226 -0
- package/dist/src/cli/hook-codex.js.map +1 -0
- package/dist/src/cli/hook.d.ts +787 -0
- package/dist/src/cli/hook.js +1235 -181
- package/dist/src/cli/hook.js.map +1 -1
- package/dist/src/cli/import.d.ts +35 -0
- package/dist/src/cli/import.js +1 -1
- package/dist/src/cli/import.js.map +1 -1
- package/dist/src/cli/init.d.ts +84 -0
- package/dist/src/cli/init.js +2 -2
- package/dist/src/cli/init.js.map +1 -1
- package/dist/src/cli/instructions.d.ts +23 -0
- package/dist/src/cli/journal.d.ts +41 -0
- package/dist/src/cli/log-advance.d.ts +287 -0
- package/dist/src/cli/log-advance.js +102 -11
- package/dist/src/cli/log-advance.js.map +1 -1
- package/dist/src/cli/log-anchor.d.ts +176 -0
- package/dist/src/cli/log-checkpoint.d.ts +22 -0
- package/dist/src/cli/log-sync.d.ts +243 -0
- package/dist/src/cli/log-verbs.d.ts +16 -0
- package/dist/src/cli/log-verbs.js +7 -1
- package/dist/src/cli/log-verbs.js.map +1 -1
- package/dist/src/cli/long-help.d.ts +70 -0
- package/dist/src/cli/main.d.ts +77 -0
- package/dist/src/cli/main.js +159 -7
- package/dist/src/cli/main.js.map +1 -1
- package/dist/src/cli/mcp.d.ts +52 -0
- package/dist/src/cli/paths.d.ts +56 -0
- package/dist/src/cli/payload.d.ts +58 -0
- package/dist/src/cli/policy-apply.d.ts +195 -0
- package/dist/src/cli/policy-apply.js +573 -0
- package/dist/src/cli/policy-apply.js.map +1 -0
- package/dist/src/cli/policy.d.ts +43 -0
- package/dist/src/cli/policy.js +14 -1
- package/dist/src/cli/policy.js.map +1 -1
- package/dist/src/cli/preflight.d.ts +501 -0
- package/dist/src/cli/preflight.js +689 -45
- package/dist/src/cli/preflight.js.map +1 -1
- package/dist/src/cli/progress.d.ts +78 -0
- package/dist/src/cli/prompt.d.ts +209 -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/render.d.ts +22 -0
- package/dist/src/cli/sandbox.d.ts +51 -0
- package/dist/src/cli/sandbox.js +17 -1
- package/dist/src/cli/sandbox.js.map +1 -1
- package/dist/src/cli/scaffold.d.ts +79 -0
- package/dist/src/cli/scaffold.js +1 -1
- package/dist/src/cli/setup-adapter.d.ts +137 -0
- package/dist/src/cli/setup-adapter.js +38 -4
- package/dist/src/cli/setup-adapter.js.map +1 -1
- package/dist/src/cli/setup-channel.d.ts +126 -0
- package/dist/src/cli/setup-channel.js +28 -1
- package/dist/src/cli/setup-channel.js.map +1 -1
- package/dist/src/cli/setup-checkpoint.d.ts +57 -0
- package/dist/src/cli/setup-common.d.ts +277 -0
- package/dist/src/cli/setup-common.js +3 -2
- package/dist/src/cli/setup-common.js.map +1 -1
- package/dist/src/cli/setup-flow.d.ts +287 -0
- package/dist/src/cli/setup-service.d.ts +96 -0
- package/dist/src/cli/setup.d.ts +204 -0
- package/dist/src/cli/setup.js +94 -2
- package/dist/src/cli/setup.js.map +1 -1
- package/dist/src/cli/style.d.ts +320 -0
- package/dist/src/cli/token.d.ts +39 -0
- package/dist/src/cli/up.d.ts +155 -0
- package/dist/src/cli/up.js +119 -53
- package/dist/src/cli/up.js.map +1 -1
- package/dist/src/cli/usage.d.ts +37 -0
- package/dist/src/cli/values.d.ts +40 -0
- package/dist/src/cli/values.js +3 -4
- package/dist/src/cli/values.js.map +1 -1
- package/dist/src/cli/vault.d.ts +59 -0
- package/dist/src/cli/vault.js +2 -2
- package/dist/src/cli/vault.js.map +1 -1
- package/dist/src/cli/verb-registry.d.ts +76 -0
- package/dist/src/cli/verb-registry.js +344 -11
- package/dist/src/cli/verb-registry.js.map +1 -1
- package/dist/src/cli/wordmark.d.ts +31 -0
- package/dist/src/cli/wordmark.js +2 -2
- package/dist/src/codex/broker.d.ts +229 -0
- package/dist/src/codex/broker.js +548 -0
- package/dist/src/codex/broker.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/runner.d.ts +178 -0
- package/dist/src/codex/runner.js +231 -0
- package/dist/src/codex/runner.js.map +1 -0
- package/dist/src/codex/serve.d.ts +56 -0
- package/dist/src/codex/serve.js +98 -0
- package/dist/src/codex/serve.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-commit.d.ts +219 -0
- package/dist/src/codex/workspace-commit.js +549 -0
- package/dist/src/codex/workspace-commit.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 +221 -0
- package/dist/src/core/advance-cycle.js +66 -2
- package/dist/src/core/advance-cycle.js.map +1 -1
- package/dist/src/core/agents-md.d.ts +278 -0
- package/dist/src/core/agents-md.js +33 -31
- package/dist/src/core/agents-md.js.map +1 -1
- 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 +635 -0
- package/dist/src/core/attest.js +326 -4
- package/dist/src/core/attest.js.map +1 -1
- package/dist/src/core/audit.d.ts +510 -0
- package/dist/src/core/audit.js +13 -0
- package/dist/src/core/audit.js.map +1 -1
- package/dist/src/core/budgets.d.ts +238 -0
- package/dist/src/core/channel-owner.d.ts +213 -0
- package/dist/src/core/channel-owner.js +358 -0
- package/dist/src/core/channel-owner.js.map +1 -0
- package/dist/src/core/checkpoint.d.ts +500 -0
- package/dist/src/core/child-env.d.ts +88 -0
- package/dist/src/core/clock.d.ts +52 -0
- package/dist/src/core/command-class.d.ts +697 -0
- package/dist/src/core/command-class.js +713 -25
- package/dist/src/core/command-class.js.map +1 -1
- package/dist/src/core/commit-guard.d.ts +272 -0
- package/dist/src/core/commit-guard.js +424 -0
- package/dist/src/core/commit-guard.js.map +1 -0
- package/dist/src/core/coverage-sources/adapter.d.ts +40 -0
- package/dist/src/core/coverage-sources/gh.d.ts +48 -0
- package/dist/src/core/coverage-sources/git.d.ts +101 -0
- package/dist/src/core/coverage.d.ts +217 -0
- package/dist/src/core/credential-spec.d.ts +72 -0
- package/dist/src/core/daemon-actor.d.ts +45 -0
- package/dist/src/core/daemon-actor.js +54 -0
- package/dist/src/core/daemon-actor.js.map +1 -0
- package/dist/src/core/dark-session.d.ts +432 -0
- package/dist/src/core/dark-session.js +266 -82
- package/dist/src/core/dark-session.js.map +1 -1
- package/dist/src/core/decision-refusal.d.ts +206 -0
- package/dist/src/core/decision-refusal.js +24 -2
- package/dist/src/core/decision-refusal.js.map +1 -1
- package/dist/src/core/env-file.d.ts +455 -0
- package/dist/src/core/env-file.js +60 -1
- package/dist/src/core/env-file.js.map +1 -1
- package/dist/src/core/execute.d.ts +871 -0
- package/dist/src/core/execute.js +59 -8
- package/dist/src/core/execute.js.map +1 -1
- package/dist/src/core/frontmatter.d.ts +78 -0
- package/dist/src/core/gate-window.d.ts +312 -0
- package/dist/src/core/gate.d.ts +1449 -0
- package/dist/src/core/gate.js +149 -14
- package/dist/src/core/gate.js.map +1 -1
- package/dist/src/core/gesture-refusal.d.ts +166 -0
- package/dist/src/core/gesture-refusal.js +188 -0
- package/dist/src/core/gesture-refusal.js.map +1 -0
- package/dist/src/core/git-run.d.ts +73 -0
- package/dist/src/core/harness-version.d.ts +157 -0
- package/dist/src/core/harness-version.js +4 -1
- package/dist/src/core/harness-version.js.map +1 -1
- package/dist/src/core/harness-wait.d.ts +55 -0
- package/dist/src/core/head-retry.d.ts +107 -0
- package/dist/src/core/instance.d.ts +310 -0
- package/dist/src/core/instance.js +113 -0
- package/dist/src/core/instance.js.map +1 -1
- package/dist/src/core/intake-limits.d.ts +247 -0
- package/dist/src/core/jcs.d.ts +52 -0
- package/dist/src/core/journal.d.ts +144 -0
- package/dist/src/core/live-draw.d.ts +436 -0
- package/dist/src/core/log-reconcile.d.ts +89 -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 +316 -0
- package/dist/src/core/log.js.map +1 -1
- package/dist/src/core/loop.d.ts +274 -0
- package/dist/src/core/loop.js +11 -0
- package/dist/src/core/loop.js.map +1 -1
- package/dist/src/core/md-fence.d.ts +41 -0
- package/dist/src/core/money.d.ts +147 -0
- package/dist/src/core/payload-census.d.ts +74 -0
- package/dist/src/core/payload-store.d.ts +175 -0
- package/dist/src/core/payload.d.ts +71 -0
- package/dist/src/core/policy-diff.d.ts +292 -0
- package/dist/src/core/policy-diff.js +27 -4
- package/dist/src/core/policy-diff.js.map +1 -1
- package/dist/src/core/policy-expectations.d.ts +199 -0
- package/dist/src/core/policy-explain.d.ts +160 -0
- package/dist/src/core/policy-explain.js +63 -3
- package/dist/src/core/policy-explain.js.map +1 -1
- package/dist/src/core/policy-load.d.ts +567 -0
- package/dist/src/core/policy-load.js +36 -6
- package/dist/src/core/policy-load.js.map +1 -1
- package/dist/src/core/policy-match.d.ts +324 -0
- package/dist/src/core/policy-match.js +72 -9
- package/dist/src/core/policy-match.js.map +1 -1
- package/dist/src/core/policy-proposal.d.ts +317 -0
- package/dist/src/core/policy-proposal.js +102 -2
- package/dist/src/core/policy-proposal.js.map +1 -1
- package/dist/src/core/prompt-layout.d.ts +221 -0
- package/dist/src/core/protected-path-guard.d.ts +566 -0
- package/dist/src/core/protected-path-guard.js +848 -55
- package/dist/src/core/protected-path-guard.js.map +1 -1
- package/dist/src/core/question-preempted.d.ts +141 -0
- package/dist/src/core/question-preempted.js +152 -0
- package/dist/src/core/question-preempted.js.map +1 -0
- package/dist/src/core/read-scope.d.ts +172 -0
- package/dist/src/core/read-scope.js +252 -0
- package/dist/src/core/read-scope.js.map +1 -0
- package/dist/src/core/registration.d.ts +25 -0
- package/dist/src/core/reindex.d.ts +99 -0
- package/dist/src/core/sampler.d.ts +313 -0
- package/dist/src/core/sandbox.d.ts +371 -0
- package/dist/src/core/sandbox.js +190 -1
- package/dist/src/core/sandbox.js.map +1 -1
- package/dist/src/core/seal.d.ts +165 -0
- package/dist/src/core/sender-identity.d.ts +476 -0
- package/dist/src/core/sender-identity.js +572 -0
- package/dist/src/core/sender-identity.js.map +1 -0
- package/dist/src/core/shlex.d.ts +102 -0
- package/dist/src/core/shlex.js +159 -0
- package/dist/src/core/shlex.js.map +1 -0
- package/dist/src/core/state.d.ts +505 -0
- package/dist/src/core/task-file.d.ts +185 -0
- package/dist/src/core/telegram-config.d.ts +93 -0
- package/dist/src/core/token.d.ts +409 -0
- package/dist/src/core/token.js +21 -38
- package/dist/src/core/token.js.map +1 -1
- package/dist/src/core/validate.d.ts +138 -0
- package/dist/src/core/values.d.ts +147 -0
- package/dist/src/core/values.js +36 -1
- package/dist/src/core/values.js.map +1 -1
- package/dist/src/core/vault.d.ts +291 -0
- package/dist/src/core/verified-snapshot.d.ts +204 -0
- package/dist/src/core/verify.d.ts +336 -0
- package/dist/src/core/version.d.ts +8 -0
- package/dist/src/core/wysiwys.d.ts +370 -0
- package/dist/src/daemon/advance-child.d.ts +39 -0
- package/dist/src/daemon/advance.d.ts +476 -0
- package/dist/src/daemon/advance.js +25 -4
- package/dist/src/daemon/advance.js.map +1 -1
- package/dist/src/daemon/audit.d.ts +87 -0
- package/dist/src/daemon/daemon.d.ts +1180 -0
- package/dist/src/daemon/daemon.js +9 -0
- package/dist/src/daemon/daemon.js.map +1 -1
- package/dist/src/daemon/dark-session.d.ts +64 -0
- package/dist/src/daemon/draw-child.d.ts +36 -0
- package/dist/src/daemon/draw.d.ts +154 -0
- package/dist/src/daemon/git-evidence.d.ts +173 -0
- package/dist/src/daemon/git-evidence.js +1 -1
- package/dist/src/daemon/projection.d.ts +180 -0
- package/dist/src/daemon/prune.d.ts +207 -0
- package/dist/src/mcp/http.d.ts +113 -0
- package/dist/src/mcp/server.d.ts +265 -0
- package/dist/src/mcp/server.js +17 -1
- package/dist/src/mcp/server.js.map +1 -1
- package/docs/adapter-api.md +106 -0
- package/docs/cli-reference.md +1316 -63
- package/docs/codex-enforced-session.md +103 -0
- package/docs/codex-workspace-broker.md +118 -0
- package/package.json +14 -2
- package/schema/codex-instance.schema.json +82 -0
- package/schema/event.schema.json +539 -9
- 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/event/invalid/approval-granted-sender-hashed-false.json +20 -0
- package/schema/fixtures/event/invalid/approval-granted-sender-hashed-raw-id.json +20 -0
- package/schema/fixtures/event/invalid/audit-gesture-refused-human-actor.json +16 -0
- package/schema/fixtures/event/invalid/audit-gesture-refused-no-actor-no-sender.json +15 -0
- package/schema/fixtures/event/invalid/audit-gesture-refused-unknown-gesture.json +16 -0
- package/schema/fixtures/event/invalid/audit-question-preempted-agent-actor.json +16 -0
- package/schema/fixtures/event/invalid/audit-question-preempted-no-question-id.json +16 -0
- package/schema/fixtures/event/invalid/audit-question-preempted-unknown-source.json +15 -0
- package/schema/fixtures/event/invalid/gate-path-signed-off-absolute-path.json +14 -0
- package/schema/fixtures/event/invalid/gate-path-signed-off-agent-actor.json +14 -0
- package/schema/fixtures/event/invalid/gate-path-signed-off-missing-path.json +13 -0
- package/schema/fixtures/event/valid/approval-granted-sender-hashed.json +20 -0
- package/schema/fixtures/event/valid/audit-gesture-refused-review-note.json +21 -0
- package/schema/fixtures/event/valid/audit-gesture-refused-sender-key-unavailable.json +19 -0
- package/schema/fixtures/event/valid/audit-gesture-refused.json +19 -0
- package/schema/fixtures/event/valid/audit-question-preempted-no-verdict.json +16 -0
- package/schema/fixtures/event/valid/audit-question-preempted.json +20 -0
- package/schema/fixtures/event/valid/gate-path-signed-off.json +14 -0
- package/schema/fixtures/event/valid/harness-kind-claude-code.json +23 -0
- package/schema/fixtures/event/valid/harness-kind-codex.json +23 -0
- package/schema/fixtures/event/valid/harness-kind-cursor.json +23 -0
- package/schema/fixtures/event/valid/harness-kind-grok.json +23 -0
- package/schema/fixtures/event/valid/harness-kind-muse.json +23 -0
- package/schema/fixtures/policy/invalid/senders-half-keyed.json +20 -0
- package/schema/fixtures/policy/valid/canonical.json +1 -1
- package/schema/fixtures/policy/valid/senders-keyed.json +24 -0
- package/schema/fixtures/policy-md/valid/canonical.md +1 -1
- package/schema/fixtures/policy-md/valid/with-values.md +5 -7
- package/schema/fixtures/values/invalid/class-shaped.json +1 -1
- package/schema/fixtures/values/invalid/duplicate-entry.json +1 -1
- package/schema/fixtures/values/invalid/non-string-item.json +1 -1
- package/schema/fixtures/values/invalid/over-cap.json +1 -1
- package/schema/fixtures/values/invalid/unknown-key.json +1 -1
- package/schema/fixtures/values/invalid/version-float.json +1 -0
- package/schema/fixtures/values/invalid/version-integer.json +1 -0
- package/schema/fixtures/values/invalid/version-wrong-string.json +1 -0
- package/schema/fixtures/values/valid/empty-lists.json +2 -3
- package/schema/fixtures/values/valid/full.json +5 -7
- package/schema/fixtures/values/valid/minimal.json +1 -1
- package/schema/fixtures/values-md/invalid/schema-invalid.md +5 -3
- package/schema/fixtures/values-md/invalid/two-blocks.md +3 -3
- package/schema/fixtures/values-md/invalid/unterminated.md +2 -2
- package/schema/fixtures/values-md/invalid/version-1.md +69 -0
- package/schema/fixtures/values-md/invalid/version-unquoted.md +64 -0
- package/schema/fixtures/values-md/invalid/yaml-error.md +2 -2
- package/schema/fixtures/values-md/valid/absent.md +1 -1
- package/schema/fixtures/values-md/valid/with-values.md +5 -7
- package/schema/policy.schema.json +75 -3
- package/schema/values.schema.json +7 -11
- package/templates/codex/README.md +9 -0
- package/schema/fixtures/values/invalid/version-string.json +0 -1
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `approval policy apply <proposal.md>` (APRV-343) — apply a proposal
|
|
3
|
+
* document's quoted replacements to `APPROVAL.md`, then run the amendment.
|
|
4
|
+
*
|
|
5
|
+
* ## The hand-ritual this replaces
|
|
6
|
+
*
|
|
7
|
+
* Agents may not write `APPROVAL.md`: it is `policy.core`, and this repository's
|
|
8
|
+
* policy holds that class human-only. So a policy change an agent proposes
|
|
9
|
+
* travels as a document under `docs/proposals/` that quotes each current line
|
|
10
|
+
* byte for byte beside its replacement, and the human pastes. On 2026-09-16 the
|
|
11
|
+
* paste was done by copying a prepared file over `APPROVAL.md` and running
|
|
12
|
+
* `approval policy amend`. Two things go wrong with that, and both have:
|
|
13
|
+
*
|
|
14
|
+
* - **a whole-file copy reverts what it did not know about.** The prepared file
|
|
15
|
+
* was written against the policy as it stood when the proposal was drafted,
|
|
16
|
+
* so anything landed in between is silently undone. This is the failure
|
|
17
|
+
* `base-policy-diverged` catches for the COMMIT, one step too late to help;
|
|
18
|
+
* - **a paste carries its wrapper.** One paste of a proposal page took the
|
|
19
|
+
* page's own fence with it, which hid a block from the loader (APRV-273).
|
|
20
|
+
*
|
|
21
|
+
* This verb answers both by construction. It never writes bytes that are not
|
|
22
|
+
* anchored to bytes already in the live file, and it reads fences by their
|
|
23
|
+
* backtick run, so a four-backtick wrapper around a three-backtick block is the
|
|
24
|
+
* wrapper it is rather than part of the content.
|
|
25
|
+
*
|
|
26
|
+
* ## The contract, and the three questions APRV-343 left open
|
|
27
|
+
*
|
|
28
|
+
* A proposal is markdown. Anywhere in it, a fenced block whose immediately
|
|
29
|
+
* preceding non-blank line is a LABEL is a member of a pair:
|
|
30
|
+
*
|
|
31
|
+
* - `Current:` — the bytes as they stand in the live policy;
|
|
32
|
+
* - `Replace with:` — what they become;
|
|
33
|
+
* - `Supersedes:` — optional, and the answer to the first open question.
|
|
34
|
+
*
|
|
35
|
+
* **How supersession is declared.** Explicitly, by a third block, and never by
|
|
36
|
+
* position. A later section that rewrites a line an earlier section already
|
|
37
|
+
* rewrote quotes the earlier section's RESULT under a `Supersedes:` label, and
|
|
38
|
+
* the applier looks for that text when the section's own `Current` block is no
|
|
39
|
+
* longer in the file — which is exactly the state the earlier section left
|
|
40
|
+
* behind. Position could not carry this: two sections that touch one line are
|
|
41
|
+
* not in general in the order the file needs, and a rule inferred from order is
|
|
42
|
+
* a rule nobody can read off the page. A pair whose `Current` AND `Supersedes`
|
|
43
|
+
* blocks both occur is ambiguous and refuses, because it means the file
|
|
44
|
+
* contains both spellings and no verb here will pick.
|
|
45
|
+
*
|
|
46
|
+
* **Whether a whole-file replacement is accepted.** No, and that is the
|
|
47
|
+
* decision rather than an omission. The verb's whole value is that every byte it
|
|
48
|
+
* writes is anchored to a byte it proved present, which is what makes a stale
|
|
49
|
+
* proposal a refusal instead of a silent revert. A whole-file blob has no
|
|
50
|
+
* anchor: applying one is a paste with extra steps, and `approval policy amend`
|
|
51
|
+
* over a hand-edited file is already the supported way to do that deliberately.
|
|
52
|
+
*
|
|
53
|
+
* **How the values block is treated.** Identically, and by knowing nothing
|
|
54
|
+
* about it. The applier is a byte-level replacement over the whole file; it
|
|
55
|
+
* does not parse the policy, does not locate blocks, and does not care which
|
|
56
|
+
* fence a pair lands in. The values block is inert (SPEC §11.1 invariant 10),
|
|
57
|
+
* so applying one changes no verdict, and the attestation the amend appends
|
|
58
|
+
* covers the whole file's bytes either way (SPEC §5.2, §5.3). A verb that
|
|
59
|
+
* treated the two blocks differently would be asserting a distinction the file
|
|
60
|
+
* does not make.
|
|
61
|
+
*
|
|
62
|
+
* ## Refuse before writing, always
|
|
63
|
+
*
|
|
64
|
+
* Every pair is resolved against an IN-MEMORY copy, in document order, before a
|
|
65
|
+
* byte reaches the disk. A proposal whose third pair is stale writes nothing at
|
|
66
|
+
* all, so "a stale proposal cannot half-apply" is a property of the code rather
|
|
67
|
+
* than of the order somebody wrote the sections in.
|
|
68
|
+
*
|
|
69
|
+
* ## It publishes, because one command means one command (APRV-360)
|
|
70
|
+
*
|
|
71
|
+
* The amendment runs with `--pr` unless `--no-publish` says otherwise. Before
|
|
72
|
+
* this, `apply` ran the amend with no flag: the policy was written and
|
|
73
|
+
* attested, and the operator was handed a printed procedure for getting it onto
|
|
74
|
+
* main. On 2026-09-18 that procedure opened with `git checkout -b
|
|
75
|
+
* policy-amend-<seq> origin/main`, the primary's main was fourteen commits
|
|
76
|
+
* behind, and the switch refused rather than overwrite `QUEUE.md`, the working
|
|
77
|
+
* log and six payloads. The ceremony stalled with an edited, attested,
|
|
78
|
+
* unpublished policy, which is the one state in which every gated operation on
|
|
79
|
+
* the box refuses.
|
|
80
|
+
*
|
|
81
|
+
* A verb whose whole value is that the edit and its attestation are ONE act has
|
|
82
|
+
* no business stopping one step short of the act being visible. `--no-publish`
|
|
83
|
+
* is the operator who wants it to stop at the commit; `--pr` is accepted and
|
|
84
|
+
* does nothing, because runbooks already say it.
|
|
85
|
+
*
|
|
86
|
+
* ## Human-only
|
|
87
|
+
*
|
|
88
|
+
* `approval policy apply` classifies `policy.core` (`core/command-class.ts`),
|
|
89
|
+
* which this repository's policy holds human-only, so the hook denies an agent
|
|
90
|
+
* that runs it. The verb ALSO refuses an agent identity itself, with
|
|
91
|
+
* `apply-agent-actor`: a lock that exists only in the classifier is a lock that
|
|
92
|
+
* a harness without a hook does not have. It mints no class — `policy.core`
|
|
93
|
+
* already exists and already covers the policy's own machinery (SPEC §11.1
|
|
94
|
+
* invariant 9).
|
|
95
|
+
*/
|
|
96
|
+
import type { Streams } from "./main.js";
|
|
97
|
+
/**
|
|
98
|
+
* Machine-readable refusal codes. Frozen public API, printed in the help.
|
|
99
|
+
*
|
|
100
|
+
* Distinct by repair, which is the whole test: `proposal-stale` means the live
|
|
101
|
+
* file moved and the proposal has to be rewritten against it; `proposal-
|
|
102
|
+
* ambiguous` means the quoted text is not specific enough and the proposal has
|
|
103
|
+
* to quote more; `proposal-malformed` means the page is not a proposal yet.
|
|
104
|
+
*
|
|
105
|
+
* Two outcomes are deliberately NOT in this union, because neither is this
|
|
106
|
+
* verb's refusal to make:
|
|
107
|
+
*
|
|
108
|
+
* - an operator who answers no at the confirmation gets exit 0 and `aborted:`
|
|
109
|
+
* on stdout, exactly as `policy amend` does. Nothing failed, and an error
|
|
110
|
+
* object at exit 0 would be a contradiction a caller has to resolve;
|
|
111
|
+
* - an amendment that refuses has already printed its OWN code, from its own
|
|
112
|
+
* frozen union. Wrapping it in a second one would put two error objects on
|
|
113
|
+
* one stream and make a caller guess which is the answer. What this verb adds
|
|
114
|
+
* is the sentence naming the state that refusal leaves behind.
|
|
115
|
+
*/
|
|
116
|
+
export declare const POLICY_APPLY_REFUSAL_CODES: readonly ["usage", "io", "apply-agent-actor", "proposal-empty", "proposal-malformed", "proposal-stale", "proposal-ambiguous"];
|
|
117
|
+
export type PolicyApplyRefusalCode = (typeof POLICY_APPLY_REFUSAL_CODES)[number];
|
|
118
|
+
/** One fenced block, with the label line that introduced it. */
|
|
119
|
+
interface Fence {
|
|
120
|
+
/** The non-blank line immediately above the opening fence, trimmed. */
|
|
121
|
+
label: string;
|
|
122
|
+
/** The block's content, without either fence line and without a trailing newline. */
|
|
123
|
+
body: string;
|
|
124
|
+
/** 1-based line number of the opening fence, for a refusal that has to point. */
|
|
125
|
+
line: number;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Every fenced block in `text` that declares a language.
|
|
129
|
+
*
|
|
130
|
+
* Two rules, and both are APRV-273:
|
|
131
|
+
*
|
|
132
|
+
* 1. **A fence is closed by a run of AT LEAST as many backticks as opened it.**
|
|
133
|
+
* That is CommonMark's rule and it is the one that makes a four-backtick
|
|
134
|
+
* wrapper work: the inner ```` ```yaml approval-values ```` lines are content,
|
|
135
|
+
* not fences, so the block quoted is the block including its own fences.
|
|
136
|
+
* 2. **An opener with no info string is not a block this verb reads.** The
|
|
137
|
+
* incident was a bare fence swallowing a block whose language nobody
|
|
138
|
+
* declared; a proposal that wants a block applied says what it is.
|
|
139
|
+
*/
|
|
140
|
+
export declare function fencesOf(text: string): Fence[];
|
|
141
|
+
/** One current/replacement pair, in the order the document states them. */
|
|
142
|
+
export interface ProposalPair {
|
|
143
|
+
/** The `###` (or `##`) heading this pair sits under, for the diff. */
|
|
144
|
+
heading: string;
|
|
145
|
+
current: string;
|
|
146
|
+
replacement: string;
|
|
147
|
+
/** The earlier section's result this pair replaces instead, when declared. */
|
|
148
|
+
supersedes: string | null;
|
|
149
|
+
/** Line of the `Replace with:` fence, so a refusal can point at the page. */
|
|
150
|
+
line: number;
|
|
151
|
+
}
|
|
152
|
+
export type ParseResult = {
|
|
153
|
+
ok: true;
|
|
154
|
+
pairs: ProposalPair[];
|
|
155
|
+
} | {
|
|
156
|
+
ok: false;
|
|
157
|
+
code: PolicyApplyRefusalCode;
|
|
158
|
+
message: string;
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Read a proposal document into ordered pairs.
|
|
162
|
+
*
|
|
163
|
+
* A block whose label names no role is skipped in silence, which is what lets a
|
|
164
|
+
* proposal page carry a `bash` block of commands to run afterwards without the
|
|
165
|
+
* applier mistaking it for policy text.
|
|
166
|
+
*/
|
|
167
|
+
export declare function parseProposal(text: string): ParseResult;
|
|
168
|
+
/** What one pair did, once the whole proposal was known to apply. */
|
|
169
|
+
export interface AppliedPair {
|
|
170
|
+
heading: string;
|
|
171
|
+
/** The text that was found in the file: the `Current` block, or the superseded one. */
|
|
172
|
+
matched: string;
|
|
173
|
+
replacement: string;
|
|
174
|
+
/** True when the match was the superseded text rather than the pair's own Current. */
|
|
175
|
+
superseded: boolean;
|
|
176
|
+
}
|
|
177
|
+
export type PlanResult = {
|
|
178
|
+
ok: true;
|
|
179
|
+
text: string;
|
|
180
|
+
applied: AppliedPair[];
|
|
181
|
+
} | {
|
|
182
|
+
ok: false;
|
|
183
|
+
code: PolicyApplyRefusalCode;
|
|
184
|
+
message: string;
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* Resolve every pair against an in-memory copy of the policy, in order.
|
|
188
|
+
*
|
|
189
|
+
* Nothing here touches the disk, which is what makes the refusals honest: a
|
|
190
|
+
* proposal is applied whole or not at all, and the caller writes only the text
|
|
191
|
+
* this function returned.
|
|
192
|
+
*/
|
|
193
|
+
export declare function planApply(live: string, pairs: readonly ProposalPair[]): PlanResult;
|
|
194
|
+
export declare function commandPolicyApply(argv: string[], streams: Streams, cwd: string): number;
|
|
195
|
+
export {};
|