@useago/sdk 1.5.3 → 1.5.5
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/CHANGELOG.md +33 -0
- package/README.md +10 -0
- package/dist/AgoClient-BI5esqbd.js +1694 -0
- package/dist/AgoClient-CQh8YovA.cjs +8 -0
- package/dist/angular.cjs +1 -1
- package/dist/angular.d.cts +70 -3
- package/dist/angular.d.ts +70 -3
- package/dist/angular.js +3 -3
- package/dist/{createConversationSession-BCb0D6bt.cjs → createConversationSession-0zVkMdYj.cjs} +1 -1
- package/dist/{createConversationSession-C7cnnWKW.js → createConversationSession-BlYTpxwz.js} +1 -1
- package/dist/{createFormCollector-iCDwAwYJ.js → createFormCollector-Bgs94NyR.js} +1 -1
- package/dist/{createFormCollector-t_fGyuTD.cjs → createFormCollector-DiCe_8ik.cjs} +1 -1
- package/dist/devtools.d.cts +69 -2
- package/dist/devtools.d.ts +69 -2
- package/dist/functions-CPs7omgM.cjs +1 -0
- package/dist/helpers.cjs +1 -1
- package/dist/helpers.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +90 -2
- package/dist/index.d.ts +90 -2
- package/dist/index.js +64 -62
- package/dist/react.cjs +3 -3
- package/dist/react.d.cts +83 -2
- package/dist/react.d.ts +83 -2
- package/dist/react.js +240 -219
- package/dist/testing.cjs +1 -1
- package/dist/testing.d.cts +69 -2
- package/dist/testing.d.ts +69 -2
- package/dist/testing.js +1 -1
- package/dist/vue.cjs +1 -1
- package/dist/vue.d.cts +69 -2
- package/dist/vue.d.ts +69 -2
- package/dist/vue.js +2 -2
- package/dist/widget.cjs +2 -2
- package/dist/widget.d.cts +69 -2
- package/dist/widget.d.ts +69 -2
- package/dist/widget.js +4 -4
- package/llms-full.txt +29 -0
- package/package.json +1 -1
- package/dist/AgoClient-BGkFSNZF.cjs +0 -8
- package/dist/AgoClient-CW-BLT1_.js +0 -1542
- package/dist/functions-IGSjjvF4.cjs +0 -1
- package/dist/rolldown-runtime-16Nf8qvH.cjs +0 -1
- /package/dist/{autoContinue-D3Mmaaca.js → autoContinue-CC8K9mBU.js} +0 -0
- /package/dist/{autoContinue-CcCTva-D.cjs → autoContinue-CP9pJR-V.cjs} +0 -0
- /package/dist/{createMockClient-Br0TWgLO.js → createMockClient-DcuNlufr.js} +0 -0
- /package/dist/{createMockClient-BwNLPjeT.cjs → createMockClient-Dw-cyISN.cjs} +0 -0
- /package/dist/{functions-CApuQZ2b.js → functions-tzyOZNp6.js} +0 -0
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-Dw-cyISN.cjs");exports.createMockClient=e.createMockClient;
|
package/dist/testing.d.cts
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
declare interface ActivityEntry {
|
|
2
|
+
ts: number;
|
|
3
|
+
actor: "user" | "agent";
|
|
4
|
+
name: string;
|
|
5
|
+
summary: string;
|
|
6
|
+
data?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare interface ActivityInput {
|
|
10
|
+
actor?: "user" | "agent";
|
|
11
|
+
name: string;
|
|
12
|
+
summary: string;
|
|
13
|
+
data?: Record<string, unknown>;
|
|
14
|
+
ts?: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
1
17
|
/**
|
|
2
18
|
* Agent information
|
|
3
19
|
*/
|
|
@@ -36,6 +52,8 @@ declare class AgoClient {
|
|
|
36
52
|
private functionRegistry;
|
|
37
53
|
private contextRegistry;
|
|
38
54
|
private eventEmitter;
|
|
55
|
+
private activityLedger;
|
|
56
|
+
private lastSentPageState;
|
|
39
57
|
private config;
|
|
40
58
|
/** Conversations already warned about an empty reply (one warning each). */
|
|
41
59
|
private warnedEmptyConversations;
|
|
@@ -122,9 +140,14 @@ declare class AgoClient {
|
|
|
122
140
|
*/
|
|
123
141
|
rejectFunction(invocationId: string): Promise<void>;
|
|
124
142
|
/**
|
|
125
|
-
* Get
|
|
143
|
+
* Get a page of conversations, newest-first. `pageSize` is capped at 100 by
|
|
144
|
+
* the backend (default 50). Returns the `{ data, has_more, total }` envelope
|
|
145
|
+
* so callers can page; `total` counts across all pages.
|
|
126
146
|
*/
|
|
127
|
-
getConversations(
|
|
147
|
+
getConversations(options?: {
|
|
148
|
+
page?: number;
|
|
149
|
+
pageSize?: number;
|
|
150
|
+
}): Promise<PaginatedResult<Conversation>>;
|
|
128
151
|
/**
|
|
129
152
|
* Get a specific conversation with messages
|
|
130
153
|
*/
|
|
@@ -346,6 +369,19 @@ declare class AgoClient {
|
|
|
346
369
|
* Get the current context snapshot.
|
|
347
370
|
*/
|
|
348
371
|
getContextSnapshot(): ContextSnapshot | null;
|
|
372
|
+
private buildSendContext;
|
|
373
|
+
/**
|
|
374
|
+
* Record something the user just did so the agent is aware of it on the next
|
|
375
|
+
* message. `actor` defaults to `"user"`. Keep `summary` short and high-signal
|
|
376
|
+
* (no raw payloads, secrets, or PII).
|
|
377
|
+
*/
|
|
378
|
+
recordActivity(entry: ActivityInput): void;
|
|
379
|
+
/** Recent user + agent actions, oldest first (a copy). */
|
|
380
|
+
getRecentActivity(): ActivityEntry[];
|
|
381
|
+
clearActivity(): void;
|
|
382
|
+
private addActivity;
|
|
383
|
+
private recordAgentAction;
|
|
384
|
+
private registerActivityContext;
|
|
349
385
|
/**
|
|
350
386
|
* Subscribe to an event
|
|
351
387
|
*/
|
|
@@ -457,6 +493,15 @@ declare interface AgoClientEvents {
|
|
|
457
493
|
* notably `createFormCollector` — can replay them to restore their state.
|
|
458
494
|
*/
|
|
459
495
|
"conversation:loaded": Conversation;
|
|
496
|
+
/**
|
|
497
|
+
* The conversation's title was generated and streamed during a live turn
|
|
498
|
+
* (the backend emits it once, at the end of the first turn). Lets the UI
|
|
499
|
+
* update a header without a refetch.
|
|
500
|
+
*/
|
|
501
|
+
"conversation:title": {
|
|
502
|
+
conversationId: string;
|
|
503
|
+
title: string;
|
|
504
|
+
};
|
|
460
505
|
"toolCall:received": ToolCallData;
|
|
461
506
|
"toolCall:form": ToolCallData;
|
|
462
507
|
"function:invoke": ClientFunctionInvocation;
|
|
@@ -517,6 +562,8 @@ declare interface AgoClientEvents {
|
|
|
517
562
|
"nudge:accepted": {
|
|
518
563
|
nudge: ProactiveNudgeInstance;
|
|
519
564
|
};
|
|
565
|
+
/** A user- or agent-action was recorded into the activity ledger. */
|
|
566
|
+
"activity:recorded": ActivityEntry;
|
|
520
567
|
}
|
|
521
568
|
|
|
522
569
|
/**
|
|
@@ -578,6 +625,14 @@ declare interface AgoConfig {
|
|
|
578
625
|
* with `maxResultBytes` on its definition; `Infinity` disables the guard.
|
|
579
626
|
*/
|
|
580
627
|
maxFunctionResultBytes?: number;
|
|
628
|
+
/**
|
|
629
|
+
* Max number of recent actions kept in the in-memory activity ledger that
|
|
630
|
+
* rides along as the `activity:recent` context entry. Older entries drop
|
|
631
|
+
* first. Default `10`. Larger values give the agent more history at the cost
|
|
632
|
+
* of tokens on every message. Each entry's `data` is also size-clamped (long
|
|
633
|
+
* strings truncated, large arrays capped) so one event can't bloat the context.
|
|
634
|
+
*/
|
|
635
|
+
maxActivityEntries?: number;
|
|
581
636
|
/**
|
|
582
637
|
* Enable the proactive mode: declarative triggers evaluated client-side
|
|
583
638
|
* against friction signals (dwell/idle time, rage clicks, route bounces…)
|
|
@@ -1005,6 +1060,16 @@ declare type NudgeAction = {
|
|
|
1005
1060
|
setPageState: Record<string, unknown>;
|
|
1006
1061
|
};
|
|
1007
1062
|
|
|
1063
|
+
/**
|
|
1064
|
+
* A page of list results, mirroring the API's `{ data, has_more, total }`
|
|
1065
|
+
* envelope. `total` is the count across all pages, not just this page.
|
|
1066
|
+
*/
|
|
1067
|
+
declare interface PaginatedResult<T> {
|
|
1068
|
+
data: T[];
|
|
1069
|
+
hasMore: boolean;
|
|
1070
|
+
total: number;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1008
1073
|
/**
|
|
1009
1074
|
* Controller returned by {@link createAgoProactive} (also available as
|
|
1010
1075
|
* `client.proactive`).
|
|
@@ -1257,6 +1322,8 @@ declare interface SSEChunkData {
|
|
|
1257
1322
|
thread?: {
|
|
1258
1323
|
id: string;
|
|
1259
1324
|
};
|
|
1325
|
+
/** Generated conversation title, streamed once at the end of the first turn. */
|
|
1326
|
+
title?: string;
|
|
1260
1327
|
agent?: {
|
|
1261
1328
|
id: string;
|
|
1262
1329
|
name: string;
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
declare interface ActivityEntry {
|
|
2
|
+
ts: number;
|
|
3
|
+
actor: "user" | "agent";
|
|
4
|
+
name: string;
|
|
5
|
+
summary: string;
|
|
6
|
+
data?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare interface ActivityInput {
|
|
10
|
+
actor?: "user" | "agent";
|
|
11
|
+
name: string;
|
|
12
|
+
summary: string;
|
|
13
|
+
data?: Record<string, unknown>;
|
|
14
|
+
ts?: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
1
17
|
/**
|
|
2
18
|
* Agent information
|
|
3
19
|
*/
|
|
@@ -36,6 +52,8 @@ declare class AgoClient {
|
|
|
36
52
|
private functionRegistry;
|
|
37
53
|
private contextRegistry;
|
|
38
54
|
private eventEmitter;
|
|
55
|
+
private activityLedger;
|
|
56
|
+
private lastSentPageState;
|
|
39
57
|
private config;
|
|
40
58
|
/** Conversations already warned about an empty reply (one warning each). */
|
|
41
59
|
private warnedEmptyConversations;
|
|
@@ -122,9 +140,14 @@ declare class AgoClient {
|
|
|
122
140
|
*/
|
|
123
141
|
rejectFunction(invocationId: string): Promise<void>;
|
|
124
142
|
/**
|
|
125
|
-
* Get
|
|
143
|
+
* Get a page of conversations, newest-first. `pageSize` is capped at 100 by
|
|
144
|
+
* the backend (default 50). Returns the `{ data, has_more, total }` envelope
|
|
145
|
+
* so callers can page; `total` counts across all pages.
|
|
126
146
|
*/
|
|
127
|
-
getConversations(
|
|
147
|
+
getConversations(options?: {
|
|
148
|
+
page?: number;
|
|
149
|
+
pageSize?: number;
|
|
150
|
+
}): Promise<PaginatedResult<Conversation>>;
|
|
128
151
|
/**
|
|
129
152
|
* Get a specific conversation with messages
|
|
130
153
|
*/
|
|
@@ -346,6 +369,19 @@ declare class AgoClient {
|
|
|
346
369
|
* Get the current context snapshot.
|
|
347
370
|
*/
|
|
348
371
|
getContextSnapshot(): ContextSnapshot | null;
|
|
372
|
+
private buildSendContext;
|
|
373
|
+
/**
|
|
374
|
+
* Record something the user just did so the agent is aware of it on the next
|
|
375
|
+
* message. `actor` defaults to `"user"`. Keep `summary` short and high-signal
|
|
376
|
+
* (no raw payloads, secrets, or PII).
|
|
377
|
+
*/
|
|
378
|
+
recordActivity(entry: ActivityInput): void;
|
|
379
|
+
/** Recent user + agent actions, oldest first (a copy). */
|
|
380
|
+
getRecentActivity(): ActivityEntry[];
|
|
381
|
+
clearActivity(): void;
|
|
382
|
+
private addActivity;
|
|
383
|
+
private recordAgentAction;
|
|
384
|
+
private registerActivityContext;
|
|
349
385
|
/**
|
|
350
386
|
* Subscribe to an event
|
|
351
387
|
*/
|
|
@@ -457,6 +493,15 @@ declare interface AgoClientEvents {
|
|
|
457
493
|
* notably `createFormCollector` — can replay them to restore their state.
|
|
458
494
|
*/
|
|
459
495
|
"conversation:loaded": Conversation;
|
|
496
|
+
/**
|
|
497
|
+
* The conversation's title was generated and streamed during a live turn
|
|
498
|
+
* (the backend emits it once, at the end of the first turn). Lets the UI
|
|
499
|
+
* update a header without a refetch.
|
|
500
|
+
*/
|
|
501
|
+
"conversation:title": {
|
|
502
|
+
conversationId: string;
|
|
503
|
+
title: string;
|
|
504
|
+
};
|
|
460
505
|
"toolCall:received": ToolCallData;
|
|
461
506
|
"toolCall:form": ToolCallData;
|
|
462
507
|
"function:invoke": ClientFunctionInvocation;
|
|
@@ -517,6 +562,8 @@ declare interface AgoClientEvents {
|
|
|
517
562
|
"nudge:accepted": {
|
|
518
563
|
nudge: ProactiveNudgeInstance;
|
|
519
564
|
};
|
|
565
|
+
/** A user- or agent-action was recorded into the activity ledger. */
|
|
566
|
+
"activity:recorded": ActivityEntry;
|
|
520
567
|
}
|
|
521
568
|
|
|
522
569
|
/**
|
|
@@ -578,6 +625,14 @@ declare interface AgoConfig {
|
|
|
578
625
|
* with `maxResultBytes` on its definition; `Infinity` disables the guard.
|
|
579
626
|
*/
|
|
580
627
|
maxFunctionResultBytes?: number;
|
|
628
|
+
/**
|
|
629
|
+
* Max number of recent actions kept in the in-memory activity ledger that
|
|
630
|
+
* rides along as the `activity:recent` context entry. Older entries drop
|
|
631
|
+
* first. Default `10`. Larger values give the agent more history at the cost
|
|
632
|
+
* of tokens on every message. Each entry's `data` is also size-clamped (long
|
|
633
|
+
* strings truncated, large arrays capped) so one event can't bloat the context.
|
|
634
|
+
*/
|
|
635
|
+
maxActivityEntries?: number;
|
|
581
636
|
/**
|
|
582
637
|
* Enable the proactive mode: declarative triggers evaluated client-side
|
|
583
638
|
* against friction signals (dwell/idle time, rage clicks, route bounces…)
|
|
@@ -1005,6 +1060,16 @@ declare type NudgeAction = {
|
|
|
1005
1060
|
setPageState: Record<string, unknown>;
|
|
1006
1061
|
};
|
|
1007
1062
|
|
|
1063
|
+
/**
|
|
1064
|
+
* A page of list results, mirroring the API's `{ data, has_more, total }`
|
|
1065
|
+
* envelope. `total` is the count across all pages, not just this page.
|
|
1066
|
+
*/
|
|
1067
|
+
declare interface PaginatedResult<T> {
|
|
1068
|
+
data: T[];
|
|
1069
|
+
hasMore: boolean;
|
|
1070
|
+
total: number;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1008
1073
|
/**
|
|
1009
1074
|
* Controller returned by {@link createAgoProactive} (also available as
|
|
1010
1075
|
* `client.proactive`).
|
|
@@ -1257,6 +1322,8 @@ declare interface SSEChunkData {
|
|
|
1257
1322
|
thread?: {
|
|
1258
1323
|
id: string;
|
|
1259
1324
|
};
|
|
1325
|
+
/** Generated conversation title, streamed once at the end of the first turn. */
|
|
1326
|
+
title?: string;
|
|
1260
1327
|
agent?: {
|
|
1261
1328
|
id: string;
|
|
1262
1329
|
name: string;
|
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 I=require("./AgoClient-CQh8YovA.cjs");let o=require("vue");var w=Symbol("ago-client"),N={install(t,e){const n=new I.AgoClient(e);t.provide(w,n)}};function v(t){if(t)return new I.AgoClient(t);const e=(0,o.inject)(w);if(!e)throw new Error("useAgo(): no AgoClient found. Either pass config or install AgoPlugin.");return e}function M(t={}){const e=t.client??v(),n=(0,o.ref)([]),s=(0,o.ref)(t.conversationId),a=(0,o.ref)(!1),u=(0,o.ref)(null),c=r=>{s.value||(s.value=r.conversationId)},f=r=>{const i=n.value.findIndex(d=>d.id===r.messageId);i>=0&&(n.value[i]={...n.value[i],content:n.value[i].content+r.content})},m=r=>{const i=n.value.findIndex(d=>d.id===r.id);i>=0?n.value[i]=r:n.value.push(r),a.value=!1},C=r=>{u.value=new Error(r.error),a.value=!1};(0,o.onMounted)(()=>{e.on("message:start",c),e.on("message:chunk",f),e.on("message:complete",m),e.on("message:error",C)}),(0,o.onUnmounted)(()=>{e.off("message:start",c),e.off("message:chunk",f),e.off("message:complete",m),e.off("message:error",C)});async function g(r,i){a.value=!0,u.value=null;const d={id:`temp-${Date.now()}`,conversationId:s.value||"",content:r,role:"user",status:"DONE",createdAt:new Date},y={id:`temp-assistant-${Date.now()}`,conversationId:s.value||"",content:"",role:"assistant",status:"IN_PROGRESS",createdAt:new Date};n.value.push(d,y);try{const l=await e.sendMessage(r,{conversationId:s.value,files:i});l.conversationId&&!s.value&&(s.value=l.conversationId),n.value=n.value.filter(A=>!A.id.startsWith("temp-"));const p={...d,id:d.id.replace("temp-","user-"),conversationId:l.conversationId};return n.value.some(A=>A.id===l.id)?n.value.push(p):n.value.push(p,l),l}catch(l){return u.value=l instanceof Error?l:new Error("Failed to send"),a.value=!1,n.value=n.value.filter(p=>!p.id.startsWith("temp-")),null}}function h(){n.value=[],s.value=void 0,u.value=null}return{messages:n,isLoading:a,error:u,conversationId:s,sendMessage:g,clearMessages:h}}function E(t={}){const e=t.client??v(),n=t.autoLoad??!0,s=(0,o.ref)([]),a=(0,o.ref)(null),u=(0,o.ref)(!1),c=(0,o.ref)(null);async function f(){u.value=!0,c.value=null;try{s.value=(await e.getConversations()).data}catch(g){c.value=g instanceof Error?g:new Error("Failed to load conversations")}finally{u.value=!1}}async function m(g){u.value=!0,c.value=null;try{a.value=await e.getConversation(g)}catch(h){c.value=h instanceof Error?h:new Error("Failed to load conversation")}finally{u.value=!1}}function C(){a.value=null}return(0,o.onMounted)(()=>{n&&f()}),{conversations:s,currentConversation:a,isLoading:u,error:c,selectConversation:m,startNewConversation:C,refreshConversations:f}}function S(t={}){const e=M({client:t.client,conversationId:t.conversationId}),n=E({client:t.client,autoLoad:t.autoLoad}),s=(0,o.computed)(()=>e.error.value||n.error.value);return{messages:e.messages,isLoading:e.isLoading,error:s,sendMessage:e.sendMessage,clearMessages:e.clearMessages,conversationId:e.conversationId,conversations:n.conversations,currentConversation:n.currentConversation,isConversationsLoading:n.isLoading,selectConversation:n.selectConversation,startNewConversation:n.startNewConversation,refreshConversations:n.refreshConversations}}function L(t,e){const n=v();(0,o.onMounted)(()=>{n.registerFunction(t,e.handler,{description:e.description,parameters:e.parameters,maxResultBytes:e.maxResultBytes})}),(0,o.onUnmounted)(()=>{n.unregisterFunction(t)})}function P(t,e){const n=v();(0,o.onMounted)(()=>{n.registerNavigationFunction(t,e)}),(0,o.onUnmounted)(()=>{n.unregisterNavigationFunction()})}function F(t,e){const n=v(),s=e?.functionName??"setPageState";(0,o.onMounted)(()=>{n.registerPageStateFunction(t,{functionName:s})}),(0,o.onUnmounted)(()=>{n.unregisterPageStateFunction(s)})}function R(t,e){const n=v();(0,o.onMounted)(()=>{n.on(t,e)}),(0,o.onUnmounted)(()=>{n.off(t,e)})}function U(t){const e=(0,o.shallowRef)(t.get());return(0,o.onScopeDispose)(t.subscribe(n=>{e.value=n})),e}function D(){const t=v(),e=(0,o.shallowRef)(null),n=a=>{e.value=a,t.proactive?.shown(a)},s=({nudge:a})=>{e.value?.id===a.id&&(e.value=null)};return(0,o.onMounted)(()=>{t.on("nudge:ready",n),t.on("nudge:accepted",s),t.on("nudge:dismissed",s)}),(0,o.onUnmounted)(()=>{t.off("nudge:ready",n),t.off("nudge:accepted",s),t.off("nudge:dismissed",s)}),{nudge:e,accept:async()=>{const a=e.value;a&&(e.value=null,await t.proactive?.accept(a))},dismiss:()=>{const a=e.value;a&&(e.value=null,t.proactive?.dismiss(a))}}}exports.AGO_CLIENT_KEY=w;exports.AgoPlugin=N;exports.useAgo=v;exports.useAgoEvents=R;exports.useAgoFunction=L;exports.useAgoNavigation=P;exports.useAgoPageState=F;exports.useAgoStore=U;exports.useChat=S;exports.useConversation=E;exports.useMessages=M;exports.useProactiveNudge=D;
|
package/dist/vue.d.cts
CHANGED
|
@@ -4,6 +4,22 @@ import { InjectionKey } from 'vue';
|
|
|
4
4
|
import { Ref } from 'vue';
|
|
5
5
|
import { ShallowRef } from 'vue';
|
|
6
6
|
|
|
7
|
+
declare interface ActivityEntry {
|
|
8
|
+
ts: number;
|
|
9
|
+
actor: "user" | "agent";
|
|
10
|
+
name: string;
|
|
11
|
+
summary: string;
|
|
12
|
+
data?: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare interface ActivityInput {
|
|
16
|
+
actor?: "user" | "agent";
|
|
17
|
+
name: string;
|
|
18
|
+
summary: string;
|
|
19
|
+
data?: Record<string, unknown>;
|
|
20
|
+
ts?: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
7
23
|
export declare const AGO_CLIENT_KEY: InjectionKey<AgoClient>;
|
|
8
24
|
|
|
9
25
|
/**
|
|
@@ -44,6 +60,8 @@ declare class AgoClient {
|
|
|
44
60
|
private functionRegistry;
|
|
45
61
|
private contextRegistry;
|
|
46
62
|
private eventEmitter;
|
|
63
|
+
private activityLedger;
|
|
64
|
+
private lastSentPageState;
|
|
47
65
|
private config;
|
|
48
66
|
/** Conversations already warned about an empty reply (one warning each). */
|
|
49
67
|
private warnedEmptyConversations;
|
|
@@ -130,9 +148,14 @@ declare class AgoClient {
|
|
|
130
148
|
*/
|
|
131
149
|
rejectFunction(invocationId: string): Promise<void>;
|
|
132
150
|
/**
|
|
133
|
-
* Get
|
|
151
|
+
* Get a page of conversations, newest-first. `pageSize` is capped at 100 by
|
|
152
|
+
* the backend (default 50). Returns the `{ data, has_more, total }` envelope
|
|
153
|
+
* so callers can page; `total` counts across all pages.
|
|
134
154
|
*/
|
|
135
|
-
getConversations(
|
|
155
|
+
getConversations(options?: {
|
|
156
|
+
page?: number;
|
|
157
|
+
pageSize?: number;
|
|
158
|
+
}): Promise<PaginatedResult<Conversation>>;
|
|
136
159
|
/**
|
|
137
160
|
* Get a specific conversation with messages
|
|
138
161
|
*/
|
|
@@ -354,6 +377,19 @@ declare class AgoClient {
|
|
|
354
377
|
* Get the current context snapshot.
|
|
355
378
|
*/
|
|
356
379
|
getContextSnapshot(): ContextSnapshot | null;
|
|
380
|
+
private buildSendContext;
|
|
381
|
+
/**
|
|
382
|
+
* Record something the user just did so the agent is aware of it on the next
|
|
383
|
+
* message. `actor` defaults to `"user"`. Keep `summary` short and high-signal
|
|
384
|
+
* (no raw payloads, secrets, or PII).
|
|
385
|
+
*/
|
|
386
|
+
recordActivity(entry: ActivityInput): void;
|
|
387
|
+
/** Recent user + agent actions, oldest first (a copy). */
|
|
388
|
+
getRecentActivity(): ActivityEntry[];
|
|
389
|
+
clearActivity(): void;
|
|
390
|
+
private addActivity;
|
|
391
|
+
private recordAgentAction;
|
|
392
|
+
private registerActivityContext;
|
|
357
393
|
/**
|
|
358
394
|
* Subscribe to an event
|
|
359
395
|
*/
|
|
@@ -465,6 +501,15 @@ declare interface AgoClientEvents {
|
|
|
465
501
|
* notably `createFormCollector` — can replay them to restore their state.
|
|
466
502
|
*/
|
|
467
503
|
"conversation:loaded": Conversation;
|
|
504
|
+
/**
|
|
505
|
+
* The conversation's title was generated and streamed during a live turn
|
|
506
|
+
* (the backend emits it once, at the end of the first turn). Lets the UI
|
|
507
|
+
* update a header without a refetch.
|
|
508
|
+
*/
|
|
509
|
+
"conversation:title": {
|
|
510
|
+
conversationId: string;
|
|
511
|
+
title: string;
|
|
512
|
+
};
|
|
468
513
|
"toolCall:received": ToolCallData;
|
|
469
514
|
"toolCall:form": ToolCallData;
|
|
470
515
|
"function:invoke": ClientFunctionInvocation;
|
|
@@ -525,6 +570,8 @@ declare interface AgoClientEvents {
|
|
|
525
570
|
"nudge:accepted": {
|
|
526
571
|
nudge: ProactiveNudgeInstance;
|
|
527
572
|
};
|
|
573
|
+
/** A user- or agent-action was recorded into the activity ledger. */
|
|
574
|
+
"activity:recorded": ActivityEntry;
|
|
528
575
|
}
|
|
529
576
|
|
|
530
577
|
/**
|
|
@@ -586,6 +633,14 @@ export declare interface AgoConfig {
|
|
|
586
633
|
* with `maxResultBytes` on its definition; `Infinity` disables the guard.
|
|
587
634
|
*/
|
|
588
635
|
maxFunctionResultBytes?: number;
|
|
636
|
+
/**
|
|
637
|
+
* Max number of recent actions kept in the in-memory activity ledger that
|
|
638
|
+
* rides along as the `activity:recent` context entry. Older entries drop
|
|
639
|
+
* first. Default `10`. Larger values give the agent more history at the cost
|
|
640
|
+
* of tokens on every message. Each entry's `data` is also size-clamped (long
|
|
641
|
+
* strings truncated, large arrays capped) so one event can't bloat the context.
|
|
642
|
+
*/
|
|
643
|
+
maxActivityEntries?: number;
|
|
589
644
|
/**
|
|
590
645
|
* Enable the proactive mode: declarative triggers evaluated client-side
|
|
591
646
|
* against friction signals (dwell/idle time, rage clicks, route bounces…)
|
|
@@ -1007,6 +1062,16 @@ export declare type NudgeAction = {
|
|
|
1007
1062
|
setPageState: Record<string, unknown>;
|
|
1008
1063
|
};
|
|
1009
1064
|
|
|
1065
|
+
/**
|
|
1066
|
+
* A page of list results, mirroring the API's `{ data, has_more, total }`
|
|
1067
|
+
* envelope. `total` is the count across all pages, not just this page.
|
|
1068
|
+
*/
|
|
1069
|
+
declare interface PaginatedResult<T> {
|
|
1070
|
+
data: T[];
|
|
1071
|
+
hasMore: boolean;
|
|
1072
|
+
total: number;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1010
1075
|
/**
|
|
1011
1076
|
* Controller returned by {@link createAgoProactive} (also available as
|
|
1012
1077
|
* `client.proactive`).
|
|
@@ -1259,6 +1324,8 @@ declare interface SSEChunkData {
|
|
|
1259
1324
|
thread?: {
|
|
1260
1325
|
id: string;
|
|
1261
1326
|
};
|
|
1327
|
+
/** Generated conversation title, streamed once at the end of the first turn. */
|
|
1328
|
+
title?: string;
|
|
1262
1329
|
agent?: {
|
|
1263
1330
|
id: string;
|
|
1264
1331
|
name: string;
|
package/dist/vue.d.ts
CHANGED
|
@@ -4,6 +4,22 @@ import { InjectionKey } from 'vue';
|
|
|
4
4
|
import { Ref } from 'vue';
|
|
5
5
|
import { ShallowRef } from 'vue';
|
|
6
6
|
|
|
7
|
+
declare interface ActivityEntry {
|
|
8
|
+
ts: number;
|
|
9
|
+
actor: "user" | "agent";
|
|
10
|
+
name: string;
|
|
11
|
+
summary: string;
|
|
12
|
+
data?: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare interface ActivityInput {
|
|
16
|
+
actor?: "user" | "agent";
|
|
17
|
+
name: string;
|
|
18
|
+
summary: string;
|
|
19
|
+
data?: Record<string, unknown>;
|
|
20
|
+
ts?: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
7
23
|
export declare const AGO_CLIENT_KEY: InjectionKey<AgoClient>;
|
|
8
24
|
|
|
9
25
|
/**
|
|
@@ -44,6 +60,8 @@ declare class AgoClient {
|
|
|
44
60
|
private functionRegistry;
|
|
45
61
|
private contextRegistry;
|
|
46
62
|
private eventEmitter;
|
|
63
|
+
private activityLedger;
|
|
64
|
+
private lastSentPageState;
|
|
47
65
|
private config;
|
|
48
66
|
/** Conversations already warned about an empty reply (one warning each). */
|
|
49
67
|
private warnedEmptyConversations;
|
|
@@ -130,9 +148,14 @@ declare class AgoClient {
|
|
|
130
148
|
*/
|
|
131
149
|
rejectFunction(invocationId: string): Promise<void>;
|
|
132
150
|
/**
|
|
133
|
-
* Get
|
|
151
|
+
* Get a page of conversations, newest-first. `pageSize` is capped at 100 by
|
|
152
|
+
* the backend (default 50). Returns the `{ data, has_more, total }` envelope
|
|
153
|
+
* so callers can page; `total` counts across all pages.
|
|
134
154
|
*/
|
|
135
|
-
getConversations(
|
|
155
|
+
getConversations(options?: {
|
|
156
|
+
page?: number;
|
|
157
|
+
pageSize?: number;
|
|
158
|
+
}): Promise<PaginatedResult<Conversation>>;
|
|
136
159
|
/**
|
|
137
160
|
* Get a specific conversation with messages
|
|
138
161
|
*/
|
|
@@ -354,6 +377,19 @@ declare class AgoClient {
|
|
|
354
377
|
* Get the current context snapshot.
|
|
355
378
|
*/
|
|
356
379
|
getContextSnapshot(): ContextSnapshot | null;
|
|
380
|
+
private buildSendContext;
|
|
381
|
+
/**
|
|
382
|
+
* Record something the user just did so the agent is aware of it on the next
|
|
383
|
+
* message. `actor` defaults to `"user"`. Keep `summary` short and high-signal
|
|
384
|
+
* (no raw payloads, secrets, or PII).
|
|
385
|
+
*/
|
|
386
|
+
recordActivity(entry: ActivityInput): void;
|
|
387
|
+
/** Recent user + agent actions, oldest first (a copy). */
|
|
388
|
+
getRecentActivity(): ActivityEntry[];
|
|
389
|
+
clearActivity(): void;
|
|
390
|
+
private addActivity;
|
|
391
|
+
private recordAgentAction;
|
|
392
|
+
private registerActivityContext;
|
|
357
393
|
/**
|
|
358
394
|
* Subscribe to an event
|
|
359
395
|
*/
|
|
@@ -465,6 +501,15 @@ declare interface AgoClientEvents {
|
|
|
465
501
|
* notably `createFormCollector` — can replay them to restore their state.
|
|
466
502
|
*/
|
|
467
503
|
"conversation:loaded": Conversation;
|
|
504
|
+
/**
|
|
505
|
+
* The conversation's title was generated and streamed during a live turn
|
|
506
|
+
* (the backend emits it once, at the end of the first turn). Lets the UI
|
|
507
|
+
* update a header without a refetch.
|
|
508
|
+
*/
|
|
509
|
+
"conversation:title": {
|
|
510
|
+
conversationId: string;
|
|
511
|
+
title: string;
|
|
512
|
+
};
|
|
468
513
|
"toolCall:received": ToolCallData;
|
|
469
514
|
"toolCall:form": ToolCallData;
|
|
470
515
|
"function:invoke": ClientFunctionInvocation;
|
|
@@ -525,6 +570,8 @@ declare interface AgoClientEvents {
|
|
|
525
570
|
"nudge:accepted": {
|
|
526
571
|
nudge: ProactiveNudgeInstance;
|
|
527
572
|
};
|
|
573
|
+
/** A user- or agent-action was recorded into the activity ledger. */
|
|
574
|
+
"activity:recorded": ActivityEntry;
|
|
528
575
|
}
|
|
529
576
|
|
|
530
577
|
/**
|
|
@@ -586,6 +633,14 @@ export declare interface AgoConfig {
|
|
|
586
633
|
* with `maxResultBytes` on its definition; `Infinity` disables the guard.
|
|
587
634
|
*/
|
|
588
635
|
maxFunctionResultBytes?: number;
|
|
636
|
+
/**
|
|
637
|
+
* Max number of recent actions kept in the in-memory activity ledger that
|
|
638
|
+
* rides along as the `activity:recent` context entry. Older entries drop
|
|
639
|
+
* first. Default `10`. Larger values give the agent more history at the cost
|
|
640
|
+
* of tokens on every message. Each entry's `data` is also size-clamped (long
|
|
641
|
+
* strings truncated, large arrays capped) so one event can't bloat the context.
|
|
642
|
+
*/
|
|
643
|
+
maxActivityEntries?: number;
|
|
589
644
|
/**
|
|
590
645
|
* Enable the proactive mode: declarative triggers evaluated client-side
|
|
591
646
|
* against friction signals (dwell/idle time, rage clicks, route bounces…)
|
|
@@ -1007,6 +1062,16 @@ export declare type NudgeAction = {
|
|
|
1007
1062
|
setPageState: Record<string, unknown>;
|
|
1008
1063
|
};
|
|
1009
1064
|
|
|
1065
|
+
/**
|
|
1066
|
+
* A page of list results, mirroring the API's `{ data, has_more, total }`
|
|
1067
|
+
* envelope. `total` is the count across all pages, not just this page.
|
|
1068
|
+
*/
|
|
1069
|
+
declare interface PaginatedResult<T> {
|
|
1070
|
+
data: T[];
|
|
1071
|
+
hasMore: boolean;
|
|
1072
|
+
total: number;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1010
1075
|
/**
|
|
1011
1076
|
* Controller returned by {@link createAgoProactive} (also available as
|
|
1012
1077
|
* `client.proactive`).
|
|
@@ -1259,6 +1324,8 @@ declare interface SSEChunkData {
|
|
|
1259
1324
|
thread?: {
|
|
1260
1325
|
id: string;
|
|
1261
1326
|
};
|
|
1327
|
+
/** Generated conversation title, streamed once at the end of the first turn. */
|
|
1328
|
+
title?: string;
|
|
1262
1329
|
agent?: {
|
|
1263
1330
|
id: string;
|
|
1264
1331
|
name: string;
|
package/dist/vue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as E } from "./AgoClient-
|
|
1
|
+
import { t as E } from "./AgoClient-BI5esqbd.js";
|
|
2
2
|
import { computed as M, inject as F, onMounted as d, onScopeDispose as S, onUnmounted as m, ref as l, shallowRef as A } from "vue";
|
|
3
3
|
var N = /* @__PURE__ */ Symbol("ago-client"), b = { install(t, e) {
|
|
4
4
|
const n = new E(e);
|
|
@@ -81,7 +81,7 @@ function P(t = {}) {
|
|
|
81
81
|
async function p() {
|
|
82
82
|
r.value = !0, c.value = null;
|
|
83
83
|
try {
|
|
84
|
-
s.value = await e.getConversations();
|
|
84
|
+
s.value = (await e.getConversations()).data;
|
|
85
85
|
} catch (g) {
|
|
86
86
|
c.value = g instanceof Error ? g : /* @__PURE__ */ new Error("Failed to load conversations");
|
|
87
87
|
} finally {
|