alchemylab-opencode 1.0.7 → 1.0.9

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 (391) hide show
  1. package/dist/{chunk-B3FN2B2N.js → chunk-3PZZ2D23.js} +7 -3
  2. package/dist/chunk-3PZZ2D23.js.map +7 -0
  3. package/dist/{chunk-LU5XVQUD.js → chunk-EGZMJTLE.js} +7 -7
  4. package/dist/{chunk-LU5XVQUD.js.map → chunk-EGZMJTLE.js.map} +2 -2
  5. package/dist/{chunk-23UYOGZG.js → chunk-ORHZOVWK.js} +6 -6
  6. package/dist/{chunk-TASPMBUL.js → chunk-SV5NEV33.js} +5 -5
  7. package/dist/{chunk-SM6WZDN6.js → chunk-UKQIL5XA.js} +18 -12
  8. package/dist/chunk-UKQIL5XA.js.map +7 -0
  9. package/dist/{chunk-GSE2T5UY.js → chunk-ZFHDPNFZ.js} +4 -4
  10. package/dist/{mcp-XFGN3FWW.js → mcp-66BBNSWA.js} +3 -3
  11. package/dist/{registry-W4MBVBYD.js → registry-YVL3V6Z6.js} +4 -4
  12. package/dist/{run-73HUV4H3.js → run-65PIGE2A.js} +7 -7
  13. package/dist/{run-service-LHEVFBIU.js → run-service-AYATGPA6.js} +2 -2
  14. package/dist/run.js +1 -1
  15. package/dist/serve.js +1 -1
  16. package/dist/{server-2CPOG3LS.js → server-KCG3B4WQ.js} +7 -7
  17. package/dist/{session-M6HOZ56B.js → session-BR5MTI3X.js} +4 -4
  18. package/dist/{share-next-QRBVSD37.js → share-next-EPYQDJ32.js} +5 -5
  19. package/dist/{worktree-3GUHT2P7.js → worktree-PIVTZBUE.js} +6 -6
  20. package/package.json +2 -15
  21. package/packages/opencode/migration/20260409000000_add_session_metadata/migration.sql +1 -0
  22. package/build.mjs +0 -192
  23. package/dist/chunk-B3FN2B2N.js.map +0 -7
  24. package/dist/chunk-SM6WZDN6.js.map +0 -7
  25. package/packages/opencode/package.json +0 -138
  26. package/packages/opencode/src/account/account.sql.ts +0 -39
  27. package/packages/opencode/src/account/index.ts +0 -463
  28. package/packages/opencode/src/account/repo.ts +0 -163
  29. package/packages/opencode/src/account/schema.ts +0 -91
  30. package/packages/opencode/src/acp/README.md +0 -174
  31. package/packages/opencode/src/acp/agent.ts +0 -1847
  32. package/packages/opencode/src/acp/session.ts +0 -116
  33. package/packages/opencode/src/acp/types.ts +0 -24
  34. package/packages/opencode/src/agent/agent.ts +0 -420
  35. package/packages/opencode/src/agent/generate.txt +0 -75
  36. package/packages/opencode/src/agent/prompt/compaction.txt +0 -15
  37. package/packages/opencode/src/agent/prompt/explore.txt +0 -18
  38. package/packages/opencode/src/agent/prompt/summary.txt +0 -11
  39. package/packages/opencode/src/agent/prompt/title.txt +0 -44
  40. package/packages/opencode/src/auth/index.ts +0 -110
  41. package/packages/opencode/src/bus/bus-event.ts +0 -40
  42. package/packages/opencode/src/bus/global.ts +0 -10
  43. package/packages/opencode/src/bus/index.ts +0 -185
  44. package/packages/opencode/src/cli/bootstrap.ts +0 -17
  45. package/packages/opencode/src/cli/cmd/cmd.ts +0 -7
  46. package/packages/opencode/src/cli/cmd/run.ts +0 -689
  47. package/packages/opencode/src/cli/cmd/serve.ts +0 -24
  48. package/packages/opencode/src/cli/cmd/tui/event.ts +0 -49
  49. package/packages/opencode/src/cli/effect/prompt.ts +0 -25
  50. package/packages/opencode/src/cli/error.ts +0 -46
  51. package/packages/opencode/src/cli/heap.ts +0 -59
  52. package/packages/opencode/src/cli/logo.ts +0 -6
  53. package/packages/opencode/src/cli/network.ts +0 -60
  54. package/packages/opencode/src/cli/ui.ts +0 -133
  55. package/packages/opencode/src/cli/upgrade.ts +0 -31
  56. package/packages/opencode/src/command/index.ts +0 -195
  57. package/packages/opencode/src/command/template/initialize.txt +0 -66
  58. package/packages/opencode/src/command/template/review.txt +0 -101
  59. package/packages/opencode/src/config/config.ts +0 -1599
  60. package/packages/opencode/src/config/console-state.ts +0 -15
  61. package/packages/opencode/src/config/markdown.ts +0 -99
  62. package/packages/opencode/src/config/paths.ts +0 -167
  63. package/packages/opencode/src/config/tui-migrate.ts +0 -155
  64. package/packages/opencode/src/config/tui-schema.ts +0 -37
  65. package/packages/opencode/src/config/tui.ts +0 -179
  66. package/packages/opencode/src/control-plane/adaptors/index.ts +0 -20
  67. package/packages/opencode/src/control-plane/adaptors/worktree.ts +0 -42
  68. package/packages/opencode/src/control-plane/schema.ts +0 -17
  69. package/packages/opencode/src/control-plane/sse.ts +0 -66
  70. package/packages/opencode/src/control-plane/types.ts +0 -32
  71. package/packages/opencode/src/control-plane/workspace.sql.ts +0 -17
  72. package/packages/opencode/src/control-plane/workspace.ts +0 -168
  73. package/packages/opencode/src/effect/cross-spawn-spawner.ts +0 -502
  74. package/packages/opencode/src/effect/instance-ref.ts +0 -6
  75. package/packages/opencode/src/effect/instance-registry.ts +0 -12
  76. package/packages/opencode/src/effect/instance-state.ts +0 -82
  77. package/packages/opencode/src/effect/run-service.ts +0 -33
  78. package/packages/opencode/src/effect/runner.ts +0 -216
  79. package/packages/opencode/src/env/index.ts +0 -28
  80. package/packages/opencode/src/file/ignore.ts +0 -82
  81. package/packages/opencode/src/file/index.ts +0 -686
  82. package/packages/opencode/src/file/protected.ts +0 -59
  83. package/packages/opencode/src/file/ripgrep.ts +0 -376
  84. package/packages/opencode/src/file/time.ts +0 -133
  85. package/packages/opencode/src/file/watcher.ts +0 -173
  86. package/packages/opencode/src/filesystem/index.ts +0 -236
  87. package/packages/opencode/src/flag/flag.ts +0 -156
  88. package/packages/opencode/src/format/formatter.ts +0 -413
  89. package/packages/opencode/src/format/index.ts +0 -203
  90. package/packages/opencode/src/git/index.ts +0 -303
  91. package/packages/opencode/src/global/index.ts +0 -56
  92. package/packages/opencode/src/id/id.ts +0 -85
  93. package/packages/opencode/src/ide/index.ts +0 -74
  94. package/packages/opencode/src/installation/index.ts +0 -355
  95. package/packages/opencode/src/installation/meta.ts +0 -7
  96. package/packages/opencode/src/lsp/client.ts +0 -252
  97. package/packages/opencode/src/lsp/index.ts +0 -558
  98. package/packages/opencode/src/lsp/language.ts +0 -120
  99. package/packages/opencode/src/lsp/launch.ts +0 -21
  100. package/packages/opencode/src/lsp/server.ts +0 -1968
  101. package/packages/opencode/src/mcp/auth.ts +0 -173
  102. package/packages/opencode/src/mcp/index.ts +0 -931
  103. package/packages/opencode/src/mcp/oauth-callback.ts +0 -216
  104. package/packages/opencode/src/mcp/oauth-provider.ts +0 -185
  105. package/packages/opencode/src/node-loader.mjs +0 -104
  106. package/packages/opencode/src/node-preload.mjs +0 -39
  107. package/packages/opencode/src/node.ts +0 -1
  108. package/packages/opencode/src/npm/index.ts +0 -188
  109. package/packages/opencode/src/patch/index.ts +0 -680
  110. package/packages/opencode/src/permission/arity.ts +0 -163
  111. package/packages/opencode/src/permission/evaluate.ts +0 -15
  112. package/packages/opencode/src/permission/index.ts +0 -325
  113. package/packages/opencode/src/permission/schema.ts +0 -17
  114. package/packages/opencode/src/plugin/cloudflare.ts +0 -67
  115. package/packages/opencode/src/plugin/codex.ts +0 -608
  116. package/packages/opencode/src/plugin/github-copilot/copilot.ts +0 -361
  117. package/packages/opencode/src/plugin/github-copilot/models.ts +0 -144
  118. package/packages/opencode/src/plugin/index.ts +0 -299
  119. package/packages/opencode/src/plugin/install.ts +0 -439
  120. package/packages/opencode/src/plugin/loader.ts +0 -174
  121. package/packages/opencode/src/plugin/meta.ts +0 -188
  122. package/packages/opencode/src/plugin/shared.ts +0 -323
  123. package/packages/opencode/src/project/bootstrap.ts +0 -31
  124. package/packages/opencode/src/project/instance.ts +0 -175
  125. package/packages/opencode/src/project/project.sql.ts +0 -16
  126. package/packages/opencode/src/project/project.ts +0 -519
  127. package/packages/opencode/src/project/schema.ts +0 -16
  128. package/packages/opencode/src/project/state.ts +0 -70
  129. package/packages/opencode/src/project/vcs.ts +0 -240
  130. package/packages/opencode/src/provider/auth.ts +0 -253
  131. package/packages/opencode/src/provider/error.ts +0 -197
  132. package/packages/opencode/src/provider/models.ts +0 -162
  133. package/packages/opencode/src/provider/provider.ts +0 -1709
  134. package/packages/opencode/src/provider/schema.ts +0 -38
  135. package/packages/opencode/src/provider/sdk/copilot/README.md +0 -5
  136. package/packages/opencode/src/provider/sdk/copilot/chat/convert-to-openai-compatible-chat-messages.ts +0 -170
  137. package/packages/opencode/src/provider/sdk/copilot/chat/get-response-metadata.ts +0 -15
  138. package/packages/opencode/src/provider/sdk/copilot/chat/map-openai-compatible-finish-reason.ts +0 -19
  139. package/packages/opencode/src/provider/sdk/copilot/chat/openai-compatible-api-types.ts +0 -64
  140. package/packages/opencode/src/provider/sdk/copilot/chat/openai-compatible-chat-language-model.ts +0 -815
  141. package/packages/opencode/src/provider/sdk/copilot/chat/openai-compatible-chat-options.ts +0 -28
  142. package/packages/opencode/src/provider/sdk/copilot/chat/openai-compatible-metadata-extractor.ts +0 -44
  143. package/packages/opencode/src/provider/sdk/copilot/chat/openai-compatible-prepare-tools.ts +0 -83
  144. package/packages/opencode/src/provider/sdk/copilot/copilot-provider.ts +0 -100
  145. package/packages/opencode/src/provider/sdk/copilot/index.ts +0 -2
  146. package/packages/opencode/src/provider/sdk/copilot/openai-compatible-error.ts +0 -27
  147. package/packages/opencode/src/provider/sdk/copilot/responses/convert-to-openai-responses-input.ts +0 -335
  148. package/packages/opencode/src/provider/sdk/copilot/responses/map-openai-responses-finish-reason.ts +0 -22
  149. package/packages/opencode/src/provider/sdk/copilot/responses/openai-config.ts +0 -18
  150. package/packages/opencode/src/provider/sdk/copilot/responses/openai-error.ts +0 -22
  151. package/packages/opencode/src/provider/sdk/copilot/responses/openai-responses-api-types.ts +0 -214
  152. package/packages/opencode/src/provider/sdk/copilot/responses/openai-responses-language-model.ts +0 -1769
  153. package/packages/opencode/src/provider/sdk/copilot/responses/openai-responses-prepare-tools.ts +0 -173
  154. package/packages/opencode/src/provider/sdk/copilot/responses/openai-responses-settings.ts +0 -1
  155. package/packages/opencode/src/provider/sdk/copilot/responses/tool/code-interpreter.ts +0 -87
  156. package/packages/opencode/src/provider/sdk/copilot/responses/tool/file-search.ts +0 -127
  157. package/packages/opencode/src/provider/sdk/copilot/responses/tool/image-generation.ts +0 -114
  158. package/packages/opencode/src/provider/sdk/copilot/responses/tool/local-shell.ts +0 -64
  159. package/packages/opencode/src/provider/sdk/copilot/responses/tool/web-search-preview.ts +0 -103
  160. package/packages/opencode/src/provider/sdk/copilot/responses/tool/web-search.ts +0 -102
  161. package/packages/opencode/src/provider/transform.ts +0 -1050
  162. package/packages/opencode/src/pty/index.ts +0 -397
  163. package/packages/opencode/src/pty/pty.node.ts +0 -27
  164. package/packages/opencode/src/pty/pty.ts +0 -25
  165. package/packages/opencode/src/pty/schema.ts +0 -17
  166. package/packages/opencode/src/question/index.ts +0 -224
  167. package/packages/opencode/src/question/schema.ts +0 -17
  168. package/packages/opencode/src/run.ts +0 -28
  169. package/packages/opencode/src/serve.ts +0 -45
  170. package/packages/opencode/src/server/error.ts +0 -36
  171. package/packages/opencode/src/server/event.ts +0 -7
  172. package/packages/opencode/src/server/instance.ts +0 -324
  173. package/packages/opencode/src/server/mdns.ts +0 -60
  174. package/packages/opencode/src/server/middleware.ts +0 -33
  175. package/packages/opencode/src/server/projectors.ts +0 -28
  176. package/packages/opencode/src/server/proxy.ts +0 -131
  177. package/packages/opencode/src/server/router.ts +0 -105
  178. package/packages/opencode/src/server/routes/config.ts +0 -92
  179. package/packages/opencode/src/server/routes/event.ts +0 -83
  180. package/packages/opencode/src/server/routes/experimental.ts +0 -374
  181. package/packages/opencode/src/server/routes/file.ts +0 -197
  182. package/packages/opencode/src/server/routes/global.ts +0 -312
  183. package/packages/opencode/src/server/routes/mcp.ts +0 -225
  184. package/packages/opencode/src/server/routes/permission.ts +0 -69
  185. package/packages/opencode/src/server/routes/project.ts +0 -118
  186. package/packages/opencode/src/server/routes/provider.ts +0 -171
  187. package/packages/opencode/src/server/routes/pty.ts +0 -210
  188. package/packages/opencode/src/server/routes/question.ts +0 -99
  189. package/packages/opencode/src/server/routes/session.ts +0 -1030
  190. package/packages/opencode/src/server/routes/tui.ts +0 -379
  191. package/packages/opencode/src/server/routes/workspace.ts +0 -94
  192. package/packages/opencode/src/server/server.ts +0 -353
  193. package/packages/opencode/src/session/compaction.ts +0 -428
  194. package/packages/opencode/src/session/index.ts +0 -887
  195. package/packages/opencode/src/session/instruction.ts +0 -258
  196. package/packages/opencode/src/session/llm.ts +0 -354
  197. package/packages/opencode/src/session/message-v2.ts +0 -1031
  198. package/packages/opencode/src/session/message.ts +0 -191
  199. package/packages/opencode/src/session/overflow.ts +0 -22
  200. package/packages/opencode/src/session/processor.ts +0 -523
  201. package/packages/opencode/src/session/projectors.ts +0 -135
  202. package/packages/opencode/src/session/prompt/anthropic.txt +0 -105
  203. package/packages/opencode/src/session/prompt/beast.txt +0 -147
  204. package/packages/opencode/src/session/prompt/build-switch.txt +0 -5
  205. package/packages/opencode/src/session/prompt/codex.txt +0 -79
  206. package/packages/opencode/src/session/prompt/copilot-gpt-5.txt +0 -143
  207. package/packages/opencode/src/session/prompt/default.txt +0 -105
  208. package/packages/opencode/src/session/prompt/gemini.txt +0 -155
  209. package/packages/opencode/src/session/prompt/gpt.txt +0 -107
  210. package/packages/opencode/src/session/prompt/kimi.txt +0 -95
  211. package/packages/opencode/src/session/prompt/max-steps.txt +0 -16
  212. package/packages/opencode/src/session/prompt/plan-reminder-anthropic.txt +0 -67
  213. package/packages/opencode/src/session/prompt/plan.txt +0 -26
  214. package/packages/opencode/src/session/prompt/trinity.txt +0 -97
  215. package/packages/opencode/src/session/prompt.ts +0 -1911
  216. package/packages/opencode/src/session/retry.ts +0 -106
  217. package/packages/opencode/src/session/revert.ts +0 -176
  218. package/packages/opencode/src/session/schema.ts +0 -38
  219. package/packages/opencode/src/session/session.sql.ts +0 -103
  220. package/packages/opencode/src/session/status.ts +0 -102
  221. package/packages/opencode/src/session/summary.ts +0 -177
  222. package/packages/opencode/src/session/system.ts +0 -76
  223. package/packages/opencode/src/session/todo.ts +0 -95
  224. package/packages/opencode/src/share/share-next.ts +0 -369
  225. package/packages/opencode/src/share/share.sql.ts +0 -13
  226. package/packages/opencode/src/shell/shell.ts +0 -110
  227. package/packages/opencode/src/skill/discovery.ts +0 -116
  228. package/packages/opencode/src/skill/index.ts +0 -277
  229. package/packages/opencode/src/snapshot/index.ts +0 -726
  230. package/packages/opencode/src/sql.d.ts +0 -4
  231. package/packages/opencode/src/storage/db.node.ts +0 -8
  232. package/packages/opencode/src/storage/db.ts +0 -177
  233. package/packages/opencode/src/storage/json-migration.ts +0 -425
  234. package/packages/opencode/src/storage/schema.sql.ts +0 -10
  235. package/packages/opencode/src/storage/schema.ts +0 -5
  236. package/packages/opencode/src/storage/storage.ts +0 -353
  237. package/packages/opencode/src/sync/README.md +0 -179
  238. package/packages/opencode/src/sync/event.sql.ts +0 -16
  239. package/packages/opencode/src/sync/index.ts +0 -263
  240. package/packages/opencode/src/sync/schema.ts +0 -14
  241. package/packages/opencode/src/tool/apply_patch.ts +0 -281
  242. package/packages/opencode/src/tool/apply_patch.txt +0 -33
  243. package/packages/opencode/src/tool/bash.ts +0 -496
  244. package/packages/opencode/src/tool/bash.txt +0 -117
  245. package/packages/opencode/src/tool/batch.ts +0 -183
  246. package/packages/opencode/src/tool/batch.txt +0 -24
  247. package/packages/opencode/src/tool/codesearch.ts +0 -132
  248. package/packages/opencode/src/tool/codesearch.txt +0 -12
  249. package/packages/opencode/src/tool/edit.ts +0 -667
  250. package/packages/opencode/src/tool/edit.txt +0 -10
  251. package/packages/opencode/src/tool/external-directory.ts +0 -46
  252. package/packages/opencode/src/tool/glob.ts +0 -78
  253. package/packages/opencode/src/tool/glob.txt +0 -6
  254. package/packages/opencode/src/tool/grep.ts +0 -156
  255. package/packages/opencode/src/tool/grep.txt +0 -8
  256. package/packages/opencode/src/tool/invalid.ts +0 -17
  257. package/packages/opencode/src/tool/ls.ts +0 -121
  258. package/packages/opencode/src/tool/ls.txt +0 -1
  259. package/packages/opencode/src/tool/lsp.ts +0 -97
  260. package/packages/opencode/src/tool/lsp.txt +0 -19
  261. package/packages/opencode/src/tool/multiedit.ts +0 -46
  262. package/packages/opencode/src/tool/multiedit.txt +0 -41
  263. package/packages/opencode/src/tool/plan-enter.txt +0 -14
  264. package/packages/opencode/src/tool/plan-exit.txt +0 -13
  265. package/packages/opencode/src/tool/plan.ts +0 -131
  266. package/packages/opencode/src/tool/question.ts +0 -46
  267. package/packages/opencode/src/tool/question.txt +0 -10
  268. package/packages/opencode/src/tool/read.ts +0 -332
  269. package/packages/opencode/src/tool/read.txt +0 -14
  270. package/packages/opencode/src/tool/registry.ts +0 -265
  271. package/packages/opencode/src/tool/schema.ts +0 -17
  272. package/packages/opencode/src/tool/skill.ts +0 -105
  273. package/packages/opencode/src/tool/task.ts +0 -166
  274. package/packages/opencode/src/tool/task.txt +0 -60
  275. package/packages/opencode/src/tool/todo.ts +0 -48
  276. package/packages/opencode/src/tool/todowrite.txt +0 -167
  277. package/packages/opencode/src/tool/tool.ts +0 -112
  278. package/packages/opencode/src/tool/truncate.ts +0 -144
  279. package/packages/opencode/src/tool/truncation-dir.ts +0 -4
  280. package/packages/opencode/src/tool/webfetch.ts +0 -206
  281. package/packages/opencode/src/tool/webfetch.txt +0 -13
  282. package/packages/opencode/src/tool/websearch.ts +0 -150
  283. package/packages/opencode/src/tool/websearch.txt +0 -14
  284. package/packages/opencode/src/tool/write.ts +0 -84
  285. package/packages/opencode/src/tool/write.txt +0 -8
  286. package/packages/opencode/src/util/abort.ts +0 -35
  287. package/packages/opencode/src/util/archive.ts +0 -17
  288. package/packages/opencode/src/util/color.ts +0 -19
  289. package/packages/opencode/src/util/context.ts +0 -25
  290. package/packages/opencode/src/util/data-url.ts +0 -9
  291. package/packages/opencode/src/util/defer.ts +0 -12
  292. package/packages/opencode/src/util/effect-http-client.ts +0 -11
  293. package/packages/opencode/src/util/effect-zod.ts +0 -98
  294. package/packages/opencode/src/util/error.ts +0 -77
  295. package/packages/opencode/src/util/filesystem.ts +0 -245
  296. package/packages/opencode/src/util/flock.ts +0 -333
  297. package/packages/opencode/src/util/fn.ts +0 -21
  298. package/packages/opencode/src/util/format.ts +0 -20
  299. package/packages/opencode/src/util/glob.ts +0 -34
  300. package/packages/opencode/src/util/hash.ts +0 -7
  301. package/packages/opencode/src/util/iife.ts +0 -3
  302. package/packages/opencode/src/util/keybind.ts +0 -103
  303. package/packages/opencode/src/util/lazy.ts +0 -23
  304. package/packages/opencode/src/util/locale.ts +0 -81
  305. package/packages/opencode/src/util/lock.ts +0 -98
  306. package/packages/opencode/src/util/log.ts +0 -182
  307. package/packages/opencode/src/util/network.ts +0 -9
  308. package/packages/opencode/src/util/process.ts +0 -176
  309. package/packages/opencode/src/util/queue.ts +0 -32
  310. package/packages/opencode/src/util/record.ts +0 -3
  311. package/packages/opencode/src/util/rpc.ts +0 -66
  312. package/packages/opencode/src/util/schema.ts +0 -53
  313. package/packages/opencode/src/util/scrap.ts +0 -10
  314. package/packages/opencode/src/util/signal.ts +0 -12
  315. package/packages/opencode/src/util/timeout.ts +0 -14
  316. package/packages/opencode/src/util/token.ts +0 -7
  317. package/packages/opencode/src/util/update-schema.ts +0 -13
  318. package/packages/opencode/src/util/which.ts +0 -14
  319. package/packages/opencode/src/util/wildcard.ts +0 -59
  320. package/packages/opencode/src/worktree/index.ts +0 -612
  321. package/packages/plugin/package.json +0 -38
  322. package/packages/plugin/src/example.ts +0 -18
  323. package/packages/plugin/src/index.ts +0 -282
  324. package/packages/plugin/src/shell.ts +0 -136
  325. package/packages/plugin/src/tool.ts +0 -38
  326. package/packages/plugin/src/tui.ts +0 -508
  327. package/packages/script/package.json +0 -16
  328. package/packages/script/src/index.ts +0 -77
  329. package/packages/sdk/package.json +0 -33
  330. package/packages/sdk/src/client.ts +0 -55
  331. package/packages/sdk/src/gen/client/client.gen.ts +0 -212
  332. package/packages/sdk/src/gen/client/index.ts +0 -25
  333. package/packages/sdk/src/gen/client/types.gen.ts +0 -222
  334. package/packages/sdk/src/gen/client/utils.gen.ts +0 -287
  335. package/packages/sdk/src/gen/client.gen.ts +0 -22
  336. package/packages/sdk/src/gen/core/auth.gen.ts +0 -41
  337. package/packages/sdk/src/gen/core/bodySerializer.gen.ts +0 -74
  338. package/packages/sdk/src/gen/core/params.gen.ts +0 -144
  339. package/packages/sdk/src/gen/core/pathSerializer.gen.ts +0 -167
  340. package/packages/sdk/src/gen/core/queryKeySerializer.gen.ts +0 -111
  341. package/packages/sdk/src/gen/core/serverSentEvents.gen.ts +0 -210
  342. package/packages/sdk/src/gen/core/types.gen.ts +0 -91
  343. package/packages/sdk/src/gen/core/utils.gen.ts +0 -109
  344. package/packages/sdk/src/gen/sdk.gen.ts +0 -1197
  345. package/packages/sdk/src/gen/types.gen.ts +0 -3904
  346. package/packages/sdk/src/index.ts +0 -21
  347. package/packages/sdk/src/process.ts +0 -31
  348. package/packages/sdk/src/server.ts +0 -134
  349. package/packages/sdk/src/v2/client.ts +0 -81
  350. package/packages/sdk/src/v2/gen/client/client.gen.ts +0 -285
  351. package/packages/sdk/src/v2/gen/client/index.ts +0 -25
  352. package/packages/sdk/src/v2/gen/client/types.gen.ts +0 -202
  353. package/packages/sdk/src/v2/gen/client/utils.gen.ts +0 -289
  354. package/packages/sdk/src/v2/gen/client.gen.ts +0 -18
  355. package/packages/sdk/src/v2/gen/core/auth.gen.ts +0 -41
  356. package/packages/sdk/src/v2/gen/core/bodySerializer.gen.ts +0 -82
  357. package/packages/sdk/src/v2/gen/core/params.gen.ts +0 -169
  358. package/packages/sdk/src/v2/gen/core/pathSerializer.gen.ts +0 -167
  359. package/packages/sdk/src/v2/gen/core/queryKeySerializer.gen.ts +0 -111
  360. package/packages/sdk/src/v2/gen/core/serverSentEvents.gen.ts +0 -239
  361. package/packages/sdk/src/v2/gen/core/types.gen.ts +0 -86
  362. package/packages/sdk/src/v2/gen/core/utils.gen.ts +0 -137
  363. package/packages/sdk/src/v2/gen/sdk.gen.ts +0 -4223
  364. package/packages/sdk/src/v2/gen/types.gen.ts +0 -5265
  365. package/packages/sdk/src/v2/index.ts +0 -21
  366. package/packages/sdk/src/v2/server.ts +0 -134
  367. package/packages/util/package.json +0 -20
  368. package/packages/util/src/array.ts +0 -10
  369. package/packages/util/src/binary.ts +0 -41
  370. package/packages/util/src/encode.ts +0 -51
  371. package/packages/util/src/error.ts +0 -54
  372. package/packages/util/src/fn.ts +0 -11
  373. package/packages/util/src/identifier.ts +0 -48
  374. package/packages/util/src/iife.ts +0 -3
  375. package/packages/util/src/lazy.ts +0 -11
  376. package/packages/util/src/module.ts +0 -10
  377. package/packages/util/src/path.ts +0 -37
  378. package/packages/util/src/retry.ts +0 -41
  379. package/packages/util/src/slug.ts +0 -74
  380. package/postinstall.cjs +0 -55
  381. /package/dist/{chunk-23UYOGZG.js.map → chunk-ORHZOVWK.js.map} +0 -0
  382. /package/dist/{chunk-TASPMBUL.js.map → chunk-SV5NEV33.js.map} +0 -0
  383. /package/dist/{chunk-GSE2T5UY.js.map → chunk-ZFHDPNFZ.js.map} +0 -0
  384. /package/dist/{mcp-XFGN3FWW.js.map → mcp-66BBNSWA.js.map} +0 -0
  385. /package/dist/{registry-W4MBVBYD.js.map → registry-YVL3V6Z6.js.map} +0 -0
  386. /package/dist/{run-73HUV4H3.js.map → run-65PIGE2A.js.map} +0 -0
  387. /package/dist/{run-service-LHEVFBIU.js.map → run-service-AYATGPA6.js.map} +0 -0
  388. /package/dist/{server-2CPOG3LS.js.map → server-KCG3B4WQ.js.map} +0 -0
  389. /package/dist/{session-M6HOZ56B.js.map → session-BR5MTI3X.js.map} +0 -0
  390. /package/dist/{share-next-QRBVSD37.js.map → share-next-EPYQDJ32.js.map} +0 -0
  391. /package/dist/{worktree-3GUHT2P7.js.map → worktree-PIVTZBUE.js.map} +0 -0
@@ -1,265 +0,0 @@
1
- import { PlanExitTool } from "./plan"
2
- import { QuestionTool } from "./question"
3
- import { BashTool } from "./bash"
4
- import { EditTool } from "./edit"
5
- import { GlobTool } from "./glob"
6
- import { GrepTool } from "./grep"
7
- import { BatchTool } from "./batch"
8
- import { ReadTool } from "./read"
9
- import { TaskTool } from "./task"
10
- import { TodoWriteTool } from "./todo"
11
- import { WebFetchTool } from "./webfetch"
12
- import { WriteTool } from "./write"
13
- import { InvalidTool } from "./invalid"
14
- import { SkillTool } from "./skill"
15
- import type { Agent } from "../agent/agent"
16
- import { Tool } from "./tool"
17
- import { Config } from "../config/config"
18
- import path from "path"
19
- import { type ToolContext as PluginToolContext, type ToolDefinition } from "@opencode-ai/plugin"
20
- import z from "zod"
21
- import { Plugin } from "../plugin"
22
- import { ProviderID, type ModelID } from "../provider/schema"
23
- import { WebSearchTool } from "./websearch"
24
- import { CodeSearchTool } from "./codesearch"
25
- import { Flag } from "@/flag/flag"
26
- import { Log } from "@/util/log"
27
- import { LspTool } from "./lsp"
28
- import { Truncate } from "./truncate"
29
- import { ApplyPatchTool } from "./apply_patch"
30
- import { Glob } from "../util/glob"
31
- import { pathToFileURL } from "url"
32
- import { Effect, Layer, ServiceMap } from "effect"
33
- import { InstanceState } from "@/effect/instance-state"
34
- import { makeRuntime } from "@/effect/run-service"
35
- import { Env } from "../env"
36
- import { Question } from "../question"
37
- import { Todo } from "../session/todo"
38
- import { LSP } from "../lsp"
39
- import { FileTime } from "../file/time"
40
- import { Instruction } from "../session/instruction"
41
- import { AppFileSystem } from "../filesystem"
42
-
43
- export namespace ToolRegistry {
44
- const log = Log.create({ service: "tool.registry" })
45
-
46
- type State = {
47
- custom: Tool.Info[]
48
- }
49
-
50
- export interface Interface {
51
- readonly ids: () => Effect.Effect<string[]>
52
- readonly named: {
53
- task: Tool.Info
54
- read: Tool.Info
55
- }
56
- readonly tools: (
57
- model: { providerID: ProviderID; modelID: ModelID },
58
- agent?: Agent.Info,
59
- ) => Effect.Effect<(Tool.Def & { id: string })[]>
60
- }
61
-
62
- export class Service extends ServiceMap.Service<Service, Interface>()("@opencode/ToolRegistry") {}
63
-
64
- export const layer: Layer.Layer<
65
- Service,
66
- never,
67
- | Config.Service
68
- | Plugin.Service
69
- | Question.Service
70
- | Todo.Service
71
- | LSP.Service
72
- | FileTime.Service
73
- | Instruction.Service
74
- | AppFileSystem.Service
75
- > = Layer.effect(
76
- Service,
77
- Effect.gen(function* () {
78
- const config = yield* Config.Service
79
- const plugin = yield* Plugin.Service
80
-
81
- const build = <T extends Tool.Info>(tool: T | Effect.Effect<T, never, any>) =>
82
- Effect.isEffect(tool) ? tool : Effect.succeed(tool)
83
-
84
- const state = yield* InstanceState.make<State>(
85
- Effect.fn("ToolRegistry.state")(function* (ctx) {
86
- const custom: Tool.Info[] = []
87
-
88
- function fromPlugin(id: string, def: ToolDefinition): Tool.Info {
89
- return {
90
- id,
91
- init: async (initCtx) => ({
92
- parameters: z.object(def.args),
93
- description: def.description,
94
- execute: async (args, toolCtx) => {
95
- const pluginCtx = {
96
- ...toolCtx,
97
- directory: ctx.directory,
98
- worktree: ctx.worktree,
99
- } as unknown as PluginToolContext
100
- const result = await def.execute(args as any, pluginCtx)
101
- const out = await Truncate.output(result, {}, initCtx?.agent)
102
- return {
103
- title: "",
104
- output: out.truncated ? out.content : result,
105
- metadata: { truncated: out.truncated, outputPath: out.truncated ? out.outputPath : undefined },
106
- }
107
- },
108
- }),
109
- }
110
- }
111
-
112
- const dirs = yield* config.directories()
113
- const matches = dirs.flatMap((dir) =>
114
- Glob.scanSync("{tool,tools}/*.{js,ts}", { cwd: dir, absolute: true, dot: true, symlink: true }),
115
- )
116
- if (matches.length) yield* config.waitForDependencies()
117
- for (const match of matches) {
118
- const namespace = path.basename(match, path.extname(match))
119
- const mod = yield* Effect.promise(
120
- () => import(process.platform === "win32" ? match : pathToFileURL(match).href),
121
- )
122
- for (const [id, def] of Object.entries<ToolDefinition>(mod)) {
123
- custom.push(fromPlugin(id === "default" ? namespace : `${namespace}_${id}`, def))
124
- }
125
- }
126
-
127
- const plugins = yield* plugin.list()
128
- for (const p of plugins) {
129
- for (const [id, def] of Object.entries(p.tool ?? {})) {
130
- custom.push(fromPlugin(id, def))
131
- }
132
- }
133
-
134
- return { custom }
135
- }),
136
- )
137
-
138
- const invalid = yield* build(InvalidTool)
139
- const ask = yield* build(QuestionTool)
140
- const bash = yield* build(BashTool)
141
- const read = yield* build(ReadTool)
142
- const glob = yield* build(GlobTool)
143
- const grep = yield* build(GrepTool)
144
- const edit = yield* build(EditTool)
145
- const write = yield* build(WriteTool)
146
- const task = yield* build(TaskTool)
147
- const fetch = yield* build(WebFetchTool)
148
- const todo = yield* build(TodoWriteTool)
149
- const search = yield* build(WebSearchTool)
150
- const code = yield* build(CodeSearchTool)
151
- const skill = yield* build(SkillTool)
152
- const patch = yield* build(ApplyPatchTool)
153
- const lsp = yield* build(LspTool)
154
- const batch = yield* build(BatchTool)
155
- const plan = yield* build(PlanExitTool)
156
-
157
- const all = Effect.fn("ToolRegistry.all")(function* (custom: Tool.Info[]) {
158
- const cfg = yield* config.get()
159
- const question = ["app", "cli", "desktop"].includes(Flag.OPENCODE_CLIENT) || Flag.OPENCODE_ENABLE_QUESTION_TOOL
160
-
161
- return [
162
- invalid,
163
- ...(question ? [ask] : []),
164
- bash,
165
- read,
166
- glob,
167
- grep,
168
- edit,
169
- write,
170
- task,
171
- fetch,
172
- todo,
173
- search,
174
- code,
175
- skill,
176
- patch,
177
- ...(Flag.OPENCODE_EXPERIMENTAL_LSP_TOOL ? [lsp] : []),
178
- ...(cfg.experimental?.batch_tool === true ? [batch] : []),
179
- ...(Flag.OPENCODE_EXPERIMENTAL_PLAN_MODE && Flag.OPENCODE_CLIENT === "cli" ? [plan] : []),
180
- ...custom,
181
- ]
182
- })
183
-
184
- const ids = Effect.fn("ToolRegistry.ids")(function* () {
185
- const s = yield* InstanceState.get(state)
186
- const tools = yield* all(s.custom)
187
- return tools.map((t) => t.id)
188
- })
189
-
190
- const tools = Effect.fn("ToolRegistry.tools")(function* (
191
- model: { providerID: ProviderID; modelID: ModelID },
192
- agent?: Agent.Info,
193
- ) {
194
- const s = yield* InstanceState.get(state)
195
- const allTools = yield* all(s.custom)
196
- const filtered = allTools.filter((tool) => {
197
- if (tool.id === "codesearch" || tool.id === "websearch") {
198
- return model.providerID === ProviderID.opencode || Flag.OPENCODE_ENABLE_EXA
199
- }
200
-
201
- const usePatch =
202
- !!Env.get("OPENCODE_E2E_LLM_URL") ||
203
- (model.modelID.includes("gpt-") && !model.modelID.includes("oss") && !model.modelID.includes("gpt-4"))
204
- if (tool.id === "apply_patch") return usePatch
205
- if (tool.id === "edit" || tool.id === "write") return !usePatch
206
-
207
- return true
208
- })
209
- return yield* Effect.forEach(
210
- filtered,
211
- Effect.fnUntraced(function* (tool: Tool.Info) {
212
- using _ = log.time(tool.id)
213
- const next = yield* Effect.promise(() => tool.init({ agent }))
214
- const output = {
215
- description: next.description,
216
- parameters: next.parameters,
217
- }
218
- yield* plugin.trigger("tool.definition", { toolID: tool.id }, output)
219
- return {
220
- id: tool.id,
221
- description: output.description,
222
- parameters: output.parameters,
223
- execute: next.execute,
224
- formatValidationError: next.formatValidationError,
225
- }
226
- }),
227
- { concurrency: "unbounded" },
228
- )
229
- })
230
-
231
- return Service.of({ ids, named: { task, read }, tools })
232
- }),
233
- )
234
-
235
- export const defaultLayer = Layer.unwrap(
236
- Effect.sync(() =>
237
- layer.pipe(
238
- Layer.provide(Config.defaultLayer),
239
- Layer.provide(Plugin.defaultLayer),
240
- Layer.provide(Question.defaultLayer),
241
- Layer.provide(Todo.defaultLayer),
242
- Layer.provide(LSP.defaultLayer),
243
- Layer.provide(FileTime.defaultLayer),
244
- Layer.provide(Instruction.defaultLayer),
245
- Layer.provide(AppFileSystem.defaultLayer),
246
- ),
247
- ),
248
- )
249
-
250
- const { runPromise } = makeRuntime(Service, defaultLayer)
251
-
252
- export async function ids() {
253
- return runPromise((svc) => svc.ids())
254
- }
255
-
256
- export async function tools(
257
- model: {
258
- providerID: ProviderID
259
- modelID: ModelID
260
- },
261
- agent?: Agent.Info,
262
- ): Promise<(Tool.Def & { id: string })[]> {
263
- return runPromise((svc) => svc.tools(model, agent))
264
- }
265
- }
@@ -1,17 +0,0 @@
1
- import { Schema } from "effect"
2
- import z from "zod"
3
-
4
- import { Identifier } from "@/id/id"
5
- import { withStatics } from "@/util/schema"
6
-
7
- const toolIdSchema = Schema.String.pipe(Schema.brand("ToolID"))
8
-
9
- export type ToolID = typeof toolIdSchema.Type
10
-
11
- export const ToolID = toolIdSchema.pipe(
12
- withStatics((schema: typeof toolIdSchema) => ({
13
- make: (id: string) => schema.makeUnsafe(id),
14
- ascending: (id?: string) => schema.makeUnsafe(Identifier.ascending("tool", id)),
15
- zod: Identifier.schema("tool").pipe(z.custom<ToolID>()),
16
- })),
17
- )
@@ -1,105 +0,0 @@
1
- import path from "path"
2
- import { pathToFileURL } from "url"
3
- import z from "zod"
4
- import { Tool } from "./tool"
5
- import { Skill } from "../skill"
6
- import { Ripgrep } from "../file/ripgrep"
7
- import { iife } from "@/util/iife"
8
-
9
- export const SkillTool = Tool.define("skill", async (ctx) => {
10
- const list = await Skill.available(ctx?.agent)
11
-
12
- const description =
13
- list.length === 0
14
- ? "Load a specialized skill that provides domain-specific instructions and workflows. No skills are currently available."
15
- : [
16
- "Load a specialized skill that provides domain-specific instructions and workflows.",
17
- "",
18
- "When you recognize that a task matches one of the available skills listed below, use this tool to load the full skill instructions.",
19
- "",
20
- "The skill will inject detailed instructions, workflows, and access to bundled resources (scripts, references, templates) into the conversation context.",
21
- "",
22
- 'Tool output includes a `<skill_content name="...">` block with the loaded content.',
23
- "",
24
- "The following skills provide specialized sets of instructions for particular tasks",
25
- "Invoke this tool to load a skill when a task matches one of the available skills listed below:",
26
- "",
27
- Skill.fmt(list, { verbose: false }),
28
- ].join("\n")
29
-
30
- const examples = list
31
- .map((skill) => `'${skill.name}'`)
32
- .slice(0, 3)
33
- .join(", ")
34
- const hint = examples.length > 0 ? ` (e.g., ${examples}, ...)` : ""
35
-
36
- const parameters = z.object({
37
- name: z.string().describe(`The name of the skill from available_skills${hint}`),
38
- })
39
-
40
- return {
41
- description,
42
- parameters,
43
- async execute(params: z.infer<typeof parameters>, ctx) {
44
- const skill = await Skill.get(params.name)
45
-
46
- if (!skill) {
47
- const available = await Skill.all().then((x) => x.map((skill) => skill.name).join(", "))
48
- throw new Error(`Skill "${params.name}" not found. Available skills: ${available || "none"}`)
49
- }
50
-
51
- await ctx.ask({
52
- permission: "skill",
53
- patterns: [params.name],
54
- always: [params.name],
55
- metadata: {},
56
- })
57
-
58
- const dir = path.dirname(skill.location)
59
- const base = pathToFileURL(dir).href
60
-
61
- const limit = 10
62
- const files = await iife(async () => {
63
- const arr = []
64
- for await (const file of Ripgrep.files({
65
- cwd: dir,
66
- follow: false,
67
- hidden: true,
68
- signal: ctx.abort,
69
- })) {
70
- if (file.includes("SKILL.md")) {
71
- continue
72
- }
73
- arr.push(path.resolve(dir, file))
74
- if (arr.length >= limit) {
75
- break
76
- }
77
- }
78
- return arr
79
- }).then((f) => f.map((file) => `<file>${file}</file>`).join("\n"))
80
-
81
- return {
82
- title: `Loaded skill: ${skill.name}`,
83
- output: [
84
- `<skill_content name="${skill.name}">`,
85
- `# Skill: ${skill.name}`,
86
- "",
87
- skill.content.trim(),
88
- "",
89
- `Base directory for this skill: ${base}`,
90
- "Relative paths in this skill (e.g., scripts/, reference/) are relative to this base directory.",
91
- "Note: file list is sampled.",
92
- "",
93
- "<skill_files>",
94
- files,
95
- "</skill_files>",
96
- "</skill_content>",
97
- ].join("\n"),
98
- metadata: {
99
- name: skill.name,
100
- dir,
101
- },
102
- }
103
- },
104
- }
105
- })
@@ -1,166 +0,0 @@
1
- import { Tool } from "./tool"
2
- import DESCRIPTION from "./task.txt"
3
- import z from "zod"
4
- import { Session } from "../session"
5
- import { SessionID, MessageID } from "../session/schema"
6
- import { MessageV2 } from "../session/message-v2"
7
- import { Identifier } from "../id/id"
8
- import { Agent } from "../agent/agent"
9
- import { SessionPrompt } from "../session/prompt"
10
- import { iife } from "@/util/iife"
11
- import { defer } from "@/util/defer"
12
- import { Config } from "../config/config"
13
- import { Permission } from "@/permission"
14
-
15
- const parameters = z.object({
16
- description: z.string().describe("A short (3-5 words) description of the task"),
17
- prompt: z.string().describe("The task for the agent to perform"),
18
- subagent_type: z.string().describe("The type of specialized agent to use for this task"),
19
- task_id: z
20
- .string()
21
- .describe(
22
- "This should only be set if you mean to resume a previous task (you can pass a prior task_id and the task will continue the same subagent session as before instead of creating a fresh one)",
23
- )
24
- .optional(),
25
- command: z.string().describe("The command that triggered this task").optional(),
26
- })
27
-
28
- export const TaskTool = Tool.define("task", async (ctx) => {
29
- const agents = await Agent.list().then((x) => x.filter((a) => a.mode !== "primary"))
30
-
31
- // Filter agents by permissions if agent provided
32
- const caller = ctx?.agent
33
- const accessibleAgents = caller
34
- ? agents.filter((a) => Permission.evaluate("task", a.name, caller.permission).action !== "deny")
35
- : agents
36
- const list = accessibleAgents.toSorted((a, b) => a.name.localeCompare(b.name))
37
-
38
- const description = DESCRIPTION.replace(
39
- "{agents}",
40
- list
41
- .map((a) => `- ${a.name}: ${a.description ?? "This subagent should only be called manually by the user."}`)
42
- .join("\n"),
43
- )
44
- return {
45
- description,
46
- parameters,
47
- async execute(params: z.infer<typeof parameters>, ctx) {
48
- const config = await Config.get()
49
-
50
- // Skip permission check when user explicitly invoked via @ or command subtask
51
- if (!ctx.extra?.bypassAgentCheck) {
52
- await ctx.ask({
53
- permission: "task",
54
- patterns: [params.subagent_type],
55
- always: ["*"],
56
- metadata: {
57
- description: params.description,
58
- subagent_type: params.subagent_type,
59
- },
60
- })
61
- }
62
-
63
- const agent = await Agent.get(params.subagent_type)
64
- if (!agent) throw new Error(`Unknown agent type: ${params.subagent_type} is not a valid agent type`)
65
-
66
- const hasTaskPermission = agent.permission.some((rule) => rule.permission === "task")
67
- const hasTodoWritePermission = agent.permission.some((rule) => rule.permission === "todowrite")
68
-
69
- const session = await iife(async () => {
70
- if (params.task_id) {
71
- const found = await Session.get(SessionID.make(params.task_id)).catch(() => {})
72
- if (found) return found
73
- }
74
-
75
- return await Session.create({
76
- parentID: ctx.sessionID,
77
- title: params.description + ` (@${agent.name} subagent)`,
78
- permission: [
79
- ...(hasTodoWritePermission
80
- ? []
81
- : [
82
- {
83
- permission: "todowrite" as const,
84
- pattern: "*" as const,
85
- action: "deny" as const,
86
- },
87
- ]),
88
- ...(hasTaskPermission
89
- ? []
90
- : [
91
- {
92
- permission: "task" as const,
93
- pattern: "*" as const,
94
- action: "deny" as const,
95
- },
96
- ]),
97
- ...(config.experimental?.primary_tools?.map((t) => ({
98
- pattern: "*",
99
- action: "allow" as const,
100
- permission: t,
101
- })) ?? []),
102
- ],
103
- })
104
- })
105
- const msg = await MessageV2.get({ sessionID: ctx.sessionID, messageID: ctx.messageID })
106
- if (msg.info.role !== "assistant") throw new Error("Not an assistant message")
107
-
108
- const model = agent.model ?? {
109
- modelID: msg.info.modelID,
110
- providerID: msg.info.providerID,
111
- }
112
-
113
- ctx.metadata({
114
- title: params.description,
115
- metadata: {
116
- sessionId: session.id,
117
- model,
118
- },
119
- })
120
-
121
- const messageID = MessageID.ascending()
122
-
123
- function cancel() {
124
- SessionPrompt.cancel(session.id)
125
- }
126
- ctx.abort.addEventListener("abort", cancel)
127
- using _ = defer(() => ctx.abort.removeEventListener("abort", cancel))
128
- const promptParts = await SessionPrompt.resolvePromptParts(params.prompt)
129
-
130
- const result = await SessionPrompt.prompt({
131
- messageID,
132
- sessionID: session.id,
133
- model: {
134
- modelID: model.modelID,
135
- providerID: model.providerID,
136
- },
137
- agent: agent.name,
138
- tools: {
139
- ...(hasTodoWritePermission ? {} : { todowrite: false }),
140
- ...(hasTaskPermission ? {} : { task: false }),
141
- ...Object.fromEntries((config.experimental?.primary_tools ?? []).map((t) => [t, false])),
142
- },
143
- parts: promptParts,
144
- })
145
-
146
- const text = result.parts.findLast((x) => x.type === "text")?.text ?? ""
147
-
148
- const output = [
149
- `task_id: ${session.id} (for resuming to continue this task if needed)`,
150
- "",
151
- "<task_result>",
152
- text,
153
- "</task_result>",
154
- ].join("\n")
155
-
156
- return {
157
- title: params.description,
158
- metadata: {
159
- sessionId: session.id,
160
- model,
161
- },
162
- output,
163
- }
164
- },
165
- }
166
- })
@@ -1,60 +0,0 @@
1
- Launch a new agent to handle complex, multistep tasks autonomously.
2
-
3
- Available agent types and the tools they have access to:
4
- {agents}
5
-
6
- When using the Task tool, you must specify a subagent_type parameter to select which agent type to use.
7
-
8
- When to use the Task tool:
9
- - When you are instructed to execute custom slash commands. Use the Task tool with the slash command invocation as the entire prompt. The slash command can take arguments. For example: Task(description="Check the file", prompt="/check-file path/to/file.py")
10
-
11
- When NOT to use the Task tool:
12
- - If you want to read a specific file path, use the Read or Glob tool instead of the Task tool, to find the match more quickly
13
- - If you are searching for a specific class definition like "class Foo", use the Glob tool instead, to find the match more quickly
14
- - If you are searching for code within a specific file or set of 2-3 files, use the Read tool instead of the Task tool, to find the match more quickly
15
- - Other tasks that are not related to the agent descriptions above
16
-
17
-
18
- Usage notes:
19
- 1. Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses
20
- 2. When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result. The output includes a task_id you can reuse later to continue the same subagent session.
21
- 3. Each agent invocation starts with a fresh context unless you provide task_id to resume the same subagent session (which continues with its previous messages and tool outputs). When starting fresh, your prompt should contain a highly detailed task description for the agent to perform autonomously and you should specify exactly what information the agent should return back to you in its final and only message to you.
22
- 4. The agent's outputs should generally be trusted
23
- 5. Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent. Tell it how to verify its work if possible (e.g., relevant test commands).
24
- 6. If the agent description mentions that it should be used proactively, then you should try your best to use it without the user having to ask for it first. Use your judgement.
25
-
26
- Example usage (NOTE: The agents below are fictional examples for illustration only - use the actual agents listed above):
27
-
28
- <example_agent_descriptions>
29
- "code-reviewer": use this agent after you are done writing a significant piece of code
30
- "greeting-responder": use this agent when to respond to user greetings with a friendly joke
31
- </example_agent_description>
32
-
33
- <example>
34
- user: "Please write a function that checks if a number is prime"
35
- assistant: Sure let me write a function that checks if a number is prime
36
- assistant: First let me use the Write tool to write a function that checks if a number is prime
37
- assistant: I'm going to use the Write tool to write the following code:
38
- <code>
39
- function isPrime(n) {
40
- if (n <= 1) return false
41
- for (let i = 2; i * i <= n; i++) {
42
- if (n % i === 0) return false
43
- }
44
- return true
45
- }
46
- </code>
47
- <commentary>
48
- Since a significant piece of code was written and the task was completed, now use the code-reviewer agent to review the code
49
- </commentary>
50
- assistant: Now let me use the code-reviewer agent to review the code
51
- assistant: Uses the Task tool to launch the code-reviewer agent
52
- </example>
53
-
54
- <example>
55
- user: "Hello"
56
- <commentary>
57
- Since the user is greeting, use the greeting-responder agent to respond with a friendly joke
58
- </commentary>
59
- assistant: "I'm going to use the Task tool to launch the with the greeting-responder agent"
60
- </example>
@@ -1,48 +0,0 @@
1
- import z from "zod"
2
- import { Effect } from "effect"
3
- import { Tool } from "./tool"
4
- import DESCRIPTION_WRITE from "./todowrite.txt"
5
- import { Todo } from "../session/todo"
6
-
7
- const parameters = z.object({
8
- todos: z.array(z.object(Todo.Info.shape)).describe("The updated todo list"),
9
- })
10
-
11
- type Metadata = {
12
- todos: Todo.Info[]
13
- }
14
-
15
- export const TodoWriteTool = Tool.defineEffect<typeof parameters, Metadata, Todo.Service>(
16
- "todowrite",
17
- Effect.gen(function* () {
18
- const todo = yield* Todo.Service
19
-
20
- return {
21
- description: DESCRIPTION_WRITE,
22
- parameters,
23
- async execute(params: z.infer<typeof parameters>, ctx: Tool.Context<Metadata>) {
24
- await ctx.ask({
25
- permission: "todowrite",
26
- patterns: ["*"],
27
- always: ["*"],
28
- metadata: {},
29
- })
30
-
31
- await todo
32
- .update({
33
- sessionID: ctx.sessionID,
34
- todos: params.todos,
35
- })
36
- .pipe(Effect.runPromise)
37
-
38
- return {
39
- title: `${params.todos.filter((x) => x.status !== "completed").length} todos`,
40
- output: JSON.stringify(params.todos, null, 2),
41
- metadata: {
42
- todos: params.todos,
43
- },
44
- }
45
- },
46
- } satisfies Tool.Def<typeof parameters, Metadata>
47
- }),
48
- )