refactor(tool): Tool.Context.metadata returns Effect (#21972)

This commit is contained in:
Kit Langton
2026-04-10 23:12:04 -04:00
committed by GitHub
parent 9581bf0670
commit 3dd09147c2
17 changed files with 63 additions and 67 deletions

View File

@@ -385,7 +385,7 @@ export const BashTool = Tool.define(
let expired = false
let aborted = false
ctx.metadata({
yield* ctx.metadata({
metadata: {
output: "",
description: input.description,
@@ -397,16 +397,15 @@ export const BashTool = Tool.define(
const handle = yield* spawner.spawn(cmd(input.shell, input.name, input.command, input.cwd, input.env))
yield* Effect.forkScoped(
Stream.runForEach(Stream.decodeText(handle.all), (chunk) =>
Effect.sync(() => {
output += chunk
ctx.metadata({
metadata: {
output: preview(output),
description: input.description,
},
})
}),
Stream.runForEach(Stream.decodeText(handle.all), (chunk) => {
output += chunk
return ctx.metadata({
metadata: {
output: preview(output),
description: input.description,
},
})
},
),
)