@useago/sdk 1.4.4 → 1.5.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.
- package/CHANGELOG.md +15 -1
- package/dist/{AgoClient-Ozz2b1dQ.js → AgoClient-q39FIjSC.js} +1 -1
- package/dist/{AgoClient-CLmtYTJx.cjs → AgoClient-wcPRaIMs.cjs} +1 -1
- package/dist/angular.cjs +1 -1
- package/dist/angular.d.cts +45 -3
- package/dist/angular.d.ts +45 -3
- package/dist/angular.js +5 -1
- package/dist/autoContinue-CcCTva-D.cjs +1 -0
- package/dist/autoContinue-D3Mmaaca.js +63 -0
- package/dist/{createConversationSession-CUkNp6mZ.cjs → createConversationSession-BBYfQLLS.cjs} +1 -1
- package/dist/{createConversationSession-QIBN0gLx.js → createConversationSession-DCSWShaW.js} +1 -1
- package/dist/{createFormCollector-DHT1ObOb.cjs → createFormCollector-eimwwWEi.cjs} +1 -1
- package/dist/{createFormCollector-F3YJfsbg.js → createFormCollector-sB6rMccD.js} +1 -1
- package/dist/devtools.d.cts +3 -3
- package/dist/devtools.d.ts +3 -3
- package/dist/helpers.cjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +52 -3
- package/dist/index.d.ts +52 -3
- package/dist/index.js +45 -43
- package/dist/react.cjs +3 -3
- package/dist/react.d.cts +5 -17
- package/dist/react.d.ts +5 -17
- package/dist/react.js +396 -454
- package/dist/testing.cjs +1 -1
- package/dist/testing.d.cts +3 -3
- package/dist/testing.d.ts +3 -3
- package/dist/testing.js +1 -1
- package/dist/vue.cjs +1 -1
- package/dist/vue.d.cts +3 -3
- package/dist/vue.d.ts +3 -3
- package/dist/vue.js +1 -1
- package/dist/widget.cjs +1 -1
- package/dist/widget.d.cts +3 -3
- package/dist/widget.d.ts +3 -3
- package/dist/widget.js +3 -3
- package/llms-full.txt +26 -4
- package/package.json +1 -1
- /package/dist/{createMockClient-bAZ9KBHC.js → createMockClient-BUc9PSbo.js} +0 -0
- /package/dist/{createMockClient-BSr-UV8R.cjs → createMockClient-CjdCqixj.cjs} +0 -0
- /package/dist/{functions-Djnq-JAo.cjs → functions-IGSjjvF4.cjs} +0 -0
package/dist/testing.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./createMockClient-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./createMockClient-CjdCqixj.cjs");exports.createMockClient=e.createMockClient;
|
package/dist/testing.d.cts
CHANGED
|
@@ -476,11 +476,11 @@ declare interface AgoConfig {
|
|
|
476
476
|
warnOnEmptyReply?: boolean;
|
|
477
477
|
/**
|
|
478
478
|
* How the agent loop treats client function calls (requires backend support):
|
|
479
|
-
* - `"
|
|
480
|
-
* result; the real result is only visible to the agent on later turns.
|
|
481
|
-
* - `"pause"`: the turn stops on client function call(s) with status
|
|
479
|
+
* - `"pause"` (default): the turn stops on client function call(s) with status
|
|
482
480
|
* `WAITING_CLIENT`; once every result is submitted, the SDK resumes the SAME
|
|
483
481
|
* turn via `POST /messages/{id}/continue`, so the agent sees the real results.
|
|
482
|
+
* - `"placeholder"` (legacy): the turn continues immediately on a placeholder
|
|
483
|
+
* result; the real result is only visible to the agent on later turns.
|
|
484
484
|
* Older backends ignore the flag, so `"pause"` degrades to legacy behavior.
|
|
485
485
|
*/
|
|
486
486
|
clientFunctionsMode?: ClientFunctionsMode;
|
package/dist/testing.d.ts
CHANGED
|
@@ -476,11 +476,11 @@ declare interface AgoConfig {
|
|
|
476
476
|
warnOnEmptyReply?: boolean;
|
|
477
477
|
/**
|
|
478
478
|
* How the agent loop treats client function calls (requires backend support):
|
|
479
|
-
* - `"
|
|
480
|
-
* result; the real result is only visible to the agent on later turns.
|
|
481
|
-
* - `"pause"`: the turn stops on client function call(s) with status
|
|
479
|
+
* - `"pause"` (default): the turn stops on client function call(s) with status
|
|
482
480
|
* `WAITING_CLIENT`; once every result is submitted, the SDK resumes the SAME
|
|
483
481
|
* turn via `POST /messages/{id}/continue`, so the agent sees the real results.
|
|
482
|
+
* - `"placeholder"` (legacy): the turn continues immediately on a placeholder
|
|
483
|
+
* result; the real result is only visible to the agent on later turns.
|
|
484
484
|
* Older backends ignore the flag, so `"pause"` degrades to legacy behavior.
|
|
485
485
|
*/
|
|
486
486
|
clientFunctionsMode?: ClientFunctionsMode;
|
package/dist/testing.js
CHANGED
package/dist/vue.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./rolldown-runtime-16Nf8qvH.cjs"),E=require("./AgoClient-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./rolldown-runtime-16Nf8qvH.cjs"),E=require("./AgoClient-wcPRaIMs.cjs");let o=require("vue");var I=Symbol("ago-client"),S={install(t,n){const e=new E.AgoClient(n);t.provide(I,e)}};function d(t){if(t)return new E.AgoClient(t);const n=(0,o.inject)(I);if(!n)throw new Error("useAgo(): no AgoClient found. Either pass config or install AgoPlugin.");return n}function M(t={}){const n=t.client??d(),e=(0,o.ref)([]),s=(0,o.ref)(t.conversationId),u=(0,o.ref)(!1),r=(0,o.ref)(null),c=a=>{s.value||(s.value=a.conversationId)},f=a=>{const i=e.value.findIndex(v=>v.id===a.messageId);i>=0&&(e.value[i]={...e.value[i],content:e.value[i].content+a.content})},m=a=>{const i=e.value.findIndex(v=>v.id===a.id);i>=0?e.value[i]=a:e.value.push(a),u.value=!1},C=a=>{r.value=new Error(a.error),u.value=!1};(0,o.onMounted)(()=>{n.on("message:start",c),n.on("message:chunk",f),n.on("message:complete",m),n.on("message:error",C)}),(0,o.onUnmounted)(()=>{n.off("message:start",c),n.off("message:chunk",f),n.off("message:complete",m),n.off("message:error",C)});async function g(a,i){u.value=!0,r.value=null;const v={id:`temp-${Date.now()}`,conversationId:s.value||"",content:a,role:"user",status:"DONE",createdAt:new Date},N={id:`temp-assistant-${Date.now()}`,conversationId:s.value||"",content:"",role:"assistant",status:"IN_PROGRESS",createdAt:new Date};e.value.push(v,N);try{const l=await n.sendMessage(a,{conversationId:s.value,files:i});l.conversationId&&!s.value&&(s.value=l.conversationId),e.value=e.value.filter(w=>!w.id.startsWith("temp-"));const A={...v,id:v.id.replace("temp-","user-"),conversationId:l.conversationId};return e.value.some(w=>w.id===l.id)?e.value.push(A):e.value.push(A,l),l}catch(l){return r.value=l instanceof Error?l:new Error("Failed to send"),u.value=!1,e.value=e.value.filter(A=>!A.id.startsWith("temp-")),null}}function h(){e.value=[],s.value=void 0,r.value=null}return{messages:e,isLoading:u,error:r,conversationId:s,sendMessage:g,clearMessages:h}}function p(t={}){const n=t.client??d(),e=t.autoLoad??!0,s=(0,o.ref)([]),u=(0,o.ref)(null),r=(0,o.ref)(!1),c=(0,o.ref)(null);async function f(){r.value=!0,c.value=null;try{s.value=await n.getConversations()}catch(g){c.value=g instanceof Error?g:new Error("Failed to load conversations")}finally{r.value=!1}}async function m(g){r.value=!0,c.value=null;try{u.value=await n.getConversation(g)}catch(h){c.value=h instanceof Error?h:new Error("Failed to load conversation")}finally{r.value=!1}}function C(){u.value=null}return(0,o.onMounted)(()=>{e&&f()}),{conversations:s,currentConversation:u,isLoading:r,error:c,selectConversation:m,startNewConversation:C,refreshConversations:f}}function y(t={}){const n=M({client:t.client,conversationId:t.conversationId}),e=p({client:t.client,autoLoad:t.autoLoad}),s=(0,o.computed)(()=>n.error.value||e.error.value);return{messages:n.messages,isLoading:n.isLoading,error:s,sendMessage:n.sendMessage,clearMessages:n.clearMessages,conversationId:n.conversationId,conversations:e.conversations,currentConversation:e.currentConversation,isConversationsLoading:e.isLoading,selectConversation:e.selectConversation,startNewConversation:e.startNewConversation,refreshConversations:e.refreshConversations}}function L(t,n){const e=d();(0,o.onMounted)(()=>{e.registerFunction(t,n.handler,{description:n.description,parameters:n.parameters,maxResultBytes:n.maxResultBytes})}),(0,o.onUnmounted)(()=>{e.unregisterFunction(t)})}function F(t,n){const e=d();(0,o.onMounted)(()=>{e.registerNavigationFunction(t,n)}),(0,o.onUnmounted)(()=>{e.unregisterNavigationFunction()})}function P(t,n){const e=d(),s=n?.functionName??"setPageState";(0,o.onMounted)(()=>{e.registerPageStateFunction(t,{functionName:s})}),(0,o.onUnmounted)(()=>{e.unregisterPageStateFunction(s)})}function _(t,n){const e=d();(0,o.onMounted)(()=>{e.on(t,n)}),(0,o.onUnmounted)(()=>{e.off(t,n)})}function R(t){const n=(0,o.shallowRef)(t.get());return(0,o.onScopeDispose)(t.subscribe(e=>{n.value=e})),n}exports.AGO_CLIENT_KEY=I;exports.AgoPlugin=S;exports.useAgo=d;exports.useAgoEvents=_;exports.useAgoFunction=L;exports.useAgoNavigation=F;exports.useAgoPageState=P;exports.useAgoStore=R;exports.useChat=y;exports.useConversation=p;exports.useMessages=M;
|
package/dist/vue.d.cts
CHANGED
|
@@ -484,11 +484,11 @@ export declare interface AgoConfig {
|
|
|
484
484
|
warnOnEmptyReply?: boolean;
|
|
485
485
|
/**
|
|
486
486
|
* How the agent loop treats client function calls (requires backend support):
|
|
487
|
-
* - `"
|
|
488
|
-
* result; the real result is only visible to the agent on later turns.
|
|
489
|
-
* - `"pause"`: the turn stops on client function call(s) with status
|
|
487
|
+
* - `"pause"` (default): the turn stops on client function call(s) with status
|
|
490
488
|
* `WAITING_CLIENT`; once every result is submitted, the SDK resumes the SAME
|
|
491
489
|
* turn via `POST /messages/{id}/continue`, so the agent sees the real results.
|
|
490
|
+
* - `"placeholder"` (legacy): the turn continues immediately on a placeholder
|
|
491
|
+
* result; the real result is only visible to the agent on later turns.
|
|
492
492
|
* Older backends ignore the flag, so `"pause"` degrades to legacy behavior.
|
|
493
493
|
*/
|
|
494
494
|
clientFunctionsMode?: ClientFunctionsMode;
|
package/dist/vue.d.ts
CHANGED
|
@@ -484,11 +484,11 @@ export declare interface AgoConfig {
|
|
|
484
484
|
warnOnEmptyReply?: boolean;
|
|
485
485
|
/**
|
|
486
486
|
* How the agent loop treats client function calls (requires backend support):
|
|
487
|
-
* - `"
|
|
488
|
-
* result; the real result is only visible to the agent on later turns.
|
|
489
|
-
* - `"pause"`: the turn stops on client function call(s) with status
|
|
487
|
+
* - `"pause"` (default): the turn stops on client function call(s) with status
|
|
490
488
|
* `WAITING_CLIENT`; once every result is submitted, the SDK resumes the SAME
|
|
491
489
|
* turn via `POST /messages/{id}/continue`, so the agent sees the real results.
|
|
490
|
+
* - `"placeholder"` (legacy): the turn continues immediately on a placeholder
|
|
491
|
+
* result; the real result is only visible to the agent on later turns.
|
|
492
492
|
* Older backends ignore the flag, so `"pause"` degrades to legacy behavior.
|
|
493
493
|
*/
|
|
494
494
|
clientFunctionsMode?: ClientFunctionsMode;
|
package/dist/vue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as A } from "./AgoClient-
|
|
1
|
+
import { t as A } from "./AgoClient-q39FIjSC.js";
|
|
2
2
|
import { computed as L, inject as M, onMounted as f, onScopeDispose as F, onUnmounted as h, ref as c, shallowRef as S } from "vue";
|
|
3
3
|
var N = /* @__PURE__ */ Symbol("ago-client"), b = { install(t, n) {
|
|
4
4
|
const e = new A(n);
|
package/dist/widget.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const se=require("./AgoClient-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const se=require("./AgoClient-wcPRaIMs.cjs"),ct=require("./createFormCollector-eimwwWEi.cjs"),Gt=require("./createConversationSession-BBYfQLLS.cjs");var jt='"IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',Re=`var(--ago-font, ${jt})`,pt={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"},Ae="var(--ago-brand-color, #03182f)",_e="var(--ago-brand-text-color, #fff)",Vt="var(--ago-header-background, var(--ago-brand-color, #03182f))",ft="var(--ago-header-text-color, #e8f0fe)",ee="var(--ago-panel-background, #fff)",xt="var(--ago-messages-background, #fbfbfb)",J="var(--ago-text-color, #30373e)",bt="var(--ago-muted-text-color, #6b6d6f)",L="var(--ago-border-color, #dee3e8)",De="var(--ago-accent-color, #1b5fc4)",ut="var(--ago-agent-bubble-background, #f1f3f5)",qt="var(--ago-radius, 16px)",ze="var(--ago-message-radius, 16px)",Kt="var(--ago-message-radius, 20px)";function Xt(n,o){if(o)for(const i of Object.keys(pt)){const r=o[i];r!=null&&n.style.setProperty(pt[i],r)}}function v(n,o){Object.assign(n.style,o)}function h(n={}){const o=document.createElement("div");return v(o,n),o}var mt="ago-chat-widget-keyframes";function Qt(){if(typeof document>"u"||document.getElementById(mt))return;const n=document.createElement("style");n.id=mt,n.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); } }",document.head.appendChild(n)}function Yt(n){let o=[];const i=document.createElement("form");v(i,{display:"flex",flexDirection:"column",gap:"8px",padding:"12px",borderTop:`1px solid ${L}`,backgroundColor:ee}),i.className="ago-chat-input";const r=h({display:"flex",flexWrap:"wrap",gap:"6px"}),b=h({display:"flex",gap:"8px",alignItems:"flex-end"}),a=document.createElement("textarea");a.placeholder=n.placeholder,a.setAttribute("aria-label",n.placeholder),a.rows=1,v(a,{flex:"1",resize:"none",boxSizing:"border-box",padding:"10px 12px",border:`1px solid ${L}`,borderRadius:"12px",fontSize:"16px",fontFamily:Re,lineHeight:"1.4",maxHeight:"110px",overflowY:"hidden"});const C=()=>{a.style.height="auto";const c=Math.min(a.scrollHeight+2,110);a.style.height=`${c}px`,a.style.overflowY=a.scrollHeight+2>110?"auto":"hidden"};a.addEventListener("input",()=>{C(),A()});const m='<svg width="18" height="18" viewBox="0 -960 960 960" fill="currentColor" aria-hidden="true"><path d="M440-160v-487L216-423l-56-57 320-320 320 320-56 57-224-224v487h-80Z"/></svg>',x='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true" style="animation: ago-spin 0.8s linear infinite"><path d="M21 12a9 9 0 1 1-6.219-8.56"/></svg>',p=document.createElement("button");p.type="submit",p.setAttribute("aria-label","Send"),p.innerHTML=m,v(p,{flexShrink:"0",width:"40px",height:"40px",padding:"0",border:"none",borderRadius:"50%",backgroundColor:Ae,color:_e,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"});let f=!1;const A=()=>{const s=a.value.trim()!==""||o.length>0,c=f||!s;p.disabled=c,p.innerHTML=f?x:m,p.style.opacity=c&&!f?"0.5":"1",p.style.cursor=c?"default":"pointer"};let R=null,_=null;n.allowFiles&&(R=document.createElement("input"),R.type="file",R.multiple=!0,v(R,{display:"none"}),_=document.createElement("button"),_.type="button",_.setAttribute("aria-label","Attach file"),_.textContent="📎",v(_,{padding:"10px 12px",border:`1px solid ${L}`,borderRadius:"12px",backgroundColor:ee,cursor:"pointer",fontSize:"14px"}),_.addEventListener("click",()=>R?.click()),R.addEventListener("change",()=>{o=[...o,...Array.from(R?.files??[])],Y()}));function Y(){r.replaceChildren(),o.forEach((s,c)=>{const w=h({display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",backgroundColor:"#f0f4ff",border:`1px solid ${L}`,borderRadius:"8px",fontSize:"12px"}),$=document.createElement("span");$.textContent=s.name;const I=document.createElement("button");I.type="button",I.setAttribute("aria-label",`Remove ${s.name}`),I.textContent="×",v(I,{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",lineHeight:"1"}),I.addEventListener("click",()=>{o=o.filter((j,V)=>V!==c),Y()}),w.append($,I),r.appendChild(w)}),A()}const D=()=>{const s=a.value,c=o;return a.value="",C(),o=[],Y(),{content:s,files:c}},g=()=>{const{content:s,files:c}=D();(s.trim()||c.length>0)&&n.onSend(s.trim(),c.length>0?c:void 0)};return i.addEventListener("submit",s=>{s.preventDefault(),g()}),a.addEventListener("keydown",s=>{s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),g())}),_&&b.appendChild(_),b.append(a,p),R&&i.appendChild(R),i.append(r,b),A(),{inputRow:i,getValueAndClear:D,setDisabled:s=>{a.disabled=s,f=s,A()},focus:()=>a.focus()}}var Zt={"&":"&","<":"<",">":">",'"':""","'":"'"};function ae(n){return n.replace(/[&<>"']/g,o=>Zt[o])}function gt(n){const o=n.trim();return/^(https?:|mailto:|tel:|#|\/|\.\/|\.\.\/)/i.test(o)||!/^[a-z][a-z0-9+.-]*:/i.test(o)?o:null}var vt='"IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace',Se="";function te(n){const o=[],i=b=>(o.push(b),`${Se}${o.length-1}${Se}`);let r=n;return r=r.replace(/`([^`]+)`/g,(b,a)=>i(`<code style="background:#f0f2f5;padding:2px 5px;border-radius:4px;font-size:13px;font-family:${vt}">${ae(a)}</code>`)),r=r.replace(/!\[([^\]]*)\]\(([^)\s]+)\)/g,(b,a,C)=>{const m=gt(C);return m?i(`<img alt="${ae(a)}" src="${ae(m)}" style="max-width:100%;border-radius:8px;margin:4px 0" />`):b}),r=r.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(b,a,C)=>{const m=gt(C);return m?i(`<a href="${ae(m)}" target="_blank" rel="noopener noreferrer" style="color:#1b5fc4;text-decoration:underline">${te(a)}</a>`):b}),r=ae(r),r=r.replace(/\*\*([^*]+?)\*\*/g,"<strong>$1</strong>").replace(/__([^_]+?)__/g,"<strong>$1</strong>").replace(/~~([^~]+?)~~/g,"<del>$1</del>").replace(/(^|[^*])\*(?!\s)([^*]+?)\*/g,"$1<em>$2</em>").replace(/(^|[^\w_])_(?!\s)([^_]+?)_/g,"$1<em>$2</em>"),r=r.replace(new RegExp(`${Se}(\\d+)${Se}`,"g"),(b,a)=>o[Number(a)]),r}function B(n,o,i){const r=document.createElement(n);return Object.assign(r.style,o),i!==void 0&&(r.innerHTML=i),r}var yt=/^ {0,3}([-*_])( *\1){2,} *$/,wt=/^ {0,3}(#{1,6})\s+(.*?)\s*#*\s*$/,Ct=/^ {0,3}(```+|~~~+)/,Ie=/^ {0,3}>\s?/,le=/^(\s*)([-*+]|\d+[.)])\s+(.*)$/,Jt=["20px","18px","16px","15px","14px","13px"],Fe=n=>n.match(/^\s*/)?.[0].length??0;function en(n){return n.trim()===""||yt.test(n)||wt.test(n)||Ct.test(n)||Ie.test(n)||le.test(n)}function Et(n){const o=n[0].match(le),i=o[1].length,r=/\d/.test(o[2]),b=B(r?"ol":"ul",{margin:"0 0 8px 0",paddingLeft:"20px",listStyleType:r?"decimal":"disc",listStylePosition:"outside"});let a=0;for(;a<n.length;){const C=n[a].match(le),m=[];for(a++;a<n.length&&Fe(n[a])>i;)m.push(n[a]),a++;const x=B("li",{display:"list-item",margin:"2px 0",lineHeight:"1.6"}),p=C[3].match(/^\[([ xX])\]\s+(.*)$/);p?(x.style.listStyleType="none",x.style.marginLeft="-20px",x.innerHTML=`<span style="margin-right:6px">${p[1].toLowerCase()==="x"?"☑":"☐"}</span>${te(p[2])}`):x.innerHTML=te(C[3]),m.filter(f=>le.test(f)).length>0&&x.appendChild(Et(m.filter(f=>f.trim()!==""))),b.appendChild(x)}return b}function tn(n){const o=m=>m.replace(/^\s*\|?/,"").replace(/\|?\s*$/,"").split("|").map(x=>x.trim()),i=B("div",{overflowX:"auto",margin:"0 0 8px 0"}),r=B("table",{borderCollapse:"collapse",width:"100%",fontSize:"13px"}),b=document.createElement("thead"),a=document.createElement("tr");for(const m of o(n[0]))a.appendChild(B("th",{border:"1px solid #dee3e8",padding:"6px 10px",textAlign:"left",backgroundColor:"#f5f7fa",fontWeight:"600"},te(m)));b.appendChild(a),r.appendChild(b);const C=document.createElement("tbody");for(const m of n.slice(2)){const x=document.createElement("tr");for(const p of o(m))x.appendChild(B("td",{border:"1px solid #dee3e8",padding:"6px 10px"},te(p)));C.appendChild(x)}return r.appendChild(C),i.appendChild(r),i}var nn=n=>!!n&&/^\s*\|?\s*:?-{1,}:?\s*(\|\s*:?-{1,}:?\s*)*\|?\s*$/.test(n);function ke(n){const o=document.createDocumentFragment(),i=n.replace(/\r\n?/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`);let r=0;for(;r<i.length;){const a=i[r];if(a.trim()===""){r++;continue}const C=a.match(Ct);if(C){const p=C[1][0],f=[];for(r++;r<i.length&&!new RegExp(`^ {0,3}${p==="`"?"`{3,}":"~{3,}"}\\s*$`).test(i[r]);)f.push(i[r]),r++;r++;const A=B("pre",{margin:"0 0 8px 0"});A.appendChild(B("code",{display:"block",background:"#f5f5f5",padding:"8px 12px",borderRadius:"6px",fontSize:"13px",overflowX:"auto",fontFamily:vt,whiteSpace:"pre"},ae(f.join(`
|
|
4
4
|
`)))),o.appendChild(A);continue}if(yt.test(a)){o.appendChild(B("hr",{border:"none",borderTop:"1px solid #dee3e8",margin:"12px 0"})),r++;continue}const m=a.match(wt);if(m){const p=m[1].length;o.appendChild(B(`h${p}`,{margin:"16px 0 8px 0",fontSize:Jt[p-1],fontWeight:"600",lineHeight:"1.3"},te(m[2]))),r++;continue}if(Ie.test(a)){const p=[];for(;r<i.length&&Ie.test(i[r]);)p.push(i[r].replace(Ie,"")),r++;const f=B("blockquote",{borderLeft:"4px solid #dee3e8",paddingLeft:"12px",margin:"0 0 8px 0",fontStyle:"italic",color:"#6b6d6f"});f.appendChild(ke(p.join(`
|
package/dist/widget.d.cts
CHANGED
|
@@ -476,11 +476,11 @@ declare interface AgoConfig {
|
|
|
476
476
|
warnOnEmptyReply?: boolean;
|
|
477
477
|
/**
|
|
478
478
|
* How the agent loop treats client function calls (requires backend support):
|
|
479
|
-
* - `"
|
|
480
|
-
* result; the real result is only visible to the agent on later turns.
|
|
481
|
-
* - `"pause"`: the turn stops on client function call(s) with status
|
|
479
|
+
* - `"pause"` (default): the turn stops on client function call(s) with status
|
|
482
480
|
* `WAITING_CLIENT`; once every result is submitted, the SDK resumes the SAME
|
|
483
481
|
* turn via `POST /messages/{id}/continue`, so the agent sees the real results.
|
|
482
|
+
* - `"placeholder"` (legacy): the turn continues immediately on a placeholder
|
|
483
|
+
* result; the real result is only visible to the agent on later turns.
|
|
484
484
|
* Older backends ignore the flag, so `"pause"` degrades to legacy behavior.
|
|
485
485
|
*/
|
|
486
486
|
clientFunctionsMode?: ClientFunctionsMode;
|
package/dist/widget.d.ts
CHANGED
|
@@ -476,11 +476,11 @@ declare interface AgoConfig {
|
|
|
476
476
|
warnOnEmptyReply?: boolean;
|
|
477
477
|
/**
|
|
478
478
|
* How the agent loop treats client function calls (requires backend support):
|
|
479
|
-
* - `"
|
|
480
|
-
* result; the real result is only visible to the agent on later turns.
|
|
481
|
-
* - `"pause"`: the turn stops on client function call(s) with status
|
|
479
|
+
* - `"pause"` (default): the turn stops on client function call(s) with status
|
|
482
480
|
* `WAITING_CLIENT`; once every result is submitted, the SDK resumes the SAME
|
|
483
481
|
* turn via `POST /messages/{id}/continue`, so the agent sees the real results.
|
|
482
|
+
* - `"placeholder"` (legacy): the turn continues immediately on a placeholder
|
|
483
|
+
* result; the real result is only visible to the agent on later turns.
|
|
484
484
|
* Older backends ignore the flag, so `"pause"` degrades to legacy behavior.
|
|
485
485
|
*/
|
|
486
486
|
clientFunctionsMode?: ClientFunctionsMode;
|
package/dist/widget.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as Wt, i as Ut, m as Gt, o as Vt, s as jt, t as qt } from "./AgoClient-
|
|
2
|
-
import { r as Kt, t as Xt } from "./createFormCollector-
|
|
3
|
-
import { t as Qt } from "./createConversationSession-
|
|
1
|
+
import { a as Wt, i as Ut, m as Gt, o as Vt, s as jt, t as qt } from "./AgoClient-q39FIjSC.js";
|
|
2
|
+
import { r as Kt, t as Xt } from "./createFormCollector-sB6rMccD.js";
|
|
3
|
+
import { t as Qt } from "./createConversationSession-DCSWShaW.js";
|
|
4
4
|
var Yt = '"IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', Se = `var(--ago-font, ${Yt})`, dt = {
|
|
5
5
|
font: "--ago-font",
|
|
6
6
|
radius: "--ago-radius",
|
package/llms-full.txt
CHANGED
|
@@ -1086,6 +1086,7 @@ ago.getMessages(conversationId)
|
|
|
1086
1086
|
ago.registerFunction(definition) // or (name, handler, schema)
|
|
1087
1087
|
ago.unregisterFunction(name)
|
|
1088
1088
|
ago.registerNavigationFunction(navigate, routes)
|
|
1089
|
+
ago.enableAutoContinueAfterNavigation(options?) // returns a disable fn
|
|
1089
1090
|
ago.registerPageStateFunction(controls, opts?) / ago.unregisterPageStateFunction(functionName?)
|
|
1090
1091
|
|
|
1091
1092
|
ago.submitToolCallForm(toolCallId, formData)
|
|
@@ -1131,6 +1132,14 @@ this.ago.registerNavigationFunction((path) => router.navigateByUrl(path), [
|
|
|
1131
1132
|
]);
|
|
1132
1133
|
```
|
|
1133
1134
|
|
|
1135
|
+
To make "go to page B and change X" work in one user message, enable
|
|
1136
|
+
auto-continue once (e.g. in the root component) and disable it on teardown:
|
|
1137
|
+
|
|
1138
|
+
```ts
|
|
1139
|
+
private stopAutoContinue = this.ago.enableAutoContinueAfterNavigation();
|
|
1140
|
+
// ngOnDestroy: this.stopAutoContinue();
|
|
1141
|
+
```
|
|
1142
|
+
|
|
1134
1143
|
Register page state, the mirror of navigation (change the current page's state
|
|
1135
1144
|
and read it back):
|
|
1136
1145
|
|
|
@@ -1387,16 +1396,29 @@ function AppShell() {
|
|
|
1387
1396
|
}
|
|
1388
1397
|
```
|
|
1389
1398
|
|
|
1399
|
+
Outside React, the same behavior ships as a framework-agnostic helper. Attach it
|
|
1400
|
+
once per client; it returns a detach function:
|
|
1401
|
+
|
|
1402
|
+
```ts
|
|
1403
|
+
import { attachAutoContinueAfterNavigation } from "@useago/sdk";
|
|
1404
|
+
|
|
1405
|
+
const detach = attachAutoContinueAfterNavigation(client);
|
|
1406
|
+
```
|
|
1407
|
+
|
|
1408
|
+
Angular wraps it as `agoService.enableAutoContinueAfterNavigation(options?)`,
|
|
1409
|
+
which also returns the disable function (call it in `ngOnDestroy`).
|
|
1410
|
+
|
|
1390
1411
|
How the gap is bridged depends on the client-functions mode:
|
|
1391
1412
|
|
|
1392
|
-
- **Pause mode** (
|
|
1413
|
+
- **Pause mode** (the default, `clientFunctionsMode: "pause"` —
|
|
1393
1414
|
needs a backend with pause/resume support): the backend pauses the turn on the
|
|
1394
1415
|
navigation call. The SDK submits the function result and resumes the SAME turn
|
|
1395
1416
|
via `POST /messages/{id}/continue`; the hook only delays that resume until the
|
|
1396
1417
|
destination's `useAgoPageState` registered. No extra prompt, no second turn,
|
|
1397
1418
|
and the agent sees the real function results.
|
|
1398
1419
|
|
|
1399
|
-
- **Placeholder mode** (legacy
|
|
1420
|
+
- **Placeholder mode** (legacy, `clientFunctionsMode: "placeholder"`, also what
|
|
1421
|
+
older backends without pause/resume support fall back to): when the navigating turn ends, the hook
|
|
1400
1422
|
waits for the destination page to register, then sends a continuation message
|
|
1401
1423
|
with `{ hidden: true }` — kept in the model's context, never displayed
|
|
1402
1424
|
(`useMessages` and `ChatWidget` filter hidden messages). Without backend
|
|
@@ -1720,7 +1742,7 @@ interface AgoConfig {
|
|
|
1720
1742
|
userJwt?: string; // Authorization: Bearer <jwt>, authenticated users
|
|
1721
1743
|
debug?: boolean; // enable verbose console logging
|
|
1722
1744
|
warnOnEmptyReply?: boolean; // default true; see "Empty replies" below
|
|
1723
|
-
clientFunctionsMode?: "placeholder" | "pause"; // default "
|
|
1745
|
+
clientFunctionsMode?: "placeholder" | "pause"; // default "pause"
|
|
1724
1746
|
maxFunctionResultBytes?: number; // default 50000; cap on client function results
|
|
1725
1747
|
}
|
|
1726
1748
|
```
|
|
@@ -1735,7 +1757,7 @@ interface AgoConfig {
|
|
|
1735
1757
|
| `userJwt` | — | `Authorization: Bearer …` | For authenticated sessions. |
|
|
1736
1758
|
| `debug` | — | — | Turns on the SDK's logger. |
|
|
1737
1759
|
| `warnOnEmptyReply` | — | — | Default `true`: warn on the console (once per conversation) when a reply completes empty, usually an unknown `agent` slug. The [`message:empty` event](events-and-streaming.md#events) fires regardless. |
|
|
1738
|
-
| `clientFunctionsMode` | — | `client_functions_mode` in the body | `"pause"
|
|
1760
|
+
| `clientFunctionsMode` | — | `client_functions_mode` in the body | Default `"pause"`: the agent stops on client function call(s) and resumes the SAME turn once the results are submitted (the SDK submits and resumes automatically; see the [`message:waiting-client` event](events-and-streaming.md#events)). Needs a backend with pause/resume support; older backends ignore the flag and fall back to placeholder behavior. Legacy `"placeholder"`: the turn continues on a placeholder and results are only visible on later turns. Per-message override via `sendMessage(..., { clientFunctionsMode })`. |
|
|
1739
1761
|
| `maxFunctionResultBytes` | — | — | Default `50000`. Client function results larger than this (serialized) are replaced with a truncated preview before reaching the LLM. Override per function with `maxResultBytes`; see [result size limit](functions-and-context.md#result-size-limit). |
|
|
1740
1762
|
|
|
1741
1763
|
---
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|