takt 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 (480) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +307 -0
  3. package/bin/takt +27 -0
  4. package/dist/agents/index.d.ts +5 -0
  5. package/dist/agents/index.d.ts.map +1 -0
  6. package/dist/agents/index.js +5 -0
  7. package/dist/agents/index.js.map +1 -0
  8. package/dist/agents/runner.d.ts +26 -0
  9. package/dist/agents/runner.d.ts.map +1 -0
  10. package/dist/agents/runner.js +144 -0
  11. package/dist/agents/runner.js.map +1 -0
  12. package/dist/claude/client.d.ts +43 -0
  13. package/dist/claude/client.d.ts.map +1 -0
  14. package/dist/claude/client.js +143 -0
  15. package/dist/claude/client.js.map +1 -0
  16. package/dist/claude/executor.d.ts +29 -0
  17. package/dist/claude/executor.d.ts.map +1 -0
  18. package/dist/claude/executor.js +169 -0
  19. package/dist/claude/executor.js.map +1 -0
  20. package/dist/claude/index.d.ts +14 -0
  21. package/dist/claude/index.d.ts.map +1 -0
  22. package/dist/claude/index.js +18 -0
  23. package/dist/claude/index.js.map +1 -0
  24. package/dist/claude/options-builder.d.ts +40 -0
  25. package/dist/claude/options-builder.d.ts.map +1 -0
  26. package/dist/claude/options-builder.js +90 -0
  27. package/dist/claude/options-builder.js.map +1 -0
  28. package/dist/claude/process.d.ts +57 -0
  29. package/dist/claude/process.d.ts.map +1 -0
  30. package/dist/claude/process.js +57 -0
  31. package/dist/claude/process.js.map +1 -0
  32. package/dist/claude/query-manager.d.ts +35 -0
  33. package/dist/claude/query-manager.d.ts.map +1 -0
  34. package/dist/claude/query-manager.js +74 -0
  35. package/dist/claude/query-manager.js.map +1 -0
  36. package/dist/claude/stream-converter.d.ts +19 -0
  37. package/dist/claude/stream-converter.d.ts.map +1 -0
  38. package/dist/claude/stream-converter.js +166 -0
  39. package/dist/claude/stream-converter.js.map +1 -0
  40. package/dist/claude/types.d.ts +99 -0
  41. package/dist/claude/types.d.ts.map +1 -0
  42. package/dist/claude/types.js +8 -0
  43. package/dist/claude/types.js.map +1 -0
  44. package/dist/cli/agentExecution.d.ts +16 -0
  45. package/dist/cli/agentExecution.d.ts.map +1 -0
  46. package/dist/cli/agentExecution.js +40 -0
  47. package/dist/cli/agentExecution.js.map +1 -0
  48. package/dist/cli/help.d.ts +8 -0
  49. package/dist/cli/help.d.ts.map +1 -0
  50. package/dist/cli/help.js +46 -0
  51. package/dist/cli/help.js.map +1 -0
  52. package/dist/cli/index.d.ts +8 -0
  53. package/dist/cli/index.d.ts.map +1 -0
  54. package/dist/cli/index.js +8 -0
  55. package/dist/cli/index.js.map +1 -0
  56. package/dist/cli/taskBatch.d.ts +8 -0
  57. package/dist/cli/taskBatch.d.ts.map +1 -0
  58. package/dist/cli/taskBatch.js +69 -0
  59. package/dist/cli/taskBatch.js.map +1 -0
  60. package/dist/cli/workflowExecution.d.ts +18 -0
  61. package/dist/cli/workflowExecution.d.ts.map +1 -0
  62. package/dist/cli/workflowExecution.js +112 -0
  63. package/dist/cli/workflowExecution.js.map +1 -0
  64. package/dist/cli.d.ts +14 -0
  65. package/dist/cli.d.ts.map +1 -0
  66. package/dist/cli.js +122 -0
  67. package/dist/cli.js.map +1 -0
  68. package/dist/commands/agentExecution.d.ts +8 -0
  69. package/dist/commands/agentExecution.d.ts.map +1 -0
  70. package/dist/commands/agentExecution.js +44 -0
  71. package/dist/commands/agentExecution.js.map +1 -0
  72. package/dist/commands/help.d.ts +8 -0
  73. package/dist/commands/help.d.ts.map +1 -0
  74. package/dist/commands/help.js +39 -0
  75. package/dist/commands/help.js.map +1 -0
  76. package/dist/commands/index.d.ts +9 -0
  77. package/dist/commands/index.d.ts.map +1 -0
  78. package/dist/commands/index.js +9 -0
  79. package/dist/commands/index.js.map +1 -0
  80. package/dist/commands/session.d.ts +10 -0
  81. package/dist/commands/session.d.ts.map +1 -0
  82. package/dist/commands/session.js +18 -0
  83. package/dist/commands/session.js.map +1 -0
  84. package/dist/commands/taskExecution.d.ts +20 -0
  85. package/dist/commands/taskExecution.d.ts.map +1 -0
  86. package/dist/commands/taskExecution.js +103 -0
  87. package/dist/commands/taskExecution.js.map +1 -0
  88. package/dist/commands/workflow.d.ts +9 -0
  89. package/dist/commands/workflow.d.ts.map +1 -0
  90. package/dist/commands/workflow.js +51 -0
  91. package/dist/commands/workflow.js.map +1 -0
  92. package/dist/commands/workflowExecution.d.ts +21 -0
  93. package/dist/commands/workflowExecution.d.ts.map +1 -0
  94. package/dist/commands/workflowExecution.js +95 -0
  95. package/dist/commands/workflowExecution.js.map +1 -0
  96. package/dist/config/agentLoader.d.ts +25 -0
  97. package/dist/config/agentLoader.d.ts.map +1 -0
  98. package/dist/config/agentLoader.js +96 -0
  99. package/dist/config/agentLoader.js.map +1 -0
  100. package/dist/config/globalConfig.d.ts +23 -0
  101. package/dist/config/globalConfig.d.ts.map +1 -0
  102. package/dist/config/globalConfig.js +117 -0
  103. package/dist/config/globalConfig.js.map +1 -0
  104. package/dist/config/index.d.ts +7 -0
  105. package/dist/config/index.d.ts.map +1 -0
  106. package/dist/config/index.js +7 -0
  107. package/dist/config/index.js.map +1 -0
  108. package/dist/config/initialization.d.ts +23 -0
  109. package/dist/config/initialization.d.ts.map +1 -0
  110. package/dist/config/initialization.js +55 -0
  111. package/dist/config/initialization.js.map +1 -0
  112. package/dist/config/loader.d.ts +9 -0
  113. package/dist/config/loader.d.ts.map +1 -0
  114. package/dist/config/loader.js +12 -0
  115. package/dist/config/loader.js.map +1 -0
  116. package/dist/config/paths.d.ts +33 -0
  117. package/dist/config/paths.d.ts.map +1 -0
  118. package/dist/config/paths.js +66 -0
  119. package/dist/config/paths.js.map +1 -0
  120. package/dist/config/projectConfig.d.ts +41 -0
  121. package/dist/config/projectConfig.d.ts.map +1 -0
  122. package/dist/config/projectConfig.js +85 -0
  123. package/dist/config/projectConfig.js.map +1 -0
  124. package/dist/config/sessionStore.d.ts +44 -0
  125. package/dist/config/sessionStore.d.ts.map +1 -0
  126. package/dist/config/sessionStore.js +194 -0
  127. package/dist/config/sessionStore.js.map +1 -0
  128. package/dist/config/workflowLoader.d.ts +23 -0
  129. package/dist/config/workflowLoader.d.ts.map +1 -0
  130. package/dist/config/workflowLoader.js +142 -0
  131. package/dist/config/workflowLoader.js.map +1 -0
  132. package/dist/constants.d.ts +9 -0
  133. package/dist/constants.d.ts.map +1 -0
  134. package/dist/constants.js +8 -0
  135. package/dist/constants.js.map +1 -0
  136. package/dist/index.d.ts +13 -0
  137. package/dist/index.d.ts.map +1 -0
  138. package/dist/index.js +20 -0
  139. package/dist/index.js.map +1 -0
  140. package/dist/interactive/commands/agent.d.ts +7 -0
  141. package/dist/interactive/commands/agent.d.ts.map +1 -0
  142. package/dist/interactive/commands/agent.js +65 -0
  143. package/dist/interactive/commands/agent.js.map +1 -0
  144. package/dist/interactive/commands/basic.d.ts +7 -0
  145. package/dist/interactive/commands/basic.d.ts.map +1 -0
  146. package/dist/interactive/commands/basic.js +81 -0
  147. package/dist/interactive/commands/basic.js.map +1 -0
  148. package/dist/interactive/commands/index.d.ts +12 -0
  149. package/dist/interactive/commands/index.d.ts.map +1 -0
  150. package/dist/interactive/commands/index.js +14 -0
  151. package/dist/interactive/commands/index.js.map +1 -0
  152. package/dist/interactive/commands/registry.d.ts +41 -0
  153. package/dist/interactive/commands/registry.d.ts.map +1 -0
  154. package/dist/interactive/commands/registry.js +37 -0
  155. package/dist/interactive/commands/registry.js.map +1 -0
  156. package/dist/interactive/commands/session.d.ts +7 -0
  157. package/dist/interactive/commands/session.d.ts.map +1 -0
  158. package/dist/interactive/commands/session.js +75 -0
  159. package/dist/interactive/commands/session.js.map +1 -0
  160. package/dist/interactive/commands/task.d.ts +7 -0
  161. package/dist/interactive/commands/task.d.ts.map +1 -0
  162. package/dist/interactive/commands/task.js +156 -0
  163. package/dist/interactive/commands/task.js.map +1 -0
  164. package/dist/interactive/commands/workflow.d.ts +7 -0
  165. package/dist/interactive/commands/workflow.d.ts.map +1 -0
  166. package/dist/interactive/commands/workflow.js +56 -0
  167. package/dist/interactive/commands/workflow.js.map +1 -0
  168. package/dist/interactive/escape-tracker.d.ts +37 -0
  169. package/dist/interactive/escape-tracker.d.ts.map +1 -0
  170. package/dist/interactive/escape-tracker.js +52 -0
  171. package/dist/interactive/escape-tracker.js.map +1 -0
  172. package/dist/interactive/handlers.d.ts +24 -0
  173. package/dist/interactive/handlers.d.ts.map +1 -0
  174. package/dist/interactive/handlers.js +191 -0
  175. package/dist/interactive/handlers.js.map +1 -0
  176. package/dist/interactive/history-manager.d.ts +45 -0
  177. package/dist/interactive/history-manager.d.ts.map +1 -0
  178. package/dist/interactive/history-manager.js +91 -0
  179. package/dist/interactive/history-manager.js.map +1 -0
  180. package/dist/interactive/index.d.ts +8 -0
  181. package/dist/interactive/index.d.ts.map +1 -0
  182. package/dist/interactive/index.js +8 -0
  183. package/dist/interactive/index.js.map +1 -0
  184. package/dist/interactive/ink/components/App.d.ts +16 -0
  185. package/dist/interactive/ink/components/App.d.ts.map +1 -0
  186. package/dist/interactive/ink/components/App.js +123 -0
  187. package/dist/interactive/ink/components/App.js.map +1 -0
  188. package/dist/interactive/ink/components/AskUserQuestion.d.ts +16 -0
  189. package/dist/interactive/ink/components/AskUserQuestion.d.ts.map +1 -0
  190. package/dist/interactive/ink/components/AskUserQuestion.js +139 -0
  191. package/dist/interactive/ink/components/AskUserQuestion.js.map +1 -0
  192. package/dist/interactive/ink/components/Header.d.ts +20 -0
  193. package/dist/interactive/ink/components/Header.d.ts.map +1 -0
  194. package/dist/interactive/ink/components/Header.js +7 -0
  195. package/dist/interactive/ink/components/Header.js.map +1 -0
  196. package/dist/interactive/ink/components/HelpView.d.ts +13 -0
  197. package/dist/interactive/ink/components/HelpView.d.ts.map +1 -0
  198. package/dist/interactive/ink/components/HelpView.js +45 -0
  199. package/dist/interactive/ink/components/HelpView.js.map +1 -0
  200. package/dist/interactive/ink/components/IterationLimit.d.ts +19 -0
  201. package/dist/interactive/ink/components/IterationLimit.d.ts.map +1 -0
  202. package/dist/interactive/ink/components/IterationLimit.js +59 -0
  203. package/dist/interactive/ink/components/IterationLimit.js.map +1 -0
  204. package/dist/interactive/ink/components/ModalRouter.d.ts +11 -0
  205. package/dist/interactive/ink/components/ModalRouter.d.ts.map +1 -0
  206. package/dist/interactive/ink/components/ModalRouter.js +71 -0
  207. package/dist/interactive/ink/components/ModalRouter.js.map +1 -0
  208. package/dist/interactive/ink/components/PermissionPrompt.d.ts +17 -0
  209. package/dist/interactive/ink/components/PermissionPrompt.d.ts.map +1 -0
  210. package/dist/interactive/ink/components/PermissionPrompt.js +102 -0
  211. package/dist/interactive/ink/components/PermissionPrompt.js.map +1 -0
  212. package/dist/interactive/ink/components/PromptInput.d.ts +26 -0
  213. package/dist/interactive/ink/components/PromptInput.d.ts.map +1 -0
  214. package/dist/interactive/ink/components/PromptInput.js +70 -0
  215. package/dist/interactive/ink/components/PromptInput.js.map +1 -0
  216. package/dist/interactive/ink/components/Spinner.d.ts +14 -0
  217. package/dist/interactive/ink/components/Spinner.d.ts.map +1 -0
  218. package/dist/interactive/ink/components/Spinner.js +8 -0
  219. package/dist/interactive/ink/components/Spinner.js.map +1 -0
  220. package/dist/interactive/ink/components/StreamingOutput.d.ts +25 -0
  221. package/dist/interactive/ink/components/StreamingOutput.d.ts.map +1 -0
  222. package/dist/interactive/ink/components/StreamingOutput.js +8 -0
  223. package/dist/interactive/ink/components/StreamingOutput.js.map +1 -0
  224. package/dist/interactive/ink/components/UserInputPrompt.d.ts +18 -0
  225. package/dist/interactive/ink/components/UserInputPrompt.d.ts.map +1 -0
  226. package/dist/interactive/ink/components/UserInputPrompt.js +30 -0
  227. package/dist/interactive/ink/components/UserInputPrompt.js.map +1 -0
  228. package/dist/interactive/ink/components/WorkflowSelector.d.ts +18 -0
  229. package/dist/interactive/ink/components/WorkflowSelector.d.ts.map +1 -0
  230. package/dist/interactive/ink/components/WorkflowSelector.js +65 -0
  231. package/dist/interactive/ink/components/WorkflowSelector.js.map +1 -0
  232. package/dist/interactive/ink/constants.d.ts +8 -0
  233. package/dist/interactive/ink/constants.d.ts.map +1 -0
  234. package/dist/interactive/ink/constants.js +8 -0
  235. package/dist/interactive/ink/constants.js.map +1 -0
  236. package/dist/interactive/ink/context/AppContext.d.ts +26 -0
  237. package/dist/interactive/ink/context/AppContext.d.ts.map +1 -0
  238. package/dist/interactive/ink/context/AppContext.js +30 -0
  239. package/dist/interactive/ink/context/AppContext.js.map +1 -0
  240. package/dist/interactive/ink/context/appReducer.d.ts +13 -0
  241. package/dist/interactive/ink/context/appReducer.d.ts.map +1 -0
  242. package/dist/interactive/ink/context/appReducer.js +183 -0
  243. package/dist/interactive/ink/context/appReducer.js.map +1 -0
  244. package/dist/interactive/ink/context/types.d.ts +144 -0
  245. package/dist/interactive/ink/context/types.d.ts.map +1 -0
  246. package/dist/interactive/ink/context/types.js +5 -0
  247. package/dist/interactive/ink/context/types.js.map +1 -0
  248. package/dist/interactive/ink/hooks/keyDetection.d.ts +116 -0
  249. package/dist/interactive/ink/hooks/keyDetection.d.ts.map +1 -0
  250. package/dist/interactive/ink/hooks/keyDetection.js +183 -0
  251. package/dist/interactive/ink/hooks/keyDetection.js.map +1 -0
  252. package/dist/interactive/ink/hooks/multilineInputLogic.d.ts +50 -0
  253. package/dist/interactive/ink/hooks/multilineInputLogic.d.ts.map +1 -0
  254. package/dist/interactive/ink/hooks/multilineInputLogic.js +150 -0
  255. package/dist/interactive/ink/hooks/multilineInputLogic.js.map +1 -0
  256. package/dist/interactive/ink/hooks/useCommands.d.ts +20 -0
  257. package/dist/interactive/ink/hooks/useCommands.d.ts.map +1 -0
  258. package/dist/interactive/ink/hooks/useCommands.js +129 -0
  259. package/dist/interactive/ink/hooks/useCommands.js.map +1 -0
  260. package/dist/interactive/ink/hooks/useHistory.d.ts +28 -0
  261. package/dist/interactive/ink/hooks/useHistory.d.ts.map +1 -0
  262. package/dist/interactive/ink/hooks/useHistory.js +59 -0
  263. package/dist/interactive/ink/hooks/useHistory.js.map +1 -0
  264. package/dist/interactive/ink/hooks/useMultilineInput.d.ts +49 -0
  265. package/dist/interactive/ink/hooks/useMultilineInput.d.ts.map +1 -0
  266. package/dist/interactive/ink/hooks/useMultilineInput.js +106 -0
  267. package/dist/interactive/ink/hooks/useMultilineInput.js.map +1 -0
  268. package/dist/interactive/ink/hooks/usePermissionHandlers.d.ts +16 -0
  269. package/dist/interactive/ink/hooks/usePermissionHandlers.d.ts.map +1 -0
  270. package/dist/interactive/ink/hooks/usePermissionHandlers.js +172 -0
  271. package/dist/interactive/ink/hooks/usePermissionHandlers.js.map +1 -0
  272. package/dist/interactive/ink/hooks/useRawKeypress.d.ts +41 -0
  273. package/dist/interactive/ink/hooks/useRawKeypress.d.ts.map +1 -0
  274. package/dist/interactive/ink/hooks/useRawKeypress.js +79 -0
  275. package/dist/interactive/ink/hooks/useRawKeypress.js.map +1 -0
  276. package/dist/interactive/ink/hooks/useTaskQueue.d.ts +32 -0
  277. package/dist/interactive/ink/hooks/useTaskQueue.d.ts.map +1 -0
  278. package/dist/interactive/ink/hooks/useTaskQueue.js +68 -0
  279. package/dist/interactive/ink/hooks/useTaskQueue.js.map +1 -0
  280. package/dist/interactive/ink/hooks/useWorkflow.d.ts +45 -0
  281. package/dist/interactive/ink/hooks/useWorkflow.d.ts.map +1 -0
  282. package/dist/interactive/ink/hooks/useWorkflow.js +93 -0
  283. package/dist/interactive/ink/hooks/useWorkflow.js.map +1 -0
  284. package/dist/interactive/ink/hooks/useWorkflowExecution.d.ts +14 -0
  285. package/dist/interactive/ink/hooks/useWorkflowExecution.d.ts.map +1 -0
  286. package/dist/interactive/ink/hooks/useWorkflowExecution.js +144 -0
  287. package/dist/interactive/ink/hooks/useWorkflowExecution.js.map +1 -0
  288. package/dist/interactive/ink/index.d.ts +30 -0
  289. package/dist/interactive/ink/index.d.ts.map +1 -0
  290. package/dist/interactive/ink/index.js +33 -0
  291. package/dist/interactive/ink/index.js.map +1 -0
  292. package/dist/interactive/ink/utils/workflow.d.ts +11 -0
  293. package/dist/interactive/ink/utils/workflow.d.ts.map +1 -0
  294. package/dist/interactive/ink/utils/workflow.js +19 -0
  295. package/dist/interactive/ink/utils/workflow.js.map +1 -0
  296. package/dist/interactive/input-buffer.d.ts +67 -0
  297. package/dist/interactive/input-buffer.d.ts.map +1 -0
  298. package/dist/interactive/input-buffer.js +162 -0
  299. package/dist/interactive/input-buffer.js.map +1 -0
  300. package/dist/interactive/input-handlers.d.ts +50 -0
  301. package/dist/interactive/input-handlers.d.ts.map +1 -0
  302. package/dist/interactive/input-handlers.js +170 -0
  303. package/dist/interactive/input-handlers.js.map +1 -0
  304. package/dist/interactive/input.d.ts +43 -0
  305. package/dist/interactive/input.d.ts.map +1 -0
  306. package/dist/interactive/input.js +74 -0
  307. package/dist/interactive/input.js.map +1 -0
  308. package/dist/interactive/keyDetection.d.ts +85 -0
  309. package/dist/interactive/keyDetection.d.ts.map +1 -0
  310. package/dist/interactive/keyDetection.js +167 -0
  311. package/dist/interactive/keyDetection.js.map +1 -0
  312. package/dist/interactive/multilineInputLogic.d.ts +30 -0
  313. package/dist/interactive/multilineInputLogic.d.ts.map +1 -0
  314. package/dist/interactive/multilineInputLogic.js +143 -0
  315. package/dist/interactive/multilineInputLogic.js.map +1 -0
  316. package/dist/interactive/passthrough.d.ts +30 -0
  317. package/dist/interactive/passthrough.d.ts.map +1 -0
  318. package/dist/interactive/passthrough.js +94 -0
  319. package/dist/interactive/passthrough.js.map +1 -0
  320. package/dist/interactive/permission.d.ts +33 -0
  321. package/dist/interactive/permission.d.ts.map +1 -0
  322. package/dist/interactive/permission.js +231 -0
  323. package/dist/interactive/permission.js.map +1 -0
  324. package/dist/interactive/prompt.d.ts +33 -0
  325. package/dist/interactive/prompt.d.ts.map +1 -0
  326. package/dist/interactive/prompt.js +132 -0
  327. package/dist/interactive/prompt.js.map +1 -0
  328. package/dist/interactive/repl.d.ts +13 -0
  329. package/dist/interactive/repl.d.ts.map +1 -0
  330. package/dist/interactive/repl.js +202 -0
  331. package/dist/interactive/repl.js.map +1 -0
  332. package/dist/interactive/types.d.ts +35 -0
  333. package/dist/interactive/types.d.ts.map +1 -0
  334. package/dist/interactive/types.js +5 -0
  335. package/dist/interactive/types.js.map +1 -0
  336. package/dist/interactive/ui.d.ts +16 -0
  337. package/dist/interactive/ui.d.ts.map +1 -0
  338. package/dist/interactive/ui.js +122 -0
  339. package/dist/interactive/ui.js.map +1 -0
  340. package/dist/interactive/user-input.d.ts +26 -0
  341. package/dist/interactive/user-input.d.ts.map +1 -0
  342. package/dist/interactive/user-input.js +115 -0
  343. package/dist/interactive/user-input.js.map +1 -0
  344. package/dist/interactive/workflow-executor.d.ts +20 -0
  345. package/dist/interactive/workflow-executor.d.ts.map +1 -0
  346. package/dist/interactive/workflow-executor.js +200 -0
  347. package/dist/interactive/workflow-executor.js.map +1 -0
  348. package/dist/models/agent.d.ts +37 -0
  349. package/dist/models/agent.d.ts.map +1 -0
  350. package/dist/models/agent.js +11 -0
  351. package/dist/models/agent.js.map +1 -0
  352. package/dist/models/config.d.ts +19 -0
  353. package/dist/models/config.d.ts.map +1 -0
  354. package/dist/models/config.js +25 -0
  355. package/dist/models/config.js.map +1 -0
  356. package/dist/models/index.d.ts +7 -0
  357. package/dist/models/index.d.ts.map +1 -0
  358. package/dist/models/index.js +11 -0
  359. package/dist/models/index.js.map +1 -0
  360. package/dist/models/schemas.d.ts +161 -0
  361. package/dist/models/schemas.d.ts.map +1 -0
  362. package/dist/models/schemas.js +137 -0
  363. package/dist/models/schemas.js.map +1 -0
  364. package/dist/models/session.d.ts +50 -0
  365. package/dist/models/session.d.ts.map +1 -0
  366. package/dist/models/session.js +45 -0
  367. package/dist/models/session.js.map +1 -0
  368. package/dist/models/types.d.ts +117 -0
  369. package/dist/models/types.d.ts.map +1 -0
  370. package/dist/models/types.js +5 -0
  371. package/dist/models/types.js.map +1 -0
  372. package/dist/models/workflow.d.ts +58 -0
  373. package/dist/models/workflow.d.ts.map +1 -0
  374. package/dist/models/workflow.js +19 -0
  375. package/dist/models/workflow.js.map +1 -0
  376. package/dist/resources/index.d.ts +38 -0
  377. package/dist/resources/index.d.ts.map +1 -0
  378. package/dist/resources/index.js +108 -0
  379. package/dist/resources/index.js.map +1 -0
  380. package/dist/task/display.d.ts +11 -0
  381. package/dist/task/display.d.ts.map +1 -0
  382. package/dist/task/display.js +41 -0
  383. package/dist/task/display.js.map +1 -0
  384. package/dist/task/index.d.ts +6 -0
  385. package/dist/task/index.d.ts.map +1 -0
  386. package/dist/task/index.js +6 -0
  387. package/dist/task/index.js.map +1 -0
  388. package/dist/task/runner.d.ts +68 -0
  389. package/dist/task/runner.d.ts.map +1 -0
  390. package/dist/task/runner.js +172 -0
  391. package/dist/task/runner.js.map +1 -0
  392. package/dist/utils/debug.d.ts +32 -0
  393. package/dist/utils/debug.d.ts.map +1 -0
  394. package/dist/utils/debug.js +135 -0
  395. package/dist/utils/debug.js.map +1 -0
  396. package/dist/utils/error.d.ts +8 -0
  397. package/dist/utils/error.d.ts.map +1 -0
  398. package/dist/utils/error.js +10 -0
  399. package/dist/utils/error.js.map +1 -0
  400. package/dist/utils/index.d.ts +7 -0
  401. package/dist/utils/index.d.ts.map +1 -0
  402. package/dist/utils/index.js +7 -0
  403. package/dist/utils/index.js.map +1 -0
  404. package/dist/utils/notification.d.ts +63 -0
  405. package/dist/utils/notification.d.ts.map +1 -0
  406. package/dist/utils/notification.js +170 -0
  407. package/dist/utils/notification.js.map +1 -0
  408. package/dist/utils/session.d.ts +38 -0
  409. package/dist/utils/session.d.ts.map +1 -0
  410. package/dist/utils/session.js +97 -0
  411. package/dist/utils/session.js.map +1 -0
  412. package/dist/utils/ui.d.ts +91 -0
  413. package/dist/utils/ui.d.ts.map +1 -0
  414. package/dist/utils/ui.js +330 -0
  415. package/dist/utils/ui.js.map +1 -0
  416. package/dist/workflow/blocked-handler.d.ts +27 -0
  417. package/dist/workflow/blocked-handler.d.ts.map +1 -0
  418. package/dist/workflow/blocked-handler.js +40 -0
  419. package/dist/workflow/blocked-handler.js.map +1 -0
  420. package/dist/workflow/constants.d.ts +20 -0
  421. package/dist/workflow/constants.d.ts.map +1 -0
  422. package/dist/workflow/constants.js +20 -0
  423. package/dist/workflow/constants.js.map +1 -0
  424. package/dist/workflow/engine.d.ts +42 -0
  425. package/dist/workflow/engine.d.ts.map +1 -0
  426. package/dist/workflow/engine.js +207 -0
  427. package/dist/workflow/engine.js.map +1 -0
  428. package/dist/workflow/index.d.ts +15 -0
  429. package/dist/workflow/index.d.ts.map +1 -0
  430. package/dist/workflow/index.js +21 -0
  431. package/dist/workflow/index.js.map +1 -0
  432. package/dist/workflow/instruction-builder.d.ts +37 -0
  433. package/dist/workflow/instruction-builder.d.ts.map +1 -0
  434. package/dist/workflow/instruction-builder.js +49 -0
  435. package/dist/workflow/instruction-builder.js.map +1 -0
  436. package/dist/workflow/loop-detector.d.ts +31 -0
  437. package/dist/workflow/loop-detector.d.ts.map +1 -0
  438. package/dist/workflow/loop-detector.js +61 -0
  439. package/dist/workflow/loop-detector.js.map +1 -0
  440. package/dist/workflow/state-manager.d.ts +25 -0
  441. package/dist/workflow/state-manager.d.ts.map +1 -0
  442. package/dist/workflow/state-manager.js +59 -0
  443. package/dist/workflow/state-manager.js.map +1 -0
  444. package/dist/workflow/transitions.d.ts +25 -0
  445. package/dist/workflow/transitions.d.ts.map +1 -0
  446. package/dist/workflow/transitions.js +106 -0
  447. package/dist/workflow/transitions.js.map +1 -0
  448. package/dist/workflow/types.d.ts +74 -0
  449. package/dist/workflow/types.d.ts.map +1 -0
  450. package/dist/workflow/types.js +8 -0
  451. package/dist/workflow/types.js.map +1 -0
  452. package/package.json +67 -0
  453. package/resources/global/en/agents/default/architect.md +292 -0
  454. package/resources/global/en/agents/default/coder.md +169 -0
  455. package/resources/global/en/agents/default/security.md +206 -0
  456. package/resources/global/en/agents/default/supervisor.md +153 -0
  457. package/resources/global/en/agents/magi/balthasar.md +75 -0
  458. package/resources/global/en/agents/magi/casper.md +100 -0
  459. package/resources/global/en/agents/magi/melchior.md +74 -0
  460. package/resources/global/en/agents/research/digger.md +134 -0
  461. package/resources/global/en/agents/research/planner.md +125 -0
  462. package/resources/global/en/agents/research/supervisor.md +86 -0
  463. package/resources/global/en/config.yaml +19 -0
  464. package/resources/global/en/workflows/default.yaml +177 -0
  465. package/resources/global/en/workflows/magi.yaml +96 -0
  466. package/resources/global/en/workflows/research.yaml +112 -0
  467. package/resources/global/ja/agents/default/architect.md +292 -0
  468. package/resources/global/ja/agents/default/coder.md +170 -0
  469. package/resources/global/ja/agents/default/security.md +206 -0
  470. package/resources/global/ja/agents/default/supervisor.md +153 -0
  471. package/resources/global/ja/agents/magi/balthasar.md +75 -0
  472. package/resources/global/ja/agents/magi/casper.md +100 -0
  473. package/resources/global/ja/agents/magi/melchior.md +74 -0
  474. package/resources/global/ja/agents/research/digger.md +134 -0
  475. package/resources/global/ja/agents/research/planner.md +125 -0
  476. package/resources/global/ja/agents/research/supervisor.md +86 -0
  477. package/resources/global/ja/config.yaml +19 -0
  478. package/resources/global/ja/workflows/default.yaml +177 -0
  479. package/resources/global/ja/workflows/magi.yaml +96 -0
  480. package/resources/global/ja/workflows/research.yaml +112 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Masanobu Naruse
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,307 @@
1
+ # TAKT
2
+
3
+ **T**ask **A**gent **K**oordination **T**ool - Multi-agent orchestration system for Claude Code (Codex support planned).
4
+
5
+ > **Note**: This project is developed at my own pace. See [Disclaimer](#disclaimer) for details.
6
+
7
+ ## Requirements
8
+
9
+ - [Claude Code](https://docs.anthropic.com/en/docs/claude-code) must be installed and configured
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npm install -g takt
15
+ ```
16
+
17
+ ## Quick Start
18
+
19
+ ```bash
20
+ # Run a task (will prompt for workflow selection)
21
+ takt "Add a login feature"
22
+
23
+ # Switch workflow
24
+ takt /switch
25
+
26
+ # Run all pending tasks
27
+ takt /run-tasks
28
+ ```
29
+
30
+ ## Commands
31
+
32
+ | Command | Description |
33
+ |---------|-------------|
34
+ | `takt "task"` | Execute task with workflow selection |
35
+ | `takt -r "task"` | Execute task, resuming previous session |
36
+ | `takt /run-tasks` | Run all pending tasks |
37
+ | `takt /switch` | Switch workflow interactively |
38
+ | `takt /clear` | Clear agent conversation sessions |
39
+ | `takt /help` | Show help |
40
+
41
+ ## Workflows
42
+
43
+ TAKT uses YAML-based workflow definitions. Place them in:
44
+ - `~/.takt/workflows/*.yaml`
45
+
46
+ ### Example Workflow
47
+
48
+ ```yaml
49
+ name: default
50
+ max_iterations: 10
51
+
52
+ steps:
53
+ - name: implement
54
+ agent: coder
55
+ instruction_template: |
56
+ {task}
57
+ transitions:
58
+ - condition: done
59
+ next_step: review
60
+ - condition: blocked
61
+ next_step: ABORT
62
+
63
+ - name: review
64
+ agent: architect
65
+ transitions:
66
+ - condition: approved
67
+ next_step: COMPLETE
68
+ - condition: rejected
69
+ next_step: implement
70
+ ```
71
+
72
+ ## Built-in Agents
73
+
74
+ - **coder** - Implements features and fixes bugs
75
+ - **architect** - Reviews code and provides feedback
76
+ - **supervisor** - Final verification and approval
77
+
78
+ ## Custom Agents
79
+
80
+ Define custom agents in `.takt/agents.yaml`:
81
+
82
+ ```yaml
83
+ agents:
84
+ - name: my-reviewer
85
+ prompt_file: .takt/prompts/reviewer.md
86
+ allowed_tools: [Read, Glob, Grep]
87
+ status_patterns:
88
+ approved: "\\[APPROVE\\]"
89
+ rejected: "\\[REJECT\\]"
90
+ ```
91
+
92
+ ## Project Structure
93
+
94
+ ```
95
+ ~/.takt/
96
+ ├── config.yaml # Global config
97
+ ├── workflows/ # Workflow definitions
98
+ └── agents/ # Agent prompt files
99
+ ```
100
+
101
+ ## Practical Usage Guide
102
+
103
+ ### Resuming Sessions with `-r`
104
+
105
+ When TAKT prompts for additional input during execution (e.g., "Please provide more details"), use the `-r` flag to continue the conversation:
106
+
107
+ ```bash
108
+ # First run - agent might ask for clarification
109
+ takt "Fix the login bug"
110
+
111
+ # Resume the same session to provide the requested information
112
+ takt -r "The bug occurs when the password contains special characters"
113
+ ```
114
+
115
+ The `-r` flag preserves the agent's conversation history, allowing for natural back-and-forth interaction.
116
+
117
+ ### Playing with MAGI System
118
+
119
+ MAGI is a deliberation system inspired by Evangelion. Three AI personas analyze your question from different perspectives and vote:
120
+
121
+ ```bash
122
+ # Select 'magi' workflow when prompted
123
+ takt "Should we migrate from REST to GraphQL?"
124
+ ```
125
+
126
+ The three MAGI personas:
127
+ - **MELCHIOR-1** (Scientist): Logical, data-driven analysis
128
+ - **BALTHASAR-2** (Nurturer): Team and human-centered perspective
129
+ - **CASPER-3** (Pragmatist): Practical, real-world considerations
130
+
131
+ Each persona votes: APPROVE, REJECT, or CONDITIONAL. The final decision is made by majority vote.
132
+
133
+ ### Adding Custom Workflows
134
+
135
+ Create your own workflow by adding YAML files to `~/.takt/workflows/`:
136
+
137
+ ```yaml
138
+ # ~/.takt/workflows/my-workflow.yaml
139
+ name: my-workflow
140
+ description: My custom workflow
141
+
142
+ max_iterations: 5
143
+
144
+ steps:
145
+ - name: analyze
146
+ agent: ~/.takt/agents/my-agents/analyzer.md
147
+ instruction_template: |
148
+ Analyze this request: {task}
149
+ transitions:
150
+ - condition: done
151
+ next_step: implement
152
+
153
+ - name: implement
154
+ agent: ~/.takt/agents/default/coder.md
155
+ instruction_template: |
156
+ Implement based on the analysis: {previous_response}
157
+ pass_previous_response: true
158
+ transitions:
159
+ - condition: done
160
+ next_step: COMPLETE
161
+ ```
162
+
163
+ ### Specifying Agents by Path
164
+
165
+ Agents are specified using file paths in workflow definitions:
166
+
167
+ ```yaml
168
+ # Use built-in agents
169
+ agent: ~/.takt/agents/default/coder.md
170
+ agent: ~/.takt/agents/magi/melchior.md
171
+
172
+ # Use project-local agents
173
+ agent: ./.takt/agents/my-reviewer.md
174
+
175
+ # Use absolute paths
176
+ agent: /path/to/custom/agent.md
177
+ ```
178
+
179
+ Create custom agent prompts as Markdown files:
180
+
181
+ ```markdown
182
+ # ~/.takt/agents/my-agents/reviewer.md
183
+
184
+ You are a code reviewer focused on security.
185
+
186
+ ## Your Role
187
+ - Check for security vulnerabilities
188
+ - Verify input validation
189
+ - Review authentication logic
190
+
191
+ ## Output Format
192
+ - [REVIEWER:APPROVE] if code is secure
193
+ - [REVIEWER:REJECT] if issues found (list them)
194
+ ```
195
+
196
+ ### Using `/run-tasks` for Batch Processing
197
+
198
+ The `/run-tasks` command executes all task files in `.takt/tasks/` directory:
199
+
200
+ ```bash
201
+ # Create task files as you think of them
202
+ echo "Add unit tests for the auth module" > .takt/tasks/001-add-tests.md
203
+ echo "Refactor the database layer" > .takt/tasks/002-refactor-db.md
204
+ echo "Update API documentation" > .takt/tasks/003-update-docs.md
205
+
206
+ # Run all pending tasks
207
+ takt /run-tasks
208
+ ```
209
+
210
+ **How it works:**
211
+ - Tasks are executed in alphabetical order (use prefixes like `001-`, `002-` for ordering)
212
+ - Each task file should contain a description of what needs to be done
213
+ - Completed tasks are moved to `.takt/completed/` with execution reports
214
+ - New tasks added during execution will be picked up dynamically
215
+
216
+ **Task file format:**
217
+
218
+ ```markdown
219
+ # .takt/tasks/add-login-feature.md
220
+
221
+ Add a login feature to the application.
222
+
223
+ Requirements:
224
+ - Username and password fields
225
+ - Form validation
226
+ - Error handling for failed attempts
227
+ ```
228
+
229
+ This is perfect for:
230
+ - Brainstorming sessions where you capture ideas as files
231
+ - Breaking down large features into smaller tasks
232
+ - Automated pipelines that generate task files
233
+
234
+ ### Workflow Variables
235
+
236
+ Available variables in `instruction_template`:
237
+
238
+ | Variable | Description |
239
+ |----------|-------------|
240
+ | `{task}` | Original user request |
241
+ | `{iteration}` | Current iteration number |
242
+ | `{max_iterations}` | Maximum iterations |
243
+ | `{previous_response}` | Previous step's output (requires `pass_previous_response: true`) |
244
+ | `{user_inputs}` | Additional user inputs during workflow |
245
+ | `{git_diff}` | Current git diff (uncommitted changes) |
246
+
247
+ ## API Usage
248
+
249
+ ```typescript
250
+ import { WorkflowEngine, loadWorkflow } from 'takt'; // npm install takt
251
+
252
+ const config = loadWorkflow('default');
253
+ if (!config) {
254
+ throw new Error('Workflow not found');
255
+ }
256
+ const engine = new WorkflowEngine(config, process.cwd(), 'My task');
257
+
258
+ engine.on('step:complete', (step, response) => {
259
+ console.log(`${step.name}: ${response.status}`);
260
+ });
261
+
262
+ await engine.run();
263
+ ```
264
+
265
+ ## Disclaimer
266
+
267
+ This project is a personal project developed at my own pace.
268
+
269
+ - **Response times**: I may not be able to respond to issues immediately
270
+ - **Development style**: This project is primarily developed using "vibe coding" (AI-assisted development) - **use at your own risk**
271
+ - **Pull requests**:
272
+ - Small, focused PRs (bug fixes, typos, docs) are welcome
273
+ - Large PRs, especially AI-generated bulk changes, are difficult to review
274
+
275
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for more details.
276
+
277
+ ## Docker Support
278
+
279
+ Docker environment is provided for testing in other environments:
280
+
281
+ ```bash
282
+ # Build Docker images
283
+ docker compose build
284
+
285
+ # Run tests in container
286
+ docker compose run --rm test
287
+
288
+ # Run lint in container
289
+ docker compose run --rm lint
290
+
291
+ # Build only (skip tests)
292
+ docker compose run --rm build
293
+ ```
294
+
295
+ This ensures the project works correctly in a clean Node.js 20 environment.
296
+
297
+ ## Documentation
298
+
299
+ - 🇯🇵 [日本語ドキュメント](./docs/README.ja.md) - Japanese documentation
300
+ - [Workflow Guide](./docs/workflows.md) - Create and customize workflows
301
+ - [Agent Guide](./docs/agents.md) - Configure custom agents
302
+ - [Changelog](./CHANGELOG.md) - Version history
303
+ - [Security Policy](./SECURITY.md) - Vulnerability reporting
304
+
305
+ ## License
306
+
307
+ MIT - See [LICENSE](./LICENSE) for details.
package/bin/takt ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * TAKT CLI wrapper for npm global/local installation
5
+ *
6
+ * This wrapper script ensures takt can be run via:
7
+ * - npm install -g takt && takt
8
+ * - npx takt
9
+ * - npm exec takt
10
+ */
11
+
12
+ import { fileURLToPath } from 'node:url';
13
+ import { dirname, join } from 'node:path';
14
+
15
+ const __filename = fileURLToPath(import.meta.url);
16
+ const __dirname = dirname(__filename);
17
+
18
+ // Import the actual CLI from dist
19
+ const cliPath = join(__dirname, '..', 'dist', 'cli.js');
20
+
21
+ try {
22
+ await import(cliPath);
23
+ } catch (err) {
24
+ console.error('Failed to load TAKT CLI. Have you run "npm run build"?');
25
+ console.error(err.message);
26
+ process.exit(1);
27
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Agents module - exports agent execution utilities
3
+ */
4
+ export * from './runner.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,aAAa,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Agents module - exports agent execution utilities
3
+ */
4
+ export * from './runner.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,aAAa,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Agent execution runners
3
+ */
4
+ import { type StreamCallback, type PermissionHandler, type AskUserQuestionHandler } from '../claude/process.js';
5
+ import type { AgentResponse, CustomAgentConfig } from '../models/types.js';
6
+ export type { StreamCallback };
7
+ /** Common options for running agents */
8
+ export interface RunAgentOptions {
9
+ cwd: string;
10
+ sessionId?: string;
11
+ model?: string;
12
+ /** Resolved path to agent prompt file */
13
+ agentPath?: string;
14
+ onStream?: StreamCallback;
15
+ onPermissionRequest?: PermissionHandler;
16
+ onAskUserQuestion?: AskUserQuestionHandler;
17
+ /** Bypass all permission checks (sacrifice-my-pc mode) */
18
+ bypassPermissions?: boolean;
19
+ }
20
+ /** Get git diff for review context */
21
+ export declare function getGitDiff(cwd: string): string;
22
+ /** Run a custom agent */
23
+ export declare function runCustomAgent(agentConfig: CustomAgentConfig, task: string, options: RunAgentOptions): Promise<AgentResponse>;
24
+ /** Run an agent by name or path */
25
+ export declare function runAgent(agentSpec: string, task: string, options: RunAgentOptions): Promise<AgentResponse>;
26
+ //# sourceMappingURL=runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/agents/runner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEhH,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE3E,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B,wCAAwC;AACxC,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,mBAAmB,CAAC,EAAE,iBAAiB,CAAC;IACxC,iBAAiB,CAAC,EAAE,sBAAsB,CAAC;IAC3C,0DAA0D;IAC1D,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AASD,sCAAsC;AACtC,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAoB9C;AAED,yBAAyB;AACzB,wBAAsB,cAAc,CAClC,WAAW,EAAE,iBAAiB,EAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,aAAa,CAAC,CA8CxB;AAqCD,mCAAmC;AACnC,wBAAsB,QAAQ,CAC5B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,aAAa,CAAC,CAmCxB"}
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Agent execution runners
3
+ */
4
+ import { execSync } from 'node:child_process';
5
+ import { existsSync, readFileSync } from 'node:fs';
6
+ import { basename, dirname } from 'node:path';
7
+ import { callClaude, callClaudeCustom, callClaudeAgent, callClaudeSkill, } from '../claude/client.js';
8
+ import { loadCustomAgents, loadAgentPrompt } from '../config/loader.js';
9
+ /** Default tools for each built-in agent type */
10
+ const DEFAULT_AGENT_TOOLS = {
11
+ coder: ['Read', 'Glob', 'Grep', 'Edit', 'Write', 'Bash', 'WebSearch', 'WebFetch'],
12
+ architect: ['Read', 'Glob', 'Grep', 'WebSearch', 'WebFetch'],
13
+ supervisor: ['Read', 'Glob', 'Grep', 'Bash', 'WebSearch', 'WebFetch'],
14
+ };
15
+ /** Get git diff for review context */
16
+ export function getGitDiff(cwd) {
17
+ try {
18
+ // First check if HEAD exists (new repos may not have any commits)
19
+ try {
20
+ execSync('git rev-parse HEAD', { cwd, encoding: 'utf-8', stdio: 'pipe' });
21
+ }
22
+ catch {
23
+ // No commits yet, return empty diff
24
+ return '';
25
+ }
26
+ const diff = execSync('git diff HEAD', {
27
+ cwd,
28
+ encoding: 'utf-8',
29
+ maxBuffer: 1024 * 1024 * 10, // 10MB
30
+ stdio: 'pipe',
31
+ });
32
+ return diff.trim();
33
+ }
34
+ catch {
35
+ return '';
36
+ }
37
+ }
38
+ /** Run a custom agent */
39
+ export async function runCustomAgent(agentConfig, task, options) {
40
+ // If agent references a Claude Code agent
41
+ if (agentConfig.claudeAgent) {
42
+ const callOptions = {
43
+ cwd: options.cwd,
44
+ sessionId: options.sessionId,
45
+ allowedTools: agentConfig.allowedTools,
46
+ model: options.model || agentConfig.model,
47
+ onStream: options.onStream,
48
+ onPermissionRequest: options.onPermissionRequest,
49
+ onAskUserQuestion: options.onAskUserQuestion,
50
+ bypassPermissions: options.bypassPermissions,
51
+ };
52
+ return callClaudeAgent(agentConfig.claudeAgent, task, callOptions);
53
+ }
54
+ // If agent references a Claude Code skill
55
+ if (agentConfig.claudeSkill) {
56
+ const callOptions = {
57
+ cwd: options.cwd,
58
+ sessionId: options.sessionId,
59
+ allowedTools: agentConfig.allowedTools,
60
+ model: options.model || agentConfig.model,
61
+ onStream: options.onStream,
62
+ onPermissionRequest: options.onPermissionRequest,
63
+ onAskUserQuestion: options.onAskUserQuestion,
64
+ bypassPermissions: options.bypassPermissions,
65
+ };
66
+ return callClaudeSkill(agentConfig.claudeSkill, task, callOptions);
67
+ }
68
+ // Custom agent with prompt
69
+ const systemPrompt = loadAgentPrompt(agentConfig);
70
+ const callOptions = {
71
+ cwd: options.cwd,
72
+ sessionId: options.sessionId,
73
+ allowedTools: agentConfig.allowedTools || ['Read', 'Glob', 'Grep', 'WebSearch', 'WebFetch'],
74
+ model: options.model || agentConfig.model,
75
+ statusPatterns: agentConfig.statusPatterns,
76
+ onStream: options.onStream,
77
+ onPermissionRequest: options.onPermissionRequest,
78
+ onAskUserQuestion: options.onAskUserQuestion,
79
+ bypassPermissions: options.bypassPermissions,
80
+ };
81
+ return callClaudeCustom(agentConfig.name, task, systemPrompt, callOptions);
82
+ }
83
+ /**
84
+ * Load agent prompt from file path.
85
+ */
86
+ function loadAgentPromptFromPath(agentPath) {
87
+ if (!existsSync(agentPath)) {
88
+ throw new Error(`Agent file not found: ${agentPath}`);
89
+ }
90
+ return readFileSync(agentPath, 'utf-8');
91
+ }
92
+ /**
93
+ * Get agent name from path or spec.
94
+ * For agents in subdirectories, includes parent dir for pattern matching.
95
+ * - "~/.takt/agents/default/coder.md" -> "coder"
96
+ * - "~/.takt/agents/research/supervisor.md" -> "research/supervisor"
97
+ * - "./coder.md" -> "coder"
98
+ * - "coder" -> "coder"
99
+ */
100
+ function extractAgentName(agentSpec) {
101
+ if (!agentSpec.endsWith('.md')) {
102
+ return agentSpec;
103
+ }
104
+ const name = basename(agentSpec, '.md');
105
+ const dir = basename(dirname(agentSpec));
106
+ // If in 'default' directory, just use the agent name
107
+ // Otherwise, include the directory for disambiguation (e.g., 'research/supervisor')
108
+ if (dir === 'default' || dir === 'agents' || dir === '.') {
109
+ return name;
110
+ }
111
+ return `${dir}/${name}`;
112
+ }
113
+ /** Run an agent by name or path */
114
+ export async function runAgent(agentSpec, task, options) {
115
+ const agentName = extractAgentName(agentSpec);
116
+ // If agentPath is provided (from workflow), use it to load prompt
117
+ if (options.agentPath) {
118
+ if (!existsSync(options.agentPath)) {
119
+ throw new Error(`Agent file not found: ${options.agentPath}`);
120
+ }
121
+ const systemPrompt = loadAgentPromptFromPath(options.agentPath);
122
+ const tools = DEFAULT_AGENT_TOOLS[agentName] || ['Read', 'Glob', 'Grep', 'WebSearch', 'WebFetch'];
123
+ const callOptions = {
124
+ cwd: options.cwd,
125
+ sessionId: options.sessionId,
126
+ allowedTools: tools,
127
+ model: options.model,
128
+ systemPrompt,
129
+ onStream: options.onStream,
130
+ onPermissionRequest: options.onPermissionRequest,
131
+ onAskUserQuestion: options.onAskUserQuestion,
132
+ bypassPermissions: options.bypassPermissions,
133
+ };
134
+ return callClaude(agentName, task, callOptions);
135
+ }
136
+ // Fallback: Look for custom agent by name
137
+ const customAgents = loadCustomAgents();
138
+ const agentConfig = customAgents.get(agentName);
139
+ if (agentConfig) {
140
+ return runCustomAgent(agentConfig, task, options);
141
+ }
142
+ throw new Error(`Unknown agent: ${agentSpec}`);
143
+ }
144
+ //# sourceMappingURL=runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/agents/runner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,eAAe,GAEhB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAmBxE,iDAAiD;AACjD,MAAM,mBAAmB,GAA6B;IACpD,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC;IACjF,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC;IAC5D,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC;CACtE,CAAC;AAEF,sCAAsC;AACtC,MAAM,UAAU,UAAU,CAAC,GAAW;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AChB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,YAAY,EAAE,KAAK;YACnB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,YAAY;YACZ,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;YAChD,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;YAC5C,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;SAC7C,CAAC;QAEF,OAAO,UAAU,CAAC,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IAClD,CAAC;IAED,0CAA0C;IAC1C,MAAM,YAAY,GAAG,gBAAgB,EAAE,CAAC;IACxC,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAEhD,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,cAAc,CAAC,WAAW,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,kBAAkB,SAAS,EAAE,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * High-level Claude client for agent interactions
3
+ *
4
+ * Uses the Claude Agent SDK for native TypeScript integration.
5
+ */
6
+ import { type StreamCallback, type PermissionHandler, type AskUserQuestionHandler } from './process.js';
7
+ import type { AgentDefinition } from '@anthropic-ai/claude-agent-sdk';
8
+ import type { AgentResponse, Status } from '../models/types.js';
9
+ /** Options for calling Claude */
10
+ export interface ClaudeCallOptions {
11
+ cwd: string;
12
+ sessionId?: string;
13
+ allowedTools?: string[];
14
+ model?: string;
15
+ maxTurns?: number;
16
+ systemPrompt?: string;
17
+ statusPatterns?: Record<string, string>;
18
+ /** SDK agents to register for sub-agent execution */
19
+ agents?: Record<string, AgentDefinition>;
20
+ /** Enable streaming mode with callback for real-time output */
21
+ onStream?: StreamCallback;
22
+ /** Custom permission handler for interactive permission prompts */
23
+ onPermissionRequest?: PermissionHandler;
24
+ /** Custom handler for AskUserQuestion tool */
25
+ onAskUserQuestion?: AskUserQuestionHandler;
26
+ /** Bypass all permission checks (sacrifice-my-pc mode) */
27
+ bypassPermissions?: boolean;
28
+ }
29
+ /** Detect status from agent output content */
30
+ export declare function detectStatus(content: string, patterns: Record<string, string>): Status;
31
+ /** Validate regex pattern for ReDoS safety */
32
+ export declare function isRegexSafe(pattern: string): boolean;
33
+ /** Get status patterns for a built-in agent type */
34
+ export declare function getBuiltinStatusPatterns(agentType: string): Record<string, string>;
35
+ /** Call Claude with an agent prompt */
36
+ export declare function callClaude(agentType: string, prompt: string, options: ClaudeCallOptions): Promise<AgentResponse>;
37
+ /** Call Claude with a custom agent configuration */
38
+ export declare function callClaudeCustom(agentName: string, prompt: string, systemPrompt: string, options: ClaudeCallOptions): Promise<AgentResponse>;
39
+ /** Call a Claude Code built-in agent (using claude --agent flag if available) */
40
+ export declare function callClaudeAgent(claudeAgentName: string, prompt: string, options: ClaudeCallOptions): Promise<AgentResponse>;
41
+ /** Call a Claude Code skill (using /skill command) */
42
+ export declare function callClaudeSkill(skillName: string, prompt: string, options: ClaudeCallOptions): Promise<AgentResponse>;
43
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/claude/client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAA6C,KAAK,cAAc,EAAE,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACnJ,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGhE,iCAAiC;AACjC,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,KAAK,CAAC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