@useago/sdk 1.0.5 → 1.0.7

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 (36) hide show
  1. package/README.md +53 -0
  2. package/dist/angular.d.cts +2 -0
  3. package/dist/angular.d.ts +2 -0
  4. package/dist/{createConversationSession-lJWANT6T.cjs → createConversationSession-BuMXp0Ia.cjs} +1 -1
  5. package/dist/{createConversationSession-Boi0PjDU.js → createConversationSession-CCT1hCf8.js} +1 -1
  6. package/dist/createFormCollector-BwM7qTrp.js +276 -0
  7. package/dist/createFormCollector-DWzGKDwO.cjs +1 -0
  8. package/dist/devtools.d.cts +2 -0
  9. package/dist/devtools.d.ts +2 -0
  10. package/dist/{functions-C1-5vadY.js → functions-CApuQZ2b.js} +50 -43
  11. package/dist/{functions-DsmzgHjC.cjs → functions-Djnq-JAo.cjs} +1 -1
  12. package/dist/helpers.cjs +1 -1
  13. package/dist/helpers.js +1 -1
  14. package/dist/index.cjs +1 -1
  15. package/dist/index.d.cts +19 -0
  16. package/dist/index.d.ts +19 -0
  17. package/dist/index.js +35 -35
  18. package/dist/react.cjs +3 -31
  19. package/dist/react.d.cts +19 -0
  20. package/dist/react.d.ts +19 -0
  21. package/dist/react.js +603 -8158
  22. package/dist/rolldown-runtime-16Nf8qvH.cjs +1 -0
  23. package/dist/testing.d.cts +2 -0
  24. package/dist/testing.d.ts +2 -0
  25. package/dist/vue.cjs +1 -1
  26. package/dist/vue.d.cts +2 -0
  27. package/dist/vue.d.ts +2 -0
  28. package/dist/widget.cjs +4 -4
  29. package/dist/widget.d.cts +22 -0
  30. package/dist/widget.d.ts +22 -0
  31. package/dist/widget.js +347 -297
  32. package/package.json +3 -3
  33. package/dist/createFormCollector-BUqSA2Qw.js +0 -257
  34. package/dist/createFormCollector-CSG5ioym.cjs +0 -1
  35. package/dist/rolldown-runtime-CaekUdDJ.cjs +0 -1
  36. package/dist/rolldown-runtime-DxmricAu.js +0 -25
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./AgoClient--y10UXUV.cjs"),m=require("./createFormCollector-CSG5ioym.cjs"),p=require("./createConversationSession-lJWANT6T.cjs"),w=require("./createMockClient-zHQ0cjUH.cjs");require("./testing.cjs");const g=require("./functions-DsmzgHjC.cjs");function h(e){return e}function E(e,o){return e.on("message:complete",o),()=>e.off("message:complete",o)}function S(e,o){return e.on("message:chunk",o),()=>e.off("message:chunk",o)}function y(e,o){return e.on("message:start",o),()=>e.off("message:start",o)}function v(e,o){return e.on("message:error",o),()=>e.off("message:error",o)}function b(e,o){return e.on("toolCall:received",o),()=>e.off("toolCall:received",o)}function F(e,o){return e.on("function:invoke",o),()=>e.off("function:invoke",o)}async function*M(e,o,l){const a=[];let r=null,s=!1;const c=i=>{a.push(i),r?.()},f=i=>c({type:"start",data:i}),t=i=>c({type:"chunk",data:i}),u=i=>{c({type:"complete",data:i}),s=!0,r?.()},d=i=>{c({type:"error",data:i}),s=!0,r?.()},C=i=>c({type:"toolCall",data:i});e.on("message:start",f),e.on("message:chunk",t),e.on("message:complete",u),e.on("message:error",d),e.on("toolCall:received",C),e.sendMessage(o,l).catch(()=>{s=!0,r?.()});try{for(;!s||a.length>0;)a.length>0?yield a.shift():(await new Promise(i=>{r=i}),r=null)}finally{e.off("message:start",f),e.off("message:chunk",t),e.off("message:complete",u),e.off("message:error",d),e.off("toolCall:received",C)}}function A(e){let o,l,a,r,s,c;if(typeof window<"u"&&window.AGO){const t=window.AGO;o=t.basepath,l=t.widgetId,a=t.agent||t.defaultAgent,r=t.permission,s=t.email,c=t.jwt}if(typeof document<"u"){const t=u=>document.querySelector(`meta[name="${u}"]`)?.getAttribute("content")||void 0;o=o||t("ago-base-url"),l=l||t("ago-widget-id"),a=a||t("ago-agent")||t("ago-agent-id"),r=r||t("ago-permission"),s=s||t("ago-user-email")}if(typeof document<"u"){const t=[document.body,...Array.from(document.querySelectorAll("script[data-ago-base-url]"))].filter(Boolean);for(const u of t)u&&(o=o||u.getAttribute("data-ago-base-url")||void 0,l=l||u.getAttribute("data-ago-widget-id")||void 0,a=a||u.getAttribute("data-ago-agent")||u.getAttribute("data-ago-agent-id")||void 0,r=r||u.getAttribute("data-ago-permission")||void 0,s=s||u.getAttribute("data-ago-user-email")||void 0)}o=e?.baseUrl||o,l=e?.widgetId||l,a=e?.agent||e?.defaultAgentId||a,r=e?.permission||r,s=e?.userEmail||s,c=e?.userJwt||c;const f=e?.debug;return o?{baseUrl:o,widgetId:l,agent:a,permission:r,userEmail:s,userJwt:c,debug:f}:null}function k(e){const o=A(e);if(!o)throw new n.AgoError('createAgo(): could not detect AGO configuration. Set window.AGO, add <meta name="ago-base-url">, or pass { baseUrl } explicitly.',"config_missing_base_url");return new n.AgoClient(o)}function q(e,o){return{...e,handler:o}}exports.AgoApiError=n.AgoApiError;exports.AgoClient=n.AgoClient;exports.AgoError=n.AgoError;exports.AgoFunctionError=n.AgoFunctionError;exports.AgoNetworkError=n.AgoNetworkError;exports.AgoStreamError=n.AgoStreamError;exports.ClientContextRegistry=n.ClientContextRegistry;exports.EventEmitter=n.EventEmitter;exports.FunctionRegistry=n.FunctionRegistry;exports.SSEHandler=n.SSEHandler;exports.autoDetectConfig=A;exports.copyToClipboard=g.copyToClipboard;exports.createAgo=k;exports.createConversationSession=p.createConversationSession;exports.createFormCollector=m.createFormCollector;exports.createMessageStream=M;exports.createMockClient=w.createMockClient;exports.createStore=m.createStore;exports.defineFunction=h;exports.deriveFormStatus=m.deriveFormStatus;exports.getLocalStorage=g.getLocalStorage;exports.getUserLocation=g.getUserLocation;exports.highlightElement=g.highlightElement;exports.isStreamNetworkError=n.isStreamNetworkError;exports.loadFormCollector=m.loadFormCollector;exports.logger=n.logger;exports.onFunctionInvoke=F;exports.onMessage=E;exports.onMessageChunk=S;exports.onMessageError=v;exports.onMessageStart=y;exports.onToolCall=b;exports.openUrl=g.openUrl;exports.scrollToElement=g.scrollToElement;exports.setLocalStorage=g.setLocalStorage;exports.setTheme=g.setTheme;exports.showConfirmDialog=g.showConfirmDialog;exports.showNotification=g.showNotification;exports.showToast=g.showToast;exports.submitForm=g.submitForm;exports.trackEvent=g.trackEvent;exports.validateConfig=n.validateConfig;exports.withHandler=q;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./AgoClient--y10UXUV.cjs"),m=require("./createFormCollector-DWzGKDwO.cjs"),p=require("./createConversationSession-BuMXp0Ia.cjs"),w=require("./createMockClient-zHQ0cjUH.cjs");require("./testing.cjs");const g=require("./functions-Djnq-JAo.cjs");function h(e){return e}function E(e,o){return e.on("message:complete",o),()=>e.off("message:complete",o)}function S(e,o){return e.on("message:chunk",o),()=>e.off("message:chunk",o)}function y(e,o){return e.on("message:start",o),()=>e.off("message:start",o)}function v(e,o){return e.on("message:error",o),()=>e.off("message:error",o)}function b(e,o){return e.on("toolCall:received",o),()=>e.off("toolCall:received",o)}function F(e,o){return e.on("function:invoke",o),()=>e.off("function:invoke",o)}async function*M(e,o,l){const a=[];let r=null,s=!1;const c=i=>{a.push(i),r?.()},f=i=>c({type:"start",data:i}),t=i=>c({type:"chunk",data:i}),u=i=>{c({type:"complete",data:i}),s=!0,r?.()},d=i=>{c({type:"error",data:i}),s=!0,r?.()},C=i=>c({type:"toolCall",data:i});e.on("message:start",f),e.on("message:chunk",t),e.on("message:complete",u),e.on("message:error",d),e.on("toolCall:received",C),e.sendMessage(o,l).catch(()=>{s=!0,r?.()});try{for(;!s||a.length>0;)a.length>0?yield a.shift():(await new Promise(i=>{r=i}),r=null)}finally{e.off("message:start",f),e.off("message:chunk",t),e.off("message:complete",u),e.off("message:error",d),e.off("toolCall:received",C)}}function A(e){let o,l,a,r,s,c;if(typeof window<"u"&&window.AGO){const t=window.AGO;o=t.basepath,l=t.widgetId,a=t.agent||t.defaultAgent,r=t.permission,s=t.email,c=t.jwt}if(typeof document<"u"){const t=u=>document.querySelector(`meta[name="${u}"]`)?.getAttribute("content")||void 0;o=o||t("ago-base-url"),l=l||t("ago-widget-id"),a=a||t("ago-agent")||t("ago-agent-id"),r=r||t("ago-permission"),s=s||t("ago-user-email")}if(typeof document<"u"){const t=[document.body,...Array.from(document.querySelectorAll("script[data-ago-base-url]"))].filter(Boolean);for(const u of t)u&&(o=o||u.getAttribute("data-ago-base-url")||void 0,l=l||u.getAttribute("data-ago-widget-id")||void 0,a=a||u.getAttribute("data-ago-agent")||u.getAttribute("data-ago-agent-id")||void 0,r=r||u.getAttribute("data-ago-permission")||void 0,s=s||u.getAttribute("data-ago-user-email")||void 0)}o=e?.baseUrl||o,l=e?.widgetId||l,a=e?.agent||e?.defaultAgentId||a,r=e?.permission||r,s=e?.userEmail||s,c=e?.userJwt||c;const f=e?.debug;return o?{baseUrl:o,widgetId:l,agent:a,permission:r,userEmail:s,userJwt:c,debug:f}:null}function k(e){const o=A(e);if(!o)throw new n.AgoError('createAgo(): could not detect AGO configuration. Set window.AGO, add <meta name="ago-base-url">, or pass { baseUrl } explicitly.',"config_missing_base_url");return new n.AgoClient(o)}function q(e,o){return{...e,handler:o}}exports.AgoApiError=n.AgoApiError;exports.AgoClient=n.AgoClient;exports.AgoError=n.AgoError;exports.AgoFunctionError=n.AgoFunctionError;exports.AgoNetworkError=n.AgoNetworkError;exports.AgoStreamError=n.AgoStreamError;exports.ClientContextRegistry=n.ClientContextRegistry;exports.EventEmitter=n.EventEmitter;exports.FunctionRegistry=n.FunctionRegistry;exports.SSEHandler=n.SSEHandler;exports.autoDetectConfig=A;exports.copyToClipboard=g.copyToClipboard;exports.createAgo=k;exports.createConversationSession=p.createConversationSession;exports.createFormCollector=m.createFormCollector;exports.createMessageStream=M;exports.createMockClient=w.createMockClient;exports.createStore=m.createStore;exports.defineFunction=h;exports.deriveFormStatus=m.deriveFormStatus;exports.getLocalStorage=g.getLocalStorage;exports.getUserLocation=g.getUserLocation;exports.highlightElement=g.highlightElement;exports.isStreamNetworkError=n.isStreamNetworkError;exports.loadFormCollector=m.loadFormCollector;exports.logger=n.logger;exports.onFunctionInvoke=F;exports.onMessage=E;exports.onMessageChunk=S;exports.onMessageError=v;exports.onMessageStart=y;exports.onToolCall=b;exports.openUrl=g.openUrl;exports.scrollToElement=g.scrollToElement;exports.setLocalStorage=g.setLocalStorage;exports.setTheme=g.setTheme;exports.showConfirmDialog=g.showConfirmDialog;exports.showNotification=g.showNotification;exports.showToast=g.showToast;exports.submitForm=g.submitForm;exports.trackEvent=g.trackEvent;exports.validateConfig=n.validateConfig;exports.withHandler=q;
package/dist/index.d.cts CHANGED
@@ -742,6 +742,16 @@ export declare interface CreateFormCollectorOptions<V = Record<string, unknown>>
742
742
  submit?: SubmitConfig<V>;
