@langchain/vue 1.0.21 → 1.0.22
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/index.cjs +1 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/selectors.cjs +57 -0
- package/dist/selectors.cjs.map +1 -1
- package/dist/selectors.d.cts +48 -2
- package/dist/selectors.d.cts.map +1 -1
- package/dist/selectors.d.ts +48 -2
- package/dist/selectors.d.ts.map +1 -1
- package/dist/selectors.js +59 -3
- package/dist/selectors.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -75,6 +75,7 @@ exports.provideStream = require_context.provideStream;
|
|
|
75
75
|
exports.useAudio = require_selectors.useAudio;
|
|
76
76
|
exports.useAudioPlayer = require_use_audio_player.useAudioPlayer;
|
|
77
77
|
exports.useChannel = require_selectors.useChannel;
|
|
78
|
+
exports.useChannelEffect = require_selectors.useChannelEffect;
|
|
78
79
|
exports.useExtension = require_selectors.useExtension;
|
|
79
80
|
exports.useFiles = require_selectors.useFiles;
|
|
80
81
|
exports.useImages = require_selectors.useImages;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AgentServerOptions, AnyStream, CustomAdapterOptions, STREAM_CONTROLLER, ThreadStream, UseStreamOptions, UseStreamResult, UseStreamReturn, useStream } from "./use-stream.cjs";
|
|
2
2
|
import { useProjection } from "./use-projection.cjs";
|
|
3
|
-
import { SelectorTarget, SubmissionQueueEntry, SubmissionQueueSnapshot, UseSubmissionQueueReturn, useAudio, useChannel, useExtension, useFiles, useImages, useMessageMetadata, useMessages, useSubmissionQueue, useToolCalls, useValues, useVideo } from "./selectors.cjs";
|
|
3
|
+
import { SelectorTarget, SubmissionQueueEntry, SubmissionQueueSnapshot, UseChannelEffectOptions, UseSubmissionQueueReturn, useAudio, useChannel, useChannelEffect, useExtension, useFiles, useImages, useMessageMetadata, useMessages, useSubmissionQueue, useToolCalls, useValues, useVideo } from "./selectors.cjs";
|
|
4
4
|
import { useMediaURL } from "./use-media-url.cjs";
|
|
5
5
|
import { AudioPlayerHandle, PlayerStatus, UseAudioPlayerOptions, useAudioPlayer } from "./use-audio-player.cjs";
|
|
6
6
|
import { UseVideoPlayerOptions, VideoPlayerHandle, useVideoPlayer } from "./use-video-player.cjs";
|
|
@@ -8,4 +8,4 @@ import { LANGCHAIN_OPTIONS, LangChainPlugin, LangChainPluginOptions, provideStre
|
|
|
8
8
|
import { VueReactiveOptions } from "./types.cjs";
|
|
9
9
|
import { AnyHeadlessToolImplementation, DefaultToolCall, FlushPendingHeadlessToolInterruptsOptions, HeadlessToolImplementation, HeadlessToolInterrupt, HttpAgentServerAdapter, HttpAgentServerAdapterOptions, OnToolCallback, ToolCallState, ToolCallWithResult, ToolCallsFromTools, ToolEvent, executeHeadlessTool, filterOutHeadlessToolInterrupts, findHeadlessTool, flushPendingHeadlessToolInterrupts, handleHeadlessToolInterrupt, headlessToolResumeCommand, isHeadlessToolInterrupt, parseHeadlessToolInterruptPayload } from "@langchain/langgraph-sdk";
|
|
10
10
|
import { AgentServerAdapter, AnyMediaHandle, AssembledToolCall, AssembledToolCallFromTool as ToolCallFromTool, AudioMedia, Channel, Event, FileMedia, ImageMedia, InferStateType, InferSubagentStates, InferToolCalls, MediaAssemblyError, MediaAssemblyErrorKind, MediaBase, MediaBlockType, MessageMetadata, MessageMetadataMap, StreamStopOptions, StreamSubmitOptions, SubagentDiscoverySnapshot, SubgraphDiscoverySnapshot, ToolCallStatus, VideoMedia, WidenUpdateMessages } from "@langchain/langgraph-sdk/stream";
|
|
11
|
-
export { type AgentServerAdapter, type AgentServerOptions, type AnyHeadlessToolImplementation, type AnyMediaHandle, type AnyStream, type AssembledToolCall, type AudioMedia, type AudioPlayerHandle, type Channel, type CustomAdapterOptions, type DefaultToolCall, type Event, type FileMedia, type FlushPendingHeadlessToolInterruptsOptions, type HeadlessToolImplementation, type HeadlessToolInterrupt, HttpAgentServerAdapter, type HttpAgentServerAdapterOptions, type ImageMedia, type InferStateType, type InferSubagentStates, type InferToolCalls, LANGCHAIN_OPTIONS, LangChainPlugin, type LangChainPluginOptions, MediaAssemblyError, type MediaAssemblyErrorKind, type MediaBase, type MediaBlockType, type MessageMetadata, type MessageMetadataMap, type OnToolCallback, type PlayerStatus, STREAM_CONTROLLER, type SelectorTarget, type StreamStopOptions, type StreamSubmitOptions, type SubagentDiscoverySnapshot, type SubgraphDiscoverySnapshot, type SubmissionQueueEntry, type SubmissionQueueSnapshot, type ThreadStream, type ToolCallFromTool, type ToolCallState, type ToolCallStatus, type ToolCallWithResult, type ToolCallsFromTools, type ToolEvent, type UseAudioPlayerOptions, type UseStreamOptions, type UseStreamResult, type UseStreamReturn, type UseSubmissionQueueReturn, type UseVideoPlayerOptions, type VideoMedia, type VideoPlayerHandle, type VueReactiveOptions, type WidenUpdateMessages, executeHeadlessTool, filterOutHeadlessToolInterrupts, findHeadlessTool, flushPendingHeadlessToolInterrupts, handleHeadlessToolInterrupt, headlessToolResumeCommand, isHeadlessToolInterrupt, parseHeadlessToolInterruptPayload, provideStream, useAudio, useAudioPlayer, useChannel, useExtension, useFiles, useImages, useMediaURL, useMessageMetadata, useMessages, useProjection, useStream, useStreamContext, useSubmissionQueue, useToolCalls, useValues, useVideo, useVideoPlayer };
|
|
11
|
+
export { type AgentServerAdapter, type AgentServerOptions, type AnyHeadlessToolImplementation, type AnyMediaHandle, type AnyStream, type AssembledToolCall, type AudioMedia, type AudioPlayerHandle, type Channel, type CustomAdapterOptions, type DefaultToolCall, type Event, type FileMedia, type FlushPendingHeadlessToolInterruptsOptions, type HeadlessToolImplementation, type HeadlessToolInterrupt, HttpAgentServerAdapter, type HttpAgentServerAdapterOptions, type ImageMedia, type InferStateType, type InferSubagentStates, type InferToolCalls, LANGCHAIN_OPTIONS, LangChainPlugin, type LangChainPluginOptions, MediaAssemblyError, type MediaAssemblyErrorKind, type MediaBase, type MediaBlockType, type MessageMetadata, type MessageMetadataMap, type OnToolCallback, type PlayerStatus, STREAM_CONTROLLER, type SelectorTarget, type StreamStopOptions, type StreamSubmitOptions, type SubagentDiscoverySnapshot, type SubgraphDiscoverySnapshot, type SubmissionQueueEntry, type SubmissionQueueSnapshot, type ThreadStream, type ToolCallFromTool, type ToolCallState, type ToolCallStatus, type ToolCallWithResult, type ToolCallsFromTools, type ToolEvent, type UseAudioPlayerOptions, type UseChannelEffectOptions, type UseStreamOptions, type UseStreamResult, type UseStreamReturn, type UseSubmissionQueueReturn, type UseVideoPlayerOptions, type VideoMedia, type VideoPlayerHandle, type VueReactiveOptions, type WidenUpdateMessages, executeHeadlessTool, filterOutHeadlessToolInterrupts, findHeadlessTool, flushPendingHeadlessToolInterrupts, handleHeadlessToolInterrupt, headlessToolResumeCommand, isHeadlessToolInterrupt, parseHeadlessToolInterruptPayload, provideStream, useAudio, useAudioPlayer, useChannel, useChannelEffect, useExtension, useFiles, useImages, useMediaURL, useMessageMetadata, useMessages, useProjection, useStream, useStreamContext, useSubmissionQueue, useToolCalls, useValues, useVideo, useVideoPlayer };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AgentServerOptions, AnyStream, CustomAdapterOptions, STREAM_CONTROLLER, ThreadStream, UseStreamOptions, UseStreamResult, UseStreamReturn, useStream } from "./use-stream.js";
|
|
2
2
|
import { useProjection } from "./use-projection.js";
|
|
3
|
-
import { SelectorTarget, SubmissionQueueEntry, SubmissionQueueSnapshot, UseSubmissionQueueReturn, useAudio, useChannel, useExtension, useFiles, useImages, useMessageMetadata, useMessages, useSubmissionQueue, useToolCalls, useValues, useVideo } from "./selectors.js";
|
|
3
|
+
import { SelectorTarget, SubmissionQueueEntry, SubmissionQueueSnapshot, UseChannelEffectOptions, UseSubmissionQueueReturn, useAudio, useChannel, useChannelEffect, useExtension, useFiles, useImages, useMessageMetadata, useMessages, useSubmissionQueue, useToolCalls, useValues, useVideo } from "./selectors.js";
|
|
4
4
|
import { useMediaURL } from "./use-media-url.js";
|
|
5
5
|
import { AudioPlayerHandle, PlayerStatus, UseAudioPlayerOptions, useAudioPlayer } from "./use-audio-player.js";
|
|
6
6
|
import { UseVideoPlayerOptions, VideoPlayerHandle, useVideoPlayer } from "./use-video-player.js";
|
|
@@ -8,4 +8,4 @@ import { LANGCHAIN_OPTIONS, LangChainPlugin, LangChainPluginOptions, provideStre
|
|
|
8
8
|
import { VueReactiveOptions } from "./types.js";
|
|
9
9
|
import { AnyHeadlessToolImplementation, DefaultToolCall, FlushPendingHeadlessToolInterruptsOptions, HeadlessToolImplementation, HeadlessToolInterrupt, HttpAgentServerAdapter, HttpAgentServerAdapterOptions, OnToolCallback, ToolCallState, ToolCallWithResult, ToolCallsFromTools, ToolEvent, executeHeadlessTool, filterOutHeadlessToolInterrupts, findHeadlessTool, flushPendingHeadlessToolInterrupts, handleHeadlessToolInterrupt, headlessToolResumeCommand, isHeadlessToolInterrupt, parseHeadlessToolInterruptPayload } from "@langchain/langgraph-sdk";
|
|
10
10
|
import { AgentServerAdapter, AnyMediaHandle, AssembledToolCall, AssembledToolCallFromTool as ToolCallFromTool, AudioMedia, Channel, Event, FileMedia, ImageMedia, InferStateType, InferSubagentStates, InferToolCalls, MediaAssemblyError, MediaAssemblyErrorKind, MediaBase, MediaBlockType, MessageMetadata, MessageMetadataMap, StreamStopOptions, StreamSubmitOptions, SubagentDiscoverySnapshot, SubgraphDiscoverySnapshot, ToolCallStatus, VideoMedia, WidenUpdateMessages } from "@langchain/langgraph-sdk/stream";
|
|
11
|
-
export { type AgentServerAdapter, type AgentServerOptions, type AnyHeadlessToolImplementation, type AnyMediaHandle, type AnyStream, type AssembledToolCall, type AudioMedia, type AudioPlayerHandle, type Channel, type CustomAdapterOptions, type DefaultToolCall, type Event, type FileMedia, type FlushPendingHeadlessToolInterruptsOptions, type HeadlessToolImplementation, type HeadlessToolInterrupt, HttpAgentServerAdapter, type HttpAgentServerAdapterOptions, type ImageMedia, type InferStateType, type InferSubagentStates, type InferToolCalls, LANGCHAIN_OPTIONS, LangChainPlugin, type LangChainPluginOptions, MediaAssemblyError, type MediaAssemblyErrorKind, type MediaBase, type MediaBlockType, type MessageMetadata, type MessageMetadataMap, type OnToolCallback, type PlayerStatus, STREAM_CONTROLLER, type SelectorTarget, type StreamStopOptions, type StreamSubmitOptions, type SubagentDiscoverySnapshot, type SubgraphDiscoverySnapshot, type SubmissionQueueEntry, type SubmissionQueueSnapshot, type ThreadStream, type ToolCallFromTool, type ToolCallState, type ToolCallStatus, type ToolCallWithResult, type ToolCallsFromTools, type ToolEvent, type UseAudioPlayerOptions, type UseStreamOptions, type UseStreamResult, type UseStreamReturn, type UseSubmissionQueueReturn, type UseVideoPlayerOptions, type VideoMedia, type VideoPlayerHandle, type VueReactiveOptions, type WidenUpdateMessages, executeHeadlessTool, filterOutHeadlessToolInterrupts, findHeadlessTool, flushPendingHeadlessToolInterrupts, handleHeadlessToolInterrupt, headlessToolResumeCommand, isHeadlessToolInterrupt, parseHeadlessToolInterruptPayload, provideStream, useAudio, useAudioPlayer, useChannel, useExtension, useFiles, useImages, useMediaURL, useMessageMetadata, useMessages, useProjection, useStream, useStreamContext, useSubmissionQueue, useToolCalls, useValues, useVideo, useVideoPlayer };
|
|
11
|
+
export { type AgentServerAdapter, type AgentServerOptions, type AnyHeadlessToolImplementation, type AnyMediaHandle, type AnyStream, type AssembledToolCall, type AudioMedia, type AudioPlayerHandle, type Channel, type CustomAdapterOptions, type DefaultToolCall, type Event, type FileMedia, type FlushPendingHeadlessToolInterruptsOptions, type HeadlessToolImplementation, type HeadlessToolInterrupt, HttpAgentServerAdapter, type HttpAgentServerAdapterOptions, type ImageMedia, type InferStateType, type InferSubagentStates, type InferToolCalls, LANGCHAIN_OPTIONS, LangChainPlugin, type LangChainPluginOptions, MediaAssemblyError, type MediaAssemblyErrorKind, type MediaBase, type MediaBlockType, type MessageMetadata, type MessageMetadataMap, type OnToolCallback, type PlayerStatus, STREAM_CONTROLLER, type SelectorTarget, type StreamStopOptions, type StreamSubmitOptions, type SubagentDiscoverySnapshot, type SubgraphDiscoverySnapshot, type SubmissionQueueEntry, type SubmissionQueueSnapshot, type ThreadStream, type ToolCallFromTool, type ToolCallState, type ToolCallStatus, type ToolCallWithResult, type ToolCallsFromTools, type ToolEvent, type UseAudioPlayerOptions, type UseChannelEffectOptions, type UseStreamOptions, type UseStreamResult, type UseStreamReturn, type UseSubmissionQueueReturn, type UseVideoPlayerOptions, type VideoMedia, type VideoPlayerHandle, type VueReactiveOptions, type WidenUpdateMessages, executeHeadlessTool, filterOutHeadlessToolInterrupts, findHeadlessTool, flushPendingHeadlessToolInterrupts, handleHeadlessToolInterrupt, headlessToolResumeCommand, isHeadlessToolInterrupt, parseHeadlessToolInterruptPayload, provideStream, useAudio, useAudioPlayer, useChannel, useChannelEffect, useExtension, useFiles, useImages, useMediaURL, useMessageMetadata, useMessages, useProjection, useStream, useStreamContext, useSubmissionQueue, useToolCalls, useValues, useVideo, useVideoPlayer };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { LANGCHAIN_OPTIONS, LangChainPlugin, provideStream, useStreamContext } from "./context.js";
|
|
2
2
|
import { STREAM_CONTROLLER, useStream } from "./use-stream.js";
|
|
3
3
|
import { useProjection } from "./use-projection.js";
|
|
4
|
-
import { useAudio, useChannel, useExtension, useFiles, useImages, useMessageMetadata, useMessages, useSubmissionQueue, useToolCalls, useValues, useVideo } from "./selectors.js";
|
|
4
|
+
import { useAudio, useChannel, useChannelEffect, useExtension, useFiles, useImages, useMessageMetadata, useMessages, useSubmissionQueue, useToolCalls, useValues, useVideo } from "./selectors.js";
|
|
5
5
|
import { useMediaURL } from "./use-media-url.js";
|
|
6
6
|
import { useAudioPlayer } from "./use-audio-player.js";
|
|
7
7
|
import { useVideoPlayer } from "./use-video-player.js";
|
|
8
8
|
import { HttpAgentServerAdapter, executeHeadlessTool, filterOutHeadlessToolInterrupts, findHeadlessTool, flushPendingHeadlessToolInterrupts, handleHeadlessToolInterrupt, headlessToolResumeCommand, isHeadlessToolInterrupt, parseHeadlessToolInterruptPayload } from "@langchain/langgraph-sdk";
|
|
9
9
|
import { MediaAssemblyError } from "@langchain/langgraph-sdk/stream";
|
|
10
|
-
export { HttpAgentServerAdapter, LANGCHAIN_OPTIONS, LangChainPlugin, MediaAssemblyError, STREAM_CONTROLLER, executeHeadlessTool, filterOutHeadlessToolInterrupts, findHeadlessTool, flushPendingHeadlessToolInterrupts, handleHeadlessToolInterrupt, headlessToolResumeCommand, isHeadlessToolInterrupt, parseHeadlessToolInterruptPayload, provideStream, useAudio, useAudioPlayer, useChannel, useExtension, useFiles, useImages, useMediaURL, useMessageMetadata, useMessages, useProjection, useStream, useStreamContext, useSubmissionQueue, useToolCalls, useValues, useVideo, useVideoPlayer };
|
|
10
|
+
export { HttpAgentServerAdapter, LANGCHAIN_OPTIONS, LangChainPlugin, MediaAssemblyError, STREAM_CONTROLLER, executeHeadlessTool, filterOutHeadlessToolInterrupts, findHeadlessTool, flushPendingHeadlessToolInterrupts, handleHeadlessToolInterrupt, headlessToolResumeCommand, isHeadlessToolInterrupt, parseHeadlessToolInterruptPayload, provideStream, useAudio, useAudioPlayer, useChannel, useChannelEffect, useExtension, useFiles, useImages, useMediaURL, useMessageMetadata, useMessages, useProjection, useStream, useStreamContext, useSubmissionQueue, useToolCalls, useValues, useVideo, useVideoPlayer };
|
package/dist/selectors.cjs
CHANGED
|
@@ -100,6 +100,62 @@ function useChannel(stream, channels, target, options) {
|
|
|
100
100
|
}
|
|
101
101
|
const EMPTY_EVENTS = [];
|
|
102
102
|
/**
|
|
103
|
+
* Side-effect counterpart to {@link useChannel}. Instead of returning a
|
|
104
|
+
* reactive buffer, it invokes `onEvent` once per event for as long as
|
|
105
|
+
* the calling scope is alive — the idiomatic place for analytics,
|
|
106
|
+
* logging, and other fire-and-forget side effects.
|
|
107
|
+
*
|
|
108
|
+
* ```ts
|
|
109
|
+
* useChannelEffect(stream, ["lifecycle", "tools"], {
|
|
110
|
+
* replay: false,
|
|
111
|
+
* onEvent(event) {
|
|
112
|
+
* sendAnalytics(event);
|
|
113
|
+
* },
|
|
114
|
+
* onError(error) {
|
|
115
|
+
* logger.error(error);
|
|
116
|
+
* },
|
|
117
|
+
* });
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* Reactive `channels` / `target` / `enabled` re-bind the subscription
|
|
121
|
+
* when they change. The underlying subscription is shared (ref-counted)
|
|
122
|
+
* with any matching {@link useChannel} consumer. `replay` defaults to
|
|
123
|
+
* `false` (live-only); events buffered before the effect attaches are
|
|
124
|
+
* not re-delivered.
|
|
125
|
+
*
|
|
126
|
+
* Must be called from a component `setup()` (or another effect scope) so
|
|
127
|
+
* the subscription is torn down on `onScopeDispose`.
|
|
128
|
+
*/
|
|
129
|
+
function useChannelEffect(stream, channels, options) {
|
|
130
|
+
useResolveSubagentNamespace(stream, options.target);
|
|
131
|
+
let dispose = null;
|
|
132
|
+
const detach = () => {
|
|
133
|
+
dispose?.();
|
|
134
|
+
dispose = null;
|
|
135
|
+
};
|
|
136
|
+
(0, vue.watch)(() => {
|
|
137
|
+
const enabled = (0, vue.toValue)(options.enabled) ?? true;
|
|
138
|
+
const sortedChannels = [...(0, vue.toValue)(channels)].sort().join(",");
|
|
139
|
+
const namespace = resolveNamespace((0, vue.toValue)(options.target));
|
|
140
|
+
return `${enabled ? "on" : "off"}|${sortedChannels}|${namespaceKey(namespace)}`;
|
|
141
|
+
}, () => {
|
|
142
|
+
detach();
|
|
143
|
+
if (!((0, vue.toValue)(options.enabled) ?? true)) return;
|
|
144
|
+
const registry = require_use_stream.getRegistry(stream);
|
|
145
|
+
if (registry == null) return;
|
|
146
|
+
dispose = (0, _langchain_langgraph_sdk_stream.acquireChannelEffect)(registry, (0, vue.toValue)(channels), resolveNamespace((0, vue.toValue)(options.target)), {
|
|
147
|
+
replay: options.replay,
|
|
148
|
+
bufferSize: options.bufferSize,
|
|
149
|
+
onEvent: (event) => options.onEvent(event),
|
|
150
|
+
onError: options.onError ? (error) => options.onError?.(error) : void 0
|
|
151
|
+
});
|
|
152
|
+
}, {
|
|
153
|
+
immediate: true,
|
|
154
|
+
flush: "sync"
|
|
155
|
+
});
|
|
156
|
+
(0, vue.onScopeDispose)(detach);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
103
159
|
* Subscribe to a scoped audio-media stream. Each handle is yielded
|
|
104
160
|
* on its first matching `content-block-start`, exposes
|
|
105
161
|
* `.partialBytes` for live access, settles `.blob` / `.objectURL` /
|
|
@@ -184,6 +240,7 @@ function useSubmissionQueue(stream) {
|
|
|
184
240
|
//#endregion
|
|
185
241
|
exports.useAudio = useAudio;
|
|
186
242
|
exports.useChannel = useChannel;
|
|
243
|
+
exports.useChannelEffect = useChannelEffect;
|
|
187
244
|
exports.useExtension = useExtension;
|
|
188
245
|
exports.useFiles = useFiles;
|
|
189
246
|
exports.useImages = useImages;
|
package/dist/selectors.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.cjs","names":["STREAM_CONTROLLER","NAMESPACE_SEPARATOR","useProjection","getRegistry"],"sources":["../src/selectors.ts"],"sourcesContent":["import {\n computed,\n onScopeDispose,\n readonly,\n shallowRef,\n toValue,\n watchEffect,\n type ComputedRef,\n type MaybeRefOrGetter,\n type ShallowRef,\n} from \"vue\";\nimport type { BaseMessage } from \"@langchain/core/messages\";\nimport {\n NAMESPACE_SEPARATOR,\n audioProjection,\n channelProjection,\n extensionProjection,\n filesProjection,\n imagesProjection,\n messagesProjection,\n toolCallsProjection,\n valuesProjection,\n videoProjection,\n type AssembledToolCall,\n type AudioMedia,\n type Channel,\n type ChannelProjectionOptions,\n type Event,\n type FileMedia,\n type ImageMedia,\n type InferToolCalls,\n type InferStateType,\n type MessageMetadata,\n type MessageMetadataMap,\n type SubagentDiscoverySnapshot,\n type SubgraphDiscoverySnapshot,\n type SubmissionQueueEntry,\n type SubmissionQueueSnapshot,\n type VideoMedia,\n} from \"@langchain/langgraph-sdk/stream\";\nimport {\n getRegistry,\n STREAM_CONTROLLER,\n type AnyStream,\n type UseStreamReturn,\n} from \"./use-stream.js\";\nimport { useProjection } from \"./use-projection.js\";\n\n/**\n * Selector composables don't need to carry `InterruptType` /\n * `ConfigurableType`. Parameterising on `StateType` alone lets\n * callers with a full `useStream<S, I, C>()` handle pass it in without\n * redeclaring those generics at every call site.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype StreamHandle<StateType extends object> = UseStreamReturn<\n StateType,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n any\n>;\n\n/**\n * What a selector composable can be targeted at. Callers can pass:\n * - `undefined` / `null` — root namespace (served by the always-on\n * root store — no extra subscription);\n * - a {@link SubagentDiscoverySnapshot} (`stream.subagents.value.get(...)`);\n * - a {@link SubgraphDiscoverySnapshot} (`stream.subgraphs.value.get(...)`);\n * - an explicit `{ namespace: string[] }`;\n * - a raw `string[]` escape hatch.\n */\nexport type SelectorTarget =\n | undefined\n | null\n | readonly string[]\n | { namespace: readonly string[] }\n | SubagentDiscoverySnapshot\n | SubgraphDiscoverySnapshot;\n\nconst EMPTY_NAMESPACE: readonly string[] = [];\n\nfunction resolveNamespace(target: SelectorTarget): readonly string[] {\n if (target == null) return EMPTY_NAMESPACE;\n if (Array.isArray(target)) return target as readonly string[];\n const obj = target as { namespace?: readonly string[] };\n return obj.namespace ?? EMPTY_NAMESPACE;\n}\n\nfunction isRoot(namespace: readonly string[]): boolean {\n return namespace.length === 0;\n}\n\n/**\n * If `target` is a subagent snapshot still on its default\n * `tools:<toolCallId>` namespace, return that tool-call id. See the\n * React selectors for the rationale (deep-agent subagents execute under\n * a distinct `tools:<uuid>` namespace resolved lazily from history).\n */\nfunction subagentNeedingNamespace(target: SelectorTarget): string | null {\n if (target == null || Array.isArray(target)) return null;\n const obj = target as { id?: unknown; namespace?: readonly string[] };\n if (typeof obj.id !== \"string\" || !Array.isArray(obj.namespace)) return null;\n if (obj.namespace.length === 1 && obj.namespace[0] === `tools:${obj.id}`) {\n return obj.id;\n }\n return null;\n}\n\n/**\n * Lazily resolve a subagent's execution namespace on first scoped use.\n * Re-evaluates if `target` changes; the controller de-dupes and skips\n * already-promoted ids so this is cheap to call from every consumer.\n */\nfunction useResolveSubagentNamespace(\n stream: AnyStream,\n target?: MaybeRefOrGetter<SelectorTarget>\n): void {\n const controller = stream[STREAM_CONTROLLER];\n watchEffect(() => {\n const id = subagentNeedingNamespace(toValue(target));\n if (id != null) void controller.resolveSubagentNamespace(id);\n });\n}\n\nfunction namespaceKey(namespace: readonly string[]): string {\n return namespace.join(NAMESPACE_SEPARATOR);\n}\n\n/**\n * Subscribe to a scoped `messages` stream.\n *\n * Contract:\n * - At the root (no `target`) this returns `stream.messages` — the\n * always-on root projection; no extra subscription is opened.\n * - For any non-root namespace, mount triggers a ref-counted\n * `messages` subscription scoped to that namespace. The\n * subscription is released automatically when the calling scope\n * disappears (and the registry closes the underlying server\n * subscription when the last consumer leaves).\n *\n * Messages are always `BaseMessage` class instances from\n * `@langchain/core/messages`.\n */\nexport function useMessages(\n stream: AnyStream,\n target?: MaybeRefOrGetter<SelectorTarget>\n): Readonly<ShallowRef<BaseMessage[]>> {\n useResolveSubagentNamespace(stream, target);\n const namespace = computed(() => resolveNamespace(toValue(target)));\n if (isRoot(namespace.value)) return stream.messages;\n const key = computed(() => `messages|${namespaceKey(namespace.value)}`);\n return useProjection<BaseMessage[]>(\n getRegistry(stream),\n () => messagesProjection(namespace.value),\n key,\n EMPTY_MESSAGES\n );\n}\n\nconst EMPTY_MESSAGES: BaseMessage[] = [];\n\n/**\n * Subscribe to a scoped `tools` (tool-call) stream. Same target and\n * lifecycle rules as {@link useMessages}; at the root this returns\n * `stream.toolCalls` directly.\n */\nexport function useToolCalls(\n stream: AnyStream,\n target?: MaybeRefOrGetter<SelectorTarget>\n): Readonly<ShallowRef<AssembledToolCall[]>>;\nexport function useToolCalls<T>(\n stream: AnyStream,\n target?: MaybeRefOrGetter<SelectorTarget>\n): Readonly<ShallowRef<InferToolCalls<T>[]>>;\nexport function useToolCalls(\n stream: AnyStream,\n target?: MaybeRefOrGetter<SelectorTarget>\n): Readonly<ShallowRef<AssembledToolCall[]>> {\n useResolveSubagentNamespace(stream, target);\n const namespace = computed(() => resolveNamespace(toValue(target)));\n if (isRoot(namespace.value)) return stream.toolCalls;\n const key = computed(() => `toolCalls|${namespaceKey(namespace.value)}`);\n return useProjection<AssembledToolCall[]>(\n getRegistry(stream),\n () => toolCallsProjection(namespace.value),\n key,\n EMPTY_TOOLCALLS\n );\n}\n\nconst EMPTY_TOOLCALLS: AssembledToolCall[] = [];\n\n/**\n * Subscribe to a scoped `values` stream — the most recent state\n * payload for a namespace. At the root returns `stream.values`.\n *\n * Typing:\n * - **Root** (`useValues(stream)`): returns the `StateType` declared\n * on `useStream<State>()` — non-nullable (the root snapshot always\n * has values, falling back to `initialValues ?? {}`).\n * - **Scoped** (`useValues(stream, target)`): scoped payloads can\n * differ from the root state; callers should annotate the\n * expected shape explicitly (`useValues<SubagentState>(stream,\n * sub)`). Defaults to `unknown` when not annotated.\n */\nexport function useValues<StateType extends object>(\n stream: StreamHandle<StateType>\n): Readonly<ShallowRef<StateType>>;\nexport function useValues<T>(\n stream: AnyStream\n): Readonly<ShallowRef<InferStateType<T>>>;\nexport function useValues<T = unknown>(\n stream: AnyStream,\n target: SelectorTarget,\n options?: { messagesKey?: string }\n): Readonly<ShallowRef<T | undefined>>;\nexport function useValues(\n stream: AnyStream,\n target?: SelectorTarget,\n options?: { messagesKey?: string }\n): Readonly<ShallowRef<unknown>> {\n const namespace = resolveNamespace(target);\n if (isRoot(namespace)) return stream.values as Readonly<ShallowRef<unknown>>;\n const messagesKey = options?.messagesKey ?? \"messages\";\n const key = `values|${messagesKey}|${namespaceKey(namespace)}`;\n return useProjection<unknown>(\n getRegistry(stream),\n () => valuesProjection<unknown>(namespace, messagesKey),\n key,\n undefined\n );\n}\n\n/**\n * Subscribe to a `custom:<name>` stream extension — the most-recent\n * payload emitted by the transformer, scoped to the target namespace.\n *\n * Returns only the latest value and resumes across serial runs, so it is\n * ideal for \"current state\" panels (progress, score, status). When you\n * need the full history of events rather than just the latest payload,\n * use {@link useChannel} instead.\n */\nexport function useExtension<T = unknown>(\n stream: AnyStream,\n name: string,\n target?: SelectorTarget\n): Readonly<ShallowRef<T | undefined>> {\n const namespace = resolveNamespace(target);\n const key = `extension|${name}|${namespaceKey(namespace)}`;\n return useProjection<T | undefined>(\n getRegistry(stream),\n () => extensionProjection<T>(name, namespace),\n key,\n undefined\n );\n}\n\n/**\n * Raw-events escape hatch. Subscribes to one or more channels at a\n * namespace and returns a bounded buffer of raw protocol events.\n *\n * The buffer keeps accumulating across serial runs for the lifetime of\n * the thread, so this is the hook to use for an event log / stream of a\n * custom channel (e.g. `[\"custom:redaction-stats\"]`). When you only need\n * the latest payload of a single `custom:<name>` channel, prefer\n * {@link useExtension}. For the common message/tool/value cases prefer\n * {@link useMessages} / {@link useToolCalls} / {@link useValues}.\n */\nexport type UseChannelOptions = ChannelProjectionOptions;\n\nexport function useChannel(\n stream: AnyStream,\n channels: readonly Channel[],\n target?: SelectorTarget,\n options?: UseChannelOptions\n): Readonly<ShallowRef<Event[]>> {\n const namespace = resolveNamespace(target);\n const sortedChannels = [...channels].sort().join(\",\");\n const key = `channel|${options?.bufferSize ?? \"default\"}|${(options?.replay ?? true) ? \"replay\" : \"live\"}|${sortedChannels}|${namespaceKey(namespace)}`;\n return useProjection<Event[]>(\n getRegistry(stream),\n () => channelProjection(channels, namespace, options),\n key,\n EMPTY_EVENTS\n );\n}\n\nconst EMPTY_EVENTS: Event[] = [];\n\n/**\n * Subscribe to a scoped audio-media stream. Each handle is yielded\n * on its first matching `content-block-start`, exposes\n * `.partialBytes` for live access, settles `.blob` / `.objectURL` /\n * `.transcript` on `message-finish`, and surfaces errors via\n * `.error`.\n */\nexport function useAudio(\n stream: AnyStream,\n target?: SelectorTarget\n): Readonly<ShallowRef<AudioMedia[]>> {\n const namespace = resolveNamespace(target);\n const key = `audio|${namespaceKey(namespace)}`;\n return useProjection<AudioMedia[]>(\n getRegistry(stream),\n () => audioProjection(namespace),\n key,\n EMPTY_AUDIO\n );\n}\n\nconst EMPTY_AUDIO: AudioMedia[] = [];\n\n/**\n * Subscribe to a scoped image-media stream. Pair with\n * {@link useMediaURL} for `<img src>`.\n */\nexport function useImages(\n stream: AnyStream,\n target?: SelectorTarget\n): Readonly<ShallowRef<ImageMedia[]>> {\n const namespace = resolveNamespace(target);\n const key = `images|${namespaceKey(namespace)}`;\n return useProjection<ImageMedia[]>(\n getRegistry(stream),\n () => imagesProjection(namespace),\n key,\n EMPTY_IMAGES\n );\n}\n\nconst EMPTY_IMAGES: ImageMedia[] = [];\n\n/**\n * Subscribe to a scoped video-media stream. Pair with\n * {@link useMediaURL} for `<video src>`.\n */\nexport function useVideo(\n stream: AnyStream,\n target?: SelectorTarget\n): Readonly<ShallowRef<VideoMedia[]>> {\n const namespace = resolveNamespace(target);\n const key = `video|${namespaceKey(namespace)}`;\n return useProjection<VideoMedia[]>(\n getRegistry(stream),\n () => videoProjection(namespace),\n key,\n EMPTY_VIDEO\n );\n}\n\nconst EMPTY_VIDEO: VideoMedia[] = [];\n\n/**\n * Subscribe to a scoped file-media stream. Pair with\n * {@link useMediaURL} for an `<a download href>` target.\n */\nexport function useFiles(\n stream: AnyStream,\n target?: SelectorTarget\n): Readonly<ShallowRef<FileMedia[]>> {\n const namespace = resolveNamespace(target);\n const key = `files|${namespaceKey(namespace)}`;\n return useProjection<FileMedia[]>(\n getRegistry(stream),\n () => filesProjection(namespace),\n key,\n EMPTY_FILES\n );\n}\n\nconst EMPTY_FILES: FileMedia[] = [];\n\n/**\n * Read metadata recorded for a specific message id — today exposes\n * `parentCheckpointId`, the checkpoint the message was first seen on.\n * Designed for fork / edit flows:\n *\n * ```ts\n * const meta = useMessageMetadata(stream, () => msg.id);\n * // meta.value?.parentCheckpointId\n * ```\n *\n * `messageId` accepts a raw string, a `Ref<string | undefined>`, or\n * a getter — the binding re-evaluates whenever the id changes.\n */\nexport function useMessageMetadata(\n stream: AnyStream,\n messageId: MaybeRefOrGetter<string | undefined>\n): ComputedRef<MessageMetadata | undefined> {\n const store = stream[STREAM_CONTROLLER].messageMetadataStore;\n const mapRef = shallowRef<MessageMetadataMap>(store.getSnapshot());\n const unsubscribe = store.subscribe(() => {\n mapRef.value = store.getSnapshot();\n });\n onScopeDispose(unsubscribe);\n\n return computed<MessageMetadata | undefined>(() => {\n const key = toValue(messageId);\n if (key == null) return undefined;\n return mapRef.value.get(key);\n });\n}\n\n/**\n * Reactive handle on the server-side submission queue.\n *\n * Populated when `submit()` is invoked with\n * `multitaskStrategy: \"enqueue\"` while another run is in flight. The\n * returned refs are shared per call — safe to pass into `v-for`.\n */\nexport interface UseSubmissionQueueReturn<\n StateType extends object = Record<string, unknown>,\n> {\n readonly entries: Readonly<ShallowRef<SubmissionQueueSnapshot<StateType>>>;\n readonly size: ComputedRef<number>;\n cancel(id: string): Promise<boolean>;\n clear(): Promise<void>;\n}\n\nexport function useSubmissionQueue<StateType extends object>(\n stream: StreamHandle<StateType>\n): UseSubmissionQueueReturn<StateType>;\nexport function useSubmissionQueue(stream: AnyStream): UseSubmissionQueueReturn;\nexport function useSubmissionQueue(\n stream: AnyStream\n): UseSubmissionQueueReturn {\n const controller = stream[STREAM_CONTROLLER];\n const store = controller.queueStore;\n const entries = shallowRef<SubmissionQueueSnapshot>(store.getSnapshot());\n const unsubscribe = store.subscribe(() => {\n entries.value = store.getSnapshot();\n });\n onScopeDispose(unsubscribe);\n\n return {\n entries: readonly(entries) as Readonly<ShallowRef<SubmissionQueueSnapshot>>,\n size: computed(() => entries.value.length),\n cancel: (id) => controller.cancelQueued(id),\n clear: () => controller.clearQueue(),\n };\n}\n\nexport type { SubmissionQueueEntry, SubmissionQ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A,IAAA,gBAAmD;EACjD,MAAM,OAAA,GAAA,IAAA,SAAc,UAAU;AAC9B,MAAI,OAAO,KAAM,QAAO,KAAA;AACxB,SAAO,OAAO,MAAM,IAAI,IAAI;GAC5B;;AAuBJ,SAAgB,mBACd,QAC0B;CAC1B,MAAM,aAAa,OAAOA,mBAAAA;CAC1B,MAAM,QAAQ,WAAW;CACzB,MAAM,WAAA,GAAA,IAAA,YAA8C,MAAM,aAAa,CAAC;AAIxE,EAAA,GAAA,IAAA,gBAHoB,MAAM,gBAAgB;AACxC,UAAQ,QAAQ,MAAM,aAAa;GACnC,CACyB;AAE3B,QAAO;EACL,UAAA,GAAA,IAAA,UAAkB,QAAQ;EAC1B,OAAA,GAAA,IAAA,gBAAqB,QAAQ,MAAM,OAAO;EAC1C,SAAS,OAAO,WAAW,aAAa,GAAG;EAC3C,aAAa,WAAW,YAAY;EACrC"}
|
|
1
|
+
{"version":3,"file":"selectors.cjs","names":["STREAM_CONTROLLER","NAMESPACE_SEPARATOR","useProjection","getRegistry"],"sources":["../src/selectors.ts"],"sourcesContent":["import {\n computed,\n onScopeDispose,\n readonly,\n shallowRef,\n toValue,\n watch,\n watchEffect,\n type ComputedRef,\n type MaybeRefOrGetter,\n type ShallowRef,\n} from \"vue\";\nimport type { BaseMessage } from \"@langchain/core/messages\";\nimport {\n NAMESPACE_SEPARATOR,\n acquireChannelEffect,\n audioProjection,\n channelProjection,\n extensionProjection,\n filesProjection,\n imagesProjection,\n messagesProjection,\n toolCallsProjection,\n valuesProjection,\n videoProjection,\n type AssembledToolCall,\n type AudioMedia,\n type Channel,\n type ChannelEffectOptions,\n type ChannelProjectionOptions,\n type Event,\n type FileMedia,\n type ImageMedia,\n type InferToolCalls,\n type InferStateType,\n type MessageMetadata,\n type MessageMetadataMap,\n type SubagentDiscoverySnapshot,\n type SubgraphDiscoverySnapshot,\n type SubmissionQueueEntry,\n type SubmissionQueueSnapshot,\n type VideoMedia,\n} from \"@langchain/langgraph-sdk/stream\";\nimport {\n getRegistry,\n STREAM_CONTROLLER,\n type AnyStream,\n type UseStreamReturn,\n} from \"./use-stream.js\";\nimport { useProjection } from \"./use-projection.js\";\n\n/**\n * Selector composables don't need to carry `InterruptType` /\n * `ConfigurableType`. Parameterising on `StateType` alone lets\n * callers with a full `useStream<S, I, C>()` handle pass it in without\n * redeclaring those generics at every call site.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype StreamHandle<StateType extends object> = UseStreamReturn<\n StateType,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n any\n>;\n\n/**\n * What a selector composable can be targeted at. Callers can pass:\n * - `undefined` / `null` — root namespace (served by the always-on\n * root store — no extra subscription);\n * - a {@link SubagentDiscoverySnapshot} (`stream.subagents.value.get(...)`);\n * - a {@link SubgraphDiscoverySnapshot} (`stream.subgraphs.value.get(...)`);\n * - an explicit `{ namespace: string[] }`;\n * - a raw `string[]` escape hatch.\n */\nexport type SelectorTarget =\n | undefined\n | null\n | readonly string[]\n | { namespace: readonly string[] }\n | SubagentDiscoverySnapshot\n | SubgraphDiscoverySnapshot;\n\nconst EMPTY_NAMESPACE: readonly string[] = [];\n\nfunction resolveNamespace(target: SelectorTarget): readonly string[] {\n if (target == null) return EMPTY_NAMESPACE;\n if (Array.isArray(target)) return target as readonly string[];\n const obj = target as { namespace?: readonly string[] };\n return obj.namespace ?? EMPTY_NAMESPACE;\n}\n\nfunction isRoot(namespace: readonly string[]): boolean {\n return namespace.length === 0;\n}\n\n/**\n * If `target` is a subagent snapshot still on its default\n * `tools:<toolCallId>` namespace, return that tool-call id. See the\n * React selectors for the rationale (deep-agent subagents execute under\n * a distinct `tools:<uuid>` namespace resolved lazily from history).\n */\nfunction subagentNeedingNamespace(target: SelectorTarget): string | null {\n if (target == null || Array.isArray(target)) return null;\n const obj = target as { id?: unknown; namespace?: readonly string[] };\n if (typeof obj.id !== \"string\" || !Array.isArray(obj.namespace)) return null;\n if (obj.namespace.length === 1 && obj.namespace[0] === `tools:${obj.id}`) {\n return obj.id;\n }\n return null;\n}\n\n/**\n * Lazily resolve a subagent's execution namespace on first scoped use.\n * Re-evaluates if `target` changes; the controller de-dupes and skips\n * already-promoted ids so this is cheap to call from every consumer.\n */\nfunction useResolveSubagentNamespace(\n stream: AnyStream,\n target?: MaybeRefOrGetter<SelectorTarget>\n): void {\n const controller = stream[STREAM_CONTROLLER];\n watchEffect(() => {\n const id = subagentNeedingNamespace(toValue(target));\n if (id != null) void controller.resolveSubagentNamespace(id);\n });\n}\n\nfunction namespaceKey(namespace: readonly string[]): string {\n return namespace.join(NAMESPACE_SEPARATOR);\n}\n\n/**\n * Subscribe to a scoped `messages` stream.\n *\n * Contract:\n * - At the root (no `target`) this returns `stream.messages` — the\n * always-on root projection; no extra subscription is opened.\n * - For any non-root namespace, mount triggers a ref-counted\n * `messages` subscription scoped to that namespace. The\n * subscription is released automatically when the calling scope\n * disappears (and the registry closes the underlying server\n * subscription when the last consumer leaves).\n *\n * Messages are always `BaseMessage` class instances from\n * `@langchain/core/messages`.\n */\nexport function useMessages(\n stream: AnyStream,\n target?: MaybeRefOrGetter<SelectorTarget>\n): Readonly<ShallowRef<BaseMessage[]>> {\n useResolveSubagentNamespace(stream, target);\n const namespace = computed(() => resolveNamespace(toValue(target)));\n if (isRoot(namespace.value)) return stream.messages;\n const key = computed(() => `messages|${namespaceKey(namespace.value)}`);\n return useProjection<BaseMessage[]>(\n getRegistry(stream),\n () => messagesProjection(namespace.value),\n key,\n EMPTY_MESSAGES\n );\n}\n\nconst EMPTY_MESSAGES: BaseMessage[] = [];\n\n/**\n * Subscribe to a scoped `tools` (tool-call) stream. Same target and\n * lifecycle rules as {@link useMessages}; at the root this returns\n * `stream.toolCalls` directly.\n */\nexport function useToolCalls(\n stream: AnyStream,\n target?: MaybeRefOrGetter<SelectorTarget>\n): Readonly<ShallowRef<AssembledToolCall[]>>;\nexport function useToolCalls<T>(\n stream: AnyStream,\n target?: MaybeRefOrGetter<SelectorTarget>\n): Readonly<ShallowRef<InferToolCalls<T>[]>>;\nexport function useToolCalls(\n stream: AnyStream,\n target?: MaybeRefOrGetter<SelectorTarget>\n): Readonly<ShallowRef<AssembledToolCall[]>> {\n useResolveSubagentNamespace(stream, target);\n const namespace = computed(() => resolveNamespace(toValue(target)));\n if (isRoot(namespace.value)) return stream.toolCalls;\n const key = computed(() => `toolCalls|${namespaceKey(namespace.value)}`);\n return useProjection<AssembledToolCall[]>(\n getRegistry(stream),\n () => toolCallsProjection(namespace.value),\n key,\n EMPTY_TOOLCALLS\n );\n}\n\nconst EMPTY_TOOLCALLS: AssembledToolCall[] = [];\n\n/**\n * Subscribe to a scoped `values` stream — the most recent state\n * payload for a namespace. At the root returns `stream.values`.\n *\n * Typing:\n * - **Root** (`useValues(stream)`): returns the `StateType` declared\n * on `useStream<State>()` — non-nullable (the root snapshot always\n * has values, falling back to `initialValues ?? {}`).\n * - **Scoped** (`useValues(stream, target)`): scoped payloads can\n * differ from the root state; callers should annotate the\n * expected shape explicitly (`useValues<SubagentState>(stream,\n * sub)`). Defaults to `unknown` when not annotated.\n */\nexport function useValues<StateType extends object>(\n stream: StreamHandle<StateType>\n): Readonly<ShallowRef<StateType>>;\nexport function useValues<T>(\n stream: AnyStream\n): Readonly<ShallowRef<InferStateType<T>>>;\nexport function useValues<T = unknown>(\n stream: AnyStream,\n target: SelectorTarget,\n options?: { messagesKey?: string }\n): Readonly<ShallowRef<T | undefined>>;\nexport function useValues(\n stream: AnyStream,\n target?: SelectorTarget,\n options?: { messagesKey?: string }\n): Readonly<ShallowRef<unknown>> {\n const namespace = resolveNamespace(target);\n if (isRoot(namespace)) return stream.values as Readonly<ShallowRef<unknown>>;\n const messagesKey = options?.messagesKey ?? \"messages\";\n const key = `values|${messagesKey}|${namespaceKey(namespace)}`;\n return useProjection<unknown>(\n getRegistry(stream),\n () => valuesProjection<unknown>(namespace, messagesKey),\n key,\n undefined\n );\n}\n\n/**\n * Subscribe to a `custom:<name>` stream extension — the most-recent\n * payload emitted by the transformer, scoped to the target namespace.\n *\n * Returns only the latest value and resumes across serial runs, so it is\n * ideal for \"current state\" panels (progress, score, status). When you\n * need the full history of events rather than just the latest payload,\n * use {@link useChannel} instead.\n */\nexport function useExtension<T = unknown>(\n stream: AnyStream,\n name: string,\n target?: SelectorTarget\n): Readonly<ShallowRef<T | undefined>> {\n const namespace = resolveNamespace(target);\n const key = `extension|${name}|${namespaceKey(namespace)}`;\n return useProjection<T | undefined>(\n getRegistry(stream),\n () => extensionProjection<T>(name, namespace),\n key,\n undefined\n );\n}\n\n/**\n * Raw-events escape hatch. Subscribes to one or more channels at a\n * namespace and returns a bounded buffer of raw protocol events.\n *\n * The buffer keeps accumulating across serial runs for the lifetime of\n * the thread, so this is the hook to use for an event log / stream of a\n * custom channel (e.g. `[\"custom:redaction-stats\"]`). When you only need\n * the latest payload of a single `custom:<name>` channel, prefer\n * {@link useExtension}. For the common message/tool/value cases prefer\n * {@link useMessages} / {@link useToolCalls} / {@link useValues}.\n */\nexport type UseChannelOptions = ChannelProjectionOptions;\n\nexport function useChannel(\n stream: AnyStream,\n channels: readonly Channel[],\n target?: SelectorTarget,\n options?: UseChannelOptions\n): Readonly<ShallowRef<Event[]>> {\n const namespace = resolveNamespace(target);\n const sortedChannels = [...channels].sort().join(\",\");\n const key = `channel|${options?.bufferSize ?? \"default\"}|${(options?.replay ?? true) ? \"replay\" : \"live\"}|${sortedChannels}|${namespaceKey(namespace)}`;\n return useProjection<Event[]>(\n getRegistry(stream),\n () => channelProjection(channels, namespace, options),\n key,\n EMPTY_EVENTS\n );\n}\n\nconst EMPTY_EVENTS: Event[] = [];\n\n/**\n * Options for {@link useChannelEffect}. Extends the projection options\n * (`bufferSize`, `replay`) with the per-event callback, an optional\n * error sink, a reactive `target` scope, and a reactive `enabled` gate.\n */\nexport interface UseChannelEffectOptions extends ChannelEffectOptions {\n /**\n * Scope events to a subagent / subgraph / explicit namespace.\n * Defaults to the root namespace. Accepts a ref/getter so reactive\n * state can drive the scope.\n */\n target?: MaybeRefOrGetter<SelectorTarget>;\n /**\n * Gate the subscription. When `false`, no subscription is opened and\n * no events are delivered. Defaults to `true`. Accepts a ref/getter.\n */\n enabled?: MaybeRefOrGetter<boolean>;\n}\n\n/**\n * Side-effect counterpart to {@link useChannel}. Instead of returning a\n * reactive buffer, it invokes `onEvent` once per event for as long as\n * the calling scope is alive — the idiomatic place for analytics,\n * logging, and other fire-and-forget side effects.\n *\n * ```ts\n * useChannelEffect(stream, [\"lifecycle\", \"tools\"], {\n * replay: false,\n * onEvent(event) {\n * sendAnalytics(event);\n * },\n * onError(error) {\n * logger.error(error);\n * },\n * });\n * ```\n *\n * Reactive `channels` / `target` / `enabled` re-bind the subscription\n * when they change. The underlying subscription is shared (ref-counted)\n * with any matching {@link useChannel} consumer. `replay` defaults to\n * `false` (live-only); events buffered before the effect attaches are\n * not re-delivered.\n *\n * Must be called from a component `setup()` (or another effect scope) so\n * the subscription is torn down on `onScopeDispose`.\n */\nexport function useChannelEffect(\n stream: AnyStream,\n channels: MaybeRefOrGetter<readonly Channel[]>,\n options: UseChannelEffectOptions\n): void {\n useResolveSubagentNamespace(stream, options.target);\n\n let dispose: (() => void) | null = null;\n const detach = () => {\n dispose?.();\n dispose = null;\n };\n\n watch(\n () => {\n const enabled = toValue(options.enabled) ?? true;\n const sortedChannels = [...toValue(channels)].sort().join(\",\");\n const namespace = resolveNamespace(toValue(options.target));\n // Return a stable string so the watcher only re-acquires when the\n // resolved scope actually changes (not on every getter call).\n return `${enabled ? \"on\" : \"off\"}|${sortedChannels}|${namespaceKey(namespace)}`;\n },\n () => {\n detach();\n const enabled = toValue(options.enabled) ?? true;\n if (!enabled) return;\n const registry = getRegistry(stream);\n if (registry == null) return;\n const resolvedChannels = toValue(channels);\n const namespace = resolveNamespace(toValue(options.target));\n dispose = acquireChannelEffect(registry, resolvedChannels, namespace, {\n replay: options.replay,\n bufferSize: options.bufferSize,\n // Read callbacks lazily so a fresh closure never re-acquires.\n onEvent: (event) => options.onEvent(event),\n onError: options.onError\n ? (error) => options.onError?.(error)\n : undefined,\n });\n },\n { immediate: true, flush: \"sync\" }\n );\n\n onScopeDispose(detach);\n}\n\n/**\n * Subscribe to a scoped audio-media stream. Each handle is yielded\n * on its first matching `content-block-start`, exposes\n * `.partialBytes` for live access, settles `.blob` / `.objectURL` /\n * `.transcript` on `message-finish`, and surfaces errors via\n * `.error`.\n */\nexport function useAudio(\n stream: AnyStream,\n target?: SelectorTarget\n): Readonly<ShallowRef<AudioMedia[]>> {\n const namespace = resolveNamespace(target);\n const key = `audio|${namespaceKey(namespace)}`;\n return useProjection<AudioMedia[]>(\n getRegistry(stream),\n () => audioProjection(namespace),\n key,\n EMPTY_AUDIO\n );\n}\n\nconst EMPTY_AUDIO: AudioMedia[] = [];\n\n/**\n * Subscribe to a scoped image-media stream. Pair with\n * {@link useMediaURL} for `<img src>`.\n */\nexport function useImages(\n stream: AnyStream,\n target?: SelectorTarget\n): Readonly<ShallowRef<ImageMedia[]>> {\n const namespace = resolveNamespace(target);\n const key = `images|${namespaceKey(namespace)}`;\n return useProjection<ImageMedia[]>(\n getRegistry(stream),\n () => imagesProjection(namespace),\n key,\n EMPTY_IMAGES\n );\n}\n\nconst EMPTY_IMAGES: ImageMedia[] = [];\n\n/**\n * Subscribe to a scoped video-media stream. Pair with\n * {@link useMediaURL} for `<video src>`.\n */\nexport function useVideo(\n stream: AnyStream,\n target?: SelectorTarget\n): Readonly<ShallowRef<VideoMedia[]>> {\n const namespace = resolveNamespace(target);\n const key = `video|${namespaceKey(namespace)}`;\n return useProjection<VideoMedia[]>(\n getRegistry(stream),\n () => videoProjection(namespace),\n key,\n EMPTY_VIDEO\n );\n}\n\nconst EMPTY_VIDEO: VideoMedia[] = [];\n\n/**\n * Subscribe to a scoped file-media stream. Pair with\n * {@link useMediaURL} for an `<a download href>` target.\n */\nexport function useFiles(\n stream: AnyStream,\n target?: SelectorTarget\n): Readonly<ShallowRef<FileMedia[]>> {\n const namespace = resolveNamespace(target);\n const key = `files|${namespaceKey(namespace)}`;\n return useProjection<FileMedia[]>(\n getRegistry(stream),\n () => filesProjection(namespace),\n key,\n EMPTY_FILES\n );\n}\n\nconst EMPTY_FILES: FileMedia[] = [];\n\n/**\n * Read metadata recorded for a specific message id — today exposes\n * `parentCheckpointId`, the checkpoint the message was first seen on.\n * Designed for fork / edit flows:\n *\n * ```ts\n * const meta = useMessageMetadata(stream, () => msg.id);\n * // meta.value?.parentCheckpointId\n * ```\n *\n * `messageId` accepts a raw string, a `Ref<string | undefined>`, or\n * a getter — the binding re-evaluates whenever the id changes.\n */\nexport function useMessageMetadata(\n stream: AnyStream,\n messageId: MaybeRefOrGetter<string | undefined>\n): ComputedRef<MessageMetadata | undefined> {\n const store = stream[STREAM_CONTROLLER].messageMetadataStore;\n const mapRef = shallowRef<MessageMetadataMap>(store.getSnapshot());\n const unsubscribe = store.subscribe(() => {\n mapRef.value = store.getSnapshot();\n });\n onScopeDispose(unsubscribe);\n\n return computed<MessageMetadata | undefined>(() => {\n const key = toValue(messageId);\n if (key == null) return undefined;\n return mapRef.value.get(key);\n });\n}\n\n/**\n * Reactive handle on the server-side submission queue.\n *\n * Populated when `submit()` is invoked with\n * `multitaskStrategy: \"enqueue\"` while another run is in flight. The\n * returned refs are shared per call — safe to pass into `v-for`.\n */\nexport interface UseSubmissionQueueReturn<\n StateType extends object = Record<string, unknown>,\n> {\n readonly entries: Readonly<ShallowRef<SubmissionQueueSnapshot<StateType>>>;\n readonly size: ComputedRef<number>;\n cancel(id: string): Promise<boolean>;\n clear(): Promise<void>;\n}\n\nexport function useSubmissionQueue<StateType extends object>(\n stream: StreamHandle<StateType>\n): UseSubmissionQueueReturn<StateType>;\nexport function useSubmissionQueue(stream: AnyStream): UseSubmissionQueueReturn;\nexport function useSubmissionQueue(\n stream: AnyStream\n): UseSubmissionQueueReturn {\n const controller = stream[STREAM_CONTROLLER];\n const store = controller.queueStore;\n const entries = shallowRef<SubmissionQueueSnapshot>(store.getSnapshot());\n const unsubscribe = store.subscribe(() => {\n entries.value = store.getSnapshot();\n });\n onScopeDispose(unsubscribe);\n\n return {\n entries: readonly(entries) as Readonly<ShallowRef<SubmissionQueueSnapshot>>,\n size: computed(() => entries.value.length),\n cancel: (id) => controller.cancelQueued(id),\n clear: () => controller.clearQueue(),\n };\n}\n\nexport type { SubmissionQueueEntry, SubmissionQueueSnapshot };\n"],"mappings":";;;;;AAmFA,MAAM,kBAAqC,EAAE;AAE7C,SAAS,iBAAiB,QAA2C;AACnE,KAAI,UAAU,KAAM,QAAO;AAC3B,KAAI,MAAM,QAAQ,OAAO,CAAE,QAAO;AAElC,QADY,OACD,aAAa;;AAG1B,SAAS,OAAO,WAAuC;AACrD,QAAO,UAAU,WAAW;;;;;;;;AAS9B,SAAS,yBAAyB,QAAuC;AACvE,KAAI,UAAU,QAAQ,MAAM,QAAQ,OAAO,CAAE,QAAO;CACpD,MAAM,MAAM;AACZ,KAAI,OAAO,IAAI,OAAO,YAAY,CAAC,MAAM,QAAQ,IAAI,UAAU,CAAE,QAAO;AACxE,KAAI,IAAI,UAAU,WAAW,KAAK,IAAI,UAAU,OAAO,SAAS,IAAI,KAClE,QAAO,IAAI;AAEb,QAAO;;;;;;;AAQT,SAAS,4BACP,QACA,QACM;CACN,MAAM,aAAa,OAAOA,mBAAAA;AAC1B,EAAA,GAAA,IAAA,mBAAkB;EAChB,MAAM,KAAK,0BAAA,GAAA,IAAA,SAAiC,OAAO,CAAC;AACpD,MAAI,MAAM,KAAW,YAAW,yBAAyB,GAAG;GAC5D;;AAGJ,SAAS,aAAa,WAAsC;AAC1D,QAAO,UAAU,KAAKC,gCAAAA,oBAAoB;;;;;;;;;;;;;;;;;AAkB5C,SAAgB,YACd,QACA,QACqC;AACrC,6BAA4B,QAAQ,OAAO;CAC3C,MAAM,aAAA,GAAA,IAAA,gBAA2B,kBAAA,GAAA,IAAA,SAAyB,OAAO,CAAC,CAAC;AACnE,KA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E3B,SAAA,GAAA,IAAA,gBAAmD;EACjD,MAAM,OAAA,GAAA,IAAA,SAAc,UAAU;AAC9B,MAAI,OAAO,KAAM,QAAO,KAAA;AACxB,SAAO,OAAO,MAAM,IAAI,IAAI;GAC5B;;AAuBJ,SAAgB,mBACd,QAC0B;CAC1B,MAAM,aAAa,OAAOA,mBAAAA;CAC1B,MAAM,QAAQ,WAAW;CACzB,MAAM,WAAA,GAAA,IAAA,YAA8C,MAAM,aAAa,CAAC;AAIxE,EAAA,GAAA,IAAA,gBAHoB,MAAM,gBAAgB;AACxC,UAAQ,QAAQ,MAAM,aAAa;GACnC,CACyB;AAE3B,QAAO;EACL,UAAA,GAAA,IAAA,UAAkB,QAAQ;EAC1B,OAAA,GAAA,IAAA,gBAAqB,QAAQ,MAAM,OAAO;EAC1C,SAAS,OAAO,WAAW,aAAa,GAAG;EAC3C,aAAa,WAAW,YAAY;EACrC"}
|
package/dist/selectors.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnyStream, UseStreamReturn } from "./use-stream.cjs";
|
|
2
2
|
import { ComputedRef, MaybeRefOrGetter, ShallowRef } from "vue";
|
|
3
3
|
import { BaseMessage } from "@langchain/core/messages";
|
|
4
|
-
import { AssembledToolCall, AudioMedia, Channel, ChannelProjectionOptions, Event, FileMedia, ImageMedia, InferStateType, InferToolCalls, MessageMetadata, SubagentDiscoverySnapshot, SubgraphDiscoverySnapshot, SubmissionQueueEntry, SubmissionQueueSnapshot, VideoMedia } from "@langchain/langgraph-sdk/stream";
|
|
4
|
+
import { AssembledToolCall, AudioMedia, Channel, ChannelEffectOptions, ChannelProjectionOptions, Event, FileMedia, ImageMedia, InferStateType, InferToolCalls, MessageMetadata, SubagentDiscoverySnapshot, SubgraphDiscoverySnapshot, SubmissionQueueEntry, SubmissionQueueSnapshot, VideoMedia } from "@langchain/langgraph-sdk/stream";
|
|
5
5
|
|
|
6
6
|
//#region src/selectors.d.ts
|
|
7
7
|
/**
|
|
@@ -87,6 +87,52 @@ declare function useExtension<T = unknown>(stream: AnyStream, name: string, targ
|
|
|
87
87
|
*/
|
|
88
88
|
type UseChannelOptions = ChannelProjectionOptions;
|
|
89
89
|
declare function useChannel(stream: AnyStream, channels: readonly Channel[], target?: SelectorTarget, options?: UseChannelOptions): Readonly<ShallowRef<Event[]>>;
|
|
90
|
+
/**
|
|
91
|
+
* Options for {@link useChannelEffect}. Extends the projection options
|
|
92
|
+
* (`bufferSize`, `replay`) with the per-event callback, an optional
|
|
93
|
+
* error sink, a reactive `target` scope, and a reactive `enabled` gate.
|
|
94
|
+
*/
|
|
95
|
+
interface UseChannelEffectOptions extends ChannelEffectOptions {
|
|
96
|
+
/**
|
|
97
|
+
* Scope events to a subagent / subgraph / explicit namespace.
|
|
98
|
+
* Defaults to the root namespace. Accepts a ref/getter so reactive
|
|
99
|
+
* state can drive the scope.
|
|
100
|
+
*/
|
|
101
|
+
target?: MaybeRefOrGetter<SelectorTarget>;
|
|
102
|
+
/**
|
|
103
|
+
* Gate the subscription. When `false`, no subscription is opened and
|
|
104
|
+
* no events are delivered. Defaults to `true`. Accepts a ref/getter.
|
|
105
|
+
*/
|
|
106
|
+
enabled?: MaybeRefOrGetter<boolean>;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Side-effect counterpart to {@link useChannel}. Instead of returning a
|
|
110
|
+
* reactive buffer, it invokes `onEvent` once per event for as long as
|
|
111
|
+
* the calling scope is alive — the idiomatic place for analytics,
|
|
112
|
+
* logging, and other fire-and-forget side effects.
|
|
113
|
+
*
|
|
114
|
+
* ```ts
|
|
115
|
+
* useChannelEffect(stream, ["lifecycle", "tools"], {
|
|
116
|
+
* replay: false,
|
|
117
|
+
* onEvent(event) {
|
|
118
|
+
* sendAnalytics(event);
|
|
119
|
+
* },
|
|
120
|
+
* onError(error) {
|
|
121
|
+
* logger.error(error);
|
|
122
|
+
* },
|
|
123
|
+
* });
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* Reactive `channels` / `target` / `enabled` re-bind the subscription
|
|
127
|
+
* when they change. The underlying subscription is shared (ref-counted)
|
|
128
|
+
* with any matching {@link useChannel} consumer. `replay` defaults to
|
|
129
|
+
* `false` (live-only); events buffered before the effect attaches are
|
|
130
|
+
* not re-delivered.
|
|
131
|
+
*
|
|
132
|
+
* Must be called from a component `setup()` (or another effect scope) so
|
|
133
|
+
* the subscription is torn down on `onScopeDispose`.
|
|
134
|
+
*/
|
|
135
|
+
declare function useChannelEffect(stream: AnyStream, channels: MaybeRefOrGetter<readonly Channel[]>, options: UseChannelEffectOptions): void;
|
|
90
136
|
/**
|
|
91
137
|
* Subscribe to a scoped audio-media stream. Each handle is yielded
|
|
92
138
|
* on its first matching `content-block-start`, exposes
|
|
@@ -140,5 +186,5 @@ interface UseSubmissionQueueReturn<StateType extends object = Record<string, unk
|
|
|
140
186
|
declare function useSubmissionQueue<StateType extends object>(stream: StreamHandle<StateType>): UseSubmissionQueueReturn<StateType>;
|
|
141
187
|
declare function useSubmissionQueue(stream: AnyStream): UseSubmissionQueueReturn;
|
|
142
188
|
//#endregion
|
|
143
|
-
export { SelectorTarget, type SubmissionQueueEntry, type SubmissionQueueSnapshot, UseSubmissionQueueReturn, useAudio, useChannel, useExtension, useFiles, useImages, useMessageMetadata, useMessages, useSubmissionQueue, useToolCalls, useValues, useVideo };
|
|
189
|
+
export { SelectorTarget, type SubmissionQueueEntry, type SubmissionQueueSnapshot, UseChannelEffectOptions, UseSubmissionQueueReturn, useAudio, useChannel, useChannelEffect, useExtension, useFiles, useImages, useMessageMetadata, useMessages, useSubmissionQueue, useToolCalls, useValues, useVideo };
|
|
144
190
|
//# sourceMappingURL=selectors.d.cts.map
|
package/dist/selectors.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.d.cts","names":[],"sources":["../src/selectors.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"selectors.d.cts","names":[],"sources":["../src/sel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";
|
|
2
2
|
import { ComputedRef, MaybeRefOrGetter, ShallowRef } from "vue";
|
|
3
|
-
import { AssembledToolCall, AudioMedia, Channel, ChannelProjectionOptions, Event, FileMedia, ImageMedia, InferStateType, InferToolCalls, MessageMetadata, SubagentDiscoverySnapshot, SubgraphDiscoverySnapshot, SubmissionQueueEntry, SubmissionQueueSnapshot, VideoMedia } from "@langchain/langgraph-sdk/stream";
|
|
3
|
+
import { AssembledToolCall, AudioMedia, Channel, ChannelEffectOptions, ChannelProjectionOptions, Event, FileMedia, ImageMedia, InferStateType, InferToolCalls, MessageMetadata, SubagentDiscoverySnapshot, SubgraphDiscoverySnapshot, SubmissionQueueEntry, SubmissionQueueSnapshot, VideoMedia } from "@langchain/langgraph-sdk/stream";
|
|
4
4
|
import { BaseMessage } from "@langchain/core/messages";
|
|
5
5
|
|
|
6
6
|
//#region src/selectors.d.ts
|
|
@@ -87,6 +87,52 @@ declare function useExtension<T = unknown>(stream: AnyStream, name: string, targ
|
|
|
87
87
|
*/
|
|
88
88
|
type UseChannelOptions = ChannelProjectionOptions;
|
|
89
89
|
declare function useChannel(stream: AnyStream, channels: readonly Channel[], target?: SelectorTarget, options?: UseChannelOptions): Readonly<ShallowRef<Event[]>>;
|
|
90
|
+
/**
|
|
91
|
+
* Options for {@link useChannelEffect}. Extends the projection options
|
|
92
|
+
* (`bufferSize`, `replay`) with the per-event callback, an optional
|
|
93
|
+
* error sink, a reactive `target` scope, and a reactive `enabled` gate.
|
|
94
|
+
*/
|
|
95
|
+
interface UseChannelEffectOptions extends ChannelEffectOptions {
|
|
96
|
+
/**
|
|
97
|
+
* Scope events to a subagent / subgraph / explicit namespace.
|
|
98
|
+
* Defaults to the root namespace. Accepts a ref/getter so reactive
|
|
99
|
+
* state can drive the scope.
|
|
100
|
+
*/
|
|
101
|
+
target?: MaybeRefOrGetter<SelectorTarget>;
|
|
102
|
+
/**
|
|
103
|
+
* Gate the subscription. When `false`, no subscription is opened and
|
|
104
|
+
* no events are delivered. Defaults to `true`. Accepts a ref/getter.
|
|
105
|
+
*/
|
|
106
|
+
enabled?: MaybeRefOrGetter<boolean>;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Side-effect counterpart to {@link useChannel}. Instead of returning a
|
|
110
|
+
* reactive buffer, it invokes `onEvent` once per event for as long as
|
|
111
|
+
* the calling scope is alive — the idiomatic place for analytics,
|
|
112
|
+
* logging, and other fire-and-forget side effects.
|
|
113
|
+
*
|
|
114
|
+
* ```ts
|
|
115
|
+
* useChannelEffect(stream, ["lifecycle", "tools"], {
|
|
116
|
+
* replay: false,
|
|
117
|
+
* onEvent(event) {
|
|
118
|
+
* sendAnalytics(event);
|
|
119
|
+
* },
|
|
120
|
+
* onError(error) {
|
|
121
|
+
* logger.error(error);
|
|
122
|
+
* },
|
|
123
|
+
* });
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* Reactive `channels` / `target` / `enabled` re-bind the subscription
|
|
127
|
+
* when they change. The underlying subscription is shared (ref-counted)
|
|
128
|
+
* with any matching {@link useChannel} consumer. `replay` defaults to
|
|
129
|
+
* `false` (live-only); events buffered before the effect attaches are
|
|
130
|
+
* not re-delivered.
|
|
131
|
+
*
|
|
132
|
+
* Must be called from a component `setup()` (or another effect scope) so
|
|
133
|
+
* the subscription is torn down on `onScopeDispose`.
|
|
134
|
+
*/
|
|
135
|
+
declare function useChannelEffect(stream: AnyStream, channels: MaybeRefOrGetter<readonly Channel[]>, options: UseChannelEffectOptions): void;
|
|
90
136
|
/**
|
|
91
137
|
* Subscribe to a scoped audio-media stream. Each handle is yielded
|
|
92
138
|
* on its first matching `content-block-start`, exposes
|
|
@@ -140,5 +186,5 @@ interface UseSubmissionQueueReturn<StateType extends object = Record<string, unk
|
|
|
140
186
|
declare function useSubmissionQueue<StateType extends object>(stream: StreamHandle<StateType>): UseSubmissionQueueReturn<StateType>;
|
|
141
187
|
declare function useSubmissionQueue(stream: AnyStream): UseSubmissionQueueReturn;
|
|
142
188
|
//#endregion
|
|
143
|
-
export { SelectorTarget, type SubmissionQueueEntry, type SubmissionQueueSnapshot, UseSubmissionQueueReturn, useAudio, useChannel, useExtension, useFiles, useImages, useMessageMetadata, useMessages, useSubmissionQueue, useToolCalls, useValues, useVideo };
|
|
189
|
+
export { SelectorTarget, type SubmissionQueueEntry, type SubmissionQueueSnapshot, UseChannelEffectOptions, UseSubmissionQueueReturn, useAudio, useChannel, useChannelEffect, useExtension, useFiles, useImages, useMessageMetadata, useMessages, useSubmissionQueue, useToolCalls, useValues, useVideo };
|
|
144
190
|
//# sourceMappingURL=selectors.d.ts.map
|
package/dist/selectors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.d.ts","names":[],"sources":["../src/selectors.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"selectors.d.ts","names":[],"sources":["../src/selectors.ts"],"mappings":";;;;;;;;AAgDyB;;;;KAUpB,YAAA,6BAAyC,eAAA,CAC5C,SAAA;;;;;AAgBF;;;;;KAAY,cAAA;EAIN,SAAA;AAAA,IACF,yBAAA,GACA,yBAAA;;AAkEJ;;;;;;;;;;;;;;iBAAgB,WAAA,CACd,MAAA,EAAQ,SAAA,EACR,MAAA,GAAS,gBAAA,CAAiB,cAAA,IACzB,QAAA,CAAS,UAAA,CAAW,WAAA;;;;;;iBAoBP,YAAA,CACd,MAAA,EAAQ,SAAA,EACR,MAAA,GAAS,gBAAA,CAAiB,cAAA,IACzB,QAAA,CAAS,UAAA,CAAW,iBAAA;AAAA,iBACP,YAAA,GAAA,CACd,MAAA,EAAQ,SAAA,EACR,MAAA,GAAS,gBAAA,CAAiB,cAAA,IACzB,QAAA,CAAS,UAAA,CAAW,cAAA,CAAe,CAAA;;;;;;;;;;;;;;iBAgCtB,SAAA,0BAAA,CACd,MAAA,EAAQ,YAAA,CAAa,SAAA,IACpB,QAAA,CAAS,UAAA,CAAW,SAAA;AAAA,iBACP,SAAA,GAAA,CACd,MA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;;;;;;;iBA0BP,kBAAA,CACd,MAAA,EAAQ,SAAA,EACR,SAAA,EAAW,gBAAA,uBACV,WAAA,CAAY,eAAA;;AApNf;;;;;AAEA;UAwOiB,wBAAA,4BACY,MAAA;EAAA,SAElB,OAAA,EAAS,QAAA,CAAS,UAAA,CAAW,uBAAA,CAAwB,SAAA;EAAA,SACrD,IAAA,EAAM,WAAA;EACf,MAAA,CAAO,EAAA,WAAa,OAAA;EACpB,KAAA,IAAS,OAAA;AAAA;AAAA,iBAGK,kBAAA,0BAAA,CACd,MAAA,EAAQ,YAAA,CAAa,SAAA,IACpB,wBAAA,CAAyB,SAAA;AAAA,iBACZ,kBAAA,CAAmB,MAAA,EAAQ,SAAA,GAAY,wBAAA"}
|
package/dist/selectors.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { STREAM_CONTROLLER, getRegistry } from "./use-stream.js";
|
|
2
2
|
import { useProjection } from "./use-projection.js";
|
|
3
|
-
import { computed, onScopeDispose, readonly, shallowRef, toValue, watchEffect } from "vue";
|
|
4
|
-
import { NAMESPACE_SEPARATOR, audioProjection, channelProjection, extensionProjection, filesProjection, imagesProjection, messagesProjection, toolCallsProjection, valuesProjection, videoProjection } from "@langchain/langgraph-sdk/stream";
|
|
3
|
+
import { computed, onScopeDispose, readonly, shallowRef, toValue, watch, watchEffect } from "vue";
|
|
4
|
+
import { NAMESPACE_SEPARATOR, acquireChannelEffect, audioProjection, channelProjection, extensionProjection, filesProjection, imagesProjection, messagesProjection, toolCallsProjection, valuesProjection, videoProjection } from "@langchain/langgraph-sdk/stream";
|
|
5
5
|
//#region src/selectors.ts
|
|
6
6
|
const EMPTY_NAMESPACE = [];
|
|
7
7
|
function resolveNamespace(target) {
|
|
@@ -100,6 +100,62 @@ function useChannel(stream, channels, target, options) {
|
|
|
100
100
|
}
|
|
101
101
|
const EMPTY_EVENTS = [];
|
|
102
102
|
/**
|
|
103
|
+
* Side-effect counterpart to {@link useChannel}. Instead of returning a
|
|
104
|
+
* reactive buffer, it invokes `onEvent` once per event for as long as
|
|
105
|
+
* the calling scope is alive — the idiomatic place for analytics,
|
|
106
|
+
* logging, and other fire-and-forget side effects.
|
|
107
|
+
*
|
|
108
|
+
* ```ts
|
|
109
|
+
* useChannelEffect(stream, ["lifecycle", "tools"], {
|
|
110
|
+
* replay: false,
|
|
111
|
+
* onEvent(event) {
|
|
112
|
+
* sendAnalytics(event);
|
|
113
|
+
* },
|
|
114
|
+
* onError(error) {
|
|
115
|
+
* logger.error(error);
|
|
116
|
+
* },
|
|
117
|
+
* });
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* Reactive `channels` / `target` / `enabled` re-bind the subscription
|
|
121
|
+
* when they change. The underlying subscription is shared (ref-counted)
|
|
122
|
+
* with any matching {@link useChannel} consumer. `replay` defaults to
|
|
123
|
+
* `false` (live-only); events buffered before the effect attaches are
|
|
124
|
+
* not re-delivered.
|
|
125
|
+
*
|
|
126
|
+
* Must be called from a component `setup()` (or another effect scope) so
|
|
127
|
+
* the subscription is torn down on `onScopeDispose`.
|
|
128
|
+
*/
|
|
129
|
+
function useChannelEffect(stream, channels, options) {
|
|
130
|
+
useResolveSubagentNamespace(stream, options.target);
|
|
131
|
+
let dispose = null;
|
|
132
|
+
const detach = () => {
|
|
133
|
+
dispose?.();
|
|
134
|
+
dispose = null;
|
|
135
|
+
};
|
|
136
|
+
watch(() => {
|
|
137
|
+
const enabled = toValue(options.enabled) ?? true;
|
|
138
|
+
const sortedChannels = [...toValue(channels)].sort().join(",");
|
|
139
|
+
const namespace = resolveNamespace(toValue(options.target));
|
|
140
|
+
return `${enabled ? "on" : "off"}|${sortedChannels}|${namespaceKey(namespace)}`;
|
|
141
|
+
}, () => {
|
|
142
|
+
detach();
|
|
143
|
+
if (!(toValue(options.enabled) ?? true)) return;
|
|
144
|
+
const registry = getRegistry(stream);
|
|
145
|
+
if (registry == null) return;
|
|
146
|
+
dispose = acquireChannelEffect(registry, toValue(channels), resolveNamespace(toValue(options.target)), {
|
|
147
|
+
replay: options.replay,
|
|
148
|
+
bufferSize: options.bufferSize,
|
|
149
|
+
onEvent: (event) => options.onEvent(event),
|
|
150
|
+
onError: options.onError ? (error) => options.onError?.(error) : void 0
|
|
151
|
+
});
|
|
152
|
+
}, {
|
|
153
|
+
immediate: true,
|
|
154
|
+
flush: "sync"
|
|
155
|
+
});
|
|
156
|
+
onScopeDispose(detach);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
103
159
|
* Subscribe to a scoped audio-media stream. Each handle is yielded
|
|
104
160
|
* on its first matching `content-block-start`, exposes
|
|
105
161
|
* `.partialBytes` for live access, settles `.blob` / `.objectURL` /
|
|
@@ -182,6 +238,6 @@ function useSubmissionQueue(stream) {
|
|
|
182
238
|
};
|
|
183
239
|
}
|
|
184
240
|
//#endregion
|
|
185
|
-
export { useAudio, useChannel, useExtension, useFiles, useImages, useMessageMetadata, useMessages, useSubmissionQueue, useToolCalls, useValues, useVideo };
|
|
241
|
+
export { useAudio, useChannel, useChannelEffect, useExtension, useFiles, useImages, useMessageMetadata, useMessages, useSubmissionQueue, useToolCalls, useValues, useVideo };
|
|
186
242
|
|
|
187
243
|
//# sourceMappingURL=selectors.js.map
|
package/dist/selectors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.js","names":[],"sources":["../src/selectors.ts"],"sourcesContent":["import {\n computed,\n onScopeDispose,\n readonly,\n shallowRef,\n toValue,\n watchEffect,\n type ComputedRef,\n type MaybeRefOrGetter,\n type ShallowRef,\n} from \"vue\";\nimport type { BaseMessage } from \"@langchain/core/messages\";\nimport {\n NAMESPACE_SEPARATOR,\n audioProjection,\n channelProjection,\n extensionProjection,\n filesProjection,\n imagesProjection,\n messagesProjection,\n toolCallsProjection,\n valuesProjection,\n videoProjection,\n type AssembledToolCall,\n type AudioMedia,\n type Channel,\n type ChannelProjectionOptions,\n type Event,\n type FileMedia,\n type ImageMedia,\n type InferToolCalls,\n type InferStateType,\n type MessageMetadata,\n type MessageMetadataMap,\n type SubagentDiscoverySnapshot,\n type SubgraphDiscoverySnapshot,\n type SubmissionQueueEntry,\n type SubmissionQueueSnapshot,\n type VideoMedia,\n} from \"@langchain/langgraph-sdk/stream\";\nimport {\n getRegistry,\n STREAM_CONTROLLER,\n type AnyStream,\n type UseStreamReturn,\n} from \"./use-stream.js\";\nimport { useProjection } from \"./use-projection.js\";\n\n/**\n * Selector composables don't need to carry `InterruptType` /\n * `ConfigurableType`. Parameterising on `StateType` alone lets\n * callers with a full `useStream<S, I, C>()` handle pass it in without\n * redeclaring those generics at every call site.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype StreamHandle<StateType extends object> = UseStreamReturn<\n StateType,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n any\n>;\n\n/**\n * What a selector composable can be targeted at. Callers can pass:\n * - `undefined` / `null` — root namespace (served by the always-on\n * root store — no extra subscription);\n * - a {@link SubagentDiscoverySnapshot} (`stream.subagents.value.get(...)`);\n * - a {@link SubgraphDiscoverySnapshot} (`stream.subgraphs.value.get(...)`);\n * - an explicit `{ namespace: string[] }`;\n * - a raw `string[]` escape hatch.\n */\nexport type SelectorTarget =\n | undefined\n | null\n | readonly string[]\n | { namespace: readonly string[] }\n | SubagentDiscoverySnapshot\n | SubgraphDiscoverySnapshot;\n\nconst EMPTY_NAMESPACE: readonly string[] = [];\n\nfunction resolveNamespace(target: SelectorTarget): readonly string[] {\n if (target == null) return EMPTY_NAMESPACE;\n if (Array.isArray(target)) return target as readonly string[];\n const obj = target as { namespace?: readonly string[] };\n return obj.namespace ?? EMPTY_NAMESPACE;\n}\n\nfunction isRoot(namespace: readonly string[]): boolean {\n return namespace.length === 0;\n}\n\n/**\n * If `target` is a subagent snapshot still on its default\n * `tools:<toolCallId>` namespace, return that tool-call id. See the\n * React selectors for the rationale (deep-agent subagents execute under\n * a distinct `tools:<uuid>` namespace resolved lazily from history).\n */\nfunction subagentNeedingNamespace(target: SelectorTarget): string | null {\n if (target == null || Array.isArray(target)) return null;\n const obj = target as { id?: unknown; namespace?: readonly string[] };\n if (typeof obj.id !== \"string\" || !Array.isArray(obj.namespace)) return null;\n if (obj.namespace.length === 1 && obj.namespace[0] === `tools:${obj.id}`) {\n return obj.id;\n }\n return null;\n}\n\n/**\n * Lazily resolve a subagent's execution namespace on first scoped use.\n * Re-evaluates if `target` changes; the controller de-dupes and skips\n * already-promoted ids so this is cheap to call from every consumer.\n */\nfunction useResolveSubagentNamespace(\n stream: AnyStream,\n target?: MaybeRefOrGetter<SelectorTarget>\n): void {\n const controller = stream[STREAM_CONTROLLER];\n watchEffect(() => {\n const id = subagentNeedingNamespace(toValue(target));\n if (id != null) void controller.resolveSubagentNamespace(id);\n });\n}\n\nfunction namespaceKey(namespace: readonly string[]): string {\n return namespace.join(NAMESPACE_SEPARATOR);\n}\n\n/**\n * Subscribe to a scoped `messages` stream.\n *\n * Contract:\n * - At the root (no `target`) this returns `stream.messages` — the\n * always-on root projection; no extra subscription is opened.\n * - For any non-root namespace, mount triggers a ref-counted\n * `messages` subscription scoped to that namespace. The\n * subscription is released automatically when the calling scope\n * disappears (and the registry closes the underlying server\n * subscription when the last consumer leaves).\n *\n * Messages are always `BaseMessage` class instances from\n * `@langchain/core/messages`.\n */\nexport function useMessages(\n stream: AnyStream,\n target?: MaybeRefOrGetter<SelectorTarget>\n): Readonly<ShallowRef<BaseMessage[]>> {\n useResolveSubagentNamespace(stream, target);\n const namespace = computed(() => resolveNamespace(toValue(target)));\n if (isRoot(namespace.value)) return stream.messages;\n const key = computed(() => `messages|${namespaceKey(namespace.value)}`);\n return useProjection<BaseMessage[]>(\n getRegistry(stream),\n () => messagesProjection(namespace.value),\n key,\n EMPTY_MESSAGES\n );\n}\n\nconst EMPTY_MESSAGES: BaseMessage[] = [];\n\n/**\n * Subscribe to a scoped `tools` (tool-call) stream. Same target and\n * lifecycle rules as {@link useMessages}; at the root this returns\n * `stream.toolCalls` directly.\n */\nexport function useToolCalls(\n stream: AnyStream,\n target?: MaybeRefOrGetter<SelectorTarget>\n): Readonly<ShallowRef<AssembledToolCall[]>>;\nexport function useToolCalls<T>(\n stream: AnyStream,\n target?: MaybeRefOrGetter<SelectorTarget>\n): Readonly<ShallowRef<InferToolCalls<T>[]>>;\nexport function useToolCalls(\n stream: AnyStream,\n target?: MaybeRefOrGetter<SelectorTarget>\n): Readonly<ShallowRef<AssembledToolCall[]>> {\n useResolveSubagentNamespace(stream, target);\n const namespace = computed(() => resolveNamespace(toValue(target)));\n if (isRoot(namespace.value)) return stream.toolCalls;\n const key = computed(() => `toolCalls|${namespaceKey(namespace.value)}`);\n return useProjection<AssembledToolCall[]>(\n getRegistry(stream),\n () => toolCallsProjection(namespace.value),\n key,\n EMPTY_TOOLCALLS\n );\n}\n\nconst EMPTY_TOOLCALLS: AssembledToolCall[] = [];\n\n/**\n * Subscribe to a scoped `values` stream — the most recent state\n * payload for a namespace. At the root returns `stream.values`.\n *\n * Typing:\n * - **Root** (`useValues(stream)`): returns the `StateType` declared\n * on `useStream<State>()` — non-nullable (the root snapshot always\n * has values, falling back to `initialValues ?? {}`).\n * - **Scoped** (`useValues(stream, target)`): scoped payloads can\n * differ from the root state; callers should annotate the\n * expected shape explicitly (`useValues<SubagentState>(stream,\n * sub)`). Defaults to `unknown` when not annotated.\n */\nexport function useValues<StateType extends object>(\n stream: StreamHandle<StateType>\n): Readonly<ShallowRef<StateType>>;\nexport function useValues<T>(\n stream: AnyStream\n): Readonly<ShallowRef<InferStateType<T>>>;\nexport function useValues<T = unknown>(\n stream: AnyStream,\n target: SelectorTarget,\n options?: { messagesKey?: string }\n): Readonly<ShallowRef<T | undefined>>;\nexport function useValues(\n stream: AnyStream,\n target?: SelectorTarget,\n options?: { messagesKey?: string }\n): Readonly<ShallowRef<unknown>> {\n const namespace = resolveNamespace(target);\n if (isRoot(namespace)) return stream.values as Readonly<ShallowRef<unknown>>;\n const messagesKey = options?.messagesKey ?? \"messages\";\n const key = `values|${messagesKey}|${namespaceKey(namespace)}`;\n return useProjection<unknown>(\n getRegistry(stream),\n () => valuesProjection<unknown>(namespace, messagesKey),\n key,\n undefined\n );\n}\n\n/**\n * Subscribe to a `custom:<name>` stream extension — the most-recent\n * payload emitted by the transformer, scoped to the target namespace.\n *\n * Returns only the latest value and resumes across serial runs, so it is\n * ideal for \"current state\" panels (progress, score, status). When you\n * need the full history of events rather than just the latest payload,\n * use {@link useChannel} instead.\n */\nexport function useExtension<T = unknown>(\n stream: AnyStream,\n name: string,\n target?: SelectorTarget\n): Readonly<ShallowRef<T | undefined>> {\n const namespace = resolveNamespace(target);\n const key = `extension|${name}|${namespaceKey(namespace)}`;\n return useProjection<T | undefined>(\n getRegistry(stream),\n () => extensionProjection<T>(name, namespace),\n key,\n undefined\n );\n}\n\n/**\n * Raw-events escape hatch. Subscribes to one or more channels at a\n * namespace and returns a bounded buffer of raw protocol events.\n *\n * The buffer keeps accumulating across serial runs for the lifetime of\n * the thread, so this is the hook to use for an event log / stream of a\n * custom channel (e.g. `[\"custom:redaction-stats\"]`). When you only need\n * the latest payload of a single `custom:<name>` channel, prefer\n * {@link useExtension}. For the common message/tool/value cases prefer\n * {@link useMessages} / {@link useToolCalls} / {@link useValues}.\n */\nexport type UseChannelOptions = ChannelProjectionOptions;\n\nexport function useChannel(\n stream: AnyStream,\n channels: readonly Channel[],\n target?: SelectorTarget,\n options?: UseChannelOptions\n): Readonly<ShallowRef<Event[]>> {\n const namespace = resolveNamespace(target);\n const sortedChannels = [...channels].sort().join(\",\");\n const key = `channel|${options?.bufferSize ?? \"default\"}|${(options?.replay ?? true) ? \"replay\" : \"live\"}|${sortedChannels}|${namespaceKey(namespace)}`;\n return useProjection<Event[]>(\n getRegistry(stream),\n () => channelProjection(channels, namespace, options),\n key,\n EMPTY_EVENTS\n );\n}\n\nconst EMPTY_EVENTS: Event[] = [];\n\n/**\n * Subscribe to a scoped audio-media stream. Each handle is yielded\n * on its first matching `content-block-start`, exposes\n * `.partialBytes` for live access, settles `.blob` / `.objectURL` /\n * `.transcript` on `message-finish`, and surfaces errors via\n * `.error`.\n */\nexport function useAudio(\n stream: AnyStream,\n target?: SelectorTarget\n): Readonly<ShallowRef<AudioMedia[]>> {\n const namespace = resolveNamespace(target);\n const key = `audio|${namespaceKey(namespace)}`;\n return useProjection<AudioMedia[]>(\n getRegistry(stream),\n () => audioProjection(namespace),\n key,\n EMPTY_AUDIO\n );\n}\n\nconst EMPTY_AUDIO: AudioMedia[] = [];\n\n/**\n * Subscribe to a scoped image-media stream. Pair with\n * {@link useMediaURL} for `<img src>`.\n */\nexport function useImages(\n stream: AnyStream,\n target?: SelectorTarget\n): Readonly<ShallowRef<ImageMedia[]>> {\n const namespace = resolveNamespace(target);\n const key = `images|${namespaceKey(namespace)}`;\n return useProjection<ImageMedia[]>(\n getRegistry(stream),\n () => imagesProjection(namespace),\n key,\n EMPTY_IMAGES\n );\n}\n\nconst EMPTY_IMAGES: ImageMedia[] = [];\n\n/**\n * Subscribe to a scoped video-media stream. Pair with\n * {@link useMediaURL} for `<video src>`.\n */\nexport function useVideo(\n stream: AnyStream,\n target?: SelectorTarget\n): Readonly<ShallowRef<VideoMedia[]>> {\n const namespace = resolveNamespace(target);\n const key = `video|${namespaceKey(namespace)}`;\n return useProjection<VideoMedia[]>(\n getRegistry(stream),\n () => videoProjection(namespace),\n key,\n EMPTY_VIDEO\n );\n}\n\nconst EMPTY_VIDEO: VideoMedia[] = [];\n\n/**\n * Subscribe to a scoped file-media stream. Pair with\n * {@link useMediaURL} for an `<a download href>` target.\n */\nexport function useFiles(\n stream: AnyStream,\n target?: SelectorTarget\n): Readonly<ShallowRef<FileMedia[]>> {\n const namespace = resolveNamespace(target);\n const key = `files|${namespaceKey(namespace)}`;\n return useProjection<FileMedia[]>(\n getRegistry(stream),\n () => filesProjection(namespace),\n key,\n EMPTY_FILES\n );\n}\n\nconst EMPTY_FILES: FileMedia[] = [];\n\n/**\n * Read metadata recorded for a specific message id — today exposes\n * `parentCheckpointId`, the checkpoint the message was first seen on.\n * Designed for fork / edit flows:\n *\n * ```ts\n * const meta = useMessageMetadata(stream, () => msg.id);\n * // meta.value?.parentCheckpointId\n * ```\n *\n * `messageId` accepts a raw string, a `Ref<string | undefined>`, or\n * a getter — the binding re-evaluates whenever the id changes.\n */\nexport function useMessageMetadata(\n stream: AnyStream,\n messageId: MaybeRefOrGetter<string | undefined>\n): ComputedRef<MessageMetadata | undefined> {\n const store = stream[STREAM_CONTROLLER].messageMetadataStore;\n const mapRef = shallowRef<MessageMetadataMap>(store.getSnapshot());\n const unsubscribe = store.subscribe(() => {\n mapRef.value = store.getSnapshot();\n });\n onScopeDispose(unsubscribe);\n\n return computed<MessageMetadata | undefined>(() => {\n const key = toValue(messageId);\n if (key == null) return undefined;\n return mapRef.value.get(key);\n });\n}\n\n/**\n * Reactive handle on the server-side submission queue.\n *\n * Populated when `submit()` is invoked with\n * `multitaskStrategy: \"enqueue\"` while another run is in flight. The\n * returned refs are shared per call — safe to pass into `v-for`.\n */\nexport interface UseSubmissionQueueReturn<\n StateType extends object = Record<string, unknown>,\n> {\n readonly entries: Readonly<ShallowRef<SubmissionQueueSnapshot<StateType>>>;\n readonly size: ComputedRef<number>;\n cancel(id: string): Promise<boolean>;\n clear(): Promise<void>;\n}\n\nexport function useSubmissionQueue<StateType extends object>(\n stream: StreamHandle<StateType>\n): UseSubmissionQueueReturn<StateType>;\nexport function useSubmissionQueue(stream: AnyStream): UseSubmissionQueueReturn;\nexport function useSubmissionQueue(\n stream: AnyStream\n): UseSubmissionQueueReturn {\n const controller = stream[STREAM_CONTROLLER];\n const store = controller.queueStore;\n const entries = shallowRef<SubmissionQueueSnapshot>(store.getSnapshot());\n const unsubscribe = store.subscribe(() => {\n entries.value = store.getSnapshot();\n });\n onScopeDispose(unsubscribe);\n\n return {\n entries: readonly(entries) as Readonly<ShallowRef<SubmissionQueueSnapshot>>,\n size: computed(() => entries.value.length),\n cancel: (id) => controller.cancelQueued(id),\n clear: () => controller.clearQueue(),\n };\n}\n\nexport type { SubmissionQueueEntry, SubmissionQueueSnapshot };\n"],"mappings":";;;;;AAgFA,MAAM,kBAAqC,EAAE;AAE7C,SAAS,iBAAiB,QAA2C;AACnE,KAAI,UAAU,KAAM,QAAO;AAC3B,KAAI,MAAM,QAAQ,OAAO,CAAE,QAAO;AAElC,QADY,OACD,aAAa;;AAG1B,SAAS,OAAO,WAAuC;AACrD,QAAO,UAAU,WAAW;;;;;;;;AAS9B,SAAS,yBAAyB,QAAuC;AACvE,KAAI,UAAU,QAAQ,MAAM,QAAQ,OAAO,CAAE,QAAO;CACpD,MAAM,MAAM;AACZ,KAAI,OAAO,IAAI,OAAO,YAAY,CAAC,MAAM,QAAQ,IAAI,UAAU,CAAE,QAAO;AACxE,KAAI,IAAI,UAAU,WAAW,KAAK,IAAI,UAAU,OAAO,SAAS,IAAI,KAClE,QAAO,IAAI;AAEb,QAAO;;;;;;;AAQT,SAAS,4BACP,QACA,QACM;CACN,MAAM,aAAa,OAAO;AAC1B,mBAAkB;EAChB,MAAM,KAAK,yBAAyB,QAAQ,OAAO,CAAC;AACpD,MAAI,MAAM,KAAW,YAAW,yBAAyB,GAAG;GAC5D;;AAGJ,SAAS,aAAa,WAAsC;AAC1D,QAAO,UAAU,KAAK,oBAAoB;;;;;;;;;;;;;;;;;AAkB5C,SAAgB,YACd,QACA,QACqC;AACrC,6BAA4B,QAAQ,OAAO;CAC3C,MAAM,YAAY,eAAe,iBAAiB,QAAQ,OAAO,CAAC,CAAC;AACnE,KAAI,OAAO,UAAU,MAAM,CAAE,QAAO,OAAO;CAC3C,MAAM,MAAM,eAAe,YAAY,aAAa,UAAU,MAAM,GAAG;AACvE,QAAO,cACL,YAAY,OAAO,QACb,mBAAmB,UAAU,MAAM,EACzC,KACA,eACD;;AAGH,MAAM,iBAAgC,EAAE;AAexC,SAAgB,aACd,QACA,QAC2C;AAC3C,6BAA4B,QAAQ,OAA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AM,eAAe,QAAQ,MAAM,OAAO;EAC1C,SAAS,OAAO,WAAW,aAAa,GAAG;EAC3C,aAAa,WAAW,YAAY;EACrC"}
|
|
1
|
+
{"version":3,"file":"selectors.js","names":[],"sources":["../src/selectors.ts"],"sourcesContent":["import {\n computed,\n onScopeDispose,\n readonly,\n shallowRef,\n toValue,\n watch,\n watchEffect,\n type ComputedRef,\n type MaybeRefOrGetter,\n type ShallowRef,\n} from \"vue\";\nimport type { BaseMessage } from \"@langchain/core/messages\";\nimport {\n NAMESPACE_SEPARATOR,\n acquireChannelEffect,\n audioProjection,\n channelProjection,\n extensionProjection,\n filesProjection,\n imagesProjection,\n messagesProjection,\n toolCallsProjection,\n valuesProjection,\n videoProjection,\n type AssembledToolCall,\n type AudioMedia,\n type Channel,\n type ChannelEffectOptions,\n type ChannelProjectionOptions,\n type Event,\n type FileMedia,\n type ImageMedia,\n type InferToolCalls,\n type InferStateType,\n type MessageMetadata,\n type MessageMetadataMap,\n type SubagentDiscoverySnapshot,\n type SubgraphDiscoverySnapshot,\n type SubmissionQueueEntry,\n type SubmissionQueueSnapshot,\n type VideoMedia,\n} from \"@langchain/langgraph-sdk/stream\";\nimport {\n getRegistry,\n STREAM_CONTROLLER,\n type AnyStream,\n type UseStreamReturn,\n} from \"./use-stream.js\";\nimport { useProjection } from \"./use-projection.js\";\n\n/**\n * Selector composables don't need to carry `InterruptType` /\n * `ConfigurableType`. Parameterising on `StateType` alone lets\n * callers with a full `useStream<S, I, C>()` handle pass it in without\n * redeclaring those generics at every call site.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype StreamHandle<StateType extends object> = UseStreamReturn<\n StateType,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n any\n>;\n\n/**\n * What a selector composable can be targeted at. Callers can pass:\n * - `undefined` / `null` — root namespace (served by the always-on\n * root store — no extra subscription);\n * - a {@link SubagentDiscoverySnapshot} (`stream.subagents.value.get(...)`);\n * - a {@link SubgraphDiscoverySnapshot} (`stream.subgraphs.value.get(...)`);\n * - an explicit `{ namespace: string[] }`;\n * - a raw `string[]` escape hatch.\n */\nexport type SelectorTarget =\n | undefined\n | null\n | readonly string[]\n | { namespace: readonly string[] }\n | SubagentDiscoverySnapshot\n | SubgraphDiscoverySnapshot;\n\nconst EMPTY_NAMESPACE: readonly string[] = [];\n\nfunction resolveNamespace(target: SelectorTarget): readonly string[] {\n if (target == null) return EMPTY_NAMESPACE;\n if (Array.isArray(target)) return target as readonly string[];\n const obj = target as { namespace?: readonly string[] };\n return obj.namespace ?? EMPTY_NAMESPACE;\n}\n\nfunction isRoot(namespace: readonly string[]): boolean {\n return namespace.length === 0;\n}\n\n/**\n * If `target` is a subagent snapshot still on its default\n * `tools:<toolCallId>` namespace, return that tool-call id. See the\n * React selectors for the rationale (deep-agent subagents execute under\n * a distinct `tools:<uuid>` namespace resolved lazily from history).\n */\nfunction subagentNeedingNamespace(target: SelectorTarget): string | null {\n if (target == null || Array.isArray(target)) return null;\n const obj = target as { id?: unknown; namespace?: readonly string[] };\n if (typeof obj.id !== \"string\" || !Array.isArray(obj.namespace)) return null;\n if (obj.namespace.length === 1 && obj.namespace[0] === `tools:${obj.id}`) {\n return obj.id;\n }\n return null;\n}\n\n/**\n * Lazily resolve a subagent's execution namespace on first scoped use.\n * Re-evaluates if `target` changes; the controller de-dupes and skips\n * already-promoted ids so this is cheap to call from every consumer.\n */\nfunction useResolveSubagentNamespace(\n stream: AnyStream,\n target?: MaybeRefOrGetter<SelectorTarget>\n): void {\n const controller = stream[STREAM_CONTROLLER];\n watchEffect(() => {\n const id = subagentNeedingNamespace(toValue(target));\n if (id != null) void controller.resolveSubagentNamespace(id);\n });\n}\n\nfunction namespaceKey(namespace: readonly string[]): string {\n return namespace.join(NAMESPACE_SEPARATOR);\n}\n\n/**\n * Subscribe to a scoped `messages` stream.\n *\n * Contract:\n * - At the root (no `target`) this returns `stream.messages` — the\n * always-on root projection; no extra subscription is opened.\n * - For any non-root namespace, mount triggers a ref-counted\n * `messages` subscription scoped to that namespace. The\n * subscription is released automatically when the calling scope\n * disappears (and the registry closes the underlying server\n * subscription when the last consumer leaves).\n *\n * Messages are always `BaseMessage` class instances from\n * `@langchain/core/messages`.\n */\nexport function useMessages(\n stream: AnyStream,\n target?: MaybeRefOrGetter<SelectorTarget>\n): Readonly<ShallowRef<BaseMessage[]>> {\n useResolveSubagentNamespace(stream, target);\n const namespace = computed(() => resolveNamespace(toValue(target)));\n if (isRoot(namespace.value)) return stream.messages;\n const key = computed(() => `messages|${namespaceKey(namespace.value)}`);\n return useProjection<BaseMessage[]>(\n getRegistry(stream),\n () => messagesProjection(namespace.value),\n key,\n EMPTY_MESSAGES\n );\n}\n\nconst EMPTY_MESSAGES: BaseMessage[] = [];\n\n/**\n * Subscribe to a scoped `tools` (tool-call) stream. Same target and\n * lifecycle rules as {@link useMessages}; at the root this returns\n * `stream.toolCalls` directly.\n */\nexport function useToolCalls(\n stream: AnyStream,\n target?: MaybeRefOrGetter<SelectorTarget>\n): Readonly<ShallowRef<AssembledToolCall[]>>;\nexport function useToolCalls<T>(\n stream: AnyStream,\n target?: MaybeRefOrGetter<SelectorTarget>\n): Readonly<ShallowRef<InferToolCalls<T>[]>>;\nexport function useToolCalls(\n stream: AnyStream,\n target?: MaybeRefOrGetter<SelectorTarget>\n): Readonly<ShallowRef<AssembledToolCall[]>> {\n useResolveSubagentNamespace(stream, target);\n const namespace = computed(() => resolveNamespace(toValue(target)));\n if (isRoot(namespace.value)) return stream.toolCalls;\n const key = computed(() => `toolCalls|${namespaceKey(namespace.value)}`);\n return useProjection<AssembledToolCall[]>(\n getRegistry(stream),\n () => toolCallsProjection(namespace.value),\n key,\n EMPTY_TOOLCALLS\n );\n}\n\nconst EMPTY_TOOLCALLS: AssembledToolCall[] = [];\n\n/**\n * Subscribe to a scoped `values` stream — the most recent state\n * payload for a namespace. At the root returns `stream.values`.\n *\n * Typing:\n * - **Root** (`useValues(stream)`): returns the `StateType` declared\n * on `useStream<State>()` — non-nullable (the root snapshot always\n * has values, falling back to `initialValues ?? {}`).\n * - **Scoped** (`useValues(stream, target)`): scoped payloads can\n * differ from the root state; callers should annotate the\n * expected shape explicitly (`useValues<SubagentState>(stream,\n * sub)`). Defaults to `unknown` when not annotated.\n */\nexport function useValues<StateType extends object>(\n stream: StreamHandle<StateType>\n): Readonly<ShallowRef<StateType>>;\nexport function useValues<T>(\n stream: AnyStream\n): Readonly<ShallowRef<InferStateType<T>>>;\nexport function useValues<T = unknown>(\n stream: AnyStream,\n target: SelectorTarget,\n options?: { messagesKey?: string }\n): Readonly<ShallowRef<T | undefined>>;\nexport function useValues(\n stream: AnyStream,\n target?: SelectorTarget,\n options?: { messagesKey?: string }\n): Readonly<ShallowRef<unknown>> {\n const namespace = resolveNamespace(target);\n if (isRoot(namespace)) return stream.values as Readonly<ShallowRef<unknown>>;\n const messagesKey = options?.messagesKey ?? \"messages\";\n const key = `values|${messagesKey}|${namespaceKey(namespace)}`;\n return useProjection<unknown>(\n getRegistry(stream),\n () => valuesProjection<unknown>(namespace, messagesKey),\n key,\n undefined\n );\n}\n\n/**\n * Subscribe to a `custom:<name>` stream extension — the most-recent\n * payload emitted by the transformer, scoped to the target namespace.\n *\n * Returns only the latest value and resumes across serial runs, so it is\n * ideal for \"current state\" panels (progress, score, status). When you\n * need the full history of events rather than just the latest payload,\n * use {@link useChannel} instead.\n */\nexport function useExtension<T = unknown>(\n stream: AnyStream,\n name: string,\n target?: SelectorTarget\n): Readonly<ShallowRef<T | undefined>> {\n const namespace = resolveNamespace(target);\n const key = `extension|${name}|${namespaceKey(namespace)}`;\n return useProjection<T | undefined>(\n getRegistry(stream),\n () => extensionProjection<T>(name, namespace),\n key,\n undefined\n );\n}\n\n/**\n * Raw-events escape hatch. Subscribes to one or more channels at a\n * namespace and returns a bounded buffer of raw protocol events.\n *\n * The buffer keeps accumulating across serial runs for the lifetime of\n * the thread, so this is the hook to use for an event log / stream of a\n * custom channel (e.g. `[\"custom:redaction-stats\"]`). When you only need\n * the latest payload of a single `custom:<name>` channel, prefer\n * {@link useExtension}. For the common message/tool/value cases prefer\n * {@link useMessages} / {@link useToolCalls} / {@link useValues}.\n */\nexport type UseChannelOptions = ChannelProjectionOptions;\n\nexport function useChannel(\n stream: AnyStream,\n channels: readonly Channel[],\n target?: SelectorTarget,\n options?: UseChannelOptions\n): Readonly<ShallowRef<Event[]>> {\n const namespace = resolveNamespace(target);\n const sortedChannels = [...channels].sort().join(\",\");\n const key = `channel|${options?.bufferSize ?? \"default\"}|${(options?.replay ?? true) ? \"replay\" : \"live\"}|${sortedChannels}|${namespaceKey(namespace)}`;\n return useProjection<Event[]>(\n getRegistry(stream),\n () => channelProjection(channels, namespace, options),\n key,\n EMPTY_EVENTS\n );\n}\n\nconst EMPTY_EVENTS: Event[] = [];\n\n/**\n * Options for {@link useChannelEffect}. Extends the projection options\n * (`bufferSize`, `replay`) with the per-event callback, an optional\n * error sink, a reactive `target` scope, and a reactive `enabled` gate.\n */\nexport interface UseChannelEffectOptions extends ChannelEffectOptions {\n /**\n * Scope events to a subagent / subgraph / explicit namespace.\n * Defaults to the root namespace. Accepts a ref/getter so reactive\n * state can drive the scope.\n */\n target?: MaybeRefOrGetter<SelectorTarget>;\n /**\n * Gate the subscription. When `false`, no subscription is opened and\n * no events are delivered. Defaults to `true`. Accepts a ref/getter.\n */\n enabled?: MaybeRefOrGetter<boolean>;\n}\n\n/**\n * Side-effect counterpart to {@link useChannel}. Instead of returning a\n * reactive buffer, it invokes `onEvent` once per event for as long as\n * the calling scope is alive — the idiomatic place for analytics,\n * logging, and other fire-and-forget side effects.\n *\n * ```ts\n * useChannelEffect(stream, [\"lifecycle\", \"tools\"], {\n * replay: false,\n * onEvent(event) {\n * sendAnalytics(event);\n * },\n * onError(error) {\n * logger.error(error);\n * },\n * });\n * ```\n *\n * Reactive `channels` / `target` / `enabled` re-bind the subscription\n * when they change. The underlying subscription is shared (ref-counted)\n * with any matching {@link useChannel} consumer. `replay` defaults to\n * `false` (live-only); events buffered before the effect attaches are\n * not re-delivered.\n *\n * Must be called from a component `setup()` (or another effect scope) so\n * the subscription is torn down on `onScopeDispose`.\n */\nexport function useChannelEffect(\n stream: AnyStream,\n channels: MaybeRefOrGetter<readonly Channel[]>,\n options: UseChannelEffectOptions\n): void {\n useResolveSubagentNamespace(stream, options.target);\n\n let dispose: (() => void) | null = null;\n const detach = () => {\n dispose?.();\n dispose = null;\n };\n\n watch(\n () => {\n const enabled = toValue(options.enabled) ?? true;\n const sortedChannels = [...toValue(channels)].sort().join(\",\");\n const namespace = resolveNamespace(toValue(options.target));\n // Return a stable string so the watcher only re-acquires when the\n // resolved scope actually changes (not on every getter call).\n return `${enabled ? \"on\" : \"off\"}|${sortedChannels}|${namespaceKey(namespace)}`;\n },\n () => {\n detach();\n const enabled = toValue(options.enabled) ?? true;\n if (!enabled) return;\n const registry = getRegistry(stream);\n if (registry == null) return;\n const resolvedChannels = toValue(channels);\n const namespace = resolveNamespace(toValue(options.target));\n dispose = acquireChannelEffect(registry, resolvedChannels, namespace, {\n replay: options.replay,\n bufferSize: options.bufferSize,\n // Read callbacks lazily so a fresh closure never re-acquires.\n onEvent: (event) => options.onEvent(event),\n onError: options.onError\n ? (error) => options.onError?.(error)\n : undefined,\n });\n },\n { immediate: true, flush: \"sync\" }\n );\n\n onScopeDispose(detach);\n}\n\n/**\n * Subscribe to a scoped audio-media stream. Each handle is yielded\n * on its first matching `content-block-start`, exposes\n * `.partialBytes` for live access, settles `.blob` / `.objectURL` /\n * `.transcript` on `message-finish`, and surfaces errors via\n * `.error`.\n */\nexport function useAudio(\n stream: AnyStream,\n target?: SelectorTarget\n): Readonly<ShallowRef<AudioMedia[]>> {\n const namespace = resolveNamespace(target);\n const key = `audio|${namespaceKey(namespace)}`;\n return useProjection<AudioMedia[]>(\n getRegistry(stream),\n () => audioProjection(namespace),\n key,\n EMPTY_AUDIO\n );\n}\n\nconst EMPTY_AUDIO: AudioMedia[] = [];\n\n/**\n * Subscribe to a scoped image-media stream. Pair with\n * {@link useMediaURL} for `<img src>`.\n */\nexport function useImages(\n stream: AnyStream,\n target?: SelectorTarget\n): Readonly<ShallowRef<ImageMedia[]>> {\n const namespace = resolveNamespace(target);\n const key = `images|${namespaceKey(namespace)}`;\n return useProjection<ImageMedia[]>(\n getRegistry(stream),\n () => imagesProjection(namespace),\n key,\n EMPTY_IMAGES\n );\n}\n\nconst EMPTY_IMAGES: ImageMedia[] = [];\n\n/**\n * Subscribe to a scoped video-media stream. Pair with\n * {@link useMediaURL} for `<video src>`.\n */\nexport function useVideo(\n stream: AnyStream,\n target?: SelectorTarget\n): Readonly<ShallowRef<VideoMedia[]>> {\n const namespace = resolveNamespace(target);\n const key = `video|${namespaceKey(namespace)}`;\n return useProjection<VideoMedia[]>(\n getRegistry(stream),\n () => videoProjection(namespace),\n key,\n EMPTY_VIDEO\n );\n}\n\nconst EMPTY_VIDEO: VideoMedia[] = [];\n\n/**\n * Subscribe to a scoped file-media stream. Pair with\n * {@link useMediaURL} for an `<a download href>` target.\n */\nexport function useFiles(\n stream: AnyStream,\n target?: SelectorTarget\n): Readonly<ShallowRef<FileMedia[]>> {\n const namespace = resolveNamespace(target);\n const key = `files|${namespaceKey(namespace)}`;\n return useProjection<FileMedia[]>(\n getRegistry(stream),\n () => filesProjection(namespace),\n key,\n EMPTY_FILES\n );\n}\n\nconst EMPTY_FILES: FileMedia[] = [];\n\n/**\n * Read metadata recorded for a specific message id — today exposes\n * `parentCheckpointId`, the checkpoint the message was first seen on.\n * Designed for fork / edit flows:\n *\n * ```ts\n * const meta = useMessageMetadata(stream, () => msg.id);\n * // meta.value?.parentCheckpointId\n * ```\n *\n * `messageId` accepts a raw string, a `Ref<string | undefined>`, or\n * a getter — the binding re-evaluates whenever the id changes.\n */\nexport function useMessageMetadata(\n stream: AnyStream,\n messageId: MaybeRefOrGetter<string | undefined>\n): ComputedRef<MessageMetadata | undefined> {\n const store = stream[STREAM_CONTROLLER].messageMetadataStore;\n const mapRef = shallowRef<MessageMetadataMap>(store.getSnapshot());\n const unsubscribe = store.subscribe(() => {\n mapRef.value = store.getSnapshot();\n });\n onScopeDispose(unsubscribe);\n\n return computed<MessageMetadata | undefined>(() => {\n const key = toValue(messageId);\n if (key == null) return undefined;\n return mapRef.value.get(key);\n });\n}\n\n/**\n * Reactive handle on the server-side submission queue.\n *\n * Populated when `submit()` is invoked with\n * `multitaskStrategy: \"enqueue\"` while another run is in flight. The\n * returned refs are shared per call — safe to pass into `v-for`.\n */\nexport interface UseSubmissionQueueReturn<\n StateType extends object = Record<string, unknown>,\n> {\n readonly entries: Readonly<ShallowRef<SubmissionQueueSnapshot<StateType>>>;\n readonly size: ComputedRef<number>;\n cancel(id: string): Promise<boolean>;\n clear(): Promise<void>;\n}\n\nexport function useSubmissionQueue<StateType extends object>(\n stream: StreamHandle<StateType>\n): UseSubmissionQueueReturn<StateType>;\nexport function useSubmissionQueue(stream: AnyStream): UseSubmissionQueueReturn;\nexport function useSubmissionQueue(\n stream: AnyStream\n): UseSubmissionQueueReturn {\n const controller = stream[STREAM_CONTROLLER];\n const store = controller.queueStore;\n const entries = shallowRef<SubmissionQueueSnapshot>(store.getSnapshot());\n const unsubscribe = store.subscribe(() => {\n entries.value = store.getSnapshot();\n });\n onScopeDispose(unsubscribe);\n\n return {\n entries: readonly(entries) as Readonly<ShallowRef<SubmissionQueueSnapshot>>,\n size: computed(() => entries.value.length),\n cancel: (id) => controller.cancelQueued(id),\n clear: () => controller.clearQueue(),\n };\n}\n\nexport type { SubmissionQueueEntry, SubmissionQueueSnapshot };\n"],"mappings":";;;;;AAmFA,MAAM,kBAAqC,EAAE;AAE7C,SAAS,iBAAiB,QAA2C;AACnE,KAAI,UAAU,KAAM,QAAO;AAC3B,KAAI,MAAM,QAAQ,OAAO,CAAE,QAAO;AAElC,QADY,OACD,aAAa;;AAG1B,SAAS,OAAO,WAAuC;AACrD,QAAO,UAAU,WAAW;;;;;;;;AA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AC1C,MAAM,QAAQ,OAAO,mBAAmB;CACxC,MAAM,SAAS,WAA+B,MAAM,aAAa,CAAC;AAIlE,gBAHoB,MAAM,gBAAgB;AACxC,SAAO,QAAQ,MAAM,aAAa;GAClC,CACyB;AAE3B,QAAO,eAA4C;EACjD,MAAM,MAAM,QAAQ,UAAU;AAC9B,MAAI,OAAO,KAAM,QAAO,KAAA;AACxB,SAAO,OAAO,MAAM,IAAI,IAAI;GAC5B;;AAuBJ,SAAgB,mBACd,QAC0B;CAC1B,MAAM,aAAa,OAAO;CAC1B,MAAM,QAAQ,WAAW;CACzB,MAAM,UAAU,WAAoC,MAAM,aAAa,CAAC;AAIxE,gBAHoB,MAAM,gBAAgB;AACxC,UAAQ,QAAQ,MAAM,aAAa;GACnC,CACyB;AAE3B,QAAO;EACL,SAAS,SAAS,QAAQ;EAC1B,MAAM,eAAe,QAAQ,MAAM,OAAO;EAC1C,SAAS,OAAO,WAAW,aAAa,GAAG;EAC3C,aAAa,WAAW,YAAY;EACrC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/vue",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.22",
|
|
4
4
|
"description": "Vue integration for LangGraph & LangChain",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"directory": "libs/sdk-vue"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@langchain/langgraph-sdk": "1.9.
|
|
13
|
+
"@langchain/langgraph-sdk": "1.9.21"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@hono/node-server": "^1.19.13",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"vue": "^3.5.35",
|
|
32
32
|
"webdriverio": "^9.25.0",
|
|
33
33
|
"zod": "^4.3.6",
|
|
34
|
-
"@langchain/langgraph": "1.4.
|
|
34
|
+
"@langchain/langgraph": "1.4.1",
|
|
35
35
|
"@langchain/langgraph-api": "1.3.0",
|
|
36
36
|
"@langchain/langgraph-checkpoint": "1.1.0"
|
|
37
37
|
},
|