tarsk 0.4.4 → 0.4.6

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 (366) hide show
  1. package/dist/index.js +447375 -37
  2. package/package.json +2 -2
  3. package/dist/agent/agent.error-utils.d.ts +0 -14
  4. package/dist/agent/agent.error-utils.js +0 -52
  5. package/dist/agent/agent.event-transformer.d.ts +0 -55
  6. package/dist/agent/agent.event-transformer.js +0 -175
  7. package/dist/agent/agent.executor.d.ts +0 -26
  8. package/dist/agent/agent.executor.js +0 -286
  9. package/dist/agent/agent.model-resolver.d.ts +0 -22
  10. package/dist/agent/agent.model-resolver.js +0 -67
  11. package/dist/agent/agent.process-manager.d.ts +0 -57
  12. package/dist/agent/agent.process-manager.js +0 -262
  13. package/dist/agent/agent.processing-state-manager.d.ts +0 -74
  14. package/dist/agent/agent.processing-state-manager.js +0 -87
  15. package/dist/agent/agent.prompt-loader.d.ts +0 -16
  16. package/dist/agent/agent.prompt-loader.js +0 -227
  17. package/dist/agent/agent.subagent-executor.d.ts +0 -35
  18. package/dist/agent/agent.subagent-executor.js +0 -135
  19. package/dist/bun/index.d.ts +0 -2
  20. package/dist/bun/index.js +0 -165
  21. package/dist/cli.d.ts +0 -3
  22. package/dist/cli.js +0 -22
  23. package/dist/core/crypto.d.ts +0 -29
  24. package/dist/core/crypto.js +0 -166
  25. package/dist/core/dev-server-cache.d.ts +0 -46
  26. package/dist/core/dev-server-cache.js +0 -59
  27. package/dist/core/env-manager.d.ts +0 -3
  28. package/dist/core/env-manager.js +0 -60
  29. package/dist/core/error-responses.d.ts +0 -61
  30. package/dist/core/error-responses.js +0 -64
  31. package/dist/core/logger.d.ts +0 -10
  32. package/dist/core/logger.js +0 -47
  33. package/dist/core/paths.d.ts +0 -22
  34. package/dist/core/paths.js +0 -26
  35. package/dist/core/random-words.d.ts +0 -18
  36. package/dist/core/random-words.js +0 -135
  37. package/dist/core/response-builder.d.ts +0 -50
  38. package/dist/core/response-builder.js +0 -56
  39. package/dist/core/route-helpers.d.ts +0 -47
  40. package/dist/core/route-helpers.js +0 -54
  41. package/dist/core/run-command-detector.d.ts +0 -26
  42. package/dist/core/run-command-detector.js +0 -98
  43. package/dist/core/stream-helper.d.ts +0 -44
  44. package/dist/core/stream-helper.js +0 -50
  45. package/dist/core/utils.d.ts +0 -43
  46. package/dist/core/utils.js +0 -113
  47. package/dist/core/validation.d.ts +0 -10
  48. package/dist/core/validation.js +0 -20
  49. package/dist/database/database.d.ts +0 -40
  50. package/dist/database/database.encryption.d.ts +0 -33
  51. package/dist/database/database.encryption.js +0 -62
  52. package/dist/database/database.js +0 -480
  53. package/dist/database/database.state.d.ts +0 -52
  54. package/dist/database/database.state.js +0 -119
  55. package/dist/database/database.test-utils.d.ts +0 -22
  56. package/dist/database/database.test-utils.js +0 -39
  57. package/dist/database/database.types.d.ts +0 -3
  58. package/dist/database/database.types.js +0 -2
  59. package/dist/features/agents/agents.manager.d.ts +0 -24
  60. package/dist/features/agents/agents.manager.js +0 -200
  61. package/dist/features/ask-user/ask-user.routes.d.ts +0 -9
  62. package/dist/features/ask-user/ask-user.routes.js +0 -35
  63. package/dist/features/chat/chat-delete.route.d.ts +0 -15
  64. package/dist/features/chat/chat-delete.route.js +0 -36
  65. package/dist/features/chat/chat-post.route.d.ts +0 -11
  66. package/dist/features/chat/chat-post.route.js +0 -270
  67. package/dist/features/chat/chat-stop.route.d.ts +0 -21
  68. package/dist/features/chat/chat-stop.route.js +0 -22
  69. package/dist/features/chat/chat-subscribe.route.d.ts +0 -9
  70. package/dist/features/chat/chat-subscribe.route.js +0 -71
  71. package/dist/features/chat/chat.routes.d.ts +0 -22
  72. package/dist/features/chat/chat.routes.js +0 -29
  73. package/dist/features/conversations/conversations-delete.route.d.ts +0 -16
  74. package/dist/features/conversations/conversations-delete.route.js +0 -34
  75. package/dist/features/conversations/conversations-get-all.route.d.ts +0 -16
  76. package/dist/features/conversations/conversations-get-all.route.js +0 -39
  77. package/dist/features/conversations/conversations-get-by-id.route.d.ts +0 -16
  78. package/dist/features/conversations/conversations-get-by-id.route.js +0 -38
  79. package/dist/features/conversations/conversations-get-deleted.route.d.ts +0 -15
  80. package/dist/features/conversations/conversations-get-deleted.route.js +0 -34
  81. package/dist/features/conversations/conversations-get-messages.route.d.ts +0 -16
  82. package/dist/features/conversations/conversations-get-messages.route.js +0 -49
  83. package/dist/features/conversations/conversations.content.d.ts +0 -28
  84. package/dist/features/conversations/conversations.content.js +0 -142
  85. package/dist/features/conversations/conversations.database.d.ts +0 -108
  86. package/dist/features/conversations/conversations.database.js +0 -373
  87. package/dist/features/conversations/conversations.manager.d.ts +0 -130
  88. package/dist/features/conversations/conversations.manager.js +0 -162
  89. package/dist/features/conversations/conversations.routes.d.ts +0 -21
  90. package/dist/features/conversations/conversations.routes.js +0 -38
  91. package/dist/features/conversations/token-usage.route.d.ts +0 -41
  92. package/dist/features/conversations/token-usage.route.js +0 -419
  93. package/dist/features/git/git-commit.route.d.ts +0 -12
  94. package/dist/features/git/git-commit.route.js +0 -39
  95. package/dist/features/git/git-create-branch.route.d.ts +0 -28
  96. package/dist/features/git/git-create-branch.route.js +0 -119
  97. package/dist/features/git/git-create-pr.route.d.ts +0 -13
  98. package/dist/features/git/git-create-pr.route.js +0 -50
  99. package/dist/features/git/git-create-repo.route.d.ts +0 -14
  100. package/dist/features/git/git-create-repo.route.js +0 -108
  101. package/dist/features/git/git-diff.route.d.ts +0 -30
  102. package/dist/features/git/git-diff.route.js +0 -189
  103. package/dist/features/git/git-fetch.route.d.ts +0 -12
  104. package/dist/features/git/git-fetch.route.js +0 -31
  105. package/dist/features/git/git-generate-commit-message.route.d.ts +0 -12
  106. package/dist/features/git/git-generate-commit-message.route.js +0 -76
  107. package/dist/features/git/git-generate-pr-info.route.d.ts +0 -13
  108. package/dist/features/git/git-generate-pr-info.route.js +0 -147
  109. package/dist/features/git/git-github-status.route.d.ts +0 -16
  110. package/dist/features/git/git-github-status.route.js +0 -68
  111. package/dist/features/git/git-log.route.d.ts +0 -17
  112. package/dist/features/git/git-log.route.js +0 -33
  113. package/dist/features/git/git-pr-status.route.d.ts +0 -15
  114. package/dist/features/git/git-pr-status.route.js +0 -33
  115. package/dist/features/git/git-pull.route.d.ts +0 -12
  116. package/dist/features/git/git-pull.route.js +0 -35
  117. package/dist/features/git/git-push.route.d.ts +0 -12
  118. package/dist/features/git/git-push.route.js +0 -46
  119. package/dist/features/git/git-status-cache.database.d.ts +0 -7
  120. package/dist/features/git/git-status-cache.database.js +0 -53
  121. package/dist/features/git/git-status.route.d.ts +0 -15
  122. package/dist/features/git/git-status.route.js +0 -62
  123. package/dist/features/git/git-sync-branch.route.d.ts +0 -4
  124. package/dist/features/git/git-sync-branch.route.js +0 -208
  125. package/dist/features/git/git-unified-status.route.d.ts +0 -30
  126. package/dist/features/git/git-unified-status.route.js +0 -165
  127. package/dist/features/git/git-username.route.d.ts +0 -3
  128. package/dist/features/git/git-username.route.js +0 -24
  129. package/dist/features/git/git.manager.d.ts +0 -139
  130. package/dist/features/git/git.manager.js +0 -352
  131. package/dist/features/git/git.routes.d.ts +0 -4
  132. package/dist/features/git/git.routes.js +0 -116
  133. package/dist/features/git/git.utils.d.ts +0 -82
  134. package/dist/features/git/git.utils.js +0 -1040
  135. package/dist/features/mcp/mcp.config.d.ts +0 -27
  136. package/dist/features/mcp/mcp.config.js +0 -148
  137. package/dist/features/mcp/mcp.manager.d.ts +0 -61
  138. package/dist/features/mcp/mcp.manager.js +0 -254
  139. package/dist/features/mcp/mcp.popular.json +0 -103
  140. package/dist/features/mcp/mcp.routes.d.ts +0 -13
  141. package/dist/features/mcp/mcp.routes.js +0 -159
  142. package/dist/features/mcp/mcp.types.d.ts +0 -80
  143. package/dist/features/mcp/mcp.types.js +0 -8
  144. package/dist/features/metadata/metadata.manager.d.ts +0 -126
  145. package/dist/features/metadata/metadata.manager.js +0 -423
  146. package/dist/features/models/model-info-aihubmix.d.ts +0 -25
  147. package/dist/features/models/model-info-aihubmix.js +0 -117
  148. package/dist/features/models/model-info-openrouter.d.ts +0 -25
  149. package/dist/features/models/model-info-openrouter.js +0 -104
  150. package/dist/features/models/model-info.d.ts +0 -37
  151. package/dist/features/models/model-info.js +0 -39
  152. package/dist/features/models/models-catalog.d.ts +0 -49
  153. package/dist/features/models/models-catalog.js +0 -80
  154. package/dist/features/models/models-catalog.route.d.ts +0 -43
  155. package/dist/features/models/models-catalog.route.js +0 -15
  156. package/dist/features/models/models-get-available.route.d.ts +0 -36
  157. package/dist/features/models/models-get-available.route.js +0 -66
  158. package/dist/features/models/models-get-enabled.route.d.ts +0 -33
  159. package/dist/features/models/models-get-enabled.route.js +0 -45
  160. package/dist/features/models/models-get-model-info.route.d.ts +0 -31
  161. package/dist/features/models/models-get-model-info.route.js +0 -84
  162. package/dist/features/models/models-model-disable.route.d.ts +0 -15
  163. package/dist/features/models/models-model-disable.route.js +0 -20
  164. package/dist/features/models/models-model-enable.route.d.ts +0 -13
  165. package/dist/features/models/models-model-enable.route.js +0 -20
  166. package/dist/features/models/models-provider-refresh.route.d.ts +0 -17
  167. package/dist/features/models/models-provider-refresh.route.js +0 -20
  168. package/dist/features/models/models.manager.d.ts +0 -58
  169. package/dist/features/models/models.manager.js +0 -138
  170. package/dist/features/models/models.routes.d.ts +0 -18
  171. package/dist/features/models/models.routes.js +0 -83
  172. package/dist/features/models/open-router-models.d.ts +0 -38
  173. package/dist/features/models/open-router-models.js +0 -73
  174. package/dist/features/models/openai-models.d.ts +0 -63
  175. package/dist/features/models/openai-models.js +0 -150
  176. package/dist/features/onboarding/onboarding-get-git-check.route.d.ts +0 -11
  177. package/dist/features/onboarding/onboarding-get-git-check.route.js +0 -28
  178. package/dist/features/onboarding/onboarding-get-status.route.d.ts +0 -12
  179. package/dist/features/onboarding/onboarding-get-status.route.js +0 -15
  180. package/dist/features/onboarding/onboarding-post-complete.route.d.ts +0 -12
  181. package/dist/features/onboarding/onboarding-post-complete.route.js +0 -15
  182. package/dist/features/onboarding/onboarding-post-reset.route.d.ts +0 -12
  183. package/dist/features/onboarding/onboarding-post-reset.route.js +0 -15
  184. package/dist/features/onboarding/onboarding.routes.d.ts +0 -18
  185. package/dist/features/onboarding/onboarding.routes.js +0 -28
  186. package/dist/features/project-todos/project-todos.database.d.ts +0 -38
  187. package/dist/features/project-todos/project-todos.database.js +0 -91
  188. package/dist/features/project-todos/project-todos.routes.d.ts +0 -4
  189. package/dist/features/project-todos/project-todos.routes.js +0 -94
  190. package/dist/features/projects/projects-ai-files.route.d.ts +0 -148
  191. package/dist/features/projects/projects-ai-files.route.js +0 -425
  192. package/dist/features/projects/projects-commands.route.d.ts +0 -27
  193. package/dist/features/projects/projects-commands.route.js +0 -39
  194. package/dist/features/projects/projects-create.route.d.ts +0 -19
  195. package/dist/features/projects/projects-create.route.js +0 -37
  196. package/dist/features/projects/projects-delete.route.d.ts +0 -24
  197. package/dist/features/projects/projects-delete.route.js +0 -34
  198. package/dist/features/projects/projects-get.route.d.ts +0 -47
  199. package/dist/features/projects/projects-get.route.js +0 -36
  200. package/dist/features/projects/projects-list.route.d.ts +0 -58
  201. package/dist/features/projects/projects-list.route.js +0 -59
  202. package/dist/features/projects/projects-open-folder.route.d.ts +0 -10
  203. package/dist/features/projects/projects-open-folder.route.js +0 -11
  204. package/dist/features/projects/projects-open.route.d.ts +0 -26
  205. package/dist/features/projects/projects-open.route.js +0 -49
  206. package/dist/features/projects/projects-package-scripts.route.d.ts +0 -15
  207. package/dist/features/projects/projects-package-scripts.route.js +0 -96
  208. package/dist/features/projects/projects-run-command.route.d.ts +0 -8
  209. package/dist/features/projects/projects-run-command.route.js +0 -21
  210. package/dist/features/projects/projects-run.route.d.ts +0 -51
  211. package/dist/features/projects/projects-run.route.js +0 -74
  212. package/dist/features/projects/projects-update.route.d.ts +0 -24
  213. package/dist/features/projects/projects-update.route.js +0 -81
  214. package/dist/features/projects/projects.creator.d.ts +0 -33
  215. package/dist/features/projects/projects.creator.js +0 -555
  216. package/dist/features/projects/projects.database.d.ts +0 -61
  217. package/dist/features/projects/projects.database.js +0 -212
  218. package/dist/features/projects/projects.manager.d.ts +0 -291
  219. package/dist/features/projects/projects.manager.js +0 -426
  220. package/dist/features/projects/projects.open-with.d.ts +0 -27
  221. package/dist/features/projects/projects.open-with.js +0 -156
  222. package/dist/features/projects/projects.routes.d.ts +0 -20
  223. package/dist/features/projects/projects.routes.js +0 -255
  224. package/dist/features/projects/terminal-session-manager.d.ts +0 -55
  225. package/dist/features/projects/terminal-session-manager.js +0 -90
  226. package/dist/features/providers/provider-resolver.d.ts +0 -13
  227. package/dist/features/providers/provider-resolver.js +0 -22
  228. package/dist/features/providers/providers-get-credits.route.d.ts +0 -15
  229. package/dist/features/providers/providers-get-credits.route.js +0 -51
  230. package/dist/features/providers/providers-get.route.d.ts +0 -16
  231. package/dist/features/providers/providers-get.route.js +0 -32
  232. package/dist/features/providers/providers-open-external.route.d.ts +0 -15
  233. package/dist/features/providers/providers-open-external.route.js +0 -49
  234. package/dist/features/providers/providers-post-bulk-keys.route.d.ts +0 -14
  235. package/dist/features/providers/providers-post-bulk-keys.route.js +0 -31
  236. package/dist/features/providers/providers-post-keys.route.d.ts +0 -14
  237. package/dist/features/providers/providers-post-keys.route.js +0 -25
  238. package/dist/features/providers/providers.routes.d.ts +0 -19
  239. package/dist/features/providers/providers.routes.js +0 -31
  240. package/dist/features/rules/rules-post.route.d.ts +0 -43
  241. package/dist/features/rules/rules-post.route.js +0 -89
  242. package/dist/features/rules/rules.manager.d.ts +0 -36
  243. package/dist/features/rules/rules.manager.js +0 -203
  244. package/dist/features/rules/rules.routes.d.ts +0 -12
  245. package/dist/features/rules/rules.routes.js +0 -13
  246. package/dist/features/run/run-get-running.route.d.ts +0 -15
  247. package/dist/features/run/run-get-running.route.js +0 -21
  248. package/dist/features/run/run-post-start.route.d.ts +0 -8
  249. package/dist/features/run/run-post-start.route.js +0 -21
  250. package/dist/features/run/run-post-stop.route.d.ts +0 -15
  251. package/dist/features/run/run-post-stop.route.js +0 -24
  252. package/dist/features/run/run-post-suggest.route.d.ts +0 -15
  253. package/dist/features/run/run-post-suggest.route.js +0 -21
  254. package/dist/features/run/run-put-command.route.d.ts +0 -15
  255. package/dist/features/run/run-put-command.route.js +0 -24
  256. package/dist/features/run/run.routes.d.ts +0 -19
  257. package/dist/features/run/run.routes.js +0 -31
  258. package/dist/features/scaffold/index.d.ts +0 -7
  259. package/dist/features/scaffold/index.js +0 -5
  260. package/dist/features/scaffold/scaffold-get-templates.route.d.ts +0 -27
  261. package/dist/features/scaffold/scaffold-get-templates.route.js +0 -17
  262. package/dist/features/scaffold/scaffold-post.route.d.ts +0 -8
  263. package/dist/features/scaffold/scaffold-post.route.js +0 -30
  264. package/dist/features/scaffold/scaffold.routes.d.ts +0 -10
  265. package/dist/features/scaffold/scaffold.routes.js +0 -16
  266. package/dist/features/scaffold/scaffold.runner.d.ts +0 -48
  267. package/dist/features/scaffold/scaffold.runner.js +0 -475
  268. package/dist/features/scaffold/scaffold.types.d.ts +0 -26
  269. package/dist/features/scaffold/scaffold.types.js +0 -5
  270. package/dist/features/skills/skills.activation.d.ts +0 -31
  271. package/dist/features/skills/skills.activation.js +0 -155
  272. package/dist/features/skills/skills.manager.d.ts +0 -35
  273. package/dist/features/skills/skills.manager.js +0 -251
  274. package/dist/features/slash-commands/slash-commands-delete.route.d.ts +0 -23
  275. package/dist/features/slash-commands/slash-commands-delete.route.js +0 -36
  276. package/dist/features/slash-commands/slash-commands-get.route.d.ts +0 -53
  277. package/dist/features/slash-commands/slash-commands-get.route.js +0 -54
  278. package/dist/features/slash-commands/slash-commands-post.route.d.ts +0 -39
  279. package/dist/features/slash-commands/slash-commands-post.route.js +0 -70
  280. package/dist/features/slash-commands/slash-commands-put.route.d.ts +0 -23
  281. package/dist/features/slash-commands/slash-commands-put.route.js +0 -36
  282. package/dist/features/slash-commands/slash-commands.manager.d.ts +0 -46
  283. package/dist/features/slash-commands/slash-commands.manager.js +0 -265
  284. package/dist/features/slash-commands/slash-commands.routes.d.ts +0 -13
  285. package/dist/features/slash-commands/slash-commands.routes.js +0 -20
  286. package/dist/features/threads/threads-ai-files.route.d.ts +0 -153
  287. package/dist/features/threads/threads-ai-files.route.js +0 -287
  288. package/dist/features/threads/threads-conversation-folder-path.route.d.ts +0 -14
  289. package/dist/features/threads/threads-conversation-folder-path.route.js +0 -23
  290. package/dist/features/threads/threads-create.route.d.ts +0 -22
  291. package/dist/features/threads/threads-create.route.js +0 -60
  292. package/dist/features/threads/threads-delete.route.d.ts +0 -25
  293. package/dist/features/threads/threads-delete.route.js +0 -35
  294. package/dist/features/threads/threads-files.route.d.ts +0 -15
  295. package/dist/features/threads/threads-files.route.js +0 -20
  296. package/dist/features/threads/threads-fix-comments.route.d.ts +0 -26
  297. package/dist/features/threads/threads-fix-comments.route.js +0 -45
  298. package/dist/features/threads/threads-get.route.d.ts +0 -30
  299. package/dist/features/threads/threads-get.route.js +0 -38
  300. package/dist/features/threads/threads-list.route.d.ts +0 -56
  301. package/dist/features/threads/threads-list.route.js +0 -58
  302. package/dist/features/threads/threads-messages.route.d.ts +0 -28
  303. package/dist/features/threads/threads-messages.route.js +0 -110
  304. package/dist/features/threads/threads-open.route.d.ts +0 -26
  305. package/dist/features/threads/threads-open.route.js +0 -62
  306. package/dist/features/threads/threads-select.route.d.ts +0 -25
  307. package/dist/features/threads/threads-select.route.js +0 -35
  308. package/dist/features/threads/threads-update.route.d.ts +0 -15
  309. package/dist/features/threads/threads-update.route.js +0 -30
  310. package/dist/features/threads/threads.database.d.ts +0 -68
  311. package/dist/features/threads/threads.database.js +0 -215
  312. package/dist/features/threads/threads.manager.d.ts +0 -204
  313. package/dist/features/threads/threads.manager.js +0 -505
  314. package/dist/features/threads/threads.routes.d.ts +0 -20
  315. package/dist/features/threads/threads.routes.js +0 -230
  316. package/dist/features/todos/todos.database.d.ts +0 -14
  317. package/dist/features/todos/todos.database.js +0 -31
  318. package/dist/features/updates/updates.routes.d.ts +0 -13
  319. package/dist/features/updates/updates.routes.js +0 -40
  320. package/dist/index.d.ts +0 -3
  321. package/dist/project-analyzer.d.ts +0 -26
  322. package/dist/project-analyzer.js +0 -307
  323. package/dist/server.d.ts +0 -12
  324. package/dist/server.js +0 -142
  325. package/dist/tools/agent-tool.d.ts +0 -49
  326. package/dist/tools/agent-tool.js +0 -131
  327. package/dist/tools/ask-user.d.ts +0 -25
  328. package/dist/tools/ask-user.js +0 -74
  329. package/dist/tools/ast-grep.d.ts +0 -28
  330. package/dist/tools/ast-grep.js +0 -273
  331. package/dist/tools/bash.d.ts +0 -33
  332. package/dist/tools/bash.js +0 -186
  333. package/dist/tools/edit-diff.d.ts +0 -24
  334. package/dist/tools/edit-diff.js +0 -136
  335. package/dist/tools/edit.d.ts +0 -28
  336. package/dist/tools/edit.js +0 -78
  337. package/dist/tools/find.d.ts +0 -31
  338. package/dist/tools/find.js +0 -117
  339. package/dist/tools/grep.d.ts +0 -37
  340. package/dist/tools/grep.js +0 -231
  341. package/dist/tools/index.d.ts +0 -93
  342. package/dist/tools/index.js +0 -110
  343. package/dist/tools/ls.d.ts +0 -31
  344. package/dist/tools/ls.js +0 -108
  345. package/dist/tools/mcp-tools.d.ts +0 -31
  346. package/dist/tools/mcp-tools.js +0 -59
  347. package/dist/tools/path-utils.d.ts +0 -14
  348. package/dist/tools/path-utils.js +0 -87
  349. package/dist/tools/read.d.ts +0 -27
  350. package/dist/tools/read.js +0 -86
  351. package/dist/tools/resolve-bin.d.ts +0 -5
  352. package/dist/tools/resolve-bin.js +0 -28
  353. package/dist/tools/shell.d.ts +0 -7
  354. package/dist/tools/shell.js +0 -143
  355. package/dist/tools/skill-reference-tool.d.ts +0 -30
  356. package/dist/tools/skill-reference-tool.js +0 -171
  357. package/dist/tools/skill-tool.d.ts +0 -33
  358. package/dist/tools/skill-tool.js +0 -213
  359. package/dist/tools/todo.d.ts +0 -20
  360. package/dist/tools/todo.js +0 -168
  361. package/dist/tools/tool-helpers.d.ts +0 -78
  362. package/dist/tools/tool-helpers.js +0 -109
  363. package/dist/tools/truncate.d.ts +0 -31
  364. package/dist/tools/truncate.js +0 -164
  365. package/dist/tools/write.d.ts +0 -21
  366. package/dist/tools/write.js +0 -65
