@useago/sdk 0.3.2 → 0.3.4

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 (121) 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/createFormCollector-ClzHfaBd.js +185 -0
  8. package/dist/createFormCollector-H4Me_2uj.cjs +1 -0
  9. package/dist/createMockClient-C50gjV0b.js +71 -0
  10. package/dist/createMockClient-DQvFFWnc.cjs +1 -0
  11. package/dist/devtools.cjs +26 -100
  12. package/dist/devtools.d.cts +443 -0
  13. package/dist/devtools.d.ts +443 -2
  14. package/dist/devtools.js +68 -93
  15. package/dist/functions-BH1X5kas.cjs +1 -0
  16. package/dist/functions-CWSRi3xv.js +312 -0
  17. package/dist/helpers.cjs +1 -15
  18. package/dist/{helpers/functions.d.ts → helpers.d.cts} +121 -62
  19. package/dist/helpers.d.ts +121 -2
  20. package/dist/helpers.js +16 -2
  21. package/dist/index.cjs +1 -347
  22. package/dist/index.d.cts +1150 -0
  23. package/dist/index.d.ts +1150 -20
  24. package/dist/index.js +129 -298
  25. package/dist/react.cjs +31 -22438
  26. package/dist/react.d.cts +999 -0
  27. package/dist/react.d.ts +999 -2
  28. package/dist/react.js +8416 -22376
  29. package/dist/rolldown-runtime-CaekUdDJ.cjs +1 -0
  30. package/dist/rolldown-runtime-DxmricAu.js +25 -0
  31. package/dist/vue.cjs +1 -336
  32. package/dist/vue.d.cts +1063 -0
  33. package/dist/vue.d.ts +1063 -2
  34. package/dist/vue.js +174 -316
  35. package/dist/widget.cjs +1 -0
  36. package/dist/widget.d.cts +577 -0
  37. package/dist/widget.d.ts +577 -2
  38. package/dist/widget.js +398 -0
  39. package/package.json +35 -24
  40. package/dist/AgoClient-DPZdN5n2.js +0 -905
  41. package/dist/AgoClient-DPZdN5n2.js.map +0 -1
  42. package/dist/AgoClient-wMVUQqCD.cjs +0 -976
  43. package/dist/AgoClient-wMVUQqCD.cjs.map +0 -1
  44. package/dist/angular/ago.service.d.ts +0 -98
  45. package/dist/angular/index.d.ts +0 -4
  46. package/dist/angular/provide.d.ts +0 -27
  47. package/dist/angular.cjs.map +0 -1
  48. package/dist/angular.js.map +0 -1
  49. package/dist/api/HttpClient.d.ts +0 -31
  50. package/dist/api/index.d.ts +0 -1
  51. package/dist/auto/createAgo.d.ts +0 -39
  52. package/dist/auto/index.d.ts +0 -1
  53. package/dist/client/AgoClient.d.ts +0 -169
  54. package/dist/client/errors.d.ts +0 -48
  55. package/dist/client/index.d.ts +0 -3
  56. package/dist/client/types.d.ts +0 -205
  57. package/dist/createMockClient-Ci_N2tH8.cjs +0 -104
  58. package/dist/createMockClient-Ci_N2tH8.cjs.map +0 -1
  59. package/dist/createMockClient-U0ae_AYy.js +0 -99
  60. package/dist/createMockClient-U0ae_AYy.js.map +0 -1
  61. package/dist/devtools/index.d.ts +0 -2
  62. package/dist/devtools/initDevPanel.d.ts +0 -15
  63. package/dist/devtools.cjs.map +0 -1
  64. package/dist/devtools.js.map +0 -1
  65. package/dist/functions/FunctionRegistry.d.ts +0 -41
  66. package/dist/functions/defineFunction.d.ts +0 -22
  67. package/dist/functions/index.d.ts +0 -2
  68. package/dist/functions/types.d.ts +0 -50
  69. package/dist/functions--c6lx3ic.cjs +0 -480
  70. package/dist/functions--c6lx3ic.cjs.map +0 -1
  71. package/dist/functions-C9F1dnmh.js +0 -398
  72. package/dist/functions-C9F1dnmh.js.map +0 -1
  73. package/dist/helpers/factory.d.ts +0 -20
  74. package/dist/helpers/index.d.ts +0 -1
  75. package/dist/index.cjs.map +0 -1
  76. package/dist/index.js.map +0 -1
  77. package/dist/react/components/ChatInput.d.ts +0 -12
  78. package/dist/react/components/ChatWidget.d.ts +0 -35
  79. package/dist/react/components/Markdown.d.ts +0 -12
  80. package/dist/react/components/Message.d.ts +0 -9
  81. package/dist/react/components/index.d.ts +0 -8
  82. package/dist/react/context/AgoContext.d.ts +0 -62
  83. package/dist/react/context/index.d.ts +0 -2
  84. package/dist/react/hooks/index.d.ts +0 -7
  85. package/dist/react/hooks/useAgo.d.ts +0 -14
  86. package/dist/react/hooks/useAgoContext.d.ts +0 -40
  87. package/dist/react/hooks/useAgoFunction.d.ts +0 -58
  88. package/dist/react/hooks/useAgoStore.d.ts +0 -17
  89. package/dist/react/hooks/useChat.d.ts +0 -45
  90. package/dist/react/hooks/useConversation.d.ts +0 -28
  91. package/dist/react/hooks/useMessages.d.ts +0 -26
  92. package/dist/react/index.d.ts +0 -24
  93. package/dist/react/testing.d.ts +0 -2
  94. package/dist/react.cjs.map +0 -1
  95. package/dist/react.js.map +0 -1
  96. package/dist/rolldown-runtime-BqCkTl7Q.cjs +0 -50
  97. package/dist/rolldown-runtime-CNZpIYwj.js +0 -33
  98. package/dist/state/ClientContextRegistry.d.ts +0 -64
  99. package/dist/state/createStore.d.ts +0 -30
  100. package/dist/streaming/SSEHandler.d.ts +0 -46
  101. package/dist/streaming/helpers.d.ts +0 -67
  102. package/dist/streaming/index.d.ts +0 -2
  103. package/dist/testing/createMockClient.d.ts +0 -42
  104. package/dist/testing/index.d.ts +0 -2
  105. package/dist/utils/eventEmitter.d.ts +0 -23
  106. package/dist/utils/index.d.ts +0 -2
  107. package/dist/utils/logger.d.ts +0 -14
  108. package/dist/vue/composables/useAgo.d.ts +0 -17
  109. package/dist/vue/composables/useAgoEvents.d.ts +0 -11
  110. package/dist/vue/composables/useAgoFunction.d.ts +0 -34
  111. package/dist/vue/composables/useAgoStore.d.ts +0 -18
  112. package/dist/vue/composables/useChat.d.ts +0 -251
  113. package/dist/vue/composables/useConversation.d.ts +0 -178
  114. package/dist/vue/composables/useMessages.d.ts +0 -89
  115. package/dist/vue/index.d.ts +0 -11
  116. package/dist/vue/plugin.d.ts +0 -16
  117. package/dist/vue/symbols.d.ts +0 -3
  118. package/dist/vue.cjs.map +0 -1
  119. package/dist/vue.js.map +0 -1
  120. package/dist/widget/index.d.ts +0 -1
  121. package/dist/widget/types.d.ts +0 -43
