tuplet 2.7.0

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 (319) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +136 -0
  3. package/dist/agent.d.ts +46 -0
  4. package/dist/agent.d.ts.map +1 -0
  5. package/dist/agent.js +393 -0
  6. package/dist/agent.js.map +1 -0
  7. package/dist/built-in-agents/explore.d.ts +9 -0
  8. package/dist/built-in-agents/explore.d.ts.map +1 -0
  9. package/dist/built-in-agents/explore.js +40 -0
  10. package/dist/built-in-agents/explore.js.map +1 -0
  11. package/dist/built-in-agents/index.d.ts +15 -0
  12. package/dist/built-in-agents/index.d.ts.map +1 -0
  13. package/dist/built-in-agents/index.js +19 -0
  14. package/dist/built-in-agents/index.js.map +1 -0
  15. package/dist/built-in-agents/plan.d.ts +10 -0
  16. package/dist/built-in-agents/plan.d.ts.map +1 -0
  17. package/dist/built-in-agents/plan.js +62 -0
  18. package/dist/built-in-agents/plan.js.map +1 -0
  19. package/dist/built-in-agents/worker.d.ts +9 -0
  20. package/dist/built-in-agents/worker.d.ts.map +1 -0
  21. package/dist/built-in-agents/worker.js +53 -0
  22. package/dist/built-in-agents/worker.js.map +1 -0
  23. package/dist/constants.d.ts +7 -0
  24. package/dist/constants.d.ts.map +1 -0
  25. package/dist/constants.js +18 -0
  26. package/dist/constants.js.map +1 -0
  27. package/dist/context-manager.d.ts +65 -0
  28. package/dist/context-manager.d.ts.map +1 -0
  29. package/dist/context-manager.js +272 -0
  30. package/dist/context-manager.js.map +1 -0
  31. package/dist/context-manager.test.d.ts +2 -0
  32. package/dist/context-manager.test.d.ts.map +1 -0
  33. package/dist/context-manager.test.js +394 -0
  34. package/dist/context-manager.test.js.map +1 -0
  35. package/dist/executor.d.ts +29 -0
  36. package/dist/executor.d.ts.map +1 -0
  37. package/dist/executor.js +399 -0
  38. package/dist/executor.js.map +1 -0
  39. package/dist/index.d.ts +24 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +40 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/prompt/index.d.ts +9 -0
  44. package/dist/prompt/index.d.ts.map +1 -0
  45. package/dist/prompt/index.js +10 -0
  46. package/dist/prompt/index.js.map +1 -0
  47. package/dist/prompt/main-agent-builder.d.ts +81 -0
  48. package/dist/prompt/main-agent-builder.d.ts.map +1 -0
  49. package/dist/prompt/main-agent-builder.js +287 -0
  50. package/dist/prompt/main-agent-builder.js.map +1 -0
  51. package/dist/prompt/sub-agent-builder.d.ts +133 -0
  52. package/dist/prompt/sub-agent-builder.d.ts.map +1 -0
  53. package/dist/prompt/sub-agent-builder.js +337 -0
  54. package/dist/prompt/sub-agent-builder.js.map +1 -0
  55. package/dist/prompt/templates.d.ts +87 -0
  56. package/dist/prompt/templates.d.ts.map +1 -0
  57. package/dist/prompt/templates.js +343 -0
  58. package/dist/prompt/templates.js.map +1 -0
  59. package/dist/prompt/types.d.ts +159 -0
  60. package/dist/prompt/types.d.ts.map +1 -0
  61. package/dist/prompt/types.js +5 -0
  62. package/dist/prompt/types.js.map +1 -0
  63. package/dist/prompt.d.ts +32 -0
  64. package/dist/prompt.d.ts.map +1 -0
  65. package/dist/prompt.js +86 -0
  66. package/dist/prompt.js.map +1 -0
  67. package/dist/providers/dataset/base.d.ts +74 -0
  68. package/dist/providers/dataset/base.d.ts.map +1 -0
  69. package/dist/providers/dataset/base.js +7 -0
  70. package/dist/providers/dataset/base.js.map +1 -0
  71. package/dist/providers/dataset/index.d.ts +8 -0
  72. package/dist/providers/dataset/index.d.ts.map +1 -0
  73. package/dist/providers/dataset/index.js +8 -0
  74. package/dist/providers/dataset/index.js.map +1 -0
  75. package/dist/providers/dataset/recorder.d.ts +46 -0
  76. package/dist/providers/dataset/recorder.d.ts.map +1 -0
  77. package/dist/providers/dataset/recorder.js +105 -0
  78. package/dist/providers/dataset/recorder.js.map +1 -0
  79. package/dist/providers/dataset/replayer.d.ts +46 -0
  80. package/dist/providers/dataset/replayer.d.ts.map +1 -0
  81. package/dist/providers/dataset/replayer.js +163 -0
  82. package/dist/providers/dataset/replayer.js.map +1 -0
  83. package/dist/providers/dataset/tester.d.ts +89 -0
  84. package/dist/providers/dataset/tester.d.ts.map +1 -0
  85. package/dist/providers/dataset/tester.js +143 -0
  86. package/dist/providers/dataset/tester.js.map +1 -0
  87. package/dist/providers/env/memory.d.ts +14 -0
  88. package/dist/providers/env/memory.d.ts.map +1 -0
  89. package/dist/providers/env/memory.js +19 -0
  90. package/dist/providers/env/memory.js.map +1 -0
  91. package/dist/providers/index.d.ts +12 -0
  92. package/dist/providers/index.d.ts.map +1 -0
  93. package/dist/providers/index.js +10 -0
  94. package/dist/providers/index.js.map +1 -0
  95. package/dist/providers/llm/base.d.ts +7 -0
  96. package/dist/providers/llm/base.d.ts.map +1 -0
  97. package/dist/providers/llm/base.js +7 -0
  98. package/dist/providers/llm/base.js.map +1 -0
  99. package/dist/providers/llm/claude.d.ts +32 -0
  100. package/dist/providers/llm/claude.d.ts.map +1 -0
  101. package/dist/providers/llm/claude.js +171 -0
  102. package/dist/providers/llm/claude.js.map +1 -0
  103. package/dist/providers/llm/openai.d.ts +26 -0
  104. package/dist/providers/llm/openai.d.ts.map +1 -0
  105. package/dist/providers/llm/openai.js +174 -0
  106. package/dist/providers/llm/openai.js.map +1 -0
  107. package/dist/providers/llm/openrouter.d.ts +43 -0
  108. package/dist/providers/llm/openrouter.d.ts.map +1 -0
  109. package/dist/providers/llm/openrouter.js +288 -0
  110. package/dist/providers/llm/openrouter.js.map +1 -0
  111. package/dist/providers/logger/base.d.ts +7 -0
  112. package/dist/providers/logger/base.d.ts.map +1 -0
  113. package/dist/providers/logger/base.js +7 -0
  114. package/dist/providers/logger/base.js.map +1 -0
  115. package/dist/providers/logger/console.d.ts +29 -0
  116. package/dist/providers/logger/console.d.ts.map +1 -0
  117. package/dist/providers/logger/console.js +70 -0
  118. package/dist/providers/logger/console.js.map +1 -0
  119. package/dist/providers/repository/base.d.ts +7 -0
  120. package/dist/providers/repository/base.d.ts.map +1 -0
  121. package/dist/providers/repository/base.js +7 -0
  122. package/dist/providers/repository/base.js.map +1 -0
  123. package/dist/providers/repository/memory.d.ts +21 -0
  124. package/dist/providers/repository/memory.d.ts.map +1 -0
  125. package/dist/providers/repository/memory.js +50 -0
  126. package/dist/providers/repository/memory.js.map +1 -0
  127. package/dist/providers/workspace/file.d.ts +26 -0
  128. package/dist/providers/workspace/file.d.ts.map +1 -0
  129. package/dist/providers/workspace/file.js +151 -0
  130. package/dist/providers/workspace/file.js.map +1 -0
  131. package/dist/providers/workspace/index.d.ts +7 -0
  132. package/dist/providers/workspace/index.d.ts.map +1 -0
  133. package/dist/providers/workspace/index.js +6 -0
  134. package/dist/providers/workspace/index.js.map +1 -0
  135. package/dist/providers/workspace/memory.d.ts +26 -0
  136. package/dist/providers/workspace/memory.d.ts.map +1 -0
  137. package/dist/providers/workspace/memory.js +136 -0
  138. package/dist/providers/workspace/memory.js.map +1 -0
  139. package/dist/providers/workspace/types.d.ts +27 -0
  140. package/dist/providers/workspace/types.d.ts.map +1 -0
  141. package/dist/providers/workspace/types.js +8 -0
  142. package/dist/providers/workspace/types.js.map +1 -0
  143. package/dist/providers/workspace/workspace-provider.test.d.ts +2 -0
  144. package/dist/providers/workspace/workspace-provider.test.d.ts.map +1 -0
  145. package/dist/providers/workspace/workspace-provider.test.js +250 -0
  146. package/dist/providers/workspace/workspace-provider.test.js.map +1 -0
  147. package/dist/shell/commands/browse.d.ts +6 -0
  148. package/dist/shell/commands/browse.d.ts.map +1 -0
  149. package/dist/shell/commands/browse.js +158 -0
  150. package/dist/shell/commands/browse.js.map +1 -0
  151. package/dist/shell/commands/cat.d.ts +6 -0
  152. package/dist/shell/commands/cat.d.ts.map +1 -0
  153. package/dist/shell/commands/cat.js +104 -0
  154. package/dist/shell/commands/cat.js.map +1 -0
  155. package/dist/shell/commands/curl.d.ts +6 -0
  156. package/dist/shell/commands/curl.d.ts.map +1 -0
  157. package/dist/shell/commands/curl.js +190 -0
  158. package/dist/shell/commands/curl.js.map +1 -0
  159. package/dist/shell/commands/date.d.ts +6 -0
  160. package/dist/shell/commands/date.d.ts.map +1 -0
  161. package/dist/shell/commands/date.js +151 -0
  162. package/dist/shell/commands/date.js.map +1 -0
  163. package/dist/shell/commands/echo.d.ts +6 -0
  164. package/dist/shell/commands/echo.d.ts.map +1 -0
  165. package/dist/shell/commands/echo.js +48 -0
  166. package/dist/shell/commands/echo.js.map +1 -0
  167. package/dist/shell/commands/env.d.ts +8 -0
  168. package/dist/shell/commands/env.d.ts.map +1 -0
  169. package/dist/shell/commands/env.js +41 -0
  170. package/dist/shell/commands/env.js.map +1 -0
  171. package/dist/shell/commands/file.d.ts +6 -0
  172. package/dist/shell/commands/file.d.ts.map +1 -0
  173. package/dist/shell/commands/file.js +213 -0
  174. package/dist/shell/commands/file.js.map +1 -0
  175. package/dist/shell/commands/find.d.ts +6 -0
  176. package/dist/shell/commands/find.d.ts.map +1 -0
  177. package/dist/shell/commands/find.js +100 -0
  178. package/dist/shell/commands/find.js.map +1 -0
  179. package/dist/shell/commands/grep.d.ts +6 -0
  180. package/dist/shell/commands/grep.d.ts.map +1 -0
  181. package/dist/shell/commands/grep.js +229 -0
  182. package/dist/shell/commands/grep.js.map +1 -0
  183. package/dist/shell/commands/head.d.ts +6 -0
  184. package/dist/shell/commands/head.d.ts.map +1 -0
  185. package/dist/shell/commands/head.js +88 -0
  186. package/dist/shell/commands/head.js.map +1 -0
  187. package/dist/shell/commands/index.d.ts +25 -0
  188. package/dist/shell/commands/index.d.ts.map +1 -0
  189. package/dist/shell/commands/index.js +43 -0
  190. package/dist/shell/commands/index.js.map +1 -0
  191. package/dist/shell/commands/jq.d.ts +8 -0
  192. package/dist/shell/commands/jq.d.ts.map +1 -0
  193. package/dist/shell/commands/jq.js +233 -0
  194. package/dist/shell/commands/jq.js.map +1 -0
  195. package/dist/shell/commands/ls.d.ts +6 -0
  196. package/dist/shell/commands/ls.d.ts.map +1 -0
  197. package/dist/shell/commands/ls.js +88 -0
  198. package/dist/shell/commands/ls.js.map +1 -0
  199. package/dist/shell/commands/mkdir.d.ts +6 -0
  200. package/dist/shell/commands/mkdir.d.ts.map +1 -0
  201. package/dist/shell/commands/mkdir.js +43 -0
  202. package/dist/shell/commands/mkdir.js.map +1 -0
  203. package/dist/shell/commands/rm.d.ts +6 -0
  204. package/dist/shell/commands/rm.d.ts.map +1 -0
  205. package/dist/shell/commands/rm.js +64 -0
  206. package/dist/shell/commands/rm.js.map +1 -0
  207. package/dist/shell/commands/sed.d.ts +6 -0
  208. package/dist/shell/commands/sed.d.ts.map +1 -0
  209. package/dist/shell/commands/sed.js +414 -0
  210. package/dist/shell/commands/sed.js.map +1 -0
  211. package/dist/shell/commands/sort.d.ts +6 -0
  212. package/dist/shell/commands/sort.d.ts.map +1 -0
  213. package/dist/shell/commands/sort.js +109 -0
  214. package/dist/shell/commands/sort.js.map +1 -0
  215. package/dist/shell/commands/tail.d.ts +6 -0
  216. package/dist/shell/commands/tail.d.ts.map +1 -0
  217. package/dist/shell/commands/tail.js +68 -0
  218. package/dist/shell/commands/tail.js.map +1 -0
  219. package/dist/shell/commands/wc.d.ts +6 -0
  220. package/dist/shell/commands/wc.d.ts.map +1 -0
  221. package/dist/shell/commands/wc.js +86 -0
  222. package/dist/shell/commands/wc.js.map +1 -0
  223. package/dist/shell/index.d.ts +10 -0
  224. package/dist/shell/index.d.ts.map +1 -0
  225. package/dist/shell/index.js +10 -0
  226. package/dist/shell/index.js.map +1 -0
  227. package/dist/shell/limits.d.ts +5 -0
  228. package/dist/shell/limits.d.ts.map +1 -0
  229. package/dist/shell/limits.js +5 -0
  230. package/dist/shell/limits.js.map +1 -0
  231. package/dist/shell/parser.d.ts +8 -0
  232. package/dist/shell/parser.d.ts.map +1 -0
  233. package/dist/shell/parser.js +307 -0
  234. package/dist/shell/parser.js.map +1 -0
  235. package/dist/shell/path-validation.d.ts +35 -0
  236. package/dist/shell/path-validation.d.ts.map +1 -0
  237. package/dist/shell/path-validation.js +81 -0
  238. package/dist/shell/path-validation.js.map +1 -0
  239. package/dist/shell/shell.d.ts +66 -0
  240. package/dist/shell/shell.d.ts.map +1 -0
  241. package/dist/shell/shell.js +301 -0
  242. package/dist/shell/shell.js.map +1 -0
  243. package/dist/shell/shell.test.d.ts +2 -0
  244. package/dist/shell/shell.test.d.ts.map +1 -0
  245. package/dist/shell/shell.test.js +1088 -0
  246. package/dist/shell/shell.test.js.map +1 -0
  247. package/dist/shell/types.d.ts +82 -0
  248. package/dist/shell/types.d.ts.map +1 -0
  249. package/dist/shell/types.js +5 -0
  250. package/dist/shell/types.js.map +1 -0
  251. package/dist/summarizer.d.ts +28 -0
  252. package/dist/summarizer.d.ts.map +1 -0
  253. package/dist/summarizer.js +136 -0
  254. package/dist/summarizer.js.map +1 -0
  255. package/dist/summarizer.test.d.ts +2 -0
  256. package/dist/summarizer.test.d.ts.map +1 -0
  257. package/dist/summarizer.test.js +192 -0
  258. package/dist/summarizer.test.js.map +1 -0
  259. package/dist/tools/ask-user.d.ts +11 -0
  260. package/dist/tools/ask-user.d.ts.map +1 -0
  261. package/dist/tools/ask-user.js +35 -0
  262. package/dist/tools/ask-user.js.map +1 -0
  263. package/dist/tools/index.d.ts +11 -0
  264. package/dist/tools/index.d.ts.map +1 -0
  265. package/dist/tools/index.js +18 -0
  266. package/dist/tools/index.js.map +1 -0
  267. package/dist/tools/output.d.ts +15 -0
  268. package/dist/tools/output.d.ts.map +1 -0
  269. package/dist/tools/output.js +40 -0
  270. package/dist/tools/output.js.map +1 -0
  271. package/dist/tools/shell.d.ts +13 -0
  272. package/dist/tools/shell.d.ts.map +1 -0
  273. package/dist/tools/shell.js +166 -0
  274. package/dist/tools/shell.js.map +1 -0
  275. package/dist/tools/sub-agent.d.ts +25 -0
  276. package/dist/tools/sub-agent.d.ts.map +1 -0
  277. package/dist/tools/sub-agent.js +312 -0
  278. package/dist/tools/sub-agent.js.map +1 -0
  279. package/dist/tools/tasks.d.ts +170 -0
  280. package/dist/tools/tasks.d.ts.map +1 -0
  281. package/dist/tools/tasks.js +947 -0
  282. package/dist/tools/tasks.js.map +1 -0
  283. package/dist/trace/builder.d.ts +54 -0
  284. package/dist/trace/builder.d.ts.map +1 -0
  285. package/dist/trace/builder.js +229 -0
  286. package/dist/trace/builder.js.map +1 -0
  287. package/dist/trace/console.d.ts +45 -0
  288. package/dist/trace/console.d.ts.map +1 -0
  289. package/dist/trace/console.js +143 -0
  290. package/dist/trace/console.js.map +1 -0
  291. package/dist/trace/index.d.ts +11 -0
  292. package/dist/trace/index.d.ts.map +1 -0
  293. package/dist/trace/index.js +11 -0
  294. package/dist/trace/index.js.map +1 -0
  295. package/dist/trace/openrouter-pricing.d.ts +9 -0
  296. package/dist/trace/openrouter-pricing.d.ts.map +1 -0
  297. package/dist/trace/openrouter-pricing.js +321 -0
  298. package/dist/trace/openrouter-pricing.js.map +1 -0
  299. package/dist/trace/pricing.d.ts +13 -0
  300. package/dist/trace/pricing.d.ts.map +1 -0
  301. package/dist/trace/pricing.js +41 -0
  302. package/dist/trace/pricing.js.map +1 -0
  303. package/dist/trace/types.d.ts +142 -0
  304. package/dist/trace/types.d.ts.map +1 -0
  305. package/dist/trace/types.js +16 -0
  306. package/dist/trace/types.js.map +1 -0
  307. package/dist/trace.d.ts +5 -0
  308. package/dist/trace.d.ts.map +1 -0
  309. package/dist/trace.js +5 -0
  310. package/dist/trace.js.map +1 -0
  311. package/dist/types.d.ts +382 -0
  312. package/dist/types.d.ts.map +1 -0
  313. package/dist/types.js +5 -0
  314. package/dist/types.js.map +1 -0
  315. package/dist/workspace.d.ts +287 -0
  316. package/dist/workspace.d.ts.map +1 -0
  317. package/dist/workspace.js +560 -0
  318. package/dist/workspace.js.map +1 -0
  319. package/package.json +47 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ask-user.d.ts","sourceRoot":"","sources":["../../src/tools/ask-user.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAExC;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CA0BxC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Ask User Tool
