@useago/sdk 1.4.2 → 1.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +4 -1
  2. package/dist/AgoClient-CLmtYTJx.cjs +8 -0
  3. package/dist/{AgoClient-BdtuHX7k.js → AgoClient-Ozz2b1dQ.js} +301 -161
  4. package/dist/angular.cjs +1 -1
  5. package/dist/angular.d.cts +151 -6
  6. package/dist/angular.d.ts +151 -6
  7. package/dist/angular.js +1 -1
  8. package/dist/{createConversationSession-B8zfTL78.cjs → createConversationSession-CUkNp6mZ.cjs} +1 -1
  9. package/dist/{createConversationSession-CWpf4u6I.js → createConversationSession-QIBN0gLx.js} +1 -1
  10. package/dist/{createFormCollector-BB_l0Sia.cjs → createFormCollector-DHT1ObOb.cjs} +1 -1
  11. package/dist/{createFormCollector-B4n0_diV.js → createFormCollector-F3YJfsbg.js} +1 -1
  12. package/dist/createMockClient-BSr-UV8R.cjs +1 -0
  13. package/dist/{createMockClient-d-arlmCq.js → createMockClient-bAZ9KBHC.js} +18 -15
  14. package/dist/devtools.d.cts +149 -4
  15. package/dist/devtools.d.ts +149 -4
  16. package/dist/helpers.d.cts +6 -0
  17. package/dist/helpers.d.ts +6 -0
  18. package/dist/index.cjs +1 -1
  19. package/dist/index.d.cts +181 -5
  20. package/dist/index.d.ts +181 -5
  21. package/dist/index.js +4 -4
  22. package/dist/react.cjs +3 -3
  23. package/dist/react.d.cts +169 -10
  24. package/dist/react.d.ts +169 -10
  25. package/dist/react.js +441 -428
  26. package/dist/testing.cjs +1 -1
  27. package/dist/testing.d.cts +149 -4
  28. package/dist/testing.d.ts +149 -4
  29. package/dist/testing.js +1 -1
  30. package/dist/vue.cjs +1 -1
  31. package/dist/vue.d.cts +162 -5
  32. package/dist/vue.d.ts +162 -5
  33. package/dist/vue.js +22 -21
  34. package/dist/widget.cjs +3 -3
  35. package/dist/widget.d.cts +149 -4
  36. package/dist/widget.d.ts +149 -4
  37. package/dist/widget.js +120 -120
  38. package/llms-full.txt +1910 -0
  39. package/package.json +5 -3
  40. package/dist/AgoClient-CRAnT4qE.cjs +0 -8
  41. package/dist/createMockClient-ucPENDzz.cjs +0 -1
