@codyswann/lisa 4.84.7 → 4.84.8

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 (150) hide show
  1. package/all/copy-overwrite/scripts/lib/completion-authorization.mjs +282 -0
  2. package/all/copy-overwrite/scripts/lib/completion-proof-adapters.mjs +213 -0
  3. package/all/copy-overwrite/scripts/lib/completion-proof-conformance.mjs +115 -0
  4. package/all/copy-overwrite/scripts/lib/completion-proof-content.mjs +408 -0
  5. package/all/copy-overwrite/scripts/lib/completion-proof-errors.mjs +16 -0
  6. package/all/copy-overwrite/scripts/lib/completion-proof-github.mjs +233 -0
  7. package/all/copy-overwrite/scripts/lib/completion-proof-markdown.mjs +70 -0
  8. package/all/copy-overwrite/scripts/lib/completion-proof-projection.mjs +169 -0
  9. package/all/copy-overwrite/scripts/lib/completion-proof-publisher.mjs +238 -0
  10. package/all/copy-overwrite/scripts/lib/completion-proof-reader.mjs +175 -0
  11. package/all/copy-overwrite/scripts/lib/completion-proof-shape.mjs +374 -0
  12. package/all/copy-overwrite/scripts/lib/completion-proof-source.mjs +174 -0
  13. package/all/copy-overwrite/scripts/lib/history-secret-scanner.mjs +20 -5
  14. package/all/copy-overwrite/scripts/lib/npm-update-helper-inventory.mjs +15 -0
  15. package/all/copy-overwrite/scripts/lib/usage-effectiveness.d.mts +27 -0
  16. package/all/copy-overwrite/scripts/lib/usage-effectiveness.mjs +156 -0
  17. package/all/copy-overwrite/scripts/lib/usage-ledger-integrity.d.mts +8 -0
  18. package/all/copy-overwrite/scripts/lib/usage-ledger-integrity.mjs +141 -0
  19. package/all/copy-overwrite/scripts/lib/usage-ledger.d.mts +89 -0
  20. package/all/copy-overwrite/scripts/lib/usage-ledger.mjs +206 -0
  21. package/all/copy-overwrite/scripts/lisa-hooks/parity-safety-net.sh +3 -1
  22. package/all/copy-overwrite/scripts/lisa-work-item.mjs +255 -39
  23. package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +141 -3
  24. package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
  25. package/dist/core/lisa-owned-hash-ledger.js +186 -0
  26. package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
  27. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  28. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  29. package/dist/core/upstream-evidence-manifest.js +101 -12
  30. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  31. package/dist/opencode/plugin-templates/parity-safety-net.sh +3 -1
  32. package/dist/utils/effectiveness.d.ts +4 -41
  33. package/dist/utils/effectiveness.d.ts.map +1 -1
  34. package/dist/utils/effectiveness.js +2 -126
  35. package/dist/utils/effectiveness.js.map +1 -1
  36. package/dist/utils/usage-accounting.d.ts +5 -100
  37. package/dist/utils/usage-accounting.d.ts.map +1 -1
  38. package/dist/utils/usage-accounting.js +4 -287
  39. package/dist/utils/usage-accounting.js.map +1 -1
  40. package/package.json +4 -4
  41. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  42. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  43. package/plugins/lisa/.codex-plugin/skills/lisa-drive-pr-to-merge/SKILL.md +15 -1
  44. package/plugins/lisa/.codex-plugin/skills/lisa-tracker-evidence/SKILL.md +7 -1
  45. package/plugins/lisa/.codex-plugin/skills/lisa-tracker-evidence/references/completion-authorization.md +193 -0
  46. package/plugins/lisa/hooks/parity-safety-net.sh +3 -1
  47. package/plugins/lisa/rules/eager/00-rule-index.md +1 -0
  48. package/plugins/lisa/rules/reference/completion-authorization.md +10 -0
  49. package/plugins/lisa/skills/lisa-drive-pr-to-merge/SKILL.md +15 -1
  50. package/plugins/lisa/skills/lisa-tracker-evidence/SKILL.md +7 -1
  51. package/plugins/lisa/skills/lisa-tracker-evidence/references/completion-authorization.md +193 -0
  52. package/plugins/lisa-agy/hooks/parity-safety-net.sh +3 -1
  53. package/plugins/lisa-agy/plugin.json +1 -1
  54. package/plugins/lisa-agy/skills/lisa-drive-pr-to-merge/SKILL.md +15 -1
  55. package/plugins/lisa-agy/skills/lisa-tracker-evidence/SKILL.md +7 -1
  56. package/plugins/lisa-agy/skills/lisa-tracker-evidence/references/completion-authorization.md +193 -0
  57. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  58. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  59. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  60. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  61. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  62. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  63. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  64. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  65. package/plugins/lisa-copilot/hooks/parity-safety-net.sh +3 -1
  66. package/plugins/lisa-copilot/rules/eager/00-rule-index.md +1 -0
  67. package/plugins/lisa-copilot/rules/reference/completion-authorization.md +10 -0
  68. package/plugins/lisa-copilot/skills/lisa-drive-pr-to-merge/SKILL.md +15 -1
  69. package/plugins/lisa-copilot/skills/lisa-tracker-evidence/SKILL.md +7 -1
  70. package/plugins/lisa-copilot/skills/lisa-tracker-evidence/references/completion-authorization.md +193 -0
  71. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  72. package/plugins/lisa-cursor/hooks/parity-safety-net.sh +3 -1
  73. package/plugins/lisa-cursor/rules/00-rule-index.mdc +1 -0
  74. package/plugins/lisa-cursor/rules/completion-authorization-reference.mdc +15 -0
  75. package/plugins/lisa-cursor/skills/lisa-drive-pr-to-merge/SKILL.md +15 -1
  76. package/plugins/lisa-cursor/skills/lisa-tracker-evidence/SKILL.md +7 -1
  77. package/plugins/lisa-cursor/skills/lisa-tracker-evidence/references/completion-authorization.md +193 -0
  78. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  79. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  80. package/plugins/lisa-devin/hooks/parity-safety-net.sh +3 -1
  81. package/plugins/lisa-devin/rules/eager/00-rule-index.md +1 -0
  82. package/plugins/lisa-devin/rules/reference/completion-authorization.md +10 -0
  83. package/plugins/lisa-devin/skills/lisa-drive-pr-to-merge/SKILL.md +15 -1
  84. package/plugins/lisa-devin/skills/lisa-tracker-evidence/SKILL.md +7 -1
  85. package/plugins/lisa-devin/skills/lisa-tracker-evidence/references/completion-authorization.md +193 -0
  86. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  87. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  88. package/plugins/lisa-expo-agy/plugin.json +1 -1
  89. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  90. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  91. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  92. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  93. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  94. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  95. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  96. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  97. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  98. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  99. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  100. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  101. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  102. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  103. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  104. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  105. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  106. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  107. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  108. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  109. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  110. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  111. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  112. package/plugins/lisa-openclaw-devin/.claude-plugin/plugin.json +1 -1
  113. package/plugins/lisa-openclaw-devin/.devin-plugin/plugin.json +1 -1
  114. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  115. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  116. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  117. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  118. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  119. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  120. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  121. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  122. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  123. package/plugins/lisa-rails-agy/plugin.json +1 -1
  124. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  125. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  126. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  127. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  128. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  129. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  130. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  131. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  132. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  133. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  134. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  135. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  136. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  137. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  138. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  139. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  140. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  141. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  142. package/plugins/src/base/hooks/parity-safety-net.sh +3 -1
  143. package/plugins/src/base/rules/eager/00-rule-index.md +1 -0
  144. package/plugins/src/base/rules/reference/completion-authorization.md +10 -0
  145. package/plugins/src/base/skills/lisa-drive-pr-to-merge/SKILL.md +15 -1
  146. package/plugins/src/base/skills/lisa-tracker-evidence/SKILL.md +7 -1
  147. package/plugins/src/base/skills/lisa-tracker-evidence/references/completion-authorization.md +193 -0
  148. package/scripts/two-channel-couplings.json +2 -2
  149. package/typescript/copy-overwrite/.prettierignore +15 -0
  150. package/typescript/copy-overwrite/scripts/check-skipped-required-checks.mjs +32 -0
