@nodetool-ai/agents 0.7.0-rc.11

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 (281) hide show
  1. package/dist/agent-executor.d.ts +62 -0
  2. package/dist/agent-executor.d.ts.map +1 -0
  3. package/dist/agent-executor.js +324 -0
  4. package/dist/agent-executor.js.map +1 -0
  5. package/dist/agent-step-executor.d.ts +28 -0
  6. package/dist/agent-step-executor.d.ts.map +1 -0
  7. package/dist/agent-step-executor.js +99 -0
  8. package/dist/agent-step-executor.js.map +1 -0
  9. package/dist/agent-workflow-runner.d.ts +31 -0
  10. package/dist/agent-workflow-runner.d.ts.map +1 -0
  11. package/dist/agent-workflow-runner.js +124 -0
  12. package/dist/agent-workflow-runner.js.map +1 -0
  13. package/dist/agent.d.ts +115 -0
  14. package/dist/agent.d.ts.map +1 -0
  15. package/dist/agent.js +587 -0
  16. package/dist/agent.js.map +1 -0
  17. package/dist/base-agent.d.ts +42 -0
  18. package/dist/base-agent.d.ts.map +1 -0
  19. package/dist/base-agent.js +29 -0
  20. package/dist/base-agent.js.map +1 -0
  21. package/dist/constants.d.ts +8 -0
  22. package/dist/constants.d.ts.map +1 -0
  23. package/dist/constants.js +8 -0
  24. package/dist/constants.js.map +1 -0
  25. package/dist/graph-builder.d.ts +49 -0
  26. package/dist/graph-builder.d.ts.map +1 -0
  27. package/dist/graph-builder.js +206 -0
  28. package/dist/graph-builder.js.map +1 -0
  29. package/dist/graph-planner.d.ts +56 -0
  30. package/dist/graph-planner.d.ts.map +1 -0
  31. package/dist/graph-planner.js +311 -0
  32. package/dist/graph-planner.js.map +1 -0
  33. package/dist/index.d.ts +79 -0
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +81 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/js-sandbox.d.ts +84 -0
  38. package/dist/js-sandbox.d.ts.map +1 -0
  39. package/dist/js-sandbox.js +654 -0
  40. package/dist/js-sandbox.js.map +1 -0
  41. package/dist/multi-mode-agent.d.ts +86 -0
  42. package/dist/multi-mode-agent.d.ts.map +1 -0
  43. package/dist/multi-mode-agent.js +476 -0
  44. package/dist/multi-mode-agent.js.map +1 -0
  45. package/dist/output-format.d.ts +10 -0
  46. package/dist/output-format.d.ts.map +1 -0
  47. package/dist/output-format.js +17 -0
  48. package/dist/output-format.js.map +1 -0
  49. package/dist/parallel-task-executor.d.ts +87 -0
  50. package/dist/parallel-task-executor.d.ts.map +1 -0
  51. package/dist/parallel-task-executor.js +332 -0
  52. package/dist/parallel-task-executor.js.map +1 -0
  53. package/dist/prompts/graph-planner-prompt.d.ts +48 -0
  54. package/dist/prompts/graph-planner-prompt.d.ts.map +1 -0
  55. package/dist/prompts/graph-planner-prompt.js +180 -0
  56. package/dist/prompts/graph-planner-prompt.js.map +1 -0
  57. package/dist/reject-agentic-provider.d.ts +21 -0
  58. package/dist/reject-agentic-provider.d.ts.map +1 -0
  59. package/dist/reject-agentic-provider.js +32 -0
  60. package/dist/reject-agentic-provider.js.map +1 -0
  61. package/dist/simple-agent.d.ts +29 -0
  62. package/dist/simple-agent.d.ts.map +1 -0
  63. package/dist/simple-agent.js +54 -0
  64. package/dist/simple-agent.js.map +1 -0
  65. package/dist/step-executor.d.ts +162 -0
  66. package/dist/step-executor.d.ts.map +1 -0
  67. package/dist/step-executor.js +1114 -0
  68. package/dist/step-executor.js.map +1 -0
  69. package/dist/sub-agent-planner.d.ts +33 -0
  70. package/dist/sub-agent-planner.d.ts.map +1 -0
  71. package/dist/sub-agent-planner.js +203 -0
  72. package/dist/sub-agent-planner.js.map +1 -0
  73. package/dist/task-executor.d.ts +89 -0
  74. package/dist/task-executor.d.ts.map +1 -0
  75. package/dist/task-executor.js +359 -0
  76. package/dist/task-executor.js.map +1 -0
  77. package/dist/task-planner.d.ts +44 -0
  78. package/dist/task-planner.d.ts.map +1 -0
  79. package/dist/task-planner.js +532 -0
  80. package/dist/task-planner.js.map +1 -0
  81. package/dist/team/db-task-board.d.ts +54 -0
  82. package/dist/team/db-task-board.d.ts.map +1 -0
  83. package/dist/team/db-task-board.js +361 -0
  84. package/dist/team/db-task-board.js.map +1 -0
  85. package/dist/team/edge-message-bus.d.ts +51 -0
  86. package/dist/team/edge-message-bus.d.ts.map +1 -0
  87. package/dist/team/edge-message-bus.js +169 -0
  88. package/dist/team/edge-message-bus.js.map +1 -0
  89. package/dist/team/edge-task-board.d.ts +77 -0
  90. package/dist/team/edge-task-board.d.ts.map +1 -0
  91. package/dist/team/edge-task-board.js +140 -0
  92. package/dist/team/edge-task-board.js.map +1 -0
  93. package/dist/team/index.d.ts +16 -0
  94. package/dist/team/index.d.ts.map +1 -0
  95. package/dist/team/index.js +17 -0
  96. package/dist/team/index.js.map +1 -0
  97. package/dist/team/message-bus.d.ts +58 -0
  98. package/dist/team/message-bus.d.ts.map +1 -0
  99. package/dist/team/message-bus.js +151 -0
  100. package/dist/team/message-bus.js.map +1 -0
  101. package/dist/team/task-board.d.ts +106 -0
  102. package/dist/team/task-board.d.ts.map +1 -0
  103. package/dist/team/task-board.js +370 -0
  104. package/dist/team/task-board.js.map +1 -0
  105. package/dist/team/team-executor.d.ts +72 -0
  106. package/dist/team/team-executor.d.ts.map +1 -0
  107. package/dist/team/team-executor.js +466 -0
  108. package/dist/team/team-executor.js.map +1 -0
  109. package/dist/team/team-tools.d.ts +252 -0
  110. package/dist/team/team-tools.d.ts.map +1 -0
  111. package/dist/team/team-tools.js +412 -0
  112. package/dist/team/team-tools.js.map +1 -0
  113. package/dist/team/types.d.ts +198 -0
  114. package/dist/team/types.d.ts.map +1 -0
  115. package/dist/team/types.js +8 -0
  116. package/dist/team/types.js.map +1 -0
  117. package/dist/tools/add-edge-tool.d.ts +18 -0
  118. package/dist/tools/add-edge-tool.d.ts.map +1 -0
  119. package/dist/tools/add-edge-tool.js +92 -0
  120. package/dist/tools/add-edge-tool.js.map +1 -0
  121. package/dist/tools/add-node-tool.d.ts +22 -0
  122. package/dist/tools/add-node-tool.d.ts.map +1 -0
  123. package/dist/tools/add-node-tool.js +128 -0
  124. package/dist/tools/add-node-tool.js.map +1 -0
  125. package/dist/tools/asset-tools.d.ts +58 -0
  126. package/dist/tools/asset-tools.d.ts.map +1 -0
  127. package/dist/tools/asset-tools.js +191 -0
  128. package/dist/tools/asset-tools.js.map +1 -0
  129. package/dist/tools/base-tool.d.ts +25 -0
  130. package/dist/tools/base-tool.d.ts.map +1 -0
  131. package/dist/tools/base-tool.js +24 -0
  132. package/dist/tools/base-tool.js.map +1 -0
  133. package/dist/tools/browser-tools.d.ts +32 -0
  134. package/dist/tools/browser-tools.d.ts.map +1 -0
  135. package/dist/tools/browser-tools.js +208 -0
  136. package/dist/tools/browser-tools.js.map +1 -0
  137. package/dist/tools/calculator-tool.d.ts +24 -0
  138. package/dist/tools/calculator-tool.d.ts.map +1 -0
  139. package/dist/tools/calculator-tool.js +64 -0
  140. package/dist/tools/calculator-tool.js.map +1 -0
  141. package/dist/tools/claude-code-tools.d.ts +96 -0
  142. package/dist/tools/claude-code-tools.d.ts.map +1 -0
  143. package/dist/tools/claude-code-tools.js +463 -0
  144. package/dist/tools/claude-code-tools.js.map +1 -0
  145. package/dist/tools/code-tools.d.ts +26 -0
  146. package/dist/tools/code-tools.d.ts.map +1 -0
  147. package/dist/tools/code-tools.js +82 -0
  148. package/dist/tools/code-tools.js.map +1 -0
  149. package/dist/tools/control-tool.d.ts +47 -0
  150. package/dist/tools/control-tool.d.ts.map +1 -0
  151. package/dist/tools/control-tool.js +101 -0
  152. package/dist/tools/control-tool.js.map +1 -0
  153. package/dist/tools/create-plan-tool.d.ts +29 -0
  154. package/dist/tools/create-plan-tool.d.ts.map +1 -0
  155. package/dist/tools/create-plan-tool.js +355 -0
  156. package/dist/tools/create-plan-tool.js.map +1 -0
  157. package/dist/tools/create-task-tool.d.ts +28 -0
  158. package/dist/tools/create-task-tool.d.ts.map +1 -0
  159. package/dist/tools/create-task-tool.js +254 -0
  160. package/dist/tools/create-task-tool.js.map +1 -0
  161. package/dist/tools/dataseo-tools.d.ts +38 -0
  162. package/dist/tools/dataseo-tools.d.ts.map +1 -0
  163. package/dist/tools/dataseo-tools.js +329 -0
  164. package/dist/tools/dataseo-tools.js.map +1 -0
  165. package/dist/tools/email-tools.d.ts +76 -0
  166. package/dist/tools/email-tools.d.ts.map +1 -0
  167. package/dist/tools/email-tools.js +259 -0
  168. package/dist/tools/email-tools.js.map +1 -0
  169. package/dist/tools/filesystem-tools.d.ts +77 -0
  170. package/dist/tools/filesystem-tools.d.ts.map +1 -0
  171. package/dist/tools/filesystem-tools.js +334 -0
  172. package/dist/tools/filesystem-tools.js.map +1 -0
  173. package/dist/tools/find-model-tool.d.ts +25 -0
  174. package/dist/tools/find-model-tool.d.ts.map +1 -0
  175. package/dist/tools/find-model-tool.js +236 -0
  176. package/dist/tools/find-model-tool.js.map +1 -0
  177. package/dist/tools/finish-graph-tool.d.ts +23 -0
  178. package/dist/tools/finish-graph-tool.d.ts.map +1 -0
  179. package/dist/tools/finish-graph-tool.js +46 -0
  180. package/dist/tools/finish-graph-tool.js.map +1 -0
  181. package/dist/tools/finish-step-tool.d.ts +16 -0
  182. package/dist/tools/finish-step-tool.d.ts.map +1 -0
  183. package/dist/tools/finish-step-tool.js +68 -0
  184. package/dist/tools/finish-step-tool.js.map +1 -0
  185. package/dist/tools/google-tools.d.ts +44 -0
  186. package/dist/tools/google-tools.d.ts.map +1 -0
  187. package/dist/tools/google-tools.js +176 -0
  188. package/dist/tools/google-tools.js.map +1 -0
  189. package/dist/tools/http-tools.d.ts +56 -0
  190. package/dist/tools/http-tools.d.ts.map +1 -0
  191. package/dist/tools/http-tools.js +180 -0
  192. package/dist/tools/http-tools.js.map +1 -0
  193. package/dist/tools/js-code-tool.d.ts +30 -0
  194. package/dist/tools/js-code-tool.d.ts.map +1 -0
  195. package/dist/tools/js-code-tool.js +98 -0
  196. package/dist/tools/js-code-tool.js.map +1 -0
  197. package/dist/tools/local-get-node-info-tool.d.ts +19 -0
  198. package/dist/tools/local-get-node-info-tool.d.ts.map +1 -0
  199. package/dist/tools/local-get-node-info-tool.js +75 -0
  200. package/dist/tools/local-get-node-info-tool.js.map +1 -0
  201. package/dist/tools/local-list-nodes-tool.d.ts +19 -0
  202. package/dist/tools/local-list-nodes-tool.d.ts.map +1 -0
  203. package/dist/tools/local-list-nodes-tool.js +69 -0
  204. package/dist/tools/local-list-nodes-tool.js.map +1 -0
  205. package/dist/tools/local-search-nodes-tool.d.ts +21 -0
  206. package/dist/tools/local-search-nodes-tool.d.ts.map +1 -0
  207. package/dist/tools/local-search-nodes-tool.js +111 -0
  208. package/dist/tools/local-search-nodes-tool.js.map +1 -0
  209. package/dist/tools/math-tools.d.ts +156 -0
  210. package/dist/tools/math-tools.d.ts.map +1 -0
  211. package/dist/tools/math-tools.js +422 -0
  212. package/dist/tools/math-tools.js.map +1 -0
  213. package/dist/tools/mcp-tools.d.ts +413 -0
  214. package/dist/tools/mcp-tools.d.ts.map +1 -0
  215. package/dist/tools/mcp-tools.js +618 -0
  216. package/dist/tools/mcp-tools.js.map +1 -0
  217. package/dist/tools/media-tools.d.ts +277 -0
  218. package/dist/tools/media-tools.d.ts.map +1 -0
  219. package/dist/tools/media-tools.js +682 -0
  220. package/dist/tools/media-tools.js.map +1 -0
  221. package/dist/tools/model-tools.d.ts +25 -0
  222. package/dist/tools/model-tools.d.ts.map +1 -0
  223. package/dist/tools/model-tools.js +48 -0
  224. package/dist/tools/model-tools.js.map +1 -0
  225. package/dist/tools/openai-tools.d.ts +73 -0
  226. package/dist/tools/openai-tools.d.ts.map +1 -0
  227. package/dist/tools/openai-tools.js +193 -0
  228. package/dist/tools/openai-tools.js.map +1 -0
  229. package/dist/tools/pdf-tools.d.ts +152 -0
  230. package/dist/tools/pdf-tools.d.ts.map +1 -0
  231. package/dist/tools/pdf-tools.js +339 -0
  232. package/dist/tools/pdf-tools.js.map +1 -0
  233. package/dist/tools/plan-builder-tools.d.ts +72 -0
  234. package/dist/tools/plan-builder-tools.d.ts.map +1 -0
  235. package/dist/tools/plan-builder-tools.js +438 -0
  236. package/dist/tools/plan-builder-tools.js.map +1 -0
  237. package/dist/tools/search-tools.d.ts +39 -0
  238. package/dist/tools/search-tools.d.ts.map +1 -0
  239. package/dist/tools/search-tools.js +218 -0
  240. package/dist/tools/search-tools.js.map +1 -0
  241. package/dist/tools/serp-providers/dataforseo-provider.d.ts +14 -0
  242. package/dist/tools/serp-providers/dataforseo-provider.d.ts.map +1 -0
  243. package/dist/tools/serp-providers/dataforseo-provider.js +114 -0
  244. package/dist/tools/serp-providers/dataforseo-provider.js.map +1 -0
  245. package/dist/tools/serp-providers/index.d.ts +35 -0
  246. package/dist/tools/serp-providers/index.d.ts.map +1 -0
  247. package/dist/tools/serp-providers/index.js +14 -0
  248. package/dist/tools/serp-providers/index.js.map +1 -0
  249. package/dist/tools/serp-providers/serpapi-provider.d.ts +18 -0
  250. package/dist/tools/serp-providers/serpapi-provider.d.ts.map +1 -0
  251. package/dist/tools/serp-providers/serpapi-provider.js +66 -0
  252. package/dist/tools/serp-providers/serpapi-provider.js.map +1 -0
  253. package/dist/tools/tool-registry.d.ts +9 -0
  254. package/dist/tools/tool-registry.d.ts.map +1 -0
  255. package/dist/tools/tool-registry.js +17 -0
  256. package/dist/tools/tool-registry.js.map +1 -0
  257. package/dist/tools/vector-tools.d.ts +224 -0
  258. package/dist/tools/vector-tools.d.ts.map +1 -0
  259. package/dist/tools/vector-tools.js +582 -0
  260. package/dist/tools/vector-tools.js.map +1 -0
  261. package/dist/tools/workspace-tools.d.ts +58 -0
  262. package/dist/tools/workspace-tools.d.ts.map +1 -0
  263. package/dist/tools/workspace-tools.js +152 -0
  264. package/dist/tools/workspace-tools.js.map +1 -0
  265. package/dist/types.d.ts +65 -0
  266. package/dist/types.d.ts.map +1 -0
  267. package/dist/types.js +5 -0
  268. package/dist/types.js.map +1 -0
  269. package/dist/utils/json-parser.d.ts +15 -0
  270. package/dist/utils/json-parser.d.ts.map +1 -0
  271. package/dist/utils/json-parser.js +78 -0
  272. package/dist/utils/json-parser.js.map +1 -0
  273. package/dist/utils/remove-base64-images.d.ts +12 -0
  274. package/dist/utils/remove-base64-images.d.ts.map +1 -0
  275. package/dist/utils/remove-base64-images.js +20 -0
  276. package/dist/utils/remove-base64-images.js.map +1 -0
  277. package/dist/utils/wrap-generators-parallel.d.ts +11 -0
  278. package/dist/utils/wrap-generators-parallel.d.ts.map +1 -0
  279. package/dist/utils/wrap-generators-parallel.js +38 -0
  280. package/dist/utils/wrap-generators-parallel.js.map +1 -0
  281. package/package.json +65 -0
@@ -0,0 +1,46 @@
1
+ /**
2
+ * FinishGraphTool -- planner tool that validates and finalizes the graph.
3
+ *
4
+ * Called by the LLM when it's done building the graph. Runs full validation
5
+ * (cycle detection, connectivity) and produces the GraphData.
6
+ */
7
+ import { Tool } from "./base-tool.js";
8
+ const FINISH_GRAPH_INPUT_SCHEMA = {
9
+ type: "object",
10
+ properties: {},
11
+ required: []
12
+ };
13
+ export class FinishGraphTool extends Tool {
14
+ builder;
15
+ name = "finish_graph";
16
+ description = "Validate and finalize the workflow graph. Call this when you are done adding nodes and edges.";
17
+ inputSchema = FINISH_GRAPH_INPUT_SCHEMA;
18
+ /** The finalized graph, available after a successful call. */
19
+ _graph = null;
20
+ get graph() {
21
+ return this._graph;
22
+ }
23
+ constructor(builder) {
24
+ super();
25
+ this.builder = builder;
26
+ }
27
+ async process(_context, _params) {
28
+ const errors = this.builder.validate();
29
+ if (errors.length > 0) {
30
+ return {
31
+ status: "validation_failed",
32
+ errors
33
+ };
34
+ }
35
+ this._graph = this.builder.build();
36
+ return {
37
+ status: "graph_finalized",
38
+ nodes: this._graph.nodes.length,
39
+ edges: this._graph.edges.length
40
+ };
41
+ }
42
+ userMessage(_params) {
43
+ return "Finalizing workflow graph";
44
+ }
45
+ }
46
+ //# sourceMappingURL=finish-graph-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"finish-graph-tool.js","sourceRoot":"","sources":["../../src/tools/finish-graph-tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGtC,MAAM,yBAAyB,GAAG;IAChC,IAAI,EAAE,QAAiB;IACvB,UAAU,EAAE,EAAE;IACd,QAAQ,EAAE,EAAc;CACzB,CAAC;AAEF,MAAM,OAAO,eAAgB,SAAQ,IAAI;IAaV;IAZpB,IAAI,GAAG,cAAc,CAAC;IACtB,WAAW,GAClB,+FAA+F,CAAC;IACzF,WAAW,GAA4B,yBAAyB,CAAC;IAE1E,8DAA8D;IACtD,MAAM,GAAqB,IAAI,CAAC;IAExC,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,YAA6B,OAAqB;QAChD,KAAK,EAAE,CAAC;QADmB,YAAO,GAAP,OAAO,CAAc;IAElD,CAAC;IAED,KAAK,CAAC,OAAO,CACX,QAA2B,EAC3B,OAAgC;QAEhC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACvC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,OAAO;gBACL,MAAM,EAAE,mBAAmB;gBAC3B,MAAM;aACP,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QAEnC,OAAO;YACL,MAAM,EAAE,iBAAiB;YACzB,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM;YAC/B,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM;SAChC,CAAC;IACJ,CAAC;IAED,WAAW,CAAC,OAAgC;QAC1C,OAAO,2BAA2B,CAAC;IACrC,CAAC;CACF"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Tool for signaling step completion with a validated result.
3
+ *
4
+ * Port of src/nodetool/agents/tools/finish_step_tool.py
5
+ */
6
+ import type { ProcessingContext } from "@nodetool-ai/runtime";
7
+ import { Tool } from "./base-tool.js";
8
+ export declare class FinishStepTool extends Tool {
9
+ readonly name = "finish_step";
10
+ readonly description: string;
11
+ readonly inputSchema: Record<string, unknown>;
12
+ constructor(outputSchema?: Record<string, unknown>);
13
+ process(_context: ProcessingContext, params: Record<string, unknown>): Promise<unknown>;
14
+ userMessage(_params: Record<string, unknown>): string;
15
+ }
16
+ //# sourceMappingURL=finish-step-tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"finish-step-tool.d.ts","sourceRoot":"","sources":["../../src/tools/finish-step-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,qBAAa,cAAe,SAAQ,IAAI;IACtC,QAAQ,CAAC,IAAI,iBAAiB;IAC9B,QAAQ,CAAC,WAAW,SAG8C;IAElE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAElC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAgD5C,OAAO,CACX,QAAQ,EAAE,iBAAiB,EAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,OAAO,CAAC,OAAO,CAAC;IAMnB,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;CAGtD"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Tool for signaling step completion with a validated result.
3
+ *
4
+ * Port of src/nodetool/agents/tools/finish_step_tool.py
5
+ */
6
+ import { Tool } from "./base-tool.js";
7
+ export class FinishStepTool extends Tool {
8
+ name = "finish_step";
9
+ description = "Call this tool when you have completed the step and have the final result ready. " +
10
+ "This is the ONLY way to properly signal step completion. Do not output raw JSON blocks. " +
11
+ "The result must conform to the step's declared output schema.";
12
+ inputSchema;
13
+ constructor(outputSchema) {
14
+ super();
15
+ if (outputSchema) {
16
+ let resultSchema = { ...outputSchema };
17
+ // OpenAI requires function parameter schemas to be type "object" at the
18
+ // top level. When the step declares an array output, wrap it so the
19
+ // overall tool schema stays valid while the result value keeps its
20
+ // intended array shape.
21
+ if (resultSchema["type"] === "array") {
22
+ resultSchema = {
23
+ type: "object",
24
+ description: resultSchema["description"] ?? "Result wrapper",
25
+ properties: {
26
+ items: resultSchema
27
+ },
28
+ required: ["items"],
29
+ additionalProperties: false
30
+ };
31
+ }
32
+ if (resultSchema["type"] === "object" &&
33
+ !("additionalProperties" in resultSchema)) {
34
+ resultSchema["additionalProperties"] = false;
35
+ }
36
+ this.inputSchema = {
37
+ type: "object",
38
+ properties: {
39
+ result: resultSchema
40
+ },
41
+ required: ["result"],
42
+ additionalProperties: false
43
+ };
44
+ }
45
+ else {
46
+ this.inputSchema = {
47
+ type: "object",
48
+ properties: {
49
+ result: {
50
+ type: "string",
51
+ description: "The result of the step."
52
+ }
53
+ },
54
+ required: ["result"],
55
+ additionalProperties: false
56
+ };
57
+ }
58
+ }
59
+ async process(_context, params) {
60
+ // The actual completion handling is done in StepExecutor.
61
+ // This method just returns the params for logging/history purposes.
62
+ return params;
63
+ }
64
+ userMessage(_params) {
65
+ return "Completing step with result...";
66
+ }
67
+ }
68
+ //# sourceMappingURL=finish-step-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"finish-step-tool.js","sourceRoot":"","sources":["../../src/tools/finish-step-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,OAAO,cAAe,SAAQ,IAAI;IAC7B,IAAI,GAAG,aAAa,CAAC;IACrB,WAAW,GAClB,mFAAmF;QACnF,0FAA0F;QAC1F,+DAA+D,CAAC;IAEzD,WAAW,CAA0B;IAE9C,YAAY,YAAsC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,CAAC,OAAgC;QAC1C,OAAO,gCAAgC,CAAC;IAC1C,CAAC;CACF"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Google-powered tools: grounded search and image generation via Gemini API.
3
+ *
4
+ * Port of src/nodetool/agents/tools/google_tools.py
5
+ */
6
+ import type { ProcessingContext } from "@nodetool-ai/runtime";
7
+ import { Tool } from "./base-tool.js";
8
+ export declare class GoogleGroundedSearchTool extends Tool {
9
+ readonly name = "google_grounded_search";
10
+ readonly description = "Search the web using Google's Gemini API with grounding capabilities";
11
+ readonly inputSchema: {
12
+ type: "object";
13
+ properties: {
14
+ query: {
15
+ type: "string";
16
+ description: string;
17
+ };
18
+ };
19
+ required: string[];
20
+ };
21
+ process(_context: ProcessingContext, params: Record<string, unknown>): Promise<unknown>;
22
+ userMessage(params: Record<string, unknown>): string;
23
+ }
24
+ export declare class GoogleImageGenerationTool extends Tool {
25
+ readonly name = "google_image_generation";
26
+ readonly description = "Generate images based on a text prompt using Google's Gemini/Imagen API";
27
+ readonly inputSchema: {
28
+ type: "object";
29
+ properties: {
30
+ prompt: {
31
+ type: "string";
32
+ description: string;
33
+ };
34
+ output_file: {
35
+ type: "string";
36
+ description: string;
37
+ };
38
+ };
39
+ required: string[];
40
+ };
41
+ process(context: ProcessingContext, params: Record<string, unknown>): Promise<unknown>;
42
+ userMessage(params: Record<string, unknown>): string;
43
+ }
44
+ //# sourceMappingURL=google-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google-tools.d.ts","sourceRoot":"","sources":["../../src/tools/google-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAUtC,qBAAa,wBAAyB,SAAQ,IAAI;IAChD,QAAQ,CAAC,IAAI,4BAA4B;IACzC,QAAQ,CAAC,WAAW,0EACqD;IACzE,QAAQ,CAAC,WAAW;;;;;;;;;MASlB;IAEI,OAAO,CACX,QAAQ,EAAE,iBAAiB,EAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,OAAO,CAAC,OAAO,CAAC;IAyFnB,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;CAKrD;AAED,qBAAa,yBAA0B,SAAQ,IAAI;IACjD,QAAQ,CAAC,IAAI,6BAA6B;IAC1C,QAAQ,CAAC,WAAW,6EACwD;IAC5E,QAAQ,CAAC,WAAW;;;;;;;;;;;;;MAalB;IAEI,OAAO,CACX,OAAO,EAAE,iBAAiB,EAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,OAAO,CAAC,OAAO,CAAC;IAiEnB,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;CAKrD"}
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Google-powered tools: grounded search and image generation via Gemini API.
3
+ *
4
+ * Port of src/nodetool/agents/tools/google_tools.py
5
+ */
6
+ import * as fs from "node:fs/promises";
7
+ import * as path from "node:path";
8
+ import { Tool } from "./base-tool.js";
9
+ const GEMINI_API_BASE = "https://generativelanguage.googleapis.com/v1beta";
10
+ function getGeminiApiKey() {
11
+ const key = process.env["GEMINI_API_KEY"];
12
+ if (!key)
13
+ throw new Error("GEMINI_API_KEY is not set");
14
+ return key;
15
+ }
16
+ export class GoogleGroundedSearchTool extends Tool {
17
+ name = "google_grounded_search";
18
+ description = "Search the web using Google's Gemini API with grounding capabilities";
19
+ inputSchema = {
20
+ type: "object",
21
+ properties: {
22
+ query: {
23
+ type: "string",
24
+ description: "The search query to execute"
25
+ }
26
+ },
27
+ required: ["query"]
28
+ };
29
+ async process(_context, params) {
30
+ const query = params["query"];
31
+ if (typeof query !== "string" || !query) {
32
+ return { error: "Search query is required" };
33
+ }
34
+ try {
35
+ const apiKey = getGeminiApiKey();
36
+ const url = `${GEMINI_API_BASE}/models/gemini-2.0-flash:generateContent?key=${apiKey}`;
37
+ const body = {
38
+ contents: [{ role: "user", parts: [{ text: query }] }],
39
+ tools: [{ googleSearch: {} }],
40
+ generationConfig: { responseModalities: ["TEXT"] }
41
+ };
42
+ const response = await fetch(url, {
43
+ method: "POST",
44
+ headers: { "Content-Type": "application/json" },
45
+ body: JSON.stringify(body)
46
+ });
47
+ if (!response.ok) {
48
+ return {
49
+ error: `Gemini API error: ${response.status} ${response.statusText}`
50
+ };
51
+ }
52
+ const data = (await response.json());
53
+ const candidates = data["candidates"];
54
+ if (!candidates?.length) {
55
+ return { error: "No response received from Gemini API" };
56
+ }
57
+ const candidate = candidates[0];
58
+ const content = candidate["content"];
59
+ const parts = content?.["parts"];
60
+ // Extract text results
61
+ const results = [];
62
+ if (parts) {
63
+ for (const part of parts) {
64
+ if (typeof part["text"] === "string") {
65
+ results.push(part["text"]);
66
+ }
67
+ }
68
+ }
69
+ // Extract grounding metadata / sources
70
+ const groundingMetadata = candidate["groundingMetadata"];
71
+ const sources = [];
72
+ if (groundingMetadata) {
73
+ const chunks = groundingMetadata["groundingChunks"];
74
+ if (chunks) {
75
+ for (const chunk of chunks) {
76
+ const web = chunk["web"];
77
+ if (web?.["uri"]) {
78
+ sources.push({
79
+ title: String(web["title"] ?? "Unknown Source"),
80
+ url: String(web["uri"])
81
+ });
82
+ }
83
+ }
84
+ }
85
+ }
86
+ return {
87
+ query,
88
+ results,
89
+ sources,
90
+ status: "success"
91
+ };
92
+ }
93
+ catch (e) {
94
+ return { error: `Google grounded search failed: ${String(e)}` };
95
+ }
96
+ }
97
+ userMessage(params) {
98
+ const query = String(params["query"] ?? "something");
99
+ const msg = `Searching Google (grounded) for '${query}'...`;
100
+ return msg.length > 80 ? "Searching Google (grounded)..." : msg;
101
+ }
102
+ }
103
+ export class GoogleImageGenerationTool extends Tool {
104
+ name = "google_image_generation";
105
+ description = "Generate images based on a text prompt using Google's Gemini/Imagen API";
106
+ inputSchema = {
107
+ type: "object",
108
+ properties: {
109
+ prompt: {
110
+ type: "string",
111
+ description: "The text prompt describing the image to generate"
112
+ },
113
+ output_file: {
114
+ type: "string",
115
+ description: "The path to save the generated image as a PNG file"
116
+ }
117
+ },
118
+ required: ["prompt", "output_file"]
119
+ };
120
+ async process(context, params) {
121
+ const prompt = params["prompt"];
122
+ const outputFile = params["output_file"];
123
+ if (typeof prompt !== "string" || !prompt)
124
+ return { error: "Image generation prompt is required" };
125
+ if (typeof outputFile !== "string" || !outputFile)
126
+ return { error: "Output file is required" };
127
+ try {
128
+ const apiKey = getGeminiApiKey();
129
+ // Use Imagen 3 REST API
130
+ const url = `${GEMINI_API_BASE}/models/imagen-3.0-generate-002:predict?key=${apiKey}`;
131
+ const body = {
132
+ instances: [{ prompt }],
133
+ parameters: { sampleCount: 1 }
134
+ };
135
+ const response = await fetch(url, {
136
+ method: "POST",
137
+ headers: { "Content-Type": "application/json" },
138
+ body: JSON.stringify(body)
139
+ });
140
+ if (!response.ok) {
141
+ const errText = await response.text();
142
+ return { error: `Gemini API error: ${response.status} - ${errText}` };
143
+ }
144
+ const data = (await response.json());
145
+ const predictions = data["predictions"];
146
+ if (!predictions?.length) {
147
+ return { error: "No images generated" };
148
+ }
149
+ const imageB64 = predictions[0]["bytesBase64Encoded"];
150
+ if (!imageB64)
151
+ return { error: "No image bytes found in response" };
152
+ const imageBuffer = Buffer.from(imageB64, "base64");
153
+ const workspace = context["workspaceDir"];
154
+ const filePath = workspace
155
+ ? path.join(workspace, outputFile)
156
+ : outputFile;
157
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
158
+ await fs.writeFile(filePath, imageBuffer);
159
+ return {
160
+ type: "image",
161
+ prompt,
162
+ output_file: outputFile,
163
+ status: "success"
164
+ };
165
+ }
166
+ catch (e) {
167
+ return { error: `Google image generation failed: ${String(e)}` };
168
+ }
169
+ }
170
+ userMessage(params) {
171
+ const prompt = String(params["prompt"] ?? "an image");
172
+ const msg = `Generating image '${prompt}' using Google...`;
173
+ return msg.length > 80 ? "Generating an image using Google..." : msg;
174
+ }
175
+ }
176
+ //# sourceMappingURL=google-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google-tools.js","sourceRoot":"","sources":["../../src/tools/google-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,eAAe,GAAG,kDAAkD,CAAC;AAE3E,SAAS,eAAe;IACtB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC1C,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IACvD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,OAAO,wBAAyB,SAAQ,IAAI;IACvC,IAAI,GAAG,wBAAwB,CAAC;IAChC,WAAW,GAClB,sEAAsE,CAAC;IAChE,WAAW,GAAG;QACrB,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI,EAAE,QAAiB;gBACvB,WAAW,EAAE,6BAA6B;aAC3C;SACF;QACD,QAAQ,EAAE,CAAC,OAAO,CAAC;KACpB,CAAC;IAEF,KAAK,CAAC,OAAO,CACX,QAA2B,EAC3B,MAA+B;QAE/B,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;QAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,EAAE,CAAC;YACxC,OAAO,EAAE,KAAK,EAAE,0BAA0B,EAAE,CAAC;QAC/C,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;YACjC,MAAM,GAAG,GAAG,GAAG,eAAe,gDAAgD,M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AAC;QACJ,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,EAAE,KAAK,EAAE,mCAAmC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACnE,CAAC;IACH,CAAC;IAED,WAAW,CAAC,MAA+B;QACzC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,UAAU,CAAC,CAAC;QACtD,MAAM,GAAG,GAAG,qBAAqB,MAAM,mBAAmB,CAAC;QAC3D,OAAO,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,qCAAqC,CAAC,CAAC,CAAC,GAAG,CAAC;IACvE,CAAC;CACF"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * HTTP tools for downloading files and making HTTP requests.
3
+ *
4
+ * Port of src/nodetool/agents/tools/http_tools.py
5
+ */
6
+ import type { ProcessingContext } from "@nodetool-ai/runtime";
7
+ import { Tool } from "./base-tool.js";
8
+ export declare class DownloadFileTool extends Tool {
9
+ readonly name = "download_file";
10
+ readonly description = "Download a text or binary file from a URL and save it to disk";
11
+ readonly inputSchema: {
12
+ type: "object";
13
+ properties: {
14
+ url: {
15
+ type: "string";
16
+ description: string;
17
+ };
18
+ output_file: {
19
+ type: "string";
20
+ description: string;
21
+ };
22
+ };
23
+ required: string[];
24
+ };
25
+ process(context: ProcessingContext, params: Record<string, unknown>): Promise<unknown>;
26
+ userMessage(params: Record<string, unknown>): string;
27
+ }
28
+ export declare class HttpRequestTool extends Tool {
29
+ readonly name = "http_request";
30
+ readonly description = "Make an HTTP request and return the response body as text";
31
+ readonly inputSchema: {
32
+ type: "object";
33
+ properties: {
34
+ url: {
35
+ type: "string";
36
+ description: string;
37
+ };
38
+ method: {
39
+ type: "string";
40
+ description: string;
41
+ };
42
+ headers: {
43
+ type: "object";
44
+ description: string;
45
+ };
46
+ body: {
47
+ type: "string";
48
+ description: string;
49
+ };
50
+ };
51
+ required: string[];
52
+ };
53
+ process(_context: ProcessingContext, params: Record<string, unknown>): Promise<unknown>;
54
+ userMessage(params: Record<string, unknown>): string;
55
+ }
56
+ //# sourceMappingURL=http-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-tools.d.ts","sourceRoot":"","sources":["../../src/tools/http-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAStC,qBAAa,gBAAiB,SAAQ,IAAI;IACxC,QAAQ,CAAC,IAAI,mBAAmB;IAChC,QAAQ,CAAC,WAAW,mEAC8C;IAClE,QAAQ,CAAC,WAAW;;;;;;;;;;;;;MAalB;IAEI,OAAO,CACX,OAAO,EAAE,iBAAiB,EAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,OAAO,CAAC,OAAO,CAAC;IAqEnB,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;CAYrD;AAED,qBAAa,eAAgB,SAAQ,IAAI;IACvC,QAAQ,CAAC,IAAI,kBAAkB;IAC/B,QAAQ,CAAC,WAAW,+DAC0C;IAC9D,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;MAsBlB;IAEI,OAAO,CACX,QAAQ,EAAE,iBAAiB,EAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,OAAO,CAAC,OAAO,CAAC;IAuDnB,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;CASrD"}
@@ -0,0 +1,180 @@
1
+ /**
2
+ * HTTP tools for downloading files and making HTTP requests.
3
+ *
4
+ * Port of src/nodetool/agents/tools/http_tools.py
5
+ */
6
+ import { writeFile, mkdir } from "node:fs/promises";
7
+ import { dirname } from "node:path";
8
+ import { Tool } from "./base-tool.js";
9
+ const DEFAULT_HEADERS = {
10
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36",
11
+ Accept: "*/*",
12
+ "Accept-Language": "en-US,en;q=0.9"
13
+ };
14
+ export class DownloadFileTool extends Tool {
15
+ name = "download_file";
16
+ description = "Download a text or binary file from a URL and save it to disk";
17
+ inputSchema = {
18
+ type: "object",
19
+ properties: {
20
+ url: {
21
+ type: "string",
22
+ description: "URL of the file to download"
23
+ },
24
+ output_file: {
25
+ type: "string",
26
+ description: "Workspace relative path where to save the file"
27
+ }
28
+ },
29
+ required: ["url", "output_file"]
30
+ };
31
+ async process(context, params) {
32
+ try {
33
+ const url = params["url"];
34
+ const outputFile = params["output_file"];
35
+ if (typeof url !== "string" || !url) {
36
+ return { error: "URL is required" };
37
+ }
38
+ if (typeof outputFile !== "string" || !outputFile) {
39
+ return { error: "Output file is required" };
40
+ }
41
+ const customHeaders = params["headers"] && typeof params["headers"] === "object"
42
+ ? params["headers"]
43
+ : {};
44
+ const mergedHeaders = { ...DEFAULT_HEADERS, ...customHeaders };
45
+ const timeoutMs = typeof params["timeout"] === "number"
46
+ ? params["timeout"] * 1000
47
+ : 60_000;
48
+ const controller = new AbortController();
49
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
50
+ let response;
51
+ try {
52
+ response = await fetch(url, {
53
+ headers: mergedHeaders,
54
+ signal: controller.signal
55
+ });
56
+ }
57
+ finally {
58
+ clearTimeout(timer);
59
+ }
60
+ if (!response.ok) {
61
+ return {
62
+ url,
63
+ output_file: outputFile,
64
+ success: false,
65
+ error: `HTTP request failed with status ${response.status}`,
66
+ status_code: response.status
67
+ };
68
+ }
69
+ const contentType = response.headers.get("Content-Type") ?? "unknown";
70
+ const contentLength = response.headers.get("Content-Length");
71
+ const fileSizeBytes = contentLength ? parseInt(contentLength, 10) : null;
72
+ const fullPath = context.resolveWorkspacePath(outputFile);
73
+ const parentDir = dirname(fullPath);
74
+ await mkdir(parentDir, { recursive: true });
75
+ const buffer = Buffer.from(await response.arrayBuffer());
76
+ await writeFile(fullPath, buffer);
77
+ return {
78
+ url,
79
+ output_file: outputFile,
80
+ success: true,
81
+ content_type: contentType,
82
+ file_size_bytes: fileSizeBytes
83
+ };
84
+ }
85
+ catch (e) {
86
+ return { error: `Error in download process: ${String(e)}` };
87
+ }
88
+ }
89
+ userMessage(params) {
90
+ const url = String(params["url"] ?? "a URL");
91
+ const output = String(params["output_file"] ?? "a file");
92
+ let msg = `Downloading from ${url} to ${output}...`;
93
+ if (msg.length > 80) {
94
+ msg = `Downloading file to ${output}...`;
95
+ }
96
+ if (msg.length > 80) {
97
+ msg = "Downloading a file...";
98
+ }
99
+ return msg;
100
+ }
101
+ }
102
+ export class HttpRequestTool extends Tool {
103
+ name = "http_request";
104
+ description = "Make an HTTP request and return the response body as text";
105
+ inputSchema = {
106
+ type: "object",
107
+ properties: {
108
+ url: {
109
+ type: "string",
110
+ description: "URL to send the request to"
111
+ },
112
+ method: {
113
+ type: "string",
114
+ description: "HTTP method (GET, POST, PUT, DELETE, PATCH). Defaults to GET."
115
+ },
116
+ headers: {
117
+ type: "object",
118
+ description: "Optional HTTP headers"
119
+ },
120
+ body: {
121
+ type: "string",
122
+ description: "Optional request body (for POST/PUT/PATCH)"
123
+ }
124
+ },
125
+ required: ["url"]
126
+ };
127
+ async process(_context, params) {
128
+ try {
129
+ const url = params["url"];
130
+ if (typeof url !== "string" || !url) {
131
+ return { error: "URL is required" };
132
+ }
133
+ const method = (typeof params["method"] === "string" ? params["method"] : "GET").toUpperCase();
134
+ const customHeaders = params["headers"] && typeof params["headers"] === "object"
135
+ ? params["headers"]
136
+ : {};
137
+ const mergedHeaders = { ...DEFAULT_HEADERS, ...customHeaders };
138
+ const body = typeof params["body"] === "string" ? params["body"] : undefined;
139
+ const timeoutMs = typeof params["timeout"] === "number"
140
+ ? params["timeout"] * 1000
141
+ : 60_000;
142
+ const controller = new AbortController();
143
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
144
+ let response;
145
+ try {
146
+ response = await fetch(url, {
147
+ method,
148
+ headers: mergedHeaders,
149
+ body: ["POST", "PUT", "PATCH"].includes(method) ? body : undefined,
150
+ signal: controller.signal
151
+ });
152
+ }
153
+ finally {
154
+ clearTimeout(timer);
155
+ }
156
+ const contentType = response.headers.get("Content-Type") ?? "unknown";
157
+ const text = await response.text();
158
+ return {
159
+ url,
160
+ status_code: response.status,
161
+ success: response.ok,
162
+ content_type: contentType,
163
+ body: text
164
+ };
165
+ }
166
+ catch (e) {
167
+ return { error: `Error in HTTP request: ${String(e)}` };
168
+ }
169
+ }
170
+ userMessage(params) {
171
+ const method = String(params["method"] ?? "GET").toUpperCase();
172
+ const url = String(params["url"] ?? "a URL");
173
+ let msg = `${method} ${url}`;
174
+ if (msg.length > 80) {
175
+ msg = `${method} request...`;
176
+ }
177
+ return msg;
178
+ }
179
+ }
180
+ //# sourceMappingURL=http-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-tools.js","sourceRoot":"","sources":["../../src/tools/http-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,eAAe,GAA2B;IAC9C,YAAY,EACV,iHAAiH;IACnH,MAAM,EAAE,KAAK;IACb,iBAAiB,EAAE,gBAAgB;CACpC,CAAC;AAEF,MAAM,OAAO,gBAAiB,SAAQ,IAAI;IAC/B,IAAI,GAAG,eAAe,CAAC;IACvB,WAAW,GAClB,+DAA+D,CAAC;IACzD,WAAW,GAAG;QACrB,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,GAAG,EAAE;gBACH,IAAI,EAAE,QAAiB;gBACvB,WAA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