@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/testing.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./createMockClient-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./createMockClient-ucPENDzz.cjs");exports.createMockClient=e.createMockClient;
|
package/dist/testing.d.cts
CHANGED
|
@@ -146,6 +146,12 @@ declare class AgoClient {
|
|
|
146
146
|
getRegisteredFunctions(): ClientFunctionSchema[];
|
|
147
147
|
/**
|
|
148
148
|
* Register a navigation function that lets AGO navigate users to different pages.
|
|
149
|
+
*
|
|
150
|
+
* Also registers a dynamic context entry (`current-page`) that reports the page
|
|
151
|
+
* the user is currently on, by route name, on every message. This is what lets
|
|
152
|
+
* the agent know *where* it is after it navigates (e.g. so auto-continuation
|
|
153
|
+
* can apply page state on the destination), not just how to navigate away.
|
|
154
|
+
*
|
|
149
155
|
* @param navigate - A callback that performs the navigation (e.g. react-router's navigate)
|
|
150
156
|
* @param routes - Map of route names to paths, with descriptions for the LLM
|
|
151
157
|
*/
|
|
@@ -154,6 +160,41 @@ declare class AgoClient {
|
|
|
154
160
|
path: string;
|
|
155
161
|
description: string;
|
|
156
162
|
}>): void;
|
|
163
|
+
/**
|
|
164
|
+
* Unregister the navigation function and its `current-page` context provider.
|
|
165
|
+
*/
|
|
166
|
+
unregisterNavigationFunction(): void;
|
|
167
|
+
/**
|
|
168
|
+
* Register a "page state" function that lets AGO change the current page's
|
|
169
|
+
* state (filters, sort, view mode, selection…) and reads the current state
|
|
170
|
+
* back as dynamic context. This is the state-mutation mirror of
|
|
171
|
+
* {@link registerNavigationFunction}.
|
|
172
|
+
*
|
|
173
|
+
* It does two things:
|
|
174
|
+
* - Synthesizes ONE client function (default name `setPageState`) whose
|
|
175
|
+
* properties are the controls — all optional, so the agent sets only the
|
|
176
|
+
* ones the user asked for.
|
|
177
|
+
* - Registers a dynamic context provider (keyed `page-state:<fnName>`) that
|
|
178
|
+
* reports each control's current `get()` value on every message.
|
|
179
|
+
*
|
|
180
|
+
* ```ts
|
|
181
|
+
* client.registerPageStateFunction([
|
|
182
|
+
* {
|
|
183
|
+
* name: "statusFilter",
|
|
184
|
+
* description: "Filter the list by review status",
|
|
185
|
+
* schema: { type: "string", enum: ["all", "pending", "approved"] },
|
|
186
|
+
* get: () => filters.status,
|
|
187
|
+
* set: (v) => setFilters({ ...filters, status: v }),
|
|
188
|
+
* },
|
|
189
|
+
* ]);
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
registerPageStateFunction(controls: AgoStateControl[], opts?: AgoPageStateOptions): void;
|
|
193
|
+
/**
|
|
194
|
+
* Unregister a page state function and its dynamic context provider.
|
|
195
|
+
* Mirror of unregistering `navigateToPage`.
|
|
196
|
+
*/
|
|
197
|
+
unregisterPageStateFunction(functionName?: string): void;
|
|
157
198
|
/**
|
|
158
199
|
* Register or update a piece of client-side context.
|
|
159
200
|
* This context is sent with every message so the AI understands the user's situation.
|
|
@@ -386,9 +427,23 @@ declare interface AgoMessage {
|
|
|
386
427
|
followUpReplies?: string[];
|
|
387
428
|
/** Uploaded files on this message (usually the user's). */
|
|
388
429
|
attachments?: AgoAttachment[];
|
|
430
|
+
/**
|
|
431
|
+
* True when the backend flagged this message as hidden (e.g. an
|
|
432
|
+
* auto-continuation nudge). Kept in the model's context but not displayed;
|
|
433
|
+
* UI helpers like `useMessages`/`ChatWidget` filter these out.
|
|
434
|
+
*/
|
|
435
|
+
hidden?: boolean;
|
|
389
436
|
createdAt: Date;
|
|
390
437
|
}
|
|
391
438
|
|
|
439
|
+
/**
|
|
440
|
+
* Options for {@link AgoClient.registerPageStateFunction}.
|
|
441
|
+
*/
|
|
442
|
+
declare interface AgoPageStateOptions {
|
|
443
|
+
/** Name of the synthesized client function. Defaults to "setPageState". */
|
|
444
|
+
functionName?: string;
|
|
445
|
+
}
|
|
446
|
+
|
|
392
447
|
/**
|
|
393
448
|
* Knowledge source citation
|
|
394
449
|
*/
|
|
@@ -398,6 +453,32 @@ declare interface AgoSource {
|
|
|
398
453
|
url?: string;
|
|
399
454
|
}
|
|
400
455
|
|
|
456
|
+
/**
|
|
457
|
+
* A single editable control on the current page (a filter, a sort, a view mode,
|
|
458
|
+
* a selection…). It becomes one optional property of the synthesized
|
|
459
|
+
* `setPageState` function, and its current value is surfaced back to the agent
|
|
460
|
+
* as dynamic context. This is the state-mutation mirror of a navigation route.
|
|
461
|
+
*/
|
|
462
|
+
declare interface AgoStateControl<T = unknown> {
|
|
463
|
+
/** Machine name of the control, e.g. "statusFilter". Becomes a property of the tool. */
|
|
464
|
+
name: string;
|
|
465
|
+
/** Description for the LLM, e.g. "Filter the list by review status". */
|
|
466
|
+
description: string;
|
|
467
|
+
/** JSON schema for a SINGLE field (like one property of navigateToPage). */
|
|
468
|
+
schema: {
|
|
469
|
+
type: "string" | "number" | "boolean" | "array";
|
|
470
|
+
enum?: (string | number)[];
|
|
471
|
+
items?: {
|
|
472
|
+
type: string;
|
|
473
|
+
enum?: (string | number)[];
|
|
474
|
+
};
|
|
475
|
+
};
|
|
476
|
+
/** Current value → pushed as dynamic context so the agent knows what to change. */
|
|
477
|
+
get?: () => T;
|
|
478
|
+
/** Apply the state change on the page. May be async. */
|
|
479
|
+
set: (value: T) => void | Promise<void>;
|
|
480
|
+
}
|
|
481
|
+
|
|
401
482
|
/**
|
|
402
483
|
* Single-object function definition — combines name, schema, and handler.
|
|
403
484
|
*
|
|
@@ -444,7 +525,11 @@ declare interface ClientFunctionSchema {
|
|
|
444
525
|
properties: Record<string, {
|
|
445
526
|
type: string;
|
|
446
527
|
description?: string;
|
|
447
|
-
enum?: string[];
|
|
528
|
+
enum?: (string | number)[];
|
|
529
|
+
items?: {
|
|
530
|
+
type: string;
|
|
531
|
+
enum?: (string | number)[];
|
|
532
|
+
};
|
|
448
533
|
default?: unknown;
|
|
449
534
|
}>;
|
|
450
535
|
required?: string[];
|
|
@@ -639,6 +724,13 @@ declare interface SendMessageOptions {
|
|
|
639
724
|
agentId?: string;
|
|
640
725
|
/** File attachments */
|
|
641
726
|
files?: File[];
|
|
727
|
+
/**
|
|
728
|
+
* Mark this message as hidden. The backend keeps it in the model's context but
|
|
729
|
+
* flags it so the UI never displays it. Used by auto-continuation to nudge the
|
|
730
|
+
* agent after a navigation without polluting the visible transcript.
|
|
731
|
+
* Requires backend support for the `hidden` flag; older backends ignore it.
|
|
732
|
+
*/
|
|
733
|
+
hidden?: boolean;
|
|
642
734
|
}
|
|
643
735
|
|
|
644
736
|
/**
|
package/dist/testing.d.ts
CHANGED
|
@@ -146,6 +146,12 @@ declare class AgoClient {
|
|
|
146
146
|
getRegisteredFunctions(): ClientFunctionSchema[];
|
|
147
147
|
/**
|
|
148
148
|
* Register a navigation function that lets AGO navigate users to different pages.
|
|
149
|
+
*
|
|
150
|
+
* Also registers a dynamic context entry (`current-page`) that reports the page
|
|
151
|
+
* the user is currently on, by route name, on every message. This is what lets
|
|
152
|
+
* the agent know *where* it is after it navigates (e.g. so auto-continuation
|
|
153
|
+
* can apply page state on the destination), not just how to navigate away.
|
|
154
|
+
*
|
|
149
155
|
* @param navigate - A callback that performs the navigation (e.g. react-router's navigate)
|
|
150
156
|
* @param routes - Map of route names to paths, with descriptions for the LLM
|
|
151
157
|
*/
|
|
@@ -154,6 +160,41 @@ declare class AgoClient {
|
|
|
154
160
|
path: string;
|
|
155
161
|
description: string;
|
|
156
162
|
}>): void;
|
|
163
|
+
/**
|
|
164
|
+
* Unregister the navigation function and its `current-page` context provider.
|
|
165
|
+
*/
|
|
166
|
+
unregisterNavigationFunction(): void;
|
|
167
|
+
/**
|
|
168
|
+
* Register a "page state" function that lets AGO change the current page's
|
|
169
|
+
* state (filters, sort, view mode, selection…) and reads the current state
|
|
170
|
+
* back as dynamic context. This is the state-mutation mirror of
|
|
171
|
+
* {@link registerNavigationFunction}.
|
|
172
|
+
*
|
|
173
|
+
* It does two things:
|
|
174
|
+
* - Synthesizes ONE client function (default name `setPageState`) whose
|
|
175
|
+
* properties are the controls — all optional, so the agent sets only the
|
|
176
|
+
* ones the user asked for.
|
|
177
|
+
* - Registers a dynamic context provider (keyed `page-state:<fnName>`) that
|
|
178
|
+
* reports each control's current `get()` value on every message.
|
|
179
|
+
*
|
|
180
|
+
* ```ts
|
|
181
|
+
* client.registerPageStateFunction([
|
|
182
|
+
* {
|
|
183
|
+
* name: "statusFilter",
|
|
184
|
+
* description: "Filter the list by review status",
|
|
185
|
+
* schema: { type: "string", enum: ["all", "pending", "approved"] },
|
|
186
|
+
* get: () => filters.status,
|
|
187
|
+
* set: (v) => setFilters({ ...filters, status: v }),
|
|
188
|
+
* },
|
|
189
|
+
* ]);
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
registerPageStateFunction(controls: AgoStateControl[], opts?: AgoPageStateOptions): void;
|
|
193
|
+
/**
|
|
194
|
+
* Unregister a page state function and its dynamic context provider.
|
|
195
|
+
* Mirror of unregistering `navigateToPage`.
|
|
196
|
+
*/
|
|
197
|
+
unregisterPageStateFunction(functionName?: string): void;
|
|
157
198
|
/**
|
|
158
199
|
* Register or update a piece of client-side context.
|
|
159
200
|
* This context is sent with every message so the AI understands the user's situation.
|
|
@@ -386,9 +427,23 @@ declare interface AgoMessage {
|
|
|
386
427
|
followUpReplies?: string[];
|
|
387
428
|
/** Uploaded files on this message (usually the user's). */
|
|
388
429
|
attachments?: AgoAttachment[];
|
|
430
|
+
/**
|
|
431
|
+
* True when the backend flagged this message as hidden (e.g. an
|
|
432
|
+
* auto-continuation nudge). Kept in the model's context but not displayed;
|
|
433
|
+
* UI helpers like `useMessages`/`ChatWidget` filter these out.
|
|
434
|
+
*/
|
|
435
|
+
hidden?: boolean;
|
|
389
436
|
createdAt: Date;
|
|
390
437
|
}
|
|
391
438
|
|
|
439
|
+
/**
|
|
440
|
+
* Options for {@link AgoClient.registerPageStateFunction}.
|
|
441
|
+
*/
|
|
442
|
+
declare interface AgoPageStateOptions {
|
|
443
|
+
/** Name of the synthesized client function. Defaults to "setPageState". */
|
|
444
|
+
functionName?: string;
|
|
445
|
+
}
|
|
446
|
+
|
|
392
447
|
/**
|
|
393
448
|
* Knowledge source citation
|
|
394
449
|
*/
|
|
@@ -398,6 +453,32 @@ declare interface AgoSource {
|
|
|
398
453
|
url?: string;
|
|
399
454
|
}
|
|
400
455
|
|
|
456
|
+
/**
|
|
457
|
+
* A single editable control on the current page (a filter, a sort, a view mode,
|
|
458
|
+
* a selection…). It becomes one optional property of the synthesized
|
|
459
|
+
* `setPageState` function, and its current value is surfaced back to the agent
|
|
460
|
+
* as dynamic context. This is the state-mutation mirror of a navigation route.
|
|
461
|
+
*/
|
|
462
|
+
declare interface AgoStateControl<T = unknown> {
|
|
463
|
+
/** Machine name of the control, e.g. "statusFilter". Becomes a property of the tool. */
|
|
464
|
+
name: string;
|
|
465
|
+
/** Description for the LLM, e.g. "Filter the list by review status". */
|
|
466
|
+
description: string;
|
|
467
|
+
/** JSON schema for a SINGLE field (like one property of navigateToPage). */
|
|
468
|
+
schema: {
|
|
469
|
+
type: "string" | "number" | "boolean" | "array";
|
|
470
|
+
enum?: (string | number)[];
|
|
471
|
+
items?: {
|
|
472
|
+
type: string;
|
|
473
|
+
enum?: (string | number)[];
|
|
474
|
+
};
|
|
475
|
+
};
|
|
476
|
+
/** Current value → pushed as dynamic context so the agent knows what to change. */
|
|
477
|
+
get?: () => T;
|
|
478
|
+
/** Apply the state change on the page. May be async. */
|
|
479
|
+
set: (value: T) => void | Promise<void>;
|
|
480
|
+
}
|
|
481
|
+
|
|
401
482
|
/**
|
|
402
483
|
* Single-object function definition — combines name, schema, and handler.
|
|
403
484
|
*
|
|
@@ -444,7 +525,11 @@ declare interface ClientFunctionSchema {
|
|
|
444
525
|
properties: Record<string, {
|
|
445
526
|
type: string;
|
|
446
527
|
description?: string;
|
|
447
|
-
enum?: string[];
|
|
528
|
+
enum?: (string | number)[];
|
|
529
|
+
items?: {
|
|
530
|
+
type: string;
|
|
531
|
+
enum?: (string | number)[];
|
|
532
|
+
};
|
|
448
533
|
default?: unknown;
|
|
449
534
|
}>;
|
|
450
535
|
required?: string[];
|
|
@@ -639,6 +724,13 @@ declare interface SendMessageOptions {
|
|
|
639
724
|
agentId?: string;
|
|
640
725
|
/** File attachments */
|
|
641
726
|
files?: File[];
|
|
727
|
+
/**
|
|
728
|
+
* Mark this message as hidden. The backend keeps it in the model's context but
|
|
729
|
+
* flags it so the UI never displays it. Used by auto-continuation to nudge the
|
|
730
|
+
* agent after a navigation without polluting the visible transcript.
|
|
731
|
+
* Requires backend support for the `hidden` flag; older backends ignore it.
|
|
732
|
+
*/
|
|
733
|
+
hidden?: boolean;
|
|
642
734
|
}
|
|
643
735
|
|
|
644
736
|
/**
|
package/dist/testing.js
CHANGED
package/dist/vue.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const U=require("./rolldown-runtime-16Nf8qvH.cjs"),p=require("./AgoClient-CRAnT4qE.cjs");let o=require("vue");var I=Symbol("ago-client"),S={install(t,n){const e=new p.AgoClient(n);t.provide(I,e)}};function d(t){if(t)return new p.AgoClient(t);const n=(0,o.inject)(I);if(!n)throw new Error("useAgo(): no AgoClient found. Either pass config or install AgoPlugin.");return n}function E(t={}){const n=t.client??d(),e=(0,o.ref)([]),s=(0,o.ref)(t.conversationId),i=(0,o.ref)(!1),r=(0,o.ref)(null),c=a=>{s.value||(s.value=a.conversationId)},f=a=>{const u=e.value.findIndex(v=>v.id===a.messageId);u>=0&&(e.value[u]={...e.value[u],content:e.value[u].content+a.content})},m=a=>{const u=e.value.findIndex(v=>v.id===a.id);u>=0?e.value[u]=a:e.value.push(a),i.value=!1},C=a=>{r.value=new Error(a.error),i.value=!1};(0,o.onMounted)(()=>{n.on("message:start",c),n.on("message:chunk",f),n.on("message:complete",m),n.on("message:error",C)}),(0,o.onUnmounted)(()=>{n.off("message:start",c),n.off("message:chunk",f),n.off("message:complete",m),n.off("message:error",C)});async function g(a,u){i.value=!0,r.value=null;const v={id:`temp-${Date.now()}`,conversationId:s.value||"",content:a,role:"user",status:"DONE",createdAt:new Date},N={id:`temp-assistant-${Date.now()}`,conversationId:s.value||"",content:"",role:"assistant",status:"IN_PROGRESS",createdAt:new Date};e.value.push(v,N);try{const l=await n.sendMessage(a,{conversationId:s.value,files:u});l.conversationId&&!s.value&&(s.value=l.conversationId),e.value=e.value.filter(w=>!w.id.startsWith("temp-"));const A={...v,id:v.id.replace("temp-","user-"),conversationId:l.conversationId};return e.value.some(w=>w.id===l.id)?e.value.push(A):e.value.push(A,l),l}catch(l){return r.value=l instanceof Error?l:new Error("Failed to send"),i.value=!1,e.value=e.value.filter(A=>!A.id.startsWith("temp-")),null}}function h(){e.value=[],s.value=void 0,r.value=null}return{messages:e,isLoading:i,error:r,conversationId:s,sendMessage:g,clearMessages:h}}function M(t={}){const n=t.client??d(),e=t.autoLoad??!0,s=(0,o.ref)([]),i=(0,o.ref)(null),r=(0,o.ref)(!1),c=(0,o.ref)(null);async function f(){r.value=!0,c.value=null;try{s.value=await n.getConversations()}catch(g){c.value=g instanceof Error?g:new Error("Failed to load conversations")}finally{r.value=!1}}async function m(g){r.value=!0,c.value=null;try{i.value=await n.getConversation(g)}catch(h){c.value=h instanceof Error?h:new Error("Failed to load conversation")}finally{r.value=!1}}function C(){i.value=null}return(0,o.onMounted)(()=>{e&&f()}),{conversations:s,currentConversation:i,isLoading:r,error:c,selectConversation:m,startNewConversation:C,refreshConversations:f}}function L(t={}){const n=E({client:t.client,conversationId:t.conversationId}),e=M({client:t.client,autoLoad:t.autoLoad}),s=(0,o.computed)(()=>n.error.value||e.error.value);return{messages:n.messages,isLoading:n.isLoading,error:s,sendMessage:n.sendMessage,clearMessages:n.clearMessages,conversationId:n.conversationId,conversations:e.conversations,currentConversation:e.currentConversation,isConversationsLoading:e.isLoading,selectConversation:e.selectConversation,startNewConversation:e.startNewConversation,refreshConversations:e.refreshConversations}}function y(t,n){const e=d();(0,o.onMounted)(()=>{e.registerFunction(t,n.handler,{description:n.description,parameters:n.parameters})}),(0,o.onUnmounted)(()=>{e.unregisterFunction(t)})}function F(t,n){const e=d();(0,o.onMounted)(()=>{e.registerNavigationFunction(t,n)}),(0,o.onUnmounted)(()=>{e.unregisterNavigationFunction()})}function P(t,n){const e=d(),s=n?.functionName??"setPageState";(0,o.onMounted)(()=>{e.registerPageStateFunction(t,{functionName:s})}),(0,o.onUnmounted)(()=>{e.unregisterPageStateFunction(s)})}function _(t,n){const e=d();(0,o.onMounted)(()=>{e.on(t,n)}),(0,o.onUnmounted)(()=>{e.off(t,n)})}function D(t){const n=(0,o.shallowRef)(t.get());return(0,o.onScopeDispose)(t.subscribe(e=>{n.value=e})),n}exports.AGO_CLIENT_KEY=I;exports.AgoPlugin=S;exports.useAgo=d;exports.useAgoEvents=_;exports.useAgoFunction=y;exports.useAgoNavigation=F;exports.useAgoPageState=P;exports.useAgoStore=D;exports.useChat=L;exports.useConversation=M;exports.useMessages=E;
|
package/dist/vue.d.cts
CHANGED
|
@@ -154,6 +154,12 @@ declare class AgoClient {
|
|
|
154
154
|
getRegisteredFunctions(): ClientFunctionSchema[];
|
|
155
155
|
/**
|
|
156
156
|
* Register a navigation function that lets AGO navigate users to different pages.
|
|
157
|
+
*
|
|
158
|
+
* Also registers a dynamic context entry (`current-page`) that reports the page
|
|
159
|
+
* the user is currently on, by route name, on every message. This is what lets
|
|
160
|
+
* the agent know *where* it is after it navigates (e.g. so auto-continuation
|
|
161
|
+
* can apply page state on the destination), not just how to navigate away.
|
|
162
|
+
*
|
|
157
163
|
* @param navigate - A callback that performs the navigation (e.g. react-router's navigate)
|
|
158
164
|
* @param routes - Map of route names to paths, with descriptions for the LLM
|
|
159
165
|
*/
|
|
@@ -162,6 +168,41 @@ declare class AgoClient {
|
|
|
162
168
|
path: string;
|
|
163
169
|
description: string;
|
|
164
170
|
}>): void;
|
|
171
|
+
/**
|
|
172
|
+
* Unregister the navigation function and its `current-page` context provider.
|
|
173
|
+
*/
|
|
174
|
+
unregisterNavigationFunction(): void;
|
|
175
|
+
/**
|
|
176
|
+
* Register a "page state" function that lets AGO change the current page's
|
|
177
|
+
* state (filters, sort, view mode, selection…) and reads the current state
|
|
178
|
+
* back as dynamic context. This is the state-mutation mirror of
|
|
179
|
+
* {@link registerNavigationFunction}.
|
|
180
|
+
*
|
|
181
|
+
* It does two things:
|
|
182
|
+
* - Synthesizes ONE client function (default name `setPageState`) whose
|
|
183
|
+
* properties are the controls — all optional, so the agent sets only the
|
|
184
|
+
* ones the user asked for.
|
|
185
|
+
* - Registers a dynamic context provider (keyed `page-state:<fnName>`) that
|
|
186
|
+
* reports each control's current `get()` value on every message.
|
|
187
|
+
*
|
|
188
|
+
* ```ts
|
|
189
|
+
* client.registerPageStateFunction([
|
|
190
|
+
* {
|
|
191
|
+
* name: "statusFilter",
|
|
192
|
+
* description: "Filter the list by review status",
|
|
193
|
+
* schema: { type: "string", enum: ["all", "pending", "approved"] },
|
|
194
|
+
* get: () => filters.status,
|
|
195
|
+
* set: (v) => setFilters({ ...filters, status: v }),
|
|
196
|
+
* },
|
|
197
|
+
* ]);
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
registerPageStateFunction(controls: AgoStateControl[], opts?: AgoPageStateOptions): void;
|
|
201
|
+
/**
|
|
202
|
+
* Unregister a page state function and its dynamic context provider.
|
|
203
|
+
* Mirror of unregistering `navigateToPage`.
|
|
204
|
+
*/
|
|
205
|
+
unregisterPageStateFunction(functionName?: string): void;
|
|
165
206
|
/**
|
|
166
207
|
* Register or update a piece of client-side context.
|
|
167
208
|
* This context is sent with every message so the AI understands the user's situation.
|
|
@@ -394,9 +435,23 @@ export declare interface AgoMessage {
|
|
|
394
435
|
followUpReplies?: string[];
|
|
395
436
|
/** Uploaded files on this message (usually the user's). */
|
|
396
437
|
attachments?: AgoAttachment[];
|
|
438
|
+
/**
|
|
439
|
+
* True when the backend flagged this message as hidden (e.g. an
|
|
440
|
+
* auto-continuation nudge). Kept in the model's context but not displayed;
|
|
441
|
+
* UI helpers like `useMessages`/`ChatWidget` filter these out.
|
|
442
|
+
*/
|
|
443
|
+
hidden?: boolean;
|
|
397
444
|
createdAt: Date;
|
|
398
445
|
}
|
|
399
446
|
|
|
447
|
+
/**
|
|
448
|
+
* Options for {@link AgoClient.registerPageStateFunction}.
|
|
449
|
+
*/
|
|
450
|
+
export declare interface AgoPageStateOptions {
|
|
451
|
+
/** Name of the synthesized client function. Defaults to "setPageState". */
|
|
452
|
+
functionName?: string;
|
|
453
|
+
}
|
|
454
|
+
|
|
400
455
|
/**
|
|
401
456
|
* Vue plugin that provides an AgoClient to the entire app via inject/provide.
|
|
402
457
|
*
|
|
@@ -427,6 +482,32 @@ export declare interface AgoSource {
|
|
|
427
482
|
url?: string;
|
|
428
483
|
}
|
|
429
484
|
|
|
485
|
+
/**
|
|
486
|
+
* A single editable control on the current page (a filter, a sort, a view mode,
|
|
487
|
+
* a selection…). It becomes one optional property of the synthesized
|
|
488
|
+
* `setPageState` function, and its current value is surfaced back to the agent
|
|
489
|
+
* as dynamic context. This is the state-mutation mirror of a navigation route.
|
|
490
|
+
*/
|
|
491
|
+
export declare interface AgoStateControl<T = unknown> {
|
|
492
|
+
/** Machine name of the control, e.g. "statusFilter". Becomes a property of the tool. */
|
|
493
|
+
name: string;
|
|
494
|
+
/** Description for the LLM, e.g. "Filter the list by review status". */
|
|
495
|
+
description: string;
|
|
496
|
+
/** JSON schema for a SINGLE field (like one property of navigateToPage). */
|
|
497
|
+
schema: {
|
|
498
|
+
type: "string" | "number" | "boolean" | "array";
|
|
499
|
+
enum?: (string | number)[];
|
|
500
|
+
items?: {
|
|
501
|
+
type: string;
|
|
502
|
+
enum?: (string | number)[];
|
|
503
|
+
};
|
|
504
|
+
};
|
|
505
|
+
/** Current value → pushed as dynamic context so the agent knows what to change. */
|
|
506
|
+
get?: () => T;
|
|
507
|
+
/** Apply the state change on the page. May be async. */
|
|
508
|
+
set: (value: T) => void | Promise<void>;
|
|
509
|
+
}
|
|
510
|
+
|
|
430
511
|
/**
|
|
431
512
|
* Single-object function definition — combines name, schema, and handler.
|
|
432
513
|
*
|
|
@@ -473,7 +554,11 @@ declare interface ClientFunctionSchema {
|
|
|
473
554
|
properties: Record<string, {
|
|
474
555
|
type: string;
|
|
475
556
|
description?: string;
|
|
476
|
-
enum?: string[];
|
|
557
|
+
enum?: (string | number)[];
|
|
558
|
+
items?: {
|
|
559
|
+
type: string;
|
|
560
|
+
enum?: (string | number)[];
|
|
561
|
+
};
|
|
477
562
|
default?: unknown;
|
|
478
563
|
}>;
|
|
479
564
|
required?: string[];
|
|
@@ -635,6 +720,13 @@ declare interface SendMessageOptions {
|
|
|
635
720
|
agentId?: string;
|
|
636
721
|
/** File attachments */
|
|
637
722
|
files?: File[];
|
|
723
|
+
/**
|
|
724
|
+
* Mark this message as hidden. The backend keeps it in the model's context but
|
|
725
|
+
* flags it so the UI never displays it. Used by auto-continuation to nudge the
|
|
726
|
+
* agent after a navigation without polluting the visible transcript.
|
|
727
|
+
* Requires backend support for the `hidden` flag; older backends ignore it.
|
|
728
|
+
*/
|
|
729
|
+
hidden?: boolean;
|
|
638
730
|
}
|
|
639
731
|
|
|
640
732
|
/**
|
|
@@ -798,6 +890,26 @@ export declare function useAgoFunction(name: string, options: {
|
|
|
798
890
|
*/
|
|
799
891
|
export declare function useAgoNavigation(navigate: (path: string) => void, routes: AgoRoute[]): void;
|
|
800
892
|
|
|
893
|
+
/**
|
|
894
|
+
* Register editable page-state controls with auto-cleanup on unmount.
|
|
895
|
+
* The state-mutation mirror of `useAgoNavigation`: the agent can change the
|
|
896
|
+
* current page's state (filters, sort, view mode…) and read it back.
|
|
897
|
+
*
|
|
898
|
+
* ```ts
|
|
899
|
+
* const status = ref("all");
|
|
900
|
+
* useAgoPageState([
|
|
901
|
+
* {
|
|
902
|
+
* name: "statusFilter",
|
|
903
|
+
* description: "Filter the list by review status",
|
|
904
|
+
* schema: { type: "string", enum: ["all", "pending", "approved"] },
|
|
905
|
+
* get: () => status.value,
|
|
906
|
+
* set: (v) => { status.value = v as string; },
|
|
907
|
+
* },
|
|
908
|
+
* ]);
|
|
909
|
+
* ```
|
|
910
|
+
*/
|
|
911
|
+
export declare function useAgoPageState(controls: AgoStateControl[], opts?: AgoPageStateOptions): void;
|
|
912
|
+
|
|
801
913
|
/**
|
|
802
914
|
* Read a framework-agnostic AGO store (`createStore`) as a reactive Vue ref.
|
|
803
915
|
*
|
|
@@ -864,6 +976,7 @@ export declare function useChat(options?: UseChatOptions): {
|
|
|
864
976
|
url?: string | undefined;
|
|
865
977
|
isSafeImage: boolean;
|
|
866
978
|
}[] | undefined;
|
|
979
|
+
hidden?: boolean | undefined;
|
|
867
980
|
createdAt: Date;
|
|
868
981
|
}[], AgoMessage[] | {
|
|
869
982
|
id: string;
|
|
@@ -906,6 +1019,7 @@ export declare function useChat(options?: UseChatOptions): {
|
|
|
906
1019
|
url?: string | undefined;
|
|
907
1020
|
isSafeImage: boolean;
|
|
908
1021
|
}[] | undefined;
|
|
1022
|
+
hidden?: boolean | undefined;
|
|
909
1023
|
createdAt: Date;
|
|
910
1024
|
}[]>;
|
|
911
1025
|
isLoading: Ref<boolean, boolean>;
|
|
@@ -958,6 +1072,7 @@ export declare function useChat(options?: UseChatOptions): {
|
|
|
958
1072
|
url?: string | undefined;
|
|
959
1073
|
isSafeImage: boolean;
|
|
960
1074
|
}[] | undefined;
|
|
1075
|
+
hidden?: boolean | undefined;
|
|
961
1076
|
createdAt: Date;
|
|
962
1077
|
}[] | undefined;
|
|
963
1078
|
}[], Conversation[] | {
|
|
@@ -1005,6 +1120,7 @@ export declare function useChat(options?: UseChatOptions): {
|
|
|
1005
1120
|
url?: string | undefined;
|
|
1006
1121
|
isSafeImage: boolean;
|
|
1007
1122
|
}[] | undefined;
|
|
1123
|
+
hidden?: boolean | undefined;
|
|
1008
1124
|
createdAt: Date;
|
|
1009
1125
|
}[] | undefined;
|
|
1010
1126
|
}[]>;
|
|
@@ -1053,6 +1169,7 @@ export declare function useChat(options?: UseChatOptions): {
|
|
|
1053
1169
|
url?: string | undefined;
|
|
1054
1170
|
isSafeImage: boolean;
|
|
1055
1171
|
}[] | undefined;
|
|
1172
|
+
hidden?: boolean | undefined;
|
|
1056
1173
|
createdAt: Date;
|
|
1057
1174
|
}[] | undefined;
|
|
1058
1175
|
} | null, Conversation | {
|
|
@@ -1100,6 +1217,7 @@ export declare function useChat(options?: UseChatOptions): {
|
|
|
1100
1217
|
url?: string | undefined;
|
|
1101
1218
|
isSafeImage: boolean;
|
|
1102
1219
|
}[] | undefined;
|
|
1220
|
+
hidden?: boolean | undefined;
|
|
1103
1221
|
createdAt: Date;
|
|
1104
1222
|
}[] | undefined;
|
|
1105
1223
|
} | null>;
|
|
@@ -1168,6 +1286,7 @@ export declare function useConversation(options?: UseConversationOptions): {
|
|
|
1168
1286
|
url?: string | undefined;
|
|
1169
1287
|
isSafeImage: boolean;
|
|
1170
1288
|
}[] | undefined;
|
|
1289
|
+
hidden?: boolean | undefined;
|
|
1171
1290
|
createdAt: Date;
|
|
1172
1291
|
}[] | undefined;
|
|
1173
1292
|
}[], Conversation[] | {
|
|
@@ -1215,6 +1334,7 @@ export declare function useConversation(options?: UseConversationOptions): {
|
|
|
1215
1334
|
url?: string | undefined;
|
|
1216
1335
|
isSafeImage: boolean;
|
|
1217
1336
|
}[] | undefined;
|
|
1337
|
+
hidden?: boolean | undefined;
|
|
1218
1338
|
createdAt: Date;
|
|
1219
1339
|
}[] | undefined;
|
|
1220
1340
|
}[]>;
|
|
@@ -1263,6 +1383,7 @@ export declare function useConversation(options?: UseConversationOptions): {
|
|
|
1263
1383
|
url?: string | undefined;
|
|
1264
1384
|
isSafeImage: boolean;
|
|
1265
1385
|
}[] | undefined;
|
|
1386
|
+
hidden?: boolean | undefined;
|
|
1266
1387
|
createdAt: Date;
|
|
1267
1388
|
}[] | undefined;
|
|
1268
1389
|
} | null, Conversation | {
|
|
@@ -1310,6 +1431,7 @@ export declare function useConversation(options?: UseConversationOptions): {
|
|
|
1310
1431
|
url?: string | undefined;
|
|
1311
1432
|
isSafeImage: boolean;
|
|
1312
1433
|
}[] | undefined;
|
|
1434
|
+
hidden?: boolean | undefined;
|
|
1313
1435
|
createdAt: Date;
|
|
1314
1436
|
}[] | undefined;
|
|
1315
1437
|
} | null>;
|
|
@@ -1374,6 +1496,7 @@ export declare function useMessages(options?: UseMessagesOptions): {
|
|
|
1374
1496
|
url?: string | undefined;
|
|
1375
1497
|
isSafeImage: boolean;
|
|
1376
1498
|
}[] | undefined;
|
|
1499
|
+
hidden?: boolean | undefined;
|
|
1377
1500
|
createdAt: Date;
|
|
1378
1501
|
}[], AgoMessage[] | {
|
|
1379
1502
|
id: string;
|
|
@@ -1416,6 +1539,7 @@ export declare function useMessages(options?: UseMessagesOptions): {
|
|
|
1416
1539
|
url?: string | undefined;
|
|
1417
1540
|
isSafeImage: boolean;
|
|
1418
1541
|
}[] | undefined;
|
|
1542
|
+
hidden?: boolean | undefined;
|
|
1419
1543
|
createdAt: Date;
|
|
1420
1544
|
}[]>;
|
|
1421
1545
|
isLoading: Ref<boolean, boolean>;
|