@specforge/canary-cli 0.2.16 → 0.2.18

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.
Files changed (51) hide show
  1. package/dist/cli/config/paths.d.ts +15 -0
  2. package/dist/cli/config/paths.d.ts.map +1 -1
  3. package/dist/cli/config/paths.js +5 -0
  4. package/dist/cli/config/paths.js.map +1 -1
  5. package/dist/cli/config/work-sessions-base-registry.d.ts +61 -0
  6. package/dist/cli/config/work-sessions-base-registry.d.ts.map +1 -0
  7. package/dist/cli/config/work-sessions-base-registry.js +50 -0
  8. package/dist/cli/config/work-sessions-base-registry.js.map +1 -0
  9. package/dist/cli/templates/agents/content/core/sfag-orchestrator.d.ts.map +1 -1
  10. package/dist/cli/templates/agents/content/core/sfag-orchestrator.js +34 -6
  11. package/dist/cli/templates/agents/content/core/sfag-orchestrator.js.map +1 -1
  12. package/dist/cli/templates/agents/content/core/sfag-ticket-implementer.d.ts.map +1 -1
  13. package/dist/cli/templates/agents/content/core/sfag-ticket-implementer.js +37 -6
  14. package/dist/cli/templates/agents/content/core/sfag-ticket-implementer.js.map +1 -1
  15. package/dist/tools/core/git-injection.d.ts +45 -26
  16. package/dist/tools/core/git-injection.d.ts.map +1 -1
  17. package/dist/tools/core/git-injection.js +35 -37
  18. package/dist/tools/core/git-injection.js.map +1 -1
  19. package/dist/tools/index.d.ts.map +1 -1
  20. package/dist/tools/index.js +50 -7
  21. package/dist/tools/index.js.map +1 -1
  22. package/node_modules/@specforge/api-types/package.json +1 -1
  23. package/node_modules/@specforge/report-types/package.json +1 -1
  24. package/node_modules/@specforge/session-types/CHANGELOG.md +4 -0
  25. package/node_modules/@specforge/session-types/dist/index.d.ts +1 -1
  26. package/node_modules/@specforge/session-types/dist/index.d.ts.map +1 -1
  27. package/node_modules/@specforge/session-types/dist/index.js +1 -1
  28. package/node_modules/@specforge/session-types/dist/index.js.map +1 -1
  29. package/node_modules/@specforge/session-types/dist/runtime/implementation-config.d.ts.map +1 -1
  30. package/node_modules/@specforge/session-types/dist/runtime/implementation-config.js +3 -1
  31. package/node_modules/@specforge/session-types/dist/runtime/implementation-config.js.map +1 -1
  32. package/node_modules/@specforge/session-types/dist/runtime/lifecycle-contract.d.ts +27 -1
  33. package/node_modules/@specforge/session-types/dist/runtime/lifecycle-contract.d.ts.map +1 -1
  34. package/node_modules/@specforge/session-types/dist/runtime/work-session-file-change.d.ts +7 -1
  35. package/node_modules/@specforge/session-types/dist/runtime/work-session-file-change.d.ts.map +1 -1
  36. package/node_modules/@specforge/session-types/dist/schema/index.d.ts +1 -1
  37. package/node_modules/@specforge/session-types/dist/schema/index.d.ts.map +1 -1
  38. package/node_modules/@specforge/session-types/dist/schema/index.js +1 -1
  39. package/node_modules/@specforge/session-types/dist/schema/index.js.map +1 -1
  40. package/node_modules/@specforge/session-types/dist/schema/work-session-file-change.d.ts +99 -0
  41. package/node_modules/@specforge/session-types/dist/schema/work-session-file-change.d.ts.map +1 -1
  42. package/node_modules/@specforge/session-types/dist/schema/work-session-file-change.js +36 -0
  43. package/node_modules/@specforge/session-types/dist/schema/work-session-file-change.js.map +1 -1
  44. package/node_modules/@specforge/session-types/dist/schema/work-session.d.ts +17 -0
  45. package/node_modules/@specforge/session-types/dist/schema/work-session.d.ts.map +1 -1
  46. package/node_modules/@specforge/session-types/dist/schema/work-session.js +15 -0
  47. package/node_modules/@specforge/session-types/dist/schema/work-session.js.map +1 -1
  48. package/node_modules/@specforge/session-types/package.json +1 -1
  49. package/package.json +6 -6
  50. package/src/cli/templates/agents/content/core/sfag-orchestrator.ts +34 -6
  51. package/src/cli/templates/agents/content/core/sfag-ticket-implementer.ts +37 -6
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@specforge/api-types",
3
- "version": "0.4.17",
3
+ "version": "0.4.18",
4
4
  "description": "Catch-all type contracts for SpecForge: entity types, store interfaces, derived views, and API-surface helpers that are not lifecycle session-types and not spec-domain types.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@specforge/report-types",
3
- "version": "0.4.9",
3
+ "version": "0.4.10",
4
4
  "description": "SpecForge status/analytic report types (specification/epic status, implementation/time/blockers). Embeds the canonical spec-domain entities (spec-types) + Project (api-types).",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.15 — 2026-08-30
4
+
5
+ - MB.46 progress-honest-finalize-gate: progress becomes the hard finalize gate (stop stamping Ticket.progress=100, persist the real score); a `fulfills` discriminated link on WorkSessionFileChange lets an approved cross-path deviation satisfy a sub-declared step/file in both the `file-action-coverage` gate and the progress dimensions (fileId = a TicketFileId, additional-file allowed); the CWS git commit-diff injection (base recovered from a per-worktree CLI local registry, D3b) backstops the honest file gate in-memory; and the MCP tooling + proactive/reactive guidance (both tool catalogs, remediation-map, composeNotFinishedBlock, nextFileDirective, orientation) drive the agent to declare and re-declare `fulfills`. Closes 624db98f.
6
+
3
7
  ## 0.4.14 — 2026-08-23
4
8
 
