@useago/sdk 0.3.2 → 0.3.3

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 (116) hide show
  1. package/dist/AgoClient-DF7M2WAz.js +575 -0
  2. package/dist/AgoClient-bjN-z2ZQ.cjs +6 -0
  3. package/dist/angular.cjs +1 -143
  4. package/dist/angular.d.cts +530 -0
  5. package/dist/angular.d.ts +530 -2
  6. package/dist/angular.js +71 -139
  7. package/dist/createMockClient-D6uVh-B9.js +254 -0
  8. package/dist/createMockClient-DecMEUcK.cjs +1 -0
  9. package/dist/devtools.cjs +4 -78
  10. package/dist/devtools.d.cts +443 -0
  11. package/dist/devtools.d.ts +443 -2
  12. package/dist/devtools.js +46 -71
  13. package/dist/functions-Bz-1Bs3I.cjs +1 -0
  14. package/dist/functions-DdROP6Ui.js +312 -0
  15. package/dist/helpers.cjs +1 -15
  16. package/dist/{helpers/functions.d.ts → helpers.d.cts} +121 -62
  17. package/dist/helpers.d.ts +121 -2
  18. package/dist/helpers.js +16 -2
  19. package/dist/index.cjs +1 -347
  20. package/dist/index.d.cts +1150 -0
  21. package/dist/index.d.ts +1150 -20
  22. package/dist/index.js +128 -298
  23. package/dist/react.cjs +31 -22438
  24. package/dist/react.d.cts +960 -0
  25. package/dist/react.d.ts +960 -2
  26. package/dist/react.js +8401 -22376
  27. package/dist/rolldown-runtime-CaekUdDJ.cjs +1 -0
  28. package/dist/rolldown-runtime-DxmricAu.js +25 -0
  29. package/dist/vue.cjs +1 -336
  30. package/dist/vue.d.cts +1063 -0
  31. package/dist/vue.d.ts +1063 -2
  32. package/dist/vue.js +174 -316
  33. package/dist/{widget/types.d.ts → widget.d.cts} +41 -43
  34. package/dist/widget.d.ts +41 -2
  35. package/package.json +35 -24
  36. package/dist/AgoClient-DPZdN5n2.js +0 -905
  37. package/dist/AgoClient-DPZdN5n2.js.map +0 -1
  38. package/dist/AgoClient-wMVUQqCD.cjs +0 -976
  39. package/dist/AgoClient-wMVUQqCD.cjs.map +0 -1
  40. package/dist/angular/ago.service.d.ts +0 -98
  41. package/dist/angular/index.d.ts +0 -4
  42. package/dist/angular/provide.d.ts +0 -27
  43. package/dist/angular.cjs.map +0 -1
  44. package/dist/angular.js.map +0 -1
  45. package/dist/api/HttpClient.d.ts +0 -31
  46. package/dist/api/index.d.ts +0 -1
  47. package/dist/auto/createAgo.d.ts +0 -39
  48. package/dist/auto/index.d.ts +0 -1
  49. package/dist/client/AgoClient.d.ts +0 -169
  50. package/dist/client/errors.d.ts +0 -48
  51. package/dist/client/index.d.ts +0 -3
  52. package/dist/client/types.d.ts +0 -205
  53. package/dist/createMockClient-Ci_N2tH8.cjs +0 -104
  54. package/dist/createMockClient-Ci_N2tH8.cjs.map +0 -1
  55. package/dist/createMockClient-U0ae_AYy.js +0 -99
  56. package/dist/createMockClient-U0ae_AYy.js.map +0 -1
  57. package/dist/devtools/index.d.ts +0 -2
  58. package/dist/devtools/initDevPanel.d.ts +0 -15
  59. package/dist/devtools.cjs.map +0 -1
  60. package/dist/devtools.js.map +0 -1
  61. package/dist/functions/FunctionRegistry.d.ts +0 -41
  62. package/dist/functions/defineFunction.d.ts +0 -22
  63. package/dist/functions/index.d.ts +0 -2
  64. package/dist/functions/types.d.ts +0 -50
  65. package/dist/functions--c6lx3ic.cjs +0 -480
  66. package/dist/functions--c6lx3ic.cjs.map +0 -1
  67. package/dist/functions-C9F1dnmh.js +0 -398
  68. package/dist/functions-C9F1dnmh.js.map +0 -1
  69. package/dist/helpers/factory.d.ts +0 -20
  70. package/dist/helpers/index.d.ts +0 -1
  71. package/dist/index.cjs.map +0 -1
  72. package/dist/index.js.map +0 -1
  73. package/dist/react/components/ChatInput.d.ts +0 -12
  74. package/dist/react/components/ChatWidget.d.ts +0 -35
  75. package/dist/react/components/Markdown.d.ts +0 -12
  76. package/dist/react/components/Message.d.ts +0 -9
  77. package/dist/react/components/index.d.ts +0 -8
  78. package/dist/react/context/AgoContext.d.ts +0 -62
  79. package/dist/react/context/index.d.ts +0 -2
  80. package/dist/react/hooks/index.d.ts +0 -7
  81. package/dist/react/hooks/useAgo.d.ts +0 -14
  82. package/dist/react/hooks/useAgoContext.d.ts +0 -40
  83. package/dist/react/hooks/useAgoFunction.d.ts +0 -58
  84. package/dist/react/hooks/useAgoStore.d.ts +0 -17
  85. package/dist/react/hooks/useChat.d.ts +0 -45
  86. package/dist/react/hooks/useConversation.d.ts +0 -28
  87. package/dist/react/hooks/useMessages.d.ts +0 -26
  88. package/dist/react/index.d.ts +0 -24
  89. package/dist/react/testing.d.ts +0 -2
  90. package/dist/react.cjs.map +0 -1
  91. package/dist/react.js.map +0 -1
  92. package/dist/rolldown-runtime-BqCkTl7Q.cjs +0 -50
  93. package/dist/rolldown-runtime-CNZpIYwj.js +0 -33
  94. package/dist/state/ClientContextRegistry.d.ts +0 -64
  95. package/dist/state/createStore.d.ts +0 -30
  96. package/dist/streaming/SSEHandler.d.ts +0 -46
  97. package/dist/streaming/helpers.d.ts +0 -67
  98. package/dist/streaming/index.d.ts +0 -2
  99. package/dist/testing/createMockClient.d.ts +0 -42
  100. package/dist/testing/index.d.ts +0 -2
  101. package/dist/utils/eventEmitter.d.ts +0 -23
  102. package/dist/utils/index.d.ts +0 -2
  103. package/dist/utils/logger.d.ts +0 -14
  104. package/dist/vue/composables/useAgo.d.ts +0 -17
  105. package/dist/vue/composables/useAgoEvents.d.ts +0 -11
  106. package/dist/vue/composables/useAgoFunction.d.ts +0 -34
  107. package/dist/vue/composables/useAgoStore.d.ts +0 -18
  108. package/dist/vue/composables/useChat.d.ts +0 -251
  109. package/dist/vue/composables/useConversation.d.ts +0 -178
  110. package/dist/vue/composables/useMessages.d.ts +0 -89
  111. package/dist/vue/index.d.ts +0 -11
  112. package/dist/vue/plugin.d.ts +0 -16
  113. package/dist/vue/symbols.d.ts +0 -3
  114. package/dist/vue.cjs.map +0 -1
  115. package/dist/vue.js.map +0 -1
  116. package/dist/widget/index.d.ts +0 -1
