@useago/sdk 1.0.4 → 1.0.6

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 (41) hide show
  1. package/README.md +3 -3
  2. package/dist/{AgoClient-1jgDndKs.cjs → AgoClient--y10UXUV.cjs} +1 -1
  3. package/dist/{AgoClient-j1sk1hK5.js → AgoClient-DYdIe_R4.js} +9 -6
  4. package/dist/angular.cjs +1 -1
  5. package/dist/angular.d.cts +49 -2
  6. package/dist/angular.d.ts +49 -2
  7. package/dist/angular.js +1 -1
  8. package/dist/{createConversationSession-CZhoTCtD.js → createConversationSession-Boi0PjDU.js} +1 -1
  9. package/dist/{createConversationSession-BYNhYbkY.cjs → createConversationSession-lJWANT6T.cjs} +1 -1
  10. package/dist/{createFormCollector-BPKzKDeX.js → createFormCollector-BUqSA2Qw.js} +1 -1
  11. package/dist/{createFormCollector-B8V9YSGe.cjs → createFormCollector-CSG5ioym.cjs} +1 -1
  12. package/dist/devtools.cjs +41 -27
  13. package/dist/devtools.d.cts +48 -0
  14. package/dist/devtools.d.ts +48 -0
  15. package/dist/devtools.js +98 -70
  16. package/dist/{functions-C1-5vadY.js → functions-CApuQZ2b.js} +50 -43
  17. package/dist/{functions-DsmzgHjC.cjs → functions-Djnq-JAo.cjs} +1 -1
  18. package/dist/helpers.cjs +1 -1
  19. package/dist/helpers.js +1 -1
  20. package/dist/index.cjs +1 -1
  21. package/dist/index.d.cts +12 -0
  22. package/dist/index.d.ts +12 -0
  23. package/dist/index.js +35 -35
  24. package/dist/react.cjs +3 -31
  25. package/dist/react.d.cts +49 -2
  26. package/dist/react.d.ts +49 -2
  27. package/dist/react.js +599 -8156
  28. package/dist/rolldown-runtime-16Nf8qvH.cjs +1 -0
  29. package/dist/testing.d.cts +48 -0
  30. package/dist/testing.d.ts +48 -0
  31. package/dist/vue.cjs +1 -1
  32. package/dist/vue.d.cts +49 -2
  33. package/dist/vue.d.ts +49 -2
  34. package/dist/vue.js +1 -1
  35. package/dist/widget.cjs +1 -1
  36. package/dist/widget.d.cts +48 -0
  37. package/dist/widget.d.ts +48 -0
  38. package/dist/widget.js +3 -3
  39. package/package.json +6 -6
  40. package/dist/rolldown-runtime-CaekUdDJ.cjs +0 -1
  41. package/dist/rolldown-runtime-DxmricAu.js +0 -25
@@ -0,0 +1 @@
1
+ var b=Object.create,u=Object.defineProperty,c=Object.getOwnPropertyDescriptor,O=Object.getOwnPropertyNames,v=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty,f=(e,r)=>{let t={};for(var a in e)u(t,a,{get:e[a],enumerable:!0});return r||u(t,Symbol.toStringTag,{value:"Module"}),t},g=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(var o=O(r),_=0,l=o.length,n;_<l;_++)n=o[_],!P.call(e,n)&&n!==t&&u(e,n,{get:(p=>r[p]).bind(null,n),enumerable:!(a=c(r,n))||a.enumerable});return e},i=(e,r,t)=>(t=e!=null?b(v(e)):{},g(r||!e||!e.__esModule?u(t,"default",{value:e,enumerable:!0}):t,e));Object.defineProperty(exports,"__exportAll",{enumerable:!0,get:function(){return f}});Object.defineProperty(exports,"__toESM",{enumerable:!0,get:function(){return i}});
@@ -243,6 +243,13 @@ declare interface AgoClientEvents {
243
243
  conversationId: string;
244
244
  messageId: string;
245
245
  };
246
+ /**
247
+ * Every raw SSE message parsed off the stream, before the handler interprets it
248
+ * into the higher-level `message:*` / `toolCall:*` / `function:*` events. Carries
249
+ * the chunk verbatim so debugging tools (notably the dev panel) can log the exact
250
+ * wire payload. Heartbeat comments are not messages and don't fire this.
251
+ */
252
+ "stream:message": SSEChunkData;
246
253
  /**
247
254
  * The main answer text is done (backend emitted `status: "DONE"`), but follow-up
248
255
  * replies may still be pending. Fires once, before `message:complete`.
@@ -571,6 +578,47 @@ declare interface SendMessageOptions {
571
578
  files?: File[];
572
579
  }
573
580
 
581
+ /**
582
+ * SSE stream chunk data
583
+ */
584
+ declare interface SSEChunkData {
585
+ content?: string;
586
+ full_content?: string;
587
+ message_id?: string;
588
+ status?: MessageStatus;
589
+ thread?: {
590
+ id: string;
591
+ };
592
+ agent?: {
593
+ id: string;
594
+ name: string;
595
+ display_name?: string;
596
+ };
597
+ knowledge_sources?: Array<{
598
+ knowledge_document: {
599
+ id: string;
600
+ title: string;
601
+ use_external_link: boolean;
602
+ external_link_url?: string;
603
+ internal_link_url?: string;
604
+ };
605
+ position: number;
606
+ }>;
607
+ tool_call_data?: boolean;
608
+ type?: string;
609
+ id?: string;
610
+ tool_name?: string;
611
+ tool_display_name?: string;
612
+ function_name?: string;
613
+ arguments?: Record<string, unknown>;
614
+ form_schema?: FormSchema;
615
+ message?: string;
616
+ data?: Record<string, unknown>;
617
+ follow_up_replies?: string[];
618
+ satisfaction_feedback?: unknown;
619
+ ask_to_talk_to_human?: boolean;
620
+ }
621
+
574
622
  /**
575
623
  * Where a completed form is sent.
576
624
  * - `"https://..."` (a bare string) — shorthand for `{ via: "client", url }`: the browser
package/dist/testing.d.ts CHANGED
@@ -243,6 +243,13 @@ declare interface AgoClientEvents {
243
243
  conversationId: string;
244
244
  messageId: string;
245
245
  };
246
+ /**
247
+ * Every raw SSE message parsed off the stream, before the handler interprets it
248
+ * into the higher-level `message:*` / `toolCall:*` / `function:*` events. Carries
249
+ * the chunk verbatim so debugging tools (notably the dev panel) can log the exact
250
+ * wire payload. Heartbeat comments are not messages and don't fire this.
251
+ */
252
+ "stream:message": SSEChunkData;
246
253
  /**
247
254
  * The main answer text is done (backend emitted `status: "DONE"`), but follow-up
248
255
  * replies may still be pending. Fires once, before `message:complete`.
@@ -571,6 +578,47 @@ declare interface SendMessageOptions {
571
578
  files?: File[];
572
579
  }
573
580
 
581
+ /**
582
+ * SSE stream chunk data
583
+ */
584
+ declare interface SSEChunkData {
585
+ content?: string;
586
+ full_content?: string;
587
+ message_id?: string;
588
+ status?: MessageStatus;
589
+ thread?: {
590
+ id: string;
591
+ };
592
+ agent?: {
593
+ id: string;
594
+ name: string;
595
+ display_name?: string;
596
+ };
597
+ knowledge_sources?: Array<{
598
+ knowledge_document: {
599
+ id: string;
600
+ title: string;
601
+ use_external_link: boolean;
602
+ external_link_url?: string;
603
+ internal_link_url?: string;
604
+ };
605
+ position: number;
606
+ }>;
607
+ tool_call_data?: boolean;
608
+ type?: string;
609
+ id?: string;
610
+ tool_name?: string;
611
+ tool_display_name?: string;
612
+ function_name?: string;
613
+ arguments?: Record<string, unknown>;
614
+ form_schema?: FormSchema;
615
+ message?: string;
616
+ data?: Record<string, unknown>;
617
+ follow_up_replies?: string[];
618
+ satisfaction_feedback?: unknown;
619
+ ask_to_talk_to_human?: boolean;
620
+ }
621
+
574
622
  /**
575
623
  * Where a completed form is sent.
576
624
  * - `"https://..."` (a bare string) — shorthand for `{ via: "client", url }`: the browser
package/dist/vue.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./rolldown-runtime-CaekUdDJ.cjs"),p=require("./AgoClient-1jgDndKs.cjs");let t=require("vue");var I=Symbol("ago-client"),y={install(o,n){const e=new p.AgoClient(n);o.provide(I,e)}};function g(o){if(o)return new p.AgoClient(o);const n=(0,t.inject)(I);if(!n)throw new Error("useAgo(): no AgoClient found. Either pass config or install AgoPlugin.");return n}function E(o={}){const n=o.client??g(),e=(0,t.ref)([]),s=(0,t.ref)(o.conversationId),i=(0,t.ref)(!1),r=(0,t.ref)(null),c=a=>{s.value||(s.value=a.conversationId)},f=a=>{const u=e.value.findIndex(v=>v.id===a.messageId);u>=0&&(e.value[u]={...e.value[u],content:e.value[u].content+a.content})},m=a=>{const u=e.value.findIndex(v=>v.id===a.id);u>=0?e.value[u]=a:e.value.push(a),i.value=!1},C=a=>{r.value=new Error(a.error),i.value=!1};(0,t.onMounted)(()=>{n.on("message:start",c),n.on("message:chunk",f),n.on("message:complete",m),n.on("message:error",C)}),(0,t.onUnmounted)(()=>{n.off("message:start",c),n.off("message:chunk",f),n.off("message:complete",m),n.off("message:error",C)});async function d(a,u){i.value=!0,r.value=null;const v={id:`temp-${Date.now()}`,conversationId:s.value||"",content:a,role:"user",status:"DONE",createdAt:new Date},L={id:`temp-assistant-${Date.now()}`,conversationId:s.value||"",content:"",role:"assistant",status:"IN_PROGRESS",createdAt:new Date};e.value.push(v,L);try{const l=await n.sendMessage(a,{conversationId:s.value,files:u});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"),i.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:i,error:r,conversationId:s,sendMessage:d,clearMessages:h}}function M(o={}){const n=o.client??g(),e=o.autoLoad??!0,s=(0,t.ref)([]),i=(0,t.ref)(null),r=(0,t.ref)(!1),c=(0,t.ref)(null);async function f(){r.value=!0,c.value=null;try{s.value=await n.getConversations()}catch(d){c.value=d instanceof Error?d:new Error("Failed to load conversations")}finally{r.value=!1}}async function m(d){r.value=!0,c.value=null;try{i.value=await n.getConversation(d)}catch(h){c.value=h instanceof Error?h:new Error("Failed to load conversation")}finally{r.value=!1}}function C(){i.value=null}return(0,t.onMounted)(()=>{e&&f()}),{conversations:s,currentConversation:i,isLoading:r,error:c,selectConversation:m,startNewConversation:C,refreshConversations:f}}function N(o={}){const n=E({client:o.client,conversationId:o.conversationId}),e=M({client:o.client,autoLoad:o.autoLoad}),s=(0,t.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 F(o,n){const e=g();(0,t.onMounted)(()=>{e.registerFunction(o,n.handler,{description:n.description,parameters:n.parameters})}),(0,t.onUnmounted)(()=>{e.unregisterFunction(o)})}function S(o,n){const e=g();(0,t.onMounted)(()=>{e.registerNavigationFunction(o,n)}),(0,t.onUnmounted)(()=>{e.unregisterFunction("navigateToPage")})}function _(o,n){const e=g();(0,t.onMounted)(()=>{e.on(o,n)}),(0,t.onUnmounted)(()=>{e.off(o,n)})}function D(o){const n=(0,t.shallowRef)(o.get());return(0,t.onScopeDispose)(o.subscribe(e=>{n.value=e})),n}exports.AGO_CLIENT_KEY=I;exports.AgoPlugin=y;exports.useAgo=g;exports.useAgoEvents=_;exports.useAgoFunction=F;exports.useAgoNavigation=S;exports.useAgoStore=D;exports.useChat=N;exports.useConversation=M;exports.useMessages=E;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./rolldown-runtime-16Nf8qvH.cjs"),p=require("./AgoClient--y10UXUV.cjs");let t=require("vue");var I=Symbol("ago-client"),y={install(o,n){const e=new p.AgoClient(n);o.provide(I,e)}};function g(o){if(o)return new p.AgoClient(o);const n=(0,t.inject)(I);if(!n)throw new Error("useAgo(): no AgoClient found. Either pass config or install AgoPlugin.");return n}function E(o={}){const n=o.client??g(),e=(0,t.ref)([]),s=(0,t.ref)(o.conversationId),i=(0,t.ref)(!1),r=(0,t.ref)(null),c=a=>{s.value||(s.value=a.conversationId)},f=a=>{const u=e.value.findIndex(v=>v.id===a.messageId);u>=0&&(e.value[u]={...e.value[u],content:e.value[u].content+a.content})},m=a=>{const u=e.value.findIndex(v=>v.id===a.id);u>=0?e.value[u]=a:e.value.push(a),i.value=!1},C=a=>{r.value=new Error(a.error),i.value=!1};(0,t.onMounted)(()=>{n.on("message:start",c),n.on("message:chunk",f),n.on("message:complete",m),n.on("message:error",C)}),(0,t.onUnmounted)(()=>{n.off("message:start",c),n.off("message:chunk",f),n.off("message:complete",m),n.off("message:error",C)});async function d(a,u){i.value=!0,r.value=null;const v={id:`temp-${Date.now()}`,conversationId:s.value||"",content:a,role:"user",status:"DONE",createdAt:new Date},L={id:`temp-assistant-${Date.now()}`,conversationId:s.value||"",content:"",role:"assistant",status:"IN_PROGRESS",createdAt:new Date};e.value.push(v,L);try{const l=await n.sendMessage(a,{conversationId:s.value,files:u});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"),i.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:i,error:r,conversationId:s,sendMessage:d,clearMessages:h}}function M(o={}){const n=o.client??g(),e=o.autoLoad??!0,s=(0,t.ref)([]),i=(0,t.ref)(null),r=(0,t.ref)(!1),c=(0,t.ref)(null);async function f(){r.value=!0,c.value=null;try{s.value=await n.getConversations()}catch(d){c.value=d instanceof Error?d:new Error("Failed to load conversations")}finally{r.value=!1}}async function m(d){r.value=!0,c.value=null;try{i.value=await n.getConversation(d)}catch(h){c.value=h instanceof Error?h:new Error("Failed to load conversation")}finally{r.value=!1}}function C(){i.value=null}return(0,t.onMounted)(()=>{e&&f()}),{conversations:s,currentConversation:i,isLoading:r,error:c,selectConversation:m,startNewConversation:C,refreshConversations:f}}function N(o={}){const n=E({client:o.client,conversationId:o.conversationId}),e=M({client:o.client,autoLoad:o.autoLoad}),s=(0,t.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 F(o,n){const e=g();(0,t.onMounted)(()=>{e.registerFunction(o,n.handler,{description:n.description,parameters:n.parameters})}),(0,t.onUnmounted)(()=>{e.unregisterFunction(o)})}function S(o,n){const e=g();(0,t.onMounted)(()=>{e.registerNavigationFunction(o,n)}),(0,t.onUnmounted)(()=>{e.unregisterFunction("navigateToPage")})}function _(o,n){const e=g();(0,t.onMounted)(()=>{e.on(o,n)}),(0,t.onUnmounted)(()=>{e.off(o,n)})}function D(o){const n=(0,t.shallowRef)(o.get());return(0,t.onScopeDispose)(o.subscribe(e=>{n.value=e})),n}exports.AGO_CLIENT_KEY=I;exports.AgoPlugin=y;exports.useAgo=g;exports.useAgoEvents=_;exports.useAgoFunction=F;exports.useAgoNavigation=S;exports.useAgoStore=D;exports.useChat=N;exports.useConversation=M;exports.useMessages=E;
package/dist/vue.d.cts CHANGED
@@ -251,6 +251,13 @@ declare interface AgoClientEvents {
251
251
  conversationId: string;
252
252
  messageId: string;
253
253
  };
254
+ /**
255
+ * Every raw SSE message parsed off the stream, before the handler interprets it
256
+ * into the higher-level `message:*` / `toolCall:*` / `function:*` events. Carries
257
+ * the chunk verbatim so debugging tools (notably the dev panel) can log the exact
258
+ * wire payload. Heartbeat comments are not messages and don't fire this.
259
+ */
260
+ "stream:message": SSEChunkData;
254
261
  /**
255
262
  * The main answer text is done (backend emitted `status: "DONE"`), but follow-up
256
263
  * replies may still be pending. Fires once, before `message:complete`.
@@ -358,8 +365,7 @@ export declare const AgoPlugin: {
358
365
  install(app: App, options: AgoPluginOptions): void;
359
366
  };
360
367
 
361
- export declare interface AgoPluginOptions extends AgoConfig {
362
- }
368
+ export declare type AgoPluginOptions = AgoConfig;
363
369
 
364
370
  declare interface AgoRoute {
365
371
  name: string;
@@ -568,6 +574,47 @@ declare interface SendMessageOptions {
568
574
  files?: File[];
569
575
  }
570
576
 
577
+ /**
578
+ * SSE stream chunk data
579
+ */
580
+ declare interface SSEChunkData {
581
+ content?: string;
582
+ full_content?: string;
583
+ message_id?: string;
584
+ status?: MessageStatus;
585
+ thread?: {
586
+ id: string;
587
+ };
588
+ agent?: {
589
+ id: string;
590
+ name: string;
591
+ display_name?: string;
592
+ };
593
+ knowledge_sources?: Array<{
594
+ knowledge_document: {
595
+ id: string;
596
+ title: string;
597
+ use_external_link: boolean;
598
+ external_link_url?: string;
599
+ internal_link_url?: string;
600
+ };
601
+ position: number;
602
+ }>;
603
+ tool_call_data?: boolean;
604
+ type?: string;
605
+ id?: string;
606
+ tool_name?: string;
607
+ tool_display_name?: string;
608
+ function_name?: string;
609
+ arguments?: Record<string, unknown>;
610
+ form_schema?: FormSchema;
611
+ message?: string;
612
+ data?: Record<string, unknown>;
613
+ follow_up_replies?: string[];
614
+ satisfaction_feedback?: unknown;
615
+ ask_to_talk_to_human?: boolean;
616
+ }
617
+
571
618
  /**
572
619
  * A minimal observable store: one value, synchronous subscriptions, and
573
620
  * optional persistence via {@link PersistOptions} (localStorage by default).
package/dist/vue.d.ts CHANGED
@@ -251,6 +251,13 @@ declare interface AgoClientEvents {
251
251
  conversationId: string;
252
252
  messageId: string;
253
253
  };
254
+ /**
255
+ * Every raw SSE message parsed off the stream, before the handler interprets it
256
+ * into the higher-level `message:*` / `toolCall:*` / `function:*` events. Carries
257
+ * the chunk verbatim so debugging tools (notably the dev panel) can log the exact
258
+ * wire payload. Heartbeat comments are not messages and don't fire this.
259
+ */
260
+ "stream:message": SSEChunkData;
254
261
  /**
255
262
  * The main answer text is done (backend emitted `status: "DONE"`), but follow-up
256
263
  * replies may still be pending. Fires once, before `message:complete`.
@@ -358,8 +365,7 @@ export declare const AgoPlugin: {
358
365
  install(app: App, options: AgoPluginOptions): void;
359
366
  };
360
367
 
361
- export declare interface AgoPluginOptions extends AgoConfig {
362
- }
368
+ export declare type AgoPluginOptions = AgoConfig;
363
369
 
364
370
  declare interface AgoRoute {
365
371
  name: string;
@@ -568,6 +574,47 @@ declare interface SendMessageOptions {
568
574
  files?: File[];
569
575
  }
570
576
 
577
+ /**
578
+ * SSE stream chunk data
579
+ */
580
+ declare interface SSEChunkData {
581
+ content?: string;
582
+ full_content?: string;
583
+ message_id?: string;
584
+ status?: MessageStatus;
585
+ thread?: {
586
+ id: string;
587
+ };
588
+ agent?: {
589
+ id: string;
590
+ name: string;
591
+ display_name?: string;
592
+ };
593
+ knowledge_sources?: Array<{
594
+ knowledge_document: {
595
+ id: string;
596
+ title: string;
597
+ use_external_link: boolean;
598
+ external_link_url?: string;
599
+ internal_link_url?: string;
600
+ };
601
+ position: number;
602
+ }>;
603
+ tool_call_data?: boolean;
604
+ type?: string;
605
+ id?: string;
606
+ tool_name?: string;
607
+ tool_display_name?: string;
608
+ function_name?: string;
609
+ arguments?: Record<string, unknown>;
610
+ form_schema?: FormSchema;
611
+ message?: string;
612
+ data?: Record<string, unknown>;
613
+ follow_up_replies?: string[];
614
+ satisfaction_feedback?: unknown;
615
+ ask_to_talk_to_human?: boolean;
616
+ }
617
+
571
618
  /**
572
619
  * A minimal observable store: one value, synchronous subscriptions, and
573
620
  * optional persistence via {@link PersistOptions} (localStorage by default).
package/dist/vue.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as A } from "./AgoClient-j1sk1hK5.js";
1
+ import { t as A } from "./AgoClient-DYdIe_R4.js";
2
2
  import { computed as y, inject as F, onMounted as g, onScopeDispose as N, onUnmounted as I, ref as c, shallowRef as D } from "vue";
3
3
  var L = /* @__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 ke=require("./AgoClient-1jgDndKs.cjs"),$e=require("./createFormCollector-B8V9YSGe.cjs"),Ke=require("./createConversationSession-BYNhYbkY.cjs");var Ve={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function U(o){return o.replace(/[&<>"']/g,n=>Ve[n])}function Ae(o){const n=o.trim();return/^(https?:|mailto:|tel:|#|\/|\.\/|\.\.\/)/i.test(n)||!/^[a-z][a-z0-9+.-]*:/i.test(n)?n:null}var Te='"IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace',Q="";function M(o){const n=[],r=u=>(n.push(u),`${Q}${n.length-1}${Q}`);let t=o;return t=t.replace(/`([^`]+)`/g,(u,i)=>r(`<code style="background:#f0f2f5;padding:2px 5px;border-radius:4px;font-size:13px;font-family:${Te}">${U(i)}</code>`)),t=t.replace(/!\[([^\]]*)\]\(([^)\s]+)\)/g,(u,i,f)=>{const s=Ae(f);return s?r(`<img alt="${U(i)}" src="${U(s)}" style="max-width:100%;border-radius:8px;margin:4px 0" />`):u}),t=t.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(u,i,f)=>{const s=Ae(f);return s?r(`<a href="${U(s)}" target="_blank" rel="noopener noreferrer" style="color:#1b5fc4;text-decoration:underline">${M(i)}</a>`):u}),t=U(t),t=t.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>"),t=t.replace(new RegExp(`${Q}(\\d+)${Q}`,"g"),(u,i)=>n[Number(i)]),t}function _(o,n,r){const t=document.createElement(o);return Object.assign(t.style,n),r!==void 0&&(t.innerHTML=r),t}var De=/^ {0,3}([-*_])( *\1){2,} *$/,Me=/^ {0,3}(#{1,6})\s+(.*?)\s*#*\s*$/,Be=/^ {0,3}(```+|~~~+)/,Z=/^ {0,3}>\s?/,P=/^(\s*)([-*+]|\d+[.)])\s+(.*)$/,Qe=["20px","18px","16px","15px","14px","13px"],fe=o=>o.match(/^\s*/)?.[0].length??0;function Ye(o){return o.trim()===""||De.test(o)||Me.test(o)||Be.test(o)||Z.test(o)||P.test(o)}function ze(o){const n=o[0].match(P),r=n[1].length,t=/\d/.test(n[2]),u=_(t?"ol":"ul",{margin:"0 0 8px 0",paddingLeft:"20px",listStyleType:t?"decimal":"disc",listStylePosition:"outside"});let i=0;for(;i<o.length;){const f=o[i].match(P),s=[];for(i++;i<o.length&&fe(o[i])>r;)s.push(o[i]),i++;const p=_("li",{display:"list-item",margin:"2px 0",lineHeight:"1.6"}),c=f[3].match(/^\[([ xX])\]\s+(.*)$/);c?(p.style.listStyleType="none",p.style.marginLeft="-20px",p.innerHTML=`<span style="margin-right:6px">${c[1].toLowerCase()==="x"?"☑":"☐"}</span>${M(c[2])}`):p.innerHTML=M(f[3]),s.filter(h=>P.test(h)).length>0&&p.appendChild(ze(s.filter(h=>h.trim()!==""))),u.appendChild(p)}return u}function Ze(o){const n=s=>s.replace(/^\s*\|?/,"").replace(/\|?\s*$/,"").split("|").map(p=>p.trim()),r=_("div",{overflowX:"auto",margin:"0 0 8px 0"}),t=_("table",{borderCollapse:"collapse",width:"100%",fontSize:"13px"}),u=document.createElement("thead"),i=document.createElement("tr");for(const s of n(o[0]))i.appendChild(_("th",{border:"1px solid #dee3e8",padding:"6px 10px",textAlign:"left",backgroundColor:"#f5f7fa",fontWeight:"600"},M(s)));u.appendChild(i),t.appendChild(u);const f=document.createElement("tbody");for(const s of o.slice(2)){const p=document.createElement("tr");for(const c of n(s))p.appendChild(_("td",{border:"1px solid #dee3e8",padding:"6px 10px"},M(c)));f.appendChild(p)}return t.appendChild(f),r.appendChild(t),r}var Je=o=>!!o&&/^\s*\|?\s*:?-{1,}:?\s*(\|\s*:?-{1,}:?\s*)*\|?\s*$/.test(o);function J(o){const n=document.createDocumentFragment(),r=o.replace(/\r\n?/g,`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ke=require("./AgoClient--y10UXUV.cjs"),$e=require("./createFormCollector-CSG5ioym.cjs"),Ke=require("./createConversationSession-lJWANT6T.cjs");var Ve={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function U(o){return o.replace(/[&<>"']/g,n=>Ve[n])}function Ae(o){const n=o.trim();return/^(https?:|mailto:|tel:|#|\/|\.\/|\.\.\/)/i.test(n)||!/^[a-z][a-z0-9+.-]*:/i.test(n)?n:null}var Te='"IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace',Q="";function M(o){const n=[],r=u=>(n.push(u),`${Q}${n.length-1}${Q}`);let t=o;return t=t.replace(/`([^`]+)`/g,(u,i)=>r(`<code style="background:#f0f2f5;padding:2px 5px;border-radius:4px;font-size:13px;font-family:${Te}">${U(i)}</code>`)),t=t.replace(/!\[([^\]]*)\]\(([^)\s]+)\)/g,(u,i,f)=>{const s=Ae(f);return s?r(`<img alt="${U(i)}" src="${U(s)}" style="max-width:100%;border-radius:8px;margin:4px 0" />`):u}),t=t.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(u,i,f)=>{const s=Ae(f);return s?r(`<a href="${U(s)}" target="_blank" rel="noopener noreferrer" style="color:#1b5fc4;text-decoration:underline">${M(i)}</a>`):u}),t=U(t),t=t.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>"),t=t.replace(new RegExp(`${Q}(\\d+)${Q}`,"g"),(u,i)=>n[Number(i)]),t}function _(o,n,r){const t=document.createElement(o);return Object.assign(t.style,n),r!==void 0&&(t.innerHTML=r),t}var De=/^ {0,3}([-*_])( *\1){2,} *$/,Me=/^ {0,3}(#{1,6})\s+(.*?)\s*#*\s*$/,Be=/^ {0,3}(```+|~~~+)/,Z=/^ {0,3}>\s?/,P=/^(\s*)([-*+]|\d+[.)])\s+(.*)$/,Qe=["20px","18px","16px","15px","14px","13px"],fe=o=>o.match(/^\s*/)?.[0].length??0;function Ye(o){return o.trim()===""||De.test(o)||Me.test(o)||Be.test(o)||Z.test(o)||P.test(o)}function ze(o){const n=o[0].match(P),r=n[1].length,t=/\d/.test(n[2]),u=_(t?"ol":"ul",{margin:"0 0 8px 0",paddingLeft:"20px",listStyleType:t?"decimal":"disc",listStylePosition:"outside"});let i=0;for(;i<o.length;){const f=o[i].match(P),s=[];for(i++;i<o.length&&fe(o[i])>r;)s.push(o[i]),i++;const p=_("li",{display:"list-item",margin:"2px 0",lineHeight:"1.6"}),c=f[3].match(/^\[([ xX])\]\s+(.*)$/);c?(p.style.listStyleType="none",p.style.marginLeft="-20px",p.innerHTML=`<span style="margin-right:6px">${c[1].toLowerCase()==="x"?"☑":"☐"}</span>${M(c[2])}`):p.innerHTML=M(f[3]),s.filter(h=>P.test(h)).length>0&&p.appendChild(ze(s.filter(h=>h.trim()!==""))),u.appendChild(p)}return u}function Ze(o){const n=s=>s.replace(/^\s*\|?/,"").replace(/\|?\s*$/,"").split("|").map(p=>p.trim()),r=_("div",{overflowX:"auto",margin:"0 0 8px 0"}),t=_("table",{borderCollapse:"collapse",width:"100%",fontSize:"13px"}),u=document.createElement("thead"),i=document.createElement("tr");for(const s of n(o[0]))i.appendChild(_("th",{border:"1px solid #dee3e8",padding:"6px 10px",textAlign:"left",backgroundColor:"#f5f7fa",fontWeight:"600"},M(s)));u.appendChild(i),t.appendChild(u);const f=document.createElement("tbody");for(const s of o.slice(2)){const p=document.createElement("tr");for(const c of n(s))p.appendChild(_("td",{border:"1px solid #dee3e8",padding:"6px 10px"},M(c)));f.appendChild(p)}return t.appendChild(f),r.appendChild(t),r}var Je=o=>!!o&&/^\s*\|?\s*:?-{1,}:?\s*(\|\s*:?-{1,}:?\s*)*\|?\s*$/.test(o);function J(o){const n=document.createDocumentFragment(),r=o.replace(/\r\n?/g,`
