@assistant-ui/react-langchain 0.0.31 → 0.0.33
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/dist/attachSubagentTranscripts.d.ts +19 -12
- package/dist/attachSubagentTranscripts.d.ts.map +1 -1
- package/dist/attachSubagentTranscripts.js +8 -4
- package/dist/attachSubagentTranscripts.js.map +1 -1
- package/dist/convertMessages.d.ts +8 -11
- package/dist/convertMessages.d.ts.map +1 -1
- package/dist/convertMessages.js +53 -15
- package/dist/convertMessages.js.map +1 -1
- package/dist/converter.d.ts +137 -138
- package/dist/converter.d.ts.map +1 -1
- package/dist/converter.js +2 -1
- package/dist/converter.js.map +1 -1
- package/dist/findForkCheckpointInHistory.d.ts +17 -19
- package/dist/findForkCheckpointInHistory.d.ts.map +1 -1
- package/dist/hooks.d.ts +19 -22
- package/dist/hooks.d.ts.map +1 -1
- package/dist/index.d.ts +7 -8
- package/dist/index.d.ts.map +1 -0
- package/dist/resolveForkCheckpoint.d.ts +5 -7
- package/dist/resolveForkCheckpoint.d.ts.map +1 -1
- package/dist/runtimeExtras.d.ts +2 -5
- package/dist/runtimeExtras.d.ts.map +1 -1
- package/dist/sdkIdentity.d.ts +2 -5
- package/dist/sdkIdentity.d.ts.map +1 -1
- package/dist/sdkIdentity.js +1 -1
- package/dist/streamingTiming.d.ts +4 -7
- package/dist/streamingTiming.d.ts.map +1 -1
- package/dist/subagentMessagesProjection.d.ts +17 -0
- package/dist/subagentMessagesProjection.d.ts.map +1 -0
- package/dist/subagentMessagesProjection.js +40 -0
- package/dist/subagentMessagesProjection.js.map +1 -0
- package/dist/types.d.ts +106 -109
- package/dist/types.d.ts.map +1 -1
- package/dist/uiMessages.d.ts +37 -10
- package/dist/uiMessages.d.ts.map +1 -1
- package/dist/uiMessages.js +55 -5
- package/dist/uiMessages.js.map +1 -1
- package/dist/useStreamRuntime.d.ts +9 -12
- package/dist/useStreamRuntime.d.ts.map +1 -1
- package/dist/useStreamRuntime.js +102 -28
- package/dist/useStreamRuntime.js.map +1 -1
- package/dist/useSubagentTranscripts.d.ts +5 -8
- package/dist/useSubagentTranscripts.d.ts.map +1 -1
- package/dist/useSubagentTranscripts.js +129 -34
- package/dist/useSubagentTranscripts.js.map +1 -1
- package/package.json +16 -11
- package/src/attachSubagentTranscripts.test.ts +13 -5
- package/src/attachSubagentTranscripts.ts +26 -7
- package/src/convertMessages.test.ts +69 -0
- package/src/convertMessages.ts +46 -8
- package/src/converter.ts +6 -0
- package/src/subagentMessagesProjection.test.ts +175 -0
- package/src/subagentMessagesProjection.ts +50 -0
- package/src/uiMessages.test.ts +149 -0
- package/src/uiMessages.ts +79 -4
- package/src/useStreamRuntime.test.tsx +212 -0
- package/src/useStreamRuntime.ts +202 -50
- package/src/useStreamRuntime.voice.test.tsx +712 -0
- package/src/useSubagentTranscripts.test.tsx +795 -52
- package/src/useSubagentTranscripts.ts +269 -50
package/dist/types.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
args: Record<string, unknown>;
|
|
1
|
+
import type { AttachmentAdapter, DictationAdapter, ExternalStoreSharedOptions, FeedbackAdapter, MessageStatus, RealtimeVoiceAdapter, RemoteThreadListAdapter, SpeechSynthesisAdapter } from "@assistant-ui/core";
|
|
2
|
+
import type { AssistantCloud } from "assistant-cloud";
|
|
3
|
+
import type { UseStreamOptions, AssembledToolCall, AnyStream, SubagentDiscoverySnapshot, SubgraphDiscoverySnapshot } from "@langchain/react";
|
|
4
|
+
export type { LangChainContentBlock } from "./converter.js";
|
|
5
|
+
export type LangChainToolCall = {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
args: Record<string, unknown>;
|
|
10
9
|
};
|
|
11
10
|
/**
|
|
12
11
|
* A generative UI component the graph accumulates in its state. Read from
|
|
@@ -15,28 +14,28 @@ type LangChainToolCall = {
|
|
|
15
14
|
* The parent assistant message is carried in `metadata.message_id` by the
|
|
16
15
|
* Python SDK and in `metadata.id` by the JS SDK; the runtime reads either.
|
|
17
16
|
*/
|
|
18
|
-
type UIMessage<TName extends string = string, TProps extends Record<string, unknown> = Record<string, unknown>> = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
17
|
+
export type UIMessage<TName extends string = string, TProps extends Record<string, unknown> = Record<string, unknown>> = {
|
|
18
|
+
type: "ui";
|
|
19
|
+
id: string;
|
|
20
|
+
name: TName;
|
|
21
|
+
props: TProps;
|
|
22
|
+
metadata?: {
|
|
23
|
+
merge?: boolean;
|
|
24
|
+
run_id?: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
tags?: string[];
|
|
27
|
+
message_id?: string;
|
|
28
|
+
id?: string;
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
};
|
|
32
31
|
};
|
|
33
32
|
/**
|
|
34
33
|
* Emitted on the live `custom` channel by the graph's `remove_ui_message`
|
|
35
34
|
* helper to drop a pushed `UIMessage` by id.
|
|
36
35
|
*/
|
|
37
|
-
type RemoveUIMessage = {
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
export type RemoveUIMessage = {
|
|
37
|
+
type: "remove-ui";
|
|
38
|
+
id: string;
|
|
40
39
|
};
|
|
41
40
|
/**
|
|
42
41
|
* Minimal duck-typed interface for BaseMessage class instances returned by
|
|
@@ -45,90 +44,88 @@ type RemoveUIMessage = {
|
|
|
45
44
|
* Uses `unknown` for `content` to remain compatible with
|
|
46
45
|
* `@langchain/core`'s `MessageContent` union.
|
|
47
46
|
*/
|
|
48
|
-
type LangChainBaseMessage = {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
47
|
+
export type LangChainBaseMessage = {
|
|
48
|
+
_getType: () => string;
|
|
49
|
+
content: unknown;
|
|
50
|
+
id?: string | undefined;
|
|
51
|
+
name?: string | undefined;
|
|
52
|
+
additional_kwargs?: Record<string, unknown> | undefined;
|
|
53
|
+
/** Present on AIMessage */
|
|
54
|
+
tool_calls?: readonly LangChainToolCall[] | undefined;
|
|
55
|
+
/** Present on ToolMessage */
|
|
56
|
+
tool_call_id?: string | undefined;
|
|
57
|
+
/** Completion status (AIMessage) or outcome status (ToolMessage) */
|
|
58
|
+
status?: MessageStatus | "success" | "error" | undefined;
|
|
59
|
+
/** Present on ToolMessage */
|
|
60
|
+
artifact?: unknown;
|
|
62
61
|
};
|
|
63
|
-
type LangChainRuntimeExtras = {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
62
|
+
export type LangChainRuntimeExtras = {
|
|
63
|
+
interrupt: {
|
|
64
|
+
value?: unknown;
|
|
65
|
+
} | undefined;
|
|
66
|
+
interrupts: readonly {
|
|
67
|
+
id?: string;
|
|
68
|
+
value?: unknown;
|
|
69
|
+
}[];
|
|
70
|
+
toolCalls: readonly AssembledToolCall[];
|
|
71
|
+
subagents: ReadonlyMap<string, SubagentDiscoverySnapshot>;
|
|
72
|
+
subgraphs: ReadonlyMap<string, SubgraphDiscoverySnapshot>;
|
|
73
|
+
stream: AnyStream;
|
|
74
|
+
error: unknown;
|
|
75
|
+
submit: (values: Record<string, unknown> | null | undefined, options?: Record<string, unknown>) => Promise<void>;
|
|
76
|
+
respond: (response: unknown, options?: Record<string, unknown>) => Promise<void>;
|
|
77
|
+
respondAll: (responsesById: Record<string, unknown>, options?: Record<string, unknown>) => Promise<void>;
|
|
78
|
+
values: Record<string, unknown>;
|
|
79
|
+
messagesKey: string;
|
|
81
80
|
};
|
|
82
|
-
type LangChainRuntimeExtraOptions = ExternalStoreSharedOptions & {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
81
|
+
export type LangChainRuntimeExtraOptions = ExternalStoreSharedOptions & {
|
|
82
|
+
/**
|
|
83
|
+
* Called whenever the active thread's canonical (remote) ID changes, so the
|
|
84
|
+
* value can be treated as a managed/controlled variable (e.g. synced to a URL
|
|
85
|
+
* query param). Only the settled remote ID is emitted: while a freshly created
|
|
86
|
+
* thread is still optimistic the value is `undefined`, and the real ID is
|
|
87
|
+
* emitted once the thread is initialized; the transient local ID is never
|
|
88
|
+
* surfaced.
|
|
89
|
+
*/
|
|
90
|
+
onThreadIdChange?: ((threadId: string | undefined) => void) | undefined;
|
|
91
|
+
cloud?: AssistantCloud | undefined;
|
|
92
|
+
adapters?: {
|
|
93
|
+
attachments?: AttachmentAdapter | undefined;
|
|
94
|
+
speech?: SpeechSynthesisAdapter | undefined;
|
|
95
|
+
dictation?: DictationAdapter | undefined;
|
|
96
|
+
voice?: RealtimeVoiceAdapter | undefined;
|
|
97
|
+
feedback?: FeedbackAdapter | undefined;
|
|
98
|
+
} | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* When the user sends a new message while previous tool calls are
|
|
101
|
+
* still pending, automatically submit `tool` messages that cancel
|
|
102
|
+
* them so the agent's tool-call accounting stays consistent.
|
|
103
|
+
* Defaults to `true`.
|
|
104
|
+
*/
|
|
105
|
+
autoCancelPendingToolCalls?: boolean | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Routes the Cancel button's click to `useStream().stop()`. On by
|
|
108
|
+
* default. Pass `false` to disable the Cancel button.
|
|
109
|
+
*/
|
|
110
|
+
unstable_allowCancellation?: boolean | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* Custom `RemoteThreadListAdapter`. When provided, replaces the
|
|
113
|
+
* cloud-backed thread list adapter.
|
|
114
|
+
*/
|
|
115
|
+
unstable_threadListAdapter?: RemoteThreadListAdapter | undefined;
|
|
116
|
+
/** Custom thread-creation hook, forwarded to the cloud adapter. */
|
|
117
|
+
create?: (() => Promise<{
|
|
118
|
+
externalId: string | undefined;
|
|
119
|
+
}>) | undefined;
|
|
120
|
+
/** Custom thread-deletion hook, forwarded to the cloud adapter. */
|
|
121
|
+
delete?: ((threadId: string) => Promise<void>) | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* State key the graph accumulates generative `UIMessage`s under. Each UI
|
|
124
|
+
* is attached to the assistant message identified by its `metadata.message_id`
|
|
125
|
+
* (Python SDK) or `metadata.id` (JS SDK) and emitted as a `data` part.
|
|
126
|
+
* Defaults to `"ui"`.
|
|
127
|
+
*/
|
|
128
|
+
uiStateKey?: string | undefined;
|
|
130
129
|
};
|
|
131
|
-
type UseStreamRuntimeOptions = UseStreamOptions extends
|
|
132
|
-
//#endregion
|
|
133
|
-
export { LangChainBaseMessage, type LangChainContentBlock, LangChainRuntimeExtraOptions, LangChainRuntimeExtras, LangChainToolCall, RemoveUIMessage, UIMessage, UseStreamRuntimeOptions };
|
|
130
|
+
export type UseStreamRuntimeOptions = UseStreamOptions extends infer O ? O extends UseStreamOptions ? O & LangChainRuntimeExtraOptions : never : never;
|
|
134
131
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,0BAA0B,EAC1B,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,yBAAyB,EACzB,yBAAyB,EAC1B,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EAAE,qBAAqB,EAAE,uBAAoB;AAEzD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,CACnB,KAAK,SAAS,MAAM,GAAG,MAAM,EAC7B,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAC9D;IACF,IAAI,EAAE,IAAI,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE;QACT,KAAK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E,oBAAoB,GAAG,SAAS,CAAC;QACzC,QAAQ,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;KACxC,GACD,SAAS,CAAC;IACd;;;;;OAKG;IACH,0BAA0B,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACjD;;;OAGG;IACH,0BAA0B,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACjD;;;OAGG;IACH,0BAA0B,CAAC,EAAE,uBAAuB,GAAG,SAAS,CAAC;IACjE,mEAAmE;IACnE,MAAM,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC;QAAE,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC,CAAC,GAAG,SAAS,CAAC;IACzE,mEAAmE;IACnE,MAAM,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC;IAC3D;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC,CAAC;AAMF,MAAM,MAAM,uBAAuB,GAAG,gBAAgB,SAAS,MAAM,CAAC,GAClE,CAAC,SAAS,gBAAgB,GACxB,CAAC,GAAG,4BAA4B,GAChC,KAAK,GACP,KAAK,CAAC"}
|
package/dist/uiMessages.d.ts
CHANGED
|
@@ -1,15 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare const
|
|
5
|
-
|
|
1
|
+
import type { Channel } from "@langchain/react";
|
|
2
|
+
import type { RemoveUIMessage, UIMessage } from "./types.js";
|
|
3
|
+
/** Channels the generative-UI fold reads, at the root and per subagent. */
|
|
4
|
+
export declare const UI_CUSTOM_CHANNELS: readonly Channel[];
|
|
5
|
+
export type UIUpdate = UIMessage | RemoveUIMessage;
|
|
6
|
+
export declare const isUIUpdate: (value: unknown) => value is UIUpdate | readonly UIUpdate[];
|
|
7
|
+
export declare const applyUIUpdate: (list: readonly UIMessage[], update: UIUpdate | readonly UIUpdate[]) => UIMessage[];
|
|
6
8
|
/**
|
|
7
9
|
* Pulls a UI update out of a raw `custom`-channel event. The graph writes the
|
|
8
10
|
* `UIMessage` straight to the channel, so it lands at `params.data`; some
|
|
9
11
|
* transports wrap it one level deeper at `params.data.payload`.
|
|
10
12
|
*/
|
|
11
|
-
declare const extractUIUpdate: (event: unknown) => UIUpdate | readonly UIUpdate[] | undefined;
|
|
12
|
-
|
|
13
|
+
export declare const extractUIUpdate: (event: unknown) => UIUpdate | readonly UIUpdate[] | undefined;
|
|
14
|
+
export type UIFoldMemo = {
|
|
15
|
+
events: readonly unknown[];
|
|
16
|
+
messages: UIMessage[];
|
|
17
|
+
};
|
|
18
|
+
export declare const createUIFoldMemo: () => UIFoldMemo;
|
|
19
|
+
/**
|
|
20
|
+
* Folds `custom`-channel events into UI messages, continuing the fold held in
|
|
21
|
+
* `memo`. The channel buffer holds each event object once, appends new events
|
|
22
|
+
* and drops its oldest ones once full, so only events after the previously
|
|
23
|
+
* folded last event are applied, and entries no later event touches keep
|
|
24
|
+
* their identity. A buffer that no longer contains that event was replaced
|
|
25
|
+
* and is folded from scratch.
|
|
26
|
+
*/
|
|
27
|
+
export declare const foldUIUpdates: (events: readonly unknown[], memo?: UIFoldMemo) => UIMessage[];
|
|
28
|
+
export type UISnapshotMemo = {
|
|
29
|
+
snapshot: unknown;
|
|
30
|
+
entries: readonly UIMessage[];
|
|
31
|
+
};
|
|
32
|
+
export declare const createUISnapshotMemo: () => UISnapshotMemo;
|
|
33
|
+
/**
|
|
34
|
+
* Recovers entry identity across `values` events. The SDK rebuilds the
|
|
35
|
+
* `values` object from every snapshot and reconciles only the messages slot by
|
|
36
|
+
* id, so an unchanged UI list arrives as a new array of new objects on every
|
|
37
|
+
* superstep. An entry structurally equal to the previous entry with its id is
|
|
38
|
+
* replaced by that previous object, and a list whose entries all survive in
|
|
39
|
+
* place is replaced by the previous list.
|
|
40
|
+
*/
|
|
41
|
+
export declare const reconcileUISnapshot: (snapshot: unknown, memo: UISnapshotMemo) => readonly UIMessage[];
|
|
13
42
|
/**
|
|
14
43
|
* Merges live-streamed UI with the state snapshot. The snapshot is
|
|
15
44
|
* authoritative by id: once a UI lands in graph state it supersedes its live
|
|
@@ -17,7 +46,5 @@ declare const foldUIUpdates: (events: readonly unknown[]) => UIMessage[];
|
|
|
17
46
|
* snapshot still contains that id; the removal only takes visible effect once
|
|
18
47
|
* the snapshot catches up.
|
|
19
48
|
*/
|
|
20
|
-
declare const mergeUIMessages: (live: readonly UIMessage[], snapshot: unknown) => UIMessage[];
|
|
21
|
-
//#endregion
|
|
22
|
-
export { UIUpdate, applyUIUpdate, extractUIUpdate, foldUIUpdates, isUIUpdate, mergeUIMessages };
|
|
49
|
+
export declare const mergeUIMessages: (live: readonly UIMessage[], snapshot: unknown) => UIMessage[];
|
|
23
50
|
//# sourceMappingURL=uiMessages.d.ts.map
|
package/dist/uiMessages.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uiMessages.d.ts","
|
|
1
|
+
{"version":3,"file":"uiMessages.d.ts","sourceRoot":"","sources":["../src/uiMessages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,mBAAgB;AAE1D,2EAA2E;AAC3E,eAAO,MAAM,kBAAkB,EAAE,SAAS,OAAO,EAAe,CAAC;AAEjE,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,eAAe,CAAC;AAEnD,eAAO,MAAM,UAAU,GACrB,OAAO,OAAO,KACb,KAAK,IAAI,QAAQ,GAAG,SAAS,QAAQ,EAiBvC,CAAC;AAEF,eAAO,MAAM,aAAa,GACxB,MAAM,SAAS,SAAS,EAAE,EAC1B,QAAQ,QAAQ,GAAG,SAAS,QAAQ,EAAE,KACrC,SAAS,EAmBX,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,OAAO,KACb,QAAQ,GAAG,SAAS,QAAQ,EAAE,GAAG,SAMnC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC;IAC3B,QAAQ,EAAE,SAAS,EAAE,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAO,UAGlC,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GACxB,QAAQ,SAAS,OAAO,EAAE,EAC1B,OAAM,UAA+B,KACpC,SAAS,EAcX,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,SAAS,SAAS,EAAE,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAO,cAGtC,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,OAAO,EACjB,MAAM,cAAc,KACnB,SAAS,SAAS,EAmBpB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAC1B,MAAM,SAAS,SAAS,EAAE,EAC1B,UAAU,OAAO,KAChB,SAAS,EAOX,CAAC"}
|
package/dist/uiMessages.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { isJSONValueEqual } from "@assistant-ui/core/internal";
|
|
1
2
|
//#region src/uiMessages.ts
|
|
3
|
+
/** Channels the generative-UI fold reads, at the root and per subagent. */
|
|
4
|
+
const UI_CUSTOM_CHANNELS = ["custom"];
|
|
2
5
|
const isUIUpdate = (value) => {
|
|
3
6
|
if (Array.isArray(value)) return value.length > 0 && value.every(isUIUpdate);
|
|
4
7
|
if (value == null || typeof value !== "object") return false;
|
|
@@ -41,14 +44,61 @@ const extractUIUpdate = (event) => {
|
|
|
41
44
|
const payload = data?.payload;
|
|
42
45
|
if (isUIUpdate(payload)) return payload;
|
|
43
46
|
};
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
const createUIFoldMemo = () => ({
|
|
48
|
+
events: [],
|
|
49
|
+
messages: []
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* Folds `custom`-channel events into UI messages, continuing the fold held in
|
|
53
|
+
* `memo`. The channel buffer holds each event object once, appends new events
|
|
54
|
+
* and drops its oldest ones once full, so only events after the previously
|
|
55
|
+
* folded last event are applied, and entries no later event touches keep
|
|
56
|
+
* their identity. A buffer that no longer contains that event was replaced
|
|
57
|
+
* and is folded from scratch.
|
|
58
|
+
*/
|
|
59
|
+
const foldUIUpdates = (events, memo = createUIFoldMemo()) => {
|
|
60
|
+
const previous = memo.events;
|
|
61
|
+
const resumeAt = previous.length === 0 ? 0 : events.lastIndexOf(previous.at(-1), previous.length - 1) + 1;
|
|
62
|
+
let acc = previous.length > 0 && resumeAt === 0 ? [] : memo.messages;
|
|
63
|
+
for (let i = resumeAt; i < events.length; i++) {
|
|
64
|
+
const update = extractUIUpdate(events[i]);
|
|
48
65
|
if (update) acc = applyUIUpdate(acc, update);
|
|
49
66
|
}
|
|
67
|
+
memo.events = events;
|
|
68
|
+
memo.messages = acc;
|
|
50
69
|
return acc;
|
|
51
70
|
};
|
|
71
|
+
const createUISnapshotMemo = () => ({
|
|
72
|
+
snapshot: void 0,
|
|
73
|
+
entries: []
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* Recovers entry identity across `values` events. The SDK rebuilds the
|
|
77
|
+
* `values` object from every snapshot and reconciles only the messages slot by
|
|
78
|
+
* id, so an unchanged UI list arrives as a new array of new objects on every
|
|
79
|
+
* superstep. An entry structurally equal to the previous entry with its id is
|
|
80
|
+
* replaced by that previous object, and a list whose entries all survive in
|
|
81
|
+
* place is replaced by the previous list.
|
|
82
|
+
*/
|
|
83
|
+
const reconcileUISnapshot = (snapshot, memo) => {
|
|
84
|
+
if (snapshot === memo.snapshot) return memo.entries;
|
|
85
|
+
memo.snapshot = snapshot;
|
|
86
|
+
if (!Array.isArray(snapshot)) {
|
|
87
|
+
if (memo.entries.length > 0) memo.entries = [];
|
|
88
|
+
return memo.entries;
|
|
89
|
+
}
|
|
90
|
+
const previous = memo.entries;
|
|
91
|
+
const previousById = new Map(previous.map((ui) => [ui.id, ui]));
|
|
92
|
+
let same = snapshot.length === previous.length;
|
|
93
|
+
const entries = snapshot.map((ui, index) => {
|
|
94
|
+
const before = previousById.get(ui.id);
|
|
95
|
+
const entry = before !== void 0 && isJSONValueEqual(before, ui) ? before : ui;
|
|
96
|
+
if (entry !== previous[index]) same = false;
|
|
97
|
+
return entry;
|
|
98
|
+
});
|
|
99
|
+
if (!same) memo.entries = entries;
|
|
100
|
+
return memo.entries;
|
|
101
|
+
};
|
|
52
102
|
/**
|
|
53
103
|
* Merges live-streamed UI with the state snapshot. The snapshot is
|
|
54
104
|
* authoritative by id: once a UI lands in graph state it supersedes its live
|
|
@@ -63,6 +113,6 @@ const mergeUIMessages = (live, snapshot) => {
|
|
|
63
113
|
return [...byId.values()];
|
|
64
114
|
};
|
|
65
115
|
//#endregion
|
|
66
|
-
export { applyUIUpdate, extractUIUpdate, foldUIUpdates, isUIUpdate, mergeUIMessages };
|
|
116
|
+
export { UI_CUSTOM_CHANNELS, applyUIUpdate, createUIFoldMemo, createUISnapshotMemo, extractUIUpdate, foldUIUpdates, isUIUpdate, mergeUIMessages, reconcileUISnapshot };
|
|
67
117
|
|
|
68
118
|
//# sourceMappingURL=uiMessages.js.map
|
package/dist/uiMessages.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uiMessages.js","names":[],"sources":["../src/uiMessages.ts"],"sourcesContent":["import type { RemoveUIMessage, UIMessage } from \"./types\";\n\nexport type UIUpdate = UIMessage | RemoveUIMessage;\n\nexport const isUIUpdate = (\n value: unknown,\n): value is UIUpdate | readonly UIUpdate[] => {\n if (Array.isArray(value)) return value.length > 0 && value.every(isUIUpdate);\n if (value == null || typeof value !== \"object\") return false;\n const v = value as {\n type?: unknown;\n id?: unknown;\n name?: unknown;\n props?: unknown;\n };\n if (typeof v.id !== \"string\") return false;\n if (v.type === \"remove-ui\") return true;\n return (\n v.type === \"ui\" &&\n typeof v.name === \"string\" &&\n typeof v.props === \"object\" &&\n v.props !== null\n );\n};\n\nexport const applyUIUpdate = (\n list: readonly UIMessage[],\n update: UIUpdate | readonly UIUpdate[],\n): UIMessage[] => {\n const events = Array.isArray(update) ? update : [update as UIUpdate];\n let next = list.slice();\n for (const event of events) {\n if (event.type === \"remove-ui\") {\n next = next.filter((ui) => ui.id !== event.id);\n continue;\n }\n const index = next.findIndex((ui) => ui.id === event.id);\n if (index === -1) {\n next.push(event);\n continue;\n }\n next[index] =\n event.metadata?.merge === true\n ? { ...event, props: { ...next[index]!.props, ...event.props } }\n : event;\n }\n return next;\n};\n\n/**\n * Pulls a UI update out of a raw `custom`-channel event. The graph writes the\n * `UIMessage` straight to the channel, so it lands at `params.data`; some\n * transports wrap it one level deeper at `params.data.payload`.\n */\nexport const extractUIUpdate = (\n event: unknown,\n): UIUpdate | readonly UIUpdate[] | undefined => {\n const data = (event as { params?: { data?: unknown } } | null)?.params?.data;\n if (isUIUpdate(data)) return data;\n const payload = (data as { payload?: unknown } | undefined)?.payload;\n if (isUIUpdate(payload)) return payload;\n return undefined;\n};\n\nexport const foldUIUpdates = (events: readonly unknown[]): UIMessage[] => {\n let acc
|
|
1
|
+
{"version":3,"file":"uiMessages.js","names":[],"sources":["../src/uiMessages.ts"],"sourcesContent":["import type { Channel } from \"@langchain/react\";\nimport { isJSONValueEqual } from \"@assistant-ui/core/internal\";\nimport type { RemoveUIMessage, UIMessage } from \"./types\";\n\n/** Channels the generative-UI fold reads, at the root and per subagent. */\nexport const UI_CUSTOM_CHANNELS: readonly Channel[] = [\"custom\"];\n\nexport type UIUpdate = UIMessage | RemoveUIMessage;\n\nexport const isUIUpdate = (\n value: unknown,\n): value is UIUpdate | readonly UIUpdate[] => {\n if (Array.isArray(value)) return value.length > 0 && value.every(isUIUpdate);\n if (value == null || typeof value !== \"object\") return false;\n const v = value as {\n type?: unknown;\n id?: unknown;\n name?: unknown;\n props?: unknown;\n };\n if (typeof v.id !== \"string\") return false;\n if (v.type === \"remove-ui\") return true;\n return (\n v.type === \"ui\" &&\n typeof v.name === \"string\" &&\n typeof v.props === \"object\" &&\n v.props !== null\n );\n};\n\nexport const applyUIUpdate = (\n list: readonly UIMessage[],\n update: UIUpdate | readonly UIUpdate[],\n): UIMessage[] => {\n const events = Array.isArray(update) ? update : [update as UIUpdate];\n let next = list.slice();\n for (const event of events) {\n if (event.type === \"remove-ui\") {\n next = next.filter((ui) => ui.id !== event.id);\n continue;\n }\n const index = next.findIndex((ui) => ui.id === event.id);\n if (index === -1) {\n next.push(event);\n continue;\n }\n next[index] =\n event.metadata?.merge === true\n ? { ...event, props: { ...next[index]!.props, ...event.props } }\n : event;\n }\n return next;\n};\n\n/**\n * Pulls a UI update out of a raw `custom`-channel event. The graph writes the\n * `UIMessage` straight to the channel, so it lands at `params.data`; some\n * transports wrap it one level deeper at `params.data.payload`.\n */\nexport const extractUIUpdate = (\n event: unknown,\n): UIUpdate | readonly UIUpdate[] | undefined => {\n const data = (event as { params?: { data?: unknown } } | null)?.params?.data;\n if (isUIUpdate(data)) return data;\n const payload = (data as { payload?: unknown } | undefined)?.payload;\n if (isUIUpdate(payload)) return payload;\n return undefined;\n};\n\nexport type UIFoldMemo = {\n events: readonly unknown[];\n messages: UIMessage[];\n};\n\nexport const createUIFoldMemo = (): UIFoldMemo => ({\n events: [],\n messages: [],\n});\n\n/**\n * Folds `custom`-channel events into UI messages, continuing the fold held in\n * `memo`. The channel buffer holds each event object once, appends new events\n * and drops its oldest ones once full, so only events after the previously\n * folded last event are applied, and entries no later event touches keep\n * their identity. A buffer that no longer contains that event was replaced\n * and is folded from scratch.\n */\nexport const foldUIUpdates = (\n events: readonly unknown[],\n memo: UIFoldMemo = createUIFoldMemo(),\n): UIMessage[] => {\n const previous = memo.events;\n const resumeAt =\n previous.length === 0\n ? 0\n : events.lastIndexOf(previous.at(-1), previous.length - 1) + 1;\n let acc = previous.length > 0 && resumeAt === 0 ? [] : memo.messages;\n for (let i = resumeAt; i < events.length; i++) {\n const update = extractUIUpdate(events[i]);\n if (update) acc = applyUIUpdate(acc, update);\n }\n memo.events = events;\n memo.messages = acc;\n return acc;\n};\n\nexport type UISnapshotMemo = {\n snapshot: unknown;\n entries: readonly UIMessage[];\n};\n\nexport const createUISnapshotMemo = (): UISnapshotMemo => ({\n snapshot: undefined,\n entries: [],\n});\n\n/**\n * Recovers entry identity across `values` events. The SDK rebuilds the\n * `values` object from every snapshot and reconciles only the messages slot by\n * id, so an unchanged UI list arrives as a new array of new objects on every\n * superstep. An entry structurally equal to the previous entry with its id is\n * replaced by that previous object, and a list whose entries all survive in\n * place is replaced by the previous list.\n */\nexport const reconcileUISnapshot = (\n snapshot: unknown,\n memo: UISnapshotMemo,\n): readonly UIMessage[] => {\n if (snapshot === memo.snapshot) return memo.entries;\n memo.snapshot = snapshot;\n if (!Array.isArray(snapshot)) {\n if (memo.entries.length > 0) memo.entries = [];\n return memo.entries;\n }\n const previous = memo.entries;\n const previousById = new Map(previous.map((ui) => [ui.id, ui]));\n let same = snapshot.length === previous.length;\n const entries = (snapshot as UIMessage[]).map((ui, index) => {\n const before = previousById.get(ui.id);\n const entry =\n before !== undefined && isJSONValueEqual(before, ui) ? before : ui;\n if (entry !== previous[index]) same = false;\n return entry;\n });\n if (!same) memo.entries = entries;\n return memo.entries;\n};\n\n/**\n * Merges live-streamed UI with the state snapshot. The snapshot is\n * authoritative by id: once a UI lands in graph state it supersedes its live\n * copy. A consequence is that a live `remove-ui` is overridden while the\n * snapshot still contains that id; the removal only takes visible effect once\n * the snapshot catches up.\n */\nexport const mergeUIMessages = (\n live: readonly UIMessage[],\n snapshot: unknown,\n): UIMessage[] => {\n const byId = new Map<string, UIMessage>();\n for (const ui of live) byId.set(ui.id, ui);\n if (Array.isArray(snapshot)) {\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,IAAI,GAAG,IAAI,EAAE;CACzC,IAAI,MAAM,QAAQ,QAAQ,GACxB,KAAK,MAAM,MAAM,UAAyB,KAAK,IAAI,GAAG,IAAI,EAAE;CAE9D,OAAO,CAAC,GAAG,KAAK,OAAO,CAAC;AAC1B"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
/// <reference types="@assistant-ui/core/store" />
|
|
2
|
-
import {
|
|
3
|
-
import { UseStreamRuntimeOptions } from "./types.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
1
|
+
/// <reference types="@assistant-ui/core/store" preserve="true" />
|
|
2
|
+
import type { AppendMessage } from "@assistant-ui/core";
|
|
3
|
+
import type { UseStreamRuntimeOptions } from "./types.js";
|
|
4
|
+
export { groupUIMessagesByParent } from "./converter.js";
|
|
5
|
+
export declare const runConfigToSubmitOptions: (runConfig: AppendMessage["runConfig"]) => {
|
|
6
|
+
config: {
|
|
7
|
+
configurable: Record<string, unknown>;
|
|
8
|
+
};
|
|
10
9
|
} | undefined;
|
|
11
10
|
/**
|
|
12
11
|
* Creates an assistant-ui runtime backed by LangChain's `useStream` hook.
|
|
@@ -32,7 +31,5 @@ declare const runConfigToSubmitOptions: (runConfig: AppendMessage["runConfig"])
|
|
|
32
31
|
* }
|
|
33
32
|
* ```
|
|
34
33
|
*/
|
|
35
|
-
declare const useStreamRuntime: (rawOptions: UseStreamRuntimeOptions) => import("@assistant-ui/core").AssistantRuntime;
|
|
36
|
-
//#endregion
|
|
37
|
-
export { groupUIMessagesByParent, runConfigToSubmitOptions, useStreamRuntime };
|
|
34
|
+
export declare const useStreamRuntime: (rawOptions: UseStreamRuntimeOptions) => import("@assistant-ui/core").AssistantRuntime;
|
|
38
35
|
//# sourceMappingURL=useStreamRuntime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStreamRuntime.d.ts","
|
|
1
|
+
{"version":3,"file":"useStreamRuntime.d.ts","sourceRoot":"","sources":["../src/useStreamRuntime.ts"],"names":[],"mappings":";AAWA,OAAO,KAAK,EAAE,aAAa,EAAuB,MAAM,oBAAoB,CAAC;AAqB7E,OAAO,KAAK,EAIV,uBAAuB,EACxB,mBAAgB;AAEjB,OAAO,EAAE,uBAAuB,EAAE,uBAAoB;AAwBtD,eAAO,MAAM,wBAAwB,GACnC,WAAW,aAAa,CAAC,WAAW,CAAC;;;;aAIxB,CAAC;AA6rBhB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,gBAAgB,GAAI,YAAY,uBAAuB,kDA8BnE,CAAC"}
|