5
9
  - MB.36 — the file-graph (file-provenance/file-conflict/import-freeze) moves into ticket_expansion, validated repo-aware against the current git worktree (grep double-call + stash) and re-run in cross_validation as a safety net; create_dependencies/delete_dependencies become a native band in ticket_expansion (no rollback); cross_validation becomes the dependency-parallelization pass with a full dependency-tree render + parallelism directive in its guidance; the mcp-handler action boundary forwards existingFiles and injects [] for web origin. webapp bugfixes: a "New Spec" button on the project dashboard (projects/{id}); the /projects grid now refreshes after creating a project (invalidate the accessible key); a "New spec" affordance in the sidebar when a project is expanded.
@@ -43,5 +43,5 @@ export * from './stores/work-session-action-store.js';
43
43
  export * from './stores/implementation-record-event-store.js';
44
44
  export * from './stores/discovery-store.js';
45
45
  export * from './stores/working-context-store.js';
46
- export { ImplementationSessionSchema, WorkSessionSchema, WorkSessionAcceptanceCheckSchema, WorkSessionImplStepCompletionSchema, WorkSessionFileChangeSchema, WorkSessionTestResultSchema, WorkSessionResolutionSchema, WorkSessionActionSchema, DiscoverySchema, ImplementationRecordEventSchema, ParsedGitEvidenceSchema, } from './schema/index.js';
46
+ export { ImplementationSessionSchema, WorkSessionSchema, WorkSessionAcceptanceCheckSchema, WorkSessionImplStepCompletionSchema, WorkSessionFileChangeSchema, FileChangeFulfillsSchema, WorkSessionTestResultSchema, WorkSessionResolutionSchema, WorkSessionActionSchema, DiscoverySchema, ImplementationRecordEventSchema, ParsedGitEvidenceSchema, } from './schema/index.js';
47
47
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sCAAsC,CAAC;AACrD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0CAA0C,CAAC;AACzD,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4CAA4C,CAAC;AAC3D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,0CAA0C,CAAC;AACzD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AAEjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6CAA6C,CAAC;AAC5D,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AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,0CAA0C,CAAC;AACzD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AAEjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,oDAAoD,CAAC;AACnE,cAAc,mDAAmD,CAAC;AAClE,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iDAAiD,CAAC;AAChE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qDAAqD,CAAC;AACpE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,uCAAuC,CAAC;AACtD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAElD,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,gCAAgC,EAChC,mCAAmC,EACnC,2BAA2B,EAC3B,wBAAwB,EACxB,2BAA2B,EAC3B,2BAA2B,EAC3B,uBAAuB,EACvB,eAAe,EACf,+BAA+B,EAC/B,uBAAuB,GACxB,MAAM,mBAAmB,CAAC"}
@@ -43,5 +43,5 @@ export * from './stores/work-session-action-store.js';
43
43
  export * from './stores/implementation-record-event-store.js';
44
44
  export * from './stores/discovery-store.js';
45
45
  export * from './stores/working-context-store.js';