2
2
  `).split(`
3
3
  `);let t=0;for(;t<r.length;){const i=r[t];if(i.trim()===""){t++;continue}const f=i.match(Be);if(f){const c=f[1][0],h=[];for(t++;t<r.length&&!new RegExp(`^ {0,3}${c==="`"?"`{3,}":"~{3,}"}\\s*$`).test(r[t]);)h.push(r[t]),t++;t++;const L=_("pre",{margin:"0 0 8px 0"});L.appendChild(_("code",{display:"block",background:"#f5f5f5",padding:"8px 12px",borderRadius:"6px",fontSize:"13px",overflowX:"auto",fontFamily:Te,whiteSpace:"pre"},U(h.join(`
4
4
  `)))),n.appendChild(L);continue}if(De.test(i)){n.appendChild(_("hr",{border:"none",borderTop:"1px solid #dee3e8",margin:"12px 0"})),t++;continue}const s=i.match(Me);if(s){const c=s[1].length;n.appendChild(_(`h${c}`,{margin:"16px 0 8px 0",fontSize:Qe[c-1],fontWeight:"600",lineHeight:"1.3"},M(s[2]))),t++;continue}if(Z.test(i)){const c=[];for(;t<r.length&&Z.test(r[t]);)c.push(r[t].replace(Z,"")),t++;const h=_("blockquote",{borderLeft:"4px solid #dee3e8",paddingLeft:"12px",margin:"0 0 8px 0",fontStyle:"italic",color:"#6b6d6f"});h.appendChild(J(c.join(`
