@adhd/sox-embedding-provider 0.3.0 → 0.4.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;AAE7C,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,eAAe,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;IACtD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC;IAC7C,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACnE,UAAU,CACR,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,SAAS,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAC9C,aAAa,CAAC,YAAY,CAAC,CAAC;IAC/B,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,4DAA4D;IAC5D,MAAM,IAAI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EAAE,MAAM,uBAAuB,CAAC;AAEpF;;;;;;;;;GASG;AACH,OAAO,EACL,yBAAyB,EACzB,4BAA4B,GAC7B,MAAM,6BAA6B,CAAC;AAErC;;;;;;;;;;;;;;GAcG;AACH,YAAY,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EACL,oBAAoB,EACpB,4BAA4B,EAC5B,KAAK,4BAA4B,EACjC,kBAAkB,EAClB,wBAAwB,EACxB,uBAAuB,EACvB,2BAA2B,EAC3B,8BAA8B,GAC/B,MAAM,6BAA6B,CAAC;AAIrC,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,iBAAiB,CAAC,CAe5B;AA4DD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,CAOzD;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,CAG7D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEzE"}
package/dist/index.js CHANGED
@@ -52,6 +52,7 @@ export { getSharedOnnxWorker, SharedOnnxWorkerClient } from './sharedOnnxWorker.
52
52
  * root-cause writeup and rationale.
53
53
  */
54
54
  export { getSharedFastembedProcess, SharedFastembedProcessClient, } from './sharedFastembedProcess.js';
55
+ export { FastembedProcessPool, AdaptiveFastembedProcessPool, FastembedBusyError, resolveFastembedPoolSize, resolveFastembedPoolPin, resolveFastembedPoolCeiling, resolveFastembedAdmissionLimit, } from './sharedFastembedProcess.js';
55
56
  // ── Factory ───────────────────────────────────────────────────────────────────
56
57
  export async function createEmbeddingProvider(config) {
57
58
  if (!config.type || typeof config.type !== 'string') {
package/d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O,EAAE,EAAE,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AACjE,CAAC"}
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhd/sox-embedding-provider",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Pluggable text→vector embedding provider — generic EmbeddingProvider interface, config-driven model resolution, async batch-first API (AsyncIterable). Default: fastembed (local ONNX, >=3 model dims proven). Loud-fail: createEmbeddingProvider() throws ResolutionError if config is invalid or model cannot load — no silent downgrade.",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -24,7 +24,7 @@
24
24
  "dist"
25
25
  ],
26
26
  "dependencies": {
27
- "@adhd/sox-telemetry": "workspace:*",
27
+ "@adhd/sox-telemetry": "workspace:^",
28
28
  "@huggingface/transformers": "^4.2.0",
29
29
  "fastembed": "^2.1.0"
30
30
  },
@@ -59,5 +59,16 @@
59
59
  "dist/index.js"
60
60
  ]
61
61
  },
62
+ "keywords": [
63
+ "embedding",
64
+ "vector",
65
+ "onnx",
66
+ "typescript"
67
+ ],
68
+ "repository": {
69
+ "type": "git",
70
+ "url": "git+https://github.com/PseudoSky/adhd.git"
71
+ },
72
+ "homepage": "https://github.com/PseudoSky/adhd",
62
73
  "module": "./index.js"
63
74
  }
@@ -15,12 +15,126 @@
15
15
  * process alive) but forks a child **process** instead of constructing a
16
16
  * `worker_threads.Worker`.
17
17
  */
