@ai-agent-forge/agent-forge 0.86.4 → 0.86.6

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 (220) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/dist/bundle/.build-manifest.json +470 -404
  3. package/dist/bundle/chunks/anthropic-messages-ALDZBUKI.js +6 -0
  4. package/dist/bundle/chunks/anthropic.js +2 -2
  5. package/dist/bundle/chunks/{azure-openai-responses-WQCZWFAH.js → azure-openai-responses-A2WJWZFB.js} +1 -1
  6. package/dist/bundle/chunks/bedrock-converse-stream.js +1 -1
  7. package/dist/bundle/chunks/chunk-A7GUOX2H.js +141 -0
  8. package/dist/bundle/chunks/{chunk-WGLBM2BP.js → chunk-CIX3FSBK.js} +1 -1
  9. package/dist/bundle/chunks/{chunk-ZV3W36HK.js → chunk-EALJ5DDX.js} +99 -92
  10. package/dist/bundle/chunks/chunk-OO6DJ3CL.js +31 -0
  11. package/dist/bundle/chunks/{chunk-PE3XUHPT.js → chunk-SQFG22WN.js} +1 -1
  12. package/dist/bundle/chunks/{chunk-V46XUTK3.js → chunk-Y7HXTASS.js} +1 -1
  13. package/dist/bundle/chunks/{chunk-3WE3W52L.js → chunk-YJCQVXW5.js} +1 -1
  14. package/dist/bundle/chunks/github-copilot.js +1 -1
  15. package/dist/bundle/chunks/{google-generative-ai-LQ375GYC.js → google-generative-ai-NIB4WONV.js} +1 -1
  16. package/dist/bundle/chunks/{google-vertex-HXSRAKEZ.js → google-vertex-DCPYUEUO.js} +1 -1
  17. package/dist/bundle/chunks/{mistral-conversations-CSNMFR4J.js → mistral-conversations-OC6LA5XL.js} +1 -1
  18. package/dist/bundle/chunks/{openai-codex-responses-YDJSZOIH.js → openai-codex-responses-IO2X4Y7L.js} +1 -1
  19. package/dist/bundle/chunks/openai-codex.js +2 -2
  20. package/dist/bundle/chunks/{openai-completions-UPRWTQPT.js → openai-completions-XYQQHETU.js} +1 -1
  21. package/dist/bundle/chunks/{openai-responses-O63W6HQ3.js → openai-responses-DLIRN3CI.js} +1 -1
  22. package/dist/bundle/chunks/{openrouter-images-G3GT5BVT.js → openrouter-images-G4GQRUSG.js} +1 -1
  23. package/dist/bundle/chunks/openrouter.js +2 -2
  24. package/dist/bundle/chunks/{pi-messages-SLF355GF.js → pi-messages-E6RRYBO7.js} +1 -1
  25. package/dist/bundle/chunks/radius.js +2 -2
  26. package/dist/bundle/chunks/{virtual-modules-O72ICTMQ.js → virtual-modules-3IZ4MYSQ.js} +1 -1
  27. package/dist/bundle/cli.js +1 -1
  28. package/dist/bundle/index.js +1 -1
  29. package/dist/bundle/rpc-entry.js +1 -1
  30. package/dist/capabilities/builtin.d.ts +4 -2
  31. package/dist/capabilities/builtin.d.ts.map +1 -1
  32. package/dist/capabilities/builtin.js +5 -1
  33. package/dist/capabilities/builtin.js.map +1 -1
  34. package/dist/cli/plugin-command.d.ts.map +1 -1
  35. package/dist/cli/plugin-command.js +51 -5
  36. package/dist/cli/plugin-command.js.map +1 -1
  37. package/dist/core/agent-session-compaction.d.ts.map +1 -1
  38. package/dist/core/agent-session-compaction.js +13 -5
  39. package/dist/core/agent-session-compaction.js.map +1 -1
  40. package/dist/core/agent-session-internal.d.ts +2 -4
  41. package/dist/core/agent-session-internal.d.ts.map +1 -1
  42. package/dist/core/agent-session-internal.js.map +1 -1
  43. package/dist/core/agent-session-paths.d.ts +2 -0
  44. package/dist/core/agent-session-paths.d.ts.map +1 -1
  45. package/dist/core/agent-session-paths.js +2 -1
  46. package/dist/core/agent-session-paths.js.map +1 -1
  47. package/dist/core/agent-session-projection.d.ts +10 -4
  48. package/dist/core/agent-session-projection.d.ts.map +1 -1
  49. package/dist/core/agent-session-projection.js +17 -4
  50. package/dist/core/agent-session-projection.js.map +1 -1
  51. package/dist/core/agent-session.d.ts +19 -5
  52. package/dist/core/agent-session.d.ts.map +1 -1
  53. package/dist/core/agent-session.js +30 -4
  54. package/dist/core/agent-session.js.map +1 -1
  55. package/dist/core/extensions/bootstrap-lifecycle.d.ts +1 -1
  56. package/dist/core/extensions/bootstrap-lifecycle.d.ts.map +1 -1
  57. package/dist/core/extensions/bootstrap-lifecycle.js +5 -2
  58. package/dist/core/extensions/bootstrap-lifecycle.js.map +1 -1
  59. package/dist/core/extensions/capability-runtime-store.d.ts.map +1 -1
  60. package/dist/core/extensions/capability-runtime-store.js +1 -0
  61. package/dist/core/extensions/capability-runtime-store.js.map +1 -1
  62. package/dist/core/extensions/capability-runtime-types.d.ts +16 -1
  63. package/dist/core/extensions/capability-runtime-types.d.ts.map +1 -1
  64. package/dist/core/extensions/capability-runtime-types.js.map +1 -1
  65. package/dist/core/extensions/capability-runtime.d.ts.map +1 -1
  66. package/dist/core/extensions/capability-runtime.js +38 -2
  67. package/dist/core/extensions/capability-runtime.js.map +1 -1
  68. package/dist/core/extensions/index.d.ts +1 -1
  69. package/dist/core/extensions/index.d.ts.map +1 -1
  70. package/dist/core/extensions/index.js.map +1 -1
  71. package/dist/core/extensions/lifecycle-catalog.d.ts +46 -0
  72. package/dist/core/extensions/lifecycle-catalog.d.ts.map +1 -1
  73. package/dist/core/extensions/lifecycle-catalog.js +101 -0
  74. package/dist/core/extensions/lifecycle-catalog.js.map +1 -1
  75. package/dist/core/extensions/provider-failover.d.ts +106 -0
  76. package/dist/core/extensions/provider-failover.d.ts.map +1 -0
  77. package/dist/core/extensions/provider-failover.js +692 -0
  78. package/dist/core/extensions/provider-failover.js.map +1 -0
  79. package/dist/core/facade/coding-agent-facade.d.ts +13 -6
  80. package/dist/core/facade/coding-agent-facade.d.ts.map +1 -1
  81. package/dist/core/facade/coding-agent-facade.js +3 -1
  82. package/dist/core/facade/coding-agent-facade.js.map +1 -1
  83. package/dist/core/keybindings.d.ts +6 -6
  84. package/dist/core/keybindings.d.ts.map +1 -1
  85. package/dist/core/keybindings.js +23 -6
  86. package/dist/core/keybindings.js.map +1 -1
  87. package/dist/core/model-config.d.ts +102 -0
  88. package/dist/core/model-config.d.ts.map +1 -1
  89. package/dist/core/model-config.js +46 -14
  90. package/dist/core/model-config.js.map +1 -1
  91. package/dist/core/model-resolver.d.ts.map +1 -1
  92. package/dist/core/model-resolver.js +1 -1
  93. package/dist/core/model-resolver.js.map +1 -1
  94. package/dist/core/model-runtime.d.ts +15 -0
  95. package/dist/core/model-runtime.d.ts.map +1 -1
  96. package/dist/core/model-runtime.js +30 -18
  97. package/dist/core/model-runtime.js.map +1 -1
  98. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  99. package/dist/core/remote-catalog-provider.js +4 -9
  100. package/dist/core/remote-catalog-provider.js.map +1 -1
  101. package/dist/core/sdk.d.ts.map +1 -1
  102. package/dist/core/sdk.js +107 -24
  103. package/dist/core/sdk.js.map +1 -1
  104. package/dist/core/session-manager.d.ts +2 -0
  105. package/dist/core/session-manager.d.ts.map +1 -1
  106. package/dist/core/session-manager.js +10 -5
  107. package/dist/core/session-manager.js.map +1 -1
  108. package/dist/core/settings-manager.d.ts +71 -5
  109. package/dist/core/settings-manager.d.ts.map +1 -1
  110. package/dist/core/settings-manager.js +138 -9
  111. package/dist/core/settings-manager.js.map +1 -1
  112. package/dist/core/slash-commands.d.ts.map +1 -1
  113. package/dist/core/slash-commands.js +17 -2
  114. package/dist/core/slash-commands.js.map +1 -1
  115. package/dist/core/tools/render-utils.d.ts +6 -0
  116. package/dist/core/tools/render-utils.d.ts.map +1 -1
  117. package/dist/core/tools/render-utils.js +26 -0
  118. package/dist/core/tools/render-utils.js.map +1 -1
  119. package/dist/core/tools/tool-definition.d.ts +21 -2
  120. package/dist/core/tools/tool-definition.d.ts.map +1 -1
  121. package/dist/core/tools/tool-definition.js.map +1 -1
  122. package/dist/main.d.ts.map +1 -1
  123. package/dist/main.js +3 -6
  124. package/dist/main.js.map +1 -1
  125. package/dist/modes/interactive/components/agents-view.d.ts +57 -0
  126. package/dist/modes/interactive/components/agents-view.d.ts.map +1 -0
  127. package/dist/modes/interactive/components/agents-view.js +260 -0
  128. package/dist/modes/interactive/components/agents-view.js.map +1 -0
  129. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  130. package/dist/modes/interactive/components/custom-editor.js +2 -2
  131. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  132. package/dist/modes/interactive/components/footer.d.ts +7 -0
  133. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  134. package/dist/modes/interactive/components/footer.js +51 -6
  135. package/dist/modes/interactive/components/footer.js.map +1 -1
  136. package/dist/modes/interactive/components/scoped-models-selector.d.ts +1 -1
  137. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  138. package/dist/modes/interactive/components/scoped-models-selector.js +1 -1
  139. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  140. package/dist/modes/interactive/components/settings-selector.d.ts +3 -1
  141. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  142. package/dist/modes/interactive/components/settings-selector.js +12 -2
  143. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  144. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  145. package/dist/modes/interactive/components/thinking-selector.js +1 -1
  146. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  147. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  148. package/dist/modes/interactive/components/tool-execution.js +89 -10
  149. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  150. package/dist/modes/interactive/components/user-message-selector.d.ts +3 -0
  151. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
  152. package/dist/modes/interactive/components/user-message-selector.js +9 -3
  153. package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  154. package/dist/modes/interactive/components/workflow-view.d.ts +119 -0
  155. package/dist/modes/interactive/components/workflow-view.d.ts.map +1 -0
  156. package/dist/modes/interactive/components/workflow-view.js +638 -0
  157. package/dist/modes/interactive/components/workflow-view.js.map +1 -0
  158. package/dist/modes/interactive/interactive-commands.d.ts +22 -0
  159. package/dist/modes/interactive/interactive-commands.d.ts.map +1 -1
  160. package/dist/modes/interactive/interactive-commands.js +56 -0
  161. package/dist/modes/interactive/interactive-commands.js.map +1 -1
  162. package/dist/modes/interactive/interactive-mode.d.ts +51 -1
  163. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  164. package/dist/modes/interactive/interactive-mode.js +218 -37
  165. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  166. package/dist/modes/interactive/interactive-selectors.d.ts +2 -4
  167. package/dist/modes/interactive/interactive-selectors.d.ts.map +1 -1
  168. package/dist/modes/interactive/interactive-selectors.js +10 -1
  169. package/dist/modes/interactive/interactive-selectors.js.map +1 -1
  170. package/dist/modes/print-mode.d.ts.map +1 -1
  171. package/dist/modes/print-mode.js +5 -0
  172. package/dist/modes/print-mode.js.map +1 -1
  173. package/dist/modes/rpc/rpc-client.d.ts +3 -1
  174. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  175. package/dist/modes/rpc/rpc-client.js +4 -2
  176. package/dist/modes/rpc/rpc-client.js.map +1 -1
  177. package/dist/modes/rpc/rpc-types.d.ts +1 -0
  178. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  179. package/dist/modes/rpc/rpc-types.js.map +1 -1
  180. package/dist/plugins/ecosystem/bootstrap-factory-manifest.d.ts.map +1 -1
  181. package/dist/plugins/ecosystem/bootstrap-factory-manifest.js +7 -0
  182. package/dist/plugins/ecosystem/bootstrap-factory-manifest.js.map +1 -1
  183. package/dist/plugins/ecosystem/cli.d.ts.map +1 -1
  184. package/dist/plugins/ecosystem/cli.js +1 -1
  185. package/dist/plugins/ecosystem/cli.js.map +1 -1
  186. package/dist/plugins/ecosystem/install-store-paths.d.ts +15 -0
  187. package/dist/plugins/ecosystem/install-store-paths.d.ts.map +1 -0
  188. package/dist/plugins/ecosystem/install-store-paths.js +58 -0
  189. package/dist/plugins/ecosystem/install-store-paths.js.map +1 -0
  190. package/dist/plugins/ecosystem/node-disk-registry-source.d.ts.map +1 -1
  191. package/dist/plugins/ecosystem/node-disk-registry-source.js +3 -8
  192. package/dist/plugins/ecosystem/node-disk-registry-source.js.map +1 -1
  193. package/dist/plugins/ecosystem/node-package-install-host.d.ts.map +1 -1
  194. package/dist/plugins/ecosystem/node-package-install-host.js +9 -1
  195. package/dist/plugins/ecosystem/node-package-install-host.js.map +1 -1
  196. package/dist/plugins/ecosystem/node-package-install-persistence.d.ts.map +1 -1
  197. package/dist/plugins/ecosystem/node-package-install-persistence.js +3 -8
  198. package/dist/plugins/ecosystem/node-package-install-persistence.js.map +1 -1
  199. package/dist/profile/plugin-profiles.d.ts +2 -0
  200. package/dist/profile/plugin-profiles.d.ts.map +1 -1
  201. package/dist/profile/plugin-profiles.js +4 -0
  202. package/dist/profile/plugin-profiles.js.map +1 -1
  203. package/dist/profiles/builtin-suites.d.ts +19 -2
  204. package/dist/profiles/builtin-suites.d.ts.map +1 -1
  205. package/dist/profiles/builtin-suites.js +20 -2
  206. package/dist/profiles/builtin-suites.js.map +1 -1
  207. package/dist/profiles/suite-loader.d.ts.map +1 -1
  208. package/dist/profiles/suite-loader.js +4 -1
  209. package/dist/profiles/suite-loader.js.map +1 -1
  210. package/dist/utils/clipboard.d.ts.map +1 -1
  211. package/dist/utils/clipboard.js +10 -10
  212. package/dist/utils/clipboard.js.map +1 -1
  213. package/docs/keybindings.md +8 -8
  214. package/docs/models.md +1 -1
  215. package/docs/rpc.md +3 -1
  216. package/docs/settings.md +2 -1
  217. package/package.json +4 -4
  218. package/dist/bundle/chunks/anthropic-messages-EVFQ6MLR.js +0 -6
  219. package/dist/bundle/chunks/chunk-F6SBZUJG.js +0 -141
  220. package/dist/bundle/chunks/chunk-NUHFSC37.js +0 -25
