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,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The strict Codex broker server (APRV-325.2): one tool, and nothing else.
|
|
3
|
+
*
|
|
4
|
+
* This is deliberately NOT `src/mcp/server.ts` with a flag. That server
|
|
5
|
+
* publishes the whole agent verb catalog — `run` spawns argv on the host,
|
|
6
|
+
* `adapter <name>` spends vault credentials, `journal write` writes a local
|
|
7
|
+
* file — and its tool list is derived from the verb registry, so a verb added
|
|
8
|
+
* tomorrow appears on it. A constrained Codex session is the case where that
|
|
9
|
+
* derivation is exactly wrong: the session must reach ONE door, the door must
|
|
10
|
+
* be the same door next month, and the way to guarantee that is a server whose
|
|
11
|
+
* catalog is a literal of length one.
|
|
12
|
+
*
|
|
13
|
+
* Everything else follows from the same reasoning:
|
|
14
|
+
*
|
|
15
|
+
* - **The catalog is a literal.** {@link BROKER_TOOLS} is checked at CALL time
|
|
16
|
+
* as well as at list time, so a client that crafted the name itself is
|
|
17
|
+
* refused by the same check that filtered the list (the defence in depth
|
|
18
|
+
* `mcp-guest-restricted` keeps on the broad server).
|
|
19
|
+
* - **The input schema has no authority in it.** `operations` and
|
|
20
|
+
* `expected_policy_sha256`, `additionalProperties: false`, and the broker
|
|
21
|
+
* refuses an unknown key a second time. There is no `--as`, no path, no
|
|
22
|
+
* class, no token and no sandbox flag to remove, because none was ever
|
|
23
|
+
* published.
|
|
24
|
+
* - **Identity and every path come from the manifest**, which lives under a
|
|
25
|
+
* root-owned install root. The operator who installed it chose them; this
|
|
26
|
+
* process cannot be argued into different ones.
|
|
27
|
+
* - **A refusal is a RESULT, not a JSON-RPC error**, for the reason the broad
|
|
28
|
+
* server gives: the call was well formed and the runtime's answer was no,
|
|
29
|
+
* which the caller has to be able to read as data and branch on.
|
|
30
|
+
*/
|
|
31
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
32
|
+
import { CallToolRequestSchema, ErrorCode, ListToolsRequestSchema, McpError, } from "@modelcontextprotocol/sdk/types.js";
|
|
33
|
+
import { SPEC_VERSION } from "../core/version.js";
|
|
34
|
+
import { applyWorkspaceChange, BROKER_TOOLS, } from "./broker.js";
|
|
35
|
+
export const BROKER_TOOL_NAME = "codex_workspace_apply";
|
|
36
|
+
/** The whole published contract of this server. */
|
|
37
|
+
export const BROKER_TOOL = {
|
|
38
|
+
name: BROKER_TOOL_NAME,
|
|
39
|
+
title: "apply a bounded workspace change through the approval gate",
|
|
40
|
+
description: "Apply a bounded, typed change to the canonical workspace through approval.md's gate. Every operation is create, replace, delete or move on a relative path inside the workspace; `replace`, `delete` and `move` state the SHA-256 of the bytes they expect to find and are refused if the workspace has moved on. `expected_policy_sha256` is the digest of the policy you read, and a proposal built against a different one is refused rather than silently re-evaluated. The acting identity, the workspace root, the policy, the log and every class are the installation's and cannot be named here. A class the policy resolves to a human decision is refused with `approval-required` and the action keys a person must grant; ask again once they have. Nothing partially applies: either the whole proposal took, or it did not, or the answer is honestly unknown and a person owns it.",
|
|
41
|
+
inputSchema: {
|
|
42
|
+
type: "object",
|
|
43
|
+
additionalProperties: false,
|
|
44
|
+
required: ["operations", "expected_policy_sha256"],
|
|
45
|
+
properties: {
|
|
46
|
+
operations: {
|
|
47
|
+
type: "array",
|
|
48
|
+
minItems: 1,
|
|
49
|
+
maxItems: 64,
|
|
50
|
+
description: "The bounded closed change language. `{kind:\"create\", path, after_base64}`, `{kind:\"replace\", path, expected_before_sha256, after_base64}`, `{kind:\"delete\", path, expected_before_sha256}`, `{kind:\"move\", from, to, expected_before_sha256}`. Paths are relative NFC POSIX paths inside the workspace; images are canonical base64, at most 1 MiB each and 8 MiB combined.",
|
|
51
|
+
items: { type: "object" },
|
|
52
|
+
},
|
|
53
|
+
expected_policy_sha256: {
|
|
54
|
+
type: "string",
|
|
55
|
+
pattern: "^[0-9a-f]{64}$",
|
|
56
|
+
description: "SHA-256 of the exact APPROVAL.md bytes this proposal was built against. A mismatch refuses `attestation-drift`.",
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
export const BROKER_INSTRUCTIONS = "This server is the ONLY way a change reaches the canonical workspace in this session. It publishes exactly one tool, `codex_workspace_apply`, and no other name is callable whether or not something advertised it. You cannot name the acting identity, the workspace root, the policy file, the log, an action class, a reversibility, a grant token or a sandbox posture: all of those belong to the installation an operator owns, and a call that mentions one is refused rather than quietly overridden. Read the policy, hash its exact bytes, and send that digest as `expected_policy_sha256`; if it has changed since, you are told so instead of being evaluated against something you did not read. Every proposal is all-or-nothing: the operations are staged, journaled and applied under a workspace lock, and the outcome you are given is what reading the workspace back proved, not what this process believes it did. When the policy sends a class to a human, the refusal names the action keys awaiting a decision; call again with the same bytes once they have decided, and the same call will apply. Shell, network and credentials are not here and are not coming: this door is for workspace changes.";
|
|
62
|
+
/**
|
|
63
|
+
* Build the strict server. Nothing is connected until `Server.connect`.
|
|
64
|
+
*
|
|
65
|
+
* `tokens` is omitted from what a caller of this constructor may forward for
|
|
66
|
+
* the same reason `--as` is absent from the published schema: a raw grant token
|
|
67
|
+
* is spend material, and a server process holding one for every class would be
|
|
68
|
+
* a server that executes a human's decision without the human. The manual path
|
|
69
|
+
* works through sealed delivery instead — the human grants, the token is sealed
|
|
70
|
+
* to the key the request minted, and `core/execute.ts` opens it at the start.
|
|
71
|
+
*/
|
|
72
|
+
export function createCodexBrokerServer(options) {
|
|
73
|
+
const server = new Server({ name: "approval-md-codex-broker", version: SPEC_VERSION }, { capabilities: { tools: {} }, instructions: BROKER_INSTRUCTIONS });
|
|
74
|
+
server.setRequestHandler(ListToolsRequestSchema, () => ({ tools: [BROKER_TOOL] }));
|
|
75
|
+
server.setRequestHandler(CallToolRequestSchema, (request) => {
|
|
76
|
+
const name = request.params.name;
|
|
77
|
+
if (!BROKER_TOOLS.has(name)) {
|
|
78
|
+
throw new McpError(ErrorCode.InvalidParams, `unknown tool ${JSON.stringify(name)}: this server publishes exactly ${[...BROKER_TOOLS].join(", ")}. Shell, network, credential and gate-authority verbs are not withheld here, they are absent`);
|
|
79
|
+
}
|
|
80
|
+
const result = applyWorkspaceChange(name, options.installation, request.params.arguments, options.broker ?? {});
|
|
81
|
+
const payload = result.ok
|
|
82
|
+
? { ...result }
|
|
83
|
+
: { error: { code: result.code, message: result.message, ...(result.detail === undefined ? {} : { detail: result.detail }), ...(result.pending === undefined ? {} : { pending: result.pending }), ...(result.state === undefined ? {} : { state: result.state }) } };
|
|
84
|
+
return {
|
|
85
|
+
content: [{ type: "text", text: JSON.stringify(payload) }],
|
|
86
|
+
structuredContent: payload,
|
|
87
|
+
...(result.ok ? {} : { isError: true }),
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
return server;
|
|
91
|
+
}
|
|
92
|
+
/** Build the strict server and connect it. Resolves once connected. */
|
|
93
|
+
export async function serveCodexBroker(options, transport) {
|
|
94
|
+
const server = createCodexBrokerServer(options);
|
|
95
|
+
await server.connect(transport);
|
|
96
|
+
return server;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=serve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../../../src/codex/serve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE,OAAO,EACL,qBAAqB,EACrB,SAAS,EACT,sBAAsB,EACtB,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AAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1D,iBAAiB,EAAE,OAAO;YAC1B,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;SACxC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,uEAAuE;AACvE,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAA4B,EAC5B,SAAoB;IAEpB,MAAM,MAAM,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAChD,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type CodexInstanceManifest } from "./manifest.js";
|
|
2
|
+
export declare const CODEX_BUNDLE_VERSION = 1;
|
|
3
|
+
export declare const CODEX_BUNDLE_FILES: readonly ["codex-instance.json", "requirements.toml", "managed_config.toml", "approval-codex-mcp", "approval-codex-start", "com.approval.codex-broker.plist", "com.approval.codex-runner.plist", "INSTALL.md"];
|
|
4
|
+
export interface PrepareInput {
|
|
5
|
+
instanceId: string;
|
|
6
|
+
workspace: string;
|
|
7
|
+
primary: string;
|
|
8
|
+
installRoot: string;
|
|
9
|
+
output: string;
|
|
10
|
+
codexExecutable: string;
|
|
11
|
+
nodeExecutable: string;
|
|
12
|
+
}
|
|
13
|
+
export type PrepareResult = {
|
|
14
|
+
ok: true;
|
|
15
|
+
output: string;
|
|
16
|
+
manifest: CodexInstanceManifest;
|
|
17
|
+
files: string[];
|
|
18
|
+
} | {
|
|
19
|
+
ok: false;
|
|
20
|
+
code: string;
|
|
21
|
+
message: string;
|
|
22
|
+
};
|
|
23
|
+
export interface BundleIndex {
|
|
24
|
+
version: 1;
|
|
25
|
+
files: Record<string, string>;
|
|
26
|
+
}
|
|
27
|
+
export declare function manifestFor(input: PrepareInput): CodexInstanceManifest;
|
|
28
|
+
export declare function requirementsToml(manifest: CodexInstanceManifest): string;
|
|
29
|
+
export declare function managedConfigToml(manifest: CodexInstanceManifest): string;
|
|
30
|
+
export declare function renderBundle(manifest: CodexInstanceManifest): Record<string, string>;
|
|
31
|
+
export declare function prepareBundle(input: PrepareInput): PrepareResult;
|
|
32
|
+
export type BundleCheck = {
|
|
33
|
+
ok: true;
|
|
34
|
+
manifest: CodexInstanceManifest;
|
|
35
|
+
files: string[];
|
|
36
|
+
} | {
|
|
37
|
+
ok: false;
|
|
38
|
+
code: string;
|
|
39
|
+
message: string;
|
|
40
|
+
};
|
|
41
|
+
export declare function checkBundle(directory: string): BundleCheck;
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { mkdirSync, lstatSync, readFileSync, realpathSync, readdirSync, writeFileSync, } from "node:fs";
|
|
3
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { CODEX_INSTANCE_SCHEMA_VERSION, SUPPORTED_CODEX_PLATFORM, SUPPORTED_CODEX_VERSION, checkCodexInstance, } from "./manifest.js";
|
|
6
|
+
export const CODEX_BUNDLE_VERSION = 1;
|
|
7
|
+
export const CODEX_BUNDLE_FILES = [
|
|
8
|
+
"codex-instance.json",
|
|
9
|
+
"requirements.toml",
|
|
10
|
+
"managed_config.toml",
|
|
11
|
+
"approval-codex-mcp",
|
|
12
|
+
"approval-codex-start",
|
|
13
|
+
"com.approval.codex-broker.plist",
|
|
14
|
+
"com.approval.codex-runner.plist",
|
|
15
|
+
"INSTALL.md",
|
|
16
|
+
];
|
|
17
|
+
function quote(value) {
|
|
18
|
+
return JSON.stringify(value);
|
|
19
|
+
}
|
|
20
|
+
function xml(value) {
|
|
21
|
+
return value
|
|
22
|
+
.replaceAll("&", "&")
|
|
23
|
+
.replaceAll("<", "<")
|
|
24
|
+
.replaceAll(">", ">")
|
|
25
|
+
.replaceAll('"', """);
|
|
26
|
+
}
|
|
27
|
+
function sha256(bytes) {
|
|
28
|
+
return createHash("sha256").update(bytes).digest("hex");
|
|
29
|
+
}
|
|
30
|
+
function packageVersion() {
|
|
31
|
+
const packageRoot = fileURLToPath(new URL("../../../", import.meta.url));
|
|
32
|
+
const value = JSON.parse(readFileSync(join(packageRoot, "package.json"), "utf8"));
|
|
33
|
+
if (typeof value.version !== "string")
|
|
34
|
+
throw new Error("installed package.json has no version");
|
|
35
|
+
return value.version;
|
|
36
|
+
}
|
|
37
|
+
export function manifestFor(input) {
|
|
38
|
+
const installRoot = resolve(input.installRoot);
|
|
39
|
+
const manifestPath = join(installRoot, "instances", `${input.instanceId}.json`);
|
|
40
|
+
const mcpExecutable = join(installRoot, "bin", "approval-codex-mcp");
|
|
41
|
+
return {
|
|
42
|
+
schema_version: CODEX_INSTANCE_SCHEMA_VERSION,
|
|
43
|
+
instance_id: input.instanceId,
|
|
44
|
+
platform: SUPPORTED_CODEX_PLATFORM,
|
|
45
|
+
codex_version: SUPPORTED_CODEX_VERSION,
|
|
46
|
+
node_version: process.versions.node,
|
|
47
|
+
package_version: packageVersion(),
|
|
48
|
+
paths: {
|
|
49
|
+
install_root: installRoot,
|
|
50
|
+
package_root: join(installRoot, "package"),
|
|
51
|
+
workspace: resolve(input.workspace),
|
|
52
|
+
primary: resolve(input.primary),
|
|
53
|
+
policy: join(resolve(input.primary), "APPROVAL.md"),
|
|
54
|
+
log: join(resolve(input.primary), ".approval", "log", "events.jsonl"),
|
|
55
|
+
manifest: manifestPath,
|
|
56
|
+
codex_executable: resolve(input.codexExecutable),
|
|
57
|
+
node_executable: resolve(input.nodeExecutable),
|
|
58
|
+
mcp_executable: mcpExecutable,
|
|
59
|
+
broker_executable: join(installRoot, "bin", "approval-codex-broker"),
|
|
60
|
+
runner_executable: join(installRoot, "bin", "approval-codex-runner"),
|
|
61
|
+
},
|
|
62
|
+
principals: {
|
|
63
|
+
codex: "_approval_codex",
|
|
64
|
+
broker: "_approval_broker",
|
|
65
|
+
runner: "_approval_runner",
|
|
66
|
+
},
|
|
67
|
+
invocation: {
|
|
68
|
+
command: mcpExecutable,
|
|
69
|
+
args: ["codex", "serve", "--manifest", manifestPath],
|
|
70
|
+
},
|
|
71
|
+
components: {
|
|
72
|
+
broker: "required-not-shipped",
|
|
73
|
+
runner: "required-not-shipped",
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export function requirementsToml(manifest) {
|
|
78
|
+
const rules = manifest.invocation.args
|
|
79
|
+
.map((value) => ` { match = "exact", value = ${quote(value)} },`)
|
|
80
|
+
.join("\n");
|
|
81
|
+
return `# INERT REVIEW ARTIFACT. Installing this file is a human/MDM action.
|
|
82
|
+
allowed_approval_policies = ["never"]
|
|
83
|
+
allowed_web_search_modes = ["disabled"]
|
|
84
|
+
default_permissions = "approval-codex-readonly"
|
|
85
|
+
allow_managed_hooks_only = true
|
|
86
|
+
allow_remote_control = false
|
|
87
|
+
|
|
88
|
+
[allowed_permission_profiles]
|
|
89
|
+
approval-codex-readonly = true
|
|
90
|
+
|
|
91
|
+
[permissions.approval-codex-readonly.filesystem]
|
|
92
|
+
":root" = "deny"
|
|
93
|
+
":minimal" = "read"
|
|
94
|
+
|
|
95
|
+
[permissions.approval-codex-readonly.filesystem.":workspace_roots"]
|
|
96
|
+
"." = "read"
|
|
97
|
+
|
|
98
|
+
[permissions.approval-codex-readonly.network]
|
|
99
|
+
enabled = false
|
|
100
|
+
|
|
101
|
+
[features]
|
|
102
|
+
apps = false
|
|
103
|
+
browser_use = false
|
|
104
|
+
browser_use_external = false
|
|
105
|
+
browser_use_full_cdp_access = false
|
|
106
|
+
computer_use = false
|
|
107
|
+
in_app_browser = false
|
|
108
|
+
plugins = false
|
|
109
|
+
web_search = false
|
|
110
|
+
|
|
111
|
+
[mcp_servers.approval-codex.identity]
|
|
112
|
+
command = { executable = ${quote(manifest.invocation.command)}, args = [
|
|
113
|
+
${rules}
|
|
114
|
+
] }
|
|
115
|
+
`;
|
|
116
|
+
}
|
|
117
|
+
export function managedConfigToml(manifest) {
|
|
118
|
+
const args = manifest.invocation.args.map(quote).join(", ");
|
|
119
|
+
return `# INERT REVIEW ARTIFACT. This enables only the pinned strict MCP shim.
|
|
120
|
+
[mcp_servers.approval-codex]
|
|
121
|
+
command = ${quote(manifest.invocation.command)}
|
|
122
|
+
args = [${args}]
|
|
123
|
+
required = true
|
|
124
|
+
`;
|
|
125
|
+
}
|
|
126
|
+
function shellQuote(value) {
|
|
127
|
+
return `'${value.replaceAll("'", "'\"'\"'")}'`;
|
|
128
|
+
}
|
|
129
|
+
function launcher(manifest, mode) {
|
|
130
|
+
const cli = join(manifest.paths.package_root, "cli.js");
|
|
131
|
+
const prefix = `exec /usr/bin/env -i PATH=/usr/bin:/bin HOME=/var/empty TMPDIR=/tmp ${shellQuote(manifest.paths.node_executable)} ${shellQuote(cli)}`;
|
|
132
|
+
const command = mode === "serve"
|
|
133
|
+
? `if [ "$#" -ne 4 ] || [ "$1" != 'codex' ] || [ "$2" != 'serve' ] || [ "$3" != '--manifest' ] || [ "$4" != ${shellQuote(manifest.paths.manifest)} ]; then exit 2; fi
|
|
134
|
+
${prefix} codex serve --manifest ${shellQuote(manifest.paths.manifest)}`
|
|
135
|
+
: `if [ "$#" -ne 0 ]; then exit 2; fi\n${prefix} codex start --manifest ${shellQuote(manifest.paths.manifest)}`;
|
|
136
|
+
return `#!/bin/sh
|
|
137
|
+
# INERT until installed root-owned with the complete APRV-325 broker/runner.
|
|
138
|
+
cd ${shellQuote(manifest.paths.package_root)} || exit 1
|
|
139
|
+
${command}
|
|
140
|
+
`;
|
|
141
|
+
}
|
|
142
|
+
function plist(manifest, component) {
|
|
143
|
+
const executable = component === "broker" ? manifest.paths.broker_executable : manifest.paths.runner_executable;
|
|
144
|
+
const principal = component === "broker" ? manifest.principals.broker : manifest.principals.runner;
|
|
145
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
146
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
147
|
+
<plist version="1.0"><dict>
|
|
148
|
+
<key>Label</key><string>com.approval.codex-${component}</string>
|
|
149
|
+
<key>ProgramArguments</key><array>
|
|
150
|
+
<string>${xml(executable)}</string>
|
|
151
|
+
<string>--manifest</string>
|
|
152
|
+
<string>${xml(manifest.paths.manifest)}</string>
|
|
153
|
+
</array>
|
|
154
|
+
<key>UserName</key><string>${principal}</string>
|
|
155
|
+
<key>RunAtLoad</key><false/>
|
|
156
|
+
</dict></plist>
|
|
157
|
+
`;
|
|
158
|
+
}
|
|
159
|
+
function installGuide(manifest) {
|
|
160
|
+
return `# Constrained Codex instance ${manifest.instance_id}
|
|
161
|
+
|
|
162
|
+
This bundle is inert. It does not create users, install files, load launchd
|
|
163
|
+
services, edit /etc/codex, authenticate Codex, start an executor, or change
|
|
164
|
+
approval.md policy.
|
|
165
|
+
|
|
166
|
+
The broker and runner are deliberately marked required-not-shipped. Do not
|
|
167
|
+
install or start this bundle until APRV-325.2 and APRV-325.3 replace those
|
|
168
|
+
placeholders and strict doctor reports ready.
|
|
169
|
+
|
|
170
|
+
Target install root: ${manifest.paths.install_root}
|
|
171
|
+
Canonical workspace: ${manifest.paths.workspace}
|
|
172
|
+
Primary gate checkout: ${manifest.paths.primary}
|
|
173
|
+
|
|
174
|
+
Review bundle-sha256.json, then run:
|
|
175
|
+
approval codex setup --check <this-directory>
|
|
176
|
+
approval codex doctor --manifest ${manifest.paths.manifest}
|
|
177
|
+
|
|
178
|
+
A passing setup check proves only that this review bundle is internally
|
|
179
|
+
consistent. It does not prove host custody or enforcement.
|
|
180
|
+
`;
|
|
181
|
+
}
|
|
182
|
+
export function renderBundle(manifest) {
|
|
183
|
+
return {
|
|
184
|
+
"codex-instance.json": `${JSON.stringify(manifest, null, 2)}\n`,
|
|
185
|
+
"requirements.toml": requirementsToml(manifest),
|
|
186
|
+
"managed_config.toml": managedConfigToml(manifest),
|
|
187
|
+
"approval-codex-mcp": launcher(manifest, "serve"),
|
|
188
|
+
"approval-codex-start": launcher(manifest, "start"),
|
|
189
|
+
"com.approval.codex-broker.plist": plist(manifest, "broker"),
|
|
190
|
+
"com.approval.codex-runner.plist": plist(manifest, "runner"),
|
|
191
|
+
"INSTALL.md": installGuide(manifest),
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
export function prepareBundle(input) {
|
|
195
|
+
let manifest;
|
|
196
|
+
try {
|
|
197
|
+
manifest = manifestFor(input);
|
|
198
|
+
}
|
|
199
|
+
catch (cause) {
|
|
200
|
+
return { ok: false, code: "package-unreadable", message: cause instanceof Error ? cause.message : String(cause) };
|
|
201
|
+
}
|
|
202
|
+
const checked = checkCodexInstance(manifest);
|
|
203
|
+
if (!checked.ok) {
|
|
204
|
+
return {
|
|
205
|
+
ok: false,
|
|
206
|
+
code: "manifest-invalid",
|
|
207
|
+
message: checked.errors.map((error) => `${error.path || "/"}: ${error.message}`).join("; "),
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
let output;
|
|
211
|
+
try {
|
|
212
|
+
const requestedOutput = resolve(input.output);
|
|
213
|
+
output = join(realpathSync(dirname(requestedOutput)), basename(requestedOutput));
|
|
214
|
+
}
|
|
215
|
+
catch (cause) {
|
|
216
|
+
return { ok: false, code: "prepare-failed", message: cause instanceof Error ? cause.message : String(cause) };
|
|
217
|
+
}
|
|
218
|
+
const roots = [manifest.paths.workspace, manifest.paths.primary, manifest.paths.install_root];
|
|
219
|
+
if (roots.some((root) => output === root || output.startsWith(`${root}/`) || root.startsWith(`${output}/`))) {
|
|
220
|
+
return { ok: false, code: "output-overlap", message: "preparation output must be disjoint from workspace, primary and install roots" };
|
|
221
|
+
}
|
|
222
|
+
try {
|
|
223
|
+
mkdirSync(output);
|
|
224
|
+
const rendered = renderBundle(manifest);
|
|
225
|
+
for (const [name, content] of Object.entries(rendered)) {
|
|
226
|
+
writeFileSync(join(output, name), content, {
|
|
227
|
+
encoding: "utf8",
|
|
228
|
+
mode: name.startsWith("approval-codex-") ? 0o755 : 0o644,
|
|
229
|
+
flag: "wx",
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
const index = { version: CODEX_BUNDLE_VERSION, files: {} };
|
|
233
|
+
for (const name of CODEX_BUNDLE_FILES) {
|
|
234
|
+
index.files[name] = sha256(readFileSync(join(output, name)));
|
|
235
|
+
}
|
|
236
|
+
writeFileSync(join(output, "bundle-sha256.json"), `${JSON.stringify(index, null, 2)}\n`, {
|
|
237
|
+
encoding: "utf8",
|
|
238
|
+
mode: 0o644,
|
|
239
|
+
flag: "wx",
|
|
240
|
+
});
|
|
241
|
+
return { ok: true, output, manifest, files: [...CODEX_BUNDLE_FILES, "bundle-sha256.json"] };
|
|
242
|
+
}
|
|
243
|
+
catch (cause) {
|
|
244
|
+
return { ok: false, code: "prepare-failed", message: cause instanceof Error ? cause.message : String(cause) };
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
export function checkBundle(directory) {
|
|
248
|
+
const root = resolve(directory);
|
|
249
|
+
try {
|
|
250
|
+
if (!lstatSync(root).isDirectory() || realpathSync(root) !== root) {
|
|
251
|
+
return { ok: false, code: "bundle-root-unsafe", message: "bundle root must be a canonical directory, not a symlink" };
|
|
252
|
+
}
|
|
253
|
+
if (!lstatSync(join(root, "bundle-sha256.json")).isFile()) {
|
|
254
|
+
return { ok: false, code: "bundle-index-unreadable", message: "bundle-sha256.json must be a regular file" };
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
catch (cause) {
|
|
258
|
+
return { ok: false, code: "bundle-index-unreadable", message: cause instanceof Error ? cause.message : String(cause) };
|
|
259
|
+
}
|
|
260
|
+
let index;
|
|
261
|
+
try {
|
|
262
|
+
index = JSON.parse(readFileSync(join(root, "bundle-sha256.json"), "utf8"));
|
|
263
|
+
}
|
|
264
|
+
catch (cause) {
|
|
265
|
+
return { ok: false, code: "bundle-index-unreadable", message: cause instanceof Error ? cause.message : String(cause) };
|
|
266
|
+
}
|
|
267
|
+
if (index.version !== CODEX_BUNDLE_VERSION ||
|
|
268
|
+
typeof index.files !== "object" ||
|
|
269
|
+
index.files === null ||
|
|
270
|
+
Array.isArray(index.files)) {
|
|
271
|
+
return { ok: false, code: "bundle-index-invalid", message: "bundle-sha256.json has an unsupported shape or version" };
|
|
272
|
+
}
|
|
273
|
+
const expected = [...CODEX_BUNDLE_FILES].sort();
|
|
274
|
+
const actual = Object.keys(index.files).sort();
|
|
275
|
+
if (JSON.stringify(actual) !== JSON.stringify(expected)) {
|
|
276
|
+
return { ok: false, code: "bundle-file-set", message: "bundle index must name the exact required file set" };
|
|
277
|
+
}
|
|
278
|
+
try {
|
|
279
|
+
const disk = readdirSync(root).sort();
|
|
280
|
+
const allowed = [...expected, "bundle-sha256.json"].sort();
|
|
281
|
+
if (JSON.stringify(disk) !== JSON.stringify(allowed)) {
|
|
282
|
+
return { ok: false, code: "bundle-file-set", message: "bundle directory must contain only the indexed files and bundle-sha256.json" };
|
|
283
|
+
}
|
|
284
|
+
for (const name of expected) {
|
|
285
|
+
if (!lstatSync(join(root, name)).isFile()) {
|
|
286
|
+
return { ok: false, code: "bundle-file-type", message: `${name} must be a regular file, not a symlink or directory` };
|
|
287
|
+
}
|
|
288
|
+
if (index.files[name] !== sha256(readFileSync(join(root, name)))) {
|
|
289
|
+
return { ok: false, code: "bundle-hash-mismatch", message: `${name} does not match bundle-sha256.json` };
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
catch (cause) {
|
|
294
|
+
return { ok: false, code: "bundle-unreadable", message: cause instanceof Error ? cause.message : String(cause) };
|
|
295
|
+
}
|
|
296
|
+
let manifestValue;
|
|
297
|
+
try {
|
|
298
|
+
manifestValue = JSON.parse(readFileSync(join(root, "codex-instance.json"), "utf8"));
|
|
299
|
+
}
|
|
300
|
+
catch (cause) {
|
|
301
|
+
return {
|
|
302
|
+
ok: false,
|
|
303
|
+
code: "manifest-invalid",
|
|
304
|
+
message: cause instanceof Error ? cause.message : String(cause),
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
const checked = checkCodexInstance(manifestValue);
|
|
308
|
+
if (!checked.ok) {
|
|
309
|
+
return { ok: false, code: "manifest-invalid", message: checked.errors.map((error) => error.message).join("; ") };
|
|
310
|
+
}
|
|
311
|
+
const expectedRendered = renderBundle(checked.manifest);
|
|
312
|
+
for (const [name, content] of Object.entries(expectedRendered)) {
|
|
313
|
+
if (readFileSync(join(root, name), "utf8") !== content) {
|
|
314
|
+
return { ok: false, code: "bundle-template-drift", message: `${name} does not match the manifest-derived template` };
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return { ok: true, manifest: checked.manifest, files: [...expected, "bundle-sha256.json"] };
|
|
318
|
+
}
|
|
319
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/codex/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,SAAS,EACT,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,GAEnB,MAAM,eAAe,CAAC;AAEvB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AACtC,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,qBAAqB;IACrB,mBAAmB;IACnB,qBAAqB;IACrB,oBAAoB;IACpB,sBAAsB;IACtB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,EAAE,CAAC;YACvD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,GAAG,IAAI,+CAA+C,EAAE,CAAC;QACvH,CAAC;IACH,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,GAAG,QAAQ,EAAE,oBAAoB,CAAC,EAAE,CAAC;AAC9F,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CodexInstanceManifest } from "./manifest.js";
|
|
2
|
+
export interface DoctorFinding {
|
|
3
|
+
code: string;
|
|
4
|
+
path?: string;
|
|
5
|
+
message: string;
|
|
6
|
+
}
|
|
7
|
+
export interface DoctorReport {
|
|
8
|
+
ok: false;
|
|
9
|
+
ready: false;
|
|
10
|
+
findings: DoctorFinding[];
|
|
11
|
+
}
|
|
12
|
+
export interface TrustOptions {
|
|
13
|
+
platform?: NodeJS.Platform;
|
|
14
|
+
resolveUid?: (name: string) => number | null;
|
|
15
|
+
groupsFor?: (name: string) => number[] | null;
|
|
16
|
+
}
|
|
17
|
+
export declare function parseCodexVersionOutput(stdout: string, stderr: string): string | null;
|
|
18
|
+
export declare function parseNodeVersionOutput(stdout: string, stderr: string): string | null;
|
|
19
|
+
export declare function diagnoseCodexInstance(manifest: CodexInstanceManifest, options?: TrustOptions): DoctorReport;
|