@mcoda/codali 0.1.107 → 0.1.109

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 (149) hide show
  1. package/dist/agents/AgentInventory.d.ts +56 -0
  2. package/dist/agents/AgentInventory.d.ts.map +1 -0
  3. package/dist/agents/AgentInventory.js +131 -0
  4. package/dist/agents/RoleResolution.d.ts +49 -0
  5. package/dist/agents/RoleResolution.d.ts.map +1 -0
  6. package/dist/agents/RoleResolution.js +166 -0
  7. package/dist/api/ChatCompletionsAdapter.d.ts +76 -0
  8. package/dist/api/ChatCompletionsAdapter.d.ts.map +1 -0
  9. package/dist/api/ChatCompletionsAdapter.js +54 -0
  10. package/dist/api/CodaliApi.d.ts +78 -0
  11. package/dist/api/CodaliApi.d.ts.map +1 -0
  12. package/dist/api/CodaliApi.js +273 -0
  13. package/dist/api/CodaliServer.d.ts +42 -0
  14. package/dist/api/CodaliServer.d.ts.map +1 -0
  15. package/dist/api/CodaliServer.js +118 -0
  16. package/dist/cli/AskCommand.d.ts +66 -0
  17. package/dist/cli/AskCommand.d.ts.map +1 -0
  18. package/dist/cli/AskCommand.js +536 -0
  19. package/dist/cli/AuthCommand.d.ts +19 -0
  20. package/dist/cli/AuthCommand.d.ts.map +1 -0
  21. package/dist/cli/AuthCommand.js +161 -0
  22. package/dist/cli/ServeCommand.d.ts +5 -0
  23. package/dist/cli/ServeCommand.d.ts.map +1 -0
  24. package/dist/cli/ServeCommand.js +87 -0
  25. package/dist/cli/ToolsCommand.d.ts +22 -0
  26. package/dist/cli/ToolsCommand.d.ts.map +1 -0
  27. package/dist/cli/ToolsCommand.js +208 -0
  28. package/dist/cli.d.ts.map +1 -1
  29. package/dist/cli.js +29 -1
  30. package/dist/connectors/http/HttpToolDefinition.d.ts +74 -0
  31. package/dist/connectors/http/HttpToolDefinition.d.ts.map +1 -0
  32. package/dist/connectors/http/HttpToolDefinition.js +190 -0
  33. package/dist/connectors/http/HttpToolSource.d.ts +18 -0
  34. package/dist/connectors/http/HttpToolSource.d.ts.map +1 -0
  35. package/dist/connectors/http/HttpToolSource.js +29 -0
  36. package/dist/connectors/mcp/McpClient.d.ts +132 -0
  37. package/dist/connectors/mcp/McpClient.d.ts.map +1 -0
  38. package/dist/connectors/mcp/McpClient.js +215 -0
  39. package/dist/connectors/mcp/McpServerRegistry.d.ts +75 -0
  40. package/dist/connectors/mcp/McpServerRegistry.d.ts.map +1 -0
  41. package/dist/connectors/mcp/McpServerRegistry.js +180 -0
  42. package/dist/connectors/mcp/McpToolAdapter.d.ts +48 -0
  43. package/dist/connectors/mcp/McpToolAdapter.d.ts.map +1 -0
  44. package/dist/connectors/mcp/McpToolAdapter.js +101 -0
  45. package/dist/connectors/mcp/McpToolSource.d.ts +27 -0
  46. package/dist/connectors/mcp/McpToolSource.d.ts.map +1 -0
  47. package/dist/connectors/mcp/McpToolSource.js +33 -0
  48. package/dist/connectors/media/ImageGenerationTool.d.ts +43 -0
  49. package/dist/connectors/media/ImageGenerationTool.d.ts.map +1 -0
  50. package/dist/connectors/media/ImageGenerationTool.js +122 -0
  51. package/dist/connectors/oauth/DeviceCodeAuth.d.ts +74 -0
  52. package/dist/connectors/oauth/DeviceCodeAuth.d.ts.map +1 -0
  53. package/dist/connectors/oauth/DeviceCodeAuth.js +153 -0
  54. package/dist/docdex/DocdexClient.d.ts +2 -0
  55. package/dist/docdex/DocdexClient.d.ts.map +1 -1
  56. package/dist/docdex/DocdexClient.js +4 -0
  57. package/dist/gateway/CodaliGateway.d.ts +51 -3
  58. package/dist/gateway/CodaliGateway.d.ts.map +1 -1
  59. package/dist/gateway/CodaliGateway.js +226 -2
  60. package/dist/gateway/CodaliGatewayTypes.d.ts +34 -0
  61. package/dist/gateway/CodaliGatewayTypes.d.ts.map +1 -1
  62. package/dist/gateway/EvidenceNormalizer.d.ts.map +1 -1
  63. package/dist/gateway/EvidenceNormalizer.js +90 -1
  64. package/dist/gateway/Finalizer.d.ts +50 -0
  65. package/dist/gateway/Finalizer.d.ts.map +1 -0
  66. package/dist/gateway/Finalizer.js +79 -0
  67. package/dist/gateway/GatewayPlanner.d.ts +13 -0
  68. package/dist/gateway/GatewayPlanner.d.ts.map +1 -1
  69. package/dist/gateway/GatewayPlanner.js +81 -16
  70. package/dist/gateway/GatewayStateMachine.d.ts.map +1 -1
  71. package/dist/gateway/GatewayStateMachine.js +6 -0
  72. package/dist/gateway/GatewayTracer.d.ts +93 -0
  73. package/dist/gateway/GatewayTracer.d.ts.map +1 -0
  74. package/dist/gateway/GatewayTracer.js +214 -0
  75. package/dist/gateway/LocalGatewayProvider.d.ts +46 -0
  76. package/dist/gateway/LocalGatewayProvider.d.ts.map +1 -0
  77. package/dist/gateway/LocalGatewayProvider.js +161 -0
  78. package/dist/gateway/LocalGatewayTaskRunner.d.ts +79 -0
  79. package/dist/gateway/LocalGatewayTaskRunner.d.ts.map +1 -0
  80. package/dist/gateway/LocalGatewayTaskRunner.js +354 -0
  81. package/dist/gateway/RelevanceJudge.d.ts +14 -0
  82. package/dist/gateway/RelevanceJudge.d.ts.map +1 -0
  83. package/dist/gateway/RelevanceJudge.js +87 -0
  84. package/dist/gateway/ResponseSchema.d.ts +32 -0
  85. package/dist/gateway/ResponseSchema.d.ts.map +1 -0
  86. package/dist/gateway/ResponseSchema.js +120 -0
  87. package/dist/gateway/TemporalContext.d.ts +36 -0
  88. package/dist/gateway/TemporalContext.d.ts.map +1 -0
  89. package/dist/gateway/TemporalContext.js +115 -0
  90. package/dist/gateway/ToolCapabilityCompiler.d.ts +5 -0
  91. package/dist/gateway/ToolCapabilityCompiler.d.ts.map +1 -1
  92. package/dist/gateway/ToolCapabilityCompiler.js +27 -2
  93. package/dist/gateway/ToolDescriptorSource.d.ts +6 -0
  94. package/dist/gateway/ToolDescriptorSource.d.ts.map +1 -0
  95. package/dist/gateway/ToolDescriptorSource.js +30 -0
  96. package/dist/gateway/ToolExposure.d.ts +36 -0
  97. package/dist/gateway/ToolExposure.d.ts.map +1 -0
  98. package/dist/gateway/ToolExposure.js +154 -0
  99. package/dist/index.d.ts +57 -0
  100. package/dist/index.d.ts.map +1 -1
  101. package/dist/index.js +45 -0
  102. package/dist/providers/ClaudeCliProvider.d.ts +2 -0
  103. package/dist/providers/ClaudeCliProvider.d.ts.map +1 -1
  104. package/dist/providers/ClaudeCliProvider.js +2 -0
  105. package/dist/providers/CodexCliProvider.d.ts +2 -0
  106. package/dist/providers/CodexCliProvider.d.ts.map +1 -1
  107. package/dist/providers/CodexCliProvider.js +2 -0
  108. package/dist/providers/MswarmWorkerProvider.d.ts +2 -0
  109. package/dist/providers/MswarmWorkerProvider.d.ts.map +1 -1
  110. package/dist/providers/MswarmWorkerProvider.js +2 -0
  111. package/dist/providers/OllamaRemoteProvider.d.ts +2 -0
  112. package/dist/providers/OllamaRemoteProvider.d.ts.map +1 -1
  113. package/dist/providers/OllamaRemoteProvider.js +2 -0
  114. package/dist/providers/OpenAiCompatibleProvider.d.ts +2 -0
  115. package/dist/providers/OpenAiCompatibleProvider.d.ts.map +1 -1
  116. package/dist/providers/OpenAiCompatibleProvider.js +2 -0
  117. package/dist/providers/ProviderTypes.d.ts +13 -0
  118. package/dist/providers/ProviderTypes.d.ts.map +1 -1
  119. package/dist/providers/ProviderTypes.js +1 -1
  120. package/dist/runcontext/CredentialFile.d.ts +12 -0
  121. package/dist/runcontext/CredentialFile.d.ts.map +1 -0
  122. package/dist/runcontext/CredentialFile.js +81 -0
  123. package/dist/runcontext/RunContextResolver.d.ts +126 -0
  124. package/dist/runcontext/RunContextResolver.d.ts.map +1 -0
  125. package/dist/runcontext/RunContextResolver.js +389 -0
  126. package/dist/storage/CodaliDatasetPrivacyEngine.d.ts +1 -1
  127. package/dist/storage/CodaliDatasetPrivacyEngine.d.ts.map +1 -1
  128. package/dist/storage/CodaliDatasetPrivacyEngine.js +12 -0
  129. package/dist/tools/ToolRegistry.d.ts +14 -1
  130. package/dist/tools/ToolRegistry.d.ts.map +1 -1
  131. package/dist/tools/ToolRegistry.js +38 -1
  132. package/dist/tools/ToolTypes.d.ts +35 -0
  133. package/dist/tools/ToolTypes.d.ts.map +1 -1
  134. package/dist/tools/ToolTypes.js +21 -0
  135. package/dist/tools/TruncateResult.d.ts +29 -0
  136. package/dist/tools/TruncateResult.d.ts.map +1 -0
  137. package/dist/tools/TruncateResult.js +91 -0
  138. package/dist/tools/diff/DiffTool.d.ts.map +1 -1
  139. package/dist/tools/diff/DiffTool.js +2 -0
  140. package/dist/tools/docdex/DocdexTools.d.ts +21 -1
  141. package/dist/tools/docdex/DocdexTools.d.ts.map +1 -1
  142. package/dist/tools/docdex/DocdexTools.js +108 -16
  143. package/dist/tools/filesystem/FileTools.d.ts.map +1 -1
  144. package/dist/tools/filesystem/FileTools.js +8 -0
  145. package/dist/tools/search/SearchTool.d.ts.map +1 -1
  146. package/dist/tools/search/SearchTool.js +3 -1
  147. package/dist/tools/shell/ShellTool.d.ts.map +1 -1
  148. package/dist/tools/shell/ShellTool.js +2 -0
  149. package/package.json +4 -3
@@ -57,10 +57,45 @@ export interface ToolExecutionResult extends ToolHandlerResult {
57
57
  error?: ToolError;
58
58
  }
59
59
  export type ToolHandler = (args: unknown, context: ToolContext) => Promise<ToolHandlerResult>;
60
+ /**
61
+ * Capability group a tool belongs to. The orchestrator selects capabilities
62
+ * first and only then sees the full schemas of the tools inside them, so this
63
+ * value is what keeps the planner prompt bounded as the registry grows.
64
+ */
65
+ export type ToolCapability = string;
60
66
  export interface ToolDefinition {
61
67
  name: string;
62
68
  description: string;
63
69
  inputSchema?: ToolInputSchema;
70
+ /** Shape of `ToolHandlerResult.data`, when the tool returns structured data. */
71
+ outputSchema?: ToolSchemaDefinition;
72
+ /**
73
+ * Whether the tool can mutate anything. Decided by Codali policy, never by a
74
+ * connector's self-description: an MCP server advertising `readOnlyHint` is a
75
+ * hint, not a security boundary.
76
+ */
77
+ readOnly?: boolean;
78
+ capability?: ToolCapability;
64
79
  handler: ToolHandler;
65
80
  }
81
+ /**
82
+ * The model-facing view of a tool. Derived from {@link ToolDefinition} on
83
+ * demand — never stored separately, so the planner and the executor cannot
84
+ * drift onto different schemas.
85
+ */
86
+ export interface ToolDescriptor {
87
+ name: string;
88
+ description: string;
89
+ inputSchema?: ToolInputSchema;
90
+ outputSchema?: ToolSchemaDefinition;
91
+ readOnly: boolean;
92
+ capability: ToolCapability;
93
+ }
94
+ export declare const DEFAULT_TOOL_CAPABILITY = "general";
95
+ /**
96
+ * Capability inferred from a tool name when the definition does not declare
97
+ * one. Names are conventionally `<capability>_<action>` (`docdex_search`) or
98
+ * `<source>:<server>:<tool>` for connector-backed tools.
99
+ */
100
+ export declare const toolCapabilityForName: (name: string) => ToolCapability;
66
101
  //# sourceMappingURL=ToolTypes.d.ts.map
@@ -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,C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c,GAAG,MAAM,CAAC;AAEpC,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,gFAAgF;IAChF,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,OAAO,EAAE,WAAW,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,cAAc,CAAC;CAC5B;AAED,eAAO,MAAM,uBAAuB,YAAY,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,KAAG,cAapD,CAAC"}
@@ -42,3 +42,24 @@ export const toolErrorCategoryForCode = (code) => {
42
42
  }
43
43
  return "execution";
44
44
  };
45
+ export const DEFAULT_TOOL_CAPABILITY = "general";
46
+ /**
47
+ * Capability inferred from a tool name when the definition does not declare
48
+ * one. Names are conventionally `<capability>_<action>` (`docdex_search`) or
49
+ * `<source>:<server>:<tool>` for connector-backed tools.
50
+ */
51
+ export const toolCapabilityForName = (name) => {
52
+ const trimmed = name.trim();
53
+ if (!trimmed)
54
+ return DEFAULT_TOOL_CAPABILITY;
55
+ const namespaced = trimmed.split(":");
56
+ if (namespaced.length >= 3) {
57
+ // "mcp:github:list_issues" -> "github"
58
+ return namespaced[1] || DEFAULT_TOOL_CAPABILITY;
59
+ }
60
+ const underscored = trimmed.split("_");
61
+ if (underscored.length >= 2 && underscored[0]) {
62
+ return underscored[0];
63
+ }
64
+ return DEFAULT_TOOL_CAPABILITY;
65
+ };
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Fitting a tool result into a budget without destroying it.
3
+ *
4
+ * Cutting a serialized payload at a character count leaves the model invalid
5
+ * JSON ending mid-token. Observed with `list_commits`: 12,063 characters cut at
6
+ * 12,000, so the model received a broken document and reported "I can only see
7
+ * one commit" — accurate about what survived, useless as an answer.
8
+ *
9
+ * Most oversized results are a list of similar things. Keeping whole items and
10
+ * saying how many were dropped preserves both validity and the fact that more
11
+ * exists, which is what the model needs to be honest about coverage.
12
+ */
13
+ export interface TruncationResult {
14
+ text: string;
15
+ truncated: boolean;
16
+ /** Items kept, when the payload was a list. */
17
+ keptItems?: number;
18
+ /** Items dropped, when the payload was a list. */
19
+ droppedItems?: number;
20
+ }
21
+ /**
22
+ * Trims a tool result to `limit` characters.
23
+ *
24
+ * When the payload holds a list, drops whole items from the end until it fits,
25
+ * so the result stays parseable. Otherwise falls back to a character cut, which
26
+ * is still better than silence for prose.
27
+ */
28
+ export declare const truncateToolResult: (raw: unknown, serialized: string, limit: number) => TruncationResult;
29
+ //# sourceMappingURL=TruncateResult.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TruncateResult.d.ts","sourceRoot":"","sources":["../../src/tools/TruncateResult.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAkCD;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAC7B,KAAK,OAAO,EACZ,YAAY,MAAM,EAClB,OAAO,MAAM,KACZ,gBA8CF,CAAC"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Fitting a tool result into a budget without destroying it.
3
+ *
4
+ * Cutting a serialized payload at a character count leaves the model invalid
5
+ * JSON ending mid-token. Observed with `list_commits`: 12,063 characters cut at
6
+ * 12,000, so the model received a broken document and reported "I can only see
7
+ * one commit" — accurate about what survived, useless as an answer.
8
+ *
9
+ * Most oversized results are a list of similar things. Keeping whole items and
10
+ * saying how many were dropped preserves both validity and the fact that more
11
+ * exists, which is what the model needs to be honest about coverage.
12
+ */
13
+ const NOTICE = (detail) => `\n\n[TRUNCATED: ${detail}. This result is INCOMPLETE — say so explicitly and do not present it as the full set.]`;
14
+ /**
15
+ * Finds the largest array in a payload — the part worth trimming. A connector
16
+ * usually wraps its list in an envelope (`{ value: [...] }`, `{ issues: [...] }`),
17
+ * so the array is rarely at the root.
18
+ */
19
+ const findLargestArray = (value, depth = 0) => {
20
+ if (depth > 4)
21
+ return undefined;
22
+ if (Array.isArray(value))
23
+ return { parent: undefined, items: value };
24
+ if (!value || typeof value !== "object")
25
+ return undefined;
26
+ let best;
27
+ for (const [key, entry] of Object.entries(value)) {
28
+ if (Array.isArray(entry)) {
29
+ if (!best || entry.length > best.items.length) {
30
+ best = { parent: value, key, items: entry };
31
+ }
32
+ continue;
33
+ }
34
+ const nested = findLargestArray(entry, depth + 1);
35
+ if (nested?.parent && (!best || nested.items.length > best.items.length)) {
36
+ best = { parent: nested.parent, key: nested.key, items: nested.items };
37
+ }
38
+ }
39
+ return best;
40
+ };
41
+ /**
42
+ * Trims a tool result to `limit` characters.
43
+ *
44
+ * When the payload holds a list, drops whole items from the end until it fits,
45
+ * so the result stays parseable. Otherwise falls back to a character cut, which
46
+ * is still better than silence for prose.
47
+ */
48
+ export const truncateToolResult = (raw, serialized, limit) => {
49
+ if (serialized.length <= limit) {
50
+ return { text: serialized, truncated: false };
51
+ }
52
+ const found = findLargestArray(raw);
53
+ if (found && found.items.length > 1) {
54
+ const total = found.items.length;
55
+ // Binary search the largest prefix that fits, rather than dropping one at a
56
+ // time — a 500-item result would otherwise re-serialize 500 times.
57
+ let low = 1;
58
+ let high = total;
59
+ let bestFit = 1;
60
+ let bestText = "";
61
+ while (low <= high) {
62
+ const mid = Math.floor((low + high) / 2);
63
+ const kept = found.items.slice(0, mid);
64
+ const candidate = found.parent
65
+ ? { ...found.parent, [found.key]: kept }
66
+ : kept;
67
+ const text = JSON.stringify(candidate, null, 2);
68
+ if (text.length <= limit) {
69
+ bestFit = mid;
70
+ bestText = text;
71
+ low = mid + 1;
72
+ }
73
+ else {
74
+ high = mid - 1;
75
+ }
76
+ }
77
+ if (bestText) {
78
+ const dropped = total - bestFit;
79
+ return {
80
+ text: `${bestText}${NOTICE(`showing ${bestFit} of ${total} items; ${dropped} omitted`)}`,
81
+ truncated: true,
82
+ keptItems: bestFit,
83
+ droppedItems: dropped,
84
+ };
85
+ }
86
+ }
87
+ return {
88
+ text: `${serialized.slice(0, limit)}${NOTICE(`${serialized.length - limit} more characters were cut`)}`,
89
+ truncated: true,
90
+ };
91
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"DiffTool.d.ts","sourceRoot":"","sources":["../../../src/tools/diff/DiffTool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAanE,eAAO,MAAM,cAAc,QAAO,cAsBhC,CAAC"}
1
+ {"version":3,"file":"DiffTool.d.ts","sourceRoot":"","sources":["../../../src/tools/diff/DiffTool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAanE,eAAO,MAAM,cAAc,QAAO,cAwBhC,CAAC"}
@@ -12,6 +12,8 @@ const runGitStatus = (cwd) => {
12
12
  export const createDiffTool = () => ({
13
13
  name: "diff_summary",
14
14
  description: "Show a git status summary of workspace changes.",
15
+ readOnly: true,
16
+ capability: "workspace",
15
17
  inputSchema: {
16
18
  type: "object",
17
19
  properties: {
@@ -1,4 +1,24 @@
1
1
  import type { ToolDefinition } from "../ToolTypes.js";
2
2
  import type { DocdexClient } from "../../docdex/DocdexClient.js";
3
- export declare const createDocdexTools: (client: DocdexClient) => ToolDefinition[];
3
+ /**
4
+ * Judges whether search results actually answer the question.
5
+ *
6
+ * Needed because presence is not relevance. The local index returns *something*
7
+ * for almost any query — "GDP of France 2025" scores 29.07 against this
8
+ * repository, higher than "gateway planner class" at 14.35, because a test
9
+ * fixture happens to contain the phrase. A score threshold would therefore be
10
+ * both arbitrary and wrong, and keyword rules ("if the query mentions GDP, go
11
+ * to the web") are exactly the hardcoding this project rules out.
12
+ *
13
+ * So the judgement is delegated to a model: cheap, generic, and it degrades to
14
+ * the old presence-based behaviour when no judge is supplied.
15
+ */
16
+ export type RelevanceJudge = (input: {
17
+ query: string;
18
+ results: unknown;
19
+ }) => Promise<boolean>;
20
+ export interface DocdexToolOptions {
21
+ judgeRelevance?: RelevanceJudge;
22
+ }
23
+ export declare const createDocdexTools: (client: DocdexClient, options?: DocdexToolOptions) => ToolDefinition[];
4
24
  //# sourceMappingURL=DocdexTools.d.ts.map
@@ -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,EA8iBtE,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;AAwEjE;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEvB,MAAM,WAAW,iBAAiB;IAChC,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,YAAY,EACpB,UAAS,iBAAsB,KAC9B,cAAc,EAAgE,CAAC"}
@@ -2,7 +2,70 @@ const toOutput = (payload) => ({
2
2
  output: typeof payload === "string" ? payload : JSON.stringify(payload, null, 2),
3
3
  data: payload,
4
4
  });
5
- export const createDocdexTools = (client) => [
5
+ /**
6
+ * Docdex tools that mutate state (index, memory, profile, repo binding). Every
7
+ * other docdex tool is read-only. Listed as the exception set so a newly added
8
+ * read tool is safe by default and a newly added write tool must be declared.
9
+ */
10
+ const DOCDEX_WRITE_TOOLS = new Set([
11
+ "docdex_initialize",
12
+ "docdex_index_rebuild",
13
+ "docdex_index_ingest",
14
+ "docdex_memory_save",
15
+ "docdex_save_preference",
16
+ "docdex_delegate",
17
+ ]);
18
+ /**
19
+ * Docdex is one capability from the orchestrator's point of view, except web
20
+ * research, which is a distinct capability ("current external information")
21
+ * even though docdex happens to serve it.
22
+ */
23
+ const docdexCapabilityFor = (name) => name === "docdex_web_research" ? "web" : "docdex";
24
+ const isRecord = (value) => Boolean(value && typeof value === "object" && !Array.isArray(value));
25
+ /**
26
+ * Whether a docdex search payload actually returned anything usable. Docdex
27
+ * answers with `hits: []` rather than an error when the index has no match, so
28
+ * an empty result is a normal outcome that the waterfall must recognize.
29
+ */
30
+ const hasSearchHits = (payload) => {
31
+ if (!isRecord(payload))
32
+ return false;
33
+ for (const key of ["hits", "results", "matches"]) {
34
+ const value = payload[key];
35
+ if (Array.isArray(value) && value.length > 0)
36
+ return true;
37
+ }
38
+ return false;
39
+ };
40
+ /**
41
+ * Whether a forced-web search actually discovered anything.
42
+ *
43
+ * Docdex reports web findings under `webDiscovery.discovery.results` and leaves
44
+ * `hits` empty until the fetched pages are indexed, so judging a web result by
45
+ * `hits` alone throws away everything it just found.
46
+ */
47
+ const hasWebFindings = (payload) => {
48
+ if (hasSearchHits(payload))
49
+ return true;
50
+ if (!isRecord(payload))
51
+ return false;
52
+ const discovery = isRecord(payload.webDiscovery) ? payload.webDiscovery : undefined;
53
+ if (!discovery)
54
+ return false;
55
+ const inner = isRecord(discovery.discovery) ? discovery.discovery : undefined;
56
+ const results = inner?.results ?? discovery.results;
57
+ if (Array.isArray(results) && results.length > 0)
58
+ return true;
59
+ const fetches = discovery.fetches;
60
+ return Array.isArray(fetches) && fetches.length > 0;
61
+ };
62
+ const withDocdexMetadata = (tools) => tools.map((tool) => ({
63
+ ...tool,
64
+ readOnly: tool.readOnly ?? !DOCDEX_WRITE_TOOLS.has(tool.name),
65
+ capability: tool.capability ?? docdexCapabilityFor(tool.name),
66
+ }));
67
+ export const createDocdexTools = (client, options = {}) => withDocdexMetadata(docdexToolDefinitions(client, options));
68
+ const docdexToolDefinitions = (client, options) => [
6
69
  {
7
70
  name: "docdex_health",
8
71
  description: "Check docdex healthz endpoint.",
@@ -30,7 +93,7 @@ export const createDocdexTools = (client) => [
30
93
  },
31
94
  {
32
95
  name: "docdex_search",
33
- description: "Search docdex index.",
96
+ description: "Search the indexed repository and organizational memory for code, docs, and prior decisions. Ranked snippets with file paths and doc ids. Searches locally first and falls back to the web when the local index has nothing relevant, so this is the default tool for both repo questions and general external questions.",
34
97
  inputSchema: {
35
98
  type: "object",
36
99
  required: ["query"],
@@ -41,13 +104,42 @@ export const createDocdexTools = (client) => [
41
104
  },
42
105
  handler: async (args) => {
43
106
  const { query, limit } = args;
44
- const result = await client.search(query, { limit });
45
- return toOutput(result);
107
+ const local = await client.search(query, { limit });
108
+ // The local-then-web waterfall lives here, inside the search tool, rather
109
+ // than in the orchestrator. The orchestrator should only have to know
110
+ // "search"; whether an answer comes from the repository index or the
111
+ // public web is an implementation detail of searching. Putting this
112
+ // decision in the router would make it special-case logic that every new
113
+ // question type has to be taught.
114
+ let localAnswers = hasSearchHits(local);
115
+ // Hits alone do not mean the question was answered. Ask a model whether
116
+ // they are actually relevant before settling for them.
117
+ if (localAnswers && options.judgeRelevance) {
118
+ try {
119
+ localAnswers = await options.judgeRelevance({ query, results: local });
120
+ }
121
+ catch {
122
+ // A judge that fails must not block a search that already succeeded.
123
+ }
124
+ }
125
+ if (!localAnswers) {
126
+ try {
127
+ const web = await client.search(query, { limit, forceWeb: true });
128
+ if (hasWebFindings(web)) {
129
+ return toOutput(web);
130
+ }
131
+ }
132
+ catch {
133
+ // Web discovery being unavailable must not fail a local search that
134
+ // simply found nothing. Return the local (empty) result instead.
135
+ }
136
+ }
137
+ return toOutput(local);
46
138
  },
47
139
  },
48
140
  {
49
141
  name: "docdex_open",
50
- description: "Open a file by path or fetch a snippet by doc id.",
142
+ description: "Read an exact slice of a file, either by repo-relative path or by a doc id returned from a search. Use after a search has identified a target rather than guessing paths.",
51
143
  inputSchema: {
52
144
  type: "object",
53
145
  properties: {
@@ -76,7 +168,7 @@ export const createDocdexTools = (client) => [
76
168
  },
77
169
  {
78
170
  name: "docdex_symbols",
79
- description: "Fetch docdex symbols for a file.",
171
+ description: "List the definitions in a file with their exact signatures and line numbers - functions, classes, methods, exported constants. Use to confirm where something is defined before relying on it.",
80
172
  inputSchema: {
81
173
  type: "object",
82
174
  required: ["path"],
@@ -92,7 +184,7 @@ export const createDocdexTools = (client) => [
92
184
  },
93
185
  {
94
186
  name: "docdex_ast",
95
- description: "Fetch docdex AST nodes for a file.",
187
+ description: "Query a file's syntax tree for precise structure: class and function definitions, call sites, imports. More exact than text search when the question is structural.",
96
188
  inputSchema: {
97
189
  type: "object",
98
190
  required: ["path"],
@@ -109,7 +201,7 @@ export const createDocdexTools = (client) => [
109
201
  },
110
202
  {
111
203
  name: "docdex_impact_graph",
112
- description: "Fetch docdex impact graph for a file.",
204
+ description: "Show what depends on a file and what it depends on. Answers \"what breaks if this changes\" and identifies the blast radius of an edit.",
113
205
  inputSchema: {
114
206
  type: "object",
115
207
  required: ["file"],
@@ -128,7 +220,7 @@ export const createDocdexTools = (client) => [
128
220
  },
129
221
  {
130
222
  name: "docdex_impact_diagnostics",
131
- description: "Fetch docdex impact diagnostics (dynamic imports).",
223
+ description: "List unresolved or dynamic imports that the dependency graph could not follow, so gaps in impact analysis are visible rather than silent.",
132
224
  inputSchema: {
133
225
  type: "object",
134
226
  properties: {
@@ -163,7 +255,7 @@ export const createDocdexTools = (client) => [
163
255
  },
164
256
  {
165
257
  name: "docdex_tree",
166
- description: "Render a folder tree from docdex.",
258
+ description: "Render the repository folder tree with build output and vendor directories excluded. Use to orient in an unfamiliar repo instead of listing directories manually.",
167
259
  inputSchema: {
168
260
  type: "object",
169
261
  properties: {
@@ -218,7 +310,7 @@ export const createDocdexTools = (client) => [
218
310
  },
219
311
  {
220
312
  name: "docdex_get_profile",
221
- description: "Fetch docdex profile preferences.",
313
+ description: "Read stored global preferences and constraints that should shape the answer, such as style rules or disallowed libraries.",
222
314
  inputSchema: {
223
315
  type: "object",
224
316
  properties: {
@@ -251,7 +343,7 @@ export const createDocdexTools = (client) => [
251
343
  },
252
344
  {
253
345
  name: "docdex_memory_recall",
254
- description: "Recall repo memory from docdex.",
346
+ description: "Recall durable facts previously recorded about this repository - architectural decisions, gotchas, where things live.",
255
347
  inputSchema: {
256
348
  type: "object",
257
349
  required: ["query"],
@@ -268,7 +360,7 @@ export const createDocdexTools = (client) => [
268
360
  },
269
361
  {
270
362
  name: "docdex_web_research",
271
- description: "Run docdex web research (requires DOCDEX_WEB_ENABLED=1).",
363
+ description: "Search the public web for current external information: facts, news, third-party documentation, anything not in this repository. Returns sourced results with URLs.",
272
364
  inputSchema: {
273
365
  type: "object",
274
366
  required: ["query"],
@@ -343,7 +435,7 @@ export const createDocdexTools = (client) => [
343
435
  },
344
436
  {
345
437
  name: "docdex_batch_search",
346
- description: "Run batched docdex search queries via optional batch endpoint/tool.",
438
+ description: "Run several related search queries in one call. Use when a question decomposes into multiple independent lookups, to save round trips.",
347
439
  inputSchema: {
348
440
  type: "object",
349
441
  required: ["queries"],
@@ -376,7 +468,7 @@ export const createDocdexTools = (client) => [
376
468
  },
377
469
  {
378
470
  name: "docdex_stats",
379
- description: "Fetch docdex index stats.",
471
+ description: "Report index size and when it was last updated. Use to detect a stale index before trusting a negative search result.",
380
472
  inputSchema: { type: "object", properties: {} },
381
473
  handler: async () => {
382
474
  const result = await client.stats();
@@ -385,7 +477,7 @@ export const createDocdexTools = (client) => [
385
477
  },
386
478
  {
387
479
  name: "docdex_files",
388
- description: "List docdex indexed files.",
480
+ description: "List the files currently present in the index, to confirm coverage before concluding that something does not exist.",
389
481
  inputSchema: {
390
482
  type: "object",
391
483
  properties: {
@@ -1 +1 @@
1
- {"version":3,"file":"FileTools.d.ts","sourceRoot":"","sources":["../../../src/tools/filesystem/FileTools.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAgEnE,eAAO,MAAM,eAAe,QAAO,cAAc,EAwFhD,CAAC"}
1
+ {"version":3,"file":"FileTools.d.ts","sourceRoot":"","sources":["../../../src/tools/filesystem/FileTools.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAgEnE,eAAO,MAAM,eAAe,QAAO,cAAc,EAgGhD,CAAC"}
@@ -55,6 +55,8 @@ export const createFileTools = () => {
55
55
  {
56
56
  name: "read_file",
57
57
  description: "Read a text file from the workspace.",
58
+ readOnly: true,
59
+ capability: "workspace",
58
60
  inputSchema: {
59
61
  type: "object",
60
62
  required: ["path"],
@@ -73,6 +75,8 @@ export const createFileTools = () => {
73
75
  {
74
76
  name: "write_file",
75
77
  description: "Write content to a file inside the workspace.",
78
+ readOnly: false,
79
+ capability: "workspace",
76
80
  inputSchema: {
77
81
  type: "object",
78
82
  required: ["path", "content"],
@@ -96,6 +100,8 @@ export const createFileTools = () => {
96
100
  {
97
101
  name: "list_files",
98
102
  description: "List files under a directory within the workspace.",
103
+ readOnly: true,
104
+ capability: "workspace",
99
105
  inputSchema: {
100
106
  type: "object",
101
107
  properties: {
@@ -115,6 +121,8 @@ export const createFileTools = () => {
115
121
  {
116
122
  name: "stat_path",
117
123
  description: "Get stat info for a file or directory.",
124
+ readOnly: true,
125
+ capability: "workspace",
118
126
  inputSchema: {
119
127
  type: "object",
120
128
  required: ["path"],
@@ -1 +1 @@
1
- {"version":3,"file":"SearchTool.d.ts","sourceRoot":"","sources":["../../../src/tools/search/SearchTool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,iBAAiB,CAAC;AA0BnE,eAAO,MAAM,gBAAgB,QAAO,cAwBlC,CAAC"}
1
+ {"version":3,"file":"SearchTool.d.ts","sourceRoot":"","sources":["../../../src/tools/search/SearchTool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,iBAAiB,CAAC;AA0BnE,eAAO,MAAM,gBAAgB,QAAO,cA0BlC,CAAC"}
@@ -22,7 +22,9 @@ const runGrepFallback = (query, cwd) => {
22
22
  };
23
23
  export const createSearchTool = () => ({
24
24
  name: "search_repo",
25
- description: "Search for text in the workspace using rg when available.",
25
+ description: "Search for literal text in the working tree. Use when an exact string is known; prefer docdex_search for conceptual questions.",
26
+ readOnly: true,
27
+ capability: "workspace",
26
28
  inputSchema: {
27
29
  type: "object",
28
30
  required: ["query"],
@@ -1 +1 @@
1
- {"version":3,"file":"ShellTool.d.ts","sourceRoot":"","sources":["../../../src/tools/shell/ShellTool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwC,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AA2C5F,eAAO,MAAM,eAAe,QAAO,cAyEjC,CAAC"}
1
+ {"version":3,"file":"ShellTool.d.ts","sourceRoot":"","sources":["../../../src/tools/shell/ShellTool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwC,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AA2C5F,eAAO,MAAM,eAAe,QAAO,cA2EjC,CAAC"}
@@ -41,6 +41,8 @@ const isDestructiveShellAction = (command, args) => {
41
41
  export const createShellTool = () => ({
42
42
  name: "run_shell",
43
43
  description: "Run a shell command from the workspace root (allowlist only).",
44
+ readOnly: false,
45
+ capability: "shell",
44
46
  inputSchema: {
45
47
  type: "object",
46
48
  required: ["command"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcoda/codali",
3
- "version": "0.1.107",
3
+ "version": "0.1.109",
4
4
  "description": "Standalone tool-runner adapter for mcoda.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -34,8 +34,9 @@
34
34
  "access": "public"
35
35
  },
36
36
  "dependencies": {
37
- "@mcoda/db": "0.1.107",
38
- "@mcoda/shared": "0.1.107"
37
+ "@modelcontextprotocol/sdk": "1.30.0",
38
+ "@mcoda/db": "0.1.109",
39
+ "@mcoda/shared": "0.1.109"
39
40
  },
40
41
  "scripts": {
41
42
  "build": "tsc -p tsconfig.json",