mastracode 0.0.1 → 0.1.0-alpha.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 (574) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/LICENSE.md +15 -0
  3. package/README.md +140 -6
  4. package/dist/agents/coding.d.ts +2 -0
  5. package/dist/agents/coding.d.ts.map +1 -0
  6. package/dist/agents/instructions.d.ts +6 -0
  7. package/dist/agents/instructions.d.ts.map +1 -0
  8. package/dist/agents/memory.d.ts +12 -0
  9. package/dist/agents/memory.d.ts.map +1 -0
  10. package/dist/agents/model.d.ts +21 -0
  11. package/dist/agents/model.d.ts.map +1 -0
  12. package/dist/agents/prompts/agent-instructions.d.ts +20 -0
  13. package/dist/agents/prompts/agent-instructions.d.ts.map +1 -0
  14. package/dist/agents/prompts/base.d.ts +19 -0
  15. package/dist/agents/prompts/base.d.ts.map +1 -0
  16. package/dist/agents/prompts/build.d.ts +12 -0
  17. package/dist/agents/prompts/build.d.ts.map +1 -0
  18. package/dist/agents/prompts/fast.d.ts +5 -0
  19. package/dist/agents/prompts/fast.d.ts.map +1 -0
  20. package/dist/agents/prompts/index.d.ts +21 -0
  21. package/dist/agents/prompts/index.d.ts.map +1 -0
  22. package/dist/agents/prompts/plan.d.ts +5 -0
  23. package/dist/agents/prompts/plan.d.ts.map +1 -0
  24. package/dist/agents/subagents/execute.d.ts +10 -0
  25. package/dist/agents/subagents/execute.d.ts.map +1 -0
  26. package/dist/agents/subagents/explore.d.ts +10 -0
  27. package/dist/agents/subagents/explore.d.ts.map +1 -0
  28. package/dist/agents/subagents/index.d.ts +29 -0
  29. package/dist/agents/subagents/index.d.ts.map +1 -0
  30. package/dist/agents/subagents/plan.d.ts +10 -0
  31. package/dist/agents/subagents/plan.d.ts.map +1 -0
  32. package/dist/agents/subagents/types.d.ts +22 -0
  33. package/dist/agents/subagents/types.d.ts.map +1 -0
  34. package/dist/agents/tools.d.ts +6 -0
  35. package/dist/agents/tools.d.ts.map +1 -0
  36. package/dist/agents/workspace.d.ts +6 -0
  37. package/dist/agents/workspace.d.ts.map +1 -0
  38. package/dist/auth/index.d.ts +7 -0
  39. package/dist/auth/index.d.ts.map +1 -0
  40. package/dist/auth/pkce.d.ts +13 -0
  41. package/dist/auth/pkce.d.ts.map +1 -0
  42. package/dist/auth/providers/anthropic.d.ts +17 -0
  43. package/dist/auth/providers/anthropic.d.ts.map +1 -0
  44. package/dist/auth/providers/openai-codex.d.ts +37 -0
  45. package/dist/auth/providers/openai-codex.d.ts.map +1 -0
  46. package/dist/auth/storage.d.ts +119 -0
  47. package/dist/auth/storage.d.ts.map +1 -0
  48. package/dist/auth/types.d.ts +48 -0
  49. package/dist/auth/types.d.ts.map +1 -0
  50. package/dist/chunk-QSBFHSWD.js +5633 -0
  51. package/dist/chunk-QSBFHSWD.js.map +1 -0
  52. package/dist/chunk-RAZEF2K6.cjs +110 -0
  53. package/dist/chunk-RAZEF2K6.cjs.map +1 -0
  54. package/dist/chunk-WQ5P4QLV.js +101 -0
  55. package/dist/chunk-WQ5P4QLV.js.map +1 -0
  56. package/dist/chunk-XEINW6IG.cjs +5674 -0
  57. package/dist/chunk-XEINW6IG.cjs.map +1 -0
  58. package/dist/cli.cjs +7513 -0
  59. package/dist/cli.cjs.map +1 -0
  60. package/dist/cli.js +7488 -0
  61. package/dist/cli.js.map +1 -0
  62. package/dist/clipboard/index.d.ts +16 -0
  63. package/dist/clipboard/index.d.ts.map +1 -0
  64. package/dist/constants.d.ts +4 -0
  65. package/dist/constants.d.ts.map +1 -0
  66. package/dist/hooks/config.d.ts +10 -0
  67. package/dist/hooks/config.d.ts.map +1 -0
  68. package/dist/hooks/executor.d.ts +13 -0
  69. package/dist/hooks/executor.d.ts.map +1 -0
  70. package/dist/hooks/index.d.ts +6 -0
  71. package/dist/hooks/index.d.ts.map +1 -0
  72. package/dist/hooks/manager.d.ts +27 -0
  73. package/dist/hooks/manager.d.ts.map +1 -0
  74. package/dist/hooks/types.d.ts +85 -0
  75. package/dist/hooks/types.d.ts.map +1 -0
  76. package/dist/index.cjs +12 -0
  77. package/dist/index.cjs.map +1 -0
  78. package/dist/index.d.ts +35 -0
  79. package/dist/index.d.ts.map +1 -0
  80. package/dist/index.js +3 -0
  81. package/dist/index.js.map +1 -0
  82. package/dist/ipc/ipc-reporter.d.ts +14 -0
  83. package/dist/ipc/ipc-reporter.d.ts.map +1 -0
  84. package/dist/lsp/client.d.ts +56 -0
  85. package/dist/lsp/client.d.ts.map +1 -0
  86. package/dist/lsp/index.d.ts +4 -0
  87. package/dist/lsp/index.d.ts.map +1 -0
  88. package/dist/lsp/language.d.ts +9 -0
  89. package/dist/lsp/language.d.ts.map +1 -0
  90. package/dist/lsp/manager.d.ts +34 -0
  91. package/dist/lsp/manager.d.ts.map +1 -0
  92. package/dist/lsp/server.d.ts +27 -0
  93. package/dist/lsp/server.d.ts.map +1 -0
  94. package/dist/lsp/workspace.d.ts +9 -0
  95. package/dist/lsp/workspace.d.ts.map +1 -0
  96. package/dist/main.d.ts +3 -0
  97. package/dist/main.d.ts.map +1 -0
  98. package/dist/mcp/config.d.ts +15 -0
  99. package/dist/mcp/config.d.ts.map +1 -0
  100. package/dist/mcp/index.d.ts +4 -0
  101. package/dist/mcp/index.d.ts.map +1 -0
  102. package/dist/mcp/manager.d.ts +57 -0
  103. package/dist/mcp/manager.d.ts.map +1 -0
  104. package/dist/mcp/types.d.ts +39 -0
  105. package/dist/mcp/types.d.ts.map +1 -0
  106. package/dist/permissions-5LKXYCOP.js +3 -0
  107. package/dist/permissions-5LKXYCOP.js.map +1 -0
  108. package/dist/permissions-DQKS6UWB.cjs +40 -0
  109. package/dist/permissions-DQKS6UWB.cjs.map +1 -0
  110. package/dist/permissions.d.ts +55 -0
  111. package/dist/permissions.d.ts.map +1 -0
  112. package/dist/providers/claude-max.d.ts +22 -0
  113. package/dist/providers/claude-max.d.ts.map +1 -0
  114. package/dist/providers/openai-codex.d.ts +28 -0
  115. package/dist/providers/openai-codex.d.ts.map +1 -0
  116. package/dist/schema.d.ts +50 -0
  117. package/dist/schema.d.ts.map +1 -0
  118. package/dist/tools/ast-smart-edit.d.ts +43 -0
  119. package/dist/tools/ast-smart-edit.d.ts.map +1 -0
  120. package/dist/tools/file-editor.d.ts +31 -0
  121. package/dist/tools/file-editor.d.ts.map +1 -0
  122. package/dist/tools/file-view.d.ts +11 -0
  123. package/dist/tools/file-view.d.ts.map +1 -0
  124. package/dist/tools/glob.d.ts +11 -0
  125. package/dist/tools/glob.d.ts.map +1 -0
  126. package/dist/tools/grep.d.ts +15 -0
  127. package/dist/tools/grep.d.ts.map +1 -0
  128. package/dist/tools/index.d.ts +18 -0
  129. package/dist/tools/index.d.ts.map +1 -0
  130. package/dist/tools/request-sandbox-access.d.ts +12 -0
  131. package/dist/tools/request-sandbox-access.d.ts.map +1 -0
  132. package/dist/tools/shell.d.ts +69 -0
  133. package/dist/tools/shell.d.ts.map +1 -0
  134. package/dist/tools/string-replace-lsp.d.ts +16 -0
  135. package/dist/tools/string-replace-lsp.d.ts.map +1 -0
  136. package/dist/tools/subagent.d.ts +44 -0
  137. package/dist/tools/subagent.d.ts.map +1 -0
  138. package/dist/tools/todo-check.d.ts +5 -0
  139. package/dist/tools/todo-check.d.ts.map +1 -0
  140. package/dist/tools/todo.d.ts +27 -0
  141. package/dist/tools/todo.d.ts.map +1 -0
  142. package/dist/tools/types.d.ts +4 -0
  143. package/dist/tools/types.d.ts.map +1 -0
  144. package/dist/tools/utils.d.ts +30 -0
  145. package/dist/tools/utils.d.ts.map +1 -0
  146. package/dist/tools/web-search.d.ts +35 -0
  147. package/dist/tools/web-search.d.ts.map +1 -0
  148. package/dist/tools/wrap-with-confirmation.d.ts +3 -0
  149. package/dist/tools/wrap-with-confirmation.d.ts.map +1 -0
  150. package/dist/tools/write.d.ts +11 -0
  151. package/dist/tools/write.d.ts.map +1 -0
  152. package/dist/tui/components/ask-question-dialog.d.ts +30 -0
  153. package/dist/tui/components/ask-question-dialog.d.ts.map +1 -0
  154. package/dist/tui/components/ask-question-inline.d.ts +41 -0
  155. package/dist/tui/components/ask-question-inline.d.ts.map +1 -0
  156. package/dist/tui/components/assistant-message.d.ts +18 -0
  157. package/dist/tui/components/assistant-message.d.ts.map +1 -0
  158. package/dist/tui/components/collapsible.d.ts +56 -0
  159. package/dist/tui/components/collapsible.d.ts.map +1 -0
  160. package/dist/tui/components/custom-editor.d.ts +25 -0
  161. package/dist/tui/components/custom-editor.d.ts.map +1 -0
  162. package/dist/tui/components/diff-output.d.ts +8 -0
  163. package/dist/tui/components/diff-output.d.ts.map +1 -0
  164. package/dist/tui/components/error-display.d.ts +36 -0
  165. package/dist/tui/components/error-display.d.ts.map +1 -0
  166. package/dist/tui/components/login-dialog.d.ts +34 -0
  167. package/dist/tui/components/login-dialog.d.ts.map +1 -0
  168. package/dist/tui/components/login-selector.d.ts +27 -0
  169. package/dist/tui/components/login-selector.d.ts.map +1 -0
  170. package/dist/tui/components/model-selector.d.ts +61 -0
  171. package/dist/tui/components/model-selector.d.ts.map +1 -0
  172. package/dist/tui/components/multi-step-progress.d.ts +67 -0
  173. package/dist/tui/components/multi-step-progress.d.ts.map +1 -0
  174. package/dist/tui/components/obi-loader.d.ts +37 -0
  175. package/dist/tui/components/obi-loader.d.ts.map +1 -0
  176. package/dist/tui/components/om-marker.d.ts +53 -0
  177. package/dist/tui/components/om-marker.d.ts.map +1 -0
  178. package/dist/tui/components/om-output.d.ts +28 -0
  179. package/dist/tui/components/om-output.d.ts.map +1 -0
  180. package/dist/tui/components/om-progress.d.ts +92 -0
  181. package/dist/tui/components/om-progress.d.ts.map +1 -0
  182. package/dist/tui/components/om-settings.d.ts +35 -0
  183. package/dist/tui/components/om-settings.d.ts.map +1 -0
  184. package/dist/tui/components/plan-approval-inline.d.ts +49 -0
  185. package/dist/tui/components/plan-approval-inline.d.ts.map +1 -0
  186. package/dist/tui/components/settings.d.ts +32 -0
  187. package/dist/tui/components/settings.d.ts.map +1 -0
  188. package/dist/tui/components/shell-output.d.ts +8 -0
  189. package/dist/tui/components/shell-output.d.ts.map +1 -0
  190. package/dist/tui/components/simple-progress.d.ts +66 -0
  191. package/dist/tui/components/simple-progress.d.ts.map +1 -0
  192. package/dist/tui/components/slash-command.d.ts +15 -0
  193. package/dist/tui/components/slash-command.d.ts.map +1 -0
  194. package/dist/tui/components/subagent-execution.d.ts +42 -0
  195. package/dist/tui/components/subagent-execution.d.ts.map +1 -0
  196. package/dist/tui/components/system-reminder.d.ts +12 -0
  197. package/dist/tui/components/system-reminder.d.ts.map +1 -0
  198. package/dist/tui/components/thinking-settings.d.ts +42 -0
  199. package/dist/tui/components/thinking-settings.d.ts.map +1 -0
  200. package/dist/tui/components/thread-selector.d.ts +44 -0
  201. package/dist/tui/components/thread-selector.d.ts.map +1 -0
  202. package/dist/tui/components/todo-progress.d.ts +27 -0
  203. package/dist/tui/components/todo-progress.d.ts.map +1 -0
  204. package/dist/tui/components/tool-approval-dialog.d.ts +44 -0
  205. package/dist/tui/components/tool-approval-dialog.d.ts.map +1 -0
  206. package/dist/tui/components/tool-execution-enhanced.d.ts +65 -0
  207. package/dist/tui/components/tool-execution-enhanced.d.ts.map +1 -0
  208. package/dist/tui/components/tool-execution-interface.d.ts +20 -0
  209. package/dist/tui/components/tool-execution-interface.d.ts.map +1 -0
  210. package/dist/tui/components/tool-validation-error.d.ts +30 -0
  211. package/dist/tui/components/tool-validation-error.d.ts.map +1 -0
  212. package/dist/tui/components/user-message.d.ts +9 -0
  213. package/dist/tui/components/user-message.d.ts.map +1 -0
  214. package/dist/tui/index.d.ts +15 -0
  215. package/dist/tui/index.d.ts.map +1 -0
  216. package/dist/tui/mastra-tui.d.ts +325 -0
  217. package/dist/tui/mastra-tui.d.ts.map +1 -0
  218. package/dist/tui/notify.d.ts +22 -0
  219. package/dist/tui/notify.d.ts.map +1 -0
  220. package/dist/tui/theme.d.ts +107 -0
  221. package/dist/tui/theme.d.ts.map +1 -0
  222. package/dist/utils/errors.d.ts +35 -0
  223. package/dist/utils/errors.d.ts.map +1 -0
  224. package/dist/utils/gateway-sync.d.ts +18 -0
  225. package/dist/utils/gateway-sync.d.ts.map +1 -0
  226. package/dist/utils/project.d.ts +96 -0
  227. package/dist/utils/project.d.ts.map +1 -0
  228. package/dist/utils/slash-command-loader.d.ts +43 -0
  229. package/dist/utils/slash-command-loader.d.ts.map +1 -0
  230. package/dist/utils/slash-command-processor.d.ts +14 -0
  231. package/dist/utils/slash-command-processor.d.ts.map +1 -0
  232. package/dist/utils/thread-lock.d.ts +26 -0
  233. package/dist/utils/thread-lock.d.ts.map +1 -0
  234. package/dist/utils/token-estimator.d.ts +3 -0
  235. package/dist/utils/token-estimator.d.ts.map +1 -0
  236. package/dist/wrap-with-confirmation-J4FUCPZJ.js +12 -0
  237. package/dist/wrap-with-confirmation-J4FUCPZJ.js.map +1 -0
  238. package/dist/wrap-with-confirmation-UACYYX4U.cjs +15 -0
  239. package/dist/wrap-with-confirmation-UACYYX4U.cjs.map +1 -0
  240. package/package.json +80 -102
  241. package/AGENTS.md +0 -27
  242. package/Dockerfile +0 -18
  243. package/bin/opencode +0 -84
  244. package/bunfig.toml +0 -4
  245. package/parsers-config.ts +0 -239
  246. package/script/build.ts +0 -167
  247. package/script/postinstall.mjs +0 -122
  248. package/script/publish-registries.ts +0 -187
  249. package/script/publish.ts +0 -70
  250. package/script/schema.ts +0 -47
  251. package/src/acp/README.md +0 -164
  252. package/src/acp/agent.ts +0 -1051
  253. package/src/acp/session.ts +0 -101
  254. package/src/acp/types.ts +0 -22
  255. package/src/agent/agent.ts +0 -398
  256. package/src/agent/generate.txt +0 -75
  257. package/src/agent/prompt/compaction.txt +0 -12
  258. package/src/agent/prompt/explore.txt +0 -18
  259. package/src/agent/prompt/summary.txt +0 -10
  260. package/src/agent/prompt/title.txt +0 -36
  261. package/src/auth/index.ts +0 -70
  262. package/src/bun/index.ts +0 -114
  263. package/src/bus/bus-event.ts +0 -43
  264. package/src/bus/global.ts +0 -10
  265. package/src/bus/index.ts +0 -105
  266. package/src/cli/bootstrap.ts +0 -17
  267. package/src/cli/cmd/acp.ts +0 -88
  268. package/src/cli/cmd/agent.ts +0 -256
  269. package/src/cli/cmd/auth.ts +0 -391
  270. package/src/cli/cmd/cmd.ts +0 -7
  271. package/src/cli/cmd/debug/config.ts +0 -15
  272. package/src/cli/cmd/debug/file.ts +0 -91
  273. package/src/cli/cmd/debug/index.ts +0 -43
  274. package/src/cli/cmd/debug/lsp.ts +0 -48
  275. package/src/cli/cmd/debug/ripgrep.ts +0 -83
  276. package/src/cli/cmd/debug/scrap.ts +0 -15
  277. package/src/cli/cmd/debug/skill.ts +0 -15
  278. package/src/cli/cmd/debug/snapshot.ts +0 -48
  279. package/src/cli/cmd/export.ts +0 -88
  280. package/src/cli/cmd/generate.ts +0 -38
  281. package/src/cli/cmd/github.ts +0 -1408
  282. package/src/cli/cmd/import.ts +0 -98
  283. package/src/cli/cmd/mcp.ts +0 -654
  284. package/src/cli/cmd/models.ts +0 -77
  285. package/src/cli/cmd/pr.ts +0 -112
  286. package/src/cli/cmd/run.ts +0 -368
  287. package/src/cli/cmd/serve.ts +0 -31
  288. package/src/cli/cmd/session.ts +0 -106
  289. package/src/cli/cmd/stats.ts +0 -298
  290. package/src/cli/cmd/tui/app.tsx +0 -686
  291. package/src/cli/cmd/tui/attach.ts +0 -30
  292. package/src/cli/cmd/tui/component/border.tsx +0 -21
  293. package/src/cli/cmd/tui/component/dialog-agent.tsx +0 -31
  294. package/src/cli/cmd/tui/component/dialog-command.tsx +0 -124
  295. package/src/cli/cmd/tui/component/dialog-mcp.tsx +0 -86
  296. package/src/cli/cmd/tui/component/dialog-model.tsx +0 -230
  297. package/src/cli/cmd/tui/component/dialog-provider.tsx +0 -224
  298. package/src/cli/cmd/tui/component/dialog-session-list.tsx +0 -102
  299. package/src/cli/cmd/tui/component/dialog-session-rename.tsx +0 -31
  300. package/src/cli/cmd/tui/component/dialog-stash.tsx +0 -86
  301. package/src/cli/cmd/tui/component/dialog-status.tsx +0 -162
  302. package/src/cli/cmd/tui/component/dialog-tag.tsx +0 -44
  303. package/src/cli/cmd/tui/component/dialog-theme-list.tsx +0 -50
  304. package/src/cli/cmd/tui/component/did-you-know.tsx +0 -85
  305. package/src/cli/cmd/tui/component/logo.tsx +0 -27
  306. package/src/cli/cmd/tui/component/prompt/autocomplete.tsx +0 -574
  307. package/src/cli/cmd/tui/component/prompt/history.tsx +0 -108
  308. package/src/cli/cmd/tui/component/prompt/index.tsx +0 -1117
  309. package/src/cli/cmd/tui/component/prompt/stash.tsx +0 -101
  310. package/src/cli/cmd/tui/component/tips.ts +0 -103
  311. package/src/cli/cmd/tui/component/todo-item.tsx +0 -32
  312. package/src/cli/cmd/tui/context/args.tsx +0 -14
  313. package/src/cli/cmd/tui/context/directory.ts +0 -13
  314. package/src/cli/cmd/tui/context/exit.tsx +0 -23
  315. package/src/cli/cmd/tui/context/helper.tsx +0 -25
  316. package/src/cli/cmd/tui/context/keybind.tsx +0 -101
  317. package/src/cli/cmd/tui/context/kv.tsx +0 -49
  318. package/src/cli/cmd/tui/context/local.tsx +0 -339
  319. package/src/cli/cmd/tui/context/prompt.tsx +0 -18
  320. package/src/cli/cmd/tui/context/route.tsx +0 -46
  321. package/src/cli/cmd/tui/context/sdk.tsx +0 -74
  322. package/src/cli/cmd/tui/context/sync.tsx +0 -372
  323. package/src/cli/cmd/tui/context/theme/aura.json +0 -69
  324. package/src/cli/cmd/tui/context/theme/ayu.json +0 -80
  325. package/src/cli/cmd/tui/context/theme/catppuccin-frappe.json +0 -233
  326. package/src/cli/cmd/tui/context/theme/catppuccin-macchiato.json +0 -233
  327. package/src/cli/cmd/tui/context/theme/catppuccin.json +0 -112
  328. package/src/cli/cmd/tui/context/theme/cobalt2.json +0 -228
  329. package/src/cli/cmd/tui/context/theme/cursor.json +0 -249
  330. package/src/cli/cmd/tui/context/theme/dracula.json +0 -219
  331. package/src/cli/cmd/tui/context/theme/everforest.json +0 -241
  332. package/src/cli/cmd/tui/context/theme/flexoki.json +0 -237
  333. package/src/cli/cmd/tui/context/theme/github.json +0 -233
  334. package/src/cli/cmd/tui/context/theme/gruvbox.json +0 -95
  335. package/src/cli/cmd/tui/context/theme/kanagawa.json +0 -77
  336. package/src/cli/cmd/tui/context/theme/lucent-orng.json +0 -227
  337. package/src/cli/cmd/tui/context/theme/material.json +0 -235
  338. package/src/cli/cmd/tui/context/theme/matrix.json +0 -77
  339. package/src/cli/cmd/tui/context/theme/mercury.json +0 -252
  340. package/src/cli/cmd/tui/context/theme/monokai.json +0 -221
  341. package/src/cli/cmd/tui/context/theme/nightowl.json +0 -221
  342. package/src/cli/cmd/tui/context/theme/nord.json +0 -223
  343. package/src/cli/cmd/tui/context/theme/one-dark.json +0 -84
  344. package/src/cli/cmd/tui/context/theme/orng.json +0 -245
  345. package/src/cli/cmd/tui/context/theme/palenight.json +0 -222
  346. package/src/cli/cmd/tui/context/theme/rosepine.json +0 -234
  347. package/src/cli/cmd/tui/context/theme/solarized.json +0 -223
  348. package/src/cli/cmd/tui/context/theme/synthwave84.json +0 -226
  349. package/src/cli/cmd/tui/context/theme/tokyonight.json +0 -243
  350. package/src/cli/cmd/tui/context/theme/vercel.json +0 -245
  351. package/src/cli/cmd/tui/context/theme/vesper.json +0 -218
  352. package/src/cli/cmd/tui/context/theme/zenburn.json +0 -223
  353. package/src/cli/cmd/tui/context/theme.tsx +0 -1109
  354. package/src/cli/cmd/tui/event.ts +0 -40
  355. package/src/cli/cmd/tui/routes/home.tsx +0 -140
  356. package/src/cli/cmd/tui/routes/session/dialog-fork-from-timeline.tsx +0 -64
  357. package/src/cli/cmd/tui/routes/session/dialog-message.tsx +0 -109
  358. package/src/cli/cmd/tui/routes/session/dialog-subagent.tsx +0 -26
  359. package/src/cli/cmd/tui/routes/session/dialog-timeline.tsx +0 -47
  360. package/src/cli/cmd/tui/routes/session/footer.tsx +0 -88
  361. package/src/cli/cmd/tui/routes/session/header.tsx +0 -141
  362. package/src/cli/cmd/tui/routes/session/index.tsx +0 -1885
  363. package/src/cli/cmd/tui/routes/session/sidebar.tsx +0 -322
  364. package/src/cli/cmd/tui/spawn.ts +0 -60
  365. package/src/cli/cmd/tui/thread.ts +0 -120
  366. package/src/cli/cmd/tui/ui/dialog-alert.tsx +0 -57
  367. package/src/cli/cmd/tui/ui/dialog-confirm.tsx +0 -83
  368. package/src/cli/cmd/tui/ui/dialog-help.tsx +0 -38
  369. package/src/cli/cmd/tui/ui/dialog-prompt.tsx +0 -77
  370. package/src/cli/cmd/tui/ui/dialog-select.tsx +0 -332
  371. package/src/cli/cmd/tui/ui/dialog.tsx +0 -170
  372. package/src/cli/cmd/tui/ui/spinner.ts +0 -368
  373. package/src/cli/cmd/tui/ui/toast.tsx +0 -100
  374. package/src/cli/cmd/tui/util/clipboard.ts +0 -127
  375. package/src/cli/cmd/tui/util/editor.ts +0 -32
  376. package/src/cli/cmd/tui/util/terminal.ts +0 -114
  377. package/src/cli/cmd/tui/worker.ts +0 -63
  378. package/src/cli/cmd/uninstall.ts +0 -344
  379. package/src/cli/cmd/upgrade.ts +0 -67
  380. package/src/cli/cmd/web.ts +0 -84
  381. package/src/cli/error.ts +0 -56
  382. package/src/cli/ui.ts +0 -84
  383. package/src/cli/upgrade.ts +0 -25
  384. package/src/command/index.ts +0 -80
  385. package/src/command/template/initialize.txt +0 -10
  386. package/src/command/template/review.txt +0 -97
  387. package/src/config/config.ts +0 -997
  388. package/src/config/markdown.ts +0 -41
  389. package/src/env/index.ts +0 -26
  390. package/src/file/ignore.ts +0 -83
  391. package/src/file/index.ts +0 -328
  392. package/src/file/ripgrep.ts +0 -393
  393. package/src/file/time.ts +0 -64
  394. package/src/file/watcher.ts +0 -103
  395. package/src/flag/flag.ts +0 -46
  396. package/src/format/formatter.ts +0 -315
  397. package/src/format/index.ts +0 -137
  398. package/src/global/index.ts +0 -52
  399. package/src/id/id.ts +0 -73
  400. package/src/ide/index.ts +0 -76
  401. package/src/index.ts +0 -158
  402. package/src/installation/index.ts +0 -196
  403. package/src/lsp/client.ts +0 -229
  404. package/src/lsp/index.ts +0 -485
  405. package/src/lsp/language.ts +0 -116
  406. package/src/lsp/server.ts +0 -1895
  407. package/src/mcp/auth.ts +0 -135
  408. package/src/mcp/index.ts +0 -654
  409. package/src/mcp/oauth-callback.ts +0 -200
  410. package/src/mcp/oauth-provider.ts +0 -154
  411. package/src/patch/index.ts +0 -622
  412. package/src/permission/index.ts +0 -199
  413. package/src/plugin/index.ts +0 -91
  414. package/src/project/bootstrap.ts +0 -31
  415. package/src/project/instance.ts +0 -78
  416. package/src/project/project.ts +0 -221
  417. package/src/project/state.ts +0 -65
  418. package/src/project/vcs.ts +0 -76
  419. package/src/provider/auth.ts +0 -143
  420. package/src/provider/models-macro.ts +0 -11
  421. package/src/provider/models.ts +0 -106
  422. package/src/provider/provider.ts +0 -1056
  423. package/src/provider/sdk/openai-compatible/src/README.md +0 -5
  424. package/src/provider/sdk/openai-compatible/src/index.ts +0 -2
  425. package/src/provider/sdk/openai-compatible/src/openai-compatible-provider.ts +0 -100
  426. package/src/provider/sdk/openai-compatible/src/responses/convert-to-openai-responses-input.ts +0 -303
  427. package/src/provider/sdk/openai-compatible/src/responses/map-openai-responses-finish-reason.ts +0 -22
  428. package/src/provider/sdk/openai-compatible/src/responses/openai-config.ts +0 -18
  429. package/src/provider/sdk/openai-compatible/src/responses/openai-error.ts +0 -22
  430. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-api-types.ts +0 -207
  431. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-language-model.ts +0 -1713
  432. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-prepare-tools.ts +0 -177
  433. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-settings.ts +0 -1
  434. package/src/provider/sdk/openai-compatible/src/responses/tool/code-interpreter.ts +0 -88
  435. package/src/provider/sdk/openai-compatible/src/responses/tool/file-search.ts +0 -128
  436. package/src/provider/sdk/openai-compatible/src/responses/tool/image-generation.ts +0 -115
  437. package/src/provider/sdk/openai-compatible/src/responses/tool/local-shell.ts +0 -65
  438. package/src/provider/sdk/openai-compatible/src/responses/tool/web-search-preview.ts +0 -104
  439. package/src/provider/sdk/openai-compatible/src/responses/tool/web-search.ts +0 -103
  440. package/src/provider/transform.ts +0 -455
  441. package/src/pty/index.ts +0 -231
  442. package/src/server/error.ts +0 -36
  443. package/src/server/project.ts +0 -79
  444. package/src/server/server.ts +0 -2642
  445. package/src/server/tui.ts +0 -71
  446. package/src/session/compaction.ts +0 -223
  447. package/src/session/index.ts +0 -458
  448. package/src/session/llm-mastra.ts +0 -412
  449. package/src/session/llm-shared.ts +0 -172
  450. package/src/session/llm.ts +0 -439
  451. package/src/session/message-v2.ts +0 -675
  452. package/src/session/message.ts +0 -189
  453. package/src/session/processor.ts +0 -171
  454. package/src/session/prompt/anthropic-20250930.txt +0 -166
  455. package/src/session/prompt/anthropic.txt +0 -105
  456. package/src/session/prompt/anthropic_spoof.txt +0 -1
  457. package/src/session/prompt/beast.txt +0 -147
  458. package/src/session/prompt/build-switch.txt +0 -5
  459. package/src/session/prompt/codex.txt +0 -318
  460. package/src/session/prompt/copilot-gpt-5.txt +0 -143
  461. package/src/session/prompt/gemini.txt +0 -155
  462. package/src/session/prompt/max-steps.txt +0 -16
  463. package/src/session/prompt/plan-reminder-anthropic.txt +0 -67
  464. package/src/session/prompt/plan.txt +0 -26
  465. package/src/session/prompt/polaris.txt +0 -107
  466. package/src/session/prompt/qwen.txt +0 -109
  467. package/src/session/prompt.ts +0 -1454
  468. package/src/session/retry.ts +0 -86
  469. package/src/session/revert.ts +0 -108
  470. package/src/session/status.ts +0 -76
  471. package/src/session/summary.ts +0 -194
  472. package/src/session/system.ts +0 -120
  473. package/src/session/todo.ts +0 -37
  474. package/src/share/share-next.ts +0 -194
  475. package/src/share/share.ts +0 -87
  476. package/src/shell/shell.ts +0 -67
  477. package/src/skill/index.ts +0 -1
  478. package/src/skill/skill.ts +0 -83
  479. package/src/snapshot/index.ts +0 -197
  480. package/src/storage/storage.ts +0 -226
  481. package/src/tool/bash.ts +0 -306
  482. package/src/tool/bash.txt +0 -158
  483. package/src/tool/batch.ts +0 -175
  484. package/src/tool/batch.txt +0 -24
  485. package/src/tool/codesearch.ts +0 -138
  486. package/src/tool/codesearch.txt +0 -12
  487. package/src/tool/edit.ts +0 -675
  488. package/src/tool/edit.txt +0 -10
  489. package/src/tool/glob.ts +0 -65
  490. package/src/tool/glob.txt +0 -6
  491. package/src/tool/grep.ts +0 -121
  492. package/src/tool/grep.txt +0 -8
  493. package/src/tool/invalid.ts +0 -17
  494. package/src/tool/ls.ts +0 -110
  495. package/src/tool/ls.txt +0 -1
  496. package/src/tool/lsp-diagnostics.ts +0 -26
  497. package/src/tool/lsp-diagnostics.txt +0 -1
  498. package/src/tool/lsp-hover.ts +0 -31
  499. package/src/tool/lsp-hover.txt +0 -1
  500. package/src/tool/lsp.ts +0 -87
  501. package/src/tool/lsp.txt +0 -19
  502. package/src/tool/multiedit.ts +0 -46
  503. package/src/tool/multiedit.txt +0 -41
  504. package/src/tool/patch.ts +0 -233
  505. package/src/tool/patch.txt +0 -1
  506. package/src/tool/read.ts +0 -219
  507. package/src/tool/read.txt +0 -12
  508. package/src/tool/registry.ts +0 -162
  509. package/src/tool/skill.ts +0 -100
  510. package/src/tool/task.ts +0 -136
  511. package/src/tool/task.txt +0 -60
  512. package/src/tool/todo.ts +0 -39
  513. package/src/tool/todoread.txt +0 -14
  514. package/src/tool/todowrite.txt +0 -167
  515. package/src/tool/tool.ts +0 -71
  516. package/src/tool/webfetch.ts +0 -187
  517. package/src/tool/webfetch.txt +0 -13
  518. package/src/tool/websearch.ts +0 -150
  519. package/src/tool/websearch.txt +0 -11
  520. package/src/tool/write.ts +0 -110
  521. package/src/tool/write.txt +0 -8
  522. package/src/util/archive.ts +0 -16
  523. package/src/util/color.ts +0 -19
  524. package/src/util/context.ts +0 -25
  525. package/src/util/defer.ts +0 -12
  526. package/src/util/eventloop.ts +0 -20
  527. package/src/util/filesystem.ts +0 -83
  528. package/src/util/fn.ts +0 -11
  529. package/src/util/iife.ts +0 -3
  530. package/src/util/keybind.ts +0 -102
  531. package/src/util/lazy.ts +0 -11
  532. package/src/util/locale.ts +0 -81
  533. package/src/util/lock.ts +0 -98
  534. package/src/util/log.ts +0 -180
  535. package/src/util/queue.ts +0 -32
  536. package/src/util/rpc.ts +0 -42
  537. package/src/util/scrap.ts +0 -10
  538. package/src/util/signal.ts +0 -12
  539. package/src/util/timeout.ts +0 -14
  540. package/src/util/token.ts +0 -7
  541. package/src/util/wildcard.ts +0 -54
  542. package/sst-env.d.ts +0 -9
  543. package/test/agent/agent.test.ts +0 -146
  544. package/test/bun.test.ts +0 -53
  545. package/test/cli/github-remote.test.ts +0 -80
  546. package/test/config/agent-color.test.ts +0 -66
  547. package/test/config/config.test.ts +0 -535
  548. package/test/config/markdown.test.ts +0 -89
  549. package/test/file/ignore.test.ts +0 -10
  550. package/test/fixture/fixture.ts +0 -34
  551. package/test/fixture/lsp/fake-lsp-server.js +0 -77
  552. package/test/ide/ide.test.ts +0 -82
  553. package/test/keybind.test.ts +0 -421
  554. package/test/lsp/client.test.ts +0 -95
  555. package/test/mcp/headers.test.ts +0 -153
  556. package/test/patch/patch.test.ts +0 -348
  557. package/test/preload.ts +0 -57
  558. package/test/project/project.test.ts +0 -72
  559. package/test/provider/provider.test.ts +0 -1809
  560. package/test/provider/transform.test.ts +0 -411
  561. package/test/session/retry.test.ts +0 -61
  562. package/test/session/session.test.ts +0 -71
  563. package/test/skill/skill.test.ts +0 -131
  564. package/test/snapshot/snapshot.test.ts +0 -939
  565. package/test/tool/__snapshots__/tool.test.ts.snap +0 -9
  566. package/test/tool/bash.test.ts +0 -434
  567. package/test/tool/grep.test.ts +0 -108
  568. package/test/tool/patch.test.ts +0 -259
  569. package/test/tool/read.test.ts +0 -42
  570. package/test/util/iife.test.ts +0 -36
  571. package/test/util/lazy.test.ts +0 -50
  572. package/test/util/timeout.test.ts +0 -21
  573. package/test/util/wildcard.test.ts +0 -55
  574. package/tsconfig.json +0 -16
