@telora/daemon 0.22.137 → 0.22.146

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 (78) hide show
  1. package/build-info.json +13 -3
  2. package/dist/audit/audit-phase.d.ts +34 -1
  3. package/dist/audit/audit-phase.d.ts.map +1 -1
  4. package/dist/audit/audit-phase.js +92 -9
  5. package/dist/audit/audit-phase.js.map +1 -1
  6. package/dist/audit/audit-prompt.d.ts +174 -0
  7. package/dist/audit/audit-prompt.d.ts.map +1 -1
  8. package/dist/audit/audit-prompt.js +365 -2
  9. package/dist/audit/audit-prompt.js.map +1 -1
  10. package/dist/completion/review-coverage-shas.d.ts +49 -0
  11. package/dist/completion/review-coverage-shas.d.ts.map +1 -0
  12. package/dist/completion/review-coverage-shas.js +128 -0
  13. package/dist/completion/review-coverage-shas.js.map +1 -0
  14. package/dist/completion/review-exit-deps.d.ts +15 -2
  15. package/dist/completion/review-exit-deps.d.ts.map +1 -1
  16. package/dist/completion/review-exit-deps.js +9 -3
  17. package/dist/completion/review-exit-deps.js.map +1 -1
  18. package/dist/delivery/delivery-review-coverage.d.ts +216 -0
  19. package/dist/delivery/delivery-review-coverage.d.ts.map +1 -0
  20. package/dist/delivery/delivery-review-coverage.js +208 -0
  21. package/dist/delivery/delivery-review-coverage.js.map +1 -0
  22. package/dist/queries/focus-branch-work-evidence.d.ts +55 -0
  23. package/dist/queries/focus-branch-work-evidence.d.ts.map +1 -0
  24. package/dist/queries/focus-branch-work-evidence.js +65 -0
  25. package/dist/queries/focus-branch-work-evidence.js.map +1 -0
  26. package/dist/queries/focus-criteria-standing.d.ts +138 -0
  27. package/dist/queries/focus-criteria-standing.d.ts.map +1 -0
  28. package/dist/queries/focus-criteria-standing.js +98 -0
  29. package/dist/queries/focus-criteria-standing.js.map +1 -0
  30. package/dist/queries/focus-review-watermark.d.ts +35 -0
  31. package/dist/queries/focus-review-watermark.d.ts.map +1 -0
  32. package/dist/queries/focus-review-watermark.js +47 -0
  33. package/dist/queries/focus-review-watermark.js.map +1 -0
  34. package/dist/queries/focuses.d.ts +0 -9
  35. package/dist/queries/focuses.d.ts.map +1 -1
  36. package/dist/queries/focuses.js +0 -14
  37. package/dist/queries/focuses.js.map +1 -1
  38. package/dist/queries/shared.js +1 -1
  39. package/dist/queries/verification.d.ts +23 -25
  40. package/dist/queries/verification.d.ts.map +1 -1
  41. package/dist/queries/verification.js +66 -45
  42. package/dist/queries/verification.js.map +1 -1
  43. package/dist/resolvers/assembly-engine.d.ts +51 -0
  44. package/dist/resolvers/assembly-engine.d.ts.map +1 -1
  45. package/dist/resolvers/assembly-engine.js +10 -20
  46. package/dist/resolvers/assembly-engine.js.map +1 -1
  47. package/dist/resolvers/branch-work-arming.d.ts +133 -0
  48. package/dist/resolvers/branch-work-arming.d.ts.map +1 -0
  49. package/dist/resolvers/branch-work-arming.js +67 -0
  50. package/dist/resolvers/branch-work-arming.js.map +1 -0
  51. package/dist/resolvers/focus-criteria-standing.d.ts +24 -0
  52. package/dist/resolvers/focus-criteria-standing.d.ts.map +1 -0
  53. package/dist/resolvers/focus-criteria-standing.js +234 -0
  54. package/dist/resolvers/focus-criteria-standing.js.map +1 -0
  55. package/dist/resolvers/focus-review-coverage.d.ts +189 -0
  56. package/dist/resolvers/focus-review-coverage.d.ts.map +1 -0
  57. package/dist/resolvers/focus-review-coverage.js +516 -0
  58. package/dist/resolvers/focus-review-coverage.js.map +1 -0
  59. package/dist/resolvers/git-diff-against-base.d.ts.map +1 -1
  60. package/dist/resolvers/git-diff-against-base.js +11 -0
  61. package/dist/resolvers/git-diff-against-base.js.map +1 -1
  62. package/dist/resolvers/index.d.ts.map +1 -1
  63. package/dist/resolvers/index.js +7 -1
  64. package/dist/resolvers/index.js.map +1 -1
  65. package/dist/resolvers/reality-tree-snapshot.d.ts +9 -4
  66. package/dist/resolvers/reality-tree-snapshot.d.ts.map +1 -1
  67. package/dist/resolvers/reality-tree-snapshot.js +64 -17
  68. package/dist/resolvers/reality-tree-snapshot.js.map +1 -1
  69. package/dist/resolvers/shared/branch-fact-provenance.d.ts +258 -0
  70. package/dist/resolvers/shared/branch-fact-provenance.d.ts.map +1 -0
  71. package/dist/resolvers/shared/branch-fact-provenance.js +571 -0
  72. package/dist/resolvers/shared/branch-fact-provenance.js.map +1 -0
  73. package/dist/resolvers/shared/reality-tree-arrival.d.ts +71 -0
  74. package/dist/resolvers/shared/reality-tree-arrival.d.ts.map +1 -0
  75. package/dist/resolvers/shared/reality-tree-arrival.js +129 -0
  76. package/dist/resolvers/shared/reality-tree-arrival.js.map +1 -0
  77. package/dist/testing/fixtures/index.js +1 -1
  78. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resolvers/index.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,wEAAwE;AACxE,iEAAiE;AACjE,gBAAgB;AAEhB;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAAE,0CAA0C,EAAE,MAAM,mCAAmC,CAAC;AAC/F,OAAO,EAAE,mCAAmC,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,qCAAqC,EAAE,MAAM,+BAA+B,CAAC;AACtF,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,kCAAkC,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,uCAAuC,EAAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAA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AC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,2EAA2E;YAC3E,mEAAmE;YACnE,kEAAkE,CACnE,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,yEAAyE;AACzE,OAAO,EACL,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,EAC1B,+BAA+B,EAC/B,gBAAgB,EAChB,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,EACzB,iCAAiC,EACjC,6BAA6B,EAC7B,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,kCAAkC,EAClC,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,6BAA6B,GAC9B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resolvers/index.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,wEAAwE;AACxE,mEAAmE;AACnE,kEAAkE;AAClE,gEAAgE;AAChE,gBAAgB;AAEhB;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAAE,0CAA0C,EAAE,MAAM,mCAAmC,CAAC;AAC/F,OAAO,EAAE,mCAAmC,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,qCAAqC,EAAE,MAAM,+BAA+B,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shot
