@useago/sdk 1.12.0 → 1.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +111 -4
  2. package/README.md +73 -0
  3. package/dist/angular.cjs +1 -1
  4. package/dist/angular.d.cts +140 -38
  5. package/dist/angular.d.ts +140 -38
  6. package/dist/angular.js +7 -4
  7. package/dist/autoContinue-C3UsCvT5.cjs +1 -0
  8. package/dist/{autoContinue-CC8K9mBU.js → autoContinue-Cb4_iEbO.js} +1 -1
  9. package/dist/{createConversationSession-B1Qn-y0I.js → createConversationSession-D0vks-8C.js} +1 -1
  10. package/dist/{createConversationSession-B3v_xOU7.cjs → createConversationSession-Ri3EKIJU.cjs} +1 -1
  11. package/dist/{createFormCollector-m79zk_NA.js → createFormCollector-BMN-blXs.js} +1 -1
  12. package/dist/{createFormCollector-FvwDOqnV.cjs → createFormCollector-BNCMIUw2.cjs} +1 -1
  13. package/dist/createMockClient-BPt1gSve.cjs +1 -0
  14. package/dist/{createMockClient-Beao82tu.js → createMockClient-YoYr3pQr.js} +1 -0
  15. package/dist/devtools.cjs +4 -4
  16. package/dist/devtools.d.cts +129 -33
  17. package/dist/devtools.d.ts +129 -33
  18. package/dist/devtools.js +87 -84
  19. package/dist/helpers.d.cts +42 -12
  20. package/dist/helpers.d.ts +42 -12
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.d.cts +135 -40
  23. package/dist/index.d.ts +135 -40
  24. package/dist/index.js +44 -43
  25. package/dist/react.cjs +4 -4
  26. package/dist/react.d.cts +187 -34
  27. package/dist/react.d.ts +187 -34
  28. package/dist/react.js +822 -729
  29. package/dist/speechToText-BV7qxqPF.js +704 -0
  30. package/dist/speechToText-ZciRyyJE.cjs +1 -0
  31. package/dist/testing.cjs +1 -1
  32. package/dist/testing.d.cts +129 -33
  33. package/dist/testing.d.ts +129 -33
  34. package/dist/testing.js +1 -1
  35. package/dist/types-Ck3iZG0K.cjs +10 -0
  36. package/dist/{types-Ct1hlKwg.js → types-fX-VoHfa.js} +1042 -759
  37. package/dist/vue.cjs +1 -1
  38. package/dist/vue.d.cts +143 -35
  39. package/dist/vue.d.ts +143 -35
  40. package/dist/vue.js +133 -131
  41. package/dist/widget.cjs +6 -6
  42. package/dist/widget.d.cts +161 -33
  43. package/dist/widget.d.ts +161 -33
  44. package/dist/widget.js +1702 -1757
  45. package/llms-full.txt +166 -1
  46. package/package.json +1 -1
  47. package/dist/autoContinue-CP9pJR-V.cjs +0 -1
  48. package/dist/createMockClient-BEOXI8yW.cjs +0 -1
  49. package/dist/sheetController-BThJRtOu.cjs +0 -1
  50. package/dist/sheetController-aEKXIvjk.js +0 -343
  51. package/dist/types-mcW8vB1U.cjs +0 -10