743
743
  /** Pre-filled values. */
744
744
  initialValues?: Partial<V>;
745
+ /**
746
+ * Submit on its own as soon as every required field is filled, without waiting
747
+ * for the agent or a UI button. The form submits at most once. Defaults to
748
+ * `true` whenever a `submit` target is set: when on, no `submit_<name>` function
749
+ * is exposed, the form submits itself, and the agent never confirms a submit.
750
+ * Pass `autoSubmit: false` to keep the manual flow (expose `submit_<name>` and
751
+ * submit only on an explicit call). Has no effect on a collect-only form (no
752
+ * `submit` target); setting it `true` there is ignored with a warning.
753
+ */
754
+ autoSubmit?: boolean;
745
755
  }
746
756
 
747
757
  /**
@@ -897,6 +907,8 @@ export declare interface FormCollectorDefinition<V = Record<string, unknown>> {
897
907
  schema: FormCollectorSchema;
898
908
  /** Server-stored submit target, if any. Absent means collect-only. */
899
909
  submit?: SubmitConfig<V>;
910
+ /** Server-stored default for auto-submitting once the form is complete. */
911
+ autoSubmit?: boolean;
900
912
  }
901
913
 
902
914
  /**
@@ -915,6 +927,13 @@ export declare interface FormCollectorState<V = Record<string, unknown>> {
915
927
  values: Partial<V>;
916
928
  /** True once a submit succeeded. */