3
3
  *
4
- * Returns the focus's reality tree(s) as a structured text dump for the
5
- * audit assessor. Same shape as focus.reality_tree but with the "CRT Dump"
6
- * heading renamed to "Snapshot" so the audit prompt distinguishes its
7
- * "current graph" input from other tree-related sections. Fails soft.
4
+ * Returns the focus's reality tree(s) as a structured text dump for the audit
5
+ * assessor. Same shape as focus.reality_tree but with the "CRT Dump" heading
6
+ * renamed to "Snapshot" so the audit prompt distinguishes its "current graph"
7
+ * input from other tree-related sections, and with each tree's canonical
8
+ * ARRIVAL verdict appended.
9
+ *
10
+ * Fails SOFT but never SILENT: a failed read renders an explicit READ FAILED
11
+ * state rather than an empty section, which the assessor cannot tell apart
12
+ * from a focus with no tree -- and therefore from a finished one.
8
13
  */
9
14
  /** Register this module's resolver(s). Called from initResolvers() -- not an import side effect. */
10
15
  export declare function registerRealityTreeSnapshotResolver(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"reality-tree-snapshot.d.ts","sourceRoot":"","sources":["../../src/resolvers/reality-tree-snapshot.ts"],"names":[],"mappings":"AAmBA;;;;;;;GAOG;AACH,oGAAoG;AACpG,wBAAgB,mCAAmC,IAAI,IAAI,CAmC1D"}