@@ -3475,8 +3475,10 @@ if [ -f "$rules_file" ]; then
3475
3475
  # here — before the remaining rules ran, and with an exit status that is
3476
3476
  # not a refusal. The `||` puts the pipeline in a condition context, where
3477
3477
  # a non-zero status is expected rather than fatal.
3478
+ # Consume the whole input: grep -q can close an early match while printf
3479
+ # is still writing, making pipefail report SIGPIPE instead of the match.
3478
3480
  rule_status=0
3479
- printf '%s' "$custom_command_str" | grep -Eiq -- "$rule" || rule_status=$?
3481
+ printf '%s' "$custom_command_str" | grep -Ei -- "$rule" >/dev/null || rule_status=$?
3480
3482
  case "$rule_status" in
3481
3483
  0) block "matched a project custom safety rule (${rules_file##*/}): $rule" ;;
3482
3484
  1) ;; # no match
@@ -1,44 +1,13 @@
1
- /** Four independent clocks and their provenance for one usage row. */
2
- export interface EffectivenessObservation {
3
- readonly schema: 1;
4
- readonly lisaVersion: string | null;
5
- readonly workerConfigRevision: string | null;
6
- readonly workerWallMs: number | null;
7
- readonly feedbackMs: readonly number[] | null;
8
- readonly workerSource: string | null;
9
- readonly attention: readonly {
10
- readonly id: string;
11
- readonly source: string;
12
- }[] | null;
13
- readonly readyAt: string | null;
14
- readonly acceptedAt: string | null;
15
- readonly lifecycleSources: readonly string[] | null;
16
- readonly reworkSources: readonly string[] | null;
17
- }
1
+ import { isEvidenceString, isEvidenceTime, parseEffectiveness, parseEffectivenessTokens } from "../../all/copy-overwrite/scripts/lib/usage-effectiveness.mjs";
2
+ import type { EffectivenessObservation } from "../../all/copy-overwrite/scripts/lib/usage-effectiveness.mjs";
3
+ export { isEvidenceString, isEvidenceTime, parseEffectiveness, parseEffectivenessTokens, };
4
+ export type { EffectivenessObservation };
18
5
  /**
19
6
  * Normalize and hash exactly as the gardener does, independent of ledger entry versions.
20
7
  * @param invariant - Rule whose recurrence is being measured
21
8
  * @returns Twelve-character SHA-256 prefix
22
9
  */
