@@ -51,8 +51,6 @@ import { llmClient } from "../../effect/app-node-platform"
5151import { AgentNotFoundError , StepFailedError } from "../error"
5252import { toSessionError } from "../to-session-error"
5353import { SessionRunnerRetry } from "./retry"
54- import type { SessionHooks } from "@opencode-ai/plugin/v2/effect/session"
55- import { PluginHooks } from "../../plugin/hooks"
5654import { PluginSupervisor } from "../../plugin/supervisor"
5755
5856type StepTokens = {
@@ -91,7 +89,6 @@ const layer = Layer.effect(
9189 const llm = yield * LLMClient . Service
9290 const agents = yield * AgentV2 . Service
9391 const tools = yield * ToolRegistry . Service
94- const hooks = yield * PluginHooks . Service
9592 const models = yield * SessionRunnerModel . Service
9693 const store = yield * SessionStore . Service
9794 const location = yield * Location . Service
@@ -212,30 +209,7 @@ const layer = Layer.effect(
212209 const toolFibers = yield * FiberSet . make < void , ToolOutputStore . Error > ( )
213210 const ownedToolFibers : Array < Fiber . Fiber < void , ToolOutputStore . Error > > = [ ]
214211 let needsContinuation = false
215- const availableTools = new Map ( request . tools . map ( ( tool ) => [ tool . name , tool ] ) )
216- const requestEvent : SessionHooks [ "request" ] = {
217- sessionID : session . id ,
218- agent : agent . id ,
219- model : resolved . ref ,
220- system : [ ...request . system ] ,
221- messages : [ ...request . messages ] ,
222- tools : Object . fromEntries (
223- request . tools . map ( ( tool ) => [ tool . name , { description : tool . description , input : { ...tool . inputSchema } } ] ) ,
224- ) ,
225- }
226- // Plugins may reshape the draft, but cannot advertise tools excluded earlier
227- // by permissions or registration state.
228- yield * hooks . trigger ( "session" , "request" , requestEvent )
229- const hookedRequest = LLM . updateRequest ( request , {
230- system : requestEvent . system ,
231- messages : requestEvent . messages ,
232- tools : Object . entries ( requestEvent . tools ) . flatMap ( ( [ name , tool ] ) => {
233- const registered = availableTools . get ( name )
234- if ( ! registered ) return [ ]
235- return [ { ...registered , description : tool . description , inputSchema : tool . input } ]
236- } ) ,
237- } )
238- const advertisedTools = new Set ( hookedRequest . tools . map ( ( tool ) => tool . name ) )
212+ const hookedRequest = request
239213 // Automatic compaction completed; rebuild the request from compacted history.
240214 if (
241215 ! ( yield * SessionPending . compaction ( db , session . id ) ) &&
@@ -280,21 +254,6 @@ const layer = Layer.effect(
280254 )
281255 return
282256 }
283- // A request hook hid this registered tool from the current request. Fail only
284- // this call durably and continue so the model can react, instead of executing
285- // a tool that was not advertised. Unregistered tools flow through settle, which
286- // durably fails them as unknown.
287- if ( ! advertisedTools . has ( event . name ) && availableTools . has ( event . name ) ) {
288- needsContinuation = true
289- yield * publish (
290- LLMEvent . toolError ( {
291- id : event . id ,
292- name : event . name ,
293- message : `Tool is not available for this request: ${ event . name } ` ,
294- } ) ,
295- )
296- return
297- }
298257 needsContinuation = true
299258 const assistantMessageID = yield * publisher . assistantMessageID ( event . id )
300259 ownedToolFibers . push (
@@ -624,7 +583,6 @@ export const node = makeLocationNode({
624583 llmClient ,
625584 AgentV2 . node ,
626585 ToolRegistry . node ,
627- PluginHooks . node ,
628586 SessionRunnerModel . node ,
629587 SessionStore . node ,
630588 Location . node ,
0 commit comments