@codyswann/lisa 2.298.0 → 2.299.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.
Files changed (117) hide show
  1. package/all/copy-contents/.gitattributes +6 -0
  2. package/dist/cli/gate-commands.d.ts +8 -6
  3. package/dist/cli/gate-commands.d.ts.map +1 -1
  4. package/dist/cli/gate-commands.js +21 -0
  5. package/dist/cli/gate-commands.js.map +1 -1
  6. package/dist/cli/learnings-overflow-cmd.d.ts +27 -0
  7. package/dist/cli/learnings-overflow-cmd.d.ts.map +1 -0
  8. package/dist/cli/learnings-overflow-cmd.js +57 -0
  9. package/dist/cli/learnings-overflow-cmd.js.map +1 -0
  10. package/dist/core/learnings-alias.d.ts +156 -0
  11. package/dist/core/learnings-alias.d.ts.map +1 -0
  12. package/dist/core/learnings-alias.js +199 -0
  13. package/dist/core/learnings-alias.js.map +1 -0
  14. package/dist/core/learnings-document.d.ts +18 -0
  15. package/dist/core/learnings-document.d.ts.map +1 -1
  16. package/dist/core/learnings-document.js +23 -2
  17. package/dist/core/learnings-document.js.map +1 -1
  18. package/dist/core/learnings-merge-driver.d.ts +8 -33
  19. package/dist/core/learnings-merge-driver.d.ts.map +1 -1
  20. package/dist/core/learnings-merge-driver.js +15 -0
  21. package/dist/core/learnings-merge-driver.js.map +1 -1
  22. package/dist/core/learnings-overflow.d.ts +76 -0
  23. package/dist/core/learnings-overflow.d.ts.map +1 -0
  24. package/dist/core/learnings-overflow.js +212 -0
  25. package/dist/core/learnings-overflow.js.map +1 -0
  26. package/dist/core/learnings-writer.d.ts +6 -0
  27. package/dist/core/learnings-writer.d.ts.map +1 -1
  28. package/dist/core/learnings-writer.js +57 -8
  29. package/dist/core/learnings-writer.js.map +1 -1
  30. package/dist/core/learnings.d.ts +2 -0
  31. package/dist/core/learnings.d.ts.map +1 -1
  32. package/dist/core/learnings.js +2 -0
  33. package/dist/core/learnings.js.map +1 -1
  34. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  35. package/dist/core/upstream-evidence-manifest.js +15 -6
  36. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  37. package/dist/opencode/plugin-templates/parity-safety-net-heredoc.py +232 -40
  38. package/dist/opencode/plugin-templates/parity-safety-net.sh +21 -1
  39. package/package.json +3 -1
  40. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  41. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  42. package/plugins/lisa/.codex-plugin/skills/lisa-learnings-audit/SKILL.md +42 -6
  43. package/plugins/lisa/.codex-plugin/skills/lisa-parity-safety-net-rules/SKILL.md +38 -1
  44. package/plugins/lisa/.codex-plugin/skills/lisa-persist-learning/SKILL.md +7 -2
  45. package/plugins/lisa/hooks/parity-safety-net-heredoc.py +232 -40
  46. package/plugins/lisa/hooks/parity-safety-net.sh +21 -1
  47. package/plugins/lisa/skills/lisa-learnings-audit/SKILL.md +42 -6
  48. package/plugins/lisa/skills/lisa-parity-safety-net-rules/SKILL.md +38 -1
  49. package/plugins/lisa/skills/lisa-persist-learning/SKILL.md +7 -2
  50. package/plugins/lisa-agy/hooks/parity-safety-net-heredoc.py +232 -40
  51. package/plugins/lisa-agy/hooks/parity-safety-net.sh +21 -1
  52. package/plugins/lisa-agy/plugin.json +1 -1
  53. package/plugins/lisa-agy/skills/lisa-learnings-audit/SKILL.md +42 -6
  54. package/plugins/lisa-agy/skills/lisa-parity-safety-net-rules/SKILL.md +38 -1
  55. package/plugins/lisa-agy/skills/lisa-persist-learning/SKILL.md +7 -2
  56. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  57. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  58. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  59. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  60. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  61. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  62. package/plugins/lisa-copilot/hooks/parity-safety-net-heredoc.py +232 -40
  63. package/plugins/lisa-copilot/hooks/parity-safety-net.sh +21 -1
  64. package/plugins/lisa-copilot/skills/lisa-learnings-audit/SKILL.md +42 -6
  65. package/plugins/lisa-copilot/skills/lisa-parity-safety-net-rules/SKILL.md +38 -1
  66. package/plugins/lisa-copilot/skills/lisa-persist-learning/SKILL.md +7 -2
  67. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  68. package/plugins/lisa-cursor/hooks/parity-safety-net-heredoc.py +232 -40
  69. package/plugins/lisa-cursor/hooks/parity-safety-net.sh +21 -1
  70. package/plugins/lisa-cursor/skills/lisa-learnings-audit/SKILL.md +42 -6
  71. package/plugins/lisa-cursor/skills/lisa-parity-safety-net-rules/SKILL.md +38 -1
  72. package/plugins/lisa-cursor/skills/lisa-persist-learning/SKILL.md +7 -2
  73. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  74. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  75. package/plugins/lisa-expo-agy/plugin.json +1 -1
  76. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  77. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  78. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  79. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  80. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  81. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  82. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  83. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  84. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  85. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  86. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  87. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  88. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  89. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  90. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  91. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  92. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  93. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  94. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  95. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  96. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  97. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  98. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  99. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  100. package/plugins/lisa-rails-agy/plugin.json +1 -1
  101. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  102. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  103. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  104. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  105. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  106. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  107. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  108. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  109. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  110. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  111. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  112. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  113. package/plugins/src/base/hooks/parity-safety-net-heredoc.py +232 -40
  114. package/plugins/src/base/hooks/parity-safety-net.sh +21 -1
  115. package/plugins/src/base/skills/lisa-learnings-audit/SKILL.md +42 -6
  116. package/plugins/src/base/skills/lisa-parity-safety-net-rules/SKILL.md +38 -1
  117. package/plugins/src/base/skills/lisa-persist-learning/SKILL.md +7 -2
