@runtypelabs/persona 4.10.1 → 4.11.0

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.
Files changed (56) hide show
  1. package/dist/animations/glyph-cycle.d.cts +1 -1
  2. package/dist/animations/glyph-cycle.d.ts +1 -1
  3. package/dist/animations/{types-Bx_rvjff.d.cts → types-DveIaNx6.d.cts} +2 -0
  4. package/dist/animations/{types-Bx_rvjff.d.ts → types-DveIaNx6.d.ts} +2 -0
  5. package/dist/animations/wipe.d.cts +1 -1
  6. package/dist/animations/wipe.d.ts +1 -1
  7. package/dist/chunk-MMUPR2JW.js +1 -0
  8. package/dist/codegen.cjs +1 -1
  9. package/dist/codegen.js +1 -1
  10. package/dist/{context-mentions-7S5KVUTG.js → context-mentions-ONG7A7M6.js} +1 -1
  11. package/dist/context-mentions.d.cts +26 -0
  12. package/dist/context-mentions.d.ts +26 -0
  13. package/dist/index.cjs +67 -67
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +27 -1
  16. package/dist/index.d.ts +27 -1
  17. package/dist/index.global.js +55 -55
  18. package/dist/index.global.js.map +1 -1
  19. package/dist/index.js +78 -78
  20. package/dist/index.js.map +1 -1
  21. package/dist/smart-dom-reader.d.cts +26 -0
  22. package/dist/smart-dom-reader.d.ts +26 -0
  23. package/dist/theme-editor-preview.cjs +66 -66
  24. package/dist/theme-editor-preview.d.cts +26 -0
  25. package/dist/theme-editor-preview.d.ts +26 -0
  26. package/dist/theme-editor-preview.js +55 -55
  27. package/dist/theme-editor.cjs +5 -5
  28. package/dist/theme-editor.d.cts +26 -0
  29. package/dist/theme-editor.d.ts +26 -0
  30. package/dist/theme-editor.js +9 -9
  31. package/dist/widget.css +1 -1
  32. package/package.json +1 -1
  33. package/src/components/approval-bubble.ts +0 -1
  34. package/src/components/composer-parts.ts +19 -19
  35. package/src/components/context-mention-button.test.ts +5 -1
  36. package/src/components/context-mention-button.ts +6 -4
  37. package/src/components/header-builder.test.ts +3 -3
  38. package/src/components/header-parts.ts +14 -108
  39. package/src/components/message-bubble.test.ts +49 -0
  40. package/src/components/message-bubble.ts +8 -7
  41. package/src/components/reasoning-bubble.ts +0 -2
  42. package/src/components/tool-bubble.ts +0 -2
  43. package/src/generated/runtype-openapi-contract.ts +2 -0
  44. package/src/index-core.ts +1 -0
  45. package/src/styles/widget.css +118 -58
  46. package/src/theme-editor/sections.test.ts +33 -0
  47. package/src/theme-editor/sections.ts +10 -1
  48. package/src/types.ts +25 -0
  49. package/src/ui.attachments-drop.test.ts +2 -1
  50. package/src/ui.message-width.test.ts +407 -0
  51. package/src/ui.ts +145 -238
  52. package/src/utils/table-scroll-fade.test.ts +123 -0
  53. package/src/utils/table-scroll-fade.ts +75 -0
  54. package/src/utils/tooltip.test.ts +226 -0
  55. package/src/utils/tooltip.ts +245 -0
  56. package/dist/chunk-IPVK3KOM.js +0 -1
@@ -1,4 +1,4 @@
1
- import { S as StreamAnimationPlugin } from './types-Bx_rvjff.cjs';
1
+ import { S as StreamAnimationPlugin } from './types-DveIaNx6.cjs';
2
2
 
3
3
  declare const glyphCycle: StreamAnimationPlugin;
4
4
 
@@ -1,4 +1,4 @@
1
- import { S as StreamAnimationPlugin } from './types-Bx_rvjff.js';
1
+ import { S as StreamAnimationPlugin } from './types-DveIaNx6.js';
2
2
 
3
3
  declare const glyphCycle: StreamAnimationPlugin;
4
4
 
