@cortexkit/aft-bridge 0.49.3 → 0.50.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 (48) hide show
  1. package/dist/bridge.d.ts +7 -1
  2. package/dist/bridge.d.ts.map +1 -1
  3. package/dist/bridge.js +66 -4
  4. package/dist/bridge.js.map +1 -1
  5. package/dist/cache-paths.d.ts +26 -0
  6. package/dist/cache-paths.d.ts.map +1 -0
  7. package/dist/cache-paths.js +37 -0
  8. package/dist/cache-paths.js.map +1 -0
  9. package/dist/downloader.d.ts +2 -3
  10. package/dist/downloader.d.ts.map +1 -1
  11. package/dist/downloader.js +5 -13
  12. package/dist/downloader.js.map +1 -1
  13. package/dist/durable-log.d.ts +3 -1
  14. package/dist/durable-log.d.ts.map +1 -1
  15. package/dist/durable-log.js +4 -2
  16. package/dist/durable-log.js.map +1 -1
  17. package/dist/error-contract.d.ts +20 -0
  18. package/dist/error-contract.d.ts.map +1 -1
  19. package/dist/error-contract.js +84 -0
  20. package/dist/error-contract.js.map +1 -1
  21. package/dist/index.d.ts +3 -2
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +4 -3
  24. package/dist/index.js.map +1 -1
  25. package/dist/lifecycle-registry.d.ts +196 -0
  26. package/dist/lifecycle-registry.d.ts.map +1 -0
  27. package/dist/lifecycle-registry.js +471 -0
  28. package/dist/lifecycle-registry.js.map +1 -0
  29. package/dist/pool.d.ts +7 -7
  30. package/dist/pool.d.ts.map +1 -1
  31. package/dist/pool.js +36 -9
  32. package/dist/pool.js.map +1 -1
  33. package/dist/resolver.d.ts.map +1 -1
  34. package/dist/resolver.js +4 -11
  35. package/dist/resolver.js.map +1 -1
  36. package/dist/revivable-transport.d.ts +11 -0
  37. package/dist/revivable-transport.d.ts.map +1 -1
  38. package/dist/revivable-transport.js +44 -2
  39. package/dist/revivable-transport.js.map +1 -1
  40. package/dist/subc-transport.d.ts +220 -45
  41. package/dist/subc-transport.d.ts.map +1 -1
  42. package/dist/subc-transport.js +1025 -319
  43. package/dist/subc-transport.js.map +1 -1
  44. package/dist/transport-factory.d.ts +19 -0
  45. package/dist/transport-factory.d.ts.map +1 -1
  46. package/dist/transport-factory.js +71 -2
  47. package/dist/transport-factory.js.map +1 -1
  48. package/package.json +1 -1