23
10
  export declare function invariantFingerprint(invariant: string): string;
24
- /**
25
- * Require a nonempty evidence identifier.
26
- * @param value - Untrusted field
27
- * @returns Whether this is a nonempty string
28
- */
29
- export declare function isEvidenceString(value: unknown): value is string;
30
- /**
31
- * Require an unambiguous UTC instant rather than a locale-dependent date.
32
- * @param value - Untrusted timestamp
33
- * @returns Whether this is a canonical UTC instant
34
- */
35
- export declare function isEvidenceTime(value: unknown): value is string;
36
- /**
37
- * Parse additive observation data, refusing malformed measurements rather than guessing.
38
- * @param value - JSON-compatible input
39
- * @returns Validated observation
40
- */
41
- export declare function parseEffectiveness(value: unknown): EffectivenessObservation;
42
11
  /**
43
12
  * Summarize a run without combining distinct clocks or extrapolating missing evidence.
44
13
  * @param observation - Validated run observations
@@ -63,10 +32,4 @@ export declare function summarizeEffectiveness(observation: EffectivenessObserva
63
32
  * @returns Extension token or empty text for legacy entries
64
33
  */
65
34
  export declare function renderEffectivenessToken(entryId: string, observation?: EffectivenessObservation): string;
66
- /**
67
- * Read correlated extensions and reject ambiguous repeated values.
68
- * @param section - Managed usage markdown
69
- * @returns Observation keyed by usage entry identity
70
- */
71
- export declare function parseEffectivenessTokens(section: string): ReadonlyMap<string, EffectivenessObservation>;
72
35
  //# sourceMappingURL=effectiveness.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"effectiveness.d.ts","sourceRoot":"","sources":["../../src/utils/effectiveness.ts"],"names":[],"mappings":"AAGA,sEAAsE;AACtE,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACnB,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7C,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;IAC9C,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,SAAS,EACd,SAAS;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,GAC3D,IAAI,CAAC;IACT,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;IACpD,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;CAClD;AAgBD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAK9D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEhE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAM9D;AAoED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,wBAAwB,CAuB3E;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,wBAAwB;;;;;;;;;;;EAgC3E;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,wBAAwB,GACrC,MAAM,CAGR;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,GACd,WAAW,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAyB/C"}