package/dist/vue.d.cts CHANGED
@@ -47,12 +47,45 @@ declare class AgoClient {
47
47
  private config;
48
48
  /** Conversations already warned about an empty reply (one warning each). */
49
49
  private warnedEmptyConversations;
50
+ /** Paused turns awaiting auto-resume, keyed by assistant message id. */
51
+ private pendingResumes;
52
+ /** App-provided gate deciding WHEN a paused turn resumes (see {@link registerResumeGate}). */
53
+ private resumeGate;
50
54
  constructor(config: AgoConfig);
51
55
  /**
52
56
  * Send a message and receive a streaming response
53
57
  */
54
58
  sendMessage(content: string, options?: SendMessageOptions): Promise<AgoMessage>;
55
59
  private processSSEResponse;
60
+ private resolveClientFunctionsMode;
61
+ /**
62
+ * Register a gate deciding WHEN a paused turn resumes. The SDK still decides
63
+ * *whether* (it resumes once every waiting result is submitted); the gate only
64
+ * delays the continue call — e.g. `useAgoAutoContinueAfterNavigation` waits for
65
+ * the destination page to register its page state. One gate at a time (last
66
+ * registration wins). Returns an unregister function.
67
+ */
68
+ registerResumeGate(gate: ResumeGate): () => void;
69
+ /**
70
+ * Resume a turn paused on client function results (`WAITING_CLIENT`).
71
+ *
72
+ * Sends the CURRENT page's registered functions and context — the page may
73
+ * have changed since the pause (that's the point of pausing on a navigation) —
74
+ * and streams the continuation through the same event pipeline as
75
+ * `sendMessage`, so `message:chunk` / `message:complete` (or another
76
+ * `message:waiting-client` for chained pauses) fire as usual.
77
+ *
78
+ * The SDK calls this automatically after submitting the waiting results; call
79
+ * it manually only for custom flows (e.g. after restoring a reloaded page via
80
+ * {@link resumePendingClientFunctions}).
81
+ */
82
+ continueMessage(messageId: string): Promise<AgoMessage>;
83
+ /**
84
+ * Record one of the two auto-resume preconditions for a paused turn and fire
85
+ * the resume when both are in (see {@link PendingResume}).
86
+ */
87
+ private markResumeSignal;
88
+ private runAutoResume;
56
89
  /**
57
90
  * Detect a reply that completed as DONE with no content and no activity —
58
91
  * today's backend answers an unknown `agent` slug with an empty 200, which
@@ -85,9 +118,25 @@ declare class AgoClient {
85
118
  */
86
119
  getMessages(conversationId: string): Promise<AgoMessage[]>;
87
120
  /**
88
- * Submit form data for a tool call
121
+ * Resume a turn left paused on client function results by a page reload.
122
+ *
123
+ * A paused turn (pause mode) survives a full reload: the backend keeps the
124
+ * assistant message in `WAITING_CLIENT` with its waiting tool calls. After
125
+ * restoring the conversation (`getConversation`) and re-registering the page's
126
+ * functions, call this: it re-executes each waiting client function through the
127
+ * registry, submits the results, and continues the turn.
128
+ *
129
+ * Opt-in on purpose — re-running functions on reload can be surprising (e.g. a
130
+ * navigation function would navigate again), so the app decides. Returns the
131
+ * resumed turn's final message, or `null` when there was nothing to resume or
132
+ * some waiting function is not registered on this page.
133
+ */
134
+ resumePendingClientFunctions(conversation: Conversation): Promise<AgoMessage | null>;
135
+ /**
136
+ * Submit form data for a tool call. The response's `resume` field (pause mode
137
+ * only) tells whether the paused turn is ready to be resumed.
89
138
  */
90
- submitToolCallForm(toolCallId: string, formData: Record<string, unknown>): Promise<void>;
139
+ submitToolCallForm(toolCallId: string, formData: Record<string, unknown>): Promise<SubmitToolCallResult>;
91
140
  /**
92
141
  * Confirm a tool call
93
142
  */
@@ -134,7 +183,7 @@ declare class AgoClient {
134
183
  * ```
135
184
  */
136
185
  registerFunction(definition: ClientFunctionDefinition): void;
137
- registerFunction(name: string, handler: ClientFunctionHandler, schema: Omit<ClientFunctionSchema, "name">): void;
186
+ registerFunction(name: string, handler: ClientFunctionHandler, schema: ClientFunctionRegisterOptions): void;
138
187
  /**
139
188
  * Short alias for `registerFunction`. Also accepts an array of definitions.
140
189
  *
@@ -160,6 +209,12 @@ declare class AgoClient {
160
209
  * the agent know *where* it is after it navigates (e.g. so auto-continuation
161
210
  * can apply page state on the destination), not just how to navigate away.
162
211
  *
212
+ * Routes may contain `:param` placeholders (`/users/:id`). Each distinct
213
+ * placeholder becomes a top-level string argument of `navigateToPage`
214
+ * (`{ page: "userDetail", id: "42" }`), so one route covers every detail
215
+ * page of an entity. Flat arguments only: nested object parameters are not
216
+ * reliably rendered to the model, so placeholders must not be named `page`.
217
+ *
163
218
  * @param navigate - A callback that performs the navigation (e.g. react-router's navigate)
164
219
  * @param routes - Map of route names to paths, with descriptions for the LLM
165
220
  */
@@ -327,6 +382,19 @@ declare interface AgoClientEvents {
327
382
  */
328
383
  "message:answer-complete": AgoMessage;
329
384
  "message:complete": AgoMessage;
385
+ /**
386
+ * The turn paused on client function call(s) (pause mode): the stream closed
387
+ * with status `WAITING_CLIENT` instead of `DONE`. `message:complete` does NOT
388
+ * fire for this stream — it fires when the resumed turn concludes, so one
389
+ * logical turn still emits exactly one `message:complete`. The SDK submits the
390
+ * function results and resumes automatically; listen to this to know the agent
391
+ * is waiting on the page (e.g. to keep a "working…" indicator up).
392
+ */
393
+ "message:waiting-client": {
394
+ conversationId: string;
395
+ messageId: string;
396
+ waitingToolCallIds: string[];
397
+ };
330
398
  /**
331
399
  * A reply finished as `DONE` with empty content and no tool calls, client
332
400
  * functions, or follow-up replies — usually an unknown `agent` slug (the
@@ -414,6 +482,24 @@ export declare interface AgoConfig {
414
482
  * event fires regardless of this setting.
415
483
  */
416
484
  warnOnEmptyReply?: boolean;
485
+ /**
486
+ * How the agent loop treats client function calls (requires backend support):
487
+ * - `"placeholder"` (default): the turn continues immediately on a placeholder
488
+ * result; the real result is only visible to the agent on later turns.
489
+ * - `"pause"`: the turn stops on client function call(s) with status
490
+ * `WAITING_CLIENT`; once every result is submitted, the SDK resumes the SAME
491
+ * turn via `POST /messages/{id}/continue`, so the agent sees the real results.
492
+ * Older backends ignore the flag, so `"pause"` degrades to legacy behavior.
493
+ */
494
+ clientFunctionsMode?: ClientFunctionsMode;
495
+ /**
496
+ * Max serialized size (bytes) of a client function result before the SDK
497
+ * replaces it with a flagged, truncated preview. Everything a handler
498
+ * returns is sent into the LLM context, so this caps runaway payloads
499
+ * (raw API responses, full tables). Default `50000`. Override per function
500
+ * with `maxResultBytes` on its definition; `Infinity` disables the guard.
501
+ */
502
+ maxFunctionResultBytes?: number;
417
503
  }
418
504
 
419
505
  declare type AgoEventHandler<K extends AgoEventName> = (data: AgoClientEvents[K]) => void;
@@ -526,6 +612,12 @@ declare interface ClientFunctionDefinition {
526
612
  description: string;
527
613
  parameters: ClientFunctionSchema["parameters"];
528
614
  handler: ClientFunctionHandler;
615
+ /**
616
+ * Max serialized result size in bytes before the SDK truncates it to a
617
+ * flagged preview (default: `AgoConfig.maxFunctionResultBytes`, 50 000).
618
+ * `Infinity` disables the guard for this function.
619
+ */
620
+ maxResultBytes?: number;
529
621
  }
530
622
 
531
623
  /**
@@ -540,6 +632,20 @@ declare interface ClientFunctionInvocation {
540
632
  conversationId: string;
541
633
  }
542
634
 
635
+ /**
636
+ * Schema-plus-settings object accepted when registering a function: the schema
637
+ * (minus `name`) and SDK-side options that are NOT sent to the backend.
638
+ */
639
+ declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & {
640
+ /**
641
+ * Max serialized result size in bytes before the SDK truncates it to a
642
+ * flagged preview. Overrides the client-level default
643
+ * (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
644
+ * disables the guard for this function.
645
+ */
646
+ maxResultBytes?: number;
647
+ };
648
+
543
649
  /**
544
650
  * Schema for a client-side function that AGO can call
545
651
  */
@@ -565,6 +671,9 @@ declare interface ClientFunctionSchema {
565
671
  };
566
672
  }
567
673
 
674
+ /** See {@link AgoConfig.clientFunctionsMode}. */
675
+ declare type ClientFunctionsMode = "placeholder" | "pause";
676
+
568
677
  /**
569
678
  * A single piece of context the client wants the LLM to know about.
570
679
  */
@@ -706,9 +815,32 @@ declare interface FormSchema {
706
815
  required?: string[];
707
816
  }
708
817
 
709
- declare type MessageStatus = "IN_PROGRESS" | "DONE" | "ERROR" | "TODO" | "CANCELED";
818
+ declare type MessageStatus = "IN_PROGRESS" | "DONE" | "ERROR" | "TODO" | "CANCELED"
819
+ /**
820
+ * The turn paused on client function call(s) (pause mode): the agent waits for
821
+ * every waiting call to be submitted, then the turn resumes via
822
+ * `continueMessage`. Not a final state.
823
+ */
824
+ | "WAITING_CLIENT";
825
+
826
+ declare type MessageStatus_2 = "IN_PROGRESS" | "DONE" | "ERROR" | "TODO" | "CANCELED"
827
+ /**
828
+ * The turn paused on client function call(s) (pause mode): the agent waits for
829
+ * every waiting call to be submitted, then the turn resumes via
830
+ * `continueMessage`. Not a final state.
831
+ */
832
+ | "WAITING_CLIENT";
710
833
 
711
- declare type MessageStatus_2 = "IN_PROGRESS" | "DONE" | "ERROR" | "TODO" | "CANCELED";
834
+ /**
835
+ * Hook run before a paused turn is resumed, so the app controls WHEN the
836
+ * continuation fires (e.g. wait for the destination page to mount after a
837
+ * navigation). It must resolve — throwing or hanging blocks the resume; on
838
+ * timeout-style situations resolve anyway and let the agent conclude.
839
+ */
840
+ declare type ResumeGate = (info: {
841
+ conversationId: string;
842
+ messageId: string;
843
+ }) => Promise<void> | void;
712
844
 
713
845
  /**
714
846
  * Options for sending a message
@@ -727,6 +859,8 @@ declare interface SendMessageOptions {
727
859
  * Requires backend support for the `hidden` flag; older backends ignore it.
728
860
  */
729
861
  hidden?: boolean;
862
+ /** Per-message override of {@link AgoConfig.clientFunctionsMode}. */
863
+ clientFunctionsMode?: ClientFunctionsMode;
730
864
  }
731
865
 
732
866
  /**
@@ -768,6 +902,8 @@ declare interface SSEChunkData {
768
902
  follow_up_replies?: string[];
769
903
  satisfaction_feedback?: unknown;
770
904
  ask_to_talk_to_human?: boolean;
905
+ /** Tool call ids still awaiting a client result, sent with the final `WAITING_CLIENT` event. */
906
+ waiting_tool_call_ids?: string[];
771
907
  }
772
908
 
773
909
  /**
@@ -813,6 +949,21 @@ declare type SubmitConfig<V = Record<string, unknown>> = string | {
813
949
  destination?: string;
814
950
  } | false;
815
951
 
952
+ /**
953
+ * Response of `POST /tool-calls/{id}/submit`. `resume` is only present when the
954
+ * tool call belongs to a turn paused on client functions (pause mode): `ready`
955
+ * flips to `true` once ALL waiting calls of that message are submitted, meaning
956
+ * the turn can be resumed via `continueMessage(resume.message_id)`.
957
+ */
958
+ declare interface SubmitToolCallResult {
959
+ status: string;
960
+ result?: unknown;
961
+ resume?: {
962
+ message_id: string;
963
+ ready: boolean;
964
+ };
965
+ }
966
+
816
967
  /**
817
968
  * Tool call data from SSE stream
818
969
  */
@@ -875,6 +1026,12 @@ export declare function useAgoFunction(name: string, options: {
875
1026
  description: string;
876
1027
  parameters: ClientFunctionSchema["parameters"];
877
1028
  handler: ClientFunctionHandler;
1029
+ /**
1030
+ * Max serialized result size in bytes before the SDK truncates it to a
1031
+ * flagged preview (default: `AgoConfig.maxFunctionResultBytes`, 50 000).
1032
+ * `Infinity` disables the guard for this function.
1033
+ */
1034
+ maxResultBytes?: number;
878
1035
  }): void;
879
1036
 
880
1037
  /**
package/dist/vue.d.ts CHANGED
@@ -47,12 +47,45 @@ declare class AgoClient {
47
47
  private config;
48
48
  /** Conversations already warned about an empty reply (one warning each). */
49
49
  private warnedEmptyConversations;
50
+ /** Paused turns awaiting auto-resume, keyed by assistant message id. */
51
+ private pendingResumes;
52
+ /** App-provided gate deciding WHEN a paused turn resumes (see {@link registerResumeGate}). */
53
+ private resumeGate;
50
54
  constructor(config: AgoConfig);
51
55
  /**
52
56
  * Send a message and receive a streaming response
53
57
  */
54
58
  sendMessage(content: string, options?: SendMessageOptions): Promise<AgoMessage>;
55
59
  private processSSEResponse;
60
+ private resolveClientFunctionsMode;
61
+ /**
62
+ * Register a gate deciding WHEN a paused turn resumes. The SDK still decides
63
+ * *whether* (it resumes once every waiting result is submitted); the gate only
64
+ * delays the continue call — e.g. `useAgoAutoContinueAfterNavigation` waits for
65
+ * the destination page to register its page state. One gate at a time (last
66
+ * registration wins). Returns an unregister function.
67
+ */
68
+ registerResumeGate(gate: ResumeGate): () => void;
69
+ /**
70
+ * Resume a turn paused on client function results (`WAITING_CLIENT`).
71
+ *
72
+ * Sends the CURRENT page's registered functions and context — the page may
73
+ * have changed since the pause (that's the point of pausing on a navigation) —
74
+ * and streams the continuation through the same event pipeline as
75
+ * `sendMessage`, so `message:chunk` / `message:complete` (or another
76
+ * `message:waiting-client` for chained pauses) fire as usual.
77
+ *
78
+ * The SDK calls this automatically after submitting the waiting results; call
79
+ * it manually only for custom flows (e.g. after restoring a reloaded page via
80
+ * {@link resumePendingClientFunctions}).
81
+ */
82
+ continueMessage(messageId: string): Promise<AgoMessage>;
83
+ /**
84
+ * Record one of the two auto-resume preconditions for a paused turn and fire
85
+ * the resume when both are in (see {@link PendingResume}).
86
+ */
87
+ private markResumeSignal;
88
+ private runAutoResume;
56
89
  /**
57
90
  * Detect a reply that completed as DONE with no content and no activity —
58
91
  * today's backend answers an unknown `agent` slug with an empty 200, which
@@ -85,9 +118,25 @@ declare class AgoClient {
85
118
  */
86
119
  getMessages(conversationId: string): Promise<AgoMessage[]>;
87
120
  /**
88
- * Submit form data for a tool call
121
+ * Resume a turn left paused on client function results by a page reload.
122
+ *
123
+ * A paused turn (pause mode) survives a full reload: the backend keeps the
124
+ * assistant message in `WAITING_CLIENT` with its waiting tool calls. After
125
+ * restoring the conversation (`getConversation`) and re-registering the page's
126
+ * functions, call this: it re-executes each waiting client function through the
127
+ * registry, submits the results, and continues the turn.
128
+ *
129
+ * Opt-in on purpose — re-running functions on reload can be surprising (e.g. a
130
+ * navigation function would navigate again), so the app decides. Returns the
131
+ * resumed turn's final message, or `null` when there was nothing to resume or
132
+ * some waiting function is not registered on this page.
133
+ */
134
+ resumePendingClientFunctions(conversation: Conversation): Promise<AgoMessage | null>;
135
+ /**
136
+ * Submit form data for a tool call. The response's `resume` field (pause mode
137
+ * only) tells whether the paused turn is ready to be resumed.
89
138
  */
90
- submitToolCallForm(toolCallId: string, formData: Record<string, unknown>): Promise<void>;
139
+ submitToolCallForm(toolCallId: string, formData: Record<string, unknown>): Promise<SubmitToolCallResult>;
91
140
  /**
92
141
  * Confirm a tool call
93
142
  */
@@ -134,7 +183,7 @@ declare class AgoClient {
134
183
  * ```
135
184
  */
136
185
  registerFunction(definition: ClientFunctionDefinition): void;
137
- registerFunction(name: string, handler: ClientFunctionHandler, schema: Omit<ClientFunctionSchema, "name">): void;
186
+ registerFunction(name: string, handler: ClientFunctionHandler, schema: ClientFunctionRegisterOptions): void;
138
187
  /**
139
188
  * Short alias for `registerFunction`. Also accepts an array of definitions.
140
189
  *
@@ -160,6 +209,12 @@ declare class AgoClient {
160
209
  * the agent know *where* it is after it navigates (e.g. so auto-continuation
161
210
  * can apply page state on the destination), not just how to navigate away.
162
211
  *
212
+ * Routes may contain `:param` placeholders (`/users/:id`). Each distinct
213
+ * placeholder becomes a top-level string argument of `navigateToPage`
214
+ * (`{ page: "userDetail", id: "42" }`), so one route covers every detail
215
+ * page of an entity. Flat arguments only: nested object parameters are not
216
+ * reliably rendered to the model, so placeholders must not be named `page`.
217
+ *
163
218
  * @param navigate - A callback that performs the navigation (e.g. react-router's navigate)
164
219
  * @param routes - Map of route names to paths, with descriptions for the LLM
165
220
  */
@@ -327,6 +382,19 @@ declare interface AgoClientEvents {
327
382
  */
328
383
  "message:answer-complete": AgoMessage;
329
384
  "message:complete": AgoMessage;
385
+ /**
386
+ * The turn paused on client function call(s) (pause mode): the stream closed
387
+ * with status `WAITING_CLIENT` instead of `DONE`. `message:complete` does NOT
388
+ * fire for this stream — it fires when the resumed turn concludes, so one
389
+ * logical turn still emits exactly one `message:complete`. The SDK submits the
390
+ * function results and resumes automatically; listen to this to know the agent
391
+ * is waiting on the page (e.g. to keep a "working…" indicator up).
392
+ */
393
+ "message:waiting-client": {
394
+ conversationId: string;
395
+ messageId: string;
396
+ waitingToolCallIds: string[];
397
+ };
330
398
  /**
331
399
  * A reply finished as `DONE` with empty content and no tool calls, client
332
400
  * functions, or follow-up replies — usually an unknown `agent` slug (the
@@ -414,6 +482,24 @@ export declare interface AgoConfig {
414
482
  * event fires regardless of this setting.
415
483
  */
416
484
  warnOnEmptyReply?: boolean;
485
+ /**
486
+ * How the agent loop treats client function calls (requires backend support):
487
+ * - `"placeholder"` (default): the turn continues immediately on a placeholder
488
+ * result; the real result is only visible to the agent on later turns.
489
+ * - `"pause"`: the turn stops on client function call(s) with status
490
+ * `WAITING_CLIENT`; once every result is submitted, the SDK resumes the SAME
491
+ * turn via `POST /messages/{id}/continue`, so the agent sees the real results.
492
+ * Older backends ignore the flag, so `"pause"` degrades to legacy behavior.
493
+ */
494
+ clientFunctionsMode?: ClientFunctionsMode;
495
+ /**
496
+ * Max serialized size (bytes) of a client function result before the SDK
497
+ * replaces it with a flagged, truncated preview. Everything a handler
498
+ * returns is sent into the LLM context, so this caps runaway payloads
499
+ * (raw API responses, full tables). Default `50000`. Override per function
500
+ * with `maxResultBytes` on its definition; `Infinity` disables the guard.
501
+ */
502
+ maxFunctionResultBytes?: number;
417
503
  }
418
504
 
419
505
  declare type AgoEventHandler<K extends AgoEventName> = (data: AgoClientEvents[K]) => void;
@@ -526,6 +612,12 @@ declare interface ClientFunctionDefinition {
526
612
  description: string;
527
613
  parameters: ClientFunctionSchema["parameters"];
528
614
  handler: ClientFunctionHandler;
615
+ /**
616
+ * Max serialized result size in bytes before the SDK truncates it to a
617
+ * flagged preview (default: `AgoConfig.maxFunctionResultBytes`, 50 000).
618
+ * `Infinity` disables the guard for this function.
619
+ */
620
+ maxResultBytes?: number;
529
621
  }
530
622
 
531
623
  /**
@@ -540,6 +632,20 @@ declare interface ClientFunctionInvocation {
540
632
  conversationId: string;
541
633
  }
542
634
 
635
+ /**
636
+ * Schema-plus-settings object accepted when registering a function: the schema
637
+ * (minus `name`) and SDK-side options that are NOT sent to the backend.
638
+ */
639
+ declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & {
640
+ /**
641
+ * Max serialized result size in bytes before the SDK truncates it to a
642
+ * flagged preview. Overrides the client-level default
643
+ * (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
644
+ * disables the guard for this function.
645
+ */
646
+ maxResultBytes?: number;
647
+ };
648
+
543
649
  /**
544
650
  * Schema for a client-side function that AGO can call
545
651
  */
@@ -565,6 +671,9 @@ declare interface ClientFunctionSchema {
565
671
  };
566
672
  }
567
673
 
674
+ /** See {@link AgoConfig.clientFunctionsMode}. */
675
+ declare type ClientFunctionsMode = "placeholder" | "pause";
676
+
568
677
  /**
569
678
  * A single piece of context the client wants the LLM to know about.
570
679
  */
@@ -706,9 +815,32 @@ declare interface FormSchema {
706
815
  required?: string[];
707
816
  }
708
817
 
709
- declare type MessageStatus = "IN_PROGRESS" | "DONE" | "ERROR" | "TODO" | "CANCELED";
818
+ declare type MessageStatus = "IN_PROGRESS" | "DONE" | "ERROR" | "TODO" | "CANCELED"
819
+ /**
820
+ * The turn paused on client function call(s) (pause mode): the agent waits for
821
+ * every waiting call to be submitted, then the turn resumes via
822
+ * `continueMessage`. Not a final state.
823
+ */
824
+ | "WAITING_CLIENT";
825
+
826
+ declare type MessageStatus_2 = "IN_PROGRESS" | "DONE" | "ERROR" | "TODO" | "CANCELED"
827
+ /**
828
+ * The turn paused on client function call(s) (pause mode): the agent waits for
829
+ * every waiting call to be submitted, then the turn resumes via
830
+ * `continueMessage`. Not a final state.
831
+ */
832
+ | "WAITING_CLIENT";
710
833
 
711
- declare type MessageStatus_2 = "IN_PROGRESS" | "DONE" | "ERROR" | "TODO" | "CANCELED";
834
+ /**
835
+ * Hook run before a paused turn is resumed, so the app controls WHEN the
836
+ * continuation fires (e.g. wait for the destination page to mount after a
837
+ * navigation). It must resolve — throwing or hanging blocks the resume; on
838
+ * timeout-style situations resolve anyway and let the agent conclude.
839
+ */
840
+ declare type ResumeGate = (info: {
841
+ conversationId: string;
842
+ messageId: string;
843
+ }) => Promise<void> | void;
712
844
 
713
845
  /**
714
846
  * Options for sending a message
@@ -727,6 +859,8 @@ declare interface SendMessageOptions {
727
859
  * Requires backend support for the `hidden` flag; older backends ignore it.
728
860
  */
729
861
  hidden?: boolean;
862
+ /** Per-message override of {@link AgoConfig.clientFunctionsMode}. */
863
+ clientFunctionsMode?: ClientFunctionsMode;
730
864
  }
