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,480 +0,0 @@
1
- /**
2
- * SQLite Database Connection Management
3
- *
4
- * This module handles:
5
- * - SQLite database connection initialization
6
- * - Database file creation at ~/Library/Application Support/Tarsk/data/tarsk.db
7
- * - Schema initialization
8
- * - Connection lifecycle management
9
- */
10
- import { createClient } from "@libsql/client";
11
- import { join } from "path";
12
- import { homedir } from "os";
13
- import { mkdirSync } from "fs";
14
- /**
15
- * Get the database file path
16
- * @returns Absolute path to tarsk.db
17
- */
18
- export function getDatabasePath() {
19
- const appSupportDir = join(homedir(), "Library", "Application Support", "Tarsk");
20
- const dataDir = join(appSupportDir, "data");
21
- return join(dataDir, "tarsk.db");
22
- }
23
- /**
24
- * Initialize the database connection and create tables if needed
25
- * @returns SQLite database instance
26
- */
27
- export async function initializeDatabase() {
28
- const dbPath = getDatabasePath();
29
- try {
30
- // Ensure data directory exists
31
- const dataDir = join(homedir(), "Library", "Application Support", "Tarsk", "data");
32
- mkdirSync(dataDir, { recursive: true });
33
- // Open database connection (creates file if not exists)
34
- const db = createClient({
35
- url: `file:${dbPath}`,
36
- });
37
- // Enable foreign keys
38
- await db.execute("PRAGMA foreign_keys = ON");
39
- // Initialize schema
40
- await initializeSchema(db);
41
- return db;
42
- }
43
- catch (error) {
44
- console.error("Failed to initialize database:", error);
45
- throw error;
46
- }
47
- }
48
- /**
49
- * Initialize database schema with all required tables
50
- * @param db SQLite database instance
51
- */
52
- export async function initializeSchema(db) {
53
- try {
54
- // Create projects table
55
- await db.execute(`
56
- CREATE TABLE IF NOT EXISTS projects (
57
- id TEXT PRIMARY KEY,
58
- name TEXT NOT NULL,
59
- gitUrl TEXT NOT NULL,
60
- path TEXT NOT NULL,
61
- createdAt TEXT NOT NULL,
62
- openWith TEXT,
63
- commands TEXT,
64
- setupScript TEXT,
65
- runCommand TEXT,
66
- commitMethod TEXT
67
- )
68
- `);
69
- // Create threads table
70
- await db.execute(`
71
- CREATE TABLE IF NOT EXISTS threads (
72
- id TEXT PRIMARY KEY,
73
- projectId TEXT NOT NULL,
74
- title TEXT NOT NULL,
75
- path TEXT NOT NULL,
76
- currentBranch TEXT NOT NULL,
77
- createdAt TEXT NOT NULL,
78
- enabledSkills TEXT,
79
- disabledSkills TEXT,
80
- currentConversationId TEXT,
81
- status TEXT NOT NULL DEFAULT 'active',
82
- model TEXT,
83
- diffComments TEXT,
84
- FOREIGN KEY (projectId) REFERENCES projects(id) ON DELETE CASCADE
85
- )
86
- `);
87
- // Create state table
88
- await db.execute(`
89
- CREATE TABLE IF NOT EXISTS state (
90
- key TEXT PRIMARY KEY,
91
- value TEXT NOT NULL
92
- )
93
- `);
94
- // Create conversation_history table
95
- await db.execute(`
96
- CREATE TABLE IF NOT EXISTS conversation_history (
97
- id TEXT PRIMARY KEY,
98
- threadId TEXT NOT NULL,
99
- conversationId TEXT NOT NULL,
100
- timestamp TEXT NOT NULL,
101
- status TEXT NOT NULL DEFAULT 'active',
102
- request_message TEXT NOT NULL,
103
- request_model TEXT NOT NULL,
104
- request_attachments TEXT,
105
- request_planMode INTEGER,
106
- response_content TEXT,
107
- response_events TEXT,
108
- response_completedAt TEXT,
109
- input_tokens INTEGER DEFAULT 0,
110
- output_tokens INTEGER DEFAULT 0,
111
- FOREIGN KEY (threadId) REFERENCES threads(id) ON DELETE CASCADE
112
- )
113
- `);
114
- // Create todos table
115
- await db.execute(`
116
- CREATE TABLE IF NOT EXISTS todos (
117
- id TEXT PRIMARY KEY,
118
- threadId TEXT NOT NULL,
119
- description TEXT NOT NULL,
120
- status TEXT NOT NULL DEFAULT 'pending',
121
- assignedTo TEXT NOT NULL DEFAULT 'agent',
122
- createdAt TEXT NOT NULL,
123
- updatedAt TEXT NOT NULL,
124
- FOREIGN KEY (threadId) REFERENCES threads(id) ON DELETE CASCADE
125
- )
126
- `);
127
- // Create project_todos table
128
- await db.execute(`
129
- CREATE TABLE IF NOT EXISTS project_todos (
130
- id TEXT PRIMARY KEY,
131
- projectId TEXT NOT NULL,
132
- threadId TEXT,
133
- title TEXT NOT NULL,
134
- description TEXT NOT NULL,
135
- status TEXT NOT NULL DEFAULT 'Ready',
136
- working INTEGER NOT NULL DEFAULT 0,
137
- createdAt TEXT NOT NULL,
138
- updatedAt TEXT NOT NULL,
139
- FOREIGN KEY (projectId) REFERENCES projects(id) ON DELETE CASCADE
140
- )
141
- `);
142
- // Create git_status_cache table
143
- await db.execute(`
144
- CREATE TABLE IF NOT EXISTS git_status_cache (
145
- threadId TEXT PRIMARY KEY,
146
- data TEXT NOT NULL,
147
- cachedAt TEXT NOT NULL
148
- )
149
- `);
150
- // Create indexes for efficient queries
151
- await db.execute(`
152
- CREATE INDEX IF NOT EXISTS idx_threads_projectId ON threads(projectId)
153
- `);
154
- await db.execute(`
155
- CREATE INDEX IF NOT EXISTS idx_todos_threadId ON todos(threadId)
156
- `);
157
- await db.execute(`
158
- CREATE INDEX IF NOT EXISTS idx_project_todos_projectId ON project_todos(projectId)
159
- `);
160
- await db.execute(`
161
- CREATE INDEX IF NOT EXISTS idx_conversation_history_threadId ON conversation_history(threadId)
162
- `);
163
- await db.execute(`
164
- CREATE INDEX IF NOT EXISTS idx_conversation_history_conversationId ON conversation_history(conversationId)
165
- `);
166
- // Run migrations to apply schema updates to existing databases
167
- await runMigrations(db);
168
- }
169
- catch (error) {
170
- console.error("Failed to initialize database schema:", error);
171
- throw error;
172
- }
173
- }
174
- async function runMigrations(db) {
175
- try {
176
- // Check if conversation_history table exists
177
- const conversationHistoryExists = await db.execute(`SELECT name FROM sqlite_master WHERE type='table' AND name='conversation_history'`);
178
- if (conversationHistoryExists.rows.length > 0) {
179
- // Migration: Add conversationId column to conversation_history if it doesn't exist
180
- const conversationHistoryInfo = await db.execute(`PRAGMA table_info(conversation_history)`);
181
- const hasConversationId = conversationHistoryInfo.rows.some((col) => col.name === "conversationId");
182
- if (!hasConversationId) {
183
- console.log("[db] Running migration: Adding conversationId column to conversation_history");
184
- await db.execute(`ALTER TABLE conversation_history ADD COLUMN conversationId TEXT NOT NULL DEFAULT ''`);
185
- }
186
- // Migration: Drop prompt_id, message_type, and sequence_id columns if they exist
187
- const hasPromptIdColumn = conversationHistoryInfo.rows.some((col) => col.name === "prompt_id");
188
- const hasMessageTypeColumn = conversationHistoryInfo.rows.some((col) => col.name === "message_type");
189
- const hasSequenceIdColumn = conversationHistoryInfo.rows.some((col) => col.name === "sequence_id");
190
- const hasStatusColumn = conversationHistoryInfo.rows.some((col) => col.name === "status");
191
- const hasInputTokensColumn = conversationHistoryInfo.rows.some((col) => col.name === "input_tokens");
192
- const hasOutputTokensColumn = conversationHistoryInfo.rows.some((col) => col.name === "output_tokens");
193
- if (!hasStatusColumn) {
194
- console.log("[db] Running migration: Adding status column to conversation_history");
195
- await db.execute(`ALTER TABLE conversation_history ADD COLUMN status TEXT NOT NULL DEFAULT 'active'`);
196
- }
197
- if (!hasInputTokensColumn) {
198
- console.log("[db] Running migration: Adding input_tokens column to conversation_history");
199
- await db.execute(`ALTER TABLE conversation_history ADD COLUMN input_tokens INTEGER DEFAULT 0`);
200
- }
201
- if (!hasOutputTokensColumn) {
202
- console.log("[db] Running migration: Adding output_tokens column to conversation_history");
203
- await db.execute(`ALTER TABLE conversation_history ADD COLUMN output_tokens INTEGER DEFAULT 0`);
204
- }
205
- if (hasPromptIdColumn || hasMessageTypeColumn || hasSequenceIdColumn) {
206
- console.log("[db] Running migration: Dropping prompt_id, message_type, and sequence_id columns from conversation_history");
207
- // SQLite doesn't support DROP COLUMN directly, so we need to recreate table
208
- await db.execute(`
209
- CREATE TABLE conversation_history_new AS SELECT
210
- id,
211
- threadId,
212
- conversationId,
213
- timestamp,
214
- status,
215
- request_message,
216
- request_model,
217
- request_attachments,
218
- request_planMode,
219
- response_content,
220
- response_events,
221
- response_completedAt,
222
- input_tokens,
223
- output_tokens
224
- FROM conversation_history
225
- `);
226
- await db.execute(`DROP TABLE conversation_history`);
227
- await db.execute(`ALTER TABLE conversation_history_new RENAME TO conversation_history`);
228
- // Recreate indexes
229
- await db.execute(`
230
- CREATE INDEX IF NOT EXISTS idx_conversation_history_threadId ON conversation_history(threadId)
231
- `);
232
- await db.execute(`
233
- CREATE INDEX IF NOT EXISTS idx_conversation_history_conversationId ON conversation_history(conversationId)
234
- `);
235
- }
236
- // Migration: Add ON DELETE CASCADE to conversation_history.threadId foreign key
237
- // Check if foreign key has CASCADE by examining the table SQL
238
- const tableInfo = await db.execute(`
239
- SELECT sql FROM sqlite_master
240
- WHERE type='table' AND name='conversation_history'
241
- `);
242
- if (tableInfo.rows.length > 0) {
243
- const tableSql = tableInfo.rows[0].sql;
244
- if (!tableSql.includes("ON DELETE CASCADE")) {
245
- console.log("[db] Running migration: Adding ON DELETE CASCADE to conversation_history.threadId foreign key");
246
- // Recreate table with CASCADE
247
- await db.execute(`
248
- CREATE TABLE conversation_history_new AS SELECT
249
- id,
250
- threadId,
251
- conversationId,
252
- timestamp,
253
- status,
254
- request_message,
255
- request_model,
256
- request_attachments,
257
- request_planMode,
258
- response_content,
259
- response_events,
260
- response_completedAt,
261
- input_tokens,
262
- output_tokens
263
- FROM conversation_history
264
- `);
265
- await db.execute(`DROP TABLE conversation_history`);
266
- await db.execute(`
267
- CREATE TABLE conversation_history (
268
- id TEXT PRIMARY KEY,
269
- threadId TEXT NOT NULL,
270
- conversationId TEXT NOT NULL,
271
- timestamp TEXT NOT NULL,
272
- status TEXT NOT NULL DEFAULT 'active',
273
- request_message TEXT NOT NULL,
274
- request_model TEXT NOT NULL,
275
- request_attachments TEXT,
276
- request_planMode INTEGER,
277
- response_content TEXT,
278
- response_events TEXT,
279
- response_completedAt TEXT,
280
- input_tokens INTEGER DEFAULT 0,
281
- output_tokens INTEGER DEFAULT 0,
282
- FOREIGN KEY (threadId) REFERENCES threads(id) ON DELETE CASCADE
283
- )
284
- `);
285
- await db.execute(`
286
- INSERT INTO conversation_history SELECT
287
- id,
288
- threadId,
289
- conversationId,
290
- timestamp,
291
- status,
292
- request_message,
293
- request_model,
294
- request_attachments,
295
- request_planMode,
296
- response_content,
297
- response_events,
298
- response_completedAt,
299
- input_tokens,
300
- output_tokens
301
- FROM conversation_history_new
302
- `);
303
- await db.execute(`DROP TABLE conversation_history_new`);
304
- // Recreate indexes
305
- await db.execute(`
306
- CREATE INDEX IF NOT EXISTS idx_conversation_history_threadId ON conversation_history(threadId)
307
- `);
308
- await db.execute(`
309
- CREATE INDEX IF NOT EXISTS idx_conversation_history_conversationId ON conversation_history(conversationId)
310
- `);
311
- }
312
- }
313
- }
314
- // Check if threads table exists
315
- const threadsExists = await db.execute(`SELECT name FROM sqlite_master WHERE type='table' AND name='threads'`);
316
- if (threadsExists.rows.length > 0) {
317
- // Migration: Add ON DELETE CASCADE to threads.projectId foreign key
318
- const threadsTableInfo = await db.execute(`
319
- SELECT sql FROM sqlite_master
320
- WHERE type='table' AND name='threads'
321
- `);
322
- if (threadsTableInfo.rows.length > 0) {
323
- const tableSql = threadsTableInfo.rows[0].sql;
324
- if (!tableSql.includes("ON DELETE CASCADE")) {
325
- console.log("[db] Running migration: Adding ON DELETE CASCADE to threads.projectId foreign key");
326
- // Clean up any existing threads_new table from interrupted migration
327
- await db.execute(`DROP TABLE IF EXISTS threads_new`);
328
- // Temporarily disable foreign key constraints for the migration
329
- await db.execute("PRAGMA foreign_keys = OFF");
330
- try {
331
- // Recreate table with CASCADE
332
- await db.execute(`
333
- CREATE TABLE threads_new AS SELECT
334
- id,
335
- projectId,
336
- title,
337
- path,
338
- currentBranch,
339
- createdAt,
340
- enabledSkills,
341
- disabledSkills,
342
- currentConversationId,
343
- status
344
- FROM threads
345
- `);
346
- await db.execute(`DROP TABLE threads`);
347
- await db.execute(`
348
- CREATE TABLE threads (
349
- id TEXT PRIMARY KEY,
350
- projectId TEXT NOT NULL,
351
- title TEXT NOT NULL,
352
- path TEXT NOT NULL,
353
- currentBranch TEXT NOT NULL,
354
- createdAt TEXT NOT NULL,
355
- enabledSkills TEXT,
356
- disabledSkills TEXT,
357
- currentConversationId TEXT,
358
- status TEXT NOT NULL DEFAULT 'active',
359
- FOREIGN KEY (projectId) REFERENCES projects(id) ON DELETE CASCADE
360
- )
361
- `);
362
- await db.execute(`
363
- INSERT INTO threads SELECT
364
- id,
365
- projectId,
366
- title,
367
- path,
368
- currentBranch,
369
- createdAt,
370
- enabledSkills,
371
- disabledSkills,
372
- currentConversationId,
373
- status
374
- FROM threads_new
375
- `);
376
- await db.execute(`DROP TABLE threads_new`);
377
- // Recreate index
378
- await db.execute(`
379
- CREATE INDEX IF NOT EXISTS idx_threads_projectId ON threads(projectId)
380
- `);
381
- }
382
- finally {
383
- // Re-enable foreign key constraints
384
- await db.execute("PRAGMA foreign_keys = ON");
385
- }
386
- }
387
- }
388
- // Migration: Add currentConversationId column to threads if it doesn't exist
389
- const threadsInfo = await db.execute(`PRAGMA table_info(threads)`);
390
- const hasCurrentConversationId = threadsInfo.rows.some((col) => col.name === "currentConversationId");
391
- const hasStatusColumn = threadsInfo.rows.some((col) => col.name === "status");
392
- if (!hasCurrentConversationId) {
393
- console.log("[db] Running migration: Adding currentConversationId column to threads");
394
- await db.execute(`ALTER TABLE threads ADD COLUMN currentConversationId TEXT`);
395
- }
396
- if (!hasStatusColumn) {
397
- console.log("[db] Running migration: Adding status column to threads");
398
- await db.execute(`ALTER TABLE threads ADD COLUMN status TEXT NOT NULL DEFAULT 'active'`);
399
- }
400
- const hasDiffComments = threadsInfo.rows.some((col) => col.name === "diffComments");
401
- if (!hasDiffComments) {
402
- console.log("[db] Running migration: Adding diffComments column to threads");
403
- await db.execute(`ALTER TABLE threads ADD COLUMN diffComments TEXT`);
404
- }
405
- const hasModel = threadsInfo.rows.some((col) => col.name === "model");
406
- if (!hasModel) {
407
- console.log("[db] Running migration: Adding model column to threads");
408
- await db.execute(`ALTER TABLE threads ADD COLUMN model TEXT`);
409
- }
410
- const hasModelProvider = threadsInfo.rows.some((col) => col.name === "modelProvider");
411
- if (!hasModelProvider) {
412
- console.log("[db] Running migration: Adding modelProvider column to threads");
413
- await db.execute(`ALTER TABLE threads ADD COLUMN modelProvider TEXT`);
414
- }
415
- // Migration: Update existing model data to include provider
416
- const hasModelColumn = threadsInfo.rows.some((col) => col.name === "model");
417
- if (hasModelColumn) {
418
- console.log("[db] Running migration: Updating existing model data to include provider");
419
- // Set modelProvider to 'unknown' for threads that have model but no modelProvider
420
- // This indicates the provider couldn't be determined from the model format
421
- await db.execute(`
422
- UPDATE threads
423
- SET modelProvider = 'unknown'
424
- WHERE model IS NOT NULL AND modelProvider IS NULL
425
- `);
426
- console.log("[db] Updated rows:", (await db.execute("SELECT id, model, modelProvider FROM threads")).rows);
427
- }
428
- }
429
- // Migration: Add threadId to project_todos
430
- const projectTodosInfo = await db.execute(`PRAGMA table_info(project_todos)`);
431
- const hasThreadIdColumn = projectTodosInfo.rows.some((col) => col.name === "threadId");
432
- if (!hasThreadIdColumn) {
433
- console.log("[db] Running migration: Adding threadId column to project_todos");
434
- await db.execute(`ALTER TABLE project_todos ADD COLUMN threadId TEXT`);
435
- }
436
- // Migration: Create git_status_cache table if it doesn't exist
437
- const gitStatusCacheExists = await db.execute(`SELECT name FROM sqlite_master WHERE type='table' AND name='git_status_cache'`);
438
- if (gitStatusCacheExists.rows.length === 0) {
439
- console.log("[db] Running migration: Creating git_status_cache table");
440
- await db.execute(`
441
- CREATE TABLE git_status_cache (
442
- threadId TEXT PRIMARY KEY,
443
- data TEXT NOT NULL,
444
- cachedAt TEXT NOT NULL
445
- )
446
- `);
447
- }
448
- }
449
- catch (error) {
450
- console.error("Failed to run migrations:", error);
451
- throw error;
452
- }
453
- }
454
- /**
455
- * Close database connection
456
- * @param db SQLite database instance
457
- */
458
- export async function closeDatabase(_db) {
459
- // libsql-js doesn't have an explicit close method for file-based connections
460
- }
461
- // Singleton instance
462
- let dbInstance = null;
463
- /**
464
- * Get or create the singleton database instance
465
- * @returns SQLite database instance
466
- */
467
- export async function getDatabase() {
468
- dbInstance ??= await initializeDatabase();
469
- return dbInstance;
470
- }
471
- /**
472
- * Close the singleton database instance
473
- */
474
- export async function closeDatabaseInstance() {
475
- if (dbInstance) {
476
- await closeDatabase(dbInstance);
477
- dbInstance = null;
478
- }
479
- }
480
- //# sourceMappingURL=database.js.map
@@ -1,52 +0,0 @@
1
- /**
2
- * SQLite Database Operations for Application State
3
- *
4
- * This module handles key-value state storage in the SQLite database.
5
- * Supports complex values through JSON serialization.
6
- */
7
- import { Database } from "./database.types";
8
- /**
9
- * Set a state value
10
- * @param db SQLite database instance
11
- * @param key State key
12
- * @param value State value (will be JSON serialized)
13
- */
14
- export declare function setState(db: Database, key: string, value: unknown): Promise<void>;
15
- /**
16
- * Get a state value
17
- * @param db SQLite database instance
18
- * @param key State key
19
- * @returns Deserialized state value or null if not found
20
- */
21
- export declare function getState(db: Database, key: string): Promise<unknown>;
22
- /**
23
- * Get all state as a record
24
- * @param db SQLite database instance
25
- * @returns Record of all state key-value pairs
26
- */
27
- export declare function getAllState(db: Database): Promise<Record<string, unknown>>;
28
- /**
29
- * Delete a state value
30
- * @param db SQLite database instance
31
- * @param key State key
32
- */
33
- export declare function deleteState(db: Database, key: string): Promise<void>;
34
- /**
35
- * Check if a state key exists
36
- * @param db SQLite database instance
37
- * @param key State key
38
- * @returns True if key exists
39
- */
40
- export declare function stateKeyExists(db: Database, key: string): Promise<boolean>;
41
- /**
42
- * Clear all state
43
- * @param db SQLite database instance
44
- */
45
- export declare function clearAllState(db: Database): Promise<void>;
46
- /**
47
- * Get state value count
48
- * @param db SQLite database instance
49
- * @returns Number of state entries
50
- */
51
- export declare function getStateCount(db: Database): Promise<number>;
52
- //# sourceMappingURL=database.state.d.ts.map
@@ -1,119 +0,0 @@
1
- /**
2
- * SQLite Database Operations for Application State
3
- *
4
- * This module handles key-value state storage in the SQLite database.
5
- * Supports complex values through JSON serialization.
6
- */
7
- /**
8
- * Set a state value
9
- * @param db SQLite database instance
10
- * @param key State key
11
- * @param value State value (will be JSON serialized)
12
- */
13
- export async function setState(db, key, value) {
14
- try {
15
- const serialized = JSON.stringify(value);
16
- await db.execute("INSERT OR REPLACE INTO state (key, value) VALUES (?, ?)", [key, serialized]);
17
- }
18
- catch (error) {
19
- console.error(`Failed to set state for key "${key}":`, error);
20
- throw error;
21
- }
22
- }
23
- /**
24
- * Get a state value
25
- * @param db SQLite database instance
26
- * @param key State key
27
- * @returns Deserialized state value or null if not found
28
- */
29
- export async function getState(db, key) {
30
- const result = await db.execute("SELECT value FROM state WHERE key = ?", [key]);
31
- const row = result.rows[0];
32
- if (!row) {
33
- return null;
34
- }
35
- try {
36
- return JSON.parse(row.value);
37
- }
38
- catch (error) {
39
- console.error(`Failed to parse state value for key "${key}":`, error);
40
- return null;
41
- }
42
- }
43
- /**
44
- * Get all state as a record
45
- * @param db SQLite database instance
46
- * @returns Record of all state key-value pairs
47
- */
48
- export async function getAllState(db) {
49
- try {
50
- const result = await db.execute("SELECT key, value FROM state");
51
- const rows = result.rows;
52
- const stateResult = {};
53
- for (const row of rows) {
54
- // Skip encryption_key as it's handled separately by crypto module
55
- if (row.key === "encryption_key") {
56
- continue;
57
- }
58
- try {
59
- stateResult[row.key] = JSON.parse(row.value);
60
- }
61
- catch (error) {
62
- console.error(`Failed to parse state value for key "${row.key}":`, error);
63
- stateResult[row.key] = null;
64
- }
65
- }
66
- return stateResult;
67
- }
68
- catch (error) {
69
- console.error("Failed to get all state:", error);
70
- throw error;
71
- }
72
- }
73
- /**
74
- * Delete a state value
75
- * @param db SQLite database instance
76
- * @param key State key
77
- */
78
- export async function deleteState(db, key) {
79
- try {
80
- await db.execute("DELETE FROM state WHERE key = ?", [key]);
81
- }
82
- catch (error) {
83
- console.error(`Failed to delete state for key "${key}":`, error);
84
- throw error;
85
- }
86
- }
87
- /**
88
- * Check if a state key exists
89
- * @param db SQLite database instance
90
- * @param key State key
91
- * @returns True if key exists
92
- */
93
- export async function stateKeyExists(db, key) {
94
- const result = await db.execute("SELECT 1 FROM state WHERE key = ? LIMIT 1", [key]);
95
- return result.rows.length > 0;
96
- }
97
- /**
98
- * Clear all state
99
- * @param db SQLite database instance
100
- */
101
- export async function clearAllState(db) {
102
- try {
103
- await db.execute("DELETE FROM state");
104
- }
105
- catch (error) {
106
- console.error("Failed to clear all state:", error);
107
- throw error;
108
- }
109
- }
110
- /**
111
- * Get state value count
112
- * @param db SQLite database instance
113
- * @returns Number of state entries
114
- */
115
- export async function getStateCount(db) {
116
- const result = await db.execute("SELECT COUNT(*) as count FROM state");
117
- return result.rows[0].count;
118
- }
119
- //# sourceMappingURL=database.state.js.map
@@ -1,22 +0,0 @@
1
- /**
2
- * Test Database Utilities
3
- *
4
- * Provides in-memory SQLite database for testing using libsql-js
5
- * for compatibility with Node test environment.
6
- */
7
- import type { Database } from "./database.types";
8
- /**
9
- * Create an in-memory database for testing
10
- * @returns SQLite database instance compatible with libsql-js API
11
- */
12
- export declare function createTestDatabase(): Promise<Database>;
13
- /**
14
- * Mock the database module for testing
15
- * @returns Mock database functions
16
- */
17
- export declare function createMockDatabase(): Promise<{
18
- initializeDatabase: () => import("@libsql/client").Client;
19
- getDatabase: () => import("@libsql/client").Client;
20
- getDatabasePath: () => string;
21
- }>;
22
- //# sourceMappingURL=database.test-utils.d.ts.map