@@ -0,0 +1 @@
1
+ var k=new WeakMap,ae=["position","top","left","right","width"];function W(e,t){return t.map(r=>({style:e,prop:r,value:e.getPropertyValue(r),priority:e.getPropertyPriority(r)}))}function ie(e){for(const{style:t,prop:r,value:n,priority:o}of e)n?t.setProperty(r,n,o):t.removeProperty(r)}function ue(e,t=document){const r=k.get(t);if(r){r.owners.add(e);return}const n=t.body,o=t.documentElement,u=t.defaultView?.scrollY??0;k.set(t,{owners:new Set([e]),saved:[...W(n.style,ae),...W(o.style,["overflow"])],scrollY:u}),n.style.position="fixed",n.style.top=`-${u}px`,n.style.left="0",n.style.right="0",n.style.width="100%",o.style.overflow="hidden"}function ce(e,t=document){const r=k.get(t);!r||!r.owners.delete(e)||r.owners.size>0||(k.delete(t),ie(r.saved),t.defaultView?.scrollTo(0,r.scrollY))}function se(e,t){const r=e.replace("#",""),n=Number.parseInt(r.substring(0,2),16),o=Number.parseInt(r.substring(2,4),16),u=Number.parseInt(r.substring(4,6),16),a=s=>Math.min(255,Math.round(s+(255-s)*(t/100))),c=s=>s.toString(16).padStart(2,"0");return`#${c(a(n))}${c(a(o))}${c(a(u))}`}function le(e){return/^#?[0-9A-F]{6}$/i.test(e)}function de(e,t,r){const n=(1-Math.abs(2*r-1))*t,o=(e%360+360)%360/60,u=o|0,a=n*(1-Math.abs(o%2-1)),[c,s,h]=[[n,a,0],[a,n,0],[0,n,a],[0,a,n],[a,0,n],[n,0,a]][u],y=r-n/2;return[Math.round((c+y)*255),Math.round((s+y)*255),Math.round((h+y)*255)]}function fe(e){const t=e.trim(),r=/^hsla?\(\s*([\d.-]+)(?:deg)?[\s,]+([\d.]+)%[\s,]+([\d.]+)%/i.exec(t);if(r){const[a,c,s]=r.slice(1,4).map(Number);return[a,c,s].some(Number.isNaN)?null:de(a,Math.min(c,100)/100,Math.min(s,100)/100)}const n=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(t);if(n){const a=n.slice(1,4).map(Number);return a.some(c=>Number.isNaN(c)||c<0||c>255)?null:a}const o=t.replace("#",""),u=o.length===3?o.split("").map(a=>a+a).join(""):o;return/^[0-9a-f]{6}$/i.test(u)?[Number.parseInt(u.substring(0,2),16),Number.parseInt(u.substring(2,4),16),Number.parseInt(u.substring(4,6),16)]:null}function z(e){const t=fe(e);if(!t)return null;const[r,n,o]=t.map(u=>{const a=u/255;return a<=.03928?a/12.92:((a+.055)/1.055)**2.4});return .2126*r+.7152*n+.0722*o}function be(e,t){const r=z(e),n=z(t);return r===null||n===null?null:(Math.max(r,n)+.05)/(Math.min(r,n)+.05)}var ge=/(?:repeating-)?(?:linear|radial|conic)-gradient\(/i;function pe(e){return!!e&&ge.test(e)}function me(e){return e.match(/#[0-9a-f]{3,8}|(?:rgba?|hsla?)\([^()]*\)|\btransparent\b/gi)??[]}function he(e){const t=e.trim().toLowerCase();if(t==="transparent")return!0;const r=/\/\s*([\d.]+)%?\s*\)$/.exec(t);if(r)return Number.parseFloat(r[1])===0;const n=/^(?:rgba|hsla)\([^)]*,\s*([\d.]+)%?\s*\)$/.exec(t);if(n)return Number.parseFloat(n[1])===0;if(!t.startsWith("#"))return!1;const o=t.slice(1);return/^[0-9a-f]+$/.test(o)?o.length===8?o.slice(6)==="00":o.length===4?o[3]==="0":!1:!1}var j="#FFFFFF",ve="#000000",ye="#FFFFFF";function Y(e){if(!e)return j;const t=pe(e)?me(e):[e],r=(t.some(he)?[...t,ye]:t).map(n=>be(n,j)).filter(n=>n!==null);return r.length&&Math.min(...r)<3?ve:j}var Ee='"IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',H=`var(--ago-font, ${Ee})`,$={font:"--ago-font",radius:"--ago-radius",messageRadius:"--ago-message-radius",brand:"--ago-brand-color",brandText:"--ago-brand-text-color",headerBg:"--ago-header-background",headerText:"--ago-header-text-color",panelBg:"--ago-panel-background",messagesBg:"--ago-messages-background",text:"--ago-text-color",mutedText:"--ago-muted-text-color",border:"--ago-border-color",accent:"--ago-accent-color",agentBubbleBg:"--ago-agent-bubble-background",agentBubbleText:"--ago-agent-bubble-text-color",userBubbleBg:"--ago-user-bubble-background",userBubbleText:"--ago-user-bubble-text-color",launcherBg:"--ago-launcher-background",launcherText:"--ago-launcher-text-color",sendBg:"--ago-send-button-background",panelWidth:"--ago-panel-width"},Q="var(--ago-brand-color, #03182f)",Oe="var(--ago-brand-text-color, #fff)",Ae="var(--ago-header-background, var(--ago-brand-color, #03182f))",Ce="var(--ago-header-text-color, #e8f0fe)",Te="var(--ago-panel-background, #fff)",xe="var(--ago-messages-background, #fbfbfb)",Me="var(--ago-text-color, #30373e)",Z="var(--ago-muted-text-color, #6b6d6f)",Re="var(--ago-border-color, #dee3e8)",_e="var(--ago-accent-color, #1b5fc4)",Se="var(--ago-agent-bubble-background, #f1f3f5)",U="var(--ago-radius, 16px)",Be="var(--ago-message-radius, 16px)",Pe="var(--ago-message-radius, 20px)",De="var(--ago-launcher-background, #007bff)",we="var(--ago-launcher-text-color, #fff)",Ne="var(--ago-send-button-background, var(--ago-brand-color, #03182f))",Ie="var(--ago-user-bubble-background, #fff)",Le="var(--ago-user-bubble-text-color, #0a0a0a)",je="var(--ago-agent-bubble-text-color, var(--ago-text-color, #30373e))",ke="var(--ago-panel-background, #f8faff)",He="var(--ago-accent-color, #003edf)",Ue="#e3edff",Fe="#e5e5e5",qe="var(--ago-border-color, #e4e4e7)",Ze="var(--ago-muted-text-color, #71717a)",Ge="var(--ago-panel-width, 550px)",Xe="0 1px 2px 0 rgba(0,0,0,0.05)",Ke="0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1)",We="0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)",ze="rgba(15, 15, 15, 0.16) 0px 5px 40px 0px";function $e(e,t){if(t)for(const r of Object.keys($)){const n=t[r];n!=null&&e.style.setProperty($[r],n)}}function Ve(e){if(!e)return{};const t={};return e.button&&(t.launcherBg=e.button,t.sendBg=e.button),e.header&&(t.headerBg=e.header,t.headerText=Y(e.header)),e.agentMessage&&(t.agentBubbleBg=e.agentMessage),e.agentMessageFont&&(t.agentBubbleText=e.agentMessageFont),e.background&&(t.panelBg=e.background,t.messagesBg=e.background),e.font&&(t.text=e.font),e.userMessage&&(t.userBubbleBg=e.userMessage),e.userMessageFont&&(t.userBubbleText=e.userMessageFont),t}function D(e,t){Object.assign(e.style,t)}function F(e={}){const t=document.createElement("div");return D(t,e),t}var V="ago-chat-widget-keyframes";function Ye(){if(typeof document>"u"||document.getElementById(V))return;const e=document.createElement("style");e.id=V,e.textContent="@keyframes ago-pulse { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }@keyframes ago-spin { to { transform: rotate(360deg); } }@keyframes ago-scale-in { 50% { transform: translateX(-10px) translateY(-5px) scale(1.1); } }@keyframes ago-appear { 0%, 98% { opacity: 0; } 100% { opacity: 1; } }@keyframes ago-skeleton-pulse { 50% { opacity: 0.5; } }.ago-chat-input--embed textarea::placeholder { font-style: italic; color: #9ca3af; opacity: 1; }",document.head.appendChild(e)}var Qe="2147483000";function Je(e,t="0px"){return e===void 0?t:typeof e=="number"?`${e}px`:e}function J(e){return`(max-width: ${e}px), (max-height: 500px) and (orientation: landscape)`}function et(e={}){const t=e.breakpoint??768,r=e.peekHeight??152,n=Je(e.bottomOffset),o=e.initialState??"peek",u=new Set;let a=o,c=!1;const s=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(J(t)):void 0;let h=d();const y=f(!1,o);function E(l,T){if(!l)return{style:{},attrs:{role:null,"aria-modal":null,"aria-label":null}};const x={position:"fixed",left:"0",right:"0",bottom:n,zIndex:Qe,display:"flex",flexDirection:"column",borderRadius:T==="full"?"0":`${U} ${U} 0 0`,paddingBottom:"env(safe-area-inset-bottom)"};return T==="full"?{style:{...x,top:"0",height:"auto",paddingTop:"env(safe-area-inset-top)"},attrs:{role:"dialog","aria-modal":"true",tabindex:"-1"}}:{style:{...x,top:"auto",minHeight:`calc(${r}px + env(safe-area-inset-bottom))`,height:"auto"},attrs:{role:null,"aria-modal":null,tabindex:"-1"}}}function f(l,T){return{compact:l,state:T,isModal:l&&T==="full",surface:E(l,T)}}function d(){return f(!!s?.matches,a)}function g(){h=d();for(const l of u)l()}function p(l,T){c||a===l||(a=l,g(),e.onStateChange?.(l,T))}function v(){if(!c){if(!s?.matches&&a!==o){a=o,g(),e.onStateChange?.(o,"breakpoint");return}g()}}let O=!1;function M(){O||!s||(s.addEventListener("change",v),O=!0,h=d())}function A(){!O||!s||(s.removeEventListener("change",v),O=!1)}return{subscribe(l){return u.add(l),u.size===1&&M(),()=>{u.delete(l),u.size===0&&A()}},getSnapshot:()=>h,getServerSnapshot:()=>y,expand:(l="api")=>p("full",l),collapse:(l="api")=>p("peek",l),toggle:(l="api")=>p(a==="full"?"peek":"full",l),destroy(){c||(c=!0,A(),u.clear())}}}var I="http://www.w3.org/2000/svg";function tt(e={}){return P(["M9 5a3 3 0 0 1 6 0v7a3 3 0 0 1-6 0Z","M5 10v2a7 7 0 0 0 14 0v-2M12 19v3M8 22h8"],e)}function rt(e={}){return P(["M5 12l4 4L19 6"],e)}function nt(e={}){return P(["M21 12a9 9 0 1 1-6.219-8.56"],e)}function L(e,t,r){const n=document.createElementNS(I,"svg");return n.setAttribute("xmlns",I),n.setAttribute("viewBox",e),n.setAttribute("width",String(t)),n.setAttribute("height",String(t)),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),n.style.flexShrink="0",n.style.display="block",r&&n.setAttribute("class",r),n}function w(e,t){const r=document.createElementNS(I,"path");return r.setAttribute("d",e),r.setAttribute("fill","currentColor"),t&&r.setAttribute("data-ago-path",t),r}function C(e,t={}){const r=L("0 -960 960 960",t.size??24,t.className);return r.appendChild(w(e)),r}function P(e,t={}){const r=L("0 0 24 24",t.size??24,t.className);r.setAttribute("fill","none"),r.setAttribute("stroke","currentColor"),r.setAttribute("stroke-width",String(t.strokeWidth??2)),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round");for(const n of e){const o=document.createElementNS(I,"path");o.setAttribute("d",n),r.appendChild(o)}return r}var ot="M240-400h480v-80H240v80Zm0-120h480v-80H240v80Zm0-120h480v-80H240v80ZM880-80 720-240H160q-33 0-56.5-23.5T80-320v-480q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v720ZM160-320h594l46 45v-525H160v480Zm0 0v-480 480Z",ee="M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z";function at(){const e=L("0 -960 960 960",48);return e.appendChild(w(ot,"open")),e.appendChild(w(ee,"close")),e}function it(){const e=L("0 -960 960 960",48);return e.appendChild(w(ee,"close")),e}function ut(e){return C("M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z",e)}function ct(e){return C("M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z",e)}function te(e){return C("m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z",e)}function st(e){return C("M440-400h80v-120h120v-80H520v-120h-80v120H320v80h120v120ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z",e)}function lt(e){return C("M440-160v-487L216-423l-56-57 320-320 320 320-56 57-224-224v487h-80Z",e)}function dt(e){return C("M440-800v487L216-537l-56 57 320 320 320-320-56-57-224 224v-487h-80Z",e)}function ft(e){return C("M240-240v-480h480v480H240Z",e)}function bt(e){return C("M720-120H280v-520l280-280 50 50q7 7 11.5 19t4.5 23v14l-44 174h258q32 0 56 24t24 56v80q0 7-2 15t-4 15L794-168q-9 20-30 34t-44 14Zm-360-80h360l120-280v-80H480l54-220-174 174v406Zm0-406v406-406Zm-80-34v80H160v360h120v80H80v-520h200Z",e)}function gt(e){return C("M240-840h440v520L400-40l-50-50q-7-7-11.5-19t-4.5-23v-14l44-174H120q-32 0-56-24t-24-56v-80q0-7 2-15t4-15l120-282q9-20 30-34t44-14Zm360 80H240L120-480v80h360l-54 220 174-174v-406Zm0 406v-406 406Zm80 34v-80h120v-360H680v-80h200v520H680Z",e)}function pt(e){return C("M320-240h320v-80H320v80Zm0-160h320v-80H320v80ZM240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm280-520v-200H240v640h480v-440H520ZM240-800v200-200 640-640Z",e)}function mt(e){return C("M480-320 280-520l56-58 104 104v-326h80v326l104-104 56 58-200 200ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z",e)}function ht(e){return C("M720-330q0 104-73 177T470-80q-104 0-177-73t-73-177v-370q0-75 52.5-127.5T400-880q75 0 127.5 52.5T580-700v350q0 46-32 78t-78 32q-46 0-78-32t-32-78v-370h80v370q0 13 8.5 21.5T470-320q13 0 21.5-8.5T500-350v-350q-1-42-29.5-71T400-800q-42 0-71 29t-29 71v370q-1 71 49 120.5T470-160q70 0 119-49.5T640-330v-390h80v390Z",e)}function vt(e){return P(["M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8","M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"],{...e,strokeWidth:1.5})}function yt(e){return P(["M7 7h10v10","M7 17 17 7"],e)}function Et(e){const t=P(["M12 8v4","M12 16h.01"],e),r=document.createElementNS(I,"circle");return r.setAttribute("cx","12"),r.setAttribute("cy","12"),r.setAttribute("r","10"),t.insertBefore(r,t.firstChild),t}function Ot(e){return P(["M12 3v3m6.366-.366-2.12 2.12M21 12h-3m.366 6.366-2.12-2.12M12 21v-3m-6.366.366 2.12-2.12M3 12h3m-.366-6.366 2.12 2.12"],{size:20,...e,strokeWidth:1.5})}function At(e){const t=L("0 0 24 24",e?.size??24,e?.className);return t.setAttribute("fill","none"),t.appendChild(w("M21.5166 5.68457C21.5166 5.43995 21.4185 5.20337 21.2402 5.02734C21.0616 4.85106 20.8173 4.75009 20.5605 4.75H6.90723C6.65037 4.75 6.40524 4.85098 6.22656 5.02734C6.04838 5.20336 5.9502 5.44001 5.9502 5.68457V19.0518L7.58691 17.4365C8.04823 16.9811 8.67203 16.7267 9.32031 16.7266H20.5605C20.8173 16.7265 21.0616 16.6255 21.2402 16.4492C21.4185 16.2732 21.5166 16.0366 21.5166 15.792V5.68457ZM23.0166 15.792C23.0166 16.4408 22.7556 17.0608 22.2939 17.5166C21.8326 17.972 21.2088 18.2265 20.5605 18.2266H9.32031C9.09545 18.2266 8.87996 18.3038 8.70996 18.4414L8.64062 18.5039L6.76172 20.3584C6.57148 20.5461 6.32948 20.6733 6.06836 20.7246C5.80739 20.7758 5.53645 20.7492 5.29004 20.6484C5.0436 20.5476 4.83171 20.3759 4.68164 20.1543C4.53151 19.9325 4.45027 19.671 4.4502 19.4023V5.68457C4.4502 5.03587 4.71129 4.41572 5.17285 3.95996C5.63429 3.50449 6.25881 3.25 6.90723 3.25H20.5605C21.2088 3.25009 21.8326 3.50457 22.2939 3.95996C22.7556 4.41574 23.0166 5.0358 23.0166 5.68457V15.792Z")),t.appendChild(w("M1.25 7.81793C1.25 7.16923 1.5111 6.54909 1.97266 6.09332C2.4341 5.63785 3.05861 5.38336 3.70703 5.38336C4.12108 5.38356 4.45703 5.71927 4.45703 6.13336C4.45703 6.54745 4.12108 6.88316 3.70703 6.88336C3.45018 6.88336 3.20505 6.98434 3.02637 7.16071C2.84819 7.33672 2.75 7.57337 2.75 7.81793V19.1304C3.02293 19.0188 3.34839 19.0755 3.56836 19.2984C3.85897 19.5932 3.85612 20.0681 3.56152 20.3589C3.37129 20.5467 3.12929 20.6729 2.86816 20.7242C2.60717 20.7754 2.33628 20.7497 2.08984 20.649C1.84341 20.5482 1.63154 20.3764 1.48145 20.1548C1.33122 19.933 1.25004 19.6707 1.25 19.4019V7.81793Z")),t}function Ct(){const e=document.createElement("canvas");e.className="ago-chat-input__waveform",e.setAttribute("aria-hidden","true"),D(e,{width:"100%",height:"40px",display:"block",color:Z});let t,r,n,o,u,a=null,c=[],s=0;function h(){if(!a)return;a.clearRect(0,0,s,40),a.fillStyle=getComputedStyle(e).color;const d=Math.min(300,Math.floor(s/4));for(let g=0;g<d;g++){const p=c[c.length-d+g]??0,v=2+p*30;a.globalAlpha=p>.02?.85:.3,a.fillRect(g*4,(40-v)/2,2,v)}}function y(){s=e.clientWidth;const d=window.devicePixelRatio||1;e.width=Math.round(s*d),e.height=40*d,a?.setTransform(d,0,0,d,0,0),h()}function E(){o!==void 0&&cancelAnimationFrame(o),o=void 0,u?.disconnect(),u=void 0,r?.disconnect(),r=void 0,n?.disconnect(),n=void 0,t&&t.state!=="closed"&&t.close().catch(()=>{}),t=void 0}function f(d){if(E(),c=[],!(typeof AudioContext>"u"))try{if(a=e.getContext("2d"),!a||(y(),typeof ResizeObserver<"u"&&(u=new ResizeObserver(y),u.observe(e)),window.matchMedia?.("(prefers-reduced-motion: reduce)").matches))return;t=new AudioContext,r=t.createMediaStreamSource(d),n=t.createAnalyser(),n.fftSize=256,r.connect(n),t.state==="suspended"&&t.resume().catch(()=>{});const g=new Uint8Array(n.fftSize);let p=0;const v=O=>{if(n){if(O-p>=50){p=O,n.getByteTimeDomainData(g);let M=0;for(const A of g)M+=((A-128)/128)**2;c.push(Math.min(1,Math.sqrt(M/g.length)*4)),c.length>300&&c.shift(),h()}o=requestAnimationFrame(v)}};o=requestAnimationFrame(v)}catch{E()}}return{canvas:e,start:f,stop:E,reset(){E(),c=[],h()}}}var q={start:"Dictate a message",finish:"Finish recording",cancel:"Cancel dictation",requesting:"Waiting for microphone…",recording:"Recording…",transcribing:"Transcribing…",limitApproaching:"Recording will finish in 10 seconds.",permissionDenied:"Allow microphone access in your browser to dictate a message.",recordingFailed:"Could not record audio. Check your microphone and try again.",tooLarge:"Recording is too large. Try a shorter message.",noSpeech:"No audio was recorded. Please try again.",transcriptionFailed:"Transcription failed. Please try again."};function Tt(e){let t={...q,...e.labels};const r=F({display:"none",alignItems:"center",minWidth:"0",gap:"4px",flex:"1"});r.className="ago-chat-input__speech";const n=document.createElement("button");n.type="button",n.className="ago-chat-input__microphone";const o=document.createElement("button");o.type="button",o.append(te({size:18}));for(const i of[n,o])D(i,{width:"44px",height:"44px",border:"none",borderRadius:"50%",background:"transparent",color:Q,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0"});const u=document.createElement("span");u.setAttribute("role","status"),D(u,{position:"absolute",width:"1px",height:"1px",overflow:"hidden",clipPath:"inset(50%)",fontFamily:H});const a=Ct(),c=F({flex:"1",minWidth:"0",padding:"0 8px"});c.append(a.canvas);const s=document.createElement("span");s.setAttribute("aria-hidden","true"),D(s,{fontFamily:H,fontSize:"12px",color:Z,fontVariantNumeric:"tabular-nums"}),r.append(c,s,u,o,n);let h=!1,y=!1,E=!1,f="idle",d=0,g,p,v,O,M,A=0,l;function T(){return typeof MediaRecorder<"u"&&!!navigator.mediaDevices?.getUserMedia}function x(){l?.cancel(),l=void 0,r.style.display=h&&T()?"flex":"none",n.disabled=y||f==="requesting"||f==="transcribing",n.style.opacity=n.disabled?"0.5":"1";const i=f==="recording",b=f!=="idle";r.style.flex=b?"1":"0 0 auto";const _=i?t.finish:f==="requesting"?t.requesting:f==="transcribing"?t.transcribing:t.start;n.setAttribute("aria-label",_),n.title=_;const m=i?rt({size:20}):b?nt({size:20}):tt({size:20});b&&!i&&!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches&&(l=m.animate?.([{transform:"rotate(0deg)"},{transform:"rotate(360deg)"}],{duration:800,iterations:1/0})),n.replaceChildren(m),o.setAttribute("aria-label",t.cancel),o.title=t.cancel,o.style.display=f==="idle"?"none":"flex",c.style.display=b?"block":"none",s.style.display=i?"inline":"none",s.textContent=`${Math.floor(A/60)}:${String(A%60).padStart(2,"0")}`,u.textContent=i?t.recording:f==="transcribing"?t.transcribing:f==="requesting"?t.requesting:""}function G(){a.stop(),g?.getTracks().forEach(i=>i.stop()),g=void 0,O&&clearTimeout(O),O=void 0,M&&clearInterval(M),M=void 0}function R(){d++,v?.abort(),v=void 0;const i=p;p=void 0,i&&i.state!=="inactive"&&i.stop(),G(),a.reset(),A=0,f="idle",e.onBusy(!1),x()}function N(i){R(),e.onError(i)}async function re(){if(!h||y||E||f!=="idle"||!T())return;const i=++d;f="requesting",e.onBusy(!0),x(),o.focus();try{const b=await navigator.mediaDevices.getUserMedia({audio:!0});if(i!==d||E){b.getTracks().forEach(B=>B.stop());return}g=b;const _=["audio/webm;codecs=opus","audio/mp4","audio/ogg;codecs=opus"].find(B=>MediaRecorder.isTypeSupported(B)),m=new MediaRecorder(b,_?{mimeType:_}:void 0);p=m;const S=[];let K=0;m.ondataavailable=B=>{if(!(i!==d||!B.data.size)){if(K+=B.data.size,K>25e6){N(t.tooLarge);return}S.push(B.data)}},m.onerror=()=>{i===d&&N(t.recordingFailed)},m.onstop=()=>{i===d&&(G(),p=void 0,ne(S,m.mimeType||_||"",i))},m.start(1e3),f="recording",x(),a.start(b),n.focus();const oe=Date.now();M=setInterval(()=>{A=Math.floor((Date.now()-oe)/1e3),s.textContent=`${Math.floor(A/60)}:${String(A%60).padStart(2,"0")}`,A===110&&(u.textContent=t.limitApproaching)},1e3),O=setTimeout(()=>{m.state==="recording"&&m.stop()},12e4)}catch(b){if(i!==d)return;N(typeof b=="object"&&b!==null&&"name"in b&&b.name==="NotAllowedError"?t.permissionDenied:t.recordingFailed)}}async function ne(i,b,_){const m=b.includes("mp4")?"mp4":b.includes("webm")?"webm":b.includes("ogg")?"ogg":void 0;if(!m||i.length===0){N(t.noSpeech);return}f="transcribing",x(),o.focus(),v=new AbortController;try{const{text:S}=await e.transcribe(new File(i,`recording.${m}`,{type:b}),{signal:v.signal});if(_!==d||E)return;R(),S.trim()?e.onText(S.trim()):e.onError(t.noSpeech)}catch(S){if(_!==d||E)return;N(S instanceof Error?S.message:t.transcriptionFailed)}}n.addEventListener("click",()=>{f==="recording"?p?.state==="recording"&&p.stop():re()}),o.addEventListener("click",R),r.addEventListener("keydown",i=>{i.key==="Escape"&&f!=="idle"&&(i.preventDefault(),i.stopPropagation(),R())});const X=()=>{document.hidden&&R()};return document.addEventListener("visibilitychange",X),x(),{el:r,cancel:R,setLabels(i){t={...q,...i},x()},setEnabled(i){h=i,i||R(),x()},setDisabled(i){y=i,i&&R(),x()},destroy(){E=!0,R(),document.removeEventListener("visibilitychange",X)}}}Object.defineProperty(exports,"ACCENT_COLOR",{enumerable:!0,get:function(){return _e}});Object.defineProperty(exports,"AGENT_BUBBLE_BACKGROUND",{enumerable:!0,get:function(){return Se}});Object.defineProperty(exports,"AGENT_BUBBLE_TEXT",{enumerable:!0,get:function(){return je}});Object.defineProperty(exports,"BORDER_COLOR",{enumerable:!0,get:function(){return Re}});Object.defineProperty(exports,"BRAND_COLOR",{enumerable:!0,get:function(){return Q}});Object.defineProperty(exports,"BRAND_TEXT_COLOR",{enumerable:!0,get:function(){return Oe}});Object.defineProperty(exports,"DEFAULT_SPEECH_TO_TEXT_LABELS",{enumerable:!0,get:function(){return q}});Object.defineProperty(exports,"EMBED_BACKGROUND",{enumerable:!0,get:function(){return ke}});Object.defineProperty(exports,"EMBED_BORDER",{enumerable:!0,get:function(){return qe}});Object.defineProperty(exports,"EMBED_MUTED_TEXT",{enumerable:!0,get:function(){return Ze}});Object.defineProperty(exports,"FONT_VAR",{enumerable:!0,get:function(){return H}});Object.defineProperty(exports,"HEADER_BACKGROUND",{enumerable:!0,get:function(){return Ae}});Object.defineProperty(exports,"HEADER_TEXT_COLOR",{enumerable:!0,get:function(){return Ce}});Object.defineProperty(exports,"LAUNCHER_BACKGROUND",{enumerable:!0,get:function(){return De}});Object.defineProperty(exports,"LAUNCHER_TEXT_COLOR",{enumerable:!0,get:function(){return we}});Object.defineProperty(exports,"MESSAGES_BACKGROUND",{enumerable:!0,get:function(){return xe}});Object.defineProperty(exports,"MESSAGE_RADIUS",{enumerable:!0,get:function(){return Be}});Object.defineProperty(exports,"MESSAGE_RADIUS_IMESSAGE",{enumerable:!0,get:function(){return Pe}});Object.defineProperty(exports,"MUTED_TEXT_COLOR",{enumerable:!0,get:function(){return Z}});Object.defineProperty(exports,"NEUTRAL_BORDER",{enumerable:!0,get:function(){return Fe}});Object.defineProperty(exports,"PANEL_BACKGROUND",{enumerable:!0,get:function(){return Te}});Object.defineProperty(exports,"PANEL_SHADOW",{enumerable:!0,get:function(){return ze}});Object.defineProperty(exports,"PANEL_WIDTH",{enumerable:!0,get:function(){return Ge}});Object.defineProperty(exports,"PRIMARY_ACCENT",{enumerable:!0,get:function(){return He}});Object.defineProperty(exports,"PRIMARY_FOREGROUND",{enumerable:!0,get:function(){return Ue}});Object.defineProperty(exports,"RADIUS",{enumerable:!0,get:function(){return U}});Object.defineProperty(exports,"SEND_BACKGROUND",{enumerable:!0,get:function(){return Ne}});Object.defineProperty(exports,"SHADOW",{enumerable:!0,get:function(){return Ke}});Object.defineProperty(exports,"SHADOW_MD",{enumerable:!0,get:function(){return We}});Object.defineProperty(exports,"SHADOW_SM",{enumerable:!0,get:function(){return Xe}});Object.defineProperty(exports,"TEXT_COLOR",{enumerable:!0,get:function(){return Me}});Object.defineProperty(exports,"USER_BUBBLE_BACKGROUND_EMBED",{enumerable:!0,get:function(){return Ie}});Object.defineProperty(exports,"USER_BUBBLE_TEXT_EMBED",{enumerable:!0,get:function(){return Le}});Object.defineProperty(exports,"addCommentIcon",{enumerable:!0,get:function(){return st}});Object.defineProperty(exports,"alertCircleIcon",{enumerable:!0,get:function(){return Et}});Object.defineProperty(exports,"applyTheme",{enumerable:!0,get:function(){return $e}});Object.defineProperty(exports,"arrowDownwardIcon",{enumerable:!0,get:function(){return dt}});Object.defineProperty(exports,"arrowUpRightIcon",{enumerable:!0,get:function(){return yt}});Object.defineProperty(exports,"arrowUpwardIcon",{enumerable:!0,get:function(){return lt}});Object.defineProperty(exports,"attachFileIcon",{enumerable:!0,get:function(){return ht}});Object.defineProperty(exports,"chevronLeftIcon",{enumerable:!0,get:function(){return ut}});Object.defineProperty(exports,"chevronRightIcon",{enumerable:!0,get:function(){return ct}});Object.defineProperty(exports,"closeIcon",{enumerable:!0,get:function(){return te}});Object.defineProperty(exports,"colorsToTheme",{enumerable:!0,get:function(){return Ve}});Object.defineProperty(exports,"compactMediaQuery",{enumerable:!0,get:function(){return J}});Object.defineProperty(exports,"conversationsIcon",{enumerable:!0,get:function(){return At}});Object.defineProperty(exports,"createSheetController",{enumerable:!0,get:function(){return et}});Object.defineProperty(exports,"createSpeechToText",{enumerable:!0,get:function(){return Tt}});Object.defineProperty(exports,"css",{enumerable:!0,get:function(){return D}});Object.defineProperty(exports,"descriptionIcon",{enumerable:!0,get:function(){return pt}});Object.defineProperty(exports,"div",{enumerable:!0,get:function(){return F}});Object.defineProperty(exports,"downloadIcon",{enumerable:!0,get:function(){return mt}});Object.defineProperty(exports,"ensureKeyframes",{enumerable:!0,get:function(){return Ye}});Object.defineProperty(exports,"houseIcon",{enumerable:!0,get:function(){return vt}});Object.defineProperty(exports,"isValidHexColor",{enumerable:!0,get:function(){return le}});Object.defineProperty(exports,"launcherCloseIcon",{enumerable:!0,get:function(){return it}});Object.defineProperty(exports,"launcherIcon",{enumerable:!0,get:function(){return at}});Object.defineProperty(exports,"lightenColor",{enumerable:!0,get:function(){return se}});Object.defineProperty(exports,"lockBackgroundScroll",{enumerable:!0,get:function(){return ue}});Object.defineProperty(exports,"readableTextColor",{enumerable:!0,get:function(){return Y}});Object.defineProperty(exports,"spokeSpinnerIcon",{enumerable:!0,get:function(){return Ot}});Object.defineProperty(exports,"stopIcon",{enumerable:!0,get:function(){return ft}});Object.defineProperty(exports,"thumbDownIcon",{enumerable:!0,get:function(){return gt}});Object.defineProperty(exports,"thumbUpIcon",{enumerable:!0,get:function(){return bt}});Object.defineProperty(exports,"unlockBackgroundScroll",{enumerable:!0,get:function(){return ce}});
package/dist/testing.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./createMockClient-BEOXI8yW.cjs");exports.createMockClient=e.createMockClient;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./createMockClient-BPt1gSve.cjs");exports.createMockClient=e.createMockClient;
@@ -58,6 +58,8 @@ declare class AgoClient {
58
58
  private config;
59
59
  /** Conversations already warned about an empty reply (one warning each). */
60
60
  private warnedEmptyConversations;
61
+ /** Client functions the backend has accepted from a WebMCP call report. */
62
+ private declaredExternally;
61
63
  /** Whether the placeholder-mode page-data warning has already been logged. */
62
64
  private warnedPageDataPlaceholder;
63
65
  /** `readPageData` companions this SDK registered, so cleanup only removes its own. */
@@ -92,7 +94,12 @@ declare class AgoClient {
92
94
  * `null` otherwise.
93
95
  */
94
96
  proactive: ProactiveController | null;
97
+ /** Removes the mirrored WebMCP tools; `null` when the bridge is off. */
98
+ private detachWebMCP;
99
+ /** The `listPages` companion is live. */
100
+ private listPagesRegistered;
95
101
  constructor(config: AgoConfig);
102
+ private attachWebMCPBridge;
96
103
  /**
97
104
  * Send a message and receive a streaming response
98
105
  */
@@ -204,6 +211,12 @@ declare class AgoClient {
204
211
  * (the agent decides what to do next). No-op if the invocation is unknown.
205
212
  */
206
213
  rejectFunction(invocationId: string): Promise<void>;
214
+ /* Excluded from this release type: runExternalFunction */
215
+ /**
216
+ * Best-effort analytics for one WebMCP call. No agent: the caller is someone
217
+ * else's agent and cannot be known from `execute`.
218
+ */
219
+ private reportExternalCall;
207
220
  /**
208
221
  * Get a page of conversations, newest-first. `pageSize` is capped at 100 by
209
222
  * the backend (default 50). Returns the `{ data, has_more, total }` envelope
@@ -223,11 +236,20 @@ declare class AgoClient {
223
236
  * `SSEHandler.parseToolCall` so persisted and streamed tool calls match.
224
237
  */
225
238
  private static mapPersistedToolCalls;
239
+ /**
240
+ * Transcribe an audio file into editable text (`POST /api/sdk/v1/audio/transcriptions`).
241
+ * Requires speech to text to be enabled for the tenant. Supports FLAC, MP3,
242
+ * MP4, MPEG, MPGA, M4A, OGG, WAV and WebM files up to 25 MB.
243
+ * The filename must include the matching extension. For a MediaRecorder blob,
244
+ * wrap it in a File with the recording's extension and MIME type.
245
+ * Show the returned text as a draft; call `sendMessage` when the user sends it.
246
+ */
247
+ transcribeAudio(file: File, options?: TranscribeAudioOptions): Promise<AudioTranscription>;
226
248
  /**
227
249
  * The tenant's SDK configuration (`GET /api/sdk/v1/config`): per-permission
228
250
  * agents, the ticket form the agent's `ago_ticketing` tool opens, and the
229
- * file-attachment flag. The vanilla widget fetches it once, when a ticket
230
- * form first appears in a conversation.
251
+ * file-attachment and speech-to-text flags. The vanilla widget fetches it
252
+ * once, when a ticket form first appears in a conversation.
231
253
  */
232
254
  getConfig(): Promise<SdkConfig>;
233
255
  /**
@@ -364,6 +386,9 @@ declare class AgoClient {
364
386
  * Get all registered function schemas
365
387
  */
366
388
  getRegisteredFunctions(): ClientFunctionSchema[];
389
+ /** The callback form of `functions:changed`. Returns an unsubscribe. */
390
+ onFunctionsChanged(listener: () => void): () => void;
391
+ /* Excluded from this release type: getFunctionRegistrations */
367
392
  /**
368
393
  * Execute a registered client function locally, through the same
369
394
  * FunctionRegistry path (result-size guard, error wrapping) as agent-invoked
@@ -386,14 +411,15 @@ declare class AgoClient {
386
411
  * page of an entity. Flat arguments only: nested object parameters are not
387
412
  * reliably rendered to the model, so placeholders must not be named `page`.
388
413
  *
414
+ * For a large table, `{ catalogue: "onDemand" }` moves the route descriptions
415
+ * into a read-only `listPages` companion, leaving only the page names in the
416
+ * per-message schema. Routes may carry a `section` to group that companion.
417
+ *
389
418
  * @param navigate - A callback that performs the navigation (e.g. react-router's navigate)
390
419
  * @param routes - Map of route names to paths, with descriptions for the LLM
420
+ * @param opts - Where the catalogue lives; `"inline"` by default
391
421
  */
392
- registerNavigationFunction(navigate: (path: string) => void, routes: Array<{
393
- name: string;
394
- path: string;
395
- description: string;
396
- }>): void;
422
+ registerNavigationFunction(navigate: (path: string) => void, routes: NavRoute[], opts?: AgoNavigationOptions): void;
397
423
  /**
398
424
  * Unregister the navigation function and its `current-page` context provider.
399
425
  */
@@ -696,6 +722,8 @@ declare interface AgoClientEvents {
696
722
  * call running immediately.
697
723
  */
698
724
  "function:awaiting-approval": ClientFunctionInvocation;
725
+ /** A function was registered or unregistered, or the registry cleared. */
726
+ "functions:changed": ClientFunctionSchema[];
699
727
  "function:result": {
700
728
  invocationId: string;
701
729
  result: unknown;
@@ -768,6 +796,8 @@ declare interface AgoConfig {
768
796
  defaultAgentId?: string;
769
797
  /** Permission name to apply to all requests (sent as `X-Widget-Permission`). Mirrors the widget's `window.AGO.permission`. */
770
798
  permission?: string;
799
+ /** Interface locale selected by the host app, sent as Accept-Language. Null clears the override. */
800
+ language?: string | null;
771
801
  /** User email for identification */
772
802
  userEmail?: string;
773
803
  /** JWT token for authenticated users */
@@ -845,6 +875,15 @@ declare interface AgoConfig {
845
875
  * mode's `jsErrors` signal. See `client.reportError()` for caught errors.
846
876
  */
847
877
  errorWatcher?: boolean | ErrorWatcherOptions;
878
+ /** Mirror every registered client function into the browser's WebMCP registry
879
+ * (`document.modelContext`), so an external agent can call the same functions
880
+ * the in-app agent calls. Off by default; no-ops without WebMCP.
881
+ *
882
+ * A mirrored function runs immediately: the approval gate
883
+ * ({@link approvalPolicy}, `requiresApproval`) covers the agent loop only.
884
+ * Use `webmcp: false` on a definition to keep it out.
885
+ */
886
+ webmcp?: boolean;
848
887
  }
849
888
 
850
889
  declare type AgoEventHandler<K extends AgoEventName> = (data: AgoClientEvents[K]) => void;
@@ -875,6 +914,16 @@ declare interface AgoMessage {
875
914
  createdAt: Date;
876
915
  }
877
916
 
917
+ /**
918
+ * Where the route catalogue lives: `"inline"` (default) in `navigateToPage`'s
919
+ * description, or `"onDemand"` in a `listPages` companion's result.
920
+ */
921
+ declare type AgoNavigationOptions = {
922
+ catalogue?: "inline";
923
+ } | {
924
+ catalogue: "onDemand";
925
+ };
926
+
878
927
  /**
879
928
  * What the page currently displays, returned to the agent as the *result* of
880
929
  * `setPageState` instead of only as context on the next message.
@@ -1029,6 +1078,11 @@ declare type AgoStateSetResult = {
1029
1078
  result: "unchanged";
1030
1079
  };
1031
1080
 
1081
+ /** Editable text returned by `AgoClient.transcribeAudio`. */
1082
+ declare interface AudioTranscription {
1083
+ text: string;
1084
+ }
1085
+
1032
1086
  /** One JavaScript error captured on the page (deduplicated, see `count`). */
1033
1087
  declare interface CapturedError {
1034
1088
  type: CapturedErrorType;
@@ -1068,22 +1122,11 @@ declare type CapturedErrorType = "error" | "unhandledrejection" | "console" | "m
1068
1122
  * client.registerFunction(fn);
1069
1123
  * ```
1070
1124
  */
1071
- declare interface ClientFunctionDefinition {
1125
+ declare interface ClientFunctionDefinition extends ClientFunctionSettings {
1072
1126
  name: string;
1073
1127
  description: string;
1074
1128
  parameters: ClientFunctionSchema["parameters"];
1075
1129
  handler: ClientFunctionHandler;
1076
- /**
1077
- * Max serialized result size in bytes before the SDK truncates it to a
1078
- * flagged preview (default: `AgoConfig.maxFunctionResultBytes`, 50 000).
1079
- * `Infinity` disables the guard for this function.
1080
- */
1081
- maxResultBytes?: number;
1082
- /**
1083
- * Require explicit user approval before this function runs. See
1084
- * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1085
- */
1086
- requiresApproval?: boolean;
1087
1130
  }
1088
1131
 
1089
1132
  /**
@@ -1102,20 +1145,7 @@ declare interface ClientFunctionInvocation {
1102
1145
  * Schema-plus-settings object accepted when registering a function: the schema
1103
1146
  * (minus `name`) and SDK-side options that are NOT sent to the backend.
1104
1147
  */
1105
- declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & {
1106
- /**
1107
- * Max serialized result size in bytes before the SDK truncates it to a
1108
- * flagged preview. Overrides the client-level default
1109
- * (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
1110
- * disables the guard for this function.
1111
- */
1112
- maxResultBytes?: number;
1113
- /**
1114
- * Require explicit user approval before this function runs. See
1115
- * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1116
- */
1117
- requiresApproval?: boolean;
1118
- };
1148
+ declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & ClientFunctionSettings;
1119
1149
 
1120
1150
  /**
1121
1151
  * Schema for a client-side function that AGO can call
@@ -1142,6 +1172,28 @@ declare interface ClientFunctionSchema {
1142
1172
  };
1143
1173
  }
1144
1174
 
1175
+ /** SDK-side function settings that are never sent to the backend. */
1176
+ declare interface ClientFunctionSettings {
1177
+ /**
1178
+ * Max serialized result size in bytes before the SDK truncates it to a
1179
+ * flagged preview. Overrides the client-level default
1180
+ * (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
1181
+ * disables the guard for this function.
1182
+ */
1183
+ maxResultBytes?: number;
1184
+ /**
1185
+ * Require explicit user approval before this function runs. See
1186
+ * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1187
+ */
1188
+ requiresApproval?: boolean;
1189
+ /**
1190
+ * WebMCP metadata, read only when the bridge is on (`AgoConfig.webmcp`).
1191
+ * `false` keeps this function out of WebMCP while leaving it available to the
1192
+ * in-app agent.
1193
+ */
1194
+ webmcp?: WebMCPToolMeta | false;
1195
+ }
1196
+
1145
1197
  /** See {@link AgoConfig.clientFunctionsMode}. */
1146
1198
  declare type ClientFunctionsMode = "placeholder" | "pause";
1147
1199
 
@@ -1459,6 +1511,15 @@ export declare interface MockAgoClientOptions {
1459
1511
 
1460
1512
  declare type MockFn = (...args: any[]) => any;
1461
1513
 
1514
+ /** A navigable page. `path` may carry `:param` placeholders. */
1515
+ declare interface NavRoute {
1516
+ name: string;
1517
+ path: string;
1518
+ description: string;
1519
+ /** Only read under `catalogue: "onDemand"`. */
1520
+ section?: string;
1521
+ }
1522
+
1462
1523
  /**
1463
1524
  * Optional action attached to a nudge. Accepting a `functionName` action
1464
1525
  * executes the registered client function (same `FunctionRegistry` path as
@@ -1651,6 +1712,14 @@ declare interface ProactiveTriggerWhen {
1651
1712
  fieldErrors?: Record<string, number>;
1652
1713
  }
1653
1714
 
1715
+ /**
1716
+ * Registered function with handler
1717
+ */
1718
+ declare interface RegisteredFunction extends ClientFunctionSettings {
1719
+ schema: ClientFunctionSchema;
1720
+ handler: ClientFunctionHandler;
1721
+ }
1722
+
1654
1723
  /**
1655
1724
  * Hook run before a paused turn is resumed, so the app controls WHEN the
1656
1725
  * continuation fires (e.g. wait for the destination page to mount after a
@@ -1707,6 +1776,8 @@ declare interface SdkPermissionConfig {
1707
1776
  homePage?: SdkHomePageConfig;
1708
1777
  fileAttachmentsEnabled: boolean;
1709
1778
  voiceEnabled: boolean;
1779
+ /** Whether audio uploads can be transcribed. Defaults to false on older backends. */
1780
+ speechToTextEnabled: boolean;
1710
1781
  }
1711
1782
 
1712
1783
  /**
@@ -2019,4 +2090,29 @@ declare interface ToolCallTicketPrefill {
2019
2090
 
2020
2091
  declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
2021
2092
 
2093
+ /** Options for `AgoClient.transcribeAudio`. */
2094
+ declare interface TranscribeAudioOptions {
2095
+ /** Cancel the upload or stop waiting for its transcription. */
2096
+ signal?: AbortSignal;
2097
+ }
2098
+
2099
+ /** The MCP behavior hints AGO has no equivalent for. */
2100
+ declare interface WebMCPToolMeta {
2101
+ /**
2102
+ * Both default to `false`, so only set what is true: `readOnlyHint` marks a
2103
+ * function that changes nothing, `untrustedContentHint` one whose result may
2104
+ * carry third-party text.
2105
+ */
2106
+ annotations?: {
2107
+ readOnlyHint?: boolean;
2108
+ untrustedContentHint?: boolean;
2109
+ };
2110
+ /**
2111
+ * This function navigates. The WebMCP call is held open until the function
2112
+ * registry goes quiet, so the caller sees the destination page's tools rather
2113
+ * than the departing page's. Already set on the built-in `navigateToPage`.
2114
+ */
2115
+ navigates?: boolean;
2116
+ }
2117
+
2022
2118
  export { }
package/dist/testing.d.ts CHANGED
@@ -58,6 +58,8 @@ declare class AgoClient {
58
58
  private config;
59
59
  /** Conversations already warned about an empty reply (one warning each). */
60
60
  private warnedEmptyConversations;
61
+ /** Client functions the backend has accepted from a WebMCP call report. */
62
+ private declaredExternally;
61
63
  /** Whether the placeholder-mode page-data warning has already been logged. */
62
64
  private warnedPageDataPlaceholder;
63
65
  /** `readPageData` companions this SDK registered, so cleanup only removes its own. */
@@ -92,7 +94,12 @@ declare class AgoClient {
92
94
  * `null` otherwise.
93
95
  */
94
96
  proactive: ProactiveController | null;
97
+ /** Removes the mirrored WebMCP tools; `null` when the bridge is off. */
98
+ private detachWebMCP;
99
+ /** The `listPages` companion is live. */
100
+ private listPagesRegistered;
95
101
  constructor(config: AgoConfig);
102
+ private attachWebMCPBridge;
96
103
  /**
97
104
  * Send a message and receive a streaming response
98
105
  */
@@ -204,6 +211,12 @@ declare class AgoClient {
204
211
  * (the agent decides what to do next). No-op if the invocation is unknown.
205
212
  */
206
213
  rejectFunction(invocationId: string): Promise<void>;
214
+ /* Excluded from this release type: runExternalFunction */
215
+ /**
216
+ * Best-effort analytics for one WebMCP call. No agent: the caller is someone
217
+ * else's agent and cannot be known from `execute`.
218
+ */
219
+ private reportExternalCall;
207
220
  /**
208
221
  * Get a page of conversations, newest-first. `pageSize` is capped at 100 by
209
222
  * the backend (default 50). Returns the `{ data, has_more, total }` envelope
@@ -223,11 +236,20 @@ declare class AgoClient {
223
236
  * `SSEHandler.parseToolCall` so persisted and streamed tool calls match.
224
237
  */
225
238
  private static mapPersistedToolCalls;
239
+ /**
240
+ * Transcribe an audio file into editable text (`POST /api/sdk/v1/audio/transcriptions`).
241
+ * Requires speech to text to be enabled for the tenant. Supports FLAC, MP3,
242
+ * MP4, MPEG, MPGA, M4A, OGG, WAV and WebM files up to 25 MB.
243
+ * The filename must include the matching extension. For a MediaRecorder blob,
244
+ * wrap it in a File with the recording's extension and MIME type.
245
+ * Show the returned text as a draft; call `sendMessage` when the user sends it.
246
+ */
247
+ transcribeAudio(file: File, options?: TranscribeAudioOptions): Promise<AudioTranscription>;
226
248
  /**
227
249
  * The tenant's SDK configuration (`GET /api/sdk/v1/config`): per-permission
228
250
  * agents, the ticket form the agent's `ago_ticketing` tool opens, and the
229
- * file-attachment flag. The vanilla widget fetches it once, when a ticket
230
- * form first appears in a conversation.
251
+ * file-attachment and speech-to-text flags. The vanilla widget fetches it
252
+ * once, when a ticket form first appears in a conversation.
231
253
  */
232
254
  getConfig(): Promise<SdkConfig>;
233
255
  /**
@@ -364,6 +386,9 @@ declare class AgoClient {
364
386
  * Get all registered function schemas
365
387
  */
366
388
  getRegisteredFunctions(): ClientFunctionSchema[];
389
+ /** The callback form of `functions:changed`. Returns an unsubscribe. */
390
+ onFunctionsChanged(listener: () => void): () => void;
391
+ /* Excluded from this release type: getFunctionRegistrations */
367
392
  /**
368
393
  * Execute a registered client function locally, through the same
369
394
  * FunctionRegistry path (result-size guard, error wrapping) as agent-invoked
@@ -386,14 +411,15 @@ declare class AgoClient {
386
411
  * page of an entity. Flat arguments only: nested object parameters are not
387
412
  * reliably rendered to the model, so placeholders must not be named `page`.
388
413
  *
414
+ * For a large table, `{ catalogue: "onDemand" }` moves the route descriptions
415
+ * into a read-only `listPages` companion, leaving only the page names in the
416
+ * per-message schema. Routes may carry a `section` to group that companion.
417
+ *
389
418
  * @param navigate - A callback that performs the navigation (e.g. react-router's navigate)
390
419
  * @param routes - Map of route names to paths, with descriptions for the LLM
420
+ * @param opts - Where the catalogue lives; `"inline"` by default
391
421
  */
392
- registerNavigationFunction(navigate: (path: string) => void, routes: Array<{
393
- name: string;
394
- path: string;
395
- description: string;
396
- }>): void;
422
+ registerNavigationFunction(navigate: (path: string) => void, routes: NavRoute[], opts?: AgoNavigationOptions): void;
397
423
  /**
398
424
  * Unregister the navigation function and its `current-page` context provider.
399
425
  */
@@ -696,6 +722,8 @@ declare interface AgoClientEvents {
696
722
  * call running immediately.
697
723
  */
698
724
  "function:awaiting-approval": ClientFunctionInvocation;
725
+ /** A function was registered or unregistered, or the registry cleared. */
726
+ "functions:changed": ClientFunctionSchema[];
699
727
  "function:result": {
700
728
  invocationId: string;
701
729
  result: unknown;
@@ -768,6 +796,8 @@ declare interface AgoConfig {
768
796
  defaultAgentId?: string;
769
797
  /** Permission name to apply to all requests (sent as `X-Widget-Permission`). Mirrors the widget's `window.AGO.permission`. */
770
798
  permission?: string;
799
+ /** Interface locale selected by the host app, sent as Accept-Language. Null clears the override. */
800
+ language?: string | null;
771
801
  /** User email for identification */
772
802
  userEmail?: string;
773
803
  /** JWT token for authenticated users */
@@ -845,6 +875,15 @@ declare interface AgoConfig {
845
875
  * mode's `jsErrors` signal. See `client.reportError()` for caught errors.
846
876
  */
847
877
  errorWatcher?: boolean | ErrorWatcherOptions;
878
+ /** Mirror every registered client function into the browser's WebMCP registry
879
+ * (`document.modelContext`), so an external agent can call the same functions
880
+ * the in-app agent calls. Off by default; no-ops without WebMCP.
881
+ *
882
+ * A mirrored function runs immediately: the approval gate
883
+ * ({@link approvalPolicy}, `requiresApproval`) covers the agent loop only.
884
+ * Use `webmcp: false` on a definition to keep it out.
885
+ */
886
+ webmcp?: boolean;
848
887
  }
849
888
 
850
889
  declare type AgoEventHandler<K extends AgoEventName> = (data: AgoClientEvents[K]) => void;
@@ -875,6 +914,16 @@ declare interface AgoMessage {
875
914
  createdAt: Date;
876
915
  }
877
916
 
917
+ /**
918
+ * Where the route catalogue lives: `"inline"` (default) in `navigateToPage`'s
919
+ * description, or `"onDemand"` in a `listPages` companion's result.
920
+ */
921
+ declare type AgoNavigationOptions = {
922
+ catalogue?: "inline";
923
+ } | {
924
+ catalogue: "onDemand";
925
+ };
926
+
878
927
  /**
879
928
  * What the page currently displays, returned to the agent as the *result* of
880
929
  * `setPageState` instead of only as context on the next message.
@@ -1029,6 +1078,11 @@ declare type AgoStateSetResult = {
1029
1078
  result: "unchanged";
1030
1079
  };
1031
1080
 
1081
+ /** Editable text returned by `AgoClient.transcribeAudio`. */
1082
+ declare interface AudioTranscription {
1083
+ text: string;
1084
+ }
1085
+
1032
1086
  /** One JavaScript error captured on the page (deduplicated, see `count`). */
1033
1087
  declare interface CapturedError {
1034
1088
  type: CapturedErrorType;
@@ -1068,22 +1122,11 @@ declare type CapturedErrorType = "error" | "unhandledrejection" | "console" | "m
1068
1122
  * client.registerFunction(fn);
1069
1123
  * ```
1070
1124
  */
1071
- declare interface ClientFunctionDefinition {
1125
+ declare interface ClientFunctionDefinition extends ClientFunctionSettings {
1072
1126
  name: string;
1073
1127
  description: string;
1074
1128
  parameters: ClientFunctionSchema["parameters"];
1075
1129
  handler: ClientFunctionHandler;
1076
- /**
1077
- * Max serialized result size in bytes before the SDK truncates it to a
1078
- * flagged preview (default: `AgoConfig.maxFunctionResultBytes`, 50 000).
1079
- * `Infinity` disables the guard for this function.
1080
- */
1081
- maxResultBytes?: number;
1082
- /**
1083
- * Require explicit user approval before this function runs. See
1084
- * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1085
- */
1086
- requiresApproval?: boolean;
1087
1130
  }
1088
1131
 
1089
1132
  /**
@@ -1102,20 +1145,7 @@ declare interface ClientFunctionInvocation {
1102
1145
  * Schema-plus-settings object accepted when registering a function: the schema
1103
1146
  * (minus `name`) and SDK-side options that are NOT sent to the backend.
1104
1147
  */
1105
- declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & {
1106
- /**
1107
- * Max serialized result size in bytes before the SDK truncates it to a
1108
- * flagged preview. Overrides the client-level default
1109
- * (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
1110
- * disables the guard for this function.
1111
- */
1112
- maxResultBytes?: number;
1113
- /**
1114
- * Require explicit user approval before this function runs. See
1115
- * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1116
- */
1117
- requiresApproval?: boolean;
1118
- };
1148
+ declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & ClientFunctionSettings;
1119
1149
 
1120
1150
  /**
1121
1151
  * Schema for a client-side function that AGO can call
@@ -1142,6 +1172,28 @@ declare interface ClientFunctionSchema {
1142
1172
  };
1143
1173
  }
1144
1174
 
1175
+ /** SDK-side function settings that are never sent to the backend. */
1176
+ declare interface ClientFunctionSettings {
1177
+ /**
1178
+ * Max serialized result size in bytes before the SDK truncates it to a
1179
+ * flagged preview. Overrides the client-level default
1180
+ * (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
1181
+ * disables the guard for this function.
1182
+ */
1183
+ maxResultBytes?: number;
1184
+ /**
1185
+ * Require explicit user approval before this function runs. See
1186
+ * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1187
+ */
1188
+ requiresApproval?: boolean;
1189
+ /**
1190
+ * WebMCP metadata, read only when the bridge is on (`AgoConfig.webmcp`).
1191
+ * `false` keeps this function out of WebMCP while leaving it available to the
1192
+ * in-app agent.
1193
+ */
1194
+ webmcp?: WebMCPToolMeta | false;
1195
+ }
1196
+
1145
1197
  /** See {@link AgoConfig.clientFunctionsMode}. */
1146
1198
  declare type ClientFunctionsMode = "placeholder" | "pause";
1147
1199
 
@@ -1459,6 +1511,15 @@ export declare interface MockAgoClientOptions {
1459
1511
 
1460
1512
  declare type MockFn = (...args: any[]) => any;
1461
1513
 
1514
+ /** A navigable page. `path` may carry `:param` placeholders. */
1515
+ declare interface NavRoute {
1516
+ name: string;
1517
+ path: string;
1518
+ description: string;
1519
+ /** Only read under `catalogue: "onDemand"`. */
1520
+ section?: string;
1521
+ }
1522
+
1462
1523
  /**
1463
1524
  * Optional action attached to a nudge. Accepting a `functionName` action
1464
1525
  * executes the registered client function (same `FunctionRegistry` path as
@@ -1651,6 +1712,14 @@ declare interface ProactiveTriggerWhen {
1651
1712
  fieldErrors?: Record<string, number>;
1652
1713
  }
1653
1714
 
1715
+ /**
1716
+ * Registered function with handler
1717
+ */
1718
+ declare interface RegisteredFunction extends ClientFunctionSettings {
1719
+ schema: ClientFunctionSchema;
1720
+ handler: ClientFunctionHandler;
1721
+ }
1722
+
1654
1723
  /**
1655
1724
  * Hook run before a paused turn is resumed, so the app controls WHEN the
1656
1725
  * continuation fires (e.g. wait for the destination page to mount after a
@@ -1707,6 +1776,8 @@ declare interface SdkPermissionConfig {
1707
1776
  homePage?: SdkHomePageConfig;
1708
1777
  fileAttachmentsEnabled: boolean;
1709
1778
  voiceEnabled: boolean;
1779
+ /** Whether audio uploads can be transcribed. Defaults to false on older backends. */
1780
+ speechToTextEnabled: boolean;
1710
1781
  }
1711
1782
 
1712
1783
  /**
@@ -2019,4 +2090,29 @@ declare interface ToolCallTicketPrefill {
2019
2090
 
2020
2091
  declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
2021
2092
 
2093
+ /** Options for `AgoClient.transcribeAudio`. */
2094
+ declare interface TranscribeAudioOptions {
2095
+ /** Cancel the upload or stop waiting for its transcription. */
2096
+ signal?: AbortSignal;
2097
+ }
2098
+
2099
+ /** The MCP behavior hints AGO has no equivalent for. */
2100
+ declare interface WebMCPToolMeta {
2101
+ /**
2102
+ * Both default to `false`, so only set what is true: `readOnlyHint` marks a
2103
+ * function that changes nothing, `untrustedContentHint` one whose result may
2104
+ * carry third-party text.
2105
+ */
2106
+ annotations?: {
2107
+ readOnlyHint?: boolean;
2108
+ untrustedContentHint?: boolean;
2109
+ };
2110
+ /**
2111
+ * This function navigates. The WebMCP call is held open until the function
2112
+ * registry goes quiet, so the caller sees the destination page's tools rather
2113
+ * than the departing page's. Already set on the built-in `navigateToPage`.
2114
+ */
2115
+ navigates?: boolean;
2116
+ }
2117
+
2022
2118
  export { }
package/dist/testing.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as e } from "./createMockClient-Beao82tu.js";
1
+ import { t as e } from "./createMockClient-YoYr3pQr.js";
2
2
  export {
3
3
  e as createMockClient
4
4
  };