@openrig/cli 0.5.2 → 0.5.3
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/daemon/assets/plugins/openrig-core/hooks/claude.json +36 -0
- package/daemon/assets/plugins/openrig-core/hooks/codex.json +27 -0
- package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus.cjs +132 -0
- package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/SKILL.md +35 -3
- package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/precompact-hook.mjs +8 -95
- package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/restore-from-jsonl.mjs +63 -20
- package/daemon/assets/plugins/openrig-core/skills/forming-an-openrig-mental-model/SKILL.md +6 -2
- package/daemon/assets/plugins/openrig-core/skills/messaging-the-human/SKILL.md +28 -2
- package/daemon/assets/plugins/openrig-core/skills/mission-slice-sop/SKILL.md +42 -52
- package/daemon/assets/plugins/openrig-core/skills/openrig-skills/SKILL.md +23 -1
- package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +7 -2
- package/daemon/assets/plugins/openrig-core/skills/orienting-to-an-inherited-seat/CHANGELOG.md +64 -0
- package/daemon/assets/plugins/openrig-core/skills/orienting-to-an-inherited-seat/SKILL.md +235 -0
- package/daemon/assets/plugins/openrig-core/skills/queue-handoff/SKILL.md +31 -1
- package/daemon/assets/plugins/openrig-core/skills/retiring-and-inheriting-a-seat/CHANGELOG.md +48 -0
- package/daemon/assets/plugins/openrig-core/skills/retiring-and-inheriting-a-seat/SKILL.md +211 -0
- package/daemon/assets/plugins/openrig-core/skills/seat-continuity-and-handover/SKILL.md +8 -0
- package/daemon/assets/plugins/openrig-core/skills/software-for-agents/SKILL.md +28 -1
- package/daemon/context-packs/skills/core/agent-starters/SKILL.md +132 -0
- package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +9 -0
- package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/SKILL.md +112 -0
- package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +9 -0
- package/daemon/context-packs/skills/core/attention-queue/SKILL.md +264 -0
- package/daemon/context-packs/skills/core/attention-queue/manifest.yaml +9 -0
- package/daemon/context-packs/skills/core/cross-host-rig-commands/SKILL.md +195 -0
- package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +9 -0
- package/daemon/context-packs/skills/core/human-in-the-loop/SKILL.md +104 -0
- package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +9 -0
- package/daemon/context-packs/skills/core/openrig-architect/SKILL.md +378 -0
- package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +9 -0
- package/daemon/context-packs/skills/core/openrig-cmux/SKILL.md +81 -0
- package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +9 -0
- package/daemon/context-packs/skills/core/openrig-herdr/SKILL.md +153 -0
- package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +9 -0
- package/daemon/context-packs/skills/core/openrig-upgrade/SKILL.md +460 -0
- package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +9 -0
- package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/SKILL.md +101 -0
- package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +9 -0
- package/daemon/context-packs/skills/core/rig-lifecycle/SKILL.md +127 -0
- package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +9 -0
- package/daemon/context-packs/skills/core/session-source-fork/SKILL.md +160 -0
- package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +9 -0
- package/daemon/context-packs/skills/core/specification-system/SKILL.md +103 -0
- package/daemon/context-packs/skills/core/specification-system/manifest.yaml +9 -0
- package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/SKILL.md +118 -0
- package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +9 -0
- package/daemon/context-packs/skills/core/watchdog/SKILL.md +126 -0
- package/daemon/context-packs/skills/core/watchdog/manifest.yaml +9 -0
- package/daemon/context-packs/skills/pm/backlog-capture/SKILL.md +43 -0
- package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +9 -0
- package/daemon/context-packs/skills/pm/context-builder/SKILL.md +87 -0
- package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +9 -0
- package/daemon/context-packs/skills/pm/exec-summary/SKILL.md +84 -0
- package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +9 -0
- package/daemon/context-packs/skills/pm/office-hours/SKILL.md +129 -0
- package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +9 -0
- package/daemon/context-packs/skills/pm/plan-review/SKILL.md +98 -0
- package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +9 -0
- package/daemon/context-packs/skills/pm/requirements-writer/SKILL.md +113 -0
- package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +9 -0
- package/daemon/context-packs/skills/pm/ui-mockup/SKILL.md +76 -0
- package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +9 -0
- package/daemon/context-packs/skills/pods/development-team/SKILL.md +156 -0
- package/daemon/context-packs/skills/pods/development-team/manifest.yaml +9 -0
- package/daemon/context-packs/skills/pods/orchestration-team/SKILL.md +307 -0
- package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +9 -0
- package/daemon/context-packs/skills/pods/oversight-team/SKILL.md +106 -0
- package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +9 -0
- package/daemon/context-packs/skills/pods/review-team/SKILL.md +213 -0
- package/daemon/context-packs/skills/pods/review-team/manifest.yaml +9 -0
- package/daemon/context-packs/skills/process/agent-browser/LOCAL-INSIGHTS.md +189 -0
- package/daemon/context-packs/skills/process/agent-browser/OPENRIG.md +40 -0
- package/daemon/context-packs/skills/process/agent-browser/SKILL.md +427 -0
- package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +13 -0
- package/daemon/context-packs/skills/process/brainstorming/OPENRIG.md +48 -0
- package/daemon/context-packs/skills/process/brainstorming/SKILL.md +107 -0
- package/daemon/context-packs/skills/process/brainstorming/manifest.yaml +11 -0
- package/daemon/context-packs/skills/process/context-engineering/SKILL.md +479 -0
- package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +9 -0
- package/daemon/context-packs/skills/process/dogfood/SKILL.md +225 -0
- package/daemon/context-packs/skills/process/dogfood/manifest.yaml +13 -0
- package/daemon/context-packs/skills/process/dogfood/references/issue-taxonomy.md +109 -0
- package/daemon/context-packs/skills/process/dogfood/templates/dogfood-report-template.md +53 -0
- package/daemon/context-packs/skills/process/executing-plans/OPENRIG.md +56 -0
- package/daemon/context-packs/skills/process/executing-plans/SKILL.md +94 -0
- package/daemon/context-packs/skills/process/executing-plans/manifest.yaml +11 -0
- package/daemon/context-packs/skills/process/frontend-design/LICENSE.txt +177 -0
- package/daemon/context-packs/skills/process/frontend-design/SKILL.md +50 -0
- package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +11 -0
- package/daemon/context-packs/skills/process/systematic-debugging/SKILL.md +301 -0
- package/daemon/context-packs/skills/process/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/daemon/context-packs/skills/process/systematic-debugging/condition-based-waiting.md +115 -0
- package/daemon/context-packs/skills/process/systematic-debugging/defense-in-depth.md +122 -0
- package/daemon/context-packs/skills/process/systematic-debugging/find-polluter.sh +63 -0
- package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +19 -0
- package/daemon/context-packs/skills/process/systematic-debugging/root-cause-tracing.md +169 -0
- package/daemon/context-packs/skills/process/test-driven-development/SKILL.md +385 -0
- package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +11 -0
- package/daemon/context-packs/skills/process/test-driven-development/testing-anti-patterns.md +299 -0
- package/daemon/context-packs/skills/process/using-superpowers/OPENRIG.md +48 -0
- package/daemon/context-packs/skills/process/using-superpowers/SKILL.md +106 -0
- package/daemon/context-packs/skills/process/using-superpowers/manifest.yaml +11 -0
- package/daemon/context-packs/skills/process/verification-before-completion/SKILL.md +155 -0
- package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +9 -0
- package/daemon/context-packs/skills/process/writing-plans/OPENRIG.md +52 -0
- package/daemon/context-packs/skills/process/writing-plans/SKILL.md +126 -0
- package/daemon/context-packs/skills/process/writing-plans/manifest.yaml +11 -0
- package/daemon/context-packs/world/install/01-world-from-primitives.md +97 -0
- package/daemon/context-packs/world/install/02-permission-self-sleep.md +141 -0
- package/daemon/context-packs/world/install/03-what-this-is-for.md +86 -0
- package/daemon/context-packs/world/install/04-ontology.md +790 -0
- package/daemon/context-packs/world/install/05-harness-power-use.md +355 -0
- package/daemon/context-packs/world/install/06-a-competent-turn.md +225 -0
- package/daemon/context-packs/world/install/manifest.yaml +125 -0
- package/daemon/context-packs/world/install/reference-material.md +125 -0
- package/daemon/context-packs/world/install/what-you-can-do.md +416 -0
- package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-code-adapter.js +7 -4
- package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
- package/daemon/dist/adapters/claude-resume.js +2 -2
- package/daemon/dist/adapters/claude-resume.js.map +1 -1
- package/daemon/dist/adapters/tmux.d.ts +10 -2
- package/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux.js +27 -7
- package/daemon/dist/adapters/tmux.js.map +1 -1
- package/daemon/dist/adapters/yolo-mode.d.ts +18 -0
- package/daemon/dist/adapters/yolo-mode.d.ts.map +1 -1
- package/daemon/dist/adapters/yolo-mode.js +21 -0
- package/daemon/dist/adapters/yolo-mode.js.map +1 -1
- package/daemon/dist/build-info.js +3 -3
- package/daemon/dist/domain/codex-thread-id.d.ts +95 -0
- package/daemon/dist/domain/codex-thread-id.d.ts.map +1 -1
- package/daemon/dist/domain/codex-thread-id.js +171 -2
- package/daemon/dist/domain/codex-thread-id.js.map +1 -1
- package/daemon/dist/domain/context-packs/context-pack-types.d.ts +48 -0
- package/daemon/dist/domain/context-packs/context-pack-types.d.ts.map +1 -1
- package/daemon/dist/domain/context-packs/context-pack-types.js +8 -0
- package/daemon/dist/domain/context-packs/context-pack-types.js.map +1 -1
- package/daemon/dist/domain/context-packs/manifest-parser.d.ts.map +1 -1
- package/daemon/dist/domain/context-packs/manifest-parser.js +234 -2
- package/daemon/dist/domain/context-packs/manifest-parser.js.map +1 -1
- package/daemon/dist/domain/context-packs/probe-eval-bridge.d.ts +34 -0
- package/daemon/dist/domain/context-packs/probe-eval-bridge.d.ts.map +1 -0
- package/daemon/dist/domain/context-packs/probe-eval-bridge.js +38 -0
- package/daemon/dist/domain/context-packs/probe-eval-bridge.js.map +1 -0
- package/daemon/dist/domain/context-packs/profile-composer.d.ts +49 -0
- package/daemon/dist/domain/context-packs/profile-composer.d.ts.map +1 -0
- package/daemon/dist/domain/context-packs/profile-composer.js +125 -0
- package/daemon/dist/domain/context-packs/profile-composer.js.map +1 -0
- package/daemon/dist/domain/context-packs/profile-source-resolver.d.ts +53 -0
- package/daemon/dist/domain/context-packs/profile-source-resolver.d.ts.map +1 -0
- package/daemon/dist/domain/context-packs/profile-source-resolver.js +129 -0
- package/daemon/dist/domain/context-packs/profile-source-resolver.js.map +1 -0
- package/daemon/dist/domain/context-packs/seat-recap-store.d.ts +48 -0
- package/daemon/dist/domain/context-packs/seat-recap-store.d.ts.map +1 -0
- package/daemon/dist/domain/context-packs/seat-recap-store.js +123 -0
- package/daemon/dist/domain/context-packs/seat-recap-store.js.map +1 -0
- package/daemon/dist/domain/markdown-address.d.ts +56 -0
- package/daemon/dist/domain/markdown-address.d.ts.map +1 -0
- package/daemon/dist/domain/markdown-address.js +188 -0
- package/daemon/dist/domain/markdown-address.js.map +1 -0
- package/daemon/dist/domain/model-divergence/current-generation-record.d.ts +8 -2
- package/daemon/dist/domain/model-divergence/current-generation-record.d.ts.map +1 -1
- package/daemon/dist/domain/model-divergence/current-generation-record.js +1 -1
- package/daemon/dist/domain/model-divergence/current-generation-record.js.map +1 -1
- package/daemon/dist/domain/model-divergence/model-divergence-monitor.d.ts +33 -21
- package/daemon/dist/domain/model-divergence/model-divergence-monitor.d.ts.map +1 -1
- package/daemon/dist/domain/model-divergence/model-divergence-monitor.js +64 -55
- package/daemon/dist/domain/model-divergence/model-divergence-monitor.js.map +1 -1
- package/daemon/dist/domain/periodic-snapshot-scheduler.d.ts +4 -0
- package/daemon/dist/domain/periodic-snapshot-scheduler.d.ts.map +1 -1
- package/daemon/dist/domain/periodic-snapshot-scheduler.js +5 -1
- package/daemon/dist/domain/periodic-snapshot-scheduler.js.map +1 -1
- package/daemon/dist/domain/permission-drift-observer.d.ts.map +1 -1
- package/daemon/dist/domain/permission-drift-observer.js +6 -1
- package/daemon/dist/domain/permission-drift-observer.js.map +1 -1
- package/daemon/dist/domain/process-census.d.ts +25 -0
- package/daemon/dist/domain/process-census.d.ts.map +1 -0
- package/daemon/dist/domain/process-census.js +47 -0
- package/daemon/dist/domain/process-census.js.map +1 -0
- package/daemon/dist/domain/resume-metadata-refresher.d.ts +31 -2
- package/daemon/dist/domain/resume-metadata-refresher.d.ts.map +1 -1
- package/daemon/dist/domain/resume-metadata-refresher.js +64 -29
- package/daemon/dist/domain/resume-metadata-refresher.js.map +1 -1
- package/daemon/dist/domain/review/compose.d.ts +5 -26
- package/daemon/dist/domain/review/compose.d.ts.map +1 -1
- package/daemon/dist/domain/review/compose.js +31 -57
- package/daemon/dist/domain/review/compose.js.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts +4 -0
- package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.js +39 -0
- package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
- package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-schema.js +19 -3
- package/daemon/dist/domain/rigspec-schema.js.map +1 -1
- package/daemon/dist/domain/scope/logical-checkbox.d.ts +26 -0
- package/daemon/dist/domain/scope/logical-checkbox.d.ts.map +1 -0
- package/daemon/dist/domain/scope/logical-checkbox.js +65 -0
- package/daemon/dist/domain/scope/logical-checkbox.js.map +1 -0
- package/daemon/dist/domain/scope/plan-lock-artifacts.d.ts +1 -1
- package/daemon/dist/domain/scope/plan-lock-artifacts.d.ts.map +1 -1
- package/daemon/dist/domain/scope/plan-lock-artifacts.js +2 -2
- package/daemon/dist/domain/scope/plan-lock-artifacts.js.map +1 -1
- package/daemon/dist/domain/scope/scaffold-placeholder.d.ts +22 -0
- package/daemon/dist/domain/scope/scaffold-placeholder.d.ts.map +1 -1
- package/daemon/dist/domain/scope/scaffold-placeholder.js +24 -0
- package/daemon/dist/domain/scope/scaffold-placeholder.js.map +1 -1
- package/daemon/dist/domain/seat-activity-service.d.ts +1 -0
- package/daemon/dist/domain/seat-activity-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-activity-service.js +39 -23
- package/daemon/dist/domain/seat-activity-service.js.map +1 -1
- package/daemon/dist/domain/seat-handover-service.d.ts +22 -0
- package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-handover-service.js +32 -2
- package/daemon/dist/domain/seat-handover-service.js.map +1 -1
- package/daemon/dist/domain/session-transport.d.ts +8 -0
- package/daemon/dist/domain/session-transport.d.ts.map +1 -1
- package/daemon/dist/domain/session-transport.js +116 -0
- package/daemon/dist/domain/session-transport.js.map +1 -1
- package/daemon/dist/domain/shell-classifier.d.ts +23 -0
- package/daemon/dist/domain/shell-classifier.d.ts.map +1 -0
- package/daemon/dist/domain/shell-classifier.js +36 -0
- package/daemon/dist/domain/shell-classifier.js.map +1 -0
- package/daemon/dist/domain/slices/slice-detail-projector.d.ts.map +1 -1
- package/daemon/dist/domain/slices/slice-detail-projector.js +10 -1
- package/daemon/dist/domain/slices/slice-detail-projector.js.map +1 -1
- package/daemon/dist/domain/spec-validation-advisory.d.ts +17 -0
- package/daemon/dist/domain/spec-validation-advisory.d.ts.map +1 -0
- package/daemon/dist/domain/spec-validation-advisory.js +38 -0
- package/daemon/dist/domain/spec-validation-advisory.js.map +1 -0
- package/daemon/dist/domain/successor-session-launcher.d.ts +7 -0
- package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/successor-session-launcher.js +38 -1
- package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
- package/daemon/dist/domain/topology-defaults-installer.d.ts +47 -0
- package/daemon/dist/domain/topology-defaults-installer.d.ts.map +1 -0
- package/daemon/dist/domain/topology-defaults-installer.js +92 -0
- package/daemon/dist/domain/topology-defaults-installer.js.map +1 -0
- package/daemon/dist/domain/transcript-rotation.d.ts +4 -0
- package/daemon/dist/domain/transcript-rotation.d.ts.map +1 -1
- package/daemon/dist/domain/transcript-rotation.js +61 -3
- package/daemon/dist/domain/transcript-rotation.js.map +1 -1
- package/daemon/dist/domain/transcript-store.d.ts.map +1 -1
- package/daemon/dist/domain/transcript-store.js +9 -2
- package/daemon/dist/domain/transcript-store.js.map +1 -1
- package/daemon/dist/domain/types.d.ts +3 -0
- package/daemon/dist/domain/types.d.ts.map +1 -1
- package/daemon/dist/domain/user-settings/settings-store.d.ts +10 -1
- package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
- package/daemon/dist/domain/user-settings/settings-store.js +39 -0
- package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
- package/daemon/dist/routes/context-packs.d.ts.map +1 -1
- package/daemon/dist/routes/context-packs.js +205 -0
- package/daemon/dist/routes/context-packs.js.map +1 -1
- package/daemon/dist/routes/seat.d.ts.map +1 -1
- package/daemon/dist/routes/seat.js +11 -0
- package/daemon/dist/routes/seat.js.map +1 -1
- package/daemon/dist/routes/sessions.js +55 -0
- package/daemon/dist/routes/sessions.js.map +1 -1
- package/daemon/dist/routes/transport.d.ts.map +1 -1
- package/daemon/dist/routes/transport.js +12 -3
- package/daemon/dist/routes/transport.js.map +1 -1
- package/daemon/dist/seat-recap-store-surface.d.ts +2 -0
- package/daemon/dist/seat-recap-store-surface.d.ts.map +1 -0
- package/daemon/dist/seat-recap-store-surface.js +6 -0
- package/daemon/dist/seat-recap-store-surface.js.map +1 -0
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +37 -6
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/docs/reference/chain-file-convention.md +115 -0
- package/daemon/docs/reference/legacy-topology-migration.md +53 -0
- package/daemon/docs/reference/refocus-channel.md +80 -0
- package/daemon/docs/reference/sdlc-conventions.md +24 -0
- package/daemon/specs/agents/shared/skills/core/attention-queue/SKILL.md +1 -1
- package/daemon/specs/agents/shared/skills/core/human-in-the-loop/SKILL.md +1 -1
- package/daemon/specs/agents/shared/skills/core/session-source-fork/SKILL.md +1 -1
- package/daemon/specs/agents/shared/skills/core/watchdog/SKILL.md +4 -4
- package/daemon/specs/agents/shared/skills/pods/development-team/SKILL.md +8 -0
- package/daemon/specs/agents/shared/skills/pods/orchestration-team/SKILL.md +72 -31
- package/daemon/specs/agents/shared/skills/pods/oversight-team/SKILL.md +106 -0
- package/daemon/specs/agents/shared/skills/process/context-engineering/SKILL.md +479 -0
- package/daemon/specs/agents/shared/skills/process/test-driven-development/SKILL.md +9 -0
- package/daemon/specs/rigs/launch/demo/project-example/README.md +25 -0
- package/daemon/specs/rigs/launch/demo/project-example/missions/improve-onboarding/SPEC.md +19 -0
- package/daemon/specs/rigs/launch/demo/project-example/missions/improve-onboarding/slices/01-shorten-first-run/PROGRESS.md +6 -0
- package/daemon/specs/rigs/launch/demo/project-example/missions/improve-onboarding/slices/01-shorten-first-run/PROOF.md +7 -0
- package/daemon/specs/rigs/launch/demo/project-example/missions/improve-onboarding/slices/01-shorten-first-run/SPEC.md +31 -0
- package/daemon/specs/rigs/preview/product-team/topology/instance/CRAFT.md +24 -0
- package/daemon/specs/rigs/preview/product-team/topology/rig/CRAFT.md +21 -0
- package/daemon/specs/rigs/preview/product-team/topology/rig/ORCHESTRATION-CRAFT.md +50 -0
- package/daemon/specs/rigs/preview/product-team/topology/seats/dev1-qa/CRAFT.md +13 -0
- package/daemon/specs/rigs/preview/product-team/topology/seats/orch1-lead/CRAFT.md +17 -0
- package/daemon/specs/rigs/preview/product-team/topology/seats/rev1-r1/CRAFT.md +17 -0
- package/daemon/specs/rigs/preview/product-team/topology/seats/rev1-r2/CRAFT.md +15 -0
- package/dist/build-info.js +3 -3
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +8 -0
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js +353 -48
- package/dist/commands/context.js.map +1 -1
- package/dist/commands/proof.d.ts.map +1 -1
- package/dist/commands/proof.js +70 -12
- package/dist/commands/proof.js.map +1 -1
- package/dist/commands/rig.d.ts.map +1 -1
- package/dist/commands/rig.js +5 -0
- package/dist/commands/rig.js.map +1 -1
- package/dist/commands/transcript.d.ts.map +1 -1
- package/dist/commands/transcript.js +25 -1
- package/dist/commands/transcript.js.map +1 -1
- package/dist/commands/walk.d.ts.map +1 -1
- package/dist/commands/walk.js +279 -26
- package/dist/commands/walk.js.map +1 -1
- package/dist/config-store.d.ts +15 -1
- package/dist/config-store.d.ts.map +1 -1
- package/dist/config-store.js +35 -1
- package/dist/config-store.js.map +1 -1
- package/dist/lib/scope/logical-checkbox.d.ts +26 -0
- package/dist/lib/scope/logical-checkbox.d.ts.map +1 -0
- package/dist/lib/scope/logical-checkbox.js +65 -0
- package/dist/lib/scope/logical-checkbox.js.map +1 -0
- package/dist/lib/scope/scaffold-placeholder.d.ts +22 -0
- package/dist/lib/scope/scaffold-placeholder.d.ts.map +1 -1
- package/dist/lib/scope/scaffold-placeholder.js +24 -0
- package/dist/lib/scope/scaffold-placeholder.js.map +1 -1
- package/dist/lib/topology-trace.d.ts +36 -0
- package/dist/lib/topology-trace.d.ts.map +1 -0
- package/dist/lib/topology-trace.js +91 -0
- package/dist/lib/topology-trace.js.map +1 -0
- package/node_modules/@openrig/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/adapters/claude-code-adapter.js +7 -4
- package/node_modules/@openrig/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/adapters/claude-resume.js +2 -2
- package/node_modules/@openrig/daemon/dist/adapters/claude-resume.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/adapters/tmux.d.ts +10 -2
- package/node_modules/@openrig/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/adapters/tmux.js +27 -7
- package/node_modules/@openrig/daemon/dist/adapters/tmux.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/adapters/yolo-mode.d.ts +18 -0
- package/node_modules/@openrig/daemon/dist/adapters/yolo-mode.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/adapters/yolo-mode.js +21 -0
- package/node_modules/@openrig/daemon/dist/adapters/yolo-mode.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/build-info.js +3 -3
- package/node_modules/@openrig/daemon/dist/domain/codex-thread-id.d.ts +95 -0
- package/node_modules/@openrig/daemon/dist/domain/codex-thread-id.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/codex-thread-id.js +171 -2
- package/node_modules/@openrig/daemon/dist/domain/codex-thread-id.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/context-packs/context-pack-types.d.ts +48 -0
- package/node_modules/@openrig/daemon/dist/domain/context-packs/context-pack-types.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/context-packs/context-pack-types.js +8 -0
- package/node_modules/@openrig/daemon/dist/domain/context-packs/context-pack-types.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/context-packs/manifest-parser.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/context-packs/manifest-parser.js +234 -2
- package/node_modules/@openrig/daemon/dist/domain/context-packs/manifest-parser.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/context-packs/probe-eval-bridge.d.ts +34 -0
- package/node_modules/@openrig/daemon/dist/domain/context-packs/probe-eval-bridge.d.ts.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/context-packs/probe-eval-bridge.js +38 -0
- package/node_modules/@openrig/daemon/dist/domain/context-packs/probe-eval-bridge.js.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-composer.d.ts +49 -0
- package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-composer.d.ts.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-composer.js +125 -0
- package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-composer.js.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-source-resolver.d.ts +53 -0
- package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-source-resolver.d.ts.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-source-resolver.js +129 -0
- package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-source-resolver.js.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/context-packs/seat-recap-store.d.ts +48 -0
- package/node_modules/@openrig/daemon/dist/domain/context-packs/seat-recap-store.d.ts.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/context-packs/seat-recap-store.js +123 -0
- package/node_modules/@openrig/daemon/dist/domain/context-packs/seat-recap-store.js.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/markdown-address.d.ts +56 -0
- package/node_modules/@openrig/daemon/dist/domain/markdown-address.d.ts.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/markdown-address.js +188 -0
- package/node_modules/@openrig/daemon/dist/domain/markdown-address.js.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/model-divergence/current-generation-record.d.ts +8 -2
- package/node_modules/@openrig/daemon/dist/domain/model-divergence/current-generation-record.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/model-divergence/current-generation-record.js +1 -1
- package/node_modules/@openrig/daemon/dist/domain/model-divergence/current-generation-record.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/model-divergence/model-divergence-monitor.d.ts +33 -21
- package/node_modules/@openrig/daemon/dist/domain/model-divergence/model-divergence-monitor.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/model-divergence/model-divergence-monitor.js +64 -55
- package/node_modules/@openrig/daemon/dist/domain/model-divergence/model-divergence-monitor.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/periodic-snapshot-scheduler.d.ts +4 -0
- package/node_modules/@openrig/daemon/dist/domain/periodic-snapshot-scheduler.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/periodic-snapshot-scheduler.js +5 -1
- package/node_modules/@openrig/daemon/dist/domain/periodic-snapshot-scheduler.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/permission-drift-observer.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/permission-drift-observer.js +6 -1
- package/node_modules/@openrig/daemon/dist/domain/permission-drift-observer.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/process-census.d.ts +25 -0
- package/node_modules/@openrig/daemon/dist/domain/process-census.d.ts.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/process-census.js +47 -0
- package/node_modules/@openrig/daemon/dist/domain/process-census.js.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/resume-metadata-refresher.d.ts +31 -2
- package/node_modules/@openrig/daemon/dist/domain/resume-metadata-refresher.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/resume-metadata-refresher.js +64 -29
- package/node_modules/@openrig/daemon/dist/domain/resume-metadata-refresher.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/review/compose.d.ts +5 -26
- package/node_modules/@openrig/daemon/dist/domain/review/compose.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/review/compose.js +31 -57
- package/node_modules/@openrig/daemon/dist/domain/review/compose.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/rigspec-instantiator.d.ts +4 -0
- package/node_modules/@openrig/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/rigspec-instantiator.js +39 -0
- package/node_modules/@openrig/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/rigspec-schema.js +19 -3
- package/node_modules/@openrig/daemon/dist/domain/rigspec-schema.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/scope/logical-checkbox.d.ts +26 -0
- package/node_modules/@openrig/daemon/dist/domain/scope/logical-checkbox.d.ts.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/scope/logical-checkbox.js +65 -0
- package/node_modules/@openrig/daemon/dist/domain/scope/logical-checkbox.js.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/scope/plan-lock-artifacts.d.ts +1 -1
- package/node_modules/@openrig/daemon/dist/domain/scope/plan-lock-artifacts.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/scope/plan-lock-artifacts.js +2 -2
- package/node_modules/@openrig/daemon/dist/domain/scope/plan-lock-artifacts.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/scope/scaffold-placeholder.d.ts +22 -0
- package/node_modules/@openrig/daemon/dist/domain/scope/scaffold-placeholder.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/scope/scaffold-placeholder.js +24 -0
- package/node_modules/@openrig/daemon/dist/domain/scope/scaffold-placeholder.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/seat-activity-service.d.ts +1 -0
- package/node_modules/@openrig/daemon/dist/domain/seat-activity-service.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/seat-activity-service.js +39 -23
- package/node_modules/@openrig/daemon/dist/domain/seat-activity-service.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/seat-handover-service.d.ts +22 -0
- package/node_modules/@openrig/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/seat-handover-service.js +32 -2
- package/node_modules/@openrig/daemon/dist/domain/seat-handover-service.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/session-transport.d.ts +8 -0
- package/node_modules/@openrig/daemon/dist/domain/session-transport.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/session-transport.js +116 -0
- package/node_modules/@openrig/daemon/dist/domain/session-transport.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/shell-classifier.d.ts +23 -0
- package/node_modules/@openrig/daemon/dist/domain/shell-classifier.d.ts.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/shell-classifier.js +36 -0
- package/node_modules/@openrig/daemon/dist/domain/shell-classifier.js.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/slices/slice-detail-projector.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/slices/slice-detail-projector.js +10 -1
- package/node_modules/@openrig/daemon/dist/domain/slices/slice-detail-projector.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/spec-validation-advisory.d.ts +17 -0
- package/node_modules/@openrig/daemon/dist/domain/spec-validation-advisory.d.ts.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/spec-validation-advisory.js +38 -0
- package/node_modules/@openrig/daemon/dist/domain/spec-validation-advisory.js.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/successor-session-launcher.d.ts +7 -0
- package/node_modules/@openrig/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/successor-session-launcher.js +38 -1
- package/node_modules/@openrig/daemon/dist/domain/successor-session-launcher.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/topology-defaults-installer.d.ts +47 -0
- package/node_modules/@openrig/daemon/dist/domain/topology-defaults-installer.d.ts.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/topology-defaults-installer.js +92 -0
- package/node_modules/@openrig/daemon/dist/domain/topology-defaults-installer.js.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/transcript-rotation.d.ts +4 -0
- package/node_modules/@openrig/daemon/dist/domain/transcript-rotation.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/transcript-rotation.js +61 -3
- package/node_modules/@openrig/daemon/dist/domain/transcript-rotation.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/transcript-store.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/transcript-store.js +9 -2
- package/node_modules/@openrig/daemon/dist/domain/transcript-store.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/types.d.ts +3 -0
- package/node_modules/@openrig/daemon/dist/domain/types.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/user-settings/settings-store.d.ts +10 -1
- package/node_modules/@openrig/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/user-settings/settings-store.js +39 -0
- package/node_modules/@openrig/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/context-packs.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/context-packs.js +205 -0
- package/node_modules/@openrig/daemon/dist/routes/context-packs.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/seat.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/seat.js +11 -0
- package/node_modules/@openrig/daemon/dist/routes/seat.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/sessions.js +55 -0
- package/node_modules/@openrig/daemon/dist/routes/sessions.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/transport.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/transport.js +12 -3
- package/node_modules/@openrig/daemon/dist/routes/transport.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/seat-recap-store-surface.d.ts +2 -0
- package/node_modules/@openrig/daemon/dist/seat-recap-store-surface.d.ts.map +1 -0
- package/node_modules/@openrig/daemon/dist/seat-recap-store-surface.js +6 -0
- package/node_modules/@openrig/daemon/dist/seat-recap-store-surface.js.map +1 -0
- package/node_modules/@openrig/daemon/dist/startup.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/startup.js +37 -6
- package/node_modules/@openrig/daemon/dist/startup.js.map +1 -1
- package/node_modules/@openrig/daemon/package.json +6 -1
- package/package.json +1 -1
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// OPR.0.5.3.5 Atom 3 — the composition algebra (locked SPEC, founder refinement):
|
|
2
|
+
//
|
|
3
|
+
// FRESH = the base walk (atoms tagged fresh)
|
|
4
|
+
// HANDOVER = FRESH + the handover material (atoms tagged handover)
|
|
5
|
+
// POST-COMPACTION = the tagged subset of fresh + the handover material
|
|
6
|
+
//
|
|
7
|
+
// Every profile is CLOSED over requires (a subset profile must close — intake rule);
|
|
8
|
+
// the runtime filter runs per mini-req 3 (claude and codex are never assumed to have
|
|
9
|
+
// lost the same dimensions, so they compose different profiles from the SAME graph);
|
|
10
|
+
// each piece resolves through the Atom-1 address machinery and carries a per-piece
|
|
11
|
+
// SOURCE LABEL (Q2-Amendment 1: composition is multi-source by contract — library /
|
|
12
|
+
// seat tree / mission tree — and every assembled piece names its source; the caller's
|
|
13
|
+
// resolver decides the kind, this module labels). Budgets are evaluated AT COMPOSE
|
|
14
|
+
// and on overage REPORT the amount and the priority-ordered drop candidates —
|
|
15
|
+
// composition never silently truncates (mini-req 9; D2: budgets flag for review,
|
|
16
|
+
// never silently govern).
|
|
17
|
+
//
|
|
18
|
+
// PURE by contract, like the manifest parser: file text arrives through the caller's
|
|
19
|
+
// readFile so the same algebra serves library packs today and configured tree roots
|
|
20
|
+
// (seat/mission sources) when the wiring atom lands. Every failure is LOUD and names
|
|
21
|
+
// the atom — a compose stops rather than thinning the walk (the Q1 rationale).
|
|
22
|
+
import { estimateTokensFromBytes } from "./token-estimate.js";
|
|
23
|
+
import { AddressResolutionError, parseAddress, resolveAddress } from "../markdown-address.js";
|
|
24
|
+
export class ProfileComposeError extends Error {
|
|
25
|
+
constructor(message) {
|
|
26
|
+
super(message);
|
|
27
|
+
this.name = "ProfileComposeError";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** Which situation tags select atoms for a profile, per the locked algebra. */
|
|
31
|
+
function selectionTags(situation) {
|
|
32
|
+
switch (situation) {
|
|
33
|
+
case "fresh":
|
|
34
|
+
return ["fresh"];
|
|
35
|
+
case "handover":
|
|
36
|
+
return ["fresh", "handover"];
|
|
37
|
+
case "post-compaction":
|
|
38
|
+
return ["post-compaction", "handover"];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const DROP_ORDER = { optional: 0, recommended: 1, core: 2 };
|
|
42
|
+
export function composeProfile(input) {
|
|
43
|
+
const { atoms, situation, runtime, readFile, budgetTokens, sourceKindFor } = input;
|
|
44
|
+
const byId = new Map(atoms.map((a) => [a.id, a]));
|
|
45
|
+
// 1. SELECT by situation tag, then filter by runtime (an "any" atom serves both).
|
|
46
|
+
const tags = selectionTags(situation);
|
|
47
|
+
const runtimeFits = (a) => a.runtime === "any" || a.runtime === runtime;
|
|
48
|
+
const selected = new Map();
|
|
49
|
+
for (const a of atoms) {
|
|
50
|
+
if (a.situations.some((s) => tags.includes(s)) && runtimeFits(a))
|
|
51
|
+
selected.set(a.id, a);
|
|
52
|
+
}
|
|
53
|
+
// 2. CLOSE over requires: a required atom joins the profile even when untagged.
|
|
54
|
+
// A dependency that exists but is excluded by the RUNTIME filter is a broken
|
|
55
|
+
// graph for this runtime — fail loud, never a quietly thinner walk.
|
|
56
|
+
const queue = [...selected.keys()];
|
|
57
|
+
while (queue.length > 0) {
|
|
58
|
+
const id = queue.pop();
|
|
59
|
+
for (const req of selected.get(id)?.requires ?? byId.get(id)?.requires ?? []) {
|
|
60
|
+
if (selected.has(req))
|
|
61
|
+
continue;
|
|
62
|
+
const dep = byId.get(req);
|
|
63
|
+
if (!dep) {
|
|
64
|
+
throw new ProfileComposeError(`atom '${id}' requires '${req}', which is not in the graph — the ${situation} profile cannot close.`);
|
|
65
|
+
}
|
|
66
|
+
if (!runtimeFits(dep)) {
|
|
67
|
+
throw new ProfileComposeError(`atom '${id}' requires '${req}', but '${req}' is declared runtime=${dep.runtime} and this compose targets runtime=${runtime} — ` +
|
|
68
|
+
`the closure would silently thin the ${situation} walk; fix the graph (retag '${req}' or drop the edge).`);
|
|
69
|
+
}
|
|
70
|
+
selected.set(req, dep);
|
|
71
|
+
queue.push(req);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// 3. ORDER the walk (stable: order, then id — absorption depends on sequence).
|
|
75
|
+
const walk = [...selected.values()].sort((x, y) => x.order - y.order || x.id.localeCompare(y.id));
|
|
76
|
+
// 4. RESOLVE every piece through the one address machinery; label its source.
|
|
77
|
+
const pieces = walk.map((a) => {
|
|
78
|
+
const { ref, headerPath } = parseAddress(a.address);
|
|
79
|
+
let fileText;
|
|
80
|
+
try {
|
|
81
|
+
fileText = readFile(ref);
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
throw new ProfileComposeError(`atom '${a.id}' (${a.address}): source file '${ref}' is unreadable — ${err.message}`);
|
|
85
|
+
}
|
|
86
|
+
let text;
|
|
87
|
+
if (headerPath.length === 0) {
|
|
88
|
+
text = fileText;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
try {
|
|
92
|
+
text = resolveAddress(fileText, headerPath).text;
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
if (err instanceof AddressResolutionError) {
|
|
96
|
+
throw new ProfileComposeError(`atom '${a.id}' (${a.address}): ${err.message}`);
|
|
97
|
+
}
|
|
98
|
+
throw err;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
atomId: a.id,
|
|
103
|
+
address: a.address,
|
|
104
|
+
sourceKind: sourceKindFor?.(a) ?? "library",
|
|
105
|
+
order: a.order,
|
|
106
|
+
priority: a.priority,
|
|
107
|
+
text,
|
|
108
|
+
estimatedTokens: estimateTokensFromBytes(Buffer.byteLength(text, "utf-8")),
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
const totalEstimatedTokens = pieces.reduce((sum, p) => sum + p.estimatedTokens, 0);
|
|
112
|
+
// 5. BUDGET report (mini-req 9): flag, never govern — all pieces stay.
|
|
113
|
+
let budget;
|
|
114
|
+
if (budgetTokens !== undefined && totalEstimatedTokens > budgetTokens) {
|
|
115
|
+
budget = {
|
|
116
|
+
limitTokens: budgetTokens,
|
|
117
|
+
overageTokens: totalEstimatedTokens - budgetTokens,
|
|
118
|
+
dropCandidates: [...pieces]
|
|
119
|
+
.sort((x, y) => DROP_ORDER[x.priority] - DROP_ORDER[y.priority] || y.estimatedTokens - x.estimatedTokens || x.atomId.localeCompare(y.atomId))
|
|
120
|
+
.map((p) => ({ atomId: p.atomId, priority: p.priority, estimatedTokens: p.estimatedTokens })),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
return { situation, runtime, pieces, totalEstimatedTokens, ...(budget !== undefined ? { budget } : {}) };
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=profile-composer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-composer.js","sourceRoot":"","sources":["../../../src/domain/context-packs/profile-composer.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,EAAE;AACF,yDAAyD;AACzD,4EAA4E;AAC5E,yEAAyE;AACzE,EAAE;AACF,qFAAqF;AACrF,qFAAqF;AACrF,qFAAqF;AACrF,mFAAmF;AACnF,oFAAoF;AACpF,sFAAsF;AACtF,mFAAmF;AACnF,8EAA8E;AAC9E,iFAAiF;AACjF,0BAA0B;AAC1B,EAAE;AACF,qFAAqF;AACrF,oFAAoF;AACpF,qFAAqF;AACrF,+EAA+E;AAG/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,wBAA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GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAC3G,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { SourceKind } from "./profile-composer.js";
|
|
2
|
+
export declare class SourceResolutionError extends Error {
|
|
3
|
+
constructor(message: string);
|
|
4
|
+
}
|
|
5
|
+
declare const TREE_KINDS: readonly ["seat", "mission"];
|
|
6
|
+
export type TreeKind = (typeof TREE_KINDS)[number];
|
|
7
|
+
export interface ParsedSourceRef {
|
|
8
|
+
kind: SourceKind;
|
|
9
|
+
/** Relative path under the pack dir (library) or the kind's configured root. */
|
|
10
|
+
rel: string;
|
|
11
|
+
}
|
|
12
|
+
/** Split a pre-`#` ref into its resolver kind + relative path. Fail-loud on an
|
|
13
|
+
* unknown prefix or a traversal-shaped path — a clean refusal, never an escape
|
|
14
|
+
* (the r2-B3 precedent from the trace verb). */
|
|
15
|
+
export declare function parseSourceRef(ref: string): ParsedSourceRef;
|
|
16
|
+
export interface ProfileSourceRoots {
|
|
17
|
+
/** The seat's tree directory (recap + lore beside LEARNED) — from config. */
|
|
18
|
+
seat?: string;
|
|
19
|
+
/** The mission's tree directory — from config. */
|
|
20
|
+
mission?: string;
|
|
21
|
+
}
|
|
22
|
+
/** Byte-provenance record for one successful read (r1 rider 1 via 4a's review):
|
|
23
|
+
* the label must be CHECKABLE, not merely asserted — with a symlink in play a
|
|
24
|
+
* source label is accurate about the REF and wrong about the BYTES, and that
|
|
25
|
+
* bites on benign symlinks, not just hostile ones. */
|
|
26
|
+
export interface SourceReadRecord {
|
|
27
|
+
ref: string;
|
|
28
|
+
kind: SourceKind;
|
|
29
|
+
/** The root the read was granted against. */
|
|
30
|
+
base: string;
|
|
31
|
+
/** base + rel, before symlink resolution. */
|
|
32
|
+
nominalPath: string;
|
|
33
|
+
/** Where the BYTES actually came from (realpath after the successful read). */
|
|
34
|
+
realPath: string;
|
|
35
|
+
/** True when realPath sits outside base. Computed via path.relative — never a
|
|
36
|
+
* bare string prefix (r1: `startsWith` says /seat-evil is inside /seat). */
|
|
37
|
+
escapesRoot: boolean;
|
|
38
|
+
}
|
|
39
|
+
/** Build the composer's fail-loud readFile over the pack dir + configured tree
|
|
40
|
+
* roots. Every failure names the source kind and what was being resolved —
|
|
41
|
+
* a missing root is a MISSING CONFIG error, never a silent empty; a DANGLING
|
|
42
|
+
* symlink is its own named failure (a realistic corpus state, not a generic
|
|
43
|
+
* unreadable). Each successful read reports byte provenance via onRead. */
|
|
44
|
+
export declare function makeProfileReadFile(opts: {
|
|
45
|
+
packDir: string;
|
|
46
|
+
roots: ProfileSourceRoots;
|
|
47
|
+
onRead?: (record: SourceReadRecord) => void;
|
|
48
|
+
}): (ref: string) => string;
|
|
49
|
+
/** The composer's per-piece source label (Q2-Amendment 1: every assembled piece
|
|
50
|
+
* is labeled with its source), derived from the atom's full address. */
|
|
51
|
+
export declare function sourceKindForAddress(address: string): SourceKind;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=profile-source-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-source-resolver.d.ts","sourceRoot":"","sources":["../../../src/domain/context-packs/profile-source-resolver.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGxD,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,OAAO,EAAE,MAAM;CAI5B;AAED,QAAA,MAAM,UAAU,8BAA+B,CAAC;AAChD,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,UAAU,CAAC;IACjB,gFAAgF;IAChF,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;iDAEiD;AACjD,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CA0B3D;AAED,MAAM,WAAW,kBAAkB;IACjC,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;uDAGuD;AACvD,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;IACjB,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,CAAC;IACjB;iFAC6E;IAC7E,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;;;4EAI4E;AAC5E,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,kBAAkB,CAAC;IAC1B,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAC7C,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CA8D1B;AAED;yEACyE;AACzE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAEhE"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// OPR.0.5.3.5 Atom 4a — the two pre-`#` resolvers behind ONE grammar.
|
|
2
|
+
//
|
|
3
|
+
// Q2-Amendment 1 (locked), the desk's grammar ruling verbatim: non-library sources
|
|
4
|
+
// are addressable with the SAME `#H2-slug/H3-slug` grammar; only the pre-`#`
|
|
5
|
+
// resolver differs — a library ref resolves through the library (here: the pack's
|
|
6
|
+
// own directory), a tree path resolves from CONFIGURED roots — and both resolve
|
|
7
|
+
// FAIL-LOUD. One grammar held in memory, two resolvers behind it, no second
|
|
8
|
+
// addressing convention. The kind prefix is the entire pre-`#` dialect:
|
|
9
|
+
//
|
|
10
|
+
// walk.md#welcome -> library (the pack's declared files)
|
|
11
|
+
// seat:RECAP.md#decisions -> the seat tree (recap + lore live beside LEARNED)
|
|
12
|
+
// mission:NOTES.md#watch-items -> the mission tree
|
|
13
|
+
//
|
|
14
|
+
// Roots arrive from CONFIG through the caller (CE-v2 03-tree-addressability: an
|
|
15
|
+
// addressing verb resolves tree paths from config, never literals — this module
|
|
16
|
+
// holds no path literal and refuses to guess a missing root). Composability comes
|
|
17
|
+
// from ADDRESSING, not homing: nothing must be copied into the library to compose
|
|
18
|
+
// (a profile that copies seat or mission content into the library is a defect —
|
|
19
|
+
// Q2-Amendment 1(c)).
|
|
20
|
+
import { lstatSync, readFileSync, realpathSync } from "node:fs";
|
|
21
|
+
import { isAbsolute, join, normalize, relative, sep } from "node:path";
|
|
22
|
+
import { parseAddress } from "../markdown-address.js";
|
|
23
|
+
export class SourceResolutionError extends Error {
|
|
24
|
+
constructor(message) {
|
|
25
|
+
super(message);
|
|
26
|
+
this.name = "SourceResolutionError";
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const TREE_KINDS = ["seat", "mission"];
|
|
30
|
+
/** Split a pre-`#` ref into its resolver kind + relative path. Fail-loud on an
|
|
31
|
+
* unknown prefix or a traversal-shaped path — a clean refusal, never an escape
|
|
32
|
+
* (the r2-B3 precedent from the trace verb). */
|
|
33
|
+
export function parseSourceRef(ref) {
|
|
34
|
+
const colon = ref.indexOf(":");
|
|
35
|
+
let kind = "library";
|
|
36
|
+
let rel = ref;
|
|
37
|
+
if (colon >= 0) {
|
|
38
|
+
const prefix = ref.slice(0, colon);
|
|
39
|
+
if (!TREE_KINDS.includes(prefix)) {
|
|
40
|
+
throw new SourceResolutionError(`source ref '${ref}' has unknown kind prefix '${prefix}' — the pre-'#' dialect is bare (library), ${TREE_KINDS.map((k) => `'${k}:'`).join(" or ")}.`);
|
|
41
|
+
}
|
|
42
|
+
kind = prefix;
|
|
43
|
+
rel = ref.slice(colon + 1);
|
|
44
|
+
}
|
|
45
|
+
if (rel.length === 0) {
|
|
46
|
+
throw new SourceResolutionError(`source ref '${ref}' has an empty path after its kind prefix.`);
|
|
47
|
+
}
|
|
48
|
+
const unsafe = isAbsolute(rel) ||
|
|
49
|
+
rel.split(/[\\/]/).some((segment) => segment === ".." || segment === "");
|
|
50
|
+
if (unsafe) {
|
|
51
|
+
throw new SourceResolutionError(`source ref '${ref}' is traversal-shaped (absolute path, '..' or empty segment) — refs stay inside their source root.`);
|
|
52
|
+
}
|
|
53
|
+
return { kind, rel };
|
|
54
|
+
}
|
|
55
|
+
/** Build the composer's fail-loud readFile over the pack dir + configured tree
|
|
56
|
+
* roots. Every failure names the source kind and what was being resolved —
|
|
57
|
+
* a missing root is a MISSING CONFIG error, never a silent empty; a DANGLING
|
|
58
|
+
* symlink is its own named failure (a realistic corpus state, not a generic
|
|
59
|
+
* unreadable). Each successful read reports byte provenance via onRead. */
|
|
60
|
+
export function makeProfileReadFile(opts) {
|
|
61
|
+
return (ref) => {
|
|
62
|
+
const { kind, rel } = parseSourceRef(ref);
|
|
63
|
+
let base;
|
|
64
|
+
if (kind === "library") {
|
|
65
|
+
base = opts.packDir;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
const configured = opts.roots[kind];
|
|
69
|
+
if (!configured) {
|
|
70
|
+
throw new SourceResolutionError(`source ref '${ref}' needs the ${kind} tree root, which is not configured for this compose — ` +
|
|
71
|
+
`tree paths resolve from config, never literals; supply the ${kind} root or drop the ${kind}-homed atom.`);
|
|
72
|
+
}
|
|
73
|
+
base = configured;
|
|
74
|
+
}
|
|
75
|
+
const abs = normalize(join(base, rel));
|
|
76
|
+
let text;
|
|
77
|
+
try {
|
|
78
|
+
text = readFileSync(abs, "utf-8");
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
// Name the dangling-symlink state precisely: the path EXISTS as a link
|
|
82
|
+
// but its target does not — a generic "unreadable" would send an author
|
|
83
|
+
// hunting for a file that is right there in their listing.
|
|
84
|
+
let dangling = false;
|
|
85
|
+
try {
|
|
86
|
+
lstatSync(abs);
|
|
87
|
+
dangling = true;
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
/* genuinely absent */
|
|
91
|
+
}
|
|
92
|
+
throw new SourceResolutionError(dangling
|
|
93
|
+
? `source ref '${ref}' (${kind}) is a DANGLING symlink: ${abs} exists but its target does not — ${err.message}`
|
|
94
|
+
: `source ref '${ref}' (${kind}) did not resolve: ${abs} is unreadable — ${err.message}`);
|
|
95
|
+
}
|
|
96
|
+
// Provenance AFTER the successful read (r1: realpath on a missing file
|
|
97
|
+
// throws, and that throw must never garble the honest read error above).
|
|
98
|
+
if (opts.onRead) {
|
|
99
|
+
let realPath = abs;
|
|
100
|
+
try {
|
|
101
|
+
realPath = realpathSync(abs);
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
/* raced away post-read; nominal stands as the best truth available */
|
|
105
|
+
}
|
|
106
|
+
let realBase = base;
|
|
107
|
+
try {
|
|
108
|
+
realBase = realpathSync(base);
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
/* root itself unresolvable; compare against the nominal base */
|
|
112
|
+
}
|
|
113
|
+
const relFromBase = relative(realBase, realPath);
|
|
114
|
+
// SEGMENT comparison, never a prefix test on a path-shaped string (r1
|
|
115
|
+
// round-3 F1: a file legitimately NAMED '..hidden-notes.md' inside the
|
|
116
|
+
// root satisfied startsWith('..') — the identical class as
|
|
117
|
+
// startsWith(base) saying /seat-evil is inside /seat, one level in).
|
|
118
|
+
const escapesRoot = relFromBase === ".." || relFromBase.startsWith(`..${sep}`) || isAbsolute(relFromBase);
|
|
119
|
+
opts.onRead({ ref, kind, base, nominalPath: abs, realPath, escapesRoot });
|
|
120
|
+
}
|
|
121
|
+
return text;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/** The composer's per-piece source label (Q2-Amendment 1: every assembled piece
|
|
125
|
+
* is labeled with its source), derived from the atom's full address. */
|
|
126
|
+
export function sourceKindForAddress(address) {
|
|
127
|
+
return parseSourceRef(parseAddress(address).ref).kind;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=profile-source-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-source-resolver.js","sourceRoot":"","sources":["../../../src/domain/context-packs/profile-source-resolver.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,EAAE;AACF,mFAAmF;AACnF,6EAA6E;AAC7E,kFAAkF;AAClF,gFAAgF;AAChF,4EAA4E;AAC5E,wEAAwE;AACxE,EAAE;AACF,wEAAwE;AACxE,qFAAqF;AACrF,qDAAqD;AACrD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,kFAAkF;AAClF,kFAAkF;AAClF,gFAAgF;AAChF,sBAAsB;AAEtB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AAED,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,SAAS,CAAU,CAAC;AAShD;;iDAEiD;AACjD,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,IAAI,GAAe,SAAS,CAAC;IACjC,IAAI,GAAG,GAAG,GAAG,CAAC;IACd,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QACf,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QACnC,IAAI,CAAE,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AAC,CAAC;YAChC,CAAC;YAAC,MAAM,CAAC;gBACP,gEAAgE;YAClE,CAAC;YACD,MAAM,WAAW,GAAG,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YACjD,sEAAsE;YACtE,uEAAuE;YACvE,2DAA2D;YAC3D,qEAAqE;YACrE,MAAM,WAAW,GAAG,WAAW,KAAK,IAAI,IAAI,WAAW,CAAC,UAAU,CAAC,KAAK,GAAG,EAAE,CAAC,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;YAC1G,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC;QAC5E,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAED;yEACyE;AACzE,MAAM,UAAU,oBAAoB,CAAC,OAAe;IAClD,OAAO,cAAc,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare const RECAP_FILENAME = "RECAP.md";
|
|
2
|
+
export declare class RecapWriteError extends Error {
|
|
3
|
+
constructor(message: string);
|
|
4
|
+
}
|
|
5
|
+
export interface RecapChainEntry {
|
|
6
|
+
/** Absolute path of the superseded recap. */
|
|
7
|
+
path: string;
|
|
8
|
+
/** The supersession timestamp encoded in the filename (ms epoch). */
|
|
9
|
+
supersededAtMs: number;
|
|
10
|
+
/** Same-millisecond disambiguator (1 for the bare name, 2+ for -N suffixes). */
|
|
11
|
+
sequence: number;
|
|
12
|
+
}
|
|
13
|
+
/** Write the seat's current recap, superseding any existing one into the
|
|
14
|
+
* chain. The gate is ADDRESSABILITY only — never prose shape. */
|
|
15
|
+
export declare function writeSeatRecap(opts: {
|
|
16
|
+
seatDir: string;
|
|
17
|
+
content: string;
|
|
18
|
+
now?: () => number;
|
|
19
|
+
}): void;
|
|
20
|
+
/** The superseded chain, oldest first. Empty when no recap was ever superseded. */
|
|
21
|
+
export declare function listRecapChain(seatDir: string): RecapChainEntry[];
|
|
22
|
+
export type RecapContractFinding = {
|
|
23
|
+
kind: "no-decisions-section";
|
|
24
|
+
} | {
|
|
25
|
+
kind: "nonstandard-unverified-marker";
|
|
26
|
+
line: number;
|
|
27
|
+
};
|
|
28
|
+
/** The authoring contract's CHECKABLE subset (Q2): decisions-with-rationale has
|
|
29
|
+
* a structural proxy (a decisions-titled section exists); the UNVERIFIED
|
|
30
|
+
* marker has a canonical grammar (`UNVERIFIED:` uppercase) that must stay
|
|
31
|
+
* findable — a variant marker hides exactly the fact it exists to flag.
|
|
32
|
+
* Advisory: findings, never throws. */
|
|
33
|
+
export declare function validateRecapContract(content: string): RecapContractFinding[];
|
|
34
|
+
/** BUILD FOLLOW-UP (r1 verdict bb00e850; row 17015088) — the authored-recap
|
|
35
|
+
* pointer resolution, ONE-HOMED here beside the store it reads, parsing the
|
|
36
|
+
* seat ref through the CANONICAL parseSessionName (first-@ split, the
|
|
37
|
+
* documented greedy-rig ruling) — never a second parser. Safety floor
|
|
38
|
+
* preserved: an unresolved or non-canonical ref fails with a LABELED reason
|
|
39
|
+
* carrying what was tried; fuzzy-matching another seat's directory would hand
|
|
40
|
+
* a successor a DIFFERENT occupant's decisions, which is strictly worse than
|
|
41
|
+
* honest absence. */
|
|
42
|
+
export declare function resolveAuthoredRecapPointer(seatRef: string, topologyRoot: string): {
|
|
43
|
+
address: string;
|
|
44
|
+
chainLength: number;
|
|
45
|
+
} | {
|
|
46
|
+
absentReason: string;
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=seat-recap-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seat-recap-store.d.ts","sourceRoot":"","sources":["../../../src/domain/context-packs/seat-recap-store.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,cAAc,aAAa,CAAC;AAGzC,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B;AAED,MAAM,WAAW,eAAe;IAC9B,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,cAAc,EAAE,MAAM,CAAC;IACvB,gFAAgF;IAChF,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;kEACkE;AAClE,wBAAgB,cAAc,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;CAAE,GAAG,IAAI,CA4BnG;AAED,mFAAmF;AACnF,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,EAAE,CAiBjE;AAED,MAAM,MAAM,oBAAoB,GAC5B;IAAE,IAAI,EAAE,sBAAsB,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,+BAA+B,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5D;;;;wCAIwC;AACxC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,oBAAoB,EAAE,CAa7E;AAED;;;;;;;sBAOsB;AACtB,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,GACnB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,CAUrE"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// OPR.0.5.3.5 mini-req 7 (Q2 + Q2-Amendment 1) — the seat recap store.
|
|
2
|
+
//
|
|
3
|
+
// The AUTHORED recap: decisions-with-rationale written by the outgoing occupant
|
|
4
|
+
// at the boundary, extending the shipped from-record boot recap's name (the Q2
|
|
5
|
+
// unify-what-exists ruling — predecessor-recap-resolver.ts remains the
|
|
6
|
+
// transcript-derived sibling). SEAT-HOMED beside LEARNED (Q2-Amendment 1(a):
|
|
7
|
+
// the recap is POSITION knowledge, unshareable by construction — a
|
|
8
|
+
// library-homed recap would be position knowledge on the portable shelf).
|
|
9
|
+
// RETENTION (1(b)): superseded-chain versioning — the newest recap is
|
|
10
|
+
// RECAP.md, predecessors stay byte-preserved under recap-superseded/ in the
|
|
11
|
+
// seat directory, cleaned by seat-directory lifecycle, NEVER by library
|
|
12
|
+
// curation; no librarian job is created.
|
|
13
|
+
//
|
|
14
|
+
// Two validation altitudes, deliberately different:
|
|
15
|
+
// - ADDRESSABILITY is the one HARD gate on write: the recap is composed by
|
|
16
|
+
// address (seat:RECAP.md#...), so an unaddressable recap (duplicate header
|
|
17
|
+
// paths, unterminated fence) would fail every handover profile downstream,
|
|
18
|
+
// silently late. Structural, not prose-shaped.
|
|
19
|
+
// - The AUTHORING CONTRACT validates ADVISORY on its CHECKABLE subset only:
|
|
20
|
+
// findings flag for review, never gate the boundary (the D2 pattern). The
|
|
21
|
+
// contract's semantic halves (temporal order, derived-values-as-commands)
|
|
22
|
+
// are not mechanically checkable and are NOT pretended at.
|
|
23
|
+
import { mkdirSync, readdirSync, renameSync, writeFileSync, existsSync } from "node:fs";
|
|
24
|
+
import { join } from "node:path";
|
|
25
|
+
import { validateMarkdownAddressability, parseMarkdownSections } from "../markdown-address.js";
|
|
26
|
+
import { parseSessionName } from "../session-name.js";
|
|
27
|
+
export const RECAP_FILENAME = "RECAP.md";
|
|
28
|
+
const CHAIN_DIRNAME = "recap-superseded";
|
|
29
|
+
export class RecapWriteError extends Error {
|
|
30
|
+
constructor(message) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.name = "RecapWriteError";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** Write the seat's current recap, superseding any existing one into the
|
|
36
|
+
* chain. The gate is ADDRESSABILITY only — never prose shape. */
|
|
37
|
+
export function writeSeatRecap(opts) {
|
|
38
|
+
const findings = validateMarkdownAddressability(opts.content);
|
|
39
|
+
if (findings.length > 0) {
|
|
40
|
+
throw new RecapWriteError(`recap is not addressable and could never compose (seat:${RECAP_FILENAME}#... would fail every ` +
|
|
41
|
+
`handover profile): ${findings.map((f) => f.kind === "unterminated-fence" ? `unterminated fence at line ${f.line}` : `${f.kind} '${"headerPath" in f ? f.headerPath : ""}'`).join("; ")}. ` +
|
|
42
|
+
`Fix the structure (duplicate header paths / unterminated fences); prose shape is never gated.`);
|
|
43
|
+
}
|
|
44
|
+
const now = opts.now ?? Date.now;
|
|
45
|
+
const current = join(opts.seatDir, RECAP_FILENAME);
|
|
46
|
+
if (existsSync(current)) {
|
|
47
|
+
const chainDir = join(opts.seatDir, CHAIN_DIRNAME);
|
|
48
|
+
mkdirSync(chainDir, { recursive: true });
|
|
49
|
+
// COLLISION-SAFE naming (r1 F1): renameSync onto an existing path REPLACES
|
|
50
|
+
// it, so two supersessions in one millisecond silently destroyed a
|
|
51
|
+
// predecessor — the retention contract inverted. A counter suffix
|
|
52
|
+
// disambiguates: nothing is lost AND the boundary write still succeeds
|
|
53
|
+
// (better than throwing on both counts). `now` is injectable, so
|
|
54
|
+
// programmatic callers collide deterministically, not rarely.
|
|
55
|
+
const stamp = String(now()).padStart(15, "0");
|
|
56
|
+
let target = join(chainDir, `RECAP-${stamp}.md`);
|
|
57
|
+
for (let counter = 2; existsSync(target); counter++) {
|
|
58
|
+
target = join(chainDir, `RECAP-${stamp}-${counter}.md`);
|
|
59
|
+
}
|
|
60
|
+
renameSync(current, target);
|
|
61
|
+
}
|
|
62
|
+
writeFileSync(current, opts.content);
|
|
63
|
+
}
|
|
64
|
+
/** The superseded chain, oldest first. Empty when no recap was ever superseded. */
|
|
65
|
+
export function listRecapChain(seatDir) {
|
|
66
|
+
const chainDir = join(seatDir, CHAIN_DIRNAME);
|
|
67
|
+
let names;
|
|
68
|
+
try {
|
|
69
|
+
names = readdirSync(chainDir);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
74
|
+
return names
|
|
75
|
+
.map((name) => {
|
|
76
|
+
const m = name.match(/^RECAP-(\d+)(?:-(\d+))?\.md$/);
|
|
77
|
+
return m
|
|
78
|
+
? { path: join(chainDir, name), supersededAtMs: Number(m[1]), sequence: m[2] ? Number(m[2]) : 1 }
|
|
79
|
+
: null;
|
|
80
|
+
})
|
|
81
|
+
.filter((e) => e !== null)
|
|
82
|
+
.sort((a, b) => a.supersededAtMs - b.supersededAtMs || a.sequence - b.sequence);
|
|
83
|
+
}
|
|
84
|
+
/** The authoring contract's CHECKABLE subset (Q2): decisions-with-rationale has
|
|
85
|
+
* a structural proxy (a decisions-titled section exists); the UNVERIFIED
|
|
86
|
+
* marker has a canonical grammar (`UNVERIFIED:` uppercase) that must stay
|
|
87
|
+
* findable — a variant marker hides exactly the fact it exists to flag.
|
|
88
|
+
* Advisory: findings, never throws. */
|
|
89
|
+
export function validateRecapContract(content) {
|
|
90
|
+
const findings = [];
|
|
91
|
+
const sections = parseMarkdownSections(content);
|
|
92
|
+
const hasDecisions = sections.some((s) => s.headerPath[s.headerPath.length - 1].includes("decision"));
|
|
93
|
+
if (!hasDecisions)
|
|
94
|
+
findings.push({ kind: "no-decisions-section" });
|
|
95
|
+
const lines = content.split("\n");
|
|
96
|
+
for (let i = 0; i < lines.length; i++) {
|
|
97
|
+
const line = lines[i];
|
|
98
|
+
if (/unverified/i.test(line) && !line.includes("UNVERIFIED:")) {
|
|
99
|
+
findings.push({ kind: "nonstandard-unverified-marker", line: i });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return findings;
|
|
103
|
+
}
|
|
104
|
+
/** BUILD FOLLOW-UP (r1 verdict bb00e850; row 17015088) — the authored-recap
|
|
105
|
+
* pointer resolution, ONE-HOMED here beside the store it reads, parsing the
|
|
106
|
+
* seat ref through the CANONICAL parseSessionName (first-@ split, the
|
|
107
|
+
* documented greedy-rig ruling) — never a second parser. Safety floor
|
|
108
|
+
* preserved: an unresolved or non-canonical ref fails with a LABELED reason
|
|
109
|
+
* carrying what was tried; fuzzy-matching another seat's directory would hand
|
|
110
|
+
* a successor a DIFFERENT occupant's decisions, which is strictly worse than
|
|
111
|
+
* honest absence. */
|
|
112
|
+
export function resolveAuthoredRecapPointer(seatRef, topologyRoot) {
|
|
113
|
+
const parsed = parseSessionName(seatRef);
|
|
114
|
+
if (parsed.kind !== "canonical") {
|
|
115
|
+
return { absentReason: `seat ref '${seatRef}' did not parse as canonical <seat>@<rig> (parse verdict: ${parsed.kind}) — authored recap not resolved, never guessed` };
|
|
116
|
+
}
|
|
117
|
+
const seatDir = join(topologyRoot, "rigs", parsed.rig, "seats", parsed.member);
|
|
118
|
+
if (!existsSync(join(seatDir, RECAP_FILENAME))) {
|
|
119
|
+
return { absentReason: `no ${RECAP_FILENAME} on the seat tree (${seatDir}) — the predecessor never wrote one` };
|
|
120
|
+
}
|
|
121
|
+
return { address: `seat:${RECAP_FILENAME}`, chainLength: listRecapChain(seatDir).length };
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=seat-recap-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seat-recap-store.js","sourceRoot":"","sources":["../../../src/domain/context-packs/seat-recap-store.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,EAAE;AACF,gFAAgF;AAChF,+EAA+E;AAC/E,uEAAuE;AACvE,6EAA6E;AAC7E,mEAAmE;AACnE,0EAA0E;AAC1E,sEAAsE;AACtE,4EAA4E;AAC5E,wEAAwE;AACxE,yCAAyC;AACzC,EAAE;AACF,oDAAoD;AACpD,2EAA2E;AAC3E,6EAA6E;AAC7E,6EAA6E;AAC7E,iDAAiD;AACjD,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAC5E,6DAA6D;AAE7D,OAAO,EAAE,SAAS,EAAE,WAAW,EAAgB,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACtG,OAAO,EAAE,IAAI,EAAE,MAAM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AAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,+BAA+B,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;sBAOsB;AACtB,MAAM,UAAU,2BAA2B,CACzC,OAAe,EACf,YAAoB;IAEpB,MAAM,MAAM,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACzC,IAAI,MAAM,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QAChC,OAAO,EAAE,YAAY,EAAE,aAAa,OAAO,6DAA6D,MAAM,CAAC,IAAI,gDAAgD,EAAE,CAAC;IACxK,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/E,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;QAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,sBAAsB,OAAO,qCAAqC,EAAE,CAAC;IAClH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,QAAQ,cAAc,EAAE,EAAE,WAAW,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;AAC5F,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare class AddressResolutionError extends Error {
|
|
2
|
+
constructor(message: string);
|
|
3
|
+
}
|
|
4
|
+
/** ONE slug rule, simple enough to hold in memory: lowercase; markdown emphasis/code
|
|
5
|
+
* markers stripped with the text kept; every run of non-alphanumerics becomes one
|
|
6
|
+
* hyphen; leading/trailing hyphens trimmed. */
|
|
7
|
+
export declare function slugifyHeader(title: string): string;
|
|
8
|
+
export interface ParsedAddress {
|
|
9
|
+
/** The pre-`#` ref — a library ref or a tree path; the caller's resolver owns it. */
|
|
10
|
+
ref: string;
|
|
11
|
+
/** 0 (whole file), 1 (H2) or 2 (H2/H3) slugs. */
|
|
12
|
+
headerPath: string[];
|
|
13
|
+
}
|
|
14
|
+
/** Parse the one grammar form `ref` / `ref#h2` / `ref#h2/h3`. Fail-loud on anything else. */
|
|
15
|
+
export declare function parseAddress(address: string): ParsedAddress;
|
|
16
|
+
export interface MarkdownSection {
|
|
17
|
+
/** Header level (2 or 3). */
|
|
18
|
+
level: number;
|
|
19
|
+
/** The header's raw title text. */
|
|
20
|
+
title: string;
|
|
21
|
+
/** This section's address path: [h2Slug] or [h2Slug, h3Slug]. */
|
|
22
|
+
headerPath: string[];
|
|
23
|
+
/** 0-based line of the header itself. */
|
|
24
|
+
headerLine: number;
|
|
25
|
+
/** FULL span (Q1): header line through the line before the next same-or-higher header. */
|
|
26
|
+
text: string;
|
|
27
|
+
/** OWN text: header line through the line before the next header of ANY level. */
|
|
28
|
+
ownText: string;
|
|
29
|
+
}
|
|
30
|
+
/** Parse the addressable H2/H3 section tree of a markdown text.
|
|
31
|
+
* A matched section is NEVER empty by construction: the span includes the header
|
|
32
|
+
* line itself, so even a body-less `## alpha` (next line another header, or EOF)
|
|
33
|
+
* resolves to at least its own header — a matched-but-empty section can never
|
|
34
|
+
* quietly thin a compose (the structural half of the fail-loud contract; r1 A2). */
|
|
35
|
+
export declare function parseMarkdownSections(text: string): MarkdownSection[];
|
|
36
|
+
/** Resolve a header path against markdown text. FAIL-LOUD: no match is an error that
|
|
37
|
+
* names the miss and the real candidates at that altitude — never a silent empty. */
|
|
38
|
+
export declare function resolveAddress(text: string, headerPath: string[]): MarkdownSection;
|
|
39
|
+
export type AddressabilityFinding = {
|
|
40
|
+
kind: "duplicate-header-path";
|
|
41
|
+
headerPath: string;
|
|
42
|
+
lines: number[];
|
|
43
|
+
} | {
|
|
44
|
+
kind: "unaddressable-header";
|
|
45
|
+
headerPath: string;
|
|
46
|
+
line: number;
|
|
47
|
+
title: string;
|
|
48
|
+
} | {
|
|
49
|
+
kind: "unterminated-fence";
|
|
50
|
+
line: number;
|
|
51
|
+
};
|
|
52
|
+
/** The compose-gate validator: every H2/H3 must be uniquely addressable under the one
|
|
53
|
+
* slug rule, and the file must not silently lose sections. Findings, not throws —
|
|
54
|
+
* the caller decides the gate. */
|
|
55
|
+
export declare function validateMarkdownAddressability(text: string): AddressabilityFinding[];
|
|
56
|
+
//# sourceMappingURL=markdown-address.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-address.d.ts","sourceRoot":"","sources":["../../src/domain/markdown-address.ts"],"names":[],"mappings":"AA0BA,qBAAa,sBAAuB,SAAQ,KAAK;gBACnC,OAAO,EAAE,MAAM;CAI5B;AAED;;gDAEgD;AAChD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMnD;AAED,MAAM,WAAW,aAAa;IAC5B,qFAAqF;IACrF,GAAG,EAAE,MAAM,CAAC;IACZ,iDAAiD;IACjD,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,6FAA6F;AAC7F,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAsB3D;AAED,MAAM,WAAW,eAAe;IAC9B,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,0FAA0F;IAC1F,IAAI,EAAE,MAAM,CAAC;IACb,kFAAkF;IAClF,OAAO,EAAE,MAAM,CAAC;CACjB;AAyCD;;;;qFAIqF;AACrF,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,EAAE,CAgCrE;AAED;sFACsF;AACtF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,eAAe,CA4BlF;AAED,MA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