18
- export declare class SharedFastembedProcessClient {
18
+ /** TEST-ONLY: clear the TTL cache so a test can force a fresh fs read. */
19
+ export declare function __resetCompetingHostCacheForTests(): void;
20
+ /**
21
+ * Exported for direct unit testing (DEBT-EPIC-HOTPATH-REDUNDANT-IO-001) — see the
22
+ * TTL-cache doc comment above for why this used to be a per-call sync fs read.
23
+ *
24
+ * (BUG-MEMORY-EMBED-HEAD-OF-LINE-BLOCKING-001) `ownPoolGroup`, when supplied,
25
+ * suppresses a "competing host" result whose lock entry carries the SAME
26
+ * `poolGroup` — i.e. another member of this client's own `FastembedProcessPool`,
27
+ * not a genuinely unrelated fastembed host. Without this, the BL-432
28
+ * `competing_host_pid` telemetry field would read as permanently "contended"
29
+ * for every pooled request, which is exactly the false-positive noise BL-331's
30
+ * own postmortem warns against trusting.
31
+ */
32
+ export declare function detectCompetingFastembedHost(ownPid: number | undefined, ownPoolGroup?: string): {
33
+ pid: number;
34
+ startedAt: string;
35
+ } | null;
36
+ /**
37
+ * (BUG-MEMORY-EMBED-HEAD-OF-LINE-BLOCKING-001) The structural shape both
38
+ * `SharedFastembedProcessClient` (one child) and `FastembedProcessPool`
39
+ * (N independent children) satisfy. `FastembedProvider` (fastembed.ts)
40
+ * depends on this interface, not the concrete single-child class, so
41
+ * `getSharedFastembedProcess()` can return either without callers caring —
42
+ * every existing `.request()`/`.terminate()`/`.started` call site keeps
43
+ * working unchanged.
44
+ */
45
+ export interface SharedFastembedClient {
46
+ request<T = Record<string, unknown>>(payload: Record<string, unknown>, timeoutMs?: number, signal?: AbortSignal): Promise<T>;
47
+ terminate(): Promise<void>;
48
+ readonly started: boolean;
49
+ }
50
+ /**
51
+ * (BUG-MEMORY-EMBED-HEAD-OF-LINE-BLOCKING-001) Thrown by `FastembedProcessPool
52
+ * .request()` when every pool member already has `admissionLimit` or more
53
+ * requests in flight — the "a queue that never refuses hides its own
54
+ * failure" backstop the bug item asked for. This is NOT the primary fix (the
55
+ * pool itself is — see the class below); it exists purely so a burst that
56
+ * genuinely exceeds total pool capacity gets a fast, typed, retryable
57
+ * rejection instead of silently joining a multi-minute queue. Named
58
+ * `TransientEmbeddingError`-shaped (has `retryAfterMs`) but defined locally
59
+ * rather than importing from `./index.js`, to keep this module free of a
60
+ * dependency on the public interface skeleton — callers can duck-type on
61
+ * `.name === 'FastembedBusyError'` or `instanceof FastembedBusyError`.
62
+ */
63
+ export declare class FastembedBusyError extends Error {
64
+ readonly retryAfterMs: number;
65
+ constructor(message: string, retryAfterMs: number);
66
+ }
67
+ export declare class SharedFastembedProcessClient implements SharedFastembedClient {
19
68
  private child;
20
69
  private startingPromise;
70
+ /**
71
+ * (BUG-MEMORYSERVER-SHUTDOWN-LEAKS-FASTEMBED-CHILD-001) True once
72
+ * `terminate()` has been called on THIS client — permanent, never reset.
73
+ * Distinct from an unexpected crash (the `c.on('exit')`/`c.on('error')`
74
+ * handlers below null `this.child` WITHOUT setting this flag, so BUG-021's
75
+ * transparent-respawn-and-reinit behaviour for a genuinely crashed child is
76
+ * completely unaffected).
77
+ *
78
+ * ROOT CAUSE this closes: `fastembed.ts`'s `initModel()` retries a
79
+ * cache-hit warmup up to `WARMUP_CACHE_HIT_ATTEMPTS` times, each attempt
80
+ * calling `this.shared.request({ type: 'init', ... })`. `coordinatedShutdown`
81
+ * (`memory-server/src/backend.ts`) races step 0 (`flushPendingEmbeds`)
82
+ * against a short bound and, on timeout, ABANDONS it as a background
83
+ * "loser" promise that keeps running concurrently with step 1
84
+ * (`terminateEmbedWorkers`). If that abandoned promise's in-flight
85
+ * `initModel()` attempt is still on its first attempt when step 1's
86
+ * `terminate()` below nulls `this.child`/`this.startingPromise` and rejects
87
+ * every pending request (including that attempt), `initModel()`'s catch
88
+ * block loops and fires attempt 2 — which, before this fix, called
89
+ * `ensureProcess()` and found `this.child === null`, so it happily forked a
90
+ * BRAND NEW, completely untracked child process. That child was never
91
+ * subject to any further termination step (`coordinatedShutdown` had
92
+ * already moved past step 1) and was abandoned as a live orphan the instant
93
+ * `exit(0)` fired — reproduced directly: a real backend forked under
94
+ * `SOX_PROXY_BACKEND=1`, given one `memory_write` (to start Phase-B's async
95
+ * embed), then SIGTERM'd immediately — server pid exited cleanly at
96
+ * t+694ms, but a SECOND `fastembedProcessHost.js` child (forked ~150ms
97
+ * AFTER the coordinated shutdown's own step 4 already finished) was still
98
+ * alive seconds later, orphaned under the process's original parent.
99
+ *
100
+ * `ensureProcess()` now refuses to fork once this flag is set — any request
101
+ * racing a real `terminate()` fails fast with a clear error instead of
102
+ * spawning a child nothing will ever reap.
103
+ */
104
+ private terminated;
21
105
  private nextId;
22
106
  private pending;
23
107
  private readonly hostPath;
108
+ private readonly poolGroup;
109
+ private poolSize;
110
+ private memberIndex;
111
+ /**
112
+ * (BUG-021) The last `{ type: 'init', model, cacheDir }` payload this
113
+ * member has ever been asked to load — kept independently of any pool
114
+ * wrapper above it so a LONE (non-pooled) client is self-healing too.
115
+ * `null` until the first successful `init`.
116
+ */
117
+ private lastInitPayload;
118
+ /**
119
+ * (BUG-021 root cause) True once the CURRENT `this.child` has actually
120
+ * loaded the model named by `lastInitPayload`. Reset to `false` every time
121
+ * `ensureProcess()` forks a NEW child — including a transparent respawn
122
+ * after the previous child died (crash, OOM-kill, the BL-426/std::bad_alloc
123
+ * native-teardown hazards documented on `fastembedProcessHost.ts`, etc).
124
+ *
125
+ * Before this fix, `ensureProcess()`'s `c.on('exit')`/`c.on('error')`
126
+ * handlers nulled out `this.child`/`this.startingPromise` on an unexpected
127
+ * death, but nothing told the NEXT `request()` call that the freshly
128
+ * (re)forked replacement child has an empty `_embedder` — every real
129
+ * `embed`/`embedBatch` request sent to it failed with "Model not
130
+ * initialized" forever, because the higher-level `FastembedProvider.ready`
131
+ * flag was already latched `true` from the original (pre-crash) init and
132
+ * `ensureReady()` never re-sends `init` once `ready` is true. Live incident
133
+ * BUG-021: the lock file showed a child forked mere SECONDS before every
134
+ * request against it failed — exactly this respawn-without-reinit gap, not
135
+ * a stale/orphaned lock as first suspected.
136
+ */
137
+ private childInitialized;
24
138
  /**
25
139
  * @param hostPathOverride Test-only injection point (BL-410): points the
26
140
  * fork target at a lightweight fixture host instead of the real
@@ -28,10 +142,47 @@ export declare class SharedFastembedProcessClient {
28
142
  * contract without loading fastembed or downloading a model. Production
29
143
  * code (`getSharedFastembedProcess()`) never passes this — it always
30
144
  * resolves the real host path.
145
+ * @param poolGroup (BUG-MEMORY-EMBED-HEAD-OF-LINE-BLOCKING-001) Set by
146
+ * `FastembedProcessPool` to a group id shared by every member of that pool.
147
+ * Forwarded to the forked child via `SOX_FASTEMBED_POOL_GROUP` so the
148
+ * BL-331 advisory lock can tell "another member of my own pool" apart from
149
+ * "a genuinely unrelated fastembed host" — see `fastembedLock.ts`'s
150
+ * `poolGroup` doc comment. `undefined` for a lone (non-pooled) client,
151
+ * which preserves today's exact single-host lock behaviour there.
152
+ * @param poolSize / @param memberIndex (BUG-EMBED-POOL-SIZE-DARWIN-FREEMEM-001,
153
+ * observability addendum) Set by `FastembedProcessPool` so every
154
+ * `fastembed_process.request.*` telemetry record this client emits carries
155
+ * the pool's actual size and this member's index alongside `queue_depth`/
156
+ * `response_ms`. Diagnosing THIS incident required an agent to read source
157
+ * and reconstruct `resolveFastembedPoolSize()`'s arithmetic by hand,
158
+ * because no telemetry field ever recorded what size the pool actually
159
+ * resolved to at runtime — `queue_depth` alone cannot distinguish
160
+ * "contention on an inert 1-member pool" from "genuine over-capacity on a
161
+ * 4-member pool". `undefined` for a lone (non-pooled) client, which omits
162
+ * both fields from telemetry exactly as before this addendum.
31
163
  */
32
- constructor(hostPathOverride?: string);
164
+ constructor(hostPathOverride?: string, poolGroup?: string, poolSize?: number, memberIndex?: number);
33
165
  /** True once the underlying child process has been forked. */
34
166
  get started(): boolean;
167
+ /**
168
+ * (BUG-MEMORY-EMBED-HEAD-OF-LINE-BLOCKING-001) Number of requests already
169
+ * admitted-and-unsettled on this specific child, i.e. how many are ahead
170
+ * of a hypothetical next request. Exposed read-only so `FastembedProcessPool`
171
+ * (below) can route a new request to whichever pool member is least loaded
172
+ * — the exact `this.pending.size` value `request()` already measures
173
+ * internally for the `queue_depth` telemetry field, just made visible to a
174
+ * caller one level up instead of re-derived.
175
+ */
176
+ get pendingCount(): number;
177
+ /**
178
+ * (BL-575) Update the `pool_size`/`member_index` telemetry fields this
179
+ * client stamps on every `fastembed_process.request.*` record. Package-
180
+ * private (no `readonly`) specifically so `AdaptiveFastembedProcessPool`
181
+ * can keep them truthful as the pool grows/shrinks at runtime — a FIXED
182
+ * `FastembedProcessPool` never calls this (its size is constant for the
183
+ * member's whole lifetime, set once at construction).
184
+ */
185
+ setPoolMeta(poolSize: number, memberIndex: number): void;
35
186
  /** Lazily fork (exactly once) and return the single shared child process. */
36
187
  private ensureProcess;
37
188
  /**
@@ -76,8 +227,24 @@ export declare class SharedFastembedProcessClient {
76
227
  * 3. `competing_host_pid` — present only when a second, still-live
77
228
  * `fastembedProcessHost` process is detected (BL-331's advisory lock),
78
229
  * since that changes embed latency 25-50x independent of queueing.
230
+ *
231
+ * BL-576: `signal`, when supplied, is an external cancellation source —
232
+ * e.g. `operation-guard.ts`'s `withOperationDeadline` abort controller, so
233
+ * a deadline that fires while an embed is queued behind an unrelated slow
234
+ * request stops WAITING on it immediately rather than riding the deadline
235
+ * out via its own separate mechanism. This does NOT kill the underlying
236
+ * fastembed child mid-inference (the same "no native cancellation
237
+ * primitive" constraint `operation-guard.ts` documents applies here too —
238
+ * the child process is shared across other pending requests, so killing
239
+ * it on one caller's abort would collaterally fail every other in-flight
240
+ * request on that member) — it settles the CALLER's promise immediately
241
+ * with an `AbortError` and removes the pending entry so a late reply from
242
+ * the child (once the real work finishes) is silently dropped instead of
243
+ * resolving/rejecting a promise nobody is awaiting anymore. If `signal`
244
+ * is already aborted when `request()` is called, it rejects immediately
245
+ * without ever sending to the child.
79
246
  */
80
- request<T = Record<string, unknown>>(payload: Record<string, unknown>, timeoutMs?: number): Promise<T>;
247
+ request<T = Record<string, unknown>>(payload: Record<string, unknown>, timeoutMs?: number, signal?: AbortSignal): Promise<T>;
81
248
  /**
82
249
  * Terminate the shared fastembed process. Intended ONLY for full process
83
250
  * shutdown or test teardown that genuinely owns the whole process's
@@ -95,14 +262,277 @@ export declare class SharedFastembedProcessClient {
95
262
  */
96
263
  terminate(): Promise<void>;
97
264
  }
265
+ /**
266
+ * (BUG-EMBED-POOL-SIZE-DARWIN-FREEMEM-001) Estimate REAL available memory
267
+ * (MB), platform-aware — the input `resolveFastembedPoolSize()`'s
268
+ * memory-cap arithmetic below actually needs, as opposed to what
269
+ * `os.freemem()` alone reports.
270
+ *
271
+ * `os.freemem()` is not a usable proxy for "memory this process could
272
+ * actually claim" on macOS: it maps to Mach's raw "free" page count only,
273
+ * which deliberately EXCLUDES "inactive"/"speculative"/"purgeable" pages —
274
+ * pages the kernel is using as disk cache but will hand back instantly
275
+ * (zero swap-in cost) under real pressure. Measured via `vm_stat` on the
276
+ * exact box this defect was diagnosed on (32GB physical, page size 16384):
277
+ * `os.freemem()` reported ~299MB while `Pages inactive` ALONE was 345,579
278
+ * pages (~5.4GB) — the overwhelming majority of genuinely-available memory
279
+ * was invisible to the metric `resolveFastembedPoolSize()` used to
280
+ * compute `memoryCap`. Because `MEMORY_SAFETY_MARGIN_MB` (1024) routinely
281
+ * exceeds `os.freemem()`'s ~300MB-ish reading on macOS regardless of real
282
+ * load, `memoryCap` collapsed to `Math.max(1, negative) === 1` on every
283
+ * macOS box, unconditionally — the pool was permanently INERT (silently
284
+ * behaving exactly like the pre-fix single-child topology) unless an
285
+ * operator manually overrode `SOX_EMBED_POOL_SIZE`. `hol-pool-sizing.spec.ts`
286
+ * even self-documents "this suite was itself first run on a box with only
287
+ * ~128MB free" — the sizing design was validated against the very macOS
288
+ * quirk that made it universally wrong, not a genuinely memory-constrained
289
+ * machine.
290
+ *
291
+ * Fix: compute "available" as free + inactive + speculative + purgeable
292
+ * pages (the standard macOS "reclaimable without swapping" heuristic —
293
+ * matches what `htop`-family tools approximate; NOT Apple's undocumented
294
+ * memory-pressure internals, which have no public API). On Linux,
295
+ * `/proc/meminfo`'s `MemAvailable` is already the kernel's own equivalent
296
+ * estimate and is used directly. Any other platform, or any parse/exec
297
+ * failure, falls back to `os.freemem()` unchanged — this must never throw
298
+ * or block pool sizing on a shell-out failing; it runs once per process
299
+ * (at `getSharedFastembedProcess()` construction), never per-request.
300
+ */
301
+ export declare function estimateAvailableMemMb(): number;
302
+ /**
303
+ * (BL-575) The explicit `SOX_EMBED_POOL_SIZE` override, if set — a HARD PIN.
304
+ * Split out of `resolveFastembedPoolSize()` so `getSharedFastembedProcess()`
305
+ * can tell "operator pinned an exact size" (disables ALL adaptation —
306
+ * `AdaptiveFastembedProcessPool` is never constructed) apart from "no
307
+ * override, compute a ceiling for adaptive sizing to grow toward" — the two
308
+ * cases used to be indistinguishable from the return value of a single
309
+ * function that already folded the CPU/memory-cap arithmetic into the
310
+ * "no override" branch.
311
+ */
312
+ export declare function resolveFastembedPoolPin(): number | null;
313
+ /**
314
+ * (BL-575) The maximum pool size the memory/CPU budget allows — i.e. what
315
+ * `resolveFastembedPoolSize()` used to compute unconditionally in its
316
+ * "no override" branch. Now used two ways: (a) unchanged, as
317
+ * `resolveFastembedPoolSize()`'s own fallback when no pin is set, so every
318
+ * existing caller of that function keeps its exact prior behavior; (b) as
319
+ * `AdaptiveFastembedProcessPool`'s `maxSize` — the ceiling it is allowed to
320
+ * grow toward under sustained load, never exceeded regardless of how
321
+ * sustained the demand is.
322
+ *
323
+ * Auto-sized from BOTH real available memory (`estimateAvailableMemMb()` —
324
+ * see its doc comment for why this is NOT simply `os.freemem()`, and
325
+ * BUG-EMBED-POOL-SIZE-DARWIN-FREEMEM-001 for the incident this fixes —
326
+ * against `DEFAULT_PER_MEMBER_MB`, less `MEMORY_SAFETY_MARGIN_MB` headroom —
327
+ * override the per-member budget via `SOX_EMBED_POOL_PER_CHILD_MB` for a
328
+ * non-default model) AND CPU count (half the logical CPUs, cap 4 — fastembed
329
+ * inference is CPU/ANE-bound per request, not embarrassingly parallel across
330
+ * all cores), taking the SMALLER of the two so a memory-constrained box
331
+ * never gets sized past what's actually free. See the module doc comment
332
+ * above for the measurement (footprint/vmmap on 1 vs 4 real children) that
333
+ * justifies this.
334
+ *
335
+ * @param getAvailableMemMb Test-only injection point — production always
336
+ * uses the default `estimateAvailableMemMb`. Lets tests exercise the sizing
337
+ * arithmetic against deterministic MB values instead of the real, inherently
338
+ * machine/moment-dependent OS memory state.
339
+ */
340
+ export declare function resolveFastembedPoolCeiling(getAvailableMemMb?: () => number): number;
341
+ /**
342
+ * Number of independent fastembed child processes a FIXED (non-adaptive)
343
+ * pool should use. Preserved unchanged for backward compatibility (existing
344
+ * callers/tests) — `SOX_EMBED_POOL_SIZE` honored exactly if set
345
+ * (`resolveFastembedPoolPin()`), else the memory/CPU ceiling
346
+ * (`resolveFastembedPoolCeiling()`). `getSharedFastembedProcess()` itself no
347
+ * longer calls this for its default (adaptive) path as of BL-575 — see
348
+ * `resolveFastembedPoolPin`/`resolveFastembedPoolCeiling`'s doc comments.
349
+ *
350
+ * @param getAvailableMemMb Test-only injection point, forwarded to
351
+ * `resolveFastembedPoolCeiling`.
352
+ */
353
+ export declare function resolveFastembedPoolSize(getAvailableMemMb?: () => number): number;
354
+ /** Per-member in-flight cap above which `FastembedProcessPool.request()` fast-rejects
355
+ * a non-init request with `FastembedBusyError` instead of enqueuing. Disabled
356
+ * (`Infinity`) by default — see the pool doc comment above for why. Override
357
+ * via `SOX_EMBED_POOL_ADMISSION_LIMIT` (a finite number opts in). */
358
+ export declare function resolveFastembedAdmissionLimit(): number;
359
+ /**
360
+ * A pool of `size` independent `SharedFastembedProcessClient`s — i.e. `size`
361
+ * independent fastembed-hosting OS child processes, each fully isolated from
362
+ * the others (preserving BL-238's process-isolation requirement) — routing
363
+ * each request to whichever member currently has the fewest requests in
364
+ * flight. See the module-level doc comment above for the full rationale and
365
+ * the production measurements this fixes.
366
+ */
367
+ export declare class FastembedProcessPool implements SharedFastembedClient {
368
+ readonly members: SharedFastembedProcessClient[];
369
+ private readonly admissionLimit;
370
+ /**
371
+ * (BUG-MEMORY-EMBED-HEAD-OF-LINE-BLOCKING-001) Routing/admission MUST NOT
372
+ * read `member.pendingCount` for the decision — that counter is only
373
+ * incremented deep inside `SharedFastembedProcessClient.request()`, AFTER
374
+ * its own `await this.ensureProcess()`, i.e. at least one microtask tick
375
+ * after the call starts. Several callers issued in the same synchronous
376
+ * burst (`Promise.all(callers.map(() => pool.request(...)))`, the exact
377
+ * shape a real caller under load produces) all run their OWN synchronous
378
+ * prefix — including this pool's `leastLoaded()`/admission check — before
379
+ * ANY of them reaches that tick, so every one of them would read
380
+ * `pendingCount === 0` for every member and pile onto `members[0]`,
381
+ * silently defeating both load-balancing and admission control for
382
+ * exactly the bursty-arrival case this fix exists for. `inFlight` is
383
+ * incremented SYNCHRONOUSLY the instant a member is chosen (before any
384
+ * `await`), so the very next synchronous call in the same burst already
385
+ * sees it.
386
+ */
387
+ private readonly inFlight;
388
+ /** Cached so a member added to routing after the first `init` (there is
389
+ * none today — pool size is fixed at construction — but kept so a future
390
+ * dynamic-resize doesn't silently skip initializing a new member) can be
391
+ * brought up to date. Also lets `request()` short-circuit a redundant
392
+ * broadcast if the model/cacheDir haven't changed. */
393
+ private lastInitPayload;
394
+ constructor(size: number, hostPathOverride?: string, admissionLimit?: number);
395
+ /** True once at least one member has forked its child process. */
396
+ get started(): boolean;
397
+ /** The last `{ type: 'init', model, cacheDir }` payload broadcast to every
398
+ * member, or `null` before the first init. Exposed for introspection/tests
399
+ * only — `request()` itself doesn't need to read this back today (pool
400
+ * size is fixed at construction, so every member is always initialized by
401
+ * the broadcast), it's retained purely so a future dynamic-resize path has
402
+ * the payload on hand to bring a newly-added member up to date. */
403
+ get lastInit(): Record<string, unknown> | null;
404
+ /** Sum of in-flight requests across every member — the pool-wide
405
+ * head-of-line depth an arriving caller would experience. */
406
+ get pendingCount(): number;
407
+ /** Index of the least-loaded member by the SYNCHRONOUS `inFlight` counter
408
+ * — see that field's doc comment for why `member.pendingCount` itself is
409
+ * unsafe to read here. */
410
+ private leastLoadedIndex;
411
+ request<T = Record<string, unknown>>(payload: Record<string, unknown>, timeoutMs?: number): Promise<T>;
412
+ terminate(): Promise<void>;
413
+ }
414
+ export interface AdaptiveFastembedPoolOptions {
415
+ /** Starting (and floor) pool size. Default 1 — the topology real
416
+ * measurement shows wins at concurrency <20. */
417
+ minSize?: number;
418
+ /** Ceiling the pool may grow to — pass `resolveFastembedPoolCeiling()`'s
419
+ * result in production; never exceeded regardless of how sustained
420
+ * demand is. */
421
+ maxSize: number;
422
+ hostPathOverride?: string;
423
+ admissionLimit?: number;
424
+ /** Test-only clock injection — production uses `Date.now`. */
425
+ now?: () => number;
426
+ /** Hysteresis knobs — all optional, defaulting to the values documented
427
+ * above. Exposed so a test can use tiny thresholds/intervals instead of
428
+ * waiting out real minutes-scale windows, and so an operator can tune
429
+ * the policy without a rebuild if the defaults prove wrong for their
430
+ * traffic shape. Production (`getSharedFastembedProcess()`) never
431
+ * overrides any of these — it relies on the documented defaults. */
432
+ growQueueRatioThreshold?: number;
433
+ growSustainCount?: number;
434
+ /** (BL-575 hysteresis fix, post-ship) Minimum WALL-CLOCK span the
435
+ * over-threshold streak must cover before a grow is allowed to fire —
436
+ * see `growSustainWindowMs`'s own doc comment on the field below for why
437
+ * `growSustainCount` alone was not sufficient. */
438
+ growSustainWindowMs?: number;
439
+ growCooldownMs?: number;
440
+ shrinkIdleMs?: number;
441
+ shrinkCheckIntervalMs?: number;
442
+ }
443
+ export declare class AdaptiveFastembedProcessPool implements SharedFastembedClient {
444
+ private members;
445
+ private inFlight;
446
+ private readonly minSize;
447
+ private readonly maxSize;
448
+ private readonly hostPathOverride;
449
+ private readonly admissionLimit;
450
+ private readonly poolGroup;
451
+ private readonly clock;
452
+ private readonly shrinkTimer;
453
+ private readonly growQueueRatioThreshold;
454
+ private readonly growSustainCount;
455
+ private readonly growSustainWindowMs;
456
+ private readonly growCooldownMs;
457
+ private readonly shrinkIdleMs;
458
+ private lastInitPayload;
459
+ private growConsecutiveOverThreshold;
460
+ /** Wall-clock timestamp the CURRENT over-threshold streak began — `null`
461
+ * when not currently in a streak. See `GROW_SUSTAIN_WINDOW_MS`'s doc
462
+ * comment for why a count alone is insufficient. */
463
+ private growStreakStartedAt;
464
+ private lastGrowAt;
465
+ private idleSinceMs;
466
+ /** Serializes concurrent grow attempts — `request()` can observe the
467
+ * over-threshold condition from several concurrent callers in the same
468
+ * burst; only one grow should actually happen. */
469
+ private growInFlight;
470
+ private terminated;
471
+ /** Counts of grow/shrink actions taken — exposed for tests/observability,
472
+ * not consumed by any routing logic. */
473
+ growCount: number;
474
+ shrinkCount: number;
475
+ constructor(opts: AdaptiveFastembedPoolOptions);
476
+ get started(): boolean;
477
+ get lastInit(): Record<string, unknown> | null;
478
+ get pendingCount(): number;
479
+ /** Current pool size — exposed for tests/observability. */
480
+ get size(): number;
481
+ private leastLoadedIndex;
482
+ /** Renumber every member's `pool_size`/`member_index` telemetry fields to
483
+ * match current pool composition — called after every grow/shrink so
484
+ * `fastembed_process.request.*` records stay truthful. */
485
+ private renumberMembers;
486
+ /**
487
+ * Attempt to add one member, up to `maxSize`. Best-effort and internally
488
+ * serialized (`growInFlight`) — safe to call from multiple concurrent
489
+ * `request()` admissions without double-growing. If a `lastInitPayload`
490
+ * exists (the pool has already been initialized with a model), the new
491
+ * member is sent the SAME init payload before being added to routing —
492
+ * an un-initialized member would fail every real embed request it was
493
+ * routed to.
494
+ */
495
+ private grow;
496
+ /** Periodic shrink check — terminates exactly ONE idle member if the
497
+ * entire pool has been continuously idle for `SHRINK_IDLE_MS`. Never
498
+ * shrinks below `minSize`. Resets the idle clock after shrinking so a
499
+ * demand spike right after only costs one re-grow step, not a full
500
+ * rebuild, and so consecutive shrinks are still spaced `SHRINK_IDLE_MS`
501
+ * apart (the same conservative cadence, not a rapid drain to `minSize`). */
502
+ private maybeShrink;
503
+ request<T = Record<string, unknown>>(payload: Record<string, unknown>, timeoutMs?: number, signal?: AbortSignal): Promise<T>;
504
+ terminate(): Promise<void>;
505
+ }
98
506
  /**
99
507
  * Process-wide singleton accessor — the ONLY sanctioned place a fastembed
100
508
  * child process is forked anywhere in `@adhd/sox-embedding-provider`
101
509
  * (BL-238/BL-171). Every `FastembedProvider` obtains its handle through this
102
510
  * function instead of constructing its own `worker_threads.Worker` or
103
511
  * `child_process`.
512
+ *
513
+ * (BL-575) Two shapes, chosen by whether `SOX_EMBED_POOL_SIZE` is set:
514
+ *
515
+ * - PINNED (`resolveFastembedPoolPin()` returns non-null): a FIXED
516
+ * `FastembedProcessPool` at exactly that size, no adaptation — an
517
+ * operator who set this has already judged their model's footprint and
518
+ * the box's headroom; adaptive sizing would second-guess that judgement.
519
+ * - DEFAULT (no override): an `AdaptiveFastembedProcessPool` starting at
520
+ * `minSize: 1` (the topology real measurement shows wins below ~20
521
+ * concurrency) and growing toward `resolveFastembedPoolCeiling()` (the
522
+ * SAME ceiling `FastembedProcessPool` used to apply unconditionally)
523
+ * only under sustained demand — see that class's doc comment for the
524
+ * full measurement and hysteresis policy (BUG-MEMORY-EMBED-HEAD-OF-LINE-
525
+ * BLOCKING-001's original qdepth-11+ production regime is exactly the
526
+ * sustained-demand case this still grows to meet; the difference is it
527
+ * no longer pays that pool's cost on every LOWER-concurrency request
528
+ * too).
529
+ *
530
+ * Every existing caller keeps working unchanged either way — both classes
531
+ * implement the same `SharedFastembedClient` shape (`request()`/
532
+ * `terminate()`/`started`). Setting `SOX_EMBED_POOL_SIZE=1` recovers the
533
+ * exact pre-BL-575 (and pre-pool) single-child topology.
104
534
  */
105
- export declare function getSharedFastembedProcess(): SharedFastembedProcessClient;
535
+ export declare function getSharedFastembedProcess(): SharedFastembedClient;
106
536
  /**
107
537
  * Test-only: reset the module-level singleton so a test can exercise a
108
538
  * fresh shared-process lifecycle (e.g. after deliberately crashing/
@@ -1 +1 @@
1
- {"version":3,"file":"sharedFastembedProcess.d.ts","sourceRoot":"","sources":["../src/sharedFastembedProcess.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAsFH,qBAAa,4BAA4B;IACvC,OAAO,CAAC,KAAK,CAA6B;IAC1C,OAAO,CAAC,eAAe,CAAsC;IAC7D,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,OAAO,CAAmC;IAClD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAE9C;;;;;;;OAOG;gBACS,gBAAgB,CAAC,EAAE,MAAM;IAIrC,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