pi-ghost-autocomplete 0.3.2 → 0.4.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 (168) hide show
  1. package/LICENSE +561 -0
  2. package/README.md +464 -331
  3. package/dist/bench-cli.js +1 -123
  4. package/dist/bench.d.ts +7 -3
  5. package/dist/bench.js +1 -522
  6. package/dist/config.d.ts +4 -1
  7. package/dist/context-aggregator.d.ts +4 -1
  8. package/dist/cycle-manager.d.ts +2 -21
  9. package/dist/entropy-stop.d.ts +4 -1
  10. package/dist/eval-dataset.d.ts +2 -13
  11. package/dist/fuzzy-matcher.d.ts +4 -1
  12. package/dist/ghost-editor.d.ts +11 -2
  13. package/dist/index.d.ts +4 -1
  14. package/dist/index.js +1 -289
  15. package/dist/intent.d.ts +179 -0
  16. package/dist/metrics.d.ts +4 -1
  17. package/dist/path-index.d.ts +4 -1
  18. package/dist/path-matcher.d.ts +4 -1
  19. package/dist/profile-store.d.ts +4 -1
  20. package/dist/profile.d.ts +2 -20
  21. package/dist/providers/cloud-provider.d.ts +4 -1
  22. package/dist/providers/local-provider.d.ts +4 -1
  23. package/dist/providers/openai-compat-provider.d.ts +24 -1
  24. package/dist/providers/race.d.ts +4 -1
  25. package/dist/providers/types.d.ts +13 -1
  26. package/dist/recent-paths.d.ts +4 -1
  27. package/dist/replay-cli.js +1 -166
  28. package/dist/replay.d.ts +2 -7
  29. package/package.json +90 -80
  30. package/dist/bench-cli.d.ts +0 -3
  31. package/dist/bench-cli.d.ts.map +0 -1
  32. package/dist/bench-cli.js.map +0 -1
  33. package/dist/bench.d.ts.map +0 -1
  34. package/dist/bench.js.map +0 -1
  35. package/dist/cache.d.ts +0 -124
  36. package/dist/cache.d.ts.map +0 -1
  37. package/dist/cache.js +0 -173
  38. package/dist/cache.js.map +0 -1
  39. package/dist/candidate-rerank.d.ts +0 -57
  40. package/dist/candidate-rerank.d.ts.map +0 -1
  41. package/dist/candidate-rerank.js +0 -78
  42. package/dist/candidate-rerank.js.map +0 -1
  43. package/dist/config.d.ts.map +0 -1
  44. package/dist/config.js +0 -317
  45. package/dist/config.js.map +0 -1
  46. package/dist/context-aggregator.d.ts.map +0 -1
  47. package/dist/context-aggregator.js +0 -87
  48. package/dist/context-aggregator.js.map +0 -1
  49. package/dist/context-selector.d.ts +0 -128
  50. package/dist/context-selector.d.ts.map +0 -1
  51. package/dist/context-selector.js +0 -300
  52. package/dist/context-selector.js.map +0 -1
  53. package/dist/cycle-manager.d.ts.map +0 -1
  54. package/dist/cycle-manager.js +0 -168
  55. package/dist/cycle-manager.js.map +0 -1
  56. package/dist/edit-history-ring.d.ts +0 -148
  57. package/dist/edit-history-ring.d.ts.map +0 -1
  58. package/dist/edit-history-ring.js +0 -262
  59. package/dist/edit-history-ring.js.map +0 -1
  60. package/dist/entropy-stop.d.ts.map +0 -1
  61. package/dist/entropy-stop.js +0 -141
  62. package/dist/entropy-stop.js.map +0 -1
  63. package/dist/eval-dataset.d.ts.map +0 -1
  64. package/dist/eval-dataset.js +0 -127
  65. package/dist/eval-dataset.js.map +0 -1
  66. package/dist/fast-path-engine.d.ts +0 -286
  67. package/dist/fast-path-engine.d.ts.map +0 -1
  68. package/dist/fast-path-engine.js +0 -341
  69. package/dist/fast-path-engine.js.map +0 -1
  70. package/dist/fuzzy-matcher.d.ts.map +0 -1
  71. package/dist/fuzzy-matcher.js +0 -162
  72. package/dist/fuzzy-matcher.js.map +0 -1
  73. package/dist/ghost-editor.d.ts.map +0 -1
  74. package/dist/ghost-editor.js +0 -1491
  75. package/dist/ghost-editor.js.map +0 -1
  76. package/dist/index.d.ts.map +0 -1
  77. package/dist/index.js.map +0 -1
  78. package/dist/keystroke-timer.d.ts +0 -59
  79. package/dist/keystroke-timer.d.ts.map +0 -1
  80. package/dist/keystroke-timer.js +0 -94
  81. package/dist/keystroke-timer.js.map +0 -1
  82. package/dist/metrics-builder.d.ts +0 -71
  83. package/dist/metrics-builder.d.ts.map +0 -1
  84. package/dist/metrics-builder.js +0 -71
  85. package/dist/metrics-builder.js.map +0 -1
  86. package/dist/metrics.d.ts.map +0 -1
  87. package/dist/metrics.js +0 -212
  88. package/dist/metrics.js.map +0 -1
  89. package/dist/path-index.d.ts.map +0 -1
  90. package/dist/path-index.js +0 -148
  91. package/dist/path-index.js.map +0 -1
  92. package/dist/path-matcher.d.ts.map +0 -1
  93. package/dist/path-matcher.js +0 -88
  94. package/dist/path-matcher.js.map +0 -1
  95. package/dist/profile-store.d.ts.map +0 -1
  96. package/dist/profile-store.js +0 -199
  97. package/dist/profile-store.js.map +0 -1
  98. package/dist/profile.d.ts.map +0 -1
  99. package/dist/profile.js +0 -434
  100. package/dist/profile.js.map +0 -1
  101. package/dist/providers/cloud-provider.d.ts.map +0 -1
  102. package/dist/providers/cloud-provider.js +0 -109
  103. package/dist/providers/cloud-provider.js.map +0 -1
  104. package/dist/providers/local-provider.d.ts.map +0 -1
  105. package/dist/providers/local-provider.js +0 -48
  106. package/dist/providers/local-provider.js.map +0 -1
  107. package/dist/providers/openai-compat-provider.d.ts.map +0 -1
  108. package/dist/providers/openai-compat-provider.js +0 -215
  109. package/dist/providers/openai-compat-provider.js.map +0 -1
  110. package/dist/providers/openai-completions-runner.d.ts +0 -52
  111. package/dist/providers/openai-completions-runner.d.ts.map +0 -1
  112. package/dist/providers/openai-completions-runner.js +0 -141
  113. package/dist/providers/openai-completions-runner.js.map +0 -1
  114. package/dist/providers/race.d.ts.map +0 -1
  115. package/dist/providers/race.js +0 -441
  116. package/dist/providers/race.js.map +0 -1
  117. package/dist/providers/truncate.d.ts +0 -7
  118. package/dist/providers/truncate.d.ts.map +0 -1
  119. package/dist/providers/truncate.js +0 -57
  120. package/dist/providers/truncate.js.map +0 -1
  121. package/dist/providers/types.d.ts.map +0 -1
  122. package/dist/providers/types.js +0 -60
  123. package/dist/providers/types.js.map +0 -1
  124. package/dist/provisional-manager.d.ts +0 -93
  125. package/dist/provisional-manager.d.ts.map +0 -1
  126. package/dist/provisional-manager.js +0 -98
  127. package/dist/provisional-manager.js.map +0 -1
  128. package/dist/provisional.d.ts +0 -150
  129. package/dist/provisional.d.ts.map +0 -1
  130. package/dist/provisional.js +0 -238
  131. package/dist/provisional.js.map +0 -1
  132. package/dist/recent-paths.d.ts.map +0 -1
  133. package/dist/recent-paths.js +0 -114
  134. package/dist/recent-paths.js.map +0 -1
  135. package/dist/regret-tracker.d.ts +0 -84
  136. package/dist/regret-tracker.d.ts.map +0 -1
  137. package/dist/regret-tracker.js +0 -145
  138. package/dist/regret-tracker.js.map +0 -1
  139. package/dist/replay-cli.d.ts +0 -13
  140. package/dist/replay-cli.d.ts.map +0 -1
  141. package/dist/replay-cli.js.map +0 -1
  142. package/dist/replay.d.ts.map +0 -1
  143. package/dist/replay.js +0 -225
  144. package/dist/replay.js.map +0 -1
  145. package/dist/reranker.d.ts +0 -181
  146. package/dist/reranker.d.ts.map +0 -1
  147. package/dist/reranker.js +0 -324
  148. package/dist/reranker.js.map +0 -1
  149. package/dist/session-trie.d.ts +0 -103
  150. package/dist/session-trie.d.ts.map +0 -1
  151. package/dist/session-trie.js +0 -280
  152. package/dist/session-trie.js.map +0 -1
  153. package/dist/speculative.d.ts +0 -74
  154. package/dist/speculative.d.ts.map +0 -1
  155. package/dist/speculative.js +0 -107
  156. package/dist/speculative.js.map +0 -1
  157. package/dist/tool-summarize.d.ts +0 -40
  158. package/dist/tool-summarize.d.ts.map +0 -1
  159. package/dist/tool-summarize.js +0 -245
  160. package/dist/tool-summarize.js.map +0 -1
  161. package/dist/trie-sanitize.d.ts +0 -22
  162. package/dist/trie-sanitize.d.ts.map +0 -1
  163. package/dist/trie-sanitize.js +0 -142
  164. package/dist/trie-sanitize.js.map +0 -1
  165. package/dist/versions.d.ts +0 -23
  166. package/dist/versions.d.ts.map +0 -1
  167. package/dist/versions.js +0 -31
  168. package/dist/versions.js.map +0 -1
