diff --git a/packages/opencode/src/command/index.ts b/packages/opencode/src/command/index.ts index 7af99b6aca..365c598137 100644 --- a/packages/opencode/src/command/index.ts +++ b/packages/opencode/src/command/index.ts @@ -164,13 +164,13 @@ export namespace Command { const state = yield* InstanceState.make((ctx) => init(ctx)) const get = Effect.fn("Command.get")(function* (name: string) { - const state = yield* InstanceState.get(state) - return state.commands[name] + const s = yield* InstanceState.get(state) + return s.commands[name] }) const list = Effect.fn("Command.list")(function* () { - const state = yield* InstanceState.get(state) - return Object.values(state.commands) + const s = yield* InstanceState.get(state) + return Object.values(s.commands) }) return Service.of({ get, list }) diff --git a/packages/opencode/src/plugin/index.ts b/packages/opencode/src/plugin/index.ts index b54d8614e2..8cd9776cd8 100644 --- a/packages/opencode/src/plugin/index.ts +++ b/packages/opencode/src/plugin/index.ts @@ -279,8 +279,8 @@ export namespace Plugin { Output = Parameters[Name]>[1], >(name: Name, input: Input, output: Output) { if (!name) return output - const state = yield* InstanceState.get(state) - for (const hook of state.hooks) { + const s = yield* InstanceState.get(state) + for (const hook of s.hooks) { const fn = hook[name] as any if (!fn) continue yield* Effect.promise(async () => fn(input, output)) @@ -289,8 +289,8 @@ export namespace Plugin { }) const list = Effect.fn("Plugin.list")(function* () { - const state = yield* InstanceState.get(state) - return state.hooks + const s = yield* InstanceState.get(state) + return s.hooks }) const init = Effect.fn("Plugin.init")(function* () { diff --git a/packages/opencode/src/tool/registry.ts b/packages/opencode/src/tool/registry.ts index ffda954e38..133a5018ad 100644 --- a/packages/opencode/src/tool/registry.ts +++ b/packages/opencode/src/tool/registry.ts @@ -139,18 +139,18 @@ export namespace ToolRegistry { }) const register = Effect.fn("ToolRegistry.register")(function* (tool: Tool.Info) { - const state = yield* InstanceState.get(state) - const idx = state.custom.findIndex((t) => t.id === tool.id) + const s = yield* InstanceState.get(state) + const idx = s.custom.findIndex((t) => t.id === tool.id) if (idx >= 0) { - state.custom.splice(idx, 1, tool) + s.custom.splice(idx, 1, tool) return } - state.custom.push(tool) + s.custom.push(tool) }) const ids = Effect.fn("ToolRegistry.ids")(function* () { - const state = yield* InstanceState.get(state) - const tools = yield* all(state.custom) + const s = yield* InstanceState.get(state) + const tools = yield* all(s.custom) return tools.map((t) => t.id) }) @@ -158,8 +158,8 @@ export namespace ToolRegistry { model: { providerID: ProviderID; modelID: ModelID }, agent?: Agent.Info, ) { - const state = yield* InstanceState.get(state) - const allTools = yield* all(state.custom) + const s = yield* InstanceState.get(state) + const allTools = yield* all(s.custom) const filtered = allTools.filter((tool) => { if (tool.id === "codesearch" || tool.id === "websearch") { return model.providerID === ProviderID.opencode || Flag.OPENCODE_ENABLE_EXA