1
+ {"version":3,"file":"effectiveness.d.ts","sourceRoot":"","sources":["../../src/utils/effectiveness.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,wBAAwB,EACzB,MAAM,8DAA8D,CAAC;AACtE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,8DAA8D,CAAC;AAC7G,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,wBAAwB,GACzB,CAAC;AACF,YAAY,EAAE,wBAAwB,EAAE,CAAC;AAIzC;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAK9D;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,wBAAwB;;;;;;;;;;;EAgC3E;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,wBAAwB,GACrC,MAAM,CAGR"}
@@ -1,18 +1,7 @@
1
+ import { isEvidenceString, isEvidenceTime, parseEffectiveness, parseEffectivenessTokens, } from "../../all/copy-overwrite/scripts/lib/usage-effectiveness.mjs";
2
+ export { isEvidenceString, isEvidenceTime, parseEffectiveness, parseEffectivenessTokens, };
1
3
  /** Observations, not scores. Unknown clocks stay null and evidence stays explicit. */
2
4
  import { createHash } from "node:crypto";
3
- const FIELDS = [
4
- "schema",
5
- "lisaVersion",
6
- "workerConfigRevision",
7
- "workerWallMs",
8
- "feedbackMs",
9
- "workerSource",
10
- "attention",
11
- "readyAt",
12
- "acceptedAt",
13
- "lifecycleSources",
14
- "reworkSources",
15
- ];
16
5
  /**
17
6
  * Normalize and hash exactly as the gardener does, independent of ledger entry versions.
18
7
  * @param invariant - Rule whose recurrence is being measured
@@ -24,99 +13,6 @@ export function invariantFingerprint(invariant) {
24
13
  .digest("hex")
25
14
  .slice(0, 12);
26
15
  }
27
- /**
28
- * Require a nonempty evidence identifier.
29
- * @param value - Untrusted field
30
- * @returns Whether this is a nonempty string
31
- */
32
- export function isEvidenceString(value) {
33
- return typeof value === "string" && value.trim().length > 0;
34
- }
35
- /**
36
- * Require an unambiguous UTC instant rather than a locale-dependent date.
37
- * @param value - Untrusted timestamp
38
- * @returns Whether this is a canonical UTC instant
39
- */
40
- export function isEvidenceTime(value) {
41
- return (typeof value === "string" &&
42
- Number.isFinite(Date.parse(value)) &&
43
- new Date(value).toISOString() === value);
44
- }
45
- /**
46
- * Validate a duration without converting missing values to zero.
47
- * @param value - Untrusted duration
48
- * @returns Whether duration is finite and nonnegative
49
- */
50
- function isDuration(value) {
51
- return typeof value === "number" && Number.isFinite(value) && value >= 0;
52
- }
53
- /**
54
- * Validate optional source lists.
55
- * @param value - Untrusted sources
56
- * @returns Whether sources are valid or explicitly unavailable
57
- */
58
- function isSources(value) {
59
- return (value === null || (Array.isArray(value) && value.every(isEvidenceString)));
60
- }
61
- /**
62
- * Validate observed human interventions; timestamps cannot imply minutes of work.
63
- * @param value - Untrusted events
64
- * @returns Whether all events carry stable identity and source
65
- */
66
- function isAttention(value) {
67
- return (value === null ||
68
- (Array.isArray(value) &&
69
- value.every(event => event !== null &&
70
- typeof event === "object" &&
71
- Object.keys(event).length === 2 &&
72
- isEvidenceString(event.id) &&
73
- isEvidenceString(event.source))));
74
- }
75
- /**
76
- * Check nullable clock fields and the evidence needed to interpret them.
77
- * @param row - Candidate observation
78
- * @returns Whether clocks are valid and sourced
79
- */
80
- function validClocks(row) {
81
- const durations = (row.workerWallMs === null || isDuration(row.workerWallMs)) &&
82
- (row.feedbackMs === null ||
83
- (Array.isArray(row.feedbackMs) && row.feedbackMs.every(isDuration)));
84
- const sourcedWorker = (row.workerWallMs === null && row.feedbackMs === null) ||
85
- isEvidenceString(row.workerSource);
86
- const times = [row.readyAt, row.acceptedAt].every(value => value === null || isEvidenceTime(value));
87
- const sourcedLifecycle = (row.readyAt === null && row.acceptedAt === null) ||
88
- (Array.isArray(row.lifecycleSources) && row.lifecycleSources.length > 0);
89
- const ordered = !isEvidenceTime(row.readyAt) ||
90
- !isEvidenceTime(row.acceptedAt) ||
91
- Date.parse(row.acceptedAt) >= Date.parse(row.readyAt);
92
- return durations && sourcedWorker && times && sourcedLifecycle && ordered;
93
- }
94
- /**
95
- * Parse additive observation data, refusing malformed measurements rather than guessing.
96
- * @param value - JSON-compatible input
97
- * @returns Validated observation
98
- */
99
- export function parseEffectiveness(value) {
100
- if (value === null || typeof value !== "object" || Array.isArray(value))
101
- throw new Error("Invalid effectiveness observation");
102
- const row = value;
103
- const shape = Object.keys(row).length === FIELDS.length &&
104
- FIELDS.every(key => Object.hasOwn(row, key));
105
- const tags = [
106
- row.lisaVersion,
107
- row.workerConfigRevision,
108
- row.workerSource,
109
- ].every(tag => tag === null || isEvidenceString(tag));
110
- if (!shape ||
111
- row.schema !== 1 ||
112
- !tags ||
113
- !isAttention(row.attention) ||
114
- !isSources(row.lifecycleSources) ||
115
- !isSources(row.reworkSources) ||
116
- !validClocks(row))
117
- throw new Error("Invalid or unsourced effectiveness observation");
118
- return value;
119
- }
120
16
  /**
121
17
  * Summarize a run without combining distinct clocks or extrapolating missing evidence.
122
18
  * @param observation - Validated run observations
@@ -160,24 +56,4 @@ export function renderEffectivenessToken(entryId, observation) {
160
56
  return "";
161
57
  return ` <!-- lisa:usage-effectiveness entry_id=${encodeURIComponent(entryId)} data=${encodeURIComponent(JSON.stringify(parseEffectiveness(observation)))} -->`;
162
58
  }
163
- /**
164
- * Read correlated extensions and reject ambiguous repeated values.
165
- * @param section - Managed usage markdown
166
- * @returns Observation keyed by usage entry identity
167
- */
168
- export function parseEffectivenessTokens(section) {
169
- const rows = Array.from(section.matchAll(/<!-- lisa:usage-effectiveness [^\r\n]*? -->/gu), token => {
170
- const match = /^<!-- lisa:usage-effectiveness entry_id=(\S+) data=(\S+) -->$/u.exec(token[0]);
171
- if (match === null)
172
- throw new Error("Invalid effectiveness extension");
173
- return [
174
- decodeURIComponent(match[1] ?? ""),
175
- parseEffectiveness(JSON.parse(decodeURIComponent(match[2] ?? ""))),
176
- ];
177
- });
178
- const entries = new Map(rows);
179
- if (rows.some(([id, row]) => JSON.stringify(entries.get(id)) !== JSON.stringify(row)))
180
- throw new Error("Conflicting effectiveness extensions");
181
- return entries;
182
- }
183
59
  //# sourceMappingURL=effectiveness.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"effectiveness.js","sourceRoot":"","sources":["../../src/utils/effectiveness.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAmBzC,MAAM,MAAM,GAAG;IACb,QAAQ;IACR,aAAa;IACb,sBAAsB;IACtB,cAAc;IACd,YAAY;IACZ,cAAc;IACd,WAAW;IACX,SAAS;IACT,YAAY;IACZ,kBAAkB;IAClB,eAAe;CAChB,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAAiB;IACpD,OAAO,UAAU,CAAC,QAAQ,CAAC;SACxB,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,W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GAAG,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;KAC3D,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACtC,OAAe,EACf,WAAsC;IAEtC,IAAI,WAAW,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACzC,OAAO,2CAA2C,kBAAkB,CAAC,OAAO,CAAC,SAAS,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC;AAClK,CAAC"}
@@ -1,64 +1,8 @@
1
- import { type EffectivenessObservation } from "./effectiveness.js";
2
- export declare const LISA_USAGE_HEADING = "## Lisa Usage";
3
- /**
4
- *
5
- */
6
- export interface LisaUsageEntry {
7
- artifactRef: string;
8
- cachedInputTokens: number | null;
9
- cost: number | null;
10
- currency: string | null;
11
- entryId: string;
12
- effectiveness?: EffectivenessObservation;
13
- flow: string;
14
- inputTokens: number | null;
15
- measuredSubsetTokens?: number | null;
16
- model: string;
17
- outputTokens: number | null;
18
- parentArtifactRef: string | null;
19
- pricingSource: string | null;
20
- pricingStatus: string;
21
- provider: string;
22
- reasoningTokens: number | null;
23
- runId: string;
24
- source: string;
25
- totalTokens: number | null;
26
- }
27
- /**
28
- *
29
- */
30
- export interface LisaUsageRollup {
31
- childCost: number | null;
32
- childCurrency: string | null;
33
- childEntryIds: readonly string[];
34
- childRefs: readonly string[];
35
- childTokens: number | null;
36
- childTokensIncomplete?: boolean;
37
- currency: string | null;
38
- directCost: number | null;
39
- directEntryIds: readonly string[];
40
- directTokens: number | null;
41
- totalCost: number | null;
42
- totalTokens: number | null;
43
- }
44
- /**
45
- *
46
- */
47
- export interface LisaUsageChildArtifact {
48
- artifactRef: string;
49
- entries: readonly LisaUsageEntry[];
50
- }
51
- /**
52
- *
53
- */
54
- export interface ParsedLisaUsageSection {
55
- entries: readonly LisaUsageEntry[];
56
- range: {
57
- end: number;
58
- start: number;
59
- } | null;
60
- rollup: LisaUsageRollup | null;
61
- }
1
+ import { LISA_USAGE_HEADING, parseLisaUsageSection } from "../../all/copy-overwrite/scripts/lib/usage-ledger.mjs";
2
+ import { verifyLisaUsageSectionIntegrity } from "../../all/copy-overwrite/scripts/lib/usage-ledger-integrity.mjs";
3
+ import type { LisaUsageEntry, LisaUsageRollup, LisaUsageChildArtifact, ParsedLisaUsageSection, LisaUsageSectionIntegrityIssue, LisaUsageSectionIntegrityResult } from "../../all/copy-overwrite/scripts/lib/usage-ledger.mjs";
4
+ export { LISA_USAGE_HEADING, parseLisaUsageSection, verifyLisaUsageSectionIntegrity, };
5
+ export type { LisaUsageEntry, LisaUsageRollup, LisaUsageChildArtifact, ParsedLisaUsageSection, LisaUsageSectionIntegrityIssue, LisaUsageSectionIntegrityResult, };
62
6
  /**
63
7
  * Merge new usage entries into an existing ledger while keeping stable order for
64
8
  * previously recorded entries and replacing matching `entry_id` rows in place.
@@ -115,45 +59,6 @@ export declare function renderLisaUsageSection(input: {
115
59
  entries: readonly LisaUsageEntry[];
116
60
  rollup: LisaUsageRollup;
117
61
  }): string;
118
- /**
119
- * Parse the managed usage section out of an artifact body or comment.
120
- *
121
- * @param document Artifact markdown to inspect.
122
- * @returns Parsed direct entries, rollup token, and the located section range.
123
- */
124
- export declare function parseLisaUsageSection(document: string): ParsedLisaUsageSection;
125
- /**
126
- * Describe one way a stored managed usage section fails to be a readable ledger.
127
- */
128
- export interface LisaUsageSectionIntegrityIssue {
129
- code: "missing-entry-token" | "missing-rollup-token" | "missing-section" | "unrecorded-entry";
130
- entryIds: readonly string[];
131
- message: string;
132
- }
133
- /**
134
- *
135
- */
136
- export interface LisaUsageSectionIntegrityResult {
137
- issues: readonly LisaUsageSectionIntegrityIssue[];
138
- ok: boolean;
139
- }
140
- /**
141
- * Verify that a STORED managed usage section is still a readable ledger.
142
- *
143
- * This exists because a write surface can accept a section, report success, and
144
- * silently destroy part of it. Callers must run this against the bytes read back
145
- * from the host, never against the payload they sent and never against the
146
- * mutation's return value — trusting the mutation result is precisely what let a
147
- * Linear description strip every entry token while reporting `success: true`.
148
- *
149
- * @param storedDocument Artifact body or comment body as read back from the host.
150
- * @param expected Optional expectations from the write that was just performed.
151
- * @param expected.entryIds Entry ids the caller believes it just persisted.
152
- * @returns Whether the stored ledger is enumerable, plus every issue found.
153
- */
154
- export declare function verifyLisaUsageSectionIntegrity(storedDocument: string, expected?: {
155
- entryIds?: readonly string[];
156
- }): LisaUsageSectionIntegrityResult;
157
62
  /**
158
63
  * Append or replace the canonical `## Lisa Usage` section in a markdown
159
64
  * artifact while preserving prior entries that are not being refreshed.
@@ -1 +1 @@
1
- {"version":3,"file":"usage-accounting.d.ts","sourceRoot":"","sources":["../../src/utils/usage-accounting.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,oBAAoB,CAAC;AAE5B,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,wBAAwB,CAAC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,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MAAM,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;CACjC,GACA,MAAM,CAkCR"}
1
+ {"version":3,"file":"usage-accounting.d.ts","sourceRoot":"","sources":["../../src/utils/usage-accounting.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EAAE,+BAA+B,EAAE,MAAM,iEAAiE,CAAC;AAClH,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,8BAA8B,EAC9B,+BAA+B,EAChC,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,+BAA+B,GAChC,CAAC;AACF,YAAY,EACV,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,8BAA8B,EAC9B,+BAA+B,GAChC,CAAC;AA4JF;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,eAAe,EAAE,SAAS,cAAc,EAAE,EAC1C,WAAW,EAAE,SAAS,cAAc,EAAE,GACrC,SAAS,cAAc,EAAE,CAsB3B;AA+FD;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,SAAS,cAAc,EAAE,EAClC,cAAc,CAAC,EAAE,eAAe,GAAG,IAAI,EACvC,cAAc,CAAC,EAAE,SAAS,sBAAsB,EAAE,GACjD,eAAe,CAoDjB;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAIvE;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAK1E;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC5C,OAAO,EAAE,SAAS,cAAc,EAAE,CAAC;IACnC,MAAM,EAAE,eAAe,CAAC;CACzB,GAAG,MAAM,CAyBT;A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