731
865
 
732
866
  /**
@@ -768,6 +902,8 @@ declare interface SSEChunkData {
768
902
  follow_up_replies?: string[];
769
903
  satisfaction_feedback?: unknown;
770
904
  ask_to_talk_to_human?: boolean;
905
+ /** Tool call ids still awaiting a client result, sent with the final `WAITING_CLIENT` event. */
906
+ waiting_tool_call_ids?: string[];
771
907
  }
772
908
 
773
909
  /**
@@ -813,6 +949,21 @@ declare type SubmitConfig<V = Record<string, unknown>> = string | {
813
949
  destination?: string;
814
950
  } | false;
815
951
 
952
+ /**
953
+ * Response of `POST /tool-calls/{id}/submit`. `resume` is only present when the
954
+ * tool call belongs to a turn paused on client functions (pause mode): `ready`
955
+ * flips to `true` once ALL waiting calls of that message are submitted, meaning
956
+ * the turn can be resumed via `continueMessage(resume.message_id)`.
957
+ */
958
+ declare interface SubmitToolCallResult {
959
+ status: string;
960
+ result?: unknown;
961
+ resume?: {
962
+ message_id: string;
963
+ ready: boolean;
964
+ };
965
+ }
966
+
816
967
  /**
817
968
  * Tool call data from SSE stream
818
969
  */
