Release of @iterate-com/ui from 6a1d909ade0c4b13668ccfa3c06c4435547b404e
ui release builder, 2026-11-26 17:30 UTC · dad6fd39a3a8addd9e86343df719326e5eed60b7 · parent 187daeb
4 files changed
M dist/agent-kind-view-frame.js
Not shown: the change is larger than this page shows. A clone has it.
M dist/components/widget/widget.mjs
@@ -1,4 +1,4 @@ -const e=`events.iterate.com/`,t={shown:`${e}agent-ui/widget-shown`,updated:`${e}agent-ui/widget-updated`,toolCalled:`${e}agent-ui/widget-tool-called`,context:`${e}agent-ui/widget-context`},n=`2026-01-26`,r=262144,i=4194304,a=2e3,o=120,s=e=>!!e&&typeof e==`object`&&!Array.isArray(e),c=(e,t)=>typeof e==`string`&&e.trim()!==``?e.slice(0,t):void 0,l=(e,t)=>Array.isArray(e)?e.filter(e=>typeof e==`string`).slice(0,t):void 0,u=e=>s(e)?Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`)):void 0;function d(e){if(!s(e))return;let t={};for(let n of[`connectDomains`,`resourceDomains`,`frameDomains`,`baseUriDomains`]){let r=l(e[n],50);r?.length&&(t[n]=r)}return Object.keys(t).length?t:void 0}const f=500,p=/^(?:\/[A-Za-z0-9._~@:-]+)+$/,m=e=>e.length<=400&&p.test(e)&&e.split(`/`).every(e=>e!==`.`&&e!==`..`);function h(e){let t=[...new Set(l(e,50)?.filter(m))].slice(0,8);return t.length?t:void 0}function g(e){if(!s(e))return;let t=c(e.server,2e3),n=c(e.tool,200),r=c(e.resourceUri,2e3);if(!t||!n||!r||!_(t))return;let i=s(e.result)?e.result:{};return{server:t,headers:u(e.headers),tool:n,resourceUri:r,input:s(e.input)?e.input:{},result:{content:Array.isArray(i.content)?i.content:void 0,structuredContent:i.structuredContent,isError:i.isError===!0||void 0,_meta:s(i._meta)?i._meta:void 0},permissions:s(e.permissions)?e.permissions:void 0,prefersBorder:typeof e.prefersBorder==`boolean`?e.prefersBorder:void 0}}function _(e){try{return new URL(e).protocol===`https:`}catch{return!1}}const v=e=>new URL(e.server).host,y=e=>e.app?i:r;function b(e){return c(e.key,200)??c(e.id,200)}function x(e,t){if(!s(e)||typeof e.html!=`string`)return null;let n=g(e.app);if(e.app!==void 0&&!n)return null;let r=c(e.title,200),i=typeof e.height==`number`&&e.height>0?e.height:void 0;return{key:b(e)??`widget-${String(t)}`,text:c(e.text,4e3)??r??`A widget`,html:e.html,data:e.data,title:r,height:i&&Math.min(i,2e3),offset:t,csp:d(e.csp),app:n,contexts:n?void 0:h(e.contexts)}}function S(e,t){let n=e.source;if(!s(n)||n.origin!==t||n.principal!==void 0||n.grant!==void 0||n.onBehalfOf!==void 0||n.copiedFrom!==void 0)return!1;let r=s(n.cause)?n.cause.parent:void 0;return typeof r==`string`&&r.startsWith(`${t}@`)}function C(e){return s(e)&&e.type===t.shown&&s(e.payload)&&e.payload.contexts!==void 0}function w(e,n=/* @__PURE__ */ new Map,r){let i=new Map(n);for(let n of e)if(s(n)&&typeof n.offset==`number`){if(n.type===t.shown){let e=x(n.payload,n.offset);if(!e)continue;e.contexts&&!(r&&S(n,r))&&delete e.contexts,i.set(e.key,{first:i.get(e.key)?.first??n.offset,widget:e})}else if(n.type===t.updated&&s(n.payload)){let e=b(n.payload),t=e?i.get(e):void 0;if(!t||!e)continue;let r=c(n.payload.text,4e3);i.set(e,{...t,widget:{...t.widget,data:n.payload.data,text:r||t.widget.text}})}}return i}function T(e,t,n,r){return!!w(e,void 0,t).get(n)?.widget.contexts?.includes(r)}const E=`default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data: blob:; media-src data: blob:; font-src data:; connect-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'`,D=/^(?:(?:https|wss):\/\/(?:\*\.)?[a-z0-9-]+(?:\.[a-z0-9-]+)*|(?:http|ws):\/\/(?:localhost|127\.0\.0\.1))(?::\d{1,5})?$/i;function O(e){let t=[],n=[];for(let r of e||[])(D.test(r)?t:n).push(r);return{taken:t,refused:n}}function k(e){if(!e)return E;let t=O(e.connectDomains).taken,n=O(e.resourceDomains).taken,r=O(e.frameDomains).taken,i=O(e.baseUriDomains).taken,a=(e,t,n)=>[e,t,...n].join(` `);return[`default-src 'none'`,a(`script-src`,`'unsafe-inline'`,n),a(`style-src`,`'unsafe-inline'`,n),a(`img-src`,`data: blob:`,n),a(`media-src`,`data: blob:`,n),a(`font-src`,`data:`,n),t.length?`connect-src ${t.join(` `)}`:`connect-src 'none'`,...r.length?[`frame-src ${r.join(` `)}`]:[],`object-src 'none'`,i.length?`base-uri ${i.join(` `)}`:`base-uri 'none'`,`form-action 'none'`].join(`; `)}const A=/* @__PURE__ */ RegExp(`[\\u2028\\u2029]`,`g`),j=e=>JSON.stringify(e??null).replace(/</g,`\\u003c`).replace(A,e=>e===`\u2028`?`\\u2028`:`\\u2029`),M=e=>Object.entries(e).filter(([e,t])=>/^--[a-z0-9-]+$/i.test(e)&&!/[;{}<>]/.test(t)).map(([e,t])=>`${e}:${t}`).join(`;`),N=`iterate/notifications/scrolled`,P=`iterate/context/read`,F=`(function () { +const e=`events.iterate.com/`,t={shown:`${e}agent-ui/widget-shown`,updated:`${e}agent-ui/widget-updated`,toolCalled:`${e}agent-ui/widget-tool-called`,context:`${e}agent-ui/widget-context`},n=`2026-01-26`,r=262144,i=4194304,a=2e3,o=120,s=e=>!!e&&typeof e==`object`&&!Array.isArray(e),c=(e,t)=>typeof e==`string`&&e.trim()!==``?e.slice(0,t):void 0,l=(e,t)=>Array.isArray(e)?e.filter(e=>typeof e==`string`).slice(0,t):void 0,u=e=>s(e)?Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`)):void 0;function d(e){if(!s(e))return;let t={};for(let n of[`connectDomains`,`resourceDomains`,`frameDomains`,`baseUriDomains`]){let r=l(e[n],50);r?.length&&(t[n]=r)}return Object.keys(t).length?t:void 0}const f=500,p=/^(?:\/[A-Za-z0-9._~@:-]+)+$/,m=e=>e.length<=400&&p.test(e)&&e.split(`/`).every(e=>e!==`.`&&e!==`..`);function h(e){let t=[...new Set(l(e,50)?.filter(m))].slice(0,8);return t.length?t:void 0}function g(e){if(!s(e))return;let t=c(e.server,2e3),n=c(e.tool,200),r=c(e.resourceUri,2e3);if(!t||!n||!r||!_(t))return;let i=s(e.result)?e.result:{};return{server:t,headers:u(e.headers),tool:n,resourceUri:r,input:s(e.input)?e.input:{},result:{content:Array.isArray(i.content)?i.content:void 0,structuredContent:i.structuredContent,isError:i.isError===!0||void 0,_meta:s(i._meta)?i._meta:void 0},permissions:s(e.permissions)?e.permissions:void 0,prefersBorder:typeof e.prefersBorder==`boolean`?e.prefersBorder:void 0}}function _(e){try{return new URL(e).protocol===`https:`}catch{return!1}}const v=e=>new URL(e.server).host,y=e=>e.app?i:r;function b(e){return c(e.key,200)??c(e.id,200)}function x(e,t){if(!s(e)||typeof e.html!=`string`)return null;let n=g(e.app);if(e.app!==void 0&&!n)return null;let r=c(e.title,200),i=typeof e.height==`number`&&e.height>0?e.height:void 0;return{key:b(e)??`widget-${String(t)}`,text:c(e.text,4e3)??r??`A widget`,html:e.html,data:e.data,title:r,height:i&&Math.min(i,2e3),offset:t,csp:d(e.csp),app:n,contexts:n?void 0:h(e.contexts)}}function S(e,t){let n=e.source;if(!s(n)||n.origin!==t||n.principal!==void 0||n.grant!==void 0||n.onBehalfOf!==void 0||n.copiedFrom!==void 0)return!1;let r=s(n.cause)?n.cause.parent:void 0;return typeof r==`string`&&r.startsWith(`${t}@`)}function C(e){return s(e)&&e.type===t.shown&&s(e.payload)&&e.payload.contexts!==void 0}function w(e,n=/* @__PURE__ */ new Map,r){let i=new Map(n);for(let n of e)if(s(n)&&typeof n.offset==`number`){if(n.type===t.shown){let e=x(n.payload,n.offset);if(!e)continue;e.contexts&&!(r&&S(n,r))&&delete e.contexts,i.set(e.key,{first:i.get(e.key)?.first??n.offset,widget:e})}else if(n.type===t.updated&&s(n.payload)){let e=b(n.payload),t=e?i.get(e):void 0;if(!t||!e)continue;let r=c(n.payload.text,4e3);i.set(e,{...t,widget:{...t.widget,data:n.payload.data,text:r||t.widget.text}})}}return i}function T(e,t,n,r){return!!w(e,void 0,t).get(n)?.widget.contexts?.includes(r)}const E=`default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data: blob:; media-src data: blob:; font-src data:; connect-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'`,D=/^(?:(?:(?:https|wss):\/\/(?:\*\.)?[a-z0-9-]+(?:\.[a-z0-9-]+)*|(?:http|ws):\/\/(?:localhost|127\.0\.0\.1))(?::\d{1,5})?|blob:)$/i;function O(e){let t=[],n=[];for(let r of e||[])(D.test(r)?t:n).push(r);return{taken:t,refused:n}}function k(e){if(!e)return E;let t=O(e.connectDomains).taken,n=O(e.resourceDomains).taken,r=O(e.frameDomains).taken,i=O(e.baseUriDomains).taken,a=(e,t,n)=>[e,t,...n].join(` `);return[`default-src 'none'`,a(`script-src`,`'unsafe-inline'`,n),a(`style-src`,`'unsafe-inline'`,n),a(`img-src`,`data: blob:`,n),a(`media-src`,`data: blob:`,n),a(`font-src`,`data:`,n),t.length?`connect-src ${t.join(` `)}`:`connect-src 'none'`,...r.length?[`frame-src ${r.join(` `)}`]:[],`object-src 'none'`,i.length?`base-uri ${i.join(` `)}`:`base-uri 'none'`,`form-action 'none'`].join(`; `)}const A=/* @__PURE__ */ RegExp(`[\\u2028\\u2029]`,`g`),j=e=>JSON.stringify(e??null).replace(/</g,`\\u003c`).replace(A,e=>e===`\u2028`?`\\u2028`:`\\u2029`),M=e=>Object.entries(e).filter(([e,t])=>/^--[a-z0-9-]+$/i.test(e)&&!/[;{}<>]/.test(t)).map(([e,t])=>`${e}:${t}`).join(`;`),N=`iterate/notifications/scrolled`,P=`iterate/context/read`,F=`(function () { var boot = JSON.parse(document.getElementById("iterate-widget-boot").textContent); var listeners = [], pending = {}, nextId = 1, lastHeight = -1, logged = 0, loggedSince = Date.now(); function post(message) { parent.postMessage(Object.assign({ jsonrpc: "2.0" }, message), "*"); } @@ -124,4 +124,4 @@ if (typeof ResizeObserver === "function") new ResizeObserver(size).observe(document.documentElement); addEventListener("load", size); }); -})();`;function I(e,t){let n=`<meta http-equiv="Content-Security-Policy" content="${k(e.csp)}">`;return e.app?`<!doctype html><meta charset="utf-8">${n}${e.html}`:`<!doctype html><html><head><meta charset="utf-8">`+n+`<meta name="viewport" content="width=device-width, initial-scale=1"><style>:root{${M(t.variables)}}html{height:auto}body{margin:0;padding:12px;font:14px/1.5 var(--font-sans,system-ui,sans-serif);color:var(--color-text-primary,CanvasText);background:transparent;overflow-wrap:anywhere}button{font:inherit;color:inherit;background:var(--color-background-secondary,ButtonFace);border:1px solid var(--color-border-primary,ButtonBorder);border-radius:var(--border-radius-md,8px);padding:6px 12px;cursor:pointer}table{border-collapse:collapse}td,th{border:1px solid var(--color-border-primary,GrayText);padding:4px 8px;text-align:left}</style><style id="iterate-widget-scheme">:root,:root *{color-scheme:${t.theme} !important}</style><script type="application/json" id="iterate-widget-boot">${j({data:e.data??null,theme:t.theme})}<\/script><script>${F}<\/script></head><body>${e.html}</body></html>`}const L=(e,t)=>({jsonrpc:`2.0`,id:e,result:t}),R=(e,t,n)=>({jsonrpc:`2.0`,id:e,error:{code:t,message:n}});function z(e){let t={};for(let n of[`connectDomains`,`resourceDomains`,`frameDomains`,`baseUriDomains`]){let{taken:r}=O(e?.[n]);r.length&&(t[n]=r)}return t}function B(e){return{theme:e.theme.theme,styles:{variables:e.theme.variables},displayMode:`inline`,availableDisplayModes:[`inline`],...!!e.width&&{containerDimensions:{maxWidth:e.width}}}}const V=e=>e.app?{...e.app.result,structuredContent:e.data===void 0?e.app.result.structuredContent:e.data}:{content:[{type:`text`,text:e.text}],structuredContent:e.data??null},H=e=>e.app?e.app.input:e.data??{};function U(e,t){if(!s(e)||e.jsonrpc!==`2.0`||typeof e.method!=`string`)return{};let{id:r,method:i}=e,o=s(e.params)?e.params:{},l=typeof r==`string`||typeof r==`number`;switch(i){case`ui/initialize`:{let e=!!(t.widget.app&&t.canCallServer);return{reply:L(r,{protocolVersion:n,hostInfo:{name:`iterate`,version:`1`},hostCapabilities:{openLinks:{},logging:{},...(t.widget.app?t.canDraft:t.canSend)&&{message:{text:{}}},...t.canModelContext&&{updateModelContext:{text:{},structuredContent:{}}},...e&&{serverTools:{},serverResources:{}},...t.canReadContext&&t.widget.contexts&&{contexts:{read:t.widget.contexts}},sandbox:{permissions:{},csp:z(t.widget.csp)}},hostContext:B(t)})}}case`ui/notifications/initialized`:return{initialized:!0};case`ui/notifications/size-changed`:{let e=typeof o.height==`number`&&Number.isFinite(o.height)?o.height:void 0;return e===void 0?{}:{height:Math.min(Math.max(Math.ceil(e),24),a)}}case`ui/message`:{let e=(Array.isArray(o.content)?o.content:[]).map(e=>s(e)&&e.type===`text`&&typeof e.text==`string`?e.text:``).join(``).trim().slice(0,4e3);if(!l)return{};let n=!!t.widget.app;return(n?!t.canDraft:!t.canSend)?{reply:R(r,-32601,n?`This chat has no composer for a widget's words.`:`This chat takes no words from a widget.`)}:t.pressed?e===``?{reply:R(r,-32602,`The message has no words.`)}:n?{reply:L(r,{}),draft:e}:{reply:L(r,{}),send:e}:{reply:R(r,-32e3,`A widget sends words only when a person presses something in it.`)}}case`ui/open-link`:{let e=typeof o.url==`string`?o.url:``;return l?/^https:\/\/[^\s]+$/i.test(e)?t.pressed?{reply:L(r,{}),open:e}:{reply:R(r,-32e3,`A widget opens a link only when a person presses something in it.`)}:{reply:R(r,-32602,`A widget opens https links only.`)}:{}}case N:{let e=Number(o.wheel),t=Number(o.by);return Number.isFinite(e)&&e?{scrolled:{wheel:Math.max(-4e3,Math.min(4e3,e))}}:o.touch===`start`||o.touch===`end`?{scrolled:{touch:o.touch}}:o.touch===`move`&&Number.isFinite(t)?{scrolled:{touch:`move`,by:Math.max(-4e3,Math.min(4e3,t))}}:{}}case`notifications/message`:{let e=String(o.level),t=e===`debug`?`debug`:e===`info`||e===`notice`?`info`:e===`warning`?`warn`:`error`,n=typeof o.data==`string`?o.data:JSON.stringify(o.data??null);return{log:{level:t,text:String(n).slice(0,2048)}}}case`tools/call`:{if(!l)return{};if(!t.widget.app||!t.canCallServer)return{reply:R(r,-32601,`This widget has no server to call.`)};let e=c(o.name,200);return e?{callTool:{id:r,name:e,arguments:s(o.arguments)?o.arguments:{}}}:{reply:R(r,-32602,`A tool call names its tool.`)}}case`resources/read`:{if(!l)return{};if(!t.widget.app||!t.canCallServer)return{reply:R(r,-32601,`This widget has no server to read.`)};let e=c(o.uri,2e3);return e?{readResource:{id:r,uri:e}}:{reply:R(r,-32602,`A read names its resource.`)}}case P:{if(!l)return{};if(t.widget.app||!t.canReadContext)return{reply:R(r,-32601,`This widget reads no context.`)};let e=typeof o.path==`string`?o.path:``;if(!t.widget.contexts?.includes(e))return{reply:R(r,-32602,"This widget's fact does not name that context in `contexts`.")};let n=(e,t,n,r)=>typeof e==`number`&&Number.isFinite(e)?Math.min(Math.max(Math.floor(e),t),n):r;return{readContext:{id:r,context:e,after:n(o.after,0,2**53-1,0),limit:n(o.limit,1,500,200)}}}case`ui/update-model-context`:{if(!l)return{};if(!t.canModelContext)return{reply:R(r,-32601,`This chat takes no context from a widget.`)};let e=Array.isArray(o.content)?o.content.slice(0,20):[];return{reply:L(r,{}),modelContext:{content:e,structuredContent:o.structuredContent}}}case`ui/request-display-mode`:return l?{reply:L(r,{mode:`inline`})}:{};case`ping`:return l?{reply:L(r,{})}:{};default:return l?{reply:R(r,-32601,`This host does not offer ${i}.`)}:{}}}const W={"--color-background-primary":`--background`,"--color-background-secondary":`--muted`,"--color-text-primary":`--foreground`,"--color-text-secondary":`--muted-foreground`,"--color-border-primary":`--border`,"--color-ring-primary":`--ring`,"--border-radius-md":`--radius`};function G(e){if(!e||typeof getComputedStyle!=`function`)return{theme:`light`,variables:{}};let t=getComputedStyle(e),n={};for(let[e,r]of Object.entries(W)){let i=t.getPropertyValue(r).trim();i&&(n[e]=i)}return n[`--font-sans`]=t.fontFamily,{theme:e.closest(`.dark`)?`dark`:`light`,variables:n}}export{i as WIDGET_APP_HTML_MAX,F as WIDGET_CLIENT,P as WIDGET_CONTEXT_READ,f as WIDGET_CONTEXT_READ_MAX,t as WIDGET_FACT,o as WIDGET_HEIGHT_FIRST,a as WIDGET_HEIGHT_MAX,r as WIDGET_HTML_MAX,E as WIDGET_POLICY,N as WIDGET_SCROLLED,C as asksToReadContext,U as widgetAnswer,O as widgetCspSources,I as widgetDocument,w as widgetFold,y as widgetHtmlMax,H as widgetInput,T as widgetNamesContext,x as widgetOf,k as widgetPolicy,V as widgetResult,v as widgetServerHost,G as widgetThemeAt}; +})();`;function I(e,t){let n=`<meta http-equiv="Content-Security-Policy" content="${k(e.csp)}">`;return e.app?`<!doctype html><meta charset="utf-8">${n}${e.html}`:`<!doctype html><html><head><meta charset="utf-8">`+n+`<meta name="viewport" content="width=device-width, initial-scale=1"><style>:root{${M(t.variables)}}html{height:auto}body{margin:0;padding:2px;font:14px/1.5 var(--font-sans,system-ui,sans-serif);color:var(--color-text-primary,CanvasText);background:transparent;overflow-wrap:anywhere}body>:not(script,style,template):not(:not(script,style,template)~*){margin-top:0}body>:not(script,style,template):not(:has(~:not(script,style,template))){margin-bottom:0}button{font:inherit;color:inherit;background:var(--color-background-secondary,ButtonFace);border:1px solid var(--color-border-primary,ButtonBorder);border-radius:var(--border-radius-md,8px);padding:6px 12px;cursor:pointer}table{border-collapse:collapse}td,th{border:1px solid var(--color-border-primary,GrayText);padding:4px 8px;text-align:left}</style><style id="iterate-widget-scheme">:root,:root *{color-scheme:${t.theme} !important}</style><script type="application/json" id="iterate-widget-boot">${j({data:e.data??null,theme:t.theme})}<\/script><script>${F}<\/script></head><body>${e.html}</body></html>`}const L=(e,t)=>({jsonrpc:`2.0`,id:e,result:t}),R=(e,t,n)=>({jsonrpc:`2.0`,id:e,error:{code:t,message:n}});function z(e){let t={};for(let n of[`connectDomains`,`resourceDomains`,`frameDomains`,`baseUriDomains`]){let{taken:r}=O(e?.[n]);r.length&&(t[n]=r)}return t}function B(e){return{theme:e.theme.theme,styles:{variables:e.theme.variables},displayMode:`inline`,availableDisplayModes:[`inline`],...!!e.width&&{containerDimensions:{maxWidth:e.width}}}}const V=e=>e.app?{...e.app.result,structuredContent:e.data===void 0?e.app.result.structuredContent:e.data}:{content:[{type:`text`,text:e.text}],structuredContent:e.data??null},H=e=>e.app?e.app.input:e.data??{};function U(e,t){if(!s(e)||e.jsonrpc!==`2.0`||typeof e.method!=`string`)return{};let{id:r,method:i}=e,o=s(e.params)?e.params:{},l=typeof r==`string`||typeof r==`number`;switch(i){case`ui/initialize`:{let e=!!(t.widget.app&&t.canCallServer);return{reply:L(r,{protocolVersion:n,hostInfo:{name:`iterate`,version:`1`},hostCapabilities:{openLinks:{},logging:{},...(t.widget.app?t.canDraft:t.canSend)&&{message:{text:{}}},...t.canModelContext&&{updateModelContext:{text:{},structuredContent:{}}},...e&&{serverTools:{},serverResources:{}},...t.canReadContext&&t.widget.contexts&&{contexts:{read:t.widget.contexts}},sandbox:{permissions:{},csp:z(t.widget.csp)}},hostContext:B(t)})}}case`ui/notifications/initialized`:return{initialized:!0};case`ui/notifications/size-changed`:{let e=typeof o.height==`number`&&Number.isFinite(o.height)?o.height:void 0;return e===void 0?{}:{height:Math.min(Math.max(Math.ceil(e),24),a)}}case`ui/message`:{let e=(Array.isArray(o.content)?o.content:[]).map(e=>s(e)&&e.type===`text`&&typeof e.text==`string`?e.text:``).join(``).trim().slice(0,4e3);if(!l)return{};let n=!!t.widget.app;return(n?!t.canDraft:!t.canSend)?{reply:R(r,-32601,n?`This chat has no composer for a widget's words.`:`This chat takes no words from a widget.`)}:t.pressed?e===``?{reply:R(r,-32602,`The message has no words.`)}:n?{reply:L(r,{}),draft:e}:{reply:L(r,{}),send:e}:{reply:R(r,-32e3,`A widget sends words only when a person presses something in it.`)}}case`ui/open-link`:{let e=typeof o.url==`string`?o.url:``;return l?/^https:\/\/[^\s]+$/i.test(e)?t.pressed?{reply:L(r,{}),open:e}:{reply:R(r,-32e3,`A widget opens a link only when a person presses something in it.`)}:{reply:R(r,-32602,`A widget opens https links only.`)}:{}}case N:{let e=Number(o.wheel),t=Number(o.by);return Number.isFinite(e)&&e?{scrolled:{wheel:Math.max(-4e3,Math.min(4e3,e))}}:o.touch===`start`||o.touch===`end`?{scrolled:{touch:o.touch}}:o.touch===`move`&&Number.isFinite(t)?{scrolled:{touch:`move`,by:Math.max(-4e3,Math.min(4e3,t))}}:{}}case`notifications/message`:{let e=String(o.level),t=e===`debug`?`debug`:e===`info`||e===`notice`?`info`:e===`warning`?`warn`:`error`,n=typeof o.data==`string`?o.data:JSON.stringify(o.data??null);return{log:{level:t,text:String(n).slice(0,2048)}}}case`tools/call`:{if(!l)return{};if(!t.widget.app||!t.canCallServer)return{reply:R(r,-32601,`This widget has no server to call.`)};let e=c(o.name,200);return e?{callTool:{id:r,name:e,arguments:s(o.arguments)?o.arguments:{}}}:{reply:R(r,-32602,`A tool call names its tool.`)}}case`resources/read`:{if(!l)return{};if(!t.widget.app||!t.canCallServer)return{reply:R(r,-32601,`This widget has no server to read.`)};let e=c(o.uri,2e3);return e?{readResource:{id:r,uri:e}}:{reply:R(r,-32602,`A read names its resource.`)}}case P:{if(!l)return{};if(t.widget.app||!t.canReadContext)return{reply:R(r,-32601,`This widget reads no context.`)};let e=typeof o.path==`string`?o.path:``;if(!t.widget.contexts?.includes(e))return{reply:R(r,-32602,"This widget's fact does not name that context in `contexts`.")};let n=(e,t,n,r)=>typeof e==`number`&&Number.isFinite(e)?Math.min(Math.max(Math.floor(e),t),n):r;return{readContext:{id:r,context:e,after:n(o.after,0,2**53-1,0),limit:n(o.limit,1,500,200)}}}case`ui/update-model-context`:{if(!l)return{};if(!t.canModelContext)return{reply:R(r,-32601,`This chat takes no context from a widget.`)};let e=Array.isArray(o.content)?o.content.slice(0,20):[];return{reply:L(r,{}),modelContext:{content:e,structuredContent:o.structuredContent}}}case`ui/request-display-mode`:return l?{reply:L(r,{mode:`inline`})}:{};case`ping`:return l?{reply:L(r,{})}:{};default:return l?{reply:R(r,-32601,`This host does not offer ${i}.`)}:{}}}const W={"--color-background-primary":`--background`,"--color-background-secondary":`--muted`,"--color-text-primary":`--foreground`,"--color-text-secondary":`--muted-foreground`,"--color-border-primary":`--border`,"--color-ring-primary":`--ring`,"--border-radius-md":`--radius`};function G(e){if(!e||typeof getComputedStyle!=`function`)return{theme:`light`,variables:{}};let t=getComputedStyle(e),n={};for(let[e,r]of Object.entries(W)){let i=t.getPropertyValue(r).trim();i&&(n[e]=i)}return n[`--font-sans`]=t.fontFamily,{theme:e.closest(`.dark`)?`dark`:`light`,variables:n}}export{i as WIDGET_APP_HTML_MAX,F as WIDGET_CLIENT,P as WIDGET_CONTEXT_READ,f as WIDGET_CONTEXT_READ_MAX,t as WIDGET_FACT,o as WIDGET_HEIGHT_FIRST,a as WIDGET_HEIGHT_MAX,r as WIDGET_HTML_MAX,E as WIDGET_POLICY,N as WIDGET_SCROLLED,C as asksToReadContext,U as widgetAnswer,O as widgetCspSources,I as widgetDocument,w as widgetFold,y as widgetHtmlMax,H as widgetInput,T as widgetNamesContext,x as widgetOf,k as widgetPolicy,V as widgetResult,v as widgetServerHost,G as widgetThemeAt};
M files.json
@@ -1,5 +1,5 @@ { - "dist/agent-kind-view-frame.js": "sha256-CRfC/ySBMYTGj/Dl4WYvmJG6yU7Ehyg1dl8kWl4KNcc=", + "dist/agent-kind-view-frame.js": "sha256-YbWuLQWcLySmzYNH2tQyiBSw3bRqTSwgOozja1DTlcY=", "dist/agent-kind-view/dash-agents.mjs": "sha256-9bFiQNceby17zVcNg0htQJWYqCvNjwoqTzqe5is5o1E=", "dist/agent-kind-view/host.mjs": "sha256-/yrlwg3YDOk373Ejg8pD+BFpNDRgexd0zB0x92fh8uM=", "dist/change-my-mind.mjs": "sha256-aqmxIIjGQVYZsB+OK01AeFZiTGkcej/+PTMjNrvRAag=", @@ -160,7 +160,7 @@ "dist/components/ui/textarea.mjs": "sha256-bCkZ+PFtUM1WS4IEKut0imrHCuS3LQk3JbH6oJY6V4k=", "dist/components/ui/tooltip.mjs": "sha256-bg2Kdn00fYxg5lJO/gLXByEpcvkYBO3YNLrqKCBjdEI=", "dist/components/virtual-log/virtual-log.mjs": "sha256-RxRfYpVtqKm7/XEA18Pyybd+Avd2dt11WNb9DsGDpcw=", - "dist/components/widget/widget.mjs": "sha256-ZZ/6KktBG40SloZr13c9m0nNSEyHVvbcmqTVJcIYwUU=", + "dist/components/widget/widget.mjs": "sha256-zJBDhjGAHijldjUTPxuuLB+KVqzOENiWWFy8K0p20fM=", "dist/docs-editor.css": "sha256-5DOTnktX+ELxuypsNQXVh052bLHUt0M/FQIE+9EqQuI=", "dist/fonts/ubuntu-cyrillic-400-normal.woff2": "sha256-yGEScEVE9ZfUgUYleVNHvv/lFuFcZ51SsUMC7F4Um6c=", "dist/fonts/ubuntu-cyrillic-500-normal.woff2": "sha256-cUHi8cZE0hd1dJCUhMQw5OJUr32vfiolOkm66Szf09g=",
M release.json
@@ -1,7 +1,7 @@ { "package": "@iterate-com/ui", - "source": "600802a262087cbf7da88f8b09e88ba57ca93341", - "workspace": "0fdfb49d5231c9526b2d319fd07ee8c8fa65123b", + "source": "6a1d909ade0c4b13668ccfa3c06c4435547b404e", + "workspace": "362e4600343d1c57e4814c425dab0ea06ef90f63", "modules": 185, "rewritten": 518 }