@lvy-jsd/dsh-tool-manager 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +99 -2
  2. package/cordis.patch.yml +13 -0
  3. package/lib/exempt.d.ts +45 -0
  4. package/lib/exempt.d.ts.map +1 -0
  5. package/lib/exempt.js +122 -0
  6. package/lib/exempt.js.map +1 -0
  7. package/lib/index.d.ts +1 -0
  8. package/lib/index.d.ts.map +1 -1
  9. package/lib/index.js +243 -34
  10. package/lib/index.js.map +1 -1
  11. package/lib/manifest.d.ts +21 -0
  12. package/lib/manifest.d.ts.map +1 -0
  13. package/lib/manifest.js +112 -0
  14. package/lib/manifest.js.map +1 -0
  15. package/lib/metadata.d.ts +38 -0
  16. package/lib/metadata.d.ts.map +1 -0
  17. package/lib/metadata.js +102 -0
  18. package/lib/metadata.js.map +1 -0
  19. package/lib/router/bm25.d.ts +21 -0
  20. package/lib/router/bm25.d.ts.map +1 -0
  21. package/lib/router/bm25.js +63 -0
  22. package/lib/router/bm25.js.map +1 -0
  23. package/lib/router/index.d.ts +9 -0
  24. package/lib/router/index.d.ts.map +1 -0
  25. package/lib/router/index.js +422 -0
  26. package/lib/router/index.js.map +1 -0
  27. package/lib/router/sidecar.d.ts +34 -0
  28. package/lib/router/sidecar.d.ts.map +1 -0
  29. package/lib/router/sidecar.js +156 -0
  30. package/lib/router/sidecar.js.map +1 -0
  31. package/lib/router/types.d.ts +164 -0
  32. package/lib/router/types.d.ts.map +1 -0
  33. package/lib/router/types.js +7 -0
  34. package/lib/router/types.js.map +1 -0
  35. package/lib/settings.d.ts +32 -0
  36. package/lib/settings.d.ts.map +1 -0
  37. package/lib/settings.js +93 -0
  38. package/lib/settings.js.map +1 -0
  39. package/lib/types.d.ts +137 -1
  40. package/lib/types.d.ts.map +1 -1
  41. package/package.json +8 -4
  42. package/sidecar/bin/tool-router-sidecar +0 -0
  43. package/src/exempt.ts +148 -0
  44. package/src/index.ts +245 -35
  45. package/src/manifest.ts +116 -0
  46. package/src/metadata.ts +123 -0
  47. package/src/router/bm25.ts +68 -0
  48. package/src/router/index.ts +440 -0
  49. package/src/router/sidecar.ts +159 -0
  50. package/src/router/types.ts +149 -0
  51. package/src/settings.ts +108 -0
  52. package/src/types.ts +134 -3
