@mcoda/mswarm 0.1.60 → 0.1.65

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.
@@ -4,7 +4,7 @@ import { createProvider } from "../providers/ProviderRegistry.js";
4
4
  import { OpenAiCompatibleProvider } from "../providers/OpenAiCompatibleProvider.js";
5
5
  import { OllamaRemoteProvider } from "../providers/OllamaRemoteProvider.js";
6
6
  import { CodexCliProvider } from "../providers/CodexCliProvider.js";
7
- import { DocdexClient } from "../docdex/DocdexClient.js";
7
+ import { DocdexClient, normalizeDocdexRuntimeOperation, } from "../docdex/DocdexClient.js";
8
8
  import { createDiffTool } from "../tools/diff/DiffTool.js";
9
9
  import { createDocdexTools } from "../tools/docdex/DocdexTools.js";
10
10
  import { createFileTools } from "../tools/filesystem/FileTools.js";
@@ -29,6 +29,35 @@ const WEB_TOOL_NAMES = new Set(["docdex_web_research"]);
29
29
  const MEMORY_WRITE_TOOL_NAMES = new Set(["docdex_memory_save"]);
30
30
  const PROFILE_WRITE_TOOL_NAMES = new Set(["docdex_save_preference"]);
31
31
  const INDEX_REBUILD_TOOL_NAMES = new Set(["docdex_index_rebuild", "docdex_index_ingest"]);
