@beehexa/hexasync-template-index 2608.15.1 → 2608.20.18
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/package.json +4 -4
- package/dist/checkpoints.d.ts +0 -47
- package/dist/checkpoints.d.ts.map +0 -1
- package/dist/checkpoints.js +0 -59
- package/dist/checkpoints.js.map +0 -1
- package/dist/cursorContext.d.ts +0 -204
- package/dist/cursorContext.d.ts.map +0 -1
- package/dist/cursorContext.js +0 -479
- package/dist/cursorContext.js.map +0 -1
- package/dist/detectors.d.ts +0 -103
- package/dist/detectors.d.ts.map +0 -1
- package/dist/detectors.js +0 -104
- package/dist/detectors.js.map +0 -1
- package/dist/discovery.d.ts +0 -249
- package/dist/discovery.d.ts.map +0 -1
- package/dist/discovery.js +0 -455
- package/dist/discovery.js.map +0 -1
- package/dist/effectiveGraph.d.ts +0 -240
- package/dist/effectiveGraph.d.ts.map +0 -1
- package/dist/effectiveGraph.js +0 -523
- package/dist/effectiveGraph.js.map +0 -1
- package/dist/failures.d.ts +0 -50
- package/dist/failures.d.ts.map +0 -1
- package/dist/failures.js +0 -125
- package/dist/failures.js.map +0 -1
- package/dist/graph.d.ts +0 -47
- package/dist/graph.d.ts.map +0 -1
- package/dist/graph.js +0 -230
- package/dist/graph.js.map +0 -1
- package/dist/index.d.ts +0 -21
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -38
- package/dist/index.js.map +0 -1
- package/dist/queries.d.ts +0 -102
- package/dist/queries.d.ts.map +0 -1
- package/dist/queries.js +0 -469
- package/dist/queries.js.map +0 -1
- package/dist/ranges.d.ts +0 -71
- package/dist/ranges.d.ts.map +0 -1
- package/dist/ranges.js +0 -322
- package/dist/ranges.js.map +0 -1
- package/dist/resolveField.d.ts +0 -125
- package/dist/resolveField.d.ts.map +0 -1
- package/dist/resolveField.js +0 -234
- package/dist/resolveField.js.map +0 -1
- package/dist/tier1Service.d.ts +0 -96
- package/dist/tier1Service.d.ts.map +0 -1
- package/dist/tier1Service.js +0 -194
- package/dist/tier1Service.js.map +0 -1
- package/dist/tier2Service.d.ts +0 -195
- package/dist/tier2Service.d.ts.map +0 -1
- package/dist/tier2Service.js +0 -642
- package/dist/tier2Service.js.map +0 -1
- package/dist/yamlScalar.d.ts +0 -17
- package/dist/yamlScalar.d.ts.map +0 -1
- package/dist/yamlScalar.js +0 -101
- package/dist/yamlScalar.js.map +0 -1
package/dist/tier2Service.d.ts
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,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