praxis-agent 0.1.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 (395) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +534 -0
  3. package/dist/application/background-agent-manager.d.ts +66 -0
  4. package/dist/application/background-agent-manager.d.ts.map +1 -0
  5. package/dist/application/background-agent-manager.js +362 -0
  6. package/dist/application/background-agent-manager.js.map +1 -0
  7. package/dist/application/background-bash-manager.d.ts +54 -0
  8. package/dist/application/background-bash-manager.d.ts.map +1 -0
  9. package/dist/application/background-bash-manager.js +354 -0
  10. package/dist/application/background-bash-manager.js.map +1 -0
  11. package/dist/application/background-task-id.d.ts +5 -0
  12. package/dist/application/background-task-id.d.ts.map +1 -0
  13. package/dist/application/background-task-id.js +25 -0
  14. package/dist/application/background-task-id.js.map +1 -0
  15. package/dist/application/claude-project-purge.d.ts +50 -0
  16. package/dist/application/claude-project-purge.d.ts.map +1 -0
  17. package/dist/application/claude-project-purge.js +459 -0
  18. package/dist/application/claude-project-purge.js.map +1 -0
  19. package/dist/application/managed-worktree.d.ts +15 -0
  20. package/dist/application/managed-worktree.d.ts.map +1 -0
  21. package/dist/application/managed-worktree.js +127 -0
  22. package/dist/application/managed-worktree.js.map +1 -0
  23. package/dist/application/model-compactor.d.ts +8 -0
  24. package/dist/application/model-compactor.d.ts.map +1 -0
  25. package/dist/application/model-compactor.js +70 -0
  26. package/dist/application/model-compactor.js.map +1 -0
  27. package/dist/application/scheduled-prompt-manager.d.ts +69 -0
  28. package/dist/application/scheduled-prompt-manager.d.ts.map +1 -0
  29. package/dist/application/scheduled-prompt-manager.js +387 -0
  30. package/dist/application/scheduled-prompt-manager.js.map +1 -0
  31. package/dist/application/session-service.d.ts +142 -0
  32. package/dist/application/session-service.d.ts.map +1 -0
  33. package/dist/application/session-service.js +1690 -0
  34. package/dist/application/session-service.js.map +1 -0
  35. package/dist/application/session-worktree.d.ts +55 -0
  36. package/dist/application/session-worktree.d.ts.map +1 -0
  37. package/dist/application/session-worktree.js +311 -0
  38. package/dist/application/session-worktree.js.map +1 -0
  39. package/dist/application/subagent-service.d.ts +98 -0
  40. package/dist/application/subagent-service.d.ts.map +1 -0
  41. package/dist/application/subagent-service.js +1305 -0
  42. package/dist/application/subagent-service.js.map +1 -0
  43. package/dist/application/tool-use-summary.d.ts +8 -0
  44. package/dist/application/tool-use-summary.d.ts.map +1 -0
  45. package/dist/application/tool-use-summary.js +53 -0
  46. package/dist/application/tool-use-summary.js.map +1 -0
  47. package/dist/application/top-level-agent-manager.d.ts +58 -0
  48. package/dist/application/top-level-agent-manager.d.ts.map +1 -0
  49. package/dist/application/top-level-agent-manager.js +907 -0
  50. package/dist/application/top-level-agent-manager.js.map +1 -0
  51. package/dist/application/workflow-manager.d.ts +61 -0
  52. package/dist/application/workflow-manager.d.ts.map +1 -0
  53. package/dist/application/workflow-manager.js +582 -0
  54. package/dist/application/workflow-manager.js.map +1 -0
  55. package/dist/application/workflow-meta.d.ts +18 -0
  56. package/dist/application/workflow-meta.d.ts.map +1 -0
  57. package/dist/application/workflow-meta.js +146 -0
  58. package/dist/application/workflow-meta.js.map +1 -0
  59. package/dist/application/workflow-runtime.d.ts +29 -0
  60. package/dist/application/workflow-runtime.d.ts.map +1 -0
  61. package/dist/application/workflow-runtime.js +176 -0
  62. package/dist/application/workflow-runtime.js.map +1 -0
  63. package/dist/application/workflow-worktree.d.ts +9 -0
  64. package/dist/application/workflow-worktree.d.ts.map +1 -0
  65. package/dist/application/workflow-worktree.js +11 -0
  66. package/dist/application/workflow-worktree.js.map +1 -0
  67. package/dist/cli/agents-dashboard.d.ts +37 -0
  68. package/dist/cli/agents-dashboard.d.ts.map +1 -0
  69. package/dist/cli/agents-dashboard.js +408 -0
  70. package/dist/cli/agents-dashboard.js.map +1 -0
  71. package/dist/cli/controls.d.ts +15 -0
  72. package/dist/cli/controls.d.ts.map +1 -0
  73. package/dist/cli/controls.js +219 -0
  74. package/dist/cli/controls.js.map +1 -0
  75. package/dist/cli/debug.d.ts +13 -0
  76. package/dist/cli/debug.d.ts.map +1 -0
  77. package/dist/cli/debug.js +37 -0
  78. package/dist/cli/debug.js.map +1 -0
  79. package/dist/cli/interactive.d.ts +63 -0
  80. package/dist/cli/interactive.d.ts.map +1 -0
  81. package/dist/cli/interactive.js +600 -0
  82. package/dist/cli/interactive.js.map +1 -0
  83. package/dist/cli/protocol.d.ts +251 -0
  84. package/dist/cli/protocol.d.ts.map +1 -0
  85. package/dist/cli/protocol.js +2146 -0
  86. package/dist/cli/protocol.js.map +1 -0
  87. package/dist/cli.d.ts +116 -0
  88. package/dist/cli.d.ts.map +1 -0
  89. package/dist/cli.js +3901 -0
  90. package/dist/cli.js.map +1 -0
  91. package/dist/compatibility/claude/compaction.d.ts +19 -0
  92. package/dist/compatibility/claude/compaction.d.ts.map +1 -0
  93. package/dist/compatibility/claude/compaction.js +82 -0
  94. package/dist/compatibility/claude/compaction.js.map +1 -0
  95. package/dist/compatibility/claude/context.d.ts +24 -0
  96. package/dist/compatibility/claude/context.d.ts.map +1 -0
  97. package/dist/compatibility/claude/context.js +92 -0
  98. package/dist/compatibility/claude/context.js.map +1 -0
  99. package/dist/compatibility/claude/dynamic-context.d.ts +20 -0
  100. package/dist/compatibility/claude/dynamic-context.d.ts.map +1 -0
  101. package/dist/compatibility/claude/dynamic-context.js +168 -0
  102. package/dist/compatibility/claude/dynamic-context.js.map +1 -0
  103. package/dist/compatibility/claude/file-history.d.ts +14 -0
  104. package/dist/compatibility/claude/file-history.d.ts.map +1 -0
  105. package/dist/compatibility/claude/file-history.js +340 -0
  106. package/dist/compatibility/claude/file-history.js.map +1 -0
  107. package/dist/compatibility/claude/file-resources.d.ts +28 -0
  108. package/dist/compatibility/claude/file-resources.d.ts.map +1 -0
  109. package/dist/compatibility/claude/file-resources.js +168 -0
  110. package/dist/compatibility/claude/file-resources.js.map +1 -0
  111. package/dist/compatibility/claude/fork.d.ts +9 -0
  112. package/dist/compatibility/claude/fork.d.ts.map +1 -0
  113. package/dist/compatibility/claude/fork.js +225 -0
  114. package/dist/compatibility/claude/fork.js.map +1 -0
  115. package/dist/compatibility/claude/history.d.ts +4 -0
  116. package/dist/compatibility/claude/history.d.ts.map +1 -0
  117. package/dist/compatibility/claude/history.js +86 -0
  118. package/dist/compatibility/claude/history.js.map +1 -0
  119. package/dist/compatibility/claude/ownership.d.ts +87 -0
  120. package/dist/compatibility/claude/ownership.d.ts.map +1 -0
  121. package/dist/compatibility/claude/ownership.js +100 -0
  122. package/dist/compatibility/claude/ownership.js.map +1 -0
  123. package/dist/compatibility/claude/paths.d.ts +17 -0
  124. package/dist/compatibility/claude/paths.d.ts.map +1 -0
  125. package/dist/compatibility/claude/paths.js +54 -0
  126. package/dist/compatibility/claude/paths.js.map +1 -0
  127. package/dist/compatibility/claude/pr-links.d.ts +25 -0
  128. package/dist/compatibility/claude/pr-links.d.ts.map +1 -0
  129. package/dist/compatibility/claude/pr-links.js +80 -0
  130. package/dist/compatibility/claude/pr-links.js.map +1 -0
  131. package/dist/compatibility/claude/projection.d.ts +11 -0
  132. package/dist/compatibility/claude/projection.d.ts.map +1 -0
  133. package/dist/compatibility/claude/projection.js +325 -0
  134. package/dist/compatibility/claude/projection.js.map +1 -0
  135. package/dist/compatibility/claude/schema.d.ts +18 -0
  136. package/dist/compatibility/claude/schema.d.ts.map +1 -0
  137. package/dist/compatibility/claude/schema.js +983 -0
  138. package/dist/compatibility/claude/schema.js.map +1 -0
  139. package/dist/compatibility/claude/shared-resources.d.ts +51 -0
  140. package/dist/compatibility/claude/shared-resources.d.ts.map +1 -0
  141. package/dist/compatibility/claude/shared-resources.js +382 -0
  142. package/dist/compatibility/claude/shared-resources.js.map +1 -0
  143. package/dist/compatibility/claude/sidechain.d.ts +50 -0
  144. package/dist/compatibility/claude/sidechain.d.ts.map +1 -0
  145. package/dist/compatibility/claude/sidechain.js +90 -0
  146. package/dist/compatibility/claude/sidechain.js.map +1 -0
  147. package/dist/compatibility/claude/tool-links.d.ts +13 -0
  148. package/dist/compatibility/claude/tool-links.d.ts.map +1 -0
  149. package/dist/compatibility/claude/tool-links.js +61 -0
  150. package/dist/compatibility/claude/tool-links.js.map +1 -0
  151. package/dist/compatibility/claude/translation.d.ts +71 -0
  152. package/dist/compatibility/claude/translation.d.ts.map +1 -0
  153. package/dist/compatibility/claude/translation.js +443 -0
  154. package/dist/compatibility/claude/translation.js.map +1 -0
  155. package/dist/compatibility/claude/workflow-replay.d.ts +10 -0
  156. package/dist/compatibility/claude/workflow-replay.d.ts.map +1 -0
  157. package/dist/compatibility/claude/workflow-replay.js +66 -0
  158. package/dist/compatibility/claude/workflow-replay.js.map +1 -0
  159. package/dist/compatibility/claude/workflow.d.ts +33 -0
  160. package/dist/compatibility/claude/workflow.d.ts.map +1 -0
  161. package/dist/compatibility/claude/workflow.js +76 -0
  162. package/dist/compatibility/claude/workflow.js.map +1 -0
  163. package/dist/core/compaction.d.ts +16 -0
  164. package/dist/core/compaction.d.ts.map +1 -0
  165. package/dist/core/compaction.js +2 -0
  166. package/dist/core/compaction.js.map +1 -0
  167. package/dist/core/context-budget.d.ts +28 -0
  168. package/dist/core/context-budget.d.ts.map +1 -0
  169. package/dist/core/context-budget.js +108 -0
  170. package/dist/core/context-budget.js.map +1 -0
  171. package/dist/core/context.d.ts +16 -0
  172. package/dist/core/context.d.ts.map +1 -0
  173. package/dist/core/context.js +13 -0
  174. package/dist/core/context.js.map +1 -0
  175. package/dist/core/runtime.d.ts +394 -0
  176. package/dist/core/runtime.d.ts.map +1 -0
  177. package/dist/core/runtime.js +507 -0
  178. package/dist/core/runtime.js.map +1 -0
  179. package/dist/core/usage.d.ts +26 -0
  180. package/dist/core/usage.d.ts.map +1 -0
  181. package/dist/core/usage.js +133 -0
  182. package/dist/core/usage.js.map +1 -0
  183. package/dist/extensions/claude-extension-tools.d.ts +16 -0
  184. package/dist/extensions/claude-extension-tools.d.ts.map +1 -0
  185. package/dist/extensions/claude-extension-tools.js +78 -0
  186. package/dist/extensions/claude-extension-tools.js.map +1 -0
  187. package/dist/extensions/claude-extensions.d.ts +41 -0
  188. package/dist/extensions/claude-extensions.d.ts.map +1 -0
  189. package/dist/extensions/claude-extensions.js +270 -0
  190. package/dist/extensions/claude-extensions.js.map +1 -0
  191. package/dist/hooks/claude-hook-tools.d.ts +26 -0
  192. package/dist/hooks/claude-hook-tools.d.ts.map +1 -0
  193. package/dist/hooks/claude-hook-tools.js +129 -0
  194. package/dist/hooks/claude-hook-tools.js.map +1 -0
  195. package/dist/hooks/claude-hooks.d.ts +87 -0
  196. package/dist/hooks/claude-hooks.d.ts.map +1 -0
  197. package/dist/hooks/claude-hooks.js +411 -0
  198. package/dist/hooks/claude-hooks.js.map +1 -0
  199. package/dist/maintenance/doctor.d.ts +33 -0
  200. package/dist/maintenance/doctor.d.ts.map +1 -0
  201. package/dist/maintenance/doctor.js +391 -0
  202. package/dist/maintenance/doctor.js.map +1 -0
  203. package/dist/maintenance/self-update.d.ts +31 -0
  204. package/dist/maintenance/self-update.d.ts.map +1 -0
  205. package/dist/maintenance/self-update.js +81 -0
  206. package/dist/maintenance/self-update.js.map +1 -0
  207. package/dist/mcp/claude-mcp-management.d.ts +28 -0
  208. package/dist/mcp/claude-mcp-management.d.ts.map +1 -0
  209. package/dist/mcp/claude-mcp-management.js +169 -0
  210. package/dist/mcp/claude-mcp-management.js.map +1 -0
  211. package/dist/mcp/claude-mcp-oauth.d.ts +113 -0
  212. package/dist/mcp/claude-mcp-oauth.d.ts.map +1 -0
  213. package/dist/mcp/claude-mcp-oauth.js +1053 -0
  214. package/dist/mcp/claude-mcp-oauth.js.map +1 -0
  215. package/dist/mcp/claude-mcp-tools.d.ts +98 -0
  216. package/dist/mcp/claude-mcp-tools.d.ts.map +1 -0
  217. package/dist/mcp/claude-mcp-tools.js +1246 -0
  218. package/dist/mcp/claude-mcp-tools.js.map +1 -0
  219. package/dist/mcp/praxis-mcp-server.d.ts +35 -0
  220. package/dist/mcp/praxis-mcp-server.d.ts.map +1 -0
  221. package/dist/mcp/praxis-mcp-server.js +520 -0
  222. package/dist/mcp/praxis-mcp-server.js.map +1 -0
  223. package/dist/permissions/claude-auto-classifier.d.ts +20 -0
  224. package/dist/permissions/claude-auto-classifier.d.ts.map +1 -0
  225. package/dist/permissions/claude-auto-classifier.js +140 -0
  226. package/dist/permissions/claude-auto-classifier.js.map +1 -0
  227. package/dist/permissions/claude-permission-resolver.d.ts +30 -0
  228. package/dist/permissions/claude-permission-resolver.d.ts.map +1 -0
  229. package/dist/permissions/claude-permission-resolver.js +334 -0
  230. package/dist/permissions/claude-permission-resolver.js.map +1 -0
  231. package/dist/persistence/claude-job-store.d.ts +68 -0
  232. package/dist/persistence/claude-job-store.d.ts.map +1 -0
  233. package/dist/persistence/claude-job-store.js +311 -0
  234. package/dist/persistence/claude-job-store.js.map +1 -0
  235. package/dist/persistence/claude-scheduled-task-store.d.ts +29 -0
  236. package/dist/persistence/claude-scheduled-task-store.d.ts.map +1 -0
  237. package/dist/persistence/claude-scheduled-task-store.js +163 -0
  238. package/dist/persistence/claude-scheduled-task-store.js.map +1 -0
  239. package/dist/persistence/claude-sidechain-store.d.ts +18 -0
  240. package/dist/persistence/claude-sidechain-store.d.ts.map +1 -0
  241. package/dist/persistence/claude-sidechain-store.js +107 -0
  242. package/dist/persistence/claude-sidechain-store.js.map +1 -0
  243. package/dist/persistence/claude-task-store.d.ts +72 -0
  244. package/dist/persistence/claude-task-store.d.ts.map +1 -0
  245. package/dist/persistence/claude-task-store.js +440 -0
  246. package/dist/persistence/claude-task-store.js.map +1 -0
  247. package/dist/persistence/claude-transcript-store.d.ts +85 -0
  248. package/dist/persistence/claude-transcript-store.d.ts.map +1 -0
  249. package/dist/persistence/claude-transcript-store.js +385 -0
  250. package/dist/persistence/claude-transcript-store.js.map +1 -0
  251. package/dist/persistence/claude-workflow-store.d.ts +41 -0
  252. package/dist/persistence/claude-workflow-store.d.ts.map +1 -0
  253. package/dist/persistence/claude-workflow-store.js +263 -0
  254. package/dist/persistence/claude-workflow-store.js.map +1 -0
  255. package/dist/persistence/in-memory-sidechain-store.d.ts +12 -0
  256. package/dist/persistence/in-memory-sidechain-store.d.ts.map +1 -0
  257. package/dist/persistence/in-memory-sidechain-store.js +30 -0
  258. package/dist/persistence/in-memory-sidechain-store.js.map +1 -0
  259. package/dist/persistence/in-memory-transcript-store.d.ts +15 -0
  260. package/dist/persistence/in-memory-transcript-store.d.ts.map +1 -0
  261. package/dist/persistence/in-memory-transcript-store.js +95 -0
  262. package/dist/persistence/in-memory-transcript-store.js.map +1 -0
  263. package/dist/platform/atomic-write.d.ts +5 -0
  264. package/dist/platform/atomic-write.d.ts.map +1 -0
  265. package/dist/platform/atomic-write.js +25 -0
  266. package/dist/platform/atomic-write.js.map +1 -0
  267. package/dist/platform/bounded-process-runner.d.ts +28 -0
  268. package/dist/platform/bounded-process-runner.d.ts.map +1 -0
  269. package/dist/platform/bounded-process-runner.js +209 -0
  270. package/dist/platform/bounded-process-runner.js.map +1 -0
  271. package/dist/platform/claude-version.d.ts +5 -0
  272. package/dist/platform/claude-version.d.ts.map +1 -0
  273. package/dist/platform/claude-version.js +17 -0
  274. package/dist/platform/claude-version.js.map +1 -0
  275. package/dist/platform/command-shell.d.ts +3 -0
  276. package/dist/platform/command-shell.d.ts.map +1 -0
  277. package/dist/platform/command-shell.js +15 -0
  278. package/dist/platform/command-shell.js.map +1 -0
  279. package/dist/platform/exclusive-file-lease.d.ts +15 -0
  280. package/dist/platform/exclusive-file-lease.d.ts.map +1 -0
  281. package/dist/platform/exclusive-file-lease.js +265 -0
  282. package/dist/platform/exclusive-file-lease.js.map +1 -0
  283. package/dist/platform/sensitive-data.d.ts +8 -0
  284. package/dist/platform/sensitive-data.d.ts.map +1 -0
  285. package/dist/platform/sensitive-data.js +138 -0
  286. package/dist/platform/sensitive-data.js.map +1 -0
  287. package/dist/platform/tmux-worktree.d.ts +30 -0
  288. package/dist/platform/tmux-worktree.d.ts.map +1 -0
  289. package/dist/platform/tmux-worktree.js +138 -0
  290. package/dist/platform/tmux-worktree.js.map +1 -0
  291. package/dist/plugins/claude-plugin-eval-discovery.d.ts +20 -0
  292. package/dist/plugins/claude-plugin-eval-discovery.d.ts.map +1 -0
  293. package/dist/plugins/claude-plugin-eval-discovery.js +128 -0
  294. package/dist/plugins/claude-plugin-eval-discovery.js.map +1 -0
  295. package/dist/plugins/claude-plugin-eval-graders.d.ts +49 -0
  296. package/dist/plugins/claude-plugin-eval-graders.d.ts.map +1 -0
  297. package/dist/plugins/claude-plugin-eval-graders.js +137 -0
  298. package/dist/plugins/claude-plugin-eval-graders.js.map +1 -0
  299. package/dist/plugins/claude-plugin-eval-runner.d.ts +50 -0
  300. package/dist/plugins/claude-plugin-eval-runner.d.ts.map +1 -0
  301. package/dist/plugins/claude-plugin-eval-runner.js +189 -0
  302. package/dist/plugins/claude-plugin-eval-runner.js.map +1 -0
  303. package/dist/plugins/claude-plugin-eval-schema.d.ts +80 -0
  304. package/dist/plugins/claude-plugin-eval-schema.d.ts.map +1 -0
  305. package/dist/plugins/claude-plugin-eval-schema.js +436 -0
  306. package/dist/plugins/claude-plugin-eval-schema.js.map +1 -0
  307. package/dist/plugins/claude-plugin-eval.d.ts +66 -0
  308. package/dist/plugins/claude-plugin-eval.d.ts.map +1 -0
  309. package/dist/plugins/claude-plugin-eval.js +438 -0
  310. package/dist/plugins/claude-plugin-eval.js.map +1 -0
  311. package/dist/plugins/claude-plugin-maintenance.d.ts +39 -0
  312. package/dist/plugins/claude-plugin-maintenance.d.ts.map +1 -0
  313. package/dist/plugins/claude-plugin-maintenance.js +336 -0
  314. package/dist/plugins/claude-plugin-maintenance.js.map +1 -0
  315. package/dist/plugins/claude-plugin-marketplace.d.ts +97 -0
  316. package/dist/plugins/claude-plugin-marketplace.d.ts.map +1 -0
  317. package/dist/plugins/claude-plugin-marketplace.js +1433 -0
  318. package/dist/plugins/claude-plugin-marketplace.js.map +1 -0
  319. package/dist/plugins/claude-plugin-mcpb.d.ts +71 -0
  320. package/dist/plugins/claude-plugin-mcpb.d.ts.map +1 -0
  321. package/dist/plugins/claude-plugin-mcpb.js +885 -0
  322. package/dist/plugins/claude-plugin-mcpb.js.map +1 -0
  323. package/dist/plugins/claude-plugin-runtime.d.ts +120 -0
  324. package/dist/plugins/claude-plugin-runtime.d.ts.map +1 -0
  325. package/dist/plugins/claude-plugin-runtime.js +1263 -0
  326. package/dist/plugins/claude-plugin-runtime.js.map +1 -0
  327. package/dist/providers/anthropic-compatible.d.ts +35 -0
  328. package/dist/providers/anthropic-compatible.d.ts.map +1 -0
  329. package/dist/providers/anthropic-compatible.js +733 -0
  330. package/dist/providers/anthropic-compatible.js.map +1 -0
  331. package/dist/providers/environment.d.ts +14 -0
  332. package/dist/providers/environment.d.ts.map +1 -0
  333. package/dist/providers/environment.js +67 -0
  334. package/dist/providers/environment.js.map +1 -0
  335. package/dist/providers/fallback-provider.d.ts +17 -0
  336. package/dist/providers/fallback-provider.d.ts.map +1 -0
  337. package/dist/providers/fallback-provider.js +70 -0
  338. package/dist/providers/fallback-provider.js.map +1 -0
  339. package/dist/providers/openai-compatible.d.ts +30 -0
  340. package/dist/providers/openai-compatible.d.ts.map +1 -0
  341. package/dist/providers/openai-compatible.js +409 -0
  342. package/dist/providers/openai-compatible.js.map +1 -0
  343. package/dist/tools/claude-interactive-tools.d.ts +58 -0
  344. package/dist/tools/claude-interactive-tools.d.ts.map +1 -0
  345. package/dist/tools/claude-interactive-tools.js +390 -0
  346. package/dist/tools/claude-interactive-tools.js.map +1 -0
  347. package/dist/tools/claude-lsp-formatters.d.ts +2 -0
  348. package/dist/tools/claude-lsp-formatters.d.ts.map +1 -0
  349. package/dist/tools/claude-lsp-formatters.js +291 -0
  350. package/dist/tools/claude-lsp-formatters.js.map +1 -0
  351. package/dist/tools/claude-lsp-tool.d.ts +22 -0
  352. package/dist/tools/claude-lsp-tool.d.ts.map +1 -0
  353. package/dist/tools/claude-lsp-tool.js +744 -0
  354. package/dist/tools/claude-lsp-tool.js.map +1 -0
  355. package/dist/tools/claude-scheduled-tools.d.ts +20 -0
  356. package/dist/tools/claude-scheduled-tools.d.ts.map +1 -0
  357. package/dist/tools/claude-scheduled-tools.js +344 -0
  358. package/dist/tools/claude-scheduled-tools.js.map +1 -0
  359. package/dist/tools/claude-task-tools.d.ts +30 -0
  360. package/dist/tools/claude-task-tools.d.ts.map +1 -0
  361. package/dist/tools/claude-task-tools.js +503 -0
  362. package/dist/tools/claude-task-tools.js.map +1 -0
  363. package/dist/tools/claude-user-message.d.ts +16 -0
  364. package/dist/tools/claude-user-message.d.ts.map +1 -0
  365. package/dist/tools/claude-user-message.js +98 -0
  366. package/dist/tools/claude-user-message.js.map +1 -0
  367. package/dist/tools/claude-workflow-tools.d.ts +27 -0
  368. package/dist/tools/claude-workflow-tools.d.ts.map +1 -0
  369. package/dist/tools/claude-workflow-tools.js +257 -0
  370. package/dist/tools/claude-workflow-tools.js.map +1 -0
  371. package/dist/tools/claude-worktree-tools.d.ts +17 -0
  372. package/dist/tools/claude-worktree-tools.d.ts.map +1 -0
  373. package/dist/tools/claude-worktree-tools.js +135 -0
  374. package/dist/tools/claude-worktree-tools.js.map +1 -0
  375. package/dist/tools/filtered-tool-registry.d.ts +16 -0
  376. package/dist/tools/filtered-tool-registry.d.ts.map +1 -0
  377. package/dist/tools/filtered-tool-registry.js +51 -0
  378. package/dist/tools/filtered-tool-registry.js.map +1 -0
  379. package/dist/tools/glob.d.ts +9 -0
  380. package/dist/tools/glob.d.ts.map +1 -0
  381. package/dist/tools/glob.js +88 -0
  382. package/dist/tools/glob.js.map +1 -0
  383. package/dist/tools/local-tools.d.ts +47 -0
  384. package/dist/tools/local-tools.d.ts.map +1 -0
  385. package/dist/tools/local-tools.js +1082 -0
  386. package/dist/tools/local-tools.js.map +1 -0
  387. package/dist/tools/notebook.d.ts +22 -0
  388. package/dist/tools/notebook.d.ts.map +1 -0
  389. package/dist/tools/notebook.js +154 -0
  390. package/dist/tools/notebook.js.map +1 -0
  391. package/dist/tools/web.d.ts +48 -0
  392. package/dist/tools/web.d.ts.map +1 -0
  393. package/dist/tools/web.js +726 -0
  394. package/dist/tools/web.js.map +1 -0
  395. package/package.json +145 -0
