@useago/sdk 1.12.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +71 -4
  2. package/README.md +73 -0
  3. package/dist/angular.cjs +1 -1
  4. package/dist/angular.d.cts +97 -28
  5. package/dist/angular.d.ts +97 -28
  6. package/dist/angular.js +4 -1
  7. package/dist/{createConversationSession-B1Qn-y0I.js → createConversationSession-BfJg0WyA.js} +1 -1
  8. package/dist/{createConversationSession-B3v_xOU7.cjs → createConversationSession-CiOXKWl0.cjs} +1 -1
  9. package/dist/{createFormCollector-m79zk_NA.js → createFormCollector-DN1xjAv5.js} +1 -1
  10. package/dist/{createFormCollector-FvwDOqnV.cjs → createFormCollector-DnQl77Ko.cjs} +1 -1
  11. package/dist/createMockClient-BPt1gSve.cjs +1 -0
  12. package/dist/{createMockClient-Beao82tu.js → createMockClient-YoYr3pQr.js} +1 -0
  13. package/dist/devtools.cjs +4 -4
  14. package/dist/devtools.d.cts +95 -28
  15. package/dist/devtools.d.ts +95 -28
  16. package/dist/devtools.js +87 -84
  17. package/dist/helpers.d.cts +42 -12
  18. package/dist/helpers.d.ts +42 -12
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.d.cts +101 -35
  21. package/dist/index.d.ts +101 -35
  22. package/dist/index.js +44 -43
  23. package/dist/react.cjs +4 -4
  24. package/dist/react.d.cts +147 -28
  25. package/dist/react.d.ts +147 -28
  26. package/dist/react.js +814 -727
  27. package/dist/speechToText-BV7qxqPF.js +704 -0
  28. package/dist/speechToText-ZciRyyJE.cjs +1 -0
  29. package/dist/testing.cjs +1 -1
  30. package/dist/testing.d.cts +95 -28
  31. package/dist/testing.d.ts +95 -28
  32. package/dist/testing.js +1 -1
  33. package/dist/{types-Ct1hlKwg.js → types-Q7t1peH-.js} +595 -419
  34. package/dist/types-a7teDBnC.cjs +10 -0
  35. package/dist/vue.cjs +1 -1
  36. package/dist/vue.d.cts +105 -28
  37. package/dist/vue.d.ts +105 -28
  38. package/dist/vue.js +103 -101
  39. package/dist/widget.cjs +6 -6
  40. package/dist/widget.d.cts +127 -28
  41. package/dist/widget.d.ts +127 -28
  42. package/dist/widget.js +1717 -1772
  43. package/llms-full.txt +129 -1
  44. package/package.json +1 -1
  45. package/dist/createMockClient-BEOXI8yW.cjs +0 -1
  46. package/dist/sheetController-BThJRtOu.cjs +0 -1
  47. package/dist/sheetController-aEKXIvjk.js +0 -343
  48. package/dist/types-mcW8vB1U.cjs +0 -10