@@ -1,67 +0,0 @@
1
- /**
2
- * Model resolver for Pi Agent
3
- * Handles provider mapping and model resolution for different AI providers
4
- */
5
- import { getModel } from "@mariozechner/pi-ai";
6
- /**
7
- * Maps provider names to Pi AI known provider identifiers
8
- */
9
- export const PROVIDER_NAME_TO_PI = {
10
- anthropic: "anthropic",
11
- openai: "openai",
12
- google: "google",
13
- groq: "groq",
14
- cerebras: "cerebras",
15
- xai: "xai",
16
- openrouter: "openrouter",
17
- "github copilot": "github-copilot",
18
- minimax: "minimax",
19
- "kimi coding plan": "kimi-coding",
20
- "hugging face": "huggingface",
21
- codex: "openai-codex",
22
- mistral: "mistral",
23
- };
24
- /**
25
- * Determines the API type based on the provider's API URL
26
- */
27
- export function determineApiType(apiUrl) {
28
- if (apiUrl.includes("/anthropic/"))
29
- return "anthropic-messages";
30
- if (apiUrl.includes("api.anthropic.com"))
31
- return "anthropic-messages";
32
- return "openai-completions";
33
- }
34
- /**
35
- * Resolves a model configuration for the Pi Agent
36
- * First attempts to use known providers from pi-ai registry,
37
- * then falls back to creating a custom model configuration
38
- */
39
- export function resolveModel(providerName, modelId, providerConfig) {
40
- const piProvider = PROVIDER_NAME_TO_PI[providerName.toLowerCase()];
41
- if (piProvider) {
42
- try {
43
- return getModel(piProvider, modelId);
44
- }
45
- catch {
46
- // Model not in pi-ai registry — fall through to custom model
47
- }
48
- }
49
- const baseUrl = providerConfig.api;
50
- if (!baseUrl) {
51
- throw new Error(`No API URL configured for provider: ${providerName}`);
52
- }
53
- const apiType = determineApiType(baseUrl);
54
- return {
55
- id: modelId,
56
- name: modelId,
57
- api: apiType,
58
- provider: providerName.toLowerCase(),
59
- baseUrl,
60
- reasoning: false,
61
- input: ["text"],
62
- cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
63
- contextWindow: 128000,
64
- maxTokens: 16384,
65
- };
66
- }
67
- //# sourceMappingURL=agent.model-resolver.js.map
@@ -1,57 +0,0 @@
1
- /**
2
- * ProcessManager handles running and stopping dev server processes
3
- *
4
- * This manager is responsible for:
5
- * - Starting dev server processes with output capture
6
- * - Detecting URLs from process output
7
- * - Stopping running processes
8
- * - Streaming output back to the frontend
9
- */
10
- import { EventEmitter } from "events";
11
- export interface ProcessOutput {
12
- type: "stdout" | "stderr" | "url" | "error" | "complete";
13
- content?: string;
14
- url?: string;
15
- error?: unknown;
16
- }
17
- export declare class ProcessManager extends EventEmitter {
18
- private processes;
19
- private detectedUrls;
20
- private queues;
21
- private resolvers;
22
- /**
23
- * Run a command and stream its output
24
- * @param projectId - The project ID (used as a key)
25
- * @param command - The command to run (e.g., "npm run dev")
26
- * @param cwd - Working directory to run the command in
27
- * @param threadId - The thread ID to cache the URL for
28
- * @returns AsyncGenerator that yields ProcessOutput events
29
- */
30
- runProcess(projectId: string, command: string, cwd: string, threadId: string): AsyncGenerator<ProcessOutput>;
31
- /**
32
- * Stop a running process
33
- * @param projectId - The project ID
34
- * @param threadId - The thread ID to clear the URL from cache
35
- * @returns true if process was stopped, false if no process was running
36
- */
37
- stopProcess(projectId: string, threadId?: string): boolean;
38
- /**
39
- * Check if a process is running for a project
40
- * @param projectId - The project ID
41
- * @returns true if a process is running
42
- */
43
- isRunning(projectId: string): boolean;
44
- /**
45
- * Get the detected URL for a running process
46
- * @param projectId - The project ID
47
- * @returns The URL if detected, undefined otherwise
48
- */
49
- getDetectedUrl(projectId: string): string | undefined;
50
- /**
51
- * Detect URL from text output
52
- * @param text - The text to search for URLs
53
- * @returns The first detected URL or undefined
54
- */
55
- private detectUrl;
56
- }
57
- //# sourceMappingURL=agent.process-manager.d.ts.map
@@ -1,262 +0,0 @@
1
- /**
2
- * ProcessManager handles running and stopping dev server processes
3
- *
4
- * This manager is responsible for:
5
- * - Starting dev server processes with output capture
6
- * - Detecting URLs from process output
7
- * - Stopping running processes
8
- * - Streaming output back to the frontend
9
- */
10
- import { spawnProcess } from "../core/utils.js";
11
- import { EventEmitter } from "events";
12
- import { devServerCache } from "../core/dev-server-cache.js";
13
- let Utils = null;
14
- let utilsLoaded = false;
15
- // Lazy load Utils from electrobun (optional - may not be available in pure server mode)
16
- async function loadUtils() {
17
- if (utilsLoaded)
18
- return;
19
- utilsLoaded = true;
20
- try {
21
- const electrobun = await import("electrobun/bun");
22
- Utils = electrobun.Utils;
23
- }
24
- catch {
25
- // electrobun not available in pure server mode - that's OK
26
- }
27
- }
28
- // Common patterns for detecting dev server URLs in output
29
- const URL_PATTERNS = [
30
- // http(s)://localhost:PORT
31
- /https?:\/\/localhost[:/](\d+)/i,
32
- // localhost:PORT
33
- /localhost:(\d+)/i,
34
- // 127.0.0.1:PORT
35
- /127\.0\.0\.1:(\d+)/i,
36
- // http://0.0.0.0:PORT or http://[::]:PORT (for IPv6)
37
- /https?:\/\/(0\.0\.0\.0|\[::?\]):(\d+)/i,
38
- // Local address patterns like http://192.168...
39
- /https?:\/\/(192\.168\.\d+\.\d+):(\d+)/i,
40
- ];
41
- export class ProcessManager extends EventEmitter {
42
- processes = new Map();
43
- detectedUrls = new Map();
44
- queues = new Map();
45
- resolvers = new Map();
46
- /**
47
- * Run a command and stream its output
48
- * @param projectId - The project ID (used as a key)
49
- * @param command - The command to run (e.g., "npm run dev")
50
- * @param cwd - Working directory to run the command in
51
- * @param threadId - The thread ID to cache the URL for
52
- * @returns AsyncGenerator that yields ProcessOutput events
53
- */
54
- async *runProcess(projectId, command, cwd, threadId) {
55
- console.log("CLI ProcessManager: runProcess called for project:", projectId, "thread:", threadId, "command:", command, "cwd:", cwd);
56
- // Load utils (may fail gracefully if electrobun not available)
57
- await loadUtils();
58
- // Check if a process is already running for this project
59
- if (this.processes.has(projectId)) {
60
- console.log("CLI ProcessManager: Process already running for project:", projectId);
61
- yield {
62
- type: "error",
63
- error: new Error("A process is already running for this project"),
64
- };
65
- return;
66
- }
67
- console.log("CLI ProcessManager: Starting new process for project:", projectId);
68
- // Initialize queue for this process
69
- this.queues.set(projectId, []);
70
- this.resolvers.set(projectId, []);
71
- const addToQueue = (output) => {
72
- const queue = this.queues.get(projectId);
73
- if (queue) {
74
- queue.push(output);
75
- // Call any pending resolvers
76
- const res = this.resolvers.get(projectId);
77
- if (res && res.length > 0) {
78
- const resolver = res.shift();
79
- if (resolver)
80
- resolver();
81
- }
82
- }
83
- };
84
- const waitForQueue = () => {
85
- return new Promise((resolve) => {
86
- const queue = this.queues.get(projectId);
87
- if (queue && queue.length > 0) {
88
- resolve();
89
- }
90
- else {
91
- const res = this.resolvers.get(projectId);
92
- if (res)
93
- res.push(resolve);
94
- }
95
- });
96
- };
97
- try {
98
- const [cmd, ...args] = command.split(" ");
99
- console.log("CLI ProcessManager: Spawning process:", cmd, "with args:", args);
100
- const childProcess = spawnProcess(cmd, args, {
101
- cwd,
102
- shell: true,
103
- stdio: ["ignore", "pipe", "pipe"],
104
- });
105
- this.processes.set(projectId, childProcess);
106
- console.log("CLI ProcessManager: Process spawned with PID:", childProcess.pid);
107
- let urlDetected = false;
108
- let urlBuffer = "";
109
- // Handle stdout - add to queue immediately
110
- childProcess.stdout?.on("data", (data) => {
111
- const text = data.toString();
112
- urlBuffer += text;
113
- // Try to detect URL
114
- if (!urlDetected) {
115
- const detectedUrl = this.detectUrl(urlBuffer);
116
- if (detectedUrl) {
117
- urlDetected = true;
118
- this.detectedUrls.set(projectId, detectedUrl);
119
- // Store URL in the thread-based cache
120
- devServerCache.setUrl(threadId, detectedUrl);
121
- // Open the URL in the system's default browser (only in desktop mode with electrobun)
122
- if (Utils) {
123
- Utils.openExternal(detectedUrl);
124
- }
125
- addToQueue({ type: "url", url: detectedUrl });
126
- }
127
- }
128
- addToQueue({ type: "stdout", content: text });
129
- });
130
- // Handle stderr - add to queue immediately
131
- childProcess.stderr?.on("data", (data) => {
132
- const text = data.toString();
133
- urlBuffer += text;
134
- // Try to detect URL in stderr as well
135
- if (!urlDetected) {
136
- const detectedUrl = this.detectUrl(urlBuffer);
137
- if (detectedUrl) {
138
- urlDetected = true;
139
- this.detectedUrls.set(projectId, detectedUrl);
140
- // Store URL in the thread-based cache
141
- devServerCache.setUrl(threadId, detectedUrl);
142
- // Open the URL in the system's default browser (only in desktop mode with electrobun)
143
- if (Utils) {
144
- Utils.openExternal(detectedUrl);
145
- }
146
- addToQueue({ type: "url", url: detectedUrl });
147
- }
148
- }
149
- addToQueue({ type: "stderr", content: text });
150
- });
151
- // Handle process end
152
- let processEnded = false;
153
- childProcess.on("close", () => {
154
- processEnded = true;
155
- this.processes.delete(projectId);
156
- addToQueue({ type: "complete" });
157
- // Call any pending resolvers to flush the queue
158
- const res = this.resolvers.get(projectId);
159
- if (res) {
160
- res.forEach((r) => r());
161
- res.length = 0;
162
- }
163
- });
164
- childProcess.on("error", (err) => {
165
- processEnded = true;
166
- this.processes.delete(projectId);
167
- addToQueue({ type: "error", error: err });
168
- // Call any pending resolvers to flush the queue
169
- const res = this.resolvers.get(projectId);
170
- if (res) {
171
- res.forEach((r) => r());
172
- res.length = 0;
173
- }
174
- });
175
- // Yield items from the queue
176
- while (true) {
177
- const queue = this.queues.get(projectId);
178
- if (queue && queue.length > 0) {
179
- const output = queue.shift();
180
- if (output) {
181
- yield output;
182
- if (output.type === "complete" || output.type === "error") {
183
- break;
184
- }
185
- }
186
- }
187
- else if (processEnded) {
188
- break;
189
- }
190
- else {
191
- // Wait for more data
192
- await waitForQueue();
193
- }
194
- }
195
- }
196
- catch (error) {
197
- this.processes.delete(projectId);
198
- this.detectedUrls.delete(projectId);
199
- yield { type: "error", error };
200
- }
201
- finally {
202
- // Cleanup
203
- this.queues.delete(projectId);
204
- this.resolvers.delete(projectId);
205
- }
206
- }
207
- /**
208
- * Stop a running process
209
- * @param projectId - The project ID
210
- * @param threadId - The thread ID to clear the URL from cache
211
- * @returns true if process was stopped, false if no process was running
212
- */
213
- stopProcess(projectId, threadId) {
214
- const process = this.processes.get(projectId);
215
- if (!process) {
216
- return false;
217
- }
218
- process.kill();
219
- this.processes.delete(projectId);
220
- this.detectedUrls.delete(projectId);
221
- // Clear URL from thread-based cache if threadId is provided
222
- if (threadId) {
223
- devServerCache.clearUrl(threadId);
224
- }
225
- return true;
226
- }
227
- /**
228
- * Check if a process is running for a project
229
- * @param projectId - The project ID
230
- * @returns true if a process is running
231
- */
232
- isRunning(projectId) {
233
- return this.processes.has(projectId);
234
- }
235
- /**
236
- * Get the detected URL for a running process
237
- * @param projectId - The project ID
238
- * @returns The URL if detected, undefined otherwise
239
- */
240
- getDetectedUrl(projectId) {
241
- return this.detectedUrls.get(projectId);
242
- }
243
- /**
244
- * Detect URL from text output
245
- * @param text - The text to search for URLs
246
- * @returns The first detected URL or undefined
247
- */
248
- detectUrl(text) {
249
- for (const pattern of URL_PATTERNS) {
250
- const match = text.match(pattern);
251
- if (match) {
252
- // For simple localhost patterns, construct the full URL
253
- if (match[1] && !match[0].includes("://")) {
254
- return `http://localhost:${match[1]}`;
255
- }
256
- return match[0];
257
- }
258
- }
259
- return undefined;
260
- }
261
- }
262
- //# sourceMappingURL=agent.process-manager.js.map
@@ -1,74 +0,0 @@
1
- /**
2
- * ProcessingStateManager tracks which threads currently have active chat processing
3
- *
4
- * This is an in-memory store that tracks thread IDs that are currently
5
- * processing chat messages. The frontend can poll this to show/hide spinners.
6
- * It also buffers streaming events so late subscribers can replay them.
7
- */
8
- import type { AgentEvent } from "@tarsk/shared";
9
- export type StreamSubscriber = (event: AgentEvent) => void;
10
- export interface ProcessingStateManager {
11
- /**
12
- * Mark a thread as currently processing
13
- * @param threadId - The thread ID that started processing
14
- */
15
- setProcessing(threadId: string): void;
16
- /**
17
- * Mark a thread as no longer processing
18
- * @param threadId - The thread ID that finished processing
19
- */
20
- clearProcessing(threadId: string): void;
21
- /**
22
- * Check if a thread is currently processing
23
- * @param threadId - The thread ID to check
24
- * @returns true if the thread is processing
25
- */
26
- isProcessing(threadId: string): boolean;
27
- /**
28
- * Get all thread IDs that are currently processing
29
- * @returns Array of thread IDs
30
- */
31
- getProcessingThreadIds(): string[];
32
- /**
33
- * Push a streaming event for a thread (buffered for late subscribers)
34
- */
35
- pushEvent(threadId: string, event: AgentEvent): void;
36
- /**
37
- * Subscribe to a thread's stream. Replays buffered events immediately,
38
- * then delivers new events as they arrive. Returns an unsubscribe function.
39
- */
40
- subscribe(threadId: string, subscriber: StreamSubscriber): () => void;
41
- /**
42
- * Get buffered events for a thread
43
- */
44
- getBufferedEvents(threadId: string): AgentEvent[];
45
- /**
46
- * Register the AbortController for a thread's active execution so it can
47
- * be cancelled via the stop endpoint regardless of connection state.
48
- */
49
- registerAbortController(threadId: string, controller: AbortController): void;
50
- /**
51
- * Abort the active execution for a thread.
52
- * @returns true if an active controller was found and aborted
53
- */
54
- abortThread(threadId: string): boolean;
55
- }
56
- /**
57
- * Implementation of ProcessingStateManager using an in-memory Set
58
- */
59
- export declare class ProcessingStateManagerImpl implements ProcessingStateManager {
60
- private processingThreads;
61
- private eventBuffers;
62
- private subscribers;
63
- private abortControllers;
64
- setProcessing(threadId: string): void;
65
- registerAbortController(threadId: string, controller: AbortController): void;
66
- abortThread(threadId: string): boolean;
67
- clearProcessing(threadId: string): void;
68
- isProcessing(threadId: string): boolean;
69
- getProcessingThreadIds(): string[];
70
- pushEvent(threadId: string, event: AgentEvent): void;
71
- subscribe(threadId: string, subscriber: StreamSubscriber): () => void;
72
- getBufferedEvents(threadId: string): AgentEvent[];
73
- }
74
- //# sourceMappingURL=agent.processing-state-manager.d.ts.map
@@ -1,87 +0,0 @@
1
- /**
2
- * ProcessingStateManager tracks which threads currently have active chat processing
3
- *
4
- * This is an in-memory store that tracks thread IDs that are currently
5
- * processing chat messages. The frontend can poll this to show/hide spinners.
6
- * It also buffers streaming events so late subscribers can replay them.
7
- */
8
- /**
9
- * Implementation of ProcessingStateManager using an in-memory Set
10
- */
11
- export class ProcessingStateManagerImpl {
12
- processingThreads = new Set();
13
- eventBuffers = new Map();
14
- subscribers = new Map();
15
- abortControllers = new Map();
16
- setProcessing(threadId) {
17
- this.processingThreads.add(threadId);
18
- this.eventBuffers.set(threadId, []);
19
- console.log(`[ProcessingState] Thread ${threadId} started processing. Active: ${this.processingThreads.size}`);
20
- }
21
- registerAbortController(threadId, controller) {
22
- this.abortControllers.set(threadId, controller);
23
- }
24
- abortThread(threadId) {
25
- const controller = this.abortControllers.get(threadId);
26
- if (!controller)
27
- return false;
28
- console.log(`[ProcessingState] Aborting thread ${threadId} via stop endpoint`);
29
- controller.abort();
30
- this.abortControllers.delete(threadId);
31
- return true;
32
- }
33
- clearProcessing(threadId) {
34
- this.abortControllers.delete(threadId);
35
- this.processingThreads.delete(threadId);
36
- // Notify subscribers that stream is complete, then clean up
37
- const subs = this.subscribers.get(threadId);
38
- if (subs) {
39
- for (const sub of subs) {
40
- sub({ type: "complete", content: "" });
41
- }
42
- this.subscribers.delete(threadId);
43
- }
44
- // Keep the buffer briefly for any final subscribers, then clean up
45
- setTimeout(() => {
46
- this.eventBuffers.delete(threadId);
47
- }, 5000);
48
- console.log(`[ProcessingState] Thread ${threadId} finished processing. Active: ${this.processingThreads.size}`);
49
- }
50
- isProcessing(threadId) {
51
- return this.processingThreads.has(threadId);
52
- }
53
- getProcessingThreadIds() {
54
- return Array.from(this.processingThreads);
55
- }
56
- pushEvent(threadId, event) {
57
- const buffer = this.eventBuffers.get(threadId);
58
- if (buffer) {
59
- buffer.push(event);
60
- }
61
- const subs = this.subscribers.get(threadId);
62
- if (subs) {
63
- for (const sub of subs) {
64
- sub(event);
65
- }
66
- }
67
- }
68
- subscribe(threadId, subscriber) {
69
- if (!this.subscribers.has(threadId)) {
70
- this.subscribers.set(threadId, new Set());
71
- }
72
- this.subscribers.get(threadId).add(subscriber);
73
- return () => {
74
- const subs = this.subscribers.get(threadId);
75
- if (subs) {
76
- subs.delete(subscriber);
77
- if (subs.size === 0) {
78
- this.subscribers.delete(threadId);
79
- }
80
- }
81
- };
82
- }
83
- getBufferedEvents(threadId) {
84
- return this.eventBuffers.get(threadId) ?? [];
85
- }
86
- }
87
- //# sourceMappingURL=agent.processing-state-manager.js.map
@@ -1,16 +0,0 @@
1
- /**
2
- * System prompt loader for Pi Agent
3
- * Loads agent system prompt from agents.md file with fallback
4
- */
5
- import type { Skill, AgentDefinition } from "@tarsk/shared";
6
- /**
7
- * Load agent system prompt from agents.md file
8
- * System prompt is the DEFAULT_PROMPT, agents.md is appended as developer context
9
- *
10
- * @param threadPath - Path to the thread directory (required)
11
- * @param skills - Optional array of activated skills to inject into the prompt
12
- * @param planMode - Optional flag to enable plan mode instructions
13
- * @param agents - Optional array of available agent definitions to inject into the prompt
14
- */
15
- export declare function loadAgentSystemPrompt(threadPath: string, skills?: Skill[], planMode?: boolean, agents?: AgentDefinition[]): Promise<string>;
16
- //# sourceMappingURL=agent.prompt-loader.d.ts.map