@ftrdotdev/pi-tracker 0.5.2 → 0.7.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 (39) hide show
  1. package/README.md +136 -46
  2. package/package.json +8 -2
  3. package/src/compaction/candidate.test.ts +191 -0
  4. package/src/compaction/candidate.ts +105 -0
  5. package/src/compaction/classifier.test.ts +422 -0
  6. package/src/compaction/classifier.ts +198 -0
  7. package/src/compaction/completion.test.ts +257 -0
  8. package/src/compaction/completion.ts +94 -0
  9. package/src/compaction/decision-record.test.ts +91 -0
  10. package/src/compaction/decision-record.ts +101 -0
  11. package/src/compaction/digest.test.ts +185 -0
  12. package/src/compaction/digest.ts +158 -0
  13. package/src/compaction/footprint.test.ts +135 -0
  14. package/src/compaction/footprint.ts +387 -0
  15. package/src/compaction/observations.test.ts +199 -0
  16. package/src/compaction/observations.ts +348 -0
  17. package/src/compaction/pointer.test.ts +26 -0
  18. package/src/compaction/pointer.ts +15 -0
  19. package/src/compaction/rules.test.ts +253 -0
  20. package/src/compaction/rules.ts +188 -0
  21. package/src/compaction/settings.test.ts +315 -0
  22. package/src/compaction/settings.ts +185 -0
  23. package/src/compaction/settle.test.ts +370 -0
  24. package/src/compaction/settle.ts +150 -0
  25. package/src/{deps.test.ts → core/deps.test.ts} +1 -1
  26. package/src/{domain.test.ts → core/domain.test.ts} +42 -9
  27. package/src/{domain.ts → core/domain.ts} +73 -8
  28. package/src/{persistence.test.ts → core/persistence.test.ts} +7 -7
  29. package/src/{store.test.ts → core/store.test.ts} +116 -50
  30. package/src/{store.ts → core/store.ts} +92 -31
  31. package/src/index.test.ts +728 -84
  32. package/src/index.ts +237 -49
  33. package/src/{tool-metadata.test.ts → presentation/tool-metadata.test.ts} +264 -49
  34. package/src/presentation/tool-metadata.ts +675 -0
  35. package/src/{ui.test.ts → presentation/ui.test.ts} +128 -9
  36. package/src/{ui.ts → presentation/ui.ts} +123 -30
  37. package/src/tool-metadata.ts +0 -452
  38. /package/src/{deps.ts → core/deps.ts} +0 -0
  39. /package/src/{persistence.ts → core/persistence.ts} +0 -0