package/dist/vue.d.cts ADDED
@@ -0,0 +1,1063 @@
1
+ import { App } from 'vue';
2
+ import { ComputedRef } from 'vue';
3
+ import { InjectionKey } from 'vue';
4
+ import { Ref } from 'vue';
5
+ import { ShallowRef } from 'vue';
6
+
7
+ export declare const AGO_CLIENT_KEY: InjectionKey<AgoClient>;
8
+
9
+ /**
10
+ * Agent information
11
+ */
12
+ export declare interface AgoAgent {
13
+ id: string;
14
+ name: string;
15
+ displayName?: string;
16
+ }
17
+
18
+ /**
19
+ * Main SDK client for AGO Chat integration
20
+ */
21
+ declare class AgoClient {
22
+ private httpClient;
23
+ private functionRegistry;
24
+ private contextRegistry;
25
+ private eventEmitter;
26
+ private config;
27
+ constructor(config: AgoConfig);
28
+ /**
29
+ * Send a message and receive a streaming response
30
+ */
31
+ sendMessage(content: string, options?: SendMessageOptions): Promise<AgoMessage>;
32
+ private processSSEResponse;
33
+ private handleClientFunctionInvocation;
34
+ /**
35
+ * Get list of conversations
36
+ */
37
+ getConversations(): Promise<Conversation[]>;
38
+ /**
39
+ * Get a specific conversation with messages
40
+ */
41
+ getConversation(conversationId: string): Promise<Conversation>;
42
+ /**
43
+ * Get messages for a conversation
44
+ */
45
+ getMessages(conversationId: string): Promise<AgoMessage[]>;
46
+ /**
47
+ * Submit form data for a tool call
48
+ */
49
+ submitToolCallForm(toolCallId: string, formData: Record<string, unknown>): Promise<void>;
50
+ /**
51
+ * Confirm a tool call
52
+ */
53
+ confirmToolCall(toolCallId: string): Promise<void>;
54
+ /**
55
+ * Reject a tool call
56
+ */
57
+ rejectToolCall(toolCallId: string): Promise<void>;
58
+ /**
59
+ * Relay a completed form collector's values to a server-configured destination.
60
+ *
61
+ * Used by `createFormCollector` / `useFormCollector` in `{ via: "backend" }` mode:
62
+ * the browser never holds the destination URL or its secret — the backend resolves
63
+ * `destination` (a named, opted-in tool) and forwards the values from the server.
64
+ */
65
+ submitFormCollector(destination: string, values: Record<string, unknown>): Promise<unknown>;
66
+ /**
67
+ * Submit feedback for a message
68
+ */
69
+ submitFeedback(messageId: string, rating: "positive" | "negative"): Promise<void>;
70
+ /**
71
+ * Register a client-side function that AGO can call.
72
+ * Accepts either a definition object or (name, handler, schema) args.
73
+ *
74
+ * ```ts
75
+ * // Single-object (preferred)
76
+ * client.registerFunction({
77
+ * name: "lookupOrder",
78
+ * description: "Look up an order",
79
+ * parameters: { type: "object", properties: { id: { type: "string" } } },
80
+ * handler: async (args) => fetchOrder(args.id),
81
+ * });
82
+ *
83
+ * // Classic 3-arg form
84
+ * client.registerFunction("lookupOrder", handler, schema);
85
+ * ```
86
+ */
87
+ registerFunction(definition: ClientFunctionDefinition): void;
88
+ registerFunction(name: string, handler: ClientFunctionHandler, schema: Omit<ClientFunctionSchema, "name">): void;
89
+ /**
90
+ * Short alias for `registerFunction`. Also accepts an array of definitions.
91
+ *
92
+ * ```ts
93
+ * client.register(lookupOrder);
94
+ * client.register([lookupOrder, cancelOrder]);
95
+ * ```
96
+ */
97
+ register(definition: ClientFunctionDefinition | ClientFunctionDefinition[]): void;
98
+ /**
99
+ * Unregister a client-side function
100
+ */
101
+ unregisterFunction(name: string): boolean;
102
+ /**
103
+ * Get all registered function schemas
104
+ */
105
+ getRegisteredFunctions(): ClientFunctionSchema[];
106
+ /**
107
+ * Register a navigation function that lets AGO navigate users to different pages.
108
+ * @param navigate - A callback that performs the navigation (e.g. react-router's navigate)
109
+ * @param routes - Map of route names to paths, with descriptions for the LLM
110
+ */
111
+ registerNavigationFunction(navigate: (path: string) => void, routes: Array<{
112
+ name: string;
113
+ path: string;
114
+ description: string;
115
+ }>): void;
116
+ /**
117
+ * Register or update a piece of client-side context.
118
+ * This context is sent with every message so the AI understands the user's situation.
119
+ *
120
+ * ```ts
121
+ * client.setContext("order-page", {
122
+ * name: "Order detail",
123
+ * description: "User is viewing order #123",
124
+ * data: { orderId: "123", status: "shipped" },
125
+ * });
126
+ * ```
127
+ */
128
+ setContext(key: string, entry: ContextEntry): void;
129
+ /**
130
+ * Remove a previously registered context entry.
131
+ */
132
+ removeContext(key: string): boolean;
133
+ /**
134
+ * Register a dynamic context provider. The callback is invoked every time
135
+ * a message is sent, so the AI always gets the freshest data.
136
+ *
137
+ * Use this for context that lives outside React state — global stores,
138
+ * refs, or computed values.
139
+ *
140
+ * ```ts
141
+ * client.addDynamicContext("cart", () => ({
142
+ * name: "Checkout",
143
+ * data: { itemCount: cart.items.length, total: cart.total },
144
+ * }));
145
+ * ```
146
+ */
147
+ addDynamicContext(key: string, provider: DynamicContextProvider): void;
148
+ /**
149
+ * Remove a dynamic context provider.
150
+ */
151
+ removeDynamicContext(key: string): boolean;
152
+ /**
153
+ * Enable automatic capture of the current browser page (URL + title).
154
+ * Injected as a dynamic context entry named `browser-page`.
155
+ */
156
+ enableAutoPageContext(): void;
157
+ /**
158
+ * Get the current context snapshot.
159
+ */
160
+ getContextSnapshot(): ContextSnapshot | null;
161
+ /**
162
+ * Subscribe to an event
163
+ */
164
+ on<K extends AgoEventName>(event: K, handler: AgoEventHandler<K>): void;
165
+ /**
166
+ * Unsubscribe from an event
167
+ */
168
+ off<K extends AgoEventName>(event: K, handler: AgoEventHandler<K>): void;
169
+ /**
170
+ * Subscribe to an event once — auto-unsubscribes after the first call.
171
+ */
172
+ once<K extends AgoEventName>(event: K, handler: AgoEventHandler<K>): void;
173
+ /**
174
+ * Returns a Promise that resolves the next time `event` fires.
175
+ *
176
+ * ```ts
177
+ * const msg = await client.waitFor("message:complete", { timeout: 10000 });
178
+ * ```
179
+ */
180
+ waitFor<K extends AgoEventName>(event: K, options?: {
181
+ timeout?: number;
182
+ }): Promise<AgoClientEvents[K]>;
183
+ /**
184
+ * Update client configuration
185
+ */
186
+ updateConfig(config: Partial<AgoConfig>): void;
187
+ /**
188
+ * Clean up resources
189
+ */
190
+ destroy(): void;
191
+ }
192
+
193
+ /**
194
+ * SDK Events
195
+ */
196
+ declare interface AgoClientEvents {
197
+ "message:start": {
198
+ conversationId: string;
199
+ messageId: string;
200
+ };
201
+ "message:chunk": {
202
+ content: string;
203
+ conversationId: string;
204
+ messageId: string;
205
+ };
206
+ "message:complete": AgoMessage;
207
+ "message:error": {
208
+ error: string;
209
+ conversationId?: string;
210
+ messageId?: string;
211
+ };
212
+ "toolCall:received": ToolCallData;
213
+ "toolCall:form": ToolCallData;
214
+ "function:invoke": ClientFunctionInvocation;
215
+ "function:result": {
216
+ invocationId: string;
217
+ result: unknown;
218
+ error?: string;
219
+ };
220
+ "connection:status": {
221
+ connected: boolean;
222
+ };
223
+ }
224
+
225
+ /**
226
+ * SDK Configuration
227
+ */
228
+ export declare interface AgoConfig {
229
+ /** API base URL (e.g., https://YOUR-DOMAIN.useago.com) */
230
+ baseUrl: string;
231
+ /** Widget ID (X-Widget-Id header). Auto-generated if not provided. */
232
+ widgetId?: string;
233
+ /** Default agent (id or slug) for new conversations. Shorthand for `defaultAgentId`. */
234
+ agent?: string;
235
+ /** Default agent ID for new conversations. Prefer `agent`. */
236
+ defaultAgentId?: string;
237
+ /** Permission name to apply to all requests (sent as `X-Widget-Permission`). Mirrors the widget's `window.AGO.permission`. */
238
+ permission?: string;
239
+ /** User email for identification */
240
+ userEmail?: string;
241
+ /** JWT token for authenticated users */
242
+ userJwt?: string;
243
+ /** Enable debug logging */
244
+ debug?: boolean;
245
+ }
246
+
247
+ declare type AgoEventHandler<K extends AgoEventName> = (data: AgoClientEvents[K]) => void;
248
+
249
+ declare type AgoEventName = keyof AgoClientEvents;
250
+
251
+ /**
252
+ * Message from AGO
253
+ */
254
+ export declare interface AgoMessage {
255
+ id: string;
256
+ conversationId: string;
257
+ content: string;
258
+ role: "user" | "assistant";
259
+ status: MessageStatus;
260
+ agent?: AgoAgent;
261
+ sources?: AgoSource[];
262
+ toolCalls?: ToolCallData[];
263
+ followUpReplies?: string[];
264
+ createdAt: Date;
265
+ }
266
+
267
+ /**
268
+ * Vue plugin that provides an AgoClient to the entire app via inject/provide.
269
+ *
270
+ * ```ts
271
+ * import { AgoPlugin } from "@useago/sdk/vue";
272
+ *
273
+ * app.use(AgoPlugin, { baseUrl: "https://YOUR-DOMAIN.useago.com" });
274
+ * ```
275
+ */
276
+ export declare const AgoPlugin: {
277
+ install(app: App, options: AgoPluginOptions): void;
278
+ };
279
+
280
+ export declare interface AgoPluginOptions extends AgoConfig {
281
+ }
282
+
283
+ declare interface AgoRoute {
284
+ name: string;
285
+ path: string;
286
+ description: string;
287
+ }
288
+
289
+ /**
290
+ * Knowledge source citation
291
+ */
292
+ export declare interface AgoSource {
293
+ id: string;
294
+ title: string;
295
+ url?: string;
296
+ }
297
+
298
+ /**
299
+ * Single-object function definition — combines name, schema, and handler.
300
+ *
301
+ * ```ts
302
+ * const fn = defineFunction({
303
+ * name: "lookupOrder",
304
+ * description: "Look up an order by ID",
305
+ * parameters: { type: "object", properties: { id: { type: "string" } }, required: ["id"] },
306
+ * handler: async (args) => fetchOrder(args.id as string),
307
+ * });
308
+ * client.registerFunction(fn);
309
+ * ```
310
+ */
311
+ declare interface ClientFunctionDefinition {
312
+ name: string;
313
+ description: string;
314
+ parameters: ClientFunctionSchema["parameters"];
315
+ handler: ClientFunctionHandler;
316
+ }
317
+
318
+ /**
319
+ * Function handler type
320
+ */
321
+ declare type ClientFunctionHandler = (args: Record<string, unknown>) => Promise<unknown> | unknown;
322
+
323
+ declare interface ClientFunctionInvocation {
324
+ invocationId: string;
325
+ functionName: string;
326
+ arguments: Record<string, unknown>;
327
+ conversationId: string;
328
+ }
329
+
330
+ /**
331
+ * Schema for a client-side function that AGO can call
332
+ */
333
+ declare interface ClientFunctionSchema {
334
+ /** Function name (must be unique) */
335
+ name: string;
336
+ /** Description for the LLM to understand when to call this function */
337
+ description: string;
338
+ /** JSON Schema for function parameters */
339
+ parameters: {
340
+ type: "object";
341
+ properties: Record<string, {
342
+ type: string;
343
+ description?: string;
344
+ enum?: string[];
345
+ default?: unknown;
346
+ }>;
347
+ required?: string[];
348
+ };
349
+ }
350
+
351
+ /**
352
+ * A single piece of context the client wants the LLM to know about.
353
+ */
354
+ declare interface ContextEntry {
355
+ /** Human-readable label (e.g. "Order detail", "Current user") */
356
+ name?: string;
357
+ /** Short description of what this context represents */
358
+ description?: string;
359
+ /** Arbitrary structured data the AI should know about */
360
+ data?: Record<string, unknown>;
361
+ }
362
+
363
+ /**
364
+ * Serialised client context sent with each message.
365
+ */
366
+ declare interface ContextSnapshot {
367
+ /** All active context entries keyed by their registration key */
368
+ entries: Record<string, ContextEntry>;
369
+ }
370
+
371
+ /**
372
+ * Conversation/Thread
373
+ */
374
+ export declare interface Conversation {
375
+ id: string;
376
+ title: string;
377
+ lastMessageDate: Date;
378
+ messages?: AgoMessage[];
379
+ }
380
+
381
+ /**
382
+ * A function that returns a fresh context entry on demand.
383
+ * Evaluated every time a message is sent — use it to pull data from stores,
384
+ * refs, or any source that isn't captured by React state.
385
+ */
386
+ declare type DynamicContextProvider = () => ContextEntry | null | undefined;
387
+
388
+ declare interface FormField {
389
+ type: "string" | "number" | "boolean" | "array";
390
+ title?: string;
391
+ description?: string;
392
+ enum?: string[];
393
+ default?: unknown;
394
+ }
395
+
396
+ declare interface FormField_2 {
397
+ type: "string" | "number" | "boolean" | "array";
398
+ title?: string;
399
+ description?: string;
400
+ enum?: string[];
401
+ default?: unknown;
402
+ }
403
+
404
+ /**
405
+ * Form schema for tool calls requiring user input
406
+ */
407
+ declare interface FormSchema {
408
+ type: "object";
409
+ properties: Record<string, FormField>;
410
+ required?: string[];
411
+ }
412
+
413
+ declare type MessageStatus = "IN_PROGRESS" | "DONE" | "ERROR" | "TODO" | "CANCELED";
414
+
415
+ declare type MessageStatus_2 = "IN_PROGRESS" | "DONE" | "ERROR" | "TODO" | "CANCELED";
416
+
417
+ /**
418
+ * Options for sending a message
419
+ */
420
+ declare interface SendMessageOptions {
421
+ /** Existing conversation ID */
422
+ conversationId?: string;
423
+ /** Override default agent */
424
+ agentId?: string;
425
+ /** File attachments */
426
+ files?: File[];
427
+ }
428
+
429
+ /**
430
+ * A minimal observable store: one value, synchronous subscriptions, and
431
+ * optional persistence via {@link PersistOptions} (localStorage by default).
432
+ *
433
+ * ```ts
434
+ * const store = createStore({ count: 0 });
435
+ * store.subscribe((state) => save(state));
436
+ * store.set({ count: 1 }); // listeners fire synchronously
437
+ *
438
+ * const cart = createStore({ items: [] }, { key: "cart" }); // persisted
439
+ * ```
440
+ */
441
+ declare interface Store<T> {
442
+ /** Current state. */
443
+ get(): T;
444
+ /** Replace the state and notify subscribers synchronously. */
445
+ set(next: T): void;
446
+ /** Register a listener; returns a function that removes it. */
447
+ subscribe(listener: (state: T) => void): () => void;
448
+ }
449
+
450
+ /**
451
+ * Tool call data from SSE stream
452
+ */
453
+ export declare interface ToolCallData {
454
+ id: string;
455
+ type: ToolCallType;
456
+ status: string;
457
+ toolName: string;
458
+ toolDisplayName?: string;
459
+ message?: string;
460
+ formSchema?: FormSchema;
461
+ data?: Record<string, unknown>;
462
+ functionName?: string;
463
+ arguments?: Record<string, unknown>;
464
+ }
465
+
466
+ declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
467
+
468
+ declare type ToolCallType_2 = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
469
+
470
+ /**
471
+ * Get or create an AgoClient.
472
+ *
473
+ * - Without args: returns the client from `AgoPlugin` (throws if none).
474
+ * - With config: creates a new client instance.
475
+ *
476
+ * ```ts
477
+ * // From plugin
478
+ * const client = useAgo();
479
+ *
480
+ * // Standalone
481
+ * const client = useAgo({ baseUrl: "https://YOUR-DOMAIN.useago.com" });
482
+ * ```
483
+ */
484
+ export declare function useAgo(config?: AgoConfig): AgoClient;
485
+
486
+ /**
487
+ * Subscribe to AGO client events with auto-cleanup on unmount.
488
+ *
489
+ * ```ts
490
+ * useAgoEvents("message:complete", (msg) => {
491
+ * console.log("Got message:", msg.content);
492
+ * });
493
+ * ```
494
+ */
495
+ export declare function useAgoEvents<K extends AgoEventName>(event: K, handler: (data: AgoClientEvents[K]) => void): void;
496
+
497
+ /**
498
+ * Register a client-side function with auto-cleanup on unmount.
499
+ *
500
+ * ```ts
501
+ * useAgoFunction("showToast", {
502
+ * description: "Show a toast",
503
+ * parameters: { type: "object", properties: { message: { type: "string" } } },
504
+ * handler: async (args) => { toast(args.message); return { shown: true }; },
505
+ * });
506
+ * ```
507
+ */
508
+ export declare function useAgoFunction(name: string, options: {
509
+ description: string;
510
+ parameters: ClientFunctionSchema["parameters"];
511
+ handler: ClientFunctionHandler;
512
+ }): void;
513
+
514
+ /**
515
+ * Register navigation routes with auto-cleanup on unmount.
516
+ * Works with vue-router's `useRouter().push`.
517
+ *
518
+ * ```ts
519
+ * const router = useRouter();
520
+ * useAgoNavigation((path) => router.push(path), [
521
+ * { name: "dashboard", path: "/dashboard", description: "Main dashboard" },
522
+ * ]);
523
+ * ```
524
+ */
525
+ export declare function useAgoNavigation(navigate: (path: string) => void, routes: AgoRoute[]): void;
526
+
527
+ /**
528
+ * Read a framework-agnostic AGO store (`createStore`) as a reactive Vue ref.
529
+ *
530
+ * The ref's `.value` updates on every `store.set(...)`. Mutate through the store,
531
+ * not the ref. A `shallowRef` is used because the store replaces its value
532
+ * wholesale, so deep reactivity would be wasted work.
533
+ *
534
+ * ```ts
535
+ * const cart = createStore({ items: [] as string[] });
536
+ *
537
+ * // in setup():
538
+ * const state = useAgoStore(cart);
539
+ * // template: {{ state.items.length }}
540
+ * ```
541
+ */
542
+ export declare function useAgoStore<T>(store: Store<T>): ShallowRef<T>;
543
+
544
+ /**
545
+ * All-in-one composable combining messages + conversations.
546
+ *
547
+ * ```ts
548
+ * const { messages, sendMessage, conversations, selectConversation } = useChat();
549
+ * ```
550
+ */
551
+ export declare function useChat(options?: UseChatOptions): {
552
+ messages: Ref< {
553
+ id: string;
554
+ conversationId: string;
555
+ content: string;
556
+ role: "user" | "assistant";
557
+ status: MessageStatus_2;
558
+ agent?: {
559
+ id: string;
560
+ name: string;
561
+ displayName?: string | undefined;
562
+ } | undefined;
563
+ sources?: {
564
+ id: string;
565
+ title: string;
566
+ url?: string | undefined;
567
+ }[] | undefined;
568
+ toolCalls?: {
569
+ id: string;
570
+ type: ToolCallType_2;
571
+ status: string;
572
+ toolName: string;
573
+ toolDisplayName?: string | undefined;
574
+ message?: string | undefined;
575
+ formSchema?: {
576
+ type: "object";
577
+ properties: Record<string, FormField_2>;
578
+ required?: string[] | undefined;
579
+ } | undefined;
580
+ data?: Record<string, unknown> | undefined;
581
+ functionName?: string | undefined;
582
+ arguments?: Record<string, unknown> | undefined;
583
+ }[] | undefined;
584
+ followUpReplies?: string[] | undefined;
585
+ createdAt: Date;
586
+ }[], AgoMessage[] | {
587
+ id: string;
588
+ conversationId: string;
589
+ content: string;
590
+ role: "user" | "assistant";
591
+ status: MessageStatus_2;
592
+ agent?: {
593
+ id: string;
594
+ name: string;
595
+ displayName?: string | undefined;
596
+ } | undefined;
597
+ sources?: {
598
+ id: string;
599
+ title: string;
600
+ url?: string | undefined;
601
+ }[] | undefined;
602
+ toolCalls?: {
603
+ id: string;
604
+ type: ToolCallType_2;
605
+ status: string;
606
+ toolName: string;
607
+ toolDisplayName?: string | undefined;
608
+ message?: string | undefined;
609
+ formSchema?: {
610
+ type: "object";
611
+ properties: Record<string, FormField_2>;
612
+ required?: string[] | undefined;
613
+ } | undefined;
614
+ data?: Record<string, unknown> | undefined;
615
+ functionName?: string | undefined;
616
+ arguments?: Record<string, unknown> | undefined;
617
+ }[] | undefined;
618
+ followUpReplies?: string[] | undefined;
619
+ createdAt: Date;
620
+ }[]>;
621
+ isLoading: Ref<boolean, boolean>;
622
+ error: ComputedRef<Error | null>;
623
+ sendMessage: (content: string, files?: File[]) => Promise<AgoMessage | null>;
624
+ clearMessages: () => void;
625
+ conversationId: Ref<string | undefined, string | undefined>;
626
+ conversations: Ref< {
627
+ id: string;
628
+ title: string;
629
+ lastMessageDate: Date;
630
+ messages?: {
631
+ id: string;
632
+ conversationId: string;
633
+ content: string;
634
+ role: "user" | "assistant";
635
+ status: MessageStatus_2;
636
+ agent?: {
637
+ id: string;
638
+ name: string;
639
+ displayName?: string | undefined;
640
+ } | undefined;
641
+ sources?: {
642
+ id: string;
643
+ title: string;
644
+ url?: string | undefined;
645
+ }[] | undefined;
646
+ toolCalls?: {
647
+ id: string;
648
+ type: ToolCallType_2;
649
+ status: string;
650
+ toolName: string;
651
+ toolDisplayName?: string | undefined;
652
+ message?: string | undefined;
653
+ formSchema?: {
654
+ type: "object";
655
+ properties: Record<string, FormField_2>;
656
+ required?: string[] | undefined;
657
+ } | undefined;
658
+ data?: Record<string, unknown> | undefined;
659
+ functionName?: string | undefined;
660
+ arguments?: Record<string, unknown> | undefined;
661
+ }[] | undefined;
662
+ followUpReplies?: string[] | undefined;
663
+ createdAt: Date;
664
+ }[] | undefined;
665
+ }[], Conversation[] | {
666
+ id: string;
667
+ title: string;
668
+ lastMessageDate: Date;
669
+ messages?: {
670
+ id: string;
671
+ conversationId: string;
672
+ content: string;
673
+ role: "user" | "assistant";
674
+ status: MessageStatus_2;
675
+ agent?: {
676
+ id: string;
677
+ name: string;
678
+ displayName?: string | undefined;
679
+ } | undefined;
680
+ sources?: {
681
+ id: string;
682
+ title: string;
683
+ url?: string | undefined;
684
+ }[] | undefined;
685
+ toolCalls?: {
686
+ id: string;
687
+ type: ToolCallType_2;
688
+ status: string;
689
+ toolName: string;
690
+ toolDisplayName?: string | undefined;
691
+ message?: string | undefined;
692
+ formSchema?: {
693
+ type: "object";
694
+ properties: Record<string, FormField_2>;
695
+ required?: string[] | undefined;
696
+ } | undefined;
697
+ data?: Record<string, unknown> | undefined;
698
+ functionName?: string | undefined;
699
+ arguments?: Record<string, unknown> | undefined;
700
+ }[] | undefined;
701
+ followUpReplies?: string[] | undefined;
702
+ createdAt: Date;
703
+ }[] | undefined;
704
+ }[]>;
705
+ currentConversation: Ref< {
706
+ id: string;
707
+ title: string;
708
+ lastMessageDate: Date;
709
+ messages?: {
710
+ id: string;
711
+ conversationId: string;
712
+ content: string;
713
+ role: "user" | "assistant";
714
+ status: MessageStatus_2;
715
+ agent?: {
716
+ id: string;
717
+ name: string;
718
+ displayName?: string | undefined;
719
+ } | undefined;
720
+ sources?: {
721
+ id: string;
722
+ title: string;
723
+ url?: string | undefined;
724
+ }[] | undefined;
725
+ toolCalls?: {
726
+ id: string;
727
+ type: ToolCallType_2;
728
+ status: string;
729
+ toolName: string;
730
+ toolDisplayName?: string | undefined;
731
+ message?: string | undefined;
732
+ formSchema?: {
733
+ type: "object";
734
+ properties: Record<string, FormField_2>;
735
+ required?: string[] | undefined;
736
+ } | undefined;
737
+ data?: Record<string, unknown> | undefined;
738
+ functionName?: string | undefined;
739
+ arguments?: Record<string, unknown> | undefined;
740
+ }[] | undefined;
741
+ followUpReplies?: string[] | undefined;
742
+ createdAt: Date;
743
+ }[] | undefined;
744
+ } | null, Conversation | {
745
+ id: string;
746
+ title: string;
747
+ lastMessageDate: Date;
748
+ messages?: {
749
+ id: string;
750
+ conversationId: string;
751
+ content: string;
752
+ role: "user" | "assistant";
753
+ status: MessageStatus_2;
754
+ agent?: {
755
+ id: string;
756
+ name: string;
757
+ displayName?: string | undefined;
758
+ } | undefined;
759
+ sources?: {
760
+ id: string;
761
+ title: string;
762
+ url?: string | undefined;
763
+ }[] | undefined;
764
+ toolCalls?: {
765
+ id: string;
766
+ type: ToolCallType_2;
767
+ status: string;
768
+ toolName: string;
769
+ toolDisplayName?: string | undefined;
770
+ message?: string | undefined;
771
+ formSchema?: {
772
+ type: "object";
773
+ properties: Record<string, FormField_2>;
774
+ required?: string[] | undefined;
775
+ } | undefined;
776
+ data?: Record<string, unknown> | undefined;
777
+ functionName?: string | undefined;
778
+ arguments?: Record<string, unknown> | undefined;
779
+ }[] | undefined;
780
+ followUpReplies?: string[] | undefined;
781
+ createdAt: Date;
782
+ }[] | undefined;
783
+ } | null>;
784
+ isConversationsLoading: Ref<boolean, boolean>;
785
+ selectConversation: (id: string) => Promise<void>;
786
+ startNewConversation: () => void;
787
+ refreshConversations: () => Promise<void>;
788
+ };
789
+
790
+ declare interface UseChatOptions {
791
+ client?: AgoClient;
792
+ conversationId?: string;
793
+ autoLoad?: boolean;
794
+ }
795
+
796
+ /**
797
+ * Composable to manage conversations.
798
+ *
799
+ * ```ts
800
+ * const { conversations, selectConversation } = useConversation();
801
+ * ```
802
+ */
803
+ export declare function useConversation(options?: UseConversationOptions): {
804
+ conversations: Ref< {
805
+ id: string;
806
+ title: string;
807
+ lastMessageDate: Date;
808
+ messages?: {
809
+ id: string;
810
+ conversationId: string;
811
+ content: string;
812
+ role: "user" | "assistant";
813
+ status: MessageStatus_2;
814
+ agent?: {
815
+ id: string;
816
+ name: string;
817
+ displayName?: string | undefined;
818
+ } | undefined;
819
+ sources?: {
820
+ id: string;
821
+ title: string;
822
+ url?: string | undefined;
823
+ }[] | undefined;
824
+ toolCalls?: {
825
+ id: string;
826
+ type: ToolCallType_2;
827
+ status: string;
828
+ toolName: string;
829
+ toolDisplayName?: string | undefined;
830
+ message?: string | undefined;
831
+ formSchema?: {
832
+ type: "object";
833
+ properties: Record<string, FormField_2>;
834
+ required?: string[] | undefined;
835
+ } | undefined;
836
+ data?: Record<string, unknown> | undefined;
837
+ functionName?: string | undefined;
838
+ arguments?: Record<string, unknown> | undefined;
839
+ }[] | undefined;
840
+ followUpReplies?: string[] | undefined;
841
+ createdAt: Date;
842
+ }[] | undefined;
843
+ }[], Conversation[] | {
844
+ id: string;
845
+ title: string;
846
+ lastMessageDate: Date;
847
+ messages?: {
848
+ id: string;
849
+ conversationId: string;
850
+ content: string;
851
+ role: "user" | "assistant";
852
+ status: MessageStatus_2;
853
+ agent?: {
854
+ id: string;
855
+ name: string;
856
+ displayName?: string | undefined;
857
+ } | undefined;
858
+ sources?: {
859
+ id: string;
860
+ title: string;
861
+ url?: string | undefined;
862
+ }[] | undefined;
863
+ toolCalls?: {
864
+ id: string;
865
+ type: ToolCallType_2;
866
+ status: string;
867
+ toolName: string;
868
+ toolDisplayName?: string | undefined;
869
+ message?: string | undefined;
870
+ formSchema?: {
871
+ type: "object";
872
+ properties: Record<string, FormField_2>;
873
+ required?: string[] | undefined;
874
+ } | undefined;
875
+ data?: Record<string, unknown> | undefined;
876
+ functionName?: string | undefined;
877
+ arguments?: Record<string, unknown> | undefined;
878
+ }[] | undefined;
879
+ followUpReplies?: string[] | undefined;
880
+ createdAt: Date;
881
+ }[] | undefined;
882
+ }[]>;
883
+ currentConversation: Ref< {
884
+ id: string;
885
+ title: string;
886
+ lastMessageDate: Date;
887
+ messages?: {
888
+ id: string;
889
+ conversationId: string;
890
+ content: string;
891
+ role: "user" | "assistant";
892
+ status: MessageStatus_2;
893
+ agent?: {
894
+ id: string;
895
+ name: string;
896
+ displayName?: string | undefined;
897
+ } | undefined;
898
+ sources?: {
899
+ id: string;
900
+ title: string;
901
+ url?: string | undefined;
902
+ }[] | undefined;
903
+ toolCalls?: {
904
+ id: string;
905
+ type: ToolCallType_2;
906
+ status: string;
907
+ toolName: string;
908
+ toolDisplayName?: string | undefined;
909
+ message?: string | undefined;
910
+ formSchema?: {
911
+ type: "object";
912
+ properties: Record<string, FormField_2>;
913
+ required?: string[] | undefined;
914
+ } | undefined;
915
+ data?: Record<string, unknown> | undefined;
916
+ functionName?: string | undefined;
917
+ arguments?: Record<string, unknown> | undefined;
918
+ }[] | undefined;
919
+ followUpReplies?: string[] | undefined;
920
+ createdAt: Date;
921
+ }[] | undefined;
922
+ } | null, Conversation | {
923
+ id: string;
924
+ title: string;
925
+ lastMessageDate: Date;
926
+ messages?: {
927
+ id: string;
928
+ conversationId: string;
929
+ content: string;
930
+ role: "user" | "assistant";
931
+ status: MessageStatus_2;
932
+ agent?: {
933
+ id: string;
934
+ name: string;
935
+ displayName?: string | undefined;
936
+ } | undefined;
937
+ sources?: {
938
+ id: string;
939
+ title: string;
940
+ url?: string | undefined;
941
+ }[] | undefined;
942
+ toolCalls?: {
943
+ id: string;
944
+ type: ToolCallType_2;
945
+ status: string;
946
+ toolName: string;
947
+ toolDisplayName?: string | undefined;
948
+ message?: string | undefined;
949
+ formSchema?: {
950
+ type: "object";
951
+ properties: Record<string, FormField_2>;
952
+ required?: string[] | undefined;
953
+ } | undefined;
954
+ data?: Record<string, unknown> | undefined;
955
+ functionName?: string | undefined;
956
+ arguments?: Record<string, unknown> | undefined;
957
+ }[] | undefined;
958
+ followUpReplies?: string[] | undefined;
959
+ createdAt: Date;
960
+ }[] | undefined;
961
+ } | null>;
962
+ isLoading: Ref<boolean, boolean>;
963
+ error: Ref<Error | null, Error | null>;
964
+ selectConversation: (id: string) => Promise<void>;
965
+ startNewConversation: () => void;
966
+ refreshConversations: () => Promise<void>;
967
+ };
968
+
969
+ declare interface UseConversationOptions {
970
+ client?: AgoClient;
971
+ autoLoad?: boolean;
972
+ }
973
+
974
+ /**
975
+ * Composable to manage messages in a conversation.
976
+ *
977
+ * ```ts
978
+ * const { messages, sendMessage, isLoading } = useMessages();
979
+ * ```
980
+ */
981
+ export declare function useMessages(options?: UseMessagesOptions): {
982
+ messages: Ref< {
983
+ id: string;
984
+ conversationId: string;
985
+ content: string;
986
+ role: "user" | "assistant";
987
+ status: MessageStatus_2;
988
+ agent?: {
989
+ id: string;
990
+ name: string;
991
+ displayName?: string | undefined;
992
+ } | undefined;
993
+ sources?: {
994
+ id: string;
995
+ title: string;
996
+ url?: string | undefined;
997
+ }[] | undefined;
998
+ toolCalls?: {
999
+ id: string;
1000
+ type: ToolCallType_2;
1001
+ status: string;
1002
+ toolName: string;
1003
+ toolDisplayName?: string | undefined;
1004
+ message?: string | undefined;
1005
+ formSchema?: {
1006
+ type: "object";
1007
+ properties: Record<string, FormField_2>;
1008
+ required?: string[] | undefined;
1009
+ } | undefined;
1010
+ data?: Record<string, unknown> | undefined;
1011
+ functionName?: string | undefined;
1012
+ arguments?: Record<string, unknown> | undefined;
1013
+ }[] | undefined;
1014
+ followUpReplies?: string[] | undefined;
1015
+ createdAt: Date;
1016
+ }[], AgoMessage[] | {
1017
+ id: string;
1018
+ conversationId: string;
1019
+ content: string;
1020
+ role: "user" | "assistant";
1021
+ status: MessageStatus_2;
1022
+ agent?: {
1023
+ id: string;
1024
+ name: string;
1025
+ displayName?: string | undefined;
1026
+ } | undefined;
1027
+ sources?: {
1028
+ id: string;
1029
+ title: string;
1030
+ url?: string | undefined;
1031
+ }[] | undefined;
1032
+ toolCalls?: {
1033
+ id: string;
1034
+ type: ToolCallType_2;
1035
+ status: string;
1036
+ toolName: string;
1037
+ toolDisplayName?: string | undefined;
1038
+ message?: string | undefined;
1039
+ formSchema?: {
1040
+ type: "object";
1041
+ properties: Record<string, FormField_2>;
1042
+ required?: string[] | undefined;
1043
+ } | undefined;
1044
+ data?: Record<string, unknown> | undefined;
1045
+ functionName?: string | undefined;
1046
+ arguments?: Record<string, unknown> | undefined;
1047
+ }[] | undefined;
1048
+ followUpReplies?: string[] | undefined;
1049
+ createdAt: Date;
1050
+ }[]>;
1051
+ isLoading: Ref<boolean, boolean>;
1052
+ error: Ref<Error | null, Error | null>;
1053
+ conversationId: Ref<string | undefined, string | undefined>;
1054
+ sendMessage: (content: string, files?: File[]) => Promise<AgoMessage | null>;
1055
+ clearMessages: () => void;
1056
+ };
1057
+
1058
+ declare interface UseMessagesOptions {
1059
+ client?: AgoClient;
1060
+ conversationId?: string;
1061
+ }
1062
+
1063
+ export { }