@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.
- 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/createFormCollector-ClzHfaBd.js +185 -0
- package/dist/createFormCollector-H4Me_2uj.cjs +1 -0
- package/dist/createMockClient-C50gjV0b.js +71 -0
- package/dist/createMockClient-DQvFFWnc.cjs +1 -0
- package/dist/devtools.cjs +26 -100
- package/dist/devtools.d.cts +443 -0
- package/dist/devtools.d.ts +443 -2
- package/dist/devtools.js +68 -93
- package/dist/functions-BH1X5kas.cjs +1 -0
- package/dist/functions-CWSRi3xv.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 +129 -298
- package/dist/react.cjs +31 -22438
- package/dist/react.d.cts +999 -0
- package/dist/react.d.ts +999 -2
- package/dist/react.js +8416 -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.cjs +1 -0
- package/dist/widget.d.cts +577 -0
- package/dist/widget.d.ts +577 -2
- package/dist/widget.js +398 -0
- 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
- package/dist/widget/types.d.ts +0 -43
package/dist/devtools.d.ts
CHANGED
|
@@ -1,2 +1,443 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 { }
|
package/dist/devtools.js
CHANGED
|
@@ -1,87 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var getStateFn = () => ({});
|
|
5
|
-
function renderState() {
|
|
6
|
-
if (!stateEl) return;
|
|
7
|
-
stateEl.textContent = JSON.stringify(getStateFn(), null, 2);
|
|
1
|
+
var r, d, x = () => ({});
|
|
2
|
+
function p() {
|
|
3
|
+
r && (r.textContent = JSON.stringify(x(), null, 2));
|
|
8
4
|
}
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
line.textContent = `${(/* @__PURE__ */ new Date()).toLocaleTimeString()} ${text}`;
|
|
14
|
-
logEl.appendChild(line);
|
|
15
|
-
logEl.scrollTop = logEl.scrollHeight;
|
|
5
|
+
function g(t, a) {
|
|
6
|
+
if (!d) return;
|
|
7
|
+
const e = document.createElement("div");
|
|
8
|
+
e.className = `dev-log-line dev-log-${a}`, e.textContent = `${(/* @__PURE__ */ new Date()).toLocaleTimeString()} ${t}`, d.appendChild(e), d.scrollTop = d.scrollHeight;
|
|
16
9
|
}
|
|
17
|
-
var
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
localStorage.setItem(COLLAPSE_KEY, collapsed ? "1" : "0");
|
|
28
|
-
} catch {}
|
|
10
|
+
var u = "ago_dev_panel_collapsed";
|
|
11
|
+
function s(t, a) {
|
|
12
|
+
t.classList.toggle("collapsed", a);
|
|
13
|
+
const e = t.querySelector(".dev-toggle");
|
|
14
|
+
e && (e.textContent = a ? "▢" : "—", e.title = a ? "Expand dev tools" : "Collapse dev tools", e.setAttribute("aria-expanded", String(!a)));
|
|
15
|
+
try {
|
|
16
|
+
localStorage.setItem(u, a ? "1" : "0");
|
|
17
|
+
} catch {
|
|
18
|
+
}
|
|
29
19
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const panel = document.createElement("aside");
|
|
36
|
-
panel.id = "dev-panel";
|
|
37
|
-
(host ?? document.body).appendChild(panel);
|
|
38
|
-
panel.innerHTML = `
|
|
20
|
+
function m(t) {
|
|
21
|
+
const { store: a, client: e, target: i } = t;
|
|
22
|
+
x = a.get, b();
|
|
23
|
+
const f = typeof i == "string" ? document.querySelector(i) : i instanceof Element ? i : document.body, o = document.createElement("aside");
|
|
24
|
+
o.id = "ago-dev-panel", (f ?? document.body).appendChild(o), o.innerHTML = `
|
|
39
25
|
<div class="dev-head">
|
|
40
26
|
<span class="dev-badge">DEV</span>
|
|
41
27
|
<span class="dev-title">DEV TOOLS · client-side function state — not for production</span>
|
|
42
28
|
<button type="button" class="dev-toggle" aria-label="Toggle dev tools">—</button>
|
|
43
29
|
</div>
|
|
44
30
|
<div class="dev-body">
|
|
45
|
-
<div class="dev-fns">Registered functions: <code>${(
|
|
31
|
+
<div class="dev-fns">Registered functions: <code>${(e.getRegisteredFunctions?.() ?? []).map((n) => n.name).join(", ") || "—"}</code></div>
|
|
46
32
|
<div class="dev-section-label">JSON object (built by the agent)</div>
|
|
47
|
-
<pre class="dev-state" id="dev-state"></pre>
|
|
33
|
+
<pre class="dev-state" id="ago-dev-state"></pre>
|
|
48
34
|
<div class="dev-section-label">Function calls</div>
|
|
49
|
-
<div class="dev-log" id="dev-log"></div>
|
|
35
|
+
<div class="dev-log" id="ago-dev-log"></div>
|
|
50
36
|
</div>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
client.on("function:invoke", ({ functionName, arguments: args }) => {
|
|
67
|
-
logLine(`→ ${functionName}(${JSON.stringify(args ?? {})})`, "invoke");
|
|
68
|
-
});
|
|
69
|
-
client.on("function:result", ({ result, error }) => {
|
|
70
|
-
logLine(error ? `✗ error: ${error}` : `← ${JSON.stringify(result)}`, error ? "error" : "result");
|
|
71
|
-
});
|
|
72
|
-
store.subscribe(renderState);
|
|
73
|
-
renderState();
|
|
37
|
+
`, r = o.querySelector("#ago-dev-state"), d = o.querySelector("#ago-dev-log"), o.querySelector(".dev-toggle")?.addEventListener("click", (n) => {
|
|
38
|
+
n.stopPropagation(), s(o, !o.classList.contains("collapsed"));
|
|
39
|
+
}), o.addEventListener("click", () => {
|
|
40
|
+
o.classList.contains("collapsed") && s(o, !1);
|
|
41
|
+
});
|
|
42
|
+
let c = !1;
|
|
43
|
+
try {
|
|
44
|
+
c = localStorage.getItem(u) === "1";
|
|
45
|
+
} catch {
|
|
46
|
+
}
|
|
47
|
+
s(o, c), e.on("function:invoke", ({ functionName: n, arguments: l }) => {
|
|
48
|
+
g(`→ ${n}(${JSON.stringify(l ?? {})})`, "invoke");
|
|
49
|
+
}), e.on("function:result", ({ result: n, error: l }) => {
|
|
50
|
+
g(l ? `✗ error: ${l}` : `← ${JSON.stringify(n)}`, l ? "error" : "result");
|
|
51
|
+
}), a.subscribe(p), p();
|
|
74
52
|
}
|
|
75
|
-
var
|
|
76
|
-
function
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
style.textContent = PANEL_CSS;
|
|
81
|
-
document.head.appendChild(style);
|
|
53
|
+
var v = "ago-dev-panel-styles";
|
|
54
|
+
function b() {
|
|
55
|
+
if (document.getElementById(v)) return;
|
|
56
|
+
const t = document.createElement("style");
|
|
57
|
+
t.id = v, t.textContent = h, document.head.appendChild(t);
|
|
82
58
|
}
|
|
83
|
-
var
|
|
84
|
-
#dev-panel {
|
|
59
|
+
var h = `
|
|
60
|
+
#ago-dev-panel {
|
|
85
61
|
position: fixed;
|
|
86
62
|
top: 16px;
|
|
87
63
|
right: 16px;
|
|
@@ -102,8 +78,8 @@ var PANEL_CSS = `
|
|
|
102
78
|
font-size: 12px;
|
|
103
79
|
z-index: 1000;
|
|
104
80
|
}
|
|
105
|
-
#dev-panel .dev-head { display: flex; align-items: center; gap: 8px; }
|
|
106
|
-
#dev-panel .dev-toggle {
|
|
81
|
+
#ago-dev-panel .dev-head { display: flex; align-items: center; gap: 8px; }
|
|
82
|
+
#ago-dev-panel .dev-toggle {
|
|
107
83
|
margin-left: auto;
|
|
108
84
|
flex: none;
|
|
109
85
|
width: 22px;
|
|
@@ -119,19 +95,19 @@ var PANEL_CSS = `
|
|
|
119
95
|
line-height: 1;
|
|
120
96
|
cursor: pointer;
|
|
121
97
|
}
|
|
122
|
-
#dev-panel .dev-toggle:hover { color: #d7e0e8; border-color: #3a4655; }
|
|
123
|
-
#dev-panel .dev-body { display: flex; flex-direction: column; gap: 8px; }
|
|
98
|
+
#ago-dev-panel .dev-toggle:hover { color: #d7e0e8; border-color: #3a4655; }
|
|
99
|
+
#ago-dev-panel .dev-body { display: flex; flex-direction: column; gap: 8px; }
|
|
124
100
|
|
|
125
101
|
/* Collapsed: shrink to a small clickable widget showing only the DEV badge. */
|
|
126
|
-
#dev-panel.collapsed {
|
|
102
|
+
#ago-dev-panel.collapsed {
|
|
127
103
|
width: auto;
|
|
128
104
|
cursor: pointer;
|
|
129
105
|
padding: 8px 10px;
|
|
130
106
|
}
|
|
131
|
-
#dev-panel.collapsed .dev-title,
|
|
132
|
-
#dev-panel.collapsed .dev-body { display: none; }
|
|
133
|
-
#dev-panel.collapsed .dev-toggle { margin-left: 6px; }
|
|
134
|
-
#dev-panel .dev-badge {
|
|
107
|
+
#ago-dev-panel.collapsed .dev-title,
|
|
108
|
+
#ago-dev-panel.collapsed .dev-body { display: none; }
|
|
109
|
+
#ago-dev-panel.collapsed .dev-toggle { margin-left: 6px; }
|
|
110
|
+
#ago-dev-panel .dev-badge {
|
|
135
111
|
background: #f59e0b;
|
|
136
112
|
color: #1c1206;
|
|
137
113
|
font-weight: 700;
|
|
@@ -140,17 +116,17 @@ var PANEL_CSS = `
|
|
|
140
116
|
padding: 2px 6px;
|
|
141
117
|
border-radius: 5px;
|
|
142
118
|
}
|
|
143
|
-
#dev-panel .dev-title { color: #f59e0b; font-size: 11px; line-height: 1.3; }
|
|
144
|
-
#dev-panel .dev-fns { color: #7c8a99; font-size: 11px; }
|
|
145
|
-
#dev-panel .dev-fns code { color: #9ecbff; }
|
|
146
|
-
#dev-panel .dev-section-label {
|
|
119
|
+
#ago-dev-panel .dev-title { color: #f59e0b; font-size: 11px; line-height: 1.3; }
|
|
120
|
+
#ago-dev-panel .dev-fns { color: #7c8a99; font-size: 11px; }
|
|
121
|
+
#ago-dev-panel .dev-fns code { color: #9ecbff; }
|
|
122
|
+
#ago-dev-panel .dev-section-label {
|
|
147
123
|
color: #7c8a99;
|
|
148
124
|
text-transform: uppercase;
|
|
149
125
|
letter-spacing: .08em;
|
|
150
126
|
font-size: 10px;
|
|
151
127
|
margin-top: 4px;
|
|
152
128
|
}
|
|
153
|
-
#dev-panel .dev-state {
|
|
129
|
+
#ago-dev-panel .dev-state {
|
|
154
130
|
margin: 0;
|
|
155
131
|
padding: 8px;
|
|
156
132
|
background: #060a0e;
|
|
@@ -160,7 +136,7 @@ var PANEL_CSS = `
|
|
|
160
136
|
white-space: pre;
|
|
161
137
|
color: #c8e6c9;
|
|
162
138
|
}
|
|
163
|
-
#dev-panel .dev-log {
|
|
139
|
+
#ago-dev-panel .dev-log {
|
|
164
140
|
display: flex;
|
|
165
141
|
flex-direction: column;
|
|
166
142
|
gap: 2px;
|
|
@@ -170,12 +146,11 @@ var PANEL_CSS = `
|
|
|
170
146
|
border-radius: 8px;
|
|
171
147
|
padding: 6px 8px;
|
|
172
148
|
}
|
|
173
|
-
#dev-panel .dev-log-line { white-space: pre-wrap; word-break: break-word; line-height: 1.4; }
|
|
174
|
-
#dev-panel .dev-log-invoke { color: #9ecbff; }
|
|
175
|
-
#dev-panel .dev-log-result { color: #86efac; }
|
|
176
|
-
#dev-panel .dev-log-error { color: #fca5a5; }
|
|
149
|
+
#ago-dev-panel .dev-log-line { white-space: pre-wrap; word-break: break-word; line-height: 1.4; }
|
|
150
|
+
#ago-dev-panel .dev-log-invoke { color: #9ecbff; }
|
|
151
|
+
#ago-dev-panel .dev-log-result { color: #86efac; }
|
|
152
|
+
#ago-dev-panel .dev-log-error { color: #fca5a5; }
|
|
177
153
|
`;
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
//# sourceMappingURL=devtools.js.map
|
|
154
|
+
export {
|
|
155
|
+
m as initDevPanel
|
|
156
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const v=require("./rolldown-runtime-CaekUdDJ.cjs");var w=v.__exportAll({copyToClipboard:()=>c,getLocalStorage:()=>f,getUserLocation:()=>p,highlightElement:()=>h,openUrl:()=>a,scrollToElement:()=>d,setLocalStorage:()=>m,setTheme:()=>l,showConfirmDialog:()=>u,showNotification:()=>s,showToast:()=>i,submitForm:()=>y,trackEvent:()=>g}),i={name:"showToast",description:"Show a toast notification to the user. Use this to confirm actions or display brief messages.",parameters:{type:"object",properties:{message:{type:"string",description:"The message to display"},type:{type:"string",description:"Toast type",enum:["success","error","warning","info"]},duration:{type:"number",description:"Duration in milliseconds (default 3000)"}},required:["message"]},handler:async()=>({shown:!1,error:"No toast handler configured"})},s={name:"showNotification",description:"Show a browser notification to the user. Useful for important alerts even when the tab is not focused.",parameters:{type:"object",properties:{title:{type:"string",description:"Notification title"},body:{type:"string",description:"Notification body text"}},required:["title"]},handler:async e=>typeof Notification>"u"?{shown:!1,error:"Notifications not supported"}:Notification.permission==="denied"?{shown:!1,error:"Notification permission denied"}:(Notification.permission!=="granted"&&await Notification.requestPermission(),Notification.permission==="granted"?(new Notification(e.title,{body:e.body}),{shown:!0}):{shown:!1,error:"Permission not granted"})},a={name:"openUrl",description:"Open a URL in a new browser tab.",parameters:{type:"object",properties:{url:{type:"string",description:"The URL to open"}},required:["url"]},handler:async e=>(window.open(e.url,"_blank","noopener,noreferrer"),{opened:!0})},c={name:"copyToClipboard",description:"Copy text to the user's clipboard.",parameters:{type:"object",properties:{text:{type:"string",description:"The text to copy"}},required:["text"]},handler:async e=>(await navigator.clipboard.writeText(e.text),{copied:!0})},l={name:"setTheme",description:"Change the application's color theme. Sets a data-theme attribute on the document element.",parameters:{type:"object",properties:{theme:{type:"string",description:"Theme to apply",enum:["light","dark","system"]}},required:["theme"]},handler:async e=>{const t=e.theme;return document.documentElement.setAttribute("data-theme",t),t==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),{theme:t,applied:!0}}},u={name:"showConfirmDialog",description:"Show a confirmation dialog to the user and return their choice (true/false).",parameters:{type:"object",properties:{message:{type:"string",description:"The confirmation message to display"}},required:["message"]},handler:async e=>({confirmed:window.confirm(e.message)})},p={name:"getUserLocation",description:"Get the user's current geographic location (requires permission).",parameters:{type:"object",properties:{}},handler:async()=>navigator.geolocation?new Promise(e=>{navigator.geolocation.getCurrentPosition(t=>e({latitude:t.coords.latitude,longitude:t.coords.longitude,accuracy:t.coords.accuracy}),t=>e({error:t.message}))}):{error:"Geolocation not supported"}},d={name:"scrollToElement",description:"Scroll the page to a specific element identified by CSS selector.",parameters:{type:"object",properties:{selector:{type:"string",description:"CSS selector of the element to scroll to (e.g. '#section-pricing')"},behavior:{type:"string",description:"Scroll behavior",enum:["smooth","instant"]}},required:["selector"]},handler:async e=>{const t=document.querySelector(e.selector);return t?(t.scrollIntoView({behavior:e.behavior||"smooth"}),{scrolled:!0}):{scrolled:!1,error:`Element not found: ${e.selector}`}}},m={name:"setLocalStorage",description:"Store a value in the browser's localStorage.",parameters:{type:"object",properties:{key:{type:"string",description:"Storage key"},value:{type:"string",description:"Value to store"}},required:["key","value"]},handler:async e=>(localStorage.setItem(e.key,e.value),{stored:!0})},f={name:"getLocalStorage",description:"Retrieve a value from the browser's localStorage.",parameters:{type:"object",properties:{key:{type:"string",description:"Storage key"}},required:["key"]},handler:async e=>{const t=localStorage.getItem(e.key);return{key:e.key,value:t,found:t!==null}}},h={name:"highlightElement",description:"Highlight a DOM element to draw the user's attention (e.g. for onboarding).",parameters:{type:"object",properties:{selector:{type:"string",description:"CSS selector of the element to highlight"},color:{type:"string",description:"Highlight border color (default: #3b82f6)"}},required:["selector"]},handler:async e=>{const t=document.querySelector(e.selector);if(!t)return{highlighted:!1,error:`Element not found: ${e.selector}`};const r=t.style.outline,o=e.color||"#3b82f6";return t.style.outline=`3px solid ${o}`,t.style.outlineOffset="2px",t.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(()=>{t.style.outline=r,t.style.outlineOffset=""},3e3),{highlighted:!0}}},y={name:"submitForm",description:"Fill and submit an HTML form on the page. Pass field values as key-value pairs.",parameters:{type:"object",properties:{selector:{type:"string",description:"CSS selector of the form element"},values:{type:"string",description:"JSON string of field name → value pairs"}},required:["selector"]},handler:async e=>{const t=document.querySelector(e.selector);if(!t)return{submitted:!1,error:`Form not found: ${e.selector}`};if(e.values){const r=JSON.parse(e.values);for(const[o,b]of Object.entries(r)){const n=t.elements.namedItem(o);n&&(n.value=b)}}return t.requestSubmit(),{submitted:!0}}},g={name:"trackEvent",description:"Track a custom analytics event. Override the handler to wire up your analytics provider.",parameters:{type:"object",properties:{event:{type:"string",description:"Event name"},properties:{type:"string",description:"JSON string of event properties"}},required:["event"]},handler:async e=>{const t=e.properties?JSON.parse(e.properties):{};return console.log(`[AGO Analytics] ${e.event}`,t),{tracked:!0,event:e.event}}};Object.defineProperty(exports,"copyToClipboard",{enumerable:!0,get:function(){return c}});Object.defineProperty(exports,"functions_exports",{enumerable:!0,get:function(){return w}});Object.defineProperty(exports,"getLocalStorage",{enumerable:!0,get:function(){return f}});Object.defineProperty(exports,"getUserLocation",{enumerable:!0,get:function(){return p}});Object.defineProperty(exports,"highlightElement",{enumerable:!0,get:function(){return h}});Object.defineProperty(exports,"openUrl",{enumerable:!0,get:function(){return a}});Object.defineProperty(exports,"scrollToElement",{enumerable:!0,get:function(){return d}});Object.defineProperty(exports,"setLocalStorage",{enumerable:!0,get:function(){return m}});Object.defineProperty(exports,"setTheme",{enumerable:!0,get:function(){return l}});Object.defineProperty(exports,"showConfirmDialog",{enumerable:!0,get:function(){return u}});Object.defineProperty(exports,"showNotification",{enumerable:!0,get:function(){return s}});Object.defineProperty(exports,"showToast",{enumerable:!0,get:function(){return i}});Object.defineProperty(exports,"submitForm",{enumerable:!0,get:function(){return y}});Object.defineProperty(exports,"trackEvent",{enumerable:!0,get:function(){return g}});
|