refactor(plugin): include name in promise tools

This commit is contained in:
Dax Raad 2026-07-10 00:22:45 -04:00
commit 2a4b298108
5 changed files with 16 additions and 10 deletions

View file

@ -1,7 +1,7 @@
export * as PluginPromise from "./promise"
import { Plugin } from "@opencode-ai/plugin/v2/effect"
import type { AnyTool, RegisterOptions } from "@opencode-ai/plugin/v2/tool"
import type { AnyTool } from "@opencode-ai/plugin/v2/tool"
import { Effect, Scope, Stream } from "effect"
import { Tool } from "../tool/tool"
@ -114,8 +114,7 @@ export function fromPromise(plugin: PromisePlugin) {
register(
host.tool.transform((draft) =>
callback({
add: (name: string, tool: AnyTool, options?: RegisterOptions) =>
draft.add(name, fromPromiseTool(tool), options),
add: (tool: AnyTool) => draft.add(tool.name, fromPromiseTool(tool), tool.options),
}),
),
),

View file

@ -106,7 +106,8 @@ describe("fromPromise", () => {
id: "promise-tool",
setup: async (ctx) => {
await ctx.tool.transform((tools) => {
tools.add("hello", {
tools.add({
name: "hello",
description: "Hello",
input: Schema.Struct({ name: Schema.String }),
output: Schema.String,