package/dist/vue.d.ts CHANGED
@@ -100,7 +100,10 @@ declare class AgoClient {
100
100
  * `null` otherwise.
101
101
  */
102
102
  proactive: ProactiveController | null;
103
+ /** Removes the mirrored WebMCP tools; `null` when the bridge is off. */
104
+ private detachWebMCP;
103
105
  constructor(config: AgoConfig);
106
+ private attachWebMCPBridge;
104
107
  /**
105
108
  * Send a message and receive a streaming response
106
109
  */
@@ -212,6 +215,7 @@ declare class AgoClient {
212
215
  * (the agent decides what to do next). No-op if the invocation is unknown.
213
216
  */
214
217
  rejectFunction(invocationId: string): Promise<void>;
218
+ /* Excluded from this release type: runExternalFunction */
215
219
  /**
216
220
  * Get a page of conversations, newest-first. `pageSize` is capped at 100 by
217
221
  * the backend (default 50). Returns the `{ data, has_more, total }` envelope
@@ -231,11 +235,20 @@ declare class AgoClient {
231
235
  * `SSEHandler.parseToolCall` so persisted and streamed tool calls match.
232
236
  */
233
237
  private static mapPersistedToolCalls;
238
+ /**
239
+ * Transcribe an audio file into editable text (`POST /api/sdk/v1/audio/transcriptions`).
240
+ * Requires speech to text to be enabled for the tenant. Supports FLAC, MP3,
241
+ * MP4, MPEG, MPGA, M4A, OGG, WAV and WebM files up to 25 MB.
242
+ * The filename must include the matching extension. For a MediaRecorder blob,
243
+ * wrap it in a File with the recording's extension and MIME type.
244
+ * Show the returned text as a draft; call `sendMessage` when the user sends it.
245
+ */
246
+ transcribeAudio(file: File, options?: TranscribeAudioOptions): Promise<AudioTranscription>;
234
247
  /**
235
248
  * The tenant's SDK configuration (`GET /api/sdk/v1/config`): per-permission
236
249
  * agents, the ticket form the agent's `ago_ticketing` tool opens, and the
237
- * file-attachment flag. The vanilla widget fetches it once, when a ticket
238
- * form first appears in a conversation.
250
+ * file-attachment and speech-to-text flags. The vanilla widget fetches it
251
+ * once, when a ticket form first appears in a conversation.
239
252
  */
240
253
  getConfig(): Promise<SdkConfig>;
241
254
  /**
@@ -372,6 +385,9 @@ declare class AgoClient {
372
385
  * Get all registered function schemas
373
386
  */
374
387
  getRegisteredFunctions(): ClientFunctionSchema[];
388
+ /** The callback form of `functions:changed`. Returns an unsubscribe. */
389
+ onFunctionsChanged(listener: () => void): () => void;
390
+ /* Excluded from this release type: getFunctionRegistrations */
375
391
  /**
376
392
  * Execute a registered client function locally, through the same
377
393
  * FunctionRegistry path (result-size guard, error wrapping) as agent-invoked
@@ -704,6 +720,8 @@ declare interface AgoClientEvents {
704
720
  * call running immediately.
705
721
  */
706
722
  "function:awaiting-approval": ClientFunctionInvocation;
723
+ /** A function was registered or unregistered, or the registry cleared. */
724
+ "functions:changed": ClientFunctionSchema[];
707
725
  "function:result": {
708
726
  invocationId: string;
709
727
  result: unknown;
@@ -776,6 +794,8 @@ export declare interface AgoConfig {
776
794
  defaultAgentId?: string;
777
795
  /** Permission name to apply to all requests (sent as `X-Widget-Permission`). Mirrors the widget's `window.AGO.permission`. */
778
796
  permission?: string;
797
+ /** Interface locale selected by the host app, sent as Accept-Language. Null clears the override. */
798
+ language?: string | null;
779
799
  /** User email for identification */
780
800
  userEmail?: string;
781
801
  /** JWT token for authenticated users */
@@ -853,6 +873,15 @@ export declare interface AgoConfig {
853
873
  * mode's `jsErrors` signal. See `client.reportError()` for caught errors.
854
874
  */
855
875
  errorWatcher?: boolean | ErrorWatcherOptions;
876
+ /** Mirror every registered client function into the browser's WebMCP registry
877
+ * (`document.modelContext`), so an external agent can call the same functions
878
+ * the in-app agent calls. Off by default; no-ops without WebMCP.
879
+ *
880
+ * A mirrored function runs immediately: the approval gate
881
+ * ({@link approvalPolicy}, `requiresApproval`) covers the agent loop only.
882
+ * Use `webmcp: false` on a definition to keep it out.
883
+ */
884
+ webmcp?: boolean;
856
885
  }
857
886
 
858
887
  declare type AgoEventHandler<K extends AgoEventName> = (data: AgoClientEvents[K]) => void;
@@ -1058,6 +1087,11 @@ declare type AgoStateSetResult = {
1058
1087
  result: "unchanged";
1059
1088
  };
1060
1089
 
1090
+ /** Editable text returned by `AgoClient.transcribeAudio`. */
1091
+ declare interface AudioTranscription {
1092
+ text: string;
1093
+ }
1094
+
1061
1095
  /** One JavaScript error captured on the page (deduplicated, see `count`). */
1062
1096
  declare interface CapturedError {
1063
1097
  type: CapturedErrorType;
@@ -1097,22 +1131,11 @@ declare type CapturedErrorType = "error" | "unhandledrejection" | "console" | "m
1097
1131
  * client.registerFunction(fn);
1098
1132
  * ```
1099
1133
  */
1100
- declare interface ClientFunctionDefinition {
1134
+ declare interface ClientFunctionDefinition extends ClientFunctionSettings {
1101
1135
  name: string;
1102
1136
  description: string;
1103
1137
  parameters: ClientFunctionSchema["parameters"];
1104
1138
  handler: ClientFunctionHandler;
1105
- /**
1106
- * Max serialized result size in bytes before the SDK truncates it to a
1107
- * flagged preview (default: `AgoConfig.maxFunctionResultBytes`, 50 000).
1108
- * `Infinity` disables the guard for this function.
1109
- */
1110
- maxResultBytes?: number;
1111
- /**
1112
- * Require explicit user approval before this function runs. See
1113
- * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1114
- */
1115
- requiresApproval?: boolean;
1116
1139
  }
1117
1140
 
1118
1141
  /**
@@ -1131,20 +1154,7 @@ declare interface ClientFunctionInvocation {
1131
1154
  * Schema-plus-settings object accepted when registering a function: the schema
1132
1155
  * (minus `name`) and SDK-side options that are NOT sent to the backend.
1133
1156
  */
1134
- declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & {
1135
- /**
1136
- * Max serialized result size in bytes before the SDK truncates it to a
1137
- * flagged preview. Overrides the client-level default
1138
- * (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
1139
- * disables the guard for this function.
1140
- */
1141
- maxResultBytes?: number;
1142
- /**
1143
- * Require explicit user approval before this function runs. See
1144
- * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1145
- */
1146
- requiresApproval?: boolean;
1147
- };
1157
+ declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & ClientFunctionSettings;
1148
1158
 
1149
1159
  /**
1150
1160
  * Schema for a client-side function that AGO can call
@@ -1171,6 +1181,28 @@ declare interface ClientFunctionSchema {
1171
1181
  };
1172
1182
  }
1173
1183
 
1184
+ /** SDK-side function settings that are never sent to the backend. */
1185
+ declare interface ClientFunctionSettings {
1186
+ /**
1187
+ * Max serialized result size in bytes before the SDK truncates it to a
1188
+ * flagged preview. Overrides the client-level default
1189
+ * (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
1190
+ * disables the guard for this function.
1191
+ */
1192
+ maxResultBytes?: number;
1193
+ /**
1194
+ * Require explicit user approval before this function runs. See
1195
+ * {@link AgoConfig.approvalPolicy} — pause mode only. ORs with the policy.
1196
+ */
1197
+ requiresApproval?: boolean;
1198
+ /**
1199
+ * WebMCP metadata, read only when the bridge is on (`AgoConfig.webmcp`).
1200
+ * `false` keeps this function out of WebMCP while leaving it available to the
1201
+ * in-app agent.
1202
+ */
1203
+ webmcp?: WebMCPToolMeta | false;
1204
+ }
1205
+
1174
1206
  /** See {@link AgoConfig.clientFunctionsMode}. */
1175
1207
  declare type ClientFunctionsMode = "placeholder" | "pause";
1176
1208
 
@@ -1656,6 +1688,14 @@ declare interface ProactiveTriggerWhen {
1656
1688
  fieldErrors?: Record<string, number>;
1657
1689
  }
1658
1690
 
1691
+ /**
1692
+ * Registered function with handler
1693
+ */
1694
+ declare interface RegisteredFunction extends ClientFunctionSettings {
1695
+ schema: ClientFunctionSchema;
1696
+ handler: ClientFunctionHandler;
1697
+ }
1698
+
1659
1699
  /**
1660
1700
  * Hook run before a paused turn is resumed, so the app controls WHEN the
1661
1701
  * continuation fires (e.g. wait for the destination page to mount after a
@@ -1712,6 +1752,8 @@ declare interface SdkPermissionConfig {
1712
1752
  homePage?: SdkHomePageConfig;
1713
1753
  fileAttachmentsEnabled: boolean;
1714
1754
  voiceEnabled: boolean;
1755
+ /** Whether audio uploads can be transcribed. Defaults to false on older backends. */
1756
+ speechToTextEnabled: boolean;
1715
1757
  }
1716
1758
 
1717
1759
  /**
@@ -2047,6 +2089,12 @@ declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "
2047
2089
 
2048
2090
  declare type ToolCallType_2 = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
2049
2091
 
2092
+ /** Options for `AgoClient.transcribeAudio`. */
2093
+ declare interface TranscribeAudioOptions {
2094
+ /** Cancel the upload or stop waiting for its transcription. */
2095
+ signal?: AbortSignal;
2096
+ }
2097
+
2050
2098
  /**
2051
2099
  * Get or create an AgoClient.
2052
2100
  *
@@ -2095,6 +2143,16 @@ export declare function useAgoFunction(name: string, options: {
2095
2143
  * `Infinity` disables the guard for this function.
2096
2144
  */
2097
2145
  maxResultBytes?: number;
2146
+ /**
2147
+ * Require explicit user approval before this function runs (pause mode
2148
+ * only). See `AgoConfig.approvalPolicy`.
2149
+ */
2150
+ requiresApproval?: boolean;
2151
+ /**
2152
+ * WebMCP metadata, read only when the bridge is on (`AgoConfig.webmcp`).
2153
+ * `false` keeps this function out of WebMCP.
2154
+ */
2155
+ webmcp?: WebMCPToolMeta | false;
2098
2156
  }): void;
2099
2157
 
2100
2158
  /**
@@ -3029,4 +3087,23 @@ export declare interface UseProactiveNudgeResult {
3029
3087
  dismiss: () => void;
3030
3088
  }
3031
3089
 
3090
+ /** The MCP behavior hints AGO has no equivalent for. */
3091
+ declare interface WebMCPToolMeta {
3092
+ /**
3093
+ * Both default to `false`, so only set what is true: `readOnlyHint` marks a
3094
+ * function that changes nothing, `untrustedContentHint` one whose result may
3095
+ * carry third-party text.
3096
+ */
3097
+ annotations?: {
3098
+ readOnlyHint?: boolean;
3099
+ untrustedContentHint?: boolean;
3100
+ };
3101
+ /**
3102
+ * This function navigates. The WebMCP call is held open until the function
3103
+ * registry goes quiet, so the caller sees the destination page's tools rather
3104
+ * than the departing page's. Already set on the built-in `navigateToPage`.
3105
+ */
3106
+ navigates?: boolean;
3107
+ }
3108
+
3032
3109
  export { }
package/dist/vue.js CHANGED
@@ -1,47 +1,47 @@
1
- import { n as A, t as D } from "./types-Ct1hlKwg.js";
1
+ import { n as I, t as D } from "./types-Q7t1peH-.js";
2
2
  import { computed as L, inject as M, onMounted as p, onScopeDispose as R, onUnmounted as C, ref as d, shallowRef as F } from "vue";
3
- var N = /* @__PURE__ */ Symbol("ago-client"), q = { install(t, n) {
4
- const e = new A(n);
5
- t.provide(N, e);
3
+ var N = /* @__PURE__ */ Symbol("ago-client"), _ = { install(t, e) {
4
+ const n = new I(e);
5
+ t.provide(N, n);
6
6
  } };
7
7
  function m(t) {
8
- if (t) return new A(t);
9
- const n = M(N);
10
- if (!n) throw new Error("useAgo(): no AgoClient found. Either pass config or install AgoPlugin.");
11
- return n;
8
+ if (t) return new I(t);
9
+ const e = M(N);
10
+ if (!e) throw new Error("useAgo(): no AgoClient found. Either pass config or install AgoPlugin.");
11
+ return e;
12
12
  }
13
13
  function k(t = {}) {
14
- const n = t.client ?? m(), e = d([]), a = d(t.conversationId), o = d(!1), i = d(null), c = (s) => {
14
+ const e = t.client ?? m(), n = d([]), a = d(t.conversationId), o = d(!1), i = d(null), c = (s) => {
15
15
  a.value || (a.value = s.conversationId);
16
16
  }, g = (s) => {
17
- const u = e.value.findIndex((v) => v.id === s.messageId);
18
- u >= 0 && (e.value[u] = {
19
- ...e.value[u],
20
- content: e.value[u].content + s.content
17
+ const u = n.value.findIndex((v) => v.id === s.messageId);
18
+ u >= 0 && (n.value[u] = {
19
+ ...n.value[u],
20
+ content: n.value[u].content + s.content
21
21
  });
22
- }, h = (s) => {
23
- const u = e.value.findIndex((v) => v.id === s.id);
24
- u >= 0 ? e.value[u] = s : e.value.push(s), o.value = !1;
25
22
  }, w = (s) => {
23
+ const u = n.value.findIndex((v) => v.id === s.id);
24
+ u >= 0 ? n.value[u] = s : n.value.push(s), o.value = !1;
25
+ }, h = (s) => {
26
26
  i.value = new Error(s.error), o.value = !1;
27
27
  }, r = () => {
28
28
  let s = -1;
29
- for (let u = e.value.length - 1; u >= 0; u--) {
30
- const v = e.value[u];
29
+ for (let u = n.value.length - 1; u >= 0; u--) {
30
+ const v = n.value[u];
31
31
  if (v.role === "assistant" && (v.status === "IN_PROGRESS" || v.status === "WAITING_CLIENT")) {
32
32
  s = u;
33
33
  break;
34
34
  }
35
35
  }
36
- s >= 0 && (e.value[s].content ? e.value[s] = {
37
- ...e.value[s],
36
+ s >= 0 && (n.value[s].content ? n.value[s] = {
37
+ ...n.value[s],
38
38
  status: "CANCELED"
39
- } : e.value.splice(s, 1)), o.value = !1;
39
+ } : n.value.splice(s, 1)), o.value = !1;
40
40
  };
41
41
  p(() => {
42
- n.on("message:start", c), n.on("message:chunk", g), n.on("message:complete", h), n.on("message:error", w), n.on("message:stopped", r);
42
+ e.on("message:start", c), e.on("message:chunk", g), e.on("message:complete", w), e.on("message:error", h), e.on("message:stopped", r);
43
43
  }), C(() => {
44
- n.off("message:start", c), n.off("message:chunk", g), n.off("message:complete", h), n.off("message:error", w), n.off("message:stopped", r);
44
+ e.off("message:start", c), e.off("message:chunk", g), e.off("message:complete", w), e.off("message:error", h), e.off("message:stopped", r);
45
45
  });
46
46
  async function l(s, u) {
47
47
  o.value = !0, i.value = null;
@@ -60,31 +60,31 @@ function k(t = {}) {
60
60
  status: "IN_PROGRESS",
61
61
  createdAt: /* @__PURE__ */ new Date()
62
62
  };
63
- e.value.push(v, S);
63
+ n.value.push(v, S);
64
64
  try {
65
- const f = await n.sendMessage(s, {
65
+ const f = await e.sendMessage(s, {
66
66
  conversationId: a.value,
67
67
  files: u
68
68
  });
69
- f.conversationId && !a.value && (a.value = f.conversationId), e.value = e.value.filter((b) => !b.id.startsWith("temp-"));
70
- const I = {
69
+ f.conversationId && !a.value && (a.value = f.conversationId), n.value = n.value.filter((A) => !A.id.startsWith("temp-"));
70
+ const b = {
71
71
  ...v,
72
72
  id: v.id.replace("temp-", "user-"),
73
73
  conversationId: f.conversationId
74
74
  };
75
- return e.value.some((b) => b.id === f.id) ? e.value.push(I) : e.value.push(I, f), f;
75
+ return n.value.some((A) => A.id === f.id) ? n.value.push(b) : n.value.push(b, f), f;
76
76
  } catch (f) {
77
- return i.value = f instanceof Error ? f : /* @__PURE__ */ new Error("Failed to send"), o.value = !1, e.value = e.value.filter((I) => !I.id.startsWith("temp-")), null;
77
+ return i.value = f instanceof Error ? f : /* @__PURE__ */ new Error("Failed to send"), o.value = !1, n.value = n.value.filter((b) => !b.id.startsWith("temp-")), null;
78
78
  }
79
79
  }
80
80
  async function E() {
81
- await n.stop();
81
+ await e.stop();
82
82
  }
83
83
  function y() {
84
- e.value = [], a.value = void 0, i.value = null;
84
+ n.value = [], a.value = void 0, i.value = null;
85
85
  }
86
86
  return {
87
- messages: e,
87
+ messages: n,
88
88
  isLoading: o,
89
89
  error: i,
90
90
  conversationId: a,
@@ -94,79 +94,79 @@ function k(t = {}) {
94
94
  };
95
95
  }
96
96
  function P(t = {}) {
97
- const n = t.client ?? m(), e = t.autoLoad ?? !0, a = d([]), o = d(null), i = d(!1), c = d(null);
97
+ const e = t.client ?? m(), n = t.autoLoad ?? !0, a = d([]), o = d(null), i = d(!1), c = d(null);
98
98
  async function g() {
99
99
  i.value = !0, c.value = null;
100
100
  try {
101
- a.value = (await n.getConversations()).data;
101
+ a.value = (await e.getConversations()).data;
102
102
  } catch (r) {
103
103
  c.value = r instanceof Error ? r : /* @__PURE__ */ new Error("Failed to load conversations");
104
104
  } finally {
105
105
  i.value = !1;
106
106
  }
107
107
  }
108
- async function h(r) {
108
+ async function w(r) {
109
109
  i.value = !0, c.value = null;
110
110
  try {
111
- o.value = await n.getConversation(r);
111
+ o.value = await e.getConversation(r);
112
112
  } catch (l) {
113
113
  c.value = l instanceof Error ? l : /* @__PURE__ */ new Error("Failed to load conversation");
114
114
  } finally {
115
115
  i.value = !1;
116
116
  }
117
117
  }
118
- function w() {
118
+ function h() {
119
119
  o.value = null;
120
120
  }
121
121
  return p(() => {
122
- e && g();
122
+ n && g();
123
123
  }), {
124
124
  conversations: a,
125
125
  currentConversation: o,
126
126
  isLoading: i,
127
127
  error: c,
128
- selectConversation: h,
129
- startNewConversation: w,
128
+ selectConversation: w,
129
+ startNewConversation: h,
130
130
  refreshConversations: g
131
131
  };
132
132
  }
133
133
  function O(t = {}) {
134
- const n = k({
134
+ const e = k({
135
135
  client: t.client,
136
136
  conversationId: t.conversationId
137
- }), e = P({
137
+ }), n = P({
138
138
  client: t.client,
139
139
  autoLoad: t.autoLoad
140
- }), a = L(() => n.error.value || e.error.value);
140
+ }), a = L(() => e.error.value || n.error.value);
141
141
  return {
142
- messages: n.messages,
143
- isLoading: n.isLoading,
142
+ messages: e.messages,
143
+ isLoading: e.isLoading,
144
144
  error: a,
145
- sendMessage: n.sendMessage,
146
- stop: n.stop,
147
- clearMessages: n.clearMessages,
148
- conversationId: n.conversationId,
149
- conversations: e.conversations,
150
- currentConversation: e.currentConversation,
151
- isConversationsLoading: e.isLoading,
152
- selectConversation: e.selectConversation,
153
- startNewConversation: e.startNewConversation,
154
- refreshConversations: e.refreshConversations
145
+ sendMessage: e.sendMessage,
146
+ stop: e.stop,
147
+ clearMessages: e.clearMessages,
148
+ conversationId: e.conversationId,
149
+ conversations: n.conversations,
150
+ currentConversation: n.currentConversation,
151
+ isConversationsLoading: n.isLoading,
152
+ selectConversation: n.selectConversation,
153
+ startNewConversation: n.startNewConversation,
154
+ refreshConversations: n.refreshConversations
155
155
  };
156
156
  }
157
157
  function G(t = {}) {
158
- const n = t.client ?? m(), e = d({}), a = d(!1), o = d(null), i = /* @__PURE__ */ new Map();
158
+ const e = t.client ?? m(), n = d({}), a = d(!1), o = d(null), i = /* @__PURE__ */ new Map();
159
159
  function c(r) {
160
160
  const l = (i.get(r) ?? 0) + 1;
161
161
  return i.set(r, l), l;
162
162
  }
163
163
  const g = (r, l) => i.get(r) === l;
164
- async function h(r, l, E) {
164
+ async function w(r, l, E) {
165
165
  const y = c(r);
166
166
  a.value = !0, o.value = null;
167
167
  try {
168
- await n.submitFeedback(r, l, E), g(r, y) && (e.value = {
169
- ...e.value,
168
+ await e.submitFeedback(r, l, E), g(r, y) && (n.value = {
169
+ ...n.value,
170
170
  [r]: l
171
171
  });
172
172
  } catch (s) {
@@ -176,13 +176,13 @@ function G(t = {}) {
176
176
  a.value = !1;
177
177
  }
178
178
  }
179
- async function w(r, l, E) {
179
+ async function h(r, l, E) {
180
180
  const y = c(r);
181
181
  a.value = !0, o.value = null;
182
182
  try {
183
- const s = await n.submitConversationFeedback(r, l, E);
184
- return g(r, y) && (e.value = {
185
- ...e.value,
183
+ const s = await e.submitConversationFeedback(r, l, E);
184
+ return g(r, y) && (n.value = {
185
+ ...n.value,
186
186
  [s]: l
187
187
  }), s;
188
188
  } catch (s) {
@@ -193,83 +193,85 @@ function G(t = {}) {
193
193
  }
194
194
  }
195
195
  return {
196
- ratings: e,
196
+ ratings: n,
197
197
  isSubmitting: a,
198
198
  error: o,
199
- submitFeedback: h,
200
- submitConversationFeedback: w
199
+ submitFeedback: w,
200
+ submitConversationFeedback: h
201
201
  };
202
202
  }
203
- function B(t, n) {
204
- const e = m();
203
+ function B(t, e) {
204
+ const n = m();
205
205
  p(() => {
206
- e.registerFunction(t, n.handler, {
207
- description: n.description,
208
- parameters: n.parameters,
209
- maxResultBytes: n.maxResultBytes
206
+ n.registerFunction(t, e.handler, {
207
+ description: e.description,
208
+ parameters: e.parameters,
209
+ maxResultBytes: e.maxResultBytes,
210
+ requiresApproval: e.requiresApproval,
211
+ webmcp: e.webmcp
210
212
  });
211
213
  }), C(() => {
212
- e.unregisterFunction(t);
214
+ n.unregisterFunction(t);
213
215
  });
214
216
  }
215
- function T(t, n) {
216
- const e = m();
217
+ function T(t, e) {
218
+ const n = m();
217
219
  p(() => {
218
- e.registerNavigationFunction(t, n);
220
+ n.registerNavigationFunction(t, e);
219
221
  }), C(() => {
220
- e.unregisterNavigationFunction();
222
+ n.unregisterNavigationFunction();
221
223
  });
222
224
  }
223
- function W(t, n) {
224
- const e = m(), a = n?.functionName ?? "setPageState";
225
+ function W(t, e) {
226
+ const n = m(), a = e?.functionName ?? "setPageState";
225
227
  p(() => {
226
- e.registerPageStateFunction(t, {
227
- ...n,
228
+ n.registerPageStateFunction(t, {
229
+ ...e,
228
230
  functionName: a
229
231
  });
230
232
  }), C(() => {
231
- e.unregisterPageStateFunction(a);
233
+ n.unregisterPageStateFunction(a);
232
234
  });
233
235
  }
234
- function K(t, n) {
235
- const e = m();
236
+ function K(t, e) {
237
+ const n = m();
236
238
  p(() => {
237
- e.on(t, n);
239
+ n.on(t, e);
238
240
  }), C(() => {
239
- e.off(t, n);
241
+ n.off(t, e);
240
242
  });
241
243
  }
242
244
  function U(t) {
243
- const n = F(t.get());
244
- return R(t.subscribe((e) => {
245
- n.value = e;
246
- })), n;
245
+ const e = F(t.get());
246
+ return R(t.subscribe((n) => {
247
+ e.value = n;
248
+ })), e;
247
249
  }
248
250
  function $() {
249
- const t = m(), n = F(null), e = (o) => {
250
- n.value = o, t.proactive?.shown(o);
251
+ const t = m(), e = F(null), n = (o) => {
252
+ e.value = o, t.proactive?.shown(o);
251
253
  }, a = ({ nudge: o }) => {
252
- n.value?.id === o.id && (n.value = null);
254
+ e.value?.id === o.id && (e.value = null);
253
255
  };
254
256
  return p(() => {
255
- t.on("nudge:ready", e), t.on("nudge:accepted", a), t.on("nudge:dismissed", a);
257
+ t.on("nudge:ready", n), t.on("nudge:accepted", a), t.on("nudge:dismissed", a);
256
258
  }), C(() => {
257
- t.off("nudge:ready", e), t.off("nudge:accepted", a), t.off("nudge:dismissed", a);
259
+ t.off("nudge:ready", n), t.off("nudge:accepted", a), t.off("nudge:dismissed", a);
258
260
  }), {
259
- nudge: n,
261
+ nudge: e,
260
262
  accept: async () => {
261
- const o = n.value;
262
- o && (n.value = null, await t.proactive?.accept(o));
263
+ const o = e.value;
264
+ o && (e.value = null, await t.proactive?.accept(o));
263
265
  },
264
266
  dismiss: () => {
265
- const o = n.value;
266
- o && (n.value = null, t.proactive?.dismiss(o));
267
+ const o = e.value;
268
+ o && (e.value = null, t.proactive?.dismiss(o));
267
269
  }
268
270
  };
269
271
  }
270
272
  export {
271
273
  N as AGO_CLIENT_KEY,
272
- q as AgoPlugin,
274
+ _ as AgoPlugin,
273
275
  D as FEEDBACK_REASONS,
274
276
  m as useAgo,
275
277
  K as useAgoEvents,