1
+ {"version":3,"file":"reality-tree-snapshot.d.ts","sourceRoot":"","sources":["../../src/resolvers/reality-tree-snapshot.ts"],"names":[],"mappings":"AA2EA;;;;;;;;;;;;GAYG;AACH,oGAAoG;AACpG,wBAAgB,mCAAmC,IAAI,IAAI,CAyB1D"}
@@ -4,15 +4,68 @@
4
4
  import { registerSourceResolver } from './assembly-engine.js';
5
5
  import { callApi } from '../queries/shared.js';
6
6
  import { CRT_DUMP_BUDGET_CHARS, renderRealityTreeDump, } from './shared/reality-tree.js';
7
+ import { parseArrivalBlock, renderArrivalSection, renderSnapshotReadFailure, } from './shared/reality-tree-arrival.js';
7
8
  import { createLogger } from '../shell/log.js';
8
9
  const log = createLogger({ module: 'assembly' });
10
+ /**
11
+ * Read one tree's arrival verdict from the CANONICAL computation.
12
+ *
13
+ * `reality_tree_dump` is the single place arrival is decided; this resolver
14
+ * calls it for the verdict alone and keeps rendering the graph body from the
15
+ * node/edge lists. Taking the dump's own rendered body instead would swap the
16
+ * audit's budget-truncated "Snapshot" graph for the authoring banner, and the
17
+ * dump takes no budget -- whereas the DIVERGENCE risk the guidance names lives
18
+ * entirely in the verdict, which is consumed here, never recomputed.
19
+ *
20
+ * Never throws: an unreadable verdict is a rendered state, not a gap.
21
+ */
22
+ async function readTreeArrival(treeId) {
23
+ try {
24
+ const resp = await callApi('reality_tree_dump', { treeId });
25
+ return parseArrivalBlock(resp);
26
+ }
27
+ catch (err) {
28
+ const reason = err instanceof Error ? err.message : String(err);
29
+ log.warn(`reality_tree.snapshot arrival read failed for tree ${treeId}: ${reason}`);
30
+ return { kind: 'unreadable', reason };
31
+ }
32
+ }
33
+ /**
34
+ * Render one tree: the active graph body (budget-limited) plus its arrival
35
+ * section, which is ALWAYS rendered. Returns null only for a tree that has
36
+ * nothing to say at all -- no rendered body AND an earned verdict; a hold or
37
+ * an unreadable verdict always produces a section, because a tree whose
38
+ * retirements were unearned can legitimately have zero active nodes left.
39
+ */
40
+ async function renderTreeSection(tree, bodyBudget) {
41
+ const [nodesResp, edgesResp, arrival] = await Promise.all([
42
+ callApi('reality_tree_node_list', { treeId: tree.id, status: 'active' }),
43
+ callApi('reality_tree_edge_list', { treeId: tree.id }),
44
+ readTreeArrival(tree.id),
45
+ ]);
46
+ const body = bodyBudget > 0
47
+ ? renderRealityTreeDump(tree, nodesResp.items ?? [], edgesResp.items ?? [], bodyBudget)
48
+ : '';
49
+ const arrivalSection = renderArrivalSection(arrival);
50
+ if (body.length === 0) {
51
+ if (arrival.kind === 'verdict' && arrival.verdict.allEarned)
52
+ return null;
53
+ return `### Tree: ${tree.name}\n\n_No active nodes rendered for this tree._\n\n${arrivalSection}`;
54
+ }
55
+ return `${body}\n\n${arrivalSection}`;
56
+ }
9
57
  /**
10
58
  * reality_tree.snapshot
11
59
  *
12
- * Returns the focus's reality tree(s) as a structured text dump for the
13
- * audit assessor. Same shape as focus.reality_tree but with the "CRT Dump"
14
- * heading renamed to "Snapshot" so the audit prompt distinguishes its
15
- * "current graph" input from other tree-related sections. Fails soft.
60
+ * Returns the focus's reality tree(s) as a structured text dump for the audit
61
+ * assessor. Same shape as focus.reality_tree but with the "CRT Dump" heading
62
+ * renamed to "Snapshot" so the audit prompt distinguishes its "current graph"
63
+ * input from other tree-related sections, and with each tree's canonical
64
+ * ARRIVAL verdict appended.
65
+ *
66
+ * Fails SOFT but never SILENT: a failed read renders an explicit READ FAILED
67
+ * state rather than an empty section, which the assessor cannot tell apart
68
+ * from a focus with no tree -- and therefore from a finished one.
16
69
  */