917
929
  submitted: boolean;
930
+ /**
931
+ * The submit response, set once `submitted` is true: the resolved value of the
932
+ * client `handler`, the parsed JSON of a client `url` POST, or the backend
933
+ * relay result. Lets a UI surface a server-returned message. Undefined until
934
+ * a submit succeeds (and after `reset()`).
935
+ */
936
+ submitResult?: unknown;
918
937
  }
919
938
 
920
939
  /** Completeness status derived from values + schema — computed on read, never stored. */
package/dist/index.d.ts CHANGED
@@ -742,6 +742,16 @@ export declare interface CreateFormCollectorOptions<V = Record<string, unknown>>
742
742
  submit?: SubmitConfig<V>;
743
743
  /** Pre-filled values. */
744
744
  initialValues?: Partial<V>;
745
+ /**
746
+ * Submit on its own as soon as every required field is filled, without waiting
747
+ * for the agent or a UI button. The form submits at most once. Defaults to
748
+ * `true` whenever a `submit` target is set: when on, no `submit_<name>` function
749
+ * is exposed, the form submits itself, and the agent never confirms a submit.
750
+ * Pass `autoSubmit: false` to keep the manual flow (expose `submit_<name>` and
751
+ * submit only on an explicit call). Has no effect on a collect-only form (no
752
+ * `submit` target); setting it `true` there is ignored with a warning.
753
+ */
754
+ autoSubmit?: boolean;
745
755
  }
