pomljs
Version:
Prompt Orchestration Markup Language
1 lines • 44.7 kB
Source Map (JSON)
{"version":3,"file":"essentials.cjs","sources":["../.build/essentials.js"],"sourcesContent":["import * as React from 'react';\nimport { component, expandRelative, ReadError, useWithCatch } from './base';\nimport { Markup, Serialize, computePresentationOrUndefined, Free, MultiMedia } from './presentation';\nimport fs from './util/fs';\nimport { preprocessImage } from './util/image';\nimport { preprocessAudio } from './util/audio';\nconst FREE_SYNTAXES = ['text'];\nconst MARKUP_SYNTAXES = ['markdown', 'html', 'csv', 'tsv'];\nconst SERIALIZE_SYNTAXES = ['json', 'yaml', 'xml'];\nconst MULTIMEDIA_SYNTAXES = ['multimedia'];\nexport const computeSyntaxContext = (props, defaultSyntax, invalidPresentations) => {\n const { syntax, ...others } = props;\n invalidPresentations = invalidPresentations ?? ['multimedia'];\n // 1. Create the full presentation style based on the syntax shortcut.\n // This is the case when syntax is explicity specified.\n let presentationStyle;\n if (!syntax) {\n presentationStyle = {};\n }\n else if (MARKUP_SYNTAXES.includes(syntax)) {\n if (invalidPresentations.includes('markup')) {\n throw ReadError.fromProps(`Markup syntax (${syntax}) is not supported here.`, others);\n }\n presentationStyle = { presentation: 'markup', markupLang: syntax };\n }\n else if (SERIALIZE_SYNTAXES.includes(syntax)) {\n if (invalidPresentations.includes('serialize')) {\n throw ReadError.fromProps(`Serialize syntax (${syntax}) is not supported here.`, others);\n }\n presentationStyle = { presentation: 'serialize', serializer: syntax };\n }\n else if (FREE_SYNTAXES.includes(syntax)) {\n if (invalidPresentations.includes('free')) {\n throw ReadError.fromProps(`Free syntax (${syntax}) is not supported here.`, others);\n }\n presentationStyle = { presentation: 'free' };\n }\n else if (MULTIMEDIA_SYNTAXES.includes(syntax)) {\n if (invalidPresentations.includes('multimedia')) {\n throw ReadError.fromProps(`Multimedia syntax (${syntax}) is not supported here.`, others);\n }\n presentationStyle = { presentation: 'multimedia' };\n }\n else {\n throw ReadError.fromProps(`Unsupported syntax: ${syntax}`, others);\n }\n // 2. Compute the presentation context.\n // Try to inherit presentation and syntax from parents.\n // There are two cases where the inherited presentation does not count.\n // (a) No presentation is found.\n // (b) The presentation is free and the syntax is not specified.\n const presentation = computePresentationOrUndefined(presentationStyle);\n if (!presentation || (presentation === 'free' && !syntax)) {\n if (syntax) {\n // This should not happen. Must be a bug.\n throw ReadError.fromProps(`Syntax is specified (${syntax}) but presentation method is not found. Something is wrong.`, others);\n }\n // Try again with a default syntax\n return computeSyntaxContext({ ...others, syntax: defaultSyntax || 'markdown' }, defaultSyntax, invalidPresentations);\n }\n return presentation;\n};\n// Helper component for contents that are designed for markup, but also work in other syntaxes.\nexport const AnyOrFree = component('AnyOrFree')((props) => {\n const { syntax, children, presentation, name, type, asAny, ...others } = props;\n if (presentation === 'serialize') {\n if (asAny) {\n return (React.createElement(Serialize.Any, { serializer: syntax, name: name, type: type, ...others }, children));\n }\n else {\n return (React.createElement(Serialize.Environment, { serializer: syntax, ...others }, children));\n }\n }\n else if (presentation === 'free') {\n return React.createElement(Free.Text, { ...others }, children);\n }\n else {\n throw ReadError.fromProps(`This component is not designed for ${presentation} syntaxes.`, others);\n }\n});\n/**\n * Text (`<text>`, `<poml>`) is a wrapper for any contents.\n * By default, it uses `markdown` syntax and writes the contents within it directly to the output.\n * When used with \"markup\" syntaxes, it renders a standalone section preceded and followed by one blank line.\n * It's mostly used in the root element of a prompt, but it should also work in any other places.\n * This component will be automatically added as a wrapping root element if it's not provided:\n * 1. If the first element is pure text contents, `<poml syntax=\"text\">` will be added.\n * 2. If the first element is a POML component, `<poml syntax=\"markdown\">` will be added.\n *\n * @param {'markdown'|'html'|'json'|'yaml'|'xml'|'text'} syntax - The syntax of the content. Note `xml` and `text` are experimental.\n * @param className - A class name for quickly styling the current block with stylesheets.\n * @param {'human'|'ai'|'system'} speaker - The speaker of the content. By default, it's determined by the context and the content.\n * @param name - The name of the content, used in serialization.\n * @param type - The type of the content, used in serialization.\n * @param {object} writerOptions - **Experimental.**. Optional JSON string to customize the format of markdown headers, JSON indents, etc.\n * @param {'pre'|'filter'|'trim'} whiteSpace - **Experimental.** Controls how whitespace is handled in text content.\n * `'pre'` (default when `syntax` is `text`): Preserves all whitespace as-is;\n * `'filter'` (default when `syntax` is not `text`): Removes leading/trailing whitespace and normalizes internal whitespace in the gaps;\n * `'trim'`: Trims whitespace from the beginning and end.\n * @param {number} charLimit - **Experimental.** Soft character limit before truncation is applied. Content exceeding this limit will be truncated with a marker.\n * @param {number} tokenLimit - **Experimental.** Soft token limit before truncation is applied. Content exceeding this limit will be truncated with a marker.\n * @param {number} priority - **Experimental.** Priority used when truncating globally. Lower numbers are dropped first when content needs to be reduced to fit limits.\n *\n * @example\n * ```xml\n * <poml syntax=\"text\">\n * Contents of the whole prompt.\n *\n * 1. Your customized list.\n * 2. You don't need to know anything about POML.\n * </poml>\n * ```\n *\n * To render the whole prompt in markdown syntax with a \"human\" speaker:\n *\n * ```xml\n * <poml syntax=\"markdown\" speaker=\"human\">\n * <p>You are a helpful assistant.</p>\n * <p>What is the capital of France?</p>\n * </poml>\n * ```\n *\n * **Experimental usage with limits and priority:**\n *\n * ```xml\n * <poml syntax=\"markdown\" tokenLimit=\"10\">\n * <p priority=\"1\">This has lower priority and may be truncated first.</p>\n * <p priority=\"3\">This has higher priority and will be preserved longer.</p>\n * </poml>\n * ```\n */\nexport const Text = component('Text', ['div', 'poml'])((props) => {\n const { syntax, children, name, type, ...others } = props;\n const presentation = computeSyntaxContext(props, 'markdown');\n if (presentation === 'markup') {\n return (React.createElement(Paragraph, { syntax: syntax, blankLine: false, ...others }, children));\n }\n else {\n return (React.createElement(AnyOrFree, { syntax: syntax, presentation: presentation, asAny: true, name: name, type: type, ...others }, children));\n }\n});\nexport const Poml = Text;\n/**\n * Paragraph (`<p>`) is a standalone section preceded by and followed by two blank lines in markup syntaxes.\n * It's mostly used for text contents.\n *\n * @param {boolean} blankLine - Whether to add one more blank line (2 in total) before and after the paragraph.\n *\n * @see {@link Text} for other props available.\n *\n * @example\n * ```xml\n * <p>Contents of the paragraph.</p>\n * ```\n */\nexport const Paragraph = component('Paragraph', ['p'])((props) => {\n const { syntax, children, name, type, ...others } = props;\n const presentation = computeSyntaxContext(props);\n if (presentation === 'markup') {\n return (React.createElement(Markup.Paragraph, { markupLang: syntax, ...others }, children));\n }\n else {\n return (React.createElement(AnyOrFree, { syntax: syntax, presentation: presentation, asAny: true, name: name, type: type, ...others }, children));\n }\n});\n/**\n * Inline (`<span>`) is a container for inline content.\n * When used with markup syntaxes, it wraps text in an inline style, without any preceding or following blank characters.\n * In serializer syntaxes, it's treated as a generic value.\n * Inline elements are not designed to be used alone (especially in serializer syntaxes).\n * One might notice problematic renderings (e.g., speaker not applied) when using it alone.\n *\n * @param {'markdown'|'html'|'json'|'yaml'|'xml'|'text'} syntax - The syntax of the content.\n * @param className - A class name for quickly styling the current block with stylesheets.\n * @param {'human'|'ai'|'system'} speaker - The speaker of the content. By default, it's determined by the context and the content.\n * @param {object} writerOptions - **Experimental.**. Optional JSON string to customize the format of markdown headers, JSON indents, etc.\n * @param {'pre'|'filter'|'trim'} whiteSpace - **Experimental.** Controls how whitespace is handled in text content.\n * `'pre'` (default when `syntax` is `text`): Preserves all whitespace as-is;\n * `'filter'` (default when `syntax` is not `text`): Removes leading/trailing whitespace and normalizes internal whitespace in the gaps;\n * `'trim'`: Trims whitespace from the beginning and end.\n * @param {number} charLimit - **Experimental.** Soft character limit before truncation is applied. Content exceeding this limit will be truncated with a marker.\n * @param {number} tokenLimit - **Experimental.** Soft token limit before truncation is applied. Content exceeding this limit will be truncated with a marker.\n * @param {number} priority - **Experimental.** Priority used when truncating globally. Lower numbers are dropped first when content needs to be reduced to fit limits.\n *\n * @example\n * ```xml\n * <p>I'm listening to <span>music</span> right now.</p>\n * ```\n */\nexport const Inline = component('Inline', ['span'])((props) => {\n const { syntax, children, ...others } = props;\n const presentation = computeSyntaxContext(props);\n if (presentation === 'markup') {\n return (React.createElement(Markup.Inline, { markupLang: syntax, ...others }, children));\n }\n else {\n return (React.createElement(AnyOrFree, { syntax: syntax, presentation: presentation, asAny: false, ...others }, children));\n }\n});\n/**\n * Newline (`<br>`) explicitly adds a line break, primarily in markup syntaxes.\n * In serializer syntaxes, it's ignored.\n *\n * @param {number} newLineCount - The number of linebreaks to add.\n *\n * @see {@link Inline} for other props available.\n *\n * @example\n * ```xml\n * <br />\n * ```\n */\nexport const Newline = component('Newline', ['br'])((props) => {\n const { syntax, ...others } = props;\n const presentation = computeSyntaxContext(props);\n if (presentation === 'markup') {\n return React.createElement(Markup.Newline, { markupLang: syntax, ...others });\n }\n else {\n return null;\n }\n});\n/**\n * Header (`<h>`) renders headings in markup syntaxes.\n * It's commonly used to highlight titles or section headings.\n * The header level will be automatically computed based on the context.\n * Use SubContent (`<section>`) for nested content.\n *\n * @see {@link Paragraph} for other props available.\n *\n * @example\n * ```xml\n * <Header syntax=\"markdown\">Section Title</Header>\n * ```\n */\nexport const Header = component('Header', ['h'])((props) => {\n const { syntax, children, name, type, ...others } = props;\n const presentation = computeSyntaxContext(props);\n if (presentation === 'markup') {\n return (React.createElement(Markup.Header, { markupLang: syntax, ...others }, children));\n }\n else {\n return (React.createElement(AnyOrFree, { syntax: syntax, presentation: presentation, asAny: true, name: name, type: type, ...others }, children));\n }\n});\n/**\n * SubContent (`<section>`) renders nested content, often following a header.\n * The headers within the section will be automatically adjusted to a lower level.\n *\n * @see {@link Paragraph} for other props available.\n *\n * @example\n * ```xml\n * <h>Section Title</h>\n * <section>\n * <h>Sub-section Title</h> <!-- Nested header -->\n * <p>Sub-section details</p>\n * </section>\n * ```\n */\nexport const SubContent = component('SubContent', ['section'])((props) => {\n const { syntax, children, name, type, ...others } = props;\n const presentation = computeSyntaxContext(props);\n if (presentation === 'markup') {\n return (React.createElement(Markup.SubContent, { markupLang: syntax, ...others }, children));\n }\n else {\n return (React.createElement(AnyOrFree, { syntax: syntax, presentation: presentation, asAny: true, name: name, type: type, ...others }, children));\n }\n});\n/**\n * Bold (`<b>`) emphasizes text in a bold style when using markup syntaxes.\n *\n * @see {@link Inline} for other props available.\n *\n * @example\n * ```xml\n * <p><b>Task:</b> Do something.</p>\n * ```\n */\nexport const Bold = component('Bold', ['b'])((props) => {\n const { syntax, children, ...others } = props;\n const presentation = computeSyntaxContext(props);\n if (presentation === 'markup') {\n return (React.createElement(Markup.Bold, { markupLang: syntax, ...others }, children));\n }\n else {\n return (React.createElement(AnyOrFree, { syntax: syntax, presentation: presentation, asAny: false, ...others }, children));\n }\n});\n/**\n * Italic (`<i>`) emphasizes text in an italic style when using markup syntaxes.\n *\n * @see {@link Inline} for other props available.\n *\n * @example\n * ```xml\n * Your <i>italicized</i> text.\n * ```\n */\nexport const Italic = component('Italic', ['i'])((props) => {\n const { syntax, children, ...others } = props;\n const presentation = computeSyntaxContext(props);\n if (presentation === 'markup') {\n return (React.createElement(Markup.Italic, { markupLang: syntax, ...others }, children));\n }\n else {\n return (React.createElement(AnyOrFree, { syntax: syntax, presentation: presentation, asAny: false, ...others }, children));\n }\n});\n/**\n * Strikethrough (`<s>`, `<strike>`) indicates removed or invalid text in markup syntaxes.\n *\n * @see {@link Inline} for other props available.\n *\n * @example\n * ```xml\n * <s>This messages is removed.</s>\n * ```\n */\nexport const Strikethrough = component('Strikethrough', ['s', 'strike'])((props) => {\n const { syntax, children, ...others } = props;\n const presentation = computeSyntaxContext(props);\n if (presentation === 'markup') {\n return (React.createElement(Markup.Strikethrough, { markupLang: syntax, ...others }, children));\n }\n else {\n return (React.createElement(AnyOrFree, { syntax: syntax, presentation: presentation, asAny: false, ...others }, children));\n }\n});\n/**\n * Underline (`<u>`) draws a line beneath text in markup syntaxes.\n *\n * @see {@link Inline} for other props available.\n *\n * @example\n * ```xml\n * This text is <u>underlined</u>.\n * ```\n */\nexport const Underline = component('Underline', ['u'])((props) => {\n const { syntax, children, ...others } = props;\n const presentation = computeSyntaxContext(props);\n if (presentation === 'markup') {\n return (React.createElement(Markup.Underline, { markupLang: syntax, ...others }, children));\n }\n else {\n return (React.createElement(AnyOrFree, { syntax: syntax, presentation: presentation, asAny: false, ...others }, children));\n }\n});\n/**\n * Code is used to represent code snippets or inline code in markup syntaxes.\n *\n * @param {boolean} inline - Whether to render code inline or as a block. Default is `true`.\n * @param lang - The language of the code snippet.\n *\n * @see {@link Paragraph} for other props available.\n *\n * @example\n * ```xml\n * <code inline=\"true\">const x = 42;</code>\n * ```\n *\n * ```xml\n * <code lang=\"javascript\">\n * const x = 42;\n * </code>\n * ```\n */\nexport const Code = component('Code')((props) => {\n const { syntax, children, name, type, ...others } = props;\n const presentation = computeSyntaxContext(props);\n if (presentation === 'markup') {\n return (React.createElement(Markup.Code, { markupLang: syntax, ...others }, children));\n }\n else {\n return (React.createElement(AnyOrFree, { syntax: syntax, presentation: presentation, asAny: true, name: name, type: type, ...others }, children));\n }\n});\n/**\n * List (`<list>`) is a container for multiple ListItem (`<item>`) elements.\n * When used with markup syntaxes, a bullet or numbering is added.\n *\n * @param {'star'|'dash'|'plus'|'decimal'|'latin'} listStyle - The style for the list marker, such as dash or star. Default is `dash`.\n *\n * @see {@link Paragraph} for other props available.\n *\n * @example\n * ```xml\n * <list listStyle=\"decimal\">\n * <item>Item 1</item>\n * <item>Item 2</item>\n * </list>\n * ```\n */\nexport const List = component('List')((props) => {\n const { syntax, children, listStyle, name, type, ...others } = props;\n const presentation = computeSyntaxContext(props);\n if (presentation === 'markup') {\n return (React.createElement(Markup.List, { markupLang: syntax, listStyle: listStyle, ...others }, children));\n }\n else {\n return (React.createElement(AnyOrFree, { syntax: syntax, presentation: presentation, asAny: true, name: name, type: type ?? 'array', ...others }, children));\n }\n});\n/**\n * ListItem (`<item>`) is an item within a List component.\n * In markup mode, it is rendered with the specified bullet or numbering style.\n *\n * @see {@link Paragraph} for other props available.\n *\n * @example\n * ```xml\n * <list listStyle=\"decimal\">\n * <item blankLine=\"true\">Item 1</item>\n * <item>Item 2</item>\n * </list>\n * ```\n */\nexport const ListItem = component('ListItem', ['item'])((props) => {\n const { syntax, children, name, type, ...others } = props;\n const presentation = computeSyntaxContext(props);\n if (presentation === 'markup') {\n return (React.createElement(Markup.ListItem, { markupLang: syntax, ...others }, children));\n }\n else {\n return (React.createElement(AnyOrFree, { syntax: syntax, presentation: presentation, asAny: true, name: name, type: type, ...others }, children));\n }\n});\n/**\n * Object (`<obj>`, `<dataObj>`) displays external data or object content.\n * When in serialize mode, it's serialized according to the given serializer.\n *\n * @param {'markdown'|'html'|'json'|'yaml'|'xml'} syntax - The syntax or serializer of the content. Default is `json`.\n * @param {object} data - The data object to render.\n *\n * @see {@link Inline} for other props available.\n *\n * @example\n * ```xml\n * <Object syntax=\"json\" data=\"{ key: 'value' }\" />\n * ```\n */\nexport const Object = component('Object', ['obj', 'dataObj'])((props) => {\n const { syntax, children, ...others } = props;\n const presentation = computeSyntaxContext(props, 'json');\n if (presentation === 'serialize') {\n return (React.createElement(Serialize.Object, { serializer: syntax, ...others }, children));\n }\n else {\n return React.createElement(Text, { syntax: syntax }, JSON.stringify(props.data));\n }\n});\n/**\n * Image (`<img>`) displays an image in the content.\n * Alternatively, it can also be shown as an alt text by specifying the `syntax` prop.\n * Note that syntax must be specified as `multimedia` to show the image.\n *\n * @see {@link Inline} for other props available.\n *\n * @param {string} src - The path to the image file.\n * @param {string} alt - The alternative text to show when the image cannot be displayed.\n * @param {string} base64 - The base64 encoded image data. It can not be specified together with `src`.\n * @param {string} type - The MIME type of the image **to be shown**. If not specified, it will be inferred from the file extension.\n * If specified, the image will be converted to the specified type. Can be `image/jpeg`, `image/png`, etc., or without the `image/` prefix.\n * @param {'top'|'bottom'|'here'} position - The position of the image. Default is `here`.\n * @param {number} maxWidth - The maximum width of the image to be shown.\n * @param {number} maxHeight - The maximum height of the image to be shown.\n * @param {number} resize - The ratio to resize the image to to be shown.\n * @param {'markdown'|'html'|'json'|'yaml'|'xml'|'multimedia'} syntax - Only when specified as `multimedia`, the image will be shown.\n * Otherwise, the alt text will be shown. By default, it's `multimedia` when `alt` is not specified. Otherwise, it's undefined (inherit from parent).\n *\n * @example\n * ```xml\n * <Image src=\"path/to/image.jpg\" alt=\"Image description\" position=\"bottom\" />\n * ```\n */\nexport const Image = component('Image', { aliases: ['img'], asynchorous: true })((props) => {\n let { syntax, src, base64, alt, type, position, maxWidth, maxHeight, resize, ...others } = props;\n if (!alt) {\n syntax = syntax ?? 'multimedia';\n }\n const presentation = computeSyntaxContext({ ...props, syntax }, 'multimedia', []);\n if (presentation === 'multimedia') {\n if (src) {\n if (base64) {\n throw ReadError.fromProps('Cannot specify both `src` and `base64`.', others);\n }\n src = expandRelative(src);\n if (!fs.existsSync(src)) {\n throw ReadError.fromProps(`Image file not found: ${src}`, others);\n }\n }\n else if (!base64) {\n throw ReadError.fromProps('Either `src` or `base64` must be specified.', others);\n }\n const image = useWithCatch(preprocessImage({ src, base64, type, maxWidth, maxHeight, resize }), others);\n if (!image) {\n return null;\n }\n return (React.createElement(MultiMedia.Image, { presentation: presentation, base64: image.base64, position: position, type: image.mimeType, alt: alt, ...others }));\n }\n else {\n return React.createElement(Inline, { syntax: syntax }, alt);\n }\n});\n/**\n * Audio (`<audio>`) embeds an audio file in the content.\n *\n * Accepts either a file path (`src`) or base64-encoded audio data (`base64`).\n * The MIME type can be provided via `type` or will be inferred from the file extension.\n *\n * @param {string} src - Path to the audio file. If provided, the file will be read and encoded as base64.\n * @param {string} base64 - Base64-encoded audio data. Cannot be used together with `src`.\n * @param {string} alt - The alternative text to show when the image cannot be displayed.\n * @param {string} type - The MIME type of the audio (e.g., audio/mpeg, audio/wav). If not specified, it will be inferred from the file extension.\n * The type must be consistent with the real type of the file. The consistency will NOT be checked or converted.\n * The type can be specified with or without the `audio/` prefix.\n * @param {'top'|'bottom'|'here'} position - The position of the image. Default is `here`.\n * @param {'markdown'|'html'|'json'|'yaml'|'xml'|'multimedia'} syntax - Only when specified as `multimedia`, the image will be shown.\n * Otherwise, the alt text will be shown. By default, it's `multimedia` when `alt` is not specified. Otherwise, it's undefined (inherit from parent).\n *\n * @example\n * ```xml\n * <Audio src=\"path/to/audio.mp3\" />\n * ```\n * @example\n * ```xml\n * <Audio base64=\"...\" type=\"audio/wav\" />\n * ```\n */\nexport const Audio = component('Audio', { aliases: ['audio'], asynchorous: true })((props) => {\n let { syntax, src, base64, type, ...others } = props;\n const presentation = computeSyntaxContext(props, 'multimedia', []);\n if (presentation === 'multimedia') {\n if (src) {\n if (base64) {\n throw ReadError.fromProps('Cannot specify both `src` and `base64`.', others);\n }\n src = expandRelative(src);\n if (!fs.existsSync(src)) {\n throw ReadError.fromProps(`Audio file not found: ${src}`, others);\n }\n }\n else if (!base64) {\n throw ReadError.fromProps('Either `src` or `base64` must be specified.', others);\n }\n const audio = useWithCatch(preprocessAudio({ src, base64, type }), others);\n if (!audio) {\n return null;\n }\n return (React.createElement(MultiMedia.Audio, { presentation: presentation, base64: audio.base64, type: audio.mimeType, ...others }));\n }\n else {\n return null;\n }\n});\n/**\n * ToolRequest represents an AI-generated tool request with parameters.\n * Used to display tool calls made by AI models.\n *\n * @param {string} id - Tool request ID\n * @param {string} name - Tool name\n * @param {any} parameters - Tool input parameters\n * @param {'human'|'ai'|'system'} speaker - The speaker of the content. Default is `ai`.\n *\n * @example\n * ```xml\n * <ToolRequest id=\"123\" name=\"search\" parameters={{ query: \"hello\" }} />\n * ```\n */\nexport const ToolRequest = component('ToolRequest', { aliases: ['toolRequest'] })((props) => {\n let { syntax, id, name, parameters, speaker, ...others } = props;\n syntax = syntax ?? 'multimedia';\n const presentation = computeSyntaxContext({ ...props, syntax }, 'multimedia', []);\n if (presentation === 'multimedia') {\n return (React.createElement(MultiMedia.ToolRequest, { presentation: presentation, id: id, name: name, parameters: parameters, speaker: speaker ?? 'ai', ...others }));\n }\n else {\n return (React.createElement(Object, { syntax: syntax, speaker: speaker ?? 'ai', data: { id, name, parameters }, ...others }));\n }\n});\n/**\n * ToolResponse represents the result of a tool execution.\n * Used to display tool execution results with rich content.\n *\n * @param {'markdown'|'html'|'json'|'yaml'|'xml'|'text'} syntax - The syntax of ToolResponse is special.\n * It is always `multimedia` for itself. The syntax is used to render the content inside.\n * If not specified, it will inherit from the parent context.\n * @param {string} id - Tool call ID to respond to\n * @param {string} name - Tool name\n * @param {'human'|'ai'|'system'|'tool'} speaker - The speaker of the content. Default is `tool`.\n *\n * @example\n * ```xml\n * <ToolResponse id=\"123\" name=\"search\">\n * <Paragraph>Search results for \"hello\":</Paragraph>\n * <List>\n * <ListItem>Result 1</ListItem>\n * <ListItem>Result 2</ListItem>\n * </List>\n * </ToolResponse>\n * ```\n */\nexport const ToolResponse = component('ToolResponse', { aliases: ['toolResponse'] })((props) => {\n const { syntax, id, name, children, speaker, ...others } = props;\n const presentation = computeSyntaxContext(props);\n let syntaxFromContext = syntax;\n if (syntaxFromContext === undefined) {\n if (presentation === 'markup') {\n syntaxFromContext = 'markdown';\n }\n else if (presentation === 'serialize') {\n syntaxFromContext = 'json';\n }\n else if (presentation === 'free') {\n syntaxFromContext = 'text';\n }\n else if (presentation === 'multimedia') {\n syntaxFromContext = 'multimedia';\n }\n }\n return (React.createElement(MultiMedia.ToolResponse, { presentation: 'multimedia', id: id, name: name, speaker: speaker ?? 'tool', ...others },\n React.createElement(Inline, { syntax: syntaxFromContext }, children)));\n});\n//# sourceMappingURL=essentials.js.map"],"names":["ReadError","presentation","computePresentationOrUndefined","component","React","Serialize","Free","Markup","Object","expandRelative","fs","image","useWithCatch","preprocessImage","MultiMedia","audio","preprocessAudio"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,aAAa,GAAG,CAAC,MAAM,CAAC;AAC9B,MAAM,eAAe,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC;AAC1D,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC;AAClD,MAAM,mBAAmB,GAAG,CAAC,YAAY,CAAC;AAC9B,MAAC,oBAAoB,GAAG,CAAC,KAAK,EAAE,aAAa,EAAE,oBAAoB,K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