@@ -875,6 +1026,12 @@ export declare function useAgoFunction(name: string, options: {
875
1026
  description: string;
876
1027
  parameters: ClientFunctionSchema["parameters"];
877
1028
  handler: ClientFunctionHandler;
1029
+ /**
1030
+ * Max serialized result size in bytes before the SDK truncates it to a
1031
+ * flagged preview (default: `AgoConfig.maxFunctionResultBytes`, 50 000).
1032
+ * `Infinity` disables the guard for this function.
1033
+ */
1034
+ maxResultBytes?: number;
878
1035
  }): void;
879
1036
 
880
1037
  /**
package/dist/vue.js CHANGED
@@ -1,16 +1,16 @@
1
- import { t as A } from "./AgoClient-BdtuHX7k.js";
2
- import { computed as M, inject as F, onMounted as f, onScopeDispose as S, onUnmounted as h, ref as c, shallowRef as y } from "vue";
1
+ import { t as A } from "./AgoClient-Ozz2b1dQ.js";
2
+ import { computed as L, inject as M, onMounted as f, onScopeDispose as F, onUnmounted as h, ref as c, shallowRef as S } from "vue";
3
3
  var N = /* @__PURE__ */ Symbol("ago-client"), b = { install(t, n) {
4
4
  const e = new A(n);
5
5
  t.provide(N, e);
6
6
  } };
