fix(core): continue after unavailable tool calls
This commit is contained in:
@@ -365,6 +365,15 @@ const layer = Layer.effect(
|
||||
return
|
||||
}
|
||||
needsContinuation = true
|
||||
if (!advertisedTools.has(event.name)) {
|
||||
yield* serialized(
|
||||
publisher.failUnsettledTools({
|
||||
type: "tool.execution",
|
||||
message: `Tool is not available for this request: ${event.name}`,
|
||||
}),
|
||||
)
|
||||
return
|
||||
}
|
||||
const assistantMessageID = yield* publisher.assistantMessageID(event.id)
|
||||
ownedToolFibers.push(
|
||||
yield* Effect.uninterruptibleMask((restore) =>
|
||||
|
||||
@@ -273,9 +273,9 @@ function withLocation<A, E, R>(
|
||||
function mutablePlugin(description: string) {
|
||||
const plugin = pathToFileURL(path.join(import.meta.dir, "../../../plugin/src/v2/promise/index.ts")).href
|
||||
return `
|
||||
import { define } from ${JSON.stringify(plugin)}
|
||||
import { Plugin } from ${JSON.stringify(plugin)}
|
||||
|
||||
export default EffectPlugin.define({
|
||||
export default Plugin.define({
|
||||
id: "mutable-plugin",
|
||||
setup: async (ctx) => {
|
||||
await ctx.agent.transform((agents) => {
|
||||
|
||||
@@ -2674,7 +2674,10 @@ describe("SessionRunnerLLM", () => {
|
||||
{
|
||||
type: "tool",
|
||||
id: "call-missing",
|
||||
state: { status: "error", error: { message: "Unknown tool: missing" } },
|
||||
state: {
|
||||
status: "error",
|
||||
error: { type: "tool.execution", message: "Tool is not available for this request: missing" },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user