@@ -0,0 +1,422 @@
1
+ // The retrieval + routing layer, merged into dsh-tool-manager.
2
+ //
3
+ // dsh-tool-manager gives the model a directory and on-demand loading, but the
4
+ // model still has to guess the right keywords and spend turns searching. This
5
+ // module adds the retrieval layer that makes an unbounded catalog usable:
6
+ //
7
+ // tools_find(query) -> ranked matches (BM25, model-free, always available)
8
+ // tools_route(query) -> ranked matches, then loads them (the router)
9
+ //
10
+ // Retrieval is BM25 by default: no model, no network, works offline, and scales
11
+ // to a large catalog. When a model is configured (config.model {provider,
12
+ // model}), tools_route re-ranks the BM25 candidates with the model, so a
13
+ // natural-language intent that shares no words with a tool name still finds it.
14
+ // That is the RAG-MCP pattern: retrieve a small candidate set, then rank it.
15
+ //
16
+ // The BM25 index lives in a Rust sidecar process (sidecar/, tantivy over a Unix
17
+ // socket) for headroom: the hot path is native and the TypeScript here is a
18
+ // thin client. A dependency-free JS BM25 index is kept as the always-available
19
+ // fallback, so retrieval never breaks if the sidecar binary is missing or the
20
+ // process dies.
21
+ //
22
+ // It reuses the core's `toolCatalog` service (passed in by the core's apply),
23
+ // so it shares the catalog, the load path, and the token accounting. Without a
24
+ // catalog it falls back to the raw tool schemas and its own token estimate;
25
+ // tools_route then only retrieves (there is no load path to drive).
26
+ //
27
+ // Tool definitions are built by hand (no @deepseek-ai/dsh-tools import) so the
28
+ // retrieval layer stays self-contained.
29
+ import { existsSync } from 'node:fs';
30
+ import { dirname, join } from 'node:path';
31
+ import { fileURLToPath } from 'node:url';
32
+ import { Bm25 } from './bm25.js';
33
+ import { Sidecar } from './sidecar.js';
34
+ const pluginDir = dirname(fileURLToPath(import.meta.url));
35
+ // This module compiles to lib/router/index.js; the package root is two levels
36
+ // up. The npm package ships a prebuilt binary under sidecar/bin/; a source
37
+ // checkout has a dev build under sidecar/target/release/. Prefer the shipped one.
38
+ const sidecarBin = [
39
+ join(pluginDir, '..', '..', 'sidecar', 'bin', 'tool-router-sidecar'),
40
+ join(pluginDir, '..', '..', 'sidecar', 'target', 'release', 'tool-router-sidecar'),
41
+ ].find(existsSync);
42
+ // One socket per plugin load: the plugin is loaded once per DSH process, but
43
+ // tests load it many times (across processes and within one process), and a
44
+ // shared fixed path would make them fight over the same socket. The PID plus a
45
+ // per-load sequence keeps every instance on its own socket.
46
+ let sidecarSocketSeq = 0;
47
+ function sidecarSocketPath() {
48
+ sidecarSocketSeq += 1;
49
+ return join(pluginDir, '..', '..', `.sidecar-${process.pid}-${sidecarSocketSeq}.sock`);
50
+ }
51
+ // --- helpers -----------------------------------------------------------------
52
+ function estimateTokens(schema) {
53
+ const text = JSON.stringify(schema);
54
+ let wide = 0;
55
+ for (const ch of text)
56
+ if ((ch.codePointAt(0) ?? 0) > 0x2e7f)
57
+ wide += 1;
58
+ return Math.ceil((text.length - wide) / 4 + wide);
59
+ }
60
+ function fmtTokens(n) {
61
+ return n >= 1000 ? `~${(n / 1000).toFixed(1)}k tok` : `~${n} tok`;
62
+ }
63
+ function firstLine(text, max = 80) {
64
+ const flat = String(text ?? '').replace(/\s+/g, ' ').trim();
65
+ const first = flat.split(/(?<=[.!?。!?])\s/)[0] ?? '';
66
+ return first.length > max ? `${first.slice(0, max - 1)}…` : first;
67
+ }
68
+ function toolText(t) {
69
+ return `${t.name} ${t.summary} ${t.description} ${t.group} ${t.category}`;
70
+ }
71
+ function skillText(s) {
72
+ return `${s.name} ${s.summary} ${s.whenToUse ?? ''}`;
73
+ }
74
+ function formatFind(hits) {
75
+ if (!hits.length)
76
+ return 'No tools matched. Try different words, or tools_ls("/") to browse the directory.';
77
+ const lines = hits.map((h, i) => {
78
+ const t = h.ref;
79
+ const risk = t.highRisk ? ' [high risk]' : '';
80
+ return `${i + 1}. ${t.name}\n ${t.path} · ${fmtTokens(t.tokens)}${risk}\n ${t.summary}`;
81
+ });
82
+ return `Best matches (load with tools_route, or tools_load by path):\n${lines.join('\n')}`;
83
+ }
84
+ function formatSkillFind(hits) {
85
+ if (!hits.length)
86
+ return 'No skills matched. Try different words.';
87
+ const lines = hits.map((h, i) => {
88
+ const s = h.ref;
89
+ const extra = s.whenToUse ? ` — ${s.whenToUse}` : '';
90
+ return `${i + 1}. ${s.name}\n ${s.summary}${extra}`;
91
+ });
92
+ return `Best matching skills (load one with skills_route):\n${lines.join('\n')}`;
93
+ }
94
+ /** Build a tool definition by hand (no @deepseek-ai/dsh-tools dependency). */
95
+ function makeTool(tool) {
96
+ return {
97
+ ...tool,
98
+ output: {
99
+ schema: { type: 'string' },
100
+ render: (_args, value) => [{ type: 'text', text: String(value) }],
101
+ },
102
+ };
103
+ }
104
+ /**
105
+ * Register the retrieval + routing tools (tools_find, tools_route, skills_find,
106
+ * skills_route) on the host. Called by the core's apply() after it provides the
107
+ * toolCatalog service, so the router reuses the catalog, the load path, and the
108
+ * token accounting.
109
+ */
110
+ export function registerRouter(ctx, config = {}, catalog) {
111
+ const logger = (typeof ctx.logger === 'function' ? ctx.logger('tool-router') : ctx.logger) ?? console;
112
+ const cat = (catalog ?? ctx.toolCatalog ?? (typeof ctx.get === 'function' ? ctx.get('toolCatalog') : undefined));
113
+ const bm25 = new Bm25({ k1: config.k1, b: config.b });
114
+ const skillBm25 = new Bm25({ k1: config.k1, b: config.b });
115
+ const topK = config.topK ?? 8;
116
+ const maxBudget = config.maxBudget ?? 20000;
117
+ const model = config.model ?? {};
118
+ const llm = (typeof ctx.get === 'function' ? ctx.get('llm') : undefined);
119
+ const sidecar = new Sidecar({
120
+ bin: config.sidecar?.bin ?? sidecarBin ?? join(pluginDir, '..', '..', 'sidecar', 'bin', 'tool-router-sidecar'),
121
+ socket: config.sidecar?.socket ?? sidecarSocketPath(),
122
+ timeoutMs: config.sidecar?.timeoutMs,
123
+ logger,
124
+ });
125
+ // Refs aligned to index doc ids (the sidecar returns doc ids; we map them
126
+ // back to these refs). Kept in sync with the JS BM25 fallback.
127
+ let toolRefs = [];
128
+ let skillRefs = [];
129
+ /** The default working directory, used to scope the skill catalog view. */
130
+ function cwdOf() {
131
+ try {
132
+ const wd = typeof ctx.get === 'function' ? ctx.get('workingDirectory') : undefined;
133
+ return wd?.defaultDirectory;
134
+ }
135
+ catch {
136
+ return undefined;
137
+ }
138
+ }
139
+ /** Rebuild the tool index (JS fallback + sidecar) from the catalog. */
140
+ function rebuild() {
141
+ let tools;
142
+ if (cat && typeof cat.get === 'function') {
143
+ const c = cat.get();
144
+ tools = [...c.tools.values()].map((t) => ({
145
+ name: t.name,
146
+ path: `/${t.category}/${t.group}/${t.short}`,
147
+ summary: t.summary,
148
+ description: t.description,
149
+ group: t.group,
150
+ category: t.category,
151
+ tokens: t.tokens,
152
+ highRisk: t.highRisk === true,
153
+ }));
154
+ }
155
+ else {
156
+ tools = ctx.tools.schemas().map((s) => ({
157
+ name: s.name,
158
+ path: s.name,
159
+ summary: firstLine(s.description),
160
+ description: s.description ?? '',
161
+ group: '',
162
+ category: '',
163
+ tokens: estimateTokens(s),
164
+ highRisk: false,
165
+ }));
166
+ }
167
+ toolRefs = tools;
168
+ bm25.build(tools.map((t) => ({ ref: t, text: toolText(t) })));
169
+ void sidecar.index('tools', tools.map((t) => ({ ref: t, text: toolText(t) })));
170
+ }
171
+ rebuild();
172
+ if (cat) {
173
+ ctx.effect(() => ctx.on('tool-catalog/after-rebuild', () => rebuild()), 'tool-router.rebuild()');
174
+ }
175
+ // Tools register after this plugin's apply() runs (plugin load order), so the
176
+ // catalog is often empty on the first rebuild. Rebuild again, debounced, when
177
+ // the tool set changes so the index catches up without rebuilding per tool.
178
+ let rebuildTimer = null;
179
+ function scheduleRebuild() {
180
+ if (rebuildTimer)
181
+ return;
182
+ rebuildTimer = setTimeout(() => {
183
+ rebuildTimer = null;
184
+ rebuild();
185
+ }, 200);
186
+ rebuildTimer.unref?.();
187
+ }
188
+ try {
189
+ ctx.effect(() => ctx.on('tools/change', () => { scheduleRebuild(); }), 'tool-router.tools-change()');
190
+ }
191
+ catch (caught) {
192
+ logger?.warn?.(`tool-router: tools/change hook skipped: ${caught instanceof Error ? caught.message : String(caught)}`);
193
+ }
194
+ /**
195
+ * Rebuild the skill index from the skill registry. Skills have the same
196
+ * progressive-disclosure shape as tools: a cheap summary (name + description)
197
+ * here, the full body loaded on demand by skills_route.
198
+ */
199
+ async function rebuildSkills() {
200
+ // The skill registry is the cordis `skills` service, looked up via ctx.get
201
+ // (ctx.skills throws when the service is not injected into this plugin).
202
+ // list() takes {cwd, scope}; scope is left undefined for the global layer.
203
+ try {
204
+ const skillsApi = (typeof ctx.get === 'function' ? ctx.get('skills') : undefined);
205
+ if (!skillsApi || typeof skillsApi.list !== 'function')
206
+ return;
207
+ const cwd = cwdOf();
208
+ const skills = await skillsApi.list({ cwd });
209
+ const refs = skills
210
+ .filter((s) => s.invocation?.modelInvocable !== false)
211
+ .map((s) => ({
212
+ name: s.name,
213
+ summary: s.description ?? '',
214
+ whenToUse: s.whenToUse ?? '',
215
+ source: s.source,
216
+ provider: s.provider,
217
+ }));
218
+ skillRefs = refs;
219
+ skillBm25.build(refs.map((s) => ({ ref: s, text: skillText(s) })));
220
+ void sidecar.index('skills', refs.map((s) => ({ ref: s, text: skillText(s) })));
221
+ }
222
+ catch (caught) {
223
+ logger?.warn?.(`tool-router: skill index rebuild failed: ${caught instanceof Error ? caught.message : String(caught)}`);
224
+ }
225
+ }
226
+ // Start the sidecar, then rebuild the indexes. The initial rebuild() and
227
+ // rebuildSkills() runs fire before the sidecar is ready (and the catalog may
228
+ // still be empty at apply() time); rebuilding after start() re-reads the
229
+ // catalog and pushes a fresh index now that the sidecar is up.
230
+ void (async () => {
231
+ const ok = await sidecar.start();
232
+ if (!ok)
233
+ return;
234
+ rebuild();
235
+ void rebuildSkills();
236
+ })();
237
+ void rebuildSkills();
238
+ try {
239
+ ctx.effect(() => ctx.on('skills/change', () => { void rebuildSkills(); }), 'tool-router.skills-rebuild()');
240
+ }
241
+ catch (caught) {
242
+ logger?.warn?.(`tool-router: skills change hook skipped: ${caught instanceof Error ? caught.message : String(caught)}`);
243
+ }
244
+ // Kill the sidecar child and clear the pending rebuild on disposal.
245
+ ctx.effect(() => () => {
246
+ if (rebuildTimer)
247
+ clearTimeout(rebuildTimer);
248
+ sidecar.stop();
249
+ }, 'tool-router.sidecar-stop()');
250
+ /** Search the tool index: sidecar first, JS BM25 fallback. */
251
+ async function searchTools(query, limit) {
252
+ const hits = await sidecar.search('tools', query, limit);
253
+ if (hits)
254
+ return hits.map((h) => ({ ref: toolRefs[h.id], score: h.score }));
255
+ return bm25.search(query, limit);
256
+ }
257
+ /** Search the skill index: sidecar first, JS BM25 fallback. */
258
+ async function searchSkills(query, limit) {
259
+ const hits = await sidecar.search('skills', query, limit);
260
+ if (hits)
261
+ return hits.map((h) => ({ ref: skillRefs[h.id], score: h.score }));
262
+ return skillBm25.search(query, limit);
263
+ }
264
+ /**
265
+ * Optional model re-rank of the BM25 candidates. Returns the top-k refs.
266
+ * Any failure falls back to the BM25 order, so the router never breaks on a
267
+ * model hiccup.
268
+ */
269
+ async function rerank(query, candidates, k) {
270
+ if (!llm || !model.provider || !model.model || candidates.length <= k)
271
+ return candidates.slice(0, k);
272
+ const list = candidates.map((c, i) => `${i + 1}. ${c.ref.name}: ${c.ref.summary}`).join('\n');
273
+ const prompt = [
274
+ 'You are a tool router. Pick the tools that best fit the task.',
275
+ '',
276
+ `Task: ${query}`,
277
+ '',
278
+ 'Candidates:',
279
+ list,
280
+ '',
281
+ `Return the numbers of the best tools, comma-separated, at most ${k}. If none fit, return "none".`,
282
+ ].join('\n');
283
+ try {
284
+ let text = '';
285
+ let finished = false;
286
+ const options = {
287
+ provider: model.provider,
288
+ model: model.model,
289
+ system: 'You are a strict tool router. You answer with numbers only.',
290
+ messages: [{ role: 'user', content: [{ type: 'text', text: prompt }] }],
291
+ maxTokens: config.maxTokens ?? 24,
292
+ temperature: 0,
293
+ };
294
+ for await (const chunk of llm.stream(options)) {
295
+ if (finished)
296
+ break;
297
+ if (chunk.type === 'text-delta')
298
+ text += chunk.text ?? '';
299
+ else if (chunk.type === 'finish')
300
+ finished = true;
301
+ }
302
+ const picks = String(text).split(/[,\s]+/).map((s) => Number.parseInt(s, 10)).filter((n) => Number.isInteger(n) && n >= 1 && n <= candidates.length);
303
+ const unique = [...new Set(picks)].slice(0, k).map((n) => candidates[n - 1]);
304
+ return unique.length ? unique : candidates.slice(0, k);
305
+ }
306
+ catch (caught) {
307
+ logger?.warn?.(`tool-router: re-rank failed, using BM25 order: ${caught instanceof Error ? caught.message : String(caught)}`);
308
+ return candidates.slice(0, k);
309
+ }
310
+ }
311
+ function budgetReport(agent) {
312
+ if (!cat || typeof cat.wireTokens !== 'function')
313
+ return '';
314
+ const tokens = cat.wireTokens(agent);
315
+ const pct = Math.round((tokens / maxBudget) * 100);
316
+ return `Context budget: ${tokens} tokens of loaded tool schemas (${pct}% of the ${maxBudget} budget)${tokens > maxBudget ? ' — OVER budget; unload tools you no longer need' : ''}`;
317
+ }
318
+ // --- tools_find --------------------------------------------------------------
319
+ ctx.tools.register(makeTool({
320
+ name: 'tools_find',
321
+ description: 'Search the whole tool catalog by intent. Describe what you want to do in plain words (e.g. "send an email", "search the web", "read a PDF"); it returns the best-matching tools ranked by relevance, each with its path, one-line summary, and schema size. Use this before loading when you are not sure which tool fits. It retrieves only; it does not load anything.',
322
+ parameters: {
323
+ type: 'object',
324
+ properties: {
325
+ query: { type: 'string', description: 'What you want to do, in plain words.' },
326
+ limit: { type: 'number', description: `How many matches to return (default ${topK}).` },
327
+ },
328
+ required: ['query'],
329
+ additionalProperties: false,
330
+ },
331
+ isConcurrencySafe: () => true,
332
+ async execute(args) {
333
+ return formatFind(await searchTools(String(args.query), Number(args.limit ?? topK)));
334
+ },
335
+ }));
336
+ // --- tools_route -------------------------------------------------------------
337
+ ctx.tools.register(makeTool({
338
+ name: 'tools_route',
339
+ description: 'Find the tools that fit a task and load them in one step. Describe the task in plain words; it retrieves the best matches, re-ranks them with the model when one is configured, and loads them so they are callable from your next step. Use this to get set up for a task without browsing the directory. Pass load=false to only retrieve, without loading.',
340
+ parameters: {
341
+ type: 'object',
342
+ properties: {
343
+ query: { type: 'string', description: 'The task, in plain words.' },
344
+ limit: { type: 'number', description: `How many tools to load (default ${topK}).` },
345
+ load: { type: 'boolean', description: 'Load the matches (default true). Set false to only retrieve.' },
346
+ },
347
+ required: ['query'],
348
+ additionalProperties: false,
349
+ },
350
+ async execute(args, exec) {
351
+ const agent = exec?.agent;
352
+ const want = Number(args.limit ?? topK);
353
+ const candidates = await searchTools(String(args.query), Math.max(want, 10));
354
+ const ranked = await rerank(String(args.query), candidates, want);
355
+ if (args.load === false || !cat)
356
+ return formatFind(ranked);
357
+ if (!agent)
358
+ return formatFind(ranked);
359
+ const targets = ranked.map((h) => h.ref.name);
360
+ const result = await cat.load(agent, targets);
361
+ const budget = budgetReport(agent);
362
+ return budget ? `${result}\n${budget}` : result;
363
+ },
364
+ }));
365
+ // --- skills_find -------------------------------------------------------------
366
+ ctx.tools.register(makeTool({
367
+ name: 'skills_find',
368
+ description: 'Search the whole skill catalog by intent. Describe the kind of task you are doing (e.g. "write a pull request", "develop a DSH plugin", "add a badge"); it returns the best-matching skills ranked by relevance, each with its name and one-line description. Use this before loading when you are not sure which skill fits. It retrieves only; it does not load anything.',
369
+ parameters: {
370
+ type: 'object',
371
+ properties: {
372
+ query: { type: 'string', description: 'The kind of task you are doing, in plain words.' },
373
+ limit: { type: 'number', description: `How many matches to return (default ${topK}).` },
374
+ },
375
+ required: ['query'],
376
+ additionalProperties: false,
377
+ },
378
+ isConcurrencySafe: () => true,
379
+ async execute(args) {
380
+ return formatSkillFind(await searchSkills(String(args.query), Number(args.limit ?? topK)));
381
+ },
382
+ }));
383
+ // --- skills_route ------------------------------------------------------------
384
+ ctx.tools.register(makeTool({
385
+ name: 'skills_route',
386
+ description: 'Find the best skill for a task and load its full instructions in one step. Describe the task in plain words; it retrieves the best matches, re-ranks them with the model when one is configured, and returns the top skill\'s complete body so you can act on it immediately. Use this to get the right instructions without browsing the skill catalog.',
387
+ parameters: {
388
+ type: 'object',
389
+ properties: {
390
+ query: { type: 'string', description: 'The task, in plain words.' },
391
+ limit: { type: 'number', description: `How many candidates to consider (default ${topK}).` },
392
+ },
393
+ required: ['query'],
394
+ additionalProperties: false,
395
+ },
396
+ async execute(args) {
397
+ const want = Number(args.limit ?? topK);
398
+ const candidates = await searchSkills(String(args.query), Math.max(want, 5));
399
+ if (!candidates.length)
400
+ return 'No skills matched. Try different words.';
401
+ const ranked = await rerank(String(args.query), candidates, want);
402
+ const top = ranked[0];
403
+ let body = '';
404
+ try {
405
+ const skillsApi = (typeof ctx.get === 'function' ? ctx.get('skills') : undefined);
406
+ const def = skillsApi ? await skillsApi.get(top.ref.name, { cwd: cwdOf() }) : undefined;
407
+ if (def?.content)
408
+ body = def.content;
409
+ }
410
+ catch {
411
+ // fall through to the summary
412
+ }
413
+ const others = ranked.slice(1).map((r) => r.ref.name);
414
+ const header = `Loaded skill "${top.ref.name}"${top.ref.source ? ` (source: ${top.ref.source})` : ''}:`;
415
+ const rest = body ? `\n\n${body}` : `\n\n${top.ref.summary}${top.ref.whenToUse ? ` — ${top.ref.whenToUse}` : ''}`;
416
+ return others.length ? `${header}${rest}\n\nOther candidates: ${others.join(', ')}` : `${header}${rest}`;
417
+ },
418
+ }));
419
+ if (!cat)
420
+ logger?.info?.('tool-router: no toolCatalog service; tools_route retrieves only');
421
+ }
422
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,0EAA0E;AAC1E,EAAE;AACF,+EAA+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,yBAAyB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,IAAI,EAAE,CAAA;QAC1G,CAAC;KACF,CAAC,CAAC,CAAA;IAEH,IAAI,CAAC,GAAG;QAAE,MAAM,EAAE,IAAI,EAAE,CAAC,iEAAiE,CAAC,CAAA;AAC7F,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { Logger } from './types.js';
2
+ export interface SidecarOptions {
3
+ bin: string;
4
+ socket: string;
5
+ timeoutMs?: number;
6
+ logger?: Logger;
7
+ }
8
+ export declare class Sidecar {
9
+ private bin;
10
+ private socket;
11
+ private timeoutMs;
12
+ private logger?;
13
+ private child;
14
+ private sock;
15
+ private buf;
16
+ private pending;
17
+ private nextId;
18
+ private ready;
19
+ constructor({ bin, socket, timeoutMs, logger }: SidecarOptions);
20
+ start(): Promise<boolean>;
21
+ private _connect;
22
+ private _onData;
23
+ private _request;
24
+ index(name: string, docs: {
25
+ ref: unknown;
26
+ text: string;
27
+ }[]): Promise<boolean>;
28
+ search(index: string, query: string, limit: number): Promise<{
29
+ id: number;
30
+ score: number;
31
+ }[] | null>;
32
+ stop(): void;
33
+ }
34
+ //# sourceMappingURL=sidecar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sidecar.d.ts","sourceRoot":"","sources":["../../src/router/sidecar.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAexC,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,qBAAa,OAAO;IAClB,OAAO,CAAC,GAAG,CAAQ;IACnB,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,MAAM,CAAC,CAAQ;IACvB,OAAO,CAAC,KAAK,CAA4B;IACzC,OAAO,CAAC,IAAI,CAAsB;IAClC,OAAO,CAAC,GAAG,CAAK;IAChB,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,MAAM,CAAI;IAClB,OAAO,CAAC,KAAK,CAAQ;gBAET,EAAE,GAAG,EAAE,MAAM,EAAE,SAAgB,EAAE,MAAM,EAAE,EAAE,cAAc;IAO/D,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC;IAkC/B,OAAO,CAAC,QAAQ;IAehB,OAAO,CAAC,OAAO;IAmBf,OAAO,CAAC,QAAQ;IAmBV,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;QAAE,GAAG,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAQ7E,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,GAAG,IAAI,CAAC;IAO1G,IAAI,IAAI,IAAI;CAOb"}
@@ -0,0 +1,156 @@
1
+ // A thin client over the Rust sidecar. It spawns the binary, pushes the
2
+ // catalog on change, and asks for ranked hits. Any failure (missing binary,
3
+ // dead process, timeout) resolves to null so the caller falls back to the JS
4
+ // BM25 index.
5
+ import { spawn } from 'node:child_process';
6
+ import { connect } from 'node:net';
7
+ import { existsSync } from 'node:fs';
8
+ export class Sidecar {
9
+ bin;
10
+ socket;
11
+ timeoutMs;
12
+ logger;
13
+ child = null;
14
+ sock = null;
15
+ buf = '';
16
+ pending = new Map();
17
+ nextId = 1;
18
+ ready = false;
19
+ constructor({ bin, socket, timeoutMs = 2000, logger }) {
20
+ this.bin = bin;
21
+ this.socket = socket;
22
+ this.timeoutMs = timeoutMs;
23
+ this.logger = logger;
24
+ }
25
+ async start() {
26
+ if (!existsSync(this.bin)) {
27
+ this.logger?.warn?.(`tool-router: sidecar binary not found at ${this.bin}; using JS BM25`);
28
+ return false;
29
+ }
30
+ try {
31
+ this.child = spawn(this.bin, ['--socket', this.socket], { stdio: ['ignore', 'ignore', 'pipe'] });
32
+ this.child.stderr?.on('data', (d) => this.logger?.debug?.(`tool-router sidecar: ${String(d).trim()}`));
33
+ this.child.on('exit', (code) => {
34
+ this.logger?.warn?.(`tool-router: sidecar exited (code ${code}); falling back to JS BM25`);
35
+ this.ready = false;
36
+ this.sock?.destroy();
37
+ this.sock = null;
38
+ });
39
+ for (let attempt = 0; attempt < 50; attempt++) {
40
+ try {
41
+ await this._connect();
42
+ break;
43
+ }
44
+ catch {
45
+ await new Promise((r) => setTimeout(r, 100));
46
+ }
47
+ }
48
+ if (!this.sock) {
49
+ this.logger?.warn?.('tool-router: sidecar start: no socket after connect loop');
50
+ return false;
51
+ }
52
+ const pong = await this._request({ op: 'ping' });
53
+ if (!pong?.ok) {
54
+ this.logger?.warn?.(`tool-router: sidecar start: ping failed: ${JSON.stringify(pong)}`);
55
+ return false;
56
+ }
57
+ this.ready = true;
58
+ this.logger?.info?.('tool-router: Rust sidecar active (tantivy BM25)');
59
+ return true;
60
+ }
61
+ catch (caught) {
62
+ this.logger?.warn?.(`tool-router: sidecar start failed: ${caught instanceof Error ? caught.message : String(caught)}`);
63
+ return false;
64
+ }
65
+ }
66
+ _connect() {
67
+ return new Promise((resolve, reject) => {
68
+ const s = connect({ path: this.socket });
69
+ s.once('connect', () => {
70
+ this.sock = s;
71
+ s.setEncoding('utf8');
72
+ s.on('data', (chunk) => this._onData(chunk));
73
+ s.on('close', () => { this.ready = false; this.sock = null; });
74
+ s.on('error', () => { });
75
+ resolve();
76
+ });
77
+ s.once('error', reject);
78
+ });
79
+ }
80
+ _onData(chunk) {
81
+ this.buf += chunk;
82
+ let idx;
83
+ while ((idx = this.buf.indexOf('\n')) >= 0) {
84
+ const line = this.buf.slice(0, idx);
85
+ this.buf = this.buf.slice(idx + 1);
86
+ if (!line.trim())
87
+ continue;
88
+ let msg;
89
+ try {
90
+ msg = JSON.parse(line);
91
+ }
92
+ catch {
93
+ continue;
94
+ }
95
+ const id = msg.id;
96
+ if (id === undefined)
97
+ continue;
98
+ const p = this.pending.get(id);
99
+ if (!p)
100
+ continue;
101
+ this.pending.delete(id);
102
+ clearTimeout(p.timer);
103
+ p.resolve(msg);
104
+ }
105
+ }
106
+ _request(msg, timeoutMs = this.timeoutMs) {
107
+ // Only gate on the socket, not on this.ready: the ping is what sets ready,
108
+ // so gating on ready would make the ping itself unreachable. this.sock is
109
+ // kept in sync with the connection lifecycle (set on connect, nulled on
110
+ // close/exit/stop), so it is the correct liveness check.
111
+ if (!this.sock)
112
+ return Promise.resolve(null);
113
+ const sock = this.sock;
114
+ const id = this.nextId++;
115
+ msg.id = id;
116
+ return new Promise((resolve) => {
117
+ const timer = setTimeout(() => {
118
+ this.pending.delete(id);
119
+ resolve(null);
120
+ }, timeoutMs);
121
+ this.pending.set(id, { resolve, timer });
122
+ sock.write(JSON.stringify(msg) + '\n');
123
+ });
124
+ }
125
+ async index(name, docs) {
126
+ if (!this.ready)
127
+ return false;
128
+ const res = await this._request({ op: 'index', name, docs });
129
+ if (res?.ok)
130
+ return true;
131
+ this.logger?.warn?.(`tool-router: sidecar index ${name} failed: ${res?.error ?? 'no response'}`);
132
+ return false;
133
+ }
134
+ async search(index, query, limit) {
135
+ if (!this.ready)
136
+ return null;
137
+ const res = await this._request({ op: 'search', index, query, limit });
138
+ if (!res?.ok)
139
+ return null;
140
+ return res.hits ?? null;
141
+ }
142
+ stop() {
143
+ try {
144
+ this.sock?.destroy();
145
+ }
146
+ catch { /* ignore */ }
147
+ this.sock = null;
148
+ try {
149
+ this.child?.kill();
150
+ }
151
+ catch { /* ignore */ }
152
+ this.child = null;
153
+ this.ready = false;
154
+ }
155
+ }
156
+ //# sourceMappingURL=sidecar.js.map
@@ -0,0 +1 @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