alchemylab-opencode 1.0.7 → 1.0.8

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 (358) hide show
  1. package/package.json +2 -15
  2. package/build.mjs +0 -192
  3. package/packages/opencode/package.json +0 -138
  4. package/packages/opencode/src/account/account.sql.ts +0 -39
  5. package/packages/opencode/src/account/index.ts +0 -463
  6. package/packages/opencode/src/account/repo.ts +0 -163
  7. package/packages/opencode/src/account/schema.ts +0 -91
  8. package/packages/opencode/src/acp/README.md +0 -174
  9. package/packages/opencode/src/acp/agent.ts +0 -1847
  10. package/packages/opencode/src/acp/session.ts +0 -116
  11. package/packages/opencode/src/acp/types.ts +0 -24
  12. package/packages/opencode/src/agent/agent.ts +0 -420
  13. package/packages/opencode/src/agent/generate.txt +0 -75
  14. package/packages/opencode/src/agent/prompt/compaction.txt +0 -15
  15. package/packages/opencode/src/agent/prompt/explore.txt +0 -18
  16. package/packages/opencode/src/agent/prompt/summary.txt +0 -11
  17. package/packages/opencode/src/agent/prompt/title.txt +0 -44
  18. package/packages/opencode/src/auth/index.ts +0 -110
  19. package/packages/opencode/src/bus/bus-event.ts +0 -40
  20. package/packages/opencode/src/bus/global.ts +0 -10
  21. package/packages/opencode/src/bus/index.ts +0 -185
  22. package/packages/opencode/src/cli/bootstrap.ts +0 -17
  23. package/packages/opencode/src/cli/cmd/cmd.ts +0 -7
  24. package/packages/opencode/src/cli/cmd/run.ts +0 -689
  25. package/packages/opencode/src/cli/cmd/serve.ts +0 -24
  26. package/packages/opencode/src/cli/cmd/tui/event.ts +0 -49
  27. package/packages/opencode/src/cli/effect/prompt.ts +0 -25
  28. package/packages/opencode/src/cli/error.ts +0 -46
  29. package/packages/opencode/src/cli/heap.ts +0 -59
  30. package/packages/opencode/src/cli/logo.ts +0 -6
  31. package/packages/opencode/src/cli/network.ts +0 -60
  32. package/packages/opencode/src/cli/ui.ts +0 -133
  33. package/packages/opencode/src/cli/upgrade.ts +0 -31
  34. package/packages/opencode/src/command/index.ts +0 -195
  35. package/packages/opencode/src/command/template/initialize.txt +0 -66
  36. package/packages/opencode/src/command/template/review.txt +0 -101
  37. package/packages/opencode/src/config/config.ts +0 -1599
  38. package/packages/opencode/src/config/console-state.ts +0 -15
  39. package/packages/opencode/src/config/markdown.ts +0 -99
  40. package/packages/opencode/src/config/paths.ts +0 -167
  41. package/packages/opencode/src/config/tui-migrate.ts +0 -155
  42. package/packages/opencode/src/config/tui-schema.ts +0 -37
  43. package/packages/opencode/src/config/tui.ts +0 -179
  44. package/packages/opencode/src/control-plane/adaptors/index.ts +0 -20
  45. package/packages/opencode/src/control-plane/adaptors/worktree.ts +0 -42
  46. package/packages/opencode/src/control-plane/schema.ts +0 -17
  47. package/packages/opencode/src/control-plane/sse.ts +0 -66
  48. package/packages/opencode/src/control-plane/types.ts +0 -32
  49. package/packages/opencode/src/control-plane/workspace.sql.ts +0 -17
  50. package/packages/opencode/src/control-plane/workspace.ts +0 -168
  51. package/packages/opencode/src/effect/cross-spawn-spawner.ts +0 -502
  52. package/packages/opencode/src/effect/instance-ref.ts +0 -6
  53. package/packages/opencode/src/effect/instance-registry.ts +0 -12
  54. package/packages/opencode/src/effect/instance-state.ts +0 -82
  55. package/packages/opencode/src/effect/run-service.ts +0 -33
  56. package/packages/opencode/src/effect/runner.ts +0 -216
  57. package/packages/opencode/src/env/index.ts +0 -28
  58. package/packages/opencode/src/file/ignore.ts +0 -82
  59. package/packages/opencode/src/file/index.ts +0 -686
  60. package/packages/opencode/src/file/protected.ts +0 -59
  61. package/packages/opencode/src/file/ripgrep.ts +0 -376
  62. package/packages/opencode/src/file/time.ts +0 -133
  63. package/packages/opencode/src/file/watcher.ts +0 -173
  64. package/packages/opencode/src/filesystem/index.ts +0 -236
  65. package/packages/opencode/src/flag/flag.ts +0 -156
  66. package/packages/opencode/src/format/formatter.ts +0 -413
  67. package/packages/opencode/src/format/index.ts +0 -203
  68. package/packages/opencode/src/git/index.ts +0 -303
  69. package/packages/opencode/src/global/index.ts +0 -56
  70. package/packages/opencode/src/id/id.ts +0 -85
  71. package/packages/opencode/src/ide/index.ts +0 -74
  72. package/packages/opencode/src/installation/index.ts +0 -355
  73. package/packages/opencode/src/installation/meta.ts +0 -7
  74. package/packages/opencode/src/lsp/client.ts +0 -252
  75. package/packages/opencode/src/lsp/index.ts +0 -558
  76. package/packages/opencode/src/lsp/language.ts +0 -120
  77. package/packages/opencode/src/lsp/launch.ts +0 -21
  78. package/packages/opencode/src/lsp/server.ts +0 -1968
  79. package/packages/opencode/src/mcp/auth.ts +0 -173
  80. package/packages/opencode/src/mcp/index.ts +0 -931
  81. package/packages/opencode/src/mcp/oauth-callback.ts +0 -216
  82. package/packages/opencode/src/mcp/oauth-provider.ts +0 -185
  83. package/packages/opencode/src/node-loader.mjs +0 -104
  84. package/packages/opencode/src/node-preload.mjs +0 -39
  85. package/packages/opencode/src/node.ts +0 -1
  86. package/packages/opencode/src/npm/index.ts +0 -188
  87. package/packages/opencode/src/patch/index.ts +0 -680
  88. package/packages/opencode/src/permission/arity.ts +0 -163
  89. package/packages/opencode/src/permission/evaluate.ts +0 -15
  90. package/packages/opencode/src/permission/index.ts +0 -325
  91. package/packages/opencode/src/permission/schema.ts +0 -17
  92. package/packages/opencode/src/plugin/cloudflare.ts +0 -67
  93. package/packages/opencode/src/plugin/codex.ts +0 -608
  94. package/packages/opencode/src/plugin/github-copilot/copilot.ts +0 -361
  95. package/packages/opencode/src/plugin/github-copilot/models.ts +0 -144
  96. package/packages/opencode/src/plugin/index.ts +0 -299
  97. package/packages/opencode/src/plugin/install.ts +0 -439
  98. package/packages/opencode/src/plugin/loader.ts +0 -174
  99. package/packages/opencode/src/plugin/meta.ts +0 -188
  100. package/packages/opencode/src/plugin/shared.ts +0 -323
  101. package/packages/opencode/src/project/bootstrap.ts +0 -31
  102. package/packages/opencode/src/project/instance.ts +0 -175
  103. package/packages/opencode/src/project/project.sql.ts +0 -16
  104. package/packages/opencode/src/project/project.ts +0 -519
  105. package/packages/opencode/src/project/schema.ts +0 -16
  106. package/packages/opencode/src/project/state.ts +0 -70
  107. package/packages/opencode/src/project/vcs.ts +0 -240
  108. package/packages/opencode/src/provider/auth.ts +0 -253
  109. package/packages/opencode/src/provider/error.ts +0 -197
  110. package/packages/opencode/src/provider/models.ts +0 -162
  111. package/packages/opencode/src/provider/provider.ts +0 -1709
  112. package/packages/opencode/src/provider/schema.ts +0 -38
  113. package/packages/opencode/src/provider/sdk/copilot/README.md +0 -5
  114. package/packages/opencode/src/provider/sdk/copilot/chat/convert-to-openai-compatible-chat-messages.ts +0 -170
  115. package/packages/opencode/src/provider/sdk/copilot/chat/get-response-metadata.ts +0 -15
  116. package/packages/opencode/src/provider/sdk/copilot/chat/map-openai-compatible-finish-reason.ts +0 -19
  117. package/packages/opencode/src/provider/sdk/copilot/chat/openai-compatible-api-types.ts +0 -64
  118. package/packages/opencode/src/provider/sdk/copilot/chat/openai-compatible-chat-language-model.ts +0 -815
  119. package/packages/opencode/src/provider/sdk/copilot/chat/openai-compatible-chat-options.ts +0 -28
  120. package/packages/opencode/src/provider/sdk/copilot/chat/openai-compatible-metadata-extractor.ts +0 -44
  121. package/packages/opencode/src/provider/sdk/copilot/chat/openai-compatible-prepare-tools.ts +0 -83
  122. package/packages/opencode/src/provider/sdk/copilot/copilot-provider.ts +0 -100
  123. package/packages/opencode/src/provider/sdk/copilot/index.ts +0 -2
  124. package/packages/opencode/src/provider/sdk/copilot/openai-compatible-error.ts +0 -27
  125. package/packages/opencode/src/provider/sdk/copilot/responses/convert-to-openai-responses-input.ts +0 -335
  126. package/packages/opencode/src/provider/sdk/copilot/responses/map-openai-responses-finish-reason.ts +0 -22
  127. package/packages/opencode/src/provider/sdk/copilot/responses/openai-config.ts +0 -18
  128. package/packages/opencode/src/provider/sdk/copilot/responses/openai-error.ts +0 -22
  129. package/packages/opencode/src/provider/sdk/copilot/responses/openai-responses-api-types.ts +0 -214
  130. package/packages/opencode/src/provider/sdk/copilot/responses/openai-responses-language-model.ts +0 -1769
  131. package/packages/opencode/src/provider/sdk/copilot/responses/openai-responses-prepare-tools.ts +0 -173
  132. package/packages/opencode/src/provider/sdk/copilot/responses/openai-responses-settings.ts +0 -1
  133. package/packages/opencode/src/provider/sdk/copilot/responses/tool/code-interpreter.ts +0 -87
  134. package/packages/opencode/src/provider/sdk/copilot/responses/tool/file-search.ts +0 -127
  135. package/packages/opencode/src/provider/sdk/copilot/responses/tool/image-generation.ts +0 -114
  136. package/packages/opencode/src/provider/sdk/copilot/responses/tool/local-shell.ts +0 -64
  137. package/packages/opencode/src/provider/sdk/copilot/responses/tool/web-search-preview.ts +0 -103
  138. package/packages/opencode/src/provider/sdk/copilot/responses/tool/web-search.ts +0 -102
  139. package/packages/opencode/src/provider/transform.ts +0 -1050
  140. package/packages/opencode/src/pty/index.ts +0 -397
  141. package/packages/opencode/src/pty/pty.node.ts +0 -27
  142. package/packages/opencode/src/pty/pty.ts +0 -25
  143. package/packages/opencode/src/pty/schema.ts +0 -17
  144. package/packages/opencode/src/question/index.ts +0 -224
  145. package/packages/opencode/src/question/schema.ts +0 -17
  146. package/packages/opencode/src/run.ts +0 -28
  147. package/packages/opencode/src/serve.ts +0 -45
  148. package/packages/opencode/src/server/error.ts +0 -36
  149. package/packages/opencode/src/server/event.ts +0 -7
  150. package/packages/opencode/src/server/instance.ts +0 -324
  151. package/packages/opencode/src/server/mdns.ts +0 -60
  152. package/packages/opencode/src/server/middleware.ts +0 -33
  153. package/packages/opencode/src/server/projectors.ts +0 -28
  154. package/packages/opencode/src/server/proxy.ts +0 -131
  155. package/packages/opencode/src/server/router.ts +0 -105
  156. package/packages/opencode/src/server/routes/config.ts +0 -92
  157. package/packages/opencode/src/server/routes/event.ts +0 -83
  158. package/packages/opencode/src/server/routes/experimental.ts +0 -374
  159. package/packages/opencode/src/server/routes/file.ts +0 -197
  160. package/packages/opencode/src/server/routes/global.ts +0 -312
  161. package/packages/opencode/src/server/routes/mcp.ts +0 -225
  162. package/packages/opencode/src/server/routes/permission.ts +0 -69
  163. package/packages/opencode/src/server/routes/project.ts +0 -118
  164. package/packages/opencode/src/server/routes/provider.ts +0 -171
  165. package/packages/opencode/src/server/routes/pty.ts +0 -210
  166. package/packages/opencode/src/server/routes/question.ts +0 -99
  167. package/packages/opencode/src/server/routes/session.ts +0 -1030
  168. package/packages/opencode/src/server/routes/tui.ts +0 -379
  169. package/packages/opencode/src/server/routes/workspace.ts +0 -94
  170. package/packages/opencode/src/server/server.ts +0 -353
  171. package/packages/opencode/src/session/compaction.ts +0 -428
  172. package/packages/opencode/src/session/index.ts +0 -887
  173. package/packages/opencode/src/session/instruction.ts +0 -258
  174. package/packages/opencode/src/session/llm.ts +0 -354
  175. package/packages/opencode/src/session/message-v2.ts +0 -1031
  176. package/packages/opencode/src/session/message.ts +0 -191
  177. package/packages/opencode/src/session/overflow.ts +0 -22
  178. package/packages/opencode/src/session/processor.ts +0 -523
  179. package/packages/opencode/src/session/projectors.ts +0 -135
  180. package/packages/opencode/src/session/prompt/anthropic.txt +0 -105
  181. package/packages/opencode/src/session/prompt/beast.txt +0 -147
  182. package/packages/opencode/src/session/prompt/build-switch.txt +0 -5
  183. package/packages/opencode/src/session/prompt/codex.txt +0 -79
  184. package/packages/opencode/src/session/prompt/copilot-gpt-5.txt +0 -143
  185. package/packages/opencode/src/session/prompt/default.txt +0 -105
  186. package/packages/opencode/src/session/prompt/gemini.txt +0 -155
  187. package/packages/opencode/src/session/prompt/gpt.txt +0 -107
  188. package/packages/opencode/src/session/prompt/kimi.txt +0 -95
  189. package/packages/opencode/src/session/prompt/max-steps.txt +0 -16
  190. package/packages/opencode/src/session/prompt/plan-reminder-anthropic.txt +0 -67
  191. package/packages/opencode/src/session/prompt/plan.txt +0 -26
  192. package/packages/opencode/src/session/prompt/trinity.txt +0 -97
  193. package/packages/opencode/src/session/prompt.ts +0 -1911
  194. package/packages/opencode/src/session/retry.ts +0 -106
  195. package/packages/opencode/src/session/revert.ts +0 -176
  196. package/packages/opencode/src/session/schema.ts +0 -38
  197. package/packages/opencode/src/session/session.sql.ts +0 -103
  198. package/packages/opencode/src/session/status.ts +0 -102
  199. package/packages/opencode/src/session/summary.ts +0 -177
  200. package/packages/opencode/src/session/system.ts +0 -76
  201. package/packages/opencode/src/session/todo.ts +0 -95
  202. package/packages/opencode/src/share/share-next.ts +0 -369
  203. package/packages/opencode/src/share/share.sql.ts +0 -13
  204. package/packages/opencode/src/shell/shell.ts +0 -110
  205. package/packages/opencode/src/skill/discovery.ts +0 -116
  206. package/packages/opencode/src/skill/index.ts +0 -277
  207. package/packages/opencode/src/snapshot/index.ts +0 -726
  208. package/packages/opencode/src/sql.d.ts +0 -4
  209. package/packages/opencode/src/storage/db.node.ts +0 -8
  210. package/packages/opencode/src/storage/db.ts +0 -177
  211. package/packages/opencode/src/storage/json-migration.ts +0 -425
  212. package/packages/opencode/src/storage/schema.sql.ts +0 -10
  213. package/packages/opencode/src/storage/schema.ts +0 -5
  214. package/packages/opencode/src/storage/storage.ts +0 -353
  215. package/packages/opencode/src/sync/README.md +0 -179
  216. package/packages/opencode/src/sync/event.sql.ts +0 -16
  217. package/packages/opencode/src/sync/index.ts +0 -263
  218. package/packages/opencode/src/sync/schema.ts +0 -14
  219. package/packages/opencode/src/tool/apply_patch.ts +0 -281
  220. package/packages/opencode/src/tool/apply_patch.txt +0 -33
  221. package/packages/opencode/src/tool/bash.ts +0 -496
  222. package/packages/opencode/src/tool/bash.txt +0 -117
  223. package/packages/opencode/src/tool/batch.ts +0 -183
  224. package/packages/opencode/src/tool/batch.txt +0 -24
  225. package/packages/opencode/src/tool/codesearch.ts +0 -132
  226. package/packages/opencode/src/tool/codesearch.txt +0 -12
  227. package/packages/opencode/src/tool/edit.ts +0 -667
  228. package/packages/opencode/src/tool/edit.txt +0 -10
  229. package/packages/opencode/src/tool/external-directory.ts +0 -46
  230. package/packages/opencode/src/tool/glob.ts +0 -78
  231. package/packages/opencode/src/tool/glob.txt +0 -6
  232. package/packages/opencode/src/tool/grep.ts +0 -156
  233. package/packages/opencode/src/tool/grep.txt +0 -8
  234. package/packages/opencode/src/tool/invalid.ts +0 -17
  235. package/packages/opencode/src/tool/ls.ts +0 -121
  236. package/packages/opencode/src/tool/ls.txt +0 -1
  237. package/packages/opencode/src/tool/lsp.ts +0 -97
  238. package/packages/opencode/src/tool/lsp.txt +0 -19
  239. package/packages/opencode/src/tool/multiedit.ts +0 -46
  240. package/packages/opencode/src/tool/multiedit.txt +0 -41
  241. package/packages/opencode/src/tool/plan-enter.txt +0 -14
  242. package/packages/opencode/src/tool/plan-exit.txt +0 -13
  243. package/packages/opencode/src/tool/plan.ts +0 -131
  244. package/packages/opencode/src/tool/question.ts +0 -46
  245. package/packages/opencode/src/tool/question.txt +0 -10
  246. package/packages/opencode/src/tool/read.ts +0 -332
  247. package/packages/opencode/src/tool/read.txt +0 -14
  248. package/packages/opencode/src/tool/registry.ts +0 -265
  249. package/packages/opencode/src/tool/schema.ts +0 -17
  250. package/packages/opencode/src/tool/skill.ts +0 -105
  251. package/packages/opencode/src/tool/task.ts +0 -166
  252. package/packages/opencode/src/tool/task.txt +0 -60
  253. package/packages/opencode/src/tool/todo.ts +0 -48
  254. package/packages/opencode/src/tool/todowrite.txt +0 -167
  255. package/packages/opencode/src/tool/tool.ts +0 -112
  256. package/packages/opencode/src/tool/truncate.ts +0 -144
  257. package/packages/opencode/src/tool/truncation-dir.ts +0 -4
  258. package/packages/opencode/src/tool/webfetch.ts +0 -206
  259. package/packages/opencode/src/tool/webfetch.txt +0 -13
  260. package/packages/opencode/src/tool/websearch.ts +0 -150
  261. package/packages/opencode/src/tool/websearch.txt +0 -14
  262. package/packages/opencode/src/tool/write.ts +0 -84
  263. package/packages/opencode/src/tool/write.txt +0 -8
  264. package/packages/opencode/src/util/abort.ts +0 -35
  265. package/packages/opencode/src/util/archive.ts +0 -17
  266. package/packages/opencode/src/util/color.ts +0 -19
  267. package/packages/opencode/src/util/context.ts +0 -25
  268. package/packages/opencode/src/util/data-url.ts +0 -9
  269. package/packages/opencode/src/util/defer.ts +0 -12
  270. package/packages/opencode/src/util/effect-http-client.ts +0 -11
  271. package/packages/opencode/src/util/effect-zod.ts +0 -98
  272. package/packages/opencode/src/util/error.ts +0 -77
  273. package/packages/opencode/src/util/filesystem.ts +0 -245
  274. package/packages/opencode/src/util/flock.ts +0 -333
  275. package/packages/opencode/src/util/fn.ts +0 -21
  276. package/packages/opencode/src/util/format.ts +0 -20
  277. package/packages/opencode/src/util/glob.ts +0 -34
  278. package/packages/opencode/src/util/hash.ts +0 -7
  279. package/packages/opencode/src/util/iife.ts +0 -3
  280. package/packages/opencode/src/util/keybind.ts +0 -103
  281. package/packages/opencode/src/util/lazy.ts +0 -23
  282. package/packages/opencode/src/util/locale.ts +0 -81
  283. package/packages/opencode/src/util/lock.ts +0 -98
  284. package/packages/opencode/src/util/log.ts +0 -182
  285. package/packages/opencode/src/util/network.ts +0 -9
  286. package/packages/opencode/src/util/process.ts +0 -176
  287. package/packages/opencode/src/util/queue.ts +0 -32
  288. package/packages/opencode/src/util/record.ts +0 -3
  289. package/packages/opencode/src/util/rpc.ts +0 -66
  290. package/packages/opencode/src/util/schema.ts +0 -53
  291. package/packages/opencode/src/util/scrap.ts +0 -10
  292. package/packages/opencode/src/util/signal.ts +0 -12
  293. package/packages/opencode/src/util/timeout.ts +0 -14
  294. package/packages/opencode/src/util/token.ts +0 -7
  295. package/packages/opencode/src/util/update-schema.ts +0 -13
  296. package/packages/opencode/src/util/which.ts +0 -14
  297. package/packages/opencode/src/util/wildcard.ts +0 -59
  298. package/packages/opencode/src/worktree/index.ts +0 -612
  299. package/packages/plugin/package.json +0 -38
  300. package/packages/plugin/src/example.ts +0 -18
  301. package/packages/plugin/src/index.ts +0 -282
  302. package/packages/plugin/src/shell.ts +0 -136
  303. package/packages/plugin/src/tool.ts +0 -38
  304. package/packages/plugin/src/tui.ts +0 -508
  305. package/packages/script/package.json +0 -16
  306. package/packages/script/src/index.ts +0 -77
  307. package/packages/sdk/package.json +0 -33
  308. package/packages/sdk/src/client.ts +0 -55
  309. package/packages/sdk/src/gen/client/client.gen.ts +0 -212
  310. package/packages/sdk/src/gen/client/index.ts +0 -25
  311. package/packages/sdk/src/gen/client/types.gen.ts +0 -222
  312. package/packages/sdk/src/gen/client/utils.gen.ts +0 -287
  313. package/packages/sdk/src/gen/client.gen.ts +0 -22
  314. package/packages/sdk/src/gen/core/auth.gen.ts +0 -41
  315. package/packages/sdk/src/gen/core/bodySerializer.gen.ts +0 -74
  316. package/packages/sdk/src/gen/core/params.gen.ts +0 -144
  317. package/packages/sdk/src/gen/core/pathSerializer.gen.ts +0 -167
  318. package/packages/sdk/src/gen/core/queryKeySerializer.gen.ts +0 -111
  319. package/packages/sdk/src/gen/core/serverSentEvents.gen.ts +0 -210
  320. package/packages/sdk/src/gen/core/types.gen.ts +0 -91
  321. package/packages/sdk/src/gen/core/utils.gen.ts +0 -109
  322. package/packages/sdk/src/gen/sdk.gen.ts +0 -1197
  323. package/packages/sdk/src/gen/types.gen.ts +0 -3904
  324. package/packages/sdk/src/index.ts +0 -21
  325. package/packages/sdk/src/process.ts +0 -31
  326. package/packages/sdk/src/server.ts +0 -134
  327. package/packages/sdk/src/v2/client.ts +0 -81
  328. package/packages/sdk/src/v2/gen/client/client.gen.ts +0 -285
  329. package/packages/sdk/src/v2/gen/client/index.ts +0 -25
  330. package/packages/sdk/src/v2/gen/client/types.gen.ts +0 -202
  331. package/packages/sdk/src/v2/gen/client/utils.gen.ts +0 -289
  332. package/packages/sdk/src/v2/gen/client.gen.ts +0 -18
  333. package/packages/sdk/src/v2/gen/core/auth.gen.ts +0 -41
  334. package/packages/sdk/src/v2/gen/core/bodySerializer.gen.ts +0 -82
  335. package/packages/sdk/src/v2/gen/core/params.gen.ts +0 -169
  336. package/packages/sdk/src/v2/gen/core/pathSerializer.gen.ts +0 -167
  337. package/packages/sdk/src/v2/gen/core/queryKeySerializer.gen.ts +0 -111
  338. package/packages/sdk/src/v2/gen/core/serverSentEvents.gen.ts +0 -239
  339. package/packages/sdk/src/v2/gen/core/types.gen.ts +0 -86
  340. package/packages/sdk/src/v2/gen/core/utils.gen.ts +0 -137
  341. package/packages/sdk/src/v2/gen/sdk.gen.ts +0 -4223
  342. package/packages/sdk/src/v2/gen/types.gen.ts +0 -5265
  343. package/packages/sdk/src/v2/index.ts +0 -21
  344. package/packages/sdk/src/v2/server.ts +0 -134
  345. package/packages/util/package.json +0 -20
  346. package/packages/util/src/array.ts +0 -10
  347. package/packages/util/src/binary.ts +0 -41
  348. package/packages/util/src/encode.ts +0 -51
  349. package/packages/util/src/error.ts +0 -54
  350. package/packages/util/src/fn.ts +0 -11
  351. package/packages/util/src/identifier.ts +0 -48
  352. package/packages/util/src/iife.ts +0 -3
  353. package/packages/util/src/lazy.ts +0 -11
  354. package/packages/util/src/module.ts +0 -10
  355. package/packages/util/src/path.ts +0 -37
  356. package/packages/util/src/retry.ts +0 -41
  357. package/packages/util/src/slug.ts +0 -74
  358. package/postinstall.cjs +0 -55