@@ -0,0 +1,27 @@
1
+ import type { ModelToolCall, ModelToolDefinition, ToolExecutionContext, ToolExecutionResult, ToolRegistry } from '../core/runtime.js';
2
+ import { type WorkflowManager } from '../application/workflow-manager.js';
3
+ import type { ClaudeSubagentExecutor } from '../application/subagent-service.js';
4
+ export interface ClaudeWorkflowToolRegistryOptions {
5
+ base: ToolRegistry;
6
+ manager: WorkflowManager;
7
+ executor: ClaudeSubagentExecutor;
8
+ cwd: string;
9
+ cwdProvider?: () => string;
10
+ configRoot: string;
11
+ sessionId: string;
12
+ promptIdForCall(callId: string): string | null;
13
+ defaultModel: string;
14
+ tokenBudget?: number | null;
15
+ enabled: boolean;
16
+ }
17
+ export declare class ClaudeWorkflowToolRegistry implements ToolRegistry {
18
+ private readonly options;
19
+ private readonly prepared;
20
+ constructor(options: ClaudeWorkflowToolRegistryOptions);
21
+ definitions(): readonly ModelToolDefinition[];
22
+ prepare(call: ModelToolCall, context: ToolExecutionContext): Promise<ModelToolCall>;
23
+ execute(call: ModelToolCall, context: ToolExecutionContext): Promise<ToolExecutionResult>;
24
+ private resolveSource;
25
+ private source;
26
+ }
27
+ //# sourceMappingURL=claude-workflow-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-workflow-tools.d.ts","sourceRoot":"","sources":["../../src/tools/claude-workflow-tools.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACb,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAEL,KAAK,eAAe,EAErB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAA;AAwEhF,MAAM,WAAW,iCAAiC;IAChD,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,EAAE,eAAe,CAAA;IACxB,QAAQ,EAAE,sBAAsB,CAAA;IAChC,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,CAAC,EAAE,MAAM,MAAM,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;IAC9C,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,OAAO,EAAE,OAAO,CAAA;CACjB;AAcD,qBAAa,0BAA2B,YAAW,YAAY;IAGjD,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoC;gBAEhC,OAAO,EAAE,iCAAiC;IAEvE,WAAW,IAAI,SAAS,mBAAmB,EAAE;IAQvC,OAAO,CACX,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,aAAa,CAAC;IAkEnB,OAAO,CACX,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,mBAAmB,CAAC;YA2DjB,aAAa;IA8C3B,OAAO,CAAC,MAAM;CASf"}
@@ -0,0 +1,257 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { isAbsolute, resolve } from 'node:path';
3
+ import { parseWorkflowScript, } from '../application/workflow-manager.js';
4
+ const MAX_SCRIPT_BYTES = 524_288;
5
+ const WORKFLOW_DEFINITION = {
6
+ name: 'Workflow',
7
+ description: `Run an explicitly requested, sandboxed JavaScript workflow in the background. Use only when the user asks for a workflow or named saved workflow; for ordinary delegation use Agent.
8
+
9
+ Every script starts with a pure-literal \`export const meta = { name, description, phases? }\`. Its async body may use \`args\`, \`agent(prompt, options?)\`, \`parallel(thunks)\`, \`pipeline(items, ...stages)\`, \`workflow(nameOrScriptPath, args)\`, \`phase(title)\`, \`log(message)\`, and \`budget.{total,spent(),remaining()}\`. Agent options are \`label\`, \`phase\`, \`model\`, \`effort\`, \`agentType\`, \`schema\`, and \`isolation: 'worktree'\`. Pipeline stages receive \`(previousResult, originalItem, index)\`; failed parallel or pipeline items become null. Nested workflows are limited to one level.
10
+
11
+ Provide one source: \`scriptPath\` takes precedence over \`script\`, which takes precedence over \`name\`. Saved names resolve from project then user \`.claude/workflows\`, followed by built-ins. The call returns a task ID immediately; use TaskOutput/TaskStop for lifecycle. Resume a terminal or interrupted run with its script path and \`resumeFromRunId\`; completed matching agents replay from journal. Workflows allow at most 1000 agents, 4096 collection items, and bounded concurrency. Scripts have no Node.js, filesystem, network, ambient time, or randomness.`,
12
+ inputSchema: {
13
+ $schema: 'https://json-schema.org/draft/2020-12/schema',
14
+ type: 'object',
15
+ properties: {
16
+ script: { type: 'string', maxLength: MAX_SCRIPT_BYTES },
17
+ name: { type: 'string' },
18
+ description: { type: 'string' },
19
+ title: { type: 'string' },
20
+ args: {},
21
+ scriptPath: { type: 'string' },
22
+ resumeFromRunId: {
23
+ type: 'string',
24
+ pattern: '^wf_[a-z0-9-]{6,}$',
25
+ },
26
+ },
27
+ additionalProperties: false,
28
+ },
29
+ };
30
+ const DEEP_RESEARCH = `export const meta = {
31
+ name: 'deep-research',
32
+ description: 'Research a topic from independent angles and synthesize the evidence',
33
+ phases: [
34
+ { title: 'Research', detail: 'Gather independent evidence' },
35
+ { title: 'Synthesis', detail: 'Reconcile findings and produce the answer' },
36
+ ],
37
+ }
38
+ phase('Research')
39
+ const topic = typeof args === 'string' ? args : args.topic
40
+ if (typeof topic !== 'string' || topic.length === 0) throw new Error('deep-research requires args.topic')
41
+ const findings = await parallel([
42
+ () => agent('Research primary sources for: ' + topic, { label: 'Primary sources', phase: 'Research' }),
43
+ () => agent('Find counterarguments and unresolved questions for: ' + topic, { label: 'Counterevidence', phase: 'Research' }),
44
+ () => agent('Build a concise factual timeline for: ' + topic, { label: 'Timeline', phase: 'Research' }),
45
+ ])
46
+ phase('Synthesis')
47
+ return agent('Synthesize these findings into a sourced answer about ' + topic + ':\n' + JSON.stringify(findings), { label: 'Synthesis', phase: 'Synthesis' })`;
48
+ const CODE_REVIEW = `export const meta = {
49
+ name: 'code-review',
50
+ description: 'Review a code change for correctness, security, tests, and maintainability',
51
+ phases: [
52
+ { title: 'Review', detail: 'Run independent focused reviews' },
53
+ { title: 'Triage', detail: 'Deduplicate and rank actionable findings' },
54
+ ],
55
+ }
56
+ phase('Review')
57
+ const target = typeof args === 'string' ? args : (args.target || 'current working tree changes')
58
+ const reviews = await parallel([
59
+ () => agent('Review ' + target + ' for logic errors and edge cases. Return only actionable findings.', { label: 'Correctness', phase: 'Review' }),
60
+ () => agent('Review ' + target + ' for security, resource, and concurrency bugs. Return only actionable findings.', { label: 'Security', phase: 'Review' }),
61
+ () => agent('Review tests for ' + target + ' and identify behavior not actually covered.', { label: 'Test coverage', phase: 'Review' }),
62
+ ])
63
+ phase('Triage')
64
+ return agent('Deduplicate and severity-rank these review findings. Keep concrete file references and fixes:\n' + JSON.stringify(reviews), { label: 'Triage', phase: 'Triage' })`;
65
+ const BUILT_INS = new Map([
66
+ ['deep-research', DEEP_RESEARCH],
67
+ ['code-review', CODE_REVIEW],
68
+ ]);
69
+ function optionalString(input, name) {
70
+ const value = input[name];
71
+ if (value === undefined)
72
+ return undefined;
73
+ if (typeof value !== 'string' || value.length === 0) {
74
+ throw new Error(`${name} must be a non-empty string`);
75
+ }
76
+ return value;
77
+ }
78
+ export class ClaudeWorkflowToolRegistry {
79
+ options;
80
+ prepared = new Map();
81
+ constructor(options) {
82
+ this.options = options;
83
+ }
84
+ definitions() {
85
+ const base = this.options.base.definitions();
86
+ if (!this.options.enabled || base.some(({ name }) => name === 'Workflow')) {
87
+ return base;
88
+ }
89
+ return [...base, WORKFLOW_DEFINITION];
90
+ }
91
+ async prepare(call, context) {
92
+ if (call.name === 'TaskOutput' || call.name === 'TaskStop') {
93
+ const taskId = call.input.task_id ?? call.input.shell_id;
94
+ if (typeof taskId === 'string' && this.options.manager.has(taskId)) {
95
+ if (call.name === 'TaskOutput') {
96
+ const block = call.input.block ?? true;
97
+ const timeout = call.input.timeout ?? 30_000;
98
+ if (typeof block !== 'boolean')
99
+ throw new Error('block must be a boolean');
100
+ if (typeof timeout !== 'number' || timeout < 0 || timeout > 600_000) {
101
+ throw new Error('timeout must be between 0 and 600000');
102
+ }
103
+ return { ...call, input: { task_id: taskId, block, timeout } };
104
+ }
105
+ return { ...call, input: { task_id: taskId } };
106
+ }
107
+ return this.options.base.prepare(call, context);
108
+ }
109
+ if (call.name !== 'Workflow')
110
+ return this.options.base.prepare(call, context);
111
+ if (!this.options.enabled)
112
+ throw new Error('Tool Workflow is unavailable');
113
+ const allowed = new Set([
114
+ 'script',
115
+ 'name',
116
+ 'description',
117
+ 'title',
118
+ 'args',
119
+ 'scriptPath',
120
+ 'resumeFromRunId',
121
+ ]);
122
+ for (const key of Object.keys(call.input)) {
123
+ if (!allowed.has(key))
124
+ throw new Error(`Unknown Workflow input field ${key}`);
125
+ }
126
+ const script = optionalString(call.input, 'script');
127
+ const name = optionalString(call.input, 'name');
128
+ const scriptPath = optionalString(call.input, 'scriptPath');
129
+ const description = optionalString(call.input, 'description');
130
+ const title = optionalString(call.input, 'title');
131
+ const resumeFromRunId = optionalString(call.input, 'resumeFromRunId');
132
+ if (!scriptPath && !script && !name) {
133
+ throw new Error('InputValidationError: [\n {\n "code": "custom",\n "path": [],\n "message": "Must provide script, name, or scriptPath"\n }\n]');
134
+ }
135
+ if (resumeFromRunId && !/^wf_[a-z0-9-]{6,}$/u.test(resumeFromRunId)) {
136
+ throw new Error('resumeFromRunId must match ^wf_[a-z0-9-]{6,}$');
137
+ }
138
+ const source = await this.resolveSource({
139
+ ...(scriptPath ? { scriptPath } : {}),
140
+ ...(script ? { script } : {}),
141
+ ...(name ? { name } : {}),
142
+ });
143
+ this.prepared.set(call.id, source);
144
+ return {
145
+ ...call,
146
+ input: {
147
+ ...(scriptPath ? { scriptPath } : script ? { script } : { name }),
148
+ ...(description ? { description } : {}),
149
+ ...(title ? { title } : {}),
150
+ ...(Object.hasOwn(call.input, 'args') ? { args: call.input.args } : {}),
151
+ ...(resumeFromRunId ? { resumeFromRunId } : {}),
152
+ },
153
+ };
154
+ }
155
+ async execute(call, context) {
156
+ if (call.name === 'TaskOutput' || call.name === 'TaskStop') {
157
+ const taskId = String(call.input.task_id);
158
+ if (this.options.manager.has(taskId)) {
159
+ return {
160
+ content: call.name === 'TaskOutput'
161
+ ? await this.options.manager.output(taskId, {
162
+ block: Boolean(call.input.block),
163
+ timeout: Number(call.input.timeout),
164
+ })
165
+ : this.options.manager.stop(taskId),
166
+ isError: false,
167
+ };
168
+ }
169
+ return this.options.base.execute(call, context);
170
+ }
171
+ if (call.name !== 'Workflow')
172
+ return this.options.base.execute(call, context);
173
+ const source = this.prepared.get(call.id);
174
+ this.prepared.delete(call.id);
175
+ if (!source)
176
+ throw new Error('Workflow was not prepared');
177
+ const launch = await this.options.manager.launch({
178
+ sessionId: this.options.sessionId,
179
+ promptId: this.options.promptIdForCall(call.id) ?? call.id,
180
+ script: source.script,
181
+ parsed: source.parsed,
182
+ args: Object.hasOwn(call.input, 'args') ? call.input.args : undefined,
183
+ ...(typeof call.input.resumeFromRunId === 'string'
184
+ ? { resumeFromRunId: call.input.resumeFromRunId }
185
+ : {}),
186
+ defaultModel: this.options.defaultModel,
187
+ ...(this.options.tokenBudget === undefined
188
+ ? {}
189
+ : { tokenBudget: this.options.tokenBudget }),
190
+ runAgent: (agentOptions) => this.options.executor.runWorkflowAgent(agentOptions),
191
+ resolveNested: (reference) => this.resolveSource(reference.endsWith('.js') || reference.includes('/')
192
+ ? { scriptPath: reference }
193
+ : { name: reference }),
194
+ ...(context.signal ? { signal: context.signal } : {}),
195
+ });
196
+ return {
197
+ content: launch.content,
198
+ isError: false,
199
+ nativeToolUseResult: {
200
+ isAsync: true,
201
+ status: 'async_launched',
202
+ taskId: launch.taskId,
203
+ taskType: 'local_workflow',
204
+ runId: launch.runId,
205
+ outputFile: launch.transcriptDirectory,
206
+ },
207
+ };
208
+ }
209
+ async resolveSource(input) {
210
+ if (input.scriptPath) {
211
+ const path = isAbsolute(input.scriptPath)
212
+ ? input.scriptPath
213
+ : resolve(this.options.cwdProvider?.() ?? this.options.cwd, input.scriptPath);
214
+ let script;
215
+ try {
216
+ script = await readFile(path, 'utf8');
217
+ }
218
+ catch (error) {
219
+ if (error.code === 'ENOENT') {
220
+ throw new Error(`Workflow script file not found: ${path}`);
221
+ }
222
+ throw error;
223
+ }
224
+ return this.source(script);
225
+ }
226
+ if (input.script)
227
+ return this.source(input.script);
228
+ const name = String(input.name);
229
+ for (const path of [
230
+ resolve(this.options.cwdProvider?.() ?? this.options.cwd, '.claude', 'workflows', `${name}.js`),
231
+ resolve(this.options.configRoot, 'workflows', `${name}.js`),
232
+ ]) {
233
+ try {
234
+ return this.source(await readFile(path, 'utf8'));
235
+ }
236
+ catch (error) {
237
+ if (error.code !== 'ENOENT')
238
+ throw error;
239
+ }
240
+ }
241
+ const builtIn = BUILT_INS.get(name);
242
+ if (builtIn)
243
+ return this.source(builtIn);
244
+ const available = [...BUILT_INS.keys()].join(', ');
245
+ throw new Error(`Workflow "${name}" not found. Available: ${available}`);
246
+ }
247
+ source(script) {
248
+ if (Buffer.byteLength(script) > MAX_SCRIPT_BYTES) {
249
+ throw new Error(`Workflow script exceeded ${MAX_SCRIPT_BYTES} bytes`);
250
+ }
251
+ return {
252
+ script,
253
+ parsed: parseWorkflowScript(script),
254
+ };
255
+ }
256
+ }
257
+ //# sourceMappingURL=claude-workflow-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-workflow-tools.js","sourceRoot":"","sources":["../../src/tools/claude-workflow-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,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GAAG,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAClD,MAAM,IAAI,KAAK,CAAC,aAAa,IAAI,2BAA2B,SAAS,EAAE,CAAC,CAAA;IAC1E,CAAC;IAEO,MAAM,CAAC,MAAc;QAC3B,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,gBAAgB,EAAE,CAAC;YACjD,MAAM,IAAI,KAAK,CAAC,4BAA4B,gBAAgB,QAAQ,CAAC,CAAA;QACvE,CAAC;QACD,OAAO;YACL,MAAM;YACN,MAAM,EAAE,mBAAmB,CAAC,MAAM,CAAC;SACpC,CAAA;IACH,CAAC;CACF"}
@@ -0,0 +1,17 @@
1
+ import type { ModelToolCall, ModelToolDefinition, ToolExecutionContext, ToolExecutionResult, ToolRegistry } from '../core/runtime.js';
2
+ import type { SessionWorktreeManager, WorkspaceContext } from '../application/session-worktree.js';
3
+ export declare class ClaudeWorktreeToolRegistry implements ToolRegistry {
4
+ private readonly options;
5
+ private readonly enabled;
6
+ constructor(options: {
7
+ base: ToolRegistry;
8
+ manager: SessionWorktreeManager;
9
+ workspace: WorkspaceContext;
10
+ enabledTools?: readonly ('EnterWorktree' | 'ExitWorktree')[];
11
+ });
12
+ definitions(): readonly ModelToolDefinition[];
13
+ prepare(call: ModelToolCall, context: ToolExecutionContext): Promise<ModelToolCall>;
14
+ execute(call: ModelToolCall, context: ToolExecutionContext): Promise<ToolExecutionResult>;
15
+ }
16
+ export declare const claudeWorktreeToolDefinitions: readonly [ModelToolDefinition, ModelToolDefinition];
17
+ //# sourceMappingURL=claude-worktree-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-worktree-tools.d.ts","sourceRoot":"","sources":["../../src/tools/claude-worktree-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACb,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EACV,sBAAsB,EACtB,gBAAgB,EACjB,MAAM,oCAAoC,CAAA;AAyE3C,qBAAa,0BAA2B,YAAW,YAAY;IAI3D,OAAO,CAAC,QAAQ,CAAC,OAAO;IAH1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;gBAG1B,OAAO,EAAE;QACxB,IAAI,EAAE,YAAY,CAAA;QAClB,OAAO,EAAE,sBAAsB,CAAA;QAC/B,SAAS,EAAE,gBAAgB,CAAA;QAC3B,YAAY,CAAC,EAAE,SAAS,CAAC,eAAe,GAAG,cAAc,CAAC,EAAE,CAAA;KAC7D;IAOH,WAAW,IAAI,SAAS,mBAAmB,EAAE;IAYvC,OAAO,CACX,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,aAAa,CAAC;IA0CnB,OAAO,CACX,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,mBAAmB,CAAC;CAmBhC;AAED,eAAO,MAAM,6BAA6B,qDAGhC,CAAA"}
@@ -0,0 +1,135 @@
1
+ const ENTER_DEFINITION = {
2
+ name: 'EnterWorktree',
3
+ description: 'Create or enter an isolated Git worktree and switch the current session into it.',
4
+ inputSchema: {
5
+ $schema: 'https://json-schema.org/draft/2020-12/schema',
6
+ type: 'object',
7
+ properties: {
8
+ name: {
9
+ description: 'Optional name for a new worktree. Each "/"-separated segment may contain only letters, digits, dots, underscores, and dashes; max 64 chars total. A random name is generated if not provided. Mutually exclusive with path.',
10
+ type: 'string',
11
+ },
12
+ path: {
13
+ description: 'Path to an existing worktree to switch into instead of creating a new one. Must be registered with the current repository and live under .claude/worktrees. Mutually exclusive with name.',
14
+ type: 'string',
15
+ },
16
+ },
17
+ additionalProperties: false,
18
+ },
19
+ };
20
+ const EXIT_DEFINITION = {
21
+ name: 'ExitWorktree',
22
+ description: 'Exit an active worktree session and return to the original working directory.',
23
+ inputSchema: {
24
+ $schema: 'https://json-schema.org/draft/2020-12/schema',
25
+ type: 'object',
26
+ properties: {
27
+ action: {
28
+ description: '"keep" leaves the worktree and branch on disk; "remove" deletes both.',
29
+ type: 'string',
30
+ enum: ['keep', 'remove'],
31
+ },
32
+ discard_changes: {
33
+ description: 'Required true when action is "remove" and the worktree has uncommitted files or unmerged commits.',
34
+ type: 'boolean',
35
+ },
36
+ },
37
+ required: ['action'],
38
+ additionalProperties: false,
39
+ },
40
+ };
41
+ function objectInput(call) {
42
+ if (!call.input ||
43
+ typeof call.input !== 'object' ||
44
+ Array.isArray(call.input)) {
45
+ throw new Error(`${call.name} input must be an object`);
46
+ }
47
+ return call.input;
48
+ }
49
+ function optionalString(input, key) {
50
+ const value = input[key];
51
+ if (value === undefined)
52
+ return undefined;
53
+ if (typeof value !== 'string' || value.length === 0) {
54
+ throw new Error(`${key} must be a non-empty string`);
55
+ }
56
+ return value;
57
+ }
58
+ export class ClaudeWorktreeToolRegistry {
59
+ options;
60
+ enabled;
61
+ constructor(options) {
62
+ this.options = options;
63
+ this.enabled = new Set(options.enabledTools ?? ['EnterWorktree', 'ExitWorktree']);
64
+ }
65
+ definitions() {
66
+ const base = this.options.base.definitions();
67
+ const existing = new Set(base.map(({ name }) => name));
68
+ return [
69
+ ...base,
70
+ ...[ENTER_DEFINITION, EXIT_DEFINITION].filter((definition) => this.enabled.has(definition.name) && !existing.has(definition.name)),
71
+ ];
72
+ }
73
+ async prepare(call, context) {
74
+ if (call.name === 'EnterWorktree' && this.enabled.has(call.name)) {
75
+ const input = objectInput(call);
76
+ const name = optionalString(input, 'name');
77
+ const path = optionalString(input, 'path');
78
+ if (name !== undefined && path !== undefined) {
79
+ throw new Error('EnterWorktree name and path are mutually exclusive');
80
+ }
81
+ return {
82
+ ...call,
83
+ input: {
84
+ ...(name === undefined ? {} : { name }),
85
+ ...(path === undefined ? {} : { path }),
86
+ },
87
+ };
88
+ }
89
+ if (call.name === 'ExitWorktree' && this.enabled.has(call.name)) {
90
+ const input = objectInput(call);
91
+ const action = input.action;
92
+ if (action !== 'keep' && action !== 'remove') {
93
+ throw new Error('action must be keep or remove');
94
+ }
95
+ const discardChanges = input.discard_changes;
96
+ if (discardChanges !== undefined && typeof discardChanges !== 'boolean') {
97
+ throw new Error('discard_changes must be a boolean');
98
+ }
99
+ return {
100
+ ...call,
101
+ input: {
102
+ action,
103
+ ...(discardChanges === undefined
104
+ ? {}
105
+ : { discard_changes: discardChanges }),
106
+ },
107
+ };
108
+ }
109
+ return this.options.base.prepare(call, {
110
+ ...context,
111
+ cwd: this.options.workspace.cwd(),
112
+ });
113
+ }
114
+ async execute(call, context) {
115
+ if (call.name === 'EnterWorktree' && this.enabled.has(call.name)) {
116
+ const input = call.input;
117
+ const result = await this.options.manager.enter(input, call.id);
118
+ return { ...result, isError: false };
119
+ }
120
+ if (call.name === 'ExitWorktree' && this.enabled.has(call.name)) {
121
+ const input = call.input;
122
+ const result = await this.options.manager.exit(input, call.id);
123
+ return { ...result, isError: false };
124
+ }
125
+ return this.options.base.execute(call, {
126
+ ...context,
127
+ cwd: this.options.workspace.cwd(),
128
+ });
129
+ }
130
+ }
131
+ export const claudeWorktreeToolDefinitions = [
132
+ ENTER_DEFINITION,
133
+ EXIT_DEFINITION,
134
+ ];
135
+ //# sourceMappingURL=claude-worktree-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-worktree-tools.js","sourceRoot":"","sources":["../../src/tools/claude-worktree-tools.ts"],"names":[],"mappings":"AAYA,MAAM,gBAAgB,GAAwB;IAC5C,IAAI,EAAE,eAAe;IACrB,WAAW,EACT,kFAAkF;IACpF,WAAW,EAAE;QACX,OAAO,EAAE,8CAA8C;QACvD,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,WAAW,EACT,6NAA6N;gBAC/N,IAAI,EAAE,QAAQ;aACf;YACD,IAAI,EAAE;gBACJ,WAAW,EACT,2LAA2L;gBAC7L,IAAI,EAAE,QAAQ;aACf;SAC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C,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACjE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAyC,CAAA;YAC5D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAA;YAC/D,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;QACtC,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAChE,MAAM,KAAK,GAAG,IAAI,CAAC,KAGlB,CAAA;YACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAA;YAC9D,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;QACtC,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;YACrC,GAAG,OAAO;YACV,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE;SAClC,CAAC,CAAA;IACJ,CAAC;CACF;AAED,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,gBAAgB;IAChB,eAAe;CACP,CAAA"}
@@ -0,0 +1,16 @@
1
+ import type { ModelToolCall, ModelToolDefinition, ToolExecutionContext, ToolExecutionResult, ToolRegistry } from '../core/runtime.js';
2
+ export interface FilteredToolRegistryOptions {
3
+ tools?: readonly string[];
4
+ disallowedTools?: readonly string[];
5
+ }
6
+ export declare class FilteredToolRegistry implements ToolRegistry {
7
+ private readonly base;
8
+ private readonly definitionsByName;
9
+ private readonly enabledNames;
10
+ constructor(base: ToolRegistry, options?: FilteredToolRegistryOptions);
11
+ definitions(): readonly ModelToolDefinition[];
12
+ prepare(call: ModelToolCall, context: ToolExecutionContext): Promise<ModelToolCall>;
13
+ execute(call: ModelToolCall, context: ToolExecutionContext): Promise<ToolExecutionResult>;
14
+ private assertEnabled;
15
+ }
16
+ //# sourceMappingURL=filtered-tool-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filtered-tool-registry.d.ts","sourceRoot":"","sources":["../../src/tools/filtered-tool-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACb,MAAM,oBAAoB,CAAA;AAE3B,MAAM,WAAW,2BAA2B;IAC1C,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACzB,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CACpC;AAWD,qBAAa,oBAAqB,YAAW,YAAY;IAKrD,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJvB,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA0C;IAC5E,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAqB;gBAG/B,IAAI,EAAE,YAAY,EACnC,OAAO,GAAE,2BAAgC;IAsB3C,WAAW,IAAI,SAAS,mBAAmB,EAAE;IAQvC,OAAO,CACX,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,aAAa,CAAC;IAKnB,OAAO,CACX,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,mBAAmB,CAAC;IAK/B,OAAO,CAAC,aAAa;CAKtB"}
@@ -0,0 +1,51 @@
1
+ function exactToolNames(rules) {
2
+ return new Set(rules.flatMap((rule) => {
3
+ const match = /^([A-Za-z][\w-]*)$/.exec(rule);
4
+ return match?.[1] ? [match[1]] : [];
5
+ }));
6
+ }
7
+ export class FilteredToolRegistry {
8
+ base;
9
+ definitionsByName;
10
+ enabledNames;
11
+ constructor(base, options = {}) {
12
+ this.base = base;
13
+ const definitions = base.definitions();
14
+ this.definitionsByName = new Map(definitions.map((definition) => [definition.name, definition]));
15
+ const selected = options.tools;
16
+ const enabled = selected === undefined || selected.includes('default')
17
+ ? new Set(this.definitionsByName.keys())
18
+ : new Set(selected);
19
+ for (const name of enabled) {
20
+ if (!this.definitionsByName.has(name)) {
21
+ throw new Error(`Unknown tool in --tools: ${name}`);
22
+ }
23
+ }
24
+ for (const name of exactToolNames(options.disallowedTools ?? [])) {
25
+ enabled.delete(name);
26
+ }
27
+ this.enabledNames = enabled;
28
+ }
29
+ definitions() {
30
+ return [...this.enabledNames].map((name) => {
31
+ const definition = this.definitionsByName.get(name);
32
+ if (!definition)
33
+ throw new Error(`Unknown enabled tool: ${name}`);
34
+ return definition;
35
+ });
36
+ }
37
+ async prepare(call, context) {
38
+ this.assertEnabled(call.name);
39
+ return this.base.prepare(call, context);
40
+ }
41
+ async execute(call, context) {
42
+ this.assertEnabled(call.name);
43
+ return this.base.execute(call, context);
44
+ }
45
+ assertEnabled(name) {
46
+ if (!this.enabledNames.has(name)) {
47
+ throw new Error(`Tool ${name} is disabled by CLI controls`);
48
+ }
49
+ }
50
+ }
51
+ //# sourceMappingURL=filtered-tool-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filtered-tool-registry.js","sourceRoot":"","sources":["../../src/tools/filtered-tool-registry.ts"],"names":[],"mappings":"AAaA,SAAS,cAAc,CAAC,KAAwB;IAC9C,OAAO,IAAI,GAAG,CACZ,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACrB,MAAM,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC7C,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IACrC,CAAC,CAAC,CACH,CAAA;AACH,CAAC;AAED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AA;YACnD,IAAI,CAAC,UAAU;gBAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAA;YACjE,OAAO,UAAU,CAAA;QACnB,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,OAAO,CACX,IAAmB,EACnB,OAA6B;QAE7B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IACzC,CAAC;IAED,KAAK,CAAC,OAAO,CACX,IAAmB,EACnB,OAA6B;QAE7B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IACzC,CAAC;IAEO,aAAa,CAAC,IAAY;QAChC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,QAAQ,IAAI,8BAA8B,CAAC,CAAA;QAC7D,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ export interface GlobFilesOptions {
2
+ root: string;
3
+ displayRoot: string;
4
+ absoluteRoot: string;
5
+ pattern: string;
6
+ signal?: AbortSignal;
7
+ }
8
+ export declare function globFiles(options: GlobFilesOptions): Promise<string>;
9
+ //# sourceMappingURL=glob.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../src/tools/glob.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAiCD,wBAAsB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CA+D1E"}