@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.
- package/README.md +4 -1
- package/dist/AgoClient-CLmtYTJx.cjs +8 -0
- package/dist/{AgoClient-BdtuHX7k.js → AgoClient-Ozz2b1dQ.js} +301 -161
- package/dist/angular.cjs +1 -1
- package/dist/angular.d.cts +151 -6
- package/dist/angular.d.ts +151 -6
- package/dist/angular.js +1 -1
- package/dist/{createConversationSession-B8zfTL78.cjs → createConversationSession-CUkNp6mZ.cjs} +1 -1
- package/dist/{createConversationSession-CWpf4u6I.js → createConversationSession-QIBN0gLx.js} +1 -1
- package/dist/{createFormCollector-BB_l0Sia.cjs → createFormCollector-DHT1ObOb.cjs} +1 -1
- package/dist/{createFormCollector-B4n0_diV.js → createFormCollector-F3YJfsbg.js} +1 -1
- package/dist/createMockClient-BSr-UV8R.cjs +1 -0
- package/dist/{createMockClient-d-arlmCq.js → createMockClient-bAZ9KBHC.js} +18 -15
- package/dist/devtools.d.cts +149 -4
- package/dist/devtools.d.ts +149 -4
- package/dist/helpers.d.cts +6 -0
- package/dist/helpers.d.ts +6 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +181 -5
- package/dist/index.d.ts +181 -5
- package/dist/index.js +4 -4
- package/dist/react.cjs +3 -3
- package/dist/react.d.cts +169 -10
- package/dist/react.d.ts +169 -10
- package/dist/react.js +441 -428
- package/dist/testing.cjs +1 -1
- package/dist/testing.d.cts +149 -4
- package/dist/testing.d.ts +149 -4
- package/dist/testing.js +1 -1
- package/dist/vue.cjs +1 -1
- package/dist/vue.d.cts +162 -5
- package/dist/vue.d.ts +162 -5
- package/dist/vue.js +22 -21
- package/dist/widget.cjs +3 -3
- package/dist/widget.d.cts +149 -4
- package/dist/widget.d.ts +149 -4
- package/dist/widget.js +120 -120
- package/llms-full.txt +1910 -0
- package/package.json +5 -3
- package/dist/AgoClient-CRAnT4qE.cjs +0 -8
- package/dist/createMockClient-ucPENDzz.cjs +0 -1
package/dist/angular.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./AgoClient-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./AgoClient-CLmtYTJx.cjs");var n=class{constructor(e){this.client=new o.AgoClient(e),this.messages$=this.fromEvent("message:complete"),this.chunks$=this.fromEvent("message:chunk"),this.errors$=this.fromEvent("message:error"),this.messageStart$=this.fromEvent("message:start")}fromEvent(e){const t=this.client;return{subscribe(i){const s=r=>{i.next?.(r)};return t.on(e,s),{unsubscribe:()=>t.off(e,s)}}}}sendMessage(e,t){return this.client.sendMessage(e,t)}getConversations(){return this.client.getConversations()}getConversation(e){return this.client.getConversation(e)}getMessages(e){return this.client.getMessages(e)}submitToolCallForm(e,t){return this.client.submitToolCallForm(e,t)}confirmToolCall(e){return this.client.confirmToolCall(e)}rejectToolCall(e){return this.client.rejectToolCall(e)}submitFeedback(e,t){return this.client.submitFeedback(e,t)}registerFunction(e,t,i){typeof e=="object"?this.client.registerFunction(e):this.client.registerFunction(e,t,i)}unregisterFunction(e){return this.client.unregisterFunction(e)}registerNavigationFunction(e,t){this.client.registerNavigationFunction(e,t)}unregisterNavigationFunction(){this.client.unregisterNavigationFunction()}registerPageStateFunction(e,t){this.client.registerPageStateFunction(e,t)}unregisterPageStateFunction(e){this.client.unregisterPageStateFunction(e)}on(e,t){this.client.on(e,t)}off(e,t){this.client.off(e,t)}updateConfig(e){this.client.updateConfig(e)}getClient(){return this.client}destroy(){this.client.destroy()}};function c(e){return{provide:n,useValue:new n(e)}}exports.AgoService=n;exports.provideAgo=c;
|
package/dist/angular.d.cts
CHANGED
|
@@ -39,12 +39,45 @@ declare class AgoClient {
|
|
|
39
39
|
private config;
|
|
40
40
|
/** Conversations already warned about an empty reply (one warning each). */
|
|
41
41
|
private warnedEmptyConversations;
|
|
42
|
+
/** Paused turns awaiting auto-resume, keyed by assistant message id. */
|
|
43
|
+
private pendingResumes;
|
|
44
|
+
/** App-provided gate deciding WHEN a paused turn resumes (see {@link registerResumeGate}). */
|
|
45
|
+
private resumeGate;
|
|
42
46
|
constructor(config: AgoConfig);
|
|
43
47
|
/**
|
|
44
48
|
* Send a message and receive a streaming response
|
|
45
49
|
*/
|
|
46
50
|
sendMessage(content: string, options?: SendMessageOptions): Promise<AgoMessage>;
|
|
47
51
|
private processSSEResponse;
|
|
52
|
+
private resolveClientFunctionsMode;
|
|
53
|
+
/**
|
|
54
|
+
* Register a gate deciding WHEN a paused turn resumes. The SDK still decides
|
|
55
|
+
* *whether* (it resumes once every waiting result is submitted); the gate only
|
|
56
|
+
* delays the continue call — e.g. `useAgoAutoContinueAfterNavigation` waits for
|
|
57
|
+
* the destination page to register its page state. One gate at a time (last
|
|
58
|
+
* registration wins). Returns an unregister function.
|
|
59
|
+
*/
|
|
60
|
+
registerResumeGate(gate: ResumeGate): () => void;
|
|
61
|
+
/**
|
|
62
|
+
* Resume a turn paused on client function results (`WAITING_CLIENT`).
|
|
63
|
+
*
|
|
64
|
+
* Sends the CURRENT page's registered functions and context — the page may
|
|
65
|
+
* have changed since the pause (that's the point of pausing on a navigation) —
|
|
66
|
+
* and streams the continuation through the same event pipeline as
|
|
67
|
+
* `sendMessage`, so `message:chunk` / `message:complete` (or another
|
|
68
|
+
* `message:waiting-client` for chained pauses) fire as usual.
|
|
69
|
+
*
|
|
70
|
+
* The SDK calls this automatically after submitting the waiting results; call
|
|
71
|
+
* it manually only for custom flows (e.g. after restoring a reloaded page via
|
|
72
|
+
* {@link resumePendingClientFunctions}).
|
|
73
|
+
*/
|
|
74
|
+
continueMessage(messageId: string): Promise<AgoMessage>;
|
|
75
|
+
/**
|
|
76
|
+
* Record one of the two auto-resume preconditions for a paused turn and fire
|
|
77
|
+
* the resume when both are in (see {@link PendingResume}).
|
|
78
|
+
*/
|
|
79
|
+
private markResumeSignal;
|
|
80
|
+
private runAutoResume;
|
|
48
81
|
/**
|
|
49
82
|
* Detect a reply that completed as DONE with no content and no activity —
|
|
50
83
|
* today's backend answers an unknown `agent` slug with an empty 200, which
|
|
@@ -77,9 +110,25 @@ declare class AgoClient {
|
|
|
77
110
|
*/
|
|
78
111
|
getMessages(conversationId: string): Promise<AgoMessage[]>;
|
|
79
112
|
/**
|
|
80
|
-
*
|
|
113
|
+
* Resume a turn left paused on client function results by a page reload.
|
|
114
|
+
*
|
|
115
|
+
* A paused turn (pause mode) survives a full reload: the backend keeps the
|
|
116
|
+
* assistant message in `WAITING_CLIENT` with its waiting tool calls. After
|
|
117
|
+
* restoring the conversation (`getConversation`) and re-registering the page's
|
|
118
|
+
* functions, call this: it re-executes each waiting client function through the
|
|
119
|
+
* registry, submits the results, and continues the turn.
|
|
120
|
+
*
|
|
121
|
+
* Opt-in on purpose — re-running functions on reload can be surprising (e.g. a
|
|
122
|
+
* navigation function would navigate again), so the app decides. Returns the
|
|
123
|
+
* resumed turn's final message, or `null` when there was nothing to resume or
|
|
124
|
+
* some waiting function is not registered on this page.
|
|
81
125
|
*/
|
|
82
|
-
|
|
126
|
+
resumePendingClientFunctions(conversation: Conversation): Promise<AgoMessage | null>;
|
|
127
|
+
/**
|
|
128
|
+
* Submit form data for a tool call. The response's `resume` field (pause mode
|
|
129
|
+
* only) tells whether the paused turn is ready to be resumed.
|
|
130
|
+
*/
|
|
131
|
+
submitToolCallForm(toolCallId: string, formData: Record<string, unknown>): Promise<SubmitToolCallResult>;
|
|
83
132
|
/**
|
|
84
133
|
* Confirm a tool call
|
|
85
134
|
*/
|
|
@@ -126,7 +175,7 @@ declare class AgoClient {
|
|
|
126
175
|
* ```
|
|
127
176
|
*/
|
|
128
177
|
registerFunction(definition: ClientFunctionDefinition): void;
|
|
129
|
-
registerFunction(name: string, handler: ClientFunctionHandler, schema:
|
|
178
|
+
registerFunction(name: string, handler: ClientFunctionHandler, schema: ClientFunctionRegisterOptions): void;
|
|
130
179
|
/**
|
|
131
180
|
* Short alias for `registerFunction`. Also accepts an array of definitions.
|
|
132
181
|
*
|
|
@@ -152,6 +201,12 @@ declare class AgoClient {
|
|
|
152
201
|
* the agent know *where* it is after it navigates (e.g. so auto-continuation
|
|
153
202
|
* can apply page state on the destination), not just how to navigate away.
|
|
154
203
|
*
|
|
204
|
+
* Routes may contain `:param` placeholders (`/users/:id`). Each distinct
|
|
205
|
+
* placeholder becomes a top-level string argument of `navigateToPage`
|
|
206
|
+
* (`{ page: "userDetail", id: "42" }`), so one route covers every detail
|
|
207
|
+
* page of an entity. Flat arguments only: nested object parameters are not
|
|
208
|
+
* reliably rendered to the model, so placeholders must not be named `page`.
|
|
209
|
+
*
|
|
155
210
|
* @param navigate - A callback that performs the navigation (e.g. react-router's navigate)
|
|
156
211
|
* @param routes - Map of route names to paths, with descriptions for the LLM
|
|
157
212
|
*/
|
|
@@ -319,6 +374,19 @@ export declare interface AgoClientEvents {
|
|
|
319
374
|
*/
|
|
320
375
|
"message:answer-complete": AgoMessage;
|
|
321
376
|
"message:complete": AgoMessage;
|
|
377
|
+
/**
|
|
378
|
+
* The turn paused on client function call(s) (pause mode): the stream closed
|
|
379
|
+
* with status `WAITING_CLIENT` instead of `DONE`. `message:complete` does NOT
|
|
380
|
+
* fire for this stream — it fires when the resumed turn concludes, so one
|
|
381
|
+
* logical turn still emits exactly one `message:complete`. The SDK submits the
|
|
382
|
+
* function results and resumes automatically; listen to this to know the agent
|
|
383
|
+
* is waiting on the page (e.g. to keep a "working…" indicator up).
|
|
384
|
+
*/
|
|
385
|
+
"message:waiting-client": {
|
|
386
|
+
conversationId: string;
|
|
387
|
+
messageId: string;
|
|
388
|
+
waitingToolCallIds: string[];
|
|
389
|
+
};
|
|
322
390
|
/**
|
|
323
391
|
* A reply finished as `DONE` with empty content and no tool calls, client
|
|
324
392
|
* functions, or follow-up replies — usually an unknown `agent` slug (the
|
|
@@ -406,6 +474,24 @@ export declare interface AgoConfig {
|
|
|
406
474
|
* event fires regardless of this setting.
|
|
407
475
|
*/
|
|
408
476
|
warnOnEmptyReply?: boolean;
|
|
477
|
+
/**
|
|
478
|
+
* How the agent loop treats client function calls (requires backend support):
|
|
479
|
+
* - `"placeholder"` (default): the turn continues immediately on a placeholder
|
|
480
|
+
* result; the real result is only visible to the agent on later turns.
|
|
481
|
+
* - `"pause"`: the turn stops on client function call(s) with status
|
|
482
|
+
* `WAITING_CLIENT`; once every result is submitted, the SDK resumes the SAME
|
|
483
|
+
* turn via `POST /messages/{id}/continue`, so the agent sees the real results.
|
|
484
|
+
* Older backends ignore the flag, so `"pause"` degrades to legacy behavior.
|
|
485
|
+
*/
|
|
486
|
+
clientFunctionsMode?: ClientFunctionsMode;
|
|
487
|
+
/**
|
|
488
|
+
* Max serialized size (bytes) of a client function result before the SDK
|
|
489
|
+
* replaces it with a flagged, truncated preview. Everything a handler
|
|
490
|
+
* returns is sent into the LLM context, so this caps runaway payloads
|
|
491
|
+
* (raw API responses, full tables). Default `50000`. Override per function
|
|
492
|
+
* with `maxResultBytes` on its definition; `Infinity` disables the guard.
|
|
493
|
+
*/
|
|
494
|
+
maxFunctionResultBytes?: number;
|
|
409
495
|
}
|
|
410
496
|
|
|
411
497
|
declare type AgoEventHandler<K extends AgoEventName> = (data: AgoClientEvents[K]) => void;
|
|
@@ -503,7 +589,7 @@ export declare class AgoService {
|
|
|
503
589
|
/** Get messages for a conversation */
|
|
504
590
|
getMessages(conversationId: string): Promise<AgoMessage[]>;
|
|
505
591
|
/** Submit form data for a tool call */
|
|
506
|
-
submitToolCallForm(toolCallId: string, formData: Record<string, unknown>): Promise<
|
|
592
|
+
submitToolCallForm(toolCallId: string, formData: Record<string, unknown>): Promise<SubmitToolCallResult>;
|
|
507
593
|
/** Confirm a tool call */
|
|
508
594
|
confirmToolCall(toolCallId: string): Promise<void>;
|
|
509
595
|
/** Reject a tool call */
|
|
@@ -512,7 +598,7 @@ export declare class AgoService {
|
|
|
512
598
|
submitFeedback(messageId: string, rating: "positive" | "negative"): Promise<void>;
|
|
513
599
|
/** Register a client-side function */
|
|
514
600
|
registerFunction(definition: ClientFunctionDefinition): void;
|
|
515
|
-
registerFunction(name: string, handler: ClientFunctionHandler, schema:
|
|
601
|
+
registerFunction(name: string, handler: ClientFunctionHandler, schema: ClientFunctionRegisterOptions): void;
|
|
516
602
|
/** Unregister a client-side function */
|
|
517
603
|
unregisterFunction(name: string): boolean;
|
|
518
604
|
/** Register navigation routes */
|
|
@@ -592,6 +678,12 @@ declare interface ClientFunctionDefinition {
|
|
|
592
678
|
description: string;
|
|
593
679
|
parameters: ClientFunctionSchema["parameters"];
|
|
594
680
|
handler: ClientFunctionHandler;
|
|
681
|
+
/**
|
|
682
|
+
* Max serialized result size in bytes before the SDK truncates it to a
|
|
683
|
+
* flagged preview (default: `AgoConfig.maxFunctionResultBytes`, 50 000).
|
|
684
|
+
* `Infinity` disables the guard for this function.
|
|
685
|
+
*/
|
|
686
|
+
maxResultBytes?: number;
|
|
595
687
|
}
|
|
596
688
|
|
|
597
689
|
/**
|
|
@@ -606,6 +698,20 @@ declare interface ClientFunctionInvocation {
|
|
|
606
698
|
conversationId: string;
|
|
607
699
|
}
|
|
608
700
|
|
|
701
|
+
/**
|
|
702
|
+
* Schema-plus-settings object accepted when registering a function: the schema
|
|
703
|
+
* (minus `name`) and SDK-side options that are NOT sent to the backend.
|
|
704
|
+
*/
|
|
705
|
+
declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & {
|
|
706
|
+
/**
|
|
707
|
+
* Max serialized result size in bytes before the SDK truncates it to a
|
|
708
|
+
* flagged preview. Overrides the client-level default
|
|
709
|
+
* (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
|
|
710
|
+
* disables the guard for this function.
|
|
711
|
+
*/
|
|
712
|
+
maxResultBytes?: number;
|
|
713
|
+
};
|
|
714
|
+
|
|
609
715
|
/**
|
|
610
716
|
* Schema for a client-side function that AGO can call
|
|
611
717
|
*/
|
|
@@ -631,6 +737,9 @@ declare interface ClientFunctionSchema {
|
|
|
631
737
|
};
|
|
632
738
|
}
|
|
633
739
|
|
|
740
|
+
/** See {@link AgoConfig.clientFunctionsMode}. */
|
|
741
|
+
declare type ClientFunctionsMode = "placeholder" | "pause";
|
|
742
|
+
|
|
634
743
|
/**
|
|
635
744
|
* A single piece of context the client wants the LLM to know about.
|
|
636
745
|
*/
|
|
@@ -764,7 +873,13 @@ declare interface FormSchema {
|
|
|
764
873
|
required?: string[];
|
|
765
874
|
}
|
|
766
875
|
|
|
767
|
-
declare type MessageStatus = "IN_PROGRESS" | "DONE" | "ERROR" | "TODO" | "CANCELED"
|
|
876
|
+
declare type MessageStatus = "IN_PROGRESS" | "DONE" | "ERROR" | "TODO" | "CANCELED"
|
|
877
|
+
/**
|
|
878
|
+
* The turn paused on client function call(s) (pause mode): the agent waits for
|
|
879
|
+
* every waiting call to be submitted, then the turn resumes via
|
|
880
|
+
* `continueMessage`. Not a final state.
|
|
881
|
+
*/
|
|
882
|
+
| "WAITING_CLIENT";
|
|
768
883
|
|
|
769
884
|
declare interface Observable<T> {
|
|
770
885
|
subscribe(observer: {
|
|
@@ -799,6 +914,17 @@ export declare function provideAgo(options: AgoProvideOptions): {
|
|
|
799
914
|
useValue: AgoService;
|
|
800
915
|
};
|
|
801
916
|
|
|
917
|
+
/**
|
|
918
|
+
* Hook run before a paused turn is resumed, so the app controls WHEN the
|
|
919
|
+
* continuation fires (e.g. wait for the destination page to mount after a
|
|
920
|
+
* navigation). It must resolve — throwing or hanging blocks the resume; on
|
|
921
|
+
* timeout-style situations resolve anyway and let the agent conclude.
|
|
922
|
+
*/
|
|
923
|
+
declare type ResumeGate = (info: {
|
|
924
|
+
conversationId: string;
|
|
925
|
+
messageId: string;
|
|
926
|
+
}) => Promise<void> | void;
|
|
927
|
+
|
|
802
928
|
/**
|
|
803
929
|
* Options for sending a message
|
|
804
930
|
*/
|
|
@@ -816,6 +942,8 @@ declare interface SendMessageOptions {
|
|
|
816
942
|
* Requires backend support for the `hidden` flag; older backends ignore it.
|
|
817
943
|
*/
|
|
818
944
|
hidden?: boolean;
|
|
945
|
+
/** Per-message override of {@link AgoConfig.clientFunctionsMode}. */
|
|
946
|
+
clientFunctionsMode?: ClientFunctionsMode;
|
|
819
947
|
}
|
|
820
948
|
|
|
821
949
|
/**
|
|
@@ -857,6 +985,8 @@ declare interface SSEChunkData {
|
|
|
857
985
|
follow_up_replies?: string[];
|
|
858
986
|
satisfaction_feedback?: unknown;
|
|
859
987
|
ask_to_talk_to_human?: boolean;
|
|
988
|
+
/** Tool call ids still awaiting a client result, sent with the final `WAITING_CLIENT` event. */
|
|
989
|
+
waiting_tool_call_ids?: string[];
|
|
860
990
|
}
|
|
861
991
|
|
|
862
992
|
/**
|
|
@@ -881,6 +1011,21 @@ declare type SubmitConfig<V = Record<string, unknown>> = string | {
|
|
|
881
1011
|
destination?: string;
|
|
882
1012
|
} | false;
|
|
883
1013
|
|
|
1014
|
+
/**
|
|
1015
|
+
* Response of `POST /tool-calls/{id}/submit`. `resume` is only present when the
|
|
1016
|
+
* tool call belongs to a turn paused on client functions (pause mode): `ready`
|
|
1017
|
+
* flips to `true` once ALL waiting calls of that message are submitted, meaning
|
|
1018
|
+
* the turn can be resumed via `continueMessage(resume.message_id)`.
|
|
1019
|
+
*/
|
|
1020
|
+
declare interface SubmitToolCallResult {
|
|
1021
|
+
status: string;
|
|
1022
|
+
result?: unknown;
|
|
1023
|
+
resume?: {
|
|
1024
|
+
message_id: string;
|
|
1025
|
+
ready: boolean;
|
|
1026
|
+
};
|
|
1027
|
+
}
|
|
1028
|
+
|
|
884
1029
|
/**
|
|
885
1030
|
* Tool call data from SSE stream
|
|
886
1031
|
*/
|
package/dist/angular.d.ts
CHANGED
|
@@ -39,12 +39,45 @@ declare class AgoClient {
|
|
|
39
39
|
private config;
|
|
40
40
|
/** Conversations already warned about an empty reply (one warning each). */
|
|
41
41
|
private warnedEmptyConversations;
|
|
42
|
+
/** Paused turns awaiting auto-resume, keyed by assistant message id. */
|
|
43
|
+
private pendingResumes;
|
|
44
|
+
/** App-provided gate deciding WHEN a paused turn resumes (see {@link registerResumeGate}). */
|
|
45
|
+
private resumeGate;
|
|
42
46
|
constructor(config: AgoConfig);
|
|
43
47
|
/**
|
|
44
48
|
* Send a message and receive a streaming response
|
|
45
49
|
*/
|
|
46
50
|
sendMessage(content: string, options?: SendMessageOptions): Promise<AgoMessage>;
|
|
47
51
|
private processSSEResponse;
|
|
52
|
+
private resolveClientFunctionsMode;
|
|
53
|
+
/**
|
|
54
|
+
* Register a gate deciding WHEN a paused turn resumes. The SDK still decides
|
|
55
|
+
* *whether* (it resumes once every waiting result is submitted); the gate only
|
|
56
|
+
* delays the continue call — e.g. `useAgoAutoContinueAfterNavigation` waits for
|
|
57
|
+
* the destination page to register its page state. One gate at a time (last
|
|
58
|
+
* registration wins). Returns an unregister function.
|
|
59
|
+
*/
|
|
60
|
+
registerResumeGate(gate: ResumeGate): () => void;
|
|
61
|
+
/**
|
|
62
|
+
* Resume a turn paused on client function results (`WAITING_CLIENT`).
|
|
63
|
+
*
|
|
64
|
+
* Sends the CURRENT page's registered functions and context — the page may
|
|
65
|
+
* have changed since the pause (that's the point of pausing on a navigation) —
|
|
66
|
+
* and streams the continuation through the same event pipeline as
|
|
67
|
+
* `sendMessage`, so `message:chunk` / `message:complete` (or another
|
|
68
|
+
* `message:waiting-client` for chained pauses) fire as usual.
|
|
69
|
+
*
|
|
70
|
+
* The SDK calls this automatically after submitting the waiting results; call
|
|
71
|
+
* it manually only for custom flows (e.g. after restoring a reloaded page via
|
|
72
|
+
* {@link resumePendingClientFunctions}).
|
|
73
|
+
*/
|
|
74
|
+
continueMessage(messageId: string): Promise<AgoMessage>;
|
|
75
|
+
/**
|
|
76
|
+
* Record one of the two auto-resume preconditions for a paused turn and fire
|
|
77
|
+
* the resume when both are in (see {@link PendingResume}).
|
|
78
|
+
*/
|
|
79
|
+
private markResumeSignal;
|
|
80
|
+
private runAutoResume;
|
|
48
81
|
/**
|
|
49
82
|
* Detect a reply that completed as DONE with no content and no activity —
|
|
50
83
|
* today's backend answers an unknown `agent` slug with an empty 200, which
|
|
@@ -77,9 +110,25 @@ declare class AgoClient {
|
|
|
77
110
|
*/
|
|
78
111
|
getMessages(conversationId: string): Promise<AgoMessage[]>;
|
|
79
112
|
/**
|
|
80
|
-
*
|
|
113
|
+
* Resume a turn left paused on client function results by a page reload.
|
|
114
|
+
*
|
|
115
|
+
* A paused turn (pause mode) survives a full reload: the backend keeps the
|
|
116
|
+
* assistant message in `WAITING_CLIENT` with its waiting tool calls. After
|
|
117
|
+
* restoring the conversation (`getConversation`) and re-registering the page's
|
|
118
|
+
* functions, call this: it re-executes each waiting client function through the
|
|
119
|
+
* registry, submits the results, and continues the turn.
|
|
120
|
+
*
|
|
121
|
+
* Opt-in on purpose — re-running functions on reload can be surprising (e.g. a
|
|
122
|
+
* navigation function would navigate again), so the app decides. Returns the
|
|
123
|
+
* resumed turn's final message, or `null` when there was nothing to resume or
|
|
124
|
+
* some waiting function is not registered on this page.
|
|
81
125
|
*/
|
|
82
|
-
|
|
126
|
+
resumePendingClientFunctions(conversation: Conversation): Promise<AgoMessage | null>;
|
|
127
|
+
/**
|
|
128
|
+
* Submit form data for a tool call. The response's `resume` field (pause mode
|
|
129
|
+
* only) tells whether the paused turn is ready to be resumed.
|
|
130
|
+
*/
|
|
131
|
+
submitToolCallForm(toolCallId: string, formData: Record<string, unknown>): Promise<SubmitToolCallResult>;
|
|
83
132
|
/**
|
|
84
133
|
* Confirm a tool call
|
|
85
134
|
*/
|
|
@@ -126,7 +175,7 @@ declare class AgoClient {
|
|
|
126
175
|
* ```
|
|
127
176
|
*/
|
|
128
177
|
registerFunction(definition: ClientFunctionDefinition): void;
|
|
129
|
-
registerFunction(name: string, handler: ClientFunctionHandler, schema:
|
|
178
|
+
registerFunction(name: string, handler: ClientFunctionHandler, schema: ClientFunctionRegisterOptions): void;
|
|
130
179
|
/**
|
|
131
180
|
* Short alias for `registerFunction`. Also accepts an array of definitions.
|
|
132
181
|
*
|
|
@@ -152,6 +201,12 @@ declare class AgoClient {
|
|
|
152
201
|
* the agent know *where* it is after it navigates (e.g. so auto-continuation
|
|
153
202
|
* can apply page state on the destination), not just how to navigate away.
|
|
154
203
|
*
|
|
204
|
+
* Routes may contain `:param` placeholders (`/users/:id`). Each distinct
|
|
205
|
+
* placeholder becomes a top-level string argument of `navigateToPage`
|
|
206
|
+
* (`{ page: "userDetail", id: "42" }`), so one route covers every detail
|
|
207
|
+
* page of an entity. Flat arguments only: nested object parameters are not
|
|
208
|
+
* reliably rendered to the model, so placeholders must not be named `page`.
|
|
209
|
+
*
|
|
155
210
|
* @param navigate - A callback that performs the navigation (e.g. react-router's navigate)
|
|
156
211
|
* @param routes - Map of route names to paths, with descriptions for the LLM
|
|
157
212
|
*/
|
|
@@ -319,6 +374,19 @@ export declare interface AgoClientEvents {
|
|
|
319
374
|
*/
|
|
320
375
|
"message:answer-complete": AgoMessage;
|
|
321
376
|
"message:complete": AgoMessage;
|
|
377
|
+
/**
|
|
378
|
+
* The turn paused on client function call(s) (pause mode): the stream closed
|
|
379
|
+
* with status `WAITING_CLIENT` instead of `DONE`. `message:complete` does NOT
|
|
380
|
+
* fire for this stream — it fires when the resumed turn concludes, so one
|
|
381
|
+
* logical turn still emits exactly one `message:complete`. The SDK submits the
|
|
382
|
+
* function results and resumes automatically; listen to this to know the agent
|
|
383
|
+
* is waiting on the page (e.g. to keep a "working…" indicator up).
|
|
384
|
+
*/
|
|
385
|
+
"message:waiting-client": {
|
|
386
|
+
conversationId: string;
|
|
387
|
+
messageId: string;
|
|
388
|
+
waitingToolCallIds: string[];
|
|
389
|
+
};
|
|
322
390
|
/**
|
|
323
391
|
* A reply finished as `DONE` with empty content and no tool calls, client
|
|
324
392
|
* functions, or follow-up replies — usually an unknown `agent` slug (the
|
|
@@ -406,6 +474,24 @@ export declare interface AgoConfig {
|
|
|
406
474
|
* event fires regardless of this setting.
|
|
407
475
|
*/
|
|
408
476
|
warnOnEmptyReply?: boolean;
|
|
477
|
+
/**
|
|
478
|
+
* How the agent loop treats client function calls (requires backend support):
|
|
479
|
+
* - `"placeholder"` (default): the turn continues immediately on a placeholder
|
|
480
|
+
* result; the real result is only visible to the agent on later turns.
|
|
481
|
+
* - `"pause"`: the turn stops on client function call(s) with status
|
|
482
|
+
* `WAITING_CLIENT`; once every result is submitted, the SDK resumes the SAME
|
|
483
|
+
* turn via `POST /messages/{id}/continue`, so the agent sees the real results.
|
|
484
|
+
* Older backends ignore the flag, so `"pause"` degrades to legacy behavior.
|
|
485
|
+
*/
|
|
486
|
+
clientFunctionsMode?: ClientFunctionsMode;
|
|
487
|
+
/**
|
|
488
|
+
* Max serialized size (bytes) of a client function result before the SDK
|
|
489
|
+
* replaces it with a flagged, truncated preview. Everything a handler
|
|
490
|
+
* returns is sent into the LLM context, so this caps runaway payloads
|
|
491
|
+
* (raw API responses, full tables). Default `50000`. Override per function
|
|
492
|
+
* with `maxResultBytes` on its definition; `Infinity` disables the guard.
|
|
493
|
+
*/
|
|
494
|
+
maxFunctionResultBytes?: number;
|
|
409
495
|
}
|
|
410
496
|
|
|
411
497
|
declare type AgoEventHandler<K extends AgoEventName> = (data: AgoClientEvents[K]) => void;
|
|
@@ -503,7 +589,7 @@ export declare class AgoService {
|
|
|
503
589
|
/** Get messages for a conversation */
|
|
504
590
|
getMessages(conversationId: string): Promise<AgoMessage[]>;
|
|
505
591
|
/** Submit form data for a tool call */
|
|
506
|
-
submitToolCallForm(toolCallId: string, formData: Record<string, unknown>): Promise<
|
|
592
|
+
submitToolCallForm(toolCallId: string, formData: Record<string, unknown>): Promise<SubmitToolCallResult>;
|
|
507
593
|
/** Confirm a tool call */
|
|
508
594
|
confirmToolCall(toolCallId: string): Promise<void>;
|
|
509
595
|
/** Reject a tool call */
|
|
@@ -512,7 +598,7 @@ export declare class AgoService {
|
|
|
512
598
|
submitFeedback(messageId: string, rating: "positive" | "negative"): Promise<void>;
|
|
513
599
|
/** Register a client-side function */
|
|
514
600
|
registerFunction(definition: ClientFunctionDefinition): void;
|
|
515
|
-
registerFunction(name: string, handler: ClientFunctionHandler, schema:
|
|
601
|
+
registerFunction(name: string, handler: ClientFunctionHandler, schema: ClientFunctionRegisterOptions): void;
|
|
516
602
|
/** Unregister a client-side function */
|
|
517
603
|
unregisterFunction(name: string): boolean;
|
|
518
604
|
/** Register navigation routes */
|
|
@@ -592,6 +678,12 @@ declare interface ClientFunctionDefinition {
|
|
|
592
678
|
description: string;
|
|
593
679
|
parameters: ClientFunctionSchema["parameters"];
|
|
594
680
|
handler: ClientFunctionHandler;
|
|
681
|
+
/**
|
|
682
|
+
* Max serialized result size in bytes before the SDK truncates it to a
|
|
683
|
+
* flagged preview (default: `AgoConfig.maxFunctionResultBytes`, 50 000).
|
|
684
|
+
* `Infinity` disables the guard for this function.
|
|
685
|
+
*/
|
|
686
|
+
maxResultBytes?: number;
|
|
595
687
|
}
|
|
596
688
|
|
|
597
689
|
/**
|
|
@@ -606,6 +698,20 @@ declare interface ClientFunctionInvocation {
|
|
|
606
698
|
conversationId: string;
|
|
607
699
|
}
|
|
608
700
|
|
|
701
|
+
/**
|
|
702
|
+
* Schema-plus-settings object accepted when registering a function: the schema
|
|
703
|
+
* (minus `name`) and SDK-side options that are NOT sent to the backend.
|
|
704
|
+
*/
|
|
705
|
+
declare type ClientFunctionRegisterOptions = Omit<ClientFunctionSchema, "name"> & {
|
|
706
|
+
/**
|
|
707
|
+
* Max serialized result size in bytes before the SDK truncates it to a
|
|
708
|
+
* flagged preview. Overrides the client-level default
|
|
709
|
+
* (`AgoConfig.maxFunctionResultBytes`, 50 000 by default). `Infinity`
|
|
710
|
+
* disables the guard for this function.
|
|
711
|
+
*/
|
|
712
|
+
maxResultBytes?: number;
|
|
713
|
+
};
|
|
714
|
+
|
|
609
715
|
/**
|
|
610
716
|
* Schema for a client-side function that AGO can call
|
|
611
717
|
*/
|
|
@@ -631,6 +737,9 @@ declare interface ClientFunctionSchema {
|
|
|
631
737
|
};
|
|
632
738
|
}
|
|
633
739
|
|
|
740
|
+
/** See {@link AgoConfig.clientFunctionsMode}. */
|
|
741
|
+
declare type ClientFunctionsMode = "placeholder" | "pause";
|
|
742
|
+
|
|
634
743
|
/**
|
|
635
744
|
* A single piece of context the client wants the LLM to know about.
|
|
636
745
|
*/
|
|
@@ -764,7 +873,13 @@ declare interface FormSchema {
|
|
|
764
873
|
required?: string[];
|
|
765
874
|
}
|
|
766
875
|
|
|
767
|
-
declare type MessageStatus = "IN_PROGRESS" | "DONE" | "ERROR" | "TODO" | "CANCELED"
|
|
876
|
+
declare type MessageStatus = "IN_PROGRESS" | "DONE" | "ERROR" | "TODO" | "CANCELED"
|
|
877
|
+
/**
|
|
878
|
+
* The turn paused on client function call(s) (pause mode): the agent waits for
|
|
879
|
+
* every waiting call to be submitted, then the turn resumes via
|
|
880
|
+
* `continueMessage`. Not a final state.
|
|
881
|
+
*/
|
|
882
|
+
| "WAITING_CLIENT";
|
|
768
883
|
|
|
769
884
|
declare interface Observable<T> {
|
|
770
885
|
subscribe(observer: {
|
|
@@ -799,6 +914,17 @@ export declare function provideAgo(options: AgoProvideOptions): {
|
|
|
799
914
|
useValue: AgoService;
|
|
800
915
|
};
|
|
801
916
|
|
|
917
|
+
/**
|
|
918
|
+
* Hook run before a paused turn is resumed, so the app controls WHEN the
|
|
919
|
+
* continuation fires (e.g. wait for the destination page to mount after a
|
|
920
|
+
* navigation). It must resolve — throwing or hanging blocks the resume; on
|
|
921
|
+
* timeout-style situations resolve anyway and let the agent conclude.
|
|
922
|
+
*/
|
|
923
|
+
declare type ResumeGate = (info: {
|
|
924
|
+
conversationId: string;
|
|
925
|
+
messageId: string;
|
|
926
|
+
}) => Promise<void> | void;
|
|
927
|
+
|
|
802
928
|
/**
|
|
803
929
|
* Options for sending a message
|
|
804
930
|
*/
|
|
@@ -816,6 +942,8 @@ declare interface SendMessageOptions {
|
|
|
816
942
|
* Requires backend support for the `hidden` flag; older backends ignore it.
|
|
817
943
|
*/
|
|
818
944
|
hidden?: boolean;
|
|
945
|
+
/** Per-message override of {@link AgoConfig.clientFunctionsMode}. */
|
|
946
|
+
clientFunctionsMode?: ClientFunctionsMode;
|
|
819
947
|
}
|
|
820
948
|
|
|
821
949
|
/**
|
|
@@ -857,6 +985,8 @@ declare interface SSEChunkData {
|
|
|
857
985
|
follow_up_replies?: string[];
|
|
858
986
|
satisfaction_feedback?: unknown;
|
|
859
987
|
ask_to_talk_to_human?: boolean;
|
|
988
|
+
/** Tool call ids still awaiting a client result, sent with the final `WAITING_CLIENT` event. */
|
|
989
|
+
waiting_tool_call_ids?: string[];
|
|
860
990
|
}
|
|
861
991
|
|
|
862
992
|
/**
|
|
@@ -881,6 +1011,21 @@ declare type SubmitConfig<V = Record<string, unknown>> = string | {
|
|
|
881
1011
|
destination?: string;
|
|
882
1012
|
} | false;
|
|
883
1013
|
|
|
1014
|
+
/**
|
|
1015
|
+
* Response of `POST /tool-calls/{id}/submit`. `resume` is only present when the
|
|
1016
|
+
* tool call belongs to a turn paused on client functions (pause mode): `ready`
|
|
1017
|
+
* flips to `true` once ALL waiting calls of that message are submitted, meaning
|
|
1018
|
+
* the turn can be resumed via `continueMessage(resume.message_id)`.
|
|
1019
|
+
*/
|
|
1020
|
+
declare interface SubmitToolCallResult {
|
|
1021
|
+
status: string;
|
|
1022
|
+
result?: unknown;
|
|
1023
|
+
resume?: {
|
|
1024
|
+
message_id: string;
|
|
1025
|
+
ready: boolean;
|
|
1026
|
+
};
|
|
1027
|
+
}
|
|
1028
|
+
|
|
884
1029
|
/**
|
|
885
1030
|
* Tool call data from SSE stream
|
|
886
1031
|
*/
|
package/dist/angular.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as o } from "./AgoClient-
|
|
1
|
+
import { t as o } from "./AgoClient-Ozz2b1dQ.js";
|
|
2
2
|
var s = class {
|
|
3
3
|
constructor(t) {
|
|
4
4
|
this.client = new o(t), this.messages$ = this.fromEvent("message:complete"), this.chunks$ = this.fromEvent("message:chunk"), this.errors$ = this.fromEvent("message:error"), this.messageStart$ = this.fromEvent("message:start");
|
package/dist/{createConversationSession-B8zfTL78.cjs → createConversationSession-CUkNp6mZ.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
const d=require("./createFormCollector-
|
|
1
|
+
const d=require("./createFormCollector-DHT1ObOb.cjs");var f="ago_widget_id",g="ago_last_thread",y=7200*1e3;function v(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const r=Math.floor(Math.random()*16);return(e==="x"?r:r&3|8).toString(16)})}function _(e={}){const r=e.key??f,i=e.threadKey??g,u=e.ttlMs??y,l=e.storage??(typeof localStorage<"u"?localStorage:void 0);let n=e.widgetId??"";if(!n&&l)try{n=l.getItem(r)??""}catch{}if(n||(n=v()),l)try{l.setItem(r,n)}catch{}const o=d.createStore({value:null,lastMessageAt:null},{key:i,storage:l}),c=o.get();c.value!==null&&s(c.lastMessageAt)&&o.set({value:null,lastMessageAt:null});function s(t){return t===null?!0:Number.isFinite(u)?Date.now()-t>u:!1}return{widgetId:n,key:r,getLastActiveThread(){const{value:t,lastMessageAt:a}=o.get();return t===null||s(a)?null:t},setActiveThread(t,a){const x=a==null?null:a instanceof Date?a.getTime():a;o.set({value:t,lastMessageAt:x})},clear(){o.set({value:null,lastMessageAt:null})}}}Object.defineProperty(exports,"createConversationSession",{enumerable:!0,get:function(){return _}});
|
package/dist/{createConversationSession-CWpf4u6I.js → createConversationSession-QIBN0gLx.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as d } from "./createFormCollector-
|
|
1
|
+
import { i as d } from "./createFormCollector-F3YJfsbg.js";
|
|
2
2
|
var f = "ago_widget_id", g = "ago_last_thread", y = 7200 * 1e3;
|
|
3
3
|
function v() {
|
|
4
4
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const C=require("./AgoClient-
|
|
1
|
+
const C=require("./AgoClient-CLmtYTJx.cjs");function W(n,e){const a=e?e.storage??(typeof localStorage<"u"?localStorage:void 0):void 0;let s=n;if(e&&a)try{const m=a.getItem(e.key);m!=null&&(s=JSON.parse(m))}catch{}const i=new Set,c=()=>i.forEach(m=>m(s));function b(){if(e&&a)try{a.setItem(e.key,JSON.stringify(s))}catch{}}return{get:()=>s,set:m=>{s=m,b(),c()},subscribe:m=>(i.add(m),()=>{i.delete(m)})}}var T=/^[a-zA-Z0-9_-]{1,40}$/,x=n=>n==null||n==="";function v(n,e){if("anyOf"in n)return n.anyOf.some(c=>v(c,e));if("allOf"in n)return n.allOf.every(c=>v(c,e));const a=e[n.property];if(x(a))return!1;if(Array.isArray(n.value))return n.value.some(c=>String(a)===String(c));if(!n.op)return String(a)===String(n.value);const s=Number(a),i=Number(n.value);if(Number.isNaN(s)||Number.isNaN(i))return!1;switch(n.op){case">=":return s>=i;case"<=":return s<=i;case">":return s>i;case"<":return s<i;default:return C.logger.warn(`Unknown requiredWhen op "${n.op}"; treating as not required.`),!1}}function h(n,e){const a=n.properties??{},s=new Set;for(const c of n.required??[]){const b=a[c]?.requiredWhen;(!b||v(b,e))&&s.add(c)}for(const[c,b]of Object.entries(a))b.requiredWhen&&v(b.requiredWhen,e)&&s.add(c);const i=[...s].filter(c=>x(e[c]));return{missing:i,complete:i.length===0}}function R(n){const e={};for(const[a,s]of Object.entries(n.properties??{}))e[a]={type:s.type,...s.description!=null&&{description:s.description},...s.enum&&{enum:s.enum},...s.default!==void 0&&{default:s.default}};return{type:"object",properties:e,required:[]}}function A(n){const{name:e,description:a,schema:s}=n;if(!T.test(e))throw new Error(`Invalid form collector name "${e}": must match ${T} (it becomes the update_/submit_ function names).`);const i=typeof n.submit=="string"?n.submit?{via:"client",url:n.submit}:!1:n.submit??!1;n.autoSubmit===!0&&!i&&C.logger.warn(`FormCollector "${e}": autoSubmit is ignored because no submit target is configured.`);const c=(n.autoSubmit??!0)&&!!i,b=s.properties??{},m=t=>{const r={};for(const[u,o]of Object.entries(t)){const l=b[u];if(l)if(o==null)r[u]=o;else if(l.type==="number"||l.type==="integer"){const d=typeof o=="number"?o:Number(o);r[u]=Number.isNaN(d)?o:d}else l.type==="boolean"?r[u]=typeof o=="boolean"?o:o==="true"?!0:o==="false"?!1:!!o:r[u]=o}return r},S=n.initialValues??{},f=W({values:S,submitted:!1}),$=t=>{const r=f.get(),u={...r,values:{...r.values,...t}};return f.set(u),u};let g=null;const F=(t,r)=>{g?.emitFormEvent("form:error",{name:e,values:t,error:r})};let y=null;const I=async()=>{const{values:t}=f.get(),{complete:r,missing:u}=h(s,t);if(!r)return{ok:!1,missing:u};if(!i)return{ok:!1,error:"No submit target configured for this form collector."};const o=t;try{let l;if(i.via==="client")if("handler"in i)l=await i.handler(o);else{const d=await fetch(i.url,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(o)});if(!d.ok){const j=`Submit failed: HTTP ${d.status}`;return F(o,j),{ok:!1,error:j}}l=await d.json().catch(()=>{})}else{if(!g)return{ok:!1,error:"Backend submit requires install(client) (or useFormCollector) first."};l=await g.submitFormCollector(e,o)}return f.set({...f.get(),submitted:!0,submitResult:l}),g?.emitFormEvent("form:submitted",{name:e,values:o,result:l}),{ok:!0,result:l}}catch(l){const d=l instanceof Error?l.message:"Submit failed";return C.logger.error(`FormCollector "${e}" submit failed:`,l),F(o,d),{ok:!1,error:d}}},N=()=>y||(y=(async()=>{try{return await I()}finally{y=null}})(),y),k=async()=>{if(!c||!i)return null;const{values:t,submitted:r}=f.get();return r||!h(s,t).complete?null:N()},O={name:`update_${e}`,description:`Fill or update fields of the "${e}" form. ${a} Pass any subset of fields; call it repeatedly to fill the form as the user provides information. Returns the current values and which required fields are still missing.`,parameters:R(s),handler:async t=>{const r=$(m(t)),{missing:u}=h(s,r.values),o=await k();return o?o.ok?{ok:!0,values:r.values,missing:u,submitted:!0}:{ok:!0,values:r.values,missing:u,submitted:!1,submitError:o.error}:{ok:!0,values:r.values,missing:u}}},p=[O];i&&!c&&p.push({name:`submit_${e}`,description:`Submit the completed "${e}" form. Only call this once every required field is collected and the user has confirmed. If fields are missing it returns them instead of submitting.`,parameters:{type:"object",properties:{}},handler:()=>N()});const V="client__",q=i?`submit_${e}`:null,J=t=>{const r=t.functionName??t.toolName;if(r)return r.startsWith(V)?r.slice(8):r},_=t=>{let r={...S},u=!1;for(const o of t){const l=J(o);l===O.name?o.arguments&&(r={...r,...m(o.arguments)}):q&&l===q&&o.status?.toLowerCase()==="done"&&(u=!0)}f.set({values:r,submitted:u})},w=`form:${e}`,E=()=>{const{values:t,submitted:r}=f.get(),{missing:u,complete:o}=h(s,t),l=i?c?" The form is submitted automatically as soon as every required field is filled, so there is no submit function to call.":` When nothing is missing and the user confirms, call submit_${e}.`:"",d=r?`The "${e}" form has been submitted.`:`You are currently collecting information from the user to fill the "${e}" form.`;return{name:`Form: ${e}`,description:`${d} ${a} Some fields are conditionally required; the requiredWhen field in the schema tells you when each becomes required. The form schema is the following: ${JSON.stringify(s)}. Data collected so far: ${JSON.stringify(t)}. Call update_${e} with any fields the user provides; ask only for what is still missing.${l}`,data:{values:t,missing:u,complete:o,submitted:r}}},P=t=>{_((t.messages??[]).flatMap(r=>r.toolCalls??[]))};return{name:e,store:f,functions:p,contextKey:w,contextProvider:E,install:t=>{g=t;for(const u of p)t.register(u);t.addDynamicContext(w,E);const r=f.subscribe(()=>t.notifyContextChanged());return t.on("conversation:loaded",P),()=>{r();for(const u of p)t.unregisterFunction(u.name);t.removeDynamicContext(w),t.off("conversation:loaded",P),g===t&&(g=null)}},hydrate:_,submit:N,getValues:()=>f.get().values,setValues:t=>{$(m(t)),k()},reset:()=>{f.set({values:S,submitted:!1})},getStatus:()=>h(s,f.get().values)}}async function B(n,e){const a=await n.getFormCollector(e.name);return A({name:a.name,description:e.description??a.description,schema:e.schema??a.schema,submit:e.submit??a.submit,initialValues:e.initialValues,autoSubmit:e.autoSubmit??a.autoSubmit})}Object.defineProperty(exports,"createFormCollector",{enumerable:!0,get:function(){return A}});Object.defineProperty(exports,"createStore",{enumerable:!0,get:function(){return W}});Object.defineProperty(exports,"deriveFormStatus",{enumerable:!0,get:function(){return h}});Object.defineProperty(exports,"loadFormCollector",{enumerable:!0,get:function(){return B}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function y(u={}){const{overrides:g={}}=u,a={id:"mock-msg-1",conversationId:"mock-conv-1",content:"Mock response",role:"assistant",status:"DONE",createdAt:new Date},l={id:"mock-conv-1",title:"Mock Conversation",lastMessageDate:new Date},t=new Map,r=[],m={sendMessage:async()=>a,continueMessage:async()=>a,resumePendingClientFunctions:async()=>null,registerResumeGate:()=>()=>{},getConversations:async()=>[l],getConversation:async()=>l,getMessages:async()=>[a],submitToolCallForm:async()=>({status:"completed"}),confirmToolCall:async()=>{},rejectToolCall:async()=>{},submitFeedback:async()=>{},registerFunction:()=>{},unregisterFunction:()=>!0,getRegisteredFunctions:()=>[],getContextSnapshot:()=>null,notifyContextChanged:()=>{},registerNavigationFunction:()=>{},unregisterNavigationFunction:()=>{},on:(e,o)=>{t.has(e)||t.set(e,new Set),t.get(e).add(o)},off:(e,o)=>{t.get(e)?.delete(o)},once:(e,o)=>{const n=(...i)=>{t.get(e)?.delete(n),o(...i)};t.has(e)||t.set(e,new Set),t.get(e).add(n)},waitFor:(e,o)=>new Promise((n,i)=>{let c;const d=f=>{c&&clearTimeout(c),t.get(e)?.delete(d),n(f)};t.has(e)||t.set(e,new Set),t.get(e).add(d),o?.timeout&&(c=setTimeout(()=>{t.get(e)?.delete(d),i(new Error(`waitFor("${e}") timed out after ${o.timeout}ms`))},o.timeout))}),updateConfig:()=>{},destroy:()=>{t.clear()},...g},s={};for(const[e,o]of Object.entries(m))s[e]=(...n)=>(r.push({method:e,args:n}),o(...n));return s.__calls=r,s.__callsFor=e=>r.filter(o=>o.method===e),s.__emitEvent=(e,o)=>{const n=t.get(e);n&&[...n].forEach(i=>i(o))},s}Object.defineProperty(exports,"createMockClient",{enumerable:!0,get:function(){return y}});
|