@@ -1 +1 @@
1
- {"version":3,"file":"learnings-document.js","sourceRoot":"","sources":["../../src/core/learnings-document.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EACL,kBAAkB,EAClB,sBAAsB,GAEvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,MAAM,WAAW,GAAG;;gCAEY,kBAAkB,CAAC,OAAO;;CAEzD,CAAC;AACF,MAAM,gBAAgB,GAAG,YAAY,CAAC;AACtC,MAAM,cAAc,GAAG,SAAS,CAAC;AAEjC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,eAAe,GAAG,uCAAuC,CAAC;AAEhE;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GACpC,uDAAuD,CAAC;AAE1D;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAiC;IACnE,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrE,OAAO,GAAG,WAAW,GAAG,gBAAgB,GAAG,KAAK,GAAG,cAAc,EAAE,CAAC;AACtE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAChD,4EAA4E;IAC5E,6EAA6E;IAC7E,4EAA4E;IAC5E,6EAA6E;IAC7E,MAAM,YAAY,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;IACrD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAC1C,CAAC;IACD,IAAI,sBAAsB,CAAC,OAAO,CAAC,GAAG,kBAAkB,CAAC,SAAS,EAAE,CAAC;QACnE,MAAM,IA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AI,KAAK,CAAC,oBAAoB,KAAK,KAAK,MAAM,EAAE,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAS,qBAAqB,CAAC,SAAkB;IAC/C,IAAI,SAAS,KAAK,IAAI,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QACxD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACpE,OAAO,UAAU,KAAK,SAAS;QAC7B,OAAO,IAAI,UAAU;QACrB,OAAO,UAAU,CAAC,KAAK,KAAK,QAAQ;QACpC,CAAC,CAAC,UAAU,CAAC,KAAK;QAClB,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,SAAS,cAAc,CAAC,OAAe;IACrC,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;QACnB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,IAAI,CAAC;QACH,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAY,CAAC,CAAC;IACtE,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC"}
@@ -1,36 +1,3 @@
1
- /**
2
- * Registration contract for the project-learnings union merge driver.
3
- *
4
- * A git merge driver has two halves that live in different places:
5
- *
6
- * 1. **The attribute** (`.gitattributes`) says WHICH driver a path uses. It is
7
- * a committed file, so Lisa ships it to the repository and to every host
8
- * project through the template pipeline.
9
- * 2. **The driver command** (`merge.<name>.driver`) says HOW to run it. Git
10
- * deliberately keeps this in machine-local config and never reads it from
11
- * the repository, because a committed driver command would let a cloned
12
- * repository execute arbitrary code on `git merge`.
13
- *
14
- * So the attribute alone is inert. Until the command is registered, git falls
15
- * back to its built-in text merge — which is exactly today's behavior, so an
16
- * unregistered checkout is degraded, never broken. That fallback is asserted in
17
- * `tests/unit/core/learnings-merge-driver.test.ts`.
18
- *
19
- * Registration is AUTOMATIC, not operator-initiated. `EnsureLearningsMergeDriver`
20
- * runs on every `lisa apply`, and the TypeScript stack's `package.lisa.json`
21
- * wires `lisa apply` into `postinstall` — so an ordinary `npm install` in a host
22
- * project writes `merge.lisa-learnings.driver` into `.git/config` with no
23
- * separate human step, and against Lisa's own repository too.
24
- *
25
- * That is worth stating plainly because of what it implies: the registration
26
- * persists an executable hook in local git config that fires on ordinary git
27
- * operations, outside npm's lifecycle. It is not an escalation over `npm
28
- * install` itself (which already runs arbitrary code), but it does outlive it.
29
- * Hosts that would rather not carry that hook set `learnings.mergeDriver: false`
30
- * in `.lisa.config.json`; `lisa install-merge-driver` remains available to
31
- * register it by hand in a clone that apply has not touched.
32
- * @module core/learnings-merge-driver
33
- */
34
1
  /** Git merge-driver name shared by `.gitattributes` and the local git config. */
35
2
  export declare const LEARNINGS_MERGE_DRIVER_NAME = "lisa-learnings";
36
3
  /** Human-readable driver name recorded alongside the command. */
@@ -76,6 +43,14 @@ export declare function buildLearningsAttributeLine(ledgerPath: string): string;
76
43
  * Wrapped in the same guardrail markers the `.gitignore` template uses, so the
77
44
  * `copy-contents` strategy replaces exactly this block on re-apply and leaves
78
45
  * every host-authored rule outside it untouched.
46
+ *
47
+ * Both halves of the learnings surface are bound. The overflow file
48
+ * (CodySwannGT/lisa#1996) is written by the same concurrent learner passes, on
49
+ * the same per-fingerprint branches, in the same canonical document format — so
50
+ * it has the ledger's exact merge problem and the exact same union-by-id
51
+ * resolution. Binding only the ledger would leave the overflow on git's default
52
+ * text merge, silently re-introducing the corruption this driver exists to
53
+ * remove, on the one file whose whole job is not losing content.
79
54
  * @param ledgerPath - Project-relative learnings file path
80
55
  * @returns Managed block, newline-terminated
81
56
  */
@@ -1 +1 @@
1
- {"version":3,"file":"learnings-merge-driver.d.ts","sourceRoot":"","sources":["../../src/core/learnings-merge-driver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,iFAAiF;AACjF,eAAO,MAAM,2BAA2B,mBAAmB,CAAC;AAE5D,iEAAiE;AACjE,eAAO,MAAM,kCAAkC,wCACR,CAAC;AAExC,wEAAwE;AACxE,eAAO,MAAM,0BAA0B,2BAA2B,CAAC;AAEnE,wEAAwE;AACxE,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,gCAAgC,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED;;;;;;;;GAQG;AACH,wBAAgB,iCAAiC,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAa5E"}
1
+ {"version":3,"file":"learnings-merge-driver.d.ts","sourceRoot":"","sources":["../../src/core/learnings-merge-driver.ts"],"names":[],"mappings":"AAmCA,iFAAiF;AACjF,eAAO,MAAM,2BAA2B,mBAAmB,CAAC;AAE5D,iEAAiE;AACjE,eAAO,MAAM,kCAAkC,wCACR,CAAC;AAExC,wEAAwE;AACxE,eAAO,MAAM,0BAA0B,2BAA2B,CAAC;AAEnE,wEAAwE;AACxE,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,gCAAgC,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iCAAiC,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAmB5E"}
@@ -31,6 +31,7 @@
31
31
  * register it by hand in a clone that apply has not touched.
32
32
  * @module core/learnings-merge-driver
33
33
  */
34
+ import { resolveLearningsOverflowFile } from "./learnings-overflow.js";
34
35
  /** Git merge-driver name shared by `.gitattributes` and the local git config. */
35
36
  export const LEARNINGS_MERGE_DRIVER_NAME = "lisa-learnings";
36
37
  /** Human-readable driver name recorded alongside the command. */
@@ -80,6 +81,14 @@ export function buildLearningsAttributeLine(ledgerPath) {
80
81
  * Wrapped in the same guardrail markers the `.gitignore` template uses, so the
81
82
  * `copy-contents` strategy replaces exactly this block on re-apply and leaves
82
83
  * every host-authored rule outside it untouched.
84
+ *
85
+ * Both halves of the learnings surface are bound. The overflow file
86
+ * (CodySwannGT/lisa#1996) is written by the same concurrent learner passes, on
87
+ * the same per-fingerprint branches, in the same canonical document format — so
88
+ * it has the ledger's exact merge problem and the exact same union-by-id
89
+ * resolution. Binding only the ledger would leave the overflow on git's default
90
+ * text merge, silently re-introducing the corruption this driver exists to
91
+ * remove, on the one file whose whole job is not losing content.
83
92
  * @param ledgerPath - Project-relative learnings file path
84
93
  * @returns Managed block, newline-terminated
85
94
  */
@@ -93,6 +102,12 @@ export function renderLearningsGitattributesBlock(ledgerPath) {
93
102
  "# command is machine-local — run `lisa install-merge-driver` to register it.",
94
103
  buildLearningsAttributeLine(ledgerPath),
95
104
  "",
105
+ "# The overflow buffer holds captures the ledger had no budget for, until",
106
+ "# the gardener drains them. Same writers, same branches, same format — so",
107
+ "# it needs the same union merge, or a merge could destroy the very content",
108
+ "# it exists to preserve.",
109
+ buildLearningsAttributeLine(resolveLearningsOverflowFile(ledgerPath)),
110
+ "",
96
111
  GITATTRIBUTES_END_MARKER,
97
112
  "",
98
113
  ].join("\n");
@@ -1 +1 @@
1
- {"version":3,"file":"learnings-merge-driver.js","sourceRoot":"","sources":["../../src/core/learnings-merge-driver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,iFAAiF;AACjF,MAAM,CAAC,MAAM,2BAA2B,GAA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;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,gCAAgC,CAAC,UAAkB;IACjE,OAAO,GAAG,UAAU,4DAA4D,CAAC;AACnF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,UAAkB;IAC5D,OAAO,GAAG,UAAU,UAAU,2BAA2B,EAAE,CAAC;AAC9D,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,iCAAiC,CAAC,UAAkB;IAClE,OAAO;QACL,0BAA0B;QAC1B,EAAE;QACF,6EAA6E;QAC7E,2EAA2E;QAC3E,0EAA0E;QAC1E,8EAA8E;QAC9E,2BAA2B,CAAC,UAAU,CAAC;QACvC,EAAE;QACF,0EAA0E;QAC1E,2EAA2E;QAC3E,4EAA4E;QAC5E,0BAA0B;QAC1B,2BAA2B,CAAC,4BAA4B,CAAC,UAAU,CAAC,CAAC;QACrE,EAAE;QACF,wBAAwB;QACxB,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
@@ -0,0 +1,76 @@
1
+ import { type LearningEntry } from "./learnings-contract.js";
2
+ import { LearningsBudgetError } from "./learnings-document.js";
3
+ /**
4
+ * Derive the overflow path from a project's configured ledger path.
5
+ *
6
+ * Derived rather than separately configurable so a project that relocates its
7
+ * ledger through `learnings.file` cannot end up with the two halves of one
8
+ * mechanism in different directories — and so there is no second config key to
9
+ * validate, contain, and keep in sync.
10
+ * @param learningsFile - Project-relative ledger path
11
+ * @returns Project-relative overflow path
12
+ */
13
+ export declare function resolveLearningsOverflowFile(learningsFile: string): string;
14
+ /** Entries currently awaiting drain, and where they live. */
15
+ export interface LearningsOverflowContents {
16
+ /** Absolute overflow path, whether or not the file exists yet. */
17
+ readonly file: string;
18
+ /** Validated entries awaiting drain. */
19
+ readonly entries: readonly LearningEntry[];
20
+ }
21
+ /**
22
+ * Read the overflow without modifying it.
23
+ *
24
+ * An absent file is the common, expected case and reads as empty — a project
25
+ * that has never dropped a capture must not have to special-case its absence.
26
+ * @param projectRoot - Absolute path to the host project root
27
+ * @returns Overflow path and the entries awaiting drain
28
+ */
29
+ export declare function readLearningsOverflow(projectRoot: string): Promise<LearningsOverflowContents>;
30
+ /** Outcome of draining entries the gardener has finished with. */
31
+ export interface LearningsOverflowDrain {
32
+ /** Absolute overflow path. */
33
+ readonly file: string;
34
+ /** Ids that were present and have now been removed. */
35
+ readonly drained: readonly string[];
36
+ /** Requested ids that were not in the overflow — reported, never fatal. */
37
+ readonly absent: readonly string[];
38
+ /** How many entries still await drain. */
39
+ readonly remaining: number;
40
+ }
41
+ /**
42
+ * Remove entries the gardener has durably captured elsewhere.
43
+ *
44
+ * Drain is BY ID and never "empty the file", because the gardener's real
45
+ * sequence is read → file a ticket per entry → drain. Clearing everything up
46
+ * front would lose any entry whose ticket failed to file; removing only the ids
47
+ * that already have a durable home makes a partial run safely resumable.
48
+ *
49
+ * An unknown id is reported rather than thrown, for the same reason an absent
50
+ * supersede target is tolerated: on a re-run, an id another pass already drained
51
+ * is indistinguishable from a bogus one, and failing the drain would strand
52
+ * every other entry in the batch.
53
+ * @param projectRoot - Absolute path to the host project root
54
+ * @param ids - Entry ids to remove
55
+ * @returns Which ids were drained, which were absent, and what remains
56
+ */
57
+ export declare function drainLearningsOverflow(projectRoot: string, ids: readonly string[]): Promise<LearningsOverflowDrain>;
58
+ /**
59
+ * Preserve a capture the ledger had no budget for, then re-raise the breach.
60
+ *
61
+ * Never returns normally: the capture genuinely did not land in the ledger, and
62
+ * a caller that treated preservation as success would report a learning as
63
+ * persisted when the projection will never serve it. The re-raised error names
64
+ * the overflow file so the drop is actionable rather than merely fatal.
65
+ *
66
+ * If the overflow is itself full, the original ledger breach is re-raised with
67
+ * both surfaces named. Nothing is evicted to make room — silently discarding an
68
+ * older dropped learning to store a newer one is the exact data loss this whole
69
+ * mechanism exists to prevent.
70
+ * @param projectRoot - Absolute path to the host project root
71
+ * @param entry - The validated entry the ledger rejected
72
+ * @param breach - The budget breach the ledger write raised
73
+ * @returns Never — always throws
74
+ */
75
+ export declare function preserveDroppedLearning(projectRoot: string, entry: LearningEntry, breach: LearningsBudgetError): Promise<never>;
76
+ //# sourceMappingURL=learnings-overflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"learnings-overflow.d.ts","sourceRoot":"","sources":["../../src/core/learnings-overflow.ts"],"names":[],"mappings":"AAkDA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EACL,oBAAoB,EAIrB,MAAM,yBAAyB,CAAC;AAejC;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAI1E;AAmCD,6DAA6D;AAC7D,MAAM,WAAW,yBAAyB;IACxC,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,wCAAwC;IACxC,QAAQ,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,CAAC;CAC5C;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,yBAAyB,CAAC,CAGpC;AAED,kEAAkE;AAClE,MAAM,WAAW,sBAAsB;IACrC,8BAA8B;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,0CAA0C;IAC1C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,sBAAsB,CAC1C,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,SAAS,MAAM,EAAE,GACrB,OAAO,CAAC,sBAAsB,CAAC,CAwBjC;AAqBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,KAAK,CAAC,CAyBhB"}
@@ -0,0 +1,212 @@
1
+ /**
2
+ * Durable holding area for learnings the ledger had no budget to accept.
3
+ *
4
+ * ## Why this exists
5
+ *
6
+ * When a judged-durable capture cannot fit the ledger's hard caps, the writer
7
+ * drops it. Before this module the dropped CONTENT survived only in the capture
8
+ * report's text, so once that scrolled away a genuinely valuable learning was
9
+ * gone and the gardener had nothing to drain (CodySwannGT/lisa#1996).
10
+ * CodySwannGT/lisa#1959 raised the byte budget and added the
11
+ * `[lisa-ledger-saturated]` tracker signal — the signal says "saturated"; this
12
+ * file says "and here is exactly what was dropped".
13
+ *
14
+ * ## Why it is git-tracked, in the ledger's own format
15
+ *
16
+ * A learner pass runs on its own `learning/<fingerprint>` branch in its own
17
+ * worktree, and those worktrees are disposable. An untracked, machine-local
18
+ * overflow would be deleted by ordinary worktree cleanup before any gardener
19
+ * saw it — durable in name only, and invisible to a gardener running anywhere
20
+ * else. So the overflow ships to `main` on the same pull request as the capture
21
+ * that produced it.
22
+ *
23
+ * Being tracked means it has the very concurrent-writer problem the ledger just
24
+ * had (CodySwannGT/lisa#1995), which is exactly why it reuses the ledger's
25
+ * canonical document format verbatim: one `.gitattributes` line binds it to the
26
+ * SAME union-by-id merge driver, `parseLearningsFile` gives it the SAME
27
+ * conflict-marker guard, and `checkLearningsBudget` can gate it in CI unchanged.
28
+ * A bespoke format would have needed all of that written a second time.
29
+ *
30
+ * ## Why it carries the same budget
31
+ *
32
+ * The overflow is a hand-off buffer the gardener drains, not an archive. Letting
33
+ * it grow without bound would relocate the very context-bloat problem the
34
+ * contract exists to prevent, and a repository file that only ever grows is its
35
+ * own incident. So it is capped exactly like the ledger, nothing is ever
36
+ * silently evicted from it, and an overflow that is itself full surfaces as a
37
+ * loud failure naming both surfaces.
38
+ *
39
+ * ## Lock discipline
40
+ *
41
+ * The ledger lock and the overflow lock are NEVER held at the same time. The
42
+ * writer's ledger transaction fails and fully releases its lock before
43
+ * {@link preserveDroppedLearning} takes the overflow lock, so the two paths are
44
+ * strictly sequential and the pair cannot deadlock regardless of acquisition
45
+ * order between processes.
46
+ * @module core/learnings-overflow
47
+ */
48
+ import * as fse from "fs-extra";
49
+ import * as path from "node:path";
50
+ import { writeFileAtomically } from "../utils/atomic-file-write.js";
51
+ import { LearningsBudgetError, assertDocumentBudget, parseLearningsFile, renderLearningsFile, } from "./learnings-document.js";
52
+ import { assertSafeLearningParents, readExistingLearnings, resolveSafeLearningTarget, } from "./learnings-file-safety.js";
53
+ import { withFileTargetLock } from "./learnings-lock.js";
54
+ import { readProjectConfig, resolveProjectLearningsFile, } from "./project-config.js";
55
+ /** Suffix distinguishing the overflow from the ledger it belongs to. */
56
+ const OVERFLOW_SUFFIX = ".overflow";
57
+ /**
58
+ * Derive the overflow path from a project's configured ledger path.
59
+ *
60
+ * Derived rather than separately configurable so a project that relocates its
61
+ * ledger through `learnings.file` cannot end up with the two halves of one
62
+ * mechanism in different directories — and so there is no second config key to
63
+ * validate, contain, and keep in sync.
64
+ * @param learningsFile - Project-relative ledger path
65
+ * @returns Project-relative overflow path
66
+ */
67
+ export function resolveLearningsOverflowFile(learningsFile) {
68
+ const extension = path.posix.extname(learningsFile);
69
+ const base = learningsFile.slice(0, learningsFile.length - extension.length);
70
+ return `${base}${OVERFLOW_SUFFIX}${extension}`;
71
+ }
72
+ /**
73
+ * Resolve and contain the overflow target for one project.
74
+ * @param projectRoot - Absolute path to the host project root
75
+ * @returns Resolved project root and absolute overflow path
76
+ */
77
+ async function resolveOverflowTarget(projectRoot) {
78
+ const config = await readProjectConfig(projectRoot);
79
+ const relative = resolveLearningsOverflowFile(resolveProjectLearningsFile(config));
80
+ return resolveSafeLearningTarget(projectRoot, relative);
81
+ }
82
+ /**
83
+ * Read the entries currently held in the overflow.
84
+ * @param target - Absolute overflow path
85
+ * @returns Validated entries, empty when the file does not exist
86
+ */
87
+ async function readOverflowEntries(target) {
88
+ const existing = await readExistingLearnings(target);
89
+ return existing === undefined ? [] : parseLearningsFile(existing);
90
+ }
91
+ /**
92
+ * Read the overflow without modifying it.
93
+ *
94
+ * An absent file is the common, expected case and reads as empty — a project
95
+ * that has never dropped a capture must not have to special-case its absence.
96
+ * @param projectRoot - Absolute path to the host project root
97
+ * @returns Overflow path and the entries awaiting drain
98
+ */
99
+ export async function readLearningsOverflow(projectRoot) {
100
+ const { target } = await resolveOverflowTarget(projectRoot);
101
+ return { file: target, entries: await readOverflowEntries(target) };
102
+ }
103
+ /**
104
+ * Remove entries the gardener has durably captured elsewhere.
105
+ *
106
+ * Drain is BY ID and never "empty the file", because the gardener's real
107
+ * sequence is read → file a ticket per entry → drain. Clearing everything up
108
+ * front would lose any entry whose ticket failed to file; removing only the ids
109
+ * that already have a durable home makes a partial run safely resumable.
110
+ *
111
+ * An unknown id is reported rather than thrown, for the same reason an absent
112
+ * supersede target is tolerated: on a re-run, an id another pass already drained
113
+ * is indistinguishable from a bogus one, and failing the drain would strand
114
+ * every other entry in the batch.
115
+ * @param projectRoot - Absolute path to the host project root
116
+ * @param ids - Entry ids to remove
117
+ * @returns Which ids were drained, which were absent, and what remains
118
+ */
119
+ export async function drainLearningsOverflow(projectRoot, ids) {
120
+ const requested = new Set(validateOverflowIds(ids));
121
+ const { root, target } = await resolveOverflowTarget(projectRoot);
122
+ await assertSafeLearningParents(root, path.dirname(target));
123
+ return withFileTargetLock(target, async () => {
124
+ // The pre-lock check can go stale while waiting on the lock, so the
125
+ // containment guarantee has to be re-established once the read is
126
+ // actually about to happen. Same discipline as the ledger writer.
127
+ await assertSafeLearningParents(root, path.dirname(target));
128
+ const entries = await readOverflowEntries(target);
129
+ const drained = entries
130
+ .filter(entry => requested.has(entry.id))
131
+ .map(entry => entry.id);
132
+ const retained = entries.filter(entry => !requested.has(entry.id));
133
+ if (drained.length > 0) {
134
+ await publishOverflow(root, target, retained);
135
+ }
136
+ return {
137
+ file: target,
138
+ drained,
139
+ absent: [...requested].filter(id => !drained.includes(id)),
140
+ remaining: retained.length,
141
+ };
142
+ });
143
+ }
144
+ /**
145
+ * Render, budget-check, and atomically publish the overflow document.
146
+ * @param root - Resolved project root
147
+ * @param target - Absolute overflow path
148
+ * @param entries - Entries the overflow should now hold
149
+ */
150
+ async function publishOverflow(root, target, entries) {
151
+ const rendered = renderLearningsFile(entries);
152
+ assertDocumentBudget(rendered, entries.length, "Learnings overflow");
153
+ await fse.ensureDir(path.dirname(target));
154
+ await writeFileAtomically(target, rendered, {
155
+ beforeRename: () => assertSafeLearningParents(root, path.dirname(target)),
156
+ });
157
+ }
158
+ /**
159
+ * Preserve a capture the ledger had no budget for, then re-raise the breach.
160
+ *
161
+ * Never returns normally: the capture genuinely did not land in the ledger, and
162
+ * a caller that treated preservation as success would report a learning as
163
+ * persisted when the projection will never serve it. The re-raised error names
164
+ * the overflow file so the drop is actionable rather than merely fatal.
165
+ *
166
+ * If the overflow is itself full, the original ledger breach is re-raised with
167
+ * both surfaces named. Nothing is evicted to make room — silently discarding an
168
+ * older dropped learning to store a newer one is the exact data loss this whole
169
+ * mechanism exists to prevent.
170
+ * @param projectRoot - Absolute path to the host project root
171
+ * @param entry - The validated entry the ledger rejected
172
+ * @param breach - The budget breach the ledger write raised
173
+ * @returns Never — always throws
174
+ */
175
+ export async function preserveDroppedLearning(projectRoot, entry, breach) {
176
+ const { root, target } = await resolveOverflowTarget(projectRoot);
177
+ await assertSafeLearningParents(root, path.dirname(target));
178
+ const preserved = await withFileTargetLock(target, async () => {
179
+ // Re-establish containment after the lock wait; see drainLearningsOverflow.
180
+ await assertSafeLearningParents(root, path.dirname(target));
181
+ const entries = await readOverflowEntries(target);
182
+ if (entries.some(current => current.id === entry.id)) {
183
+ return true;
184
+ }
185
+ try {
186
+ await publishOverflow(root, target, [...entries, entry]);
187
+ return true;
188
+ }
189
+ catch (error) {
190
+ if (error instanceof LearningsBudgetError) {
191
+ return false;
192
+ }
193
+ throw error;
194
+ }
195
+ });
196
+ throw new LearningsBudgetError(preserved
197
+ ? `${breach.message} — the capture was preserved in ${target}; drain it with \`lisa learnings-overflow\` (the gardener does this automatically)`
198
+ : `${breach.message} — the overflow at ${target} is full too, so the capture could not be preserved; drain the overflow, then promote or retire a learning`);
199
+ }
200
+ /**
201
+ * Reject malformed drain directives before any filesystem work.
202
+ * @param ids - Caller-supplied (possibly untrusted) entry ids
203
+ * @returns Deduplicated list of validated ids
204
+ */
205
+ function validateOverflowIds(ids) {
206
+ if (!Array.isArray(ids) ||
207
+ ids.some(id => typeof id !== "string" || id.trim() === "")) {
208
+ throw new Error("Invalid overflow drain ids: expected non-empty learning id strings");
209
+ }
210
+ return [...new Set(ids)];
211
+ }
212
+ //# sourceMappingURL=learnings-overflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"learnings-overflow.js","sourceRoot":"","sources":["../../src/core/learnings-overflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEpE,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EACL,iBAAiB,EACjB,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAE7B,wEAAwE;AACxE,MAAM,eAAe,GAAG,WAAW,CAAC;AAEpC;;;;;;;;;GASG;AACH,MAAM,UAAU,4BAA4B,CAAC,aAAqB;IAChE,MAAM,SAAS,GA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AI,KAAK,YAAY,oBAAoB,EAAE,CAAC;gBAC1C,OAAO,KAAK,CAAC;YACf,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAC,CAAC;IACH,MAAM,IAAI,oBAAoB,CAC5B,SAAS;QACP,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,mCAAmC,MAAM,oFAAoF;QAChJ,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,sBAAsB,MAAM,4GAA4G,CAC9J,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,mBAAmB,CAAC,GAAsB;IACjD,IACE,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QACnB,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAC1D,CAAC;QACD,MAAM,IAAI,KAAK,CACb,oEAAoE,CACrE,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAC3B,CAAC"}
@@ -8,6 +8,12 @@ export interface ConsolidatedLearningOptions {
8
8
  * succeeds; this is a diagnostic, not a failure hook.
9
9
  */
10
10
  readonly onAbsentSupersede?: (ids: readonly string[]) => void;
11
+ /**
12
+ * Called when a `supersedes:` alias reference did not fit inside the entry's
13
+ * provenance cap and was dropped. A reference that is about to stop resolving
14
+ * must never disappear silently; the write still succeeds.
15
+ */
16
+ readonly onAliasesDropped?: (references: readonly string[]) => void;
11
17
  }
12
18
  /**
13
19
  * Persist one already-selected learning without generating or truncating it.
@@ -1 +1 @@
1
- {"version":3,"file":"learnings-writer.d.ts","sourceRoot":"","sources":["../../src/core/learnings-writer.ts"],"names":[],"mappings":"AAsBA,gFAAgF;AAChF,MAAM,WAAW,2BAA2B;IAC1C,gEAAgE;IAChE,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,E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2
2
  import * as fse from "fs-extra";
3
3
  import * as path from "node:path";
4
4
  import { writeFileAtomically } from "../utils/atomic-file-write.js";
5
- import { assertDocumentBudget, parseLearningsFile, renderLearningsFile, } from "./learnings-document.js";
5
+ import { applySupersedeAliases, findCallerMintedAliasError, } from "./learnings-alias.js";
6
+ import { LearningsBudgetError, assertDocumentBudget, parseLearningsFile, renderLearningsFile, } from "./learnings-document.js";
6
7
  import { requireIsoDate, validateLearningEntry } from "./learnings-entry.js";
7
8
  import { assertSafeLearningParents, readExistingLearnings, resolveSafeLearningTarget, } from "./learnings-file-safety.js";
8
9
  import { withLearningTargetLock } from "./learnings-lock.js";
10
+ import { preserveDroppedLearning } from "./learnings-overflow.js";
9
11
  import { readProjectConfig, resolveProjectLearningsFile, } from "./project-config.js";
10
12
  /**
11
13
  * Persist one already-selected learning without generating or truncating it.
@@ -34,6 +36,10 @@ export async function persistLearningEntry(projectRoot, candidate) {
34
36
  */
35
37
  export async function persistConsolidatedLearning(projectRoot, candidate, options = {}) {
36
38
  const entry = validateLearningEntry(candidate);
39
+ const mintedAlias = findCallerMintedAliasError(entry);
40
+ if (mintedAlias !== undefined) {
41
+ throw mintedAlias;
42
+ }
37
43
  const supersede = validateSupersedeIds(options.supersede);
38
44
  const config = await readProjectConfig(projectRoot);
39
45
  const relativeFile = resolveProjectLearningsFile(config);
@@ -42,32 +48,75 @@ export async function persistConsolidatedLearning(projectRoot, candidate, option
42
48
  buildNextDocument([], entry, []);
43
49
  await assertSafeLearningParents(root, path.dirname(target));
44
50
  await fse.ensureDir(path.dirname(target));
45
- return writeLearningEntriesWithLock(root, target, entry, supersede, options.onAbsentSupersede);
51
+ try {
52
+ return await writeLearningEntriesWithLock({ root, target }, entry, supersede, options);
53
+ }
54
+ catch (error) {
55
+ if (!(error instanceof LearningsBudgetError)) {
56
+ throw error;
57
+ }
58
+ // The ledger lock is fully released by now — `withLearningTargetLock`
59
+ // releases in a `finally` — so the overflow lock below is taken with no
60
+ // other learnings lock held. The two are never nested.
61
+ return preserveDroppedLearning(projectRoot, entry, error);
62
+ }
46
63
  }
47
64
  /**
48
65
  * Perform the locked read-validate-write transaction for a learnings update.
49
- * @param root - Resolved project root
50
- * @param target - Absolute learnings file path
66
+ * @param location - Resolved project root and absolute learnings file path
67
+ * @param location.root - Resolved project root
68
+ * @param location.target - Absolute learnings file path
51
69
  * @param entry - New validated entry
52
70
  * @param supersede - Ids of existing entries the new entry replaces
53
- * @param onAbsentSupersede - Diagnostic sink for already-consolidated targets
71
+ * @param options - Caller diagnostics for absent targets and dropped aliases
54
72
  * @returns Absolute path to the persisted learnings file
55
73
  */
56
- function writeLearningEntriesWithLock(root, target, entry, supersede, onAbsentSupersede) {
74
+ function writeLearningEntriesWithLock({ root, target }, entry, supersede, options) {
57
75
  return withLearningTargetLock(target, async () => {
58
76
  await assertSafeLearningParents(root, path.dirname(target));
59
77
  const existing = await readExistingLearnings(target);
60
78
  const entries = existing === undefined ? [] : parseLearningsFile(existing);
61
79
  const absent = supersede.filter(id => !entries.some(current => current.id === id));
62
80
  if (absent.length > 0)
63
- onAbsentSupersede?.(absent);
64
- const rendered = buildNextDocument(entries, entry, supersede);
81
+ options.onAbsentSupersede?.(absent);
82
+ const aliased = aliasSupersededEntries(entries, entry, supersede, options);
83
+ const rendered = buildNextDocument(entries, aliased, supersede);
65
84
  await writeFileAtomically(target, rendered, {
66
85
  beforeRename: () => assertSafeLearningParents(root, path.dirname(target)),
67
86
  });
68
87
  return target;
69
88
  });
70
89
  }
90
+ /**
91
+ * Record, in the new entry's provenance, which entries this write replaced.
92
+ *
93
+ * Only targets that are genuinely PRESENT contribute an alias. A supersede
94
+ * naming an already-consolidated id removed nothing, so claiming its reference
95
+ * would hijack a pointer the earlier writer legitimately owns — see
96
+ * `learnings-alias.ts` for why that distinction is what keeps the #1995
97
+ * losing-writer guarantee intact.
98
+ *
99
+ * The rewritten entry is pushed back through `validateLearningEntry` rather than
100
+ * spread-and-trusted, so the added references are held to the same schema as any
101
+ * caller-supplied one and the persisted object stays a frozen, exactly-seven-field
102
+ * entry.
103
+ * @param entries - Entries currently in the document
104
+ * @param entry - New validated entry as the caller composed it
105
+ * @param supersede - Validated supersede ids
106
+ * @param options - Caller diagnostics
107
+ * @returns The entry to persist, carrying its supersede aliases
108
+ */
109
+ function aliasSupersededEntries(entries, entry, supersede, options) {
110
+ const superseded = new Set(supersede);
111
+ const removed = entries.filter(current => superseded.has(current.id));
112
+ if (removed.length === 0) {
113
+ return entry;
114
+ }
115
+ const aliased = applySupersedeAliases(entry, removed);
116
+ if (aliased.dropped.length > 0)
117
+ options.onAliasesDropped?.(aliased.dropped);
118
+ return validateLearningEntry({ ...entry, provenance: aliased.provenance });
119
+ }
71
120
  /**
72
121
  * Surgically advance ONLY one entry's `last_confirmed` timestamp — the
73
122
  * claim-time "this rule demonstrably applied" confirmation (#1579). Uses the
@@ -1 +1 @@
1
- {"version":3,"file":"learnings-writer.js","sourceRoot":"","sources":["../../src/core/learnings-writer.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEpE,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EACL,iBAAiB,EACjB,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAc7B;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,WAAmB,EACnB,SAAkB;IAElB,OAAO,2BA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C,CAAC"}
@@ -1,4 +1,6 @@
1
+ export * from "./learnings-alias.js";
1
2
  export * from "./learnings-contract.js";
3
+ export * from "./learnings-overflow.js";
2
4
  export * from "./learnings-projection.js";
3
5
  export * from "./learnings-writer.js";
4
6
  export * from "./upstream-attribution-body.js";
@@ -1 +1 @@
1
- {"version":3,"file":"learnings.d.ts","sourceRoot":"","sources":["../../src/core/learnings.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,OAAO,EACL,8BAA8B,EAC9B,0BAA0B,EAC1B,0BAA0B,EAC1B,iBAAiB,EACjB,iCAAiC,EACjC,2BAA2B,EAC3B,uBAAuB,EACvB,KAAK,eAAe,EACpB,KAAK,aAAa,GACnB,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"learnings.d.ts","sourceRoot":"","sources":["../../src/core/learnings.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,OAAO,EACL,8BAA8B,EAC9B,0BAA0B,EAC1B,0BAA0B,EAC1B,iBAAiB,EACjB,iCAAiC,EACjC,2BAA2B,EAC3B,uBAAuB,EACvB,KAAK,eAAe,EACpB,KAAK,aAAa,GACnB,MAAM,qBAAqB,CAAC"}
@@ -1,4 +1,6 @@
1
+ export * from "./learnings-alias.js";
1
2
  export * from "./learnings-contract.js";
3
+ export * from "./learnings-overflow.js";
2
4
  export * from "./learnings-projection.js";
3
5
  export * from "./learnings-writer.js";
4
6
  export * from "./upstream-attribution-body.js";
@@ -1 +1 @@
1
- {"version":3,"file":"learnings.js","sourceRoot":"","sources":["../../src/core/learnings.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,OAAO,EACL,8BAA8B,EAC9B,0BAA0B,EAC1B,0BAA0B,EAC1B,iBAAiB,EACjB,iCAAiC,EACjC,2BAA2B,EAC3B,uBAAuB,GAGxB,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"learnings.js","sourceRoot":"","sources":["../../src/core/learnings.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,OAAO,EACL,8BAA8B,EAC9B,0BAA0B,EAC1B,0BAA0B,EAC1B,iBAAiB,EACjB,iCAAiC,EACjC,2BAA2B,EAC3B,uBAAuB,GAGxB,MAAM,qBAAqB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"upstream-evidence-manifest.d.ts","sourceRoot":"","sources":["../../src/core/upstream-evidence-manifest.ts"],"names":[],"mappings":"AACA,iFAAiF;AACjF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAkiEpE,CAAC;AAEL,4EAA4E;AAC5E,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAiyMjE,CAAC;AAEL,sFAAsF;AACtF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAk6I/D,CAAC"}
1
+ {"version":3,"file":"upstream-evidence-manifest.d.ts","sourceRoot":"","sources":["../../src/core/upstream-evidence-manifest.ts"],"names":[],"mappings":"AACA,iFAAiF;AACjF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAkiEpE,CAAC;AAEL,4EAA4E;AAC5E,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CA0yMjE,CAAC;AAEL,sFAAsF;AACtF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAk6I/D,CAAC"}