@@ -35,6 +35,7 @@ type RuntypeExecutionStreamEvent = ({
35
35
  input: number;
36
36
  output: number;
37
37
  };
38
+ totalTokensUsed?: number;
38
39
  type: "execution_complete";
39
40
  }) | ({
40
41
  blockReason?: string;
@@ -294,6 +295,7 @@ type RuntypeExecutionStreamEvent = ({
294
295
  stepId?: string;
295
296
  success: boolean;
296
297
  toolCallId: string;
298
+ toolCost?: number;
297
299
  toolName?: string;
298
300
  type: "tool_complete";
299
301
  } | {
@@ -35,6 +35,7 @@ type RuntypeExecutionStreamEvent = ({
35
35
  input: number;
36
36
  output: number;
37
37
  };
38
+ totalTokensUsed?: number;
38
39
  type: "execution_complete";
39
40
  }) | ({
40
41
  blockReason?: string;
@@ -294,6 +295,7 @@ type RuntypeExecutionStreamEvent = ({
294
295
  stepId?: string;
295
296
  success: boolean;
296
297
  toolCallId: string;
298
+ toolCost?: number;
297
299
  toolName?: string;
298
300
  type: "tool_complete";
299
301
  } | {
@@ -1,4 +1,4 @@
1
- import { S as StreamAnimationPlugin } from './types-Bx_rvjff.cjs';
1
+ import { S as StreamAnimationPlugin } from './types-DveIaNx6.cjs';
2
2
 
3
3
  declare const wipe: StreamAnimationPlugin;
4
4
 
@@ -1,4 +1,4 @@
1
- import { S as StreamAnimationPlugin } from './types-Bx_rvjff.js';
1
+ import { S as StreamAnimationPlugin } from './types-DveIaNx6.js';
2
2
 
3
3
  declare const wipe: StreamAnimationPlugin;
4
4
 
@@ -0,0 +1 @@
1
+ var zt=(e,t)=>{let n=document.createElement(e);return t&&(n.className=t),n};var Bt=()=>document.createDocumentFragment(),Ft=(e,t={},...n)=>{let o=document.createElement(e);if(t.className&&(o.className=t.className),t.text!==void 0&&(o.textContent=t.text),t.attrs)for(let[s,a]of Object.entries(t.attrs))o.setAttribute(s,a);if(t.style){let s=o.style,a=t.style;for(let c of Object.keys(a)){let l=a[c];l!=null&&(s[c]=l)}}let r=n.filter(s=>s!=null);return r.length>0&&o.append(...r),o},Kt=(...e)=>e.filter(Boolean).join(" ");import{Activity as A,ArrowDown as k,ArrowUp as P,ArrowUpRight as L,Bot as I,ChevronDown as R,ChevronUp as D,ChevronRight as H,ChevronLeft as O,Check as z,Clipboard as B,ClipboardCopy as F,CodeXml as K,Copy as W,File as U,FileCode as j,FileSpreadsheet as $,FileText as q,ImagePlus as V,Loader as X,LoaderCircle as G,Mic as _,Paperclip as Y,RefreshCw as Z,Search as J,Send as Q,ShieldAlert as ee,ShieldCheck as te,ShieldX as ne,Square as oe,ThumbsDown as re,ThumbsUp as ie,Upload as se,Volume2 as ae,X as le,User as ce,Mail as de,Phone as ue,Calendar as me,Clock as pe,Building as ge,MapPin as he,Lock as fe,Key as we,CreditCard as ye,AtSign as be,Hash as ve,Globe as xe,Link as Ce,CircleCheck as Se,CircleX as Ee,TriangleAlert as Te,Info as Me,Ban as Ne,Shield as Ae,ArrowLeft as ke,ArrowRight as Pe,ExternalLink as Le,Ellipsis as Ie,EllipsisVertical as Re,Menu as De,House as He,Plus as Oe,Minus as ze,Pencil as Be,Trash as Fe,Trash2 as Ke,Save as We,Download as Ue,Share as je,Funnel as $e,Settings as qe,RotateCw as Ve,Maximize as Xe,Minimize as Ge,ShoppingCart as _e,ShoppingBag as Ye,Package as Ze,Truck as Je,Tag as Qe,Gift as et,Receipt as tt,Wallet as nt,Store as ot,DollarSign as rt,Percent as it,Play as st,Pause as at,VolumeX as lt,Camera as ct,Image as dt,Film as ut,Headphones as mt,MessageCircle as pt,MessageSquare as gt,Bell as ht,Heart as ft,Star as wt,Eye as yt,EyeOff as bt,Bookmark as vt,CalendarDays as xt,History as Ct,Timer as St,Folder as Et,FolderOpen as Tt,Files as Mt,Sparkles as Nt,Zap as At,Sun as kt,Moon as Pt,Flag as Lt,Monitor as It,Smartphone as Rt}from"lucide";var Dt={activity:A,"arrow-down":k,"arrow-up":P,"arrow-up-right":L,bot:I,"chevron-down":R,"chevron-up":D,"chevron-right":H,"chevron-left":O,check:z,clipboard:B,"clipboard-copy":F,"code-xml":K,copy:W,file:U,"file-code":j,"file-spreadsheet":$,"file-text":q,"image-plus":V,loader:X,"loader-circle":G,mic:_,paperclip:Y,"refresh-cw":Z,search:J,send:Q,"shield-alert":ee,"shield-check":te,"shield-x":ne,square:oe,"thumbs-down":re,"thumbs-up":ie,upload:se,"volume-2":ae,x:le,user:ce,mail:de,phone:ue,calendar:me,clock:pe,building:ge,"map-pin":he,lock:fe,key:we,"credit-card":ye,"at-sign":be,hash:ve,globe:xe,link:Ce,"circle-check":Se,"circle-x":Ee,"triangle-alert":Te,info:Me,ban:Ne,shield:Ae,"arrow-left":ke,"arrow-right":Pe,"external-link":Le,ellipsis:Ie,"ellipsis-vertical":Re,menu:De,house:He,plus:Oe,minus:ze,pencil:Be,trash:Fe,"trash-2":Ke,save:We,download:Ue,share:je,funnel:$e,settings:qe,"rotate-cw":Ve,maximize:Xe,minimize:Ge,"shopping-cart":_e,"shopping-bag":Ye,package:Ze,truck:Je,tag:Qe,gift:et,receipt:tt,wallet:nt,store:ot,"dollar-sign":rt,percent:it,play:st,pause:at,"volume-x":lt,camera:ct,image:dt,film:ut,headphones:mt,"message-circle":pt,"message-square":gt,bell:ht,heart:ft,star:wt,eye:yt,"eye-off":bt,bookmark:vt,"calendar-days":xt,history:Ct,timer:St,folder:Et,"folder-open":Tt,files:Mt,sparkles:Nt,zap:At,sun:kt,moon:Pt,flag:Lt,monitor:It,smartphone:Rt},jt=(e,t=24,n="currentColor",o=2)=>{let r=Dt[e];return r?Ht(r,t,n,o):(console.warn(`Lucide icon "${e}" is not in the Persona registry. Add it to packages/widget/src/utils/icons.ts (see docs/icon-registry-shortlist.md).`),null)};function Ht(e,t,n,o){if(!Array.isArray(e))return null;let r=document.createElementNS("http://www.w3.org/2000/svg","svg");return r.setAttribute("width",String(t)),r.setAttribute("height",String(t)),r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("fill","none"),r.setAttribute("stroke",n),r.setAttribute("stroke-width",String(o)),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),r.setAttribute("aria-hidden","true"),e.forEach(s=>{if(!Array.isArray(s)||s.length<2)return;let a=s[0],c=s[1];if(!c)return;let l=document.createElementNS("http://www.w3.org/2000/svg",a);Object.entries(c).forEach(([h,f])=>{h!=="stroke"&&l.setAttribute(h,String(f))}),r.appendChild(l)}),r}function qt(e){let t={trigger:e.trigger??"@",position:e.triggerPosition??"anywhere",allowSpaces:!1,sources:Array.isArray(e.sources)?e.sources:[],searchPlaceholder:e.searchPlaceholder,showButton:e.showButton!==!1,buttonIconName:e.buttonIconName,buttonTooltipText:e.buttonTooltipText},n=(e.triggers??[]).map(o=>({trigger:o.trigger,position:o.triggerPosition??"anywhere",allowSpaces:o.allowSpaces??!1,sources:Array.isArray(o.sources)?o.sources:[],searchPlaceholder:o.searchPlaceholder,showButton:o.showButton===!0,buttonIconName:o.buttonIconName,buttonTooltipText:o.buttonTooltipText}));return[t,...n]}function T(e){let t=e.getRootNode?.();return t instanceof ShadowRoot||t instanceof Document?t:e.ownerDocument??document}function b(e,t,n){let o=e instanceof Document?e.head:e,r=t.replace(/["\\]/g,"\\$&");if(o.querySelector(`style[data-persona-plugin-style="${r}"]`))return;let a=(e instanceof Document?e:e.ownerDocument??document).createElement("style");a.setAttribute("data-persona-plugin-style",t),a.textContent=n,o.appendChild(a)}function Xt(e,t,n){if(e instanceof Document||e instanceof ShadowRoot){b(e,t,n);return}let o=e;if(o.isConnected){b(T(o),t,n);return}let r=o.ownerDocument??document;b(r,t,n),queueMicrotask(()=>{let s=T(o);s!==r&&b(s,t,n)})}function Ot(e){let t=e.getRootNode?.();return t instanceof ShadowRoot?t:(e.ownerDocument??document).body}function Gt(e){let{anchor:t,content:n,placement:o="bottom-start",offset:r=6,matchAnchorWidth:s=!1,horizontalOffset:a,verticalOffset:c,zIndex:l=2147483e3,onOpen:h,onDismiss:f}=e,M=e.container??Ot(t),d=!1,w=null,v=()=>{if(!d)return;let i=t.getBoundingClientRect();n.style.position="fixed",s&&(n.style.minWidth=`${i.width}px`),a&&(n.style.maxWidth=`${i.width}px`);let m=n.getBoundingClientRect(),u=c?.()??null,y=u!=null?i.top+u:i.top,x=o==="top-start"||o==="top-end"?y-r-m.height:i.bottom+r,g=o==="bottom-end"||o==="top-end"?i.right-m.width:i.left,E=a?.()??null;if(E!=null){let N=Math.max(i.left,i.right-m.width);g=Math.min(Math.max(i.left+E,i.left),N)}n.style.top=`${x}px`,n.style.left=`${g}px`},p=()=>{d&&(d=!1,w&&(w(),w=null),n.remove())},S=()=>{if(d)return;d=!0,l!=null&&(n.style.zIndex=String(l)),M.appendChild(n),v();let i=(t.ownerDocument??document).defaultView??window,m=t.ownerDocument??document,u=()=>{if(!t.isConnected){p(),f?.("anchor-removed");return}v()},y=C=>{let g=typeof C.composedPath=="function"?C.composedPath():[];g.includes(n)||g.includes(t)||(p(),f?.("outside"))},x=i.setTimeout(()=>{m.addEventListener("pointerdown",y,!0)},0);i.addEventListener("scroll",u,!0),i.addEventListener("resize",u),w=()=>{i.clearTimeout(x),m.removeEventListener("pointerdown",y,!0),i.removeEventListener("scroll",u,!0),i.removeEventListener("resize",u)},h?.()};return{get isOpen(){return d},open:S,close:p,toggle:()=>d?p():S(),reposition:v,destroy:p}}function _t(e){return(typeof e.composedPath=="function"?e.composedPath():[]).some(n=>n instanceof HTMLElement&&(n.tagName==="INPUT"||n.tagName==="TEXTAREA"||n.isContentEditable))}export{zt as a,Bt as b,Ft as c,Kt as d,jt as e,qt as f,Xt as g,Gt as h,_t as i};
package/dist/codegen.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var $=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var T=(e,r)=>{for(var n in r)$(e,n,{get:r[n],enumerable:!0})},M=(e,r,n,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of I(r))!_.call(e,a)&&a!==n&&$(e,a,{get:()=>r[a],enumerable:!(s=v(r,a))||s.enumerable});return e};var R=e=>M($({},"__esModule",{value:!0}),e);var U={};T(U,{generateCodeSnippet:()=>k});module.exports=R(U);var x="4.10.1";var c=x;function u(e){if(e!==void 0)return typeof e=="string"?e:Array.isArray(e)?`[${e.map(r=>r.toString()).join(", ")}]`:e.toString()}function H(e){if(e)return{getHeaders:u(e.getHeaders),onFeedback:u(e.onFeedback),onCopy:u(e.onCopy),requestMiddleware:u(e.requestMiddleware),actionHandlers:u(e.actionHandlers),actionParsers:u(e.actionParsers),postprocessMessage:u(e.postprocessMessage),contextProviders:u(e.contextProviders),streamParser:u(e.streamParser)}}var S=`({ text, message }: any) => {
1
+ "use strict";var $=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var T=(e,r)=>{for(var n in r)$(e,n,{get:r[n],enumerable:!0})},M=(e,r,n,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of I(r))!_.call(e,a)&&a!==n&&$(e,a,{get:()=>r[a],enumerable:!(s=v(r,a))||s.enumerable});return e};var R=e=>M($({},"__esModule",{value:!0}),e);var U={};T(U,{generateCodeSnippet:()=>k});module.exports=R(U);var x="4.11.0";var c=x;function u(e){if(e!==void 0)return typeof e=="string"?e:Array.isArray(e)?`[${e.map(r=>r.toString()).join(", ")}]`:e.toString()}function H(e){if(e)return{getHeaders:u(e.getHeaders),onFeedback:u(e.onFeedback),onCopy:u(e.onCopy),requestMiddleware:u(e.requestMiddleware),actionHandlers:u(e.actionHandlers),actionParsers:u(e.actionParsers),postprocessMessage:u(e.postprocessMessage),contextProviders:u(e.contextProviders),streamParser:u(e.streamParser)}}var S=`({ text, message }: any) => {
2
2
  const jsonSource = (message as any).rawContent || text || message.content;
3
3
  if (!jsonSource || typeof jsonSource !== 'string') return null;
4
4
  let cleanJson = jsonSource
package/dist/codegen.js CHANGED
@@ -1,4 +1,4 @@
1
- var w="4.10.1";var c=w;function u(e){if(e!==void 0)return typeof e=="string"?e:Array.isArray(e)?`[${e.map(i=>i.toString()).join(", ")}]`:e.toString()}function P(e){if(e)return{getHeaders:u(e.getHeaders),onFeedback:u(e.onFeedback),onCopy:u(e.onCopy),requestMiddleware:u(e.requestMiddleware),actionHandlers:u(e.actionHandlers),actionParsers:u(e.actionParsers),postprocessMessage:u(e.postprocessMessage),contextProviders:u(e.contextProviders),streamParser:u(e.streamParser)}}var x=`({ text, message }: any) => {
1
+ var w="4.11.0";var c=w;function u(e){if(e!==void 0)return typeof e=="string"?e:Array.isArray(e)?`[${e.map(i=>i.toString()).join(", ")}]`:e.toString()}function P(e){if(e)return{getHeaders:u(e.getHeaders),onFeedback:u(e.onFeedback),onCopy:u(e.onCopy),requestMiddleware:u(e.requestMiddleware),actionHandlers:u(e.actionHandlers),actionParsers:u(e.actionParsers),postprocessMessage:u(e.postprocessMessage),contextProviders:u(e.contextProviders),streamParser:u(e.streamParser)}}var x=`({ text, message }: any) => {
2
2
  const jsonSource = (message as any).rawContent || text || message.content;
3
3
  if (!jsonSource || typeof jsonSource !== 'string') return null;
4
4
  let cleanJson = jsonSource
@@ -1,4 +1,4 @@
1
- import{a as S,d as C,f as N,g as X,h as J,i as Z}from"./chunk-IPVK3KOM.js";import{b as ee}from"./chunk-UPO4GUFC.js";import{a as _,c as Y}from"./chunk-IO5VVUKP.js";function te(s){let{ref:e,config:t,onRemove:n}=s;if(t.renderMentionChip){let u="resolving",A,T=t.renderMentionChip({ref:e,status:u,payload:A,remove:n});return{get el(){return T},setStatus:(z,E)=>{if(z===u&&E===A)return;u=z,A=E;let B=t.renderMentionChip({ref:e,status:u,payload:A,remove:n});T.replaceWith(B),T=B}}}let i=e.iconName??t.chipIconName??"at-sign",o=C("div",{className:"persona-mention-chip",attrs:{"data-persona-mention-chip":"","data-status":"resolving",title:e.label}}),r=S("span","persona-mention-chip-icon"),d=u=>{r.replaceChildren();let A=N(u,13,"currentColor",2);A&&r.appendChild(A)};d(i);let a=S("span","persona-mention-chip-spinner"),l=C("span",{className:"persona-mention-chip-label",text:e.label}),x=C("button",{className:"persona-mention-chip-remove",attrs:{type:"button","aria-label":`Remove ${e.label} context`}}),p=N("x",11,"currentColor",2.5);return p?x.appendChild(p):x.textContent="\xD7",x.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),n()}),o.appendChild(a),o.appendChild(l),o.appendChild(x),{el:o,setStatus:u=>{o.setAttribute("data-status",u),u==="resolving"?(a.parentNode!==o&&o.insertBefore(a,l),r.parentNode===o&&r.remove(),o.setAttribute("title",e.label)):(a.parentNode===o&&a.remove(),r.parentNode!==o&&o.insertBefore(r,l),u==="error"?(d("triangle-alert"),o.setAttribute("title",`Couldn't add ${e.label} to context`)):(d(i),o.setAttribute("title",e.label)))}}}function ce(s){let e=0;for(let t of s.split(`
1
+ import{a as S,c as C,e as N,f as X,g as J,h as Z}from"./chunk-MMUPR2JW.js";import{b as ee}from"./chunk-UPO4GUFC.js";import{a as _,c as Y}from"./chunk-IO5VVUKP.js";function te(s){let{ref:e,config:t,onRemove:n}=s;if(t.renderMentionChip){let u="resolving",A,T=t.renderMentionChip({ref:e,status:u,payload:A,remove:n});return{get el(){return T},setStatus:(z,E)=>{if(z===u&&E===A)return;u=z,A=E;let B=t.renderMentionChip({ref:e,status:u,payload:A,remove:n});T.replaceWith(B),T=B}}}let i=e.iconName??t.chipIconName??"at-sign",o=C("div",{className:"persona-mention-chip",attrs:{"data-persona-mention-chip":"","data-status":"resolving",title:e.label}}),r=S("span","persona-mention-chip-icon"),d=u=>{r.replaceChildren();let A=N(u,13,"currentColor",2);A&&r.appendChild(A)};d(i);let a=S("span","persona-mention-chip-spinner"),l=C("span",{className:"persona-mention-chip-label",text:e.label}),x=C("button",{className:"persona-mention-chip-remove",attrs:{type:"button","aria-label":`Remove ${e.label} context`}}),p=N("x",11,"currentColor",2.5);return p?x.appendChild(p):x.textContent="\xD7",x.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),n()}),o.appendChild(a),o.appendChild(l),o.appendChild(x),{el:o,setStatus:u=>{o.setAttribute("data-status",u),u==="resolving"?(a.parentNode!==o&&o.insertBefore(a,l),r.parentNode===o&&r.remove(),o.setAttribute("title",e.label)):(a.parentNode===o&&a.remove(),r.parentNode!==o&&o.insertBefore(r,l),u==="error"?(d("triangle-alert"),o.setAttribute("title",`Couldn't add ${e.label} to context`)):(d(i),o.setAttribute("title",e.label)))}}}function ce(s){let e=0;for(let t of s.split(`
2
2
  `)){let n=/^ {0,3}(`+)/.exec(t);n&&n[1].length>e&&(e=n[1].length)}return e}function Q(s,e){let t="`".repeat(Math.max(3,ce(e)+1));return`${t}${s}
3
3
  ${e}
4
4
  ${t}`}function de(s,e,t){return e.includes("</document_content>")?Q(s,e):`<document index="${t+1}">
@@ -864,6 +864,7 @@ type RuntypeExecutionStreamEvent = ({
864
864
  input: number;
865
865
  output: number;
866
866
  };
867
+ totalTokensUsed?: number;
867
868
  type: "execution_complete";
868
869
  }) | ({
869
870
  blockReason?: string;
@@ -1123,6 +1124,7 @@ type RuntypeExecutionStreamEvent = ({
1123
1124
  stepId?: string;
1124
1125
  success: boolean;
1125
1126
  toolCallId: string;
1127
+ toolCost?: number;
1126
1128
  toolName?: string;
1127
1129
  type: "tool_complete";
1128
1130
  } | {
@@ -4825,6 +4827,26 @@ type AgentWidgetTimestampConfig = {
4825
4827
  /** Custom formatter for timestamp display */
4826
4828
  format?: (date: Date) => string;
4827
4829
  };
4830
+ /**
4831
+ * Width configuration for one message role.
4832
+ *
4833
+ * `content` shrink-wraps the rendered message up to `maxWidth`; `full` fills
4834
+ * the available transcript track up to `maxWidth`. The track already accounts
4835
+ * for transcript padding and, when present, the avatar and its gap.
4836
+ */
4837
+ type AgentWidgetMessageRoleLayout = {
4838
+ /**
4839
+ * Message width behavior.
4840
+ * - content: size to the rendered content (the backward-compatible default)
4841
+ * - full: fill the available transcript track
4842
+ */
4843
+ width?: "content" | "full";
4844
+ /**
4845
+ * Optional CSS max-width (for example "80%", "42rem", or "72ch").
4846
+ * Defaults to "85%" for content width and "100%" for full width.
4847
+ */
4848
+ maxWidth?: string;
4849
+ };
4828
4850
  /**
4829
4851
  * Message layout configuration
4830
4852
  * Allows customization of how chat messages are displayed
@@ -4843,6 +4865,10 @@ type AgentWidgetMessageLayoutConfig = {
4843
4865
  timestamp?: AgentWidgetTimestampConfig;
4844
4866
  /** Group consecutive messages from the same role */
4845
4867
  groupConsecutive?: boolean;
4868
+ /** Width behavior for user-authored message rows */
4869
+ user?: AgentWidgetMessageRoleLayout;
4870
+ /** Width behavior for assistant-authored message rows and assistant UI variants */
4871
+ assistant?: AgentWidgetMessageRoleLayout;
4846
4872
  /**
4847
4873
  * Custom renderer for user messages
4848
4874
  * When provided, replaces the default user message rendering
@@ -864,6 +864,7 @@ type RuntypeExecutionStreamEvent = ({
864
864
  input: number;
865
865
  output: number;
866
866
  };
867
+ totalTokensUsed?: number;
867
868
  type: "execution_complete";
868
869
  }) | ({
869
870
  blockReason?: string;
@@ -1123,6 +1124,7 @@ type RuntypeExecutionStreamEvent = ({
1123
1124
  stepId?: string;
1124
1125
  success: boolean;
1125
1126
  toolCallId: string;
1127
+ toolCost?: number;
1126
1128
  toolName?: string;
1127
1129
  type: "tool_complete";
1128
1130
  } | {
@@ -4825,6 +4827,26 @@ type AgentWidgetTimestampConfig = {
4825
4827
  /** Custom formatter for timestamp display */
4826
4828
  format?: (date: Date) => string;
4827
4829
  };
4830
+ /**
4831
+ * Width configuration for one message role.
4832
+ *
4833
+ * `content` shrink-wraps the rendered message up to `maxWidth`; `full` fills
4834
+ * the available transcript track up to `maxWidth`. The track already accounts
4835
+ * for transcript padding and, when present, the avatar and its gap.
4836
+ */
4837
+ type AgentWidgetMessageRoleLayout = {
4838
+ /**
4839
+ * Message width behavior.
4840
+ * - content: size to the rendered content (the backward-compatible default)
4841
+ * - full: fill the available transcript track
4842
+ */
4843
+ width?: "content" | "full";
4844
+ /**
4845
+ * Optional CSS max-width (for example "80%", "42rem", or "72ch").
4846
+ * Defaults to "85%" for content width and "100%" for full width.
4847
+ */
4848
+ maxWidth?: string;
4849
+ };
4828
4850
  /**
4829
4851
  * Message layout configuration
4830
4852
  * Allows customization of how chat messages are displayed
@@ -4843,6 +4865,10 @@ type AgentWidgetMessageLayoutConfig = {
4843
4865
  timestamp?: AgentWidgetTimestampConfig;
4844
4866
  /** Group consecutive messages from the same role */
4845
4867
  groupConsecutive?: boolean;
4868
+ /** Width behavior for user-authored message rows */
4869
+ user?: AgentWidgetMessageRoleLayout;
4870
+ /** Width behavior for assistant-authored message rows and assistant UI variants */
4871
+ assistant?: AgentWidgetMessageRoleLayout;
4846
4872
  /**
4847
4873
  * Custom renderer for user messages
4848
4874
  * When provided, replaces the default user message rendering