3
+ *
4
+ * Tool for gathering additional information from the user when needed.
5
+ */
6
+ /**
7
+ * Create the __ask_user__ tool
8
+ */
9
+ export function createAskUserTool() {
10
+ const toolName = "__ask_user__";
11
+ return {
12
+ name: toolName,
13
+ description: `Ask the user 1-4 questions when you need information not available via other tools or conversation history.
14
+
15
+ Each question has: question (string), header (short label), options (array of strings or {label, description}).
16
+
17
+ Example: ${toolName}({ "questions": [{"question": "What is your goal?", "header": "Goal", "options": ["Lose weight", "Gain muscle", "Maintain"]}] })
18
+ `,
19
+ parameters: {
20
+ type: "object",
21
+ properties: {
22
+ questions: {
23
+ type: "array",
24
+ description: "Array of 1-4 questions. Each item has: question (string, required), header (short label, optional), options (array of {label, description}, optional)",
25
+ },
26
+ },
27
+ required: ["questions"],
28
+ },
29
+ execute: async () => {
30
+ // This tool is handled specially in the executor
31
+ return { success: true, data: "Question sent to user" };
32
+ },
33
+ };
34
+ }
35
+ //# sourceMappingURL=ask-user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ask-user.js","sourceRoot":"","sources":["../../src/tools/ask-user.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,QAAQ,GAAG,cAAc,CAAC;IAChC,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE;;;;WAIN,QAAQ;CAClB;QACG,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,SAAS,EAAE;oBACT,IAAI,EAAE,OAAO;oBACb,WAAW,EACT,uJAAuJ;iBAC1J;aACF;YACD,QAAQ,EAAE,CAAC,WAAW,CAAC;SACxB;QACD,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,iDAAiD;YACjD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAAC;QAC1D,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Tools Module
3
+ *
4
+ * Exports all internal tools used by the Tuplet agent.
5
+ */
6
+ export { createAskUserTool } from "./ask-user.js";
7
+ export { OUTPUT_TOOL_NAME, createOutputTool } from "./output.js";
8
+ export { createTaskTool, type TaskToolContext, type CreateSubTuplet, } from "./sub-agent.js";
9
+ export { TaskManager, formatTaskList, createTaskTools, createTaskCreateTool, createTaskUpdateTool, createTaskGetTool, createTaskListTool, type TaskToolOptions, TodoManager, formatTodoList, createTodoTool, type TodoToolOptions, } from "./tasks.js";
10
+ export { createShellTool } from "./shell.js";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGlD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGjE,OAAO,EACL,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,WAAW,EACX,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,eAAe,EAEpB,WAAW,EACX,cAAc,EACd,cAAc,EACd,KAAK,eAAe,GACrB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Tools Module
3
+ *
4
+ * Exports all internal tools used by the Tuplet agent.
5
+ */
6
+ // Ask User Tool
7
+ export { createAskUserTool } from "./ask-user.js";
8
+ // Output Tool
9
+ export { OUTPUT_TOOL_NAME, createOutputTool } from "./output.js";
10
+ // Sub-Agent Tool (sub-agent delegation)
11
+ export { createTaskTool, } from "./sub-agent.js";
12
+ // Task Management Tools (Claude Code 4-Tool Approach)
13
+ export { TaskManager, formatTaskList, createTaskTools, createTaskCreateTool, createTaskUpdateTool, createTaskGetTool, createTaskListTool,
14
+ // Backward compatibility aliases
15
+ TodoManager, formatTodoList, createTodoTool, } from "./tasks.js";
16
+ // Shell Tool (bash-like context access)
17
+ export { createShellTool } from "./shell.js";
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,gBAAgB;AAChB,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,cAAc;AACd,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEjE,wCAAwC;AACxC,OAAO,EACL,cAAc,GAGf,MAAM,gBAAgB,CAAC;AAExB,sDAAsD;AACtD,OAAO,EACL,WAAW,EACX,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB;AAElB,iCAAiC;AACjC,WAAW,EACX,cAAc,EACd,cAAc,GAEf,MAAM,YAAY,CAAC;AAEpB,wCAAwC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Output Tool
3
+ *
4
+ * Tool for sub-agents to return structured data to the parent agent.
5
+ */
6
+ import type { Tool, JSONSchema } from "../types.js";
7
+ /**
8
+ * Output tool name constant
9
+ */
10
+ export declare const OUTPUT_TOOL_NAME = "__output__";
11
+ /**
12
+ * Create the __output__ tool for sub-agents to return structured data
13
+ */
14
+ export declare function createOutputTool(outputSchema: JSONSchema): Tool;
15
+ //# sourceMappingURL=output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/tools/output.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEpD;;GAEG;AACH,eAAO,MAAM,gBAAgB,eAAe,CAAC;AAE7C;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,UAAU,GAAG,IAAI,CA0B/D"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Output Tool
3
+ *
4
+ * Tool for sub-agents to return structured data to the parent agent.
5
+ */
6
+ /**
7
+ * Output tool name constant
8
+ */
9
+ export const OUTPUT_TOOL_NAME = "__output__";
10
+ /**
11
+ * Create the __output__ tool for sub-agents to return structured data
12
+ */
13
+ export function createOutputTool(outputSchema) {
14
+ return {
15
+ name: OUTPUT_TOOL_NAME,
16
+ description: `Return structured output data to the parent agent.
17
+
18
+ Use this tool when you have completed your task and want to return results.
19
+ Include a brief summary and the structured data.
20
+
21
+ IMPORTANT: Call this tool ONCE when your task is complete.`,
22
+ parameters: {
23
+ type: "object",
24
+ properties: {
25
+ summary: {
26
+ type: "string",
27
+ description: "Brief summary of what was done (1-2 sentences)",
28
+ },
29
+ data: outputSchema,
30
+ },
31
+ required: ["summary", "data"],
32
+ },
33
+ execute: async (params) => {
34
+ // This tool doesn't actually execute - it's intercepted by the parent
35
+ // The executor will capture this and return it as the result
36
+ return { success: true, data: params };
37
+ },
38
+ };
39
+ }
40
+ //# sourceMappingURL=output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/tools/output.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAE7C;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,YAAwB;IACvD,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,WAAW,EAAE;;;;;2DAK0C;QACvD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,gDAAgD;iBAC9D;gBACD,IAAI,EAAE,YAAY;aACnB;YACD,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC;SAChB;QACf,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YACxB,sEAAsE;YACtE,6DAA6D;YAC7D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACzC,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Shell Tool
3
+ *
4
+ * Provides bash-like interface for AI to interact with context.
5
+ * Supports: browse, cat, curl, echo, find, grep, head, help, jq, ls, mkdir, rm, tail
6
+ */
7
+ import type { Tool } from '../types.js';
8
+ import type { Shell } from '../shell/shell.js';
9
+ /**
10
+ * Create the shell tool for context access
11
+ */
12
+ export declare function createShellTool(shell: Shell): Tool;
13
+ //# sourceMappingURL=shell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/tools/shell.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAG9C;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAoKlD"}
@@ -0,0 +1,166 @@
1
+ /**
2
+ * Shell Tool
3
+ *
4
+ * Provides bash-like interface for AI to interact with context.
5
+ * Supports: browse, cat, curl, echo, find, grep, head, help, jq, ls, mkdir, rm, tail
6
+ */
7
+ import { MAX_OUTPUT_CHARS } from '../shell/limits.js';
8
+ /**
9
+ * Create the shell tool for context access
10
+ */
11
+ export function createShellTool(shell) {
12
+ let description = `Execute bash-like commands to interact with context, make HTTP requests, and browse web pages.
13
+
14
+ ## Overview
15
+
16
+ Commands run against a workspace filesystem. All paths are RELATIVE — never use absolute paths starting with \`/\`. Pipes (\`|\`), input redirection (\`<\`), and output redirection (\`>\`, \`>>\`) are supported.
17
+
18
+ Run \`help\` to list all commands, or \`help <command>\` for detailed usage, flags, and examples.
19
+
20
+ ## Available commands
21
+
22
+ | Command | Description |
23
+ |---------|-------------|
24
+ | \`browse\` | Fetch a web page and convert HTML to readable text |
25
+ | \`cat\` | Concatenate and print files (supports --offset/--limit for pagination) |
26
+ | \`curl\` | Transfer data from or to a server |
27
+ | \`echo\` | Display text |
28
+ | \`find\` | Search for files in a directory hierarchy |
29
+ | \`grep\` | Search for patterns in files or stdin |
30
+ | \`head\` | Output the first part of files |
31
+ | \`help\` | Show available commands or detailed help for a command |
32
+ | \`jq\` | Lightweight JSON processor |
33
+ | \`ls\` | List directory contents |
34
+ | \`mkdir\` | Create directories |
35
+ | \`rm\` | Remove files or directories |
36
+ | \`sort\` | Sort lines of text |
37
+ | \`tail\` | Output the last part of files |
38
+
39
+ ## Path rules
40
+
41
+ - All paths are RELATIVE — e.g. \`data.json\`, \`reports/output.csv\`
42
+ - NEVER use absolute paths starting with \`/\` — they will be rejected
43
+ - Path traversal (\`..\`) is not allowed
44
+ - Use \`.\` or omit the path to refer to the workspace root
45
+
46
+ ## Pre-execution steps
47
+
48
+ 1. **Verify paths** — before writing, check the parent directory exists with \`ls\`.
49
+ 2. **Quote special characters** — always quote URLs: \`curl 'https://api.com/path?a=1&b=2'\`.
50
+
51
+ ## Large file handling
52
+
53
+ - Files over 256 KB cannot be read with \`cat\` directly. Use \`cat --offset 0 --limit 2000\` for paginated access, or \`head\`/\`tail\`/\`grep\` for partial reads.
54
+ - Lines longer than 2000 characters are truncated in output.
55
+ - If command output exceeds ${MAX_OUTPUT_CHARS} characters, it is saved to a temp file and you'll be told how to read it in chunks.
56
+
57
+ ## Usage by category
58
+
59
+ **Workspace (read/write):**
60
+ - \`cat data.json\` — read file
61
+ - \`cat -n data.json\` — read file with line numbers
62
+ - \`cat --offset 0 --limit 100 big.txt\` — read lines 1-100 of a large file
63
+ - \`echo '{"name":"John"}' > user.json\` — write file
64
+ - \`head -n 10 log.txt\` / \`tail -n 5 log.txt\` — partial reads
65
+
66
+ **Search & list:**
67
+ - \`ls\`, \`ls **/*.json\` — list entries
68
+ - \`find . -name "*.json"\` — find files
69
+ - \`grep "pattern" **/*.json\` — search content
70
+
71
+ **HTTP & web:**
72
+ - \`curl https://api.example.com/users\` — API requests (GET, POST, PUT, DELETE)
73
+ - \`browse https://example.com\` — fetch web page as readable text
74
+ - ⚠️ \`browse\` has no JavaScript engine. Sites that require JS (Google, Bing, SPAs) will fail.
75
+ - Do NOT use \`browse\` for search engines — use a search API via \`curl\` instead.
76
+ - If \`browse\` returns exitCode 1 with a warning, the content is useless — try a different source.
77
+
78
+ **JSON processing:**
79
+ - \`cat data.json | jq '.items[]'\` — extract, filter, transform JSON
80
+
81
+ **File management:**
82
+ - \`mkdir reports\` — create directory
83
+ - \`rm temp.json\` / \`rm -r cache/\` — remove files
84
+
85
+ <good-example>
86
+ curl 'https://api.example.com/users?page=1' | jq '.data' > users.json
87
+ </good-example>
88
+
89
+ <bad-example>
90
+ curl https://api.example.com/users?page=1&limit=10
91
+ (unquoted URL with & will break)
92
+ </bad-example>
93
+
94
+ ## Important rules
95
+
96
+ - All paths must be relative. NEVER use paths starting with \`/\` (e.g. use \`data.json\` not \`/data.json\`).
97
+ - NEVER use placeholders like \`<API_KEY>\`, \`<TOKEN>\`, \`YOUR_KEY_HERE\`. If a value is unknown, check if an environment variable is available (see below), otherwise ask the user using __ask_user__.
98
+ - Prefer free public APIs that don't require authentication. If auth is needed and credentials are not available, ask the user.
99
+ - On failure, read the output carefully and decide how to proceed based on what it says.`;
100
+ // Append available environment variable names so the AI knows what's available
101
+ const envKeys = shell.getEnvProvider()?.keys() ?? [];
102
+ if (envKeys.length > 0) {
103
+ description += `\n\n## Environment variables\n\nThe following variables are available: ${envKeys.map(k => '`$' + k + '`').join(', ')}. Use them in commands (e.g. \`curl -H "Authorization: Bearer $API_KEY" ...\`). Do NOT ask the user for these values — they are already configured.`;
104
+ }
105
+ return {
106
+ name: '__shell__',
107
+ description,
108
+ parameters: {
109
+ type: 'object',
110
+ properties: {
111
+ command: {
112
+ type: 'string',
113
+ description: 'The bash command to execute'
114
+ }
115
+ },
116
+ required: ['command']
117
+ },
118
+ execute: async (params) => {
119
+ const command = params.command;
120
+ if (!command || typeof command !== 'string') {
121
+ return {
122
+ success: false,
123
+ error: 'Command is required'
124
+ };
125
+ }
126
+ const result = await shell.execute(command);
127
+ if (result.exitCode !== 0) {
128
+ return {
129
+ success: false,
130
+ error: `\`${command}\` exited with code ${result.exitCode}`,
131
+ data: {
132
+ command,
133
+ exitCode: result.exitCode,
134
+ stdout: result.stdout,
135
+ stderr: result.stderr
136
+ }
137
+ };
138
+ }
139
+ // Output truncation with spill-to-disk
140
+ if (result.stdout.length > MAX_OUTPUT_CHARS) {
141
+ const timestamp = Date.now();
142
+ const spillPath = `.tuplet/tmp/output-${timestamp}.txt`;
143
+ const fs = shell.getFS();
144
+ // Write directly to raw provider (spill path is internal)
145
+ await fs.write('/' + spillPath, result.stdout);
146
+ return {
147
+ success: false,
148
+ error: `Output (${result.stdout.length} chars) exceeds maximum (${MAX_OUTPUT_CHARS} chars). Saved to ${spillPath}. Use \`head -n 2000 ${spillPath}\`, \`cat --offset 0 --limit 2000 ${spillPath}\`, or \`grep "pattern" ${spillPath}\` to read portions.`,
149
+ data: {
150
+ command,
151
+ exitCode: result.exitCode,
152
+ spillPath
153
+ }
154
+ };
155
+ }
156
+ return {
157
+ success: true,
158
+ data: {
159
+ output: result.stdout,
160
+ exitCode: result.exitCode
161
+ }
162
+ };
163
+ }
164
+ };
165
+ }
166
+ //# sourceMappingURL=shell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell.js","sourceRoot":"","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ig, TupletConfig, RunOptions, AgentResult } from "../types.js";
7
+ import { TraceBuilder } from "../trace.js";
8
+ /**
9
+ * Interface for the parent Tuplet context needed by task tool
10
+ */
11
+ export interface TaskToolContext {
12
+ config: TupletConfig;
13
+ getCurrentTraceBuilder(): TraceBuilder | undefined;
14
+ }
15
+ /**
16
+ * Factory function type for creating sub-Tuplet instances
17
+ */
18
+ export type CreateSubTuplet = (config: TupletConfig) => {
19
+ run(message: string, options?: RunOptions): Promise<AgentResult>;
20
+ };
21
+ /**
22
+ * Create the __sub_agent__ tool for spawning sub-agents
23
+ */
24
+ export declare function createTaskTool(context: TaskToolContext, agents: SubAgentConfig[], createSubTuplet: CreateSubTuplet): Tool;
25
+ //# sourceMappingURL=sub-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sub-agent.d.ts","sourceRoot":"","sources":["../../src/tools/sub-agent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,IAAI,EACJ,cAAc,EAEd,YAAY,EACZ,UAAU,EACV,WAAW,EAKZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,YAAY,CAAC;IACrB,sBAAsB,IAAI,YAAY,GAAG,SAAS,CAAC;CACpD;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK;IACtD,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CAClE,CAAC;AAkFF;;GAEG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,cAAc,EAAE,EACxB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAqUN"}