package/dist/widget.d.cts CHANGED
@@ -243,6 +243,13 @@ declare interface AgoClientEvents {
243
243
  conversationId: string;
244
244
  messageId: string;
245
245
  };
246
+ /**
247
+ * Every raw SSE message parsed off the stream, before the handler interprets it
248
+ * into the higher-level `message:*` / `toolCall:*` / `function:*` events. Carries
249
+ * the chunk verbatim so debugging tools (notably the dev panel) can log the exact
250
+ * wire payload. Heartbeat comments are not messages and don't fire this.
251
+ */
252
+ "stream:message": SSEChunkData;
246
253
  /**
247
254
  * The main answer text is done (backend emitted `status: "DONE"`), but follow-up
248
255
  * replies may still be pending. Fires once, before `message:complete`.
@@ -835,6 +842,47 @@ declare interface SendMessageOptions {
835
842
  files?: File[];
836
843
  }
837
844
 
845
+ /**
846
+ * SSE stream chunk data
847
+ */
848
+ declare interface SSEChunkData {
849
+ content?: string;
850
+ full_content?: string;
851
+ message_id?: string;
852
+ status?: MessageStatus;
853
+ thread?: {
854
+ id: string;
855
+ };
856
+ agent?: {
857
+ id: string;
858
+ name: string;
859
+ display_name?: string;
860
+ };
861
+ knowledge_sources?: Array<{
862
+ knowledge_document: {
863
+ id: string;
864
+ title: string;
865
+ use_external_link: boolean;
866
+ external_link_url?: string;
867
+ internal_link_url?: string;
868
+ };
869
+ position: number;
870
+ }>;
871
+ tool_call_data?: boolean;
872
+ type?: string;
873
+ id?: string;
874
+ tool_name?: string;
875
+ tool_display_name?: string;
876
+ function_name?: string;
877
+ arguments?: Record<string, unknown>;
878
+ form_schema?: FormSchema;
879
+ message?: string;
880
+ data?: Record<string, unknown>;
881
+ follow_up_replies?: string[];
882
+ satisfaction_feedback?: unknown;
883
+ ask_to_talk_to_human?: boolean;
884
+ }
885
+
838
886
  /** The slice of the Web Storage API that {@link createStore} relies on. */