package/dist/angular.cjs CHANGED
@@ -1,143 +1 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_AgoClient = require("./AgoClient-wMVUQqCD.cjs");
3
- //#region src/angular/ago.service.ts
4
- /**
5
- * Angular-style service wrapping AgoClient.
6
- * Provides RxJS-like Observables for streaming events and standard Promise-based methods.
7
- *
8
- * Usage with Angular DI:
9
- * ```ts
10
- * import { provideAgo, AgoService } from "@useago/sdk/angular";
11
- *
12
- * // In providers array:
13
- * provideAgo({ baseUrl: "https://YOUR-DOMAIN.useago.com" })
14
- *
15
- * // In component:
16
- * @Component({...})
17
- * export class ChatComponent {
18
- * private ago = inject(AgoService);
19
- * messages$ = this.ago.messages$;
20
- * }
21
- * ```
22
- *
23
- * Works without Angular DI too — just instantiate directly:
24
- * ```ts
25
- * const ago = new AgoService({ baseUrl: "https://YOUR-DOMAIN.useago.com" });
26
- * ```
27
- */
28
- var AgoService = class {
29
- constructor(config) {
30
- this.client = new require_AgoClient.AgoClient(config);
31
- this.messages$ = this.fromEvent("message:complete");
32
- this.chunks$ = this.fromEvent("message:chunk");
33
- this.errors$ = this.fromEvent("message:error");
34
- this.messageStart$ = this.fromEvent("message:start");
35
- }
36
- /** Create a minimal Observable from an AgoClient event */
37
- fromEvent(event) {
38
- const client = this.client;
39
- return { subscribe(observer) {
40
- const handler = (data) => {
41
- observer.next?.(data);
42
- };
43
- client.on(event, handler);
44
- return { unsubscribe: () => client.off(event, handler) };
45
- } };
46
- }
47
- /** Send a message and get a streaming response */
48
- sendMessage(content, options) {
49
- return this.client.sendMessage(content, options);
50
- }
51
- /** Get all conversations */
52
- getConversations() {
53
- return this.client.getConversations();
54
- }
55
- /** Get a specific conversation with messages */
56
- getConversation(id) {
57
- return this.client.getConversation(id);
58
- }
59
- /** Get messages for a conversation */
60
- getMessages(conversationId) {
61
- return this.client.getMessages(conversationId);
62
- }
63
- /** Submit form data for a tool call */
64
- submitToolCallForm(toolCallId, formData) {
65
- return this.client.submitToolCallForm(toolCallId, formData);
66
- }
67
- /** Confirm a tool call */
68
- confirmToolCall(toolCallId) {
69
- return this.client.confirmToolCall(toolCallId);
70
- }
71
- /** Reject a tool call */
72
- rejectToolCall(toolCallId) {
73
- return this.client.rejectToolCall(toolCallId);
74
- }
75
- /** Submit feedback for a message */
76
- submitFeedback(messageId, rating) {
77
- return this.client.submitFeedback(messageId, rating);
78
- }
79
- registerFunction(nameOrDef, handler, schema) {
80
- if (typeof nameOrDef === "object") this.client.registerFunction(nameOrDef);
81
- else this.client.registerFunction(nameOrDef, handler, schema);
82
- }
83
- /** Unregister a client-side function */
84
- unregisterFunction(name) {
85
- return this.client.unregisterFunction(name);
86
- }
87
- /** Register navigation routes */
88
- registerNavigationFunction(navigate, routes) {
89
- this.client.registerNavigationFunction(navigate, routes);
90
- }
91
- /** Subscribe to a client event */
92
- on(event, handler) {
93
- this.client.on(event, handler);
94
- }
95
- /** Unsubscribe from a client event */
96
- off(event, handler) {
97
- this.client.off(event, handler);
98
- }
99
- /** Update client config */
100
- updateConfig(config) {
101
- this.client.updateConfig(config);
102
- }
103
- /** Get the underlying AgoClient instance */
104
- getClient() {
105
- return this.client;
106
- }
107
- /** Destroy the service and clean up resources */
108
- destroy() {
109
- this.client.destroy();
110
- }
111
- };
112
- //#endregion
113
- //#region src/angular/provide.ts
114
- /**
115
- * Factory function that returns an Angular-compatible provider.
116
- * Use in your app's `providers` array or `bootstrapApplication`:
117
- *
118
- * ```ts
119
- * import { provideAgo, AgoService } from "@useago/sdk/angular";
120
- *
121
- * bootstrapApplication(AppComponent, {
122
- * providers: [provideAgo({ baseUrl: "https://YOUR-DOMAIN.useago.com" })],
123
- * });
124
- *
125
- * // Then inject in any component:
126
- * const ago = inject(AgoService);
127
- * ```
128
- *
129
- * Returns a provider tuple compatible with Angular's DI.
130
- * Since this package avoids a hard Angular dependency, the provider
131
- * is returned as a plain object — Angular's injector accepts this format.
132
- */
133
- function provideAgo(options) {
134
- return {
135
- provide: AgoService,
136
- useValue: new AgoService(options)
137
- };
138
- }
139
- //#endregion
140
- exports.AgoService = AgoService;
141
- exports.provideAgo = provideAgo;
142
-
143
- //# sourceMappingURL=angular.cjs.map
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./AgoClient-bjN-z2ZQ.cjs");var n=class{constructor(e){this.client=new o.AgoClient(e),this.messages$=this.fromEvent("message:complete"),this.chunks$=this.fromEvent("message:chunk"),this.errors$=this.fromEvent("message:error"),this.messageStart$=this.fromEvent("message:start")}fromEvent(e){const t=this.client;return{subscribe(i){const s=r=>{i.next?.(r)};return t.on(e,s),{unsubscribe:()=>t.off(e,s)}}}}sendMessage(e,t){return this.client.sendMessage(e,t)}getConversations(){return this.client.getConversations()}getConversation(e){return this.client.getConversation(e)}getMessages(e){return this.client.getMessages(e)}submitToolCallForm(e,t){return this.client.submitToolCallForm(e,t)}confirmToolCall(e){return this.client.confirmToolCall(e)}rejectToolCall(e){return this.client.rejectToolCall(e)}submitFeedback(e,t){return this.client.submitFeedback(e,t)}registerFunction(e,t,i){typeof e=="object"?this.client.registerFunction(e):this.client.registerFunction(e,t,i)}unregisterFunction(e){return this.client.unregisterFunction(e)}registerNavigationFunction(e,t){this.client.registerNavigationFunction(e,t)}on(e,t){this.client.on(e,t)}off(e,t){this.client.off(e,t)}updateConfig(e){this.client.updateConfig(e)}getClient(){return this.client}destroy(){this.client.destroy()}};function c(e){return{provide:n,useValue:new n(e)}}exports.AgoService=n;exports.provideAgo=c;
@@ -0,0 +1,530 @@
1
+ /**
2
+ * Agent information
3
+ */
4
+ export declare interface AgoAgent {
5
+ id: string;
6
+ name: string;
7
+ displayName?: string;
8
+ }
9
+
10
+ /**
11
+ * Main SDK client for AGO Chat integration
12
+ */
13
+ declare class AgoClient {
14
+ private httpClient;
15
+ private functionRegistry;
16
+ private contextRegistry;
17
+ private eventEmitter;
18
+ private config;
19
+ constructor(config: AgoConfig);
20
+ /**
21
+ * Send a message and receive a streaming response
22
+ */
23
+ sendMessage(content: string, options?: SendMessageOptions): Promise<AgoMessage>;
24
+ private processSSEResponse;
25
+ private handleClientFunctionInvocation;
26
+ /**
27
+ * Get list of conversations
28
+ */
29
+ getConversations(): Promise<Conversation[]>;
30
+ /**
31
+ * Get a specific conversation with messages
32
+ */
33
+ getConversation(conversationId: string): Promise<Conversation>;
34
+ /**
35
+ * Get messages for a conversation
36
+ */
37
+ getMessages(conversationId: string): Promise<AgoMessage[]>;
38
+ /**
39
+ * Submit form data for a tool call
40
+ */
41
+ submitToolCallForm(toolCallId: string, formData: Record<string, unknown>): Promise<void>;
42
+ /**
43
+ * Confirm a tool call
44
+ */
45
+ confirmToolCall(toolCallId: string): Promise<void>;
46
+ /**
47
+ * Reject a tool call
48
+ */
49
+ rejectToolCall(toolCallId: string): Promise<void>;
50
+ /**
51
+ * Relay a completed form collector's values to a server-configured destination.
52
+ *
53
+ * Used by `createFormCollector` / `useFormCollector` in `{ via: "backend" }` mode:
54
+ * the browser never holds the destination URL or its secret — the backend resolves
55
+ * `destination` (a named, opted-in tool) and forwards the values from the server.
56
+ */
57
+ submitFormCollector(destination: string, values: Record<string, unknown>): Promise<unknown>;
58
+ /**
59
+ * Submit feedback for a message
60
+ */
61
+ submitFeedback(messageId: string, rating: "positive" | "negative"): Promise<void>;
62
+ /**
63
+ * Register a client-side function that AGO can call.
64
+ * Accepts either a definition object or (name, handler, schema) args.
65
+ *
66
+ * ```ts
67
+ * // Single-object (preferred)
68
+ * client.registerFunction({
69
+ * name: "lookupOrder",
70
+ * description: "Look up an order",
71
+ * parameters: { type: "object", properties: { id: { type: "string" } } },
72
+ * handler: async (args) => fetchOrder(args.id),
73
+ * });
74
+ *
75
+ * // Classic 3-arg form
76
+ * client.registerFunction("lookupOrder", handler, schema);
77
+ * ```
78
+ */
79
+ registerFunction(definition: ClientFunctionDefinition): void;
80
+ registerFunction(name: string, handler: ClientFunctionHandler, schema: Omit<ClientFunctionSchema, "name">): void;
81
+ /**
82
+ * Short alias for `registerFunction`. Also accepts an array of definitions.
83
+ *
84
+ * ```ts
85
+ * client.register(lookupOrder);
86
+ * client.register([lookupOrder, cancelOrder]);
87
+ * ```
88
+ */
89
+ register(definition: ClientFunctionDefinition | ClientFunctionDefinition[]): void;
90
+ /**
91
+ * Unregister a client-side function
92
+ */
93
+ unregisterFunction(name: string): boolean;
94
+ /**
95
+ * Get all registered function schemas
96
+ */
97
+ getRegisteredFunctions(): ClientFunctionSchema[];
98
+ /**
99
+ * Register a navigation function that lets AGO navigate users to different pages.
100
+ * @param navigate - A callback that performs the navigation (e.g. react-router's navigate)
101
+ * @param routes - Map of route names to paths, with descriptions for the LLM
102
+ */
103
+ registerNavigationFunction(navigate: (path: string) => void, routes: Array<{
104
+ name: string;
105
+ path: string;
106
+ description: string;
107
+ }>): void;
108
+ /**
109
+ * Register or update a piece of client-side context.
110
+ * This context is sent with every message so the AI understands the user's situation.
111
+ *
112
+ * ```ts
113
+ * client.setContext("order-page", {
114
+ * name: "Order detail",
115
+ * description: "User is viewing order #123",
116
+ * data: { orderId: "123", status: "shipped" },
117
+ * });
118
+ * ```
119
+ */
120
+ setContext(key: string, entry: ContextEntry): void;
121
+ /**
122
+ * Remove a previously registered context entry.
123
+ */
124
+ removeContext(key: string): boolean;
125
+ /**
126
+ * Register a dynamic context provider. The callback is invoked every time
127
+ * a message is sent, so the AI always gets the freshest data.
128
+ *
129
+ * Use this for context that lives outside React state — global stores,
130
+ * refs, or computed values.
131
+ *
132
+ * ```ts
133
+ * client.addDynamicContext("cart", () => ({
134
+ * name: "Checkout",
135
+ * data: { itemCount: cart.items.length, total: cart.total },
136
+ * }));
137
+ * ```
138
+ */
139
+ addDynamicContext(key: string, provider: DynamicContextProvider): void;
140
+ /**
141
+ * Remove a dynamic context provider.
142
+ */
143
+ removeDynamicContext(key: string): boolean;
144
+ /**
145
+ * Enable automatic capture of the current browser page (URL + title).
146
+ * Injected as a dynamic context entry named `browser-page`.
147
+ */
148
+ enableAutoPageContext(): void;
149
+ /**
150
+ * Get the current context snapshot.
151
+ */
152
+ getContextSnapshot(): ContextSnapshot | null;
153
+ /**
154
+ * Subscribe to an event
155
+ */
156
+ on<K extends AgoEventName>(event: K, handler: AgoEventHandler<K>): void;
157
+ /**
158
+ * Unsubscribe from an event
159
+ */
160
+ off<K extends AgoEventName>(event: K, handler: AgoEventHandler<K>): void;
161
+ /**
162
+ * Subscribe to an event once — auto-unsubscribes after the first call.
163
+ */
164
+ once<K extends AgoEventName>(event: K, handler: AgoEventHandler<K>): void;
165
+ /**
166
+ * Returns a Promise that resolves the next time `event` fires.
167
+ *
168
+ * ```ts
169
+ * const msg = await client.waitFor("message:complete", { timeout: 10000 });
170
+ * ```
171
+ */
172
+ waitFor<K extends AgoEventName>(event: K, options?: {
173
+ timeout?: number;
174
+ }): Promise<AgoClientEvents[K]>;
175
+ /**
176
+ * Update client configuration
177
+ */
178
+ updateConfig(config: Partial<AgoConfig>): void;
179
+ /**
180
+ * Clean up resources
181
+ */
182
+ destroy(): void;
183
+ }
184
+
185
+ /**
186
+ * SDK Events
187
+ */
188
+ export declare interface AgoClientEvents {
189
+ "message:start": {
190
+ conversationId: string;
191
+ messageId: string;
192
+ };
193
+ "message:chunk": {
194
+ content: string;
195
+ conversationId: string;
196
+ messageId: string;
197
+ };
198
+ "message:complete": AgoMessage;
199
+ "message:error": {
200
+ error: string;
201
+ conversationId?: string;
202
+ messageId?: string;
203
+ };
204
+ "toolCall:received": ToolCallData;
205
+ "toolCall:form": ToolCallData;
206
+ "function:invoke": ClientFunctionInvocation;
207
+ "function:result": {
208
+ invocationId: string;
209
+ result: unknown;
210
+ error?: string;
211
+ };
212
+ "connection:status": {
213
+ connected: boolean;
214
+ };
215
+ }
216
+
217
+ /**
218
+ * SDK Configuration
219
+ */
220
+ export declare interface AgoConfig {
221
+ /** API base URL (e.g., https://YOUR-DOMAIN.useago.com) */
222
+ baseUrl: string;
223
+ /** Widget ID (X-Widget-Id header). Auto-generated if not provided. */
224
+ widgetId?: string;
225
+ /** Default agent (id or slug) for new conversations. Shorthand for `defaultAgentId`. */
226
+ agent?: string;
227
+ /** Default agent ID for new conversations. Prefer `agent`. */
228
+ defaultAgentId?: string;
229
+ /** Permission name to apply to all requests (sent as `X-Widget-Permission`). Mirrors the widget's `window.AGO.permission`. */
230
+ permission?: string;
231
+ /** User email for identification */
232
+ userEmail?: string;
233
+ /** JWT token for authenticated users */
234
+ userJwt?: string;
235
+ /** Enable debug logging */
236
+ debug?: boolean;
237
+ }
238
+
239
+ declare type AgoEventHandler<K extends AgoEventName> = (data: AgoClientEvents[K]) => void;
240
+
241
+ export declare type AgoEventName = keyof AgoClientEvents;
242
+
243
+ /**
244
+ * Message from AGO
245
+ */
246
+ export declare interface AgoMessage {
247
+ id: string;
248
+ conversationId: string;
249
+ content: string;
250
+ role: "user" | "assistant";
251
+ status: MessageStatus;
252
+ agent?: AgoAgent;
253
+ sources?: AgoSource[];
254
+ toolCalls?: ToolCallData[];
255
+ followUpReplies?: string[];
256
+ createdAt: Date;
257
+ }
258
+
259
+ export declare interface AgoProvideOptions extends AgoConfig {
260
+ }
261
+
262
+ /**
263
+ * Angular-style service wrapping AgoClient.
264
+ * Provides RxJS-like Observables for streaming events and standard Promise-based methods.
265
+ *
266
+ * Usage with Angular DI:
267
+ * ```ts
268
+ * import { provideAgo, AgoService } from "@useago/sdk/angular";
269
+ *
270
+ * // In providers array:
271
+ * provideAgo({ baseUrl: "https://YOUR-DOMAIN.useago.com" })
272
+ *
273
+ * // In component:
274
+ * @Component({...})
275
+ * export class ChatComponent {
276
+ * private ago = inject(AgoService);
277
+ * messages$ = this.ago.messages$;
278
+ * }
279
+ * ```
280
+ *
281
+ * Works without Angular DI too — just instantiate directly:
282
+ * ```ts
283
+ * const ago = new AgoService({ baseUrl: "https://YOUR-DOMAIN.useago.com" });
284
+ * ```
285
+ */
286
+ export declare class AgoService {
287
+ private client;
288
+ /** Observable of complete messages */
289
+ readonly messages$: Observable<AgoMessage>;
290
+ /** Observable of streaming chunks */
291
+ readonly chunks$: Observable<{
292
+ content: string;
293
+ conversationId: string;
294
+ messageId: string;
295
+ }>;
296
+ /** Observable of errors */
297
+ readonly errors$: Observable<{
298
+ error: string;
299
+ conversationId?: string;
300
+ messageId?: string;
301
+ }>;
302
+ /** Observable of message start events */
303
+ readonly messageStart$: Observable<{
304
+ conversationId: string;
305
+ messageId: string;
306
+ }>;
307
+ constructor(config: AgoConfig);
308
+ /** Create a minimal Observable from an AgoClient event */
309
+ private fromEvent;
310
+ /** Send a message and get a streaming response */
311
+ sendMessage(content: string, options?: SendMessageOptions): Promise<AgoMessage>;
312
+ /** Get all conversations */
313
+ getConversations(): Promise<Conversation[]>;
314
+ /** Get a specific conversation with messages */
315
+ getConversation(id: string): Promise<Conversation>;
316
+ /** Get messages for a conversation */
317
+ getMessages(conversationId: string): Promise<AgoMessage[]>;
318
+ /** Submit form data for a tool call */
319
+ submitToolCallForm(toolCallId: string, formData: Record<string, unknown>): Promise<void>;
320
+ /** Confirm a tool call */
321
+ confirmToolCall(toolCallId: string): Promise<void>;
322
+ /** Reject a tool call */
323
+ rejectToolCall(toolCallId: string): Promise<void>;
324
+ /** Submit feedback for a message */
325
+ submitFeedback(messageId: string, rating: "positive" | "negative"): Promise<void>;
326
+ /** Register a client-side function */
327
+ registerFunction(definition: ClientFunctionDefinition): void;
328
+ registerFunction(name: string, handler: ClientFunctionHandler, schema: Omit<ClientFunctionSchema, "name">): void;
329
+ /** Unregister a client-side function */
330
+ unregisterFunction(name: string): boolean;
331
+ /** Register navigation routes */
332
+ registerNavigationFunction(navigate: (path: string) => void, routes: Array<{
333
+ name: string;
334
+ path: string;
335
+ description: string;
336
+ }>): void;
337
+ /** Subscribe to a client event */
338
+ on<K extends AgoEventName>(event: K, handler: (data: AgoClientEvents[K]) => void): void;
339
+ /** Unsubscribe from a client event */
340
+ off<K extends AgoEventName>(event: K, handler: (data: AgoClientEvents[K]) => void): void;
341
+ /** Update client config */
342
+ updateConfig(config: Partial<AgoConfig>): void;
343
+ /** Get the underlying AgoClient instance */
344
+ getClient(): AgoClient;
345
+ /** Destroy the service and clean up resources */
346
+ destroy(): void;
347
+ }
348
+
349
+ /**
350
+ * Knowledge source citation
351
+ */
352
+ export declare interface AgoSource {
353
+ id: string;
354
+ title: string;
355
+ url?: string;
356
+ }
357
+
358
+ /**
359
+ * Single-object function definition — combines name, schema, and handler.
360
+ *
361
+ * ```ts
362
+ * const fn = defineFunction({
363
+ * name: "lookupOrder",
364
+ * description: "Look up an order by ID",
365
+ * parameters: { type: "object", properties: { id: { type: "string" } }, required: ["id"] },
366
+ * handler: async (args) => fetchOrder(args.id as string),
367
+ * });
368
+ * client.registerFunction(fn);
369
+ * ```
370
+ */
371
+ declare interface ClientFunctionDefinition {
372
+ name: string;
373
+ description: string;
374
+ parameters: ClientFunctionSchema["parameters"];
375
+ handler: ClientFunctionHandler;
376
+ }
377
+
378
+ /**
379
+ * Function handler type
380
+ */
381
+ declare type ClientFunctionHandler = (args: Record<string, unknown>) => Promise<unknown> | unknown;
382
+
383
+ declare interface ClientFunctionInvocation {
384
+ invocationId: string;
385
+ functionName: string;
386
+ arguments: Record<string, unknown>;
387
+ conversationId: string;
388
+ }
389
+
390
+ /**
391
+ * Schema for a client-side function that AGO can call
392
+ */
393
+ declare interface ClientFunctionSchema {
394
+ /** Function name (must be unique) */
395
+ name: string;
396
+ /** Description for the LLM to understand when to call this function */
397
+ description: string;
398
+ /** JSON Schema for function parameters */
399
+ parameters: {
400
+ type: "object";
401
+ properties: Record<string, {
402
+ type: string;
403
+ description?: string;
404
+ enum?: string[];
405
+ default?: unknown;
406
+ }>;
407
+ required?: string[];
408
+ };
409
+ }
410
+
411
+ /**
412
+ * A single piece of context the client wants the LLM to know about.
413
+ */
414
+ declare interface ContextEntry {
415
+ /** Human-readable label (e.g. "Order detail", "Current user") */
416
+ name?: string;
417
+ /** Short description of what this context represents */
418
+ description?: string;
419
+ /** Arbitrary structured data the AI should know about */
420
+ data?: Record<string, unknown>;
421
+ }
422
+
423
+ /**
424
+ * Serialised client context sent with each message.
425
+ */
426
+ declare interface ContextSnapshot {
427
+ /** All active context entries keyed by their registration key */
428
+ entries: Record<string, ContextEntry>;
429
+ }
430
+
431
+ /**
432
+ * Conversation/Thread
433
+ */
434
+ export declare interface Conversation {
435
+ id: string;
436
+ title: string;
437
+ lastMessageDate: Date;
438
+ messages?: AgoMessage[];
439
+ }
440
+
441
+ /**
442
+ * A function that returns a fresh context entry on demand.
443
+ * Evaluated every time a message is sent — use it to pull data from stores,
444
+ * refs, or any source that isn't captured by React state.
445
+ */
446
+ declare type DynamicContextProvider = () => ContextEntry | null | undefined;
447
+
448
+ declare interface FormField {
449
+ type: "string" | "number" | "boolean" | "array";
450
+ title?: string;
451
+ description?: string;
452
+ enum?: string[];
453
+ default?: unknown;
454
+ }
455
+
456
+ /**
457
+ * Form schema for tool calls requiring user input
458
+ */
459
+ declare interface FormSchema {
460
+ type: "object";
461
+ properties: Record<string, FormField>;
462
+ required?: string[];
463
+ }
464
+
465
+ declare type MessageStatus = "IN_PROGRESS" | "DONE" | "ERROR" | "TODO" | "CANCELED";
466
+
467
+ declare interface Observable<T> {
468
+ subscribe(observer: {
469
+ next?: (value: T) => void;
470
+ error?: (err: unknown) => void;
471
+ }): {
472
+ unsubscribe: () => void;
473
+ };
474
+ }
475
+
476
+ /**
477
+ * Factory function that returns an Angular-compatible provider.
478
+ * Use in your app's `providers` array or `bootstrapApplication`:
479
+ *
480
+ * ```ts
481
+ * import { provideAgo, AgoService } from "@useago/sdk/angular";
482
+ *
483
+ * bootstrapApplication(AppComponent, {
484
+ * providers: [provideAgo({ baseUrl: "https://YOUR-DOMAIN.useago.com" })],
485
+ * });
486
+ *
487
+ * // Then inject in any component:
488
+ * const ago = inject(AgoService);
489
+ * ```
490
+ *
491
+ * Returns a provider tuple compatible with Angular's DI.
492
+ * Since this package avoids a hard Angular dependency, the provider
493
+ * is returned as a plain object — Angular's injector accepts this format.
494
+ */
495
+ export declare function provideAgo(options: AgoProvideOptions): {
496
+ provide: typeof AgoService;
497
+ useValue: AgoService;
498
+ };
499
+
500
+ /**
501
+ * Options for sending a message
502
+ */
503
+ declare interface SendMessageOptions {
504
+ /** Existing conversation ID */
505
+ conversationId?: string;
506
+ /** Override default agent */
507
+ agentId?: string;
508
+ /** File attachments */
509
+ files?: File[];
510
+ }
511
+
512
+ /**
513
+ * Tool call data from SSE stream
514
+ */
515
+ export declare interface ToolCallData {
516
+ id: string;
517
+ type: ToolCallType;
518
+ status: string;
519
+ toolName: string;
520
+ toolDisplayName?: string;
521
+ message?: string;
522
+ formSchema?: FormSchema;
523
+ data?: Record<string, unknown>;
524
+ functionName?: string;
525
+ arguments?: Record<string, unknown>;
526
+ }
527
+
528
+ declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
529
+
530
+ export { }