32
+ const DOCDEX_TOOL_OPERATIONS = new Map([
33
+ ["docdex_health", ["health"]],
34
+ ["docdex_initialize", ["initialize"]],
35
+ ["docdex_search", ["search"]],
36
+ ["docdex_open", ["open", "snippet"]],
37
+ ["docdex_open_file", ["open"]],
38
+ ["docdex_symbols", ["symbols"]],
39
+ ["docdex_ast", ["ast"]],
40
+ ["docdex_impact_graph", ["impact_graph"]],
41
+ ["docdex_impact_diagnostics", ["impact_diagnostics"]],
42
+ ["docdex_dag_export", ["dag_export"]],
43
+ ["docdex_tree", ["tree"]],
44
+ ["docdex_memory_save", ["memory_save"]],
45
+ ["docdex_memory_recall", ["memory_recall"]],
46
+ ["docdex_get_profile", ["profile_read"]],
47
+ ["docdex_save_preference", ["profile_write"]],
48
+ ["docdex_web_research", ["web_research"]],
49
+ ["docdex_chat_context", ["chat_context"]],
50
+ ["docdex_rerank", ["rerank"]],
51
+ ["docdex_batch_search", ["batch_search"]],
52
+ ["docdex_capabilities", ["capabilities"]],
53
+ ["docdex_stats", ["stats"]],
54
+ ["docdex_files", ["files"]],
55
+ ["docdex_repo_inspect", ["repo_inspect"]],
56
+ ["docdex_index_rebuild", ["index_rebuild"]],
57
+ ["docdex_index_ingest", ["index_ingest"]],
58
+ ["docdex_delegate", ["delegate"]],
59
+ ["docdex_hooks_validate", ["hooks_validate"]],
60
+ ]);
32
61
  const RUNTIME_TO_PROTOCOL_NEEDS = new Map([
33
62
  ["docdex_search", ["docdex.search"]],
34
63
  ["docdex_open", ["docdex.open", "docdex.snippet"]],
@@ -36,6 +65,7 @@ const RUNTIME_TO_PROTOCOL_NEEDS = new Map([
36
65
  ["docdex_symbols", ["docdex.symbols"]],
37
66
  ["docdex_ast", ["docdex.ast"]],
38
67
  ["docdex_web_research", ["docdex.web"]],
68
+ ["docdex_chat_context", ["docdex.chat_context"]],
39
69
  ["docdex_impact_graph", ["docdex.impact"]],
40
70
  ["docdex_impact_diagnostics", ["docdex.impact_diagnostics"]],
41
71
  ["docdex_tree", ["docdex.tree"]],
@@ -51,6 +81,7 @@ const PROTOCOL_TO_RUNTIME_TOOL_NAMES = new Map([
51
81
  ["docdex.symbols", ["docdex_symbols"]],
52
82
  ["docdex.ast", ["docdex_ast"]],
53
83
  ["docdex.web", ["docdex_web_research"]],
84
+ ["docdex.chat_context", ["docdex_chat_context"]],
54
85
  ["docdex.impact", ["docdex_impact_graph"]],
55
86
  ["docdex.impact_diagnostics", ["docdex_impact_diagnostics"]],
56
87
  ["docdex.tree", ["docdex_tree"]],
@@ -516,10 +547,43 @@ const isRuntimeToolAllowed = (toolName, policy) => {
516
547
  }
517
548
  return true;
518
549
  };
550
+ const allowedDocdexOperations = (docdex) => {
551
+ if (!docdex?.allowedOperations?.length)
552
+ return undefined;
553
+ const operations = docdex.allowedOperations
554
+ .map((entry) => normalizeDocdexRuntimeOperation(entry))
555
+ .filter((entry) => Boolean(entry));
556
+ return operations.length ? new Set(operations) : new Set();
557
+ };
558
+ const docdexCapabilityAllows = (docdex, operation) => {
559
+ if (!docdex?.capabilities)
560
+ return true;
561
+ for (const [key, value] of Object.entries(docdex.capabilities)) {
562
+ if (normalizeDocdexRuntimeOperation(key) === operation && value === false) {
563
+ return false;
564
+ }
565
+ }
566
+ return true;
567
+ };
568
+ const isDocdexRuntimeOperationAllowed = (toolName, docdex) => {
569
+ const operations = DOCDEX_TOOL_OPERATIONS.get(toolName);
570
+ if (!operations?.length)
571
+ return true;
572
+ const allowedOperations = allowedDocdexOperations(docdex);
573
+ return operations.some((operation) => {
574
+ if (allowedOperations && !allowedOperations.has(operation)) {
575
+ return false;
576
+ }
577
+ return docdexCapabilityAllows(docdex, operation);
578
+ });
579
+ };
519
580
  const isDocdexToolAllowed = (toolName, docdex) => {
520
581
  if (!toolName.startsWith("docdex_")) {
521
582
  return true;
522
583
  }
584
+ if (docdex?.enabled === false) {
585
+ return false;
586
+ }
523
587
  if (docdex?.allowWeb === false && WEB_TOOL_NAMES.has(toolName)) {
524
588
  return false;
525
589
  }
@@ -532,6 +596,9 @@ const isDocdexToolAllowed = (toolName, docdex) => {
532
596
  if (docdex?.allowIndexRebuild === false && INDEX_REBUILD_TOOL_NAMES.has(toolName)) {
533
597
  return false;
534
598
  }
599
+ if (!isDocdexRuntimeOperationAllowed(toolName, docdex)) {
600
+ return false;
601
+ }
535
602
  return true;
536
603
  };
537
604
  const registerRuntimeTool = (registry, tool, policy, docdex) => {
@@ -563,6 +630,11 @@ const buildRuntimeToolRegistry = (input) => {
563
630
  repoId: input.docdex?.repoId,
564
631
  repoRoot: input.docdex?.repoRoot ?? input.workspace.root,
565
632
  dagSessionId: input.docdex?.dagSessionId ?? input.metadata?.requestId,
633
+ apiKey: input.docdex?.apiKey,
634
+ credentialSource: input.docdex?.credentialSource,
635
+ required: input.docdex?.required,
636
+ allowedOperations: input.docdex?.allowedOperations,
637
+ capabilities: input.docdex?.capabilities,
566
638
  });
567
639
  for (const tool of createDocdexTools(docdexClient))
568
640
  register(tool);
@@ -1 +1 @@
1
- {"version":3,"file":"ToolRegistry.d.ts","sourceRoot":"","sources":["../../src/tools/ToolRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,cAAc,EAGnB,KAAK,mBAAmB,EAGzB,MAAM,gBAAgB,CAAC;AAyOxB,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAqC;IAElD,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IAOpC,IAAI,IAAI,cAAc,EAAE;IAIxB,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,aAAa,GAAG,aAAa,CAAC,CAAC;IAQzE,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAkC/F"}
1
+ {"version":3,"file":"ToolRegistry.d.ts","sourceRoot":"","sources":["../../src/tools/ToolRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,cAAc,EAGnB,KAAK,mBAAmB,EAGzB,MAAM,gBAAgB,CAAC;AAwQxB,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAqC;IAElD,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IAOpC,IAAI,IAAI,cAAc,EAAE;IAIxB,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,aAAa,GAAG,aAAa,CAAC,CAAC;IAQzE,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAkC/F"}
@@ -194,11 +194,41 @@ const PERMISSION_DENIED_PATTERNS = [
194
194
  "eacces",
195
195
  "eperm",
196
196
  ];
197
+ const PRESERVED_ERROR_CODES = new Set([
198
+ "tool_unknown",
199
+ "tool_schema_invalid",
200
+ "tool_invalid_args",
201
+ "tool_permission_denied",
202
+ "tool_timeout",
203
+ "tool_execution_failed",
204
+ "docdex_context_missing",
205
+ "docdex_api_key_missing",
206
+ "docdex_operation_not_allowed",
207
+ "docdex_auth_failed",
208
+ "docdex_repo_access_denied",
209
+ "docdex_unavailable",
210
+ ]);
211
+ const preservedErrorCode = (error) => {
212
+ if (!isObject(error))
213
+ return undefined;
214
+ const code = error.code;
215
+ return typeof code === "string" && PRESERVED_ERROR_CODES.has(code)
216
+ ? code
217
+ : undefined;
218
+ };
197
219
  const normalizeExecutionError = (error) => {
198
220
  if (error instanceof ToolExecutionError) {
199
221
  return error.toToolError();
200
222
  }
223
+ const explicitCode = preservedErrorCode(error);
201
224
  const message = error instanceof Error ? error.message : String(error);
225
+ if (explicitCode) {
226
+ const retryable = isObject(error) && typeof error.retryable === "boolean"
227
+ ? error.retryable
228
+ : explicitCode === "tool_timeout" || explicitCode === "docdex_unavailable";
229
+ const details = isObject(error) && isObject(error.details) ? error.details : undefined;
230
+ return buildToolError(explicitCode, message, { retryable, details });
231
+ }
202
232
  const normalized = message.toLowerCase();
203
233
  if (normalized.includes("timeout") || normalized.includes("timed out") || normalized.includes("etimedout")) {
204
234
  return buildToolError("tool_timeout", message, { retryable: true });
@@ -27,7 +27,7 @@ export interface ToolInputSchema extends ToolSchemaDefinition {
27
27
  properties?: Record<string, ToolSchemaDefinition>;
28
28
  required?: string[];
29
29
  }
30
- export type ToolErrorCode = "tool_unknown" | "tool_schema_invalid" | "tool_invalid_args" | "tool_permission_denied" | "tool_timeout" | "tool_execution_failed";
30
+ export type ToolErrorCode = "tool_unknown" | "tool_schema_invalid" | "tool_invalid_args" | "tool_permission_denied" | "tool_timeout" | "tool_execution_failed" | "docdex_context_missing" | "docdex_api_key_missing" | "docdex_operation_not_allowed" | "docdex_auth_failed" | "docdex_repo_access_denied" | "docdex_unavailable";
31
31
  export type ToolErrorCategory = "lookup" | "schema" | "validation" | "permission" | "timeout" | "execution";
32
32
  export interface ToolError {
33
33
  code: ToolErrorCode;
@@ -1 +1 @@
1
- {"version":3,"file":"ToolTypes.d.ts","sourceRoot":"","sources":["../../src/tools/ToolTypes.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,MAAM,uBAAuB,GAC/B,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,SAAS,GACT,QAAQ,GACR,OAAO,GACP,MAAM,CAAC;AAEX,MAAM,WAAW,oBAAqB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACnE,IAAI,CAAC,EAAE,uBAAuB,GAAG,uBAAuB,EAAE,CAAC;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IAClD,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAA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IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAGzC,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAO;IAU1E,WAAW,IAAI,SAAS;CASzB;AAED,eAAO,MAAM,wBAAwB,GAAI,MAAM,aAAa,KAAG,iBAgB9D,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC5D,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE9F,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,OAAO,EAAE,WAAW,CAAC;CACtB"}
@@ -28,5 +28,13 @@ export const toolErrorCategoryForCode = (code) => {
28
28
  return "permission";
29
29
  if (code === "tool_timeout")
30
30
  return "timeout";
31
+ if (code === "docdex_context_missing")
32
+ return "validation";
33
+ if (code === "docdex_api_key_missing" ||
34
+ code === "docdex_operation_not_allowed" ||
35
+ code === "docdex_auth_failed" ||
36
+ code === "docdex_repo_access_denied") {
37
+ return "permission";
38
+ }
31
39
  return "execution";
32
40
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DocdexTools.d.ts","sourceRoot":"","sources":["../../../src/tools/docdex/DocdexTools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAOjE,eAAO,MAAM,iBAAiB,GAAI,QAAQ,YAAY,KAAG,cAAc,EA8ftE,CAAC"}
1
+ {"version":3,"file":"DocdexTools.d.ts","sourceRoot":"","sources":["../../../src/tools/docdex/DocdexTools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAOjE,eAAO,MAAM,iBAAiB,GAAI,QAAQ,YAAY,KAAG,cAAc,EA8iBtE,CAAC"}
@@ -286,6 +286,43 @@ export const createDocdexTools = (client) => [
286
286
  return toOutput(result);
287
287
  },
288
288
  },
289
+ {
290
+ name: "docdex_chat_context",
291
+ description: "Ask docdex OpenAI-compatible chat with repo/profile/wake-up context.",
292
+ inputSchema: {
293
+ type: "object",
294
+ required: ["messages"],
295
+ properties: {
296
+ messages: {
297
+ type: "array",
298
+ items: {
299
+ type: "object",
300
+ required: ["role", "content"],
301
+ properties: {
302
+ role: { type: "string" },
303
+ content: {
304
+ anyOf: [
305
+ { type: "string" },
306
+ { type: "array", items: { type: "object" } },
307
+ ],
308
+ },
309
+ name: { type: "string" },
310
+ tool_call_id: { type: "string" },
311
+ },
312
+ },
313
+ },
314
+ model: { type: "string" },
315
+ maxTokens: { type: "number" },
316
+ temperature: { type: "number" },
317
+ docdex: { type: "object" },
318
+ },
319
+ },
320
+ handler: async (args) => {
321
+ const { messages, model, maxTokens, temperature, docdex } = args;
322
+ const result = await client.chatContext(messages, { model, maxTokens, temperature, docdex });
323
+ return toOutput(result);
324
+ },
325
+ },
289
326
  {
290
327
  name: "docdex_rerank",
291
328
  description: "Rerank candidate hits using docdex optional rerank flow.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcoda/mswarm",
3
- "version": "0.1.60",
3
+ "version": "0.1.65",
4
4
  "description": "Owner-run mswarm node for exposing local mcoda agents through the mswarm self-hosted gateway.",
5
5
  "type": "module",
6
6
  "main": "dist/server.js",
@@ -44,8 +44,8 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "fastify": "^5.7.4",
47
- "@mcoda/db": "0.1.60",
48
- "@mcoda/shared": "0.1.60"
47
+ "@mcoda/db": "0.1.65",
48
+ "@mcoda/shared": "0.1.65"
49
49
  },
50
50
  "scripts": {
51
51
  "build": "pnpm --filter @mcoda/codali run build && tsc -p tsconfig.json && node ../../scripts/copy-mswarm-codali-vendor.js",