746
756
 
747
757
  /**
@@ -897,6 +907,8 @@ export declare interface FormCollectorDefinition<V = Record<string, unknown>> {
897
907
  schema: FormCollectorSchema;
898
908
  /** Server-stored submit target, if any. Absent means collect-only. */
899
909
  submit?: SubmitConfig<V>;
910
+ /** Server-stored default for auto-submitting once the form is complete. */
911
+ autoSubmit?: boolean;
900
912
  }
901
913
 
902
914
  /**
@@ -915,6 +927,13 @@ export declare interface FormCollectorState<V = Record<string, unknown>> {
915
927
  values: Partial<V>;
916
928
  /** True once a submit succeeded. */
917
929
  submitted: boolean;
930
+ /**
931
+ * The submit response, set once `submitted` is true: the resolved value of the
932
+ * client `handler`, the parsed JSON of a client `url` POST, or the backend
933
+ * relay result. Lets a UI surface a server-returned message. Undefined until
934
+ * a submit succeeds (and after `reset()`).
935
+ */
936
+ submitResult?: unknown;
918
937
  }
919
938
 
920
939
  /** Completeness status derived from values + schema — computed on read, never stored. */
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { a as h, c as A, d as y, f as C, i as E, l as b, n as S, o as v, p as k, r as F, s as M, t as d, u as c } from "./AgoClient-DYdIe_R4.js";
2
- import { i as I, n as U, r as G, t as O } from "./createFormCollector-BUqSA2Qw.js";
3
- import { t as x } from "./createConversationSession-Boi0PjDU.js";
4
- import { t as N } from "./createMockClient-DwdxNwEn.js";
1
+ import { a as h, c as A, d as y, f as C, i as E, l as b, m as S, o as v, p as k, r as F, s as M, t as T, u as I } from "./functions-CApuQZ2b.js";
2
+ import { a as G, c as O, d as q, f as x, i as L, l as N, n as _, o as D, p as H, r as J, s as R, t as d, u as c } from "./AgoClient-DYdIe_R4.js";
3
+ import { i as B, n as P, r as $, t as z } from "./createFormCollector-BwM7qTrp.js";
4
+ import { t as Q } from "./createConversationSession-CCT1hCf8.js";
5
+ import { t as W } from "./createMockClient-DwdxNwEn.js";
5
6
  import "./testing.js";
6
- import { a as H, c as J, d as R, f as j, i as B, l as P, m as $, o as z, p as K, r as Q, s as V, t as W, u as X } from "./functions-C1-5vadY.js";
7
7
  function Y(e) {
8
8
  return e;
9
9
  }
@@ -100,47 +100,47 @@ function ie(e, o) {
100
100
  };
101
101
  }
102
102
  export {
103
- b as AgoApiError,
103
+ N as AgoApiError,
104
104
  d as AgoClient,
105
105
  c as AgoError,
106
- y as AgoFunctionError,
107
- C as AgoNetworkError,
108
- k as AgoStreamError,
109
- v as ClientContextRegistry,
110
- F as EventEmitter,
111
- M as FunctionRegistry,
112
- E as SSEHandler,
106
+ q as AgoFunctionError,
107
+ x as AgoNetworkError,
108
+ H as AgoStreamError,
109
+ D as ClientContextRegistry,
110
+ J as EventEmitter,
111
+ R as FunctionRegistry,
112
+ L as SSEHandler,
113
113
  p as autoDetectConfig,
114
- W as copyToClipboard,
114
+ T as copyToClipboard,
115
115
  se as createAgo,
116
- x as createConversationSession,
117
- O as createFormCollector,
116
+ Q as createConversationSession,
117
+ z as createFormCollector,
118
118
  ne as createMessageStream,
119
- N as createMockClient,
120
- I as createStore,
119
+ W as createMockClient,
120
+ B as createStore,
121
121
  Y as defineFunction,
122
- U as deriveFormStatus,
123
- Q as getLocalStorage,
124
- B as getUserLocation,
125
- H as highlightElement,
126
- h as isStreamNetworkError,
127
- G as loadFormCollector,
128
- A as logger,
122
+ P as deriveFormStatus,
123
+ F as getLocalStorage,
124
+ E as getUserLocation,
125
+ h as highlightElement,
126
+ G as isStreamNetworkError,
127
+ $ as loadFormCollector,
128
+ O as logger,
129
129
  re as onFunctionInvoke,
130
130
  Z as onMessage,
131
131
  ee as onMessageChunk,
132
132
  te as onMessageError,
133
133
  oe as onMessageStart,
134
134
  ae as onToolCall,
135
- z as openUrl,
136
- V as scrollToElement,
137
- J as setLocalStorage,
138
- P as setTheme,
139
- X as showConfirmDialog,
140
- R as showNotification,
141
- j as showToast,
142
- K as submitForm,
143
- $ as trackEvent,
144
- S as validateConfig,
135
+ v as openUrl,
136
+ M as scrollToElement,
137
+ A as setLocalStorage,
138
+ b as setTheme,
139
+ I as showConfirmDialog,
140
+ y as showNotification,
141
+ C as showToast,
142
+ k as submitForm,
143
+ S as trackEvent,
144
+ _ as validateConfig,
145
145
  ie as withHandler
146
146
  };