@truefoundry/trueforge-core 0.2.0-rc.6 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-session/SessionHandle.d.ts +1 -0
- package/dist/agent-session/SessionHandle.d.ts.map +1 -1
- package/dist/agent-session/SessionHandle.js +1 -0
- package/dist/agent-session/SessionHandle.js.map +1 -1
- package/dist/agent-session/SessionHandle.mjs +1 -0
- package/dist/agent-session/SessionHandle.mjs.map +1 -1
- package/dist/agent-session/models/TurnRecord.d.ts +1 -0
- package/dist/agent-session/models/TurnRecord.d.ts.map +1 -1
- package/dist/agent-session/models/TurnRecord.js.map +1 -1
- package/dist/agent-session/models/TurnRecord.mjs.map +1 -1
- package/dist/core/capabilities/builtins/OpenUI.d.ts.map +1 -1
- package/dist/core/capabilities/builtins/OpenUI.js +4 -2
- package/dist/core/capabilities/builtins/OpenUI.js.map +1 -1
- package/dist/core/capabilities/builtins/OpenUI.mjs +4 -2
- package/dist/core/capabilities/builtins/OpenUI.mjs.map +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +7 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +4 -0
- package/dist/core/index.mjs.map +1 -1
- package/dist/core/llm/VercelAILLM.d.ts.map +1 -1
- package/dist/core/llm/VercelAILLM.js +7 -0
- package/dist/core/llm/VercelAILLM.js.map +1 -1
- package/dist/core/llm/VercelAILLM.mjs +7 -0
- package/dist/core/llm/VercelAILLM.mjs.map +1 -1
- package/dist/core/mcp/RemoteMCP.d.ts +2 -1
- package/dist/core/mcp/RemoteMCP.d.ts.map +1 -1
- package/dist/core/mcp/RemoteMCP.js +65 -20
- package/dist/core/mcp/RemoteMCP.js.map +1 -1
- package/dist/core/mcp/RemoteMCP.mjs +65 -20
- package/dist/core/mcp/RemoteMCP.mjs.map +1 -1
- package/dist/core/mcp/remoteMcpClient.d.ts.map +1 -1
- package/dist/core/mcp/remoteMcpClient.js +2 -5
- package/dist/core/mcp/remoteMcpClient.js.map +1 -1
- package/dist/core/mcp/remoteMcpClient.mjs +2 -5
- package/dist/core/mcp/remoteMcpClient.mjs.map +1 -1
- package/dist/core/runtime/DeferredTool.d.ts.map +1 -1
- package/dist/core/runtime/DeferredTool.js +3 -1
- package/dist/core/runtime/DeferredTool.js.map +1 -1
- package/dist/core/runtime/DeferredTool.mjs +3 -1
- package/dist/core/runtime/DeferredTool.mjs.map +1 -1
- package/dist/core/sandbox/Sandbox.d.ts.map +1 -1
- package/dist/core/sandbox/Sandbox.js +4 -1
- package/dist/core/sandbox/Sandbox.js.map +1 -1
- package/dist/core/sandbox/Sandbox.mjs +4 -1
- package/dist/core/sandbox/Sandbox.mjs.map +1 -1
- package/dist/core/sandbox/provider/TFYSandboxProvider.d.ts.map +1 -1
- package/dist/core/sandbox/provider/TFYSandboxProvider.js +19 -6
- package/dist/core/sandbox/provider/TFYSandboxProvider.js.map +1 -1
- package/dist/core/sandbox/provider/TFYSandboxProvider.mjs +19 -7
- package/dist/core/sandbox/provider/TFYSandboxProvider.mjs.map +1 -1
- package/dist/core/util/ssrfGuard.d.ts +10 -0
- package/dist/core/util/ssrfGuard.d.ts.map +1 -0
- package/dist/core/util/ssrfGuard.js +333 -0
- package/dist/core/util/ssrfGuard.js.map +1 -0
- package/dist/core/util/ssrfGuard.mjs +305 -0
- package/dist/core/util/ssrfGuard.mjs.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/capabilities/builtins/OpenUI.ts"],"sourcesContent":["import dedent from 'dedent';\nimport { z } from 'zod';\nimport { InstructionBuilder } from '../../InstructionBuilder';\nimport { toolResultResponse } from '../../mcp/IMCPServer';\nimport { defineTool, LocalToolMCP, type ToolDefinition } from '../../mcp/LocalToolMCP';\nimport type { AgentTracing } from '../../tracing/AgentTracing';\nimport { NOOP_AGENT_TRACING } from '../../tracing/NoopAgentTracing';\nimport type { AgentCapability } from '../AgentCapability';\n\nexport const OPENUI_SERVER_ID = 'openui';\nexport const GET_OPENUI_INSTRUCTIONS_TOOL_NAME = 'get_openui_instructions';\n\nconst getOpenUIInstructionsInputSchema = z.object({}).strict();\n\nexport const OPENUI_SECTION_TAG = 'openui';\nexport const OPENUI_MARKDOWN_FENCING_TAG = 'openui-markdown-fencing';\nexport const OPENUI_SYNTAX_RULES_TAG = 'openui-syntax-rules';\nexport const OPENUI_COMPONENT_SIGNATURES_TAG = 'openui-component-signatures';\nexport const OPENUI_BUILTIN_FUNCTIONS_TAG = 'openui-builtin-functions';\nexport const OPENUI_HOISTING_AND_STREAMING_TAG = 'openui-hoisting-and-streaming';\nexport const OPENUI_EXAMPLES_TAG = 'openui-examples';\nexport const OPENUI_IMPORTANT_RULES_TAG = 'openui-important-rules';\nexport const OPENUI_FINAL_VERIFICATION_TAG = 'openui-final-verification';\nexport const OPENUI_USER_INTERACTION_CHECKLIST_TAG = 'openui-user-interaction-checklist';\n\nexport function buildOpenUIInstruction(builder: InstructionBuilder): void {\n const openui = builder.beginSection(OPENUI_SECTION_TAG);\n\n openui.addSection(\n OPENUI_MARKDOWN_FENCING_TAG,\n dedent`\n All openui, code must be fenced within openui block.\n \\`\\`\\`openui\n code\n \\`\\`\\``,\n );\n\n openui.addSection(\n OPENUI_SYNTAX_RULES_TAG,\n dedent`\n 1. Each statement is on its own line: \\`identifier = Expression\\`\n 2. \\`root\\` is the entry point — every program must define \\`root = Stack(...)\\`\n 3. Expressions are: strings (\"...\"), numbers, booleans (true/false), null, arrays ([...]), objects ({...}), or component calls TypeName(arg1, arg2, ...)\n 4. Use references for readability: define \\`name = ...\\` on one line, then use \\`name\\` later\n 5. EVERY variable (except root) MUST be referenced by at least one other variable. Unreferenced variables are silently dropped and will NOT render. Always include defined variables in their parent's children/items array.\n 6. Arguments are POSITIONAL (order matters, not names). Write \\`Stack([children], \"row\", \"l\")\\` NOT \\`Stack([children], direction: \"row\", gap: \"l\")\\` — colon syntax is NOT supported and silently breaks\n 7. Optional arguments can be omitted from the end\n - Strings use double quotes with backslash escaping`,\n );\n\n openui.addSection(\n OPENUI_COMPONENT_SIGNATURES_TAG,\n dedent`\n Arguments marked with ? are optional. Sub-components can be inline or referenced; prefer references for better streaming.\n Props typed \\`ActionExpression\\` accept an Action([@steps...]) expression. See the Action section for available steps (@ToAssistant, @OpenUrl).\n Props marked \\`$binding<type>\\` accept a \\`$variable\\` reference for two-way binding.\n\n Layout:\n Stack([children], direction?: \"row\" | \"column\", gap?: \"none\" | \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\" | \"2xl\", align?: \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\", justify?: \"start\" | \"center\" | \"end\" | \"between\" | \"around\" | \"evenly\", wrap?: boolean) — Flex container. direction: \"row\"|\"column\" (default \"column\"). gap: \"none\"|\"xs\"|\"s\"|\"m\"|\"l\"|\"xl\"|\"2xl\" (default \"m\"). align: \"start\"|\"center\"|\"end\"|\"stretch\"|\"baseline\". justify: \"start\"|\"center\"|\"end\"|\"between\"|\"around\"|\"evenly\".\n Tabs(items: TabItem[]) — Tabbed container\n TabItem(value: string, trigger: string, content: (TextContent | MarkDownRenderer | CardHeader | Callout | TextCallout | CodeBlock | Image | ImageBlock | ImageGallery | Separator | HorizontalBarChart | RadarChart | PieChart | RadialChart | SingleStackedBarChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps)[]) — value is unique id, trigger is tab label, content is array of components\n Accordion(items: AccordionItem[]) — Collapsible sections\n AccordionItem(value: string, trigger: string, content: (TextContent | MarkDownRenderer | CardHeader | Callout | TextCallout | CodeBlock | Image | ImageBlock | ImageGallery | Separator | HorizontalBarChart | RadarChart | PieChart | RadialChart | SingleStackedBarChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps)[]) — value is unique id, trigger is section title\n Steps(items: StepsItem[]) — Step-by-step guide\n StepsItem(title: string, details: string) — title and details text for one step\n Carousel(children: (TextContent | MarkDownRenderer | CardHeader | Callout | TextCallout | CodeBlock | Image | ImageBlock | ImageGallery | Separator | HorizontalBarChart | RadarChart | PieChart | RadialChart | SingleStackedBarChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps)[][], variant?: \"card\" | \"sunk\") — Horizontal scrollable carousel\n Separator(orientation?: \"horizontal\" | \"vertical\", decorative?: boolean) — Visual divider between content sections\n Modal(title: string, open?: $binding<boolean>, children: (TextContent | MarkDownRenderer | CardHeader | Callout | TextCallout | CodeBlock | Image | ImageBlock | ImageGallery | Separator | HorizontalBarChart | RadarChart | PieChart | RadialChart | SingleStackedBarChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps)[], size?: \"sm\" | \"md\" | \"lg\") — Modal dialog. open is a reactive $boolean binding — set to true to open, X/Escape/backdrop auto-closes. Put Form with buttons inside children.\n - For grid-like layouts, use Stack with direction \"row\" and wrap set to true.\n - Prefer justify \"start\" (or omit justify) with wrap=true for stable columns instead of uneven gutters.\n - Use nested Stacks when you need explicit rows/sections.\n - Show/hide sections: $editId != \"\" ? Card([editForm]) : null\n - Modal: Modal(\"Title\", $showModal, [content]) — $showModal is boolean, X/Escape auto-closes. Put Form with its own buttons inside children.\n - Use Tabs for alternative views (chart types, data sections) — no $variable needed\n - Shared filter across Tabs: same $days binding in Query args works across all TabItems\n\n Content:\n Card(children: (TextContent | MarkDownRenderer | CardHeader | Callout | TextCallout | CodeBlock | Image | ImageBlock | ImageGallery | Separator | HorizontalBarChart | RadarChart | PieChart | RadialChart | SingleStackedBarChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps | Tabs | Carousel | Stack)[], variant?: \"card\" | \"sunk\" | \"clear\", direction?: \"row\" | \"column\", gap?: \"none\" | \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\" | \"2xl\", align?: \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\", justify?: \"start\" | \"center\" | \"end\" | \"between\" | \"around\" | \"evenly\", wrap?: boolean) — Styled container. variant: \"card\" (default, elevated) | \"sunk\" (recessed) | \"clear\" (transparent). Always full width. Accepts all Stack flex params (default: direction \"column\"). Cards flex to share space in row/wrap layouts.\n CardHeader(title?: string, subtitle?: string) — Header with optional title and subtitle\n TextContent(text: string, size?: \"small\" | \"default\" | \"large\" | \"small-heavy\" | \"large-heavy\") — Text block. Supports markdown. Optional size: \"small\" | \"default\" | \"large\" | \"small-heavy\" | \"large-heavy\".\n MarkDownRenderer(textMarkdown: string, variant?: \"clear\" | \"card\" | \"sunk\") — Renders markdown text with optional container variant\n Callout(variant: \"info\" | \"warning\" | \"error\" | \"success\" | \"neutral\", title: string, description: string, visible?: $binding<boolean>) — Callout banner. Optional visible is a reactive $boolean — auto-dismisses after 3s by setting $visible to false.\n TextCallout(variant?: \"neutral\" | \"info\" | \"warning\" | \"success\" | \"danger\", title?: string, description?: string) — Text callout with variant, title, and description\n Image(alt: string, src?: string) — Image with alt text and optional URL\n ImageBlock(src: string, alt?: string) — Image block with loading state\n ImageGallery(images: {src: string, alt?: string, details?: string}[]) — Gallery grid of images with modal preview\n CodeBlock(language: string, codeString: string) — Syntax-highlighted code block\n - Use Cards to group related KPIs or sections. Stack with direction \"row\" for side-by-side layouts.\n - Success toast: Callout(\"success\", \"Saved\", \"Done.\", $showSuccess) — use @Set($showSuccess, true) in save action, auto-dismisses after 3s. For errors: result.status == \"error\" ? Callout(\"error\", \"Failed\", result.error) : null\n - KPI card: Card([TextContent(\"Label\", \"small\"), TextContent(\"\" + @Count(@Filter(data.rows, \"field\", \"==\", \"value\")), \"large-heavy\")])\n\n Tables:\n Table(columns: Col[]) — Data table — column-oriented. Each Col holds its own data array.\n Col(label: string, data, type?: \"string\" | \"number\" | \"action\") — Column definition — holds label + data array\n - Table is COLUMN-oriented: Table([Col(\"Label\", dataArray), Col(\"Count\", countArray, \"number\")]). Use array pluck for data: data.rows.fieldName\n - Col data can be component arrays for styled cells: Col(\"Status\", @Each(data.rows, \"item\", Tag(item.status, null, \"sm\", item.status == \"open\" ? \"success\" : \"danger\")))\n - Row actions: Col(\"Actions\", @Each(data.rows, \"t\", Button(\"Edit\", Action([@Set($showEdit, true), @Set($editId, t.id)]))))\n - Sortable: sorted = @Sort(data.rows, $sortField, \"desc\"). Bind $sortField to Select. Use sorted.fieldName for Col data\n - Searchable: filtered = @Filter(data.rows, \"title\", \"contains\", $search). Bind $search to Input\n - Chain sort + filter: filtered = @Filter(...) then sorted = @Sort(filtered, ...) — use sorted for both Table and Charts\n - Empty state: @Count(data.rows) > 0 ? Table([...]) : TextContent(\"No data yet\")\n\n Charts (2D):\n BarChart(labels: string[], series: Series[], variant?: \"grouped\" | \"stacked\", xLabel?: string, yLabel?: string) — Vertical bars; use for comparing values across categories with one or more series\n LineChart(labels: string[], series: Series[], variant?: \"linear\" | \"natural\" | \"step\", xLabel?: string, yLabel?: string) — Lines over categories; use for trends and continuous data over time\n AreaChart(labels: string[], series: Series[], variant?: \"linear\" | \"natural\" | \"step\", xLabel?: string, yLabel?: string) — Filled area under lines; use for cumulative totals or volume trends over time\n RadarChart(labels: string[], series: Series[]) — Spider/web chart; use for comparing multiple variables across one or more entities\n HorizontalBarChart(labels: string[], series: Series[], variant?: \"grouped\" | \"stacked\", xLabel?: string, yLabel?: string) — Horizontal bars; prefer when category labels are long or for ranked lists\n Series(category: string, values: number[]) — One data series\n - Charts accept column arrays: LineChart(labels, [Series(\"Name\", values)]). Use array pluck: LineChart(data.rows.day, [Series(\"Views\", data.rows.views)])\n - Use Cards to wrap charts with CardHeader for titled sections\n - Chart + Table from same source: use @Sort or @Filter result for both LineChart and Table Col data\n - Multiple chart views: use Tabs — Tabs([TabItem(\"line\", \"Line\", [LineChart(...)]), TabItem(\"bar\", \"Bar\", [BarChart(...)])])\n\n Charts (1D):\n PieChart(labels: string[], values: number[], variant?: \"pie\" | \"donut\") — Circular slices; use plucked arrays: PieChart(data.categories, data.values)\n RadialChart(labels: string[], values: number[]) — Radial bars; use plucked arrays: RadialChart(data.categories, data.values)\n SingleStackedBarChart(labels: string[], values: number[]) — Single horizontal stacked bar; use plucked arrays: SingleStackedBarChart(data.categories, data.values)\n Slice(category: string, value: number) — One slice with label and numeric value\n - PieChart and BarChart need NUMBERS, not objects. For list data, use @Count(@Filter(...)) to aggregate:\n - PieChart from list: \\`PieChart([\"Low\", \"Med\", \"High\"], [@Count(@Filter(data.rows, \"priority\", \"==\", \"low\")), @Count(@Filter(data.rows, \"priority\", \"==\", \"medium\")), @Count(@Filter(data.rows, \"priority\", \"==\", \"high\"))], \"donut\")\\`\n - KPI from count: \\`TextContent(\"\" + @Count(@Filter(data.rows, \"status\", \"==\", \"open\")), \"large-heavy\")\\`\n\n Charts (Scatter):\n ScatterChart(datasets: ScatterSeries[], xLabel?: string, yLabel?: string) — X/Y scatter plot; use for correlations, distributions, and clustering\n ScatterSeries(name: string, points: Point[]) — Named dataset\n Point(x: number, y: number, z?: number) — Data point with numeric coordinates\n\n Data Display:\n TagBlock(tags: string[]) — tags is an array of strings\n Tag(text: string, icon?: string, size?: \"sm\" | \"md\" | \"lg\", variant?: \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\") — Styled tag/badge with optional icon and variant\n - Color-mapped Tag: Tag(value, null, \"sm\", value == \"high\" ? \"danger\" : value == \"medium\" ? \"warning\" : \"neutral\")`,\n );\n\n openui.addSection(\n OPENUI_BUILTIN_FUNCTIONS_TAG,\n dedent`\n Data functions prefixed with \\`@\\` to distinguish from components. These are the ONLY functions available — do NOT invent new ones.\n Use @-prefixed built-in functions (@Count, @Sum, @Avg, @Min, @Max, @Round) on Query results — do NOT hardcode computed values.\n\n @Count(array) → number — Returns array length\n @First(array) → element — Returns first element of array\n @Last(array) → element — Returns last element of array\n @Sum(numbers[]) → number — Sum of numeric array\n @Avg(numbers[]) → number — Average of numeric array\n @Min(numbers[]) → number — Minimum value in array\n @Max(numbers[]) → number — Maximum value in array\n @Sort(array, field, direction?) → sorted array — Sort array by field. Direction: \"asc\" (default) or \"desc\"\n @Filter(array, field, operator: \"==\" | \"!=\" | \">\" | \"<\" | \">=\" | \"<=\" | \"contains\", value) → filtered array — Filter array by field value\n @Round(number, decimals?) → number — Round to N decimal places (default 0)\n @Abs(number) → number — Absolute value\n @Floor(number) → number — Round down to nearest integer\n @Ceil(number) → number — Round up to nearest integer\n @Each(array, varName, template) — Evaluate template for each element. varName is the loop variable — use it ONLY inside the template expression (inline). Do NOT create a separate statement for the template.\n\n Builtins compose — output of one is input to the next:\n \\`@Count(@Filter(data.rows, \"field\", \"==\", \"val\"))\\` for KPIs/chart values, \\`@Round(@Avg(data.rows.score), 1)\\`, \\`@Each(data.rows, \"item\", Comp(item.field))\\` for per-item rendering.\n Array pluck: \\`data.rows.field\\` extracts a field from every row → use with @Sum, @Avg, charts, tables.\n\n IMPORTANT @Each rule: The loop variable (e.g. \"item\") is ONLY available inside the @Each template expression. Always inline the template — do NOT extract it to a separate statement.\n CORRECT: \\`Col(\"Actions\", @Each(rows, \"t\", Button(\"Edit\", Action([@Set($id, t.id)]))))\\`\n WRONG: \\`myBtn = Button(\"Edit\", Action([@Set($id, t.id)]))\\` then \\`Col(\"Actions\", @Each(rows, \"t\", myBtn))\\` — t is undefined in myBtn.`,\n );\n\n openui.addSection(\n OPENUI_HOISTING_AND_STREAMING_TAG,\n dedent`\n openui-lang supports hoisting: a reference can be used BEFORE it is defined. The parser resolves all references after the full input is parsed.\n\n During streaming, the output is re-parsed on every chunk. Undefined references are temporarily unresolved and appear once their definitions stream in. This creates a progressive top-down reveal — structure first, then data fills in.\n\n Recommended statement order for optimal streaming:\n 1. \\`root = Stack(...)\\` — UI shell appears immediately\n 2. $variable declarations — state ready for bindings\n 3. Query statements — defaults resolve immediately so components render with data\n 4. Component definitions — fill in with data already available\n 5. Data values — leaf content last\n\n Always write the root = Stack(...) statement first so the UI shell appears immediately, even before child data has streamed in.`,\n );\n\n openui.addSection(\n OPENUI_EXAMPLES_TAG,\n dedent`\n Example 1 — Table (column-oriented):\n\n root = Stack([title, tbl])\n title = TextContent(\"Top Languages\", \"large-heavy\")\n tbl = Table([Col(\"Language\", langs), Col(\"Users (M)\", users), Col(\"Year\", years)])\n langs = [\"Python\", \"JavaScript\", \"Java\", \"TypeScript\", \"Go\"]\n users = [15.7, 14.2, 12.1, 8.5, 5.2]\n years = [1991, 1995, 1995, 2012, 2009]\n\n Example 2 — Bar chart:\n\n root = Stack([title, chart])\n title = TextContent(\"Q4 Revenue\", \"large-heavy\")\n chart = BarChart(labels, [s1, s2], \"grouped\")\n labels = [\"Oct\", \"Nov\", \"Dec\"]\n s1 = Series(\"Product A\", [120, 150, 180])\n s2 = Series(\"Product B\", [90, 110, 140])\n\n Example 3 — Form with validation:\n\n root = Stack([title, form])\n title = TextContent(\"Contact Us\", \"large-heavy\")\n form = Form(\"contact\", btns, [nameField, emailField, countryField, msgField])\n nameField = FormControl(\"Name\", Input(\"name\", \"Your name\", \"text\", { required: true, minLength: 2 }))\n emailField = FormControl(\"Email\", Input(\"email\", \"you@example.com\", \"email\", { required: true, email: true }))\n countryField = FormControl(\"Country\", Select(\"country\", countryOpts, \"Select...\", { required: true }))\n msgField = FormControl(\"Message\", TextArea(\"message\", \"Tell us more...\", 4, { required: true, minLength: 10 }))\n countryOpts = [SelectItem(\"us\", \"United States\"), SelectItem(\"uk\", \"United Kingdom\"), SelectItem(\"de\", \"Germany\")]\n btns = Buttons([Button(\"Submit\", Action([@ToAssistant(\"Submit\")]), \"primary\"), Button(\"Cancel\", Action([@ToAssistant(\"Cancel\")]), \"secondary\")])\n\n Example 4 — Tabs with mixed content:\n\n root = Stack([title, tabs])\n title = TextContent(\"React vs Vue\", \"large-heavy\")\n tabs = Tabs([tabReact, tabVue])\n tabReact = TabItem(\"react\", \"React\", reactContent)\n tabVue = TabItem(\"vue\", \"Vue\", vueContent)\n reactContent = [TextContent(\"React is a library by Meta for building UIs.\"), Callout(\"info\", \"Note\", \"React uses JSX syntax.\")]\n vueContent = [TextContent(\"Vue is a progressive framework by Evan You.\"), Callout(\"success\", \"Tip\", \"Vue has a gentle learning curve.\")]`,\n );\n\n openui.addSection(\n OPENUI_IMPORTANT_RULES_TAG,\n dedent`\n - When asked about data, generate realistic/plausible data\n - Choose components that best represent the content (tables for comparisons, charts for trends, forms for input, etc.)\n - When you render data in an openui block (tables, charts, KPI cards), do NOT repeat the same numbers/facts in the markdown text outside the block.\n - Text outside the openui block can optionally include:\n 1. **Qualitative insights** — patterns, anomalies, or recommendations that aren't obvious from the visual (e.g. \"the high input-to-output ratio suggests document processing\")\n 2. **Actionable next steps** — what the user can do next\n 3. **Caveats/context** — things the data doesn't show\n - If all the information is already visible in the openui components, a brief one-line summary is sufficient — do not enumerate the same values again.`,\n );\n\n openui.addSection(\n OPENUI_FINAL_VERIFICATION_TAG,\n dedent`\n Before finishing, walk your output and verify:\n 1. root = Stack(...) is the FIRST line (for optimal streaming).\n 2. Every referenced name is defined. Every defined name (other than root) is reachable from root.\n\n - For grid-like layouts, use Stack with direction \"row\" and wrap=true. Avoid justify=\"between\" unless you specifically want large gutters.\n - For forms, define one FormControl reference per field so controls can stream progressively.\n - For forms, always provide the second Form argument with Buttons(...) actions: Form(name, buttons, fields).\n - Never nest Form inside Form.\n - Use @Reset($var1, $var2) after form submit to restore defaults — not @Set($var, \"\")\n - Multi-query refresh: Action([@Run(mutation), @Run(query1), @Run(query2), @Reset(...)])\n - $variables are reactive: changing via Select or @Set re-evaluates all Queries and expressions referencing them\n - Use existing components (Tabs, Accordion, Modal) before inventing ternary show/hide patterns`,\n );\n\n openui.addSection(\n OPENUI_USER_INTERACTION_CHECKLIST_TAG,\n dedent`\n 1. Will the response be UI heavy and will contain components which are not supported by markdown? Use openui if the answer is yes.\n 2. \\`\\`\\`openui\\`\\`\\` fencing must be closed.`,\n );\n}\n\n/** Renders the existing OpenUI prompt tree without duplicating section bodies. */\nexport function renderOpenUIPrompt(): string {\n const root = new InstructionBuilder('_openui_render');\n buildOpenUIInstruction(root);\n const wrapped = root.build();\n const openTag = `<${OPENUI_SECTION_TAG}>`;\n const closeTag = `</${OPENUI_SECTION_TAG}>`;\n const start = wrapped.indexOf(openTag);\n const end = wrapped.lastIndexOf(closeTag);\n if (start === -1 || end === -1) {\n throw new Error('Failed to render OpenUI prompt from buildOpenUIInstruction');\n }\n return wrapped.slice(start, end + closeTag.length);\n}\n\nfunction buildOpenUIDeferredInstruction(builder: InstructionBuilder): void {\n builder.addSection(\n OPENUI_SECTION_TAG,\n dedent`\n The Agent can render interactive UI that markdown cannot express by emitting a fenced \\`\\`\\`openui block.\n\n Before writing any \\`\\`\\`openui fence, the Agent MUST call ${GET_OPENUI_INSTRUCTIONS_TOOL_NAME} with arguments {}.\n Do not invent OpenUI syntax or component APIs without loading those instructions.\n\n Use OpenUI only when the response is UI-heavy and needs components markdown does not support.\n `.trim(),\n );\n}\n\nexport class OpenUIInstructions extends LocalToolMCP {\n readonly name = OPENUI_SERVER_ID;\n readonly displayName = 'OpenUI';\n\n constructor(tracing: AgentTracing) {\n super({ tracing });\n }\n\n private tools: ToolDefinition[] = [\n defineTool({\n name: GET_OPENUI_INSTRUCTIONS_TOOL_NAME,\n description: [\n 'Load the full OpenUI generative-UI authoring instructions (syntax, components, builtins, examples, rules).',\n 'Call this before emitting any ```openui fenced block. Pass an empty object as arguments: {}.',\n ].join(' '),\n schema: getOpenUIInstructionsInputSchema,\n handler: () => Promise.resolve(toolResultResponse({ text: renderOpenUIPrompt() })),\n }),\n ];\n\n protected getTools(): ToolDefinition[] {\n return this.tools;\n }\n}\n\nexport function openUI(options?: { preload?: boolean; tracing?: AgentTracing }): AgentCapability {\n const preload = options?.preload ?? true;\n if (preload) {\n return {\n instructionBuilders: [buildOpenUIInstruction],\n };\n }\n return {\n systemToolSets: [new OpenUIInstructions(options?.tracing ?? NOOP_AGENT_TRACING)],\n instructionBuilders: [buildOpenUIDeferredInstruction],\n };\n}\n"],"mappings":";AAAA,OA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+B,SAAmC;AACzE,UAAQ;AAAA,IACN;AAAA,IACA;AAAA;AAAA;AAAA,mEAG+D,iCAAiC;AAAA;AAAA;AAAA;AAAA,MAI9F,KAAK;AAAA,EACT;AACF;AAEO,IAAM,qBAAN,cAAiC,aAAa;AAAA,EAC1C,OAAO;AAAA,EACP,cAAc;AAAA,EAEvB,YAAY,SAAuB;AACjC,UAAM,EAAE,QAAQ,CAAC;AAAA,EACnB;AAAA,EAEQ,QAA0B;AAAA,IAChC,WAAW;AAAA,MACT,MAAM;AAAA,MACN,aAAa;AAAA,QACX;AAAA,QACA;AAAA,MACF,EAAE,KAAK,GAAG;AAAA,MACV,QAAQ;AAAA,MACR,SAAS,MAAM,QAAQ,QAAQ,mBAAmB,EAAE,MAAM,mBAAmB,EAAE,CAAC,CAAC;AAAA,IACnF,CAAC;AAAA,EACH;AAAA,EAEU,WAA6B;AACrC,WAAO,KAAK;AAAA,EACd;AACF;AAEO,SAAS,OAAO,SAA0E;AAC/F,QAAM,UAAU,SAAS,WAAW;AACpC,MAAI,SAAS;AACX,WAAO;AAAA,MACL,qBAAqB,CAAC,sBAAsB;AAAA,IAC9C;AAAA,EACF;AACA,SAAO;AAAA,IACL,gBAAgB,CAAC,IAAI,mBAAmB,SAAS,WAAW,kBAAkB,CAAC;AAAA,IAC/E,qBAAqB,CAAC,8BAA8B;AAAA,EACtD;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/capabilities/builtins/OpenUI.ts"],"sourcesContent":["import dedent from 'dedent';\nimport { z } from 'zod';\nimport { InstructionBuilder } from '../../InstructionBuilder';\nimport { toolResultResponse } from '../../mcp/IMCPServer';\nimport { defineTool, LocalToolMCP, type ToolDefinition } from '../../mcp/LocalToolMCP';\nimport type { AgentTracing } from '../../tracing/AgentTracing';\nimport { NOOP_AGENT_TRACING } from '../../tracing/NoopAgentTracing';\nimport type { AgentCapability } from '../AgentCapability';\n\nexport const OPENUI_SERVER_ID = 'openui';\nexport const GET_OPENUI_INSTRUCTIONS_TOOL_NAME = 'get_openui_instructions';\n\nconst getOpenUIInstructionsInputSchema = z.object({}).strict();\n\nexport const OPENUI_SECTION_TAG = 'openui';\nexport const OPENUI_MARKDOWN_FENCING_TAG = 'openui-markdown-fencing';\nexport const OPENUI_SYNTAX_RULES_TAG = 'openui-syntax-rules';\nexport const OPENUI_COMPONENT_SIGNATURES_TAG = 'openui-component-signatures';\nexport const OPENUI_BUILTIN_FUNCTIONS_TAG = 'openui-builtin-functions';\nexport const OPENUI_HOISTING_AND_STREAMING_TAG = 'openui-hoisting-and-streaming';\nexport const OPENUI_EXAMPLES_TAG = 'openui-examples';\nexport const OPENUI_IMPORTANT_RULES_TAG = 'openui-important-rules';\nexport const OPENUI_FINAL_VERIFICATION_TAG = 'openui-final-verification';\nexport const OPENUI_USER_INTERACTION_CHECKLIST_TAG = 'openui-user-interaction-checklist';\n\nexport function buildOpenUIInstruction(builder: InstructionBuilder): void {\n const openui = builder.beginSection(OPENUI_SECTION_TAG);\n\n openui.addSection(\n OPENUI_MARKDOWN_FENCING_TAG,\n dedent`\n All openui, code must be fenced within openui block.\n \\`\\`\\`openui\n code\n \\`\\`\\``,\n );\n\n openui.addSection(\n OPENUI_SYNTAX_RULES_TAG,\n dedent`\n 1. Each statement is on its own line: \\`identifier = Expression\\`\n 2. \\`root\\` is the entry point — every program must define \\`root = Stack(...)\\`\n 3. Expressions are: strings (\"...\"), numbers, booleans (true/false), null, arrays ([...]), objects ({...}), or component calls TypeName(arg1, arg2, ...)\n 4. Use references for readability: define \\`name = ...\\` on one line, then use \\`name\\` later\n 5. EVERY variable (except root) MUST be referenced by at least one other variable. Unreferenced variables are silently dropped and will NOT render. Always include defined variables in their parent's children/items array.\n 6. Arguments are POSITIONAL (order matters, not names). Write \\`Stack([children], \"row\", \"l\")\\` NOT \\`Stack([children], direction: \"row\", gap: \"l\")\\` — colon syntax is NOT supported and silently breaks\n 7. Optional arguments can be omitted from the end\n - Strings use double quotes with backslash escaping`,\n );\n\n openui.addSection(\n OPENUI_COMPONENT_SIGNATURES_TAG,\n dedent`\n Arguments marked with ? are optional. Sub-components can be inline or referenced; prefer references for better streaming.\n Props typed \\`ActionExpression\\` accept an Action([@steps...]) expression. See the Action section for available steps (@ToAssistant, @OpenUrl).\n Props marked \\`$binding<type>\\` accept a \\`$variable\\` reference for two-way binding.\n\n Layout:\n Stack([children], direction?: \"row\" | \"column\", gap?: \"none\" | \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\" | \"2xl\", align?: \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\", justify?: \"start\" | \"center\" | \"end\" | \"between\" | \"around\" | \"evenly\", wrap?: boolean) — Flex container. direction: \"row\"|\"column\" (default \"column\"). gap: \"none\"|\"xs\"|\"s\"|\"m\"|\"l\"|\"xl\"|\"2xl\" (default \"m\"). align: \"start\"|\"center\"|\"end\"|\"stretch\"|\"baseline\". justify: \"start\"|\"center\"|\"end\"|\"between\"|\"around\"|\"evenly\".\n Tabs(items: TabItem[]) — Tabbed container\n TabItem(value: string, trigger: string, content: (TextContent | MarkDownRenderer | CardHeader | Callout | TextCallout | CodeBlock | Image | ImageBlock | ImageGallery | Separator | HorizontalBarChart | RadarChart | PieChart | RadialChart | SingleStackedBarChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps)[]) — value is unique id, trigger is tab label, content is array of components\n Accordion(items: AccordionItem[]) — Collapsible sections\n AccordionItem(value: string, trigger: string, content: (TextContent | MarkDownRenderer | CardHeader | Callout | TextCallout | CodeBlock | Image | ImageBlock | ImageGallery | Separator | HorizontalBarChart | RadarChart | PieChart | RadialChart | SingleStackedBarChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps)[]) — value is unique id, trigger is section title\n Steps(items: StepsItem[]) — Step-by-step guide\n StepsItem(title: string, details: string) — title and details text for one step\n Carousel(children: (TextContent | MarkDownRenderer | CardHeader | Callout | TextCallout | CodeBlock | Image | ImageBlock | ImageGallery | Separator | HorizontalBarChart | RadarChart | PieChart | RadialChart | SingleStackedBarChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps)[][], variant?: \"card\" | \"sunk\") — Horizontal scrollable carousel\n Separator(orientation?: \"horizontal\" | \"vertical\", decorative?: boolean) — Visual divider between content sections\n Modal(title: string, open?: $binding<boolean>, children: (TextContent | MarkDownRenderer | CardHeader | Callout | TextCallout | CodeBlock | Image | ImageBlock | ImageGallery | Separator | HorizontalBarChart | RadarChart | PieChart | RadialChart | SingleStackedBarChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps)[], size?: \"sm\" | \"md\" | \"lg\") — Modal dialog. open is a reactive $boolean binding — set to true to open, X/Escape/backdrop auto-closes. Put Form with buttons inside children.\n - For grid-like layouts, use Stack with direction \"row\" and wrap set to true.\n - Prefer justify \"start\" (or omit justify) with wrap=true for stable columns instead of uneven gutters.\n - Use nested Stacks when you need explicit rows/sections.\n - Show/hide sections: $editId != \"\" ? Card([editForm]) : null\n - Modal: Modal(\"Title\", $showModal, [content]) — $showModal is boolean, X/Escape auto-closes. Put Form with its own buttons inside children.\n - Use Tabs for alternative views (chart types, data sections) — no $variable needed\n - Shared filter across Tabs: same $days binding in Query args works across all TabItems\n\n Content:\n Card(children: (TextContent | MarkDownRenderer | CardHeader | Callout | TextCallout | CodeBlock | Image | ImageBlock | ImageGallery | Separator | HorizontalBarChart | RadarChart | PieChart | RadialChart | SingleStackedBarChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps | Tabs | Carousel | Stack)[], variant?: \"card\" | \"sunk\" | \"clear\", direction?: \"row\" | \"column\", gap?: \"none\" | \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\" | \"2xl\", align?: \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\", justify?: \"start\" | \"center\" | \"end\" | \"between\" | \"around\" | \"evenly\", wrap?: boolean) — Styled container. variant: \"card\" (default, elevated) | \"sunk\" (recessed) | \"clear\" (transparent). Always full width. Accepts all Stack flex params (default: direction \"column\"). Cards flex to share space in row/wrap layouts.\n CardHeader(title?: string, subtitle?: string) — Header with optional title and subtitle\n TextContent(text: string, size?: \"small\" | \"default\" | \"large\" | \"small-heavy\" | \"large-heavy\") — Text block. Supports markdown. Optional size: \"small\" | \"default\" | \"large\" | \"small-heavy\" | \"large-heavy\".\n MarkDownRenderer(textMarkdown: string, variant?: \"clear\" | \"card\" | \"sunk\") — Renders markdown text with optional container variant\n Callout(variant: \"info\" | \"warning\" | \"error\" | \"success\" | \"neutral\", title: string, description: string, visible?: $binding<boolean>) — Callout banner. Optional visible is a reactive $boolean — auto-dismisses after 3s by setting $visible to false.\n TextCallout(variant?: \"neutral\" | \"info\" | \"warning\" | \"success\" | \"danger\", title?: string, description?: string) — Text callout with variant, title, and description\n Image(alt: string, src?: string) — Image with alt text and optional URL\n ImageBlock(src: string, alt?: string) — Image block with loading state\n ImageGallery(images: {src: string, alt?: string, details?: string}[]) — Gallery grid of images with modal preview\n CodeBlock(language: string, codeString: string) — Syntax-highlighted code block\n - Use Cards to group related KPIs or sections. Stack with direction \"row\" for side-by-side layouts.\n - Success toast: Callout(\"success\", \"Saved\", \"Done.\", $showSuccess) — use @Set($showSuccess, true) in save action, auto-dismisses after 3s. For errors: result.status == \"error\" ? Callout(\"error\", \"Failed\", result.error) : null\n - KPI card: Card([TextContent(\"Label\", \"small\"), TextContent(\"\" + @Count(@Filter(data.rows, \"field\", \"==\", \"value\")), \"large-heavy\")])\n\n Tables:\n Table(columns: Col[]) — Data table — column-oriented. Each Col holds its own data array.\n Col(label: string, data, type?: \"string\" | \"number\" | \"action\") — Column definition — holds label + data array\n - Table is COLUMN-oriented: Table([Col(\"Label\", dataArray), Col(\"Count\", countArray, \"number\")]). Use array pluck for data: data.rows.fieldName\n - Col data can be component arrays for styled cells: Col(\"Status\", @Each(data.rows, \"item\", Tag(item.status, null, \"sm\", item.status == \"open\" ? \"success\" : \"danger\")))\n - Row actions: Col(\"Actions\", @Each(data.rows, \"t\", Button(\"Edit\", Action([@Set($showEdit, true), @Set($editId, t.id)]))))\n - Sortable: sorted = @Sort(data.rows, $sortField, \"desc\"). Bind $sortField to Select. Use sorted.fieldName for Col data\n - Searchable: filtered = @Filter(data.rows, \"title\", \"contains\", $search). Bind $search to Input\n - Chain sort + filter: filtered = @Filter(...) then sorted = @Sort(filtered, ...) — use sorted for both Table and Charts\n - Empty state: @Count(data.rows) > 0 ? Table([...]) : TextContent(\"No data yet\")\n\n Charts (2D):\n BarChart(labels: string[], series: Series[], variant?: \"grouped\" | \"stacked\", xLabel?: string, yLabel?: string) — Vertical bars; use for comparing values across categories with one or more series\n LineChart(labels: string[], series: Series[], variant?: \"linear\" | \"natural\" | \"step\", xLabel?: string, yLabel?: string) — Lines over categories; use for trends and continuous data over time\n AreaChart(labels: string[], series: Series[], variant?: \"linear\" | \"natural\" | \"step\", xLabel?: string, yLabel?: string) — Filled area under lines; use for cumulative totals or volume trends over time\n RadarChart(labels: string[], series: Series[]) — Spider/web chart; use for comparing multiple variables across one or more entities\n HorizontalBarChart(labels: string[], series: Series[], variant?: \"grouped\" | \"stacked\", xLabel?: string, yLabel?: string) — Horizontal bars; prefer when category labels are long or for ranked lists\n Series(category: string, values: number[]) — One data series\n - Charts accept column arrays: LineChart(labels, [Series(\"Name\", values)]). Use array pluck: LineChart(data.rows.day, [Series(\"Views\", data.rows.views)])\n - Use Cards to wrap charts with CardHeader for titled sections\n - Chart + Table from same source: use @Sort or @Filter result for both LineChart and Table Col data\n - Multiple chart views: use Tabs — Tabs([TabItem(\"line\", \"Line\", [LineChart(...)]), TabItem(\"bar\", \"Bar\", [BarChart(...)])])\n\n Charts (1D):\n PieChart(labels: string[], values: number[], variant?: \"pie\" | \"donut\") — Circular slices; use plucked arrays: PieChart(data.categories, data.values)\n RadialChart(labels: string[], values: number[]) — Radial bars; use plucked arrays: RadialChart(data.categories, data.values)\n SingleStackedBarChart(labels: string[], values: number[]) — Single horizontal stacked bar; use plucked arrays: SingleStackedBarChart(data.categories, data.values)\n Slice(category: string, value: number) — One slice with label and numeric value\n - PieChart and BarChart need NUMBERS, not objects. For list data, use @Count(@Filter(...)) to aggregate:\n - PieChart from list: \\`PieChart([\"Low\", \"Med\", \"High\"], [@Count(@Filter(data.rows, \"priority\", \"==\", \"low\")), @Count(@Filter(data.rows, \"priority\", \"==\", \"medium\")), @Count(@Filter(data.rows, \"priority\", \"==\", \"high\"))], \"donut\")\\`\n - KPI from count: \\`TextContent(\"\" + @Count(@Filter(data.rows, \"status\", \"==\", \"open\")), \"large-heavy\")\\`\n\n Charts (Scatter):\n ScatterChart(datasets: ScatterSeries[], xLabel?: string, yLabel?: string) — X/Y scatter plot; use for correlations, distributions, and clustering\n ScatterSeries(name: string, points: Point[]) — Named dataset\n Point(x: number, y: number, z?: number) — Data point with numeric coordinates\n\n Data Display:\n TagBlock(tags: string[]) — tags is an array of strings\n Tag(text: string, icon?: string, size?: \"sm\" | \"md\" | \"lg\", variant?: \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\") — Styled tag/badge with optional icon and variant\n - Color-mapped Tag: Tag(value, null, \"sm\", value == \"high\" ? \"danger\" : value == \"medium\" ? \"warning\" : \"neutral\")`,\n );\n\n openui.addSection(\n OPENUI_BUILTIN_FUNCTIONS_TAG,\n dedent`\n Data functions prefixed with \\`@\\` to distinguish from components. These are the ONLY functions available — do NOT invent new ones.\n Use @-prefixed built-in functions (@Count, @Sum, @Avg, @Min, @Max, @Round) on Query results — do NOT hardcode computed values.\n\n @Count(array) → number — Returns array length\n @First(array) → element — Returns first element of array\n @Last(array) → element — Returns last element of array\n @Sum(numbers[]) → number — Sum of numeric array\n @Avg(numbers[]) → number — Average of numeric array\n @Min(numbers[]) → number — Minimum value in array\n @Max(numbers[]) → number — Maximum value in array\n @Sort(array, field, direction?) → sorted array — Sort array by field. Direction: \"asc\" (default) or \"desc\"\n @Filter(array, field, operator: \"==\" | \"!=\" | \">\" | \"<\" | \">=\" | \"<=\" | \"contains\", value) → filtered array — Filter array by field value\n @Round(number, decimals?) → number — Round to N decimal places (default 0)\n @Abs(number) → number — Absolute value\n @Floor(number) → number — Round down to nearest integer\n @Ceil(number) → number — Round up to nearest integer\n @Each(array, varName, template) — Evaluate template for each element. varName is the loop variable — use it ONLY inside the template expression (inline). Do NOT create a separate statement for the template.\n\n Builtins compose — output of one is input to the next:\n \\`@Count(@Filter(data.rows, \"field\", \"==\", \"val\"))\\` for KPIs/chart values, \\`@Round(@Avg(data.rows.score), 1)\\`, \\`@Each(data.rows, \"item\", Comp(item.field))\\` for per-item rendering.\n Array pluck: \\`data.rows.field\\` extracts a field from every row → use with @Sum, @Avg, charts, tables.\n\n IMPORTANT @Each rule: The loop variable (e.g. \"item\") is ONLY available inside the @Each template expression. Always inline the template — do NOT extract it to a separate statement.\n CORRECT: \\`Col(\"Actions\", @Each(rows, \"t\", Button(\"Edit\", Action([@Set($id, t.id)]))))\\`\n WRONG: \\`myBtn = Button(\"Edit\", Action([@Set($id, t.id)]))\\` then \\`Col(\"Actions\", @Each(rows, \"t\", myBtn))\\` — t is undefined in myBtn.`,\n );\n\n openui.addSection(\n OPENUI_HOISTING_AND_STREAMING_TAG,\n dedent`\n openui-lang supports hoisting: a reference can be used BEFORE it is defined. The parser resolves all references after the full input is parsed.\n\n During streaming, the output is re-parsed on every chunk. Undefined references are temporarily unresolved and appear once their definitions stream in. This creates a progressive top-down reveal — structure first, then data fills in.\n\n Recommended statement order for optimal streaming:\n 1. \\`root = Stack(...)\\` — UI shell appears immediately\n 2. $variable declarations — state ready for bindings\n 3. Query statements — defaults resolve immediately so components render with data\n 4. Component definitions — fill in with data already available\n 5. Data values — leaf content last\n\n Always write the root = Stack(...) statement first so the UI shell appears immediately, even before child data has streamed in.`,\n );\n\n openui.addSection(\n OPENUI_EXAMPLES_TAG,\n dedent`\n Example 1 — Table (column-oriented):\n\n root = Stack([title, tbl])\n title = TextContent(\"Top Languages\", \"large-heavy\")\n tbl = Table([Col(\"Language\", langs), Col(\"Users (M)\", users), Col(\"Year\", years)])\n langs = [\"Python\", \"JavaScript\", \"Java\", \"TypeScript\", \"Go\"]\n users = [15.7, 14.2, 12.1, 8.5, 5.2]\n years = [1991, 1995, 1995, 2012, 2009]\n\n Example 2 — Bar chart:\n\n root = Stack([title, chart])\n title = TextContent(\"Q4 Revenue\", \"large-heavy\")\n chart = BarChart(labels, [s1, s2], \"grouped\")\n labels = [\"Oct\", \"Nov\", \"Dec\"]\n s1 = Series(\"Product A\", [120, 150, 180])\n s2 = Series(\"Product B\", [90, 110, 140])\n\n Example 3 — Form with validation:\n\n root = Stack([title, form])\n title = TextContent(\"Contact Us\", \"large-heavy\")\n form = Form(\"contact\", btns, [nameField, emailField, countryField, msgField])\n nameField = FormControl(\"Name\", Input(\"name\", \"Your name\", \"text\", { required: true, minLength: 2 }))\n emailField = FormControl(\"Email\", Input(\"email\", \"you@example.com\", \"email\", { required: true, email: true }))\n countryField = FormControl(\"Country\", Select(\"country\", countryOpts, \"Select...\", { required: true }))\n msgField = FormControl(\"Message\", TextArea(\"message\", \"Tell us more...\", 4, { required: true, minLength: 10 }))\n countryOpts = [SelectItem(\"us\", \"United States\"), SelectItem(\"uk\", \"United Kingdom\"), SelectItem(\"de\", \"Germany\")]\n btns = Buttons([Button(\"Submit\", Action([@ToAssistant(\"Submit\")]), \"primary\"), Button(\"Cancel\", Action([@ToAssistant(\"Cancel\")]), \"secondary\")])\n\n Example 4 — Tabs with mixed content:\n\n root = Stack([title, tabs])\n title = TextContent(\"React vs Vue\", \"large-heavy\")\n tabs = Tabs([tabReact, tabVue])\n tabReact = TabItem(\"react\", \"React\", reactContent)\n tabVue = TabItem(\"vue\", \"Vue\", vueContent)\n reactContent = [TextContent(\"React is a library by Meta for building UIs.\"), Callout(\"info\", \"Note\", \"React uses JSX syntax.\")]\n vueContent = [TextContent(\"Vue is a progressive framework by Evan You.\"), Callout(\"success\", \"Tip\", \"Vue has a gentle learning curve.\")]`,\n );\n\n openui.addSection(\n OPENUI_IMPORTANT_RULES_TAG,\n dedent`\n - When asked about data, generate realistic/plausible data\n - Prefer OpenUI charts for plot/chart/visualize; images only if downloadable\n - Choose components that best represent the content (tables for comparisons, charts for trends, forms for input, etc.)\n - When you render data in an openui block (tables, charts, KPI cards), do NOT repeat the same numbers/facts in the markdown text outside the block.\n - Text outside the openui block can optionally include:\n 1. **Qualitative insights** — patterns, anomalies, or recommendations that aren't obvious from the visual (e.g. \"the high input-to-output ratio suggests document processing\")\n 2. **Actionable next steps** — what the user can do next\n 3. **Caveats/context** — things the data doesn't show\n - If all the information is already visible in the openui components, a brief one-line summary is sufficient — do not enumerate the same values again.`,\n );\n\n openui.addSection(\n OPENUI_FINAL_VERIFICATION_TAG,\n dedent`\n Before finishing, walk your output and verify:\n 1. root = Stack(...) is the FIRST line (for optimal streaming).\n 2. Every referenced name is defined. Every defined name (other than root) is reachable from root.\n\n - For grid-like layouts, use Stack with direction \"row\" and wrap=true. Avoid justify=\"between\" unless you specifically want large gutters.\n - For forms, define one FormControl reference per field so controls can stream progressively.\n - For forms, always provide the second Form argument with Buttons(...) actions: Form(name, buttons, fields).\n - Never nest Form inside Form.\n - Use @Reset($var1, $var2) after form submit to restore defaults — not @Set($var, \"\")\n - Multi-query refresh: Action([@Run(mutation), @Run(query1), @Run(query2), @Reset(...)])\n - $variables are reactive: changing via Select or @Set re-evaluates all Queries and expressions referencing them\n - Use existing components (Tabs, Accordion, Modal) before inventing ternary show/hide patterns`,\n );\n\n openui.addSection(\n OPENUI_USER_INTERACTION_CHECKLIST_TAG,\n dedent`\n 1. Plot/chart/visualize or UI-heavy beyond markdown? Use openui.\n 2. \\`\\`\\`openui\\`\\`\\` fencing must be closed.`,\n );\n}\n\n/** Renders the existing OpenUI prompt tree without duplicating section bodies. */\nexport function renderOpenUIPrompt(): string {\n const root = new InstructionBuilder('_openui_render');\n buildOpenUIInstruction(root);\n const wrapped = root.build();\n const openTag = `<${OPENUI_SECTION_TAG}>`;\n const closeTag = `</${OPENUI_SECTION_TAG}>`;\n const start = wrapped.indexOf(openTag);\n const end = wrapped.lastIndexOf(closeTag);\n if (start === -1 || end === -1) {\n throw new Error('Failed to render OpenUI prompt from buildOpenUIInstruction');\n }\n return wrapped.slice(start, end + closeTag.length);\n}\n\nfunction buildOpenUIDeferredInstruction(builder: InstructionBuilder): void {\n builder.addSection(\n OPENUI_SECTION_TAG,\n dedent`\n The Agent can render interactive UI that markdown cannot express by emitting a fenced \\`\\`\\`openui block.\n\n Before writing any \\`\\`\\`openui fence, the Agent MUST call ${GET_OPENUI_INSTRUCTIONS_TOOL_NAME} with arguments {}.\n Do not invent OpenUI syntax or component APIs without loading those instructions.\n\n Prefer OpenUI for plot/chart/visualize over sandbox code; sandbox images only for downloads.\n Otherwise use OpenUI only when UI-heavy beyond markdown.\n `.trim(),\n );\n}\n\nexport class OpenUIInstructions extends LocalToolMCP {\n readonly name = OPENUI_SERVER_ID;\n readonly displayName = 'OpenUI';\n\n constructor(tracing: AgentTracing) {\n super({ tracing });\n }\n\n private tools: ToolDefinition[] = [\n defineTool({\n name: GET_OPENUI_INSTRUCTIONS_TOOL_NAME,\n description: [\n 'Load the full OpenUI generative-UI authoring instructions (syntax, components, builtins, examples, rules).',\n 'Call this before emitting any ```openui fenced block. Pass an empty object as arguments: {}.',\n ].join(' '),\n schema: getOpenUIInstructionsInputSchema,\n handler: () => Promise.resolve(toolResultResponse({ text: renderOpenUIPrompt() })),\n }),\n ];\n\n protected getTools(): ToolDefinition[] {\n return this.tools;\n }\n}\n\nexport function openUI(options?: { preload?: boolean; tracing?: AgentTracing }): AgentCapability {\n const preload = options?.preload ?? true;\n if (preload) {\n return {\n instructionBuilders: [buildOpenUIInstruction],\n };\n }\n return {\n systemToolSets: [new OpenUIInstructions(options?.tracing ?? NOOP_AGENT_TRACING)],\n instructionBuilders: [buildOpenUIDeferredInstruction],\n };\n}\n"],"mappings":";AAAA,OAAO,YAAY;A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SAAmC;AACzE,UAAQ;AAAA,IACN;AAAA,IACA;AAAA;AAAA;AAAA,mEAG+D,iCAAiC;AAAA;AAAA;AAAA;AAAA;AAAA,MAK9F,KAAK;AAAA,EACT;AACF;AAEO,IAAM,qBAAN,cAAiC,aAAa;AAAA,EAC1C,OAAO;AAAA,EACP,cAAc;AAAA,EAEvB,YAAY,SAAuB;AACjC,UAAM,EAAE,QAAQ,CAAC;AAAA,EACnB;AAAA,EAEQ,QAA0B;AAAA,IAChC,WAAW;AAAA,MACT,MAAM;AAAA,MACN,aAAa;AAAA,QACX;AAAA,QACA;AAAA,MACF,EAAE,KAAK,GAAG;AAAA,MACV,QAAQ;AAAA,MACR,SAAS,MAAM,QAAQ,QAAQ,mBAAmB,EAAE,MAAM,mBAAmB,EAAE,CAAC,CAAC;AAAA,IACnF,CAAC;AAAA,EACH;AAAA,EAEU,WAA6B;AACrC,WAAO,KAAK;AAAA,EACd;AACF;AAEO,SAAS,OAAO,SAA0E;AAC/F,QAAM,UAAU,SAAS,WAAW;AACpC,MAAI,SAAS;AACX,WAAO;AAAA,MACL,qBAAqB,CAAC,sBAAsB;AAAA,IAC9C;AAAA,EACF;AACA,SAAO;AAAA,IACL,gBAAgB,CAAC,IAAI,mBAAmB,SAAS,WAAW,kBAAkB,CAAC;AAAA,IAC/E,qBAAqB,CAAC,8BAA8B;AAAA,EACtD;AACF;","names":[]}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export { AgentHarnessError, McpConnectionError, McpDcrConfigurationError } from
|
|
|
49
49
|
export { REDIS_KEY_NAMESPACE, redisKey } from './redisKeys';
|
|
50
50
|
export { describeUnknownError, extractErrorLogFields } from './util/errorLogFields';
|
|
51
51
|
export { PromiseTimeoutError, withTimeout } from './util/promiseUtils';
|
|
52
|
+
export { assertSafeOutboundUrl, configureOutboundUrlGuard, ssrfFetch } from './util/ssrfGuard';
|
|
52
53
|
export { CodeModeDispatcher } from './sandbox/codeMode/CodeModeDispatcher';
|
|
53
54
|
export type { CodeModeLogger } from './sandbox/codeMode/CodeModeDispatcher';
|
|
54
55
|
export type { CodeModeClientInstall, CodeModeTransport } from './sandbox/codeMode/CodeModeTransport';
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,YAAY,EACV,SAAS,EACT,WAAW,EACX,cAAc,EACd,wBAAwB,EACxB,yBAAyB,EACzB,gBAAgB,EAChB,yBAAyB,EACzB,0BAA0B,EAC1B,wBAAwB,GACzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,YAAY,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AACzF,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/G,YAAY,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAGxE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAClG,YAAY,EACV,2BAA2B,EAC3B,2BAA2B,EAC3B,iCAAiC,EACjC,oCAAoC,GACrC,MAAM,sCAAsC,CAAC;AAG9C,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EACL,2CAA2C,EAC3C,iBAAiB,GAClB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAChG,OAAO,EACL,uCAAuC,EACvC,oCAAoC,EACpC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wB,CAAC;AAC3D,OAAO,EAAE,4BAA4B,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACnH,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,YAAY,EAAE,kBAAkB,EAAE,gCAAgC,EAAE,MAAM,wCAAwC,CAAC;AACnH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,GACd,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACtG,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/core/index.js
CHANGED
|
@@ -92,8 +92,10 @@ __export(core_exports, {
|
|
|
92
92
|
WebSearchProviders: () => import_WebSearchProvider.WebSearchProviders,
|
|
93
93
|
absolutizeRelativeExecEnv: () => import_execEnv.absolutizeRelativeExecEnv,
|
|
94
94
|
askUserQuestion: () => import_AskUserQuestion.askUserQuestion,
|
|
95
|
+
assertSafeOutboundUrl: () => import_ssrfGuard.assertSafeOutboundUrl,
|
|
95
96
|
buildWebSearchInstruction: () => import_WebSearch.buildWebSearchInstruction,
|
|
96
97
|
buildWriteAndRunScriptCommand: () => import_Sandbox.buildWriteAndRunScriptCommand,
|
|
98
|
+
configureOutboundUrlGuard: () => import_ssrfGuard.configureOutboundUrlGuard,
|
|
97
99
|
contextCompaction: () => import_ContextCompaction.contextCompaction,
|
|
98
100
|
currentDateTime: () => import_CurrentDateTime.currentDateTime,
|
|
99
101
|
defineTool: () => import_LocalToolMCP.defineTool,
|
|
@@ -116,6 +118,7 @@ __export(core_exports, {
|
|
|
116
118
|
redisKey: () => import_redisKeys.redisKey,
|
|
117
119
|
renderSkillPromptBody: () => import_skills.renderSkillPromptBody,
|
|
118
120
|
shellEscape: () => import_Provider.shellEscape,
|
|
121
|
+
ssrfFetch: () => import_ssrfGuard.ssrfFetch,
|
|
119
122
|
toOpenAIResponseFormat: () => import_responseFormat.toOpenAIResponseFormat,
|
|
120
123
|
toolResultResponse: () => import_IMCPServer.toolResultResponse,
|
|
121
124
|
validateNoPathTraversal: () => import_SandboxErrors.validateNoPathTraversal,
|
|
@@ -151,6 +154,7 @@ var import_errors = require("./errors.js");
|
|
|
151
154
|
var import_redisKeys = require("./redisKeys.js");
|
|
152
155
|
var import_errorLogFields = require("./util/errorLogFields.js");
|
|
153
156
|
var import_promiseUtils = require("./util/promiseUtils.js");
|
|
157
|
+
var import_ssrfGuard = require("./util/ssrfGuard.js");
|
|
154
158
|
var import_CodeModeDispatcher = require("./sandbox/codeMode/CodeModeDispatcher.js");
|
|
155
159
|
var import_types = require("./sandbox/codeMode/types.js");
|
|
156
160
|
var import_DaytonaProvider = require("./sandbox/provider/DaytonaProvider.js");
|
|
@@ -239,8 +243,10 @@ var import_skills = require("./sandbox/skills/index.js");
|
|
|
239
243
|
WebSearchProviders,
|
|
240
244
|
absolutizeRelativeExecEnv,
|
|
241
245
|
askUserQuestion,
|
|
246
|
+
assertSafeOutboundUrl,
|
|
242
247
|
buildWebSearchInstruction,
|
|
243
248
|
buildWriteAndRunScriptCommand,
|
|
249
|
+
configureOutboundUrlGuard,
|
|
244
250
|
contextCompaction,
|
|
245
251
|
currentDateTime,
|
|
246
252
|
defineTool,
|
|
@@ -263,6 +269,7 @@ var import_skills = require("./sandbox/skills/index.js");
|
|
|
263
269
|
redisKey,
|
|
264
270
|
renderSkillPromptBody,
|
|
265
271
|
shellEscape,
|
|
272
|
+
ssrfFetch,
|
|
266
273
|
toOpenAIResponseFormat,
|
|
267
274
|
toolResultResponse,
|
|
268
275
|
validateNoPathTraversal,
|
package/dist/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["/**\n * Public agent execution harness.\n * Intentional consumer-facing exports only (production API).\n */\n\n// Runtime\nexport type { AgentDefinition, ModelParams } from './runtime/AgentDefinition';\nexport { AgentThread } from './runtime/AgentThread';\nexport type {\n AgentInfo,\n AgentParent,\n AgentSendInput,\n AgentThreadAppendContext,\n AgentThreadCreateSubAgent,\n AgentThreadEvent,\n AgentThreadExecutionEvent,\n AgentThreadExecutionResult,\n SubAgentCompletionMarker,\n} from './runtime/AgentThread.types';\nexport { AgentThreadOrchestrator } from './runtime/AgentThreadOrchestrator';\nexport type { CreateDynamicSubAgentThread } from './runtime/CreateDynamicSubAgentThread';\nexport { isAgentInputUserMessage, isEmptyMessageContent, isFileContentPart } from './runtime/UserInputMessage';\nexport type { AgentInputUserMessage } from './runtime/UserInputMessage';\n\n// Capability contracts\nexport type { AgentCapability, CapabilityState, JsonValue } from './capabilities/AgentCapability';\nexport type {\n AgentContextProcessorOutput,\n AgentThreadExecutionContext,\n PostToolCallAgentContextProcessor,\n PreLLMEphemeralAgentContextProcessor,\n} from './capabilities/AgentContextProcessor';\n\n// Built-in factories\nexport { askUserQuestion } from './capabilities/builtins/AskUserQuestion';\nexport {\n DEFAULT_CONTEXT_COMPACTION_THRESHOLD_TOKENS,\n contextCompaction,\n} from './capabilities/builtins/ContextCompaction';\nexport { currentDateTime } from './capabilities/builtins/CurrentDateTime';\nexport { SUB_AGENT_IDENTITY, dynamicSubAgents } from './capabilities/builtins/DynamicSubAgents';\nexport {\n DEFAULT_INDIVIDUAL_TOOL_TOKEN_THRESHOLD,\n DEFAULT_PREVIEW_NUMBER_OF_CHARACTERS,\n DEFAULT_TOTAL_TOOL_TOKEN_THRESHOLD,\n largeToolResponse,\n} from './capabilities/builtins/LargeToolResponse';\nexport { openUI } from './capabilities/builtins/OpenUI';\nexport {\n WEB_FETCH_TOOL_NAME,\n WEB_SEARCH_REMINDER_TAG,\n WEB_SEARCH_SERVER_ID,\n WEB_SEARCH_TOOL_NAME,\n buildWebSearchInstruction,\n webSearch,\n} from './capabilities/builtins/WebSearch';\n\n// MCP contracts\nexport type { ApprovalDecision } from './events/schema';\nexport { ClientSideTool } from './mcp/ClientSideTool';\nexport { isAuthRequired, toolResultResponse } from './mcp/IMCPServer';\nexport type {\n AgentToolSchema,\n AuthRequiredResponse,\n CallToolResponse,\n IToolSet,\n ListToolsResponse,\n MCPAuthRequired,\n ToolSource,\n} from './mcp/IMCPServer';\nexport { LocalToolMCP, defineTool } from './mcp/LocalToolMCP';\nexport type { ToolDefinition } from './mcp/LocalToolMCP';\n\n// Remote MCP server, split into a shared, policy-free connection (`RemoteMCP`) and a per-agent policy\n// wrapper (`ToolSet`). `RemoteMCP` connects itself from a `url` + `headers`; the networking helpers\n// live in the harness-internal `remoteMcpClient` module.\nexport { RemoteMCP } from './mcp/RemoteMCP';\nexport type { RemoteMcpHeaders, ResolveHeadersResult } from './mcp/RemoteMCP';\nexport { DEFAULT_MAX_MCP_RESPONSE_BYTES } from './mcp/remoteMcpClient';\nexport type { RemoteMcpConnection, RemoteMcpTransportType } from './mcp/remoteMcpClient';\nexport type { ToolSelectorConfig } from './mcp/ToolSelectorPolicy';\nexport {\n DEFAULT_DISABLE_TOOLS,\n DEFAULT_ENABLE_TOOLS,\n DEFAULT_PRELOAD_TOOLS,\n DEFAULT_REQUIRE_APPROVAL_FOR_TOOLS,\n REQUIRE_APPROVAL_TOOLS_SELECTOR_TAGS,\n TOOLS_SELECTOR_TAGS,\n} from './mcp/toolSelectors';\nexport { ToolSet } from './mcp/ToolSet';\n\n// LLM contracts\nexport type { AgentMetadata, ILLM, LLMCreateParams, LLMCreateParamsStreaming } from './llm/ILLM';\nexport { ResponseFormatSchema, toOpenAIResponseFormat } from './llm/responseFormat';\nexport type { ResponseFormat } from './llm/responseFormat';\nexport { SUPPORTED_REASONING_EFFORTS, VERCEL_AI_PROVIDER_NAMES, VercelAILLM } from './llm/VercelAILLM';\nexport type { VercelAILLMConfig, VercelAIProviderConfig, VercelAIProviderName } from './llm/VercelAILLM';\n\n// Event contracts\nexport {\n ActionRequiredEventSchema,\n AgentInputUserMessageSchema,\n EventIdSchema,\n EventType,\n MCPAuthRequiredEventSchema,\n MCPInitializeEventSchema,\n ModelMessageDeltaEventSchema,\n ModelMessageEventSchema,\n SandboxCreatedEventSchema,\n ThreadCreatedEventSchema,\n ThreadDoneEventSchema,\n ThreadOverwriteContextEventSchema,\n ToolApprovalRequiredEventSchema,\n ToolResponseEventSchema,\n ToolResponseRequiredEventSchema,\n UserToolApprovalMessageSchema,\n UserToolResponseMessageSchema,\n newEventId,\n} from './events/schema';\nexport type {\n AgentOutputEvent,\n MCPAuthRequiredEvent,\n MCPServerAuthInfo,\n MCPServerInitInfo,\n ThreadDoneEvent,\n ThreadOverwriteContextEvent,\n} from './events/schema';\nexport { CompletionUsageSchema } from './llm/LLMTypes';\nexport type { CompletionUsage } from './llm/LLMTypes';\nexport { InternalEventType } from './runtime/AgentThread.types';\nexport type { AgentThreadSendBatch, ContextMessage } from './runtime/AgentThread.types';\nexport { AgentThreadMetricsSchema } from './runtime/metrics';\nexport type { AgentThreadMetrics } from './runtime/metrics';\n\n// Tracing\nexport type {\n AgentExecutionTrace,\n AgentLocalToolTrace,\n AgentRemoteMcpToolTrace,\n AgentTracing,\n} from './tracing/AgentTracing';\n\n// Errors / utils\nexport { AgentHarnessError, McpConnectionError, McpDcrConfigurationError } from './errors';\nexport { REDIS_KEY_NAMESPACE, redisKey } from './redisKeys';\nexport { describeUnknownError, extractErrorLogFields } from './util/errorLogFields';\nexport { PromiseTimeoutError, withTimeout } from './util/promiseUtils';\n\n// Sandbox (concrete implementation; provider details exported for composition)\nexport { CodeModeDispatcher } from './sandbox/codeMode/CodeModeDispatcher';\nexport type { CodeModeLogger } from './sandbox/codeMode/CodeModeDispatcher';\nexport type { CodeModeClientInstall, CodeModeTransport } from './sandbox/codeMode/CodeModeTransport';\nexport { CodeModeErrorSourceSchema, CodeModeReplySchema, CodeModeRequestSchema } from './sandbox/codeMode/types';\nexport type { CodeModeErrorSource, CodeModeReply, CodeModeRequest } from './sandbox/codeMode/types';\nexport { DaytonaSandboxProvider } from './sandbox/provider/DaytonaProvider';\nexport type { DaytonaSandboxProviderOptions } from './sandbox/provider/DaytonaProvider';\nexport { absolutizeRelativeExecEnv } from './sandbox/provider/execEnv';\nexport { ensureExecSuccess, shellEscape } from './sandbox/provider/Provider';\nexport type {\n ExecErrorResult,\n ExecResult,\n ExecSuccessResult,\n SandboxBuild,\n SandboxBuildMetadata,\n SandboxBuildStatus,\n SandboxExecParams,\n SandboxInit,\n SandboxProvider,\n} from './sandbox/provider/Provider';\nexport { TFYSandboxProvider } from './sandbox/provider/TFYSandboxProvider';\nexport { SKILL_DOWNLOAD_TIMEOUT_SECONDS, Sandbox, buildWriteAndRunScriptCommand } from './sandbox/Sandbox';\nexport type { SandboxInfo } from './sandbox/Sandbox';\nexport {\n SandboxError,\n SandboxFileNotFoundError,\n SandboxFileTooLargeError,\n SandboxNotAvailableError,\n SandboxPathIsDirectoryError,\n validateNoPathTraversal,\n validateSandboxOwnedByTenant,\n} from './sandbox/SandboxErrors';\nexport { SANDBOX_IMAGE_URI } from './sandbox/sandboxImage';\nexport { existingSandboxIdForProvider, formatSandboxId, parseSandboxId, rawSandboxId } from './sandbox/sandboxRef';\nexport type { SandboxRefParts } from './sandbox/sandboxRef';\n\n// Web search\nexport { ParallelWebSearchProvider } from './web-search/ParallelWebSearchProvider';\nexport type { ParallelSearchMode, ParallelWebSearchProviderOptions } from './web-search/ParallelWebSearchProvider';\nexport { WebSearchProviders } from './web-search/WebSearchProvider';\nexport type {\n IWebSearchProvider,\n WebFetchPage,\n WebFetchPages,\n WebSearchHit,\n WebSearchHits,\n} from './web-search/WebSearchProvider';\n\n// Skills: the ISkillMounter seam lets hosts plug in their own skill sources\nexport { InstructionBuilder } from './InstructionBuilder';\nexport { SKILLS_PREAMBLE, SkillMounter, getSkillPath, renderSkillPromptBody } from './sandbox/skills';\nexport type { GitSkill, ISkillMounter, Skill } from './sandbox/skills';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,yBAA4B;AAY5B,qCAAwC;AAExC,8BAAkF;AAalF,6BAAgC;AAChC,+BAGO;AACP,6BAAgC;AAChC,8BAAqD;AACrD,+BAKO;AACP,oBAAuB;AACvB,uBAOO;AAIP,4BAA+B;AAC/B,wBAAmD;AAUnD,0BAAyC;AAMzC,uBAA0B;AAE1B,6BAA+C;AAG/C,2BAOO;AACP,qBAAwB;AAIxB,4BAA6D;AAE7D,yBAAmF;AAInF,oBAmBO;AASP,sBAAsC;AAEtC,IAAAA,sBAAkC;AAElC,qBAAyC;AAYzC,oBAAgF;AAChF,uBAA8C;AAC9C,4BAA4D;AAC5D,0BAAiD;
|
|
1
|
+
{"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["/**\n * Public agent execution harness.\n * Intentional consumer-facing exports only (production API).\n */\n\n// Runtime\nexport type { AgentDefinition, ModelParams } from './runtime/AgentDefinition';\nexport { AgentThread } from './runtime/AgentThread';\nexport type {\n AgentInfo,\n AgentParent,\n AgentSendInput,\n AgentThreadAppendContext,\n AgentThreadCreateSubAgent,\n AgentThreadEvent,\n AgentThreadExecutionEvent,\n AgentThreadExecutionResult,\n SubAgentCompletionMarker,\n} from './runtime/AgentThread.types';\nexport { AgentThreadOrchestrator } from './runtime/AgentThreadOrchestrator';\nexport type { CreateDynamicSubAgentThread } from './runtime/CreateDynamicSubAgentThread';\nexport { isAgentInputUserMessage, isEmptyMessageContent, isFileContentPart } from './runtime/UserInputMessage';\nexport type { AgentInputUserMessage } from './runtime/UserInputMessage';\n\n// Capability contracts\nexport type { AgentCapability, CapabilityState, JsonValue } from './capabilities/AgentCapability';\nexport type {\n AgentContextProcessorOutput,\n AgentThreadExecutionContext,\n PostToolCallAgentContextProcessor,\n PreLLMEphemeralAgentContextProcessor,\n} from './capabilities/AgentContextProcessor';\n\n// Built-in factories\nexport { askUserQuestion } from './capabilities/builtins/AskUserQuestion';\nexport {\n DEFAULT_CONTEXT_COMPACTION_THRESHOLD_TOKENS,\n contextCompaction,\n} from './capabilities/builtins/ContextCompaction';\nexport { currentDateTime } from './capabilities/builtins/CurrentDateTime';\nexport { SUB_AGENT_IDENTITY, dynamicSubAgents } from './capabilities/builtins/DynamicSubAgents';\nexport {\n DEFAULT_INDIVIDUAL_TOOL_TOKEN_THRESHOLD,\n DEFAULT_PREVIEW_NUMBER_OF_CHARACTERS,\n DEFAULT_TOTAL_TOOL_TOKEN_THRESHOLD,\n largeToolResponse,\n} from './capabilities/builtins/LargeToolResponse';\nexport { openUI } from './capabilities/builtins/OpenUI';\nexport {\n WEB_FETCH_TOOL_NAME,\n WEB_SEARCH_REMINDER_TAG,\n WEB_SEARCH_SERVER_ID,\n WEB_SEARCH_TOOL_NAME,\n buildWebSearchInstruction,\n webSearch,\n} from './capabilities/builtins/WebSearch';\n\n// MCP contracts\nexport type { ApprovalDecision } from './events/schema';\nexport { ClientSideTool } from './mcp/ClientSideTool';\nexport { isAuthRequired, toolResultResponse } from './mcp/IMCPServer';\nexport type {\n AgentToolSchema,\n AuthRequiredResponse,\n CallToolResponse,\n IToolSet,\n ListToolsResponse,\n MCPAuthRequired,\n ToolSource,\n} from './mcp/IMCPServer';\nexport { LocalToolMCP, defineTool } from './mcp/LocalToolMCP';\nexport type { ToolDefinition } from './mcp/LocalToolMCP';\n\n// Remote MCP server, split into a shared, policy-free connection (`RemoteMCP`) and a per-agent policy\n// wrapper (`ToolSet`). `RemoteMCP` connects itself from a `url` + `headers`; the networking helpers\n// live in the harness-internal `remoteMcpClient` module.\nexport { RemoteMCP } from './mcp/RemoteMCP';\nexport type { RemoteMcpHeaders, ResolveHeadersResult } from './mcp/RemoteMCP';\nexport { DEFAULT_MAX_MCP_RESPONSE_BYTES } from './mcp/remoteMcpClient';\nexport type { RemoteMcpConnection, RemoteMcpTransportType } from './mcp/remoteMcpClient';\nexport type { ToolSelectorConfig } from './mcp/ToolSelectorPolicy';\nexport {\n DEFAULT_DISABLE_TOOLS,\n DEFAULT_ENABLE_TOOLS,\n DEFAULT_PRELOAD_TOOLS,\n DEFAULT_REQUIRE_APPROVAL_FOR_TOOLS,\n REQUIRE_APPROVAL_TOOLS_SELECTOR_TAGS,\n TOOLS_SELECTOR_TAGS,\n} from './mcp/toolSelectors';\nexport { ToolSet } from './mcp/ToolSet';\n\n// LLM contracts\nexport type { AgentMetadata, ILLM, LLMCreateParams, LLMCreateParamsStreaming } from './llm/ILLM';\nexport { ResponseFormatSchema, toOpenAIResponseFormat } from './llm/responseFormat';\nexport type { ResponseFormat } from './llm/responseFormat';\nexport { SUPPORTED_REASONING_EFFORTS, VERCEL_AI_PROVIDER_NAMES, VercelAILLM } from './llm/VercelAILLM';\nexport type { VercelAILLMConfig, VercelAIProviderConfig, VercelAIProviderName } from './llm/VercelAILLM';\n\n// Event contracts\nexport {\n ActionRequiredEventSchema,\n AgentInputUserMessageSchema,\n EventIdSchema,\n EventType,\n MCPAuthRequiredEventSchema,\n MCPInitializeEventSchema,\n ModelMessageDeltaEventSchema,\n ModelMessageEventSchema,\n SandboxCreatedEventSchema,\n ThreadCreatedEventSchema,\n ThreadDoneEventSchema,\n ThreadOverwriteContextEventSchema,\n ToolApprovalRequiredEventSchema,\n ToolResponseEventSchema,\n ToolResponseRequiredEventSchema,\n UserToolApprovalMessageSchema,\n UserToolResponseMessageSchema,\n newEventId,\n} from './events/schema';\nexport type {\n AgentOutputEvent,\n MCPAuthRequiredEvent,\n MCPServerAuthInfo,\n MCPServerInitInfo,\n ThreadDoneEvent,\n ThreadOverwriteContextEvent,\n} from './events/schema';\nexport { CompletionUsageSchema } from './llm/LLMTypes';\nexport type { CompletionUsage } from './llm/LLMTypes';\nexport { InternalEventType } from './runtime/AgentThread.types';\nexport type { AgentThreadSendBatch, ContextMessage } from './runtime/AgentThread.types';\nexport { AgentThreadMetricsSchema } from './runtime/metrics';\nexport type { AgentThreadMetrics } from './runtime/metrics';\n\n// Tracing\nexport type {\n AgentExecutionTrace,\n AgentLocalToolTrace,\n AgentRemoteMcpToolTrace,\n AgentTracing,\n} from './tracing/AgentTracing';\n\n// Errors / utils\nexport { AgentHarnessError, McpConnectionError, McpDcrConfigurationError } from './errors';\nexport { REDIS_KEY_NAMESPACE, redisKey } from './redisKeys';\nexport { describeUnknownError, extractErrorLogFields } from './util/errorLogFields';\nexport { PromiseTimeoutError, withTimeout } from './util/promiseUtils';\nexport { assertSafeOutboundUrl, configureOutboundUrlGuard, ssrfFetch } from './util/ssrfGuard';\n\n// Sandbox (concrete implementation; provider details exported for composition)\nexport { CodeModeDispatcher } from './sandbox/codeMode/CodeModeDispatcher';\nexport type { CodeModeLogger } from './sandbox/codeMode/CodeModeDispatcher';\nexport type { CodeModeClientInstall, CodeModeTransport } from './sandbox/codeMode/CodeModeTransport';\nexport { CodeModeErrorSourceSchema, CodeModeReplySchema, CodeModeRequestSchema } from './sandbox/codeMode/types';\nexport type { CodeModeErrorSource, CodeModeReply, CodeModeRequest } from './sandbox/codeMode/types';\nexport { DaytonaSandboxProvider } from './sandbox/provider/DaytonaProvider';\nexport type { DaytonaSandboxProviderOptions } from './sandbox/provider/DaytonaProvider';\nexport { absolutizeRelativeExecEnv } from './sandbox/provider/execEnv';\nexport { ensureExecSuccess, shellEscape } from './sandbox/provider/Provider';\nexport type {\n ExecErrorResult,\n ExecResult,\n ExecSuccessResult,\n SandboxBuild,\n SandboxBuildMetadata,\n SandboxBuildStatus,\n SandboxExecParams,\n SandboxInit,\n SandboxProvider,\n} from './sandbox/provider/Provider';\nexport { TFYSandboxProvider } from './sandbox/provider/TFYSandboxProvider';\nexport { SKILL_DOWNLOAD_TIMEOUT_SECONDS, Sandbox, buildWriteAndRunScriptCommand } from './sandbox/Sandbox';\nexport type { SandboxInfo } from './sandbox/Sandbox';\nexport {\n SandboxError,\n SandboxFileNotFoundError,\n SandboxFileTooLargeError,\n SandboxNotAvailableError,\n SandboxPathIsDirectoryError,\n validateNoPathTraversal,\n validateSandboxOwnedByTenant,\n} from './sandbox/SandboxErrors';\nexport { SANDBOX_IMAGE_URI } from './sandbox/sandboxImage';\nexport { existingSandboxIdForProvider, formatSandboxId, parseSandboxId, rawSandboxId } from './sandbox/sandboxRef';\nexport type { SandboxRefParts } from './sandbox/sandboxRef';\n\n// Web search\nexport { ParallelWebSearchProvider } from './web-search/ParallelWebSearchProvider';\nexport type { ParallelSearchMode, ParallelWebSearchProviderOptions } from './web-search/ParallelWebSearchProvider';\nexport { WebSearchProviders } from './web-search/WebSearchProvider';\nexport type {\n IWebSearchProvider,\n WebFetchPage,\n WebFetchPages,\n WebSearchHit,\n WebSearchHits,\n} from './web-search/WebSearchProvider';\n\n// Skills: the ISkillMounter seam lets hosts plug in their own skill sources\nexport { InstructionBuilder } from './InstructionBuilder';\nexport { SKILLS_PREAMBLE, SkillMounter, getSkillPath, renderSkillPromptBody } from './sandbox/skills';\nexport type { GitSkill, ISkillMounter, Skill } from './sandbox/skills';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,yBAA4B;AAY5B,qCAAwC;AAExC,8BAAkF;AAalF,6BAAgC;AAChC,+BAGO;AACP,6BAAgC;AAChC,8BAAqD;AACrD,+BAKO;AACP,oBAAuB;AACvB,uBAOO;AAIP,4BAA+B;AAC/B,wBAAmD;AAUnD,0BAAyC;AAMzC,uBAA0B;AAE1B,6BAA+C;AAG/C,2BAOO;AACP,qBAAwB;AAIxB,4BAA6D;AAE7D,yBAAmF;AAInF,oBAmBO;AASP,sBAAsC;AAEtC,IAAAA,sBAAkC;AAElC,qBAAyC;AAYzC,oBAAgF;AAChF,uBAA8C;AAC9C,4BAA4D;AAC5D,0BAAiD;AACjD,uBAA4E;AAG5E,gCAAmC;AAGnC,mBAAsF;AAEtF,6BAAuC;AAEvC,qBAA0C;AAC1C,sBAA+C;AAY/C,gCAAmC;AACnC,qBAAuF;AAEvF,2BAQO;AACP,0BAAkC;AAClC,wBAA4F;AAI5F,uCAA0C;AAE1C,+BAAmC;AAUnC,gCAAmC;AACnC,oBAAmF;","names":["import_AgentThread"]}
|
package/dist/core/index.mjs
CHANGED
|
@@ -67,6 +67,7 @@ import { AgentHarnessError, McpConnectionError, McpDcrConfigurationError } from
|
|
|
67
67
|
import { REDIS_KEY_NAMESPACE, redisKey } from "./redisKeys.mjs";
|
|
68
68
|
import { describeUnknownError, extractErrorLogFields } from "./util/errorLogFields.mjs";
|
|
69
69
|
import { PromiseTimeoutError, withTimeout } from "./util/promiseUtils.mjs";
|
|
70
|
+
import { assertSafeOutboundUrl, configureOutboundUrlGuard, ssrfFetch } from "./util/ssrfGuard.mjs";
|
|
70
71
|
import { CodeModeDispatcher } from "./sandbox/codeMode/CodeModeDispatcher.mjs";
|
|
71
72
|
import { CodeModeErrorSourceSchema, CodeModeReplySchema, CodeModeRequestSchema } from "./sandbox/codeMode/types.mjs";
|
|
72
73
|
import { DaytonaSandboxProvider } from "./sandbox/provider/DaytonaProvider.mjs";
|
|
@@ -162,8 +163,10 @@ export {
|
|
|
162
163
|
WebSearchProviders,
|
|
163
164
|
absolutizeRelativeExecEnv,
|
|
164
165
|
askUserQuestion,
|
|
166
|
+
assertSafeOutboundUrl,
|
|
165
167
|
buildWebSearchInstruction,
|
|
166
168
|
buildWriteAndRunScriptCommand,
|
|
169
|
+
configureOutboundUrlGuard,
|
|
167
170
|
contextCompaction,
|
|
168
171
|
currentDateTime,
|
|
169
172
|
defineTool,
|
|
@@ -186,6 +189,7 @@ export {
|
|
|
186
189
|
redisKey,
|
|
187
190
|
renderSkillPromptBody,
|
|
188
191
|
shellEscape,
|
|
192
|
+
ssrfFetch,
|
|
189
193
|
toOpenAIResponseFormat,
|
|
190
194
|
toolResultResponse,
|
|
191
195
|
validateNoPathTraversal,
|
package/dist/core/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["/**\n * Public agent execution harness.\n * Intentional consumer-facing exports only (production API).\n */\n\n// Runtime\nexport type { AgentDefinition, ModelParams } from './runtime/AgentDefinition';\nexport { AgentThread } from './runtime/AgentThread';\nexport type {\n AgentInfo,\n AgentParent,\n AgentSendInput,\n AgentThreadAppendContext,\n AgentThreadCreateSubAgent,\n AgentThreadEvent,\n AgentThreadExecutionEvent,\n AgentThreadExecutionResult,\n SubAgentCompletionMarker,\n} from './runtime/AgentThread.types';\nexport { AgentThreadOrchestrator } from './runtime/AgentThreadOrchestrator';\nexport type { CreateDynamicSubAgentThread } from './runtime/CreateDynamicSubAgentThread';\nexport { isAgentInputUserMessage, isEmptyMessageContent, isFileContentPart } from './runtime/UserInputMessage';\nexport type { AgentInputUserMessage } from './runtime/UserInputMessage';\n\n// Capability contracts\nexport type { AgentCapability, CapabilityState, JsonValue } from './capabilities/AgentCapability';\nexport type {\n AgentContextProcessorOutput,\n AgentThreadExecutionContext,\n PostToolCallAgentContextProcessor,\n PreLLMEphemeralAgentContextProcessor,\n} from './capabilities/AgentContextProcessor';\n\n// Built-in factories\nexport { askUserQuestion } from './capabilities/builtins/AskUserQuestion';\nexport {\n DEFAULT_CONTEXT_COMPACTION_THRESHOLD_TOKENS,\n contextCompaction,\n} from './capabilities/builtins/ContextCompaction';\nexport { currentDateTime } from './capabilities/builtins/CurrentDateTime';\nexport { SUB_AGENT_IDENTITY, dynamicSubAgents } from './capabilities/builtins/DynamicSubAgents';\nexport {\n DEFAULT_INDIVIDUAL_TOOL_TOKEN_THRESHOLD,\n DEFAULT_PREVIEW_NUMBER_OF_CHARACTERS,\n DEFAULT_TOTAL_TOOL_TOKEN_THRESHOLD,\n largeToolResponse,\n} from './capabilities/builtins/LargeToolResponse';\nexport { openUI } from './capabilities/builtins/OpenUI';\nexport {\n WEB_FETCH_TOOL_NAME,\n WEB_SEARCH_REMINDER_TAG,\n WEB_SEARCH_SERVER_ID,\n WEB_SEARCH_TOOL_NAME,\n buildWebSearchInstruction,\n webSearch,\n} from './capabilities/builtins/WebSearch';\n\n// MCP contracts\nexport type { ApprovalDecision } from './events/schema';\nexport { ClientSideTool } from './mcp/ClientSideTool';\nexport { isAuthRequired, toolResultResponse } from './mcp/IMCPServer';\nexport type {\n AgentToolSchema,\n AuthRequiredResponse,\n CallToolResponse,\n IToolSet,\n ListToolsResponse,\n MCPAuthRequired,\n ToolSource,\n} from './mcp/IMCPServer';\nexport { LocalToolMCP, defineTool } from './mcp/LocalToolMCP';\nexport type { ToolDefinition } from './mcp/LocalToolMCP';\n\n// Remote MCP server, split into a shared, policy-free connection (`RemoteMCP`) and a per-agent policy\n// wrapper (`ToolSet`). `RemoteMCP` connects itself from a `url` + `headers`; the networking helpers\n// live in the harness-internal `remoteMcpClient` module.\nexport { RemoteMCP } from './mcp/RemoteMCP';\nexport type { RemoteMcpHeaders, ResolveHeadersResult } from './mcp/RemoteMCP';\nexport { DEFAULT_MAX_MCP_RESPONSE_BYTES } from './mcp/remoteMcpClient';\nexport type { RemoteMcpConnection, RemoteMcpTransportType } from './mcp/remoteMcpClient';\nexport type { ToolSelectorConfig } from './mcp/ToolSelectorPolicy';\nexport {\n DEFAULT_DISABLE_TOOLS,\n DEFAULT_ENABLE_TOOLS,\n DEFAULT_PRELOAD_TOOLS,\n DEFAULT_REQUIRE_APPROVAL_FOR_TOOLS,\n REQUIRE_APPROVAL_TOOLS_SELECTOR_TAGS,\n TOOLS_SELECTOR_TAGS,\n} from './mcp/toolSelectors';\nexport { ToolSet } from './mcp/ToolSet';\n\n// LLM contracts\nexport type { AgentMetadata, ILLM, LLMCreateParams, LLMCreateParamsStreaming } from './llm/ILLM';\nexport { ResponseFormatSchema, toOpenAIResponseFormat } from './llm/responseFormat';\nexport type { ResponseFormat } from './llm/responseFormat';\nexport { SUPPORTED_REASONING_EFFORTS, VERCEL_AI_PROVIDER_NAMES, VercelAILLM } from './llm/VercelAILLM';\nexport type { VercelAILLMConfig, VercelAIProviderConfig, VercelAIProviderName } from './llm/VercelAILLM';\n\n// Event contracts\nexport {\n ActionRequiredEventSchema,\n AgentInputUserMessageSchema,\n EventIdSchema,\n EventType,\n MCPAuthRequiredEventSchema,\n MCPInitializeEventSchema,\n ModelMessageDeltaEventSchema,\n ModelMessageEventSchema,\n SandboxCreatedEventSchema,\n ThreadCreatedEventSchema,\n ThreadDoneEventSchema,\n ThreadOverwriteContextEventSchema,\n ToolApprovalRequiredEventSchema,\n ToolResponseEventSchema,\n ToolResponseRequiredEventSchema,\n UserToolApprovalMessageSchema,\n UserToolResponseMessageSchema,\n newEventId,\n} from './events/schema';\nexport type {\n AgentOutputEvent,\n MCPAuthRequiredEvent,\n MCPServerAuthInfo,\n MCPServerInitInfo,\n ThreadDoneEvent,\n ThreadOverwriteContextEvent,\n} from './events/schema';\nexport { CompletionUsageSchema } from './llm/LLMTypes';\nexport type { CompletionUsage } from './llm/LLMTypes';\nexport { InternalEventType } from './runtime/AgentThread.types';\nexport type { AgentThreadSendBatch, ContextMessage } from './runtime/AgentThread.types';\nexport { AgentThreadMetricsSchema } from './runtime/metrics';\nexport type { AgentThreadMetrics } from './runtime/metrics';\n\n// Tracing\nexport type {\n AgentExecutionTrace,\n AgentLocalToolTrace,\n AgentRemoteMcpToolTrace,\n AgentTracing,\n} from './tracing/AgentTracing';\n\n// Errors / utils\nexport { AgentHarnessError, McpConnectionError, McpDcrConfigurationError } from './errors';\nexport { REDIS_KEY_NAMESPACE, redisKey } from './redisKeys';\nexport { describeUnknownError, extractErrorLogFields } from './util/errorLogFields';\nexport { PromiseTimeoutError, withTimeout } from './util/promiseUtils';\n\n// Sandbox (concrete implementation; provider details exported for composition)\nexport { CodeModeDispatcher } from './sandbox/codeMode/CodeModeDispatcher';\nexport type { CodeModeLogger } from './sandbox/codeMode/CodeModeDispatcher';\nexport type { CodeModeClientInstall, CodeModeTransport } from './sandbox/codeMode/CodeModeTransport';\nexport { CodeModeErrorSourceSchema, CodeModeReplySchema, CodeModeRequestSchema } from './sandbox/codeMode/types';\nexport type { CodeModeErrorSource, CodeModeReply, CodeModeRequest } from './sandbox/codeMode/types';\nexport { DaytonaSandboxProvider } from './sandbox/provider/DaytonaProvider';\nexport type { DaytonaSandboxProviderOptions } from './sandbox/provider/DaytonaProvider';\nexport { absolutizeRelativeExecEnv } from './sandbox/provider/execEnv';\nexport { ensureExecSuccess, shellEscape } from './sandbox/provider/Provider';\nexport type {\n ExecErrorResult,\n ExecResult,\n ExecSuccessResult,\n SandboxBuild,\n SandboxBuildMetadata,\n SandboxBuildStatus,\n SandboxExecParams,\n SandboxInit,\n SandboxProvider,\n} from './sandbox/provider/Provider';\nexport { TFYSandboxProvider } from './sandbox/provider/TFYSandboxProvider';\nexport { SKILL_DOWNLOAD_TIMEOUT_SECONDS, Sandbox, buildWriteAndRunScriptCommand } from './sandbox/Sandbox';\nexport type { SandboxInfo } from './sandbox/Sandbox';\nexport {\n SandboxError,\n SandboxFileNotFoundError,\n SandboxFileTooLargeError,\n SandboxNotAvailableError,\n SandboxPathIsDirectoryError,\n validateNoPathTraversal,\n validateSandboxOwnedByTenant,\n} from './sandbox/SandboxErrors';\nexport { SANDBOX_IMAGE_URI } from './sandbox/sandboxImage';\nexport { existingSandboxIdForProvider, formatSandboxId, parseSandboxId, rawSandboxId } from './sandbox/sandboxRef';\nexport type { SandboxRefParts } from './sandbox/sandboxRef';\n\n// Web search\nexport { ParallelWebSearchProvider } from './web-search/ParallelWebSearchProvider';\nexport type { ParallelSearchMode, ParallelWebSearchProviderOptions } from './web-search/ParallelWebSearchProvider';\nexport { WebSearchProviders } from './web-search/WebSearchProvider';\nexport type {\n IWebSearchProvider,\n WebFetchPage,\n WebFetchPages,\n WebSearchHit,\n WebSearchHits,\n} from './web-search/WebSearchProvider';\n\n// Skills: the ISkillMounter seam lets hosts plug in their own skill sources\nexport { InstructionBuilder } from './InstructionBuilder';\nexport { SKILLS_PREAMBLE, SkillMounter, getSkillPath, renderSkillPromptBody } from './sandbox/skills';\nexport type { GitSkill, ISkillMounter, Skill } from './sandbox/skills';\n"],"mappings":";AAOA,SAAS,mBAAmB;AAY5B,SAAS,+BAA+B;AAExC,SAAS,yBAAyB,uBAAuB,yBAAyB;AAalF,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAChC,SAAS,oBAAoB,wBAAwB;AACrD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB,0BAA0B;AAUnD,SAAS,cAAc,kBAAkB;AAMzC,SAAS,iBAAiB;AAE1B,SAAS,sCAAsC;AAG/C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe;AAIxB,SAAS,sBAAsB,8BAA8B;AAE7D,SAAS,6BAA6B,0BAA0B,mBAAmB;AAInF;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AASP,SAAS,6BAA6B;AAEtC,SAAS,yBAAyB;AAElC,SAAS,gCAAgC;AAYzC,SAAS,mBAAmB,oBAAoB,gCAAgC;AAChF,SAAS,qBAAqB,gBAAgB;AAC9C,SAAS,sBAAsB,6BAA6B;AAC5D,SAAS,qBAAqB,mBAAmB;
|
|
1
|
+
{"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["/**\n * Public agent execution harness.\n * Intentional consumer-facing exports only (production API).\n */\n\n// Runtime\nexport type { AgentDefinition, ModelParams } from './runtime/AgentDefinition';\nexport { AgentThread } from './runtime/AgentThread';\nexport type {\n AgentInfo,\n AgentParent,\n AgentSendInput,\n AgentThreadAppendContext,\n AgentThreadCreateSubAgent,\n AgentThreadEvent,\n AgentThreadExecutionEvent,\n AgentThreadExecutionResult,\n SubAgentCompletionMarker,\n} from './runtime/AgentThread.types';\nexport { AgentThreadOrchestrator } from './runtime/AgentThreadOrchestrator';\nexport type { CreateDynamicSubAgentThread } from './runtime/CreateDynamicSubAgentThread';\nexport { isAgentInputUserMessage, isEmptyMessageContent, isFileContentPart } from './runtime/UserInputMessage';\nexport type { AgentInputUserMessage } from './runtime/UserInputMessage';\n\n// Capability contracts\nexport type { AgentCapability, CapabilityState, JsonValue } from './capabilities/AgentCapability';\nexport type {\n AgentContextProcessorOutput,\n AgentThreadExecutionContext,\n PostToolCallAgentContextProcessor,\n PreLLMEphemeralAgentContextProcessor,\n} from './capabilities/AgentContextProcessor';\n\n// Built-in factories\nexport { askUserQuestion } from './capabilities/builtins/AskUserQuestion';\nexport {\n DEFAULT_CONTEXT_COMPACTION_THRESHOLD_TOKENS,\n contextCompaction,\n} from './capabilities/builtins/ContextCompaction';\nexport { currentDateTime } from './capabilities/builtins/CurrentDateTime';\nexport { SUB_AGENT_IDENTITY, dynamicSubAgents } from './capabilities/builtins/DynamicSubAgents';\nexport {\n DEFAULT_INDIVIDUAL_TOOL_TOKEN_THRESHOLD,\n DEFAULT_PREVIEW_NUMBER_OF_CHARACTERS,\n DEFAULT_TOTAL_TOOL_TOKEN_THRESHOLD,\n largeToolResponse,\n} from './capabilities/builtins/LargeToolResponse';\nexport { openUI } from './capabilities/builtins/OpenUI';\nexport {\n WEB_FETCH_TOOL_NAME,\n WEB_SEARCH_REMINDER_TAG,\n WEB_SEARCH_SERVER_ID,\n WEB_SEARCH_TOOL_NAME,\n buildWebSearchInstruction,\n webSearch,\n} from './capabilities/builtins/WebSearch';\n\n// MCP contracts\nexport type { ApprovalDecision } from './events/schema';\nexport { ClientSideTool } from './mcp/ClientSideTool';\nexport { isAuthRequired, toolResultResponse } from './mcp/IMCPServer';\nexport type {\n AgentToolSchema,\n AuthRequiredResponse,\n CallToolResponse,\n IToolSet,\n ListToolsResponse,\n MCPAuthRequired,\n ToolSource,\n} from './mcp/IMCPServer';\nexport { LocalToolMCP, defineTool } from './mcp/LocalToolMCP';\nexport type { ToolDefinition } from './mcp/LocalToolMCP';\n\n// Remote MCP server, split into a shared, policy-free connection (`RemoteMCP`) and a per-agent policy\n// wrapper (`ToolSet`). `RemoteMCP` connects itself from a `url` + `headers`; the networking helpers\n// live in the harness-internal `remoteMcpClient` module.\nexport { RemoteMCP } from './mcp/RemoteMCP';\nexport type { RemoteMcpHeaders, ResolveHeadersResult } from './mcp/RemoteMCP';\nexport { DEFAULT_MAX_MCP_RESPONSE_BYTES } from './mcp/remoteMcpClient';\nexport type { RemoteMcpConnection, RemoteMcpTransportType } from './mcp/remoteMcpClient';\nexport type { ToolSelectorConfig } from './mcp/ToolSelectorPolicy';\nexport {\n DEFAULT_DISABLE_TOOLS,\n DEFAULT_ENABLE_TOOLS,\n DEFAULT_PRELOAD_TOOLS,\n DEFAULT_REQUIRE_APPROVAL_FOR_TOOLS,\n REQUIRE_APPROVAL_TOOLS_SELECTOR_TAGS,\n TOOLS_SELECTOR_TAGS,\n} from './mcp/toolSelectors';\nexport { ToolSet } from './mcp/ToolSet';\n\n// LLM contracts\nexport type { AgentMetadata, ILLM, LLMCreateParams, LLMCreateParamsStreaming } from './llm/ILLM';\nexport { ResponseFormatSchema, toOpenAIResponseFormat } from './llm/responseFormat';\nexport type { ResponseFormat } from './llm/responseFormat';\nexport { SUPPORTED_REASONING_EFFORTS, VERCEL_AI_PROVIDER_NAMES, VercelAILLM } from './llm/VercelAILLM';\nexport type { VercelAILLMConfig, VercelAIProviderConfig, VercelAIProviderName } from './llm/VercelAILLM';\n\n// Event contracts\nexport {\n ActionRequiredEventSchema,\n AgentInputUserMessageSchema,\n EventIdSchema,\n EventType,\n MCPAuthRequiredEventSchema,\n MCPInitializeEventSchema,\n ModelMessageDeltaEventSchema,\n ModelMessageEventSchema,\n SandboxCreatedEventSchema,\n ThreadCreatedEventSchema,\n ThreadDoneEventSchema,\n ThreadOverwriteContextEventSchema,\n ToolApprovalRequiredEventSchema,\n ToolResponseEventSchema,\n ToolResponseRequiredEventSchema,\n UserToolApprovalMessageSchema,\n UserToolResponseMessageSchema,\n newEventId,\n} from './events/schema';\nexport type {\n AgentOutputEvent,\n MCPAuthRequiredEvent,\n MCPServerAuthInfo,\n MCPServerInitInfo,\n ThreadDoneEvent,\n ThreadOverwriteContextEvent,\n} from './events/schema';\nexport { CompletionUsageSchema } from './llm/LLMTypes';\nexport type { CompletionUsage } from './llm/LLMTypes';\nexport { InternalEventType } from './runtime/AgentThread.types';\nexport type { AgentThreadSendBatch, ContextMessage } from './runtime/AgentThread.types';\nexport { AgentThreadMetricsSchema } from './runtime/metrics';\nexport type { AgentThreadMetrics } from './runtime/metrics';\n\n// Tracing\nexport type {\n AgentExecutionTrace,\n AgentLocalToolTrace,\n AgentRemoteMcpToolTrace,\n AgentTracing,\n} from './tracing/AgentTracing';\n\n// Errors / utils\nexport { AgentHarnessError, McpConnectionError, McpDcrConfigurationError } from './errors';\nexport { REDIS_KEY_NAMESPACE, redisKey } from './redisKeys';\nexport { describeUnknownError, extractErrorLogFields } from './util/errorLogFields';\nexport { PromiseTimeoutError, withTimeout } from './util/promiseUtils';\nexport { assertSafeOutboundUrl, configureOutboundUrlGuard, ssrfFetch } from './util/ssrfGuard';\n\n// Sandbox (concrete implementation; provider details exported for composition)\nexport { CodeModeDispatcher } from './sandbox/codeMode/CodeModeDispatcher';\nexport type { CodeModeLogger } from './sandbox/codeMode/CodeModeDispatcher';\nexport type { CodeModeClientInstall, CodeModeTransport } from './sandbox/codeMode/CodeModeTransport';\nexport { CodeModeErrorSourceSchema, CodeModeReplySchema, CodeModeRequestSchema } from './sandbox/codeMode/types';\nexport type { CodeModeErrorSource, CodeModeReply, CodeModeRequest } from './sandbox/codeMode/types';\nexport { DaytonaSandboxProvider } from './sandbox/provider/DaytonaProvider';\nexport type { DaytonaSandboxProviderOptions } from './sandbox/provider/DaytonaProvider';\nexport { absolutizeRelativeExecEnv } from './sandbox/provider/execEnv';\nexport { ensureExecSuccess, shellEscape } from './sandbox/provider/Provider';\nexport type {\n ExecErrorResult,\n ExecResult,\n ExecSuccessResult,\n SandboxBuild,\n SandboxBuildMetadata,\n SandboxBuildStatus,\n SandboxExecParams,\n SandboxInit,\n SandboxProvider,\n} from './sandbox/provider/Provider';\nexport { TFYSandboxProvider } from './sandbox/provider/TFYSandboxProvider';\nexport { SKILL_DOWNLOAD_TIMEOUT_SECONDS, Sandbox, buildWriteAndRunScriptCommand } from './sandbox/Sandbox';\nexport type { SandboxInfo } from './sandbox/Sandbox';\nexport {\n SandboxError,\n SandboxFileNotFoundError,\n SandboxFileTooLargeError,\n SandboxNotAvailableError,\n SandboxPathIsDirectoryError,\n validateNoPathTraversal,\n validateSandboxOwnedByTenant,\n} from './sandbox/SandboxErrors';\nexport { SANDBOX_IMAGE_URI } from './sandbox/sandboxImage';\nexport { existingSandboxIdForProvider, formatSandboxId, parseSandboxId, rawSandboxId } from './sandbox/sandboxRef';\nexport type { SandboxRefParts } from './sandbox/sandboxRef';\n\n// Web search\nexport { ParallelWebSearchProvider } from './web-search/ParallelWebSearchProvider';\nexport type { ParallelSearchMode, ParallelWebSearchProviderOptions } from './web-search/ParallelWebSearchProvider';\nexport { WebSearchProviders } from './web-search/WebSearchProvider';\nexport type {\n IWebSearchProvider,\n WebFetchPage,\n WebFetchPages,\n WebSearchHit,\n WebSearchHits,\n} from './web-search/WebSearchProvider';\n\n// Skills: the ISkillMounter seam lets hosts plug in their own skill sources\nexport { InstructionBuilder } from './InstructionBuilder';\nexport { SKILLS_PREAMBLE, SkillMounter, getSkillPath, renderSkillPromptBody } from './sandbox/skills';\nexport type { GitSkill, ISkillMounter, Skill } from './sandbox/skills';\n"],"mappings":";AAOA,SAAS,mBAAmB;AAY5B,SAAS,+BAA+B;AAExC,SAAS,yBAAyB,uBAAuB,yBAAyB;AAalF,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAChC,SAAS,oBAAoB,wBAAwB;AACrD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB,0BAA0B;AAUnD,SAAS,cAAc,kBAAkB;AAMzC,SAAS,iBAAiB;AAE1B,SAAS,sCAAsC;AAG/C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe;AAIxB,SAAS,sBAAsB,8BAA8B;AAE7D,SAAS,6BAA6B,0BAA0B,mBAAmB;AAInF;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AASP,SAAS,6BAA6B;AAEtC,SAAS,yBAAyB;AAElC,SAAS,gCAAgC;AAYzC,SAAS,mBAAmB,oBAAoB,gCAAgC;AAChF,SAAS,qBAAqB,gBAAgB;AAC9C,SAAS,sBAAsB,6BAA6B;AAC5D,SAAS,qBAAqB,mBAAmB;AACjD,SAAS,uBAAuB,2BAA2B,iBAAiB;AAG5E,SAAS,0BAA0B;AAGnC,SAAS,2BAA2B,qBAAqB,6BAA6B;AAEtF,SAAS,8BAA8B;AAEvC,SAAS,iCAAiC;AAC1C,SAAS,mBAAmB,mBAAmB;AAY/C,SAAS,0BAA0B;AACnC,SAAS,gCAAgC,SAAS,qCAAqC;AAEvF;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,yBAAyB;AAClC,SAAS,8BAA8B,iBAAiB,gBAAgB,oBAAoB;AAI5F,SAAS,iCAAiC;AAE1C,SAAS,0BAA0B;AAUnC,SAAS,0BAA0B;AACnC,SAAS,iBAAiB,cAAc,cAAc,6BAA6B;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VercelAILLM.d.ts","sourceRoot":"","sources":["../../../src/core/llm/VercelAILLM.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAiB,MAAM,wBAAwB,CAAC;AAC7E,OAAO,KAAK,EAEV,WAAW,EACX,QAAQ,EACR,YAAY,EAEZ,aAAa,EACb,wBAAwB,EACxB,YAAY,EAGZ,cAAc,EAGd,OAAO,EACP,WAAW,EACZ,MAAM,IAAI,CAAC;AAEZ,OAAO,KAAK,EACV,yBAAyB,EACzB,mCAAmC,EACnC,0BAA0B,EAC1B,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"VercelAILLM.d.ts","sourceRoot":"","sources":["../../../src/core/llm/VercelAILLM.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAiB,MAAM,wBAAwB,CAAC;AAC7E,OAAO,KAAK,EAEV,WAAW,EACX,QAAQ,EACR,YAAY,EAEZ,aAAa,EACb,wBAAwB,EACxB,YAAY,EAGZ,cAAc,EAGd,OAAO,EAC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sFAAsF;AACtF,qBAAa,WAAY,YAAW,IAAI;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IAEjD,YAAY,MAAM,EAAE,iBAAiB,EAIpC;IAEM,MAAM,CACX,IAAI,EAAE,wBAAwB,GAC7B,cAAc,CAAC,2BAA2B,EAAE,4BAA4B,EAAE,OAAO,CAAC,CAoGpF;IAEK,eAAe,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAQlF;CACF"}
|
|
@@ -52,6 +52,7 @@ var import_openai = require("@ai-sdk/openai");
|
|
|
52
52
|
var import_openai_compatible = require("@ai-sdk/openai-compatible");
|
|
53
53
|
var import_ai = require("ai");
|
|
54
54
|
var import_errorLogFields = require("../util/errorLogFields.js");
|
|
55
|
+
var import_ssrfGuard = require("../util/ssrfGuard.js");
|
|
55
56
|
var import_LLMTypes = require("./LLMTypes.js");
|
|
56
57
|
var VERCEL_AI_PROVIDER_NAMES = [
|
|
57
58
|
"openai",
|
|
@@ -83,6 +84,7 @@ function compatibleModel(config) {
|
|
|
83
84
|
name: provider.type,
|
|
84
85
|
baseURL: baseUrl,
|
|
85
86
|
apiKey,
|
|
87
|
+
fetch: import_ssrfGuard.ssrfFetch,
|
|
86
88
|
// Without this the adapter silently downgrades json_schema to a schema-less json_object.
|
|
87
89
|
supportsStructuredOutputs: true,
|
|
88
90
|
// These endpoints omit token counts from streamed responses unless asked.
|
|
@@ -98,6 +100,7 @@ function buildLanguageModel(config) {
|
|
|
98
100
|
case "openai": {
|
|
99
101
|
const client = (0, import_openai.createOpenAI)({
|
|
100
102
|
apiKey,
|
|
103
|
+
fetch: import_ssrfGuard.ssrfFetch,
|
|
101
104
|
...baseUrl !== void 0 ? { baseURL: baseUrl } : {},
|
|
102
105
|
...extraHeaders !== void 0 ? { headers: extraHeaders } : {}
|
|
103
106
|
});
|
|
@@ -106,6 +109,7 @@ function buildLanguageModel(config) {
|
|
|
106
109
|
case "anthropic": {
|
|
107
110
|
const client = (0, import_anthropic.createAnthropic)({
|
|
108
111
|
apiKey,
|
|
112
|
+
fetch: import_ssrfGuard.ssrfFetch,
|
|
109
113
|
...baseUrl !== void 0 ? { baseURL: baseUrl } : {},
|
|
110
114
|
...extraHeaders !== void 0 ? { headers: extraHeaders } : {}
|
|
111
115
|
});
|
|
@@ -114,6 +118,7 @@ function buildLanguageModel(config) {
|
|
|
114
118
|
case "google-gemini": {
|
|
115
119
|
const client = (0, import_google.createGoogle)({
|
|
116
120
|
apiKey,
|
|
121
|
+
fetch: import_ssrfGuard.ssrfFetch,
|
|
117
122
|
...baseUrl !== void 0 ? { baseURL: baseUrl } : {},
|
|
118
123
|
...extraHeaders !== void 0 ? { headers: extraHeaders } : {}
|
|
119
124
|
});
|
|
@@ -122,6 +127,7 @@ function buildLanguageModel(config) {
|
|
|
122
127
|
case "moonshot": {
|
|
123
128
|
const client = (0, import_moonshotai.createMoonshotAI)({
|
|
124
129
|
apiKey,
|
|
130
|
+
fetch: import_ssrfGuard.ssrfFetch,
|
|
125
131
|
...baseUrl !== void 0 ? { baseURL: baseUrl } : {},
|
|
126
132
|
...extraHeaders !== void 0 ? { headers: extraHeaders } : {}
|
|
127
133
|
});
|
|
@@ -134,6 +140,7 @@ function buildLanguageModel(config) {
|
|
|
134
140
|
const client = (0, import_alibaba.createAlibaba)({
|
|
135
141
|
apiKey,
|
|
136
142
|
baseURL: baseUrl,
|
|
143
|
+
fetch: import_ssrfGuard.ssrfFetch,
|
|
137
144
|
...extraHeaders !== void 0 ? { headers: extraHeaders } : {}
|
|
138
145
|
});
|
|
139
146
|
return client(model.id);
|