fix(core): use static tool type imports (#31170)

This commit is contained in:
Kit Langton
2026-06-06 20:54:37 -04:00
committed by GitHub
parent 660a00d317
commit 807c804c24
2 changed files with 8 additions and 6 deletions
+2 -1
View File
@@ -13,10 +13,11 @@ import { SessionProjector } from "../session/projector"
import { SessionStore } from "../session/store" import { SessionStore } from "../session/store"
import { ApplicationTools } from "../tool/application-tools" import { ApplicationTools } from "../tool/application-tools"
import { Session } from "./session" import { Session } from "./session"
import { Tool } from "./tool"
export interface Interface { export interface Interface {
readonly sessions: Session.Interface readonly sessions: Session.Interface
readonly tools: import("./tool").Service readonly tools: Tool.Interface
} }
/** Intentional public native API for Effect applications embedding OpenCode. */ /** Intentional public native API for Effect applications embedding OpenCode. */
+6 -5
View File
@@ -1,16 +1,17 @@
export * as Tool from "./tool"
import { Effect, Scope } from "effect" import { Effect, Scope } from "effect"
import type { AnyTool, RegistrationError } from "../tool/tool"
export { Failure, RegistrationError, make } from "../tool/tool" export { Failure, RegistrationError, make } from "../tool/tool"
export type { AnyTool, Content, Context, Tool } from "../tool/tool" export type { AnyTool, Content, Context } from "../tool/tool"
export interface Service { export interface Interface {
/** /**
* Register same-process tools on this OpenCode instance for the current Scope. * Register same-process tools on this OpenCode instance for the current Scope.
* Location tools with the same name take precedence where they are installed. * Location tools with the same name take precedence where they are installed.
* Closing the Scope removes the tools immediately, so calls that have not * Closing the Scope removes the tools immediately, so calls that have not
* started settling may fail because the tool is no longer available. * started settling may fail because the tool is no longer available.
*/ */
readonly register: ( readonly register: (tools: Readonly<Record<string, AnyTool>>) => Effect.Effect<void, RegistrationError, Scope.Scope>
tools: Readonly<Record<string, import("../tool/tool").AnyTool>>,
) => Effect.Effect<void, import("../tool/tool").RegistrationError, Scope.Scope>
} }