package/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # mastracode
2
+
3
+ ## 0.1.0-alpha.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Migrated MastraCode from the prototype harness to the generic CoreHarness from @mastra/core. The createMastraCode function is now fully configurable with optional parameters for modes, subagents, storage, tools, and more. Removed the deprecated prototype harness implementation. ([#13245](https://github.com/mastra-ai/mastra/pull/13245))
8
+
9
+ ### Patch Changes
10
+
11
+ - Added generic Harness class to @mastra/core for orchestrating agents with modes, state management, built-in tools (ask_user, submit_plan), subagent support, Observational Memory integration, model discovery, and permission-aware tool approval. The Harness provides a reusable foundation for building agent-powered applications with features like thread management, heartbeat monitoring, and event-driven architecture. ([#13245](https://github.com/mastra-ai/mastra/pull/13245))
12
+
13
+ - Updated dependencies [[`252580a`](https://github.com/mastra-ai/mastra/commit/252580a71feb0e46d0ccab04a70a79ff6a2ee0ab), [`f8e819f`](https://github.com/mastra-ai/mastra/commit/f8e819fabdfdc43d2da546a3ad81ba23685f603d), [`f8e819f`](https://github.com/mastra-ai/mastra/commit/f8e819fabdfdc43d2da546a3ad81ba23685f603d), [`5c75261`](https://github.com/mastra-ai/mastra/commit/5c7526120d936757d4ffb7b82232e1641ebd45cb), [`e27d832`](https://github.com/mastra-ai/mastra/commit/e27d83281b5e166fd63a13969689e928d8605944), [`e37ef84`](https://github.com/mastra-ai/mastra/commit/e37ef8404043c94ca0c8e35ecdedb093b8087878), [`6fdd3d4`](https://github.com/mastra-ai/mastra/commit/6fdd3d451a07a8e7e216c62ac364f8dd8e36c2af), [`10cf521`](https://github.com/mastra-ai/mastra/commit/10cf52183344743a0d7babe24cd24fd78870c354), [`6fdd3d4`](https://github.com/mastra-ai/mastra/commit/6fdd3d451a07a8e7e216c62ac364f8dd8e36c2af), [`efdb682`](https://github.com/mastra-ai/mastra/commit/efdb682887f6522149769383908f9790c188ab88), [`0dee7a0`](https://github.com/mastra-ai/mastra/commit/0dee7a0ff4c2507e6eb6e6ee5f9738877ebd4ad1), [`04c2c8e`](https://github.com/mastra-ai/mastra/commit/04c2c8e888984364194131aecb490a3d6e920e61), [`02dc07a`](https://github.com/mastra-ai/mastra/commit/02dc07acc4ad42d93335825e3308f5b42266eba2), [`8650e4d`](https://github.com/mastra-ai/mastra/commit/8650e4d3579a2c3a13e2dba7ec6ee7c82c7f61a8), [`bd222d3`](https://github.com/mastra-ai/mastra/commit/bd222d39e292bfcc4a2d9a9e6ec3976cc5a4f22f), [`bb7262b`](https://github.com/mastra-ai/mastra/commit/bb7262b7c0ca76320d985b40510b6ffbbb936582), [`cf1c6e7`](https://github.com/mastra-ai/mastra/commit/cf1c6e789b131f55638fed52183a89d5078b4876), [`5ffadfe`](https://github.com/mastra-ai/mastra/commit/5ffadfefb1468ac2612b20bb84d24c39de6961c0), [`1e1339c`](https://github.com/mastra-ai/mastra/commit/1e1339cc276e571a48cfff5014487877086bfe68), [`ffa5468`](https://github.com/mastra-ai/mastra/commit/ffa546857fc4821753979b3a34e13b4d76fbbcd4), [`d03df73`](https://github.com/mastra-ai/mastra/commit/d03df73f8fe9496064a33e1c3b74ba0479bf9ee6), [`79b8f45`](https://github.com/mastra-ai/mastra/commit/79b8f45a6767e1a5c3d56cd3c5b1214326b81661), [`9bbf08e`](https://github.com/mastra-ai/mastra/commit/9bbf08e3c20731c79dea13a765895b9fcf29cbf1), [`0a25952`](https://github.com/mastra-ai/mastra/commit/0a259526b5e1ac11e6efa53db1f140272962af2d), [`ffa5468`](https://github.com/mastra-ai/mastra/commit/ffa546857fc4821753979b3a34e13b4d76fbbcd4), [`3264a04`](https://github.com/mastra-ai/mastra/commit/3264a04e30340c3c5447433300a035ea0878df85), [`6fdd3d4`](https://github.com/mastra-ai/mastra/commit/6fdd3d451a07a8e7e216c62ac364f8dd8e36c2af), [`6fdd3d4`](https://github.com/mastra-ai/mastra/commit/6fdd3d451a07a8e7e216c62ac364f8dd8e36c2af), [`088d9ba`](https://github.com/mastra-ai/mastra/commit/088d9ba2577518703c52b0dccd617178d9ee6b0d), [`74fbebd`](https://github.com/mastra-ai/mastra/commit/74fbebd918a03832a2864965a8bea59bf617d3a2), [`74fbebd`](https://github.com/mastra-ai/mastra/commit/74fbebd918a03832a2864965a8bea59bf617d3a2), [`aea6217`](https://github.com/mastra-ai/mastra/commit/aea621790bfb2291431b08da0cc5e6e150303ae7), [`b6a855e`](https://github.com/mastra-ai/mastra/commit/b6a855edc056e088279075506442ba1d6fa6def9), [`ae408ea`](https://github.com/mastra-ai/mastra/commit/ae408ea7128f0d2710b78d8623185198e7cb19c1), [`17e942e`](https://github.com/mastra-ai/mastra/commit/17e942eee2ba44985b1f807e6208cdde672f82f9), [`2015cf9`](https://github.com/mastra-ai/mastra/commit/2015cf921649f44c3f5bcd32a2c052335f8e49b4), [`7ef454e`](https://github.com/mastra-ai/mastra/commit/7ef454eaf9dcec6de60021c8f42192052dd490d6), [`2be1d99`](https://github.com/mastra-ai/mastra/commit/2be1d99564ce79acc4846071082bff353035a87a), [`2708fa1`](https://github.com/mastra-ai/mastra/commit/2708fa1055ac91c03e08b598869f6b8fb51fa37f), [`ba74aef`](https://github.com/mastra-ai/mastra/commit/ba74aef5716142dbbe931351f5243c9c6e4128a9), [`ba74aef`](https://github.com/mastra-ai/mastra/commit/ba74aef5716142dbbe931351f5243c9c6e4128a9), [`ec53e89`](https://github.com/mastra-ai/mastra/commit/ec53e8939c76c638991e21af762e51378eff7543), [`9b5a8cb`](https://github.com/mastra-ai/mastra/commit/9b5a8cb13e120811b0bf14140ada314f1c067894), [`607e66b`](https://github.com/mastra-ai/mastra/commit/607e66b02dc7f531ee37799f3456aa2dc0ca7ac5), [`a215d06`](https://github.com/mastra-ai/mastra/commit/a215d06758dcf590eabfe0b7afd4ae39bdbf082c), [`6909c74`](https://github.com/mastra-ai/mastra/commit/6909c74a7781e0447d475e9dbc1dc871b700f426), [`192438f`](https://github.com/mastra-ai/mastra/commit/192438f8a90c4f375e955f8ff179bf8dc6821a83)]:
14
+ - @mastra/core@1.5.0-alpha.0
15
+ - @mastra/memory@1.4.0-alpha.0
16
+ - @mastra/libsql@1.5.0-alpha.0
package/LICENSE.md ADDED
@@ -0,0 +1,15 @@
1
+ # Apache License 2.0
2
+
3
+ Copyright (c) 2025 Kepler Software, Inc.
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
package/README.md CHANGED
@@ -1,15 +1,149 @@
1
- # js
1
+ # Mastra Code
2
2
 
3
- To install dependencies:
3
+ A terminal-based coding agent TUI built with [Mastra](https://mastra.ai) and [pi-tui](https://github.com/badlogic/pi-mono).
4
+
5
+ ## Features
6
+
7
+ - 🤖 **Multi-model support** - Use Claude, GPT, Gemini, and 70+ other models via Mastra's unified model router
8
+ - 🔐 **OAuth login** - Authenticate with Anthropic (Claude Max) and OpenAI (ChatGPT Plus/Codex)
9
+ - 💾 **Persistent conversations** - Threads are saved per-project and resume automatically
10
+ - 🛠️ **Coding tools** - View files, edit code, run shell commands
11
+ - 📊 **Token tracking** - Monitor usage with persistent token counts per thread
12
+ - 🎨 **Beautiful TUI** - Polished terminal interface with streaming responses
13
+
14
+ ## Installation
15
+
16
+ Clone the repository and install its dependencies.
17
+
18
+ ```bash
19
+ # Clone the repository
20
+ git clone https://github.com/mastra-ai/mastra.git
21
+ cd mastracode
22
+
23
+ # Install dependencies
24
+ pnpm install
25
+ ```
26
+
27
+ To use Mastra Code, we recommend creating an alias in your shell configuration to launch it from any directory. You have to specify the absolute path to `main.ts` and then run it with `tsx`.
4
28
 
5
29
  ```bash
6
- bun install
30
+ # Add this to your .bashrc, .zshrc, etc.
31
+ alias mastracode="pnpm dlx tsx /absolute/path/mastracode/src/main.ts"
32
+ ```
33
+
34
+ Lastly, start the TUI and execute the `/login` command to authenticate with your AI providers.
35
+
36
+ ## Usage
37
+
38
+ ### Starting a conversation
39
+
40
+ Simply type your message and press Enter. The agent will respond with streaming text.
41
+
42
+ ### Slash commands
43
+
44
+ | Command | Description |
45
+ | ---------- | ----------------------------------------- |
46
+ | `/new` | Start a new conversation thread |
47
+ | `/threads` | List all threads for this project |
48
+ | `/models` | Select a different AI model |
49
+ | `/cost` | Show token usage for current conversation |
50
+ | `/login` | Authenticate with OAuth providers |
51
+ | `/logout` | Log out from a provider |
52
+ | `/help` | Show available commands |
53
+ | `/exit` | Exit the TUI |
54
+
55
+ ### Keyboard shortcuts
56
+
57
+ | Shortcut | Action |
58
+ | -------- | --------------------------------- |
59
+ | `Ctrl+C` | Interrupt current operation |
60
+ | `Ctrl+D` | Exit (when editor is empty) |
61
+ | `Ctrl+T` | Toggle thinking blocks visibility |
62
+ | `Ctrl+E` | Expand/collapse all tool outputs |
63
+
64
+ ## Configuration
65
+
66
+ ### Project-based threads
67
+
68
+ Threads are automatically scoped to your project based on:
69
+
70
+ 1. Git remote URL (if available)
71
+ 2. Absolute path (fallback)
72
+
73
+ This means conversations are shared across clones, worktrees, and SSH/HTTPS URLs of the same repository.
74
+
75
+ ### Database location
76
+
77
+ The SQLite database is stored in your system's application data directory:
78
+
79
+ - **macOS**: `~/Library/Application Support/mastracode/`
80
+ - **Linux**: `~/.local/share/mastracode/`
81
+ - **Windows**: `%APPDATA%/mastracode/`
82
+
83
+ ### Authentication
84
+
85
+ OAuth credentials are stored alongside the database in `auth.json`.
86
+
87
+ ## Architecture
88
+
89
+ ```
90
+ ┌─────────────────────────────────────────────────────────────┐
91
+ │ TUI │
92
+ │ (pi-tui components: Editor, Markdown, Loader, etc.) │
93
+ └─────────────────────────────────────────────────────────────┘
94
+
95
+
96
+ ┌─────────────────────────────────────────────────────────────┐
97
+ │ Harness │
98
+ │ - Mode management (plan, build, review) │
99
+ │ - Thread/message persistence │
100
+ │ - Event system for TUI updates │
101
+ │ - State management with Zod schemas │
102
+ └─────────────────────────────────────────────────────────────┘
103
+
104
+
105
+ ┌─────────────────────────────────────────────────────────────┐
106
+ │ Mastra Agent │
107
+ │ - Dynamic model selection │
108
+ │ - Tool execution (view, edit, bash) │
109
+ │ - Memory integration │
110
+ └─────────────────────────────────────────────────────────────┘
111
+
112
+
113
+ ┌─────────────────────────────────────────────────────────────┐
114
+ │ LibSQL Storage │
115
+ │ - Thread persistence │
116
+ │ - Message history │
117
+ │ - Token usage tracking │
118
+ └─────────────────────────────────────────────────────────────┘
7
119
  ```
8
120
 
9
- To run:
121
+ ## Development
10
122
 
11
123
  ```bash
12
- bun run index.ts
124
+ # Run in development mode (with watch)
125
+ pnpm dev
126
+
127
+ # Type check
128
+ pnpm typecheck
129
+
130
+ # Build
131
+ pnpm build
13
132
  ```
14
133
 
15
- This project was created using `bun init` in bun v1.2.12. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
134
+ ## Roadmap
135
+
136
+ - [ ] Tool approval UI for dangerous operations
137
+ - [ ] Streaming tool output
138
+ - [ ] More tools (search, grep, etc.)
139
+ - [ ] Multi-agent collaboration (network mode)
140
+
141
+ ## Credits
142
+
143
+ - [Mastra](https://mastra.ai) - AI agent framework
144
+ - [pi-mono](https://github.com/badlogic/pi-mono) - TUI primitives and inspiration
145
+ - [OpenCode](https://github.com/sst/opencode) - OAuth provider patterns
146
+
147
+ ## License
148
+
149
+ Apache-2.0
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=coding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coding.d.ts","sourceRoot":"","sources":["../../src/agents/coding.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export declare function getDynamicInstructions({ requestContext }: {
2
+ requestContext: {
3
+ get(key: string): unknown;
4
+ };
5
+ }): string;
6
+ //# sourceMappingURL=instructions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../../src/agents/instructions.ts"],"names":[],"mappings":"AAKA,wBAAgB,sBAAsB,CAAC,EAAE,cAAc,EAAE,EAAE;IAAE,cAAc,EAAE;QAAE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAA;CAAE,UAoB3G"}
@@ -0,0 +1,12 @@
1
+ import type { RequestContext } from '@mastra/core/request-context';
2
+ import type { MastraCompositeStore } from '@mastra/core/storage';
3
+ import { Memory } from '@mastra/memory';
4
+ /**
5
+ * Dynamic memory factory function.
6
+ * Reads OM thresholds from harness state via requestContext.
7
+ * Model functions also read from requestContext (no mutable bridge needed).
8
+ */
9
+ export declare function getDynamicMemory(storage: MastraCompositeStore): ({ requestContext }: {
10
+ requestContext: RequestContext;
11
+ }) => Memory;
12
+ //# sourceMappingURL=memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/agents/memory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAmCxC;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,IACpD,oBAAoB;IAAE,cAAc,EAAE,cAAc,CAAA;CAAE,YA4C/D"}
@@ -0,0 +1,21 @@
1
+ import type { LanguageModelV1 } from '@ai-sdk/provider';
2
+ import type { MastraLanguageModel } from '@mastra/core/agent';
3
+ import type { RequestContext } from '@mastra/core/request-context';
4
+ /**
5
+ * Resolve a model ID to the correct provider instance.
6
+ * Shared by the main agent, observer, and reflector.
7
+ *
8
+ * - For anthropic/* models: Uses Claude Max OAuth provider (opencode auth)
9
+ * - For openai/* models with OAuth: Uses OpenAI Codex OAuth provider
10
+ * - For moonshotai/* models: Uses Moonshot AI Anthropic-compatible endpoint
11
+ * - For all other providers: Uses Mastra's model router (models.dev gateway)
12
+ */
13
+ export declare function resolveModel(modelId: string): LanguageModelV1 | MastraLanguageModel;
14
+ /**
15
+ * Dynamic model function that reads the current model from harness state.
16
+ * This allows runtime model switching via the /models picker.
17
+ */
18
+ export declare function getDynamicModel({ requestContext, }: {
19
+ requestContext: RequestContext;
20
+ }): LanguageModelV1 | MastraLanguageModel;
21
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/agents/model.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAQnE;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,GAAG,mBAAmB,CAqBnF;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC9B,cAAc,GACf,EAAE;IACD,cAAc,EAAE,cAAc,CAAC;CAChC,GAAG,eAAe,GAAG,mBAAmB,CASxC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Load project and global agent instruction files (AGENT.md, CLAUDE.md).
3
+ * Prefers AGENT.md over CLAUDE.md when both exist at the same location.
4
+ */
5
+ interface InstructionSource {
6
+ path: string;
7
+ content: string;
8
+ scope: 'global' | 'project';
9
+ }
10
+ /**
11
+ * Load all agent instruction files from global and project locations.
12
+ * Returns an array of instruction sources, with global ones first.
13
+ */
14
+ export declare function loadAgentInstructions(projectPath: string): InstructionSource[];
15
+ /**
16
+ * Format loaded instructions into a string for the system prompt.
17
+ */
18
+ export declare function formatAgentInstructions(sources: InstructionSource[]): string;
19
+ export {};
20
+ //# sourceMappingURL=agent-instructions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-instructions.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/agent-instructions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkBH,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC7B;AAgBD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAuC9E;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAS5E"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Base system prompt — shared behavioral instructions for all modes.
3
+ * This is the "brain" that makes the agent a good coding assistant.
4
+ */
5
+ export interface PromptContext {
6
+ projectPath: string;
7
+ projectName: string;
8
+ gitBranch?: string;
9
+ platform: string;
10
+ date: string;
11
+ mode: string;
12
+ activePlan?: {
13
+ title: string;
14
+ plan: string;
15
+ approvedAt: string;
16
+ } | null;
17
+ }
18
+ export declare function buildBasePrompt(ctx: PromptContext): string;
19
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/base.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACzE;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CA8I1D"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Build mode prompt — full tool access, make changes and verify.
3
+ */
4
+ import type { PromptContext } from './base.js';
5
+ /**
6
+ * Dynamic build mode prompt function.
7
+ * When an approved plan exists in state, prepends it so the agent
8
+ * knows exactly what to implement.
9
+ */
10
+ export declare function buildModePromptFn(ctx: PromptContext): string;
11
+ export declare const buildModePrompt = "\n# Build Mode\n\nYou are in BUILD mode. You have full access to all tools and can read, write, edit, and execute commands.\n\n## Working Style\n\n**For simple tasks** (typo fixes, small edits, single-file changes):\n- Just do it. No need to explain your plan first.\n\n**For non-trivial tasks** (3+ files, architectural decisions, unclear requirements):\n- Use todo_write to track your steps\n- Work on ONE step at a time \u2014 complete it and verify it works before moving on\n- If the approach is risky or ambiguous, ask the user before proceeding\n\n## The Implementation Loop\n\nFor each change you make:\n\n1. **Understand** \u2014 Read the relevant code. Check how similar things are done elsewhere.\n2. **Implement** \u2014 Make the change. Follow existing patterns and conventions.\n3. **Verify** \u2014 Test that it works. Don't assume \u2014 actually run it.\n4. **Clean up** \u2014 Ensure no broken code, no debug statements, no half-done features.\n\nOnly move to the next change after the current one is verified working.\n\n## Verification is Required\n\nBefore considering any task complete:\n- Run relevant tests (check package.json for test scripts)\n- For TypeScript, run `tsc --noEmit` to catch type errors\n- If there are no automated tests, manually verify the behavior works as expected\n- Use todo_check to ensure all tracked tasks are done\n\n**Don't mark something as done until you've verified it actually works.**\n\n## Error Recovery\n\nWhen something breaks:\n1. Read the full error output carefully \u2014 don't guess\n2. Find the root cause, not just the symptom\n3. Fix it properly \u2014 no casts or suppressions to hide errors\n4. Re-run to confirm the fix\n5. If stuck after 2 attempts, tell the user what you've tried\n\n## Git in Build Mode\n\n- Don't commit unless asked \u2014 just report what you changed\n- Before committing, verify the code compiles and passes lint\n- Use descriptive branch names: `feat/...`, `fix/...`, `refactor/...`\n";
12
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/build.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAiB5D;AAED,eAAO,MAAM,eAAe,m8DAkD3B,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Fast mode prompt — quick answers and small edits, minimal overhead.
3
+ */
4
+ export declare const fastModePrompt = "\n# Fast Mode\n\nYou are in FAST mode. Optimize for speed and brevity.\n\n## Rules\n- Keep responses short. Under 200 words unless the task genuinely requires more.\n- Skip planning. Just do the task directly.\n- For questions: give the direct answer, not a tutorial.\n- For edits: make the change, show what you did, move on.\n- Don't explore the codebase more than necessary for the immediate task.\n\n## When to Use Tools vs. Just Answer\n- If the user asks a general programming question, answer directly from knowledge. Don't search the codebase.\n- If the user asks about THIS project's code, use tools to look it up \u2014 don't guess.\n- If the user asks for a quick edit and you know the file, read it and edit it. Don't ask for confirmation.\n- One tool call to read + one to edit is ideal. Minimize round trips.\n";
5
+ //# sourceMappingURL=fast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fast.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/fast.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,cAAc,6zBAiB1B,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Prompt system — exports the prompt builder and mode-specific prompts.
3
+ */
4
+ export { buildBasePrompt } from './base.js';
5
+ export { buildModePrompt, buildModePromptFn } from './build.js';
6
+ export { planModePrompt } from './plan.js';
7
+ export { fastModePrompt } from './fast.js';
8
+ import type { PromptContext as BasePromptContext } from './base.js';
9
+ export interface PromptContext extends BasePromptContext {
10
+ modeId: string;
11
+ state?: any;
12
+ currentDate: string;
13
+ workingDir: string;
14
+ availableTools?: string;
15
+ }
16
+ /**
17
+ * Build the full system prompt for a given mode and context.
18
+ * Combines the base prompt with mode-specific instructions.
19
+ */
20
+ export declare function buildFullPrompt(ctx: PromptContext): string;
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAI3C,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAMpE,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAQD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAsC1D"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Plan mode prompt — read-only exploration and planning.
3
+ */
4
+ export declare const planModePrompt = "\n# Plan Mode \u2014 READ-ONLY\n\nYou are in PLAN mode. Your job is to explore the codebase and design an implementation plan \u2014 NOT to make changes.\n\n## CRITICAL: Read-Only Mode\n\nThis mode is **strictly read-only**. You must NOT modify anything.\n\n**Allowed tools:**\n- `view` \u2014 read files and directories\n- `grep` \u2014 search file contents\n- `glob` \u2014 find files by pattern\n- `execute_command` \u2014 ONLY for read-only commands (git status, git log, git diff, etc.)\n- `submit_plan` \u2014 submit your completed plan\n\n**Prohibited actions:**\n- Do NOT use `string_replace_lsp` or `write_file` \u2014 no file modifications\n- Do NOT use `execute_command` for anything that changes state (no git commit, no npm install, no file creation)\n- Do NOT create, delete, or modify any files\n- Do NOT run build commands, tests, or scripts that have side effects\n\nIf the user asks you to make changes while in Plan mode, explain that you're in read-only mode and they should switch to Build mode (`/mode build`) first.\n\n## Exploration Strategy\n\nBefore writing any plan, build a mental model of the codebase:\n1. Start with the directory structure (`view` on the project root or relevant subdirectory).\n2. Find the relevant entry points and core files using `grep` and `glob`.\n3. Read the actual code \u2014 don't assume based on file names alone.\n4. Trace data flow: where does input come from, how is it transformed, where does it go?\n5. Identify existing patterns the codebase uses (naming, structure, error handling, testing).\n\n## Your Plan Output\n\nProduce a clear, step-by-step plan with this structure:\n\n### Overview\nOne paragraph: what the change does and why.\n\n### Complexity Estimate\n- **Size**: Small (1-2 files) / Medium (3-5 files) / Large (6+ files)\n- **Risk**: Low (additive, no breaking changes) / Medium (modifies existing behavior) / High (architectural, affects many consumers)\n- **Dependencies**: List any new packages, external services, or migration steps needed.\n\n### Steps\nFor each step:\n1. **File**: path to create or modify\n2. **Change**: what to add/modify/remove, with enough specificity to implement directly\n3. **Why**: brief rationale connecting this step to the overall goal\n\n### Verification\n- What tests to run\n- What to check manually\n- What could go wrong\n\n## When Done\n\nWhen your plan is complete, call the `submit_plan` tool with:\n- **title**: A short descriptive title (e.g., \"Add dark mode toggle\")\n- **plan**: The full plan in markdown, using the structure above (Overview, Complexity, Steps, Verification)\n\nThe user will see the plan rendered inline and can:\n- **Approve** \u2014 automatically switches to Build mode for implementation\n- **Reject** \u2014 stays in Plan mode\n- **Request changes** \u2014 provides feedback for you to revise and resubmit\n\nDo NOT start implementing until the plan is approved. If rejected with feedback, revise the plan and call `submit_plan` again.\n";
5
+ //# sourceMappingURL=plan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/plan.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,cAAc,i7FAoE1B,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Execute subagent — focused task execution with write capabilities.
3
+ *
4
+ * This subagent is given a specific implementation task and uses both
5
+ * read and write tools to complete it. It can modify files, run commands,
6
+ * and perform actual development work within a constrained scope.
7
+ */
8
+ import type { SubagentDefinition } from './types.js';
9
+ export declare const executeSubagent: SubagentDefinition;
10
+ //# sourceMappingURL=execute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/agents/subagents/execute.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,eAAO,MAAM,eAAe,EAAE,kBAkD7B,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Explore subagent — read-only codebase exploration.
3
+ *
4
+ * This subagent is given a focused task (e.g., "find all usages of X",
5
+ * "understand how module Y works") and uses read-only tools to explore
6
+ * the codebase, then returns a concise summary of its findings.
7
+ */
8
+ import type { SubagentDefinition } from './types.js';
9
+ export declare const exploreSubagent: SubagentDefinition;
10
+ //# sourceMappingURL=explore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"explore.d.ts","sourceRoot":"","sources":["../../../src/agents/subagents/explore.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,eAAO,MAAM,eAAe,EAAE,kBA8B7B,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { SubagentDefinition } from './types.js';
2
+ /**
3
+ * Look up a subagent definition by ID.
4
+ * Returns undefined if not found.
5
+ */
6
+ export declare function getSubagentDefinition(id: string): SubagentDefinition | undefined;
7
+ /**
8
+ * Get all registered subagent IDs (for tool description / validation).
9
+ */
10
+ export declare function getSubagentIds(): string[];
11
+ export declare function getSubagentTools(projectPath: string): {
12
+ tool: import("@mastra/core/tools").Tool<{
13
+ agentType: string;
14
+ task: string;
15
+ modelId?: string | undefined;
16
+ }, {
17
+ content: string;
18
+ isError: boolean;
19
+ }, unknown, unknown, import("@mastra/core/tools").ToolExecutionContext<unknown, unknown, unknown>, "subagent", unknown>;
20
+ toolReadOnly: import("@mastra/core/tools").Tool<{
21
+ agentType: string;
22
+ task: string;
23
+ modelId?: string | undefined;
24
+ }, {
25
+ content: string;
26
+ isError: boolean;
27
+ }, unknown, unknown, import("@mastra/core/tools").ToolExecutionContext<unknown, unknown, unknown>, "subagent", unknown>;
28
+ };
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agents/subagents/index.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AASrD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAEhF;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,EAAE,CAEzC;AAED,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM;;;;;;;;;;;;;;;;;EA0CnD"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Plan subagent — read-only analysis and planning.
3
+ *
4
+ * This subagent is given a task to analyze and produces a structured
5
+ * implementation plan. It can read the codebase to understand existing
6
+ * patterns and architecture, but cannot modify anything.
7
+ */
8
+ import type { SubagentDefinition } from './types.js';
9
+ export declare const planSubagent: SubagentDefinition;
10
+ //# sourceMappingURL=plan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../src/agents/subagents/plan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,eAAO,MAAM,YAAY,EAAE,kBAgC1B,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Subagent type definitions.
3
+ *
4
+ * A subagent is a lightweight Agent instance with a constrained tool set,
5
+ * spawned by the parent agent via the `task` meta-tool. Each subagent runs
6
+ * in its own conversation thread and returns a single text result.
7
+ */
8
+ export interface SubagentDefinition {
9
+ /** Unique identifier for this subagent type (e.g., "explore", "plan") */
10
+ id: string;
11
+ /** Human-readable name shown in tool output */
12
+ name: string;
13
+ /** System prompt for this subagent */
14
+ instructions: string;
15
+ /**
16
+ * Which tool IDs this subagent may use.
17
+ * These are keys from the parent agent's tool registry
18
+ * (e.g., "view", "search_content", "find_files").
19
+ */
20
+ allowedTools: string[];
21
+ }
22
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/agents/subagents/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,kBAAkB;IACjC,yEAAyE;IACzE,EAAE,EAAE,MAAM,CAAC;IAEX,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IAEb,sCAAsC;IACtC,YAAY,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB"}
@@ -0,0 +1,6 @@
1
+ import type { RequestContext } from '@mastra/core/request-context';
2
+ import type { MCPManager } from '../mcp/index.js';
3
+ export declare function createDynamicTools(mcpManager?: MCPManager): ({ requestContext }: {
4
+ requestContext: RequestContext;
5
+ }) => Record<string, any>;
6
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/agents/tools.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAkBzC,wBAAgB,kBAAkB,CAAC,UAAU,CAAC,EAAE,UAAU,IACxB,oBAAoB;IAAE,cAAc,EAAE,cAAc,CAAA;CAAE,yBAkDvF"}
@@ -0,0 +1,6 @@
1
+ import type { RequestContext } from '@mastra/core/request-context';
2
+ import { Workspace, LocalFilesystem, LocalSandbox } from '@mastra/core/workspace';
3
+ export declare function getDynamicWorkspace({ requestContext }: {
4
+ requestContext: RequestContext;
5
+ }): Workspace<LocalFilesystem, LocalSandbox, undefined>;
6
+ //# sourceMappingURL=workspace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/agents/workspace.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAyElF,wBAAgB,mBAAmB,CAAC,EAAE,cAAc,EAAE,EAAE;IAAE,cAAc,EAAE,cAAc,CAAA;CAAE,uDA6BzF"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * OAuth credential management for AI providers.
3
+ */
4
+ export * from './types.js';
5
+ export * from './storage.js';
6
+ export { anthropicOAuthProvider } from './providers/anthropic.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * PKCE utilities using Web Crypto API.
3
+ * Works in both Node.js 20+ and browsers.
4
+ */
5
+ /**
6
+ * Generate PKCE code verifier and challenge.
7
+ * Uses Web Crypto API for cross-platform compatibility.
8
+ */
9
+ export declare function generatePKCE(): Promise<{
10
+ verifier: string;
11
+ challenge: string;
12
+ }>;
13
+ //# sourceMappingURL=pkce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pkce.d.ts","sourceRoot":"","sources":["../../src/auth/pkce.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH;;;GAGG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,CAaD"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Anthropic OAuth flow (Claude Pro/Max)
3
+ *
4
+ * Inspired by pi-mono's OAuth implementation:
5
+ * https://github.com/badlogic/pi-mono/blob/main/packages/ai/src/utils/oauth/anthropic.ts
6
+ */
7
+ import type { OAuthCredentials, OAuthProviderInterface } from '../types.js';
8
+ /**
9
+ * Login with Anthropic OAuth (device code flow)
10
+ */
11
+ export declare function loginAnthropic(onAuthUrl: (url: string) => void, onPromptCode: () => Promise<string>): Promise<OAuthCredentials>;
12
+ /**
13
+ * Refresh Anthropic OAuth token
14
+ */
15
+ export declare function refreshAnthropicToken(refreshToken: string): Promise<OAuthCredentials>;
16
+ export declare const anthropicOAuthProvider: OAuthProviderInterface;
17
+ //# sourceMappingURL=anthropic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../../src/auth/providers/anthropic.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAuB,sBAAsB,EAAE,MAAM,aAAa,CAAC;AASjG;;GAEG;AACH,wBAAsB,cAAc,CAClC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,EAChC,YAAY,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,GAClC,OAAO,CAAC,gBAAgB,CAAC,CA6D3B;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA2B3F;AAED,eAAO,MAAM,sBAAsB,EAAE,sBAkBpC,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * OpenAI Codex (ChatGPT OAuth) flow
3
+ *
4
+ * Inspired by pi-mono's OAuth implementation:
5
+ * https://github.com/badlogic/pi-mono/blob/main/packages/ai/src/utils/oauth/openai-codex.ts
6
+ *
7
+ * NOTE: This module uses Node.js crypto and http for the OAuth callback.
8
+ * It is only intended for CLI use, not browser environments.
9
+ */
10
+ import type { OAuthCredentials, OAuthPrompt, OAuthProviderInterface } from '../types.js';
11
+ /**
12
+ * Login with OpenAI Codex OAuth
13
+ *
14
+ * @param options.onAuth - Called with URL and instructions when auth starts
15
+ * @param options.onPrompt - Called to prompt user for manual code paste (fallback if no onManualCodeInput)
16
+ * @param options.onProgress - Optional progress messages
17
+ * @param options.onManualCodeInput - Optional promise that resolves with user-pasted code.
18
+ * Races with browser callback - whichever completes first wins.
19
+ * Useful for showing paste input immediately alongside browser flow.
20
+ * @param options.originator - OAuth originator parameter (defaults to "pi")
21
+ */
22
+ export declare function loginOpenAICodex(options: {
23
+ onAuth: (info: {
24
+ url: string;
25
+ instructions?: string;
26
+ }) => void;
27
+ onPrompt: (prompt: OAuthPrompt) => Promise<string>;
28
+ onProgress?: (message: string) => void;
29
+ onManualCodeInput?: () => Promise<string>;
30
+ originator?: string;
31
+ }): Promise<OAuthCredentials>;
32
+ /**
33
+ * Refresh OpenAI Codex OAuth token
34
+ */
35
+ export declare function refreshOpenAICodexToken(refreshToken: string): Promise<OAuthCredentials>;
36
+ export declare const openaiCodexOAuthProvider: OAuthProviderInterface;
37
+ //# sourceMappingURL=openai-codex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai-codex.d.ts","sourceRoot":"","sources":["../../../src/auth/providers/openai-codex.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgBH,OAAO,KAAK,EAAE,gBAAgB,EAAuB,WAAW,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAyR9G;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE;IAC9C,MAAM,EAAE,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC/D,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACnD,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAsG5B;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAiB7F;AAED,eAAO,MAAM,wBAAwB,EAAE,sBAqBtC,CAAC"}