@beehexa/hexasync-template-index 2608.7.4
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.
- package/dist/checkpoints.d.ts +47 -0
- package/dist/checkpoints.d.ts.map +1 -0
- package/dist/checkpoints.js +59 -0
- package/dist/checkpoints.js.map +1 -0
- package/dist/cursorContext.d.ts +204 -0
- package/dist/cursorContext.d.ts.map +1 -0
- package/dist/cursorContext.js +462 -0
- package/dist/cursorContext.js.map +1 -0
- package/dist/detectors.d.ts +103 -0
- package/dist/detectors.d.ts.map +1 -0
- package/dist/detectors.js +104 -0
- package/dist/detectors.js.map +1 -0
- package/dist/discovery.d.ts +193 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +394 -0
- package/dist/discovery.js.map +1 -0
- package/dist/effectiveGraph.d.ts +240 -0
- package/dist/effectiveGraph.d.ts.map +1 -0
- package/dist/effectiveGraph.js +523 -0
- package/dist/effectiveGraph.js.map +1 -0
- package/dist/failures.d.ts +50 -0
- package/dist/failures.d.ts.map +1 -0
- package/dist/failures.js +125 -0
- package/dist/failures.js.map +1 -0
- package/dist/graph.d.ts +47 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +230 -0
- package/dist/graph.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/queries.d.ts +102 -0
- package/dist/queries.d.ts.map +1 -0
- package/dist/queries.js +463 -0
- package/dist/queries.js.map +1 -0
- package/dist/ranges.d.ts +37 -0
- package/dist/ranges.d.ts.map +1 -0
- package/dist/ranges.js +217 -0
- package/dist/ranges.js.map +1 -0
- package/dist/resolveField.d.ts +125 -0
- package/dist/resolveField.d.ts.map +1 -0
- package/dist/resolveField.js +234 -0
- package/dist/resolveField.js.map +1 -0
- package/dist/tier1Service.d.ts +96 -0
- package/dist/tier1Service.d.ts.map +1 -0
- package/dist/tier1Service.js +194 -0
- package/dist/tier1Service.js.map +1 -0
- package/dist/tier2Service.d.ts +195 -0
- package/dist/tier2Service.d.ts.map +1 -0
- package/dist/tier2Service.js +642 -0
- package/dist/tier2Service.js.map +1 -0
- package/dist/yamlScalar.d.ts +17 -0
- package/dist/yamlScalar.d.ts.map +1 -0
- package/dist/yamlScalar.js +101 -0
- package/dist/yamlScalar.js.map +1 -0
- package/package.json +31 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Tier 1 index service — the single writer (Story 2.5, AD-5 and AD-14).
|
|
3
|
+
*
|
|
4
|
+
* AD-5 exists to prevent two owners of one entity, and a consumer unable to tell a stale reply
|
|
5
|
+
* from a fresh one. So: all mutation happens here, consumers receive an **immutable,
|
|
6
|
+
* version-stamped snapshot**, and a new version is announced by push. A consumer holding version
|
|
7
|
+
* N can always tell whether what it has is current, which is what makes caching a derived view
|
|
8
|
+
* safe at all.
|
|
9
|
+
*
|
|
10
|
+
* AD-14 exists because a branch switch rewrites hundreds of `main.yaml` files at once. A build
|
|
11
|
+
* per file would queue hundreds of stale builds behind the one that matters, so a superseded
|
|
12
|
+
* build is **dropped rather than queued**, and a cancelled request resolves to a sentinel instead
|
|
13
|
+
* of throwing — a cancellation is an ordinary outcome, not a failure.
|
|
14
|
+
*/
|
|
15
|
+
import type { TemplateReader } from '@beehexa/hexasync-template-ports';
|
|
16
|
+
import { type DiscoveredProject, type DiscoveryOptions } from './discovery.js';
|
|
17
|
+
import { type InheritanceEdge, type ProjectGraph } from './graph.js';
|
|
18
|
+
/** What a cancelled build resolves to. Never thrown — see AD-14 above. */
|
|
19
|
+
export declare const CANCELLED: unique symbol;
|
|
20
|
+
export type Cancelled = typeof CANCELLED;
|
|
21
|
+
/** An immutable, version-stamped view. Consumers hold these; they never hold the service. */
|
|
22
|
+
export interface Tier1Snapshot {
|
|
23
|
+
readonly version: number;
|
|
24
|
+
readonly rootUri: string;
|
|
25
|
+
readonly graph: ProjectGraph;
|
|
26
|
+
/** Wall-clock milliseconds the build took — NFR-4's budget is measured, not assumed. */
|
|
27
|
+
readonly buildMs: number;
|
|
28
|
+
}
|
|
29
|
+
export interface Tier1Options extends DiscoveryOptions {
|
|
30
|
+
/** Injected so a test can drive time; the index must never read a clock it cannot control. */
|
|
31
|
+
now?: () => number;
|
|
32
|
+
/**
|
|
33
|
+
* How long to wait for the change storm to settle before rebuilding.
|
|
34
|
+
*
|
|
35
|
+
* A branch switch fires the watcher once per file. Coalescing turns hundreds of rebuilds into
|
|
36
|
+
* one; without it the last useful build starts only after every useless one has finished.
|
|
37
|
+
*/
|
|
38
|
+
coalesceMs?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Where a throwing listener's error goes.
|
|
41
|
+
*
|
|
42
|
+
* Without it a bad consumer takes the whole push loop down with it. Optional because the
|
|
43
|
+
* index has no opinion about reporting — the host does.
|
|
44
|
+
*/
|
|
45
|
+
onListenerError?: (error: unknown) => void;
|
|
46
|
+
}
|
|
47
|
+
export type Tier1Listener = (snapshot: Tier1Snapshot) => void;
|
|
48
|
+
export declare class Tier1IndexService {
|
|
49
|
+
#private;
|
|
50
|
+
private readonly reader;
|
|
51
|
+
private readonly options;
|
|
52
|
+
constructor(reader: TemplateReader, options?: Tier1Options);
|
|
53
|
+
/** The current snapshot, or `undefined` before the first build completes. */
|
|
54
|
+
get snapshot(): Tier1Snapshot | undefined;
|
|
55
|
+
/** Subscribe to version pushes. Returns an unsubscribe function. */
|
|
56
|
+
onDidChange(listener: Tier1Listener): () => void;
|
|
57
|
+
/**
|
|
58
|
+
* Rebuild the whole index for `rootUri`.
|
|
59
|
+
*
|
|
60
|
+
* Every call takes a token. A build that finds a newer token on the way out resolves to
|
|
61
|
+
* `CANCELLED` and publishes nothing — which is what "dropped rather than queued" means in
|
|
62
|
+
* practice: the work may finish, but its result never becomes the snapshot.
|
|
63
|
+
*/
|
|
64
|
+
rebuild(rootUri: string): Promise<Tier1Snapshot | Cancelled>;
|
|
65
|
+
/**
|
|
66
|
+
* Request a rebuild, coalescing a storm of them into one.
|
|
67
|
+
*
|
|
68
|
+
* Returns the promise of whichever build actually runs, so a caller can await settling without
|
|
69
|
+
* having to know how many changes arrived.
|
|
70
|
+
*/
|
|
71
|
+
requestRebuild(rootUri: string): Promise<Tier1Snapshot | Cancelled>;
|
|
72
|
+
/**
|
|
73
|
+
* Rebuild ONE project's entry and its edges, leaving every other project untouched
|
|
74
|
+
* (Story 2.5 AC 1, added 2026-08-02 after the epic review).
|
|
75
|
+
*
|
|
76
|
+
* The full `rebuild` re-globs and re-reads every `main.yaml` in the folder — on the real
|
|
77
|
+
* corpus that is 113 reads for one keystroke, which contradicts the AC's second clause
|
|
78
|
+
* outright rather than merely leaving it untested.
|
|
79
|
+
*
|
|
80
|
+
* Edges are recomputed wholesale from the (mostly unchanged) project list because they are a
|
|
81
|
+
* pure function of it and cost no IO — the expensive part is reading, and this reads exactly
|
|
82
|
+
* one file. Returns `CANCELLED` when a newer build has already superseded it.
|
|
83
|
+
*/
|
|
84
|
+
rebuildProject(mainYamlUri: string): Promise<Tier1Snapshot | Cancelled>;
|
|
85
|
+
/** Abandon any in-flight or scheduled build. Used on disposal and on workspace removal. */
|
|
86
|
+
cancelPending(): void;
|
|
87
|
+
/** The project owning a file, or `undefined` — never a guess (FR-51). */
|
|
88
|
+
projectForFile(fileUri: string): DiscoveredProject | undefined;
|
|
89
|
+
listProjects(): readonly DiscoveredProject[];
|
|
90
|
+
projectsInheriting(fileUri: string): string[];
|
|
91
|
+
outgoingEdges(projectId: string): InheritanceEdge[];
|
|
92
|
+
incomingEdges(projectId: string): InheritanceEdge[];
|
|
93
|
+
unresolvedEdges(): InheritanceEdge[];
|
|
94
|
+
cycles(): readonly (readonly string[])[];
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=tier1Service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tier1Service.d.ts","sourceRoot":"","sources":["../src/tier1Service.ts"],"names":[],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OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IA2ClE;;;;;OAKG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAsBnE;;;;;;;;;;;OAWG;IACG,cAAc,CAClB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAgCrC,2FAA2F;IAC3F,aAAa,IAAI,IAAI;IAarB,yEAAyE;IACzE,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS;IAK9D,YAAY,IAAI,SAAS,iBAAiB,EAAE;IAI5C,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;IAM7C,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,EAAE;IAMnD,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,EAAE;IAMnD,eAAe,IAAI,eAAe,EAAE;IAIpC,MAAM,IAAI,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE;CAGzC"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { discoverProjects, rediscoverProject, projectForFile, } from './discovery.js';
|
|
2
|
+
import { buildProjectGraph, getIncomingEdges, getOutgoingEdges, getProjectsInheriting, getUnresolvedEdges, } from './graph.js';
|
|
3
|
+
/** Freeze an object and everything reachable from it. */
|
|
4
|
+
function deepFreeze(value, seen = new WeakSet()) {
|
|
5
|
+
if (value === null || typeof value !== 'object')
|
|
6
|
+
return value;
|
|
7
|
+
if (seen.has(value))
|
|
8
|
+
return value;
|
|
9
|
+
seen.add(value);
|
|
10
|
+
for (const key of Object.getOwnPropertyNames(value)) {
|
|
11
|
+
deepFreeze(value[key], seen);
|
|
12
|
+
}
|
|
13
|
+
return Object.freeze(value);
|
|
14
|
+
}
|
|
15
|
+
/** What a cancelled build resolves to. Never thrown — see AD-14 above. */
|
|
16
|
+
export const CANCELLED = Symbol('tier1-build-cancelled');
|
|
17
|
+
export class Tier1IndexService {
|
|
18
|
+
reader;
|
|
19
|
+
options;
|
|
20
|
+
#snapshot;
|
|
21
|
+
#version = 0;
|
|
22
|
+
#listeners = new Set();
|
|
23
|
+
#buildToken = 0;
|
|
24
|
+
#coalesceTimer;
|
|
25
|
+
#pending;
|
|
26
|
+
#settlePending;
|
|
27
|
+
constructor(reader, options = {}) {
|
|
28
|
+
this.reader = reader;
|
|
29
|
+
this.options = options;
|
|
30
|
+
}
|
|
31
|
+
/** The current snapshot, or `undefined` before the first build completes. */
|
|
32
|
+
get snapshot() {
|
|
33
|
+
return this.#snapshot;
|
|
34
|
+
}
|
|
35
|
+
/** Subscribe to version pushes. Returns an unsubscribe function. */
|
|
36
|
+
onDidChange(listener) {
|
|
37
|
+
this.#listeners.add(listener);
|
|
38
|
+
return () => this.#listeners.delete(listener);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Rebuild the whole index for `rootUri`.
|
|
42
|
+
*
|
|
43
|
+
* Every call takes a token. A build that finds a newer token on the way out resolves to
|
|
44
|
+
* `CANCELLED` and publishes nothing — which is what "dropped rather than queued" means in
|
|
45
|
+
* practice: the work may finish, but its result never becomes the snapshot.
|
|
46
|
+
*/
|
|
47
|
+
async rebuild(rootUri) {
|
|
48
|
+
const token = ++this.#buildToken;
|
|
49
|
+
const now = this.options.now ?? (() => Date.now());
|
|
50
|
+
const started = now();
|
|
51
|
+
const projects = await discoverProjects(rootUri, this.reader, this.options);
|
|
52
|
+
if (token !== this.#buildToken)
|
|
53
|
+
return CANCELLED;
|
|
54
|
+
const graph = buildProjectGraph(projects);
|
|
55
|
+
if (token !== this.#buildToken)
|
|
56
|
+
return CANCELLED;
|
|
57
|
+
// DEEP frozen. `Object.freeze` is shallow, so the previous version left `graph`,
|
|
58
|
+
// `graph.projects` and `graph.edges` freely mutable by any consumer — and the test that
|
|
59
|
+
// certified the AC asserted `Object.isFrozen(snapshot)`, which passes on a shallow freeze.
|
|
60
|
+
// The AC says immutable; a consumer caching a derived view has to be able to rely on it.
|
|
61
|
+
const snapshot = deepFreeze({
|
|
62
|
+
version: ++this.#version,
|
|
63
|
+
rootUri,
|
|
64
|
+
graph,
|
|
65
|
+
buildMs: now() - started,
|
|
66
|
+
});
|
|
67
|
+
this.#snapshot = snapshot;
|
|
68
|
+
this.#publish(snapshot);
|
|
69
|
+
return snapshot;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Push the new version (AD-5). A consumer that has to ask cannot know when to.
|
|
73
|
+
*
|
|
74
|
+
* Each listener is isolated: one that throws used to propagate out of `rebuild()` AND stop
|
|
75
|
+
* every later listener being notified, so a single bad consumer could silently freeze the
|
|
76
|
+
* status bar for everyone. Errors go to `onListenerError` if the host supplied one.
|
|
77
|
+
*/
|
|
78
|
+
#publish(snapshot) {
|
|
79
|
+
for (const listener of this.#listeners) {
|
|
80
|
+
try {
|
|
81
|
+
listener(snapshot);
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
this.options.onListenerError?.(error);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Request a rebuild, coalescing a storm of them into one.
|
|
90
|
+
*
|
|
91
|
+
* Returns the promise of whichever build actually runs, so a caller can await settling without
|
|
92
|
+
* having to know how many changes arrived.
|
|
93
|
+
*/
|
|
94
|
+
requestRebuild(rootUri) {
|
|
95
|
+
const delay = this.options.coalesceMs ?? 50;
|
|
96
|
+
// Settle the request this one supersedes. Previously the timer was cleared and `#pending`
|
|
97
|
+
// reassigned, so the earlier promise's `resolve` was never called and it stayed pending
|
|
98
|
+
// FOREVER — a caller that awaited it simply hung. The AC says a cancelled request resolves
|
|
99
|
+
// to a sentinel; it resolved to nothing. Not user-visible only because the extension
|
|
100
|
+
// `void`s it, which is luck rather than design.
|
|
101
|
+
this.#settlePending?.(CANCELLED);
|
|
102
|
+
if (this.#coalesceTimer !== undefined)
|
|
103
|
+
clearTimeout(this.#coalesceTimer);
|
|
104
|
+
this.#pending = new Promise((resolve) => {
|
|
105
|
+
this.#settlePending = resolve;
|
|
106
|
+
this.#coalesceTimer = setTimeout(() => {
|
|
107
|
+
this.#coalesceTimer = undefined;
|
|
108
|
+
this.#settlePending = undefined;
|
|
109
|
+
resolve(this.rebuild(rootUri));
|
|
110
|
+
}, delay);
|
|
111
|
+
});
|
|
112
|
+
return this.#pending;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Rebuild ONE project's entry and its edges, leaving every other project untouched
|
|
116
|
+
* (Story 2.5 AC 1, added 2026-08-02 after the epic review).
|
|
117
|
+
*
|
|
118
|
+
* The full `rebuild` re-globs and re-reads every `main.yaml` in the folder — on the real
|
|
119
|
+
* corpus that is 113 reads for one keystroke, which contradicts the AC's second clause
|
|
120
|
+
* outright rather than merely leaving it untested.
|
|
121
|
+
*
|
|
122
|
+
* Edges are recomputed wholesale from the (mostly unchanged) project list because they are a
|
|
123
|
+
* pure function of it and cost no IO — the expensive part is reading, and this reads exactly
|
|
124
|
+
* one file. Returns `CANCELLED` when a newer build has already superseded it.
|
|
125
|
+
*/
|
|
126
|
+
async rebuildProject(mainYamlUri) {
|
|
127
|
+
const current = this.#snapshot;
|
|
128
|
+
// Without a baseline there is nothing to patch; the caller must do a full build first.
|
|
129
|
+
if (!current)
|
|
130
|
+
return CANCELLED;
|
|
131
|
+
const token = ++this.#buildToken;
|
|
132
|
+
const now = this.options.now ?? (() => Date.now());
|
|
133
|
+
const started = now();
|
|
134
|
+
const updated = await rediscoverProject(mainYamlUri, this.reader, current.graph.projects, this.options);
|
|
135
|
+
if (token !== this.#buildToken)
|
|
136
|
+
return CANCELLED;
|
|
137
|
+
// Nothing moved — a save that did not change the project set. Publishing anyway would
|
|
138
|
+
// churn every consumer's cached view for no reason.
|
|
139
|
+
if (updated === current.graph.projects)
|
|
140
|
+
return current;
|
|
141
|
+
const snapshot = deepFreeze({
|
|
142
|
+
version: ++this.#version,
|
|
143
|
+
rootUri: current.rootUri,
|
|
144
|
+
graph: buildProjectGraph(updated),
|
|
145
|
+
buildMs: now() - started,
|
|
146
|
+
});
|
|
147
|
+
this.#snapshot = snapshot;
|
|
148
|
+
this.#publish(snapshot);
|
|
149
|
+
return snapshot;
|
|
150
|
+
}
|
|
151
|
+
/** Abandon any in-flight or scheduled build. Used on disposal and on workspace removal. */
|
|
152
|
+
cancelPending() {
|
|
153
|
+
this.#buildToken += 1;
|
|
154
|
+
if (this.#coalesceTimer !== undefined) {
|
|
155
|
+
clearTimeout(this.#coalesceTimer);
|
|
156
|
+
this.#coalesceTimer = undefined;
|
|
157
|
+
}
|
|
158
|
+
// Same reasoning as above: a scheduled request that is abandoned must still settle.
|
|
159
|
+
this.#settlePending?.(CANCELLED);
|
|
160
|
+
this.#settlePending = undefined;
|
|
161
|
+
}
|
|
162
|
+
// ---- Tier 1 query surface (FR-42). All answered from the snapshot, none building anything.
|
|
163
|
+
/** The project owning a file, or `undefined` — never a guess (FR-51). */
|
|
164
|
+
projectForFile(fileUri) {
|
|
165
|
+
if (!this.#snapshot)
|
|
166
|
+
return undefined;
|
|
167
|
+
return projectForFile(fileUri, this.#snapshot.graph.projects);
|
|
168
|
+
}
|
|
169
|
+
listProjects() {
|
|
170
|
+
return this.#snapshot?.graph.projects ?? [];
|
|
171
|
+
}
|
|
172
|
+
projectsInheriting(fileUri) {
|
|
173
|
+
return this.#snapshot
|
|
174
|
+
? getProjectsInheriting(this.#snapshot.graph, fileUri)
|
|
175
|
+
: [];
|
|
176
|
+
}
|
|
177
|
+
outgoingEdges(projectId) {
|
|
178
|
+
return this.#snapshot
|
|
179
|
+
? getOutgoingEdges(this.#snapshot.graph, projectId)
|
|
180
|
+
: [];
|
|
181
|
+
}
|
|
182
|
+
incomingEdges(projectId) {
|
|
183
|
+
return this.#snapshot
|
|
184
|
+
? getIncomingEdges(this.#snapshot.graph, projectId)
|
|
185
|
+
: [];
|
|
186
|
+
}
|
|
187
|
+
unresolvedEdges() {
|
|
188
|
+
return this.#snapshot ? getUnresolvedEdges(this.#snapshot.graph) : [];
|
|
189
|
+
}
|
|
190
|
+
cycles() {
|
|
191
|
+
return this.#snapshot?.graph.cycles ?? [];
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=tier1Service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tier1Service.js","sourceRoot":"","sources":["../src/tier1Service.ts"],"names":[],"mappings":"AAeA,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,GAGf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,GAGnB,MAAM,YAAY,CAAC;AAEpB,yDAAyD;AACzD,SAAS,UAAU,CAAI,KAAQ,EAAE,OAAO,IAAI,OAAO,EAAU;IAC3D,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC9D,IAAI,IAAI,CAAC,GAAG,CAAC,KAAe,CAAC;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,CAAC,GAAG,CAAC,KAAe,CAAC,CAAC;IAC1B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC;QACpD,UAAU,CAAE,KAAiC,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,0EAA0E;AAC1E,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC;AAiCzD,MAAM,OAAO,iBAAiB;IAUT;IACA;IAVnB,SAAS,CAA4B;IACrC,QAAQ,GAAG,CAAC,CAAC;IACb,UAAU,GAAG,IAAI,GAAG,EAAiB,CAAC;IACtC,WAAW,GAAG,CAAC,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CAAC,MAAM,IAAI,EAAE,CAAC;IAC5C,CAAC;CACF"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Tier 2 service — effective graphs, built lazily and kept bounded.
|
|
3
|
+
*
|
|
4
|
+
* Tier 1 is eager and workspace-wide because it is cheap. Tier 2 is neither, so it is built on
|
|
5
|
+
* file-open for the project you are actually in, and evicted when you move on (NFR-7). The
|
|
6
|
+
* anti-pattern this exists to avoid is recorded in NFR-8: eager workspace-wide indexing plus a
|
|
7
|
+
* full compose on every change.
|
|
8
|
+
*
|
|
9
|
+
* Same ownership rules as Tier 1 — one writer, immutable version-stamped snapshots, push (AD-5)
|
|
10
|
+
* — plus two Tier 2 needs:
|
|
11
|
+
*
|
|
12
|
+
* AD-10 a failed rebuild must not destroy what worked. The LAST GOOD graph is retained and
|
|
13
|
+
* served, marked stale, because a graph from thirty seconds ago is far more useful
|
|
14
|
+
* than none while the developer is mid-keystroke.
|
|
15
|
+
* AD-14 a superseded build is cancelled and DROPPED, resolving to a sentinel rather than
|
|
16
|
+
* throwing, because cancellation is an ordinary outcome.
|
|
17
|
+
*/
|
|
18
|
+
import type { TemplateReader } from '@beehexa/hexasync-template-ports';
|
|
19
|
+
import type { ResolverIO } from '@beehexa/hexasync-template-compose';
|
|
20
|
+
import { type IndexFailure } from './failures.js';
|
|
21
|
+
import { type DocumentVersionLookup, type EffectiveGraph } from './effectiveGraph.js';
|
|
22
|
+
/** What a cancelled Tier 2 build resolves to. Never thrown — see AD-14. */
|
|
23
|
+
export declare const TIER2_CANCELLED: unique symbol;
|
|
24
|
+
export type Tier2Cancelled = typeof TIER2_CANCELLED;
|
|
25
|
+
/**
|
|
26
|
+
* What a build resolves to when it FAILED and there is no last-good graph to fall back on.
|
|
27
|
+
*
|
|
28
|
+
* Distinct from cancellation on purpose. Returning `TIER2_CANCELLED` for a first-ever failure
|
|
29
|
+
* made "your YAML is broken" indistinguishable from AD-14's ordinary "a newer build superseded
|
|
30
|
+
* this one" — and opening a project whose YAML is already broken is exactly the common case. The
|
|
31
|
+
* described failure is reachable through `failureFor`, so nothing is swallowed.
|
|
32
|
+
*/
|
|
33
|
+
export declare const TIER2_FAILED: unique symbol;
|
|
34
|
+
export type Tier2Failed = typeof TIER2_FAILED;
|
|
35
|
+
/**
|
|
36
|
+
* A structured failure, never a bare string (AD-9's shape, published in Phase 2).
|
|
37
|
+
*
|
|
38
|
+
* A code so a consumer can branch, the file and range so it can be underlined where it happened,
|
|
39
|
+
* and the cause chain so the reason is not flattened away. Described by `describeFailure` rather
|
|
40
|
+
* than assembled here, so a failure looks the same wherever it surfaces.
|
|
41
|
+
*/
|
|
42
|
+
export type Tier2Failure = IndexFailure;
|
|
43
|
+
export interface Tier2Snapshot {
|
|
44
|
+
readonly version: number;
|
|
45
|
+
readonly graph: EffectiveGraph;
|
|
46
|
+
readonly buildMs: number;
|
|
47
|
+
/**
|
|
48
|
+
* Bumped ONLY when the assembled variable pool actually changed (Story 3.6 AC 2).
|
|
49
|
+
*
|
|
50
|
+
* Point-wise resolution caches are keyed by it, so an ordinary edit — which rebuilds the graph
|
|
51
|
+
* but leaves the pool alone — keeps them, and a `variables.yaml` change drops them. Keying
|
|
52
|
+
* those caches on `version` instead would throw the pool away on every keystroke, which is the
|
|
53
|
+
* cost Story 3.3 exists to avoid.
|
|
54
|
+
*/
|
|
55
|
+
readonly variablesGeneration: number;
|
|
56
|
+
/**
|
|
57
|
+
* True when this graph is the LAST GOOD one and a later rebuild failed (AD-10).
|
|
58
|
+
*
|
|
59
|
+
* Stated rather than implied: a consumer that cannot tell stale from fresh will either
|
|
60
|
+
* distrust everything or trust the wrong thing.
|
|
61
|
+
*/
|
|
62
|
+
readonly stale: boolean;
|
|
63
|
+
/** Set when the most recent rebuild failed. The graph above is still the last good one. */
|
|
64
|
+
readonly failure?: Tier2Failure;
|
|
65
|
+
}
|
|
66
|
+
export interface Tier2Options {
|
|
67
|
+
/** How many projects stay hot. Beyond this the least recently used is evicted (NFR-7). */
|
|
68
|
+
maxHotProjects?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Retain prefix checkpoints so edits re-merge incrementally (Story 3.5). On by default —
|
|
71
|
+
* this service exists to serve an editor, and an editor's next event is an edit.
|
|
72
|
+
*/
|
|
73
|
+
checkpoints?: boolean | {
|
|
74
|
+
max?: number;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* How many projects keep their checkpoints (Story 3.5 AC 5).
|
|
78
|
+
*
|
|
79
|
+
* ONE by default, and that is the whole memory argument. A checkpoint set is a handful of deep
|
|
80
|
+
* copies of the composed document — roughly a megabyte each on the corpus median — so keeping
|
|
81
|
+
* them for all eight hot projects would cost tens of megabytes to speed up edits in seven
|
|
82
|
+
* projects nobody is typing in. Graphs stay hot for answering questions; checkpoints follow
|
|
83
|
+
* the cursor.
|
|
84
|
+
*/
|
|
85
|
+
maxCheckpointProjects?: number;
|
|
86
|
+
now?: () => number;
|
|
87
|
+
documentVersion?: DocumentVersionLookup;
|
|
88
|
+
onListenerError?: (error: unknown) => void;
|
|
89
|
+
}
|
|
90
|
+
export type Tier2Listener = (projectId: string, snapshot: Tier2Snapshot) => void;
|
|
91
|
+
/**
|
|
92
|
+
* Told when a project fails to build, whether or not a last-good graph survived.
|
|
93
|
+
*
|
|
94
|
+
* Separate from the snapshot listener because a first-ever failure has no snapshot to carry it,
|
|
95
|
+
* and that is precisely the case a diagnostic publisher must not miss (Story 3.6 AC 6).
|
|
96
|
+
*/
|
|
97
|
+
export type Tier2FailureListener = (projectId: string, failure: Tier2Failure) => void;
|
|
98
|
+
interface ProjectInput {
|
|
99
|
+
readonly projectId: string;
|
|
100
|
+
readonly componentPath: string;
|
|
101
|
+
readonly mainYml: string;
|
|
102
|
+
}
|
|
103
|
+
/** A file event from the host, carrying the new text so nothing here has to read. */
|
|
104
|
+
export interface FileChange {
|
|
105
|
+
readonly uri: string;
|
|
106
|
+
readonly kind: 'created' | 'changed' | 'deleted';
|
|
107
|
+
/** The file's new text. Required for `changed`; meaningless for `deleted`. */
|
|
108
|
+
readonly text?: string;
|
|
109
|
+
}
|
|
110
|
+
export declare class Tier2IndexService {
|
|
111
|
+
#private;
|
|
112
|
+
private readonly io;
|
|
113
|
+
private readonly reader;
|
|
114
|
+
private readonly options;
|
|
115
|
+
constructor(io: ResolverIO, reader: TemplateReader, options?: Tier2Options);
|
|
116
|
+
get maxHotProjects(): number;
|
|
117
|
+
get maxCheckpointProjects(): number;
|
|
118
|
+
/** Which projects currently hold checkpoints, oldest first. Exposed so the bound is testable. */
|
|
119
|
+
checkpointedProjects(): string[];
|
|
120
|
+
/**
|
|
121
|
+
* How many edits are buffered for a project, awaiting a re-evaluation.
|
|
122
|
+
*
|
|
123
|
+
* Exposed for the same reason `hotProjects` is: "the buffer retains an edit a declined resume
|
|
124
|
+
* could not apply" is otherwise unobservable, and an unobservable guarantee is one no test can
|
|
125
|
+
* hold on to.
|
|
126
|
+
*/
|
|
127
|
+
pendingChangeCount(projectId: string): number;
|
|
128
|
+
onDidChange(listener: Tier2Listener): () => void;
|
|
129
|
+
onDidFail(listener: Tier2FailureListener): () => void;
|
|
130
|
+
/** The most recent failure for a project, or undefined if its last build succeeded. */
|
|
131
|
+
failureFor(projectId: string): Tier2Failure | undefined;
|
|
132
|
+
/** The graph for a project if it is hot, marking it most-recently-used. */
|
|
133
|
+
peek(projectId: string): Tier2Snapshot | undefined;
|
|
134
|
+
/** Which projects are currently hot, oldest first. Exposed so eviction is testable. */
|
|
135
|
+
hotProjects(): string[];
|
|
136
|
+
/**
|
|
137
|
+
* Which HOT projects were built from this file (Phase 2 Story 1.6).
|
|
138
|
+
*
|
|
139
|
+
* The question a host cannot answer for itself. A shared component library lives OUTSIDE every
|
|
140
|
+
* project's folder — 9 of the corpus's 14 library folders have no `main.yaml` at all — so a
|
|
141
|
+
* path-prefix test says such a file belongs to no project, and an edit to it is dropped. The
|
|
142
|
+
* inheriting project then keeps publishing findings computed from the library's OLD content while
|
|
143
|
+
* its watermark truthfully certifies the files it did read. The graph knows better: `sources` is
|
|
144
|
+
* exactly the set of files it was built from, inheritance included.
|
|
145
|
+
*
|
|
146
|
+
* Deliberately limited to what is already hot. Answering for the whole workspace would mean
|
|
147
|
+
* indexing every project's component list, which is the eager indexing NFR-8 forbids; and a build
|
|
148
|
+
* triggered by a library edit would spend a build for a project the developer is not in, which is
|
|
149
|
+
* the signal NFR-7 refuses. Updating a project already in memory costs a Map lookup.
|
|
150
|
+
*
|
|
151
|
+
* Reads `#hot` directly rather than through `peek`, because `peek` MEANS "this project was used"
|
|
152
|
+
* and answering a file-change question is not a use. Worth being precise about: the ordering effect
|
|
153
|
+
* is nil either way — a sweep that promotes every hot project in iteration order is an identity
|
|
154
|
+
* permutation — so this is a semantic choice, not an observable one, and no test can distinguish
|
|
155
|
+
* them. Said plainly because the first version of this comment claimed the opposite.
|
|
156
|
+
*/
|
|
157
|
+
projectsReading(uri: string): string[];
|
|
158
|
+
/**
|
|
159
|
+
* Build (or rebuild) a project's effective graph.
|
|
160
|
+
*
|
|
161
|
+
* On failure the last good snapshot is retained and re-published marked stale, carrying the
|
|
162
|
+
* failure — rather than the graph being dropped, which would take the editor's every answer
|
|
163
|
+
* with it over one unparseable keystroke.
|
|
164
|
+
*/
|
|
165
|
+
build(input: ProjectInput,
|
|
166
|
+
/** Unsaved host text to build from, so a rebuild honours the editor rather than the disk. */
|
|
167
|
+
overlay?: ReadonlyMap<string, string>): Promise<Tier2Snapshot | Tier2Cancelled | Tier2Failed>;
|
|
168
|
+
/**
|
|
169
|
+
* Apply file changes to a project (Story 3.6, FR-47).
|
|
170
|
+
*
|
|
171
|
+
* The one entry point a watcher needs. It decides between three answers, and the decision is
|
|
172
|
+
* the story: resume from a checkpoint when the change is an ordinary edit, rebuild when the
|
|
173
|
+
* change moves something a checkpoint cannot represent, and do nothing at all when the change
|
|
174
|
+
* is not this project's business.
|
|
175
|
+
*
|
|
176
|
+
* Returns `undefined` when the project was untouched — which is what a change in a DIFFERENT
|
|
177
|
+
* project must produce here, since nothing else in this service knows one project from another.
|
|
178
|
+
*/
|
|
179
|
+
applyChanges(projectId: string, changes: readonly FileChange[]): Promise<Tier2Snapshot | Tier2Cancelled | Tier2Failed | undefined>;
|
|
180
|
+
/**
|
|
181
|
+
* Re-evaluate a project after an edit, resuming from a checkpoint when one covers it.
|
|
182
|
+
*
|
|
183
|
+
* Returns `undefined` when the change cannot be applied incrementally — a new file, a changed
|
|
184
|
+
* merge base, a project with no checkpoints — leaving the caller to `build()`. Declining is
|
|
185
|
+
* the point: an incremental answer that is merely probably right is worse than a slower one
|
|
186
|
+
* that is certainly right.
|
|
187
|
+
*/
|
|
188
|
+
reindex(projectId: string, updates: ReadonlyMap<string, string>): Tier2Snapshot | undefined;
|
|
189
|
+
/** Abandon any in-flight build for a project — on close, or on workspace removal. */
|
|
190
|
+
cancel(projectId: string): void;
|
|
191
|
+
/** Drop a project entirely. */
|
|
192
|
+
evict(projectId: string): void;
|
|
193
|
+
}
|
|
194
|
+
export {};
|
|
195
|
+
//# sourceMappingURL=tier2Service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tier2Service.d.ts","sourceRoot":"","sources":["../src/tier2Service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EAEpB,MAAM,qBAAqB,CAAC;AAE7B,2EAA2E;AAC3E,eAAO,MAAM,eAAe,eAAkC,CAAC;AAC/D,MAAM,MAAM,cAAc,GAAG,OAAO,eAAe,CAAC;AAEpD;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,eAA+B,CAAC;AACzD,MAAM,MAAM,WA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