839
887
  declare type StorageLike = Pick<Storage, "getItem" | "setItem">;
840
888
 
package/dist/widget.d.ts CHANGED
@@ -243,6 +243,13 @@ declare interface AgoClientEvents {
243
243
  conversationId: string;
244
244
  messageId: string;
245
245
  };
246
+ /**
247
+ * Every raw SSE message parsed off the stream, before the handler interprets it
248
+ * into the higher-level `message:*` / `toolCall:*` / `function:*` events. Carries
249
+ * the chunk verbatim so debugging tools (notably the dev panel) can log the exact
250
+ * wire payload. Heartbeat comments are not messages and don't fire this.
251
+ */
252
+ "stream:message": SSEChunkData;
246
253
  /**
247
254
  * The main answer text is done (backend emitted `status: "DONE"`), but follow-up
248
255
  * replies may still be pending. Fires once, before `message:complete`.
@@ -835,6 +842,47 @@ declare interface SendMessageOptions {
835
842
  files?: File[];
836
843
  }
837
844
 
845
+ /**
846
+ * SSE stream chunk data
847
+ */
848
+ declare interface SSEChunkData {
849
+ content?: string;
850
+ full_content?: string;
851
+ message_id?: string;
852
+ status?: MessageStatus;
853
+ thread?: {
854
+ id: string;
855
+ };
856
+ agent?: {
857
+ id: string;
858
+ name: string;
859
+ display_name?: string;
860
+ };
861
+ knowledge_sources?: Array<{
862
+ knowledge_document: {
863
+ id: string;
864
+ title: string;
865
+ use_external_link: boolean;
866
+ external_link_url?: string;
867
+ internal_link_url?: string;
868
+ };
869
+ position: number;
870
+ }>;
871
+ tool_call_data?: boolean;
872
+ type?: string;
873
+ id?: string;
874
+ tool_name?: string;
875
+ tool_display_name?: string;
876
+ function_name?: string;
877
+ arguments?: Record<string, unknown>;
878
+ form_schema?: FormSchema;
879
+ message?: string;
880
+ data?: Record<string, unknown>;
881
+ follow_up_replies?: string[];
882
+ satisfaction_feedback?: unknown;
883
+ ask_to_talk_to_human?: boolean;
884
+ }
885
+
838
886
  /** The slice of the Web Storage API that {@link createStore} relies on. */
