@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.
- package/dist/AgoClient-DF7M2WAz.js +575 -0
- package/dist/AgoClient-bjN-z2ZQ.cjs +6 -0
- package/dist/angular.cjs +1 -143
- package/dist/angular.d.cts +530 -0
- package/dist/angular.d.ts +530 -2
- package/dist/angular.js +71 -139
- package/dist/createMockClient-D6uVh-B9.js +254 -0
- package/dist/createMockClient-DecMEUcK.cjs +1 -0
- package/dist/devtools.cjs +4 -78
- package/dist/devtools.d.cts +443 -0
- package/dist/devtools.d.ts +443 -2
- package/dist/devtools.js +46 -71
- package/dist/functions-Bz-1Bs3I.cjs +1 -0
- package/dist/functions-DdROP6Ui.js +312 -0
- package/dist/helpers.cjs +1 -15
- package/dist/{helpers/functions.d.ts → helpers.d.cts} +121 -62
- package/dist/helpers.d.ts +121 -2
- package/dist/helpers.js +16 -2
- package/dist/index.cjs +1 -347
- package/dist/index.d.cts +1150 -0
- package/dist/index.d.ts +1150 -20
- package/dist/index.js +128 -298
- package/dist/react.cjs +31 -22438
- package/dist/react.d.cts +960 -0
- package/dist/react.d.ts +960 -2
- package/dist/react.js +8401 -22376
- package/dist/rolldown-runtime-CaekUdDJ.cjs +1 -0
- package/dist/rolldown-runtime-DxmricAu.js +25 -0
- package/dist/vue.cjs +1 -336
- package/dist/vue.d.cts +1063 -0
- package/dist/vue.d.ts +1063 -2
- package/dist/vue.js +174 -316
- package/dist/{widget/types.d.ts → widget.d.cts} +41 -43
- package/dist/widget.d.ts +41 -2
- package/package.json +35 -24
- package/dist/AgoClient-DPZdN5n2.js +0 -905
- package/dist/AgoClient-DPZdN5n2.js.map +0 -1
- package/dist/AgoClient-wMVUQqCD.cjs +0 -976
- package/dist/AgoClient-wMVUQqCD.cjs.map +0 -1
- package/dist/angular/ago.service.d.ts +0 -98
- package/dist/angular/index.d.ts +0 -4
- package/dist/angular/provide.d.ts +0 -27
- package/dist/angular.cjs.map +0 -1
- package/dist/angular.js.map +0 -1
- package/dist/api/HttpClient.d.ts +0 -31
- package/dist/api/index.d.ts +0 -1
- package/dist/auto/createAgo.d.ts +0 -39
- package/dist/auto/index.d.ts +0 -1
- package/dist/client/AgoClient.d.ts +0 -169
- package/dist/client/errors.d.ts +0 -48
- package/dist/client/index.d.ts +0 -3
- package/dist/client/types.d.ts +0 -205
- package/dist/createMockClient-Ci_N2tH8.cjs +0 -104
- package/dist/createMockClient-Ci_N2tH8.cjs.map +0 -1
- package/dist/createMockClient-U0ae_AYy.js +0 -99
- package/dist/createMockClient-U0ae_AYy.js.map +0 -1
- package/dist/devtools/index.d.ts +0 -2
- package/dist/devtools/initDevPanel.d.ts +0 -15
- package/dist/devtools.cjs.map +0 -1
- package/dist/devtools.js.map +0 -1
- package/dist/functions/FunctionRegistry.d.ts +0 -41
- package/dist/functions/defineFunction.d.ts +0 -22
- package/dist/functions/index.d.ts +0 -2
- package/dist/functions/types.d.ts +0 -50
- package/dist/functions--c6lx3ic.cjs +0 -480
- package/dist/functions--c6lx3ic.cjs.map +0 -1
- package/dist/functions-C9F1dnmh.js +0 -398
- package/dist/functions-C9F1dnmh.js.map +0 -1
- package/dist/helpers/factory.d.ts +0 -20
- package/dist/helpers/index.d.ts +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/react/components/ChatInput.d.ts +0 -12
- package/dist/react/components/ChatWidget.d.ts +0 -35
- package/dist/react/components/Markdown.d.ts +0 -12
- package/dist/react/components/Message.d.ts +0 -9
- package/dist/react/components/index.d.ts +0 -8
- package/dist/react/context/AgoContext.d.ts +0 -62
- package/dist/react/context/index.d.ts +0 -2
- package/dist/react/hooks/index.d.ts +0 -7
- package/dist/react/hooks/useAgo.d.ts +0 -14
- package/dist/react/hooks/useAgoContext.d.ts +0 -40
- package/dist/react/hooks/useAgoFunction.d.ts +0 -58
- package/dist/react/hooks/useAgoStore.d.ts +0 -17
- package/dist/react/hooks/useChat.d.ts +0 -45
- package/dist/react/hooks/useConversation.d.ts +0 -28
- package/dist/react/hooks/useMessages.d.ts +0 -26
- package/dist/react/index.d.ts +0 -24
- package/dist/react/testing.d.ts +0 -2
- package/dist/react.cjs.map +0 -1
- package/dist/react.js.map +0 -1
- package/dist/rolldown-runtime-BqCkTl7Q.cjs +0 -50
- package/dist/rolldown-runtime-CNZpIYwj.js +0 -33
- package/dist/state/ClientContextRegistry.d.ts +0 -64
- package/dist/state/createStore.d.ts +0 -30
- package/dist/streaming/SSEHandler.d.ts +0 -46
- package/dist/streaming/helpers.d.ts +0 -67
- package/dist/streaming/index.d.ts +0 -2
- package/dist/testing/createMockClient.d.ts +0 -42
- package/dist/testing/index.d.ts +0 -2
- package/dist/utils/eventEmitter.d.ts +0 -23
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/logger.d.ts +0 -14
- package/dist/vue/composables/useAgo.d.ts +0 -17
- package/dist/vue/composables/useAgoEvents.d.ts +0 -11
- package/dist/vue/composables/useAgoFunction.d.ts +0 -34
- package/dist/vue/composables/useAgoStore.d.ts +0 -18
- package/dist/vue/composables/useChat.d.ts +0 -251
- package/dist/vue/composables/useConversation.d.ts +0 -178
- package/dist/vue/composables/useMessages.d.ts +0 -89
- package/dist/vue/index.d.ts +0 -11
- package/dist/vue/plugin.d.ts +0 -16
- package/dist/vue/symbols.d.ts +0 -3
- package/dist/vue.cjs.map +0 -1
- package/dist/vue.js.map +0 -1
- package/dist/widget/index.d.ts +0 -1
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent information
|
|
3
|
+
*/
|
|
4
|
+
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
|
+
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
|
+
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
|
+
declare type AgoEventName = keyof AgoClientEvents;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Message from AGO
|
|
245
|
+
*/
|
|
246
|
+
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
|
+
/**
|
|
260
|
+
* Knowledge source citation
|
|
261
|
+
*/
|
|
262
|
+
declare interface AgoSource {
|
|
263
|
+
id: string;
|
|
264
|
+
title: string;
|
|
265
|
+
url?: string;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Single-object function definition — combines name, schema, and handler.
|
|
270
|
+
*
|
|
271
|
+
* ```ts
|
|
272
|
+
* const fn = defineFunction({
|
|
273
|
+
* name: "lookupOrder",
|
|
274
|
+
* description: "Look up an order by ID",
|
|
275
|
+
* parameters: { type: "object", properties: { id: { type: "string" } }, required: ["id"] },
|
|
276
|
+
* handler: async (args) => fetchOrder(args.id as string),
|
|
277
|
+
* });
|
|
278
|
+
* client.registerFunction(fn);
|
|
279
|
+
* ```
|
|
280
|
+
*/
|
|
281
|
+
declare interface ClientFunctionDefinition {
|
|
282
|
+
name: string;
|
|
283
|
+
description: string;
|
|
284
|
+
parameters: ClientFunctionSchema["parameters"];
|
|
285
|
+
handler: ClientFunctionHandler;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Function handler type
|
|
290
|
+
*/
|
|
291
|
+
declare type ClientFunctionHandler = (args: Record<string, unknown>) => Promise<unknown> | unknown;
|
|
292
|
+
|
|
293
|
+
declare interface ClientFunctionInvocation {
|
|
294
|
+
invocationId: string;
|
|
295
|
+
functionName: string;
|
|
296
|
+
arguments: Record<string, unknown>;
|
|
297
|
+
conversationId: string;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Schema for a client-side function that AGO can call
|
|
302
|
+
*/
|
|
303
|
+
declare interface ClientFunctionSchema {
|
|
304
|
+
/** Function name (must be unique) */
|
|
305
|
+
name: string;
|
|
306
|
+
/** Description for the LLM to understand when to call this function */
|
|
307
|
+
description: string;
|
|
308
|
+
/** JSON Schema for function parameters */
|
|
309
|
+
parameters: {
|
|
310
|
+
type: "object";
|
|
311
|
+
properties: Record<string, {
|
|
312
|
+
type: string;
|
|
313
|
+
description?: string;
|
|
314
|
+
enum?: string[];
|
|
315
|
+
default?: unknown;
|
|
316
|
+
}>;
|
|
317
|
+
required?: string[];
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* A single piece of context the client wants the LLM to know about.
|
|
323
|
+
*/
|
|
324
|
+
declare interface ContextEntry {
|
|
325
|
+
/** Human-readable label (e.g. "Order detail", "Current user") */
|
|
326
|
+
name?: string;
|
|
327
|
+
/** Short description of what this context represents */
|
|
328
|
+
description?: string;
|
|
329
|
+
/** Arbitrary structured data the AI should know about */
|
|
330
|
+
data?: Record<string, unknown>;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Serialised client context sent with each message.
|
|
335
|
+
*/
|
|
336
|
+
declare interface ContextSnapshot {
|
|
337
|
+
/** All active context entries keyed by their registration key */
|
|
338
|
+
entries: Record<string, ContextEntry>;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Conversation/Thread
|
|
343
|
+
*/
|
|
344
|
+
declare interface Conversation {
|
|
345
|
+
id: string;
|
|
346
|
+
title: string;
|
|
347
|
+
lastMessageDate: Date;
|
|
348
|
+
messages?: AgoMessage[];
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/** Options for {@link initDevPanel}. */
|
|
352
|
+
export declare interface DevPanelOptions {
|
|
353
|
+
/** The store whose state the panel renders live. */
|
|
354
|
+
store: Store<unknown>;
|
|
355
|
+
/**
|
|
356
|
+
* Client to read registered functions from and listen to function events on.
|
|
357
|
+
* Typed structurally so a mock client works too.
|
|
358
|
+
*/
|
|
359
|
+
client: Pick<AgoClient, "on" | "getRegisteredFunctions">;
|
|
360
|
+
/** Where to mount: a CSS selector, an Element, or `document.body` (default). */
|
|
361
|
+
target?: string | Element;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* A function that returns a fresh context entry on demand.
|
|
366
|
+
* Evaluated every time a message is sent — use it to pull data from stores,
|
|
367
|
+
* refs, or any source that isn't captured by React state.
|
|
368
|
+
*/
|
|
369
|
+
declare type DynamicContextProvider = () => ContextEntry | null | undefined;
|
|
370
|
+
|
|
371
|
+
declare interface FormField {
|
|
372
|
+
type: "string" | "number" | "boolean" | "array";
|
|
373
|
+
title?: string;
|
|
374
|
+
description?: string;
|
|
375
|
+
enum?: string[];
|
|
376
|
+
default?: unknown;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Form schema for tool calls requiring user input
|
|
381
|
+
*/
|
|
382
|
+
declare interface FormSchema {
|
|
383
|
+
type: "object";
|
|
384
|
+
properties: Record<string, FormField>;
|
|
385
|
+
required?: string[];
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export declare function initDevPanel(options: DevPanelOptions): void;
|
|
389
|
+
|
|
390
|
+
declare type MessageStatus = "IN_PROGRESS" | "DONE" | "ERROR" | "TODO" | "CANCELED";
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Options for sending a message
|
|
394
|
+
*/
|
|
395
|
+
declare interface SendMessageOptions {
|
|
396
|
+
/** Existing conversation ID */
|
|
397
|
+
conversationId?: string;
|
|
398
|
+
/** Override default agent */
|
|
399
|
+
agentId?: string;
|
|
400
|
+
/** File attachments */
|
|
401
|
+
files?: File[];
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* A minimal observable store: one value, synchronous subscriptions, and
|
|
406
|
+
* optional persistence via {@link PersistOptions} (localStorage by default).
|
|
407
|
+
*
|
|
408
|
+
* ```ts
|
|
409
|
+
* const store = createStore({ count: 0 });
|
|
410
|
+
* store.subscribe((state) => save(state));
|
|
411
|
+
* store.set({ count: 1 }); // listeners fire synchronously
|
|
412
|
+
*
|
|
413
|
+
* const cart = createStore({ items: [] }, { key: "cart" }); // persisted
|
|
414
|
+
* ```
|
|
415
|
+
*/
|
|
416
|
+
declare interface Store<T> {
|
|
417
|
+
/** Current state. */
|
|
418
|
+
get(): T;
|
|
419
|
+
/** Replace the state and notify subscribers synchronously. */
|
|
420
|
+
set(next: T): void;
|
|
421
|
+
/** Register a listener; returns a function that removes it. */
|
|
422
|
+
subscribe(listener: (state: T) => void): () => void;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Tool call data from SSE stream
|
|
427
|
+
*/
|
|
428
|
+
declare interface ToolCallData {
|
|
429
|
+
id: string;
|
|
430
|
+
type: ToolCallType;
|
|
431
|
+
status: string;
|
|
432
|
+
toolName: string;
|
|
433
|
+
toolDisplayName?: string;
|
|
434
|
+
message?: string;
|
|
435
|
+
formSchema?: FormSchema;
|
|
436
|
+
data?: Record<string, unknown>;
|
|
437
|
+
functionName?: string;
|
|
438
|
+
arguments?: Record<string, unknown>;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
declare type ToolCallType = "form" | "confirmation_input" | "status_message" | "progress_indicator" | "client_function" | "reasoning" | "mcp_ui_resource";
|
|
442
|
+
|
|
443
|
+
export { }
|