fix(core): harden unified tool runtime (#31171)
This commit is contained in:
parent
48c26fa039
commit
eb9a683b40
35 changed files with 435 additions and 237 deletions
|
|
@ -51,7 +51,7 @@ const reset = () => {
|
|||
respond = () => Effect.succeed(new Response("hello", { headers: { "content-type": "text/plain" } }))
|
||||
}
|
||||
|
||||
const call = (input: typeof WebFetchTool.Parameters.Type, id = "call-webfetch") => ({
|
||||
const call = (input: typeof WebFetchTool.Input.Type, id = "call-webfetch") => ({
|
||||
sessionID,
|
||||
...toolIdentity,
|
||||
call: { type: "tool-call" as const, id, name: "webfetch", input },
|
||||
|
|
@ -59,7 +59,7 @@ const call = (input: typeof WebFetchTool.Parameters.Type, id = "call-webfetch")
|
|||
|
||||
describe("WebFetchTool helpers", () => {
|
||||
test("defaults format and rejects invalid timeout controls", () => {
|
||||
const decode = Schema.decodeUnknownSync(WebFetchTool.Parameters)
|
||||
const decode = Schema.decodeUnknownSync(WebFetchTool.Input)
|
||||
expect(decode({ url: "https://example.com" })).toEqual({ url: "https://example.com", format: "markdown" })
|
||||
expect(() => decode({ url: "https://example.com", timeout: 0 })).toThrow()
|
||||
expect(() => decode({ url: "https://example.com", timeout: WebFetchTool.MAX_TIMEOUT_SECONDS + 1 })).toThrow()
|
||||
|
|
@ -72,7 +72,7 @@ describe("WebFetchTool helpers", () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe("WebFetchTool contribution", () => {
|
||||
describe("WebFetchTool registration", () => {
|
||||
it.effect("registers and fetches an ordinary hostname HTTP URL without rewriting it", () =>
|
||||
Effect.gen(function* () {
|
||||
reset()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue