@memnexus-ai/mx-agent-cli 0.1.294 โ 0.1.296-next.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/dist/__tests__/agents-md-canonicalization.test.js +31 -1
- package/dist/__tests__/agents-md-canonicalization.test.js.map +1 -1
- package/dist/__tests__/behavioral-extraction.test.js +50 -0
- package/dist/__tests__/behavioral-extraction.test.js.map +1 -1
- package/dist/__tests__/bootstrap-behavioral-contract.test.js +6 -3
- package/dist/__tests__/bootstrap-behavioral-contract.test.js.map +1 -1
- package/dist/__tests__/bundle-config.test.js +28 -2
- package/dist/__tests__/bundle-config.test.js.map +1 -1
- package/dist/__tests__/catalog-interaction.test.d.ts +25 -0
- package/dist/__tests__/catalog-interaction.test.d.ts.map +1 -0
- package/dist/__tests__/catalog-interaction.test.js +269 -0
- package/dist/__tests__/catalog-interaction.test.js.map +1 -0
- package/dist/__tests__/catalog-named-memories.test.d.ts +2 -0
- package/dist/__tests__/catalog-named-memories.test.d.ts.map +1 -0
- package/dist/__tests__/catalog-named-memories.test.js +204 -0
- package/dist/__tests__/catalog-named-memories.test.js.map +1 -0
- package/dist/__tests__/catalog-origin-main.test.d.ts +15 -0
- package/dist/__tests__/catalog-origin-main.test.d.ts.map +1 -0
- package/dist/__tests__/catalog-origin-main.test.js +296 -0
- package/dist/__tests__/catalog-origin-main.test.js.map +1 -0
- package/dist/__tests__/catalog.test.d.ts +2 -0
- package/dist/__tests__/catalog.test.d.ts.map +1 -0
- package/dist/__tests__/catalog.test.js +131 -0
- package/dist/__tests__/catalog.test.js.map +1 -0
- package/dist/__tests__/claude-local-sanitizer.test.d.ts +24 -0
- package/dist/__tests__/claude-local-sanitizer.test.d.ts.map +1 -0
- package/dist/__tests__/claude-local-sanitizer.test.js +906 -0
- package/dist/__tests__/claude-local-sanitizer.test.js.map +1 -0
- package/dist/__tests__/cli-build-integration.test.d.ts +2 -0
- package/dist/__tests__/cli-build-integration.test.d.ts.map +1 -0
- package/dist/__tests__/cli-build-integration.test.js +64 -0
- package/dist/__tests__/cli-build-integration.test.js.map +1 -0
- package/dist/__tests__/cli-build.test.d.ts +2 -0
- package/dist/__tests__/cli-build.test.d.ts.map +1 -0
- package/dist/__tests__/cli-build.test.js +640 -0
- package/dist/__tests__/cli-build.test.js.map +1 -0
- package/dist/__tests__/codex-deploy-config.test.js +60 -0
- package/dist/__tests__/codex-deploy-config.test.js.map +1 -1
- package/dist/__tests__/completion-rows-discriminate.test.d.ts +20 -0
- package/dist/__tests__/completion-rows-discriminate.test.d.ts.map +1 -0
- package/dist/__tests__/completion-rows-discriminate.test.js +481 -0
- package/dist/__tests__/completion-rows-discriminate.test.js.map +1 -0
- package/dist/__tests__/config-fidelity-archived-symlinks.test.d.ts +2 -0
- package/dist/__tests__/config-fidelity-archived-symlinks.test.d.ts.map +1 -0
- package/dist/__tests__/config-fidelity-archived-symlinks.test.js +127 -0
- package/dist/__tests__/config-fidelity-archived-symlinks.test.js.map +1 -0
- package/dist/__tests__/config-fidelity-display.test.d.ts +2 -0
- package/dist/__tests__/config-fidelity-display.test.d.ts.map +1 -0
- package/dist/__tests__/config-fidelity-display.test.js +77 -0
- package/dist/__tests__/config-fidelity-display.test.js.map +1 -0
- package/dist/__tests__/config-fidelity.test.js +166 -33
- package/dist/__tests__/config-fidelity.test.js.map +1 -1
- package/dist/__tests__/config-generation-gate.test.js +78 -0
- package/dist/__tests__/config-generation-gate.test.js.map +1 -1
- package/dist/__tests__/config-sync.test.js +89 -1
- package/dist/__tests__/config-sync.test.js.map +1 -1
- package/dist/__tests__/coordination-401-production-wiring.test.js +12 -7
- package/dist/__tests__/coordination-401-production-wiring.test.js.map +1 -1
- package/dist/__tests__/coordination-401-recovery.test.js +39 -32
- package/dist/__tests__/coordination-401-recovery.test.js.map +1 -1
- package/dist/__tests__/coordination-brief-pin.test.js +21 -8
- package/dist/__tests__/coordination-brief-pin.test.js.map +1 -1
- package/dist/__tests__/coordination-client.test.js +316 -3
- package/dist/__tests__/coordination-client.test.js.map +1 -1
- package/dist/__tests__/coordination-credential-endpoint.test.d.ts +24 -0
- package/dist/__tests__/coordination-credential-endpoint.test.d.ts.map +1 -0
- package/dist/__tests__/coordination-credential-endpoint.test.js +1290 -0
- package/dist/__tests__/coordination-credential-endpoint.test.js.map +1 -0
- package/dist/__tests__/coordination-memory.test.js +20 -4
- package/dist/__tests__/coordination-memory.test.js.map +1 -1
- package/dist/__tests__/coordination-provision.test.js +22 -14
- package/dist/__tests__/coordination-provision.test.js.map +1 -1
- package/dist/__tests__/coordination-status-registration.test.d.ts +16 -0
- package/dist/__tests__/coordination-status-registration.test.d.ts.map +1 -0
- package/dist/__tests__/coordination-status-registration.test.js +480 -0
- package/dist/__tests__/coordination-status-registration.test.js.map +1 -0
- package/dist/__tests__/coordination-token-multitenant.test.js +24 -24
- package/dist/__tests__/coordination-token-multitenant.test.js.map +1 -1
- package/dist/__tests__/coordination-token.test.js +35 -28
- package/dist/__tests__/coordination-token.test.js.map +1 -1
- package/dist/__tests__/creation-pr-class-check.test.d.ts +17 -0
- package/dist/__tests__/creation-pr-class-check.test.d.ts.map +1 -0
- package/dist/__tests__/creation-pr-class-check.test.js +346 -0
- package/dist/__tests__/creation-pr-class-check.test.js.map +1 -0
- package/dist/__tests__/decision-check.test.d.ts +2 -0
- package/dist/__tests__/decision-check.test.d.ts.map +1 -0
- package/dist/__tests__/decision-check.test.js +105 -0
- package/dist/__tests__/decision-check.test.js.map +1 -0
- package/dist/__tests__/digest-team-omission.test.d.ts +15 -0
- package/dist/__tests__/digest-team-omission.test.d.ts.map +1 -0
- package/dist/__tests__/digest-team-omission.test.js +247 -0
- package/dist/__tests__/digest-team-omission.test.js.map +1 -0
- package/dist/__tests__/doctor-worktree-path.test.d.ts +17 -0
- package/dist/__tests__/doctor-worktree-path.test.d.ts.map +1 -0
- package/dist/__tests__/doctor-worktree-path.test.js +158 -0
- package/dist/__tests__/doctor-worktree-path.test.js.map +1 -0
- package/dist/__tests__/fleet-data.test.js +40 -7
- package/dist/__tests__/fleet-data.test.js.map +1 -1
- package/dist/__tests__/fleet-tmux.test.js +2 -2
- package/dist/__tests__/fleet-tmux.test.js.map +1 -1
- package/dist/__tests__/generate-claude.test.js +137 -3
- package/dist/__tests__/generate-claude.test.js.map +1 -1
- package/dist/__tests__/git-env.test.d.ts +14 -0
- package/dist/__tests__/git-env.test.d.ts.map +1 -0
- package/dist/__tests__/git-env.test.js +131 -0
- package/dist/__tests__/git-env.test.js.map +1 -0
- package/dist/__tests__/git-identity-isolation.test.d.ts +33 -0
- package/dist/__tests__/git-identity-isolation.test.d.ts.map +1 -0
- package/dist/__tests__/git-identity-isolation.test.js +626 -0
- package/dist/__tests__/git-identity-isolation.test.js.map +1 -0
- package/dist/__tests__/harness-extract.test.d.ts +19 -0
- package/dist/__tests__/harness-extract.test.d.ts.map +1 -0
- package/dist/__tests__/harness-extract.test.js +566 -0
- package/dist/__tests__/harness-extract.test.js.map +1 -0
- package/dist/__tests__/harness-wiring.test.d.ts +16 -0
- package/dist/__tests__/harness-wiring.test.d.ts.map +1 -0
- package/dist/__tests__/harness-wiring.test.js +469 -0
- package/dist/__tests__/harness-wiring.test.js.map +1 -0
- package/dist/__tests__/hook-heal.test.js +17 -0
- package/dist/__tests__/hook-heal.test.js.map +1 -1
- package/dist/__tests__/init-coordination-url.test.d.ts +11 -0
- package/dist/__tests__/init-coordination-url.test.d.ts.map +1 -0
- package/dist/__tests__/init-coordination-url.test.js +114 -0
- package/dist/__tests__/init-coordination-url.test.js.map +1 -0
- package/dist/__tests__/memory-autocreate.test.js +574 -8
- package/dist/__tests__/memory-autocreate.test.js.map +1 -1
- package/dist/__tests__/memory-log-result.test.d.ts +13 -0
- package/dist/__tests__/memory-log-result.test.d.ts.map +1 -0
- package/dist/__tests__/memory-log-result.test.js +113 -0
- package/dist/__tests__/memory-log-result.test.js.map +1 -0
- package/dist/__tests__/memory-named-exists.test.d.ts +16 -0
- package/dist/__tests__/memory-named-exists.test.d.ts.map +1 -0
- package/dist/__tests__/memory-named-exists.test.js +288 -0
- package/dist/__tests__/memory-named-exists.test.js.map +1 -0
- package/dist/__tests__/mx-agent-cli-pin-validation.test.js +23 -47
- package/dist/__tests__/mx-agent-cli-pin-validation.test.js.map +1 -1
- package/dist/__tests__/mx-agent-cli-version-pin.test.js +34 -88
- package/dist/__tests__/mx-agent-cli-version-pin.test.js.map +1 -1
- package/dist/__tests__/new-project-first-team.test.d.ts +15 -0
- package/dist/__tests__/new-project-first-team.test.d.ts.map +1 -0
- package/dist/__tests__/new-project-first-team.test.js +263 -0
- package/dist/__tests__/new-project-first-team.test.js.map +1 -0
- package/dist/__tests__/otel-env.test.d.ts +2 -0
- package/dist/__tests__/otel-env.test.d.ts.map +1 -0
- package/dist/__tests__/otel-env.test.js +127 -0
- package/dist/__tests__/otel-env.test.js.map +1 -0
- package/dist/__tests__/project-config.test.js +283 -1
- package/dist/__tests__/project-config.test.js.map +1 -1
- package/dist/__tests__/provision-behavioral-contract.test.js +96 -4
- package/dist/__tests__/provision-behavioral-contract.test.js.map +1 -1
- package/dist/__tests__/provision-catalog-precondition.test.d.ts +26 -0
- package/dist/__tests__/provision-catalog-precondition.test.d.ts.map +1 -0
- package/dist/__tests__/provision-catalog-precondition.test.js +620 -0
- package/dist/__tests__/provision-catalog-precondition.test.js.map +1 -0
- package/dist/__tests__/provision-completion-rows.test.d.ts +17 -0
- package/dist/__tests__/provision-completion-rows.test.d.ts.map +1 -0
- package/dist/__tests__/provision-completion-rows.test.js +3187 -0
- package/dist/__tests__/provision-completion-rows.test.js.map +1 -0
- package/dist/__tests__/provision-identity-gate.test.d.ts +20 -0
- package/dist/__tests__/provision-identity-gate.test.d.ts.map +1 -0
- package/dist/__tests__/provision-identity-gate.test.js +600 -0
- package/dist/__tests__/provision-identity-gate.test.js.map +1 -0
- package/dist/__tests__/provision-resume.test.d.ts +26 -0
- package/dist/__tests__/provision-resume.test.d.ts.map +1 -0
- package/dist/__tests__/provision-resume.test.js +1164 -0
- package/dist/__tests__/provision-resume.test.js.map +1 -0
- package/dist/__tests__/provision-roleguide-anchors.test.d.ts +27 -0
- package/dist/__tests__/provision-roleguide-anchors.test.d.ts.map +1 -0
- package/dist/__tests__/provision-roleguide-anchors.test.js +747 -0
- package/dist/__tests__/provision-roleguide-anchors.test.js.map +1 -0
- package/dist/__tests__/provision-skeleton-fill.test.d.ts +16 -0
- package/dist/__tests__/provision-skeleton-fill.test.d.ts.map +1 -0
- package/dist/__tests__/provision-skeleton-fill.test.js +488 -0
- package/dist/__tests__/provision-skeleton-fill.test.js.map +1 -0
- package/dist/__tests__/provision-teambuilder-flow.test.js +93 -7
- package/dist/__tests__/provision-teambuilder-flow.test.js.map +1 -1
- package/dist/__tests__/repo-guard-wiring.test.d.ts +21 -0
- package/dist/__tests__/repo-guard-wiring.test.d.ts.map +1 -0
- package/dist/__tests__/repo-guard-wiring.test.js +638 -0
- package/dist/__tests__/repo-guard-wiring.test.js.map +1 -0
- package/dist/__tests__/report-format.test.d.ts +2 -0
- package/dist/__tests__/report-format.test.d.ts.map +1 -0
- package/dist/__tests__/report-format.test.js +219 -0
- package/dist/__tests__/report-format.test.js.map +1 -0
- package/dist/__tests__/row15-detail-sanitizer.test.d.ts +20 -0
- package/dist/__tests__/row15-detail-sanitizer.test.d.ts.map +1 -0
- package/dist/__tests__/row15-detail-sanitizer.test.js +61 -0
- package/dist/__tests__/row15-detail-sanitizer.test.js.map +1 -0
- package/dist/__tests__/runtime-codex-gateway-pilot.test.d.ts +2 -0
- package/dist/__tests__/runtime-codex-gateway-pilot.test.d.ts.map +1 -0
- package/dist/__tests__/runtime-codex-gateway-pilot.test.js +309 -0
- package/dist/__tests__/runtime-codex-gateway-pilot.test.js.map +1 -0
- package/dist/__tests__/runtime-codex-gateway-provider.test.d.ts +2 -0
- package/dist/__tests__/runtime-codex-gateway-provider.test.d.ts.map +1 -0
- package/dist/__tests__/runtime-codex-gateway-provider.test.js +163 -0
- package/dist/__tests__/runtime-codex-gateway-provider.test.js.map +1 -0
- package/dist/__tests__/runtime-identity.test.d.ts +2 -0
- package/dist/__tests__/runtime-identity.test.d.ts.map +1 -0
- package/dist/__tests__/runtime-identity.test.js +117 -0
- package/dist/__tests__/runtime-identity.test.js.map +1 -0
- package/dist/__tests__/session-pause-provisioning.test.js +6 -1
- package/dist/__tests__/session-pause-provisioning.test.js.map +1 -1
- package/dist/__tests__/session-record-disclosure.test.d.ts +24 -0
- package/dist/__tests__/session-record-disclosure.test.d.ts.map +1 -0
- package/dist/__tests__/session-record-disclosure.test.js +494 -0
- package/dist/__tests__/session-record-disclosure.test.js.map +1 -0
- package/dist/__tests__/session.test.js +35 -0
- package/dist/__tests__/session.test.js.map +1 -1
- package/dist/__tests__/slug-validation.test.js +27 -21
- package/dist/__tests__/slug-validation.test.js.map +1 -1
- package/dist/__tests__/standards-injection.test.d.ts +2 -0
- package/dist/__tests__/standards-injection.test.d.ts.map +1 -0
- package/dist/__tests__/standards-injection.test.js +179 -0
- package/dist/__tests__/standards-injection.test.js.map +1 -0
- package/dist/__tests__/start-interactive-role.test.d.ts +22 -0
- package/dist/__tests__/start-interactive-role.test.d.ts.map +1 -0
- package/dist/__tests__/start-interactive-role.test.js +204 -0
- package/dist/__tests__/start-interactive-role.test.js.map +1 -0
- package/dist/__tests__/start-team-identity.test.d.ts +25 -0
- package/dist/__tests__/start-team-identity.test.d.ts.map +1 -0
- package/dist/__tests__/start-team-identity.test.js +307 -0
- package/dist/__tests__/start-team-identity.test.js.map +1 -0
- package/dist/__tests__/team-memory-commands.test.js +142 -19
- package/dist/__tests__/team-memory-commands.test.js.map +1 -1
- package/dist/__tests__/template-sync.test.d.ts +19 -0
- package/dist/__tests__/template-sync.test.d.ts.map +1 -0
- package/dist/__tests__/template-sync.test.js +270 -0
- package/dist/__tests__/template-sync.test.js.map +1 -0
- package/dist/__tests__/test-project.test.d.ts +18 -0
- package/dist/__tests__/test-project.test.d.ts.map +1 -0
- package/dist/__tests__/test-project.test.js +465 -0
- package/dist/__tests__/test-project.test.js.map +1 -0
- package/dist/__tests__/usage-per-call-grouping.test.d.ts +25 -0
- package/dist/__tests__/usage-per-call-grouping.test.d.ts.map +1 -0
- package/dist/__tests__/usage-per-call-grouping.test.js +952 -0
- package/dist/__tests__/usage-per-call-grouping.test.js.map +1 -0
- package/dist/__tests__/verify-hooks-check-all.test.d.ts +32 -0
- package/dist/__tests__/verify-hooks-check-all.test.d.ts.map +1 -0
- package/dist/__tests__/verify-hooks-check-all.test.js +553 -0
- package/dist/__tests__/verify-hooks-check-all.test.js.map +1 -0
- package/dist/__tests__/worktree-sync-fixture.test.d.ts +17 -0
- package/dist/__tests__/worktree-sync-fixture.test.d.ts.map +1 -0
- package/dist/__tests__/worktree-sync-fixture.test.js +519 -0
- package/dist/__tests__/worktree-sync-fixture.test.js.map +1 -0
- package/dist/__tests__/worktree-sync-hardening.test.d.ts +13 -0
- package/dist/__tests__/worktree-sync-hardening.test.d.ts.map +1 -0
- package/dist/__tests__/worktree-sync-hardening.test.js +919 -0
- package/dist/__tests__/worktree-sync-hardening.test.js.map +1 -0
- package/dist/__tests__/worktree-sync-shell-free.test.d.ts +25 -0
- package/dist/__tests__/worktree-sync-shell-free.test.d.ts.map +1 -0
- package/dist/__tests__/worktree-sync-shell-free.test.js +185 -0
- package/dist/__tests__/worktree-sync-shell-free.test.js.map +1 -0
- package/dist/__tests__/worktree.test.js +75 -1
- package/dist/__tests__/worktree.test.js.map +1 -1
- package/dist/agent-config/.mx-config-generation.json +2 -2
- package/dist/agent-config/AGENTS.md.template +2 -2
- package/dist/agent-config/agents/bar-raiser.md +34 -1
- package/dist/agent-config/agents/red-team.md +34 -1
- package/dist/agent-config/agents/security-reviewer.md +22 -1
- package/dist/agent-config/claude-md/CLAUDE.core.md +6 -1
- package/dist/agent-config/claude-md/CLAUDE.overlay.memnexus.md +1 -3
- package/dist/agent-config/coordination-rosters.generated.json +10 -0
- package/dist/agent-config/hooks/HOOK-TIMEOUTS.md +27 -1
- package/dist/agent-config/hooks/OR-TRUE-AUDIT.md +8 -8
- package/dist/agent-config/hooks/auto-capture-precompact.sh +180 -83
- package/dist/agent-config/hooks/auto-capture-session-end.sh +216 -87
- package/dist/agent-config/hooks/auto-checkpoint.sh +75 -5
- package/dist/agent-config/hooks/coordination-brief.sh +290 -245
- package/dist/agent-config/hooks/deploy-verification-reminder.sh +359 -22
- package/dist/agent-config/hooks/git-mutation-guard.sh +85 -13
- package/dist/agent-config/hooks/observability-sync.sh +46 -9
- package/dist/agent-config/hooks/session-idle-gate.sh +177 -12
- package/dist/agent-config/hooks/subagent-write-guard.sh +670 -0
- package/dist/agent-config/hooks/worktree-guard.sh +36 -7
- package/dist/agent-config/settings.json +15 -2
- package/dist/agent-config/shared/creation-pr-review-checklist.md +317 -0
- package/dist/commands/bootstrap.d.ts.map +1 -1
- package/dist/commands/bootstrap.js +22 -10
- package/dist/commands/bootstrap.js.map +1 -1
- package/dist/commands/config-sync.d.ts +37 -0
- package/dist/commands/config-sync.d.ts.map +1 -1
- package/dist/commands/config-sync.js +36 -18
- package/dist/commands/config-sync.js.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +28 -1
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/coordination.d.ts +150 -8
- package/dist/commands/coordination.d.ts.map +1 -1
- package/dist/commands/coordination.js +524 -25
- package/dist/commands/coordination.js.map +1 -1
- package/dist/commands/create.d.ts +922 -1
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +4934 -345
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/dashboard.d.ts.map +1 -1
- package/dist/commands/dashboard.js +10 -2
- package/dist/commands/dashboard.js.map +1 -1
- package/dist/commands/decision.d.ts +20 -0
- package/dist/commands/decision.d.ts.map +1 -0
- package/dist/commands/decision.js +54 -0
- package/dist/commands/decision.js.map +1 -0
- package/dist/commands/digest.d.ts.map +1 -1
- package/dist/commands/digest.js +91 -7
- package/dist/commands/digest.js.map +1 -1
- package/dist/commands/fleet-tmux.js +1 -1
- package/dist/commands/fleet-tmux.js.map +1 -1
- package/dist/commands/init.d.ts +8 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +26 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/list.d.ts +32 -1
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +98 -5
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/monitor.d.ts.map +1 -1
- package/dist/commands/monitor.js +8 -2
- package/dist/commands/monitor.js.map +1 -1
- package/dist/commands/new.d.ts +2 -0
- package/dist/commands/new.d.ts.map +1 -1
- package/dist/commands/new.js +114 -21
- package/dist/commands/new.js.map +1 -1
- package/dist/commands/report.d.ts +33 -0
- package/dist/commands/report.d.ts.map +1 -0
- package/dist/commands/report.js +73 -0
- package/dist/commands/report.js.map +1 -0
- package/dist/commands/session.js +1 -1
- package/dist/commands/session.js.map +1 -1
- package/dist/commands/start.d.ts +42 -0
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +183 -8
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/sync.d.ts +57 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +117 -3
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/update.d.ts +13 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +50 -1
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/usage.d.ts +64 -0
- package/dist/commands/usage.d.ts.map +1 -1
- package/dist/commands/usage.js +96 -3
- package/dist/commands/usage.js.map +1 -1
- package/dist/commands/verify-hooks.d.ts +37 -1
- package/dist/commands/verify-hooks.d.ts.map +1 -1
- package/dist/commands/verify-hooks.js +114 -2
- package/dist/commands/verify-hooks.js.map +1 -1
- package/dist/commands/window.d.ts +10 -0
- package/dist/commands/window.d.ts.map +1 -0
- package/dist/commands/window.js +265 -0
- package/dist/commands/window.js.map +1 -0
- package/dist/commands/worktree-sync.d.ts +54 -0
- package/dist/commands/worktree-sync.d.ts.map +1 -0
- package/dist/commands/worktree-sync.js +135 -0
- package/dist/commands/worktree-sync.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +189 -14
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-session.d.ts +12 -0
- package/dist/lib/agent-session.d.ts.map +1 -1
- package/dist/lib/agent-session.js +189 -42
- package/dist/lib/agent-session.js.map +1 -1
- package/dist/lib/behavioral-injection.d.ts +9 -0
- package/dist/lib/behavioral-injection.d.ts.map +1 -1
- package/dist/lib/behavioral-injection.js +10 -1
- package/dist/lib/behavioral-injection.js.map +1 -1
- package/dist/lib/catalog.d.ts +321 -2
- package/dist/lib/catalog.d.ts.map +1 -1
- package/dist/lib/catalog.js +490 -11
- package/dist/lib/catalog.js.map +1 -1
- package/dist/lib/claude.d.ts +113 -23
- package/dist/lib/claude.d.ts.map +1 -1
- package/dist/lib/claude.js +498 -32
- package/dist/lib/claude.js.map +1 -1
- package/dist/lib/cli-build.d.ts +172 -0
- package/dist/lib/cli-build.d.ts.map +1 -0
- package/dist/lib/cli-build.js +654 -0
- package/dist/lib/cli-build.js.map +1 -0
- package/dist/lib/code-context-file.d.ts +109 -0
- package/dist/lib/code-context-file.d.ts.map +1 -0
- package/dist/lib/code-context-file.js +219 -0
- package/dist/lib/code-context-file.js.map +1 -0
- package/dist/lib/code-context-file.test.d.ts +19 -0
- package/dist/lib/code-context-file.test.d.ts.map +1 -0
- package/dist/lib/code-context-file.test.js +202 -0
- package/dist/lib/code-context-file.test.js.map +1 -0
- package/dist/lib/config-fidelity.d.ts +40 -20
- package/dist/lib/config-fidelity.d.ts.map +1 -1
- package/dist/lib/config-fidelity.js +144 -56
- package/dist/lib/config-fidelity.js.map +1 -1
- package/dist/lib/coordination-client.d.ts +101 -0
- package/dist/lib/coordination-client.d.ts.map +1 -1
- package/dist/lib/coordination-client.js +232 -8
- package/dist/lib/coordination-client.js.map +1 -1
- package/dist/lib/coordination-token.d.ts +333 -6
- package/dist/lib/coordination-token.d.ts.map +1 -1
- package/dist/lib/coordination-token.js +875 -52
- package/dist/lib/coordination-token.js.map +1 -1
- package/dist/lib/decision-check.d.ts +48 -0
- package/dist/lib/decision-check.d.ts.map +1 -0
- package/dist/lib/decision-check.js +149 -0
- package/dist/lib/decision-check.js.map +1 -0
- package/dist/lib/fleet-data.d.ts +34 -0
- package/dist/lib/fleet-data.d.ts.map +1 -1
- package/dist/lib/fleet-data.js +37 -9
- package/dist/lib/fleet-data.js.map +1 -1
- package/dist/lib/fleet-render.js +1 -1
- package/dist/lib/fleet-render.js.map +1 -1
- package/dist/lib/git-identity.d.ts +302 -0
- package/dist/lib/git-identity.d.ts.map +1 -0
- package/dist/lib/git-identity.js +546 -0
- package/dist/lib/git-identity.js.map +1 -0
- package/dist/lib/harness/console/announce.d.ts +45 -0
- package/dist/lib/harness/console/announce.d.ts.map +1 -0
- package/dist/lib/harness/console/announce.js +48 -0
- package/dist/lib/harness/console/announce.js.map +1 -0
- package/dist/lib/harness/console/announce.test.d.ts +2 -0
- package/dist/lib/harness/console/announce.test.d.ts.map +1 -0
- package/dist/lib/harness/console/announce.test.js +104 -0
- package/dist/lib/harness/console/announce.test.js.map +1 -0
- package/dist/lib/harness/console/by-session.d.ts +50 -0
- package/dist/lib/harness/console/by-session.d.ts.map +1 -0
- package/dist/lib/harness/console/by-session.js +83 -0
- package/dist/lib/harness/console/by-session.js.map +1 -0
- package/dist/lib/harness/console/by-session.test.d.ts +2 -0
- package/dist/lib/harness/console/by-session.test.d.ts.map +1 -0
- package/dist/lib/harness/console/by-session.test.js +86 -0
- package/dist/lib/harness/console/by-session.test.js.map +1 -0
- package/dist/lib/harness/console/console.d.ts +67 -0
- package/dist/lib/harness/console/console.d.ts.map +1 -0
- package/dist/lib/harness/console/console.js +373 -0
- package/dist/lib/harness/console/console.js.map +1 -0
- package/dist/lib/harness/console/console.test.d.ts +2 -0
- package/dist/lib/harness/console/console.test.d.ts.map +1 -0
- package/dist/lib/harness/console/console.test.js +269 -0
- package/dist/lib/harness/console/console.test.js.map +1 -0
- package/dist/lib/harness/console/decision-request.d.ts +32 -0
- package/dist/lib/harness/console/decision-request.d.ts.map +1 -0
- package/dist/lib/harness/console/decision-request.js +112 -0
- package/dist/lib/harness/console/decision-request.js.map +1 -0
- package/dist/lib/harness/console/decision-request.test.d.ts +2 -0
- package/dist/lib/harness/console/decision-request.test.d.ts.map +1 -0
- package/dist/lib/harness/console/decision-request.test.js +75 -0
- package/dist/lib/harness/console/decision-request.test.js.map +1 -0
- package/dist/lib/harness/console/fixtures.d.ts +16 -0
- package/dist/lib/harness/console/fixtures.d.ts.map +1 -0
- package/dist/lib/harness/console/fixtures.js +49 -0
- package/dist/lib/harness/console/fixtures.js.map +1 -0
- package/dist/lib/harness/console/index.d.ts +15 -0
- package/dist/lib/harness/console/index.d.ts.map +1 -0
- package/dist/lib/harness/console/index.js +14 -0
- package/dist/lib/harness/console/index.js.map +1 -0
- package/dist/lib/harness/console/rank.d.ts +73 -0
- package/dist/lib/harness/console/rank.d.ts.map +1 -0
- package/dist/lib/harness/console/rank.js +113 -0
- package/dist/lib/harness/console/rank.js.map +1 -0
- package/dist/lib/harness/console/rank.test.d.ts +2 -0
- package/dist/lib/harness/console/rank.test.d.ts.map +1 -0
- package/dist/lib/harness/console/rank.test.js +124 -0
- package/dist/lib/harness/console/rank.test.js.map +1 -0
- package/dist/lib/harness/console/render.d.ts +22 -0
- package/dist/lib/harness/console/render.d.ts.map +1 -0
- package/dist/lib/harness/console/render.js +65 -0
- package/dist/lib/harness/console/render.js.map +1 -0
- package/dist/lib/harness/console/render.test.d.ts +2 -0
- package/dist/lib/harness/console/render.test.d.ts.map +1 -0
- package/dist/lib/harness/console/render.test.js +96 -0
- package/dist/lib/harness/console/render.test.js.map +1 -0
- package/dist/lib/harness/console/replay-cli.test.d.ts +2 -0
- package/dist/lib/harness/console/replay-cli.test.d.ts.map +1 -0
- package/dist/lib/harness/console/replay-cli.test.js +96 -0
- package/dist/lib/harness/console/replay-cli.test.js.map +1 -0
- package/dist/lib/harness/console/replay.d.ts +36 -0
- package/dist/lib/harness/console/replay.d.ts.map +1 -0
- package/dist/lib/harness/console/replay.js +59 -0
- package/dist/lib/harness/console/replay.js.map +1 -0
- package/dist/lib/harness/console/replay.test.d.ts +2 -0
- package/dist/lib/harness/console/replay.test.d.ts.map +1 -0
- package/dist/lib/harness/console/replay.test.js +81 -0
- package/dist/lib/harness/console/replay.test.js.map +1 -0
- package/dist/lib/harness/console/turn-reader.d.ts +50 -0
- package/dist/lib/harness/console/turn-reader.d.ts.map +1 -0
- package/dist/lib/harness/console/turn-reader.js +184 -0
- package/dist/lib/harness/console/turn-reader.js.map +1 -0
- package/dist/lib/harness/console/turn-reader.test.d.ts +2 -0
- package/dist/lib/harness/console/turn-reader.test.d.ts.map +1 -0
- package/dist/lib/harness/console/turn-reader.test.js +108 -0
- package/dist/lib/harness/console/turn-reader.test.js.map +1 -0
- package/dist/lib/harness/console/types.d.ts +109 -0
- package/dist/lib/harness/console/types.d.ts.map +1 -0
- package/dist/lib/harness/console/types.js +2 -0
- package/dist/lib/harness/console/types.js.map +1 -0
- package/dist/lib/harness/contract.d.ts +229 -0
- package/dist/lib/harness/contract.d.ts.map +1 -0
- package/dist/lib/harness/contract.js +22 -0
- package/dist/lib/harness/contract.js.map +1 -0
- package/dist/lib/harness/credential.d.ts +23 -0
- package/dist/lib/harness/credential.d.ts.map +1 -0
- package/dist/lib/harness/credential.js +81 -0
- package/dist/lib/harness/credential.js.map +1 -0
- package/dist/lib/harness/credential.test.d.ts +2 -0
- package/dist/lib/harness/credential.test.d.ts.map +1 -0
- package/dist/lib/harness/credential.test.js +74 -0
- package/dist/lib/harness/credential.test.js.map +1 -0
- package/dist/lib/harness/evaluate.d.ts +390 -0
- package/dist/lib/harness/evaluate.d.ts.map +1 -0
- package/dist/lib/harness/evaluate.js +988 -0
- package/dist/lib/harness/evaluate.js.map +1 -0
- package/dist/lib/harness/evaluate.test.d.ts +2 -0
- package/dist/lib/harness/evaluate.test.d.ts.map +1 -0
- package/dist/lib/harness/evaluate.test.js +621 -0
- package/dist/lib/harness/evaluate.test.js.map +1 -0
- package/dist/lib/harness/extract.d.ts +152 -0
- package/dist/lib/harness/extract.d.ts.map +1 -0
- package/dist/lib/harness/extract.js +1601 -0
- package/dist/lib/harness/extract.js.map +1 -0
- package/dist/lib/harness/gate.d.ts +48 -0
- package/dist/lib/harness/gate.d.ts.map +1 -0
- package/dist/lib/harness/gate.js +60 -0
- package/dist/lib/harness/gate.js.map +1 -0
- package/dist/lib/harness/gate.test.d.ts +2 -0
- package/dist/lib/harness/gate.test.d.ts.map +1 -0
- package/dist/lib/harness/gate.test.js +111 -0
- package/dist/lib/harness/gate.test.js.map +1 -0
- package/dist/lib/harness/self-check.d.ts +59 -0
- package/dist/lib/harness/self-check.d.ts.map +1 -0
- package/dist/lib/harness/self-check.js +56 -0
- package/dist/lib/harness/self-check.js.map +1 -0
- package/dist/lib/harness/self-check.test.d.ts +2 -0
- package/dist/lib/harness/self-check.test.d.ts.map +1 -0
- package/dist/lib/harness/self-check.test.js +43 -0
- package/dist/lib/harness/self-check.test.js.map +1 -0
- package/dist/lib/harness/transcript.d.ts +65 -0
- package/dist/lib/harness/transcript.d.ts.map +1 -0
- package/dist/lib/harness/transcript.js +144 -0
- package/dist/lib/harness/transcript.js.map +1 -0
- package/dist/lib/harness/transcript.test.d.ts +2 -0
- package/dist/lib/harness/transcript.test.d.ts.map +1 -0
- package/dist/lib/harness/transcript.test.js +118 -0
- package/dist/lib/harness/transcript.test.js.map +1 -0
- package/dist/lib/harness-wiring.d.ts +145 -0
- package/dist/lib/harness-wiring.d.ts.map +1 -0
- package/dist/lib/harness-wiring.js +280 -0
- package/dist/lib/harness-wiring.js.map +1 -0
- package/dist/lib/hook-staleness.d.ts +95 -0
- package/dist/lib/hook-staleness.d.ts.map +1 -0
- package/dist/lib/hook-staleness.js +304 -0
- package/dist/lib/hook-staleness.js.map +1 -0
- package/dist/lib/jsonl.d.ts +270 -2
- package/dist/lib/jsonl.d.ts.map +1 -1
- package/dist/lib/jsonl.js +472 -76
- package/dist/lib/jsonl.js.map +1 -1
- package/dist/lib/memory.d.ts +350 -23
- package/dist/lib/memory.d.ts.map +1 -1
- package/dist/lib/memory.js +751 -38
- package/dist/lib/memory.js.map +1 -1
- package/dist/lib/otel-env.d.ts +90 -0
- package/dist/lib/otel-env.d.ts.map +1 -0
- package/dist/lib/otel-env.js +98 -0
- package/dist/lib/otel-env.js.map +1 -0
- package/dist/lib/project-config.d.ts +167 -0
- package/dist/lib/project-config.d.ts.map +1 -1
- package/dist/lib/project-config.js +321 -5
- package/dist/lib/project-config.js.map +1 -1
- package/dist/lib/projects-registry.d.ts +82 -0
- package/dist/lib/projects-registry.d.ts.map +1 -0
- package/dist/lib/projects-registry.js +145 -0
- package/dist/lib/projects-registry.js.map +1 -0
- package/dist/lib/projects-registry.test.d.ts +2 -0
- package/dist/lib/projects-registry.test.d.ts.map +1 -0
- package/dist/lib/projects-registry.test.js +176 -0
- package/dist/lib/projects-registry.test.js.map +1 -0
- package/dist/lib/repo-guard-scope.d.ts +126 -0
- package/dist/lib/repo-guard-scope.d.ts.map +1 -0
- package/dist/lib/repo-guard-scope.js +249 -0
- package/dist/lib/repo-guard-scope.js.map +1 -0
- package/dist/lib/report-format.d.ts +132 -0
- package/dist/lib/report-format.d.ts.map +1 -0
- package/dist/lib/report-format.js +317 -0
- package/dist/lib/report-format.js.map +1 -0
- package/dist/lib/roster.d.ts +99 -0
- package/dist/lib/roster.d.ts.map +1 -0
- package/dist/lib/roster.js +336 -0
- package/dist/lib/roster.js.map +1 -0
- package/dist/lib/roster.test.d.ts +15 -0
- package/dist/lib/roster.test.d.ts.map +1 -0
- package/dist/lib/roster.test.js +299 -0
- package/dist/lib/roster.test.js.map +1 -0
- package/dist/lib/runtime/codex-adapter.d.ts.map +1 -1
- package/dist/lib/runtime/codex-adapter.js +5 -0
- package/dist/lib/runtime/codex-adapter.js.map +1 -1
- package/dist/lib/runtime/codex-config.d.ts +129 -0
- package/dist/lib/runtime/codex-config.d.ts.map +1 -1
- package/dist/lib/runtime/codex-config.js +225 -0
- package/dist/lib/runtime/codex-config.js.map +1 -1
- package/dist/lib/runtime/identity.d.ts +72 -0
- package/dist/lib/runtime/identity.d.ts.map +1 -0
- package/dist/lib/runtime/identity.js +128 -0
- package/dist/lib/runtime/identity.js.map +1 -0
- package/dist/lib/standards.d.ts +99 -0
- package/dist/lib/standards.d.ts.map +1 -0
- package/dist/lib/standards.js +201 -0
- package/dist/lib/standards.js.map +1 -0
- package/dist/lib/team-identity.d.ts +134 -0
- package/dist/lib/team-identity.d.ts.map +1 -0
- package/dist/lib/team-identity.js +193 -0
- package/dist/lib/team-identity.js.map +1 -0
- package/dist/lib/templates.d.ts +29 -2
- package/dist/lib/templates.d.ts.map +1 -1
- package/dist/lib/templates.js +1042 -82
- package/dist/lib/templates.js.map +1 -1
- package/dist/lib/terminal-ui.d.ts.map +1 -1
- package/dist/lib/terminal-ui.js +12 -1
- package/dist/lib/terminal-ui.js.map +1 -1
- package/dist/lib/test-project.d.ts +95 -0
- package/dist/lib/test-project.d.ts.map +1 -0
- package/dist/lib/test-project.js +103 -0
- package/dist/lib/test-project.js.map +1 -0
- package/dist/lib/vault.d.ts +60 -0
- package/dist/lib/vault.d.ts.map +1 -0
- package/dist/lib/vault.js +102 -0
- package/dist/lib/vault.js.map +1 -0
- package/dist/lib/vault.test.d.ts +17 -0
- package/dist/lib/vault.test.d.ts.map +1 -0
- package/dist/lib/vault.test.js +169 -0
- package/dist/lib/vault.test.js.map +1 -0
- package/dist/lib/window-view.d.ts +63 -0
- package/dist/lib/window-view.d.ts.map +1 -0
- package/dist/lib/window-view.js +217 -0
- package/dist/lib/window-view.js.map +1 -0
- package/dist/lib/window-view.test.d.ts +2 -0
- package/dist/lib/window-view.test.d.ts.map +1 -0
- package/dist/lib/window-view.test.js +168 -0
- package/dist/lib/window-view.test.js.map +1 -0
- package/dist/lib/worktree-sync.d.ts +439 -0
- package/dist/lib/worktree-sync.d.ts.map +1 -0
- package/dist/lib/worktree-sync.js +1167 -0
- package/dist/lib/worktree-sync.js.map +1 -0
- package/dist/lib/worktree.d.ts +58 -1
- package/dist/lib/worktree.d.ts.map +1 -1
- package/dist/lib/worktree.js +91 -4
- package/dist/lib/worktree.js.map +1 -1
- package/dist/standards/decision-request.md +98 -0
- package/dist/standards/fail-loud-standard.md +495 -0
- package/dist/standards/po-communication-standard.md +126 -0
- package/dist/standards/report-format.md +128 -0
- package/dist/standards/writing-standard.md +382 -0
- package/package.json +3 -2
- package/scripts/generate-claude.mjs +119 -46
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { phraseTurnReader, stripNonProse, SHIPPED_PHRASES } from './turn-reader.js';
|
|
3
|
+
import { principal } from './fixtures.js';
|
|
4
|
+
const reader = phraseTurnReader();
|
|
5
|
+
const ctx = { principal: principal(), turnIndex: 0 };
|
|
6
|
+
describe('sentences real sessions emitted', () => {
|
|
7
|
+
const observed = [
|
|
8
|
+
[
|
|
9
|
+
'a suppressed question',
|
|
10
|
+
'I did not ask you to arbitrate the mechanism-vs-intent rule because the session is ' +
|
|
11
|
+
'flagged non-interactive; the evidence column carries the facts for either scheme.',
|
|
12
|
+
],
|
|
13
|
+
['a judgement call handed over', 'Two judgment calls worth your attention.'],
|
|
14
|
+
[
|
|
15
|
+
'a false premise',
|
|
16
|
+
'The result is not what the task premise assumed, so the reconciliation has nothing to do.',
|
|
17
|
+
],
|
|
18
|
+
['an instruction not followed', 'I made no code change to slug.ts.'],
|
|
19
|
+
['an assumption taken', 'I assumed the fixture path is stable across worktrees.'],
|
|
20
|
+
];
|
|
21
|
+
for (const [label, text] of observed) {
|
|
22
|
+
it(`reports ${label}`, () => {
|
|
23
|
+
const signal = reader.read(text, ctx);
|
|
24
|
+
expect(signal).not.toBeNull();
|
|
25
|
+
expect(signal.weight).toBeGreaterThan(0);
|
|
26
|
+
expect(signal.quote.length).toBeGreaterThan(0);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
it('weights a suppressed question above an assumption', () => {
|
|
30
|
+
const suppressed = reader.read('I did not ask you about the schema.', ctx);
|
|
31
|
+
const assumed = reader.read('I assumed the schema is stable.', ctx);
|
|
32
|
+
expect(suppressed.weight).toBeGreaterThan(assumed.weight);
|
|
33
|
+
});
|
|
34
|
+
it('quotes the sentence rather than the whole message', () => {
|
|
35
|
+
const signal = reader.read('Ran the suite and it passed. I assumed the fixture path is stable. Moving on now.', ctx);
|
|
36
|
+
expect(signal.quote).toBe('I assumed the fixture path is stable.');
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
describe('ordinary work stays quiet', () => {
|
|
40
|
+
const quiet = [
|
|
41
|
+
'Read the config, ran the suite, 115 passed and 0 failed.',
|
|
42
|
+
'Opened PR #3062 against main and linked the issue.',
|
|
43
|
+
'The extractor resolves paths through the shell before the evaluator sees them.',
|
|
44
|
+
'Refactored three call sites and the types still check.',
|
|
45
|
+
'',
|
|
46
|
+
' ',
|
|
47
|
+
];
|
|
48
|
+
for (const text of quiet) {
|
|
49
|
+
it(`says nothing about ${JSON.stringify(text.slice(0, 40))}`, () => {
|
|
50
|
+
expect(reader.read(text, ctx)).toBeNull();
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
describe('text where the phrases mean nothing', () => {
|
|
55
|
+
it('ignores a quoted line, which is how this repository cites its own evidence', () => {
|
|
56
|
+
const text = [
|
|
57
|
+
'POC-3 records the moment in the session s4 transcript:',
|
|
58
|
+
'',
|
|
59
|
+
'> I did not ask you to arbitrate the mechanism-vs-intent rule because the',
|
|
60
|
+
'> session is flagged non-interactive.',
|
|
61
|
+
'',
|
|
62
|
+
'That is the class the ask mechanism misses.',
|
|
63
|
+
].join('\n');
|
|
64
|
+
expect(reader.read(text, ctx)).toBeNull();
|
|
65
|
+
});
|
|
66
|
+
it('ignores a fenced code block', () => {
|
|
67
|
+
const text = ['Here is the phrase table:', '```ts', "{ pattern: /I did not ask/ },", '```'].join('\n');
|
|
68
|
+
expect(reader.read(text, ctx)).toBeNull();
|
|
69
|
+
});
|
|
70
|
+
it('ignores an unterminated fence, since a truncated turn still ends mid-block', () => {
|
|
71
|
+
expect(reader.read('Writing it out:\n```\nI assumed nothing', ctx)).toBeNull();
|
|
72
|
+
});
|
|
73
|
+
it('ignores inline code', () => {
|
|
74
|
+
expect(reader.read('The test asserts `I did not ask` matches.', ctx)).toBeNull();
|
|
75
|
+
});
|
|
76
|
+
it('still reads prose that surrounds a code block', () => {
|
|
77
|
+
const text = ['```sh', 'npm test', '```', '', 'I assumed the suite covers the guard.'].join('\n');
|
|
78
|
+
expect(reader.read(text, ctx)).not.toBeNull();
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
describe('stripNonProse', () => {
|
|
82
|
+
it('removes fences, inline code and quoted lines and keeps the rest', () => {
|
|
83
|
+
const out = stripNonProse('keep\n> drop\n```\ndrop\n```\n`drop` keep2');
|
|
84
|
+
expect(out).toContain('keep');
|
|
85
|
+
expect(out).toContain('keep2');
|
|
86
|
+
expect(out).not.toContain('drop');
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
describe('the phrase table', () => {
|
|
90
|
+
it('stays small enough to trace every entry to an observed sentence', () => {
|
|
91
|
+
expect(SHIPPED_PHRASES.length).toBeLessThanOrEqual(30);
|
|
92
|
+
});
|
|
93
|
+
it('gives every entry a reason and a weight between 0 and 1', () => {
|
|
94
|
+
for (const phrase of SHIPPED_PHRASES) {
|
|
95
|
+
expect(phrase.reason.length).toBeGreaterThan(0);
|
|
96
|
+
expect(phrase.weight).toBeGreaterThan(0);
|
|
97
|
+
expect(phrase.weight).toBeLessThanOrEqual(1);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
it('takes a replacement table, which is how a measured reader displaces this one', () => {
|
|
101
|
+
const custom = phraseTurnReader([
|
|
102
|
+
{ pattern: /\bblocked on the schema\b/i, reason: 'named blocker', weight: 1 },
|
|
103
|
+
]);
|
|
104
|
+
expect(custom.read('I did not ask you.', ctx)).toBeNull();
|
|
105
|
+
expect(custom.read('I am blocked on the schema.', ctx)).not.toBeNull();
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
//# sourceMappingURL=turn-reader.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn-reader.test.js","sourceRoot":"","sources":["../../../../src/lib/harness/console/turn-reader.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,MAAM,MAAM,GAAG,gBAAgB,EAAE,CAAC;AAClC,MAAM,GAAG,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;AAErD,QAAQ,CAAC,iCAAiC,EAAE,GAAG,EAAE;IAC/C,MAAM,QAAQ,GAA4B;QACxC;YACE,uBAAuB;YACvB,qFAAqF;gBACnF,mFAAmF;SACtF;QACD,CAAC,8BAA8B,EAAE,0CAA0C,CAAC;QAC5E;YACE,iBAAiB;YACjB,2FAA2F;SAC5F;QACD,CAAC,6BAA6B,EAAE,mCAAmC,CAAC;QACpE,CAAC,qBAAqB,EAAE,wDAAwD,CAAC;KAClF,CAAC;IAEF,KAAK,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,QAAQ,EAAE,CAAC;QACrC,EAAE,CAAC,WAAW,KAAK,EAAE,EAAE,GAAG,EAAE;YAC1B,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YACtC,MAAM,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AAC;YAC9B,EAAE,OAAO,EAAE,4BAA4B,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC,EAAE;SAC9E,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC1D,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IACzE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the console holds, and what it hands to a renderer.
|
|
3
|
+
*
|
|
4
|
+
* The console consumes `HarnessEvent` and produces a ranked list of moments
|
|
5
|
+
* that need a person. It produces nothing else. POC-3 measured a list of 8
|
|
6
|
+
* items at five sessions of which 3 mattered, because 5 were informational
|
|
7
|
+
* `finished` lines, and that class scales one per session per task. So a
|
|
8
|
+
* moment that does not need a person is not an item here, at any rank.
|
|
9
|
+
*/
|
|
10
|
+
import type { Principal } from '../contract.js';
|
|
11
|
+
/**
|
|
12
|
+
* The four classes the console surfaces, in the order they outrank each other.
|
|
13
|
+
*
|
|
14
|
+
* `ask` a rule escalated to a person
|
|
15
|
+
* `refusal` a rule refused an action, so someone decides whether the rule or
|
|
16
|
+
* the attempt was wrong
|
|
17
|
+
* `stopped` a session ended, or stopped emitting anything
|
|
18
|
+
* `prose` an agent said in prose that it needs a decision
|
|
19
|
+
*
|
|
20
|
+
* `prose` is last on purpose. POC-3b judged a reader finding a second-tier
|
|
21
|
+
* signal and POC-3c left that judgement standing, on instability: 2 of 12
|
|
22
|
+
* moments were caught in every repetition. A class that changes answer between
|
|
23
|
+
* runs cannot outrank one the runtime states as fact.
|
|
24
|
+
*/
|
|
25
|
+
export type ItemKind = 'ask' | 'refusal' | 'stopped' | 'prose';
|
|
26
|
+
/** Why a session stopped, as far as the console can tell. */
|
|
27
|
+
export type StopKind = 'ended' | 'silent';
|
|
28
|
+
export interface ConsoleItem {
|
|
29
|
+
/** Stable across re-renders, so a restated moment updates a row rather than
|
|
30
|
+
* adding one. */
|
|
31
|
+
id: string;
|
|
32
|
+
kind: ItemKind;
|
|
33
|
+
sessionId: string;
|
|
34
|
+
principal: Principal;
|
|
35
|
+
/** When the underlying event happened, not when the console ranked it. */
|
|
36
|
+
at: string;
|
|
37
|
+
/** Consequence. Higher outranks lower. Class dominates; see rank.ts. */
|
|
38
|
+
score: number;
|
|
39
|
+
/** One line naming what the person has to decide. */
|
|
40
|
+
headline: string;
|
|
41
|
+
/** Supporting lines: the rule, the command, the quote. */
|
|
42
|
+
detail: string[];
|
|
43
|
+
/** How many times the same moment recurred. A refusal the agent retried is
|
|
44
|
+
* worse than one it accepted. */
|
|
45
|
+
repeats: number;
|
|
46
|
+
/** The console cannot vouch for this item. Only `prose` sets it today. */
|
|
47
|
+
lowConfidence?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The shape says the rule may be wrong rather than the attempt.
|
|
50
|
+
*
|
|
51
|
+
* POC-3 recorded both of its guard escalations as correct pushes for a wrong
|
|
52
|
+
* reason: a write-scope glob matched against a Bash command string, refusing
|
|
53
|
+
* an `ls` and a `find` that wrote nothing. It noted the ranking "has no
|
|
54
|
+
* category for 'your rule is wrong'". This is that category.
|
|
55
|
+
*/
|
|
56
|
+
suspectRule?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/** A prose reader's finding on one turn. */
|
|
59
|
+
export interface TurnSignal {
|
|
60
|
+
/** What the agent said, verbatim, trimmed to a readable length. */
|
|
61
|
+
quote: string;
|
|
62
|
+
/** Why that reads as needing a person. */
|
|
63
|
+
reason: string;
|
|
64
|
+
/** 0 to 1. Scales the item within the `prose` class and never lifts it out. */
|
|
65
|
+
weight: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Reads one turn of agent prose and says whether it needs a person.
|
|
69
|
+
*
|
|
70
|
+
* An interface rather than a function so the measured reader can replace the
|
|
71
|
+
* shipped one without touching the console. POC-3c's per-turn reader is the
|
|
72
|
+
* candidate; it is a model call, it costs about $0.017 a turn against a real
|
|
73
|
+
* median of 90 turns a session, and POC-3e has not yet reported whether the
|
|
74
|
+
* model was the limit. None of that is settled, so the console depends on the
|
|
75
|
+
* seam and not on any particular reader.
|
|
76
|
+
*/
|
|
77
|
+
export interface TurnReader {
|
|
78
|
+
read(text: string, ctx: {
|
|
79
|
+
principal: Principal;
|
|
80
|
+
turnIndex: number;
|
|
81
|
+
}): TurnSignal | null;
|
|
82
|
+
}
|
|
83
|
+
export interface ConsoleOptions {
|
|
84
|
+
/** Defaults to the shipped phrase reader. Pass `null` to run without one. */
|
|
85
|
+
reader?: TurnReader | null;
|
|
86
|
+
/**
|
|
87
|
+
* How long a live session may emit nothing before the console calls it
|
|
88
|
+
* silent. Default 5 minutes.
|
|
89
|
+
*
|
|
90
|
+
* POC-3 found the console and a person watching panes disagree about what a
|
|
91
|
+
* stall is, and said the product has to pick one deliberately. This picks
|
|
92
|
+
* liveness: every harness event resets the timer, including decisions that
|
|
93
|
+
* never reach a pane. A session fuzzing 105,000 inputs for 102 seconds is
|
|
94
|
+
* working, and the console says so where a person reading the pane concluded
|
|
95
|
+
* it was stuck. That is the signal the operator cannot see, which is the
|
|
96
|
+
* reason for the architecture, and it is the wrong call for any session whose
|
|
97
|
+
* work is invisible to the harness.
|
|
98
|
+
*/
|
|
99
|
+
silentAfterMs?: number;
|
|
100
|
+
}
|
|
101
|
+
/** What a subscriber is told when the list changes. */
|
|
102
|
+
export interface ConsoleChange {
|
|
103
|
+
items: ConsoleItem[];
|
|
104
|
+
/** Items present now that were absent at the previous notification. */
|
|
105
|
+
added: ConsoleItem[];
|
|
106
|
+
/** Ids present at the previous notification and absent now. */
|
|
107
|
+
removed: string[];
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
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,cAAc;IAC7B,6EAA6E;IAC7E,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC3B;;;;;;;;;;;;OAYG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,uDAAuD;AACvD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,uEAAuE;IACvE,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,+DAA+D;IAC/D,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/lib/harness/console/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The seams between the four pieces of the harness.
|
|
3
|
+
*
|
|
4
|
+
* Types only. No implementation lives here, and nothing here imports anything,
|
|
5
|
+
* so four streams can build against it at once without waiting for each other.
|
|
6
|
+
*
|
|
7
|
+
* The shape follows `docs/rule-format-proposal.md` section 4.2: extract typed
|
|
8
|
+
* attributes from a tool call first, then decide on the attributes. That split
|
|
9
|
+
* is the reason the pieces are separable at all. The extractor knows shell and
|
|
10
|
+
* filesystem semantics and knows nothing about policy. The evaluator knows
|
|
11
|
+
* policy and never parses a command string.
|
|
12
|
+
*
|
|
13
|
+
* tool call โโโถ extract() โโโถ Attributes โโโถ evaluate() โโโถ Decision
|
|
14
|
+
* โ
|
|
15
|
+
* โผ
|
|
16
|
+
* HarnessEvent โโโถ console
|
|
17
|
+
*
|
|
18
|
+
* Changing anything in this file affects every stream, so it changes by
|
|
19
|
+
* agreement rather than in passing.
|
|
20
|
+
*/
|
|
21
|
+
/** Who is acting. Measured need: 94% of repository writes come from subagents,
|
|
22
|
+
* so a rule that binds only a role governs the smaller share of the writing. */
|
|
23
|
+
export interface Principal {
|
|
24
|
+
/** Team slug, e.g. `product`. */
|
|
25
|
+
team: string;
|
|
26
|
+
/** Role from the roster, e.g. `implementation-engineer`. */
|
|
27
|
+
role: string;
|
|
28
|
+
/** Subagent identifier when a delegated agent is acting, else null. */
|
|
29
|
+
subagentId: string | null;
|
|
30
|
+
/** Session this call belongs to. */
|
|
31
|
+
sessionId: string;
|
|
32
|
+
}
|
|
33
|
+
export interface ToolCall {
|
|
34
|
+
name: string;
|
|
35
|
+
input: Record<string, unknown>;
|
|
36
|
+
/** Present from SDK 0.3 onward; identifies which call in a turn asked. */
|
|
37
|
+
callId?: string;
|
|
38
|
+
}
|
|
39
|
+
/** Where a rule can be enforced. A rule naming a surface that cannot run it is
|
|
40
|
+
* a compile error rather than a rule that silently never fires.
|
|
41
|
+
* POC-1c measured that read-only tools never reach the permission callback. */
|
|
42
|
+
export type Surface = 'permission-callback' | 'pre-tool-hook' | 'integration-lane' | 'remote';
|
|
43
|
+
/** What a tool call actually touches, in terms a policy can reason about.
|
|
44
|
+
* Produced by the extractor, consumed by the evaluator. */
|
|
45
|
+
export interface Attributes {
|
|
46
|
+
/** Normalised operation, e.g. `write`, `read`, `git.reset`, `git.push-force`. */
|
|
47
|
+
operation: string;
|
|
48
|
+
/** Absolute paths the call would write, resolved through the shell where needed.
|
|
49
|
+
* The guard-coverage measurement found write targets are the largest gap:
|
|
50
|
+
* 0 of 146 write-outside-the-worktree commands were refused. */
|
|
51
|
+
writes: string[];
|
|
52
|
+
/** Absolute paths the call would read. */
|
|
53
|
+
reads: string[];
|
|
54
|
+
/**
|
|
55
|
+
* The directory the call actually worked in, after any `cd` and any `git -C`.
|
|
56
|
+
*
|
|
57
|
+
* Separate from `reads` because a rule has to tell "the shell moved to
|
|
58
|
+
* /workspace" from "the command read /home/vscode/.claude/settings.json", and
|
|
59
|
+
* both are reads. Without it, a navigation rule either misses the first or
|
|
60
|
+
* refuses the second, and the control set contains the second.
|
|
61
|
+
*
|
|
62
|
+
* Measured need: 200 of the 319 `cd` commands that leave the worktree fold to
|
|
63
|
+
* operation `chdir` with no write target, so nothing else in `Attributes`
|
|
64
|
+
* carries the crossing (`docs/gate-coverage.md` section 3).
|
|
65
|
+
*
|
|
66
|
+
* Optional, and a rule that names it does not match when it is absent, so an
|
|
67
|
+
* extractor that does not set it disables that clause rather than refusing
|
|
68
|
+
* every call.
|
|
69
|
+
*/
|
|
70
|
+
workingDir?: string;
|
|
71
|
+
/** True when the extractor could not determine the targets. A rule must be
|
|
72
|
+
* able to decide on this rather than receive an empty array that reads as
|
|
73
|
+
* "touches nothing". #5434 is what happens when uncertainty looks like safety. */
|
|
74
|
+
uncertain: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Which kind of uncertainty, because a rule answers the two differently.
|
|
77
|
+
*
|
|
78
|
+
* targets a path this call names could not be resolved: `echo hi > $(pick)`,
|
|
79
|
+
* `sed -i s/a/b/ $TARGET`, `cd $X && rm -rf build`. The call is
|
|
80
|
+
* known to write and the destination is not known.
|
|
81
|
+
* effects a command the extractor does not model ran: `npm test`,
|
|
82
|
+
* `mx memories get`, `./deploy.sh`. Nothing is known about what it
|
|
83
|
+
* touches, including whether it touches anything.
|
|
84
|
+
* both at least one of each.
|
|
85
|
+
*
|
|
86
|
+
* Measured need. Without this, a call that writes a resolved path inside the
|
|
87
|
+
* worktree and also runs `mx` sets one flag, and a write rule with
|
|
88
|
+
* `onUncertain: 'escalate'` escalates on the `mx`. That was 62 of the 74
|
|
89
|
+
* ordinary commands the rules refused in `docs/gate-coverage.md` section 4.
|
|
90
|
+
*
|
|
91
|
+
* Optional, and absent means `targets`, so a consumer written before this
|
|
92
|
+
* field keeps its behaviour.
|
|
93
|
+
*/
|
|
94
|
+
uncertainAbout?: 'targets' | 'effects' | 'both';
|
|
95
|
+
/** Why it was uncertain, for the challenge path and for the operator. */
|
|
96
|
+
uncertainReason?: string;
|
|
97
|
+
/** Raw command text when the call was a shell invocation, for the record only. */
|
|
98
|
+
command?: string;
|
|
99
|
+
}
|
|
100
|
+
export type Effect = 'allow' | 'deny' | 'ask';
|
|
101
|
+
/** Observe mode lets a rule report what it would have caught before it blocks.
|
|
102
|
+
* A rule earns its way to `block`. */
|
|
103
|
+
export type Mode = 'observe' | 'block';
|
|
104
|
+
export interface Decision {
|
|
105
|
+
effect: Effect;
|
|
106
|
+
/** Rule identifiers that produced this, most specific first. Empty means no
|
|
107
|
+
* rule matched, which is distinct from a rule deciding to allow. */
|
|
108
|
+
matchedRules: string[];
|
|
109
|
+
/** Shown to the agent when refused. Names the rule and explains it. */
|
|
110
|
+
reason?: string;
|
|
111
|
+
/** True when a rule matched in observe mode and did not enforce. */
|
|
112
|
+
observedOnly?: boolean;
|
|
113
|
+
}
|
|
114
|
+
export interface Rule {
|
|
115
|
+
id: string;
|
|
116
|
+
statement: string;
|
|
117
|
+
rationale: string;
|
|
118
|
+
/** Which principals it binds. Absent means every principal in scope. */
|
|
119
|
+
principals?: Partial<Pick<Principal, 'team' | 'role'>>;
|
|
120
|
+
surfaces: Surface[];
|
|
121
|
+
mode: Mode;
|
|
122
|
+
effect: Effect;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* A decision an agent needs a person to make.
|
|
126
|
+
*
|
|
127
|
+
* This is the standard shape for asking, and it exists because the prose form
|
|
128
|
+
* does not work. Measured over 2026-08-04 to 2026-08-11: 152 turns asked for a
|
|
129
|
+
* decision, 145 of them ran to 600 characters or more, and 5 held an explicit
|
|
130
|
+
* options block. The other 97% left the reader to work out what was being
|
|
131
|
+
* asked and what the choices were, which is not a decision request, it is a
|
|
132
|
+
* status update with a question mark.
|
|
133
|
+
*
|
|
134
|
+
* The five that did it show the shape. One of them let a reader settle a
|
|
135
|
+
* production branch-protection question in about thirty seconds.
|
|
136
|
+
*/
|
|
137
|
+
export interface DecisionRequest {
|
|
138
|
+
/** One line. What has to be decided, phrased so it can be answered. */
|
|
139
|
+
question: string;
|
|
140
|
+
/** What is true, and how it was established. A claim with no source is a
|
|
141
|
+
* claim the reader has to go and check, which is the cost this avoids. */
|
|
142
|
+
situation: string;
|
|
143
|
+
/** At least two. One option is a notification, not a decision. */
|
|
144
|
+
options: string[];
|
|
145
|
+
/** Which one, and the risk of taking it. Absent means the agent has no view,
|
|
146
|
+
* which is itself worth the reader knowing. */
|
|
147
|
+
recommendation?: string;
|
|
148
|
+
/** What degrades while this goes unanswered. Absent means nothing does, and
|
|
149
|
+
* then it can wait. */
|
|
150
|
+
costOfWaiting?: string;
|
|
151
|
+
/** When the decision stops being available. */
|
|
152
|
+
deadline?: string;
|
|
153
|
+
}
|
|
154
|
+
/** Stream: attribute extraction. Owns shell and path semantics, owns nothing else. */
|
|
155
|
+
export interface Extractor {
|
|
156
|
+
extract(call: ToolCall, context: {
|
|
157
|
+
cwd: string;
|
|
158
|
+
worktreeRoot: string;
|
|
159
|
+
}): Attributes;
|
|
160
|
+
}
|
|
161
|
+
/** Stream: the rule engine. Owns policy, never parses a command. */
|
|
162
|
+
export interface Evaluator {
|
|
163
|
+
evaluate(attrs: Attributes, principal: Principal, surface: Surface): Decision;
|
|
164
|
+
/** Rules the ruleset holds that the given surface cannot enforce. The compiler
|
|
165
|
+
* refuses a ruleset where this is non-empty for a surface it targets. */
|
|
166
|
+
unenforceableOn(surface: Surface): Rule[];
|
|
167
|
+
}
|
|
168
|
+
/** Stream: the console. Everything the harness knows, as it happens.
|
|
169
|
+
* POC-3 measured a push surface noticing in 0 to 1 ms against 5.6 to 67.4
|
|
170
|
+
* seconds for a person rotating through panes. */
|
|
171
|
+
export type HarnessEvent = {
|
|
172
|
+
type: 'session-start';
|
|
173
|
+
at: string;
|
|
174
|
+
principal: Principal;
|
|
175
|
+
credential: CredentialCheck;
|
|
176
|
+
} | {
|
|
177
|
+
type: 'decision';
|
|
178
|
+
at: string;
|
|
179
|
+
principal: Principal;
|
|
180
|
+
attrs: Attributes;
|
|
181
|
+
decision: Decision;
|
|
182
|
+
} | {
|
|
183
|
+
type: 'turn';
|
|
184
|
+
at: string;
|
|
185
|
+
principal: Principal;
|
|
186
|
+
text: string;
|
|
187
|
+
turnIndex: number;
|
|
188
|
+
} | {
|
|
189
|
+
type: 'session-end';
|
|
190
|
+
at: string;
|
|
191
|
+
principal: Principal;
|
|
192
|
+
reason: string;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* `declared` means the agent used the mechanism. `inferred-from-prose` means
|
|
196
|
+
* something read it out of what the agent wrote, which is a bridge for the
|
|
197
|
+
* 97% that narrate instead of asking, and is not as trustworthy. The console
|
|
198
|
+
* shows which, because a reader deciding on a reconstructed request should
|
|
199
|
+
* know it was reconstructed.
|
|
200
|
+
*/
|
|
201
|
+
| {
|
|
202
|
+
type: 'decision-request';
|
|
203
|
+
at: string;
|
|
204
|
+
principal: Principal;
|
|
205
|
+
request: DecisionRequest;
|
|
206
|
+
source: 'declared' | 'inferred-from-prose';
|
|
207
|
+
/** Where the agent said it, for a reader who wants the original. */
|
|
208
|
+
turnIndex?: number;
|
|
209
|
+
};
|
|
210
|
+
export interface EventSink {
|
|
211
|
+
emit(event: HarnessEvent): void;
|
|
212
|
+
}
|
|
213
|
+
/** Stream: the harness core. Verified at startup, not assumed.
|
|
214
|
+
* POC-1c found one permission setting that disables the callback silently,
|
|
215
|
+
* which is the 2026-08-01 failure shape. */
|
|
216
|
+
export interface SelfCheck {
|
|
217
|
+
/** Proves the permission callback fires by issuing a call that must be refused.
|
|
218
|
+
* A session refuses to start when this returns false. */
|
|
219
|
+
callbackFires(): Promise<boolean>;
|
|
220
|
+
}
|
|
221
|
+
/** POC-2 established billing follows the credential in the environment rather
|
|
222
|
+
* than the code, so a container starting with an API key moves to metered
|
|
223
|
+
* billing with no error. For a one-person company that is an uncapped bill. */
|
|
224
|
+
export interface CredentialCheck {
|
|
225
|
+
kind: 'subscription' | 'api-key' | 'unknown';
|
|
226
|
+
/** Never the credential itself. A description safe to log and to display. */
|
|
227
|
+
source: string;
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../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M,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The seams between the four pieces of the harness.
|
|
3
|
+
*
|
|
4
|
+
* Types only. No implementation lives here, and nothing here imports anything,
|
|
5
|
+
* so four streams can build against it at once without waiting for each other.
|
|
6
|
+
*
|
|
7
|
+
* The shape follows `docs/rule-format-proposal.md` section 4.2: extract typed
|
|
8
|
+
* attributes from a tool call first, then decide on the attributes. That split
|
|
9
|
+
* is the reason the pieces are separable at all. The extractor knows shell and
|
|
10
|
+
* filesystem semantics and knows nothing about policy. The evaluator knows
|
|
11
|
+
* policy and never parses a command string.
|
|
12
|
+
*
|
|
13
|
+
* tool call โโโถ extract() โโโถ Attributes โโโถ evaluate() โโโถ Decision
|
|
14
|
+
* โ
|
|
15
|
+
* โผ
|
|
16
|
+
* HarnessEvent โโโถ console
|
|
17
|
+
*
|
|
18
|
+
* Changing anything in this file affects every stream, so it changes by
|
|
19
|
+
* agreement rather than in passing.
|
|
20
|
+
*/
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../src/lib/harness/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CredentialCheck } from './contract.js';
|
|
2
|
+
export interface CredentialCheckOptions {
|
|
3
|
+
env?: NodeJS.ProcessEnv;
|
|
4
|
+
/** Overridable for tests. Defaults to the real credential file location. */
|
|
5
|
+
credentialsFile?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function checkCredential(opts?: CredentialCheckOptions): CredentialCheck;
|
|
8
|
+
/**
|
|
9
|
+
* Should a session refuse to start on this credential?
|
|
10
|
+
*
|
|
11
|
+
* Metered billing is a decision with a cost attached, so it is allowed only
|
|
12
|
+
* when the operator has said so. `unknown` starts, because refusing on an
|
|
13
|
+
* environment we failed to classify would break sessions for a reason the
|
|
14
|
+
* operator cannot act on, and the runtime will produce a real error of its own
|
|
15
|
+
* if the credential is genuinely absent.
|
|
16
|
+
*/
|
|
17
|
+
export declare function refuseToStart(check: CredentialCheck, opts?: {
|
|
18
|
+
allowMetered?: boolean;
|
|
19
|
+
}): {
|
|
20
|
+
refuse: boolean;
|
|
21
|
+
message?: string;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=credential.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential.d.ts","sourceRoot":"","sources":["../../../src/lib/harness/credential.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAQrD,MAAM,WAAW,sBAAsB;IACrC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,4EAA4E;IAC5E,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,eAAe,CAAC,IAAI,GAAE,sBAA2B,GAAG,eAAe,CAyBlF;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,eAAe,EACtB,IAAI,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GACpC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CA+BvC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which credential a session is about to start with.
|
|
3
|
+
*
|
|
4
|
+
* POC-2 established that billing follows the credential in the environment
|
|
5
|
+
* rather than anything in the code, on both vendors. A container that starts
|
|
6
|
+
* with an API key and no subscription credential moves to metered billing with
|
|
7
|
+
* no error and no prompt. For a one-person company that is an uncapped bill,
|
|
8
|
+
* and the harness is the only component that sees the environment at session
|
|
9
|
+
* start.
|
|
10
|
+
*
|
|
11
|
+
* This never reads, returns or logs a credential value. It reports which kind
|
|
12
|
+
* is present and where that conclusion came from.
|
|
13
|
+
*/
|
|
14
|
+
import { existsSync } from 'fs';
|
|
15
|
+
import { homedir } from 'os';
|
|
16
|
+
import { join } from 'path';
|
|
17
|
+
/** Environment variables that route a session to metered API billing. */
|
|
18
|
+
const METERED_VARS = ['ANTHROPIC_API_KEY', 'ANTHROPIC_AUTH_TOKEN'];
|
|
19
|
+
/** Environment variables that carry a subscription credential. */
|
|
20
|
+
const SUBSCRIPTION_VARS = ['CLAUDE_CODE_OAUTH_TOKEN'];
|
|
21
|
+
export function checkCredential(opts = {}) {
|
|
22
|
+
const env = opts.env ?? process.env;
|
|
23
|
+
const credentialsFile = opts.credentialsFile ?? join(homedir(), '.claude', '.credentials.json');
|
|
24
|
+
// A metered variable wins even when a subscription credential also exists,
|
|
25
|
+
// because that is the order the runtime resolves them. Reporting the more
|
|
26
|
+
// expensive answer when both are present is the safe direction to be wrong in.
|
|
27
|
+
const metered = METERED_VARS.filter((v) => (env[v] ?? '').trim() !== '');
|
|
28
|
+
if (metered.length > 0) {
|
|
29
|
+
return { kind: 'api-key', source: `${metered.join(' and ')} set in the environment` };
|
|
30
|
+
}
|
|
31
|
+
const subscriptionVar = SUBSCRIPTION_VARS.find((v) => (env[v] ?? '').trim() !== '');
|
|
32
|
+
if (subscriptionVar) {
|
|
33
|
+
return { kind: 'subscription', source: `${subscriptionVar} set in the environment` };
|
|
34
|
+
}
|
|
35
|
+
if (existsSync(credentialsFile)) {
|
|
36
|
+
return { kind: 'subscription', source: `credential file present at ${credentialsFile}` };
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
kind: 'unknown',
|
|
40
|
+
source: 'no metered variable, no subscription variable and no credential file',
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Should a session refuse to start on this credential?
|
|
45
|
+
*
|
|
46
|
+
* Metered billing is a decision with a cost attached, so it is allowed only
|
|
47
|
+
* when the operator has said so. `unknown` starts, because refusing on an
|
|
48
|
+
* environment we failed to classify would break sessions for a reason the
|
|
49
|
+
* operator cannot act on, and the runtime will produce a real error of its own
|
|
50
|
+
* if the credential is genuinely absent.
|
|
51
|
+
*/
|
|
52
|
+
export function refuseToStart(check, opts = {}) {
|
|
53
|
+
// `unknown` starts, and now says why it expects trouble.
|
|
54
|
+
//
|
|
55
|
+
// On 2026-08-18 a live proof run started on `unknown` and died about thirty
|
|
56
|
+
// seconds later with "Not logged in ยท Please run /login". The check had
|
|
57
|
+
// classified correctly: the WSL home holds `.claude/` with no credential
|
|
58
|
+
// file, and the credential lives in the Windows home the session cannot see.
|
|
59
|
+
// Saying nothing was the wrong call. The operator can act on this one, and a
|
|
60
|
+
// warning before the session starts is cheaper than a failure after it.
|
|
61
|
+
if (check.kind === 'unknown') {
|
|
62
|
+
return {
|
|
63
|
+
refuse: false,
|
|
64
|
+
message: `No credential found in this environment (${check.source}).\n` +
|
|
65
|
+
` The session will start and will probably fail to authenticate. If it does, sign in\n` +
|
|
66
|
+
` from this environment rather than from another one: a credential in a different\n` +
|
|
67
|
+
` home directory is not visible here.`,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
if (check.kind === 'api-key' && opts.allowMetered !== true) {
|
|
71
|
+
return {
|
|
72
|
+
refuse: true,
|
|
73
|
+
message: `Refusing to start: this session would bill as metered API usage (${check.source}).\n` +
|
|
74
|
+
` Billing follows the environment credential rather than the code, so this is an\n` +
|
|
75
|
+
` uncapped cost rather than a subscription one. Unset the variable to use the\n` +
|
|
76
|
+
` subscription, or pass --allow-metered if metered billing is intended.`,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return { refuse: false };
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=credential.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential.js","sourceRoot":"","sources":["../../../src/lib/harness/credential.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,UAAU,EAAE,M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CAAC;QAChC,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,8BAA8B,eAAe,EAAE,EAAE,CAAC;IAC3F,CAAC;IAED,OAAO;QACL,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,sEAAsE;KAC/E,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAsB,EACtB,OAAmC,EAAE;IAErC,yDAAyD;IACzD,EAAE;IACF,4EAA4E;IAC5E,wEAAwE;IACxE,yEAAyE;IACzE,6EAA6E;IAC7E,6EAA6E;IAC7E,wEAAwE;IACxE,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO;YACL,MAAM,EAAE,KAAK;YACb,OAAO,EACL,4CAA4C,KAAK,CAAC,MAAM,MAAM;gBAC9D,wFAAwF;gBACxF,qFAAqF;gBACrF,uCAAuC;SAC1C,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,YAAY,KAAK,IAAI,EAAE,CAAC;QAC3D,OAAO;YACL,MAAM,EAAE,IAAI;YACZ,OAAO,EACL,oEAAoE,KAAK,CAAC,MAAM,MAAM;gBACtF,oFAAoF;gBACpF,iFAAiF;gBACjF,yEAAyE;SAC5E,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential.test.d.ts","sourceRoot":"","sources":["../../../src/lib/harness/credential.test.ts"],"names":[],"mappings":""}
|