@@ -0,0 +1,471 @@
1
+ import { lstat } from "node:fs/promises";
2
+ export function asCanonicalRootPath(root) {
3
+ return root;
4
+ }
5
+ export function asRootGeneration(generation) {
6
+ if (!Number.isSafeInteger(generation) || generation < 1) {
7
+ throw new RangeError("root generations must be positive safe integers");
8
+ }
9
+ return generation;
10
+ }
11
+ export function asConcretePoolId(id) {
12
+ return id;
13
+ }
14
+ export const DEFAULT_LIFECYCLE_INTERVAL_MS = 5 * 60 * 1000;
15
+ const DEFAULT_REALM = "default";
16
+ function rootKey(root) {
17
+ return root;
18
+ }
19
+ function resultMeansPresent(result) {
20
+ if (typeof result === "boolean")
21
+ return result;
22
+ if (typeof result === "object" && result !== null && "exists" in result) {
23
+ return result.exists !== false;
24
+ }
25
+ return true;
26
+ }
27
+ function isEnoent(error) {
28
+ return (typeof error === "object" &&
29
+ error !== null &&
30
+ "code" in error &&
31
+ error.code === "ENOENT");
32
+ }
33
+ function closeCounts(result) {
34
+ const teardown = typeof result === "object" && result !== null ? result : undefined;
35
+ const sessions = teardown?.tornDownSessionCount;
36
+ const facades = teardown?.tornDownFacadeCount;
37
+ return {
38
+ sessions: typeof sessions === "number" && Number.isFinite(sessions) ? Math.max(0, sessions) : 0,
39
+ facades: typeof facades === "number" && Number.isFinite(facades) ? Math.max(0, facades) : 0,
40
+ };
41
+ }
42
+ function defaultTimer() {
43
+ return {
44
+ setInterval(callback, delayMs) {
45
+ const handle = setInterval(callback, delayMs);
46
+ const maybeUnref = handle;
47
+ maybeUnref.unref?.();
48
+ return handle;
49
+ },
50
+ clearInterval(handle) {
51
+ clearInterval(handle);
52
+ },
53
+ };
54
+ }
55
+ /**
56
+ * One lifecycle registry per JavaScript module realm.
57
+ *
58
+ * The registry deliberately knows only the concrete pool's root-close seam. It
59
+ * owns root generations, absence observations, and transition ownership, while
60
+ * the concrete pool remains responsible for indexed session and route cleanup.
61
+ */
62
+ export class LifecycleRegistry {
63
+ realm;
64
+ intervalMs;
65
+ registrations = new Map();
66
+ registrationByPool = new WeakMap();
67
+ nextGenerationByRoot = new Map();
68
+ nextConcretePoolNumber = 1;
69
+ nextRegistrationSequence = 1;
70
+ timer;
71
+ statRoot;
72
+ demand;
73
+ onEvent;
74
+ intervalHandle = null;
75
+ sweepInFlight = null;
76
+ constructor(options = {}) {
77
+ this.realm = options.realm ?? DEFAULT_REALM;
78
+ this.intervalMs = options.intervalMs ?? DEFAULT_LIFECYCLE_INTERVAL_MS;
79
+ if (!Number.isFinite(this.intervalMs) || this.intervalMs <= 0) {
80
+ throw new RangeError("lifecycle interval must be a positive finite number");
81
+ }
82
+ const nativeTimer = defaultTimer();
83
+ this.timer =
84
+ options.timer ??
85
+ (options.setInterval || options.clearInterval
86
+ ? {
87
+ setInterval: options.setInterval ?? nativeTimer.setInterval,
88
+ clearInterval: options.clearInterval ?? nativeTimer.clearInterval,
89
+ }
90
+ : nativeTimer);
91
+ this.statRoot = options.stat ?? ((root) => lstat(root));
92
+ this.demand = options.demandCheck ?? (() => false);
93
+ this.onEvent = options.onEvent;
94
+ }
95
+ /** Register an unregistered concrete pool and permanently bind its reapingEnabled setting. */
96
+ registerLifecyclePool(pool, options) {
97
+ if (!pool || typeof pool.closeProjectRoot !== "function") {
98
+ throw new TypeError("a lifecycle pool must provide closeProjectRoot");
99
+ }
100
+ if (typeof options?.evictOuterFacade !== "function") {
101
+ throw new TypeError("lifecycle registration requires evictOuterFacade");
102
+ }
103
+ if (typeof options.reapingEnabled !== "boolean") {
104
+ throw new TypeError("reapingEnabled must be a boolean");
105
+ }
106
+ const previous = this.registrationByPool.get(pool);
107
+ if (previous?.active)
108
+ this.deregisterInternal(previous);
109
+ const concretePoolId = asConcretePoolId(`pool-${this.nextConcretePoolNumber++}`);
110
+ const registrationIdentity = Object.freeze({
111
+ concretePoolId,
112
+ registrationSequence: this.nextRegistrationSequence++,
113
+ });
114
+ const internal = {
115
+ pool,
116
+ concretePoolId,
117
+ registrationIdentity,
118
+ reapingEnabled: options.reapingEnabled,
119
+ evictOuterFacade: options.evictOuterFacade,
120
+ roots: new Map(),
121
+ handle: undefined,
122
+ active: true,
123
+ };
124
+ const handle = {
125
+ registrationIdentity,
126
+ identity: registrationIdentity,
127
+ get concretePoolId() {
128
+ return concretePoolId;
129
+ },
130
+ get reapingEnabled() {
131
+ return internal.reapingEnabled;
132
+ },
133
+ deregister: () => {
134
+ this.deregisterInternal(internal);
135
+ },
136
+ };
137
+ internal.handle = handle;
138
+ this.registrations.set(concretePoolId, internal);
139
+ this.registrationByPool.set(pool, internal);
140
+ this.refreshTimer();
141
+ return handle;
142
+ }
143
+ /** Functional form used by construction sites that keep a registry instance. */
144
+ registerPool(pool, options) {
145
+ return this.registerLifecyclePool(pool, options);
146
+ }
147
+ /** Register a root before its facade is exposed. Repeated live registration is idempotent. */
148
+ registerRoot(poolId, root) {
149
+ const registration = this.currentRegistration(poolId);
150
+ if (!registration)
151
+ throw new Error(`unknown lifecycle pool ${poolId}`);
152
+ const key = rootKey(root);
153
+ const existing = registration.roots.get(key);
154
+ if (existing?.state === "live")
155
+ return existing.generation;
156
+ if (existing && !existing.synchronousPhaseComplete) {
157
+ // This is only reachable through re-entrant code in the synchronous close
158
+ // phase. Exposing the old generation would permit resurrection, so callers
159
+ // must wait until that phase has finished and ask again.
160
+ throw new Error("root registration raced its synchronous close phase");
161
+ }
162
+ const next = (this.nextGenerationByRoot.get(`${poolId}\u0000${key}`) ?? 0) + 1;
163
+ this.nextGenerationByRoot.set(`${poolId}\u0000${key}`, next);
164
+ const entry = {
165
+ registration,
166
+ canonicalRoot: root,
167
+ generation: asRootGeneration(next),
168
+ state: "live",
169
+ consecutiveAbsences: 0,
170
+ tombstoned: false,
171
+ synchronousPhaseComplete: true,
172
+ closePromise: null,
173
+ eventEmitted: false,
174
+ cause: null,
175
+ };
176
+ registration.roots.set(key, entry);
177
+ return entry.generation;
178
+ }
179
+ /**
180
+ * Get an existing live generation without creating one. This is the only
181
+ * non-creating lookup used by status and background paths.
182
+ */
183
+ currentGeneration(poolId, root) {
184
+ return this.currentRoot(poolId, root)?.generation;
185
+ }
186
+ isTombstoned(poolId, root, generation) {
187
+ const entry = this.currentRoot(poolId, root);
188
+ return entry?.generation === generation && entry.tombstoned;
189
+ }
190
+ isCurrentRegistration(identity) {
191
+ const registration = this.registrations.get(identity.concretePoolId);
192
+ return registration?.active === true && registration.registrationIdentity === identity;
193
+ }
194
+ isCurrentLiveGeneration(poolId, root, generation) {
195
+ const entry = this.currentRoot(poolId, root);
196
+ return entry?.generation === generation && entry.state === "live";
197
+ }
198
+ getRootSnapshot(poolId, root) {
199
+ const entry = this.currentRoot(poolId, root);
200
+ return entry ? this.snapshotRoot(entry) : undefined;
201
+ }
202
+ /** Return only roots visible to lifecycle operations; tombstones are retained until close settles. */
203
+ rootSnapshots(poolId) {
204
+ const entries = poolId
205
+ ? [this.currentRegistration(poolId)].filter((registration) => registration != null)
206
+ : [...this.registrations.values()];
207
+ return entries.flatMap((registration) => [...registration.roots.values()].map((entry) => this.snapshotRoot(entry)));
208
+ }
209
+ snapshot() {
210
+ return {
211
+ realm: this.realm,
212
+ intervalMs: this.intervalMs,
213
+ timerActive: this.intervalHandle !== null,
214
+ registrations: [...this.registrations.values()].map((registration) => ({
215
+ concretePoolId: registration.concretePoolId,
216
+ reapingEnabled: registration.reapingEnabled,
217
+ roots: [...registration.roots.values()].map((entry) => this.snapshotRoot(entry)),
218
+ })),
219
+ };
220
+ }
221
+ /** Alias for callers that use status terminology. */
222
+ status() {
223
+ return this.snapshot();
224
+ }
225
+ /**
226
+ * Demand gate for initial and successor creation. A live root is returned
227
+ * without repeating the filesystem check; absent roots require a fresh positive
228
+ * result and then receive exactly one greater generation.
229
+ */
230
+ async ensureRootForDemand(poolId, root) {
231
+ const registration = this.currentRegistration(poolId);
232
+ if (!registration)
233
+ return undefined;
234
+ const existing = registration.roots.get(rootKey(root));
235
+ if (existing?.state === "live")
236
+ return existing.generation;
237
+ if (existing && !existing.synchronousPhaseComplete)
238
+ return undefined;
239
+ let result;
240
+ try {
241
+ result = await this.demand(root, poolId);
242
+ }
243
+ catch {
244
+ return undefined;
245
+ }
246
+ if (!resultMeansPresent(result))
247
+ return undefined;
248
+ const stillCurrent = this.currentRegistration(poolId);
249
+ if (stillCurrent !== registration)
250
+ return undefined;
251
+ const afterCheck = registration.roots.get(rootKey(root));
252
+ if (afterCheck?.state === "live")
253
+ return afterCheck.generation;
254
+ if (afterCheck && !afterCheck.synchronousPhaseComplete)
255
+ return undefined;
256
+ return this.registerRoot(poolId, root);
257
+ }
258
+ demandRoot(poolId, root) {
259
+ return this.ensureRootForDemand(poolId, root);
260
+ }
261
+ getBridgeDemand(poolId, root) {
262
+ return this.ensureRootForDemand(poolId, root);
263
+ }
264
+ /**
265
+ * Coordinate one generation's close. The live-to-reaping transition, tombstone,
266
+ * outer eviction, and concrete close invocation all happen before the returned
267
+ * promise can yield. Concurrent requests coalesce on the same close promise.
268
+ */
269
+ requestProjectRootClose(poolId, root, expectedGeneration, cause = "explicit") {
270
+ const registration = this.currentRegistration(poolId);
271
+ if (!registration)
272
+ return Promise.resolve();
273
+ const entry = registration.roots.get(rootKey(root));
274
+ if (!entry || entry.generation !== expectedGeneration)
275
+ return Promise.resolve();
276
+ if (entry.state === "reaping")
277
+ return entry.closePromise ?? Promise.resolve();
278
+ if (entry.state === "tombstoned")
279
+ return entry.closePromise ?? Promise.resolve();
280
+ entry.state = "reaping";
281
+ entry.tombstoned = true;
282
+ entry.cause = cause;
283
+ let closeResult;
284
+ try {
285
+ registration.evictOuterFacade(entry.canonicalRoot, entry.generation);
286
+ closeResult = registration.pool.closeProjectRoot(entry.canonicalRoot, entry.generation);
287
+ entry.synchronousPhaseComplete = true;
288
+ entry.state = "tombstoned";
289
+ }
290
+ catch (error) {
291
+ entry.synchronousPhaseComplete = true;
292
+ entry.state = "tombstoned";
293
+ const failed = Promise.reject(error);
294
+ entry.closePromise = failed.then(() => undefined, (failure) => {
295
+ this.finishRootClose(entry, undefined);
296
+ throw failure;
297
+ });
298
+ return entry.closePromise;
299
+ }
300
+ entry.closePromise = Promise.resolve(closeResult).then((result) => {
301
+ const counts = closeCounts(result);
302
+ this.finishRootClose(entry, counts);
303
+ }, (error) => {
304
+ this.finishRootClose(entry, undefined);
305
+ throw error;
306
+ });
307
+ return entry.closePromise;
308
+ }
309
+ /** Coalesce concurrent ticks and observe only enabled, live registrations. */
310
+ sweep() {
311
+ if (this.sweepInFlight)
312
+ return this.sweepInFlight;
313
+ const sweep = this.runSweep();
314
+ this.sweepInFlight = sweep;
315
+ sweep.then(() => {
316
+ if (this.sweepInFlight === sweep)
317
+ this.sweepInFlight = null;
318
+ }, () => {
319
+ if (this.sweepInFlight === sweep)
320
+ this.sweepInFlight = null;
321
+ });
322
+ return sweep;
323
+ }
324
+ /** Alias used by timer seams and tests. */
325
+ sweepNow() {
326
+ return this.sweep();
327
+ }
328
+ /** Emit a generation-rejection event when a lifecycle boundary refuses the expected generation. */
329
+ recordGenerationRejection(poolId, root, expectedGeneration, boundary) {
330
+ const currentGeneration = this.currentGeneration(poolId, root);
331
+ this.emit({
332
+ type: "subc_root_generation_rejected",
333
+ realm: this.realm,
334
+ concretePoolId: poolId,
335
+ canonicalRoot: root,
336
+ expectedGeneration,
337
+ currentGeneration,
338
+ boundary,
339
+ });
340
+ }
341
+ rejectGeneration(poolId, root, expectedGeneration, boundary) {
342
+ this.recordGenerationRejection(poolId, root, expectedGeneration, boundary);
343
+ }
344
+ async runSweep() {
345
+ const snapshots = [...this.registrations.values()]
346
+ .filter((registration) => registration.active && registration.reapingEnabled)
347
+ .flatMap((registration) => [...registration.roots.values()]
348
+ .filter((entry) => entry.state === "live")
349
+ .map((entry) => ({
350
+ concretePoolId: registration.concretePoolId,
351
+ canonicalRoot: entry.canonicalRoot,
352
+ generation: entry.generation,
353
+ })));
354
+ const closes = [];
355
+ await Promise.all(snapshots.map(async (snapshot) => {
356
+ let present = false;
357
+ try {
358
+ const result = await this.statRoot(snapshot.canonicalRoot, snapshot.concretePoolId, snapshot.generation);
359
+ present = resultMeansPresent(result);
360
+ }
361
+ catch (error) {
362
+ if (!isEnoent(error))
363
+ return;
364
+ }
365
+ const entry = this.currentRoot(snapshot.concretePoolId, snapshot.canonicalRoot);
366
+ if (!entry || entry.generation !== snapshot.generation || entry.state !== "live")
367
+ return;
368
+ if (present) {
369
+ entry.consecutiveAbsences = 0;
370
+ return;
371
+ }
372
+ entry.consecutiveAbsences += 1;
373
+ if (entry.consecutiveAbsences >= 2) {
374
+ closes.push(this.requestProjectRootClose(snapshot.concretePoolId, snapshot.canonicalRoot, snapshot.generation, "sweep"));
375
+ }
376
+ }));
377
+ await Promise.all(closes);
378
+ }
379
+ currentRegistration(poolId) {
380
+ const registration = this.registrations.get(poolId);
381
+ return registration?.active ? registration : undefined;
382
+ }
383
+ currentRoot(poolId, root) {
384
+ return this.currentRegistration(poolId)?.roots.get(rootKey(root));
385
+ }
386
+ snapshotRoot(entry) {
387
+ return {
388
+ concretePoolId: entry.registration.concretePoolId,
389
+ registrationIdentity: entry.registration.registrationIdentity,
390
+ canonicalRoot: entry.canonicalRoot,
391
+ generation: entry.generation,
392
+ state: entry.state,
393
+ consecutiveAbsences: entry.consecutiveAbsences,
394
+ };
395
+ }
396
+ finishRootClose(entry, counts) {
397
+ if (counts && !entry.eventEmitted) {
398
+ entry.eventEmitted = true;
399
+ this.emit({
400
+ type: "subc_root_reaped",
401
+ realm: this.realm,
402
+ concretePoolId: entry.registration.concretePoolId,
403
+ canonicalRoot: entry.canonicalRoot,
404
+ generation: entry.generation,
405
+ consecutiveAbsenceCount: entry.consecutiveAbsences,
406
+ tornDownSessionCount: counts.sessions,
407
+ tornDownFacadeCount: counts.facades,
408
+ cause: entry.cause ?? "explicit",
409
+ });
410
+ }
411
+ const registration = entry.registration;
412
+ if (registration.roots.get(rootKey(entry.canonicalRoot)) === entry) {
413
+ registration.roots.delete(rootKey(entry.canonicalRoot));
414
+ }
415
+ }
416
+ deregisterInternal(registration) {
417
+ if (!registration.active ||
418
+ this.registrations.get(registration.concretePoolId) !== registration) {
419
+ return;
420
+ }
421
+ for (const entry of [...registration.roots.values()]) {
422
+ if (entry.state === "live") {
423
+ const close = this.requestProjectRootClose(registration.concretePoolId, entry.canonicalRoot, entry.generation, "explicit");
424
+ void close.catch(() => undefined);
425
+ }
426
+ registration.roots.delete(rootKey(entry.canonicalRoot));
427
+ }
428
+ registration.active = false;
429
+ this.registrations.delete(registration.concretePoolId);
430
+ if (this.registrationByPool.get(registration.pool) === registration) {
431
+ this.registrationByPool.delete(registration.pool);
432
+ }
433
+ this.refreshTimer();
434
+ }
435
+ refreshTimer() {
436
+ const shouldRun = [...this.registrations.values()].some((registration) => registration.active && registration.reapingEnabled);
437
+ if (shouldRun && this.intervalHandle === null) {
438
+ this.intervalHandle = this.timer.setInterval(() => {
439
+ void this.sweep().catch(() => undefined);
440
+ }, this.intervalMs);
441
+ const maybeUnref = this.intervalHandle;
442
+ maybeUnref?.unref?.();
443
+ return;
444
+ }
445
+ if (!shouldRun && this.intervalHandle !== null) {
446
+ this.timer.clearInterval(this.intervalHandle);
447
+ this.intervalHandle = null;
448
+ }
449
+ }
450
+ emit(event) {
451
+ try {
452
+ this.onEvent?.(event);
453
+ }
454
+ catch {
455
+ // Observability must not change lifecycle ownership or teardown behavior.
456
+ }
457
+ }
458
+ }
459
+ const defaultLifecycleRegistry = new LifecycleRegistry();
460
+ /** Create a lifecycle registry for callers that do not inject one; use getLifecycleRegistry() for the shared default. */
461
+ export function createLifecycleRegistry(options = {}) {
462
+ return new LifecycleRegistry(options);
463
+ }
464
+ export function getLifecycleRegistry() {
465
+ return defaultLifecycleRegistry;
466
+ }
467
+ export { LifecycleRegistry as SubcLifecycleRegistry };
468
+ export function registerLifecyclePool(pool, options) {
469
+ return defaultLifecycleRegistry.registerLifecyclePool(pool, options);
470
+ }
471
+ //# sourceMappingURL=lifecycle-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle-registry.js","sourceRoot":"","sources":["../src/lifecycle-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AA8BzC,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,OAAO,IAAyB,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,UAAkB;IACjD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,UAAU,CAAC,iDAAiD,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,UAA4B,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,EAAU;IACzC,OAAO,EAAoB,CAAC;AAC9B,CAAC;AA2GD,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAC3D,MAAM,aAAa,GAAG,SAAS,CAAC;AA0BhC,SAAS,OAAO,CAAC,IAAuB;IACtC,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,kBAAkB,CAAC,MAA2B;IACrD,IAAI,OAAO,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IAC/C,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,QAAQ,IAAI,MAAM,EAAE,CAAC;QACxE,OAAO,MAAM,CAAC,MAAM,KAAK,KAAK,CAAC;IACjC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,IA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qB;QAChC,IAAI,CAAC;YACH,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC;QAAC,MAAM,CAAC;YACP,0EAA0E;QAC5E,CAAC;IACH,CAAC;CACF;AAED,MAAM,wBAAwB,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAEzD,yHAAyH;AACzH,MAAM,UAAU,uBAAuB,CAAC,UAAoC,EAAE;IAC5E,OAAO,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,oBAAoB;IAClC,OAAO,wBAAwB,CAAC;AAClC,CAAC;AAED,OAAO,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,CAAC;AAEtD,MAAM,UAAU,qBAAqB,CACnC,IAAmB,EACnB,OAAyC;IAEzC,OAAO,wBAAwB,CAAC,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACvE,CAAC"}
package/dist/pool.d.ts CHANGED
@@ -87,6 +87,8 @@ export declare class BridgePool implements AftTransportPool {
87
87
  private readonly idleTimeoutMs;
88
88
  private readonly bridgeOptions;
89
89
  private readonly configOverrides;
90
+ private editSlotSurvives;
91
+ private editSlotSurvivesCaptured;
90
92
  private readonly projectConfigLoader;
91
93
  private readonly logger;
92
94
  private cleanupTimer;
@@ -141,14 +143,12 @@ export declare class BridgePool implements AftTransportPool {
141
143
  private log;
142
144
  private error;
143
145
  /**
144
- * Update or set a single configure override that will be applied to every
145
- * **future** bridge spawn. Existing bridges keep their original configure
146
- * payload — this method intentionally does NOT restart them, because that
147
- * would discard their warm trigram/semantic/LSP/symbol-cache state. Use
148
- * this for opt-in features that resolve asynchronously after plugin load
149
- * (e.g. ONNX runtime download finishing in the background).
146
+ * Update a runtime configure override for future bridge spawns. Existing bridges
147
+ * keep those mutable runtime values so their warm state is not discarded.
150
148
  *
151
- * If `value === undefined`, the override key is removed.
149
+ * `edit_slot_survives` is host registration state instead: its first boolean
150
+ * value is captured separately and forwarded to every existing and future bridge.
151
+ * Any later write is a lifecycle error rather than a mutable config update.
152
152
  */
153
153
  setConfigureOverride(key: string, value: unknown): void;
154
154
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../src/pool.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAW,MAAM,aAAa,CAAC;AAEnD,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACf,MAAM,gBAAgB,CAAC;AAMxB;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;aACjB,WAAW,EAAE,MAAM;gBAAnB,WAAW,EAAE,MAAM;CAQhD;AAiBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAIlE;AAOD,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAY,SAAQ,aAAa;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxE;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,UAAW,YAAW,gBAAgB;IACjD,iEAAiE;IACjE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgC;IACxD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA2B;IACxD,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA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AC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAEzE,wDAAwD;IAClD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAe/B,sEAAsE;IACtE,UAAU,IAAI,OAAO;IAIrB;;;OAGG;IACG,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAoBrD,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,GAAG;IAcX,OAAO,CAAC,KAAK;IAcb;;;;;;;OAOG;IACH,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IA0BvD;;;;;;OAMG;IACG,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBzF,OAAO,CAAC,oBAAoB;IAW5B,4CAA4C;IAC5C,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;;;;;;OAQG;IACH,uBAAuB,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAI5D;;;;;OAKG;IACH,qBAAqB,IAAI,QAAQ,CAAC,aAAa,CAAC;CAGjD"}
package/dist/pool.js CHANGED
@@ -85,6 +85,8 @@ export class BridgePool {
85
85
  idleTimeoutMs;
86
86
  bridgeOptions;
87
87
  configOverrides;
88
+ editSlotSurvives;
89
+ editSlotSurvivesCaptured = false;
88
90
  projectConfigLoader;
89
91
  logger;
90
92
  cleanupTimer = null;
@@ -112,7 +114,16 @@ export class BridgePool {
112
114
  // omitting it silently dropped the override for pooled spawns.
113
115
  childEnv: options.childEnv,
114
116
  };
115
- this.configOverrides = configOverrides;
117
+ this.configOverrides = { ...configOverrides };
118
+ const initialEditSlotSurvives = this.configOverrides.edit_slot_survives;
119
+ delete this.configOverrides.edit_slot_survives;
120
+ if (initialEditSlotSurvives !== undefined) {
121
+ if (typeof initialEditSlotSurvives !== "boolean") {
122
+ throw new Error("edit_slot_survives must be a boolean");
123
+ }
124
+ this.editSlotSurvives = initialEditSlotSurvives;
125
+ this.editSlotSurvivesCaptured = true;
126
+ }
116
127
  // Reuse the existing idle-window timer for both idle eviction and binary
117
128
  // refresh checks. When idle eviction is disabled, there is no background
118
129
  // maintenance loop.
@@ -188,7 +199,8 @@ export class BridgePool {
188
199
  // `projectConfigLoader` doc-comment on PoolOptions.
189
200
  const projectOverrides = this.loadProjectOverrides(key);
190
201
  const mergedOverrides = { ...this.configOverrides, ...projectOverrides };
191
- const bridge = new BinaryBridge(this.binaryPath, key, this.bridgeOptions, mergedOverrides);
202
+ delete mergedOverrides.edit_slot_survives;
203
+ const bridge = new BinaryBridge(this.binaryPath, key, this.bridgeOptions, mergedOverrides, this.editSlotSurvivesCaptured ? this.editSlotSurvives : undefined);
192
204
  this.bridges.set(key, { bridge, lastUsed: Date.now() });
193
205
  return bridge;
194
206
  }
@@ -319,16 +331,31 @@ export class BridgePool {
319
331
  error(message, meta);
320
332
  }
321
333
  /**
322
- * Update or set a single configure override that will be applied to every
323
- * **future** bridge spawn. Existing bridges keep their original configure
324
- * payload — this method intentionally does NOT restart them, because that
325
- * would discard their warm trigram/semantic/LSP/symbol-cache state. Use
326
- * this for opt-in features that resolve asynchronously after plugin load
327
- * (e.g. ONNX runtime download finishing in the background).
334
+ * Update a runtime configure override for future bridge spawns. Existing bridges
335
+ * keep those mutable runtime values so their warm state is not discarded.
328
336
  *
329
- * If `value === undefined`, the override key is removed.
337
+ * `edit_slot_survives` is host registration state instead: its first boolean
338
+ * value is captured separately and forwarded to every existing and future bridge.
339
+ * Any later write is a lifecycle error rather than a mutable config update.
330
340
  */
331
341
  setConfigureOverride(key, value) {
342
+ if (key === "edit_slot_survives") {
343
+ if (typeof value !== "boolean") {
344
+ throw new Error("edit_slot_survives must be set once to a boolean");
345
+ }
346
+ if (this.editSlotSurvivesCaptured) {
347
+ throw new Error("edit_slot_survives is write-once and was already captured");
348
+ }
349
+ this.editSlotSurvives = value;
350
+ this.editSlotSurvivesCaptured = true;
351
+ for (const entry of this.bridges.values()) {
352
+ entry.bridge.setEditSlotSurvives(value);
353
+ }
354
+ for (const bridge of this.staleBridges) {
355
+ bridge.setEditSlotSurvives(value);
356
+ }
357
+ return;
358
+ }
332
359
  if (value === undefined) {
333
360
  delete this.configOverrides[key];
334
361
  }