@useago/sdk 1.3.2 → 1.4.1
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/README.md +41 -0
- package/dist/{AgoClient-Cwx_eYSu.js → AgoClient-BdtuHX7k.js} +150 -85
- package/dist/AgoClient-CRAnT4qE.cjs +8 -0
- package/dist/angular.cjs +1 -1
- package/dist/angular.d.cts +99 -1
- package/dist/angular.d.ts +99 -1
- package/dist/angular.js +16 -7
- package/dist/{createConversationSession-DV0Xp_3O.cjs → createConversationSession-B8zfTL78.cjs} +1 -1
- package/dist/{createConversationSession-B3h567tt.js → createConversationSession-CWpf4u6I.js} +1 -1
- package/dist/{createFormCollector-CyWisAkI.js → createFormCollector-B4n0_diV.js} +1 -1
- package/dist/{createFormCollector-BB3Uscuo.cjs → createFormCollector-BB_l0Sia.cjs} +1 -1
- package/dist/{createMockClient-DwdxNwEn.js → createMockClient-d-arlmCq.js} +19 -17
- package/dist/createMockClient-ucPENDzz.cjs +1 -0
- package/dist/devtools.d.cts +93 -1
- package/dist/devtools.d.ts +93 -1
- package/dist/helpers.d.cts +5 -1
- package/dist/helpers.d.ts +5 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +93 -1
- package/dist/index.d.ts +93 -1
- package/dist/index.js +4 -4
- package/dist/react.cjs +3 -3
- package/dist/react.d.cts +158 -2
- package/dist/react.d.ts +158 -2
- package/dist/react.js +469 -391
- package/dist/testing.cjs +1 -1
- package/dist/testing.d.cts +93 -1
- package/dist/testing.d.ts +93 -1
- package/dist/testing.js +1 -1
- package/dist/vue.cjs +1 -1
- package/dist/vue.d.cts +125 -1
- package/dist/vue.d.ts +125 -1
- package/dist/vue.js +73 -64
- package/dist/widget.cjs +1 -1
- package/dist/widget.d.cts +93 -1
- package/dist/widget.d.ts +93 -1
- package/dist/widget.js +3 -3
- package/package.json +1 -1
- package/dist/AgoClient-CzSmJQxl.cjs +0 -6
- package/dist/createMockClient-zHQ0cjUH.cjs +0 -1
package/dist/react.d.cts
CHANGED
|
@@ -30,6 +30,23 @@ declare interface AgoAttachment {
|
|
|
30
30
|
isSafeImage: boolean;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
export declare interface AgoAutoContinueOptions {
|
|
34
|
+
/** Function names whose invocation counts as "navigated". Default `["navigateToPage"]`. */
|
|
35
|
+
navigationFunctions?: string[];
|
|
36
|
+
/** Registered function that signals the destination has editable state. Default `"setPageState"`. */
|
|
37
|
+
pageStateFunctionName?: string;
|
|
38
|
+
/** The hidden continuation prompt. Override for i18n / tone. */
|
|
39
|
+
continuationPrompt?: string;
|
|
40
|
+
/** Max continuations per user gesture (guards navigate→continue→navigate loops). Default `1`. */
|
|
41
|
+
maxDepth?: number;
|
|
42
|
+
/** How long to wait for the destination page to register page-state before giving up. Default `4000`ms. */
|
|
43
|
+
readinessTimeoutMs?: number;
|
|
44
|
+
/** Extra settle delay after page-state appears, to let sibling state mount. Default `150`ms. */
|
|
45
|
+
settleMs?: number;
|
|
46
|
+
/** Opt-out escape hatch. Default `true`. */
|
|
47
|
+
enabled?: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
33
50
|
/**
|
|
34
51
|
* Main SDK client for AGO Chat integration
|
|
35
52
|
*/
|
|
@@ -148,6 +165,12 @@ declare class AgoClient {
|
|
|
148
165
|
getRegisteredFunctions(): ClientFunctionSchema[];
|
|
149
166
|
/**
|
|
150
167
|
* Register a navigation function that lets AGO navigate users to different pages.
|
|
168
|
+
*
|
|
169
|
+
* Also registers a dynamic context entry (`current-page`) that reports the page
|
|
170
|
+
* the user is currently on, by route name, on every message. This is what lets
|
|
171
|
+
* the agent know *where* it is after it navigates (e.g. so auto-continuation
|
|
172
|
+
* can apply page state on the destination), not just how to navigate away.
|
|
173
|
+
*
|
|
151
174
|
* @param navigate - A callback that performs the navigation (e.g. react-router's navigate)
|
|
152
175
|
* @param routes - Map of route names to paths, with descriptions for the LLM
|
|
153
176
|
*/
|
|
@@ -156,6 +179,41 @@ declare class AgoClient {
|
|
|
156
179
|
path: string;
|
|
157
180
|
description: string;
|
|
158
181
|
}>): void;
|
|
182
|
+
/**
|
|
183
|
+
* Unregister the navigation function and its `current-page` context provider.
|
|
184
|
+
*/
|
|
185
|
+
unregisterNavigationFunction(): void;
|
|
186
|
+
/**
|
|
187
|
+
* Register a "page state" function that lets AGO change the current page's
|
|
188
|
+
* state (filters, sort, view mode, selection…) and reads the current state
|
|
189
|
+
* back as dynamic context. This is the state-mutation mirror of
|
|
190
|
+
* {@link registerNavigationFunction}.
|
|
191
|
+
*
|
|
192
|
+
* It does two things:
|
|
193
|
+
* - Synthesizes ONE client function (default name `setPageState`) whose
|
|
194
|
+
* properties are the controls — all optional, so the agent sets only the
|
|
195
|
+
* ones the user asked for.
|
|
196
|
+
* - Registers a dynamic context provider (keyed `page-state:<fnName>`) that
|
|
197
|
+
* reports each control's current `get()` value on every message.
|
|
198
|
+
*
|
|
199
|
+
* ```ts
|
|
200
|
+
* client.registerPageStateFunction([
|
|
201
|
+
* {
|
|
202
|
+
* name: "statusFilter",
|
|
203
|
+
* description: "Filter the list by review status",
|
|
204
|
+
* schema: { type: "string", enum: ["all", "pending", "approved"] },
|
|
205
|
+
* get: () => filters.status,
|
|
206
|
+
* set: (v) => setFilters({ ...filters, status: v }),
|
|
207
|
+
* },
|
|
208
|
+
* ]);
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
registerPageStateFunction(controls: AgoStateControl[], opts?: AgoPageStateOptions): void;
|
|
212
|
+
/**
|
|
213
|
+
* Unregister a page state function and its dynamic context provider.
|
|
214
|
+
* Mirror of unregistering `navigateToPage`.
|
|
215
|
+
*/
|
|
216
|
+
unregisterPageStateFunction(functionName?: string): void;
|
|
159
217
|
/**
|
|
160
218
|
* Register or update a piece of client-side context.
|
|
161
219
|
* This context is sent with every message so the AI understands the user's situation.
|
|
@@ -401,9 +459,23 @@ export declare interface AgoMessage {
|
|
|
401
459
|
followUpReplies?: string[];
|
|
402
460
|
/** Uploaded files on this message (usually the user's). */
|
|
403
461
|
attachments?: AgoAttachment[];
|
|
462
|
+
/**
|
|
463
|
+
* True when the backend flagged this message as hidden (e.g. an
|
|
464
|
+
* auto-continuation nudge). Kept in the model's context but not displayed;
|
|
465
|
+
* UI helpers like `useMessages`/`ChatWidget` filter these out.
|
|
466
|
+
*/
|
|
467
|
+
hidden?: boolean;
|
|
404
468
|
createdAt: Date;
|
|
405
469
|
}
|
|
406
470
|
|
|
471
|
+
/**
|
|
472
|
+
* Options for {@link AgoClient.registerPageStateFunction}.
|
|
473
|
+
*/
|
|
474
|
+
export declare interface AgoPageStateOptions {
|
|
475
|
+
/** Name of the synthesized client function. Defaults to "setPageState". */
|
|
476
|
+
functionName?: string;
|
|
477
|
+
}
|
|
478
|
+
|
|
407
479
|
/**
|
|
408
480
|
* Provides an AgoClient to all descendant components via React context.
|
|
409
481
|
*
|
|
@@ -457,6 +529,32 @@ export declare interface AgoSource {
|
|
|
457
529
|
url?: string;
|
|
458
530
|
}
|
|
459
531
|
|
|
532
|
+
/**
|
|
533
|
+
* A single editable control on the current page (a filter, a sort, a view mode,
|
|
534
|
+
* a selection…). It becomes one optional property of the synthesized
|
|
535
|
+
* `setPageState` function, and its current value is surfaced back to the agent
|
|
536
|
+
* as dynamic context. This is the state-mutation mirror of a navigation route.
|
|
537
|
+
*/
|
|
538
|
+
export declare interface AgoStateControl<T = unknown> {
|
|
539
|
+
/** Machine name of the control, e.g. "statusFilter". Becomes a property of the tool. */
|
|
540
|
+
name: string;
|
|
541
|
+
/** Description for the LLM, e.g. "Filter the list by review status". */
|
|
542
|
+
description: string;
|
|
543
|
+
/** JSON schema for a SINGLE field (like one property of navigateToPage). */
|
|
544
|
+
schema: {
|
|
545
|
+
type: "string" | "number" | "boolean" | "array";
|
|
546
|
+
enum?: (string | number)[];
|
|
547
|
+
items?: {
|
|
548
|
+
type: string;
|
|
549
|
+
enum?: (string | number)[];
|
|
550
|
+
};
|
|
551
|
+
};
|
|
552
|
+
/** Current value → pushed as dynamic context so the agent knows what to change. */
|
|
553
|
+
get?: () => T;
|
|
554
|
+
/** Apply the state change on the page. May be async. */
|
|
555
|
+
set: (value: T) => void | Promise<void>;
|
|
556
|
+
}
|
|
557
|
+
|
|
460
558
|
/**
|
|
461
559
|
* Chat input component with send button
|
|
462
560
|
*/
|
|
@@ -566,7 +664,11 @@ declare interface ClientFunctionSchema {
|
|
|
566
664
|
properties: Record<string, {
|
|
567
665
|
type: string;
|
|
568
666
|
description?: string;
|
|
569
|
-
enum?: string[];
|
|
667
|
+
enum?: (string | number)[];
|
|
668
|
+
items?: {
|
|
669
|
+
type: string;
|
|
670
|
+
enum?: (string | number)[];
|
|
671
|
+
};
|
|
570
672
|
default?: unknown;
|
|
571
673
|
}>;
|
|
572
674
|
required?: string[];
|
|
@@ -935,6 +1037,13 @@ declare interface SendMessageOptions {
|
|
|
935
1037
|
agentId?: string;
|
|
936
1038
|
/** File attachments */
|
|
937
1039
|
files?: File[];
|
|
1040
|
+
/**
|
|
1041
|
+
* Mark this message as hidden. The backend keeps it in the model's context but
|
|
1042
|
+
* flags it so the UI never displays it. Used by auto-continuation to nudge the
|
|
1043
|
+
* agent after a navigation without polluting the visible transcript.
|
|
1044
|
+
* Requires backend support for the `hidden` flag; older backends ignore it.
|
|
1045
|
+
*/
|
|
1046
|
+
hidden?: boolean;
|
|
938
1047
|
}
|
|
939
1048
|
|
|
940
1049
|
/**
|
|
@@ -1053,6 +1162,27 @@ export declare function useAgo(config: UseAgoOptions | null): {
|
|
|
1053
1162
|
isReady: boolean;
|
|
1054
1163
|
};
|
|
1055
1164
|
|
|
1165
|
+
/**
|
|
1166
|
+
* Auto-continue the agent after it navigates, so a "go to page B and change X"
|
|
1167
|
+
* request completes in one user gesture. Mount this once inside `AgoProvider`.
|
|
1168
|
+
*
|
|
1169
|
+
* How it works: when the agent calls the navigation function and that turn ends,
|
|
1170
|
+
* this waits for the destination page's `useAgoPageState` to register (so the
|
|
1171
|
+
* SDK will ship its `setPageState` + current state on the next send), then sends
|
|
1172
|
+
* a hidden continuation message. The agent then applies the state in a second
|
|
1173
|
+
* turn. The continuation is `hidden`, so it never shows in the transcript
|
|
1174
|
+
* (requires backend support for the `hidden` flag).
|
|
1175
|
+
*
|
|
1176
|
+
* ```tsx
|
|
1177
|
+
* function AppShell() {
|
|
1178
|
+
* useAgoNavigation(navigate, routes);
|
|
1179
|
+
* useAgoAutoContinueAfterNavigation();
|
|
1180
|
+
* return <Outlet />;
|
|
1181
|
+
* }
|
|
1182
|
+
* ```
|
|
1183
|
+
*/
|
|
1184
|
+
export declare function useAgoAutoContinueAfterNavigation(options?: AgoAutoContinueOptions): void;
|
|
1185
|
+
|
|
1056
1186
|
/**
|
|
1057
1187
|
* Returns the AgoClient from the nearest AgoProvider.
|
|
1058
1188
|
* Throws if used outside of an AgoProvider.
|
|
@@ -1134,7 +1264,11 @@ export declare interface UseAgoFunctionOptions {
|
|
|
1134
1264
|
properties: Record<string, {
|
|
1135
1265
|
type: string;
|
|
1136
1266
|
description?: string;
|
|
1137
|
-
enum?: string[];
|
|
1267
|
+
enum?: (string | number)[];
|
|
1268
|
+
items?: {
|
|
1269
|
+
type: string;
|
|
1270
|
+
enum?: (string | number)[];
|
|
1271
|
+
};
|
|
1138
1272
|
default?: unknown;
|
|
1139
1273
|
}>;
|
|
1140
1274
|
required?: string[];
|
|
@@ -1158,6 +1292,28 @@ export declare function useAgoNavigation(navigate: (path: string) => void, route
|
|
|
1158
1292
|
|
|
1159
1293
|
export declare type UseAgoOptions = AgoConfig;
|
|
1160
1294
|
|
|
1295
|
+
/**
|
|
1296
|
+
* Declaratively register editable page-state controls with the AGO agent.
|
|
1297
|
+
* The state-mutation mirror of `useAgoNavigation`: it wraps
|
|
1298
|
+
* `registerPageStateFunction` with React lifecycle management, so the agent can
|
|
1299
|
+
* change the current page's state (filters, sort, view mode…) and read the
|
|
1300
|
+
* current state back.
|
|
1301
|
+
*
|
|
1302
|
+
* ```tsx
|
|
1303
|
+
* const [status, setStatus] = useState("all");
|
|
1304
|
+
* useAgoPageState([
|
|
1305
|
+
* {
|
|
1306
|
+
* name: "statusFilter",
|
|
1307
|
+
* description: "Filter the list by review status",
|
|
1308
|
+
* schema: { type: "string", enum: ["all", "pending", "approved"] },
|
|
1309
|
+
* get: () => status,
|
|
1310
|
+
* set: setStatus,
|
|
1311
|
+
* },
|
|
1312
|
+
* ]);
|
|
1313
|
+
* ```
|
|
1314
|
+
*/
|
|
1315
|
+
export declare function useAgoPageState(controls: AgoStateControl[], opts?: AgoPageStateOptions): void;
|
|
1316
|
+
|
|
1161
1317
|
export declare interface UseAgoResult {
|
|
1162
1318
|
/** The AGO client instance */
|
|
1163
1319
|
client: AgoClient;
|
package/dist/react.d.ts
CHANGED
|
@@ -30,6 +30,23 @@ declare interface AgoAttachment {
|
|
|
30
30
|
isSafeImage: boolean;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
export declare interface AgoAutoContinueOptions {
|
|
34
|
+
/** Function names whose invocation counts as "navigated". Default `["navigateToPage"]`. */
|
|
35
|
+
navigationFunctions?: string[];
|
|
36
|
+
/** Registered function that signals the destination has editable state. Default `"setPageState"`. */
|
|
37
|
+
pageStateFunctionName?: string;
|
|
38
|
+
/** The hidden continuation prompt. Override for i18n / tone. */
|
|
39
|
+
continuationPrompt?: string;
|
|
40
|
+
/** Max continuations per user gesture (guards navigate→continue→navigate loops). Default `1`. */
|
|
41
|
+
maxDepth?: number;
|
|
42
|
+
/** How long to wait for the destination page to register page-state before giving up. Default `4000`ms. */
|
|
43
|
+
readinessTimeoutMs?: number;
|
|
44
|
+
/** Extra settle delay after page-state appears, to let sibling state mount. Default `150`ms. */
|
|
45
|
+
settleMs?: number;
|
|
46
|
+
/** Opt-out escape hatch. Default `true`. */
|
|
47
|
+
enabled?: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
33
50
|
/**
|
|
34
51
|
* Main SDK client for AGO Chat integration
|
|
35
52
|
*/
|
|
@@ -148,6 +165,12 @@ declare class AgoClient {
|
|
|
148
165
|
getRegisteredFunctions(): ClientFunctionSchema[];
|
|
149
166
|
/**
|
|
150
167
|
* Register a navigation function that lets AGO navigate users to different pages.
|
|
168
|
+
*
|
|
169
|
+
* Also registers a dynamic context entry (`current-page`) that reports the page
|
|
170
|
+
* the user is currently on, by route name, on every message. This is what lets
|
|
171
|
+
* the agent know *where* it is after it navigates (e.g. so auto-continuation
|
|
172
|
+
* can apply page state on the destination), not just how to navigate away.
|
|
173
|
+
*
|
|
151
174
|
* @param navigate - A callback that performs the navigation (e.g. react-router's navigate)
|
|
152
175
|
* @param routes - Map of route names to paths, with descriptions for the LLM
|
|
153
176
|
*/
|
|
@@ -156,6 +179,41 @@ declare class AgoClient {
|
|
|
156
179
|
path: string;
|
|
157
180
|
description: string;
|
|
158
181
|
}>): void;
|
|
182
|
+
/**
|
|
183
|
+
* Unregister the navigation function and its `current-page` context provider.
|
|
184
|
+
*/
|
|
185
|
+
unregisterNavigationFunction(): void;
|
|
186
|
+
/**
|
|
187
|
+
* Register a "page state" function that lets AGO change the current page's
|
|
188
|
+
* state (filters, sort, view mode, selection…) and reads the current state
|
|
189
|
+
* back as dynamic context. This is the state-mutation mirror of
|
|
190
|
+
* {@link registerNavigationFunction}.
|
|
191
|
+
*
|
|
192
|
+
* It does two things:
|
|
193
|
+
* - Synthesizes ONE client function (default name `setPageState`) whose
|
|
194
|
+
* properties are the controls — all optional, so the agent sets only the
|
|
195
|
+
* ones the user asked for.
|
|
196
|
+
* - Registers a dynamic context provider (keyed `page-state:<fnName>`) that
|
|
197
|
+
* reports each control's current `get()` value on every message.
|
|
198
|
+
*
|
|
199
|
+
* ```ts
|
|
200
|
+
* client.registerPageStateFunction([
|
|
201
|
+
* {
|
|
202
|
+
* name: "statusFilter",
|
|
203
|
+
* description: "Filter the list by review status",
|
|
204
|
+
* schema: { type: "string", enum: ["all", "pending", "approved"] },
|
|
205
|
+
* get: () => filters.status,
|
|
206
|
+
* set: (v) => setFilters({ ...filters, status: v }),
|
|
207
|
+
* },
|
|
208
|
+
* ]);
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
registerPageStateFunction(controls: AgoStateControl[], opts?: AgoPageStateOptions): void;
|
|
212
|
+
/**
|
|
213
|
+
* Unregister a page state function and its dynamic context provider.
|
|
214
|
+
* Mirror of unregistering `navigateToPage`.
|
|
215
|
+
*/
|
|
216
|
+
unregisterPageStateFunction(functionName?: string): void;
|
|
159
217
|
/**
|
|
160
218
|
* Register or update a piece of client-side context.
|
|
161
219
|
* This context is sent with every message so the AI understands the user's situation.
|
|
@@ -401,9 +459,23 @@ export declare interface AgoMessage {
|
|
|
401
459
|
followUpReplies?: string[];
|
|
402
460
|
/** Uploaded files on this message (usually the user's). */
|
|
403
461
|
attachments?: AgoAttachment[];
|
|
462
|
+
/**
|
|
463
|
+
* True when the backend flagged this message as hidden (e.g. an
|
|
464
|
+
* auto-continuation nudge). Kept in the model's context but not displayed;
|
|
465
|
+
* UI helpers like `useMessages`/`ChatWidget` filter these out.
|
|
466
|
+
*/
|
|
467
|
+
hidden?: boolean;
|
|
404
468
|
createdAt: Date;
|
|
405
469
|
}
|
|
406
470
|
|
|
471
|
+
/**
|
|
472
|
+
* Options for {@link AgoClient.registerPageStateFunction}.
|
|
473
|
+
*/
|
|
474
|
+
export declare interface AgoPageStateOptions {
|
|
475
|
+
/** Name of the synthesized client function. Defaults to "setPageState". */
|
|
476
|
+
functionName?: string;
|
|
477
|
+
}
|
|
478
|
+
|
|
407
479
|
/**
|
|
408
480
|
* Provides an AgoClient to all descendant components via React context.
|
|
409
481
|
*
|
|
@@ -457,6 +529,32 @@ export declare interface AgoSource {
|
|
|
457
529
|
url?: string;
|
|
458
530
|
}
|
|
459
531
|
|
|
532
|
+
/**
|
|
533
|
+
* A single editable control on the current page (a filter, a sort, a view mode,
|
|
534
|
+
* a selection…). It becomes one optional property of the synthesized
|
|
535
|
+
* `setPageState` function, and its current value is surfaced back to the agent
|
|
536
|
+
* as dynamic context. This is the state-mutation mirror of a navigation route.
|
|
537
|
+
*/
|
|
538
|
+
export declare interface AgoStateControl<T = unknown> {
|
|
539
|
+
/** Machine name of the control, e.g. "statusFilter". Becomes a property of the tool. */
|
|
540
|
+
name: string;
|
|
541
|
+
/** Description for the LLM, e.g. "Filter the list by review status". */
|
|
542
|
+
description: string;
|
|
543
|
+
/** JSON schema for a SINGLE field (like one property of navigateToPage). */
|
|
544
|
+
schema: {
|
|
545
|
+
type: "string" | "number" | "boolean" | "array";
|
|
546
|
+
enum?: (string | number)[];
|
|
547
|
+
items?: {
|
|
548
|
+
type: string;
|
|
549
|
+
enum?: (string | number)[];
|
|
550
|
+
};
|
|
551
|
+
};
|
|
552
|
+
/** Current value → pushed as dynamic context so the agent knows what to change. */
|
|
553
|
+
get?: () => T;
|
|
554
|
+
/** Apply the state change on the page. May be async. */
|
|
555
|
+
set: (value: T) => void | Promise<void>;
|
|
556
|
+
}
|
|
557
|
+
|
|
460
558
|
/**
|
|
461
559
|
* Chat input component with send button
|
|
462
560
|
*/
|
|
@@ -566,7 +664,11 @@ declare interface ClientFunctionSchema {
|
|
|
566
664
|
properties: Record<string, {
|
|
567
665
|
type: string;
|
|
568
666
|
description?: string;
|
|
569
|
-
enum?: string[];
|
|
667
|
+
enum?: (string | number)[];
|
|
668
|
+
items?: {
|
|
669
|
+
type: string;
|
|
670
|
+
enum?: (string | number)[];
|
|
671
|
+
};
|
|
570
672
|
default?: unknown;
|
|
571
673
|
}>;
|
|
572
674
|
required?: string[];
|
|
@@ -935,6 +1037,13 @@ declare interface SendMessageOptions {
|
|
|
935
1037
|
agentId?: string;
|
|
936
1038
|
/** File attachments */
|
|
937
1039
|
files?: File[];
|
|
1040
|
+
/**
|
|
1041
|
+
* Mark this message as hidden. The backend keeps it in the model's context but
|
|
1042
|
+
* flags it so the UI never displays it. Used by auto-continuation to nudge the
|
|
1043
|
+
* agent after a navigation without polluting the visible transcript.
|
|
1044
|
+
* Requires backend support for the `hidden` flag; older backends ignore it.
|
|
1045
|
+
*/
|
|
1046
|
+
hidden?: boolean;
|
|
938
1047
|
}
|
|
939
1048
|
|
|
940
1049
|
/**
|
|
@@ -1053,6 +1162,27 @@ export declare function useAgo(config: UseAgoOptions | null): {
|
|
|
1053
1162
|
isReady: boolean;
|
|
1054
1163
|
};
|
|
1055
1164
|
|
|
1165
|
+
/**
|
|
1166
|
+
* Auto-continue the agent after it navigates, so a "go to page B and change X"
|
|
1167
|
+
* request completes in one user gesture. Mount this once inside `AgoProvider`.
|
|
1168
|
+
*
|
|
1169
|
+
* How it works: when the agent calls the navigation function and that turn ends,
|
|
1170
|
+
* this waits for the destination page's `useAgoPageState` to register (so the
|
|
1171
|
+
* SDK will ship its `setPageState` + current state on the next send), then sends
|
|
1172
|
+
* a hidden continuation message. The agent then applies the state in a second
|
|
1173
|
+
* turn. The continuation is `hidden`, so it never shows in the transcript
|
|
1174
|
+
* (requires backend support for the `hidden` flag).
|
|
1175
|
+
*
|
|
1176
|
+
* ```tsx
|
|
1177
|
+
* function AppShell() {
|
|
1178
|
+
* useAgoNavigation(navigate, routes);
|
|
1179
|
+
* useAgoAutoContinueAfterNavigation();
|
|
1180
|
+
* return <Outlet />;
|
|
1181
|
+
* }
|
|
1182
|
+
* ```
|
|
1183
|
+
*/
|
|
1184
|
+
export declare function useAgoAutoContinueAfterNavigation(options?: AgoAutoContinueOptions): void;
|
|
1185
|
+
|
|
1056
1186
|
/**
|
|
1057
1187
|
* Returns the AgoClient from the nearest AgoProvider.
|
|
1058
1188
|
* Throws if used outside of an AgoProvider.
|
|
@@ -1134,7 +1264,11 @@ export declare interface UseAgoFunctionOptions {
|
|
|
1134
1264
|
properties: Record<string, {
|
|
1135
1265
|
type: string;
|
|
1136
1266
|
description?: string;
|
|
1137
|
-
enum?: string[];
|
|
1267
|
+
enum?: (string | number)[];
|
|
1268
|
+
items?: {
|
|
1269
|
+
type: string;
|
|
1270
|
+
enum?: (string | number)[];
|
|
1271
|
+
};
|
|
1138
1272
|
default?: unknown;
|
|
1139
1273
|
}>;
|
|
1140
1274
|
required?: string[];
|
|
@@ -1158,6 +1292,28 @@ export declare function useAgoNavigation(navigate: (path: string) => void, route
|
|
|
1158
1292
|
|
|
1159
1293
|
export declare type UseAgoOptions = AgoConfig;
|
|
1160
1294
|
|
|
1295
|
+
/**
|
|
1296
|
+
* Declaratively register editable page-state controls with the AGO agent.
|
|
1297
|
+
* The state-mutation mirror of `useAgoNavigation`: it wraps
|
|
1298
|
+
* `registerPageStateFunction` with React lifecycle management, so the agent can
|
|
1299
|
+
* change the current page's state (filters, sort, view mode…) and read the
|
|
1300
|
+
* current state back.
|
|
1301
|
+
*
|
|
1302
|
+
* ```tsx
|
|
1303
|
+
* const [status, setStatus] = useState("all");
|
|
1304
|
+
* useAgoPageState([
|
|
1305
|
+
* {
|
|
1306
|
+
* name: "statusFilter",
|
|
1307
|
+
* description: "Filter the list by review status",
|
|
1308
|
+
* schema: { type: "string", enum: ["all", "pending", "approved"] },
|
|
1309
|
+
* get: () => status,
|
|
1310
|
+
* set: setStatus,
|
|
1311
|
+
* },
|
|
1312
|
+
* ]);
|
|
1313
|
+
* ```
|
|
1314
|
+
*/
|
|
1315
|
+
export declare function useAgoPageState(controls: AgoStateControl[], opts?: AgoPageStateOptions): void;
|
|
1316
|
+
|
|
1161
1317
|
export declare interface UseAgoResult {
|
|
1162
1318
|
/** The AGO client instance */
|
|
1163
1319
|
client: AgoClient;
|