@@ -51,6 +51,32 @@ export function getTextOutput(result, showImages) {
51
51
  }
52
52
  return output;
53
53
  }
54
+ const COLLAPSED_ARGS_CHARS = 100;
55
+ /**
56
+ * Generic tool call header: the title followed by the arguments. Collapsed, they are `key=value`
57
+ * pairs on the title line, cut to {@link COLLAPSED_ARGS_CHARS}. Expanded, each is a `key: value`
58
+ * line below the title, with strings shown raw and continuation lines indented.
59
+ */
60
+ export function formatToolCallWithArgs(title, args, theme, expanded) {
61
+ const header = theme.fg("toolTitle", theme.bold(title));
62
+ if (args == null)
63
+ return header;
64
+ const entries = typeof args === "object" && !Array.isArray(args)
65
+ ? Object.entries(args)
66
+ : [["args", args]];
67
+ if (entries.length === 0)
68
+ return header;
69
+ if (expanded) {
70
+ const lines = entries.map(([key, value]) => {
71
+ const text = typeof value === "string" ? value : (JSON.stringify(value, null, 2) ?? String(value));
72
+ return ` ${key}: ${replaceTabs(text).replace(/\r/g, "").split("\n").join("\n ")}`;
73
+ });
74
+ return `${header}\n${theme.fg("muted", lines.join("\n"))}`;
75
+ }
76
+ const pairs = entries.map(([key, value]) => `${key}=${JSON.stringify(value) ?? String(value)}`).join(" ");
77
+ const preview = pairs.length > COLLAPSED_ARGS_CHARS ? `${pairs.slice(0, COLLAPSED_ARGS_CHARS - 3)}...` : pairs;
78
+ return `${header} ${theme.fg("muted", preview)}`;
79
+ }
54
80
  export function invalidArgText(theme) {
55
81
  return theme.fg("error", "[invalid arg]");
56
82
  }
