@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
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1475 outcome-journal tests — append-only outcomes.jsonl (AC-7), truncated-tail TRAJ-06 tolerance, lazy YAML migration, TRAJ-05 unknown recall id (AC-9).</purpose>
|
|
4
|
+
</MODULE_CONTRACT>
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { test, expect, describe, beforeEach, afterEach } from "vitest";
|
|
8
|
+
import { mkdtemp, rm, mkdir, writeFile, readFile, appendFile } from "node:fs/promises";
|
|
9
|
+
import { join } from "node:path";
|
|
10
|
+
import { tmpdir } from "node:os";
|
|
11
|
+
import { runTrajectoryIndex } from "./trajectory-index.ts";
|
|
12
|
+
import { runTrajectoryRecall } from "./trajectory-recall.ts";
|
|
13
|
+
import { runOutcomeRecord } from "./outcome-record.ts";
|
|
14
|
+
import { readOutcomesJournal, readRecallsJournal } from "./journal-io.ts";
|
|
15
|
+
import type { ForgeRuntimeContext } from "../../../src/types.ts";
|
|
16
|
+
|
|
17
|
+
let root: string;
|
|
18
|
+
let warns: string[];
|
|
19
|
+
|
|
20
|
+
function ctx(): ForgeRuntimeContext {
|
|
21
|
+
return {
|
|
22
|
+
workspaceRoot: root,
|
|
23
|
+
outputFormat: "json",
|
|
24
|
+
logger: { info() {}, warn(m: string) { warns.push(m); }, error() {}, success() {}, section() {} },
|
|
25
|
+
} as unknown as ForgeRuntimeContext;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function flags(f: Record<string, unknown> = {}) {
|
|
29
|
+
return { argv: [], flags: f } as never;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const OUTCOMES_JSONL = () => join(root, "docs", ".index", "trajectory", "outcomes.jsonl");
|
|
33
|
+
const TRAJ_DIR = () => join(root, "docs", ".index", "trajectory");
|
|
34
|
+
|
|
35
|
+
beforeEach(async () => {
|
|
36
|
+
root = await mkdtemp(join(tmpdir(), "trajectory-outcome-"));
|
|
37
|
+
warns = [];
|
|
38
|
+
await mkdir(join(root, "docs", "sessions"), { recursive: true });
|
|
39
|
+
await writeFile(join(root, "docs", "sessions", "2026-10-30-12-00-00-aaaaaa.md"), `---
|
|
40
|
+
id: s-green
|
|
41
|
+
verdict: green
|
|
42
|
+
taskKind: reconcile
|
|
43
|
+
commands: [mission.reconcile]
|
|
44
|
+
date: 2026-10-30
|
|
45
|
+
---
|
|
46
|
+
body
|
|
47
|
+
`);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
afterEach(async () => {
|
|
51
|
+
await rm(root, { recursive: true, force: true });
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
async function seedIndexAndRecall(): Promise<string> {
|
|
55
|
+
await runTrajectoryIndex(flags({}), ctx());
|
|
56
|
+
const recall = await runTrajectoryRecall(flags({ task: "reconcile" }), ctx());
|
|
57
|
+
return recall.data?.recallId ?? "";
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
describe("outcomes.jsonl append-only journal (RFC-1475 AC-7)", () => {
|
|
61
|
+
test("two outcome.record invocations append two lines — no read-modify-write", async () => {
|
|
62
|
+
const recallId = await seedIndexAndRecall();
|
|
63
|
+
await runOutcomeRecord(flags({ recall: recallId, helped: true }), ctx());
|
|
64
|
+
await runOutcomeRecord(flags({ recall: recallId, hurt: true }), ctx());
|
|
65
|
+
const lines = (await readFile(OUTCOMES_JSONL(), "utf8")).trim().split("\n");
|
|
66
|
+
expect(lines.length).toBe(2);
|
|
67
|
+
expect(JSON.parse(lines[0]!).helped).toBe(true);
|
|
68
|
+
expect(JSON.parse(lines[1]!).hurt).toBe(true);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test("a truncated last line drops only the partial record (TRAJ-06)", async () => {
|
|
72
|
+
const recallId = await seedIndexAndRecall();
|
|
73
|
+
await runOutcomeRecord(flags({ recall: recallId, helped: true }), ctx());
|
|
74
|
+
await appendFile(OUTCOMES_JSONL(), `{"recallId":"${recallId}","helped":tr`);
|
|
75
|
+
const read = await readOutcomesJournal(root);
|
|
76
|
+
expect(read.truncated).toBe(true);
|
|
77
|
+
expect(read.records.length).toBe(1);
|
|
78
|
+
// The handler path surfaces the warning while replay still works.
|
|
79
|
+
warns = [];
|
|
80
|
+
await runTrajectoryIndex(flags({}), ctx());
|
|
81
|
+
expect(warns.some((w) => w.includes("TRAJ-06"))).toBe(true);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test("lazy migration: outcomes.yaml records append into outcomes.jsonl once", async () => {
|
|
85
|
+
await mkdir(TRAJ_DIR(), { recursive: true });
|
|
86
|
+
await writeFile(
|
|
87
|
+
join(TRAJ_DIR(), "outcomes.yaml"),
|
|
88
|
+
"schema: forge/trajectory-outcomes@1\noutcomes:\n - {recallId: R-1, helped: true, at: \"2026-10-01T00:00:00Z\"}\n - {recallId: R-2, hurt: true, at: \"2026-10-02T00:00:00Z\"}\n",
|
|
89
|
+
);
|
|
90
|
+
const first = await readOutcomesJournal(root);
|
|
91
|
+
expect(first.records.length).toBe(2);
|
|
92
|
+
const lines = (await readFile(OUTCOMES_JSONL(), "utf8")).trim().split("\n");
|
|
93
|
+
expect(lines.length).toBe(2);
|
|
94
|
+
// Second read does not re-append (dedupe by {recallId, at}).
|
|
95
|
+
const second = await readOutcomesJournal(root);
|
|
96
|
+
expect(second.records.length).toBe(2);
|
|
97
|
+
expect((await readFile(OUTCOMES_JSONL(), "utf8")).trim().split("\n").length).toBe(2);
|
|
98
|
+
// YAML stays on disk — the read-only source until retired.
|
|
99
|
+
const yamlSrc = await readFile(join(TRAJ_DIR(), "outcomes.yaml"), "utf8");
|
|
100
|
+
expect(yamlSrc).toContain("outcomes:");
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test("unparseable outcomes.yaml warns and skips migration — JSONL unaffected", async () => {
|
|
104
|
+
await mkdir(TRAJ_DIR(), { recursive: true });
|
|
105
|
+
await writeFile(join(TRAJ_DIR(), "outcomes.yaml"), "outcomes: [unclosed\n - : :");
|
|
106
|
+
const read = await readOutcomesJournal(root);
|
|
107
|
+
expect(read.records.length).toBe(0);
|
|
108
|
+
expect(read.warnings.some((w) => w.includes("unparseable"))).toBe(true);
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
describe("unknown recall id (RFC-1475 AC-9)", () => {
|
|
113
|
+
test("a corrupt units index → TRAJ-02, never a raw exception", async () => {
|
|
114
|
+
const recallId = await seedIndexAndRecall();
|
|
115
|
+
await writeFile(join(TRAJ_DIR(), "units.yaml"), "units: [unclosed\n - : :");
|
|
116
|
+
const res = await runOutcomeRecord(flags({ recall: recallId, helped: true }), ctx());
|
|
117
|
+
expect(res.exitCode).toBe(1);
|
|
118
|
+
expect(res.data?.diagnostics?.[0]?.ruleId).toBe("TRAJ-02");
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
test("TRAJ-05 — distinct from the index-staleness signal", async () => {
|
|
122
|
+
await seedIndexAndRecall();
|
|
123
|
+
const res = await runOutcomeRecord(flags({ recall: "R-9999-99-ffff", helped: true }), ctx());
|
|
124
|
+
expect(res.exitCode).toBe(1);
|
|
125
|
+
expect(res.summary).toContain("TRAJ-05");
|
|
126
|
+
expect(res.data?.diagnostics?.[0]?.ruleId).toBe("TRAJ-05");
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
describe("recalls.jsonl shared reader", () => {
|
|
131
|
+
test("outcome.record resolves a recall journaled via recalls.jsonl", async () => {
|
|
132
|
+
const recallId = await seedIndexAndRecall();
|
|
133
|
+
const res = await runOutcomeRecord(flags({ recall: recallId, helped: true }), ctx());
|
|
134
|
+
expect(res.exitCode).toBe(0);
|
|
135
|
+
expect(res.data?.unitUpdates).toBeGreaterThan(0);
|
|
136
|
+
const recalls = await readRecallsJournal(root);
|
|
137
|
+
expect(recalls.records.some((r) => r.id === recallId)).toBe(true);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
describe("journal hardening edges (review round-1)", () => {
|
|
142
|
+
test("a second label for the same recallId does not double-count `recalled`", async () => {
|
|
143
|
+
const recallId = await seedIndexAndRecall();
|
|
144
|
+
await runOutcomeRecord(flags({ recall: recallId, helped: true }), ctx());
|
|
145
|
+
await runOutcomeRecord(flags({ recall: recallId, hurt: true }), ctx());
|
|
146
|
+
const index = await readFile(join(TRAJ_DIR(), "units.yaml"), "utf8");
|
|
147
|
+
// replay semantics — one `recalled` per recall record, not per label.
|
|
148
|
+
expect(index).toContain("recalled: 1");
|
|
149
|
+
expect(index).toContain("helped: 1");
|
|
150
|
+
expect(index).toContain("hurt: 1");
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
test("wrong-shape YAML journal warns and migrates nothing", async () => {
|
|
154
|
+
await mkdir(TRAJ_DIR(), { recursive: true });
|
|
155
|
+
await writeFile(join(TRAJ_DIR(), "outcomes.yaml"), "- a\n- top-level\n- list\n");
|
|
156
|
+
const read = await readOutcomesJournal(root);
|
|
157
|
+
expect(read.records.length).toBe(0);
|
|
158
|
+
expect(read.warnings.some((w) => w.includes("unexpected shape"))).toBe(true);
|
|
159
|
+
const read2 = await readOutcomesJournal(root);
|
|
160
|
+
expect(read2.records.length).toBe(0);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
test("array elements in YAML journal are never admitted — no unbounded re-append", async () => {
|
|
164
|
+
await mkdir(TRAJ_DIR(), { recursive: true });
|
|
165
|
+
await writeFile(join(TRAJ_DIR(), "outcomes.yaml"), "outcomes:\n - {recallId: R-1, helped: true}\n - [a, b]\n");
|
|
166
|
+
const first = await readOutcomesJournal(root);
|
|
167
|
+
expect(first.records.length).toBe(1);
|
|
168
|
+
const lines = (await readFile(OUTCOMES_JSONL(), "utf8")).trim().split("\n");
|
|
169
|
+
expect(lines.length).toBe(1);
|
|
170
|
+
// A second read must not re-append — array elements converge like dicts.
|
|
171
|
+
const second = await readOutcomesJournal(root);
|
|
172
|
+
expect(second.records.length).toBe(1);
|
|
173
|
+
expect((await readFile(OUTCOMES_JSONL(), "utf8")).trim().split("\n").length).toBe(1);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
test("non-array outcomes: value warns and migrates nothing", async () => {
|
|
177
|
+
await mkdir(TRAJ_DIR(), { recursive: true });
|
|
178
|
+
await writeFile(join(TRAJ_DIR(), "outcomes.yaml"), "schema: x\noutcomes: a-string-not-a-list\n");
|
|
179
|
+
const read = await readOutcomesJournal(root);
|
|
180
|
+
expect(read.records.length).toBe(0);
|
|
181
|
+
expect(read.warnings.some((w) => w.includes("not a record list"))).toBe(true);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
test("non-object JSONL lines are malformed records — dropped like corrupt lines", async () => {
|
|
185
|
+
await mkdir(TRAJ_DIR(), { recursive: true });
|
|
186
|
+
await writeFile(OUTCOMES_JSONL(), `{"recallId":"R-1","helped":true}\n42\nnull\n{"recallId":"R-2","hurt":true}\n`);
|
|
187
|
+
const read = await readOutcomesJournal(root);
|
|
188
|
+
expect(read.records.length).toBe(2);
|
|
189
|
+
// The last line is a valid object — mid-file non-objects are skipped, not truncation.
|
|
190
|
+
expect(read.truncated).toBe(false);
|
|
191
|
+
});
|
|
192
|
+
});
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
RFC-1472: trajectory.outcome.record --recall <id> --helped|--hurt [--note] —
|
|
5
|
+
the marginal-utility feedback loop: labels feed utilityScore re-ranking and
|
|
6
|
+
per-producer trust (helped/(helped+hurt)).
|
|
7
|
+
</purpose>
|
|
8
|
+
</MODULE_CONTRACT>
|
|
9
|
+
<CHANGE_SUMMARY>
|
|
10
|
+
<item>RFC-1472: trajectory.index + trajectory.recall + trajectory.outcome.record — procedural-memory retrieval with green-verdict admission</item>
|
|
11
|
+
<item>RFC-1475: apply review round-1 findings — vendored-label replay order, real workshopId, cache bypass, TRAJ-06 diagnostics, ENOENT-only journal reads</item>
|
|
12
|
+
<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>
|
|
13
|
+
<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>
|
|
14
|
+
<item>RFC-1475: apply review round-4 findings — frontmatter element guards, watermark type narrow, verdictRef workspace confinement, strict-boolean journal labels</item>
|
|
15
|
+
<history>RFC-1472, RFC-1475</history>
|
|
16
|
+
</CHANGE_SUMMARY>
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import path from "node:path";
|
|
20
|
+
import { parse as yamlParse, stringify as yamlStringify } from "yaml";
|
|
21
|
+
import { ambientIo, resolveIo } from "../../../src/utils/io.ts";
|
|
22
|
+
import { appendJsonl, isEnoent, journalUnitIds, readOutcomesJournal, readRecallsJournal } from "./journal-io.ts";
|
|
23
|
+
import type { ProcedureUnit } from "./trajectory-index.ts";
|
|
24
|
+
import { isShardUnit } from "./trajectory-index.ts";
|
|
25
|
+
import type {
|
|
26
|
+
ForgeCommandInput,
|
|
27
|
+
ForgeCommandResult,
|
|
28
|
+
ForgeRuntimeContext,
|
|
29
|
+
} from "../../../src/types.ts";
|
|
30
|
+
|
|
31
|
+
export interface OutcomeData {
|
|
32
|
+
command: "trajectory.outcome.record";
|
|
33
|
+
status: "ok";
|
|
34
|
+
recallId: string;
|
|
35
|
+
helped: number;
|
|
36
|
+
hurt: number;
|
|
37
|
+
unitUpdates: number;
|
|
38
|
+
diagnostics?: { ruleId?: string; severity?: string; message?: string }[];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function runOutcomeRecord(
|
|
42
|
+
input: ForgeCommandInput,
|
|
43
|
+
context: ForgeRuntimeContext,
|
|
44
|
+
): Promise<ForgeCommandResult<OutcomeData>> {
|
|
45
|
+
const io = resolveIo(context.io ?? ambientIo);
|
|
46
|
+
const root = context.workspaceRoot;
|
|
47
|
+
const recallId = String(input.flags["recall"] ?? "");
|
|
48
|
+
const helped = input.flags["helped"] === true;
|
|
49
|
+
const hurt = input.flags["hurt"] === true;
|
|
50
|
+
const note = String(input.flags["note"] ?? "");
|
|
51
|
+
if (!recallId || (!helped && !hurt)) {
|
|
52
|
+
return { data: { command: "trajectory.outcome.record", status: "ok", recallId, helped: 0, hurt: 0, unitUpdates: 0 }, summary: "missing --recall or --helped/--hurt", exitCode: 1 };
|
|
53
|
+
}
|
|
54
|
+
const journalRead = await readRecallsJournal(root, io);
|
|
55
|
+
const outcomesRead = await readOutcomesJournal(root, io);
|
|
56
|
+
for (const warning of [...journalRead.warnings, ...outcomesRead.warnings]) context.logger.warn(warning);
|
|
57
|
+
const journalTruncated = journalRead.truncated || outcomesRead.truncated;
|
|
58
|
+
const traj06 = journalTruncated
|
|
59
|
+
? [{ ruleId: "TRAJ-06", severity: "warning", message: "trajectory journal carried a truncated or malformed tail record — partial record dropped, journal survives" }]
|
|
60
|
+
: [];
|
|
61
|
+
if (journalTruncated) {
|
|
62
|
+
context.logger.warn("TRAJ-06 trajectory journal carried a truncated or malformed tail record — partial record dropped, journal survives");
|
|
63
|
+
}
|
|
64
|
+
const recall = journalRead.records.find((r) => r.id === recallId);
|
|
65
|
+
if (!recall) {
|
|
66
|
+
return {
|
|
67
|
+
data: {
|
|
68
|
+
command: "trajectory.outcome.record",
|
|
69
|
+
status: "ok",
|
|
70
|
+
recallId,
|
|
71
|
+
helped: 0,
|
|
72
|
+
hurt: 0,
|
|
73
|
+
unitUpdates: 0,
|
|
74
|
+
diagnostics: [{ ruleId: "TRAJ-05", severity: "error", message: `recall ${recallId} not found` }, ...traj06],
|
|
75
|
+
},
|
|
76
|
+
summary: `TRAJ-05 recall ${recallId} not found`,
|
|
77
|
+
exitCode: 1,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const indexRel = path.join(root, "docs", ".index", "trajectory", "units.yaml");
|
|
81
|
+
const indexSrc = await io.readFile(indexRel).catch((e) => {
|
|
82
|
+
if (isEnoent(e)) return null;
|
|
83
|
+
throw e;
|
|
84
|
+
});
|
|
85
|
+
if (indexSrc === null) {
|
|
86
|
+
return {
|
|
87
|
+
data: {
|
|
88
|
+
command: "trajectory.outcome.record",
|
|
89
|
+
status: "ok",
|
|
90
|
+
recallId,
|
|
91
|
+
helped: 0,
|
|
92
|
+
hurt: 0,
|
|
93
|
+
unitUpdates: 0,
|
|
94
|
+
diagnostics: [{ ruleId: "TRAJ-01", severity: "error", message: "units index missing" }, ...traj06],
|
|
95
|
+
},
|
|
96
|
+
summary: "TRAJ-01 units index missing",
|
|
97
|
+
exitCode: 1,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
let parsed: { sourceWatermark?: string; units?: ProcedureUnit[] } | null;
|
|
101
|
+
try {
|
|
102
|
+
parsed = yamlParse(indexSrc) as typeof parsed;
|
|
103
|
+
} catch {
|
|
104
|
+
parsed = null;
|
|
105
|
+
}
|
|
106
|
+
const units = parsed !== null && typeof parsed === "object" && Array.isArray(parsed.units)
|
|
107
|
+
? parsed.units.filter(isShardUnit)
|
|
108
|
+
: null;
|
|
109
|
+
if (units === null || units.length === 0) {
|
|
110
|
+
return {
|
|
111
|
+
data: {
|
|
112
|
+
command: "trajectory.outcome.record",
|
|
113
|
+
status: "ok",
|
|
114
|
+
recallId,
|
|
115
|
+
helped: 0,
|
|
116
|
+
hurt: 0,
|
|
117
|
+
unitUpdates: 0,
|
|
118
|
+
diagnostics: [{ ruleId: "TRAJ-02", severity: "error", message: "units index unparseable, empty, or not a unit index — rerun trajectory.index" }, ...traj06],
|
|
119
|
+
},
|
|
120
|
+
summary: "TRAJ-02 units index unusable",
|
|
121
|
+
exitCode: 1,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
// `recalled` mirrors replay semantics — one count per recall record, so a
|
|
125
|
+
// second label for the same recallId must not double-count until rebuild.
|
|
126
|
+
const firstLabel = !outcomesRead.records.some((o) => o.recallId === recallId);
|
|
127
|
+
let updated = 0;
|
|
128
|
+
for (const uid of journalUnitIds(recall)) {
|
|
129
|
+
const u = units.find((x) => x.id === uid);
|
|
130
|
+
if (!u) continue;
|
|
131
|
+
if (firstLabel) u.usedBy.recalled++;
|
|
132
|
+
if (helped) u.usedBy.helped++;
|
|
133
|
+
if (hurt) u.usedBy.hurt++;
|
|
134
|
+
u.utilityScore = u.usedBy.helped - u.usedBy.hurt;
|
|
135
|
+
updated++;
|
|
136
|
+
}
|
|
137
|
+
// RFC-1475 F11 — append-only outcomes.jsonl: appendFile only, never
|
|
138
|
+
// read-modify-write; the eager units.yaml update keeps recall-time
|
|
139
|
+
// trust buckets fresh without an index rebuild (plan step 4).
|
|
140
|
+
await appendJsonl(
|
|
141
|
+
io,
|
|
142
|
+
path.join(root, "docs", ".index", "trajectory", "outcomes.jsonl"),
|
|
143
|
+
{ recallId, helped, hurt, note, at: new Date().toISOString() },
|
|
144
|
+
);
|
|
145
|
+
await io.writeFile(
|
|
146
|
+
indexRel,
|
|
147
|
+
yamlStringify({ schema: "forge/trajectory-index@1", sourceWatermark: parsed?.sourceWatermark, units }) + "\n",
|
|
148
|
+
);
|
|
149
|
+
return {
|
|
150
|
+
data: {
|
|
151
|
+
command: "trajectory.outcome.record",
|
|
152
|
+
status: "ok",
|
|
153
|
+
recallId,
|
|
154
|
+
helped: helped ? 1 : 0,
|
|
155
|
+
hurt: hurt ? 1 : 0,
|
|
156
|
+
unitUpdates: updated,
|
|
157
|
+
diagnostics: traj06.length > 0 ? traj06 : undefined,
|
|
158
|
+
},
|
|
159
|
+
summary: `recorded ${helped ? "helped" : "hurt"} for ${recallId} — ${updated} unit(s) updated`,
|
|
160
|
+
exitCode: 0,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1475 producer-trust tests — {workshopId, sessionClass} bucket aggregation (AC-6), vendored isolation, sparse-bucket 0.5, producerStats shard materialization.</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, basename } from "node:path";
|
|
10
|
+
import { tmpdir } from "node:os";
|
|
11
|
+
import { runTrajectoryIndex } from "./trajectory-index.ts";
|
|
12
|
+
import { runTrajectoryRecall } from "./trajectory-recall.ts";
|
|
13
|
+
import { runOutcomeRecord } from "./outcome-record.ts";
|
|
14
|
+
import type { ProcedureUnit } from "./trajectory-index.ts";
|
|
15
|
+
import type { ForgeRuntimeContext } from "../../../src/types.ts";
|
|
16
|
+
|
|
17
|
+
let root: string;
|
|
18
|
+
|
|
19
|
+
function ctx(): ForgeRuntimeContext {
|
|
20
|
+
return {
|
|
21
|
+
workspaceRoot: root,
|
|
22
|
+
outputFormat: "json",
|
|
23
|
+
logger: { info() {}, warn() {}, error() {}, success() {}, section() {} },
|
|
24
|
+
} as unknown as ForgeRuntimeContext;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function flags(f: Record<string, unknown> = {}) {
|
|
28
|
+
return { argv: [], flags: f } as never;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function writeSession(name: string, frontmatter: string): Promise<void> {
|
|
32
|
+
await writeFile(join(root, "docs", "sessions", name), `---\n${frontmatter}\n---\nbody\n`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function vendoredUnit(id: string, producer: Partial<ProcedureUnit["producer"]> = {}, usedBy: Partial<ProcedureUnit["usedBy"]> = {}, taskKind = "deploy") {
|
|
36
|
+
return {
|
|
37
|
+
id,
|
|
38
|
+
kind: "trajectory",
|
|
39
|
+
situation: { taskKind, touchedPathClasses: [], recentActions: [taskKind] },
|
|
40
|
+
continuation: { commandSequence: ["mission.reconcile"], decisions: [], outcomeHash: "abc123" },
|
|
41
|
+
producer: {
|
|
42
|
+
workshopId: "other-shop",
|
|
43
|
+
sessionId: id,
|
|
44
|
+
completedAt: "2026-10-01",
|
|
45
|
+
verdictRef: "verdict:green",
|
|
46
|
+
sessionClass: "adhoc",
|
|
47
|
+
origin: "vendored",
|
|
48
|
+
...producer,
|
|
49
|
+
},
|
|
50
|
+
source: "shard",
|
|
51
|
+
tokens: 10,
|
|
52
|
+
text: `${id} ${taskKind} vendored`,
|
|
53
|
+
usedBy: { recalled: 0, helped: 0, hurt: 0, ...usedBy },
|
|
54
|
+
utilityScore: 0,
|
|
55
|
+
} satisfies ProcedureUnit;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
beforeEach(async () => {
|
|
59
|
+
root = await mkdtemp(join(tmpdir(), "trajectory-trust-"));
|
|
60
|
+
await mkdir(join(root, "docs", "sessions"), { recursive: true });
|
|
61
|
+
await writeSession("2026-10-30-12-00-00-aaaaaa.md", `id: s-mission
|
|
62
|
+
verdict: green
|
|
63
|
+
types: [mission]
|
|
64
|
+
taskKind: reconcile
|
|
65
|
+
commands: [mission.reconcile]
|
|
66
|
+
date: 2026-10-30`);
|
|
67
|
+
await writeSession("2026-10-29-12-00-00-bbbbbb.md", `id: s-adhoc
|
|
68
|
+
verdict: green
|
|
69
|
+
taskKind: reconcile
|
|
70
|
+
commands: [mission.reconcile]
|
|
71
|
+
date: 2026-10-29`);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
afterEach(async () => {
|
|
75
|
+
await rm(root, { recursive: true, force: true });
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
describe("producer trust buckets (RFC-1475 AC-6)", () => {
|
|
79
|
+
test("units in one {workshopId, sessionClass} bucket share the aggregated trust", async () => {
|
|
80
|
+
await writeSession("2026-10-28-12-00-00-cccccc.md", `id: s-adhoc-2
|
|
81
|
+
verdict: green
|
|
82
|
+
taskKind: reconcile
|
|
83
|
+
commands: [mission.reconcile]
|
|
84
|
+
date: 2026-10-28`);
|
|
85
|
+
await runTrajectoryIndex(flags({}), ctx());
|
|
86
|
+
const recall = await runTrajectoryRecall(flags({ task: "reconcile", k: 20 }), ctx());
|
|
87
|
+
const adhoc = recall.data?.units.filter((u) => u.producer.sessionId.startsWith("s-adhoc"));
|
|
88
|
+
expect(adhoc?.length).toBe(2);
|
|
89
|
+
// Label the recall — helped lands on the returned adhoc units.
|
|
90
|
+
await runOutcomeRecord(flags({ recall: recall.data?.recallId, helped: true }), ctx());
|
|
91
|
+
const re = await runTrajectoryRecall(flags({ task: "reconcile", k: 20 }), ctx());
|
|
92
|
+
const trustReasons = re.data?.units
|
|
93
|
+
.filter((u) => u.producer.sessionClass === "adhoc")
|
|
94
|
+
.map((u) => u.reasons.find((r) => r.startsWith("trust:")));
|
|
95
|
+
expect(trustReasons?.every((t) => t === "trust:1.00")).toBe(true);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test("a label on one bucket never leaks into another bucket", async () => {
|
|
99
|
+
await runTrajectoryIndex(flags({}), ctx());
|
|
100
|
+
// Recall k=1 returns exactly one unit — its {workshopId, sessionClass}
|
|
101
|
+
// bucket receives the hurt label; the other bucket stays at 0.5. The
|
|
102
|
+
// labeled bucket is read off the recall result, not a hardcoded class —
|
|
103
|
+
// the winner depends on recency vs wall clock and ages out otherwise.
|
|
104
|
+
const recall = await runTrajectoryRecall(flags({ task: "reconcile", k: 1 }), ctx());
|
|
105
|
+
const labeled = recall.data?.units[0]?.producer.sessionClass ?? "adhoc";
|
|
106
|
+
await runOutcomeRecord(flags({ recall: recall.data?.recallId, hurt: true }), ctx());
|
|
107
|
+
const re = await runTrajectoryRecall(flags({ task: "reconcile", k: 20 }), ctx());
|
|
108
|
+
const labeledUnits = re.data?.units.filter((u) => u.producer.sessionClass === labeled) ?? [];
|
|
109
|
+
const otherUnits = re.data?.units.filter((u) => u.producer.sessionClass !== labeled) ?? [];
|
|
110
|
+
expect(labeledUnits.length).toBeGreaterThan(0);
|
|
111
|
+
expect(otherUnits.length).toBeGreaterThan(0);
|
|
112
|
+
for (const u of labeledUnits) {
|
|
113
|
+
expect(u.reasons.find((r) => r.startsWith("trust:"))).toBe("trust:0.00");
|
|
114
|
+
}
|
|
115
|
+
for (const u of otherUnits) {
|
|
116
|
+
expect(u.reasons.find((r) => r.startsWith("trust:"))).toBe("trust:0.50");
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
test("vendored unit scores under its origin's bucket — werkstatt labels never smear across", async () => {
|
|
121
|
+
const { stringify } = await import("yaml");
|
|
122
|
+
const shard = "docs/.index/trajectory/incoming.yaml";
|
|
123
|
+
await mkdir(join(root, "docs", ".index", "trajectory"), { recursive: true });
|
|
124
|
+
await writeFile(
|
|
125
|
+
join(root, shard),
|
|
126
|
+
stringify({
|
|
127
|
+
schema: "forge/trajectory-shard@1",
|
|
128
|
+
units: [vendoredUnit("trajectory:vendored", {}, { helped: 3, hurt: 1, recalled: 4 })],
|
|
129
|
+
}) + "\n",
|
|
130
|
+
);
|
|
131
|
+
await runTrajectoryIndex(flags({ import: shard }), ctx());
|
|
132
|
+
// Label the local bucket — the vendored unit does not match this task, so
|
|
133
|
+
// the hurt label lands only on the returned werkstatt unit.
|
|
134
|
+
const recall = await runTrajectoryRecall(flags({ task: "reconcile", k: 1 }), ctx());
|
|
135
|
+
expect(recall.data?.units[0]?.producer.workshopId).toBe(basename(root));
|
|
136
|
+
await runOutcomeRecord(flags({ recall: recall.data?.recallId, hurt: true }), ctx());
|
|
137
|
+
const re = await runTrajectoryRecall(flags({ task: "reconcile", k: 20 }), ctx());
|
|
138
|
+
const vendored = re.data?.units.find((u) => u.id === "trajectory:vendored");
|
|
139
|
+
const vendoredTrust = vendored?.reasons.find((r) => r.startsWith("trust:"));
|
|
140
|
+
// other-shop/adhoc carried helped:3 hurt:1 → trust 0.75 regardless of werkstatt labels.
|
|
141
|
+
expect(vendoredTrust).toBe("trust:0.75");
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
test("unlabeled bucket scores at the neutral 0.5 — never below a fresh producer", async () => {
|
|
145
|
+
await runTrajectoryIndex(flags({}), ctx());
|
|
146
|
+
const re = await runTrajectoryRecall(flags({ task: "reconcile", k: 20 }), ctx());
|
|
147
|
+
for (const u of re.data?.units ?? []) {
|
|
148
|
+
expect(u.reasons.find((r) => r.startsWith("trust:"))).toBe("trust:0.50");
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
test("shard export materializes the bucket table into producerStats", async () => {
|
|
153
|
+
await runTrajectoryIndex(flags({}), ctx());
|
|
154
|
+
const out = "docs/.index/trajectory/export.yaml";
|
|
155
|
+
await runTrajectoryIndex(flags({ export: out }), ctx());
|
|
156
|
+
const shard = await readFile(join(root, out), "utf8");
|
|
157
|
+
expect(shard).toContain("producerStats:");
|
|
158
|
+
expect(shard).toContain(`workshopId: ${basename(root)}`);
|
|
159
|
+
expect(shard).toContain(`exportedFrom: ${basename(root)}`);
|
|
160
|
+
expect(shard).toContain("sessionClass: mission");
|
|
161
|
+
expect(shard).toContain("sessionClass: adhoc");
|
|
162
|
+
});
|
|
163
|
+
});
|