@warpgogol/forge 8.0.4 → 9.0.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/CHANGELOG.md +28 -0
- package/bin/cli.ts +25 -13
- package/dist/bin/cli.js +17 -13
- package/dist/bin/cli.js.map +1 -1
- package/dist/os/adr/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/adr/handlers/implement-stamp.js +1 -0
- package/dist/os/adr/handlers/implement-stamp.js.map +1 -1
- package/dist/os/adr/types.d.ts +2 -0
- package/dist/os/adr/types.d.ts.map +1 -1
- package/dist/os/agent/agent.module.d.ts +3 -0
- package/dist/os/agent/agent.module.d.ts.map +1 -0
- package/dist/os/agent/agent.module.js +60 -0
- package/dist/os/agent/agent.module.js.map +1 -0
- package/dist/os/agent/handlers/agent-delegate.d.ts +29 -0
- package/dist/os/agent/handlers/agent-delegate.d.ts.map +1 -0
- package/dist/os/agent/handlers/agent-delegate.js +187 -0
- package/dist/os/agent/handlers/agent-delegate.js.map +1 -0
- package/dist/os/agent/handlers/agent-tiers-validate.d.ts +15 -0
- package/dist/os/agent/handlers/agent-tiers-validate.d.ts.map +1 -0
- package/dist/os/agent/handlers/agent-tiers-validate.js +205 -0
- package/dist/os/agent/handlers/agent-tiers-validate.js.map +1 -0
- package/dist/os/agent/index.d.ts +5 -0
- package/dist/os/agent/index.d.ts.map +1 -0
- package/dist/os/agent/index.js +14 -0
- package/dist/os/agent/index.js.map +1 -0
- package/dist/os/agent/invoke-adapter.d.ts +43 -0
- package/dist/os/agent/invoke-adapter.d.ts.map +1 -0
- package/dist/os/agent/invoke-adapter.js +83 -0
- package/dist/os/agent/invoke-adapter.js.map +1 -0
- package/dist/os/authority/authority.module.d.ts.map +1 -1
- package/dist/os/authority/authority.module.js +2 -10
- package/dist/os/authority/authority.module.js.map +1 -1
- package/dist/os/checks/checks.module.d.ts +3 -0
- package/dist/os/checks/checks.module.d.ts.map +1 -0
- package/dist/os/checks/checks.module.js +90 -0
- package/dist/os/checks/checks.module.js.map +1 -0
- package/dist/os/checks/handlers/contribution-report.d.ts +35 -0
- package/dist/os/checks/handlers/contribution-report.d.ts.map +1 -0
- package/dist/os/checks/handlers/contribution-report.js +264 -0
- package/dist/os/checks/handlers/contribution-report.js.map +1 -0
- package/dist/os/checks/handlers/counters-export.d.ts +19 -0
- package/dist/os/checks/handlers/counters-export.d.ts.map +1 -0
- package/dist/os/checks/handlers/counters-export.js +122 -0
- package/dist/os/checks/handlers/counters-export.js.map +1 -0
- package/dist/os/checks/handlers/counters-journal.d.ts +67 -0
- package/dist/os/checks/handlers/counters-journal.d.ts.map +1 -0
- package/dist/os/checks/handlers/counters-journal.js +154 -0
- package/dist/os/checks/handlers/counters-journal.js.map +1 -0
- package/dist/os/checks/handlers/counters-validate.d.ts +11 -0
- package/dist/os/checks/handlers/counters-validate.d.ts.map +1 -0
- package/dist/os/checks/handlers/counters-validate.js +131 -0
- package/dist/os/checks/handlers/counters-validate.js.map +1 -0
- package/dist/os/checks/index.d.ts +6 -0
- package/dist/os/checks/index.d.ts.map +1 -0
- package/dist/os/checks/index.js +6 -0
- package/dist/os/checks/index.js.map +1 -0
- package/dist/os/compass/compass.module.d.ts.map +1 -1
- package/dist/os/compass/compass.module.js +55 -20
- package/dist/os/compass/compass.module.js.map +1 -1
- package/dist/os/compass/handlers/compass-header-scaffold.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-header-scaffold.js +4 -2
- package/dist/os/compass/handlers/compass-header-scaffold.js.map +1 -1
- package/dist/os/compass/handlers/compass-invariants-generate.d.ts +15 -0
- package/dist/os/compass/handlers/compass-invariants-generate.d.ts.map +1 -0
- package/dist/os/compass/handlers/compass-invariants-generate.js +208 -0
- package/dist/os/compass/handlers/compass-invariants-generate.js.map +1 -0
- package/dist/os/compass/handlers/compass-inventory-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-inventory-handler.js +46 -4
- package/dist/os/compass/handlers/compass-inventory-handler.js.map +1 -1
- package/dist/os/compass/handlers/invariant-bindings.d.ts +85 -0
- package/dist/os/compass/handlers/invariant-bindings.d.ts.map +1 -0
- package/dist/os/compass/handlers/invariant-bindings.js +390 -0
- package/dist/os/compass/handlers/invariant-bindings.js.map +1 -0
- package/dist/os/conformance/conformance.module.d.ts +3 -0
- package/dist/os/conformance/conformance.module.d.ts.map +1 -0
- package/dist/os/conformance/conformance.module.js +96 -0
- package/dist/os/conformance/conformance.module.js.map +1 -0
- package/dist/os/conformance/handlers/conformance-run.d.ts +14 -0
- package/dist/os/conformance/handlers/conformance-run.d.ts.map +1 -0
- package/dist/os/conformance/handlers/conformance-run.js +149 -0
- package/dist/os/conformance/handlers/conformance-run.js.map +1 -0
- package/dist/os/conformance/handlers/conformance-validate.d.ts +14 -0
- package/dist/os/conformance/handlers/conformance-validate.d.ts.map +1 -0
- package/dist/os/conformance/handlers/conformance-validate.js +216 -0
- package/dist/os/conformance/handlers/conformance-validate.js.map +1 -0
- package/dist/os/conformance/index.d.ts +6 -0
- package/dist/os/conformance/index.d.ts.map +1 -0
- package/dist/os/conformance/index.js +17 -0
- package/dist/os/conformance/index.js.map +1 -0
- package/dist/os/context/context.module.d.ts +3 -0
- package/dist/os/context/context.module.d.ts.map +1 -0
- package/dist/os/context/context.module.js +68 -0
- package/dist/os/context/context.module.js.map +1 -0
- package/dist/os/context/handlers/context-assemble.d.ts +28 -0
- package/dist/os/context/handlers/context-assemble.d.ts.map +1 -0
- package/dist/os/context/handlers/context-assemble.js +142 -0
- package/dist/os/context/handlers/context-assemble.js.map +1 -0
- package/dist/os/context/handlers/context-slate-eval.d.ts +15 -0
- package/dist/os/context/handlers/context-slate-eval.d.ts.map +1 -0
- package/dist/os/context/handlers/context-slate-eval.js +70 -0
- package/dist/os/context/handlers/context-slate-eval.js.map +1 -0
- package/dist/os/context/handlers/index-build.d.ts +19 -0
- package/dist/os/context/handlers/index-build.d.ts.map +1 -0
- package/dist/os/context/handlers/index-build.js +188 -0
- package/dist/os/context/handlers/index-build.js.map +1 -0
- package/dist/os/context/index.d.ts +5 -0
- package/dist/os/context/index.d.ts.map +1 -0
- package/dist/os/context/index.js +5 -0
- package/dist/os/context/index.js.map +1 -0
- package/dist/os/core/core.module.d.ts.map +1 -1
- package/dist/os/core/core.module.js +34 -11
- package/dist/os/core/core.module.js.map +1 -1
- package/dist/os/formal/formal.module.d.ts +3 -0
- package/dist/os/formal/formal.module.d.ts.map +1 -0
- package/dist/os/formal/formal.module.js +63 -0
- package/dist/os/formal/formal.module.js.map +1 -0
- package/dist/os/formal/handlers/proof-check.d.ts +10 -0
- package/dist/os/formal/handlers/proof-check.d.ts.map +1 -0
- package/dist/os/formal/handlers/proof-check.js +82 -0
- package/dist/os/formal/handlers/proof-check.js.map +1 -0
- package/dist/os/formal/index.d.ts +4 -0
- package/dist/os/formal/index.d.ts.map +1 -0
- package/dist/os/formal/index.js +16 -0
- package/dist/os/formal/index.js.map +1 -0
- package/dist/os/friction/friction.module.d.ts +3 -0
- package/dist/os/friction/friction.module.d.ts.map +1 -0
- package/dist/os/friction/friction.module.js +71 -0
- package/dist/os/friction/friction.module.js.map +1 -0
- package/dist/os/friction/handlers/friction-validate.d.ts +4 -0
- package/dist/os/friction/handlers/friction-validate.d.ts.map +1 -0
- package/dist/os/friction/handlers/friction-validate.js +228 -0
- package/dist/os/friction/handlers/friction-validate.js.map +1 -0
- package/dist/os/friction/index.d.ts +4 -0
- package/dist/os/friction/index.d.ts.map +1 -0
- package/dist/os/friction/index.js +23 -0
- package/dist/os/friction/index.js.map +1 -0
- package/dist/os/friction/types.d.ts +97 -0
- package/dist/os/friction/types.d.ts.map +1 -0
- package/dist/os/friction/types.js +78 -0
- package/dist/os/friction/types.js.map +1 -0
- package/dist/os/gate/gate.module.d.ts +3 -0
- package/dist/os/gate/gate.module.d.ts.map +1 -0
- package/dist/os/gate/gate.module.js +65 -0
- package/dist/os/gate/gate.module.js.map +1 -0
- package/dist/os/gate/handlers/gate-probe-catalog.d.ts +18 -0
- package/dist/os/gate/handlers/gate-probe-catalog.d.ts.map +1 -0
- package/dist/os/gate/handlers/gate-probe-catalog.js +66 -0
- package/dist/os/gate/handlers/gate-probe-catalog.js.map +1 -0
- package/dist/os/gate/handlers/gate-probe.d.ts +32 -0
- package/dist/os/gate/handlers/gate-probe.d.ts.map +1 -0
- package/dist/os/gate/handlers/gate-probe.js +228 -0
- package/dist/os/gate/handlers/gate-probe.js.map +1 -0
- package/dist/os/gate/index.d.ts +4 -0
- package/dist/os/gate/index.d.ts.map +1 -0
- package/dist/os/gate/index.js +4 -0
- package/dist/os/gate/index.js.map +1 -0
- package/dist/os/instructions/handlers/budget-validate.d.ts +29 -0
- package/dist/os/instructions/handlers/budget-validate.d.ts.map +1 -0
- package/dist/os/instructions/handlers/budget-validate.js +164 -0
- package/dist/os/instructions/handlers/budget-validate.js.map +1 -0
- package/dist/os/instructions/handlers/scar-migrate.d.ts +13 -0
- package/dist/os/instructions/handlers/scar-migrate.d.ts.map +1 -0
- package/dist/os/instructions/handlers/scar-migrate.js +270 -0
- package/dist/os/instructions/handlers/scar-migrate.js.map +1 -0
- package/dist/os/instructions/instructions.module.d.ts +3 -0
- package/dist/os/instructions/instructions.module.d.ts.map +1 -0
- package/dist/os/instructions/instructions.module.js +74 -0
- package/dist/os/instructions/instructions.module.js.map +1 -0
- package/dist/os/knowledge/handlers/knowledge-authz-probe.d.ts +16 -0
- package/dist/os/knowledge/handlers/knowledge-authz-probe.d.ts.map +1 -0
- package/dist/os/knowledge/handlers/knowledge-authz-probe.js +198 -0
- package/dist/os/knowledge/handlers/knowledge-authz-probe.js.map +1 -0
- package/dist/os/knowledge/handlers/knowledge-rebuild.d.ts +15 -0
- package/dist/os/knowledge/handlers/knowledge-rebuild.d.ts.map +1 -0
- package/dist/os/knowledge/handlers/knowledge-rebuild.js +137 -0
- package/dist/os/knowledge/handlers/knowledge-rebuild.js.map +1 -0
- package/dist/os/knowledge/index.d.ts +4 -0
- package/dist/os/knowledge/index.d.ts.map +1 -0
- package/dist/os/knowledge/index.js +4 -0
- package/dist/os/knowledge/index.js.map +1 -0
- package/dist/os/knowledge/knowledge.module.d.ts +3 -0
- package/dist/os/knowledge/knowledge.module.d.ts.map +1 -0
- package/dist/os/knowledge/knowledge.module.js +61 -0
- package/dist/os/knowledge/knowledge.module.js.map +1 -0
- package/dist/os/mission/handlers/archive.d.ts.map +1 -1
- package/dist/os/mission/handlers/archive.js +102 -6
- package/dist/os/mission/handlers/archive.js.map +1 -1
- package/dist/os/mission/mission.module.d.ts.map +1 -1
- package/dist/os/mission/mission.module.js +7 -0
- package/dist/os/mission/mission.module.js.map +1 -1
- package/dist/os/naming/naming-convention.d.ts.map +1 -1
- package/dist/os/naming/naming-convention.js +2 -1
- package/dist/os/naming/naming-convention.js.map +1 -1
- package/dist/os/program/schemas.d.ts +5 -5
- package/dist/os/queue/handlers/queue-validate.d.ts.map +1 -1
- package/dist/os/queue/handlers/queue-validate.js +129 -5
- package/dist/os/queue/handlers/queue-validate.js.map +1 -1
- package/dist/os/queue/queue.module.d.ts.map +1 -1
- package/dist/os/queue/queue.module.js +12 -31
- package/dist/os/queue/queue.module.js.map +1 -1
- package/dist/os/queue/types.d.ts +23 -0
- package/dist/os/queue/types.d.ts.map +1 -1
- package/dist/os/queue/types.js +24 -3
- package/dist/os/queue/types.js.map +1 -1
- package/dist/os/resolver/handlers/resolver-doors-audit.d.ts +22 -0
- package/dist/os/resolver/handlers/resolver-doors-audit.d.ts.map +1 -0
- package/dist/os/resolver/handlers/resolver-doors-audit.js +238 -0
- package/dist/os/resolver/handlers/resolver-doors-audit.js.map +1 -0
- package/dist/os/resolver/resolver.module.d.ts +3 -0
- package/dist/os/resolver/resolver.module.d.ts.map +1 -0
- package/dist/os/resolver/resolver.module.js +40 -0
- package/dist/os/resolver/resolver.module.js.map +1 -0
- package/dist/os/rfc/acceptance.d.ts +2 -1
- package/dist/os/rfc/acceptance.d.ts.map +1 -1
- package/dist/os/rfc/acceptance.js +158 -82
- package/dist/os/rfc/acceptance.js.map +1 -1
- package/dist/os/rfc/decision-log.d.ts +10 -0
- package/dist/os/rfc/decision-log.d.ts.map +1 -1
- package/dist/os/rfc/decision-log.js +14 -0
- package/dist/os/rfc/decision-log.js.map +1 -1
- package/dist/os/rfc/handlers/fixed-inputs.d.ts +29 -0
- package/dist/os/rfc/handlers/fixed-inputs.d.ts.map +1 -0
- package/dist/os/rfc/handlers/fixed-inputs.js +214 -0
- package/dist/os/rfc/handlers/fixed-inputs.js.map +1 -0
- package/dist/os/rfc/handlers/implement-stamp-deviations.d.ts +47 -0
- package/dist/os/rfc/handlers/implement-stamp-deviations.d.ts.map +1 -0
- package/dist/os/rfc/handlers/implement-stamp-deviations.js +145 -0
- package/dist/os/rfc/handlers/implement-stamp-deviations.js.map +1 -0
- package/dist/os/rfc/handlers/implement-stamp-origin.d.ts +15 -1
- package/dist/os/rfc/handlers/implement-stamp-origin.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp-origin.js +57 -5
- package/dist/os/rfc/handlers/implement-stamp-origin.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp-outcome.d.ts +42 -0
- package/dist/os/rfc/handlers/implement-stamp-outcome.d.ts.map +1 -0
- package/dist/os/rfc/handlers/implement-stamp-outcome.js +102 -0
- package/dist/os/rfc/handlers/implement-stamp-outcome.js.map +1 -0
- package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.js +101 -12
- package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
- package/dist/os/rfc/handlers/index-graph.d.ts +4 -2
- package/dist/os/rfc/handlers/index-graph.d.ts.map +1 -1
- package/dist/os/rfc/handlers/index-graph.js +57 -3
- package/dist/os/rfc/handlers/index-graph.js.map +1 -1
- package/dist/os/rfc/handlers/list-create.d.ts.map +1 -1
- package/dist/os/rfc/handlers/list-create.js +117 -12
- package/dist/os/rfc/handlers/list-create.js.map +1 -1
- package/dist/os/rfc/handlers/supersede-propose.d.ts.map +1 -1
- package/dist/os/rfc/handlers/supersede-propose.js +34 -7
- package/dist/os/rfc/handlers/supersede-propose.js.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.d.ts +4 -1
- package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.js +159 -11
- package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
- package/dist/os/rfc/handlers/validate.d.ts.map +1 -1
- package/dist/os/rfc/handlers/validate.js +10 -1
- package/dist/os/rfc/handlers/validate.js.map +1 -1
- package/dist/os/rfc/outcome-probe.d.ts +20 -0
- package/dist/os/rfc/outcome-probe.d.ts.map +1 -0
- package/dist/os/rfc/outcome-probe.js +315 -0
- package/dist/os/rfc/outcome-probe.js.map +1 -0
- package/dist/os/rfc/reachable-symbol.d.ts.map +1 -1
- package/dist/os/rfc/reachable-symbol.js +51 -12
- package/dist/os/rfc/reachable-symbol.js.map +1 -1
- package/dist/os/rfc/rfc.module.d.ts.map +1 -1
- package/dist/os/rfc/rfc.module.js +48 -11
- package/dist/os/rfc/rfc.module.js.map +1 -1
- package/dist/os/rfc/types.d.ts +90 -12
- package/dist/os/rfc/types.d.ts.map +1 -1
- package/dist/os/rfc/types.js +8 -7
- package/dist/os/rfc/types.js.map +1 -1
- package/dist/os/rfc/verification-evidence.d.ts +4 -1
- package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
- package/dist/os/rfc/verification-evidence.js +69 -17
- package/dist/os/rfc/verification-evidence.js.map +1 -1
- package/dist/os/rfc/verification-origin.d.ts +8 -0
- package/dist/os/rfc/verification-origin.d.ts.map +1 -1
- package/dist/os/rfc/verification-origin.js +48 -1
- package/dist/os/rfc/verification-origin.js.map +1 -1
- package/dist/os/rfc/verification-refresh.d.ts.map +1 -1
- package/dist/os/rfc/verification-refresh.js +19 -2
- package/dist/os/rfc/verification-refresh.js.map +1 -1
- package/dist/os/rfc/verification-verdicts.d.ts +14 -0
- package/dist/os/rfc/verification-verdicts.d.ts.map +1 -0
- package/dist/os/rfc/verification-verdicts.js +104 -0
- package/dist/os/rfc/verification-verdicts.js.map +1 -0
- package/dist/os/rfc/verifier/rfc-1391/support.d.ts +34 -0
- package/dist/os/rfc/verifier/rfc-1391/support.d.ts.map +1 -0
- package/dist/os/rfc/verifier/rfc-1391/support.js +184 -0
- package/dist/os/rfc/verifier/rfc-1391/support.js.map +1 -0
- package/dist/os/session/frontmatter-io.d.ts +3 -1
- package/dist/os/session/frontmatter-io.d.ts.map +1 -1
- package/dist/os/session/frontmatter-io.js +3 -1
- package/dist/os/session/frontmatter-io.js.map +1 -1
- package/dist/os/session/handlers/session-audit-report.d.ts +20 -0
- package/dist/os/session/handlers/session-audit-report.d.ts.map +1 -0
- package/dist/os/session/handlers/session-audit-report.js +78 -0
- package/dist/os/session/handlers/session-audit-report.js.map +1 -0
- package/dist/os/session/handlers/session-audit.d.ts +25 -0
- package/dist/os/session/handlers/session-audit.d.ts.map +1 -0
- package/dist/os/session/handlers/session-audit.js +265 -0
- package/dist/os/session/handlers/session-audit.js.map +1 -0
- package/dist/os/session/session.module.d.ts.map +1 -1
- package/dist/os/session/session.module.js +49 -2
- package/dist/os/session/session.module.js.map +1 -1
- package/dist/os/spec/spec-amendments.d.ts +7 -0
- package/dist/os/spec/spec-amendments.d.ts.map +1 -0
- package/dist/os/spec/spec-amendments.js +86 -0
- package/dist/os/spec/spec-amendments.js.map +1 -0
- package/dist/os/spec/spec-materialize.d.ts.map +1 -1
- package/dist/os/spec/spec-materialize.js +22 -24
- package/dist/os/spec/spec-materialize.js.map +1 -1
- package/dist/os/spec/spec-status.d.ts.map +1 -1
- package/dist/os/spec/spec-status.js +25 -29
- package/dist/os/spec/spec-status.js.map +1 -1
- package/dist/os/spec/spec-validate.d.ts.map +1 -1
- package/dist/os/spec/spec-validate.js +9 -29
- package/dist/os/spec/spec-validate.js.map +1 -1
- package/dist/os/spec/spec.module.d.ts.map +1 -1
- package/dist/os/spec/spec.module.js +7 -36
- package/dist/os/spec/spec.module.js.map +1 -1
- package/dist/os/trajectory/handlers/journal-io.d.ts +51 -0
- package/dist/os/trajectory/handlers/journal-io.d.ts.map +1 -0
- package/dist/os/trajectory/handlers/journal-io.js +161 -0
- package/dist/os/trajectory/handlers/journal-io.js.map +1 -0
- package/dist/os/trajectory/handlers/outcome-record.d.ts +16 -0
- package/dist/os/trajectory/handlers/outcome-record.d.ts.map +1 -0
- package/dist/os/trajectory/handlers/outcome-record.js +142 -0
- package/dist/os/trajectory/handlers/outcome-record.js.map +1 -0
- package/dist/os/trajectory/handlers/trajectory-index.d.ts +59 -0
- package/dist/os/trajectory/handlers/trajectory-index.d.ts.map +1 -0
- package/dist/os/trajectory/handlers/trajectory-index.js +427 -0
- package/dist/os/trajectory/handlers/trajectory-index.js.map +1 -0
- package/dist/os/trajectory/handlers/trajectory-recall.d.ts +21 -0
- package/dist/os/trajectory/handlers/trajectory-recall.d.ts.map +1 -0
- package/dist/os/trajectory/handlers/trajectory-recall.js +176 -0
- package/dist/os/trajectory/handlers/trajectory-recall.js.map +1 -0
- package/dist/os/trajectory/index.d.ts +5 -0
- package/dist/os/trajectory/index.d.ts.map +1 -0
- package/dist/os/trajectory/index.js +5 -0
- package/dist/os/trajectory/index.js.map +1 -0
- package/dist/os/trajectory/trajectory.module.d.ts +3 -0
- package/dist/os/trajectory/trajectory.module.d.ts.map +1 -0
- package/dist/os/trajectory/trajectory.module.js +91 -0
- package/dist/os/trajectory/trajectory.module.js.map +1 -0
- package/dist/os/werkstatt/handlers/session-close.d.ts +13 -0
- package/dist/os/werkstatt/handlers/session-close.d.ts.map +1 -0
- package/dist/os/werkstatt/handlers/session-close.js +53 -0
- package/dist/os/werkstatt/handlers/session-close.js.map +1 -0
- package/dist/os/werkstatt/handlers/session-engine.d.ts +3 -0
- package/dist/os/werkstatt/handlers/session-engine.d.ts.map +1 -0
- package/dist/os/werkstatt/handlers/session-engine.js +25 -0
- package/dist/os/werkstatt/handlers/session-engine.js.map +1 -0
- package/dist/os/werkstatt/handlers/session-open.d.ts +10 -0
- package/dist/os/werkstatt/handlers/session-open.d.ts.map +1 -0
- package/dist/os/werkstatt/handlers/session-open.js +43 -0
- package/dist/os/werkstatt/handlers/session-open.js.map +1 -0
- package/dist/os/werkstatt/handlers/session-status.d.ts +9 -0
- package/dist/os/werkstatt/handlers/session-status.d.ts.map +1 -0
- package/dist/os/werkstatt/handlers/session-status.js +31 -0
- package/dist/os/werkstatt/handlers/session-status.js.map +1 -0
- package/dist/os/werkstatt/werkstatt.module.d.ts.map +1 -1
- package/dist/os/werkstatt/werkstatt.module.js +98 -3
- package/dist/os/werkstatt/werkstatt.module.js.map +1 -1
- package/dist/src/authority/delegations.d.ts +1 -1
- package/dist/src/authority/delegations.d.ts.map +1 -1
- package/dist/src/authority/delegations.js +2 -0
- package/dist/src/authority/delegations.js.map +1 -1
- package/dist/src/cli-flags.d.ts.map +1 -1
- package/dist/src/cli-flags.js +90 -11
- package/dist/src/cli-flags.js.map +1 -1
- package/dist/src/compass/index.d.ts +2 -0
- package/dist/src/compass/index.d.ts.map +1 -0
- package/dist/src/compass/index.js +26 -0
- package/dist/src/compass/index.js.map +1 -0
- package/dist/src/compass/invariant-parser.d.ts +37 -0
- package/dist/src/compass/invariant-parser.d.ts.map +1 -0
- package/dist/src/compass/invariant-parser.js +218 -0
- package/dist/src/compass/invariant-parser.js.map +1 -0
- package/dist/src/config/forge-config.d.ts +108 -0
- package/dist/src/config/forge-config.d.ts.map +1 -1
- package/dist/src/config/forge-config.js +79 -9
- package/dist/src/config/forge-config.js.map +1 -1
- package/dist/src/conformance/index.d.ts +42 -0
- package/dist/src/conformance/index.d.ts.map +1 -0
- package/dist/src/conformance/index.js +193 -0
- package/dist/src/conformance/index.js.map +1 -0
- package/dist/src/formal/exhaustive.d.ts +40 -0
- package/dist/src/formal/exhaustive.d.ts.map +1 -0
- package/dist/src/formal/exhaustive.js +140 -0
- package/dist/src/formal/exhaustive.js.map +1 -0
- package/dist/src/formal/index.d.ts +7 -0
- package/dist/src/formal/index.d.ts.map +1 -0
- package/dist/src/formal/index.js +13 -0
- package/dist/src/formal/index.js.map +1 -0
- package/dist/src/formal/proof-runner.d.ts +51 -0
- package/dist/src/formal/proof-runner.d.ts.map +1 -0
- package/dist/src/formal/proof-runner.js +450 -0
- package/dist/src/formal/proof-runner.js.map +1 -0
- package/dist/src/formal/proof-spec.d.ts +69 -0
- package/dist/src/formal/proof-spec.d.ts.map +1 -0
- package/dist/src/formal/proof-spec.js +96 -0
- package/dist/src/formal/proof-spec.js.map +1 -0
- package/dist/src/knowledge/schema.d.ts +8 -0
- package/dist/src/knowledge/schema.d.ts.map +1 -1
- package/dist/src/knowledge/schema.js +5 -0
- package/dist/src/knowledge/schema.js.map +1 -1
- package/dist/src/knowledge/serialize.d.ts.map +1 -1
- package/dist/src/knowledge/serialize.js +3 -0
- package/dist/src/knowledge/serialize.js.map +1 -1
- package/dist/src/onboarding/agents-generate.d.ts.map +1 -1
- package/dist/src/onboarding/agents-generate.js +17 -2
- package/dist/src/onboarding/agents-generate.js.map +1 -1
- package/dist/src/onboarding/doctor.d.ts.map +1 -1
- package/dist/src/onboarding/doctor.js +87 -1
- package/dist/src/onboarding/doctor.js.map +1 -1
- package/dist/src/onboarding/init.js +3 -3
- package/dist/src/onboarding/init.js.map +1 -1
- package/dist/src/profiles/profile-schema.d.ts +8 -0
- package/dist/src/profiles/profile-schema.d.ts.map +1 -1
- package/dist/src/profiles/profile-schema.js +10 -2
- package/dist/src/profiles/profile-schema.js.map +1 -1
- package/dist/src/profiles/stack-profile.d.ts +4 -0
- package/dist/src/profiles/stack-profile.d.ts.map +1 -1
- package/dist/src/reachability/command-mentions.d.ts +17 -0
- package/dist/src/reachability/command-mentions.d.ts.map +1 -0
- package/dist/src/reachability/command-mentions.js +81 -0
- package/dist/src/reachability/command-mentions.js.map +1 -0
- package/dist/src/registry.d.ts +10 -0
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +40 -2
- package/dist/src/registry.js.map +1 -1
- package/dist/src/types.d.ts +51 -3
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +11 -14
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/sync-fs.d.ts +1 -1
- package/dist/src/utils/sync-fs.d.ts.map +1 -1
- package/dist/src/utils/sync-fs.js +2 -1
- package/dist/src/utils/sync-fs.js.map +1 -1
- package/docs/reference/forge-yaml.md +20 -0
- package/os/adr/handlers/implement-stamp.ts +2 -0
- package/os/adr/types.ts +2 -0
- package/os/agent/agent.module.ts +64 -0
- package/os/agent/handlers/agent-delegate.ts +227 -0
- package/os/agent/handlers/agent-tiers-validate.ts +228 -0
- package/os/agent/index.ts +14 -0
- package/os/agent/invoke-adapter.ts +119 -0
- package/os/authority/authority.module.ts +2 -10
- package/os/checks/checks.module.ts +95 -0
- package/os/checks/handlers/contribution-report.test.ts +244 -0
- package/os/checks/handlers/contribution-report.ts +316 -0
- package/os/checks/handlers/counters-export.test.ts +175 -0
- package/os/checks/handlers/counters-export.ts +170 -0
- package/os/checks/handlers/counters-journal.test.ts +187 -0
- package/os/checks/handlers/counters-journal.ts +179 -0
- package/os/checks/handlers/counters-validate.test.ts +176 -0
- package/os/checks/handlers/counters-validate.ts +159 -0
- package/os/checks/handlers/variant-candidates.test.ts +65 -0
- package/os/checks/index.ts +15 -0
- package/os/compass/compass.module.ts +58 -20
- package/os/compass/handlers/compass-header-scaffold.ts +4 -2
- package/os/compass/handlers/compass-invariants-generate.ts +293 -0
- package/os/compass/handlers/compass-inventory-handler.ts +59 -4
- package/os/compass/handlers/invariant-bindings.ts +526 -0
- package/os/compass/handlers/tests/compass-invariant-binding.test.ts +500 -0
- package/os/compass/handlers/tests/compass-invariants-generate.test.ts +235 -0
- package/os/compass/handlers/tests/compass-migrate.test.ts +5 -3
- package/os/conformance/conformance.module.ts +105 -0
- package/os/conformance/handlers/conformance-run.ts +175 -0
- package/os/conformance/handlers/conformance-validate.ts +334 -0
- package/os/conformance/handlers/tests/conformance.test.ts +657 -0
- package/os/conformance/index.ts +19 -0
- package/os/context/context.module.ts +73 -0
- package/os/context/handlers/context-assemble.test.ts +89 -0
- package/os/context/handlers/context-assemble.ts +171 -0
- package/os/context/handlers/context-slate-eval.test.ts +64 -0
- package/os/context/handlers/context-slate-eval.ts +86 -0
- package/os/context/handlers/index-build.test.ts +68 -0
- package/os/context/handlers/index-build.ts +211 -0
- package/os/context/handlers/no-model-deps.test.ts +32 -0
- package/os/context/handlers/slate-fill.test.ts +31 -0
- package/os/context/index.ts +4 -0
- package/os/core/core.module.ts +34 -11
- package/os/formal/formal.module.ts +67 -0
- package/os/formal/handlers/proof-check.test.ts +337 -0
- package/os/formal/handlers/proof-check.ts +100 -0
- package/os/formal/index.ts +17 -0
- package/os/friction/friction-validate.test.ts +442 -0
- package/os/friction/friction.module.ts +74 -0
- package/os/friction/handlers/friction-validate.ts +349 -0
- package/os/friction/index.ts +30 -0
- package/os/friction/types.ts +113 -0
- package/os/gate/gate.module.ts +69 -0
- package/os/gate/handlers/gate-probe-catalog.test.ts +76 -0
- package/os/gate/handlers/gate-probe-catalog.ts +85 -0
- package/os/gate/handlers/gate-probe.test.ts +108 -0
- package/os/gate/handlers/gate-probe.ts +252 -0
- package/os/gate/index.ts +3 -0
- package/os/instructions/budget.test.ts +125 -0
- package/os/instructions/handlers/budget-validate.ts +197 -0
- package/os/instructions/handlers/scar-migrate.ts +292 -0
- package/os/instructions/instructions.module.ts +78 -0
- package/os/knowledge/handlers/knowledge-authz-probe.test.ts +86 -0
- package/os/knowledge/handlers/knowledge-authz-probe.ts +236 -0
- package/os/knowledge/handlers/knowledge-rebuild.test.ts +76 -0
- package/os/knowledge/handlers/knowledge-rebuild.ts +163 -0
- package/os/knowledge/index.ts +3 -0
- package/os/knowledge/knowledge.module.ts +65 -0
- package/os/mission/handlers/archive.ts +113 -6
- package/os/mission/handlers/ship-inflight-degraded.test.ts +105 -0
- package/os/mission/mission.module.ts +8 -0
- package/os/naming/naming-convention.ts +2 -1
- package/os/queue/decision-ledger.test.ts +39 -0
- package/os/queue/handlers/queue-validate.ts +132 -5
- package/os/queue/queue-validate.test.ts +194 -0
- package/os/queue/queue.module.ts +12 -31
- package/os/queue/types.ts +26 -3
- package/os/resolver/handlers/resolver-doors-audit.test.ts +147 -0
- package/os/resolver/handlers/resolver-doors-audit.ts +281 -0
- package/os/resolver/resolver.module.ts +43 -0
- package/os/rfc/acceptance-reachable.test.ts +78 -0
- package/os/rfc/acceptance.test.ts +229 -1
- package/os/rfc/acceptance.ts +141 -45
- package/os/rfc/decision-log.ts +15 -0
- package/os/rfc/handlers/fixed-inputs.ts +252 -0
- package/os/rfc/handlers/implement-stamp-deviations.test.ts +140 -0
- package/os/rfc/handlers/implement-stamp-deviations.ts +183 -0
- package/os/rfc/handlers/implement-stamp-formal.test.ts +168 -0
- package/os/rfc/handlers/implement-stamp-origin.ts +87 -11
- package/os/rfc/handlers/implement-stamp-outcome.test.ts +193 -0
- package/os/rfc/handlers/implement-stamp-outcome.ts +146 -0
- package/os/rfc/handlers/implement-stamp.ts +107 -10
- package/os/rfc/handlers/index-graph.ts +66 -4
- package/os/rfc/handlers/list-create.test.ts +142 -0
- package/os/rfc/handlers/list-create.ts +140 -12
- package/os/rfc/handlers/supersede-propose.ts +50 -7
- package/os/rfc/handlers/tests/index-graph.test.ts +165 -0
- package/os/rfc/handlers/validate-rules-rfc1453.test.ts +163 -0
- package/os/rfc/handlers/validate-rules-rfc1454.test.ts +136 -0
- package/os/rfc/handlers/validate-rules-rfc1455.test.ts +282 -0
- package/os/rfc/handlers/validate-rules.test.ts +129 -2
- package/os/rfc/handlers/validate-rules.ts +233 -9
- package/os/rfc/handlers/validate.ts +11 -0
- package/os/rfc/outcome-probe.ts +326 -0
- package/os/rfc/reachable-symbol.ts +64 -16
- package/os/rfc/rfc-0000-template.md +4 -0
- package/os/rfc/rfc.module.ts +51 -11
- package/os/rfc/types.ts +109 -14
- package/os/rfc/verification-evidence.ts +74 -14
- package/os/rfc/verification-origin.ts +61 -1
- package/os/rfc/verification-refresh.test.ts +63 -0
- package/os/rfc/verification-refresh.ts +24 -2
- package/os/rfc/verification-verdicts.ts +123 -0
- package/os/rfc/verifier/rfc-1391/ac1-proved-exit-0.acceptance.test.ts +151 -0
- package/os/rfc/verifier/rfc-1391/ac2-unavailable-nonzero.acceptance.test.ts +111 -0
- package/os/rfc/verifier/rfc-1391/ac3-version-mismatch-error.acceptance.test.ts +97 -0
- package/os/rfc/verifier/rfc-1391/ac4-cardinality-mismatch-error.acceptance.test.ts +179 -0
- package/os/rfc/verifier/rfc-1391/ac5-imp13-formal-stamp-block.acceptance.test.ts +295 -0
- package/os/rfc/verifier/rfc-1391/ac6-formal-high-tier-gates.acceptance.test.ts +203 -0
- package/os/rfc/verifier/rfc-1391/ac7-v46-empty-assumptions.acceptance.test.ts +126 -0
- package/os/rfc/verifier/rfc-1391/cx1-emit-proof-envelope.acceptance.test.ts +130 -0
- package/os/rfc/verifier/rfc-1391/fixtures/no-report.proof.test.ts +35 -0
- package/os/rfc/verifier/rfc-1391/fixtures/small-domain.proof.test.ts +41 -0
- package/os/rfc/verifier/rfc-1391/origin-proof-spec-entry.acceptance.test.ts +175 -0
- package/os/rfc/verifier/rfc-1391/support.ts +205 -0
- package/os/session/fixtures/audit/clean.md +7 -0
- package/os/session/fixtures/audit/denied-retry.md +10 -0
- package/os/session/frontmatter-io.ts +3 -1
- package/os/session/handlers/session-audit-detectors.test.ts +91 -0
- package/os/session/handlers/session-audit-report.test.ts +64 -0
- package/os/session/handlers/session-audit-report.ts +93 -0
- package/os/session/handlers/session-audit.test.ts +80 -0
- package/os/session/handlers/session-audit.ts +317 -0
- package/os/session/session.module.ts +51 -2
- package/os/spec/spec-amendments.ts +91 -0
- package/os/spec/spec-materialize.ts +20 -22
- package/os/spec/spec-status.test.ts +17 -1
- package/os/spec/spec-status.ts +23 -29
- package/os/spec/spec-validate.test.ts +45 -0
- package/os/spec/spec-validate.ts +9 -29
- package/os/spec/spec.module.ts +7 -36
- package/os/trajectory/handlers/extract-units.test.ts +69 -0
- package/os/trajectory/handlers/journal-io.ts +211 -0
- package/os/trajectory/handlers/outcome-record.test.ts +192 -0
- package/os/trajectory/handlers/outcome-record.ts +162 -0
- package/os/trajectory/handlers/producer-trust.test.ts +163 -0
- package/os/trajectory/handlers/trajectory-index.test.ts +246 -0
- package/os/trajectory/handlers/trajectory-index.ts +470 -0
- package/os/trajectory/handlers/trajectory-recall.test.ts +227 -0
- package/os/trajectory/handlers/trajectory-recall.ts +198 -0
- package/os/trajectory/handlers/trajectory.test.ts +94 -0
- package/os/trajectory/handlers/verdict-binding.test.ts +209 -0
- package/os/trajectory/index.ts +4 -0
- package/os/trajectory/trajectory.module.ts +96 -0
- package/os/werkstatt/handlers/session-close.ts +79 -0
- package/os/werkstatt/handlers/session-engine.ts +31 -0
- package/os/werkstatt/handlers/session-open.ts +65 -0
- package/os/werkstatt/handlers/session-status.ts +52 -0
- package/os/werkstatt/werkstatt.module.ts +101 -3
- package/package.json +194 -1
- package/profiles/forge-shell.yaml +3 -1
- package/profiles/godot-game.yaml +3 -1
- package/profiles/knowledge.yaml +3 -1
- package/profiles/phaser-game.yaml +3 -1
- package/profiles/site-workshop.yaml +3 -1
- package/profiles/typescript.yaml +3 -1
- package/skills/_shared/agent-operating-model.md +1 -1
- package/skills/_shared/fo-pipeline-conventions.md +5 -1
- package/skills/fo/fo-add-tests/SKILL.md +9 -1
- package/skills/fo/fo-add-tests/pbt-guide.md +1 -0
- package/skills/fo/fo-compass-annotate/SKILL.md +18 -0
- package/skills/fo/fo-compass-annotate/templates/header-format.md +3 -2
- package/skills/fo/fo-fix/SKILL.md +14 -8
- package/skills/fo/fo-idea-create-adr/SKILL.md +5 -3
- package/skills/fo/fo-idea-create-rfc/SKILL.md +20 -8
- package/skills/fo/fo-idea-create-rfc/acceptance-criteria-standard.md +20 -0
- package/skills/fo/fo-idea-i-just-want-to-see-the-result/SKILL.md +31 -13
- package/skills/fo/fo-idea-implement/SKILL.md +20 -14
- package/skills/fo/fo-idea-plan/SKILL.md +1 -1
- package/skills/fo/fo-knowledge-distill/SKILL.md +7 -0
- package/skills/fo/fo-memory-sync/SKILL.md +6 -0
- package/skills/fo/fo-reproduce/SKILL.md +116 -0
- package/skills/fo/fo-review/SKILL.md +11 -5
- package/skills/fo/fo-session-retro/SKILL.md +134 -49
- package/skills/fo/fo-step-commit/SKILL.md +4 -3
- package/skills/fo/fo-triage/SKILL.md +9 -0
- package/skills/shared/grilling/SKILL.md +4 -0
- package/skills/shared/grilling/learned-principles.md +7 -0
- package/skills/shared/grilling/qa-log.md +39 -0
- package/src/authority/delegations.ts +2 -0
- package/src/cli-flags.ts +110 -11
- package/src/compass/index.ts +37 -0
- package/src/compass/invariant-parser.ts +253 -0
- package/src/config/forge-config.ts +111 -9
- package/src/conformance/index.ts +281 -0
- package/src/formal/exhaustive.test.ts +117 -0
- package/src/formal/exhaustive.ts +182 -0
- package/src/formal/index.ts +23 -0
- package/src/formal/proof-runner.test.ts +310 -0
- package/src/formal/proof-runner.ts +562 -0
- package/src/formal/proof-spec.test.ts +70 -0
- package/src/formal/proof-spec.ts +131 -0
- package/src/knowledge/schema.ts +9 -0
- package/src/knowledge/serialize.ts +3 -0
- package/src/onboarding/agents-generate.ts +18 -2
- package/src/onboarding/doctor.ts +93 -1
- package/src/onboarding/init.ts +3 -3
- package/src/onboarding/templates/behavioral-layer-core.md +1 -1
- package/src/profiles/profile-schema.ts +10 -2
- package/src/reachability/command-mentions.ts +87 -0
- package/src/registry.ts +44 -2
- package/src/tests/bindings-schema.test.ts +4 -0
- package/src/tests/cli-flags.test.ts +225 -0
- package/src/tests/fixtures/agents-generate-business-before.txt +4 -2
- package/src/tests/forge-config.test.ts +5 -2
- package/src/tests/implement-stamp.test.ts +51 -0
- package/src/tests/rfc-verification-verdict-ingest.test.ts +244 -0
- package/src/tests/session-retro.test.ts +47 -0
- package/src/types.ts +59 -18
- package/src/utils/sync-fs.ts +2 -0
package/os/spec/spec-status.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
<item>RFC-0396: initial spec.status handler — per-node states, blockers, front, progress.</item>
|
|
10
10
|
<item>RFC-1240: consumer-aware front — foreignOwned flag/list, foreign deps are not local blockers, --consumer flag resolution.</item>
|
|
11
11
|
<item>FIX: loadRfcStatuses delegated to loadRfcStatusMap (recursive) — archived implemented RFCs resolve their status, so terminal dependencies unblock the front instead of collapsing nodes to stale draft.</item>
|
|
12
|
+
<item>RFC-1363: fail-closed amendment loader SPEC-14 + target repairs AMD-008..011</item>
|
|
12
13
|
</CHANGE_SUMMARY>
|
|
13
14
|
*/
|
|
14
15
|
|
|
@@ -24,11 +25,9 @@ import type {
|
|
|
24
25
|
} from "../../src/types.ts";
|
|
25
26
|
import {
|
|
26
27
|
forgeSpecSchema,
|
|
27
|
-
specAmendmentSchema,
|
|
28
28
|
isForeignConsumerDep,
|
|
29
29
|
isForeignOwnedNode,
|
|
30
30
|
type ForgeSpec,
|
|
31
|
-
type SpecAmendment,
|
|
32
31
|
} from "./spec-schema.ts";
|
|
33
32
|
import { loadRfcStatusMap } from "../rfc/frontmatter-io.ts";
|
|
34
33
|
|
|
@@ -100,31 +99,7 @@ async function loadRfcStatuses(
|
|
|
100
99
|
return loadRfcStatusMap(rfcDir);
|
|
101
100
|
}
|
|
102
101
|
|
|
103
|
-
|
|
104
|
-
const amendmentsDir = path.join(specDir, "amendments");
|
|
105
|
-
if (!existsSync(amendmentsDir)) return [];
|
|
106
|
-
|
|
107
|
-
const entries = (await fs.readdir(amendmentsDir)).map((e) => e.name);
|
|
108
|
-
const amendments: SpecAmendment[] = [];
|
|
109
|
-
|
|
110
|
-
for (const entry of entries) {
|
|
111
|
-
if (!entry.endsWith(".md")) continue;
|
|
112
|
-
try {
|
|
113
|
-
const content = await fs.readFile(path.join(amendmentsDir, entry));
|
|
114
|
-
const fmMatch = content.match(/^---\n([\s\S]*?)\n---/);
|
|
115
|
-
if (!fmMatch) continue;
|
|
116
|
-
const raw = parseYaml(fmMatch[1]) as unknown;
|
|
117
|
-
const parsed = specAmendmentSchema.safeParse(raw);
|
|
118
|
-
if (parsed.success) {
|
|
119
|
-
amendments.push(parsed.data);
|
|
120
|
-
}
|
|
121
|
-
} catch {
|
|
122
|
-
// skip unreadable files
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return amendments;
|
|
127
|
-
}
|
|
102
|
+
import { loadAmendments } from "./spec-amendments.ts";
|
|
128
103
|
|
|
129
104
|
function computeFront(
|
|
130
105
|
nodes: SpecNodeStatus[],
|
|
@@ -230,8 +205,27 @@ export async function runSpecStatus(
|
|
|
230
205
|
total: nodes.length,
|
|
231
206
|
};
|
|
232
207
|
|
|
233
|
-
// Load amendments (RFC-0397)
|
|
234
|
-
const amendments = await loadAmendments(specDir);
|
|
208
|
+
// Load amendments (RFC-0397) — fail closed on SPEC-14 (RFC-1363)
|
|
209
|
+
const { amendments, errors: amendmentErrors } = await loadAmendments(specDir);
|
|
210
|
+
if (amendmentErrors.length > 0) {
|
|
211
|
+
for (const v of amendmentErrors) {
|
|
212
|
+
if (outputFormat === "pretty") logger.error(`spec.status: ${specId} — ${v.rule}: ${v.message}`);
|
|
213
|
+
}
|
|
214
|
+
return {
|
|
215
|
+
data: {
|
|
216
|
+
command: "spec.status",
|
|
217
|
+
specs: [],
|
|
218
|
+
},
|
|
219
|
+
exitCode: 1,
|
|
220
|
+
summary: `spec.status: refused — ${amendmentErrors.length} unparseable amendment file(s) in ${specId} (run spec.validate for details)`,
|
|
221
|
+
nextSteps: [
|
|
222
|
+
{
|
|
223
|
+
action: `Repair or remove the named amendment files, then re-run: pnpm exec forge run spec.validate`,
|
|
224
|
+
kind: "required" as const,
|
|
225
|
+
},
|
|
226
|
+
],
|
|
227
|
+
};
|
|
228
|
+
}
|
|
235
229
|
const acceptedAmendments = amendments.filter((a) => a.status === "accepted");
|
|
236
230
|
const amendedNodes = new Set<string>();
|
|
237
231
|
const amendedDecisions = new Set<string>();
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
<item>Gap fix: cover SPEC-07 after terminal RFC archival.</item>
|
|
8
8
|
<item>Handoff xrepo-personal-agent-to-forge-spec-validate-sweep: cover sweep-mode manifest-dir scoping and skippedDirs.</item>
|
|
9
9
|
<item>RFC-1302: consumer-aware SPEC-07, narrowed SPEC-10, source-first bin entry (RFC-1302)</item>
|
|
10
|
+
<item>RFC-1363: fail-closed amendment loader SPEC-14 + target repairs AMD-008..011</item>
|
|
10
11
|
</CHANGE_SUMMARY>
|
|
11
12
|
*/
|
|
12
13
|
|
|
@@ -247,3 +248,47 @@ ${targetsYaml}discoveredBy: test
|
|
|
247
248
|
expect(spec10[0]!.severity).toBeUndefined();
|
|
248
249
|
});
|
|
249
250
|
});
|
|
251
|
+
|
|
252
|
+
describe("spec.validate SPEC-14 fail-closed amendments (RFC-1363)", () => {
|
|
253
|
+
it("AC-1: a section target without anchor is a SPEC-14 error naming the file", async () => {
|
|
254
|
+
const workspaceRoot = await fs.mkdtemp(path.join(os.tmpdir(), "spec-validate-spec14-"));
|
|
255
|
+
roots.push(workspaceRoot);
|
|
256
|
+
await writeConsumerSpec(workspaceRoot, "");
|
|
257
|
+
const dir = path.join(workspaceRoot, "docs/specs/example/amendments");
|
|
258
|
+
await fs.mkdir(dir, { recursive: true });
|
|
259
|
+
await fs.writeFile(path.join(dir, "amd-t1.md"), `---
|
|
260
|
+
schema: forge/spec-amendment@1
|
|
261
|
+
id: AMD-T1
|
|
262
|
+
title: Missing anchor
|
|
263
|
+
status: proposed
|
|
264
|
+
createdAt: 2026-10-21
|
|
265
|
+
reviewers: []
|
|
266
|
+
targets:
|
|
267
|
+
- kind: section
|
|
268
|
+
document: readme
|
|
269
|
+
discoveredBy: test
|
|
270
|
+
---
|
|
271
|
+
`);
|
|
272
|
+
const result = await runSpecValidate({ argv: [], flags: { spec: "example" } }, ctx(workspaceRoot));
|
|
273
|
+
expect(result.exitCode).toBe(1);
|
|
274
|
+
const spec14 = result.data!.specs[0]!.violations.filter((v) => v.rule === "SPEC-14");
|
|
275
|
+
expect(spec14).toHaveLength(1);
|
|
276
|
+
expect(spec14[0]!.message).toContain("amd-t1.md");
|
|
277
|
+
expect(spec14[0]!.message).toContain("forge/spec-amendment@1");
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
it("AC-2: an amendment file without frontmatter is a SPEC-14 error naming the file", async () => {
|
|
281
|
+
const workspaceRoot = await fs.mkdtemp(path.join(os.tmpdir(), "spec-validate-spec14-"));
|
|
282
|
+
roots.push(workspaceRoot);
|
|
283
|
+
await writeConsumerSpec(workspaceRoot, "");
|
|
284
|
+
const dir = path.join(workspaceRoot, "docs/specs/example/amendments");
|
|
285
|
+
await fs.mkdir(dir, { recursive: true });
|
|
286
|
+
await fs.writeFile(path.join(dir, "amd-t2.md"), "# Amendment without frontmatter\n\nJust prose.\n");
|
|
287
|
+
const result = await runSpecValidate({ argv: [], flags: { spec: "example" } }, ctx(workspaceRoot));
|
|
288
|
+
expect(result.exitCode).toBe(1);
|
|
289
|
+
const spec14 = result.data!.specs[0]!.violations.filter((v) => v.rule === "SPEC-14");
|
|
290
|
+
expect(spec14).toHaveLength(1);
|
|
291
|
+
expect(spec14[0]!.message).toContain("amd-t2.md");
|
|
292
|
+
expect(spec14[0]!.message).toContain("no frontmatter block");
|
|
293
|
+
});
|
|
294
|
+
});
|
package/os/spec/spec-validate.ts
CHANGED
|
@@ -8,11 +8,12 @@
|
|
|
8
8
|
</non-goals>
|
|
9
9
|
</MODULE_CONTRACT>
|
|
10
10
|
<CHANGE_SUMMARY>
|
|
11
|
-
<item>RFC-0394: initial spec.validate handler with SPEC-01..07 rules.</item>
|
|
12
11
|
<item>Gap fix: resolve materialized RFCs recursively so terminal RFC archival does not invalidate accepted specs.</item>
|
|
13
12
|
<item>RFC-1240: SPEC-12 consumers list hygiene, SPEC-13 consumer-identity warning; warnings no longer fail validation.</item>
|
|
14
13
|
<item>Handoff xrepo-personal-agent-to-forge-spec-validate-sweep: sweep mode skips dirs without forge-spec.yaml (authored/live areas are not packages), reports them as skippedDirs; --spec keeps SPEC-02.</item>
|
|
15
14
|
<item>RFC-1302: consumer-aware SPEC-07, narrowed SPEC-10, source-first bin entry (RFC-1302)</item>
|
|
15
|
+
<item>RFC-1363: fail-closed amendment loader SPEC-14 + target repairs AMD-008..011</item>
|
|
16
|
+
<history>RFC-0394</history>
|
|
16
17
|
</CHANGE_SUMMARY>
|
|
17
18
|
*/
|
|
18
19
|
|
|
@@ -32,7 +33,6 @@ import type {
|
|
|
32
33
|
import {
|
|
33
34
|
forgeSpecSchema,
|
|
34
35
|
specIntegritySchema,
|
|
35
|
-
specAmendmentSchema,
|
|
36
36
|
ownsSpecNode,
|
|
37
37
|
type ForgeSpec,
|
|
38
38
|
type SpecIntegrity,
|
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
type SpecViolation,
|
|
41
41
|
type SpecValidateResult,
|
|
42
42
|
} from "./spec-schema.ts";
|
|
43
|
+
import { loadAmendments as loadAmendmentsShared, type LoadedAmendments } from "./spec-amendments.ts";
|
|
43
44
|
|
|
44
45
|
// ---------------------------------------------------------------------------
|
|
45
46
|
// Helpers
|
|
@@ -328,33 +329,11 @@ function checkConsumers(
|
|
|
328
329
|
}
|
|
329
330
|
|
|
330
331
|
// ---------------------------------------------------------------------------
|
|
331
|
-
// SPEC-08..11: Amendment validation (RFC-0397)
|
|
332
|
+
// SPEC-08..11: Amendment validation (RFC-0397); SPEC-14 fail-closed loader (RFC-1363)
|
|
332
333
|
// ---------------------------------------------------------------------------
|
|
333
334
|
|
|
334
|
-
async function loadAmendments(specDir: string): Promise<
|
|
335
|
-
|
|
336
|
-
if (!existsSync(amendmentsDir)) return [];
|
|
337
|
-
|
|
338
|
-
const entries = (await fs.readdir(amendmentsDir)).map((e) => e.name);
|
|
339
|
-
const amendments: SpecAmendment[] = [];
|
|
340
|
-
|
|
341
|
-
for (const entry of entries) {
|
|
342
|
-
if (!entry.endsWith(".md")) continue;
|
|
343
|
-
try {
|
|
344
|
-
const content = await fs.readFile(path.join(amendmentsDir, entry));
|
|
345
|
-
const fmMatch = content.match(/^---\n([\s\S]*?)\n---/);
|
|
346
|
-
if (!fmMatch) continue;
|
|
347
|
-
const raw = parseYaml(fmMatch[1]) as unknown;
|
|
348
|
-
const parsed = specAmendmentSchema.safeParse(raw);
|
|
349
|
-
if (parsed.success) {
|
|
350
|
-
amendments.push(parsed.data);
|
|
351
|
-
}
|
|
352
|
-
} catch {
|
|
353
|
-
// skip unreadable files
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
return amendments;
|
|
335
|
+
async function loadAmendments(specDir: string): Promise<LoadedAmendments> {
|
|
336
|
+
return loadAmendmentsShared(specDir);
|
|
358
337
|
}
|
|
359
338
|
|
|
360
339
|
function checkAmendments(
|
|
@@ -545,8 +524,9 @@ export async function runSpecValidate(
|
|
|
545
524
|
// SPEC-07: materializedAs
|
|
546
525
|
await checkMaterializedAs(spec, rfcDir, localConsumer, violations);
|
|
547
526
|
|
|
548
|
-
// SPEC-08..11: Amendments (RFC-0397)
|
|
549
|
-
const amendments = await loadAmendments(specDir);
|
|
527
|
+
// SPEC-08..11: Amendments (RFC-0397); SPEC-14: fail-closed load (RFC-1363)
|
|
528
|
+
const { amendments, errors: amendmentLoadErrors } = await loadAmendments(specDir);
|
|
529
|
+
violations.push(...amendmentLoadErrors);
|
|
550
530
|
checkAmendments(spec, amendments, violations);
|
|
551
531
|
|
|
552
532
|
// SPEC-12/13: consumers hygiene + identity warning (RFC-1240)
|
package/os/spec/spec.module.ts
CHANGED
|
@@ -6,19 +6,12 @@
|
|
|
6
6
|
</non-goals>
|
|
7
7
|
</MODULE_CONTRACT>
|
|
8
8
|
<CHANGE_SUMMARY>
|
|
9
|
-
<item>RFC-1230: added spec.live.rebuild command + --force flag on spec.live.merge (idempotent merge design).</item>
|
|
10
|
-
<item>RFC-1173: declare mutatesState on all kernel commands — collectDeclarationDiagnostics emits error-severity MUTATES-STATE-DECLARED, command.manifest.validate is the blocking consumer in packages.check, sweep declares the flag on every command definition (factories hardcode false for read-only check specs)</item>
|
|
11
|
-
<item>RFC-1230: review findings — scoped droppedSections to namespaced headings, warn on unreadable spec, fail-fast merge on corrupt frontmatter, CHANGE_SUMMARY dedupe</item>
|
|
12
|
-
<item>RFC-1231: step 1 — rename supportsAllSites to acceptsAllFlag
|
|
13
|
-
|
|
14
|
-
Mechanical sweep: the field only ever gated --all argv acceptance; fan-out
|
|
15
|
-
follows the parsed selector. Guard renamed assertAllSitesAllowed ->
|
|
16
|
-
assertAllFlagAccepted, message updated. 417 declaration sites + type
|
|
17
|
-
surfaces (KernelCommandMetadata, ForgeCommandMetadata) in one atomic pass.</item>
|
|
18
9
|
<item>RFC-1234: spec.live.validate description lists V-LS-09 drift rule.</item>
|
|
19
10
|
<item>RFC-1240: --consumer flag on spec.validate/spec.status/spec.materialize; SPEC-12/13 rules in spec.validate description.</item>
|
|
20
11
|
<item>Handoff xrepo-personal-agent-to-forge-spec-validate-sweep: spec.validate description documents sweep-mode manifest-dir scoping.</item>
|
|
21
|
-
<
|
|
12
|
+
<item>RFC-1363: fail-closed amendment loader SPEC-14 + target repairs AMD-008..011</item>
|
|
13
|
+
<item>RFC-1461: declare rules[] severity via CommandRuleDecl workspace-wide (RFC-1461)</item>
|
|
14
|
+
<history>RFC-0394, RFC-0396, RFC-0711, RFC-1173, RFC-1230, RFC-1231</history>
|
|
22
15
|
</CHANGE_SUMMARY>
|
|
23
16
|
*/
|
|
24
17
|
|
|
@@ -43,26 +36,14 @@ const { runSpecValidate } = await import("./spec-validate.ts");
|
|
|
43
36
|
name: "spec.validate",
|
|
44
37
|
mutatesState: false,
|
|
45
38
|
contract: "spec",
|
|
46
|
-
rules: [
|
|
47
|
-
"SPEC-01",
|
|
48
|
-
"SPEC-02",
|
|
49
|
-
"SPEC-03",
|
|
50
|
-
"SPEC-04",
|
|
51
|
-
"SPEC-05",
|
|
52
|
-
"SPEC-06",
|
|
53
|
-
"SPEC-07",
|
|
54
|
-
"SPEC-08",
|
|
55
|
-
"SPEC-09",
|
|
56
|
-
"SPEC-10",
|
|
57
|
-
"SPEC-11",
|
|
58
|
-
"SPEC-12",
|
|
59
|
-
"SPEC-13",
|
|
60
|
-
],
|
|
39
|
+
rules: [{ id: "SPEC-01", severity: "error" }, { id: "SPEC-02", severity: "error" }, { id: "SPEC-03", severity: "error" }, { id: "SPEC-04", severity: "error" }, { id: "SPEC-05", severity: "error" }, { id: "SPEC-06", severity: "error" }, { id: "SPEC-07", severity: "error" }, { id: "SPEC-08", severity: "error" }, { id: "SPEC-09", severity: "error" }, { id: "SPEC-10", severity: "error" }, { id: "SPEC-11", severity: "error" }, { id: "SPEC-12", severity: "error" }, { id: "SPEC-13", severity: "error" }, { id: "SPEC-14", severity: "error" }],
|
|
61
40
|
description:
|
|
62
41
|
"Validate vendored spec packages under docs/specs/. " +
|
|
63
42
|
"Checks integrity (SHA-256), schema, dependency graph (acyclic), " +
|
|
64
43
|
"reference resolution, wave coverage, duplicate ids, materializedAs links, " +
|
|
65
44
|
"and consumer hygiene (SPEC-12 duplicates/empty, SPEC-13 identity warning). " +
|
|
45
|
+
"Amendment files that do not parse or fail forge/spec-amendment@1 are SPEC-14 " +
|
|
46
|
+
"errors — the run fails closed instead of skipping them (RFC-1363). " +
|
|
66
47
|
"Sweep mode skips directories without forge-spec.yaml (authored/live dirs " +
|
|
67
48
|
"are not packages); --spec=<id> validates one spec and reports SPEC-02 " +
|
|
68
49
|
"when the named dir lacks a manifest.",
|
|
@@ -174,17 +155,7 @@ const { runSpecValidate } = await import("./spec-validate.ts");
|
|
|
174
155
|
coverageNote: "spec.live drift audit — current debt repaired via spec.live.rebuild",
|
|
175
156
|
mutatesState: false,
|
|
176
157
|
contract: "spec",
|
|
177
|
-
rules: [
|
|
178
|
-
"V-LS-01",
|
|
179
|
-
"V-LS-02",
|
|
180
|
-
"V-LS-03",
|
|
181
|
-
"V-LS-04",
|
|
182
|
-
"V-LS-05",
|
|
183
|
-
"V-LS-06",
|
|
184
|
-
"V-LS-07",
|
|
185
|
-
"V-LS-08",
|
|
186
|
-
"V-LS-09",
|
|
187
|
-
],
|
|
158
|
+
rules: [{ id: "V-LS-01", severity: "error" }, { id: "V-LS-02", severity: "error" }, { id: "V-LS-03", severity: "error" }, { id: "V-LS-04", severity: "error" }, { id: "V-LS-05", severity: "error" }, { id: "V-LS-06", severity: "error" }, { id: "V-LS-07", severity: "error" }, { id: "V-LS-08", severity: "error" }, { id: "V-LS-09", severity: "error" }],
|
|
188
159
|
description:
|
|
189
160
|
"Validate all living feature specs in docs/specs/live/. " +
|
|
190
161
|
"Checks V-LS-01 (frontmatter), V-LS-02 (domain/filename match), " +
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1472 trajectory tests — green-admission gating, situation-similarity recall, outcome.record feeds utilityScore.</purpose>
|
|
4
|
+
</MODULE_CONTRACT>
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { test, expect, describe, beforeEach, afterEach } from "vitest";
|
|
8
|
+
import { mkdtemp, rm, mkdir, writeFile, readFile } from "node:fs/promises";
|
|
9
|
+
import { join } from "node:path";
|
|
10
|
+
import { tmpdir } from "node:os";
|
|
11
|
+
import { runTrajectoryIndex } from "./trajectory-index.ts";
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
import type { ForgeRuntimeContext } from "../../../src/types.ts";
|
|
15
|
+
|
|
16
|
+
let root: string;
|
|
17
|
+
|
|
18
|
+
function ctx(): ForgeRuntimeContext {
|
|
19
|
+
return {
|
|
20
|
+
workspaceRoot: root,
|
|
21
|
+
outputFormat: "json",
|
|
22
|
+
logger: { info() {}, warn() {}, error() {}, success() {}, section() {} },
|
|
23
|
+
} as unknown as ForgeRuntimeContext;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function flags(f: Record<string, unknown> = {}) {
|
|
27
|
+
return { argv: [], flags: f } as never;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
beforeEach(async () => {
|
|
31
|
+
root = await mkdtemp(join(tmpdir(), "trajectory-"));
|
|
32
|
+
await mkdir(join(root, "docs", "sessions"), { recursive: true });
|
|
33
|
+
await writeFile(join(root, "docs", "sessions", "2026-10-30-12-00-00-aaaaaa.md"), `---
|
|
34
|
+
id: s-green
|
|
35
|
+
verdict: green
|
|
36
|
+
taskKind: reconcile
|
|
37
|
+
commands: [mission.reconcile, sternsystem.sync]
|
|
38
|
+
decisions: ["merged in the workpiece"]
|
|
39
|
+
filesChanged: [missions/dp7/wip.md]
|
|
40
|
+
date: 2026-10-30
|
|
41
|
+
---
|
|
42
|
+
body
|
|
43
|
+
`);
|
|
44
|
+
await writeFile(join(root, "docs", "sessions", "2026-10-29-12-00-00-bbbbbb.md"), `---
|
|
45
|
+
id: s-red
|
|
46
|
+
verdict: red
|
|
47
|
+
taskKind: deploy
|
|
48
|
+
commands: [mission.deploy]
|
|
49
|
+
date: 2026-10-29
|
|
50
|
+
---
|
|
51
|
+
body
|
|
52
|
+
`);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
afterEach(async () => {
|
|
56
|
+
await rm(root, { recursive: true, force: true });
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
describe("extract-units (RFC-1472)", () => {
|
|
60
|
+
test("situation key binds taskKind + pathClasses + recentActions; continuation carries commands + outcomeHash", async () => {
|
|
61
|
+
const res = await runTrajectoryIndex(flags({}), ctx());
|
|
62
|
+
expect(res.data?.units).toBeGreaterThanOrEqual(1);
|
|
63
|
+
const index = await readFile(join(root, "docs", ".index", "trajectory", "units.yaml"), "utf8");
|
|
64
|
+
expect(index).toContain("taskKind: reconcile");
|
|
65
|
+
expect(index).toContain("touchedPathClasses:");
|
|
66
|
+
expect(index).toContain("commandSequence:");
|
|
67
|
+
expect(index).toContain("outcomeHash:");
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
RFC-1475 F11: shared append-only JSONL journal I/O for the trajectory
|
|
5
|
+
journals (outcomes.jsonl, recalls.jsonl). appendFile-only writes — never
|
|
6
|
+
read-modify-write; a truncated last line drops the partial record, never
|
|
7
|
+
the file (TRAJ-06). One-time lazy migration retires the YAML journals as
|
|
8
|
+
write targets: the first read that finds outcomes.yaml/recalls.yaml
|
|
9
|
+
appends their records into the matching JSONL (deduped), unparseable YAML
|
|
10
|
+
warns and skips — a partial JSONL is worse than none.
|
|
11
|
+
</purpose>
|
|
12
|
+
</MODULE_CONTRACT>
|
|
13
|
+
<CHANGE_SUMMARY>
|
|
14
|
+
<item>RFC-1475: apply review round-2 findings — element-shape index validation, early-return TRAJ-06 diagnostics, declared forge.yaml/journal reads, hardened shard-unit shape</item>
|
|
15
|
+
<item>RFC-1475: apply review round-3 findings — element-type guards on journal/unit arrays, declared yaml journal reads, honest TRAJ-02 empty-vs-malformed messages, RFC deviations recorded</item>
|
|
16
|
+
<item>RFC-1475: apply review round-4 findings — frontmatter element guards, watermark type narrow, verdictRef workspace confinement, strict-boolean journal labels</item>
|
|
17
|
+
<item>RFC-1475: apply review round-5 findings — shard units container guard, array-element migration convergence, confinement drop test</item>
|
|
18
|
+
<item>RFC-1475: apply review round-6 residual — normalize non-string recalls keyOf for migration convergence</item>
|
|
19
|
+
<history>RFC-1475</history>
|
|
20
|
+
</CHANGE_SUMMARY>
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import path from "node:path";
|
|
24
|
+
import { parse as yamlParse } from "yaml";
|
|
25
|
+
import { resolveIo } from "../../../src/utils/io.ts";
|
|
26
|
+
import type { WorkspaceIO } from "../../../src/types.ts";
|
|
27
|
+
|
|
28
|
+
export interface OutcomeRecord {
|
|
29
|
+
recallId?: string;
|
|
30
|
+
helped?: boolean;
|
|
31
|
+
hurt?: boolean;
|
|
32
|
+
note?: string;
|
|
33
|
+
at?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface RecallJournalRecord {
|
|
37
|
+
id?: string;
|
|
38
|
+
task?: string;
|
|
39
|
+
unitsReturned?: string[];
|
|
40
|
+
at?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface JournalRead<T> {
|
|
44
|
+
records: T[];
|
|
45
|
+
/** Last JSONL line was truncated mid-write (TRAJ-06) — the partial record was dropped. */
|
|
46
|
+
truncated: boolean;
|
|
47
|
+
/** Human-readable warnings (unparseable YAML skipped, migrated record counts). */
|
|
48
|
+
warnings: string[];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Absent-file errors are the only tolerable read failure — everything else propagates. */
|
|
52
|
+
export function isEnoent(e: unknown): boolean {
|
|
53
|
+
return (e as NodeJS.ErrnoException)?.code === "ENOENT";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function readFileOrNull(io: WorkspaceIO, absPath: string): Promise<string | null> {
|
|
57
|
+
try {
|
|
58
|
+
return await io.readFile(absPath);
|
|
59
|
+
} catch (e) {
|
|
60
|
+
if (isEnoent(e)) return null;
|
|
61
|
+
throw e;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Append one JSON record as a single line — appendFile only, never rewrite.
|
|
67
|
+
* An unterminated tail (crash mid-write) is quarantined with a newline first,
|
|
68
|
+
* so the new record never glues onto the corrupt line and stays parseable.
|
|
69
|
+
*/
|
|
70
|
+
export async function appendJsonl(io: WorkspaceIO, absPath: string, record: unknown): Promise<void> {
|
|
71
|
+
const tail = (await readFileOrNull(io, absPath)) ?? "";
|
|
72
|
+
const separator = tail.length > 0 && !tail.endsWith("\n") ? "\n" : "";
|
|
73
|
+
await io.appendFile(absPath, `${separator}${JSON.stringify(record)}\n`);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Read a JSONL journal, tolerating a crash-truncated tail (TRAJ-06). */
|
|
77
|
+
export async function readJsonl<T>(io: WorkspaceIO, absPath: string): Promise<JournalRead<T>> {
|
|
78
|
+
const src = await readFileOrNull(io, absPath);
|
|
79
|
+
if (src === null || src.trim() === "") return { records: [], truncated: false, warnings: [] };
|
|
80
|
+
const lines = src.split("\n").filter((l) => l.trim().length > 0);
|
|
81
|
+
const records: T[] = [];
|
|
82
|
+
let truncated = false;
|
|
83
|
+
for (let i = 0; i < lines.length; i++) {
|
|
84
|
+
let parsed: unknown;
|
|
85
|
+
try {
|
|
86
|
+
parsed = JSON.parse(lines[i]!);
|
|
87
|
+
} catch {
|
|
88
|
+
parsed = undefined;
|
|
89
|
+
}
|
|
90
|
+
// Only object records are admissible — a parseable scalar (null, 42) is a
|
|
91
|
+
// malformed journal record and takes the same corrupt-line path.
|
|
92
|
+
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
93
|
+
records.push(parsed as T);
|
|
94
|
+
} else if (i === lines.length - 1) {
|
|
95
|
+
truncated = true;
|
|
96
|
+
}
|
|
97
|
+
// Mid-file malformed lines are skipped silently — the journal survives.
|
|
98
|
+
}
|
|
99
|
+
return { records, truncated, warnings: [] };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const TRAJECTORY_DIR = path.join("docs", ".index", "trajectory");
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Normalize a journal record's `unitsReturned` — the journal is untrusted
|
|
106
|
+
* input: non-array values, non-string elements, and duplicate ids would
|
|
107
|
+
* throw or double-count at consumption. Returns a deduped string list.
|
|
108
|
+
*/
|
|
109
|
+
export function journalUnitIds(r: { unitsReturned?: unknown }): string[] {
|
|
110
|
+
if (!Array.isArray(r.unitsReturned)) return [];
|
|
111
|
+
return [...new Set(r.unitsReturned.filter((x): x is string => typeof x === "string"))];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Read the outcomes journal: outcomes.jsonl plus a lazy one-time migration
|
|
116
|
+
* from outcomes.yaml (deduped by {recallId, at}). The YAML stays on disk as
|
|
117
|
+
* the read-only source until migrated; unparseable YAML warns + skips.
|
|
118
|
+
*/
|
|
119
|
+
export async function readOutcomesJournal(
|
|
120
|
+
root: string,
|
|
121
|
+
io?: WorkspaceIO,
|
|
122
|
+
): Promise<JournalRead<OutcomeRecord>> {
|
|
123
|
+
const resolved = resolveIo(io);
|
|
124
|
+
const jsonlPath = path.join(root, TRAJECTORY_DIR, "outcomes.jsonl");
|
|
125
|
+
const yamlPath = path.join(root, TRAJECTORY_DIR, "outcomes.yaml");
|
|
126
|
+
return readJournalWithYamlMigration<OutcomeRecord>(resolved, jsonlPath, yamlPath, "outcomes", (r) =>
|
|
127
|
+
`${r.recallId ?? ""}|${r.at ?? ""}`,
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Read the recalls journal: recalls.jsonl plus a lazy one-time migration
|
|
133
|
+
* from recalls.yaml (deduped by id).
|
|
134
|
+
*/
|
|
135
|
+
export async function readRecallsJournal(
|
|
136
|
+
root: string,
|
|
137
|
+
io?: WorkspaceIO,
|
|
138
|
+
): Promise<JournalRead<RecallJournalRecord>> {
|
|
139
|
+
const resolved = resolveIo(io);
|
|
140
|
+
const jsonlPath = path.join(root, TRAJECTORY_DIR, "recalls.jsonl");
|
|
141
|
+
const yamlPath = path.join(root, TRAJECTORY_DIR, "recalls.yaml");
|
|
142
|
+
return readJournalWithYamlMigration<RecallJournalRecord>(resolved, jsonlPath, yamlPath, "recalls", (r) =>
|
|
143
|
+
typeof r.id === "string" ? r.id : "",
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async function readJournalWithYamlMigration<T>(
|
|
148
|
+
io: WorkspaceIO,
|
|
149
|
+
jsonlPath: string,
|
|
150
|
+
yamlPath: string,
|
|
151
|
+
yamlKey: string,
|
|
152
|
+
keyOf: (r: T) => string,
|
|
153
|
+
): Promise<JournalRead<T>> {
|
|
154
|
+
const read = await readJsonl<T>(io, jsonlPath);
|
|
155
|
+
let yamlSrc: string | null;
|
|
156
|
+
try {
|
|
157
|
+
yamlSrc = await io.readFile(yamlPath);
|
|
158
|
+
} catch (e) {
|
|
159
|
+
if (isEnoent(e)) return read;
|
|
160
|
+
read.warnings.push(
|
|
161
|
+
`trajectory journal migration skipped: ${path.basename(yamlPath)} is unreadable (${(e as Error).message}) — YAML left untouched`,
|
|
162
|
+
);
|
|
163
|
+
return read;
|
|
164
|
+
}
|
|
165
|
+
if (yamlSrc === null) return read;
|
|
166
|
+
let yamlRecords: T[] = [];
|
|
167
|
+
try {
|
|
168
|
+
const parsed = yamlParse(yamlSrc) as Record<string, T[] | undefined> | null;
|
|
169
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
170
|
+
read.warnings.push(
|
|
171
|
+
`trajectory journal migration skipped: ${path.basename(yamlPath)} has unexpected shape for a ${yamlKey} journal — YAML left untouched`,
|
|
172
|
+
);
|
|
173
|
+
return read;
|
|
174
|
+
}
|
|
175
|
+
const list = parsed[yamlKey];
|
|
176
|
+
if (list === undefined) {
|
|
177
|
+
read.warnings.push(
|
|
178
|
+
`trajectory journal migration skipped: ${path.basename(yamlPath)} carries no ${yamlKey}: key — YAML left untouched`,
|
|
179
|
+
);
|
|
180
|
+
return read;
|
|
181
|
+
}
|
|
182
|
+
if (!Array.isArray(list)) {
|
|
183
|
+
read.warnings.push(
|
|
184
|
+
`trajectory journal migration skipped: ${path.basename(yamlPath)} ${yamlKey}: is not a record list — YAML left untouched`,
|
|
185
|
+
);
|
|
186
|
+
return read;
|
|
187
|
+
}
|
|
188
|
+
yamlRecords = list.filter((r): r is T => r !== null && typeof r === "object" && !Array.isArray(r));
|
|
189
|
+
} catch {
|
|
190
|
+
read.warnings.push(
|
|
191
|
+
`trajectory journal migration skipped: ${path.basename(yamlPath)} is unparseable — YAML left untouched`,
|
|
192
|
+
);
|
|
193
|
+
return read;
|
|
194
|
+
}
|
|
195
|
+
const seen = new Set(read.records.map(keyOf));
|
|
196
|
+
let appended = 0;
|
|
197
|
+
for (const record of yamlRecords) {
|
|
198
|
+
const key = keyOf(record);
|
|
199
|
+
if (seen.has(key)) continue;
|
|
200
|
+
seen.add(key);
|
|
201
|
+
await appendJsonl(io, jsonlPath, record);
|
|
202
|
+
read.records.push(record);
|
|
203
|
+
appended++;
|
|
204
|
+
}
|
|
205
|
+
if (appended > 0) {
|
|
206
|
+
read.warnings.push(
|
|
207
|
+
`trajectory journal migration: appended ${appended} record(s) from ${path.basename(yamlPath)} to ${path.basename(jsonlPath)}`,
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
return read;
|
|
211
|
+
}
|