@@ -1,131 +0,0 @@
1
- import z from "zod"
2
- import path from "path"
3
- import { Tool } from "./tool"
4
- import { Question } from "../question"
5
- import { Session } from "../session"
6
- import { MessageV2 } from "../session/message-v2"
7
- import { Provider } from "../provider/provider"
8
- import { Instance } from "../project/instance"
9
- import { type SessionID, MessageID, PartID } from "../session/schema"
10
- import EXIT_DESCRIPTION from "./plan-exit.txt"
11
-
12
- async function getLastModel(sessionID: SessionID) {
13
- for await (const item of MessageV2.stream(sessionID)) {
14
- if (item.info.role === "user" && item.info.model) return item.info.model
15
- }
16
- return Provider.defaultModel()
17
- }
18
-
19
- export const PlanExitTool = Tool.define("plan_exit", {
20
- description: EXIT_DESCRIPTION,
21
- parameters: z.object({}),
22
- async execute(_params, ctx) {
23
- const session = await Session.get(ctx.sessionID)
24
- const plan = path.relative(Instance.worktree, Session.plan(session))
25
- const answers = await Question.ask({
26
- sessionID: ctx.sessionID,
27
- questions: [
28
- {
29
- question: `Plan at ${plan} is complete. Would you like to switch to the build agent and start implementing?`,
30
- header: "Build Agent",
31
- custom: false,
32
- options: [
33
- { label: "Yes", description: "Switch to build agent and start implementing the plan" },
34
- { label: "No", description: "Stay with plan agent to continue refining the plan" },
35
- ],
36
- },
37
- ],
38
- tool: ctx.callID ? { messageID: ctx.messageID, callID: ctx.callID } : undefined,
39
- })
40
-
41
- const answer = answers[0]?.[0]
42
- if (answer === "No") throw new Question.RejectedError()
43
-
44
- const model = await getLastModel(ctx.sessionID)
45
-
46
- const userMsg: MessageV2.User = {
47
- id: MessageID.ascending(),
48
- sessionID: ctx.sessionID,
49
- role: "user",
50
- time: {
51
- created: Date.now(),
52
- },
53
- agent: "build",
54
- model,
55
- }
56
- await Session.updateMessage(userMsg)
57
- await Session.updatePart({
58
- id: PartID.ascending(),
59
- messageID: userMsg.id,
60
- sessionID: ctx.sessionID,
61
- type: "text",
62
- text: `The plan at ${plan} has been approved, you can now edit files. Execute the plan`,
63
- synthetic: true,
64
- } satisfies MessageV2.TextPart)
65
-
66
- return {
67
- title: "Switching to build agent",
68
- output: "User approved switching to build agent. Wait for further instructions.",
69
- metadata: {},
70
- }
71
- },
72
- })
73
-
74
- /*
75
- export const PlanEnterTool = Tool.define("plan_enter", {
76
- description: ENTER_DESCRIPTION,
77
- parameters: z.object({}),
78
- async execute(_params, ctx) {
79
- const session = await Session.get(ctx.sessionID)
80
- const plan = path.relative(Instance.worktree, Session.plan(session))
81
-
82
- const answers = await Question.ask({
83
- sessionID: ctx.sessionID,
84
- questions: [
85
- {
86
- question: `Would you like to switch to the plan agent and create a plan saved to ${plan}?`,
87
- header: "Plan Mode",
88
- custom: false,
89
- options: [
90
- { label: "Yes", description: "Switch to plan agent for research and planning" },
91
- { label: "No", description: "Stay with build agent to continue making changes" },
92
- ],
93
- },
94
- ],
95
- tool: ctx.callID ? { messageID: ctx.messageID, callID: ctx.callID } : undefined,
96
- })
97
-
98
- const answer = answers[0]?.[0]
99
-
100
- if (answer === "No") throw new Question.RejectedError()
101
-
102
- const model = await getLastModel(ctx.sessionID)
103
-
104
- const userMsg: MessageV2.User = {
105
- id: MessageID.ascending(),
106
- sessionID: ctx.sessionID,
107
- role: "user",
108
- time: {
109
- created: Date.now(),
110
- },
111
- agent: "plan",
112
- model,
113
- }
114
- await Session.updateMessage(userMsg)
115
- await Session.updatePart({
116
- id: PartID.ascending(),
117
- messageID: userMsg.id,
118
- sessionID: ctx.sessionID,
119
- type: "text",
120
- text: "User has requested to enter plan mode. Switch to plan mode and begin planning.",
121
- synthetic: true,
122
- } satisfies MessageV2.TextPart)
123
-
124
- return {
125
- title: "Switching to plan agent",
126
- output: `User confirmed to switch to plan mode. A new message has been created to switch you to plan mode. The plan file will be at ${plan}. Begin planning.`,
127
- metadata: {},
128
- }
129
- },
130
- })
131
- */
@@ -1,46 +0,0 @@
1
- import z from "zod"
2
- import { Effect } from "effect"
3
- import { Tool } from "./tool"
4
- import { Question } from "../question"
5
- import DESCRIPTION from "./question.txt"
6
-
7
- const parameters = z.object({
8
- questions: z.array(Question.Info.omit({ custom: true })).describe("Questions to ask"),
9
- })
10
-
11
- type Metadata = {
12
- answers: Question.Answer[]
13
- }
14
-
15
- export const QuestionTool = Tool.defineEffect<typeof parameters, Metadata, Question.Service>(
16
- "question",
17
- Effect.gen(function* () {
18
- const question = yield* Question.Service
19
-
20
- return {
21
- description: DESCRIPTION,
22
- parameters,
23
- async execute(params: z.infer<typeof parameters>, ctx: Tool.Context<Metadata>) {
24
- const answers = await question
25
- .ask({
26
- sessionID: ctx.sessionID,
27
- questions: params.questions,
28
- tool: ctx.callID ? { messageID: ctx.messageID, callID: ctx.callID } : undefined,
29
- })
30
- .pipe(Effect.runPromise)
31
-
32
- const formatted = params.questions
33
- .map((q, i) => `"${q.question}"="${answers[i]?.length ? answers[i].join(", ") : "Unanswered"}"`)
34
- .join(", ")
35
-
36
- return {
37
- title: `Asked ${params.questions.length} question${params.questions.length > 1 ? "s" : ""}`,
38
- output: `User has answered your questions: ${formatted}. You can now continue with the user's answers in mind.`,
39
- metadata: {
40
- answers,
41
- },
42
- }
43
- },
44
- } satisfies Tool.Def<typeof parameters, Metadata>
45
- }),
46
- )
@@ -1,10 +0,0 @@
1
- Use this tool when you need to ask the user questions during execution. This allows you to:
2
- 1. Gather user preferences or requirements
3
- 2. Clarify ambiguous instructions
4
- 3. Get decisions on implementation choices as you work
5
- 4. Offer choices to the user about what direction to take.
6
-
7
- Usage notes:
8
- - When `custom` is enabled (default), a "Type your own answer" option is added automatically; don't include "Other" or catch-all options
9
- - Answers are returned as arrays of labels; set `multiple: true` to allow selecting more than one
10
- - If you recommend a specific option, make that the first option in the list and add "(Recommended)" at the end of the label
@@ -1,332 +0,0 @@
1
- import z from "zod"
2
- import { Effect, Scope } from "effect"
3
- import { createReadStream } from "fs"
4
- import { open } from "fs/promises"
5
- import * as path from "path"
6
- import { createInterface } from "readline"
7
- import { Tool } from "./tool"
8
- import { AppFileSystem } from "../filesystem"
9
- import { LSP } from "../lsp"
10
- import { FileTime } from "../file/time"
11
- import DESCRIPTION from "./read.txt"
12
- import { Instance } from "../project/instance"
13
- import { assertExternalDirectoryEffect } from "./external-directory"
14
- import { Instruction } from "../session/instruction"
15
-
16
- const DEFAULT_READ_LIMIT = 2000
17
- const MAX_LINE_LENGTH = 2000
18
- const MAX_LINE_SUFFIX = `... (line truncated to ${MAX_LINE_LENGTH} chars)`
19
- const MAX_BYTES = 50 * 1024
20
- const MAX_BYTES_LABEL = `${MAX_BYTES / 1024} KB`
21
-
22
- const parameters = z.object({
23
- filePath: z.string().describe("The absolute path to the file or directory to read"),
24
- offset: z.coerce.number().describe("The line number to start reading from (1-indexed)").optional(),
25
- limit: z.coerce.number().describe("The maximum number of lines to read (defaults to 2000)").optional(),
26
- })
27
-
28
- export const ReadTool = Tool.defineEffect(
29
- "read",
30
- Effect.gen(function* () {
31
- const fs = yield* AppFileSystem.Service
32
- const instruction = yield* Instruction.Service
33
- const lsp = yield* LSP.Service
34
- const time = yield* FileTime.Service
35
- const scope = yield* Scope.Scope
36
-
37
- const miss = Effect.fn("ReadTool.miss")(function* (filepath: string) {
38
- const dir = path.dirname(filepath)
39
- const base = path.basename(filepath)
40
- const items = yield* fs.readDirectory(dir).pipe(
41
- Effect.map((items) =>
42
- items
43
- .filter(
44
- (item) =>
45
- item.toLowerCase().includes(base.toLowerCase()) || base.toLowerCase().includes(item.toLowerCase()),
46
- )
47
- .map((item) => path.join(dir, item))
48
- .slice(0, 3),
49
- ),
50
- Effect.catch(() => Effect.succeed([] as string[])),
51
- )
52
-
53
- if (items.length > 0) {
54
- return yield* Effect.fail(
55
- new Error(`File not found: ${filepath}\n\nDid you mean one of these?\n${items.join("\n")}`),
56
- )
57
- }
58
-
59
- return yield* Effect.fail(new Error(`File not found: ${filepath}`))
60
- })
61
-
62
- const list = Effect.fn("ReadTool.list")(function* (filepath: string) {
63
- const items = yield* fs.readDirectoryEntries(filepath)
64
- return yield* Effect.forEach(
65
- items,
66
- Effect.fnUntraced(function* (item) {
67
- if (item.type === "directory") return item.name + "/"
68
- if (item.type !== "symlink") return item.name
69
-
70
- const target = yield* fs
71
- .stat(path.join(filepath, item.name))
72
- .pipe(Effect.catch(() => Effect.succeed(undefined)))
73
- if (target?.type === "Directory") return item.name + "/"
74
- return item.name
75
- }),
76
- { concurrency: "unbounded" },
77
- ).pipe(Effect.map((items: string[]) => items.sort((a, b) => a.localeCompare(b))))
78
- })
79
-
80
- const warm = Effect.fn("ReadTool.warm")(function* (filepath: string, sessionID: Tool.Context["sessionID"]) {
81
- yield* lsp.touchFile(filepath, false).pipe(Effect.ignore, Effect.forkIn(scope))
82
- yield* time.read(sessionID, filepath)
83
- })
84
-
85
- const run = Effect.fn("ReadTool.execute")(function* (params: z.infer<typeof parameters>, ctx: Tool.Context) {
86
- if (params.offset !== undefined && params.offset < 1) {
87
- return yield* Effect.fail(new Error("offset must be greater than or equal to 1"))
88
- }
89
-
90
- let filepath = params.filePath
91
- if (!path.isAbsolute(filepath)) {
92
- filepath = path.resolve(Instance.directory, filepath)
93
- }
94
- if (process.platform === "win32") {
95
- filepath = AppFileSystem.normalizePath(filepath)
96
- }
97
- const title = path.relative(Instance.worktree, filepath)
98
-
99
- const stat = yield* fs.stat(filepath).pipe(
100
- Effect.catchIf(
101
- (err) => "reason" in err && err.reason._tag === "NotFound",
102
- () => Effect.succeed(undefined),
103
- ),
104
- )
105
-
106
- yield* assertExternalDirectoryEffect(ctx, filepath, {
107
- bypass: Boolean(ctx.extra?.["bypassCwdCheck"]),
108
- kind: stat?.type === "Directory" ? "directory" : "file",
109
- })
110
-
111
- yield* Effect.promise(() =>
112
- ctx.ask({
113
- permission: "read",
114
- patterns: [filepath],
115
- always: ["*"],
116
- metadata: {},
117
- }),
118
- )
119
-
120
- if (!stat) return yield* miss(filepath)
121
-
122
- if (stat.type === "Directory") {
123
- const items = yield* list(filepath)
124
- const limit = params.limit ?? DEFAULT_READ_LIMIT
125
- const offset = params.offset ?? 1
126
- const start = offset - 1
127
- const sliced = items.slice(start, start + limit)
128
- const truncated = start + sliced.length < items.length
129
-
130
- return {
131
- title,
132
- output: [
133
- `<path>${filepath}</path>`,
134
- `<type>directory</type>`,
135
- `<entries>`,
136
- sliced.join("\n"),
137
- truncated
138
- ? `\n(Showing ${sliced.length} of ${items.length} entries. Use 'offset' parameter to read beyond entry ${offset + sliced.length})`
139
- : `\n(${items.length} entries)`,
140
- `</entries>`,
141
- ].join("\n"),
142
- metadata: {
143
- preview: sliced.slice(0, 20).join("\n"),
144
- truncated,
145
- loaded: [] as string[],
146
- },
147
- }
148
- }
149
-
150
- const loaded = yield* instruction.resolve(ctx.messages, filepath, ctx.messageID)
151
-
152
- const mime = AppFileSystem.mimeType(filepath)
153
- const isImage = mime.startsWith("image/") && mime !== "image/svg+xml" && mime !== "image/vnd.fastbidsheet"
154
- const isPdf = mime === "application/pdf"
155
- if (isImage || isPdf) {
156
- const msg = `${isImage ? "Image" : "PDF"} read successfully`
157
- return {
158
- title,
159
- output: msg,
160
- metadata: {
161
- preview: msg,
162
- truncated: false,
163
- loaded: loaded.map((item) => item.filepath),
164
- },
165
- attachments: [
166
- {
167
- type: "file" as const,
168
- mime,
169
- url: `data:${mime};base64,${Buffer.from(yield* fs.readFile(filepath)).toString("base64")}`,
170
- },
171
- ],
172
- }
173
- }
174
-
175
- if (yield* Effect.promise(() => isBinaryFile(filepath, Number(stat.size)))) {
176
- return yield* Effect.fail(new Error(`Cannot read binary file: ${filepath}`))
177
- }
178
-
179
- const file = yield* Effect.promise(() =>
180
- lines(filepath, { limit: params.limit ?? DEFAULT_READ_LIMIT, offset: params.offset ?? 1 }),
181
- )
182
- if (file.count < file.offset && !(file.count === 0 && file.offset === 1)) {
183
- return yield* Effect.fail(
184
- new Error(`Offset ${file.offset} is out of range for this file (${file.count} lines)`),
185
- )
186
- }
187
-
188
- let output = [`<path>${filepath}</path>`, `<type>file</type>`, "<content>" + "\n"].join("\n")
189
- output += file.raw.map((line, i) => `${i + file.offset}: ${line}`).join("\n")
190
-
191
- const last = file.offset + file.raw.length - 1
192
- const next = last + 1
193
- const truncated = file.more || file.cut
194
- if (file.cut) {
195
- output += `\n\n(Output capped at ${MAX_BYTES_LABEL}. Showing lines ${file.offset}-${last}. Use offset=${next} to continue.)`
196
- } else if (file.more) {
197
- output += `\n\n(Showing lines ${file.offset}-${last} of ${file.count}. Use offset=${next} to continue.)`
198
- } else {
199
- output += `\n\n(End of file - total ${file.count} lines)`
200
- }
201
- output += "\n</content>"
202
-
203
- yield* warm(filepath, ctx.sessionID)
204
-
205
- if (loaded.length > 0) {
206
- output += `\n\n<system-reminder>\n${loaded.map((item) => item.content).join("\n\n")}\n</system-reminder>`
207
- }
208
-
209
- return {
210
- title,
211
- output,
212
- metadata: {
213
- preview: file.raw.slice(0, 20).join("\n"),
214
- truncated,
215
- loaded: loaded.map((item) => item.filepath),
216
- },
217
- }
218
- })
219
-
220
- return {
221
- description: DESCRIPTION,
222
- parameters,
223
- async execute(params: z.infer<typeof parameters>, ctx) {
224
- return Effect.runPromise(run(params, ctx).pipe(Effect.orDie))
225
- },
226
- }
227
- }),
228
- )
229
-
230
- async function lines(filepath: string, opts: { limit: number; offset: number }) {
231
- const stream = createReadStream(filepath, { encoding: "utf8" })
232
- const rl = createInterface({
233
- input: stream,
234
- // Note: we use the crlfDelay option to recognize all instances of CR LF
235
- // ('\r\n') in file as a single line break.
236
- crlfDelay: Infinity,
237
- })
238
-
239
- const start = opts.offset - 1
240
- const raw: string[] = []
241
- let bytes = 0
242
- let count = 0
243
- let cut = false
244
- let more = false
245
- try {
246
- for await (const text of rl) {
247
- count += 1
248
- if (count <= start) continue
249
-
250
- if (raw.length >= opts.limit) {
251
- more = true
252
- continue
253
- }
254
-
255
- const line = text.length > MAX_LINE_LENGTH ? text.substring(0, MAX_LINE_LENGTH) + MAX_LINE_SUFFIX : text
256
- const size = Buffer.byteLength(line, "utf-8") + (raw.length > 0 ? 1 : 0)
257
- if (bytes + size > MAX_BYTES) {
258
- cut = true
259
- more = true
260
- break
261
- }
262
-
263
- raw.push(line)
264
- bytes += size
265
- }
266
- } finally {
267
- rl.close()
268
- stream.destroy()
269
- }
270
-
271
- return { raw, count, cut, more, offset: opts.offset }
272
- }
273
-
274
- async function isBinaryFile(filepath: string, fileSize: number): Promise<boolean> {
275
- const ext = path.extname(filepath).toLowerCase()
276
- // binary check for common non-text extensions
277
- switch (ext) {
278
- case ".zip":
279
- case ".tar":
280
- case ".gz":
281
- case ".exe":
282
- case ".dll":
283
- case ".so":
284
- case ".class":
285
- case ".jar":
286
- case ".war":
287
- case ".7z":
288
- case ".doc":
289
- case ".docx":
290
- case ".xls":
291
- case ".xlsx":
292
- case ".ppt":
293
- case ".pptx":
294
- case ".odt":
295
- case ".ods":
296
- case ".odp":
297
- case ".bin":
298
- case ".dat":
299
- case ".obj":
300
- case ".o":
301
- case ".a":
302
- case ".lib":
303
- case ".wasm":
304
- case ".pyc":
305
- case ".pyo":
306
- return true
307
- default:
308
- break
309
- }
310
-
311
- if (fileSize === 0) return false
312
-
313
- const fh = await open(filepath, "r")
314
- try {
315
- const sampleSize = Math.min(4096, fileSize)
316
- const bytes = Buffer.alloc(sampleSize)
317
- const result = await fh.read(bytes, 0, sampleSize, 0)
318
- if (result.bytesRead === 0) return false
319
-
320
- let nonPrintableCount = 0
321
- for (let i = 0; i < result.bytesRead; i++) {
322
- if (bytes[i] === 0) return true
323
- if (bytes[i] < 9 || (bytes[i] > 13 && bytes[i] < 32)) {
324
- nonPrintableCount++
325
- }
326
- }
327
- // If >30% non-printable characters, consider it binary
328
- return nonPrintableCount / result.bytesRead > 0.3
329
- } finally {
330
- await fh.close()
331
- }
332
- }
@@ -1,14 +0,0 @@
1
- Read a file or directory from the local filesystem. If the path does not exist, an error is returned.
2
-
3
- Usage:
4
- - The filePath parameter should be an absolute path.
5
- - By default, this tool returns up to 2000 lines from the start of the file.
6
- - The offset parameter is the line number to start from (1-indexed).
7
- - To read later sections, call this tool again with a larger offset.
8
- - Use the grep tool to find specific content in large files or files with long lines.
9
- - If you are unsure of the correct file path, use the glob tool to look up filenames by glob pattern.
10
- - Contents are returned with each line prefixed by its line number as `<line>: <content>`. For example, if a file has contents "foo\n", you will receive "1: foo\n". For directories, entries are returned one per line (without line numbers) with a trailing `/` for subdirectories.
11
- - Any line longer than 2000 characters is truncated.
12
- - Call this tool in parallel when you know there are multiple files you want to read.
13
- - Avoid tiny repeated slices (30 line chunks). If you need more context, read a larger window.
14
- - This tool can read image files and PDFs and return them as file attachments.