17
70
  /** Register this module's resolver(s). Called from initResolvers() -- not an import side effect. */
18
71
  export function registerRealityTreeSnapshotResolver() {
@@ -27,26 +80,20 @@ export function registerRealityTreeSnapshotResolver() {
27
80
  const sections = [];
28
81
  let used = 0;
29
82
  for (const tree of trees) {
30
- if (used >= CRT_DUMP_BUDGET_CHARS)
31
- break;
32
- const remaining = CRT_DUMP_BUDGET_CHARS - used;
33
- const [nodesResp, edgesResp] = await Promise.all([
34
- callApi('reality_tree_node_list', { treeId: tree.id, status: 'active' }),
35
- callApi('reality_tree_edge_list', { treeId: tree.id }),
36
- ]);
37
- const dump = renderRealityTreeDump(tree, nodesResp.items ?? [], edgesResp.items ?? [], remaining);
38
- if (dump.length === 0)
83
+ const section = await renderTreeSection(tree, Math.max(0, CRT_DUMP_BUDGET_CHARS - used));
84
+ if (section === null)
39
85
  continue;
40
- sections.push(dump);
41
- used += dump.length;
86
+ sections.push(section);
87
+ used += section.length;
42
88
  }
43
89
  if (sections.length === 0)
44
90
  return '';
45
91
  return `## Reality Tree Snapshot\n\n${sections.join('\n\n')}`;
46
92
  }
47
93
  catch (err) {
48
- log.warn(`reality_tree.snapshot failed: ${err.message}`);
49
- return '';
94
+ const reason = err instanceof Error ? err.message : String(err);
95
+ log.warn(`reality_tree.snapshot failed: ${reason}`);
96
+ return renderSnapshotReadFailure(reason);
50
97
  }
51
98
  });
52
99
  }
@@ -1 +1 @@
1
- {"version":3,"file":"reality-tree-snapshot.js","sourceRoot":"","sources":["../../src/resolvers/reality-tree-snapshot.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,0FAA0F;AAC1F,gBAAgB;AAEhB,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EACL,qBAAqB,EACrB,qBAAqB,GAItB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,GAAG,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;AAGjD;;;;;;;GAOG;AACH,oGAAoG;AACpG,MAAM,UAAU,mCAAmC;IACjD,sBAAsB,CAAC,uBAAuB,EAAE,KAAK,EAAE,OAAwB,EAAmB,EAAE;QAClG,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,MAAM,OAAO,CAA0B,mBAAmB,EAAE;gBAC5E,OAAO,EAAE,OAAO,CAAC,OAAO;aACzB,CAAC,CAAC;YACH,MAAM,KAAK,GAAG,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC;YAC3E,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,EAAE,CAAC;YAElC,MAAM,QAAQ,GAAa,EAAE,CAAC;YAC9B,IAAI,IAAI,GAAG,CAAC,CAAC;YACb,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACzB,IAAI,IAAI,IAAI,qBAAqB;oBAAE,MAAM;gBACzC,MAAM,SAAS,GAAG,qBAAqB,GAAG,IAAI,CAAC;gBAC/C,MAAM,CAAC,SAAS,EA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B,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACvB,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;YACzB,CAAC;YACD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,EAAE,CAAC;YACrC,OAAO,+BAA+B,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAChE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,MAAM,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAChE,GAAG,CAAC,IAAI,CAAC,iCAAiC,MAAM,EAAE,CAAC,CAAC;YACpD,OAAO,yBAAyB,CAAC,MAAM,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,258 @@
1
+ /** One commit exactly as git reported it, before any join to the focus. */
2
+ export interface RawCommitFact {
3
+ readonly sha: string;
4
+ readonly subject: string;
5
+ /** Raw `Telora-Delivery` trailer value; '' when the commit carries none. */
6
+ readonly trailer: string;
7
+ /** How many parents the commit has (>= 2 means a merge). */
8
+ readonly parentCount: number;
9
+ /** Paths the commit touched (empty for a merge, which git lists bare). */
10
+ readonly files: readonly string[];
11
+ /**
12
+ * The subset of `files` this commit REMOVED: a `D` status, or the old side
13
+ * of a rename. Optional so a reader that cannot report removals reports
14
+ * NONE (the fact falls back to a declared gap) rather than have one invented.
15
+ */
16
+ readonly removedFiles?: readonly string[];
17
+ }
18
+ /** Why a commit could not be tied to one of THIS focus's deliveries. */
19
+ export type UnattributedReason =
20
+ /** The commit carries no `Telora-Delivery` trailer at all. */
21
+ 'no_trailer'
22
+ /** A merge commit: it carries no trailer and git lists no files for it. */
23
+ | 'merge_commit'
24
+ /** `Telora-Delivery: none` -- declared housekeeping, no delivery owns it. */
25
+ | 'non_delivery_commit'
26
+ /** `Telora-Delivery: unattributed` -- real work whose delivery is unknown. */
27
+ | 'unattributed_capture'
28
+ /** The trailer names a delivery that is NOT one of this focus's. */
29
+ | 'foreign_delivery'
30
+ /** The producing commit is not in the read window: it predates the base, or
31
+ * the read stopped at its commit cap. (Line and deletion grain only.) */
32
+ | 'outside_read_window';
33
+ /**
34
+ * The review state a FACT inherits. Only a fact attributed to a delivery this
35
+ * focus owns AND that a completed review covered is `reviewed`; everything
36
+ * else, every unattributed fact included, is `unreviewed`.
37
+ */
38
+ export type FactReviewState = 'reviewed' | 'unreviewed';
39
+ /** One commit, joined to the producing delivery and its review state. */
40
+ export interface AttributedCommit {
41
+ readonly sha: string;
42
+ readonly subject: string;
43
+ /** The producing delivery, or null when the commit is unattributed. */
44
+ readonly deliveryId: string | null;
45
+ readonly deliveryName: string | null;
46
+ readonly reviewState: FactReviewState;
47
+ /** Set iff `deliveryId` is null -- WHY the commit could not be attributed. */
48
+ readonly unattributed: UnattributedReason | null;
49
+ /** The delivery id the trailer named when it belongs to another focus. */
50
+ readonly foreignDeliveryId: string | null;
51
+ readonly files: readonly string[];
52
+ /** The subset of `files` this commit removed -- see `RawCommitFact`. */
53
+ readonly removedFiles: readonly string[];
54
+ }
55
+ /** One path, folded over every commit in the window that touched it. */
56
+ export interface AttributedFile {
57
+ readonly path: string;
58
+ /** Deliveries of THIS focus that touched it, in first-seen order. */
59
+ readonly deliveryIds: readonly string[];
60
+ readonly deliveryNames: readonly string[];
61
+ /** At least one commit touching it could not be attributed. */
62
+ readonly hasUnattributed: boolean;
63
+ /**
64
+ * The read was CAPPED, so this list is a LOWER BOUND -- an unread commit may
65
+ * have touched the path too. Carried per ROW because a capped read is how a
66
+ * shared file comes to look single-contributor, and a pass looking one path
67
+ * up never reads the section's banner.
68
+ */
69
+ readonly listingIncomplete: boolean;
70
+ /**
71
+ * The commit that REMOVED the path, when the newest commit in the window to
72
+ * touch it removed it -- the path is then absent at the tip and its removal
73
+ * is the only fact left to attribute. Null while it still exists.
74
+ */
75
+ readonly removedBySha: string | null;
76
+ /**
77
+ * `reviewed` only when EVERY contributing commit is attributed and reviewed
78
+ * AND the read saw the whole window. A claim about the CONTRIBUTIONS, never
79
+ * about every line -- the line table answers for those.
80
+ */
81
+ readonly reviewState: FactReviewState;
82
+ }
83
+ /** The whole mapping for one `<base>..<tip>` window. */
84
+ export interface BranchFactProvenance {
85
+ readonly base: string;
86
+ readonly tip: string;
87
+ readonly commits: readonly AttributedCommit[];
88
+ readonly files: readonly AttributedFile[];
89
+ /** The read hit its commit cap, so this listing is INCOMPLETE. */
90
+ readonly capped: boolean;
91
+ /**
92
+ * Line and deletion grain for every file the window touched, or NULL when
93
+ * this reading never descended to it -- deliberately different values: []
94
+ * means "it ran and the window touched no file", null means "nobody asked",
95
+ * and rendering the second as the first would tell the pass every line
96
+ * resolves when nothing resolved any. Filled by {@link attributeLineGrain},
97
+ * which costs a git process per live file.
98
+ */
99
+ readonly lines: readonly AttributedFileLines[] | null;
100
+ }
101
+ /** What the join needs to know about one delivery of the focus. */
102
+ export interface ProvenanceDelivery {
103
+ readonly id: string;
104
+ readonly name: string;
105
+ /** True iff a completed focus review covered this delivery's work. */
106
+ readonly reviewed: boolean;
107
+ }
108
+ /**
109
+ * The most commits one window read classifies. Past it the read stops and the
110
+ * rendering SAYS the listing is incomplete -- an unlisted commit is not
111
+ * silently absent, it is declared unattributable for this pass.
112
+ */
113
+ export declare const BRANCH_FACT_COMMIT_CAP = 500;
114
+ /**
115
+ * Pure: parse the batched `git log` output {@link readBranchCommitFacts} reads.
116
+ * Each record is `RS <sha> FS <subject> FS <parents> FS <trailer values> FS`
117
+ * followed by git's `--name-status` list. Separators are control characters no
118
+ * commit subject or path contains, so a multi-line trailer block cannot be
119
+ * mistaken for the next field.
120
+ */
121
+ export declare function parseBranchCommitFacts(output: string): RawCommitFact[];
122
+ /**
123
+ * Every commit in `<base>..<tip>` of the repository at `repoPath`, with its
124
+ * trailer and the paths it touched -- ONE git process for the whole window.
125
+ *
126
+ * Commits come back NEWEST FIRST (git log's order); the fold that decides
127
+ * whether a path is deleted AT THE TIP depends on it.
128
+ *
129
+ * Merges are INCLUDED (unlike the review-window read, which drops them): a
130
+ * merge that carries no trailer must appear as an unattributed fact rather than
131
+ * vanish, because a fact the mapping omits reads to the pass as a fact with no
132
+ * provenance question to ask.
133
+ *
134
+ * `repoPath` need not be a checkout of the branch -- `git log <ref>` reads refs,
135
+ * so the daemon's main repo path answers for a focus that has no live worktree.
136
+ * Returns null when git fails, so a caller can tell UNREADABLE from EMPTY.
137
+ */
138
+ export declare function readBranchCommitFacts(repoPath: string, base: string, tip: string, cap?: number): RawCommitFact[] | null;
139
+ /** Pure: join a read window to the focus's deliveries. */
140
+ export declare function attributeBranchFacts(facts: readonly RawCommitFact[], deliveries: readonly ProvenanceDelivery[], window: {
141
+ base: string;
142
+ tip: string;
143
+ capped?: boolean;
144
+ }): BranchFactProvenance;
145
+ /**
146
+ * One run of consecutive lines at the TIP that a single commit last wrote --
147
+ * git blame's own unit, taken as git reports it rather than re-derived.
148
+ */
149
+ export interface BlameRange {
150
+ readonly sha: string;
151
+ /** 1-based line number of the run's first line, at the tip. */
152
+ readonly startLine: number;
153
+ readonly lineCount: number;
154
+ }
155
+ /** Why a file has NO line ranges. Every one is declared, never silent. */
156
+ export type LineGrainGap =
157
+ /** The path is absent at the tip: a commit in the window DELETED it. */
158
+ 'deleted_at_tip'
159
+ /** git could not blame the path at the tip (binary, or an unreadable read). */
160
+ | 'blame_unreadable'
161
+ /** The reading's blame budget was spent before reaching this file. */
162
+ | 'over_file_cap';
163
+ /** The delivery-and-review half of ONE fact, at any grain. Shared so a line
164
+ * range and a deletion cannot drift into different answers. */
165
+ export interface FactAttribution {
166
+ readonly deliveryId: string | null;
167
+ readonly deliveryName: string | null;
168
+ readonly reviewState: FactReviewState;
169
+ /** Set iff `deliveryId` is null -- WHY this fact has no producing delivery. */
170
+ readonly unattributed: UnattributedReason | null;
171
+ }
172
+ /** One blame run, joined to the producing commit's delivery and review state. */
173
+ export interface AttributedLineRange extends FactAttribution {
174
+ readonly startLine: number;
175
+ /** 1-based, INCLUSIVE, so `startLine..endLine` reads as a closed interval. */
176
+ readonly endLine: number;
177
+ readonly sha: string;
178
+ }
179
+ /** The commit that REMOVED a path, joined exactly as a line range is. */
180
+ export interface AttributedDeletion extends FactAttribution {
181
+ readonly sha: string;
182
+ }
183
+ /** Line grain for ONE file: its ranges, or the gap that stands in for them. */
184
+ export interface AttributedFileLines {
185
+ readonly path: string;
186
+ /** Tip-ordered and non-overlapping; empty exactly when `gap` is set. */
187
+ readonly ranges: readonly AttributedLineRange[];
188
+ readonly gap: LineGrainGap | null;
189
+ /** Set iff `gap` is `deleted_at_tip` -- the commit that removed the path. */
190
+ readonly deletion: AttributedDeletion | null;
191
+ }
192
+ /** Reads one path's blame runs at the tip; null when git cannot answer. */
193
+ export type BlameReader = (path: string) => BlameRange[] | null;
194
+ /**
195
+ * The most files one reading blames. Blame walks a file's history, so this is
196
+ * the module's dearest read; past the cap a file is DECLARED unattributed at
197
+ * line grain, never blamed or silently skipped. Unchanged from when only
198
+ * ambiguous files were blamed: widening the SELECTION to every live file did
199
+ * not widen the worst case, only which files the budget reaches first.
200
+ */
201
+ export declare const BRANCH_FACT_BLAME_FILE_CAP = 40;
202
+ /**
203
+ * Pure: parse `git blame --incremental` output into tip-ordered runs.
204
+ *
205
+ * `--incremental` over porcelain because it emits ONLY the run headers and
206
+ * per-commit metadata -- never the file's content -- so the read costs the
207
+ * same for a 10-line file and a 10000-line one. Every non-header line
208
+ * (author, summary, `previous`, `boundary`, `filename`) is metadata and is
209
+ * ignored; git repeats a header-only block for a commit it already described,
210
+ * which is why the parse keys on the header shape alone.
211
+ */
212
+ export declare function parseBlameRanges(output: string): BlameRange[];
213
+ /**
214
+ * Blame ONE path at `tip` in the repository at `repoPath`. Move/copy detection
215
+ * (`-C`, `-M`) is deliberately NOT enabled: it would name the commit a line
216
+ * came FROM in another file, not the one that put the line where the pass is
217
+ * reading it -- plausible and wrong is worse here than no attribution at all.
218
+ * Returns null on any git failure, which the caller renders as a declared gap.
219
+ */
220
+ export declare function readFileBlameRanges(repoPath: string, tip: string, path: string): BlameRange[] | null;
221
+ /**
222
+ * The paths to spend the blame budget on, riskiest first. EVERY file still
223
+ * present at the tip is a candidate: the rule this replaced blamed only
224
+ * multi-contributor files and let a single-contributor file row answer for all
225
+ * its lines -- false for a pre-existing file, whose untouched lines predate the
226
+ * base, and false again whenever a capped read hid the other contributors. A
227
+ * path the window's newest touch REMOVED is excluded instead: blame cannot read
228
+ * it, and the log already attributed its removal.
229
+ *
230
+ * The ORDER is what the cost bound rests on now. A contributor is a delivery,
231
+ * "at least one unattributed commit", or "the read was capped, so there may be
232
+ * more"; above one, a wrong answer is dearest (a reviewed and an unreviewed
233
+ * delivery in one file), so those go first and an exhausted budget leaves the
234
+ * CHEAPEST facts declared rather than the dearest guessed.
235
+ */
236
+ export declare function selectBlamePaths(files: readonly AttributedFile[]): string[];
237
+ /**
238
+ * Attach line grain: EVERY path the window touched gets a row -- blame runs
239
+ * for a live path (up to `fileCap` of them), the removing commit for a path
240
+ * gone at the tip, or the declared gap standing in for either. Nothing is left
241
+ * out, because a file the table omits is one whose lines the pass answers for
242
+ * from the file row -- the false claim this grain exists to prevent.
243
+ *
244
+ * Pure but for `readBlame`, the single injected seam -- so a test can drive
245
+ * the REAL git reader against a real repository, and a caller with no
246
+ * repository leaves line grain unattached (null) rather than fabricate one.
247
+ */
248
+ export declare function attributeLineGrain(provenance: BranchFactProvenance, readBlame: BlameReader, fileCap?: number): BranchFactProvenance;
249
+ /** Sub-section heading, shared by the reading and the unavailable line. */
250
+ export declare const PROVENANCE_HEADING = "### Fact provenance (which delivery produced each observed change?)";
251
+ /** Render the mapping. Never returns an empty string. */
252
+ export declare function renderBranchFactProvenance(provenance: BranchFactProvenance): string;
253
+ /**
254
+ * Render the EXPLICIT unavailable block. Rendered instead of nothing on every
255
+ * failure, because an absent mapping reads as "there was nothing to attribute".
256
+ */
257
+ export declare function renderBranchFactProvenanceUnavailable(reason: string): string;
258
+ //# sourceMappingURL=branch-fact-provenance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"branch-fact-provenance.d.ts","sourceRoot":"","sources":["../../../src/resolvers/shared/branch-fact-provenance.ts"],"names":[],"mappings":"AAqEA,2EAA2E;AAC3E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,4EAA4E;IAC5E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,4DAA4D;IAC5D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C;AAED,wEAAwE;AACxE,MAAM,MAAM,kBAAkB;AAC5B,8DAA8D;AAC5D,YAAY;AACd,2EAA2E;GACzE,cAAc;AAChB,6EAA6E;GAC3E,qBAAqB;AACvB,8EAA8E;GAC5E,sBAAsB;AACxB,oEAAoE;GAClE,kBAAkB;AACpB;yEACyE;GACvE,qBAAqB,CAAC;AAE1B;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,YAAY,CAAC;AAExD,yEAAyE;AACzE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,uEAAuE;IACvE,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAC;IACtC,8EAA8E;IAC9E,QAAQ,CAAC,YAAY,EAAE,kB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