839
887
  declare type StorageLike = Pick<Storage, "getItem" | "setItem">;
840
888
 
package/dist/widget.js CHANGED
@@ -1,6 +1,6 @@
1
- import { t as Xe, u as Ke } from "./AgoClient-j1sk1hK5.js";
2
- import { r as qe, t as Ve } from "./createFormCollector-BPKzKDeX.js";
3
- import { t as Qe } from "./createConversationSession-CZhoTCtD.js";
1
+ import { t as Xe, u as Ke } from "./AgoClient-DYdIe_R4.js";
2
+ import { r as qe, t as Ve } from "./createFormCollector-BUqSA2Qw.js";
3
+ import { t as Qe } from "./createConversationSession-Boi0PjDU.js";
4
4
  var Ye = {
5
5
  "&": "&amp;",
6
6
  "<": "&lt;",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useago/sdk",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Create In-APP AI agents that answers question and performs actions. Works with React, Vue, Angular and vanilla JS/TS.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -100,7 +100,7 @@
100
100
  "url": "https://github.com/useago/ago-sdk/issues"
101
101
  },
102
102
  "engines": {
103
- "node": ">=18"
103
+ "node": ">=20.19.0"
104
104
  },
105
105
  "files": [
106
106
  "dist",
@@ -146,16 +146,16 @@
146
146
  "@types/node": "^20.0.0",
147
147
  "@types/react": "^18.0.0",
148
148
  "@types/react-dom": "^18.0.0",
149
- "@typescript-eslint/eslint-plugin": "^7.0.0",
150
- "@typescript-eslint/parser": "^7.0.0",
151
- "esbuild": "^0.28.0",
149
+ "@typescript-eslint/eslint-plugin": "^8.0.0",
150
+ "@typescript-eslint/parser": "^8.0.0",
151
+ "esbuild": "^0.28.1",
152
152
  "eslint": "^8.0.0",
153
153
  "eslint-plugin-react-hooks": "^4.6.2",
154
154
  "jsdom": "^28.0.0",
155
155
  "publint": "^0.3.0",
156
156
  "react": "^18.0.0",
157
157
  "react-dom": "^18.0.0",
158
- "typescript": "^5.0.0",
158
+ "typescript": "^6.0.3",
159
159
  "vite": "^8.0.0",
160
160
  "vite-plugin-dts": "^4.0.0",
161
161
  "vitest": "^4.0.0",
@@ -1 +0,0 @@
1
- var c=Object.create,u=Object.defineProperty,b=Object.getOwnPropertyDescriptor,O=Object.getOwnPropertyNames,i=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty,v=(e,r)=>()=>(r||(e((r={exports:{}}).exports,r),e=null),r.exports),P=(e,r)=>{let t={};for(var o in e)u(t,o,{get:e[o],enumerable:!0});return r||u(t,Symbol.toStringTag,{value:"Module"}),t},g=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(var a=O(r),_=0,l=a.length,n;_<l;_++)n=a[_],!f.call(e,n)&&n!==t&&u(e,n,{get:(p=>r[p]).bind(null,n),enumerable:!(o=b(r,n))||o.enumerable});return e},j=(e,r,t)=>(t=e!=null?c(i(e)):{},g(r||!e||!e.__esModule?u(t,"default",{value:e,enumerable:!0}):t,e));Object.defineProperty(exports,"__commonJSMin",{enumerable:!0,get:function(){return v}});Object.defineProperty(exports,"__exportAll",{enumerable:!0,get:function(){return P}});Object.defineProperty(exports,"__toESM",{enumerable:!0,get:function(){return j}});
@@ -1,25 +0,0 @@
1
- var v = Object.create, _ = Object.defineProperty, O = Object.getOwnPropertyDescriptor, c = Object.getOwnPropertyNames, b = Object.getPrototypeOf, s = Object.prototype.hasOwnProperty, g = (e, r) => () => (r || (e((r = { exports: {} }).exports, r), e = null), r.exports), f = (e, r) => {
2
- let t = {};
3
- for (var n in e)
4
- _(t, n, {
5
- get: e[n],
6
- enumerable: !0
7
- });
8
- return r || _(t, Symbol.toStringTag, { value: "Module" }), t;
9
- }, P = (e, r, t, n) => {
10
- if (r && typeof r == "object" || typeof r == "function")
11
- for (var l = c(r), p = 0, o = l.length, a; p < o; p++)
12
- a = l[p], !s.call(e, a) && a !== t && _(e, a, {
13
- get: ((u) => r[u]).bind(null, a),
14
- enumerable: !(n = O(r, a)) || n.enumerable
15
- });
16
- return e;
17
- }, i = (e, r, t) => (t = e != null ? v(b(e)) : {}, P(r || !e || !e.__esModule ? _(t, "default", {
18
- value: e,
19
- enumerable: !0
20
- }) : t, e));
21
- export {
22
- f as n,
23
- i as r,
24
- g as t
25
- };