approval-md 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -877
- package/SPEC.md +150 -19
- package/cli.js +66 -7
- package/dist/src/adapters/smtp.d.ts +18 -0
- package/dist/src/adapters/smtp.js +24 -3
- package/dist/src/adapters/smtp.js.map +1 -1
- package/dist/src/channels/contract.d.ts +53 -1
- package/dist/src/channels/contract.js +304 -7
- package/dist/src/channels/contract.js.map +1 -1
- package/dist/src/channels/relay-server.d.ts +90 -0
- package/dist/src/channels/relay-server.js +295 -0
- package/dist/src/channels/relay-server.js.map +1 -0
- package/dist/src/channels/relay.d.ts +273 -0
- package/dist/src/channels/relay.js +564 -0
- package/dist/src/channels/relay.js.map +1 -0
- package/dist/src/channels/tagging.js +6 -1
- package/dist/src/channels/tagging.js.map +1 -1
- package/dist/src/channels/telegram-webhook.d.ts +273 -0
- package/dist/src/channels/telegram-webhook.js +536 -0
- package/dist/src/channels/telegram-webhook.js.map +1 -0
- package/dist/src/channels/telegram.d.ts +394 -12
- package/dist/src/channels/telegram.js +621 -68
- package/dist/src/channels/telegram.js.map +1 -1
- package/dist/src/channels/web.d.ts +9 -0
- package/dist/src/channels/web.js +17 -0
- package/dist/src/channels/web.js.map +1 -1
- package/dist/src/cli/amend.js +564 -34
- package/dist/src/cli/amend.js.map +1 -1
- package/dist/src/cli/attest.d.ts +9 -0
- package/dist/src/cli/attest.js +177 -13
- package/dist/src/cli/attest.js.map +1 -1
- package/dist/src/cli/channel-relay.d.ts +108 -0
- package/dist/src/cli/channel-relay.js +334 -0
- package/dist/src/cli/channel-relay.js.map +1 -0
- package/dist/src/cli/channel-telegram-webhook.d.ts +273 -0
- package/dist/src/cli/channel-telegram-webhook.js +709 -0
- package/dist/src/cli/channel-telegram-webhook.js.map +1 -0
- package/dist/src/cli/channel-telegram.d.ts +347 -28
- package/dist/src/cli/channel-telegram.js +763 -28
- package/dist/src/cli/channel-telegram.js.map +1 -1
- package/dist/src/cli/channel.d.ts +10 -1
- package/dist/src/cli/channel.js +14 -1
- package/dist/src/cli/channel.js.map +1 -1
- 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 +1 -1
- package/dist/src/cli/codex.js +304 -7
- package/dist/src/cli/codex.js.map +1 -1
- package/dist/src/cli/daemon.js +41 -6
- package/dist/src/cli/daemon.js.map +1 -1
- package/dist/src/cli/doctor.d.ts +63 -0
- package/dist/src/cli/doctor.js +1322 -122
- package/dist/src/cli/doctor.js.map +1 -1
- package/dist/src/cli/execute.d.ts +17 -1
- package/dist/src/cli/execute.js +366 -22
- package/dist/src/cli/execute.js.map +1 -1
- package/dist/src/cli/exit-codes.d.ts +12 -0
- package/dist/src/cli/exit-codes.js +13 -0
- package/dist/src/cli/exit-codes.js.map +1 -1
- package/dist/src/cli/gate.d.ts +2 -0
- package/dist/src/cli/gate.js +233 -2
- package/dist/src/cli/gate.js.map +1 -1
- package/dist/src/cli/help.d.ts +14 -2
- package/dist/src/cli/help.js +395 -82
- package/dist/src/cli/help.js.map +1 -1
- package/dist/src/cli/hook-codex.d.ts +49 -1
- package/dist/src/cli/hook-codex.js +60 -1
- package/dist/src/cli/hook-codex.js.map +1 -1
- package/dist/src/cli/hook.d.ts +828 -4
- package/dist/src/cli/hook.js +2972 -142
- package/dist/src/cli/hook.js.map +1 -1
- package/dist/src/cli/import.js +1 -1
- package/dist/src/cli/import.js.map +1 -1
- package/dist/src/cli/init.js +16 -7
- package/dist/src/cli/init.js.map +1 -1
- package/dist/src/cli/instructions.js +24 -3
- package/dist/src/cli/instructions.js.map +1 -1
- package/dist/src/cli/log-anchor.d.ts +55 -0
- package/dist/src/cli/log-anchor.js +199 -60
- package/dist/src/cli/log-anchor.js.map +1 -1
- package/dist/src/cli/main.d.ts +0 -12
- package/dist/src/cli/main.js +56 -3
- package/dist/src/cli/main.js.map +1 -1
- package/dist/src/cli/muse.d.ts +2 -0
- package/dist/src/cli/muse.js +62 -0
- package/dist/src/cli/muse.js.map +1 -0
- package/dist/src/cli/payload.js +79 -1
- package/dist/src/cli/payload.js.map +1 -1
- 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.js +14 -1
- package/dist/src/cli/policy.js.map +1 -1
- package/dist/src/cli/preflight.d.ts +151 -13
- package/dist/src/cli/preflight.js +398 -41
- package/dist/src/cli/preflight.js.map +1 -1
- package/dist/src/cli/sandbox.js +17 -1
- package/dist/src/cli/sandbox.js.map +1 -1
- package/dist/src/cli/scaffold.d.ts +1 -1
- package/dist/src/cli/scaffold.js +7 -1
- package/dist/src/cli/scaffold.js.map +1 -1
- package/dist/src/cli/serve.d.ts +53 -0
- package/dist/src/cli/serve.js +270 -0
- package/dist/src/cli/serve.js.map +1 -0
- package/dist/src/cli/setup-channel.d.ts +9 -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-common.d.ts +3 -1
- package/dist/src/cli/setup-common.js +3 -2
- package/dist/src/cli/setup-common.js.map +1 -1
- package/dist/src/cli/setup.d.ts +2 -0
- package/dist/src/cli/setup.js +94 -2
- package/dist/src/cli/setup.js.map +1 -1
- package/dist/src/cli/up.js +134 -51
- package/dist/src/cli/up.js.map +1 -1
- package/dist/src/cli/values.js +3 -4
- package/dist/src/cli/values.js.map +1 -1
- package/dist/src/cli/verb-registry.d.ts +2 -0
- package/dist/src/cli/verb-registry.js +510 -47
- package/dist/src/cli/verb-registry.js.map +1 -1
- package/dist/src/cli/wordmark.d.ts +2 -2
- 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/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/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/core/advance-cycle.d.ts +51 -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 +20 -18
- package/dist/src/core/agents-md.js +33 -31
- package/dist/src/core/agents-md.js.map +1 -1
- package/dist/src/core/attest-bootstrap.d.ts +95 -0
- package/dist/src/core/attest-bootstrap.js +135 -0
- package/dist/src/core/attest-bootstrap.js.map +1 -0
- package/dist/src/core/attest.d.ts +234 -2
- package/dist/src/core/attest.js +342 -7
- package/dist/src/core/attest.js.map +1 -1
- package/dist/src/core/audit.d.ts +73 -3
- package/dist/src/core/audit.js +65 -5
- package/dist/src/core/audit.js.map +1 -1
- package/dist/src/core/channel-lease.d.ts +322 -0
- package/dist/src/core/channel-lease.js +663 -0
- package/dist/src/core/channel-lease.js.map +1 -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/command-class.d.ts +205 -0
- package/dist/src/core/command-class.js +1433 -28
- 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/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/daemon-host.d.ts +178 -0
- package/dist/src/core/daemon-host.js +228 -0
- package/dist/src/core/daemon-host.js.map +1 -0
- package/dist/src/core/daemon-identity.d.ts +238 -0
- package/dist/src/core/daemon-identity.js +252 -0
- package/dist/src/core/daemon-identity.js.map +1 -0
- package/dist/src/core/dark-session.d.ts +109 -8
- 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 +23 -2
- 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 +5 -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 +15 -2
- package/dist/src/core/execute.js +15 -2
- package/dist/src/core/execute.js.map +1 -1
- package/dist/src/core/gate.d.ts +392 -6
- package/dist/src/core/gate.js +852 -24
- 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/harness-version.d.ts +128 -4
- package/dist/src/core/harness-version.js +181 -12
- package/dist/src/core/harness-version.js.map +1 -1
- package/dist/src/core/harness-wait.d.ts +82 -3
- package/dist/src/core/harness-wait.js +89 -3
- package/dist/src/core/harness-wait.js.map +1 -1
- package/dist/src/core/instance.d.ts +59 -2
- package/dist/src/core/instance.js +113 -0
- package/dist/src/core/instance.js.map +1 -1
- package/dist/src/core/log-subscribe.d.ts +21 -0
- package/dist/src/core/log-subscribe.js +16 -6
- package/dist/src/core/log-subscribe.js.map +1 -1
- package/dist/src/core/log-write-layer.d.ts +55 -0
- package/dist/src/core/log-write-layer.js +91 -0
- package/dist/src/core/log-write-layer.js.map +1 -0
- package/dist/src/core/log.d.ts +89 -22
- package/dist/src/core/log.js +197 -19
- package/dist/src/core/log.js.map +1 -1
- package/dist/src/core/payload-census.d.ts +51 -0
- package/dist/src/core/payload-census.js +125 -2
- package/dist/src/core/payload-census.js.map +1 -1
- package/dist/src/core/payload-store.d.ts +31 -0
- package/dist/src/core/payload-store.js +113 -8
- package/dist/src/core/payload-store.js.map +1 -1
- package/dist/src/core/payload.d.ts +18 -3
- package/dist/src/core/payload.js +20 -4
- package/dist/src/core/payload.js.map +1 -1
- package/dist/src/core/policy-diff.d.ts +10 -0
- package/dist/src/core/policy-diff.js +10 -2
- package/dist/src/core/policy-diff.js.map +1 -1
- package/dist/src/core/policy-explain.d.ts +17 -1
- package/dist/src/core/policy-explain.js +48 -1
- package/dist/src/core/policy-explain.js.map +1 -1
- package/dist/src/core/policy-load.d.ts +65 -1
- package/dist/src/core/policy-load.js +21 -3
- package/dist/src/core/policy-load.js.map +1 -1
- package/dist/src/core/policy-match.d.ts +81 -0
- package/dist/src/core/policy-match.js +87 -0
- package/dist/src/core/policy-match.js.map +1 -1
- package/dist/src/core/policy-proposal.d.ts +75 -0
- package/dist/src/core/policy-proposal.js +110 -4
- package/dist/src/core/policy-proposal.js.map +1 -1
- package/dist/src/core/protected-path-guard.d.ts +117 -4
- package/dist/src/core/protected-path-guard.js +362 -48
- 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 +182 -0
- package/dist/src/core/read-scope.js +256 -0
- package/dist/src/core/read-scope.js.map +1 -0
- package/dist/src/core/run-payload.d.ts +160 -0
- package/dist/src/core/run-payload.js +304 -0
- package/dist/src/core/run-payload.js.map +1 -0
- package/dist/src/core/sandbox.d.ts +81 -0
- package/dist/src/core/sandbox.js +190 -1
- package/dist/src/core/sandbox.js.map +1 -1
- package/dist/src/core/sender-identity.d.ts +501 -0
- package/dist/src/core/sender-identity.js +609 -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 +52 -1
- package/dist/src/core/state.js +52 -6
- package/dist/src/core/state.js.map +1 -1
- package/dist/src/core/telegram-config.d.ts +79 -0
- package/dist/src/core/telegram-config.js +108 -0
- package/dist/src/core/telegram-config.js.map +1 -1
- package/dist/src/core/values.d.ts +18 -8
- package/dist/src/core/values.js +36 -1
- package/dist/src/core/values.js.map +1 -1
- package/dist/src/core/verify.d.ts +23 -1
- package/dist/src/core/verify.js +20 -2
- package/dist/src/core/verify.js.map +1 -1
- package/dist/src/daemon/advance.d.ts +10 -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 +80 -5
- package/dist/src/daemon/audit.js +126 -6
- package/dist/src/daemon/audit.js.map +1 -1
- package/dist/src/daemon/daemon.d.ts +174 -2
- package/dist/src/daemon/daemon.js +307 -7
- package/dist/src/daemon/daemon.js.map +1 -1
- package/dist/src/daemon/git-evidence.d.ts +2 -2
- package/dist/src/daemon/git-evidence.js +1 -1
- package/dist/src/daemon/projection.d.ts +13 -2
- package/dist/src/daemon/projection.js +39 -6
- package/dist/src/daemon/projection.js.map +1 -1
- package/dist/src/mcp/server.d.ts +39 -3
- package/dist/src/mcp/server.js +30 -3
- package/dist/src/mcp/server.js.map +1 -1
- package/dist/src/muse/server.d.ts +16 -0
- package/dist/src/muse/server.js +238 -0
- package/dist/src/muse/server.js.map +1 -0
- package/dist/src/serve/archive.d.ts +158 -0
- package/dist/src/serve/archive.js +354 -0
- package/dist/src/serve/archive.js.map +1 -0
- package/dist/src/serve/arguments.d.ts +93 -0
- package/dist/src/serve/arguments.js +228 -0
- package/dist/src/serve/arguments.js.map +1 -0
- package/dist/src/serve/credentials.d.ts +91 -0
- package/dist/src/serve/credentials.js +143 -0
- package/dist/src/serve/credentials.js.map +1 -0
- package/dist/src/serve/follow.d.ts +86 -0
- package/dist/src/serve/follow.js +101 -0
- package/dist/src/serve/follow.js.map +1 -0
- package/dist/src/serve/hook-thread.d.ts +134 -0
- package/dist/src/serve/hook-thread.js +333 -0
- package/dist/src/serve/hook-thread.js.map +1 -0
- package/dist/src/serve/hook-worker.d.ts +134 -0
- package/dist/src/serve/hook-worker.js +173 -0
- package/dist/src/serve/hook-worker.js.map +1 -0
- package/dist/src/serve/server.d.ts +412 -0
- package/dist/src/serve/server.js +1251 -0
- package/dist/src/serve/server.js.map +1 -0
- package/docs/README-extended.md +766 -0
- package/docs/cli-reference.md +2563 -73
- package/docs/codex-enforced-session.md +75 -2
- package/docs/codex-workspace-broker.md +118 -0
- package/package.json +6 -2
- package/schema/event.schema.json +595 -9
- 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/daemon-id-malformed.json +15 -0
- package/schema/fixtures/event/invalid/execution-started-truncated-policy-sha256.json +18 -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/invalid/harness-cap-at-margin.json +16 -0
- package/schema/fixtures/event/invalid/harness-cap-fractional.json +16 -0
- package/schema/fixtures/event/invalid/harness-cap-negative.json +16 -0
- package/schema/fixtures/event/invalid/harness-cap-string.json +16 -0
- package/schema/fixtures/event/invalid/harness-cap-without-harness-execution.json +16 -0
- package/schema/fixtures/event/invalid/harness-cap-zero.json +16 -0
- package/schema/fixtures/event/valid/approval-granted-sender-hashed.json +20 -0
- package/schema/fixtures/event/valid/approval-requested-harness-cap.json +18 -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/daemon-identity-declared.json +17 -0
- package/schema/fixtures/event/valid/daemon-identity.json +15 -0
- package/schema/fixtures/event/valid/execution-started-policy-sha256.json +18 -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-hermes.json +23 -0
- package/schema/fixtures/event/valid/harness-kind-muse.json +23 -0
- package/schema/fixtures/policy/invalid/daemons-malformed-id.json +10 -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/daemons-allowlist.json +19 -0
- package/schema/fixtures/policy/valid/senders-keyed.json +24 -0
- package/schema/fixtures/policy-md/invalid/schema-invalid-agent-may-request.md +21 -0
- package/schema/fixtures/policy-md/valid/agent-may-request.md +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 +100 -4
- package/schema/values.schema.json +7 -11
- package/schema/fixtures/values/invalid/version-string.json +0 -1
|
@@ -32,6 +32,20 @@
|
|
|
32
32
|
* Self-reported text is never read. The hook passes the command only; the
|
|
33
33
|
* harness's `description` field is authored by the very agent being gated
|
|
34
34
|
* (SPEC.md §11.1: self-reported fields never reduce scrutiny).
|
|
35
|
+
*
|
|
36
|
+
* Two imports, and both are pure in exactly the same way this file is: no disk,
|
|
37
|
+
* no clock, no environment, no dependencies.
|
|
38
|
+
*
|
|
39
|
+
* `core/read-scope.ts` (APRV-347) holds the read-side path arithmetic, so the
|
|
40
|
+
* hook and the policy explainer can ask the same questions this file asks, of
|
|
41
|
+
* the same table, rather than each growing a copy of it.
|
|
42
|
+
*
|
|
43
|
+
* `core/policy-match.ts` (APRV-354) is imported for ONE name, the
|
|
44
|
+
* `harness.launch.` prefix. The classifier emits the family and two enforcement
|
|
45
|
+
* paths refuse a member of it that no policy rule names, so the three have to
|
|
46
|
+
* agree on what the family is; a second spelling of the prefix would close one
|
|
47
|
+
* of those doors and leave the other open. The import is type-safe in the
|
|
48
|
+
* dependency sense as well: `policy-match.ts` itself imports only types.
|
|
35
49
|
*/
|
|
36
50
|
/** Why a command could not be classified. Each denies; none is a soft failure. */
|
|
37
51
|
export type ClassifierFailureCode = "unclassified" | "opaque" | "unparseable";
|
|
@@ -122,6 +136,14 @@ export declare const GATE_SELF_CLASS = "gate.self";
|
|
|
122
136
|
* a policy can sensibly sample.
|
|
123
137
|
*/
|
|
124
138
|
export type ProtectedPathClass = "log.mutate" | "policy.core" | "policy.edit";
|
|
139
|
+
/**
|
|
140
|
+
* The class a write under `$HERMES_HOME/scripts/` takes (APRV-445): scheduling
|
|
141
|
+
* code that Hermes's cron runs later with no hook in front of it. Returned by
|
|
142
|
+
* {@link protectedPathClass} beside the organs, ranked with `policy.edit`, and
|
|
143
|
+
* deliberately not a {@link ProtectedPathClass}: it is a side effect an
|
|
144
|
+
* operator prices, not a surface of the gate itself.
|
|
145
|
+
*/
|
|
146
|
+
export declare const HERMES_SCHEDULED_SCRIPT_CLASS = "cron.manage";
|
|
125
147
|
/**
|
|
126
148
|
* The `policy.edit` sub-class namespace a `protected_paths` entry may route to
|
|
127
149
|
* (APRV-266).
|
|
@@ -317,6 +339,16 @@ export declare function normalizePathSpelling(candidate: string): string;
|
|
|
317
339
|
* refuses to honor.
|
|
318
340
|
*/
|
|
319
341
|
export declare function isGateOrganPath(candidate: string): boolean;
|
|
342
|
+
/**
|
|
343
|
+
* Files under the approval home that hold credential material.
|
|
344
|
+
*
|
|
345
|
+
* Named by their position under `.approval/`, so this is the same pure segment
|
|
346
|
+
* matching every other rule in this file uses: `vault*` (the sealed store and
|
|
347
|
+
* anything beside it), `keys/` (the subtree), and `env` (plus `env.local` and
|
|
348
|
+
* kin), which is the environment map holding the Telegram token, the vault
|
|
349
|
+
* passphrase and the sampling secret.
|
|
350
|
+
*/
|
|
351
|
+
export declare function isCredentialPath(candidate: string): boolean;
|
|
320
352
|
/**
|
|
321
353
|
* Environment variables whose NAME says they carry a secret.
|
|
322
354
|
*
|
|
@@ -352,6 +384,26 @@ export declare const NON_SECRET_ENV_NAMES: readonly string[];
|
|
|
352
384
|
* environment rather than of command text, and it must ask it the same way.
|
|
353
385
|
*/
|
|
354
386
|
export declare function isSecretEnvName(name: string): boolean;
|
|
387
|
+
interface LexWord {
|
|
388
|
+
/** Literal text, quotes removed and backslash escapes applied. */
|
|
389
|
+
text: string;
|
|
390
|
+
/** True when any part of the word was quoted. */
|
|
391
|
+
quoted: boolean;
|
|
392
|
+
/** Inner text of each `$(…)` in this word, for recursive classification. */
|
|
393
|
+
substitutions: string[];
|
|
394
|
+
}
|
|
395
|
+
interface LexRedirect {
|
|
396
|
+
/** `>` and `>>` write; `<` reads. */
|
|
397
|
+
op: ">" | ">>" | "<";
|
|
398
|
+
target: LexWord;
|
|
399
|
+
}
|
|
400
|
+
interface LexSegment {
|
|
401
|
+
text: string;
|
|
402
|
+
words: LexWord[];
|
|
403
|
+
redirects: LexRedirect[];
|
|
404
|
+
/** Set when the segment contains a construct whose effect cannot be read. */
|
|
405
|
+
opaque: string | null;
|
|
406
|
+
}
|
|
355
407
|
/**
|
|
356
408
|
* Facts about the machine the command will run on, resolved by the CALLER
|
|
357
409
|
* (APRV-267).
|
|
@@ -381,6 +433,38 @@ export interface ClassifierContext {
|
|
|
381
433
|
* own: a path under a root still has to survive that second pass.
|
|
382
434
|
*/
|
|
383
435
|
scratchRoots?: readonly string[];
|
|
436
|
+
/**
|
|
437
|
+
* Roots a read may stay inside: the gate root, the session scratchpad and the
|
|
438
|
+
* system temp root, plus whatever `read_scope.roots` added (APRV-347).
|
|
439
|
+
*
|
|
440
|
+
* The polarity is the OPPOSITE of `scratchRoots`, and the difference is worth
|
|
441
|
+
* stating. A scratch root LOOSENS a delete, so forgetting the field is safe
|
|
442
|
+
* by construction. A read root NARROWS a read, so forgetting the field would
|
|
443
|
+
* be safe in a different way — it leaves every read `read.shell`, exactly as
|
|
444
|
+
* this classifier answered before the field existed. An EMPTY array means the
|
|
445
|
+
* same thing as absent, and deliberately: read against no roots at all would
|
|
446
|
+
* make every read in the session a decision, which is a fail-closed answer
|
|
447
|
+
* nobody asked for and the one spelling a caller reaches by accident. A
|
|
448
|
+
* caller that means to scope reads passes roots.
|
|
449
|
+
*
|
|
450
|
+
* As with `scratchRoots`, this file only compares segments. The relative
|
|
451
|
+
* paths, the symlinks and the working directory are the hook's second pass,
|
|
452
|
+
* which can only ever tighten the answer reached here.
|
|
453
|
+
*/
|
|
454
|
+
readRoots?: readonly string[];
|
|
455
|
+
/**
|
|
456
|
+
* May a login-shell wrapper be classified by the script it runs (APRV-380)?
|
|
457
|
+
*
|
|
458
|
+
* `true` by default, and `false` for exactly one caller: the classifier
|
|
459
|
+
* itself, recursing into an unwrapped script. That is what keeps the unwrap
|
|
460
|
+
* ONE LEVEL deep — a shell nested inside the script is the shape the
|
|
461
|
+
* {@link OPAQUE_BINS} position still covers, and it stays opaque.
|
|
462
|
+
*
|
|
463
|
+
* A caller that passes `false` gets the pre-APRV-380 answer, which is the
|
|
464
|
+
* strictly stricter one: every wrapper refuses. As with every other field
|
|
465
|
+
* here, forgetting it cannot loosen anything.
|
|
466
|
+
*/
|
|
467
|
+
unwrapShell?: boolean;
|
|
384
468
|
}
|
|
385
469
|
/** Everything a refinement needs: the binary and the words that followed it. */
|
|
386
470
|
interface RuleContext {
|
|
@@ -413,6 +497,7 @@ interface RuleContext {
|
|
|
413
497
|
type Refinement = {
|
|
414
498
|
class: string;
|
|
415
499
|
rule: string;
|
|
500
|
+
path?: string;
|
|
416
501
|
} | {
|
|
417
502
|
opaque: string;
|
|
418
503
|
};
|
|
@@ -434,7 +519,32 @@ export interface CommandRule {
|
|
|
434
519
|
emits?: readonly string[];
|
|
435
520
|
/** Flag-sensitive answer; falls back to `class` when it returns `null`. */
|
|
436
521
|
refine?: (ctx: RuleContext) => Refinement | null;
|
|
522
|
+
/**
|
|
523
|
+
* Match only an argv that is nothing but version or help flags (APRV-397).
|
|
524
|
+
*
|
|
525
|
+
* The row a binary needs when the thing being classified is the ABSENCE of a
|
|
526
|
+
* subcommand: `npm --version` carries no positional, so `subs` can never
|
|
527
|
+
* match it, and a row with no `subs` at all would have matched every
|
|
528
|
+
* subcommand this table does not name and turned a wall of `unclassified`
|
|
529
|
+
* denials into whatever class that row declared. A `probe` row matches the
|
|
530
|
+
* probe shape and nothing else, so everything it does not match keeps the
|
|
531
|
+
* answer it has today.
|
|
532
|
+
*/
|
|
533
|
+
probe?: boolean;
|
|
437
534
|
}
|
|
535
|
+
/**
|
|
536
|
+
* The suffix that marks a Muse model as training on what it is shown.
|
|
537
|
+
*
|
|
538
|
+
* Exported since APRV-350 so the hook adapter's contributor guard and this
|
|
539
|
+
* classifier's `harness.launch.muse` refinement test the SAME mark. Two
|
|
540
|
+
* spellings of "which models are unsafe" would drift, and the direction they
|
|
541
|
+
* drift in is the one where a launch is refused and a tool call is not.
|
|
542
|
+
*/
|
|
543
|
+
export declare const CONTRIBUTOR_SUFFIX = "-contributor";
|
|
544
|
+
/** The rule id for a read whose ABSOLUTE target sits outside every root. */
|
|
545
|
+
export declare const READ_OUT_OF_SCOPE_RULE = "read-out-of-scope";
|
|
546
|
+
/** The rule id for a read target whose expansion the text cannot show. */
|
|
547
|
+
export declare const READ_UNREADABLE_TARGET_RULE = "read-unreadable-path";
|
|
438
548
|
/**
|
|
439
549
|
* The table.
|
|
440
550
|
*
|
|
@@ -446,6 +556,42 @@ export interface CommandRule {
|
|
|
446
556
|
* move the log file, introduced by SPEC §10.1's APRV-125 amendment.
|
|
447
557
|
*/
|
|
448
558
|
export declare const COMMAND_RULES: readonly CommandRule[];
|
|
559
|
+
/**
|
|
560
|
+
* The script a LOGIN-SHELL WRAPPER runs, when the segment is exactly one
|
|
561
|
+
* (APRV-380), or `null`.
|
|
562
|
+
*
|
|
563
|
+
* ## Why this is not the second parser the table above refuses
|
|
564
|
+
*
|
|
565
|
+
* {@link OPAQUE_BINS} states the position this narrows: a second parser for the
|
|
566
|
+
* same text is a second answer waiting to disagree with the shell's. The hazard
|
|
567
|
+
* that names is reading shell text a SECOND WAY. This is not that. When the
|
|
568
|
+
* argv is exactly `[shell, -lc, script]` and nothing else, the script is the
|
|
569
|
+
* text a Claude Code `Bash` call hands this classifier directly, and what
|
|
570
|
+
* happens to it here is what happens to that: the same lexer, the same segment
|
|
571
|
+
* rules, the same table. No new parser is written, and the text is not read a
|
|
572
|
+
* second way — it is read the first way, by the only reader there is.
|
|
573
|
+
*
|
|
574
|
+
* ## The line, and it is exact
|
|
575
|
+
*
|
|
576
|
+
* Three words, no more: a known shell, one inline-script flag, one script. Any
|
|
577
|
+
* of these keeps the wrapper opaque, because each is a shape whose effect
|
|
578
|
+
* depends on something the argv alone does not say:
|
|
579
|
+
*
|
|
580
|
+
* - extra words (a script FILE, `--`, an option this rule does not model);
|
|
581
|
+
* - an assignment prefix, which changes the environment the script runs in;
|
|
582
|
+
* - a redirection on the wrapper, which is the outer shell's and not the
|
|
583
|
+
* script's;
|
|
584
|
+
* - a substitution in any of the three words, whose effect happens before the
|
|
585
|
+
* shell even starts;
|
|
586
|
+
* - a nested shell inside the script, refused by {@link ClassifierContext} when
|
|
587
|
+
* the recursion runs (the inner classification unwraps nothing).
|
|
588
|
+
*
|
|
589
|
+
* The BINDING does not move. `cli/hook.ts` binds the outer command and argv
|
|
590
|
+
* exactly as APRV-362 built them; what this changes is only which text is
|
|
591
|
+
* classified, and the classes are additional evidence about bytes that are
|
|
592
|
+
* bound elsewhere and unchanged.
|
|
593
|
+
*/
|
|
594
|
+
export declare function loginShellScript(segment: LexSegment): string | null;
|
|
449
595
|
/**
|
|
450
596
|
* The rules whose commands RUN CODE THIS RUNTIME DID NOT AUTHOR (APRV-193).
|
|
451
597
|
*
|
|
@@ -473,6 +619,39 @@ export declare const CODE_EXECUTING_RULES: readonly string[];
|
|
|
473
619
|
* it WITH the policy in hand — {@link emittableClass} is that question.
|
|
474
620
|
*/
|
|
475
621
|
export declare const CLASSIFIER_CLASSES: readonly string[];
|
|
622
|
+
/**
|
|
623
|
+
* The class the DAEMON's own cadence advance is gated as (APRV-382).
|
|
624
|
+
*
|
|
625
|
+
* The sub-class exists because the policy grammar has no actor condition and
|
|
626
|
+
* this repository wanted one: an advance publishes records the log already
|
|
627
|
+
* holds, so the daemon may make it unattended, while the same act from a
|
|
628
|
+
* session in a worktree or a human terminal stays supervised. Two classes are
|
|
629
|
+
* how that is written down, and which of them a cycle asks under is decided by
|
|
630
|
+
* `core/advance-cycle.ts` from the running process, never from an argument.
|
|
631
|
+
*
|
|
632
|
+
* NO COMMAND SPELLS IT, on purpose. `approval log advance` classifies
|
|
633
|
+
* `log.advance` whoever types it, so the looser line is unreachable from a
|
|
634
|
+
* shell an agent can drive: it is reached only from inside the daemon process,
|
|
635
|
+
* which an agent cannot become without a `gate.self` command this policy holds
|
|
636
|
+
* at the manual default.
|
|
637
|
+
*/
|
|
638
|
+
export declare const ADVANCE_DAEMON_CLASS = "log.advance.daemon";
|
|
639
|
+
/**
|
|
640
|
+
* Classes this RUNTIME emits for its own gated actions, which no command spells.
|
|
641
|
+
*
|
|
642
|
+
* Separate from {@link CLASSIFIER_CLASSES}, which is the binary table's own set
|
|
643
|
+
* and is what `docs/claude-code-hook.md` documents row by row. A class here is
|
|
644
|
+
* emitted by a runtime cycle that registers and requests it directly — the
|
|
645
|
+
* daemon's advance is the first — so a policy declaring it is declaring a line
|
|
646
|
+
* that CAN fire, and the reachability check `core/policy-expectations.ts` runs
|
|
647
|
+
* at the amendment ceremony must say so. Without this list that ceremony would
|
|
648
|
+
* refuse the line `unreachable`, which is a true statement about the command
|
|
649
|
+
* classifier and a false one about the runtime.
|
|
650
|
+
*
|
|
651
|
+
* Adding a name here is a claim that some path in this codebase asks the gate
|
|
652
|
+
* for that class, and widening it is a reviewable diff.
|
|
653
|
+
*/
|
|
654
|
+
export declare const RUNTIME_CLASSES: readonly string[];
|
|
476
655
|
/**
|
|
477
656
|
* Can the classifier emit `actionClass` for a project whose policy carries
|
|
478
657
|
* these `protected_paths`? (APRV-266.)
|
|
@@ -488,6 +667,11 @@ export declare const CLASSIFIER_CLASSES: readonly string[];
|
|
|
488
667
|
* A routed name is reachable exactly when some entry routes to it. A
|
|
489
668
|
* `policy.edit.spec` rule in a policy whose `protected_paths` routes nothing to
|
|
490
669
|
* it is a line that will never fire, and saying so is the whole point.
|
|
670
|
+
*
|
|
671
|
+
* {@link RUNTIME_CLASSES} is the third answer (APRV-382): a class no command
|
|
672
|
+
* spells and a runtime cycle asks for directly is reachable in every project,
|
|
673
|
+
* with no policy entry needed, because the path that emits it is in this
|
|
674
|
+
* codebase rather than in the operator's file.
|
|
491
675
|
*/
|
|
492
676
|
export declare function emittableClass(actionClass: string, protectedPaths?: readonly ProtectedPathEntry[]): boolean;
|
|
493
677
|
/**
|
|
@@ -539,5 +723,26 @@ export interface CommandSegmentWords {
|
|
|
539
723
|
* `classifyCommand` answers `unparseable` for. Segments carrying no binary (a
|
|
540
724
|
* bare assignment, a lone redirection) are omitted: they have no verb to show.
|
|
541
725
|
*/
|
|
726
|
+
/**
|
|
727
|
+
* The paths each segment WRITES through a redirection, from the same parse
|
|
728
|
+
* (APRV-445). `<` is a read and is left out, as are the discard devices.
|
|
729
|
+
* `null` when the tokenizer refuses the string.
|
|
730
|
+
*/
|
|
731
|
+
export declare function commandSegmentWriteTargets(command: string): string[][] | null;
|
|
732
|
+
/**
|
|
733
|
+
* Every segment of `command` with its binary (or `null`), its arguments and the
|
|
734
|
+
* paths it writes through a redirection, from ONE lex of the whole command
|
|
735
|
+
* (APRV-445 recheck). Lexing a segment's text on its own fails for a heredoc,
|
|
736
|
+
* whose body lives outside the segment's text; this keeps the body attached.
|
|
737
|
+
*/
|
|
738
|
+
export interface CommandSegmentShape {
|
|
739
|
+
text: string;
|
|
740
|
+
bin: string | null;
|
|
741
|
+
args: string[];
|
|
742
|
+
writes: string[];
|
|
743
|
+
/** Paths read through `<` (APRV-445 recheck 3, SF3c). */
|
|
744
|
+
reads: string[];
|
|
745
|
+
}
|
|
746
|
+
export declare function commandSegmentShapes(command: string): CommandSegmentShape[] | null;
|
|
542
747
|
export declare function commandSegmentWords(command: string): CommandSegmentWords[] | null;
|
|
543
748
|
export {};
|