7
7
  function g(t) {
8
8
  if (t) return new A(t);
9
- const n = F(N);
9
+ const n = M(N);
10
10
  if (!n) throw new Error("useAgo(): no AgoClient found. Either pass config or install AgoPlugin.");
11
11
  return n;
12
12
  }
13
- function P(t = {}) {
13
+ function x(t = {}) {
14
14
  const n = t.client ?? g(), e = c([]), s = c(t.conversationId), r = c(!1), a = c(null), l = (o) => {
15
15
  s.value || (s.value = o.conversationId);
16
16
  }, m = (o) => {
@@ -39,7 +39,7 @@ function P(t = {}) {
39
39
  role: "user",
40
40
  status: "DONE",
41
41
  createdAt: /* @__PURE__ */ new Date()
42
- }, L = {
42
+ }, y = {
43
43
  id: `temp-assistant-${Date.now()}`,
44
44
  conversationId: s.value || "",
45
45
  content: "",
@@ -47,7 +47,7 @@ function P(t = {}) {
47
47
  status: "IN_PROGRESS",
48
48
  createdAt: /* @__PURE__ */ new Date()
49
49
  };
50
- e.value.push(v, L);
50
+ e.value.push(v, y);
51
51
  try {
52
52
  const u = await n.sendMessage(o, {
53
53
  conversationId: s.value,
@@ -76,7 +76,7 @@ function P(t = {}) {
76
76
  clearMessages: w
77
77
  };
78
78
  }
79
- function D(t = {}) {
79
+ function P(t = {}) {
80
80
  const n = t.client ?? g(), e = t.autoLoad ?? !0, s = c([]), r = c(null), a = c(!1), l = c(null);
81
81
  async function m() {
82
82
  a.value = !0, l.value = null;
@@ -114,13 +114,13 @@ function D(t = {}) {
114
114
  };
115
115
  }
116
116
  function k(t = {}) {
117
- const n = P({
117
+ const n = x({
118
118
  client: t.client,
119
119
  conversationId: t.conversationId
120
- }), e = D({
120
+ }), e = P({
121
121
  client: t.client,
122
122
  autoLoad: t.autoLoad
123
- }), s = M(() => n.error.value || e.error.value);
123
+ }), s = L(() => n.error.value || e.error.value);
124
124
  return {
125
125
  messages: n.messages,
126
126
  isLoading: n.isLoading,
@@ -141,7 +141,8 @@ function O(t, n) {
141
141
  f(() => {
142
142
  e.registerFunction(t, n.handler, {
143
143
  description: n.description,
144
- parameters: n.parameters
144
+ parameters: n.parameters,
145
+ maxResultBytes: n.maxResultBytes
145
146
  });
146
147
  }), h(() => {
147
148
  e.unregisterFunction(t);
@@ -155,7 +156,7 @@ function _(t, n) {
155
156
  e.unregisterNavigationFunction();
156
157
  });
157
158
  }
158
- function G(t, n) {
159
+ function B(t, n) {
159
160
  const e = g(), s = n?.functionName ?? "setPageState";
160
161
  f(() => {
161
162
  e.registerPageStateFunction(t, { functionName: s });
@@ -163,7 +164,7 @@ function G(t, n) {
163
164
  e.unregisterPageStateFunction(s);
164
165
  });
165
166
  }
166
- function U(t, n) {
167
+ function G(t, n) {
167
168
  const e = g();
168
169
  f(() => {
169
170
  e.on(t, n);
@@ -171,9 +172,9 @@ function U(t, n) {
171
172
  e.off(t, n);
172
173
  });
173
174
  }
174
- function W(t) {
175
- const n = y(t.get());
176
- return S(t.subscribe((e) => {
175
+ function U(t) {
176
+ const n = S(t.get());
177
+ return F(t.subscribe((e) => {
177
178
  n.value = e;
178
179
  })), n;
179
180
  }
@@ -181,12 +182,12 @@ export {
181
182
  N as AGO_CLIENT_KEY,
182
183
  b as AgoPlugin,
183
184
  g as useAgo,
184
- U as useAgoEvents,
185
+ G as useAgoEvents,
185
186
  O as useAgoFunction,
186
187
  _ as useAgoNavigation,
187
- G as useAgoPageState,
188
- W as useAgoStore,
188
+ B as useAgoPageState,
189
+ U as useAgoStore,
189
190
  k as useChat,
190
- D as useConversation,
191
- P as useMessages
191
+ P as useConversation,
192
+ x as useMessages
192
193
  };