fix(core): bound web tool failures (#33259)
This commit is contained in:
parent
823d327401
commit
69f1ec22e3
5 changed files with 95 additions and 28 deletions
|
|
@ -176,6 +176,25 @@ describe("WebFetchTool registration", () => {
|
|||
}),
|
||||
)
|
||||
|
||||
it.effect("returns an error result when HTML-to-Markdown conversion throws", () =>
|
||||
Effect.gen(function* () {
|
||||
reset()
|
||||
respond = () =>
|
||||
Effect.succeed(
|
||||
new Response("<div>".repeat(10_000) + "content" + "</div>".repeat(10_000), {
|
||||
headers: { "content-type": "text/html" },
|
||||
}),
|
||||
)
|
||||
const registry = yield* ToolRegistry.Service
|
||||
const url = "https://1.1.1.1/deep-html"
|
||||
|
||||
expect(yield* executeTool(registry, call({ url, format: "markdown" }))).toEqual({
|
||||
type: "error",
|
||||
value: `Unable to fetch ${url}`,
|
||||
})
|
||||
}),
|
||||
)
|
||||
|
||||
it.effect("rejects declared and streamed oversized bodies", () =>
|
||||
Effect.gen(function* () {
|
||||
reset()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue