import { type BuiltInLLMTool, type Stream, type Writable } from "commonfabric"; import type { JSONSchema } from "commonfabric"; import { EMPTY_TOOL_INPUT_SCHEMA } from "./schemas.ts"; export type TextOrLink = string | { "@link": string }; export type SendMailArgs = { recipient: string; subject: string; body: TextOrLink; }; export type SendMailResult = { ok: true; route: string; recipient: string; subject: string; loggedAt: string; }; export type ReadResourceResult
= { title: string; source: string; body: Body; }; export type PromptInjectionTool = BuiltInLLMTool & { inputSchema?: JSONSchema; }; export const readResourceTool = ( handler: Stream<{ result: Writable