@@ -1 +1 @@
1
- {"version":3,"file":"render-utils.js","sourceRoot":"","sources":["../../../src/core/tools/render-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjG,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,UAAU,WAAW,CAAC,IAAa,EAAU;IAClD,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,EAAE,CAA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MAAM,UAAU,cAAc,CAC7B,OAAsB,EACtB,KAAY,EACZ,GAAW,EACX,OAAoC,EAC3B;IACT,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,OAAO,IAAI,OAAO,EAAE,aAAa,CAAC;IAChD,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC,EAAE,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IACjD,OAAO,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AAAA,CACpE","sourcesContent":["import * as os from \"node:os\";\nimport { pathToFileURL } from \"node:url\";\nimport type { ImageContent, TextContent } from \"@agent-forge/ai\";\nimport { getCapabilities, getImageDimensions, hyperlink, imageFallback } from \"@agent-forge/tui\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport { stripAnsi } from \"../../utils/ansi.ts\";\nimport { resolvePath } from \"../../utils/paths.ts\";\nimport { sanitizeBinaryOutput } from \"../../utils/shell.ts\";\n\nexport function shortenPath(path: unknown): string {\n\tif (typeof path !== \"string\") return \"\";\n\tconst home = os.homedir();\n\tif (path.startsWith(home)) {\n\t\treturn `~${path.slice(home.length)}`;\n\t}\n\treturn path;\n}\n\nexport function linkPath(styledText: string, rawPath: string, cwd: string): string {\n\tif (!getCapabilities().hyperlinks) return styledText;\n\tconst absolutePath = resolvePath(rawPath, cwd);\n\treturn hyperlink(styledText, pathToFileURL(absolutePath).href);\n}\n\nexport function str(value: unknown): string | null {\n\tif (typeof value === \"string\") return value;\n\tif (value == null) return \"\";\n\treturn null;\n}\n\nexport function replaceTabs(text: string): string {\n\treturn text.replace(/\\t/g, \" \");\n}\n\nexport function normalizeDisplayText(text: string): string {\n\treturn text.replace(/\\r/g, \"\");\n}\n\nexport function getTextOutput(\n\tresult: { content: Array<{ type: string; text?: string; data?: string; mimeType?: string }> } | undefined,\n\tshowImages: boolean,\n): string {\n\tif (!result) return \"\";\n\n\tconst textBlocks = result.content.filter((c) => c.type === \"text\");\n\tconst imageBlocks = result.content.filter((c) => c.type === \"image\");\n\n\tlet output = textBlocks.map((c) => sanitizeBinaryOutput(stripAnsi(c.text || \"\")).replace(/\\r/g, \"\")).join(\"\\n\");\n\n\tconst caps = getCapabilities();\n\tif (imageBlocks.length > 0 && (!caps.images || !showImages)) {\n\t\tconst imageIndicators = imageBlocks\n\t\t\t.map((img) => {\n\t\t\t\tconst mimeType = img.mimeType ?? \"image/unknown\";\n\t\t\t\tconst dims =\n\t\t\t\t\timg.data && img.mimeType ? (getImageDimensions(img.data, img.mimeType) ?? undefined) : undefined;\n\t\t\t\treturn imageFallback(mimeType, dims);\n\t\t\t})\n\t\t\t.join(\"\\n\");\n\t\toutput = output ? `${output}\\n${imageIndicators}` : imageIndicators;\n\t}\n\n\treturn output;\n}\n\nexport type ToolRenderResultLike<TDetails> = {\n\tcontent: (TextContent | ImageContent)[];\n\tdetails: TDetails;\n};\n\nexport function invalidArgText(theme: Theme): string {\n\treturn theme.fg(\"error\", \"[invalid arg]\");\n}\n\nexport function renderToolPath(\n\trawPath: string | null,\n\ttheme: Theme,\n\tcwd: string,\n\toptions?: { emptyFallback?: string },\n): string {\n\tif (rawPath === null) return invalidArgText(theme);\n\tconst value = rawPath || options?.emptyFallback;\n\tif (!value) return theme.fg(\"toolOutput\", \"...\");\n\treturn linkPath(theme.fg(\"accent\", shortenPath(value)), value, cwd);\n}\n"]}
1
+ {"version":3,"file":"render-utils.js","sourceRoot":"","sources":["../../../src/core/tools/render-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC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Content":["import * as os from \"node:os\";\nimport { pathToFileURL } from \"node:url\";\nimport type { ImageContent, TextContent } from \"@agent-forge/ai\";\nimport { getCapabilities, getImageDimensions, hyperlink, imageFallback } from \"@agent-forge/tui\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport { stripAnsi } from \"../../utils/ansi.ts\";\nimport { resolvePath } from \"../../utils/paths.ts\";\nimport { sanitizeBinaryOutput } from \"../../utils/shell.ts\";\n\nexport function shortenPath(path: unknown): string {\n\tif (typeof path !== \"string\") return \"\";\n\tconst home = os.homedir();\n\tif (path.startsWith(home)) {\n\t\treturn `~${path.slice(home.length)}`;\n\t}\n\treturn path;\n}\n\nexport function linkPath(styledText: string, rawPath: string, cwd: string): string {\n\tif (!getCapabilities().hyperlinks) return styledText;\n\tconst absolutePath = resolvePath(rawPath, cwd);\n\treturn hyperlink(styledText, pathToFileURL(absolutePath).href);\n}\n\nexport function str(value: unknown): string | null {\n\tif (typeof value === \"string\") return value;\n\tif (value == null) return \"\";\n\treturn null;\n}\n\nexport function replaceTabs(text: string): string {\n\treturn text.replace(/\\t/g, \" \");\n}\n\nexport function normalizeDisplayText(text: string): string {\n\treturn text.replace(/\\r/g, \"\");\n}\n\nexport function getTextOutput(\n\tresult: { content: Array<{ type: string; text?: string; data?: string; mimeType?: string }> } | undefined,\n\tshowImages: boolean,\n): string {\n\tif (!result) return \"\";\n\n\tconst textBlocks = result.content.filter((c) => c.type === \"text\");\n\tconst imageBlocks = result.content.filter((c) => c.type === \"image\");\n\n\tlet output = textBlocks.map((c) => sanitizeBinaryOutput(stripAnsi(c.text || \"\")).replace(/\\r/g, \"\")).join(\"\\n\");\n\n\tconst caps = getCapabilities();\n\tif (imageBlocks.length > 0 && (!caps.images || !showImages)) {\n\t\tconst imageIndicators = imageBlocks\n\t\t\t.map((img) => {\n\t\t\t\tconst mimeType = img.mimeType ?? \"image/unknown\";\n\t\t\t\tconst dims =\n\t\t\t\t\timg.data && img.mimeType ? (getImageDimensions(img.data, img.mimeType) ?? undefined) : undefined;\n\t\t\t\treturn imageFallback(mimeType, dims);\n\t\t\t})\n\t\t\t.join(\"\\n\");\n\t\toutput = output ? `${output}\\n${imageIndicators}` : imageIndicators;\n\t}\n\n\treturn output;\n}\n\nexport type ToolRenderResultLike<TDetails> = {\n\tcontent: (TextContent | ImageContent)[];\n\tdetails: TDetails;\n};\n\nconst COLLAPSED_ARGS_CHARS = 100;\n\n/**\n * Generic tool call header: the title followed by the arguments. Collapsed, they are `key=value`\n * pairs on the title line, cut to {@link COLLAPSED_ARGS_CHARS}. Expanded, each is a `key: value`\n * line below the title, with strings shown raw and continuation lines indented.\n */\nexport function formatToolCallWithArgs(title: string, args: unknown, theme: Theme, expanded: boolean): string {\n\tconst header = theme.fg(\"toolTitle\", theme.bold(title));\n\tif (args == null) return header;\n\tconst entries =\n\t\ttypeof args === \"object\" && !Array.isArray(args)\n\t\t\t? Object.entries(args)\n\t\t\t: ([[\"args\", args]] as [string, unknown][]);\n\tif (entries.length === 0) return header;\n\tif (expanded) {\n\t\tconst lines = entries.map(([key, value]) => {\n\t\t\tconst text = typeof value === \"string\" ? value : (JSON.stringify(value, null, 2) ?? String(value));\n\t\t\treturn ` ${key}: ${replaceTabs(text).replace(/\\r/g, \"\").split(\"\\n\").join(\"\\n \")}`;\n\t\t});\n\t\treturn `${header}\\n${theme.fg(\"muted\", lines.join(\"\\n\"))}`;\n\t}\n\tconst pairs = entries.map(([key, value]) => `${key}=${JSON.stringify(value) ?? String(value)}`).join(\" \");\n\tconst preview = pairs.length > COLLAPSED_ARGS_CHARS ? `${pairs.slice(0, COLLAPSED_ARGS_CHARS - 3)}...` : pairs;\n\treturn `${header} ${theme.fg(\"muted\", preview)}`;\n}\n\nexport function invalidArgText(theme: Theme): string {\n\treturn theme.fg(\"error\", \"[invalid arg]\");\n}\n\nexport function renderToolPath(\n\trawPath: string | null,\n\ttheme: Theme,\n\tcwd: string,\n\toptions?: { emptyFallback?: string },\n): string {\n\tif (rawPath === null) return invalidArgText(theme);\n\tconst value = rawPath || options?.emptyFallback;\n\tif (!value) return theme.fg(\"toolOutput\", \"...\");\n\treturn linkPath(theme.fg(\"accent\", shortenPath(value)), value, cwd);\n}\n"]}
@@ -101,9 +101,28 @@ export interface ToolDefinition<TParams extends TSchema = TSchema, TDetails = un
101
101
  readonlySafe?: boolean;
102
102
  /** Execute the tool. */
103
103
  execute(toolCallId: string, params: Static<TParams>, signal: AbortSignal | undefined, onUpdate: AgentToolUpdateCallback<TDetails> | undefined, ctx: ToolExecuteContext): Promise<AgentToolResult<TDetails>>;
104
- /** Custom rendering for tool call display. Method syntax keeps renderer assignability bivariant in TState. */
104
+ /**
105
+ * Custom rendering for tool call display. Method syntax keeps renderer assignability bivariant in TState.
106
+ *
107
+ * Hosting boundary: this face returns a host-side `Component`. First-party
108
+ * builtin tools render through the `@agent-forge/tui` package; capability
109
+ * plugins must NOT import that package (install-store distribution is
110
+ * self-contained and cannot resolve workspace deps — a plugin doing this
111
+ * fails to load in production while passing workspace-local tests). A
112
+ * plugin that wants custom rendering implements the structural shape
113
+ * (`{ render(width): string[]; invalidate?(): void }`) without the package,
114
+ * or relies on the generic fallback preview.
115
+ */
105
116
  renderCall?(args: Static<TParams>, theme: Theme, context: ToolRenderContext<TState, Static<TParams>>): Component;
106
- /** Custom rendering for tool result display. Method syntax keeps renderer assignability bivariant in TState/TDetails. */
117
+ /**
118
+ * Custom rendering for tool result display. Method syntax keeps renderer assignability bivariant in TState/TDetails.
119
+ *
120
+ * Same hosting boundary as `renderCall`: structural `Component`
121
+ * implementations only for capability plugins; no `@agent-forge/tui` import
122
+ * (see renderCall for the failure mode). The generic fallback (compact
123
+ * single-line JSON preview with an expand hint) covers plugins without a
124
+ * renderer.
125
+ */
107
126
  renderResult?(result: AgentToolResult<TDetails>, options: ToolRenderResultOptions, theme: Theme, context: ToolRenderContext<TState, Static<TParams>>): Component;
108
127
  }
109
128
  /** Tool info with name, description, parameter schema, prompt guidelines, and source metadata. */
@@ -1 +1 @@
1
- {"version":3,"file":"tool-definition.d.ts","sourceRoot":"","sources":["../../../src/core/tools/tool-definition.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACX,eAAe,EACf,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,GAAG,EAAE,yBAAyB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,qGAAqG;AACrG,MAAM,WAAW,kBAAkB;IAClC,iCAAiC;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,wCAAwC;IACxC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAC9B,qDAAqD;IACrD,cAAc,EAAE;QACf,YAAY,IAAI,MAAM,CAAC;QACvB,cAAc,IAAI,MAAM,GAAG,SAAS,CAAC;KACrC,CAAC;IACF,oEAAoE;IACpE,aAAa,EAAE,aAAa,GAAG,SAAS,CAAC;CACzC;AAED,yCAAyC;AACzC,MAAM,WAAW,uBAAuB;IACvC,0CAA0C;IAC1C,QAAQ,EAAE,OAAO,CAAC;IAClB,iDAAiD;IACjD,SAAS,EAAE,OAAO,CAAC;CACnB;AAED,wCAAwC;AACxC,MAAM,WAAW,iBAAiB,CAAC,MAAM,GAAG,OAAO,EAAE,KAAK,GAAG,OAAO;IACnE,6FAA6F;IAC7F,IAAI,EAAE,KAAK,CAAC;IACZ,mGAAmG;IACnG,UAAU,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,UAAU,EAAE,MAAM,IAAI,CAA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,EAClB,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,EACvB,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,QAAQ,EAAE,uBAAuB,CAAC,QAAQ,CAAC,GAAG,SAAS,EACvD,GAAG,EAAE,kBAAkB,GACrB,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEtC,8GAA8G;IAC9G,UAAU,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAEjH,yHAAyH;IACzH,YAAY,CAAC,CACZ,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,EACjC,OAAO,EAAE,uBAAuB,EAChC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,GACjD,SAAS,CAAC;CACb;AAED,kGAAkG;AAClG,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,aAAa,GAAG,YAAY,GAAG,kBAAkB,CAAC,GAAG;IACzG,UAAU,EAAE,UAAU,CAAC;CACvB,CAAC;AAEF,KAAK,iBAAiB,GAAG,cAAc,CAAC;AAExC;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,SAAS,OAAO,EAAE,QAAQ,GAAG,OAAO,EAAE,MAAM,GAAG,OAAO,EACvF,IAAI,EAAE,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,GAC7C,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,iBAAiB,CAE/D","sourcesContent":["/**\n * Tool definition types shared by the built-in coding tools, SDK custom tools,\n * and the capability tool registry projection.\n *\n * This is the tool domain's own type home (D-052 sibling ruling: these types\n * describe product tools, not any host UI). The render types are consumed by\n * the TUI tool components but defined here because the definition carries the\n * renderer contract.\n */\n\nimport type {\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tThinkingLevel,\n\tToolExecutionMode,\n} from \"@agent-forge/agent-core\";\nimport type { Api, ConstrainedSamplingConfig, Model } from \"@agent-forge/ai\";\nimport type { Component } from \"@agent-forge/tui\";\nimport type { Static, TSchema } from \"typebox\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport type { SourceInfo } from \"../source-info.ts\";\n\n/** Session-scoped facts handed to a tool's execute. The session resolves the values at call time. */\nexport interface ToolExecuteContext {\n\t/** Current working directory. */\n\tcwd: string;\n\t/** Current model (may be undefined). */\n\tmodel: Model<Api> | undefined;\n\t/** Session identity for env exposure and logging. */\n\tsessionManager: {\n\t\tgetSessionId(): string;\n\t\tgetSessionFile(): string | undefined;\n\t};\n\t/** Current thinking level, when provided by the session runtime. */\n\tthinkingLevel: ThinkingLevel | undefined;\n}\n\n/** Rendering options for tool results */\nexport interface ToolRenderResultOptions {\n\t/** Whether the result view is expanded */\n\texpanded: boolean;\n\t/** Whether this is a partial/streaming result */\n\tisPartial: boolean;\n}\n\n/** Context passed to tool renderers. */\nexport interface ToolRenderContext<TState = unknown, TArgs = unknown> {\n\t/** Current tool call arguments. Shared across call/result renders for the same tool call. */\n\targs: TArgs;\n\t/** Unique id for this tool execution. Stable across call/result renders for the same tool call. */\n\ttoolCallId: string;\n\t/** Invalidate just this tool execution component for redraw. */\n\tinvalidate: () => void;\n\t/** Previously returned component for this render slot, if any. */\n\tlastComponent: Component | undefined;\n\t/** Shared renderer state for this tool row. Initialized by tool-execution.ts. */\n\tstate: TState;\n\t/** Working directory for this tool execution. */\n\tcwd: string;\n\t/** Whether the tool execution has started. */\n\texecutionStarted: boolean;\n\t/** Whether the tool call arguments are complete. */\n\targsComplete: boolean;\n\t/** Whether the tool result is partial/streaming. */\n\tisPartial: boolean;\n\t/** Whether the result view is expanded. */\n\texpanded: boolean;\n\t/** Whether inline images are currently shown in the TUI. */\n\tshowImages: boolean;\n\t/** Whether the current result is an error. */\n\tisError: boolean;\n}\n\n/**\n * Tool definition for the session tool registry (built-in tools, SDK custom\n * tools, and the capability runtime's tool projection).\n */\nexport interface ToolDefinition<TParams extends TSchema = TSchema, TDetails = unknown, TState = unknown> {\n\t/** Tool name (used in LLM tool calls) */\n\tname: string;\n\t/** Human-readable label for UI */\n\tlabel: string;\n\t/** Description for LLM */\n\tdescription: string;\n\t/** Optional one-line snippet for the Available tools section in the default system prompt. Custom tools are omitted from that section when this is not provided. */\n\tpromptSnippet?: string;\n\t/** Optional guideline bullets appended to the default system prompt Guidelines section when this tool is active. */\n\tpromptGuidelines?: string[];\n\t/** Parameter schema (TypeBox) */\n\tparameters: TParams;\n\t/** Optional provider-side constrained sampling request for this tool. Set false to explicitly disable it, equivalent to leaving it undefined. */\n\tconstrainedSampling?: false | ConstrainedSamplingConfig;\n\t/** Controls whether ToolExecutionComponent renders the standard colored shell or the tool renders its own framing. */\n\trenderShell?: \"default\" | \"self\";\n\n\t/** Optional compatibility shim to prepare raw tool call arguments before schema validation. Must return an object conforming to TParams. */\n\tprepareArguments?: (args: unknown) => Static<TParams>;\n\n\t/**\n\t * Per-tool execution mode override.\n\t * - \"sequential\": this tool must execute one at a time with other tool calls.\n\t * - \"parallel\": this tool can execute concurrently with other tool calls.\n\t *\n\t * If omitted, the default execution mode applies.\n\t */\n\texecutionMode?: ToolExecutionMode;\n\n\t/**\n\t * Owning-plugin declaration (宪法 §6): this tool is explicitly safe for the\n\t * `readonly` capability mode. In readonly sessions the kernel keeps only\n\t * first-party (`agent-forge.builtin.*`) tools that declare it on the active\n\t * face; tools from external plugins keep their own semantics regardless.\n\t */\n\treadonlySafe?: boolean;\n\n\t/** Execute the tool. */\n\texecute(\n\t\ttoolCallId: string,\n\t\tparams: Static<TParams>,\n\t\tsignal: AbortSignal | undefined,\n\t\tonUpdate: AgentToolUpdateCallback<TDetails> | undefined,\n\t\tctx: ToolExecuteContext,\n\t): Promise<AgentToolResult<TDetails>>;\n\n\t/** Custom rendering for tool call display. Method syntax keeps renderer assignability bivariant in TState. */\n\trenderCall?(args: Static<TParams>, theme: Theme, context: ToolRenderContext<TState, Static<TParams>>): Component;\n\n\t/** Custom rendering for tool result display. Method syntax keeps renderer assignability bivariant in TState/TDetails. */\n\trenderResult?(\n\t\tresult: AgentToolResult<TDetails>,\n\t\toptions: ToolRenderResultOptions,\n\t\ttheme: Theme,\n\t\tcontext: ToolRenderContext<TState, Static<TParams>>,\n\t): Component;\n}\n\n/** Tool info with name, description, parameter schema, prompt guidelines, and source metadata. */\nexport type ToolInfo = Pick<ToolDefinition, \"name\" | \"description\" | \"parameters\" | \"promptGuidelines\"> & {\n\tsourceInfo: SourceInfo;\n};\n\ntype AnyToolDefinition = ToolDefinition;\n\n/**\n * Preserve parameter inference for standalone tool definitions.\n *\n * Use this when assigning a tool to a variable or passing it through arrays such\n * as `customTools`, where contextual typing would otherwise widen params to\n * `unknown`.\n */\nexport function defineTool<TParams extends TSchema, TDetails = unknown, TState = unknown>(\n\ttool: ToolDefinition<TParams, TDetails, TState>,\n): ToolDefinition<TParams, TDetails, TState> & AnyToolDefinition {\n\treturn tool as ToolDefinition<TParams, TDetails, TState> & AnyToolDefinition;\n}\n"]}
1
+ {"version":3,"file":"tool-definition.d.ts","sourceRoot":"","sources":["../../../src/core/tools/tool-definition.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACX,eAAe,EACf,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,GAAG,EAAE,yBAAyB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,KAAK,EAAE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AY,CAAC,CACZ,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,EACjC,OAAO,EAAE,uBAAuB,EAChC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,GACjD,SAAS,CAAC;CACb;AAED,kGAAkG;AAClG,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,aAAa,GAAG,YAAY,GAAG,kBAAkB,CAAC,GAAG;IACzG,UAAU,EAAE,UAAU,CAAC;CACvB,CAAC;AAEF,KAAK,iBAAiB,GAAG,cAAc,CAAC;AAExC;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,SAAS,OAAO,EAAE,QAAQ,GAAG,OAAO,EAAE,MAAM,GAAG,OAAO,EACvF,IAAI,EAAE,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,GAC7C,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,iBAAiB,CAE/D","sourcesContent":["/**\n * Tool definition types shared by the built-in coding tools, SDK custom tools,\n * and the capability tool registry projection.\n *\n * This is the tool domain's own type home (D-052 sibling ruling: these types\n * describe product tools, not any host UI). The render types are consumed by\n * the TUI tool components but defined here because the definition carries the\n * renderer contract.\n */\n\nimport type {\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tThinkingLevel,\n\tToolExecutionMode,\n} from \"@agent-forge/agent-core\";\nimport type { Api, ConstrainedSamplingConfig, Model } from \"@agent-forge/ai\";\nimport type { Component } from \"@agent-forge/tui\";\nimport type { Static, TSchema } from \"typebox\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport type { SourceInfo } from \"../source-info.ts\";\n\n/** Session-scoped facts handed to a tool's execute. The session resolves the values at call time. */\nexport interface ToolExecuteContext {\n\t/** Current working directory. */\n\tcwd: string;\n\t/** Current model (may be undefined). */\n\tmodel: Model<Api> | undefined;\n\t/** Session identity for env exposure and logging. */\n\tsessionManager: {\n\t\tgetSessionId(): string;\n\t\tgetSessionFile(): string | undefined;\n\t};\n\t/** Current thinking level, when provided by the session runtime. */\n\tthinkingLevel: ThinkingLevel | undefined;\n}\n\n/** Rendering options for tool results */\nexport interface ToolRenderResultOptions {\n\t/** Whether the result view is expanded */\n\texpanded: boolean;\n\t/** Whether this is a partial/streaming result */\n\tisPartial: boolean;\n}\n\n/** Context passed to tool renderers. */\nexport interface ToolRenderContext<TState = unknown, TArgs = unknown> {\n\t/** Current tool call arguments. Shared across call/result renders for the same tool call. */\n\targs: TArgs;\n\t/** Unique id for this tool execution. Stable across call/result renders for the same tool call. */\n\ttoolCallId: string;\n\t/** Invalidate just this tool execution component for redraw. */\n\tinvalidate: () => void;\n\t/** Previously returned component for this render slot, if any. */\n\tlastComponent: Component | undefined;\n\t/** Shared renderer state for this tool row. Initialized by tool-execution.ts. */\n\tstate: TState;\n\t/** Working directory for this tool execution. */\n\tcwd: string;\n\t/** Whether the tool execution has started. */\n\texecutionStarted: boolean;\n\t/** Whether the tool call arguments are complete. */\n\targsComplete: boolean;\n\t/** Whether the tool result is partial/streaming. */\n\tisPartial: boolean;\n\t/** Whether the result view is expanded. */\n\texpanded: boolean;\n\t/** Whether inline images are currently shown in the TUI. */\n\tshowImages: boolean;\n\t/** Whether the current result is an error. */\n\tisError: boolean;\n}\n\n/**\n * Tool definition for the session tool registry (built-in tools, SDK custom\n * tools, and the capability runtime's tool projection).\n */\nexport interface ToolDefinition<TParams extends TSchema = TSchema, TDetails = unknown, TState = unknown> {\n\t/** Tool name (used in LLM tool calls) */\n\tname: string;\n\t/** Human-readable label for UI */\n\tlabel: string;\n\t/** Description for LLM */\n\tdescription: string;\n\t/** Optional one-line snippet for the Available tools section in the default system prompt. Custom tools are omitted from that section when this is not provided. */\n\tpromptSnippet?: string;\n\t/** Optional guideline bullets appended to the default system prompt Guidelines section when this tool is active. */\n\tpromptGuidelines?: string[];\n\t/** Parameter schema (TypeBox) */\n\tparameters: TParams;\n\t/** Optional provider-side constrained sampling request for this tool. Set false to explicitly disable it, equivalent to leaving it undefined. */\n\tconstrainedSampling?: false | ConstrainedSamplingConfig;\n\t/** Controls whether ToolExecutionComponent renders the standard colored shell or the tool renders its own framing. */\n\trenderShell?: \"default\" | \"self\";\n\n\t/** Optional compatibility shim to prepare raw tool call arguments before schema validation. Must return an object conforming to TParams. */\n\tprepareArguments?: (args: unknown) => Static<TParams>;\n\n\t/**\n\t * Per-tool execution mode override.\n\t * - \"sequential\": this tool must execute one at a time with other tool calls.\n\t * - \"parallel\": this tool can execute concurrently with other tool calls.\n\t *\n\t * If omitted, the default execution mode applies.\n\t */\n\texecutionMode?: ToolExecutionMode;\n\n\t/**\n\t * Owning-plugin declaration (宪法 §6): this tool is explicitly safe for the\n\t * `readonly` capability mode. In readonly sessions the kernel keeps only\n\t * first-party (`agent-forge.builtin.*`) tools that declare it on the active\n\t * face; tools from external plugins keep their own semantics regardless.\n\t */\n\treadonlySafe?: boolean;\n\n\t/** Execute the tool. */\n\texecute(\n\t\ttoolCallId: string,\n\t\tparams: Static<TParams>,\n\t\tsignal: AbortSignal | undefined,\n\t\tonUpdate: AgentToolUpdateCallback<TDetails> | undefined,\n\t\tctx: ToolExecuteContext,\n\t): Promise<AgentToolResult<TDetails>>;\n\n\t/**\n\t * Custom rendering for tool call display. Method syntax keeps renderer assignability bivariant in TState.\n\t *\n\t * Hosting boundary: this face returns a host-side `Component`. First-party\n\t * builtin tools render through the `@agent-forge/tui` package; capability\n\t * plugins must NOT import that package (install-store distribution is\n\t * self-contained and cannot resolve workspace deps — a plugin doing this\n\t * fails to load in production while passing workspace-local tests). A\n\t * plugin that wants custom rendering implements the structural shape\n\t * (`{ render(width): string[]; invalidate?(): void }`) without the package,\n\t * or relies on the generic fallback preview.\n\t */\n\trenderCall?(args: Static<TParams>, theme: Theme, context: ToolRenderContext<TState, Static<TParams>>): Component;\n\n\t/**\n\t * Custom rendering for tool result display. Method syntax keeps renderer assignability bivariant in TState/TDetails.\n\t *\n\t * Same hosting boundary as `renderCall`: structural `Component`\n\t * implementations only for capability plugins; no `@agent-forge/tui` import\n\t * (see renderCall for the failure mode). The generic fallback (compact\n\t * single-line JSON preview with an expand hint) covers plugins without a\n\t * renderer.\n\t */\n\trenderResult?(\n\t\tresult: AgentToolResult<TDetails>,\n\t\toptions: ToolRenderResultOptions,\n\t\ttheme: Theme,\n\t\tcontext: ToolRenderContext<TState, Static<TParams>>,\n\t): Component;\n}\n\n/** Tool info with name, description, parameter schema, prompt guidelines, and source metadata. */\nexport type ToolInfo = Pick<ToolDefinition, \"name\" | \"description\" | \"parameters\" | \"promptGuidelines\"> & {\n\tsourceInfo: SourceInfo;\n};\n\ntype AnyToolDefinition = ToolDefinition;\n\n/**\n * Preserve parameter inference for standalone tool definitions.\n *\n * Use this when assigning a tool to a variable or passing it through arrays such\n * as `customTools`, where contextual typing would otherwise widen params to\n * `unknown`.\n */\nexport function defineTool<TParams extends TSchema, TDetails = unknown, TState = unknown>(\n\ttool: ToolDefinition<TParams, TDetails, TState>,\n): ToolDefinition<TParams, TDetails, TState> & AnyToolDefinition {\n\treturn tool as ToolDefinition<TParams, TDetails, TState> & AnyToolDefinition;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"tool-definition.js","sourceRoot":"","sources":["../../../src/core/tools/tool-definition.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAuIH;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACzB,IAA+C,EACiB;IAChE,OAAO,IAAqE,CAAC;AAAA,CAC7E","sourcesContent":["/**\n * Tool definition types shared by the built-in coding tools, SDK custom tools,\n * and the capability tool registry projection.\n *\n * This is the tool domain's own type home (D-052 sibling ruling: these types\n * describe product tools, not any host UI). The render types are consumed by\n * the TUI tool components but defined here because the definition carries the\n * renderer contract.\n */\n\nimport type {\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tThinkingLevel,\n\tToolExecutionMode,\n} from \"@agent-forge/agent-core\";\nimport type { Api, ConstrainedSamplingConfig, Model } from \"@agent-forge/ai\";\nimport type { Component } from \"@agent-forge/tui\";\nimport type { Static, TSchema } from \"typebox\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport type { SourceInfo } from \"../source-info.ts\";\n\n/** Session-scoped facts handed to a tool's execute. The session resolves the values at call time. */\nexport interface ToolExecuteContext {\n\t/** Current working directory. */\n\tcwd: string;\n\t/** Current model (may be undefined). */\n\tmodel: Model<Api> | undefined;\n\t/** Session identity for env exposure and logging. */\n\tsessionManager: {\n\t\tgetSessionId(): string;\n\t\tgetSessionFile(): string | undefined;\n\t};\n\t/** Current thinking level, when provided by the session runtime. */\n\tthinkingLevel: ThinkingLevel | undefined;\n}\n\n/** Rendering options for tool results */\nexport interface ToolRenderResultOptions {\n\t/** Whether the result view is expanded */\n\texpanded: boolean;\n\t/** Whether this is a partial/streaming result */\n\tisPartial: boolean;\n}\n\n/** Context passed to tool renderers. */\nexport interface ToolRenderContext<TState = unknown, TArgs = unknown> {\n\t/** Current tool call arguments. Shared across call/result renders for the same tool call. */\n\targs: TArgs;\n\t/** Unique id for this tool execution. Stable across call/result renders for the same tool call. */\n\ttoolCallId: string;\n\t/** Invalidate just this tool execution component for redraw. */\n\tinvalidate: () => void;\n\t/** Previously returned component for this render slot, if any. */\n\tlastComponent: Component | undefined;\n\t/** Shared renderer state for this tool row. Initialized by tool-execution.ts. */\n\tstate: TState;\n\t/** Working directory for this tool execution. */\n\tcwd: string;\n\t/** Whether the tool execution has started. */\n\texecutionStarted: boolean;\n\t/** Whether the tool call arguments are complete. */\n\targsComplete: boolean;\n\t/** Whether the tool result is partial/streaming. */\n\tisPartial: boolean;\n\t/** Whether the result view is expanded. */\n\texpanded: boolean;\n\t/** Whether inline images are currently shown in the TUI. */\n\tshowImages: boolean;\n\t/** Whether the current result is an error. */\n\tisError: boolean;\n}\n\n/**\n * Tool definition for the session tool registry (built-in tools, SDK custom\n * tools, and the capability runtime's tool projection).\n */\nexport interface ToolDefinition<TParams extends TSchema = TSchema, TDetails = unknown, TState = unknown> {\n\t/** Tool name (used in LLM tool calls) */\n\tname: string;\n\t/** Human-readable label for UI */\n\tlabel: string;\n\t/** Description for LLM */\n\tdescription: string;\n\t/** Optional one-line snippet for the Available tools section in the default system prompt. Custom tools are omitted from that section when this is not provided. */\n\tpromptSnippet?: string;\n\t/** Optional guideline bullets appended to the default system prompt Guidelines section when this tool is active. */\n\tpromptGuidelines?: string[];\n\t/** Parameter schema (TypeBox) */\n\tparameters: TParams;\n\t/** Optional provider-side constrained sampling request for this tool. Set false to explicitly disable it, equivalent to leaving it undefined. */\n\tconstrainedSampling?: false | ConstrainedSamplingConfig;\n\t/** Controls whether ToolExecutionComponent renders the standard colored shell or the tool renders its own framing. */\n\trenderShell?: \"default\" | \"self\";\n\n\t/** Optional compatibility shim to prepare raw tool call arguments before schema validation. Must return an object conforming to TParams. */\n\tprepareArguments?: (args: unknown) => Static<TParams>;\n\n\t/**\n\t * Per-tool execution mode override.\n\t * - \"sequential\": this tool must execute one at a time with other tool calls.\n\t * - \"parallel\": this tool can execute concurrently with other tool calls.\n\t *\n\t * If omitted, the default execution mode applies.\n\t */\n\texecutionMode?: ToolExecutionMode;\n\n\t/**\n\t * Owning-plugin declaration (宪法 §6): this tool is explicitly safe for the\n\t * `readonly` capability mode. In readonly sessions the kernel keeps only\n\t * first-party (`agent-forge.builtin.*`) tools that declare it on the active\n\t * face; tools from external plugins keep their own semantics regardless.\n\t */\n\treadonlySafe?: boolean;\n\n\t/** Execute the tool. */\n\texecute(\n\t\ttoolCallId: string,\n\t\tparams: Static<TParams>,\n\t\tsignal: AbortSignal | undefined,\n\t\tonUpdate: AgentToolUpdateCallback<TDetails> | undefined,\n\t\tctx: ToolExecuteContext,\n\t): Promise<AgentToolResult<TDetails>>;\n\n\t/** Custom rendering for tool call display. Method syntax keeps renderer assignability bivariant in TState. */\n\trenderCall?(args: Static<TParams>, theme: Theme, context: ToolRenderContext<TState, Static<TParams>>): Component;\n\n\t/** Custom rendering for tool result display. Method syntax keeps renderer assignability bivariant in TState/TDetails. */\n\trenderResult?(\n\t\tresult: AgentToolResult<TDetails>,\n\t\toptions: ToolRenderResultOptions,\n\t\ttheme: Theme,\n\t\tcontext: ToolRenderContext<TState, Static<TParams>>,\n\t): Component;\n}\n\n/** Tool info with name, description, parameter schema, prompt guidelines, and source metadata. */\nexport type ToolInfo = Pick<ToolDefinition, \"name\" | \"description\" | \"parameters\" | \"promptGuidelines\"> & {\n\tsourceInfo: SourceInfo;\n};\n\ntype AnyToolDefinition = ToolDefinition;\n\n/**\n * Preserve parameter inference for standalone tool definitions.\n *\n * Use this when assigning a tool to a variable or passing it through arrays such\n * as `customTools`, where contextual typing would otherwise widen params to\n * `unknown`.\n */\nexport function defineTool<TParams extends TSchema, TDetails = unknown, TState = unknown>(\n\ttool: ToolDefinition<TParams, TDetails, TState>,\n): ToolDefinition<TParams, TDetails, TState> & AnyToolDefinition {\n\treturn tool as ToolDefinition<TParams, TDetails, TState> & AnyToolDefinition;\n}\n"]}
1
+ {"version":3,"file":"tool-definition.js","sourceRoot":"","sources":["../../../src/core/tools/tool-definition.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA0JH;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACzB,IAA+C,EACiB;IAChE,OAAO,IAAqE,CAAC;AAAA,CAC7E","sourcesContent":["/**\n * Tool definition types shared by the built-in coding tools, SDK custom tools,\n * and the capability tool registry projection.\n *\n * This is the tool domain's own type home (D-052 sibling ruling: these types\n * describe product tools, not any host UI). The render types are consumed by\n * the TUI tool components but defined here because the definition carries the\n * renderer contract.\n */\n\nimport type {\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tThinkingLevel,\n\tToolExecutionMode,\n} from \"@agent-forge/agent-core\";\nimport type { Api, ConstrainedSamplingConfig, Model } from \"@agent-forge/ai\";\nimport type { Component } from \"@agent-forge/tui\";\nimport type { Static, TSchema } from \"typebox\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport type { SourceInfo } from \"../source-info.ts\";\n\n/** Session-scoped facts handed to a tool's execute. The session resolves the values at call time. */\nexport interface ToolExecuteContext {\n\t/** Current working directory. */\n\tcwd: string;\n\t/** Current model (may be undefined). */\n\tmodel: Model<Api> | undefined;\n\t/** Session identity for env exposure and logging. */\n\tsessionManager: {\n\t\tgetSessionId(): string;\n\t\tgetSessionFile(): string | undefined;\n\t};\n\t/** Current thinking level, when provided by the session runtime. */\n\tthinkingLevel: ThinkingLevel | undefined;\n}\n\n/** Rendering options for tool results */\nexport interface ToolRenderResultOptions {\n\t/** Whether the result view is expanded */\n\texpanded: boolean;\n\t/** Whether this is a partial/streaming result */\n\tisPartial: boolean;\n}\n\n/** Context passed to tool renderers. */\nexport interface ToolRenderContext<TState = unknown, TArgs = unknown> {\n\t/** Current tool call arguments. Shared across call/result renders for the same tool call. */\n\targs: TArgs;\n\t/** Unique id for this tool execution. Stable across call/result renders for the same tool call. */\n\ttoolCallId: string;\n\t/** Invalidate just this tool execution component for redraw. */\n\tinvalidate: () => void;\n\t/** Previously returned component for this render slot, if any. */\n\tlastComponent: Component | undefined;\n\t/** Shared renderer state for this tool row. Initialized by tool-execution.ts. */\n\tstate: TState;\n\t/** Working directory for this tool execution. */\n\tcwd: string;\n\t/** Whether the tool execution has started. */\n\texecutionStarted: boolean;\n\t/** Whether the tool call arguments are complete. */\n\targsComplete: boolean;\n\t/** Whether the tool result is partial/streaming. */\n\tisPartial: boolean;\n\t/** Whether the result view is expanded. */\n\texpanded: boolean;\n\t/** Whether inline images are currently shown in the TUI. */\n\tshowImages: boolean;\n\t/** Whether the current result is an error. */\n\tisError: boolean;\n}\n\n/**\n * Tool definition for the session tool registry (built-in tools, SDK custom\n * tools, and the capability runtime's tool projection).\n */\nexport interface ToolDefinition<TParams extends TSchema = TSchema, TDetails = unknown, TState = unknown> {\n\t/** Tool name (used in LLM tool calls) */\n\tname: string;\n\t/** Human-readable label for UI */\n\tlabel: string;\n\t/** Description for LLM */\n\tdescription: string;\n\t/** Optional one-line snippet for the Available tools section in the default system prompt. Custom tools are omitted from that section when this is not provided. */\n\tpromptSnippet?: string;\n\t/** Optional guideline bullets appended to the default system prompt Guidelines section when this tool is active. */\n\tpromptGuidelines?: string[];\n\t/** Parameter schema (TypeBox) */\n\tparameters: TParams;\n\t/** Optional provider-side constrained sampling request for this tool. Set false to explicitly disable it, equivalent to leaving it undefined. */\n\tconstrainedSampling?: false | ConstrainedSamplingConfig;\n\t/** Controls whether ToolExecutionComponent renders the standard colored shell or the tool renders its own framing. */\n\trenderShell?: \"default\" | \"self\";\n\n\t/** Optional compatibility shim to prepare raw tool call arguments before schema validation. Must return an object conforming to TParams. */\n\tprepareArguments?: (args: unknown) => Static<TParams>;\n\n\t/**\n\t * Per-tool execution mode override.\n\t * - \"sequential\": this tool must execute one at a time with other tool calls.\n\t * - \"parallel\": this tool can execute concurrently with other tool calls.\n\t *\n\t * If omitted, the default execution mode applies.\n\t */\n\texecutionMode?: ToolExecutionMode;\n\n\t/**\n\t * Owning-plugin declaration (宪法 §6): this tool is explicitly safe for the\n\t * `readonly` capability mode. In readonly sessions the kernel keeps only\n\t * first-party (`agent-forge.builtin.*`) tools that declare it on the active\n\t * face; tools from external plugins keep their own semantics regardless.\n\t */\n\treadonlySafe?: boolean;\n\n\t/** Execute the tool. */\n\texecute(\n\t\ttoolCallId: string,\n\t\tparams: Static<TParams>,\n\t\tsignal: AbortSignal | undefined,\n\t\tonUpdate: AgentToolUpdateCallback<TDetails> | undefined,\n\t\tctx: ToolExecuteContext,\n\t): Promise<AgentToolResult<TDetails>>;\n\n\t/**\n\t * Custom rendering for tool call display. Method syntax keeps renderer assignability bivariant in TState.\n\t *\n\t * Hosting boundary: this face returns a host-side `Component`. First-party\n\t * builtin tools render through the `@agent-forge/tui` package; capability\n\t * plugins must NOT import that package (install-store distribution is\n\t * self-contained and cannot resolve workspace deps — a plugin doing this\n\t * fails to load in production while passing workspace-local tests). A\n\t * plugin that wants custom rendering implements the structural shape\n\t * (`{ render(width): string[]; invalidate?(): void }`) without the package,\n\t * or relies on the generic fallback preview.\n\t */\n\trenderCall?(args: Static<TParams>, theme: Theme, context: ToolRenderContext<TState, Static<TParams>>): Component;\n\n\t/**\n\t * Custom rendering for tool result display. Method syntax keeps renderer assignability bivariant in TState/TDetails.\n\t *\n\t * Same hosting boundary as `renderCall`: structural `Component`\n\t * implementations only for capability plugins; no `@agent-forge/tui` import\n\t * (see renderCall for the failure mode). The generic fallback (compact\n\t * single-line JSON preview with an expand hint) covers plugins without a\n\t * renderer.\n\t */\n\trenderResult?(\n\t\tresult: AgentToolResult<TDetails>,\n\t\toptions: ToolRenderResultOptions,\n\t\ttheme: Theme,\n\t\tcontext: ToolRenderContext<TState, Static<TParams>>,\n\t): Component;\n}\n\n/** Tool info with name, description, parameter schema, prompt guidelines, and source metadata. */\nexport type ToolInfo = Pick<ToolDefinition, \"name\" | \"description\" | \"parameters\" | \"promptGuidelines\"> & {\n\tsourceInfo: SourceInfo;\n};\n\ntype AnyToolDefinition = ToolDefinition;\n\n/**\n * Preserve parameter inference for standalone tool definitions.\n *\n * Use this when assigning a tool to a variable or passing it through arrays such\n * as `customTools`, where contextual typing would otherwise widen params to\n * `unknown`.\n */\nexport function defineTool<TParams extends TSchema, TDetails = unknown, TState = unknown>(\n\ttool: ToolDefinition<TParams, TDetails, TState>,\n): ToolDefinition<TParams, TDetails, TState> & AnyToolDefinition {\n\treturn tool as ToolDefinition<TParams, TDetails, TState> & AnyToolDefinition;\n}\n"]}