@useago/sdk 1.3.1 → 1.4.0
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-B2BU8tfB.cjs +8 -0
- package/dist/{AgoClient-Cwx_eYSu.js → AgoClient-BrhKkDWt.js} +129 -88
- package/dist/angular.cjs +1 -1
- package/dist/angular.d.cts +87 -1
- package/dist/angular.d.ts +87 -1
- package/dist/angular.js +13 -7
- package/dist/{createConversationSession-B3h567tt.js → createConversationSession-ByePKfus.js} +1 -1
- package/dist/{createConversationSession-DV0Xp_3O.cjs → createConversationSession-Cin8dVNq.cjs} +1 -1
- package/dist/{createFormCollector-CyWisAkI.js → createFormCollector-BYKe5Uxm.js} +1 -1
- package/dist/{createFormCollector-BB3Uscuo.cjs → createFormCollector-CpYX_5PT.cjs} +1 -1
- package/dist/devtools.d.cts +83 -1
- package/dist/devtools.d.ts +83 -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 +83 -1
- package/dist/index.d.ts +83 -1
- package/dist/index.js +3 -3
- package/dist/react.cjs +3 -3
- package/dist/react.d.cts +148 -2
- package/dist/react.d.ts +148 -2
- package/dist/react.js +468 -390
- package/dist/testing.d.cts +83 -1
- package/dist/testing.d.ts +83 -1
- package/dist/vue.cjs +1 -1
- package/dist/vue.d.cts +115 -1
- package/dist/vue.d.ts +115 -1
- package/dist/vue.js +66 -57
- package/dist/widget.cjs +4 -4
- package/dist/widget.d.cts +89 -5
- package/dist/widget.d.ts +89 -5
- package/dist/widget.js +117 -112
- package/package.json +1 -1
- package/dist/AgoClient-CzSmJQxl.cjs +0 -6
package/dist/widget.d.cts
CHANGED
|
@@ -154,6 +154,37 @@ declare class AgoClient {
|
|
|
154
154
|
path: string;
|
|
155
155
|
description: string;
|
|
156
156
|
}>): void;
|
|
157
|
+
/**
|
|
158
|
+
* Register a "page state" function that lets AGO change the current page's
|
|
159
|
+
* state (filters, sort, view mode, selection…) and reads the current state
|
|
160
|
+
* back as dynamic context. This is the state-mutation mirror of
|
|
161
|
+
* {@link registerNavigationFunction}.
|
|
162
|
+
*
|
|
163
|
+
* It does two things:
|
|
164
|
+
* - Synthesizes ONE client function (default name `setPageState`) whose
|
|
165
|
+
* properties are the controls — all optional, so the agent sets only the
|
|
166
|
+
* ones the user asked for.
|
|
167
|
+
* - Registers a dynamic context provider (keyed `page-state:<fnName>`) that
|
|
168
|
+
* reports each control's current `get()` value on every message.
|
|
169
|
+
*
|
|
170
|
+
* ```ts
|
|
171
|
+
* client.registerPageStateFunction([
|
|
172
|
+
* {
|
|
173
|
+
* name: "statusFilter",
|
|
174
|
+
* description: "Filter the list by review status",
|
|
175
|
+
* schema: { type: "string", enum: ["all", "pending", "approved"] },
|
|
176
|
+
* get: () => filters.status,
|
|
177
|
+
* set: (v) => setFilters({ ...filters, status: v }),
|
|
178
|
+
* },
|
|
179
|
+
* ]);
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
registerPageStateFunction(controls: AgoStateControl[], opts?: AgoPageStateOptions): void;
|
|
183
|
+
/**
|
|
184
|
+
* Unregister a page state function and its dynamic context provider.
|
|
185
|
+
* Mirror of unregistering `navigateToPage`.
|
|
186
|
+
*/
|
|
187
|
+
unregisterPageStateFunction(functionName?: string): void;
|
|
157
188
|
/**
|
|
158
189
|
* Register or update a piece of client-side context.
|
|
159
190
|
* This context is sent with every message so the AI understands the user's situation.
|
|
@@ -386,9 +417,23 @@ declare interface AgoMessage {
|
|
|
386
417
|
followUpReplies?: string[];
|
|
387
418
|
/** Uploaded files on this message (usually the user's). */
|
|
388
419
|
attachments?: AgoAttachment[];
|
|
420
|
+
/**
|
|
421
|
+
* True when the backend flagged this message as hidden (e.g. an
|
|
422
|
+
* auto-continuation nudge). Kept in the model's context but not displayed;
|
|
423
|
+
* UI helpers like `useMessages`/`ChatWidget` filter these out.
|
|
424
|
+
*/
|
|
425
|
+
hidden?: boolean;
|
|
389
426
|
createdAt: Date;
|
|
390
427
|
}
|
|
391
428
|
|
|
429
|
+
/**
|
|
430
|
+
* Options for {@link AgoClient.registerPageStateFunction}.
|
|
431
|
+
*/
|
|
432
|
+
declare interface AgoPageStateOptions {
|
|
433
|
+
/** Name of the synthesized client function. Defaults to "setPageState". */
|
|
434
|
+
functionName?: string;
|
|
435
|
+
}
|
|
436
|
+
|
|
392
437
|
/**
|
|
393
438
|
* Knowledge source citation
|
|
394
439
|
*/
|
|
@@ -398,6 +443,32 @@ declare interface AgoSource {
|
|
|
398
443
|
url?: string;
|
|
399
444
|
}
|
|
400
445
|
|
|
446
|
+
/**
|
|
447
|
+
* A single editable control on the current page (a filter, a sort, a view mode,
|
|
448
|
+
* a selection…). It becomes one optional property of the synthesized
|
|
449
|
+
* `setPageState` function, and its current value is surfaced back to the agent
|
|
450
|
+
* as dynamic context. This is the state-mutation mirror of a navigation route.
|
|
451
|
+
*/
|
|
452
|
+
declare interface AgoStateControl<T = unknown> {
|
|
453
|
+
/** Machine name of the control, e.g. "statusFilter". Becomes a property of the tool. */
|
|
454
|
+
name: string;
|
|
455
|
+
/** Description for the LLM, e.g. "Filter the list by review status". */
|
|
456
|
+
description: string;
|
|
457
|
+
/** JSON schema for a SINGLE field (like one property of navigateToPage). */
|
|
458
|
+
schema: {
|
|
459
|
+
type: "string" | "number" | "boolean" | "array";
|
|
460
|
+
enum?: (string | number)[];
|
|
461
|
+
items?: {
|
|
462
|
+
type: string;
|
|
463
|
+
enum?: (string | number)[];
|
|
464
|
+
};
|
|
465
|
+
};
|
|
466
|
+
/** Current value → pushed as dynamic context so the agent knows what to change. */
|
|
467
|
+
get?: () => T;
|
|
468
|
+
/** Apply the state change on the page. May be async. */
|
|
469
|
+
set: (value: T) => void | Promise<void>;
|
|
470
|
+
}
|
|
471
|
+
|
|
401
472
|
export declare interface AgoWidgetColors {
|
|
402
473
|
button?: string;
|
|
403
474
|
header?: string;
|
|
@@ -507,7 +578,11 @@ declare interface ClientFunctionSchema {
|
|
|
507
578
|
properties: Record<string, {
|
|
508
579
|
type: string;
|
|
509
580
|
description?: string;
|
|
510
|
-
enum?: string[];
|
|
581
|
+
enum?: (string | number)[];
|
|
582
|
+
items?: {
|
|
583
|
+
type: string;
|
|
584
|
+
enum?: (string | number)[];
|
|
585
|
+
};
|
|
511
586
|
default?: unknown;
|
|
512
587
|
}>;
|
|
513
588
|
required?: string[];
|
|
@@ -876,11 +951,13 @@ export declare interface MountChatWidgetOptions {
|
|
|
876
951
|
/** Max viewport width (px) treated as "mobile". Defaults to `768`. */
|
|
877
952
|
breakpoint?: number;
|
|
878
953
|
/**
|
|
879
|
-
* Inline placement only: how the card enters full screen.
|
|
880
|
-
* expands when the
|
|
881
|
-
* `
|
|
954
|
+
* Inline placement only: how the card enters full screen.
|
|
955
|
+
* - `"tap"` (default): expands when anywhere on the compact card is tapped
|
|
956
|
+
* - `"focus"`: expands only when the input is tapped/focused.
|
|
957
|
+
* - `"manual"`: expands only via `widget.open()`.
|
|
958
|
+
* Ignored for side placements (driven by the launcher).
|
|
882
959
|
*/
|
|
883
|
-
trigger?: "focus" | "manual";
|
|
960
|
+
trigger?: "tap" | "focus" | "manual";
|
|
884
961
|
};
|
|
885
962
|
/**
|
|
886
963
|
* Load the visitor's conversation list into `widget.threads` on mount and refresh
|
|
@@ -990,6 +1067,13 @@ declare interface SendMessageOptions {
|
|
|
990
1067
|
agentId?: string;
|
|
991
1068
|
/** File attachments */
|
|
992
1069
|
files?: File[];
|
|
1070
|
+
/**
|
|
1071
|
+
* Mark this message as hidden. The backend keeps it in the model's context but
|
|
1072
|
+
* flags it so the UI never displays it. Used by auto-continuation to nudge the
|
|
1073
|
+
* agent after a navigation without polluting the visible transcript.
|
|
1074
|
+
* Requires backend support for the `hidden` flag; older backends ignore it.
|
|
1075
|
+
*/
|
|
1076
|
+
hidden?: boolean;
|
|
993
1077
|
}
|
|
994
1078
|
|
|
995
1079
|
/**
|
package/dist/widget.d.ts
CHANGED
|
@@ -154,6 +154,37 @@ declare class AgoClient {
|
|
|
154
154
|
path: string;
|
|
155
155
|
description: string;
|
|
156
156
|
}>): void;
|
|
157
|
+
/**
|
|
158
|
+
* Register a "page state" function that lets AGO change the current page's
|
|
159
|
+
* state (filters, sort, view mode, selection…) and reads the current state
|
|
160
|
+
* back as dynamic context. This is the state-mutation mirror of
|
|
161
|
+
* {@link registerNavigationFunction}.
|
|
162
|
+
*
|
|
163
|
+
* It does two things:
|
|
164
|
+
* - Synthesizes ONE client function (default name `setPageState`) whose
|
|
165
|
+
* properties are the controls — all optional, so the agent sets only the
|
|
166
|
+
* ones the user asked for.
|
|
167
|
+
* - Registers a dynamic context provider (keyed `page-state:<fnName>`) that
|
|
168
|
+
* reports each control's current `get()` value on every message.
|
|
169
|
+
*
|
|
170
|
+
* ```ts
|
|
171
|
+
* client.registerPageStateFunction([
|
|
172
|
+
* {
|
|
173
|
+
* name: "statusFilter",
|
|
174
|
+
* description: "Filter the list by review status",
|
|
175
|
+
* schema: { type: "string", enum: ["all", "pending", "approved"] },
|
|
176
|
+
* get: () => filters.status,
|
|
177
|
+
* set: (v) => setFilters({ ...filters, status: v }),
|
|
178
|
+
* },
|
|
179
|
+
* ]);
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
registerPageStateFunction(controls: AgoStateControl[], opts?: AgoPageStateOptions): void;
|
|
183
|
+
/**
|
|
184
|
+
* Unregister a page state function and its dynamic context provider.
|
|
185
|
+
* Mirror of unregistering `navigateToPage`.
|
|
186
|
+
*/
|
|
187
|
+
unregisterPageStateFunction(functionName?: string): void;
|
|
157
188
|
/**
|
|
158
189
|
* Register or update a piece of client-side context.
|
|
159
190
|
* This context is sent with every message so the AI understands the user's situation.
|
|
@@ -386,9 +417,23 @@ declare interface AgoMessage {
|
|
|
386
417
|
followUpReplies?: string[];
|
|
387
418
|
/** Uploaded files on this message (usually the user's). */
|
|
388
419
|
attachments?: AgoAttachment[];
|
|
420
|
+
/**
|
|
421
|
+
* True when the backend flagged this message as hidden (e.g. an
|
|
422
|
+
* auto-continuation nudge). Kept in the model's context but not displayed;
|
|
423
|
+
* UI helpers like `useMessages`/`ChatWidget` filter these out.
|
|
424
|
+
*/
|
|
425
|
+
hidden?: boolean;
|
|
389
426
|
createdAt: Date;
|
|
390
427
|
}
|
|
391
428
|
|
|
429
|
+
/**
|
|
430
|
+
* Options for {@link AgoClient.registerPageStateFunction}.
|
|
431
|
+
*/
|
|
432
|
+
declare interface AgoPageStateOptions {
|
|
433
|
+
/** Name of the synthesized client function. Defaults to "setPageState". */
|
|
434
|
+
functionName?: string;
|
|
435
|
+
}
|
|
436
|
+
|
|
392
437
|
/**
|
|
393
438
|
* Knowledge source citation
|
|
394
439
|
*/
|
|
@@ -398,6 +443,32 @@ declare interface AgoSource {
|
|
|
398
443
|
url?: string;
|
|
399
444
|
}
|
|
400
445
|
|
|
446
|
+
/**
|
|
447
|
+
* A single editable control on the current page (a filter, a sort, a view mode,
|
|
448
|
+
* a selection…). It becomes one optional property of the synthesized
|
|
449
|
+
* `setPageState` function, and its current value is surfaced back to the agent
|
|
450
|
+
* as dynamic context. This is the state-mutation mirror of a navigation route.
|
|
451
|
+
*/
|
|
452
|
+
declare interface AgoStateControl<T = unknown> {
|
|
453
|
+
/** Machine name of the control, e.g. "statusFilter". Becomes a property of the tool. */
|
|
454
|
+
name: string;
|
|
455
|
+
/** Description for the LLM, e.g. "Filter the list by review status". */
|
|
456
|
+
description: string;
|
|
457
|
+
/** JSON schema for a SINGLE field (like one property of navigateToPage). */
|
|
458
|
+
schema: {
|
|
459
|
+
type: "string" | "number" | "boolean" | "array";
|
|
460
|
+
enum?: (string | number)[];
|
|
461
|
+
items?: {
|
|
462
|
+
type: string;
|
|
463
|
+
enum?: (string | number)[];
|
|
464
|
+
};
|
|
465
|
+
};
|
|
466
|
+
/** Current value → pushed as dynamic context so the agent knows what to change. */
|
|
467
|
+
get?: () => T;
|
|
468
|
+
/** Apply the state change on the page. May be async. */
|
|
469
|
+
set: (value: T) => void | Promise<void>;
|
|
470
|
+
}
|
|
471
|
+
|
|
401
472
|
export declare interface AgoWidgetColors {
|
|
402
473
|
button?: string;
|
|
403
474
|
header?: string;
|
|
@@ -507,7 +578,11 @@ declare interface ClientFunctionSchema {
|
|
|
507
578
|
properties: Record<string, {
|
|
508
579
|
type: string;
|
|
509
580
|
description?: string;
|
|
510
|
-
enum?: string[];
|
|
581
|
+
enum?: (string | number)[];
|
|
582
|
+
items?: {
|
|
583
|
+
type: string;
|
|
584
|
+
enum?: (string | number)[];
|
|
585
|
+
};
|
|
511
586
|
default?: unknown;
|
|
512
587
|
}>;
|
|
513
588
|
required?: string[];
|
|
@@ -876,11 +951,13 @@ export declare interface MountChatWidgetOptions {
|
|
|
876
951
|
/** Max viewport width (px) treated as "mobile". Defaults to `768`. */
|
|
877
952
|
breakpoint?: number;
|
|
878
953
|
/**
|
|
879
|
-
* Inline placement only: how the card enters full screen.
|
|
880
|
-
* expands when the
|
|
881
|
-
* `
|
|
954
|
+
* Inline placement only: how the card enters full screen.
|
|
955
|
+
* - `"tap"` (default): expands when anywhere on the compact card is tapped
|
|
956
|
+
* - `"focus"`: expands only when the input is tapped/focused.
|
|
957
|
+
* - `"manual"`: expands only via `widget.open()`.
|
|
958
|
+
* Ignored for side placements (driven by the launcher).
|
|
882
959
|
*/
|
|
883
|
-
trigger?: "focus" | "manual";
|
|
960
|
+
trigger?: "tap" | "focus" | "manual";
|
|
884
961
|
};
|
|
885
962
|
/**
|
|
886
963
|
* Load the visitor's conversation list into `widget.threads` on mount and refresh
|
|
@@ -990,6 +1067,13 @@ declare interface SendMessageOptions {
|
|
|
990
1067
|
agentId?: string;
|
|
991
1068
|
/** File attachments */
|
|
992
1069
|
files?: File[];
|
|
1070
|
+
/**
|
|
1071
|
+
* Mark this message as hidden. The backend keeps it in the model's context but
|
|
1072
|
+
* flags it so the UI never displays it. Used by auto-continuation to nudge the
|
|
1073
|
+
* agent after a navigation without polluting the visible transcript.
|
|
1074
|
+
* Requires backend support for the `hidden` flag; older backends ignore it.
|
|
1075
|
+
*/
|
|
1076
|
+
hidden?: boolean;
|
|
993
1077
|
}
|
|
994
1078
|
|
|
995
1079
|
/**
|