46
- export { ImplementationSessionSchema, WorkSessionSchema, WorkSessionAcceptanceCheckSchema, WorkSessionImplStepCompletionSchema, WorkSessionFileChangeSchema, WorkSessionTestResultSchema, WorkSessionResolutionSchema, WorkSessionActionSchema, DiscoverySchema, ImplementationRecordEventSchema, ParsedGitEvidenceSchema, } from './schema/index.js';
46
+ export { ImplementationSessionSchema, WorkSessionSchema, WorkSessionAcceptanceCheckSchema, WorkSessionImplStepCompletionSchema, WorkSessionFileChangeSchema, FileChangeFulfillsSchema, WorkSessionTestResultSchema, WorkSessionResolutionSchema, WorkSessionActionSchema, DiscoverySchema, ImplementationRecordEventSchema, ParsedGitEvidenceSchema, } from './schema/index.js';
47
47
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sCAAsC,CAAC;AACrD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0CAA0C,CAAC;AACzD,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4CAA4C,CAAC;AAC3D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,0CAA0C,CAAC;AACzD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AAEjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,oDAAoD,CAAC;AACnE,cAAc,mDAAmD,CAAC;AAClE,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,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c,kCAAkC,CAAC;AAEjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,oDAAoD,CAAC;AACnE,cAAc,mDAAmD,CAAC;AAClE,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iDAAiD,CAAC;AAChE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qDAAqD,CAAC;AACpE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,uCAAuC,CAAC;AACtD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAElD,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,gCAAgC,EAChC,mCAAmC,EACnC,2BAA2B,EAC3B,wBAAwB,EACxB,2BAA2B,EAC3B,2BAA2B,EAC3B,uBAAuB,EACvB,eAAe,EACf,+BAA+B,EAC/B,uBAAuB,GACxB,MAAM,mBAAmB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"implementation-config.d.ts","sourceRoot":"","sources":["../../src/runtime/implementation-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,sCAAsC,EAAG,0BAAmC,CAAC;AAE1F,eAAO,MAAM,8CAA8C,IAAI,CAAC;AAEhE,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+B9C,CAAC;AACH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAC;AAEhG;;;;;;;;;GASG;AACH,eAAO,MAAM,4CAA4C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAoD,CAAC;AAC9G,MAAM,MAAM,sCAAsC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4CAA4C,CAAC,CAAC;AAKlH,eAAO,MAAM,iCAAiC,EAAE,6BAsB/C,CAAC"}
1
+ {"version":3,"file":"implementation-config.d.ts","sourceRoot":"","sources":["../../src/runtime/implementation-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,sCAAsC,EAAG,0BAAmC,CAAC;AAE1F,eAAO,MAAM,8CAA8C,IAAI,CAAC;AAEhE,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+B9C,CAAC;AACH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAC;AAEhG;;;;;;;;;GASG;AACH,eAAO,MAAM,4CAA4C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAoD,CAAC;AAC9G,MAAM,MAAM,sCAAsC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4CAA4C,CAAC,CAAC;AAKlH,eAAO,MAAM,iCAAiC,EAAE,6BAwB/C,CAAC"}
@@ -83,7 +83,9 @@ export const IMPLEMENTATION_LIFECYCLE_DEFAULTS = {
83
83
  // MB.14.5 — step-file UNIFIED weights. The step↔file links (MB.14.1) merge the old
84
84
  // separate `steps` (.40) + `files` (.15) dimensions into one step-file dimension
85
85
  // (`steps`: 0.55): the assay `computeImplStepProgress` now requires a step's linked
86
- // files recorded `matched`, so `files` carries 0. The 4-key struct shape is KEPT
86
+ // files SATISFIED — recorded `matched` OR an approved same-path deviation (MB.46.1),
87
+ // or an approved+`fulfills`-linked deviation (MB.46.2) — so `files` carries 0. The
88
+ // 4-key struct shape is KEPT
87
89
  // (the assay `ProgressWeightsSchema` is `.strict()` on {steps,ac,tests,files}).
88
90
  // DECIDED (c): 0.55 is the DEFAULT; MB.14.7 makes these user-configurable.
89
91
  weights: {
@@ -1 +1 @@
1
- {"version":3,"file":"implementation-config.js","sourceRoot":"","sources":["../../src/runtime/implementation-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,0BAAmC,CAAC;AAC1F,+EAA+E;AAC/E,MAAM,CAAC,MAAM,8CAA8C,GAAG,CAAC,CAAC;AAEhE,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1D,gFAAgF;IAChF,gFAAgF;IAChF,6DAA6D;IAC7D,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IAC5B,iFAAiF;IACjF,6EAA6E;IAC7E,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE;IAC3B,2CAA2C;IAC3C,uEAAuE;IACvE,wEAAwE;IACxE,2CAA2C;IAC3C,aAAa,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACzC,mFAAmF;IACnF,+DAA+D;IAC/D,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE;QACvB,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE;QACjB,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE;QACjB,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE;KAClB,CAAC;IACF,+EAA+E;IAC/E,kFAAkF;IAClF,+EAA+E;IAC/E,kCAAkC;IAClC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;QAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QACjB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;QACd,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QACjB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;KAClB,CAAC;CACH,CAAC,CAAC;AAGH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,4CAA4C,GAAG,mCAAmC,CAAC,WAAW,EAAE,CAAC;AAG9G,8EAA8E;AAC9E,oFAAoF;AACpF,8EAA8E;AAC9E,MAAM,CAAC,MAAM,iCAAiC,GAAkC;IAC9E,UAAU,EAAE,CAAC;IACb,cAAc,EAAE,KAAK;IACrB,aAAa,EAAE,OAAO;IACtB,KAAK,EAAE;QACL,UAAU,EAAE,IAAI;QAChB,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,IAAI;KACX;IACD,mFAAmF;IACnF,iFAAiF;IACjF,oFAAoF;IACpF,iFAAiF;IACjF,gFAAgF;IAChF,2EAA2E;IAC3E,OAAO,EAAE;QACP,KAAK,EAAE,IAAI;QACX,EAAE,EAAE,GAAG;QACP,KAAK,EAAE,IAAI;QACX,KAAK,EAAE,CAAC;KACT;CACF,CAAC"}
1
+ {"version":3,"file":"implementation-config.js","sourceRoot":"","sources":["../../src/runtime/implementation-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,0BAAmC,CAAC;AAC1F,+EAA+E;AAC/E,MAAM,CAAC,MAAM,8CAA8C,GAAG,CAAC,CAAC;AAEhE,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1D,gFAAgF;IAChF,gFAAgF;IAChF,6DAA6D;IAC7D,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,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C7B,gFAAgF;IAChF,2EAA2E;IAC3E,OAAO,EAAE;QACP,KAAK,EAAE,IAAI;QACX,EAAE,EAAE,GAAG;QACP,KAAK,EAAE,IAAI;QACX,KAAK,EAAE,CAAC;KACT;CACF,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { PlanningPhase, PlanningSessionStatus, WorkPhase, WorkSessionStatus } from './enums.js';
1
+ import type { ExpectedAction, PlanningPhase, PlanningSessionStatus, WorkPhase, WorkSessionStatus } from './enums.js';
2
2
  import type { PlanningOperationName } from './planning-operations.js';
3
3
  import type { WritePlan } from './write-plan.js';
4
4
  export type LifecycleEvent = 'start_planning_session' | 'action_planning_session' | 'complete_planning_session';
@@ -271,6 +271,16 @@ export interface StartWorkSessionPayload {
271
271
  userId?: string;
272
272
  worktreePath?: string;
273
273
  branch?: string;
274
+ /**
275
+ * MB.46 (F2 / D3) — the base commit the agent's worktree is at when the session
276
+ * starts (`git rev-parse HEAD`), injected by the MCP-local (MB.46.4). SWS
277
+ * persists it once onto `WorkSession.baseCommitSha` (the resume path never
278
+ * overwrites — MB.46.5) as the two-dot anchor for the CWS commit diff. Absent
279
+ * for a non-git caller (the Lambda has no worktree). The CLI also stashes this
280
+ * base in its own local per-worktree registry (D3b) — that local copy, not a
281
+ * server read-back, is what the CWS diff functionally uses.
282
+ */
283
+ baseCommitSha?: string;
274
284
  /**
275
285
  * Clean-git-workspace status injected by the MCP-local (M23). `false` = the
276
286
  * agent's worktree has uncommitted changes → SWS denies (`git_dirty`,
@@ -314,6 +324,22 @@ export interface CompleteWorkSessionPayload {
314
324
  * satisfies the git-evidence gate when a `commitSha` is not available.
315
325
  */
316
326
  gitEvidence?: Record<string, unknown>;
327
+ /**
328
+ * MB.46 (F2 / B-estreito) — the REAL set of files changed since the session
329
+ * base, derived by the MCP-local from `git diff --name-status
330
+ * <baseCommitSha>..HEAD` (MB.46.4) and injected as a batch. The CWS reconciles
331
+ * each entry against the plan and projects them IN MEMORY only into the set the
332
+ * assay scores (MB.46.5) — a git-caught path the agent never reported surfaces
333
+ * as an unjustified `extra`, failing the `file-action-coverage` gate (the honest
334
+ * backstop). It PERSISTS nothing: the agent remains the sole persister of file
335
+ * rows (via `add_file_change_justification`). `action` mirrors the plan's
336
+ * expected-action vocabulary (git A/M/D/R → create/modify/delete; a rename
337
+ * surfaces as a create of the new path). Absent for a non-git caller.
338
+ */
339
+ localFileChanges?: {
340
+ path: string;
341
+ action: ExpectedAction;
342
+ }[];
317
343
  }
318
344
  /**
319
345
  * Payload-carrying dispatch union accepted by the work lifecycle (the work
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle-contract.d.ts","sourceRoot":"","sources":["../../src/runtime/lifecycle-contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,qBAAqB,EACrB,SAAS,EACT,iBAAiB,EAClB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,MAAM,cAAc,GACtB,wBAAwB,GACxB,yBAAyB,GACzB,2BAA2B,CAAC;AAEhC;;;;;;;;;;GAUG;AACH;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,aAAa,CAAC;IAC7B,cAAc,EAAE,qBAAqB,CAAC;IACtC;;;;;;;;;OASG;IACH,OAAO,EAAE,SAAS,GAAG,QAAQ,GAAG,mBAAmB,CAAC;IACpD;;;;;;;;OAQG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B;;;;OAIG;IACH,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B;;;OAGG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,OAAO,G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E,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC;AAED;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,oBAAoB,CAAC;IAAC,OAAO,EAAE,uBAAuB,CAAA;CAAE,GAChE;IAAE,IAAI,EAAE,qBAAqB,CAAC;IAAC,OAAO,EAAE,wBAAwB,CAAA;CAAE,GAClE;IAAE,IAAI,EAAE,uBAAuB,CAAC;IAAC,OAAO,EAAE,0BAA0B,CAAA;CAAE,CAAC"}
1
+ {"version":3,"file":"lifecycle-contract.d.ts","sourceRoot":"","sources":["../../src/runtime/lifecycle-contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,qBAAqB,EACrB,SAAS,EACT,iBAAiB,EAClB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,MAAM,cAAc,GACtB,wBAAwB,GACxB,yBAAyB,GACzB,2BAA2B,CAAC;AAEhC;;;;;;;;;;GAUG;AACH;;;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kB,GAC1B;IAAE,IAAI,EAAE,oBAAoB,CAAC;IAAC,OAAO,EAAE,uBAAuB,CAAA;CAAE,GAChE;IAAE,IAAI,EAAE,qBAAqB,CAAC;IAAC,OAAO,EAAE,wBAAwB,CAAA;CAAE,GAClE;IAAE,IAAI,EAAE,uBAAuB,CAAC;IAAC,OAAO,EAAE,0BAA0B,CAAA;CAAE,CAAC"}
@@ -1,4 +1,10 @@
1
1
  import type { z } from 'zod';
2
- import type { WorkSessionFileChangeSchema } from '../schema/work-session-file-change.js';
2
+ import type { WorkSessionFileChangeSchema, FileChangeFulfillsSchema } from '../schema/work-session-file-change.js';
3
3
  export type WorkSessionFileChange = z.infer<typeof WorkSessionFileChangeSchema>;
4
+ /**
5
+ * MB.46 (D1 v2) — the agent-declared `fulfills` link carried on a
6
+ * `WorkSessionFileChange` (discriminated on `kind`: `step` carries the declared
7
+ * `fileId` it replaces; `acceptance_criterion`/`test` carry only the plan item id).
8
+ */
9
+ export type FileChangeFulfills = z.infer<typeof FileChangeFulfillsSchema>;
4
10
  //# sourceMappingURL=work-session-file-change.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"work-session-file-change.d.ts","sourceRoot":"","sources":["../../src/runtime/work-session-file-change.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AAEzF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
1
+ {"version":3,"file":"work-session-file-change.d.ts","sourceRoot":"","sources":["../../src/runtime/work-session-file-change.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EACV,2BAA2B,EAC3B,wBAAwB,EACzB,MAAM,uCAAuC,CAAC;AAE/C,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
@@ -2,7 +2,7 @@ export { ImplementationSessionSchema } from './implementation-session.js';
2
2
  export { WorkSessionSchema } from './work-session.js';
3
3
  export { WorkSessionAcceptanceCheckSchema } from './work-session-acceptance-check.js';
4
4
  export { WorkSessionImplStepCompletionSchema } from './work-session-impl-step-completion.js';
5
- export { WorkSessionFileChangeSchema } from './work-session-file-change.js';
5
+ export { WorkSessionFileChangeSchema, FileChangeFulfillsSchema } from './work-session-file-change.js';
6
6
  export { WorkSessionTestResultSchema } from './work-session-test-result.js';
7
7
  export { WorkSessionResolutionSchema } from './work-session-resolution.js';
8
8
  export { WorkSessionActionSchema } from './work-session-action.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,mCAAmC,EAAE,MAAM,wCAAwC,CAAC;AAC7F,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,mCAAmC,EAAE,MAAM,wCAAwC,CAAC;AAC7F,OAAO,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACtG,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -2,7 +2,7 @@ export { ImplementationSessionSchema } from './implementation-session.js';
2
2
  export { WorkSessionSchema } from './work-session.js';
3
3
  export { WorkSessionAcceptanceCheckSchema } from './work-session-acceptance-check.js';
4
4
  export { WorkSessionImplStepCompletionSchema } from './work-session-impl-step-completion.js';
5
- export { WorkSessionFileChangeSchema } from './work-session-file-change.js';
5
+ export { WorkSessionFileChangeSchema, FileChangeFulfillsSchema } from './work-session-file-change.js';
6
6
  export { WorkSessionTestResultSchema } from './work-session-test-result.js';
7
7
  export { WorkSessionResolutionSchema } from './work-session-resolution.js';
8
8
  export { WorkSessionActionSchema } from './work-session-action.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,mCAAmC,EAAE,MAAM,wCAAwC,CAAC;AAC7F,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,mCAAmC,EAAE,MAAM,wCAAwC,CAAC;AAC7F,OAAO,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACtG,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -1,4 +1,50 @@
1
1
  import { z } from 'zod';
2
+ /**
3
+ * MB.46 (D1 v2) — the agent-declared LINK from an `extra`/`mismatched` file change
4
+ * to the plan item it fulfils, declared at justification time (MB.46.9) and honoured
5
+ * by the assay progress+gate after human approval (MB.46.2). A discriminated union
6
+ * on `kind`:
7
+ * - `step` — the deviation Q REPLACES the declared file `fileId` (a **TicketFileId**
8
+ * = `fileChangeRef.id`) of step `id`. This SUPPRESSES the missing/unsatisfied
9
+ * declared file at that file's path (the deadlock fix, keyed per-file so a sibling
10
+ * P2 not produced still fails). `fileId` may be an ADDITIONAL declared file
11
+ * (declared in another step, or `referenced` without a step) — not only the step's.
12
+ * - `acceptance_criterion` / `test` — the extra is a REBUTTAL that exists to satisfy
13
+ * that AC/test (an honest reason for the approved extra). It does NOT suppress any
14
+ * declared-file missing and does NOT count progress; `id` is the AC entity id / the
15
+ * test's testType respectively.
16
+ */
17
+ export declare const FileChangeFulfillsSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
18
+ kind: z.ZodLiteral<"step">;
19
+ id: z.ZodString;
20
+ fileId: z.ZodString;
21
+ }, "strip", z.ZodTypeAny, {
22
+ id: string;
23
+ kind: "step";
24
+ fileId: string;
25
+ }, {
26
+ id: string;
27
+ kind: "step";
28
+ fileId: string;
29
+ }>, z.ZodObject<{
30
+ kind: z.ZodLiteral<"acceptance_criterion">;
31
+ id: z.ZodString;
32
+ }, "strip", z.ZodTypeAny, {
33
+ id: string;
34
+ kind: "acceptance_criterion";
35
+ }, {
36
+ id: string;
37
+ kind: "acceptance_criterion";
38
+ }>, z.ZodObject<{
39
+ kind: z.ZodLiteral<"test">;
40
+ id: z.ZodString;
41
+ }, "strip", z.ZodTypeAny, {
42
+ id: string;
43
+ kind: "test";
44
+ }, {
45
+ id: string;
46
+ kind: "test";
47
+ }>]>;
2
48
  export declare const WorkSessionFileChangeSchema: z.ZodObject<{
3
49
  id: z.ZodString;
4
50
  workSessionId: z.ZodString;
@@ -9,6 +55,37 @@ export declare const WorkSessionFileChangeSchema: z.ZodObject<{
9
55
  actualAction: z.ZodOptional<z.ZodEnum<["created", "modified", "deleted", "referenced", "absent"]>>;
10
56
  status: z.ZodEnum<["matched", "missing", "mismatched", "extra"]>;
11
57
  justification: z.ZodOptional<z.ZodString>;
58
+ fulfills: z.ZodOptional<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
59
+ kind: z.ZodLiteral<"step">;
60
+ id: z.ZodString;
61
+ fileId: z.ZodString;
62
+ }, "strip", z.ZodTypeAny, {
63
+ id: string;
64
+ kind: "step";
65
+ fileId: string;
66
+ }, {
67
+ id: string;
68
+ kind: "step";
69
+ fileId: string;
70
+ }>, z.ZodObject<{
71
+ kind: z.ZodLiteral<"acceptance_criterion">;
72
+ id: z.ZodString;
73
+ }, "strip", z.ZodTypeAny, {
74
+ id: string;
75
+ kind: "acceptance_criterion";
76
+ }, {
77
+ id: string;
78
+ kind: "acceptance_criterion";
79
+ }>, z.ZodObject<{
80
+ kind: z.ZodLiteral<"test">;
81
+ id: z.ZodString;
82
+ }, "strip", z.ZodTypeAny, {
83
+ id: string;
84
+ kind: "test";
85
+ }, {
86
+ id: string;
87
+ kind: "test";
88
+ }>]>>;
12
89
  notes: z.ZodOptional<z.ZodString>;
13
90
  lineCount: z.ZodOptional<z.ZodNumber>;
14
91
  recordedAt: z.ZodString;
@@ -24,6 +101,17 @@ export declare const WorkSessionFileChangeSchema: z.ZodObject<{
24
101
  notes?: string | undefined;
25
102
  actualAction?: "created" | "modified" | "deleted" | "referenced" | "absent" | undefined;
26
103
  justification?: string | undefined;
104
+ fulfills?: {
105
+ id: string;
106
+ kind: "step";
107
+ fileId: string;
108
+ } | {
109
+ id: string;
110
+ kind: "acceptance_criterion";
111
+ } | {
112
+ id: string;
113
+ kind: "test";
114
+ } | undefined;
27
115
  lineCount?: number | undefined;
28
116
  }, {
29
117
  status: "matched" | "missing" | "mismatched" | "extra";
@@ -37,6 +125,17 @@ export declare const WorkSessionFileChangeSchema: z.ZodObject<{
37
125
  notes?: string | undefined;
38
126
  actualAction?: "created" | "modified" | "deleted" | "referenced" | "absent" | undefined;
39
127
  justification?: string | undefined;
128
+ fulfills?: {
129
+ id: string;
130
+ kind: "step";
131
+ fileId: string;
132
+ } | {
133
+ id: string;
134
+ kind: "acceptance_criterion";
135
+ } | {
136
+ id: string;
137
+ kind: "test";
138
+ } | undefined;
40
139
  lineCount?: number | undefined;
41
140
  }>;
42
141
  //# sourceMappingURL=work-session-file-change.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"work-session-file-change.d.ts","sourceRoot":"","sources":["../../src/schema/work-session-file-change.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBtC,CAAC"}
1
+ {"version":3,"file":"work-session-file-change.d.ts","sourceRoot":"","sources":["../../src/schema/work-session-file-change.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAcnC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BtC,CAAC"}
@@ -1,5 +1,35 @@
1
1
  import { z } from 'zod';
2
2
  import { EXPECTED_ACTIONS, ACTUAL_ACTIONS, FILE_CHANGE_STATUSES, } from '../runtime/enums.js';
3
+ /**
4
+ * MB.46 (D1 v2) — the agent-declared LINK from an `extra`/`mismatched` file change
5
+ * to the plan item it fulfils, declared at justification time (MB.46.9) and honoured
6
+ * by the assay progress+gate after human approval (MB.46.2). A discriminated union
7
+ * on `kind`:
8
+ * - `step` — the deviation Q REPLACES the declared file `fileId` (a **TicketFileId**
9
+ * = `fileChangeRef.id`) of step `id`. This SUPPRESSES the missing/unsatisfied
10
+ * declared file at that file's path (the deadlock fix, keyed per-file so a sibling
11
+ * P2 not produced still fails). `fileId` may be an ADDITIONAL declared file
12
+ * (declared in another step, or `referenced` without a step) — not only the step's.
13
+ * - `acceptance_criterion` / `test` — the extra is a REBUTTAL that exists to satisfy
14
+ * that AC/test (an honest reason for the approved extra). It does NOT suppress any
15
+ * declared-file missing and does NOT count progress; `id` is the AC entity id / the
16
+ * test's testType respectively.
17
+ */
18
+ export const FileChangeFulfillsSchema = z.discriminatedUnion('kind', [
19
+ z.object({
20
+ kind: z.literal('step'),
21
+ id: z.string().min(1),
22
+ fileId: z.string().min(1),
23
+ }),
24
+ z.object({
25
+ kind: z.literal('acceptance_criterion'),
26
+ id: z.string().min(1),
27
+ }),
28
+ z.object({
29
+ kind: z.literal('test'),
30
+ id: z.string().min(1),
31
+ }),
32
+ ]);
3
33
  export const WorkSessionFileChangeSchema = z.object({
4
34
  id: z.string(),
5
35
  workSessionId: z.string(),
@@ -10,6 +40,12 @@ export const WorkSessionFileChangeSchema = z.object({
10
40
  actualAction: z.enum(ACTUAL_ACTIONS).optional(),
11
41
  status: z.enum(FILE_CHANGE_STATUSES),
12
42
  justification: z.string().optional(),
43
+ // MB.46 (D1 v2) — the agent-declared link from an `extra`/`mismatched` deviation to
44
+ // the plan item it fulfils (step+fileId | acceptance_criterion | test). Written by
45
+ // `add_file_change_justification` (MB.46.9); honoured by the assay progress+gate
46
+ // (MB.46.2). Persisted as ONE `a.json()` column (the runtime value is a nested
47
+ // discriminated object; the generic `relatedPut` spread writes it raw).
48
+ fulfills: FileChangeFulfillsSchema.optional(),
13
49
  // justificationApproved REMOVED (M17.4): the verdict is no longer persisted on
14
50
  // the file-change row. It lives on the `WorkSessionResolution` (M15.8 — source of
15
51
  // truth) and is HYDRATED per `(targetType='file_change', targetId)` onto the
@@ -1 +1 @@
1
- {"version":3,"file":"work-session-file-change.js","sourceRoot":"","sources":["../../src/schema/work-session-file-change.ts"],"names":[],"mappings":"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,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,oFAAoF;IACpF,mFAAmF;IACnF,iFAAiF;IACjF,+EAA+E;IAC/E,wEAAwE;IACxE,QAAQ,EAAE,wBAAwB,CAAC,QAAQ,EAAE;IAC7C,+EAA+E;IAC/E,kFAAkF;IAClF,6EAA6E;IAC7E,+EAA+E;IAC/E,yFAAyF;IACzF,oEAAoE;IAEpE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IACpD,4FAA4F;IAC5F,6EAA6E;IAC7E,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC"}
@@ -107,6 +107,21 @@ export declare const WorkSessionSchema: z.ZodObject<{
107
107
  insertions: z.ZodOptional<z.ZodNumber>;
108
108
  deletions: z.ZodOptional<z.ZodNumber>;
109
109
  }, z.ZodTypeAny, "passthrough">>>;
110
+ /**
111
+ * MB.46 (F2 / D3) — the base commit the WorkSession forked from, captured
112
+ * `git rev-parse HEAD` at SWS start and set once (the resume path never
113
+ * overwrites an existing base — MB.46.5). It is the two-dot anchor for the
114
+ * commit diff `git diff --name-status <baseCommitSha>..HEAD` the MCP-local runs
115
+ * at CWS to derive the REAL set of changed files (MB.46.4).
116
+ *
117
+ * ⚠ PROVENANCE-ONLY server-side (D3b): the FUNCTIONAL base of the CWS diff comes
118
+ * from the CLI's LOCAL per-worktree registry (survives resume in a fresh
119
+ * process), NOT a server read-back. This column + its store round-trip are the
120
+ * persistence-parity guard against the MB.1 silent-drop, not a functional
121
+ * consumer. The live Amplify column is added by MB.46.3 (`resource.ts`
122
+ * `WorkSession.baseCommitSha: a.string()`).
123
+ */
124
+ baseCommitSha: z.ZodOptional<z.ZodString>;
110
125
  /**
111
126
  * Coherence score (0–100) — the change-INDICATOR the assay computes (M17.4):
112
127
  * `((1 − pctFilesJustified) + (1 − pctTestsJustified)) / 2`, present dims only. It
@@ -163,6 +178,7 @@ export declare const WorkSessionSchema: z.ZodObject<{
163
178
  insertions: z.ZodOptional<z.ZodNumber>;
164
179
  deletions: z.ZodOptional<z.ZodNumber>;
165
180
  }, z.ZodTypeAny, "passthrough"> | undefined;
181
+ baseCommitSha?: string | undefined;
166
182
  coherenceScore?: number | undefined;
167
183
  actualMinutes?: number | undefined;
168
184
  }, {
@@ -197,6 +213,7 @@ export declare const WorkSessionSchema: z.ZodObject<{
197
213
  insertions: z.ZodOptional<z.ZodNumber>;
198
214
  deletions: z.ZodOptional<z.ZodNumber>;
199
215
  }, z.ZodTypeAny, "passthrough"> | undefined;
216
+ baseCommitSha?: string | undefined;
200
217
  coherenceScore?: number | undefined;
201
218
  actualMinutes?: number | undefined;
202
219
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"work-session.d.ts","sourceRoot":"","sources":["../../src/schema/work-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;IAK5B;;;;;;;OAOG;;IAGH;;;;;OAKG;;;;;IAOH;;;;;;;OAOG;;;IAIH;;;;;;;;;OASG;;IAGH;;;;;;OAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIH;;;;;;;;OAQG;;IAGH;;;;;;;;;;;OAWG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGH,CAAC"}
1
+ {"version":3,"file":"work-session.d.ts","sourceRoot":"","sources":["../../src/schema/work-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;IAK5B;;;;;;;OAOG;;IAGH;;;;;OAKG;;;;;IAOH;;;;;;;OAOG;;;IAIH;;;;;;;;;OASG;;IAGH;;;;;;OAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIH;;;;;;;;;;;;;OAaG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;;;;;OAWG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGH,CAAC"}
@@ -58,6 +58,21 @@ export const WorkSessionSchema = z.object({
58
58
  */
59
59
  commitSha: z.string().optional(),
60
60
  gitEvidence: ParsedGitEvidenceSchema.optional(),
61
+ /**
62
+ * MB.46 (F2 / D3) — the base commit the WorkSession forked from, captured
63
+ * `git rev-parse HEAD` at SWS start and set once (the resume path never
64
+ * overwrites an existing base — MB.46.5). It is the two-dot anchor for the
65
+ * commit diff `git diff --name-status <baseCommitSha>..HEAD` the MCP-local runs
66
+ * at CWS to derive the REAL set of changed files (MB.46.4).
67
+ *
68
+ * ⚠ PROVENANCE-ONLY server-side (D3b): the FUNCTIONAL base of the CWS diff comes
69
+ * from the CLI's LOCAL per-worktree registry (survives resume in a fresh
70
+ * process), NOT a server read-back. This column + its store round-trip are the
71
+ * persistence-parity guard against the MB.1 silent-drop, not a functional
72
+ * consumer. The live Amplify column is added by MB.46.3 (`resource.ts`
73
+ * `WorkSession.baseCommitSha: a.string()`).
74
+ */
75
+ baseCommitSha: z.string().optional(),
61
76
  /**
62
77
  * Coherence score (0–100) — the change-INDICATOR the assay computes (M17.4):
63
78
  * `((1 − pctFilesJustified) + (1 − pctTestsJustified)) / 2`, present dims only. It
@@ -1 +1 @@
1
- {"version":3,"file":"work-session.js","sourceRoot":"","sources":["../../src/schema/work-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AA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AAE;IAEpC;;;;;;;;OAQG;IACH,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAErC;;;;;;;;;;;OAWG;IACH,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IACxD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;CACtD,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@specforge/session-types",
3
- "version": "0.4.14",
3
+ "version": "0.4.15",
4
4
  "description": "Session type definitions for SpecForge work/planning/review sessions.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@specforge/canary-cli",
3
- "version": "0.2.16",
3
+ "version": "0.2.18",
4
4
  "description": "MCP server for SpecForge - AI agent integration",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,9 +18,9 @@
18
18
  "minimatch": "^10.1.1",
19
19
  "ora": "^8.2.0",
20
20
  "zod": "^3.25.0",
21
- "@specforge/api-types": "0.4.17",
22
- "@specforge/report-types": "0.4.9",
23
- "@specforge/session-types": "0.4.14",
21
+ "@specforge/api-types": "0.4.18",
22
+ "@specforge/session-types": "0.4.15",
23
+ "@specforge/report-types": "0.4.10",
24
24
  "@specforge/spec-types": "0.4.17"
25
25
  },
26
26
  "devDependencies": {
@@ -33,7 +33,7 @@
33
33
  "tsx": "^4.7.0",
34
34
  "typescript": "^5.0.0",
35
35
  "vitest": "4.0.18",
36
- "@specforge/lifecycle": "0.3.22"
36
+ "@specforge/lifecycle": "0.3.24"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=18.0.0"
@@ -61,7 +61,7 @@
61
61
  "@specforge/session-types",
62
62
  "@specforge/report-types"
63
63
  ],
64
- "gitHead": "5f09988626cf09d1d0f400bef277fac50c962344",
64
+ "gitHead": "5a53696e799f2b204816c6e3345b79891bafdff7",
65
65
  "scripts": {
66
66
  "build": "tsup && tsc --emitDeclarationOnly --outDir dist",
67
67
  "typecheck": "tsc --noEmit",
@@ -103,12 +103,30 @@ This is how implementation runs. Internalize it before dispatching anything.
103
103
  - **Each worker is fully autonomous.** It picks up its ticket, runs the whole SWS → action_work_session
104
104
  → complete_work_session loop, records every dimension through the assay, commits, and finalizes
105
105
  \`active → done\` with no human touch. You do not step inside a worker's loop.
106
- - **Isolate the workers.** Give each worker its own git worktree/branch (use the \`branchPrefix\` from
107
- config, e.g. \`ticket/<ref>\`) so concurrent sessions don't collide on the worktree. SWS enforces a
108
- clean worktree per session.
106
+ - **Isolate the workers one worktree each, and hand each worker its path.** Before dispatching a
107
+ worker, create a fresh git worktree/branch for its ticket (\`git worktree add\`, using the
108
+ \`branchPrefix\` from config, e.g. \`ticket/<ref>\`). Then **tell the worker its worktree path** and
109
+ instruct it to pass that path as \`worktree\` on \`start_work_session\` and \`complete_work_session\`.
110
+ This is not optional for a parallel fleet: your workers all run under **one shared MCP server**
111
+ (one process, one working directory), so the MCP-local git evidence — clean status (at
112
+ start_work_session) and commit hash (at complete_work_session) — is read from THAT one directory
113
+ unless each worker names its own worktree. Two
114
+ concurrent sessions that end up in the same worktree are **denied** (\`concurrent_worktree\`); that
115
+ denial is the signal a worker was launched without its own worktree/path. SWS also enforces a clean
116
+ worktree per session.
109
117
  - **Respect the DAG.** Only \`ready\` (dependency-free) tickets are dispatchable. When a worker completes
110
118
  a ticket, the readiness cascade unblocks its dependents (\`pending → ready\`); you then dispatch the
111
119
  newly-ready ones. Never dispatch a ticket whose dependencies aren't \`done\`.
120
+ - **Merge a completed wave into the integration branch BEFORE dispatching the next wave.** Each worker
121
+ forks its worktree from the shared integration branch (the base every \`git worktree add\` branches
122
+ from). After the tickets of a wave finalize (\`→ done\`), you MUST **merge their branches into the
123
+ integration branch** before you create the worktrees for the newly-\`ready\` dependents. Why: a
124
+ dependent needs the files the dependency produced — if you dispatch it while the integration branch is
125
+ still stale, its worktree forks from a base that is MISSING those files, and its build/imports break.
126
+ Merging first means the next wave's worktree forks from the UPDATED base (dependencies included), and
127
+ the new worker's captured base commit (the SWS HEAD it diffs against at complete_work_session) is that
128
+ merged HEAD — so \`git diff base..HEAD\` captures only that worker's own work, not the dependencies'.
129
+ **Never dispatch a dependent before the base has loaded the dependency's changes.**
112
130
  - **No review coordination.** The review lifecycle is dormant — there is no reviewer to wait on, no
113
131
  approval/dismissal gate to coordinate. A worker self-completes through the CWS gates. Do NOT wait for
114
132
  a review step; it does not exist in the work chain.
@@ -152,7 +170,9 @@ get_next_actionable_tickets({ specificationId, limit }) // the ready tickets to
152
170
  get_implementation_status({ projectId, specificationId, status: "active" }) // who is already running
153
171
  \`\`\`
154
172
  Then dispatch:
155
- - Launch one \`sfag-ticket-implementer\` per \`ready\` ticket, each in its own worktree/branch.
173
+ - Launch one \`sfag-ticket-implementer\` per \`ready\` ticket. For each, first \`git worktree add\` a
174
+ fresh worktree/branch, then hand the worker its worktree path (it passes it to SWS/CWS as
175
+ \`worktree\`). A single non-parallel worker can run in the current directory with no worktree arg.
156
176
  - Bound concurrency by the config: at most \`maxParallelEpics\` epics in flight and \`maxTicketsPerTeam\`
157
177
  tickets per epic team. If the strategy is \`single\`, run one worker at a time; \`parallel\` runs
158
178
  independent epics concurrently; \`phased\` runs the DAG in dependency-ordered phases; \`auto\` picks
@@ -181,7 +201,10 @@ not a tool you can call.
181
201
  Loop until the spec is done:
182
202
  1. Poll \`get_implementation_status({ status: "active" })\` + \`get_next_actionable_tickets(...)\`.
183
203
  2. For every worker slot free (under the concurrency bound), dispatch the next \`ready\` ticket.
184
- 3. When a ticket finalizes \`→ done\`, the cascade unblocks its dependents — dispatch those next.
204
+ 3. When a ticket finalizes \`→ done\`, the cascade unblocks its dependents — but **merge the completed
205
+ ticket's branch into the integration branch FIRST**, THEN dispatch those dependents. Their worktrees
206
+ must fork from the merged base so they carry the files the dependency produced; a dependent dispatched
207
+ against a stale base breaks on missing imports.
185
208
  4. Send anything \`blocked\`/\`paused\` to \`sfag-work-resolver\`; re-dispatch once it's \`ready\` again
186
209
  (SWS re-attaches the paused WorkSession and applies the human's resolution).
187
210
  When every spec ticket is \`done\`, the last CWS finalizes the ImplementationSession and the spec → done.
@@ -258,7 +281,12 @@ sfag-ticket-implementer (ticket C, worktree C) ─┘ poll get_implementation_
258
281
  - ❌ Don't launch a worker without a spec. If no spec, HALT and hand planning to the main agent.
259
282
  - ❌ Don't try to create a spec, and don't delegate spec creation to any subagent. Planning is main-conversation-only.
260
283
  - ❌ Don't dispatch a ticket out of dependency order. Only \`ready\` (dependency-free) tickets are dispatchable.
261
- - ❌ Don't run workers in the same worktree. Give each its own worktree/branch or SWS collides on git-clean.
284
+ - ❌ Don't dispatch a dependent before merging its dependencies' completed branches into the integration
285
+ branch. Its worktree would fork from a stale base missing the dependency's files, breaking imports/builds,
286
+ and its diffed base commit would measure the wrong file set.
287
+ - ❌ Don't run workers in the same worktree, and don't dispatch a worker without giving it its own
288
+ worktree path to pass to SWS/CWS. Concurrent sessions sharing a worktree are DENIED
289
+ (\`concurrent_worktree\`) and their git evidence would otherwise be the launcher's, not the worker's.
262
290
  - ❌ Don't create the ImplementationSession yourself. The first worker's SWS creates it (first-write-wins).
263
291
  - ❌ Don't wait for a review/approval step — there isn't one. Workers self-complete through the CWS gates.
264
292
  - ❌ Don't resolve or unblock a discovery yourself. Hand it to \`sfag-work-resolver\`; the human unblocks in the web app.