@@ -1,286 +0,0 @@
1
- /**
2
- * Fast-path engine: owns the three sync ghost sources (session trie,
3
- * completion cache, speculative-warm ring) and exposes a single lookup
4
- * that returns the winning hit or null. PRD §M1 + §M2.
5
- *
6
- * Also exposes `decideDeterministic` — a pure function that resolves
7
- * the path-prefix / fuzzy-filename decision used by the editor's
8
- * deterministic ghost path (PRD §M4 deterministic matchers).
9
- *
10
- * Refactor #57 slices 1 + 2. Extracted from `ghost-editor.ts` to reduce
11
- * the editor's responsibility surface. The engine is state-only — it
12
- * does not touch the editor's render or metric pipeline; callers feed
13
- * it fingerprints and read the result.
14
- *
15
- * Mutation methods (set/delete/insertFromAccept/penalize/...) are left
16
- * on the inner instances (`engine.cache`, `engine.trie`,
17
- * `engine.lastGhosts`) and accessed by the editor directly. Migrating
18
- * those into named methods is a follow-up slice; the win here is
19
- * consolidating the lookup ordering in one place so it can be unit
20
- * tested without spinning up the editor.
21
- *
22
- * Remaining #57 slices: extract `applyDeterministic` mutation,
23
- * ProvisionalManager, CycleManager, MetricsBuilder. ghost-editor.ts
24
- * target: <800 LOC.
25
- */
26
- import { CompletionCache, type CacheValue } from "./cache.js";
27
- import { SessionTrie } from "./session-trie.js";
28
- import { LastGhostsRing, type LastGhost } from "./speculative.js";
29
- import type { CompletionMode } from "./metrics.js";
30
- import { type PathIndex } from "./path-index.js";
31
- import { type FuzzyBand } from "./fuzzy-matcher.js";
32
- import { EditHistoryRing, PreEditTextCache } from "./edit-history-ring.js";
33
- import { type ProvisionalPick, type ReconcileResult } from "./provisional-manager.js";
34
- import type { ProfileStore } from "./profile-store.js";
35
- /**
36
- * Result of a successful fast-path lookup. Shape intentionally mirrors
37
- * the legacy inline-construction in `GhostEditor.handleTextChange` so
38
- * the editor's `applyServedGhost` call site is unchanged.
39
- *
40
- * `cacheKey` is `undefined` for trie hits (the trie keys on raw prefix,
41
- * not on the cache key) and a hex digest for cache/speculative hits.
42
- */
43
- export interface FastPathHit {
44
- ghost: string;
45
- mode: CompletionMode;
46
- providerName: string;
47
- cacheKey: string | undefined;
48
- }
49
- export interface FastPathLookupContext {
50
- contextFingerprint: string;
51
- providerFingerprint: string;
52
- versionFingerprint: string;
53
- /** Engine config fingerprint folded into the cache key + warm-path
54
- * match. Optional — when omitted, the engine substitutes its own
55
- * `getConfigFingerprint()` so callers get knob-change invalidation
56
- * by default. */
57
- configFingerprint?: string;
58
- cooldownActive: boolean;
59
- /** Optional `Date.now()` override for deterministic tests. */
60
- now?: number;
61
- }
62
- /**
63
- * Bundled view of every `PI_GHOST_*` env knob that affects lookup,
64
- * provisional, rerank, or context selection. Captured once at engine
65
- * construction so downstream consumers can migrate off per-call
66
- * `process.env` reads incrementally.
67
- *
68
- * Phase 2 contract: this is **additive**. Existing call sites that still
69
- * read `process.env.PI_GHOST_*` continue to work — the values here are
70
- * the same strings the env exposed at construction time. Tests that
71
- * mutate `process.env` between cases keep working against those call
72
- * sites; once a consumer is migrated to read from `engine.config`, that
73
- * test must construct a fresh engine.
74
- *
75
- * `editHistory` lives here too, surfaced from the same single env read
76
- * the ring already does. Other modules (config.ts provider envs,
77
- * metrics.ts logging envs, eval-dataset capture env) are out of scope —
78
- * they don't influence lookup ordering.
79
- */
80
- export interface FastPathEngineConfig {
81
- /** Raw `PI_GHOST_RERANK_WEIGHTS` (PRD §M3c). Parser in `reranker.ts`. */
82
- rerankWeightsRaw: string | undefined;
83
- /** Raw `PI_GHOST_MIN_CONFIDENCE` (PRD §M3c.1). Parser in `reranker.ts`. */
84
- minConfidenceRaw: string | undefined;
85
- /** Raw `PI_GHOST_PROVISIONAL` (PRD §M3.5b). Parser in `provisional.ts`. */
86
- provisionalRaw: string | undefined;
87
- /** Raw `PI_GHOST_PROVISIONAL_PREFER` (#6 swap-margin override). */
88
- provisionalPreferRaw: string | undefined;
89
- /** Raw `PI_GHOST_CONTEXT_BM25_WEIGHT` (PRD §M6b). */
90
- contextBm25WeightRaw: string | undefined;
91
- /** Raw `PI_GHOST_CONTEXT_EDIT_LOCALITY_WEIGHT` (#1 opt-in). */
92
- contextEditLocalityWeightRaw: string | undefined;
93
- /** Raw `PI_GHOST_CONTEXT_TOOL_MAX` (PRD §M6c). */
94
- contextToolMaxRaw: string | undefined;
95
- /** Raw `PI_GHOST_SHORT_HOVER_MS` (#3 short-hover-dismiss threshold). */
96
- shortHoverMsRaw: string | undefined;
97
- /** Raw `PI_GHOST_REGRET_WINDOW_MS` (PRD §M5a regret window). */
98
- regretWindowMsRaw: string | undefined;
99
- /** Raw `PI_GHOST_EVAL_CAPTURE` (PRD §M5c eval capture opt-in). */
100
- evalCaptureRaw: string | undefined;
101
- /** Edit-history (#1) — pre-parsed because the engine itself owns the ring. */
102
- editHistory: {
103
- enabled: boolean;
104
- capacity: number;
105
- maxAgeMs: number;
106
- halfLifeMs: number;
107
- };
108
- }
109
- /**
110
- * Optional env source. Defaults to `process.env`. Tests can pass a fixed
111
- * `Record<string, string | undefined>` to construct an engine with a
112
- * specific knob state, no global mutation required.
113
- */
114
- export type EngineEnvSource = Record<string, string | undefined>;
115
- /**
116
- * Build the bundled config snapshot. Reads each knob once. Exported so
117
- * tests + diag can compute the same fingerprint deterministically.
118
- */
119
- export declare function buildFastPathEngineConfig(env?: EngineEnvSource): FastPathEngineConfig;
120
- /**
121
- * Stable fingerprint over the bundled config. Suitable for folding into
122
- * cache keys so a knob change (e.g. swapping rerank weights mid-session)
123
- * invalidates affected entries. Field ordering is the JSON ordering
124
- * above; do not reorder without bumping the fingerprint version.
125
- */
126
- export declare function fingerprintFastPathEngineConfig(cfg: FastPathEngineConfig): string;
127
- export declare class FastPathEngine {
128
- readonly cache: CompletionCache;
129
- readonly trie: SessionTrie;
130
- readonly lastGhosts: LastGhostsRing;
131
- /**
132
- * Enhancement #1 — edit-history ring + pre-edit text cache. Capacity /
133
- * decay parameters read once at construction from
134
- * `PI_GHOST_EDIT_HISTORY*` env. The `enabled` flag is the master
135
- * switch: when false the editor skips `record()` (zero overhead) and
136
- * skips injecting an `editProximityScorer` into the reranker.
137
- */
138
- readonly editHistory: EditHistoryRing;
139
- readonly preEditCache: PreEditTextCache;
140
- readonly editHistoryEnabled: boolean;
141
- /**
142
- * PRD §M4 — workspace path index used by the deterministic matchers
143
- * (`decideDeterministic`). `null` until the editor's async indexer
144
- * resolves; the deterministic step is skipped in that window.
145
- */
146
- private pathIndex;
147
- /** Phase 2 — bundled env snapshot. Consumers migrate to read from here
148
- * instead of `process.env` over time. Immutable for an engine's lifetime. */
149
- readonly config: FastPathEngineConfig;
150
- private readonly configFingerprintCached;
151
- /**
152
- * PRD §M3.5b — provisional ghost manager. Owned by the engine so the
153
- * `picker` closure can be built from the engine's own trie + lastGhosts
154
- * without the editor having to reach in. The editor still supplies the
155
- * `canRender` predicate (editor-state) and `onShow` callback (UI mutator).
156
- */
157
- private readonly provisional;
158
- constructor(env?: EngineEnvSource);
159
- /**
160
- * Stable fingerprint over the bundled env config. Suitable for folding
161
- * into cache keys so a knob change invalidates affected entries. See
162
- * `fingerprintFastPathEngineConfig` for the field-ordering contract.
163
- */
164
- getConfigFingerprint(): string;
165
- /**
166
- * Install or replace the workspace path index. Called once at editor
167
- * startup after the async indexer resolves; may be re-called with
168
- * `null` to disable deterministic matching (test / shutdown path).
169
- */
170
- setPathIndex(pi: PathIndex | null): void;
171
- getPathIndex(): PathIndex | null;
172
- /** PRD §M2 — seed (prefix, ghost) into the session trie after an accept. */
173
- recordAccept(prefix: string, ghost: string, weight: number): void;
174
- /** PRD §M2 / #5 — apply a negative-signal penalty to a (prefix, ghost) pair. */
175
- penalize(prefix: string, ghost: string, magnitude: number): void;
176
- /** PRD §M1a — write a completed ghost into the cache keyed on `cacheKey`. */
177
- setCacheEntry(cacheKey: string, value: CacheValue): void;
178
- /** PRD §M1a — evict a single cache entry on a non-accept outcome. */
179
- deleteCacheEntry(cacheKey: string): void;
180
- /** PRD §M1b — record a shown ghost into the speculative-warm ring. */
181
- recordRecentGhost(entry: LastGhost): void;
182
- /**
183
- * PRD §M3.5b — arm a provisional ghost. Engine reads
184
- * `PI_GHOST_PROVISIONAL` from the bundled config; no-op when disabled.
185
- * The engine builds the `picker` from its own `trie` + `lastGhosts` +
186
- * caller's profile. Editor supplies the `canRender` predicate
187
- * (editor-state) and `onShow` callback (UI mutator).
188
- */
189
- armProvisional(input: {
190
- prefix: string;
191
- debounceMs: number;
192
- profile: ProfileStore | null;
193
- canRender: () => boolean;
194
- onShow: (pick: ProvisionalPick) => void;
195
- }): void;
196
- /**
197
- * PRD §M3.5b — reconcile an LLM result against any displayed
198
- * provisional. Engine reads `PI_GHOST_PROVISIONAL_PREFER` from the
199
- * bundled config.
200
- */
201
- reconcileProvisional(input: {
202
- llm: {
203
- text: string;
204
- score: number;
205
- } | null;
206
- now: number;
207
- }): ReconcileResult;
208
- /** True iff a provisional pick is currently displayed. */
209
- isProvisionalShown(): boolean;
210
- /** Cancel a pending provisional timer without touching the displayed pick. */
211
- cancelProvisionalTimer(): void;
212
- /** Reset provisional state (timer + displayed pick). */
213
- clearProvisional(): void;
214
- /**
215
- * Try, in order: session trie → completion cache → speculative warm.
216
- * Returns null when nothing matches. Lookup is sync and allocation-light;
217
- * fits inside a keystroke handler.
218
- *
219
- * `prefix` is the full pre-cursor text (multiline). The trie consults
220
- * only the last line (committed messages + accepts are seeded against
221
- * single-line prefixes). The cache/warm path consults the full prefix.
222
- */
223
- lookup(prefix: string, ctx: FastPathLookupContext): FastPathHit | null;
224
- /**
225
- * Deterministic-aware lookup. Runs `decideDeterministic` first (when
226
- * a `deterministic` input is supplied) and falls back to the standard
227
- * trie/cache/warm lookup. Returns a discriminated union so the caller
228
- * can route deterministic decisions through its `applyDeterministic`
229
- * mutator (different metrics path) while still using a single entry
230
- * point. Pass `deterministic: null` to skip the path-prefix/fuzzy
231
- * matchers (e.g., when an autocomplete popup is open).
232
- *
233
- * No editor state inside the engine — `deterministic` is supplied as a
234
- * fully-formed `DeterministicInput`, and the editor owns the eventual
235
- * mutation (`applyServedGhost` / `applyDeterministic`).
236
- */
237
- lookupWithDeterministic(prefix: string, ctx: FastPathLookupContext, deterministic: DeterministicInput | null): {
238
- kind: "deterministic";
239
- decision: DeterministicDecision;
240
- } | {
241
- kind: "fast-path";
242
- hit: FastPathHit;
243
- } | null;
244
- }
245
- /**
246
- * Result of a successful deterministic-matcher decision. The editor
247
- * applies this via `applyDeterministic()`. Pure — caller owns timing
248
- * (`startedAt`) and editor-state mutation.
249
- *
250
- * `replaceFrom` is non-null for fuzzy matches that replace a typed token
251
- * (e.g. `pkg.j` → `package.json`); null for path-prefix completions that
252
- * append to the cursor.
253
- */
254
- export interface DeterministicDecision {
255
- ghost: string;
256
- replaceFrom: {
257
- line: number;
258
- col: number;
259
- } | null;
260
- providerName: string;
261
- matchedPath: string;
262
- }
263
- export interface DeterministicInput {
264
- pathIndex: PathIndex;
265
- lineText: string;
266
- cursorLine: number;
267
- cursorCol: number;
268
- recentPaths: Set<string>;
269
- /** PRD §M4 — bounded boost from profile path-frequency. Null when no profile. */
270
- profileBoost: ((path: string) => number) | null;
271
- }
272
- /**
273
- * Resolve a deterministic ghost candidate from the active path index.
274
- * Tries path-prefix first (e.g. `src/co|` → `src/config.ts`), then
275
- * fuzzy-filename (e.g. `cfg|` → `config.ts` with replace).
276
- *
277
- * Pure function — does not consult `this`, autocomplete state, or
278
- * cursor mutation. The editor's `tryDeterministic` wraps this with the
279
- * `isShowingAutocomplete()` guard and the `applyDeterministic` mutation.
280
- *
281
- * Returns null when no candidate clears the score gates (≥70 fuzzy
282
- * baseline; ≥85 for non-action-trigger contexts).
283
- */
284
- export declare function decideDeterministic(input: DeterministicInput): DeterministicDecision | null;
285
- export declare function bandToProvider(band: FuzzyBand): string;
286
- //# sourceMappingURL=fast-path-engine.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fast-path-engine.d.ts","sourceRoot":"","sources":["../src/fast-path-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAE,eAAe,EAAkB,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE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IAIxB;;;;;;;;OAQG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,qBAAqB,GAAG,WAAW,GAAG,IAAI;IA6BtE;;;;;;;;;;;;OAYG;IACH,uBAAuB,CACtB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,qBAAqB,EAC1B,aAAa,EAAE,kBAAkB,GAAG,IAAI,GAEtC;QAAE,IAAI,EAAE,eAAe,CAAC;QAAC,QAAQ,EAAE,qBAAqB,CAAA;KAAE,GAC1D;QAAE,IAAI,EAAE,WAAW,CAAC;QAAC,GAAG,EAAE,WAAW,CAAA;KAAE,GACvC,IAAI;CASP;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAqB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAClD,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IAClC,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACzB,iFAAiF;IACjF,YAAY,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,IAAI,CAAC;CAChD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,kBAAkB,GAAG,qBAAqB,GAAG,IAAI,CAmC3F;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAStD"}
@@ -1,341 +0,0 @@
1
- /**
2
- * Fast-path engine: owns the three sync ghost sources (session trie,
3
- * completion cache, speculative-warm ring) and exposes a single lookup
4
- * that returns the winning hit or null. PRD §M1 + §M2.
5
- *
6
- * Also exposes `decideDeterministic` — a pure function that resolves
7
- * the path-prefix / fuzzy-filename decision used by the editor's
8
- * deterministic ghost path (PRD §M4 deterministic matchers).
9
- *
10
- * Refactor #57 slices 1 + 2. Extracted from `ghost-editor.ts` to reduce
11
- * the editor's responsibility surface. The engine is state-only — it
12
- * does not touch the editor's render or metric pipeline; callers feed
13
- * it fingerprints and read the result.
14
- *
15
- * Mutation methods (set/delete/insertFromAccept/penalize/...) are left
16
- * on the inner instances (`engine.cache`, `engine.trie`,
17
- * `engine.lastGhosts`) and accessed by the editor directly. Migrating
18
- * those into named methods is a follow-up slice; the win here is
19
- * consolidating the lookup ordering in one place so it can be unit
20
- * tested without spinning up the editor.
21
- *
22
- * Remaining #57 slices: extract `applyDeterministic` mutation,
23
- * ProvisionalManager, CycleManager, MetricsBuilder. ghost-editor.ts
24
- * target: <800 LOC.
25
- */
26
- import { createHash } from "node:crypto";
27
- import { CompletionCache, decideWarmPath } from "./cache.js";
28
- import { SessionTrie } from "./session-trie.js";
29
- import { LastGhostsRing } from "./speculative.js";
30
- import { extractPathPrefixToken, findPathPrefix } from "./path-matcher.js";
31
- import { extractFuzzyToken, findFuzzyFilename } from "./fuzzy-matcher.js";
32
- import { EditHistoryRing, PreEditTextCache, readEditHistoryEnv, } from "./edit-history-ring.js";
33
- import { pickProvisional, provisionalDelayMs, ProvisionalManager, } from "./provisional-manager.js";
34
- import { parseProvisionalEnv } from "./provisional.js";
35
- /**
36
- * Build the bundled config snapshot. Reads each knob once. Exported so
37
- * tests + diag can compute the same fingerprint deterministically.
38
- */
39
- export function buildFastPathEngineConfig(env = process.env) {
40
- const editHistory = readEditHistoryEnv(env);
41
- return {
42
- rerankWeightsRaw: env.PI_GHOST_RERANK_WEIGHTS,
43
- minConfidenceRaw: env.PI_GHOST_MIN_CONFIDENCE,
44
- provisionalRaw: env.PI_GHOST_PROVISIONAL,
45
- provisionalPreferRaw: env.PI_GHOST_PROVISIONAL_PREFER,
46
- contextBm25WeightRaw: env.PI_GHOST_CONTEXT_BM25_WEIGHT,
47
- contextEditLocalityWeightRaw: env.PI_GHOST_CONTEXT_EDIT_LOCALITY_WEIGHT,
48
- contextToolMaxRaw: env.PI_GHOST_CONTEXT_TOOL_MAX,
49
- shortHoverMsRaw: env.PI_GHOST_SHORT_HOVER_MS,
50
- regretWindowMsRaw: env.PI_GHOST_REGRET_WINDOW_MS,
51
- evalCaptureRaw: env.PI_GHOST_EVAL_CAPTURE,
52
- editHistory: {
53
- enabled: editHistory.enabled,
54
- capacity: editHistory.capacity,
55
- maxAgeMs: editHistory.maxAgeMs,
56
- halfLifeMs: editHistory.halfLifeMs,
57
- },
58
- };
59
- }
60
- /**
61
- * Stable fingerprint over the bundled config. Suitable for folding into
62
- * cache keys so a knob change (e.g. swapping rerank weights mid-session)
63
- * invalidates affected entries. Field ordering is the JSON ordering
64
- * above; do not reorder without bumping the fingerprint version.
65
- */
66
- export function fingerprintFastPathEngineConfig(cfg) {
67
- const h = createHash("sha1");
68
- h.update(JSON.stringify([
69
- "fpe-cfg-v1",
70
- cfg.rerankWeightsRaw ?? "",
71
- cfg.minConfidenceRaw ?? "",
72
- cfg.provisionalRaw ?? "",
73
- cfg.provisionalPreferRaw ?? "",
74
- cfg.contextBm25WeightRaw ?? "",
75
- cfg.contextEditLocalityWeightRaw ?? "",
76
- cfg.contextToolMaxRaw ?? "",
77
- cfg.shortHoverMsRaw ?? "",
78
- cfg.regretWindowMsRaw ?? "",
79
- cfg.evalCaptureRaw ?? "",
80
- cfg.editHistory.enabled,
81
- cfg.editHistory.capacity,
82
- cfg.editHistory.maxAgeMs,
83
- cfg.editHistory.halfLifeMs,
84
- ]));
85
- return h.digest("hex").slice(0, 16);
86
- }
87
- export class FastPathEngine {
88
- cache = new CompletionCache();
89
- trie = new SessionTrie();
90
- lastGhosts = new LastGhostsRing();
91
- /**
92
- * Enhancement #1 — edit-history ring + pre-edit text cache. Capacity /
93
- * decay parameters read once at construction from
94
- * `PI_GHOST_EDIT_HISTORY*` env. The `enabled` flag is the master
95
- * switch: when false the editor skips `record()` (zero overhead) and
96
- * skips injecting an `editProximityScorer` into the reranker.
97
- */
98
- editHistory;
99
- preEditCache = new PreEditTextCache();
100
- editHistoryEnabled;
101
- /**
102
- * PRD §M4 — workspace path index used by the deterministic matchers
103
- * (`decideDeterministic`). `null` until the editor's async indexer
104
- * resolves; the deterministic step is skipped in that window.
105
- */
106
- pathIndex = null;
107
- /** Phase 2 — bundled env snapshot. Consumers migrate to read from here
108
- * instead of `process.env` over time. Immutable for an engine's lifetime. */
109
- config;
110
- configFingerprintCached;
111
- /**
112
- * PRD §M3.5b — provisional ghost manager. Owned by the engine so the
113
- * `picker` closure can be built from the engine's own trie + lastGhosts
114
- * without the editor having to reach in. The editor still supplies the
115
- * `canRender` predicate (editor-state) and `onShow` callback (UI mutator).
116
- */
117
- provisional = new ProvisionalManager();
118
- constructor(env = process.env) {
119
- this.config = buildFastPathEngineConfig(env);
120
- this.editHistoryEnabled = this.config.editHistory.enabled;
121
- this.editHistory = new EditHistoryRing({
122
- capacity: this.config.editHistory.capacity,
123
- maxAgeMs: this.config.editHistory.maxAgeMs,
124
- halfLifeMs: this.config.editHistory.halfLifeMs,
125
- });
126
- this.configFingerprintCached = fingerprintFastPathEngineConfig(this.config);
127
- }
128
- /**
129
- * Stable fingerprint over the bundled env config. Suitable for folding
130
- * into cache keys so a knob change invalidates affected entries. See
131
- * `fingerprintFastPathEngineConfig` for the field-ordering contract.
132
- */
133
- getConfigFingerprint() {
134
- return this.configFingerprintCached;
135
- }
136
- /**
137
- * Install or replace the workspace path index. Called once at editor
138
- * startup after the async indexer resolves; may be re-called with
139
- * `null` to disable deterministic matching (test / shutdown path).
140
- */
141
- setPathIndex(pi) {
142
- this.pathIndex = pi;
143
- }
144
- getPathIndex() {
145
- return this.pathIndex;
146
- }
147
- // === Mutation wrappers (refactor #57 slice A) =========================
148
- // Editor goes through these instead of reaching into trie/cache/lastGhosts
149
- // directly. Each method maps 1:1 to a single inner-instance call — no
150
- // new logic, just a stable surface so future refactors (e.g. swapping
151
- // the trie implementation) don't ripple through `ghost-editor.ts`.
152
- /** PRD §M2 — seed (prefix, ghost) into the session trie after an accept. */
153
- recordAccept(prefix, ghost, weight) {
154
- this.trie.insertFromAccept(prefix, ghost, weight);
155
- }
156
- /** PRD §M2 / #5 — apply a negative-signal penalty to a (prefix, ghost) pair. */
157
- penalize(prefix, ghost, magnitude) {
158
- this.trie.penalize(prefix, ghost, magnitude);
159
- }
160
- /** PRD §M1a — write a completed ghost into the cache keyed on `cacheKey`. */
161
- setCacheEntry(cacheKey, value) {
162
- this.cache.set(cacheKey, value);
163
- }
164
- /** PRD §M1a — evict a single cache entry on a non-accept outcome. */
165
- deleteCacheEntry(cacheKey) {
166
- this.cache.delete(cacheKey);
167
- }
168
- /** PRD §M1b — record a shown ghost into the speculative-warm ring. */
169
- recordRecentGhost(entry) {
170
- this.lastGhosts.push(entry);
171
- }
172
- // === Provisional surface (refactor #57 phase 3) =======================
173
- /**
174
- * PRD §M3.5b — arm a provisional ghost. Engine reads
175
- * `PI_GHOST_PROVISIONAL` from the bundled config; no-op when disabled.
176
- * The engine builds the `picker` from its own `trie` + `lastGhosts` +
177
- * caller's profile. Editor supplies the `canRender` predicate
178
- * (editor-state) and `onShow` callback (UI mutator).
179
- */
180
- armProvisional(input) {
181
- if (!parseProvisionalEnv(this.config.provisionalRaw))
182
- return;
183
- this.provisional.arm({
184
- prefix: input.prefix,
185
- delayMs: provisionalDelayMs(input.debounceMs),
186
- canRender: input.canRender,
187
- picker: () => pickProvisional({
188
- prefix: input.prefix,
189
- trie: this.trie,
190
- profile: input.profile,
191
- lastGhosts: this.lastGhosts,
192
- }),
193
- onShow: input.onShow,
194
- });
195
- }
196
- /**
197
- * PRD §M3.5b — reconcile an LLM result against any displayed
198
- * provisional. Engine reads `PI_GHOST_PROVISIONAL_PREFER` from the
199
- * bundled config.
200
- */
201
- reconcileProvisional(input) {
202
- return this.provisional.reconcile({
203
- llm: input.llm,
204
- swapMarginEnvRaw: this.config.provisionalPreferRaw,
205
- now: input.now,
206
- });
207
- }
208
- /** True iff a provisional pick is currently displayed. */
209
- isProvisionalShown() {
210
- return this.provisional.isShown;
211
- }
212
- /** Cancel a pending provisional timer without touching the displayed pick. */
213
- cancelProvisionalTimer() {
214
- this.provisional.cancelTimer();
215
- }
216
- /** Reset provisional state (timer + displayed pick). */
217
- clearProvisional() {
218
- this.provisional.clear();
219
- }
220
- /**
221
- * Try, in order: session trie → completion cache → speculative warm.
222
- * Returns null when nothing matches. Lookup is sync and allocation-light;
223
- * fits inside a keystroke handler.
224
- *
225
- * `prefix` is the full pre-cursor text (multiline). The trie consults
226
- * only the last line (committed messages + accepts are seeded against
227
- * single-line prefixes). The cache/warm path consults the full prefix.
228
- */
229
- lookup(prefix, ctx) {
230
- const lastLine = prefix.split("\n").pop() ?? "";
231
- const trieHit = this.trie.lookup(lastLine);
232
- if (trieHit) {
233
- return {
234
- ghost: trieHit.ghost,
235
- mode: "trie",
236
- providerName: "session-trie",
237
- cacheKey: undefined,
238
- };
239
- }
240
- // Default the config fingerprint to the engine's own snapshot —
241
- // callers get knob-change cache invalidation automatically. An
242
- // explicit `ctx.configFingerprint` (e.g. tests) overrides.
243
- const configFingerprint = ctx.configFingerprint ?? this.configFingerprintCached;
244
- const warm = decideWarmPath({
245
- cache: this.cache,
246
- ring: this.lastGhosts,
247
- prefix,
248
- contextFingerprint: ctx.contextFingerprint,
249
- providerFingerprint: ctx.providerFingerprint,
250
- versionFingerprint: ctx.versionFingerprint,
251
- configFingerprint,
252
- cooldownActive: ctx.cooldownActive,
253
- ...(ctx.now !== undefined ? { now: ctx.now } : {}),
254
- });
255
- return warm ?? null;
256
- }
257
- /**
258
- * Deterministic-aware lookup. Runs `decideDeterministic` first (when
259
- * a `deterministic` input is supplied) and falls back to the standard
260
- * trie/cache/warm lookup. Returns a discriminated union so the caller
261
- * can route deterministic decisions through its `applyDeterministic`
262
- * mutator (different metrics path) while still using a single entry
263
- * point. Pass `deterministic: null` to skip the path-prefix/fuzzy
264
- * matchers (e.g., when an autocomplete popup is open).
265
- *
266
- * No editor state inside the engine — `deterministic` is supplied as a
267
- * fully-formed `DeterministicInput`, and the editor owns the eventual
268
- * mutation (`applyServedGhost` / `applyDeterministic`).
269
- */
270
- lookupWithDeterministic(prefix, ctx, deterministic) {
271
- if (deterministic) {
272
- const decision = decideDeterministic(deterministic);
273
- if (decision)
274
- return { kind: "deterministic", decision };
275
- }
276
- const hit = this.lookup(prefix, ctx);
277
- if (hit)
278
- return { kind: "fast-path", hit };
279
- return null;
280
- }
281
- }
282
- /**
283
- * Resolve a deterministic ghost candidate from the active path index.
284
- * Tries path-prefix first (e.g. `src/co|` → `src/config.ts`), then
285
- * fuzzy-filename (e.g. `cfg|` → `config.ts` with replace).
286
- *
287
- * Pure function — does not consult `this`, autocomplete state, or
288
- * cursor mutation. The editor's `tryDeterministic` wraps this with the
289
- * `isShowingAutocomplete()` guard and the `applyDeterministic` mutation.
290
- *
291
- * Returns null when no candidate clears the score gates (≥70 fuzzy
292
- * baseline; ≥85 for non-action-trigger contexts).
293
- */
294
- export function decideDeterministic(input) {
295
- const partial = input.lineText.slice(0, input.cursorCol);
296
- const pathTok = extractPathPrefixToken(partial);
297
- if (pathTok) {
298
- const m = findPathPrefix(input.pathIndex, pathTok.token, {
299
- recentPaths: input.recentPaths,
300
- profileBoost: input.profileBoost,
301
- });
302
- if (m) {
303
- return {
304
- ghost: m.suffix,
305
- replaceFrom: null,
306
- providerName: "path-prefix",
307
- matchedPath: m.match,
308
- };
309
- }
310
- }
311
- const fuzTok = extractFuzzyToken(input.lineText, input.cursorCol);
312
- if (!fuzTok)
313
- return null;
314
- const fm = findFuzzyFilename(input.pathIndex, fuzTok.token, {
315
- recentPaths: input.recentPaths,
316
- profileBoost: input.profileBoost,
317
- });
318
- if (!fm)
319
- return null;
320
- if (fm.score < 70)
321
- return null;
322
- if (fm.score < 85 && !fuzTok.hasActionTrigger)
323
- return null;
324
- return {
325
- ghost: fm.ghost,
326
- replaceFrom: fm.replace ? { line: input.cursorLine, col: fuzTok.startCol } : null,
327
- providerName: bandToProvider(fm.band),
328
- matchedPath: fm.match,
329
- };
330
- }
331
- export function bandToProvider(band) {
332
- switch (band) {
333
- case "basename-prefix":
334
- return "basename-prefix";
335
- case "fuzzy-basename":
336
- return "fuzzy-basename";
337
- case "fuzzy-path":
338
- return "fuzzy-path";
339
- }
340
- }
341
- //# sourceMappingURL=fast-path-engine.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fast-path-engine.js","sourceRoot":"","sources":["../src/fast-path-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAmB,MAAM,YAAY,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAkB,MAAM,kBAAkB,CAAC;AAGlE,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAkB,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC1F,OAAO,EACN,eAAe,EACf,gBAAgB,EAChB,kBAAkB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,eAAe,EACf,kBAAkB,EAClB,kBAAkB,GAGlB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAuFvD;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAuB,OAAO,CAAC,GAAG;IAC3E,MAAM,WAAW,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAC5C,OAAO;QACN,gBAAgB,EAAE,GAAG,CAAC,uBAAuB;QAC7C,gBAAgB,EAAE,GAAG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