@adhd/sox-embedding-provider 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -3
- package/dist/embedHostConfig.d.ts +161 -0
- package/dist/embedHostConfig.d.ts.map +1 -0
- package/dist/embedHostConfig.js +234 -0
- package/dist/embedHostConfig.js.map +1 -0
- package/dist/embedHostMain.d.ts +59 -0
- package/dist/embedHostMain.d.ts.map +1 -0
- package/dist/embedHostMain.js +223 -0
- package/dist/embedHostMain.js.map +1 -0
- package/dist/errors.d.ts +25 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +35 -0
- package/dist/errors.js.map +1 -0
- package/dist/fastembed.d.ts.map +1 -1
- package/dist/fastembed.js +3 -0
- package/dist/fastembed.js.map +1 -1
- package/dist/fastembedProcessHost.d.ts.map +1 -1
- package/dist/fastembedProcessHost.js +11 -10
- package/dist/fastembedProcessHost.js.map +1 -1
- package/dist/funnelClient.d.ts +97 -0
- package/dist/funnelClient.d.ts.map +1 -0
- package/dist/funnelClient.js +320 -0
- package/dist/funnelClient.js.map +1 -0
- package/dist/index.d.ts +35 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +54 -39
- package/dist/index.js.map +1 -1
- package/dist/onnxStderrFilter.d.ts +2 -1
- package/dist/onnxStderrFilter.d.ts.map +1 -1
- package/dist/onnxStderrFilter.js +2 -1
- package/dist/onnxStderrFilter.js.map +1 -1
- package/dist/package.json +8 -2
- package/dist/sharedFastembedProcess.d.ts +59 -32
- package/dist/sharedFastembedProcess.d.ts.map +1 -1
- package/dist/sharedFastembedProcess.js +100 -41
- package/dist/sharedFastembedProcess.js.map +1 -1
- package/package.json +8 -2
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* funnelClient.ts — the host-aware `SharedFastembedClient` (SPEC-EMBEDDING-FUNNEL.md §D).
|
|
3
|
+
*
|
|
4
|
+
* A drop-in `SharedFastembedClient` that transparently dials — and, when absent,
|
|
5
|
+
* peer-spawns — the ONE machine-wide embedding host for `(model, ep, cacheDir)`.
|
|
6
|
+
* It is the consumer half of the funnel: N processes each hold a
|
|
7
|
+
* `FunneledFastembedClient`, but `ensureBackend()`'s O_EXCL spawn-lock collapses
|
|
8
|
+
* their concurrent spawn attempts to a single detached host, and the host
|
|
9
|
+
* reaps itself once the last client leaves (see `embedHostMain.ts`).
|
|
10
|
+
*
|
|
11
|
+
* ── Honest failure, never a silent private re-fork ─────────────────────────────
|
|
12
|
+
*
|
|
13
|
+
* Under the default `host: 'shared'`, a failure to bring the host up throws a
|
|
14
|
+
* typed `TransientEmbeddingError` naming the socket — it does NOT fall back to
|
|
15
|
+
* forking a private host. A silent fallback would defeat the entire funnel
|
|
16
|
+
* (each of 535 short-lived CLIs/day would quietly become its own ONNX host) and
|
|
17
|
+
* is exactly the behaviour this design removes. `host: 'private'` is the
|
|
18
|
+
* explicit, typed CI/diagnostics selection (ADR-0013 closed union).
|
|
19
|
+
*
|
|
20
|
+
* ── Circuit breaker ────────────────────────────────────────────────────────────
|
|
21
|
+
*
|
|
22
|
+
* After `ENSURE_FAILURE_THRESHOLD` consecutive failed ensures, the client fails
|
|
23
|
+
* fast with a typed error for `ENSURE_CIRCUIT_COOLDOWN_MS` rather than paying
|
|
24
|
+
* the full `ensureBackend` ready-timeout on every call. The breaker is
|
|
25
|
+
* per-process (a short-lived CLI cannot share it) — it bounds a retrying
|
|
26
|
+
* consumer, not the fleet; that is stated here rather than implied.
|
|
27
|
+
*
|
|
28
|
+
* Leaf module — `@adhd/sox-service-proxy` + node builtins.
|
|
29
|
+
*/
|
|
30
|
+
import { dialBackend, ensureBackend, probeSocketLive } from '@adhd/sox-service-proxy';
|
|
31
|
+
import { TransientEmbeddingError, PermanentEmbeddingError } from './errors.js';
|
|
32
|
+
import { EMBED_HOST_IDLE_GRACE_ENV, embedHostSingletonKey, embedHostSocketPath, resolveEmbedHostConfig, resolveEmbedHostMainPath, resolveEmbedHostStderrLogPath, } from './embedHostConfig.js';
|
|
33
|
+
/** Consecutive failed ensures before the breaker opens. */
|
|
34
|
+
export const ENSURE_FAILURE_THRESHOLD = 3;
|
|
35
|
+
/** How long the breaker stays open (fail-fast window) once tripped. */
|
|
36
|
+
export const ENSURE_CIRCUIT_COOLDOWN_MS = 10_000;
|
|
37
|
+
/** Bound on bringing the host up (`ensureBackend`'s readyTimeoutMs). */
|
|
38
|
+
export const HOST_READY_TIMEOUT_MS = 10_000;
|
|
39
|
+
/** Per-probe connect timeout. */
|
|
40
|
+
const PROBE_TIMEOUT_MS = 250;
|
|
41
|
+
/** Bound on a control call (reset/health) — never hang the caller. */
|
|
42
|
+
const CONTROL_TIMEOUT_MS = 5_000;
|
|
43
|
+
/**
|
|
44
|
+
* The last-constructed funnel client. `resetSharedFastembedHost()` targets it.
|
|
45
|
+
* Production constructs exactly one (via `getSharedFastembedProcess()`); tests
|
|
46
|
+
* that construct extras simply re-point it, which is why the reset helper is
|
|
47
|
+
* explicitly documented as operating on the current accessor client.
|
|
48
|
+
*/
|
|
49
|
+
let _activeClient = null;
|
|
50
|
+
/** TEST-ONLY: clear the active-client reference. */
|
|
51
|
+
export function __resetActiveFunnelClientForTests() {
|
|
52
|
+
_activeClient = null;
|
|
53
|
+
}
|
|
54
|
+
/** Extract a host/model/error message safely. */
|
|
55
|
+
function msg(err) {
|
|
56
|
+
return err instanceof Error ? err.message : String(err);
|
|
57
|
+
}
|
|
58
|
+
export class FunneledFastembedClient {
|
|
59
|
+
conn = null;
|
|
60
|
+
socketPath = null;
|
|
61
|
+
initContext = null;
|
|
62
|
+
ensurePromise = null;
|
|
63
|
+
_started = false;
|
|
64
|
+
_pending = 0;
|
|
65
|
+
nextId = 1;
|
|
66
|
+
consecutiveEnsureFailures = 0;
|
|
67
|
+
circuitOpenUntil = 0;
|
|
68
|
+
constructor() {
|
|
69
|
+
_activeClient = this;
|
|
70
|
+
}
|
|
71
|
+
/** True once the host has been resolved and the dial connection established. */
|
|
72
|
+
get started() {
|
|
73
|
+
return this._started;
|
|
74
|
+
}
|
|
75
|
+
/** In-flight request count on THIS consumer (not the host's). */
|
|
76
|
+
get pendingCount() {
|
|
77
|
+
return this._pending;
|
|
78
|
+
}
|
|
79
|
+
/** The resolved host socket path, or `null` before the first successful ensure. */
|
|
80
|
+
get hostSocketPath() {
|
|
81
|
+
return this.socketPath;
|
|
82
|
+
}
|
|
83
|
+
async request(payload, timeoutMs, signal) {
|
|
84
|
+
const type = typeof payload['type'] === 'string' ? payload['type'] : '';
|
|
85
|
+
if (type === 'init') {
|
|
86
|
+
// The host's identity is keyed on (model, ep, cacheDir), all carried by
|
|
87
|
+
// the init payload. Record it so `ensureHost()` can compute the key; a
|
|
88
|
+
// non-init first request is a programming error, reported honestly below.
|
|
89
|
+
if (!this.initContext) {
|
|
90
|
+
this.initContext = {
|
|
91
|
+
model: String(payload['model'] ?? ''),
|
|
92
|
+
cacheDir: String(payload['cacheDir'] ?? ''),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
await this.ensureHost();
|
|
97
|
+
const conn = this.conn;
|
|
98
|
+
if (!conn) {
|
|
99
|
+
// ensureHost() guarantees a connection or throws; this is unreachable but
|
|
100
|
+
// keeps the type honest rather than asserting.
|
|
101
|
+
throw new TransientEmbeddingError(`embedding funnel: no connection to host at ${this.socketPath ?? '(unresolved)'}`);
|
|
102
|
+
}
|
|
103
|
+
const id = `embed-funnel-${this.nextId++}`;
|
|
104
|
+
const request = { jsonrpc: '2.0', id, method: `embedding.${type}`, params: payload };
|
|
105
|
+
this._pending++;
|
|
106
|
+
try {
|
|
107
|
+
const resp = await this.awaitResponse(conn.send(request), id, timeoutMs, signal);
|
|
108
|
+
const error = resp.error;
|
|
109
|
+
if (error)
|
|
110
|
+
throw this.mapError(error);
|
|
111
|
+
return resp.result;
|
|
112
|
+
}
|
|
113
|
+
finally {
|
|
114
|
+
this._pending--;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* NO-OP by design: under `host: 'shared'` the host is shared with every other
|
|
119
|
+
* consumer on the machine — a consumer must never kill it. Its lifetime is
|
|
120
|
+
* governed solely by its own debounced, ref-counted teardown
|
|
121
|
+
* (`embedHostMain.ts`). Kept to satisfy `SharedFastembedClient`.
|
|
122
|
+
*/
|
|
123
|
+
async terminate() {
|
|
124
|
+
// Intentionally empty — see the method doc.
|
|
125
|
+
}
|
|
126
|
+
// ── internals ───────────────────────────────────────────────────────────────
|
|
127
|
+
mapError(error) {
|
|
128
|
+
const where = this.socketPath ?? '(unresolved socket)';
|
|
129
|
+
if (error.code === -32001) {
|
|
130
|
+
return new TransientEmbeddingError(`embedding host unavailable at ${where}: ${error.message}`, 1_000);
|
|
131
|
+
}
|
|
132
|
+
if (error.code === -32601) {
|
|
133
|
+
return new PermanentEmbeddingError(`embedding host does not implement the method: ${error.message}`);
|
|
134
|
+
}
|
|
135
|
+
// Application error from the private ONNX host (e.g. "Model not
|
|
136
|
+
// initialized") — preserve the pre-funnel `new Error(message)` shape so
|
|
137
|
+
// `FastembedProvider.initModel()`'s catch/retry logic is unchanged.
|
|
138
|
+
return new Error(error.message);
|
|
139
|
+
}
|
|
140
|
+
awaitResponse(pending, id, timeoutMs, signal) {
|
|
141
|
+
return new Promise((resolve, reject) => {
|
|
142
|
+
let settled = false;
|
|
143
|
+
let timer = null;
|
|
144
|
+
const onAbort = () => {
|
|
145
|
+
if (settled)
|
|
146
|
+
return;
|
|
147
|
+
settle();
|
|
148
|
+
reject(signal?.reason instanceof Error
|
|
149
|
+
? signal.reason
|
|
150
|
+
: new TransientEmbeddingError(`embedding funnel request ${id} aborted`));
|
|
151
|
+
};
|
|
152
|
+
const settle = () => {
|
|
153
|
+
settled = true;
|
|
154
|
+
if (timer)
|
|
155
|
+
clearTimeout(timer);
|
|
156
|
+
if (signal)
|
|
157
|
+
signal.removeEventListener('abort', onAbort);
|
|
158
|
+
};
|
|
159
|
+
if (timeoutMs !== undefined && timeoutMs > 0) {
|
|
160
|
+
timer = setTimeout(() => {
|
|
161
|
+
if (settled)
|
|
162
|
+
return;
|
|
163
|
+
settle();
|
|
164
|
+
reject(new TransientEmbeddingError(`embedding funnel request timed out after ${timeoutMs}ms`, timeoutMs));
|
|
165
|
+
}, timeoutMs);
|
|
166
|
+
}
|
|
167
|
+
if (signal) {
|
|
168
|
+
if (signal.aborted) {
|
|
169
|
+
onAbort();
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
173
|
+
}
|
|
174
|
+
pending.then((resp) => {
|
|
175
|
+
if (settled)
|
|
176
|
+
return;
|
|
177
|
+
settle();
|
|
178
|
+
resolve(resp);
|
|
179
|
+
}, (err) => {
|
|
180
|
+
if (settled)
|
|
181
|
+
return;
|
|
182
|
+
settle();
|
|
183
|
+
reject(new TransientEmbeddingError(`embedding funnel transport error: ${msg(err)}`, 1_000));
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
/** Idempotent: resolves once a host is live and dialed, or throws typed. */
|
|
188
|
+
ensureHost() {
|
|
189
|
+
if (this._started && this.conn?.isConnected())
|
|
190
|
+
return Promise.resolve();
|
|
191
|
+
if (this.ensurePromise)
|
|
192
|
+
return this.ensurePromise;
|
|
193
|
+
this.ensurePromise = this.doEnsure().finally(() => {
|
|
194
|
+
this.ensurePromise = null;
|
|
195
|
+
});
|
|
196
|
+
return this.ensurePromise;
|
|
197
|
+
}
|
|
198
|
+
async doEnsure() {
|
|
199
|
+
if (Date.now() < this.circuitOpenUntil) {
|
|
200
|
+
throw new TransientEmbeddingError(`embedding funnel circuit open for ${this.circuitOpenUntil - Date.now()}ms more after ` +
|
|
201
|
+
`${this.consecutiveEnsureFailures} consecutive ensure failures`, this.circuitOpenUntil - Date.now());
|
|
202
|
+
}
|
|
203
|
+
const cfg = resolveEmbedHostConfig();
|
|
204
|
+
const ctx = this.initContext;
|
|
205
|
+
if (!ctx) {
|
|
206
|
+
throw new TransientEmbeddingError('embedding funnel requires an {type:"init"} request before any other request ' +
|
|
207
|
+
'(the host is keyed on model + cacheDir, which only init carries)');
|
|
208
|
+
}
|
|
209
|
+
const ep = process.env['SOX_EMBED_EXECUTION_PROVIDER'] ?? 'auto';
|
|
210
|
+
const key = embedHostSingletonKey(ctx.model, ep, ctx.cacheDir);
|
|
211
|
+
const socketPath = embedHostSocketPath(cfg, key);
|
|
212
|
+
if (this.socketPath !== socketPath) {
|
|
213
|
+
// The identity changed (a different model/ep/cacheDir). Drop the old dial
|
|
214
|
+
// and re-point. The old host is NOT killed — it self-reaps.
|
|
215
|
+
this.conn?.close();
|
|
216
|
+
this.conn = null;
|
|
217
|
+
this._started = false;
|
|
218
|
+
this.socketPath = socketPath;
|
|
219
|
+
}
|
|
220
|
+
const live = await probeSocketLive(socketPath, PROBE_TIMEOUT_MS);
|
|
221
|
+
if (!live) {
|
|
222
|
+
const result = await ensureBackend({
|
|
223
|
+
socketPath,
|
|
224
|
+
singletonKey: key,
|
|
225
|
+
command: process.execPath,
|
|
226
|
+
args: [resolveEmbedHostMainPath()],
|
|
227
|
+
env: {
|
|
228
|
+
...process.env,
|
|
229
|
+
SOX_EMBED_HOST_SOCKET: socketPath,
|
|
230
|
+
// Internal cross-process transport for the typed idle bound: the
|
|
231
|
+
// spawned host consumes the value the spawner resolved here
|
|
232
|
+
// (`EmbedHostConfig.idleGraceMs`), which is what makes the resolved
|
|
233
|
+
// config field the consumed surface rather than a dead declaration.
|
|
234
|
+
// The public knob is `EmbeddingProviderConfig.idleGraceMs`.
|
|
235
|
+
[EMBED_HOST_IDLE_GRACE_ENV]: String(cfg.idleGraceMs),
|
|
236
|
+
},
|
|
237
|
+
stderrLogPath: resolveEmbedHostStderrLogPath(cfg),
|
|
238
|
+
readyTimeoutMs: HOST_READY_TIMEOUT_MS,
|
|
239
|
+
});
|
|
240
|
+
if (result.disposition === 'failed') {
|
|
241
|
+
this.noteEnsureFailure();
|
|
242
|
+
throw new TransientEmbeddingError(`embedding funnel could not bring up a host at ${socketPath}: ${result.detail}`, 1_000);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
this.consecutiveEnsureFailures = 0;
|
|
246
|
+
if (!this.conn) {
|
|
247
|
+
this.conn = dialBackend({
|
|
248
|
+
socketPath,
|
|
249
|
+
onDisconnect: () => {
|
|
250
|
+
// The host may have self-reaped (idle) or crashed. The next request's
|
|
251
|
+
// `send()` re-dials and, on failure, re-ensures. Mark unstarted so
|
|
252
|
+
// `ensureHost()` runs the full probe/spawn path again.
|
|
253
|
+
this._started = false;
|
|
254
|
+
},
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
this._started = true;
|
|
258
|
+
}
|
|
259
|
+
noteEnsureFailure() {
|
|
260
|
+
this.consecutiveEnsureFailures++;
|
|
261
|
+
if (this.consecutiveEnsureFailures >= ENSURE_FAILURE_THRESHOLD) {
|
|
262
|
+
this.circuitOpenUntil = Date.now() + ENSURE_CIRCUIT_COOLDOWN_MS;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Ask the live host to tear down and re-fork its PRIVATE pool, then drop this
|
|
267
|
+
* consumer's connection so the next request re-dials the (still-live) host.
|
|
268
|
+
* No-op when no host has been resolved. Public so the module-level
|
|
269
|
+
* `resetSharedFastembedHost()` can target the accessor client.
|
|
270
|
+
*/
|
|
271
|
+
async resetHost() {
|
|
272
|
+
if (!this.socketPath)
|
|
273
|
+
return;
|
|
274
|
+
try {
|
|
275
|
+
await this.control('embedding.reset');
|
|
276
|
+
}
|
|
277
|
+
catch {
|
|
278
|
+
// Best-effort: an unreachable host has either reaped (fine) or is wedged;
|
|
279
|
+
// dropping the connection lets the next request re-ensure.
|
|
280
|
+
}
|
|
281
|
+
finally {
|
|
282
|
+
this.dropConnection();
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Send a control method (`embedding.reset` / `embedding.health`) to the live
|
|
287
|
+
* host, bounded. Returns the result, or `null` when no host is resolved.
|
|
288
|
+
*/
|
|
289
|
+
async control(method) {
|
|
290
|
+
if (!this.conn || !this.socketPath)
|
|
291
|
+
return null;
|
|
292
|
+
const id = `embed-funnel-ctl-${this.nextId++}`;
|
|
293
|
+
const resp = await this.awaitResponse(this.conn.send({ jsonrpc: '2.0', id, method }), id, CONTROL_TIMEOUT_MS, undefined);
|
|
294
|
+
const error = resp.error;
|
|
295
|
+
if (error)
|
|
296
|
+
throw this.mapError(error);
|
|
297
|
+
return (resp.result ?? {});
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Drop this consumer's dial connection. The host stays alive.
|
|
301
|
+
*/
|
|
302
|
+
dropConnection() {
|
|
303
|
+
this.conn?.close();
|
|
304
|
+
this.conn = null;
|
|
305
|
+
this._started = false;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Ask the peer-shared host to tear down and re-fork its PRIVATE pool, then drop
|
|
310
|
+
* this consumer's connection so the next request re-dials the (still-live) host.
|
|
311
|
+
*
|
|
312
|
+
* This is memory-core's heal entry point: under `host: 'shared'`,
|
|
313
|
+
* `terminate()` is a no-op (a consumer must never kill a shared host), so a
|
|
314
|
+
* wedged private child is recovered by asking the host to reset its own pool.
|
|
315
|
+
* A no-op when no host has been resolved yet — nothing to reset.
|
|
316
|
+
*/
|
|
317
|
+
export async function resetSharedFastembedHost() {
|
|
318
|
+
await _activeClient?.resetHost();
|
|
319
|
+
}
|
|
320
|
+
//# sourceMappingURL=funnelClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"funnelClient.js","sourceRoot":"","sources":["../src/funnelClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAA0B,MAAM,yBAAyB,CAAC;AAC9G,OAAO,EAAE,uB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AC9C,EAAE,EACF,kBAAkB,EAClB,SAAS,CACV,CAAC;QACF,MAAM,KAAK,GAAI,IAA6B,CAAC,KAAK,CAAC;QACnD,IAAI,KAAK;YAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACtC,OAAO,CAAE,IAA6B,CAAC,MAAM,IAAI,EAAE,CAAM,CAAC;IAC5D,CAAC;IAED;;OAEG;IACK,cAAc;QACpB,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IACxB,CAAC;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB;IAC5C,MAAM,aAAa,EAAE,SAAS,EAAE,CAAC;AACnC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,13 @@ export interface EmbeddingHealth {
|
|
|
14
14
|
dimensions: number | null;
|
|
15
15
|
last_error: string | null;
|
|
16
16
|
execution_provider?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The resolved host-selection posture (SPEC-EMBEDDING-FUNNEL.md): `'shared'`
|
|
19
|
+
* funnels through the peer-spawned host, `'private'` is the pre-funnel
|
|
20
|
+
* per-process fork. Reported so an operator can see the active mode from one
|
|
21
|
+
* call (ADR-0013 D2) — never inferred, never a placeholder.
|
|
22
|
+
*/
|
|
23
|
+
host?: 'shared' | 'private';
|
|
17
24
|
}
|
|
18
25
|
export interface EmbeddingProvider {
|
|
19
26
|
readonly metadata: EmbeddingProviderMetadata;
|
|
@@ -30,17 +37,23 @@ export interface EmbeddingProviderConfig {
|
|
|
30
37
|
type: string;
|
|
31
38
|
model: string;
|
|
32
39
|
options?: Record<string, unknown>;
|
|
40
|
+
/**
|
|
41
|
+
* Host-selection posture (SPEC-EMBEDDING-FUNNEL.md; ADR-0013). Defaults to
|
|
42
|
+
* `'shared'` — funnel through the one peer-spawned, self-reaping host.
|
|
43
|
+
* `'private'` is the explicit pre-funnel per-process fork (CI/diagnostics);
|
|
44
|
+
* it is a closed union, never an env toggle, and is reported in `health()`.
|
|
45
|
+
*/
|
|
46
|
+
host?: 'shared' | 'private';
|
|
47
|
+
/**
|
|
48
|
+
* How long the peer-shared host lingers with zero clients and zero in-flight
|
|
49
|
+
* work before it reaps itself, in milliseconds. Typed config (owner directive:
|
|
50
|
+
* "the time bound should be configurable") — applied process-wide before the
|
|
51
|
+
* host is spawned, and reported in the host's `embedding.health`. Defaults to
|
|
52
|
+
* `DEFAULT_EMBED_HOST_IDLE_GRACE_MS` (30 s). Must be a positive number.
|
|
53
|
+
*/
|
|
54
|
+
idleGraceMs?: number;
|
|
33
55
|
}
|
|
34
|
-
export
|
|
35
|
-
readonly retryAfterMs: number | undefined;
|
|
36
|
-
constructor(message: string, retryAfterMs?: number);
|
|
37
|
-
}
|
|
38
|
-
export declare class PermanentEmbeddingError extends Error {
|
|
39
|
-
constructor(message: string);
|
|
40
|
-
}
|
|
41
|
-
export declare class ResolutionError extends Error {
|
|
42
|
-
constructor(message: string);
|
|
43
|
-
}
|
|
56
|
+
export { TransientEmbeddingError, PermanentEmbeddingError, ResolutionError } from './errors.js';
|
|
44
57
|
/**
|
|
45
58
|
* Static registration for a fastembed ONNX model.
|
|
46
59
|
* Each model has a known HF repo, dimension, context window, and description.
|
|
@@ -145,8 +158,18 @@ export { getSharedFastembedProcess, SharedFastembedProcessClient, resetSharedFas
|
|
|
145
158
|
* `resolveFastembedPoolSize` (kept for backward compatibility) used to
|
|
146
159
|
* compute as one value — see their doc comments for why the split exists.
|
|
147
160
|
*/
|
|
148
|
-
export type { SharedFastembedClient } from './sharedFastembedProcess.js';
|
|
149
|
-
export { FastembedProcessPool, AdaptiveFastembedProcessPool, type AdaptiveFastembedPoolOptions, FastembedBusyError, resolveFastembedPoolSize, resolveFastembedPoolPin, resolveFastembedPoolCeiling, resolveFastembedAdmissionLimit, } from './sharedFastembedProcess.js';
|
|
161
|
+
export type { SharedFastembedClient, PrivateFastembedProcess } from './sharedFastembedProcess.js';
|
|
162
|
+
export { getPrivateFastembedProcess, FastembedProcessPool, AdaptiveFastembedProcessPool, type AdaptiveFastembedPoolOptions, FastembedBusyError, resolveFastembedPoolSize, resolveFastembedPoolPin, resolveFastembedPoolCeiling, resolveFastembedAdmissionLimit, } from './sharedFastembedProcess.js';
|
|
163
|
+
/**
|
|
164
|
+
* The host-aware client and its heal entry point. `FunneledFastembedClient` is
|
|
165
|
+
* what `getSharedFastembedProcess()` returns by default (`host: 'shared'`):
|
|
166
|
+
* N processes share ONE peer-spawned, self-reaping ONNX host, and a consumer's
|
|
167
|
+
* `terminate()` is a no-op (it must never kill a shared host).
|
|
168
|
+
* `resetSharedFastembedHost()` is the heal path — it asks the live host to
|
|
169
|
+
* re-fork its private pool (memory-core's `reinitEmbedProvider` routes here).
|
|
170
|
+
*/
|
|
171
|
+
export { FunneledFastembedClient, resetSharedFastembedHost } from './funnelClient.js';
|
|
172
|
+
export { resolveEmbedHostConfig, configureEmbedHostHost, configureEmbedHostIdleGraceMs, resolveEmbedHostSocketDir, embedHostSingletonKey, embedHostSocketPath, resolveEmbedHostMainPath, resolveEmbedHostIdleGraceMs, EMBED_HOST_PROTOCOL_VERSION, DEFAULT_EMBED_HOST_IDLE_GRACE_MS, EMBED_HOST_IDLE_GRACE_ENV, type EmbedHostConfig, type EmbedHostMode, } from './embedHostConfig.js';
|
|
150
173
|
export declare function createEmbeddingProvider(config: EmbeddingProviderConfig): Promise<EmbeddingProvider>;
|
|
151
174
|
/**
|
|
152
175
|
* Single source of truth for the fastembed warmup/init timeout budget.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,S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,GAAG,MAAM,CAG7D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEzE"}
|
package/dist/index.js
CHANGED
|
@@ -3,27 +3,15 @@
|
|
|
3
3
|
import { existsSync } from 'node:fs';
|
|
4
4
|
import { homedir } from 'node:os';
|
|
5
5
|
import { join } from 'node:path';
|
|
6
|
+
// Local binding so this module's own throws/type-guards use the SAME classes the
|
|
7
|
+
// barrel re-exports (one home — see `errors.ts`).
|
|
8
|
+
import { ResolutionError } from './errors.js';
|
|
9
|
+
import { configureEmbedHostHost, configureEmbedHostIdleGraceMs } from './embedHostConfig.js';
|
|
6
10
|
// ── Error taxonomy — three tiers, no silent degradation ──────────────────────
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.name = 'TransientEmbeddingError';
|
|
12
|
-
this.retryAfterMs = retryAfterMs;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export class PermanentEmbeddingError extends Error {
|
|
16
|
-
constructor(message) {
|
|
17
|
-
super(message);
|
|
18
|
-
this.name = 'PermanentEmbeddingError';
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export class ResolutionError extends Error {
|
|
22
|
-
constructor(message) {
|
|
23
|
-
super(message);
|
|
24
|
-
this.name = 'ResolutionError';
|
|
25
|
-
}
|
|
26
|
-
}
|
|
11
|
+
// Defined in `errors.ts` so `funnelClient.ts` can throw them without importing
|
|
12
|
+
// this barrel (which re-exports the funnel client) — re-exported here so the
|
|
13
|
+
// public surface and `instanceof` identity are unchanged.
|
|
14
|
+
export { TransientEmbeddingError, PermanentEmbeddingError, ResolutionError } from './errors.js';
|
|
27
15
|
// ── Re-exports ────────────────────────────────────────────────────────────────
|
|
28
16
|
/**
|
|
29
17
|
* @deprecated SOX-BUG-002: dead API, not used by `createEmbeddingProvider` or
|
|
@@ -52,12 +40,45 @@ export { getSharedOnnxWorker, SharedOnnxWorkerClient, resetSharedOnnxWorker } fr
|
|
|
52
40
|
* root-cause writeup and rationale.
|
|
53
41
|
*/
|
|
54
42
|
export { getSharedFastembedProcess, SharedFastembedProcessClient, resetSharedFastembedProcess, } from './sharedFastembedProcess.js';
|
|
55
|
-
export { FastembedProcessPool, AdaptiveFastembedProcessPool, FastembedBusyError, resolveFastembedPoolSize, resolveFastembedPoolPin, resolveFastembedPoolCeiling, resolveFastembedAdmissionLimit, } from './sharedFastembedProcess.js';
|
|
43
|
+
export { getPrivateFastembedProcess, FastembedProcessPool, AdaptiveFastembedProcessPool, FastembedBusyError, resolveFastembedPoolSize, resolveFastembedPoolPin, resolveFastembedPoolCeiling, resolveFastembedAdmissionLimit, } from './sharedFastembedProcess.js';
|
|
44
|
+
// ── The embedding funnel (SPEC-EMBEDDING-FUNNEL.md) ────────────────────────────
|
|
45
|
+
/**
|
|
46
|
+
* The host-aware client and its heal entry point. `FunneledFastembedClient` is
|
|
47
|
+
* what `getSharedFastembedProcess()` returns by default (`host: 'shared'`):
|
|
48
|
+
* N processes share ONE peer-spawned, self-reaping ONNX host, and a consumer's
|
|
49
|
+
* `terminate()` is a no-op (it must never kill a shared host).
|
|
50
|
+
* `resetSharedFastembedHost()` is the heal path — it asks the live host to
|
|
51
|
+
* re-fork its private pool (memory-core's `reinitEmbedProvider` routes here).
|
|
52
|
+
*/
|
|
53
|
+
export { FunneledFastembedClient, resetSharedFastembedHost } from './funnelClient.js';
|
|
54
|
+
export { resolveEmbedHostConfig, configureEmbedHostHost, configureEmbedHostIdleGraceMs, resolveEmbedHostSocketDir, embedHostSingletonKey, embedHostSocketPath, resolveEmbedHostMainPath, resolveEmbedHostIdleGraceMs, EMBED_HOST_PROTOCOL_VERSION, DEFAULT_EMBED_HOST_IDLE_GRACE_MS, EMBED_HOST_IDLE_GRACE_ENV, } from './embedHostConfig.js';
|
|
56
55
|
// ── Factory ───────────────────────────────────────────────────────────────────
|
|
57
56
|
export async function createEmbeddingProvider(config) {
|
|
58
57
|
if (!config.type || typeof config.type !== 'string') {
|
|
59
58
|
throw new ResolutionError(`Invalid provider type: ${String(config.type)}`);
|
|
60
59
|
}
|
|
60
|
+
// SPEC-EMBEDDING-FUNNEL.md / ADR-0013: apply the typed host-selection posture
|
|
61
|
+
// BEFORE the accessor singleton is first constructed. Process-wide (the host
|
|
62
|
+
// is shared by every provider in the process); reported in `health()`.
|
|
63
|
+
if (config.host !== undefined) {
|
|
64
|
+
try {
|
|
65
|
+
configureEmbedHostHost(config.host);
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
throw new ResolutionError(`Invalid embedding host mode: ${err instanceof Error ? err.message : String(err)}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// Typed idle bound (owner directive: "the time bound should be configurable").
|
|
72
|
+
// Applied process-wide before the host is spawned; the spawner forwards the
|
|
73
|
+
// resolved value to the host, which consumes it.
|
|
74
|
+
if (config.idleGraceMs !== undefined) {
|
|
75
|
+
try {
|
|
76
|
+
configureEmbedHostIdleGraceMs(config.idleGraceMs);
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
throw new ResolutionError(`Invalid embedding idle grace: ${err instanceof Error ? err.message : String(err)}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
61
82
|
switch (config.type) {
|
|
62
83
|
case 'fastembed':
|
|
63
84
|
return createFastembedProvider(config);
|
|
@@ -79,9 +100,19 @@ async function createFastembedProvider(config) {
|
|
|
79
100
|
process.env['SOX_EMBED_CACHE_DIR'] ??
|
|
80
101
|
joinDefaultCacheDir();
|
|
81
102
|
try {
|
|
103
|
+
// SPEC-EMBEDDING-FUNNEL.md §E: NO eager warmup. Construction is deliberately
|
|
104
|
+
// INERT — it resolves the model's static metadata but does NOT load the ONNX
|
|
105
|
+
// model, and therefore does NOT spawn the shared embedding host. A host that
|
|
106
|
+
// constructs a provider but never embeds (e.g. `backlog query` on a read-only
|
|
107
|
+
// view) spawns zero hosts. The model loads — and the host spawns — on the
|
|
108
|
+
// first real `embedSingle`/`embedBatch`, via `FastembedProvider.ensureReady()`.
|
|
109
|
+
//
|
|
110
|
+
// Contract note (was: "throws ResolutionError at factory time if the model
|
|
111
|
+
// cannot load"): CONFIG errors (unknown model/type) still fail here at
|
|
112
|
+
// factory time. A MODEL-LOAD failure now surfaces on first use — still a
|
|
113
|
+
// loud, typed throw, never a silent downgrade — which is the cost of not
|
|
114
|
+
// paying a model load (and a host spawn) for a verb that never embeds.
|
|
82
115
|
const provider = new FastembedProvider(modelId, cfg.dim, cacheDir);
|
|
83
|
-
const cacheHit = isModelCached(cacheDir, cfg.hfRepoId);
|
|
84
|
-
await withTimeout(provider.embedSingle('warmup'), warmupOuterBudgetMs(cacheHit), 'fastembed warmup');
|
|
85
116
|
return provider;
|
|
86
117
|
}
|
|
87
118
|
catch (err) {
|
|
@@ -178,22 +209,6 @@ export function warmupOuterBudgetMs(cacheHit) {
|
|
|
178
209
|
export function isModelCached(cacheDir, hfRepoId) {
|
|
179
210
|
return existsSync(join(cacheDir, hfRepoId, 'model_optimized.onnx'));
|
|
180
211
|
}
|
|
181
|
-
function withTimeout(p, ms, label) {
|
|
182
|
-
return new Promise((resolve, reject) => {
|
|
183
|
-
const to = setTimeout(() => {
|
|
184
|
-
reject(new Error(`${label} timed out after ${ms}ms`));
|
|
185
|
-
}, ms);
|
|
186
|
-
if (typeof to.unref === 'function')
|
|
187
|
-
to.unref();
|
|
188
|
-
p.then((v) => {
|
|
189
|
-
clearTimeout(to);
|
|
190
|
-
resolve(v);
|
|
191
|
-
}, (e) => {
|
|
192
|
-
clearTimeout(to);
|
|
193
|
-
reject(e instanceof Error ? e : new Error(String(e)));
|
|
194
|
-
});
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
212
|
function joinDefaultCacheDir() {
|
|
198
213
|
const xdg = process.env['XDG_CACHE_HOME'];
|
|
199
214
|
return join(xdg ?? join(homedir(), '.cache'), 'sox', 'models');
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,iFAAiF;AAEjF,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,iFAAiF;AAEjF,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,iFAAiF;AACjF,kDAAkD;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAgE7F,gFAAgF;AAChF,+EAA+E;AAC/E,6EAA6E;AAC7E,0DAA0D;AAE1D,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAmEhG,iFAAiF;AAEjF;;;;;GAKG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAElD;;;;;;;GAOG;AACH,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE3G;;;;;;;;;GASG;AACH,OAAO,EACL,yBAAyB,EACzB,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,6BAA6B,CAAC;AAkBrC,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,4BAA4B,EAE5B,kBAAkB,EAClB,wBAAwB,EACxB,uBAAuB,EACvB,2BAA2B,EAC3B,8BAA8B,GAC/B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AAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;IACvD,CAAC;IACD,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC,CAAC;IAC/D,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC;AACzD,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAE3C;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAiB;IACnD,MAAM,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,OAAO,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,QAAgB,EAAE,QAAgB;IAC9D,OAAO,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,sBAAsB,CAAC,CAAC,CAAC;AACtE,CAAC;AAED,SAAS,mBAAmB;IAC1B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC1C,OAAO,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
*
|
|
44
44
|
* `fastembedProcessHost.ts`'s BL-331 lock check intentionally
|
|
45
45
|
* `console.error`s a loud, greppable line when a competing fastembed host is
|
|
46
|
-
* detected (
|
|
46
|
+
* detected (so an otherwise-unattributable embed-latency regression has a
|
|
47
|
+
* visible correlate), and
|
|
47
48
|
* `resolveExecutionProviders()` intentionally `console.error`s when
|
|
48
49
|
* `SOX_EMBED_EXECUTION_PROVIDER` forces a non-default provider. A blanket
|
|
49
50
|
* "pipe stderr, discard everything" fix would silently destroy both of those
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onnxStderrFilter.d.ts","sourceRoot":"","sources":["../src/onnxStderrFilter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"onnxStderrFilter.d.ts","sourceRoot":"","sources":["../src/onnxStderrFilter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAIH;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,CAAC,cAAc,EAC7B,IAAI,GAAE,MAAM,CAAC,cAA+B,GAC3C,IAAI,CAmBN"}
|
package/dist/onnxStderrFilter.js
CHANGED
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
*
|
|
44
44
|
* `fastembedProcessHost.ts`'s BL-331 lock check intentionally
|
|
45
45
|
* `console.error`s a loud, greppable line when a competing fastembed host is
|
|
46
|
-
* detected (
|
|
46
|
+
* detected (so an otherwise-unattributable embed-latency regression has a
|
|
47
|
+
* visible correlate), and
|
|
47
48
|
* `resolveExecutionProviders()` intentionally `console.error`s when
|
|
48
49
|
* `SOX_EMBED_EXECUTION_PROVIDER` forces a non-default provider. A blanket
|
|
49
50
|
* "pipe stderr, discard everything" fix would silently destroy both of those
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onnxStderrFilter.js","sourceRoot":"","sources":["../src/onnxStderrFilter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"onnxStderrFilter.js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