@vpxa/kb 0.1.33 → 0.1.34
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/package.json +1 -1
- package/packages/present/dist/index.html +1 -1
- package/packages/server/dist/tools/present/helpers.d.ts +6 -1
- package/packages/server/dist/tools/present/helpers.js +1 -1
- package/packages/server/dist/tools/present/html.js +5 -5
- package/packages/server/dist/tools/present/markdown.js +7 -7
- package/packages/server/dist/tools/present/tool.d.ts +4 -2
- package/packages/server/dist/tools/present/tool.js +2 -2
package/package.json
CHANGED
|
@@ -435,7 +435,7 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
435
435
|
- "model": Tool visible to and callable by the agent
|
|
436
436
|
- "app": Tool callable by the app from this server only`)}),M({mimeTypes:j(E()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),M({method:L(`ui/download-file`),params:M({contents:j(P([Ys,Xs])).describe(`Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.`)})}),M({method:L(`ui/message`),params:M({role:L(`user`).describe(`Message role, currently only "user" is supported.`),content:j(Zs).describe(`Message content blocks (text, image, etc.).`)})}),M({method:L(`ui/notifications/sandbox-resource-ready`),params:M({html:E().describe(`HTML content to load into the inner iframe.`),sandbox:E().optional().describe(`Optional override for the inner iframe's sandbox attribute.`),csp:il.optional().describe(`CSP configuration from resource metadata.`),permissions:al.optional().describe(`Sandbox permissions from resource metadata.`)})});var _l=M({method:L(`ui/notifications/tool-result`),params:oc.describe(`Standard MCP tool execution result.`)}),vl=M({toolInfo:M({id:Eo.optional().describe(`JSON-RPC id of the tools/call request.`),tool:rc.describe(`Tool definition including name, inputSchema, etc.`)}).optional().describe(`Metadata of the tool call that instantiated this App.`),theme:Qc.optional().describe(`Current color theme preference.`),styles:ul.optional().describe(`Style configuration for theming the app.`),displayMode:$c.optional().describe(`How the UI is currently displayed.`),availableDisplayModes:j($c).optional().describe(`Display modes the host supports.`),containerDimensions:P([M({height:O().describe(`Fixed container height in pixels.`)}),M({maxHeight:P([O(),Ma()]).optional().describe(`Maximum container height in pixels.`)})]).and(P([M({width:O().describe(`Fixed container width in pixels.`)}),M({maxWidth:P([O(),Ma()]).optional().describe(`Maximum container width in pixels.`)})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
437
437
|
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:E().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:E().optional().describe(`User's timezone in IANA format.`),userAgent:E().optional().describe(`Host application identifier.`),platform:P([L(`web`),L(`desktop`),L(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:M({touch:k().optional().describe(`Whether the device supports touch input.`),hover:k().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:M({top:O().describe(`Top safe area inset in pixels.`),right:O().describe(`Right safe area inset in pixels.`),bottom:O().describe(`Bottom safe area inset in pixels.`),left:O().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough(),yl=M({method:L(`ui/notifications/host-context-changed`),params:vl.describe(`Partial context update containing only changed fields.`)});M({method:L(`ui/update-model-context`),params:M({content:j(Zs).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:F(E(),A().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),M({method:L(`ui/initialize`),params:M({appInfo:Vo.describe(`App identification (name and version).`),appCapabilities:ml.describe(`Features and capabilities this app provides.`),protocolVersion:E().describe(`Protocol version this app supports.`)})});var bl=M({protocolVersion:E().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:Vo.describe(`Host application identification and version.`),hostCapabilities:pl.describe(`Features and capabilities provided by the host.`),hostContext:vl.describe(`Rich context about the host environment.`)}).passthrough();function xl(){let e=document.documentElement.getAttribute(`data-theme`);return e===`dark`||e===`light`?e:document.documentElement.classList.contains(`dark`)?`dark`:`light`}function Sl(e){let t=document.documentElement;t.setAttribute(`data-theme`,e),t.style.colorScheme=e}function Cl(e,t=document.documentElement){for(let[n,r]of Object.entries(e))r!==void 0&&t.style.setProperty(n,r)}var wl=class extends Yc{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;constructor(e,t={},n={autoResize:!0}){super(n),this._appInfo=e,this._capabilities=t,this.options=n,this.setRequestHandler(Zo,e=>(console.log(`Received ping:`,e.params),{})),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput(e){this.setNotificationHandler(ol,t=>e(t.params))}set ontoolinputpartial(e){this.setNotificationHandler(sl,t=>e(t.params))}set ontoolresult(e){this.setNotificationHandler(_l,t=>e(t.params))}set ontoolcancelled(e){this.setNotificationHandler(cl,t=>e(t.params))}set onhostcontextchanged(e){this.setNotificationHandler(yl,t=>{this._hostContext={...this._hostContext,...t.params},e(t.params)})}set onteardown(e){this.setRequestHandler(dl,(t,n)=>e(t.params,n))}set oncalltool(e){this.setRequestHandler(cc,(t,n)=>e(t.params,n))}set onlisttools(e){this.setRequestHandler(ic,(t,n)=>e(t.params,n))}assertCapabilityForMethod(e){}assertRequestHandlerCapability(e){switch(e){case`tools/call`:case`tools/list`:if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${e})`);return;case`ping`:case`ui/resource-teardown`:return;default:throw Error(`No handler for method ${e} registered`)}}assertNotificationCapability(e){}assertTaskCapability(e){throw Error(`Tasks are not supported in MCP Apps`)}assertTaskHandlerCapability(e){throw Error(`Task handlers are not supported in MCP Apps`)}async callServerTool(e,t){if(typeof e==`string`)throw Error(`callServerTool() expects an object as its first argument, but received a string ("${e}"). Did you mean: callServerTool({ name: "${e}", arguments: { ... } })?`);return await this.request({method:`tools/call`,params:e},oc,t)}async readServerResource(e,t){return await this.request({method:`resources/read`,params:e},js,t)}async listServerResources(e,t){return await this.request({method:`resources/list`,params:e},Ts,t)}sendMessage(e,t){return this.request({method:`ui/message`,params:e},rl,t)}sendLog(e){return this.notification({method:`notifications/message`,params:e})}updateModelContext(e,t){return this.request({method:`ui/update-model-context`,params:e},Io,t)}openLink(e,t){return this.request({method:`ui/open-link`,params:e},tl,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this.request({method:`ui/download-file`,params:e},nl,t)}requestTeardown(e={}){return this.notification({method:`ui/notifications/request-teardown`,params:e})}requestDisplayMode(e,t){return this.request({method:`ui/request-display-mode`,params:e},hl,t)}sendSizeChanged(e){return this.notification({method:`ui/notifications/size-changed`,params:e})}setupSizeChangedNotifications(){let e=!1,t=0,n=0,r=()=>{e||(e=!0,requestAnimationFrame(()=>{e=!1;let r=document.documentElement,i=r.style.height;r.style.height=`max-content`;let a=Math.ceil(r.getBoundingClientRect().height);r.style.height=i;let o=Math.ceil(window.innerWidth);(o!==t||a!==n)&&(t=o,n=a,this.sendSizeChanged({width:o,height:a}))}))};r();let i=new ResizeObserver(r);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(e=new Zc(window.parent,window.parent),t){if(this.transport)throw Error(`App is already connected. Call close() before connecting again.`);await super.connect(e);try{let e=await this.request({method:`ui/initialize`,params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:Xc}},bl,t);if(e===void 0)throw Error(`Server sent invalid initialize result: ${e}`);this._hostCapabilities=e.hostCapabilities,this._hostInfo=e.hostInfo,this._hostContext=e.hostContext,await this.notification({method:`ui/notifications/initialized`}),this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(e){throw this.close(),e}}},Tl=new Set;function J(e,t){if(Tl.has(e))return;Tl.add(e);let n=document.createElement(`style`);n.textContent=t,document.head.appendChild(n)}function El(e){let t=Ol(e);return t=t.replace(/```(\w*)\n([\s\S]*?)```/g,(e,t,n)=>`<pre><code class="language-${t}">${n.trim()}</code></pre>`),t=t.replace(/`([^`]+)`/g,`<code>$1</code>`),t=t.replace(/^######\s+(.+)$/gm,`<h6>$1</h6>`),t=t.replace(/^#####\s+(.+)$/gm,`<h5>$1</h5>`),t=t.replace(/^####\s+(.+)$/gm,`<h4>$1</h4>`),t=t.replace(/^###\s+(.+)$/gm,`<h3>$1</h3>`),t=t.replace(/^##\s+(.+)$/gm,`<h2>$1</h2>`),t=t.replace(/^#\s+(.+)$/gm,`<h1>$1</h1>`),t=t.replace(/\*\*\*(.+?)\*\*\*/g,`<strong><em>$1</em></strong>`),t=t.replace(/\*\*(.+?)\*\*/g,`<strong>$1</strong>`),t=t.replace(/\*(.+?)\*/g,`<em>$1</em>`),t=t.replace(/^>\s+(.+)$/gm,`<blockquote>$1</blockquote>`),t=t.replace(/^(\s*)[-*]\s+(.+)$/gm,`$1<li>$2</li>`),t=t.replace(/((?:<li>.*<\/li>\n?)+)/g,`<ul>$1</ul>`),t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(e,t,n)=>{let r=Dl(n);return r?`<a href="${r}" target="_blank" rel="noopener">${t}</a>`:t}),t=t.replace(/\n\n+/g,`</p><p>`),t=`<p>${t}</p>`,t=t.replace(/<p>\s*<(h[1-6]|ul|ol|pre|blockquote)/g,`<$1`),t=t.replace(/<\/(h[1-6]|ul|ol|pre|blockquote)>\s*<\/p>/g,`</$1>`),t}function Y(e,t,n){let r=document.createElement(e);return t&&(r.className=t),n&&(r.textContent=n),r}function Dl(e){let t=e.trim();return/^https?:\/\//i.test(t)||/^mailto:/i.test(t)?t:/^[a-z][a-z0-9+.-]*:/i.test(t)?null:t}function Ol(e){let t=document.createElement(`div`);return t.textContent=e,t.innerHTML}function kl(e){return e==null?`null`:Array.isArray(e)?`[${e.map(kl).join(`, `)}]`:String(e)}function Al(e){return e.replace(/[^a-zA-Z0-9_]/g,`_`)}function jl(e){return typeof e==`object`&&!!e&&`type`in e}function Ml(e){if(typeof e==`string`)return Nl(e);if(Array.isArray(e))return e.length===0?X(`*Empty array*`):typeof e[0]==`object`&&e[0]!==null?Il(e):X(e.map(e=>`- ${String(e)}`).join(`
|
|
438
|
-
`));if(typeof e==`object`&&e){let t=e;return Array.isArray(t.nodes)&&Array.isArray(t.edges)?Vl(t):Array.isArray(t.metrics)?Bl(t.metrics):Rl(t)}return X(String(e))}function Nl(e){let t=e.trim();if(/^(graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt|pie|gitGraph)\b/i.test(t))return Fl(t);if(/^#{1,6}\s|^\s*[-*]\s|\*\*|__|\[.*\]\(|```/.test(t))return X(t);if((t.startsWith(`{`)||t.startsWith(`[`))&&(t.endsWith(`}`)||t.endsWith(`]`)))try{return Ml(JSON.parse(t))}catch{}return X(t)}function Pl(e){switch(e.type){case`markdown`:return X(String(e.value??``));case`mermaid`:return Fl(String(e.value??``));case`table`:return Il(e.
|
|
438
|
+
`));if(typeof e==`object`&&e){let t=e;return Array.isArray(t.nodes)&&Array.isArray(t.edges)?Vl(t):Array.isArray(t.metrics)?Bl(t.metrics):Rl(t)}return X(String(e))}function Nl(e){let t=e.trim();if(/^(graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt|pie|gitGraph)\b/i.test(t))return Fl(t);if(/^#{1,6}\s|^\s*[-*]\s|\*\*|__|\[.*\]\(|```/.test(t))return X(t);if((t.startsWith(`{`)||t.startsWith(`[`))&&(t.endsWith(`}`)||t.endsWith(`]`)))try{return Ml(JSON.parse(t))}catch{}return X(t)}function Pl(e){switch(e.type){case`markdown`:return X(String(e.value??``));case`mermaid`:return Fl(String(e.value??``));case`table`:{let t=e.value;if(Array.isArray(t)){if(t.length>0&&Array.isArray(t[0])){let e=t,n=e[0].map(String);return Il(e.slice(1).map(e=>Object.fromEntries(n.map((t,n)=>[t,e[n]]))))}return Il(t)}if(t&&typeof t==`object`&&`headers`in t&&`rows`in t){let{headers:e,rows:n}=t;return Il(n.map(t=>Object.fromEntries(e.map((e,n)=>[e,t[n]]))))}return Il([])}case`code`:return Ll(String(e.value??``),e.language);case`tree`:return Rl(e.value);case`cards`:return zl(e.value);case`metrics`:return Bl(e.value);case`graph`:return Vl(e.value);default:return X(JSON.stringify(e.value,null,2))}}function X(e){let t=Y(`div`,`block block-markdown`);return t.innerHTML=El(e),t}function Fl(e){let t=Y(`div`,`block block-mermaid`),n=Y(`pre`,`mermaid`,e);t.appendChild(n);let r=window;if(r.mermaid)setTimeout(()=>r.mermaid.run(),10);else if(!r.__mermaidLoading){r.__mermaidLoading=!0;let e=document.createElement(`script`);e.src=`https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.min.js`,e.onload=()=>{r.mermaid.run()},document.head.appendChild(e)}return t}function Il(e){let t=Y(`div`,`block block-table`);if(e.length===0)return X(`*Empty table*`);let n=Object.keys(e[0]),r=-1,i=!0,a=[...e],o=``,s=document.createElement(`input`);s.className=`table-filter`,s.placeholder=`Filter...`,s.addEventListener(`input`,()=>{o=s.value.toLowerCase(),f()}),t.appendChild(s);let c=document.createElement(`table`),l=document.createElement(`thead`),u=document.createElement(`tr`);n.forEach((e,t)=>{let n=document.createElement(`th`);n.textContent=e;let a=Y(`span`,`sort-icon`,`⇅`);n.appendChild(a),n.addEventListener(`click`,()=>{r===t?i=!i:(r=t,i=!0),f()}),u.appendChild(n)}),l.appendChild(u),c.appendChild(l);let d=document.createElement(`tbody`);c.appendChild(d),t.appendChild(c);function f(){if(a=[...e],o&&(a=a.filter(e=>n.some(t=>String(e[t]??``).toLowerCase().includes(o)))),r>=0){let e=n[r];a.sort((t,n)=>{let r=String(t[e]??``),a=String(n[e]??``),o=r.localeCompare(a,void 0,{numeric:!0});return i?o:-o})}d.innerHTML=``;for(let e of a){let t=document.createElement(`tr`);for(let r of n){let n=document.createElement(`td`);n.textContent=String(e[r]??``),t.appendChild(n)}d.appendChild(t)}}return f(),t}function Ll(e,t){let n=Y(`div`,`block block-code`),r=Y(`div`,`code-header`);r.appendChild(Y(`span`,``,t??`code`));let i=document.createElement(`button`);i.className=`copy-btn`,i.textContent=`Copy`,i.addEventListener(`click`,()=>{navigator.clipboard.writeText(e).then(()=>{i.textContent=`Copied!`,setTimeout(()=>{i.textContent=`Copy`},1500)})}),r.appendChild(i),n.appendChild(r);let a=document.createElement(`pre`),o=document.createElement(`code`);return o.textContent=e,a.appendChild(o),n.appendChild(a),n}function Rl(e,t=0){let n=Y(`div`,t===0?`block block-tree`:``);for(let[r,i]of Object.entries(e))if(typeof i==`object`&&i&&!Array.isArray(i)){let e=Y(`div`,`tree-node`),a=Y(`span`,`tree-toggle`,`▼`),o=Rl(i,t+1);o.className=`tree-children`;let s=!0;a.addEventListener(`click`,()=>{s=!s,a.textContent=s?`▼`:`▶`,o.style.display=s?``:`none`}),e.appendChild(a),e.appendChild(document.createTextNode(` ${r}`)),n.appendChild(e),n.appendChild(o)}else{let e=Y(`div`,`tree-leaf`);e.innerHTML=`<strong>${Ol(r)}:</strong> ${Ol(kl(i))}`,n.appendChild(e)}return n}function zl(e){let t=Y(`div`,`block block-cards`);for(let n of e){let e=Y(`div`,`card`);if(n.title&&e.appendChild(Y(`div`,`card-title`,String(n.title))),(n.body||n.description)&&e.appendChild(Y(`div`,`card-body`,String(n.body??n.description))),n.badge||n.status){let t=String(n.variant??n.status??`default`).toLowerCase(),r=[`success`,`warning`,`error`].includes(t)?t:``;e.appendChild(Y(`span`,`card-badge ${r}`,String(n.badge??n.status)))}t.appendChild(e)}return t}function Bl(e){let t=Y(`div`,`block block-metrics`);for(let n of e){let e=Y(`div`,`metric`);e.appendChild(Y(`div`,`metric-value`,String(n.value))),e.appendChild(Y(`div`,`metric-label`,n.label)),t.appendChild(e)}return t}function Vl(e){let t=[`graph LR`],n=new Map;for(let r of e.nodes){let e=String(r.id??r.name??``),i=String(r.label??r.name??e);n.set(e,i),t.push(` ${Al(e)}["${Ol(i)}"]`)}for(let n of e.edges){let e=Al(String(n.source??n.from??``)),r=Al(String(n.target??n.to??``)),i=n.label?`|${Ol(String(n.label))}|`:``;t.push(` ${e} -->${i} ${r}`)}return Fl(t.join(`
|
|
439
439
|
`))}function Hl(e,t){let n=Y(`div`,`actions`);for(let r of e)if(r.type===`select`&&r.options){let e=document.createElement(`select`);e.className=`action-select`;let i=document.createElement(`option`);i.textContent=r.label,i.disabled=!0,i.selected=!0,e.appendChild(i);for(let t of r.options){let n=document.createElement(`option`);typeof t==`string`?(n.value=t,n.textContent=t):(n.value=t.value,n.textContent=t.label),e.appendChild(n)}e.addEventListener(`change`,()=>{t.emitAction(r,e.value)}),n.appendChild(e)}else{let e=document.createElement(`button`);e.className=`action-btn ${r.variant??`default`}`,e.textContent=r.label,e.addEventListener(`click`,()=>t.emitAction(r)),n.appendChild(e)}return n}function Ul(e){return function(t,n){e.updateModelContext({key:`action:${t.id}`,content:JSON.stringify({actionId:t.id,actionType:t.type,label:t.label,value:n??t.label,timestamp:new Date().toISOString()})}),e.sendMessage(`User selected: ${t.label}${n?` → ${n}`:``}`)}}function Wl(e){return{callTool:(t,n)=>e.callServerTool({name:t,arguments:n}),sendMessage:async t=>{await e.sendMessage({message:{role:`user`,content:{type:`text`,text:t}}})},updateContext:async t=>{await e.updateModelContext({content:[{type:`text`,text:t}]})}}}var Gl=class{app;currentMode=`inline`;availableModes=[];toolbar=null;constructor(e){this.app=e}apply(e){e.displayMode&&(this.currentMode=e.displayMode),e.availableDisplayModes&&(this.availableModes=e.availableDisplayModes),this.updateToolbar()}async requestMode(e){try{let t=await this.app.requestDisplayMode({mode:e});return this.currentMode=t.mode,document.documentElement.dataset.display=t.mode,this.updateToolbar(),t.mode}catch{return this.currentMode}}updateToolbar(){if(this.availableModes.length<=1){this.toolbar?.remove(),this.toolbar=null;return}this.toolbar||=this.createToolbar(),this.renderButtons()}createToolbar(){let e=document.createElement(`div`);return e.className=`display-mode-toolbar`,document.body.appendChild(e),e}renderButtons(){if(!this.toolbar)return;this.toolbar.innerHTML=``;let e={inline:`▣`,fullscreen:`⛶`,pip:`◱`};for(let t of this.availableModes){let n=document.createElement(`button`);n.className=`dm-btn${t===this.currentMode?` dm-active`:``}`,n.textContent=e[t]??t,n.title=t,n.addEventListener(`click`,()=>this.requestMode(t)),this.toolbar.appendChild(n)}}},Kl=[[400,`compact`],[800,`comfortable`]],ql=class{root;displayMode=`inline`;sizeClass=`comfortable`;constructor(e){this.root=e??document.documentElement}apply(e){this.applyDisplayMode(e),this.applyContainerDimensions(e),this.applySafeArea(e),this.applyPlatform(e),this.applyDeviceCapabilities(e)}getDisplayMode(){return this.displayMode}getSize(){return this.sizeClass}applyDisplayMode(e){e.displayMode&&(this.displayMode=e.displayMode,this.root.dataset.display=e.displayMode)}applyContainerDimensions(e){let t=e.containerDimensions;if(!t)return;let n=this.root.style,r=`width`in t?t.width:`maxWidth`in t?t.maxWidth:void 0,i=`height`in t?t.height:`maxHeight`in t?t.maxHeight:void 0;r!==void 0&&(n.setProperty(`--kb-container-w`,`${r}px`),this.sizeClass=this.deriveSizeClass(r),this.root.dataset.size=this.sizeClass,n.setProperty(`--kb-content-max-width`,this.deriveMaxWidth(r)),n.setProperty(`--kb-body-pad-x`,this.derivePadX()),n.setProperty(`--kb-grid-cols`,this.deriveGridCols()),n.setProperty(`--kb-card-min`,this.deriveCardMin()),n.setProperty(`--kb-metric-min`,this.deriveMetricMin())),i!==void 0&&(n.setProperty(`--kb-container-h`,`${i}px`),n.setProperty(`--kb-body-pad-y`,this.derivePadY()))}applySafeArea(e){let t=e.safeAreaInsets;if(!t)return;let n=this.root.style;n.setProperty(`--kb-safe-top`,`${t.top}px`),n.setProperty(`--kb-safe-right`,`${t.right}px`),n.setProperty(`--kb-safe-bottom`,`${t.bottom}px`),n.setProperty(`--kb-safe-left`,`${t.left}px`)}applyPlatform(e){e.platform&&(this.root.dataset.platform=e.platform)}applyDeviceCapabilities(e){let t=e.deviceCapabilities;t&&(t.touch!==void 0&&(this.root.dataset.touch=String(t.touch)),t.hover!==void 0&&(this.root.dataset.hover=String(t.hover)))}deriveSizeClass(e){for(let[t,n]of Kl)if(e<t)return n;return`full`}deriveMaxWidth(e){return this.displayMode===`pip`?`100%`:this.displayMode===`fullscreen`?`none`:e<960?`100%`:`900px`}derivePadX(){return this.sizeClass===`compact`?`8px`:`16px`}derivePadY(){return this.sizeClass===`compact`?`8px`:`16px`}deriveGridCols(){switch(this.sizeClass){case`compact`:return`1`;case`comfortable`:return`2`;case`full`:return`3`}}deriveCardMin(){return this.sizeClass===`compact`?`100%`:`250px`}deriveMetricMin(){return this.sizeClass===`compact`?`100px`:`150px`}},Jl=class{templates=new Map;register(e){this.templates.set(e.name,e)}get(e){return this.templates.get(e)}detect(e){let t,n=0;for(let r of this.templates.values()){let i=r.detect(e);i>n&&(n=i,t=r)}return n>0?t:void 0}getAll(){return[...this.templates.values()]}},Yl={"--color-background-primary":`--kb-bg`,"--color-background-secondary":`--kb-surface`,"--color-background-tertiary":`--kb-surface2`,"--color-text-primary":`--kb-text`,"--color-text-secondary":`--kb-muted`,"--color-border-primary":`--kb-border`,"--color-ring-primary":`--kb-accent`,"--color-text-success":`--kb-success`,"--color-text-danger":`--kb-error`,"--color-text-warning":`--kb-warning`,"--color-text-info":`--kb-info`,"--color-background-inverse":`--kb-code-bg`,"--color-text-inverse":`--kb-code-fg`,"--font-sans":`--kb-font-sans`,"--font-mono":`--kb-font-mono`,"--border-radius-md":`--kb-radius`,"--shadow-sm":`--kb-shadow`},Xl={"--kb-bg":`--bg`,"--kb-text":`--fg`,"--kb-surface":`--surface`,"--kb-border":`--border`,"--kb-accent":`--accent`,"--kb-success":`--success`,"--kb-warning":`--warning`,"--kb-error":`--error`,"--kb-code-bg":`--code-bg`,"--kb-code-fg":`--code-fg`,"--kb-font-sans":`--font-sans`,"--kb-font-mono":`--font-mono`,"--kb-radius":`--radius`,"--kb-shadow":`--shadow`},Zl=class{root;constructor(e){this.root=e??document.documentElement}apply(e){e.theme&&Sl(e.theme),e.styles?.variables&&(Cl(e.styles.variables),this.mapTokens(e.styles.variables)),e.styles?.css?.fonts&&this.injectFonts(e.styles.css.fonts)}getTheme(){return xl()}mapTokens(e){let t=this.root.style;for(let[n,r]of Object.entries(Yl)){let i=e[n];if(i){t.setProperty(r,i);let e=Xl[r];e&&t.setProperty(e,i)}}let n=e[`--color-ring-primary`];n&&(t.setProperty(`--kb-accent-light`,n),t.setProperty(`--accent-light`,n),t.setProperty(`--kb-hover-bg`,`color-mix(in srgb, ${n} 10%, transparent)`))}injectFonts(e){let t=`kb-host-fonts`;if(document.getElementById(t))return;let n=document.createElement(`style`);n.id=t,n.textContent=e,document.head.appendChild(n)}},Ql=`
|
|
440
440
|
.tpl-dashboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
|
|
441
441
|
.db-card { min-height: 136px; padding: 14px; border: 1px solid var(--kb-border, #3c3c3c);
|
|
@@ -9,5 +9,10 @@ interface TypedBlock {
|
|
|
9
9
|
declare function formatValue(value: unknown): string;
|
|
10
10
|
declare function sanitizeId(value: string): string;
|
|
11
11
|
declare function isTypedBlock(value: unknown): value is TypedBlock;
|
|
12
|
+
/**
|
|
13
|
+
* Normalize a typed block so renderers can always read from `value`.
|
|
14
|
+
* Handles alternative field names: text, code, headers+rows → value.
|
|
15
|
+
*/
|
|
16
|
+
declare function normalizeBlock(block: TypedBlock): TypedBlock;
|
|
12
17
|
//#endregion
|
|
13
|
-
export { TypedBlock, formatValue, isTypedBlock, sanitizeId };
|
|
18
|
+
export { TypedBlock, formatValue, isTypedBlock, normalizeBlock, sanitizeId };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(t){return t==null?`null`:Array.isArray(t)?`[${t.map(e).join(`, `)}]`:String(t)}function t(e){return e.replace(/[^a-zA-Z0-9_]/g,`_`)}function n(e){return typeof e
|
|
1
|
+
function e(t){return t==null?`null`:Array.isArray(t)?`[${t.map(e).join(`, `)}]`:String(t)}function t(e){return e.replace(/[^a-zA-Z0-9_]/g,`_`)}function n(e){return typeof e!=`object`||!e||!(`type`in e)?!1:`value`in e||`text`in e||`headers`in e||`code`in e||`items`in e}function r(e){if(`value`in e)return e;let t=e;return typeof t.text==`string`?{...e,value:t.text}:typeof t.code==`string`?{...e,value:t.code}:Array.isArray(t.headers)&&Array.isArray(t.rows)?{...e,value:{headers:t.headers,rows:t.rows}}:Array.isArray(t.items)?{...e,value:{items:t.items}}:e}export{e as formatValue,n as isTypedBlock,r as normalizeBlock,t as sanitizeId};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{escHtml as e}from"../present-utils.js";import{renderChecklistHtml as t,renderComparisonHtml as n,renderProgressHtml as r,renderPromptHtml as i,renderStatusBoardHtml as a,renderTimelineHtml as o}from"../present-blocks.js";import{renderChartAsHtml as s}from"../present-charts.js";import{formatValue as c,isTypedBlock as l,sanitizeId as
|
|
2
|
-
`)}function
|
|
3
|
-
`)}function
|
|
4
|
-
`)}</tbody></table></div>`}function
|
|
5
|
-
`)}export{
|
|
1
|
+
import{escHtml as e}from"../present-utils.js";import{renderChecklistHtml as t,renderComparisonHtml as n,renderProgressHtml as r,renderPromptHtml as i,renderStatusBoardHtml as a,renderTimelineHtml as o}from"../present-blocks.js";import{renderChartAsHtml as s}from"../present-charts.js";import{formatValue as c,isTypedBlock as l,normalizeBlock as u,sanitizeId as d}from"./helpers.js";import{marked as f}from"marked";f.setOptions({async:!1,gfm:!0,breaks:!0}),f.use({renderer:{html(t){return e(t.text)}}});function p(t,n){let r=[];if(t&&r.push(`<h1>${e(t)}</h1>`),typeof n==`string`)r.push(`<div class="md-content">${f.parse(n)}</div>`);else if(Array.isArray(n))if(n.length===0)r.push(`<p><em>empty</em></p>`);else if(l(n[0]))for(let e of n)r.push(m(u(e)));else typeof n[0]==`object`&&n[0]!==null?r.push(h(n)):r.push(`<ul>${n.map(t=>`<li>${e(String(t))}</li>`).join(``)}</ul>`);else if(typeof n==`object`&&n){let t=n;if(Array.isArray(t.blocks)&&t.blocks.length>0)for(let n of t.blocks)l(n)?r.push(m(u(n))):r.push(`<p>${e(String(n))}</p>`);else Array.isArray(t.metrics)?r.push(g(t.metrics)):Array.isArray(t.nodes)&&Array.isArray(t.edges)?(r.push(`<pre class="mermaid">${e(y(t))}</pre>`),r.push(`<script src="https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.min.js"><\/script>`),r.push(`<script>mermaid.run();<\/script>`)):r.push(v(t))}else r.push(`<p>${e(String(n))}</p>`);return r.join(`
|
|
2
|
+
`)}function m(c){let l=[];switch(c.title&&l.push(`<h2>${e(c.title)}</h2>`),c.type){case`markdown`:l.push(`<div class="md-content">${f.parse(String(c.value??``))}</div>`);break;case`code`:l.push(`<pre><code>${e(String(c.value??``))}</code></pre>`);break;case`mermaid`:l.push(`<pre class="mermaid">${e(String(c.value??``))}</pre>`);break;case`table`:if(Array.isArray(c.value)){let e=c.value;if(e.length>0&&Array.isArray(e[0])){let t=e,n=t[0].map(String),r=t.slice(1).map(e=>Object.fromEntries(n.map((t,n)=>[t,e[n]])));l.push(h(r))}else l.push(h(e))}else if(c.value&&typeof c.value==`object`&&`headers`in c.value&&`rows`in c.value){let{headers:e,rows:t}=c.value,n=t.map(t=>Object.fromEntries(e.map((e,n)=>[e,t[n]])));l.push(h(n))}break;case`metrics`:{let e;Array.isArray(c.value)?e=c.value:c.value&&typeof c.value==`object`&&(e=Object.entries(c.value).map(([e,t])=>({label:e,value:String(t)}))),e&&l.push(g(e));break}case`cards`:Array.isArray(c.value)&&l.push(_(c.value));break;case`tree`:c.value&&typeof c.value==`object`&&l.push(v(c.value));break;case`graph`:c.value&&typeof c.value==`object`&&l.push(`<pre class="mermaid">${e(y(c.value))}</pre>`);break;case`chart`:{let e=c.value;if(e&&!e.chartType&&e.type&&Array.isArray(e.labels)&&Array.isArray(e.datasets)){let t=e.labels,n=e.datasets,r=n.map((e,t)=>e.label??`series${t+1}`),i=t.map((e,t)=>{let i={_label:e};return n.forEach((e,n)=>{i[r[n]]=e.data[t]??0}),i}),a={type:`chart`,title:c.title,value:{chartType:String(e.type),data:i,xKey:`_label`,yKeys:r}};l.push(s(a))}else l.push(s(c));break}case`timeline`:{let e=c.value;Array.isArray(e)&&(e={items:e.map(e=>({title:String(e.event??e.title??``),phase:e.date==null?e.phase==null?void 0:String(e.phase):String(e.date),description:e.description==null?void 0:String(e.description),status:e.status??`done`}))}),e&&l.push(o(e));break}case`checklist`:c.value&&l.push(t(c.value));break;case`comparison`:c.value&&l.push(n(c.value));break;case`status-board`:c.value&&l.push(a(c.value));break;case`prompt`:c.value&&l.push(i(c.value));break;case`progress`:c.value&&l.push(r(c.value));break;case`text`:l.push(`<div class="md-content">${f.parse(String(c.value??``))}</div>`);break;case`heading`:{let t=Math.min(Math.max(Number(c.level)||2,1),6);l.push(`<h${t}>${e(String(c.value??``))}</h${t}>`);break}case`paragraph`:l.push(`<p>${e(String(c.value??``))}</p>`);break;case`separator`:l.push(`<hr class="separator">`);break;default:l.push(`<pre>${e(JSON.stringify(c.value,null,2))}</pre>`)}return l.join(`
|
|
3
|
+
`)}function h(t){if(t.length===0)return`<p><em>empty table</em></p>`;let n=Object.keys(t[0]);return`<div class="table-wrap"><table><thead><tr>${n.map(t=>`<th>${e(t)}</th>`).join(``)}</tr></thead><tbody>${t.map(t=>`<tr>${n.map(n=>`<td>${e(String(t[n]??``))}</td>`).join(``)}</tr>`).join(`
|
|
4
|
+
`)}</tbody></table></div>`}function g(t){return`<div class="metric-grid">${t.map(t=>`<div class="metric"><div class="metric-value">${e(String(t.value))}</div><div class="metric-label">${e(t.label)}</div></div>`).join(``)}</div>`}function _(t){return`<div class="card-grid">${t.map(t=>{let n=[`<div class="card">`];return t.title&&n.push(`<div class="card-title">${e(String(t.title))}</div>`),(t.body||t.description)&&n.push(`<div class="card-body">${e(String(t.body??t.description))}</div>`),(t.badge||t.status)&&n.push(`<span class="badge">${e(String(t.badge??t.status))}</span>`),n.push(`</div>`),n.join(``)}).join(``)}</div>`}function v(t){let n=[];for(let[r,i]of Object.entries(t))typeof i==`object`&&i&&!Array.isArray(i)?n.push(`<div class="tree-node"><span class="tree-key">${e(r)}:</span><div class="tree-children">${v(i)}</div></div>`):n.push(`<div class="tree-node"><span class="tree-key">${e(r)}:</span> ${e(c(i))}</div>`);return n.join(``)}function y(e){let t=[`graph LR`];for(let n of e.nodes){let e=d(String(n.id??n.name??``)),r=String(n.label??n.name??e);t.push(` ${e}["${r}"]`)}for(let n of e.edges){let e=d(String(n.source??n.from??``)),r=d(String(n.target??n.to??``)),i=n.label?`|${String(n.label)}|`:``;t.push(` ${e} -->${i} ${r}`)}return t.join(`
|
|
5
|
+
`)}export{h as arrayToHtmlTable,_ as cardsToHtml,p as contentToHtml,y as graphToMermaidRaw,g as metricsToHtml,v as objectToHtmlTree,m as renderBlockAsHtml};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{formatValue as e,isTypedBlock as t,sanitizeId as
|
|
2
|
-
`)}function
|
|
1
|
+
import{formatValue as e,isTypedBlock as t,normalizeBlock as n,sanitizeId as r}from"./helpers.js";function i(e,r){let i=[];if(e&&i.push(`# ${e}\n`),typeof r==`string`)i.push(r);else if(Array.isArray(r))if(r.length===0)i.push(`*(empty)*`);else if(t(r[0]))for(let e of r)i.push(a(n(e)));else if(typeof r[0]==`object`&&r[0]!==null)i.push(o(r));else for(let e of r)i.push(`- ${String(e)}`);else if(typeof r==`object`&&r){let e=r;if(Array.isArray(e.blocks)&&e.blocks.length>0)for(let r of e.blocks)t(r)?i.push(a(n(r))):i.push(String(r));else Array.isArray(e.nodes)&&Array.isArray(e.edges)?i.push(c(e)):Array.isArray(e.metrics)?i.push(s(e.metrics)):i.push(l(e))}else i.push(String(r));return i.join(`
|
|
2
|
+
`)}function a(e){let t=[];switch(e.title&&t.push(`## ${e.title}\n`),e.type){case`markdown`:t.push(String(e.value??``));break;case`code`:t.push(`\`\`\`${e.language??``}\n${String(e.value??``)}\n\`\`\``);break;case`mermaid`:t.push(`\`\`\`mermaid\n${String(e.value??``)}\n\`\`\``);break;case`table`:Array.isArray(e.value)&&t.push(o(e.value));break;case`metrics`:Array.isArray(e.value)&&t.push(s(e.value));break;case`graph`:e.value&&typeof e.value==`object`&&t.push(c(e.value));break;case`cards`:if(Array.isArray(e.value))for(let n of e.value)t.push(`### ${n.title??`Card`}`),(n.body||n.description)&&t.push(String(n.body??n.description)),(n.badge||n.status)&&t.push(`> **${n.badge??n.status}**`),t.push(``);break;case`tree`:e.value&&typeof e.value==`object`&&t.push(l(e.value));break;case`chart`:{let n=e.value;n?.data&&Array.isArray(n.data)&&t.push(`*${String(n.chartType??`chart`)} chart — ${n.data.length} data points*`);break}case`timeline`:{let n=e.value;if(n?.items)for(let e of n.items){let n=e.status===`done`?`✅`:e.status===`active`?`🔄`:e.status===`error`?`❌`:`⬜`;t.push(`${n} **${e.title}**${e.description?` — ${e.description}`:``}`)}break}case`checklist`:{let n=e.value;if(n?.items)for(let e of n.items)t.push(`- [${e.checked?`x`:` `}] ${e.label}${e.note?` — ${e.note}`:``}`);break}case`comparison`:{let n=e.value;if(n?.columns&&n.columns.length>0){let e=Math.max(...n.columns.map(e=>e.items?.length??0)),r=n.columns.map(e=>e.title);t.push(`| ${r.join(` | `)} |`),t.push(`| ${r.map(()=>`---`).join(` | `)} |`);for(let r=0;r<e;r++)t.push(`| ${n.columns.map(e=>e.items?.[r]??``).join(` | `)} |`)}break}case`status-board`:{let n=e.value;if(n?.items)for(let e of n.items){let n=e.status===`success`?`🟢`:e.status===`warning`?`🟡`:e.status===`error`?`🔴`:e.status===`info`?`🔵`:`⚪`;t.push(`${n} **${e.label}**${e.detail?` — ${e.detail}`:``}`)}break}case`prompt`:{let n=e.value;n?.question&&(t.push(`> **${n.question}**`),n.context&&t.push(`> ${n.context}`));break}case`progress`:{let n=e.value;if(n?.items)for(let e of n.items){let n=e.max??100,r=n>0?Math.round(e.value/n*100):0,i=Math.round(r/5),a=`█`.repeat(i)+`░`.repeat(20-i);t.push(`${e.label}: ${a} ${r}%`)}break}case`text`:t.push(String(e.value??``));break;case`heading`:{let n=Math.min(Math.max(Number(e.level)||2,1),6);t.push(`${`#`.repeat(n)} ${String(e.value??``)}\n`);break}case`paragraph`:t.push(String(e.value??``));break;case`separator`:t.push(`---
|
|
3
3
|
`);break;default:t.push(JSON.stringify(e.value,null,2))}return t.push(``),t.join(`
|
|
4
|
-
`)}function
|
|
5
|
-
`)}function
|
|
6
|
-
`)}function
|
|
7
|
-
`)}function
|
|
8
|
-
`)}export{
|
|
4
|
+
`)}function o(e){if(e.length===0)return`*(empty table)*`;let t=Object.keys(e[0]),n=[];n.push(`| ${t.join(` | `)} |`),n.push(`| ${t.map(()=>`---`).join(` | `)} |`);for(let r of e)n.push(`| ${t.map(e=>String(r[e]??``)).join(` | `)} |`);return n.join(`
|
|
5
|
+
`)}function s(e){return e.map(e=>`- **${e.label}**: ${e.value}`).join(`
|
|
6
|
+
`)}function c(e){let t=["```mermaid",`graph LR`];for(let n of e.nodes){let e=r(String(n.id??n.name??``)),i=String(n.label??n.name??e);t.push(` ${e}["${i}"]`)}for(let n of e.edges){let e=r(String(n.source??n.from??``)),i=r(String(n.target??n.to??``)),a=n.label?`|${String(n.label)}|`:``;t.push(` ${e} -->${a} ${i}`)}return t.push("```"),t.join(`
|
|
7
|
+
`)}function l(t,n=0){let r=` `.repeat(n),i=[];for(let[a,o]of Object.entries(t))typeof o==`object`&&o&&!Array.isArray(o)?(i.push(`${r}- **${a}**:`),i.push(l(o,n+1))):i.push(`${r}- **${a}**: ${e(o)}`);return i.join(`
|
|
8
|
+
`)}export{o as arrayToMarkdownTable,i as buildMarkdown,c as graphToMermaid,s as metricsToMarkdown,l as objectToMarkdownTree,a as renderBlockAsMarkdown};
|
|
@@ -16,8 +16,10 @@ declare function formatAsHtml(title: string | undefined, content: unknown, actio
|
|
|
16
16
|
content: Array<{
|
|
17
17
|
type: 'text';
|
|
18
18
|
text: string;
|
|
19
|
-
}>;
|
|
20
|
-
structuredContent:
|
|
19
|
+
} | UIResource>;
|
|
20
|
+
structuredContent: {
|
|
21
|
+
actions: Array<Record<string, unknown>>;
|
|
22
|
+
};
|
|
21
23
|
};
|
|
22
24
|
//#endregion
|
|
23
25
|
export { formatAsBrowser, formatAsHtml, getPresentHtml, registerPresentTool, resolvePresentHtml };
|
|
@@ -15,5 +15,5 @@ import{getToolMeta as e}from"../../tool-metadata.js";import{buildBrowserHtml as
|
|
|
15
15
|
- "html" (default): Rich markdown in chat + embedded UIResource. Use for display-only content (tables, charts, reports, status boards) where no user interaction is needed.
|
|
16
16
|
- "browser": Serves a themed dashboard on a local URL. Use ONLY when you need user interaction back (confirmations, selections, form input). The tool blocks until user clicks an action button, then returns their selection.
|
|
17
17
|
FORMAT RULE: If no user interaction is needed → use "html". If you need user input back → use "browser".
|
|
18
|
-
BROWSER WORKFLOW: After calling present with format "browser", you MUST extract the URL from the response and call openBrowserPage({ url }) to open it in VS Code Simple Browser. A system browser fallback also opens automatically, but always call openBrowserPage yourself.`,annotations:r.annotations,inputSchema:_,_meta:{ui:{resourceUri:h}}},async({format:e,title:t,content:r,actions:i,template:a})=>(e??`html`)===`browser`?await w(t,r,i,n,a):T(t,r,i,a))}async function w(e,r,i,a,o){let s=n(e,r),d=t(e,r,i,o),f,p,m=Array.isArray(i)?i:[],
|
|
19
|
-
`)}],structuredContent:o}}export{w as formatAsBrowser,T as formatAsHtml,S as getPresentHtml,C as registerPresentTool,x as resolvePresentHtml};
|
|
18
|
+
BROWSER WORKFLOW: After calling present with format "browser", you MUST extract the URL from the response and call openBrowserPage({ url }) to open it in VS Code Simple Browser. A system browser fallback also opens automatically, but always call openBrowserPage yourself.`,annotations:r.annotations,inputSchema:_,_meta:{ui:{resourceUri:h}}},async({format:e,title:t,content:r,actions:i,template:a})=>(e??`html`)===`browser`?await w(t,r,i,n,a):T(t,r,i,a))}async function w(e,r,i,a,o){let s=n(e,r),d=t(e,r,i,o),f=u({uri:`ui://kb/present-browser.html`,content:{type:`rawHtml`,htmlString:d},encoding:`text`,adapters:{mcpApps:{enabled:!0}}}),p,m,h=Array.isArray(i)?i:[],g=``,_;try{b&&=(b.close(),null),h.length>0&&(p=new Promise(e=>{m=e}));let e=!1;g=await new Promise((t,n)=>{let r=l((t,n)=>{if(e||(e=!0,_&&clearTimeout(_)),t.method===`POST`&&t.url===`/callback`){let e=``;t.on(`data`,t=>{e+=t.toString()}),t.on(`end`,()=>{n.writeHead(200,{"Content-Type":`application/json`,"Access-Control-Allow-Origin":`*`}),n.end(`{"ok":true}`);try{let t=JSON.parse(e);m?.(t)}catch{}});return}if(t.method===`OPTIONS`){n.writeHead(204,{"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`POST`,"Access-Control-Allow-Headers":`Content-Type`}),n.end();return}n.writeHead(200,{"Content-Type":`text/html; charset=utf-8`}),n.end(d)});r.listen(0,`127.0.0.1`,()=>{let i=r.address();if(typeof i==`object`&&i){b=r;let n=`http://127.0.0.1:${i.port}`;_=setTimeout(()=>{if(!e)try{c(process.platform===`win32`?`start "" "${n}"`:process.platform===`darwin`?`open "${n}"`:`xdg-open "${n}"`)}catch{}},8e3),_.unref(),t(n)}else n(Error(`Failed to start present server`))}),setTimeout(()=>{r.close(),b===r&&(b=null)},300*1e3).unref()})}catch{}let v=g?`${s}\n\n---\n🌐 **Dashboard opened in browser:** ${g}\n\n**IMPORTANT:** You MUST now open this URL using the \`openBrowserPage\` tool (Simple Browser). If that tool is unavailable, open the URL in the system browser as a fallback. If neither works, ask the user to open the URL manually.`:s;if(h.length>0&&a?.available&&p)try{let e=await Promise.race([p,new Promise((e,t)=>setTimeout(()=>t(Error(`timeout`)),300*1e3))]);return{content:[{type:`text`,text:`${v}\n\n✅ **Selected:** ${e.actionId} = \`${e.value}\``},f]}}catch{return{content:[{type:`text`,text:`${v}\n\n⚠️ *No selection received (timed out).*`},f]}}return{content:[{type:`text`,text:v},f]}}function T(e,r,i,a){let o=Array.isArray(i)?i:[],s=n(e,r);if(o.length>0){let e=[``];for(let t=0;t<o.length;t++){let n=o[t],r=typeof n.label==`string`?n.label:`Action ${t+1}`;if(n.type===`select`&&Array.isArray(n.options)){let i=n.options.map(e=>typeof e==`string`?e:e.label).join(`, `);e.push(`${t+1}. **${r}** — choose: ${i}`)}else e.push(`${t+1}. **${r}**`)}s+=`\n${e.join(`
|
|
19
|
+
`)}`}let c=u({uri:`ui://kb/present-static.html`,content:{type:`rawHtml`,htmlString:t(e,r,i,a)},encoding:`text`,adapters:{mcpApps:{enabled:!0}}});return{content:[{type:`text`,text:s},c],structuredContent:{actions:o}}}export{w as formatAsBrowser,T as formatAsHtml,S as getPresentHtml,C as registerPresentTool,x as resolvePresentHtml};
|