@@ -0,0 +1,185 @@
1
+ import { assert, it } from "@effect/vitest";
2
+ import { NEEDS_CONTEXT_LABEL, NEEDS_NONE_LABEL } from "./classifier.ts";
3
+ import type { CompactionCandidate } from "./candidate.ts";
4
+ import {
5
+ DESCRIPTION_LIMIT,
6
+ PRODUCT_CAP,
7
+ QUESTION_KEY_PREFIX,
8
+ REFERENCE_CAP,
9
+ buildDigests,
10
+ compactQuestions,
11
+ questionKey,
12
+ } from "./digest.ts";
13
+ import type { ResolvedProduct, ResolvedReference } from "./observations.ts";
14
+
15
+ interface DigestShape {
16
+ candidates: Array<{
17
+ ref: string;
18
+ text: string;
19
+ description?: string;
20
+ class: string;
21
+ relationship: string;
22
+ references: Array<Record<string, unknown>>;
23
+ products: Array<Record<string, unknown>>;
24
+ referenceCut?: string;
25
+ productCut?: string;
26
+ }>;
27
+ completed: Array<{ ref: string; text: string; description?: string }>;
28
+ survival: string;
29
+ }
30
+
31
+ const dependent: CompactionCandidate = {
32
+ class: "dependent-successor",
33
+ listName: "Work",
34
+ id: 2,
35
+ text: "second",
36
+ completed: [{ ref: "Work:1", text: "first" }],
37
+ };
38
+
39
+ const readyQueue: CompactionCandidate = {
40
+ class: "ready-queue",
41
+ listName: "Work",
42
+ id: 3,
43
+ text: "third",
44
+ completed: [{ ref: "Work:1", text: "first" }],
45
+ };
46
+
47
+ const noFacts: readonly { references: []; products: [] }[] = [];
48
+
49
+ it("buildDigests carries only the candidates, the completed batch, and the survival instruction", () => {
50
+ const digest = buildDigests([dependent], noFacts);
51
+ assert.deepStrictEqual(Object.keys(digest).sort(), ["candidates", "completed", "survival"]);
52
+ });
53
+
54
+ it("buildDigests lists one entry per candidate with its class and relationship", () => {
55
+ const digest = buildDigests([dependent, readyQueue], noFacts) as unknown as DigestShape;
56
+ assert.deepStrictEqual(digest.candidates, [
57
+ {
58
+ ref: "Work:2",
59
+ text: "second",
60
+ class: "dependent-successor",
61
+ relationship: "depends on Work:1",
62
+ references: [],
63
+ products: [],
64
+ },
65
+ {
66
+ ref: "Work:3",
67
+ text: "third",
68
+ class: "ready-queue",
69
+ relationship: "independent of Work:1",
70
+ references: [],
71
+ products: [],
72
+ },
73
+ ]);
74
+ });
75
+
76
+ it("buildDigests carries the completed batch once as prior work", () => {
77
+ const digest = buildDigests([dependent, readyQueue], noFacts) as unknown as DigestShape;
78
+ assert.deepStrictEqual(digest.completed, [{ ref: "Work:1", text: "first" }]);
79
+ });
80
+
81
+ // ---------------------------------------------------------------------------
82
+ // Slice 6: descriptions, declarations, and the survival instruction
83
+ // ---------------------------------------------------------------------------
84
+
85
+ it("buildDigests carries a long description as its first paragraph with a named cut", () => {
86
+ const first = "a".repeat(DESCRIPTION_LIMIT + 50);
87
+ const candidate: CompactionCandidate = {
88
+ ...readyQueue,
89
+ description: `${first}\n\nsecond paragraph`,
90
+ };
91
+ const digest = buildDigests([candidate], noFacts) as unknown as DigestShape;
92
+ const description = digest.candidates[0]!.description!;
93
+ assert.strictEqual(description, `${"a".repeat(DESCRIPTION_LIMIT)}… [50 more characters]`);
94
+ assert.notInclude(description, "second paragraph");
95
+ });
96
+
97
+ it("buildDigests carries a description that is already one short paragraph unchanged", () => {
98
+ const candidate: CompactionCandidate = { ...readyQueue, description: "one line" };
99
+ const digest = buildDigests([candidate], noFacts) as unknown as DigestShape;
100
+ assert.strictEqual(digest.candidates[0]!.description, "one line");
101
+ });
102
+
103
+ it("buildDigests caps references at eight and products at four with a marker", () => {
104
+ const refs = Array.from({ length: 10 }, (_value, index) => ({
105
+ kind: "path" as const,
106
+ path: `src/f${index}.ts`,
107
+ }));
108
+ const produces = Array.from({ length: 6 }, (_value, index) => ({ path: `src/p${index}.ts` }));
109
+ const references: ResolvedReference[] = refs.map((reference) => ({
110
+ reference,
111
+ state: "readable",
112
+ }));
113
+ const products: ResolvedProduct[] = produces.map((product) => ({ product, state: "exists" }));
114
+ const digest = buildDigests(
115
+ [{ ...readyQueue, refs, produces }],
116
+ [{ references, products }],
117
+ ) as unknown as DigestShape;
118
+ const candidate = digest.candidates[0]!;
119
+ assert.strictEqual(candidate.references.length, REFERENCE_CAP);
120
+ assert.strictEqual(candidate.products.length, PRODUCT_CAP);
121
+ assert.strictEqual(candidate.referenceCut, "… [2 more references declared]");
122
+ assert.strictEqual(candidate.productCut, "… [2 more products declared]");
123
+ });
124
+
125
+ it("buildDigests carries a declared decision as a fact and never asserts it is archived", () => {
126
+ const refs = [{ kind: "decision" as const, topic: "storage shape" }];
127
+ const digest = buildDigests(
128
+ [{ ...readyQueue, refs }],
129
+ [{ references: [{ reference: refs[0]!, state: "unresolved" }], products: [] }],
130
+ ) as unknown as DigestShape;
131
+ assert.deepStrictEqual(digest.candidates[0]!.references, [
132
+ { kind: "decision", topic: "storage shape", state: "unresolved" },
133
+ ]);
134
+ assert.notInclude(JSON.stringify(digest), "archived");
135
+ });
136
+
137
+ it("buildDigests carries the survival instruction and no transcript text", () => {
138
+ const digest = buildDigests([dependent], noFacts) as unknown as DigestShape;
139
+ assert.include(digest.survival, "transcript");
140
+ assert.include(digest.survival, "description");
141
+ assert.notInclude(JSON.stringify(digest), "assistant said");
142
+ assert.notInclude(JSON.stringify(digest), "tool-call");
143
+ });
144
+
145
+ it("compactQuestions keys each question by its candidate reference and index", () => {
146
+ const questions = compactQuestions([dependent, readyQueue]);
147
+ assert.deepStrictEqual(
148
+ questions.map((entry) => entry.key),
149
+ [questionKey("Work:2", 0), questionKey("Work:3", 1)],
150
+ );
151
+ assert.strictEqual(questions[0]!.key, `${QUESTION_KEY_PREFIX}.Work_2.0`);
152
+ });
153
+
154
+ it("compactQuestions produces ids that satisfy the provider pattern", () => {
155
+ const questions = compactQuestions([dependent, readyQueue]);
156
+ for (const { key } of questions) {
157
+ assert.match(key, /^[A-Za-z0-9_.-]{1,100}$/);
158
+ }
159
+ });
160
+
161
+ it("compactQuestions asks one two-label choice question per candidate", () => {
162
+ const questions = compactQuestions([dependent, readyQueue]);
163
+ assert.strictEqual(questions.length, 2);
164
+ for (const { question } of questions) {
165
+ assert.strictEqual(question.type, "choice");
166
+ if (question.type !== "choice") continue;
167
+ assert.isAtLeast(question.instructions.length, 1);
168
+ assert.deepStrictEqual(
169
+ Object.keys(question.criteria).sort(),
170
+ [NEEDS_CONTEXT_LABEL, NEEDS_NONE_LABEL].sort(),
171
+ );
172
+ assert.isAtLeast(question.criteria[NEEDS_CONTEXT_LABEL]!.length, 1);
173
+ assert.isAtLeast(question.criteria[NEEDS_NONE_LABEL]!.length, 1);
174
+ }
175
+ });
176
+
177
+ it("compactQuestions uses the class-specific wording", () => {
178
+ const [dependentQuestion, queueQuestion] = compactQuestions([dependent, readyQueue]);
179
+ assert.include(dependentQuestion!.question.instructions, "depends on");
180
+ assert.include(queueQuestion!.question.instructions, "completed work");
181
+ assert.notStrictEqual(
182
+ dependentQuestion!.question.instructions,
183
+ queueQuestion!.question.instructions,
184
+ );
185
+ });
@@ -0,0 +1,158 @@
1
+ import type { JsonObject } from "@earendil-works/pi-ai";
2
+ import { formatItemRef } from "../core/deps.ts";
3
+ import { NEEDS_CONTEXT_LABEL, NEEDS_NONE_LABEL, type CompactionQuestion } from "./classifier.ts";
4
+ import type { CompactionCandidate } from "./candidate.ts";
5
+ import type { DeclaredReference, ProductState, ReferenceState } from "./observations.ts";
6
+
7
+ /**
8
+ * The bounded classifier input: every ready candidate, each with its title,
9
+ * its description, its class, its relationship to the completed batch, and its
10
+ * resolved declarations, plus the batch itself as referenced prior work. One
11
+ * survival instruction states what the item may still reach after compaction.
12
+ * The transcript is never read.
13
+ */
14
+
15
+ /** Shared prefix of the per-candidate classifier question key. */
16
+ export const QUESTION_KEY_PREFIX = "needsCompletedContext";
17
+
18
+ /** The most references one candidate's digest carries. */
19
+ export const REFERENCE_CAP = 8;
20
+ /** The most products one candidate's digest carries. */
21
+ export const PRODUCT_CAP = 4;
22
+ /** Characters of a description's first paragraph the digest keeps. */
23
+ export const DESCRIPTION_LIMIT = 400;
24
+
25
+ /** What survives compaction, stated once for the whole call. */
26
+ export const SURVIVAL_INSTRUCTION =
27
+ "After compaction, each item's title and description survive, and a file that exists on disk survives. The transcript does not survive, so ask only whether the item needs a detail that its own title, its description, or an existing file does not carry.";
28
+
29
+ /**
30
+ * A safe, unique question id for one candidate. Cloudflare Workers AI rejects
31
+ * any id that does not match `^[A-Za-z0-9_.-]{1,100}$`, so the item reference
32
+ * (`Work:2`) is sanitized and a positional index is appended for uniqueness.
33
+ */
34
+ export const questionKey = (ref: string, index: number): string =>
35
+ `${QUESTION_KEY_PREFIX}.${ref.replace(/[^A-Za-z0-9_-]/g, "_").slice(0, 60)}.${index}`;
36
+
37
+ const relationshipOf = (candidate: CompactionCandidate): string =>
38
+ candidate.class === "dependent-successor"
39
+ ? `depends on ${candidate.completed[0]?.ref ?? "the completed work"}`
40
+ : `independent of ${candidate.completed.map((item) => item.ref).join(", ")}`;
41
+
42
+ /** The first paragraph of a text, then the cap with a marker naming the cut. */
43
+ const descriptionOf = (text: string): string => {
44
+ const paragraph = text.split(/\n\s*\n/)[0]?.trim() ?? "";
45
+ return paragraph.length <= DESCRIPTION_LIMIT
46
+ ? paragraph
47
+ : `${paragraph.slice(0, DESCRIPTION_LIMIT)}… [${paragraph.length - DESCRIPTION_LIMIT} more characters]`;
48
+ };
49
+
50
+ /** One declared reference with the state it resolved to. */
51
+ const referenceOf = (reference: DeclaredReference, state: ReferenceState): JsonObject =>
52
+ reference.kind === "decision"
53
+ ? { kind: "decision", topic: reference.topic, state }
54
+ : {
55
+ kind: "path",
56
+ path: reference.path,
57
+ ...(reference.symbol === undefined ? {} : { symbol: reference.symbol }),
58
+ ...(reference.span === undefined ? {} : { span: reference.span }),
59
+ state,
60
+ };
61
+
62
+ /** A bounded candidate state: title, description, relationship, declarations. */
63
+ const candidateOf = (
64
+ candidate: CompactionCandidate,
65
+ facts: {
66
+ readonly references: readonly {
67
+ readonly reference: DeclaredReference;
68
+ readonly state: ReferenceState;
69
+ }[];
70
+ readonly products: readonly {
71
+ readonly product: { readonly path: string };
72
+ readonly state: ProductState;
73
+ }[];
74
+ },
75
+ ): JsonObject => {
76
+ const references = facts.references.slice(0, REFERENCE_CAP);
77
+ const products = facts.products.slice(0, PRODUCT_CAP);
78
+ const droppedReferences = facts.references.length - references.length;
79
+ const droppedProducts = facts.products.length - products.length;
80
+ return {
81
+ ref: formatItemRef(candidate.listName, candidate.id),
82
+ text: candidate.text,
83
+ ...(candidate.description === undefined || candidate.description.length === 0
84
+ ? {}
85
+ : { description: descriptionOf(candidate.description) }),
86
+ class: candidate.class,
87
+ relationship: relationshipOf(candidate),
88
+ references: references.map((entry) => referenceOf(entry.reference, entry.state)),
89
+ products: products.map((entry) => ({ path: entry.product.path, state: entry.state })),
90
+ ...(droppedReferences === 0
91
+ ? {}
92
+ : { referenceCut: `… [${droppedReferences} more references declared]` }),
93
+ ...(droppedProducts === 0
94
+ ? {}
95
+ : { productCut: `… [${droppedProducts} more products declared]` }),
96
+ };
97
+ };
98
+
99
+ /**
100
+ * One entry per candidate plus the completed batch once, plus the survival
101
+ * instruction. The state is facts only: a title, a description, a class, a
102
+ * relationship, resolved references, resolved products, and their cut markers.
103
+ */
104
+ export const buildDigests = (
105
+ candidates: readonly CompactionCandidate[],
106
+ facts: readonly {
107
+ readonly references: readonly {
108
+ readonly reference: DeclaredReference;
109
+ readonly state: ReferenceState;
110
+ }[];
111
+ readonly products: readonly {
112
+ readonly product: { readonly path: string };
113
+ readonly state: ProductState;
114
+ }[];
115
+ }[] = [],
116
+ ): JsonObject => ({
117
+ candidates: candidates.map((candidate, index) =>
118
+ candidateOf(candidate, facts[index] ?? { references: [], products: [] }),
119
+ ),
120
+ completed: (candidates[0]?.completed ?? []).map((item) => ({
121
+ ref: item.ref,
122
+ text: item.text,
123
+ ...(item.description === undefined ? {} : { description: item.description }),
124
+ })),
125
+ survival: SURVIVAL_INSTRUCTION,
126
+ });
127
+
128
+ /**
129
+ * One two-label choice question per candidate, keyed by the candidate's
130
+ * reference, so a single classifier call judges the whole ready frontier. The
131
+ * candidate class chooses the wording, so a dependent successor and independent
132
+ * work are asked different questions in the same call. The two labels stay
133
+ * binary either way; `confidence` rides along on the answer.
134
+ */
135
+ export const compactQuestions = (
136
+ candidates: readonly CompactionCandidate[],
137
+ ): readonly CompactionQuestion[] =>
138
+ candidates.map((candidate, index) => {
139
+ const ref = formatItemRef(candidate.listName, candidate.id);
140
+ const dependent = candidate.class === "dependent-successor";
141
+ return {
142
+ key: questionKey(ref, index),
143
+ question: {
144
+ type: "choice",
145
+ instructions: dependent
146
+ ? `The completed work is about to leave the context. Does this ready item #${ref} ("${candidate.text}") need the detail of the completed item it depends on?`
147
+ : `The completed work is about to leave the context. Does this ready item #${ref} ("${candidate.text}") need the detail of the completed work?`,
148
+ criteria: {
149
+ [NEEDS_CONTEXT_LABEL]: dependent
150
+ ? "The item needs specifics of the completed work — an interface, decision, or value — that its own text does not carry."
151
+ : "The item refers to the completed work or needs its details to proceed.",
152
+ [NEEDS_NONE_LABEL]: dependent
153
+ ? "The item's own text is self-contained and its dependency is only ordering."
154
+ : "The item stands alone and does not need the completed detail.",
155
+ },
156
+ },
157
+ };
158
+ });
@@ -0,0 +1,135 @@
1
+ import { assert, it } from "@effect/vitest";
2
+ import { Effect } from "effect";
3
+ import { fingerprintOf, type FileProbe } from "./observations.ts";
4
+ import { makeFootprintRecorder, newSideSpans, pendingOf, type ToolEvent } from "./footprint.ts";
5
+
6
+ /** A probe over a path-to-text map that records every read path. */
7
+ const countingProbe = (
8
+ files: Readonly<Record<string, string>>,
9
+ ): { readonly probe: FileProbe; readonly reads: string[] } => {
10
+ const reads: string[] = [];
11
+ return {
12
+ reads,
13
+ probe: {
14
+ read: (path) => {
15
+ reads.push(path);
16
+ return files[path];
17
+ },
18
+ findSymbol: () => [],
19
+ },
20
+ };
21
+ };
22
+
23
+ const write = (path: string, patch: string): ToolEvent => ({
24
+ phase: "end",
25
+ toolName: "write",
26
+ args: { path },
27
+ details: { patch },
28
+ });
29
+
30
+ const paths = (entries: readonly { readonly path: string }[]): readonly string[] =>
31
+ entries.map((entry) => entry.path);
32
+
33
+ // ---------------------------------------------------------------------------
34
+ // Projection
35
+ // ---------------------------------------------------------------------------
36
+
37
+ it("capture projects a write call into a path and its spans", () => {
38
+ const pending = pendingOf({
39
+ phase: "end",
40
+ toolName: "write",
41
+ args: { path: "src/a.ts" },
42
+ details: { patch: "@@ -1,2 +3,4 @@\n context" },
43
+ });
44
+ assert.deepStrictEqual(pending, { kind: "write", path: "src/a.ts", spans: ["3-6"] });
45
+ });
46
+
47
+ it("newSideSpans reads the new-side range of each hunk and caps at four", () => {
48
+ assert.deepStrictEqual(
49
+ newSideSpans({ patch: "@@ -1,0 +1,1 @@\n@@ -4,2 +8 @@\n@@ -9 +20,3 @@" }),
50
+ ["1", "8", "20-22"],
51
+ );
52
+ assert.deepStrictEqual(newSideSpans({ firstChangedLine: 12 }), ["12"]);
53
+ assert.deepStrictEqual(newSideSpans({}), []);
54
+ });
55
+
56
+ // ---------------------------------------------------------------------------
57
+ // The recorder
58
+ // ---------------------------------------------------------------------------
59
+
60
+ it.effect("capture never reads the disk", () =>
61
+ Effect.gen(function* () {
62
+ const files = Object.fromEntries(
63
+ Array.from({ length: 10 }, (_value, index) => [`src/f${index}.ts`, "one\ntwo"]),
64
+ );
65
+ const { probe, reads } = countingProbe(files);
66
+ const parts = yield* makeFootprintRecorder(probe);
67
+ for (let index = 0; index < 10; index += 1) {
68
+ yield* parts.recorder.capture(write(`src/f${index}.ts`, "@@ -1,0 +1,2 @@"));
69
+ }
70
+ assert.strictEqual(reads.length, 0);
71
+ // The snapshot is the drain: only now does the probe see a read.
72
+ yield* parts.recorder.snapshot;
73
+ assert.strictEqual(reads.length, 10);
74
+ }),
75
+ );
76
+
77
+ it.effect("repeated writes to one path coalesce into one derivation read", () =>
78
+ Effect.gen(function* () {
79
+ const { probe, reads } = countingProbe({ "src/a.ts": "1\n2\n3\n4\n5\n6\n7\n8" });
80
+ const parts = yield* makeFootprintRecorder(probe);
81
+ yield* parts.recorder.capture(write("src/a.ts", "@@ -1,1 +1,2 @@"));
82
+ yield* parts.recorder.capture(write("src/a.ts", "@@ -1,1 +3,2 @@"));
83
+ yield* parts.recorder.capture(write("src/a.ts", "@@ -1,1 +5,2 @@"));
84
+ const footprint = yield* parts.recorder.snapshot;
85
+ assert.deepStrictEqual(reads, ["src/a.ts"]);
86
+ assert.deepStrictEqual(footprint.wrote, [
87
+ { path: "src/a.ts", spans: ["5-6"], fingerprint: fingerprintOf("5\n6") },
88
+ ]);
89
+ }),
90
+ );
91
+
92
+ it.effect("parallel events for two paths derive independently", () =>
93
+ Effect.gen(function* () {
94
+ const { probe } = countingProbe({
95
+ "src/a.ts": "1\n2\n3\n4\n5\n6",
96
+ "src/b.ts": "x\n1\n2",
97
+ });
98
+ const parts = yield* makeFootprintRecorder(probe);
99
+ yield* parts.recorder.capture(write("src/a.ts", "@@ -1,2 +3,4 @@"));
100
+ yield* parts.recorder.capture(write("src/b.ts", "@@ -1,1 +1,2 @@"));
101
+ const footprint = yield* parts.recorder.snapshot;
102
+ assert.deepStrictEqual(paths(footprint.wrote), ["src/a.ts", "src/b.ts"]);
103
+ assert.deepStrictEqual(footprint.wrote[0]?.spans, ["3-6"]);
104
+ assert.deepStrictEqual(footprint.wrote[1]?.spans, ["1-2"]);
105
+ assert.strictEqual(footprint.wrote[0]?.fingerprint, fingerprintOf("3\n4\n5\n6"));
106
+ assert.strictEqual(footprint.wrote[1]?.fingerprint, fingerprintOf("x\n1"));
107
+ }),
108
+ );
109
+
110
+ it.effect("a snapshot returns only ready facts and clears on consume", () =>
111
+ Effect.gen(function* () {
112
+ const { probe } = countingProbe({ "src/a.ts": "1\n2\n3\n4\n5\n6" });
113
+ // `src/b.ts` cannot be derived: the probe throws, which leaves its fact out
114
+ // of the snapshot. The resolver abstains on the missing path.
115
+ const failing: FileProbe = {
116
+ read: (path) => {
117
+ if (path === "src/b.ts") throw new Error("not ready");
118
+ return probe.read(path);
119
+ },
120
+ findSymbol: () => [],
121
+ };
122
+ const parts = yield* makeFootprintRecorder(failing);
123
+ yield* parts.recorder.capture(write("src/a.ts", "@@ -1,1 +1,2 @@"));
124
+ yield* parts.recorder.capture(write("src/b.ts", "@@ -1,1 +1,2 @@"));
125
+
126
+ const first = yield* parts.recorder.snapshot;
127
+ assert.deepStrictEqual(paths(first.wrote), ["src/a.ts"]);
128
+
129
+ const consumed = yield* parts.recorder.consume;
130
+ assert.deepStrictEqual(paths(consumed.wrote), ["src/a.ts"]);
131
+
132
+ const second = yield* parts.recorder.snapshot;
133
+ assert.deepStrictEqual(second.wrote, []);
134
+ }),
135
+ );