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,432 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dark-session detector (APRV-192): the log is asked what git already knows.
|
|
3
|
+
*
|
|
4
|
+
* ## The hole this closes
|
|
5
|
+
*
|
|
6
|
+
* APRV-151 built the CI-side grant cross-check, and its root cause is the thing
|
|
7
|
+
* that check cannot reach. A session whose harness never invoked the hook writes
|
|
8
|
+
* NO records at all: not a grant, not a refusal, not a request. Nothing inside
|
|
9
|
+
* such a session is in a position to notice, because the component that would
|
|
10
|
+
* have written the record is the component that did not run, and asking a
|
|
11
|
+
* session whether it is hooked asks the party under oversight to report its own
|
|
12
|
+
* oversight (SPEC.md §11). The CI guard sees only the diffs that reach a pull
|
|
13
|
+
* request; a session that ran dark and pushed nothing, or pushed to a branch
|
|
14
|
+
* nobody opened a pull request for, leaves the guard with nothing to read.
|
|
15
|
+
*
|
|
16
|
+
* So the direction is reversed. APRV-42's git evidence asks "does every log
|
|
17
|
+
* entry match git?"; this asks **"does every piece of git activity match a log
|
|
18
|
+
* entry?"** Git is the artifact a session cannot help producing: a commit has an
|
|
19
|
+
* author, a date and a tree, a linked worktree has a root and a birth, and none
|
|
20
|
+
* of those is authored by the runtime's hook. The absence of a record beside
|
|
21
|
+
* them is the signal.
|
|
22
|
+
*
|
|
23
|
+
* ## Two arms, because there are two questions
|
|
24
|
+
*
|
|
25
|
+
* **Arm A, evidence.** For each commit in the window, every guarded path it
|
|
26
|
+
* changed must carry evidence in the verified log that a human decided it. This
|
|
27
|
+
* is not reimplemented: it is {@link evaluateProtectedPaths}, APRV-151's own
|
|
28
|
+
* evaluator, called per commit, so the verdict vocabulary (`attested`,
|
|
29
|
+
* `granted-file`, `granted-command`), the recency bound, the exempt evidence
|
|
30
|
+
* surface and the `no-evidence` code are one implementation with two callers.
|
|
31
|
+
* Arm A runs over EVERY checkout, the primary included, because a guarded-path
|
|
32
|
+
* commit with no evidence is dark wherever it was made.
|
|
33
|
+
*
|
|
34
|
+
* **Arm B, silence.** A linked worktree that produced commits in the window (or
|
|
35
|
+
* that came into existence in it) and to which NOT ONE record in the window can
|
|
36
|
+
* be attributed is a dark session, whatever it touched. This is the arm that
|
|
37
|
+
* catches the APRV-151 root cause on paths the CI guard never sees, and it is
|
|
38
|
+
* the arm that needs an attribution rule.
|
|
39
|
+
*
|
|
40
|
+
* ## How a record is attributed to a worktree
|
|
41
|
+
*
|
|
42
|
+
* Hook task ids are `hook:<session>:<tool-use>` and carry no checkout, so the
|
|
43
|
+
* id is not the key. The bound material is. Every gated file-tool call binds
|
|
44
|
+
* `{tool, rule, file, …}` with `file` ABSOLUTE (`cli/hook.ts`), and every gated
|
|
45
|
+
* shell call binds `{command, cwd}` with `cwd` absolute. A record whose bound
|
|
46
|
+
* material names a path inside a worktree root was written by a session working
|
|
47
|
+
* in that worktree. That is PR #169's checkout-root anchoring, which APRV-151's
|
|
48
|
+
* notes recorded as the stronger answer to the two-checkouts problem and did not
|
|
49
|
+
* have a caller for; it has one now.
|
|
50
|
+
*
|
|
51
|
+
* The branch name is the second key, and a weak one: a branch `aprv-192-…`
|
|
52
|
+
* names task `APRV-192`, and a `task.registered` for that id in the window is
|
|
53
|
+
* attribution. Weak because a branch name is chosen by the party under
|
|
54
|
+
* oversight, so it may only ever ADD attribution (SPEC.md §11.1 invariant 4:
|
|
55
|
+
* a self-reported field may raise scrutiny and never lower it) — which is
|
|
56
|
+
* exactly what it does here, since attribution is what stops an alarm. Stated
|
|
57
|
+
* plainly rather than hidden: a session that names its branch after a task some
|
|
58
|
+
* other session registered escapes arm B. It does not escape arm A, and the
|
|
59
|
+
* cost of the alternative (no branch key at all) is an alarm on every worktree
|
|
60
|
+
* whose session worked entirely outside the payload store's reach.
|
|
61
|
+
*
|
|
62
|
+
* ## What unit arm A judges, merges included (APRV-374)
|
|
63
|
+
*
|
|
64
|
+
* One commit, base to commit, which is the unit a grant binds and the unit the
|
|
65
|
+
* CI guard judges since APRV-375. The inputs are built by
|
|
66
|
+
* `core/commit-guard.ts`, so the two sides cannot drift apart.
|
|
67
|
+
*
|
|
68
|
+
* A MERGE commit is judged on what it invented and on nothing else. `git log
|
|
69
|
+
* --name-only` reports no path at all for a merge, so until APRV-374 every
|
|
70
|
+
* merge dropped out of arm A, which is right for an ordinary merge and wrong
|
|
71
|
+
* for the evil one: a conflict resolution, or a hand edit made while resolving,
|
|
72
|
+
* is the merge commit's own work, made in the checkout that made the merge, and
|
|
73
|
+
* no other commit carries those bytes. So a merge is judged for the paths whose
|
|
74
|
+
* DENSE COMBINED PATCH (`git log --cc`, {@link denseCombinedPaths}) is
|
|
75
|
+
* non-empty, against its FIRST PARENT, which is the state the checkout was in
|
|
76
|
+
* before the merge and therefore the before-state a grant for the resolution
|
|
77
|
+
* would have bound.
|
|
78
|
+
*
|
|
79
|
+
* The dense patch and not `--cc --name-only`, which over-reports: a merge blob
|
|
80
|
+
* differs from every parent blob whenever both sides edited one file, so
|
|
81
|
+
* `--name-only` lists a file two lanes happened to edit concurrently and git
|
|
82
|
+
* merged without a human in the room. Replaying that as the merge's own change
|
|
83
|
+
* would report dark for work every side of it had evidence for, which is the
|
|
84
|
+
* class of false alarm APRV-369 and APRV-375 exist to remove. The dense patch
|
|
85
|
+
* is empty for exactly those merges and non-empty for the resolutions.
|
|
86
|
+
*
|
|
87
|
+
* Scope is the guard's scope: guarded paths. A merge that resolved a conflict
|
|
88
|
+
* in a file no policy protects is not this detector's business, so the dense
|
|
89
|
+
* question is only ever asked about paths {@link isGuardedPath} accepts.
|
|
90
|
+
*
|
|
91
|
+
* ## Fail closed in the report
|
|
92
|
+
*
|
|
93
|
+
* Uncertainty is never "fine". A log that does not verify, a payload whose
|
|
94
|
+
* bytes will not resolve, a commit git could not date, a worktree whose root
|
|
95
|
+
* cannot be placed: each is its own `undetermined` verdict with its own code,
|
|
96
|
+
* counted separately from the clean ones, and the renderer never folds an
|
|
97
|
+
* undetermined subject into the pass count. What this module does NOT do is
|
|
98
|
+
* escalate on uncertainty, because a detector is not an enforcement path: it
|
|
99
|
+
* reports, a human reads, and nothing here changes what the gate authorizes.
|
|
100
|
+
*
|
|
101
|
+
* ## What keeps the human's own commits quiet (AC4)
|
|
102
|
+
*
|
|
103
|
+
* Three exemptions, narrow and documented, and each of them fails NOISY when it
|
|
104
|
+
* does not apply:
|
|
105
|
+
*
|
|
106
|
+
* 1. A commit that touches only the daemon's own append surface
|
|
107
|
+
* ({@link EXEMPT_PREFIXES}) is a records advance carrying evidence, not a
|
|
108
|
+
* session doing work. Requiring evidence for the evidence is circular.
|
|
109
|
+
* 2. A commit authored by the git-evidence identity is the daemon's own
|
|
110
|
+
* (`daemon/git-evidence.ts`), and the daemon is not a session.
|
|
111
|
+
* 3. Arm B's subject is LINKED WORKTREES ONLY. The agent-session artifact is
|
|
112
|
+
* the worktree; the human commits in the primary checkout, where the policy
|
|
113
|
+
* ceremony and the genesis events are made. The primary is not thereby
|
|
114
|
+
* passed: it stays wholly subject to arm A, so a ceremony commit passes on
|
|
115
|
+
* its attestation and an unevidenced guarded-path commit there is still
|
|
116
|
+
* reported. And the limit is stated on every report as its own coverage
|
|
117
|
+
* line, so an agent session that ran in the primary checkout shows up as a
|
|
118
|
+
* gap in the report rather than as silence.
|
|
119
|
+
*
|
|
120
|
+
* ## Layout
|
|
121
|
+
*
|
|
122
|
+
* The evaluator ({@link evaluateDarkSessions}) takes no clock and reads no
|
|
123
|
+
* file, so a fixture drives everything but arm A's replay: the ONE thing it
|
|
124
|
+
* runs git for is reading the blobs of a commit it is judging, which cannot be
|
|
125
|
+
* carried in the observation because which blobs are wanted is not known until
|
|
126
|
+
* the verdict is being computed. A fixture whose commits change no guarded path
|
|
127
|
+
* needs no repository at all. The observing half below the fold runs the rest
|
|
128
|
+
* of the git and reads the payload store,
|
|
129
|
+
* and it lives here rather than under `daemon/` because `approval doctor`
|
|
130
|
+
* reports the same findings and `src/cli/` may not import `src/daemon/`
|
|
131
|
+
* (APRV-59). The one thing that stays in `daemon/dark-session.ts` is the
|
|
132
|
+
* append, which is the one thing a reader must never do.
|
|
133
|
+
*/
|
|
134
|
+
import type { ProtectedPathEntry } from "./command-class.js";
|
|
135
|
+
import { type Clock } from "./clock.js";
|
|
136
|
+
import type { EventRecord } from "./log.js";
|
|
137
|
+
/**
|
|
138
|
+
* The events a hooked session cannot avoid writing.
|
|
139
|
+
*
|
|
140
|
+
* A registration opens the question, a request puts it to a human, and a start
|
|
141
|
+
* records that something ran. A session that made any gated tool call at all
|
|
142
|
+
* wrote at least one of these; a session that wrote none of them made no gated
|
|
143
|
+
* call the runtime ever saw, which is the definition of dark.
|
|
144
|
+
*/
|
|
145
|
+
export declare const SESSION_EVENTS: readonly string[];
|
|
146
|
+
/**
|
|
147
|
+
* How a subject came out. **Frozen union**, additive-only, in the same sense as
|
|
148
|
+
* every other verdict vocabulary here (SPEC.md §11.1 invariant 6).
|
|
149
|
+
*/
|
|
150
|
+
export declare const DARK_SESSION_VERDICTS: readonly ["hooked", "dark", "exempt", "undetermined"];
|
|
151
|
+
export type DarkSessionVerdict = (typeof DARK_SESSION_VERDICTS)[number];
|
|
152
|
+
/**
|
|
153
|
+
* Why a subject got the verdict it got. **Frozen union**, additive-only.
|
|
154
|
+
*
|
|
155
|
+
* `no-evidence` is spelled exactly as APRV-151 spells it, because it IS
|
|
156
|
+
* APRV-151's finding, arrived at through the same evaluator.
|
|
157
|
+
*/
|
|
158
|
+
export declare const DARK_SESSION_CODES: readonly [
|
|
159
|
+
/** Arm B: git activity in the window, and not one attributable record. */
|
|
160
|
+
"no-records",
|
|
161
|
+
/** Arm A: a guarded path changed and the log carries no evidence for it. */
|
|
162
|
+
"no-evidence",
|
|
163
|
+
/**
|
|
164
|
+
* Arm A, and EVERY failing commit arrived here through a merge (APRV-369).
|
|
165
|
+
*
|
|
166
|
+
* The same failure as `no-evidence` and the same `dark` verdict — nothing is
|
|
167
|
+
* excused by it — reported under its own code because the checkout it names
|
|
168
|
+
* is the one that SYNCED the change rather than the one that made it. The
|
|
169
|
+
* repair is in whatever branch or worktree authored the commit, which the
|
|
170
|
+
* detail names.
|
|
171
|
+
*/
|
|
172
|
+
"no-evidence-merged",
|
|
173
|
+
/** Exempt: the commits touch only the daemon's own append surface. */
|
|
174
|
+
"evidence-surface",
|
|
175
|
+
/** Exempt: authored by the daemon's own git identity. */
|
|
176
|
+
"daemon-authored",
|
|
177
|
+
/** Exempt from arm B (never from arm A): the primary checkout. */
|
|
178
|
+
"primary-checkout",
|
|
179
|
+
/** Undetermined: the log did not verify, so nothing may be read from it. */
|
|
180
|
+
"log-unverified",
|
|
181
|
+
/** Undetermined: git could not be run, or answered nothing. */
|
|
182
|
+
"git-unavailable",
|
|
183
|
+
/** Undetermined: bound material would not resolve, so records cannot be placed. */
|
|
184
|
+
"payload-unresolvable",
|
|
185
|
+
/** Undetermined: git named no usable date for the activity. */
|
|
186
|
+
"activity-undated"];
|
|
187
|
+
export type DarkSessionCode = (typeof DARK_SESSION_CODES)[number];
|
|
188
|
+
/**
|
|
189
|
+
* The codes a `dark` verdict can carry, and therefore the ones that reach the
|
|
190
|
+
* log on an `audit.dark_session` record (APRV-369).
|
|
191
|
+
*
|
|
192
|
+
* A separate, smaller list than {@link DARK_SESSION_CODES} because it is the
|
|
193
|
+
* one the event schema constrains: an exempt or undetermined subject is never
|
|
194
|
+
* recorded, so its code has no business in a write-boundary enum. Pinned equal
|
|
195
|
+
* to that enum by a test, for the reason APRV-358 gave: a code the sweep can
|
|
196
|
+
* produce and the schema refuses is an observation that never reaches a human,
|
|
197
|
+
* and nothing fails loudly when it happens.
|
|
198
|
+
*/
|
|
199
|
+
export declare const DARK_VERDICT_CODES: readonly ["no-records", "no-evidence", "no-evidence-merged"];
|
|
200
|
+
/** One commit the observer saw, as git reported it. */
|
|
201
|
+
export interface ObservedCommit {
|
|
202
|
+
/** The full sha. */
|
|
203
|
+
sha: string;
|
|
204
|
+
/** Author instant, ISO-8601, or `null` when git would not say. */
|
|
205
|
+
ts: string | null;
|
|
206
|
+
/** `Name <email>`, verbatim from git. */
|
|
207
|
+
author: string;
|
|
208
|
+
/** The author's email alone, lowercased, or `""` when git named none. */
|
|
209
|
+
authorEmail: string;
|
|
210
|
+
/**
|
|
211
|
+
* Repository-relative, `/`-separated paths this commit changed.
|
|
212
|
+
*
|
|
213
|
+
* For a MERGE commit these are the guarded paths whose result differs from
|
|
214
|
+
* every parent hunk by hunk — the merge's own resolution work, and nothing
|
|
215
|
+
* its parents did (APRV-374). An ordinary merge has none.
|
|
216
|
+
*/
|
|
217
|
+
changedPaths: readonly string[];
|
|
218
|
+
/**
|
|
219
|
+
* The commit's parents in git's own order, when the observer asked.
|
|
220
|
+
*
|
|
221
|
+
* OPTIONAL, and absence means "unknown", which the per-commit input builder
|
|
222
|
+
* reads as "assume it has a parent": the modest direction, since the base it
|
|
223
|
+
* then judges against is the first parent rather than nothing at all.
|
|
224
|
+
* Two or more parents is what makes a commit a merge here.
|
|
225
|
+
*/
|
|
226
|
+
parents?: readonly string[];
|
|
227
|
+
/** The branch or worktree this commit was observed on, for the message. */
|
|
228
|
+
ref: string;
|
|
229
|
+
/**
|
|
230
|
+
* Did this commit reach the checkout through a merge rather than being made
|
|
231
|
+
* on it? (APRV-369.)
|
|
232
|
+
*
|
|
233
|
+
* True when the commit is reachable from the observed HEAD but is NOT on its
|
|
234
|
+
* first-parent history, which is what "somebody else's branch was merged in"
|
|
235
|
+
* looks like in git: a lane's commits, a contributor's, or anything that
|
|
236
|
+
* arrived by fast-forward from the trunk. A commit made in this checkout and
|
|
237
|
+
* committed on the branch it is standing on is on the first-parent path and
|
|
238
|
+
* is `false`.
|
|
239
|
+
*
|
|
240
|
+
* OPTIONAL, and absence means `false` — attributed to this checkout. That is
|
|
241
|
+
* the direction that keeps a caller written before this field existed
|
|
242
|
+
* honest: an observer that cannot say where a commit came from must not be
|
|
243
|
+
* read as saying it came from somewhere else.
|
|
244
|
+
*/
|
|
245
|
+
arrivedByMerge?: boolean;
|
|
246
|
+
}
|
|
247
|
+
/** One checkout the observer saw: the primary, or a linked worktree. */
|
|
248
|
+
export interface ObservedCheckout {
|
|
249
|
+
/** Absolute, symlink-resolved root. */
|
|
250
|
+
root: string;
|
|
251
|
+
/** How it is named in the report (the worktree directory's base name). */
|
|
252
|
+
name: string;
|
|
253
|
+
/** True for the primary checkout, false for a linked worktree. */
|
|
254
|
+
primary: boolean;
|
|
255
|
+
/** The checked-out branch, or `null` on a detached HEAD. */
|
|
256
|
+
branch: string | null;
|
|
257
|
+
/** Its birth instant, when the observer could stat it; else `null`. */
|
|
258
|
+
born: string | null;
|
|
259
|
+
/** Commits observed on it inside the window. */
|
|
260
|
+
commits: readonly ObservedCommit[];
|
|
261
|
+
}
|
|
262
|
+
/** What the observer gathered, and what it could not. */
|
|
263
|
+
export interface GitActivity {
|
|
264
|
+
checkouts: readonly ObservedCheckout[];
|
|
265
|
+
/**
|
|
266
|
+
* Why git could not be asked, when it could not. A non-null value makes every
|
|
267
|
+
* subject `undetermined` rather than passing them for lack of evidence.
|
|
268
|
+
*/
|
|
269
|
+
unavailable: string | null;
|
|
270
|
+
}
|
|
271
|
+
/** The window the sweep judged, as instants. */
|
|
272
|
+
export interface DarkSessionWindow {
|
|
273
|
+
from: string;
|
|
274
|
+
to: string;
|
|
275
|
+
}
|
|
276
|
+
export interface DarkSessionInput {
|
|
277
|
+
activity: GitActivity;
|
|
278
|
+
/**
|
|
279
|
+
* Records from the log that have passed chain verification, or `null` when it
|
|
280
|
+
* did not verify. `null` makes every subject `undetermined`; nothing here
|
|
281
|
+
* reads an unverified record (SPEC.md §11.1 invariant 1).
|
|
282
|
+
*/
|
|
283
|
+
records: readonly EventRecord[] | null;
|
|
284
|
+
/** Why the log could not be used, when `records` is `null`. */
|
|
285
|
+
logDetail?: string;
|
|
286
|
+
/** `policy.protected_paths`, widening the built-in guarded set. */
|
|
287
|
+
policyProtectedPaths: readonly ProtectedPathEntry[];
|
|
288
|
+
/** The policy file's repository-relative path, e.g. `APPROVAL.md`. */
|
|
289
|
+
policyPath: string;
|
|
290
|
+
/** SHA-256 of the policy bytes now on disk, for the `attested` verdict. */
|
|
291
|
+
policySha256: string | null;
|
|
292
|
+
/** Resolve bound material by hash from the live payload store. */
|
|
293
|
+
payloadFor: (hash: string) => unknown | null;
|
|
294
|
+
/** Author emails whose commits are the daemon's own, lowercased. */
|
|
295
|
+
daemonEmails: readonly string[];
|
|
296
|
+
/** The instants the observer swept between. */
|
|
297
|
+
window: DarkSessionWindow;
|
|
298
|
+
/** Override the recency bound `evaluateProtectedPaths` applies. */
|
|
299
|
+
lookbackMs?: number;
|
|
300
|
+
}
|
|
301
|
+
/** One subject's verdict. A subject is one checkout. */
|
|
302
|
+
export interface DarkSessionFinding {
|
|
303
|
+
/** The checkout's name — the worktree directory, or `primary`. */
|
|
304
|
+
subject: string;
|
|
305
|
+
root: string;
|
|
306
|
+
primary: boolean;
|
|
307
|
+
branch: string | null;
|
|
308
|
+
verdict: DarkSessionVerdict;
|
|
309
|
+
code: DarkSessionCode | null;
|
|
310
|
+
/** Commits observed on this subject in the window. */
|
|
311
|
+
commits: number;
|
|
312
|
+
/** Guarded paths this subject changed in the window. */
|
|
313
|
+
guardedPaths: readonly string[];
|
|
314
|
+
/** Records in the window attributed to this subject. */
|
|
315
|
+
attributed: readonly number[];
|
|
316
|
+
/**
|
|
317
|
+
* The newest sha observed on this subject, or `null` when it produced no
|
|
318
|
+
* commit. Half of the observation key: an alarm is about a state of the
|
|
319
|
+
* world, and the same state must not be recorded twice.
|
|
320
|
+
*/
|
|
321
|
+
newestSha: string | null;
|
|
322
|
+
/** Stable across ticks for one observation; see {@link observationKey}. */
|
|
323
|
+
key: string;
|
|
324
|
+
/** Prose a reader can act on, on every verdict. */
|
|
325
|
+
detail: string;
|
|
326
|
+
}
|
|
327
|
+
export interface DarkSessionReport {
|
|
328
|
+
/** True when no subject came out `dark`. Says nothing about what was seen. */
|
|
329
|
+
ok: boolean;
|
|
330
|
+
/**
|
|
331
|
+
* True when every subject was ESTABLISHED, one way or the other.
|
|
332
|
+
*
|
|
333
|
+
* Kept separate from {@link DarkSessionReport.ok} on purpose. A report with
|
|
334
|
+
* no dark subject and three undetermined ones is not a clean sweep, and a
|
|
335
|
+
* single boolean would have to lie about one of the two facts: either it
|
|
336
|
+
* alarms on uncertainty (and an operator learns to ignore the alarm) or it
|
|
337
|
+
* calls uncertainty fine (and the detector reports a pass it did not earn).
|
|
338
|
+
* Two booleans say both things, and every surface reads the one it means.
|
|
339
|
+
*/
|
|
340
|
+
settled: boolean;
|
|
341
|
+
findings: readonly DarkSessionFinding[];
|
|
342
|
+
window: DarkSessionWindow;
|
|
343
|
+
/**
|
|
344
|
+
* What this sweep could not see, always stated. Arm B covers linked worktrees
|
|
345
|
+
* only, so a session that ran in the primary checkout is outside it, and a
|
|
346
|
+
* report that did not say so would be claiming coverage it does not have.
|
|
347
|
+
*/
|
|
348
|
+
coverage: string;
|
|
349
|
+
}
|
|
350
|
+
/** The observation key: one subject, one state of the world. */
|
|
351
|
+
export declare function observationKey(subject: string, newestSha: string | null, born: string | null): string;
|
|
352
|
+
/** The Backlog.md task id a branch name begins with, upper-cased (`aprv-192-x`). */
|
|
353
|
+
export declare function taskIdFromBranch(branch: string | null): string | null;
|
|
354
|
+
/**
|
|
355
|
+
* Evaluate what git showed against what the log carries. Pure: no IO, no clock.
|
|
356
|
+
*/
|
|
357
|
+
export declare function evaluateDarkSessions(input: DarkSessionInput): DarkSessionReport;
|
|
358
|
+
/** The report as lines an operator reads. Pure. */
|
|
359
|
+
export declare function renderDarkSessionReport(report: DarkSessionReport): string;
|
|
360
|
+
/**
|
|
361
|
+
* Everything below this line does IO, and it lives here rather than in
|
|
362
|
+
* `daemon/` for one reason: `approval doctor` reports the same findings and
|
|
363
|
+
* `src/cli/` may not import `src/daemon/` (APRV-59, `tests/layering.test.ts`).
|
|
364
|
+
* Two observers would be two answers to one question, so there is one, and the
|
|
365
|
+
* daemon's module keeps only the thing a reader must never do — the append.
|
|
366
|
+
*/
|
|
367
|
+
/** How far back a sweep looks, absent an operator saying otherwise. */
|
|
368
|
+
export declare const DEFAULT_DARK_WINDOW_MS: number;
|
|
369
|
+
/** How often the sweep runs, absent an operator saying otherwise. */
|
|
370
|
+
export declare const DEFAULT_DARK_INTERVAL_MS: number;
|
|
371
|
+
/**
|
|
372
|
+
* The git identities whose commits are the runtime's own.
|
|
373
|
+
*
|
|
374
|
+
* Spelled here rather than imported from `daemon/git-evidence.ts`, which is
|
|
375
|
+
* where the daemon's commit identity is defined: core must not depend on the
|
|
376
|
+
* daemon. `tests/dark-session.test.ts` pins the two against each other so they
|
|
377
|
+
* cannot drift apart, the same device `APPROVALD_VERSION` uses for its own
|
|
378
|
+
* duplicate of the package version.
|
|
379
|
+
*/
|
|
380
|
+
export declare const DAEMON_EVIDENCE_EMAILS: readonly string[];
|
|
381
|
+
/** The opt-in, as the daemon carries it. */
|
|
382
|
+
export interface DarkSessionWatch {
|
|
383
|
+
/** How far back each sweep looks. */
|
|
384
|
+
windowMs: number;
|
|
385
|
+
/** How often a sweep runs. The tick interval is the floor. */
|
|
386
|
+
intervalMs: number;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Everything git could tell the sweep about a repository in one window.
|
|
390
|
+
*
|
|
391
|
+
* `protectedPaths` is the policy's `protected_paths`, and omitting it asks the
|
|
392
|
+
* merge question about the BUILT-IN guarded set only. That is the fail-closed
|
|
393
|
+
* direction for a caller that has no policy to hand: it narrows which merges
|
|
394
|
+
* are examined and never which evidence is required, and
|
|
395
|
+
* {@link reportDarkSessions} always passes the loaded list.
|
|
396
|
+
*/
|
|
397
|
+
export declare function observeGitActivity(root: string, from: string, to: string, protectedPaths?: readonly ProtectedPathEntry[]): GitActivity;
|
|
398
|
+
export interface DarkSessionSweepOptions {
|
|
399
|
+
logPath: string;
|
|
400
|
+
/** The checkout to observe. The daemon's own `cwd`; never an agent worktree. */
|
|
401
|
+
root: string;
|
|
402
|
+
/** Policy location, with `loadPolicy`'s semantics. */
|
|
403
|
+
policy: {
|
|
404
|
+
dir?: string;
|
|
405
|
+
file?: string;
|
|
406
|
+
};
|
|
407
|
+
schemaDir?: string;
|
|
408
|
+
/** The write-boundary clock (amended SPEC.md §8). */
|
|
409
|
+
clock?: Clock;
|
|
410
|
+
windowMs: number;
|
|
411
|
+
/** Verified records. The caller has already read them; nothing re-reads. */
|
|
412
|
+
records: readonly EventRecord[] | null;
|
|
413
|
+
logDetail?: string;
|
|
414
|
+
/**
|
|
415
|
+
* Test seam: an observer that answers without running git.
|
|
416
|
+
*
|
|
417
|
+
* It is offered the policy's protected paths as a fourth argument, which the
|
|
418
|
+
* real observer needs to know which merges to ask git about (APRV-374); a
|
|
419
|
+
* seam that ignores it answers exactly as it did before.
|
|
420
|
+
*/
|
|
421
|
+
observe?: (root: string, from: string, to: string, protectedPaths: readonly ProtectedPathEntry[]) => GitActivity;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Observe and judge, appending nothing.
|
|
425
|
+
*
|
|
426
|
+
* The read-only half, which is the half `approval doctor` calls: doctor reports
|
|
427
|
+
* and the daemon writes, so two processes never become two writers of one fact.
|
|
428
|
+
*/
|
|
429
|
+
export declare function reportDarkSessions(options: DarkSessionSweepOptions): {
|
|
430
|
+
report: DarkSessionReport;
|
|
431
|
+
window: DarkSessionWindow;
|
|
432
|
+
};
|