@langchain/svelte 1.0.17 → 1.0.18
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/selectors.svelte.cjs +6 -1
- package/dist/selectors.svelte.cjs.map +1 -1
- package/dist/selectors.svelte.d.cts +13 -3
- package/dist/selectors.svelte.d.cts.map +1 -1
- package/dist/selectors.svelte.d.ts +13 -3
- package/dist/selectors.svelte.d.ts.map +1 -1
- package/dist/selectors.svelte.js +6 -1
- package/dist/selectors.svelte.js.map +1 -1
- package/package.json +2 -2
|
@@ -115,9 +115,14 @@ function useValues(stream, target, options) {
|
|
|
115
115
|
return selectFromTarget(stream, target, void 0, (ns) => (0, _langchain_langgraph_sdk_stream.valuesProjection)(ns, messagesKey), `values|${messagesKey}`);
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
|
-
* Subscribe to a `custom:<name>` stream extension — most-recent
|
|
118
|
+
* Subscribe to a `custom:<name>` stream extension — the most-recent
|
|
119
119
|
* payload emitted by the transformer, scoped to the target namespace.
|
|
120
120
|
*
|
|
121
|
+
* Returns only the latest value and resumes across serial runs, so it is
|
|
122
|
+
* ideal for "current state" panels (progress, score, status). When you
|
|
123
|
+
* need the full history of events rather than just the latest payload,
|
|
124
|
+
* use {@link useChannel} instead.
|
|
125
|
+
*
|
|
121
126
|
* `name` accepts either a plain string or a getter so component
|
|
122
127
|
* state can drive the extension name at runtime.
|
|
123
128
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.svelte.cjs","names":["NAMESPACE_SEPARATOR","STREAM_CONTROLLER","useProjection","getRegistry"],"sources":["../src/selectors.svelte.ts"],"sourcesContent":["import 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.svelte.js\";\nimport {\n useProjection,\n type ReactiveValue,\n type ValueOrGetter,\n} from \"./use-projection.svelte.js\";\n\n/**\n * Parameterise selectors on `StateType` alone so callers with a full\n * `useStream<S, I, C>()` handle don't have to redeclare\n * `InterruptType` / `ConfigurableType` at every call site.\n */\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 targets. Callers can pass:\n * - `undefined` / `null` — root namespace (served by the always-on\n * root store; no extra subscription opens);\n * - a {@link SubagentDiscoverySnapshot} (`stream.subagents.get(...)`);\n * - a {@link SubgraphDiscoverySnapshot}\n * (`stream.subgraphs.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\nfunction namespaceKey(namespace: readonly string[]): string {\n return namespace.join(NAMESPACE_SEPARATOR);\n}\n\nfunction isGetter<T>(input: ValueOrGetter<T> | undefined): input is () => T {\n return typeof input === \"function\";\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 when a reactive `target` changes; the controller\n * de-dupes and skips already-promoted ids.\n */\nfunction useResolveSubagentNamespace(\n stream: AnyStream,\n target: ValueOrGetter<SelectorTarget> | undefined\n): void {\n const controller = stream[STREAM_CONTROLLER];\n $effect(() => {\n const resolved = isGetter(target) ? target() : target;\n const id = subagentNeedingNamespace(resolved);\n if (id != null) void controller.resolveSubagentNamespace(id);\n });\n}\n\n/**\n * Internal helper that wires a reactive-or-static target into\n * {@link useProjection}. Encapsulates the bookkeeping every selector\n * otherwise repeats.\n */\nfunction selectFromTarget<T>(\n stream: AnyStream,\n target: ValueOrGetter<SelectorTarget> | undefined,\n initialValue: T,\n makeSpec: (\n namespace: readonly string[]\n ) => import(\"@langchain/langgraph-sdk/stream\").ProjectionSpec<T>,\n keyPrefix: string\n): ReactiveValue<T> {\n if (isGetter(target)) {\n const getTarget = target;\n return useProjection<T>(\n () => {\n const ns = resolveNamespace(getTarget());\n return isRoot(ns) ? null : getRegistry(stream);\n },\n () => makeSpec(resolveNamespace(getTarget())),\n () => `${keyPrefix}|${namespaceKey(resolveNamespace(getTarget()))}`,\n initialValue\n );\n }\n const ns = resolveNamespace(target);\n // Static root: we deliberately don't short-circuit here because\n // each selector owns the root fallback shape (`stream.messages`\n // vs `stream.values` vs `stream.toolCalls`). Callers use the\n // dedicated wrappers below.\n const key = `${keyPrefix}|${namespaceKey(ns)}`;\n return useProjection<T>(\n isRoot(ns) ? null : getRegistry(stream),\n () => makeSpec(ns),\n key,\n initialValue\n );\n}\n\nconst EMPTY_MESSAGES: BaseMessage[] = [];\nconst EMPTY_TOOLCALLS: AssembledToolCall[] = [];\nconst EMPTY_EVENTS: Event[] = [];\nconst EMPTY_AUDIO: AudioMedia[] = [];\nconst EMPTY_IMAGES: ImageMedia[] = [];\nconst EMPTY_VIDEO: VideoMedia[] = [];\nconst EMPTY_FILES: FileMedia[] = [];\n\n/**\n * Subscribe to a scoped `messages` stream.\n *\n * Contract:\n * - At the root (no `target`, or a static target that resolves to\n * the root namespace) returns a handle whose `.current` delegates\n * to `stream.messages` — the always-on root projection. No extra\n * 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 owning\n * component teardown fires (and the registry closes the\n * underlying server subscription when the last consumer leaves).\n * - A reactive `target` (getter form) re-binds the subscription on\n * change. A getter that flips between root and scoped is\n * supported: the root case short-circuits to the initial value\n * because dynamic root delegation isn't meaningful — pass a\n * static undefined/null target for root handles.\n *\n * Messages are always `BaseMessage` class instances from\n * `@langchain/core/messages`.\n */\nexport function useMessages(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<BaseMessage[]> {\n useResolveSubagentNamespace(stream, target);\n if (!isGetter(target)) {\n const ns = resolveNamespace(target);\n if (isRoot(ns)) {\n return {\n get current() {\n return stream.messages;\n },\n };\n }\n }\n return selectFromTarget<BaseMessage[]>(\n stream,\n target,\n EMPTY_MESSAGES,\n (ns) => messagesProjection(ns),\n \"messages\"\n );\n}\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 a\n * handle delegating to `stream.toolCalls`.\n */\nexport function useToolCalls(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<AssembledToolCall[]>;\nexport function useToolCalls<T>(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<InferToolCalls<T>[]>;\nexport function useToolCalls(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<AssembledToolCall[]> {\n useResolveSubagentNamespace(stream, target);\n if (!isGetter(target)) {\n const ns = resolveNamespace(target);\n if (isRoot(ns)) {\n return {\n get current() {\n return stream.toolCalls;\n },\n };\n }\n }\n return selectFromTarget<AssembledToolCall[]>(\n stream,\n target,\n EMPTY_TOOLCALLS,\n (ns) => toolCallsProjection(ns),\n \"toolCalls\"\n );\n}\n\n/**\n * Subscribe to a scoped `values` stream — the most recent state\n * payload for a namespace. At the root returns a handle delegating\n * to `stream.values`.\n *\n * Typing:\n * - **Root** (`useValues(stream)`): returns the `StateType` declared\n * on `useStream<State>()` — non-nullable (the root snapshot\n * always 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): ReactiveValue<StateType>;\nexport function useValues<T>(\n stream: AnyStream\n): ReactiveValue<InferStateType<T>>;\nexport function useValues<T = unknown>(\n stream: AnyStream,\n target: ValueOrGetter<SelectorTarget>,\n options?: { messagesKey?: string }\n): ReactiveValue<T | undefined>;\nexport function useValues(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>,\n options?: { messagesKey?: string }\n): ReactiveValue<unknown> {\n if (!isGetter(target)) {\n const ns = resolveNamespace(target);\n if (isRoot(ns)) {\n return {\n get current() {\n return stream.values;\n },\n };\n }\n }\n const messagesKey = options?.messagesKey ?? \"messages\";\n return selectFromTarget<unknown>(\n stream,\n target,\n undefined,\n (ns) => valuesProjection<unknown>(ns, messagesKey),\n `values|${messagesKey}`\n );\n}\n\n/**\n * Subscribe to a `custom:<name>` stream extension — most-recent\n * payload emitted by the transformer, scoped to the target namespace.\n *\n * `name` accepts either a plain string or a getter so component\n * state can drive the extension name at runtime.\n */\nexport function useExtension<T = unknown>(\n stream: AnyStream,\n name: ValueOrGetter<string>,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<T | undefined> {\n const getName = () => (isGetter(name) ? (name as () => string)() : name);\n if (isGetter(target)) {\n const getTarget = target;\n return useProjection<T | undefined>(\n () => getRegistry(stream),\n () => extensionProjection<T>(getName(), resolveNamespace(getTarget())),\n () =>\n `extension|${getName()}|${namespaceKey(resolveNamespace(getTarget()))}`,\n undefined\n );\n }\n const ns = resolveNamespace(target);\n return useProjection<T | undefined>(\n getRegistry(stream),\n () => extensionProjection<T>(getName(), ns),\n () => `extension|${getName()}|${namespaceKey(ns)}`,\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 * Prefer {@link useMessages} / {@link useToolCalls} / {@link useValues}\n * for the common cases.\n */\nexport type UseChannelOptions = ChannelProjectionOptions;\n\nexport function useChannel(\n stream: AnyStream,\n channels: ValueOrGetter<readonly Channel[]>,\n target?: ValueOrGetter<SelectorTarget>,\n options?: UseChannelOptions\n): ReactiveValue<Event[]> {\n const getChannels = () =>\n isGetter(channels) ? (channels as () => readonly Channel[])() : channels;\n const getTarget = () => (isGetter(target) ? target() : target);\n const bufferSize = options?.bufferSize ?? \"default\";\n const replayMode = (options?.replay ?? true) ? \"replay\" : \"live\";\n return useProjection<Event[]>(\n () => getRegistry(stream),\n () =>\n channelProjection(\n getChannels(),\n resolveNamespace(getTarget()),\n options\n ) as unknown as import(\"@langchain/langgraph-sdk/stream\").ProjectionSpec<\n Event[]\n >,\n () => {\n const sortedChannels = [...getChannels()].sort().join(\",\");\n return `channel|${bufferSize}|${replayMode}|${sortedChannels}|${namespaceKey(resolveNamespace(getTarget()))}`;\n },\n EMPTY_EVENTS\n );\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?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<AudioMedia[]> {\n return selectFromTarget<AudioMedia[]>(\n stream,\n target,\n EMPTY_AUDIO,\n (ns) => audioProjection(ns),\n \"audio\"\n );\n}\n\n/**\n * Subscribe to a scoped image-media stream. Pair with `useMediaURL`\n * for `<img src>`.\n */\nexport function useImages(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<ImageMedia[]> {\n return selectFromTarget<ImageMedia[]>(\n stream,\n target,\n EMPTY_IMAGES,\n (ns) => imagesProjection(ns),\n \"images\"\n );\n}\n\n/**\n * Subscribe to a scoped video-media stream. Pair with `useMediaURL`\n * for `<video src>`.\n */\nexport function useVideo(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<VideoMedia[]> {\n return selectFromTarget<VideoMedia[]>(\n stream,\n target,\n EMPTY_VIDEO,\n (ns) => videoProjection(ns),\n \"video\"\n );\n}\n\n/**\n * Subscribe to a scoped file-media stream. Pair with `useMediaURL`\n * for an `<a download href>` target.\n */\nexport function useFiles(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<FileMedia[]> {\n return selectFromTarget<FileMedia[]>(\n stream,\n target,\n EMPTY_FILES,\n (ns) => filesProjection(ns),\n \"files\"\n );\n}\n\n/**\n * Read metadata recorded for a specific message id — today exposes\n * `parentCheckpointId`, the checkpoint the message was first seen\n * on. Designed for fork / edit flows:\n *\n * ```svelte\n * <script lang=\"ts\">\n * const meta = useMessageMetadata(stream, () => selected?.id);\n * </script>\n * Parent: {meta.current?.parentCheckpointId ?? \"root\"}\n * ```\n *\n * `messageId` accepts a plain string or a getter — the binding\n * re-evaluates whenever the id changes.\n */\nexport function useMessageMetadata(\n stream: AnyStream,\n messageId: ValueOrGetter<string | undefined>\n): ReactiveValue<MessageMetadata | undefined> {\n const store = stream[STREAM_CONTROLLER].messageMetadataStore;\n let map = $state<MessageMetadataMap>(store.getSnapshot());\n\n $effect(() => {\n const unsubscribe = store.subscribe(() => {\n map = store.getSnapshot();\n });\n return unsubscribe;\n });\n\n const getId = () =>\n isGetter(messageId) ? (messageId as () => string | undefined)() : messageId;\n\n return {\n get current(): MessageMetadata | undefined {\n const key = getId();\n if (key == null) return undefined;\n return map.get(key);\n },\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 getters are stable — safe to pass into `{#each}`.\n */\nexport interface UseSubmissionQueueReturn<\n StateType extends object = Record<string, unknown>,\n> {\n readonly entries: SubmissionQueueSnapshot<StateType>;\n readonly size: 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 let entries = $state<SubmissionQueueSnapshot>(store.getSnapshot());\n\n $effect(() => {\n const unsubscribe = store.subscribe(() => {\n entries = store.getSnapshot();\n });\n return unsubscribe;\n });\n\n return {\n get entries() {\n return entries;\n },\n get size() {\n return entries.length;\n },\n cancel: (id) => controller.cancelQueued(id),\n clear: () => controller.clearQueue(),\n };\n}\n\nexport type { SubmissionQueueEntry, SubmissionQueueSnapshot };\n"],"mappings":";;;;AAwEA,MAAM,kBAAqC,EAAE;AAE7C,SAAS,iBAAiB,QAA2C;AACnE,KAAI,UAAU,KAAM,QAAO;AAC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AAG,EAC3B,QACD;;;;;;;;;;;;;;;;;AAkBH,SAAgB,mBACd,QACA,WAC4C;CAC5C,MAAM,QAAQ,OAAOF,0BAAAA,mBAAmB;CACxC,IAAI,MAAM,OAA2B,MAAM,aAAa,CAAC;AAEzD,eAAc;AAIZ,SAHoB,MAAM,gBAAgB;AACxC,SAAM,MAAM,aAAa;IACzB;GAEF;CAEF,MAAM,cACJ,SAAS,UAAU,GAAI,WAAwC,GAAG;AAEpE,QAAO,EACL,IAAI,UAAuC;EACzC,MAAM,MAAM,OAAO;AACnB,MAAI,OAAO,KAAM,QAAO,KAAA;AACxB,SAAO,IAAI,IAAI,IAAI;IAEtB;;AAuBH,SAAgB,mBACd,QAC0B;CAC1B,MAAM,aAAa,OAAOA,0BAAAA;CAC1B,MAAM,QAAQ,WAAW;CACzB,IAAI,UAAU,OAAgC,MAAM,aAAa,CAAC;AAElE,eAAc;AAIZ,SAHoB,MAAM,gBAAgB;AACxC,aAAU,MAAM,aAAa;IAC7B;GAEF;AAEF,QAAO;EACL,IAAI,UAAU;AACZ,UAAO;;EAET,IAAI,OAAO;AACT,UAAO,QAAQ;;EAEjB,SAAS,OAAO,WAAW,aAAa,GAAG;EAC3C,aAAa,WAAW,YAAY;EACrC"}
|
|
1
|
+
{"version":3,"file":"selectors.svelte.cjs","names":["NAMESPACE_SEPARATOR","STREAM_CONTROLLER","useProjection","getRegistry"],"sources":["../src/selectors.svelte.ts"],"sourcesContent":["import 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.svelte.js\";\nimport {\n useProjection,\n type ReactiveValue,\n type ValueOrGetter,\n} from \"./use-projection.svelte.js\";\n\n/**\n * Parameterise selectors on `StateType` alone so callers with a full\n * `useStream<S, I, C>()` handle don't have to redeclare\n * `InterruptType` / `ConfigurableType` at every call site.\n */\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 targets. Callers can pass:\n * - `undefined` / `null` — root namespace (served by the always-on\n * root store; no extra subscription opens);\n * - a {@link SubagentDiscoverySnapshot} (`stream.subagents.get(...)`);\n * - a {@link SubgraphDiscoverySnapshot}\n * (`stream.subgraphs.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\nfunction namespaceKey(namespace: readonly string[]): string {\n return namespace.join(NAMESPACE_SEPARATOR);\n}\n\nfunction isGetter<T>(input: ValueOrGetter<T> | undefined): input is () => T {\n return typeof input === \"function\";\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 when a reactive `target` changes; the controller\n * de-dupes and skips already-promoted ids.\n */\nfunction useResolveSubagentNamespace(\n stream: AnyStream,\n target: ValueOrGetter<SelectorTarget> | undefined\n): void {\n const controller = stream[STREAM_CONTROLLER];\n $effect(() => {\n const resolved = isGetter(target) ? target() : target;\n const id = subagentNeedingNamespace(resolved);\n if (id != null) void controller.resolveSubagentNamespace(id);\n });\n}\n\n/**\n * Internal helper that wires a reactive-or-static target into\n * {@link useProjection}. Encapsulates the bookkeeping every selector\n * otherwise repeats.\n */\nfunction selectFromTarget<T>(\n stream: AnyStream,\n target: ValueOrGetter<SelectorTarget> | undefined,\n initialValue: T,\n makeSpec: (\n namespace: readonly string[]\n ) => import(\"@langchain/langgraph-sdk/stream\").ProjectionSpec<T>,\n keyPrefix: string\n): ReactiveValue<T> {\n if (isGetter(target)) {\n const getTarget = target;\n return useProjection<T>(\n () => {\n const ns = resolveNamespace(getTarget());\n return isRoot(ns) ? null : getRegistry(stream);\n },\n () => makeSpec(resolveNamespace(getTarget())),\n () => `${keyPrefix}|${namespaceKey(resolveNamespace(getTarget()))}`,\n initialValue\n );\n }\n const ns = resolveNamespace(target);\n // Static root: we deliberately don't short-circuit here because\n // each selector owns the root fallback shape (`stream.messages`\n // vs `stream.values` vs `stream.toolCalls`). Callers use the\n // dedicated wrappers below.\n const key = `${keyPrefix}|${namespaceKey(ns)}`;\n return useProjection<T>(\n isRoot(ns) ? null : getRegistry(stream),\n () => makeSpec(ns),\n key,\n initialValue\n );\n}\n\nconst EMPTY_MESSAGES: BaseMessage[] = [];\nconst EMPTY_TOOLCALLS: AssembledToolCall[] = [];\nconst EMPTY_EVENTS: Event[] = [];\nconst EMPTY_AUDIO: AudioMedia[] = [];\nconst EMPTY_IMAGES: ImageMedia[] = [];\nconst EMPTY_VIDEO: VideoMedia[] = [];\nconst EMPTY_FILES: FileMedia[] = [];\n\n/**\n * Subscribe to a scoped `messages` stream.\n *\n * Contract:\n * - At the root (no `target`, or a static target that resolves to\n * the root namespace) returns a handle whose `.current` delegates\n * to `stream.messages` — the always-on root projection. No extra\n * 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 owning\n * component teardown fires (and the registry closes the\n * underlying server subscription when the last consumer leaves).\n * - A reactive `target` (getter form) re-binds the subscription on\n * change. A getter that flips between root and scoped is\n * supported: the root case short-circuits to the initial value\n * because dynamic root delegation isn't meaningful — pass a\n * static undefined/null target for root handles.\n *\n * Messages are always `BaseMessage` class instances from\n * `@langchain/core/messages`.\n */\nexport function useMessages(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<BaseMessage[]> {\n useResolveSubagentNamespace(stream, target);\n if (!isGetter(target)) {\n const ns = resolveNamespace(target);\n if (isRoot(ns)) {\n return {\n get current() {\n return stream.messages;\n },\n };\n }\n }\n return selectFromTarget<BaseMessage[]>(\n stream,\n target,\n EMPTY_MESSAGES,\n (ns) => messagesProjection(ns),\n \"messages\"\n );\n}\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 a\n * handle delegating to `stream.toolCalls`.\n */\nexport function useToolCalls(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<AssembledToolCall[]>;\nexport function useToolCalls<T>(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<InferToolCalls<T>[]>;\nexport function useToolCalls(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<AssembledToolCall[]> {\n useResolveSubagentNamespace(stream, target);\n if (!isGetter(target)) {\n const ns = resolveNamespace(target);\n if (isRoot(ns)) {\n return {\n get current() {\n return stream.toolCalls;\n },\n };\n }\n }\n return selectFromTarget<AssembledToolCall[]>(\n stream,\n target,\n EMPTY_TOOLCALLS,\n (ns) => toolCallsProjection(ns),\n \"toolCalls\"\n );\n}\n\n/**\n * Subscribe to a scoped `values` stream — the most recent state\n * payload for a namespace. At the root returns a handle delegating\n * to `stream.values`.\n *\n * Typing:\n * - **Root** (`useValues(stream)`): returns the `StateType` declared\n * on `useStream<State>()` — non-nullable (the root snapshot\n * always 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): ReactiveValue<StateType>;\nexport function useValues<T>(\n stream: AnyStream\n): ReactiveValue<InferStateType<T>>;\nexport function useValues<T = unknown>(\n stream: AnyStream,\n target: ValueOrGetter<SelectorTarget>,\n options?: { messagesKey?: string }\n): ReactiveValue<T | undefined>;\nexport function useValues(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>,\n options?: { messagesKey?: string }\n): ReactiveValue<unknown> {\n if (!isGetter(target)) {\n const ns = resolveNamespace(target);\n if (isRoot(ns)) {\n return {\n get current() {\n return stream.values;\n },\n };\n }\n }\n const messagesKey = options?.messagesKey ?? \"messages\";\n return selectFromTarget<unknown>(\n stream,\n target,\n undefined,\n (ns) => valuesProjection<unknown>(ns, messagesKey),\n `values|${messagesKey}`\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 *\n * `name` accepts either a plain string or a getter so component\n * state can drive the extension name at runtime.\n */\nexport function useExtension<T = unknown>(\n stream: AnyStream,\n name: ValueOrGetter<string>,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<T | undefined> {\n const getName = () => (isGetter(name) ? (name as () => string)() : name);\n if (isGetter(target)) {\n const getTarget = target;\n return useProjection<T | undefined>(\n () => getRegistry(stream),\n () => extensionProjection<T>(getName(), resolveNamespace(getTarget())),\n () =>\n `extension|${getName()}|${namespaceKey(resolveNamespace(getTarget()))}`,\n undefined\n );\n }\n const ns = resolveNamespace(target);\n return useProjection<T | undefined>(\n getRegistry(stream),\n () => extensionProjection<T>(getName(), ns),\n () => `extension|${getName()}|${namespaceKey(ns)}`,\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: ValueOrGetter<readonly Channel[]>,\n target?: ValueOrGetter<SelectorTarget>,\n options?: UseChannelOptions\n): ReactiveValue<Event[]> {\n const getChannels = () =>\n isGetter(channels) ? (channels as () => readonly Channel[])() : channels;\n const getTarget = () => (isGetter(target) ? target() : target);\n const bufferSize = options?.bufferSize ?? \"default\";\n const replayMode = (options?.replay ?? true) ? \"replay\" : \"live\";\n return useProjection<Event[]>(\n () => getRegistry(stream),\n () =>\n channelProjection(\n getChannels(),\n resolveNamespace(getTarget()),\n options\n ) as unknown as import(\"@langchain/langgraph-sdk/stream\").ProjectionSpec<\n Event[]\n >,\n () => {\n const sortedChannels = [...getChannels()].sort().join(\",\");\n return `channel|${bufferSize}|${replayMode}|${sortedChannels}|${namespaceKey(resolveNamespace(getTarget()))}`;\n },\n EMPTY_EVENTS\n );\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?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<AudioMedia[]> {\n return selectFromTarget<AudioMedia[]>(\n stream,\n target,\n EMPTY_AUDIO,\n (ns) => audioProjection(ns),\n \"audio\"\n );\n}\n\n/**\n * Subscribe to a scoped image-media stream. Pair with `useMediaURL`\n * for `<img src>`.\n */\nexport function useImages(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<ImageMedia[]> {\n return selectFromTarget<ImageMedia[]>(\n stream,\n target,\n EMPTY_IMAGES,\n (ns) => imagesProjection(ns),\n \"images\"\n );\n}\n\n/**\n * Subscribe to a scoped video-media stream. Pair with `useMediaURL`\n * for `<video src>`.\n */\nexport function useVideo(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<VideoMedia[]> {\n return selectFromTarget<VideoMedia[]>(\n stream,\n target,\n EMPTY_VIDEO,\n (ns) => videoProjection(ns),\n \"video\"\n );\n}\n\n/**\n * Subscribe to a scoped file-media stream. Pair with `useMediaURL`\n * for an `<a download href>` target.\n */\nexport function useFiles(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<FileMedia[]> {\n return selectFromTarget<FileMedia[]>(\n stream,\n target,\n EMPTY_FILES,\n (ns) => filesProjection(ns),\n \"files\"\n );\n}\n\n/**\n * Read metadata recorded for a specific message id — today exposes\n * `parentCheckpointId`, the checkpoint the message was first seen\n * on. Designed for fork / edit flows:\n *\n * ```svelte\n * <script lang=\"ts\">\n * const meta = useMessageMetadata(stream, () => selected?.id);\n * </script>\n * Parent: {meta.current?.parentCheckpointId ?? \"root\"}\n * ```\n *\n * `messageId` accepts a plain string or a getter — the binding\n * re-evaluates whenever the id changes.\n */\nexport function useMessageMetadata(\n stream: AnyStream,\n messageId: ValueOrGetter<string | undefined>\n): ReactiveValue<MessageMetadata | undefined> {\n const store = stream[STREAM_CONTROLLER].messageMetadataStore;\n let map = $state<MessageMetadataMap>(store.getSnapshot());\n\n $effect(() => {\n const unsubscribe = store.subscribe(() => {\n map = store.getSnapshot();\n });\n return unsubscribe;\n });\n\n const getId = () =>\n isGetter(messageId) ? (messageId as () => string | undefined)() : messageId;\n\n return {\n get current(): MessageMetadata | undefined {\n const key = getId();\n if (key == null) return undefined;\n return map.get(key);\n },\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 getters are stable — safe to pass into `{#each}`.\n */\nexport interface UseSubmissionQueueReturn<\n StateType extends object = Record<string, unknown>,\n> {\n readonly entries: SubmissionQueueSnapshot<StateType>;\n readonly size: 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 let entries = $state<SubmissionQueueSnapshot>(store.getSnapshot());\n\n $effect(() => {\n const unsubscribe = store.subscribe(() => {\n entries = store.getSnapshot();\n });\n return unsubscribe;\n });\n\n return {\n get entries() {\n return entries;\n },\n get size() {\n return entries.length;\n },\n cancel: (id) => controller.cancelQueued(id),\n clear: () => controller.clearQueue(),\n };\n}\n\nexport type { SubmissionQueueEntry, SubmissionQueueSnapshot };\n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EAC3B,QACD;;;;;;AAOH,SAAgB,SACd,QACA,QAC4B;AAC5B,QAAO,iBACL,QACA,QACA,cACC,QAAA,GAAA,gCAAA,iBAAuB,GAAG,EAC3B,QACD;;;;;;;;;;;;;;;;;AAkBH,SAAgB,mBACd,QACA,WAC4C;CAC5C,MAAM,QAAQ,OAAOF,0BAAAA,mBAAmB;CACxC,IAAI,MAAM,OAA2B,MAAM,aAAa,CAAC;AAEzD,eAAc;AAIZ,SAHoB,MAAM,gBAAgB;AACxC,SAAM,MAAM,aAAa;IACzB;GAEF;CAEF,MAAM,cACJ,SAAS,UAAU,GAAI,WAAwC,GAAG;AAEpE,QAAO,EACL,IAAI,UAAuC;EACzC,MAAM,MAAM,OAAO;AACnB,MAAI,OAAO,KAAM,QAAO,KAAA;AACxB,SAAO,IAAI,IAAI,IAAI;IAEtB;;AAuBH,SAAgB,mBACd,QAC0B;CAC1B,MAAM,aAAa,OAAOA,0BAAAA;CAC1B,MAAM,QAAQ,WAAW;CACzB,IAAI,UAAU,OAAgC,MAAM,aAAa,CAAC;AAElE,eAAc;AAIZ,SAHoB,MAAM,gBAAgB;AACxC,aAAU,MAAM,aAAa;IAC7B;GAEF;AAEF,QAAO;EACL,IAAI,UAAU;AACZ,UAAO;;EAET,IAAI,OAAO;AACT,UAAO,QAAQ;;EAEjB,SAAS,OAAO,WAAW,aAAa,GAAG;EAC3C,aAAa,WAAW,YAAY;EACrC"}
|
|
@@ -73,9 +73,14 @@ declare function useValues<T = unknown>(stream: AnyStream, target: ValueOrGetter
|
|
|
73
73
|
messagesKey?: string;
|
|
74
74
|
}): ReactiveValue<T | undefined>;
|
|
75
75
|
/**
|
|
76
|
-
* Subscribe to a `custom:<name>` stream extension — most-recent
|
|
76
|
+
* Subscribe to a `custom:<name>` stream extension — the most-recent
|
|
77
77
|
* payload emitted by the transformer, scoped to the target namespace.
|
|
78
78
|
*
|
|
79
|
+
* Returns only the latest value and resumes across serial runs, so it is
|
|
80
|
+
* ideal for "current state" panels (progress, score, status). When you
|
|
81
|
+
* need the full history of events rather than just the latest payload,
|
|
82
|
+
* use {@link useChannel} instead.
|
|
83
|
+
*
|
|
79
84
|
* `name` accepts either a plain string or a getter so component
|
|
80
85
|
* state can drive the extension name at runtime.
|
|
81
86
|
*/
|
|
@@ -83,8 +88,13 @@ declare function useExtension<T = unknown>(stream: AnyStream, name: ValueOrGette
|
|
|
83
88
|
/**
|
|
84
89
|
* Raw-events escape hatch. Subscribes to one or more channels at a
|
|
85
90
|
* namespace and returns a bounded buffer of raw protocol events.
|
|
86
|
-
*
|
|
87
|
-
* for the
|
|
91
|
+
*
|
|
92
|
+
* The buffer keeps accumulating across serial runs for the lifetime of
|
|
93
|
+
* the thread, so this is the hook to use for an event log / stream of a
|
|
94
|
+
* custom channel (e.g. `["custom:redaction-stats"]`). When you only need
|
|
95
|
+
* the latest payload of a single `custom:<name>` channel, prefer
|
|
96
|
+
* {@link useExtension}. For the common message/tool/value cases prefer
|
|
97
|
+
* {@link useMessages} / {@link useToolCalls} / {@link useValues}.
|
|
88
98
|
*/
|
|
89
99
|
type UseChannelOptions = ChannelProjectionOptions;
|
|
90
100
|
declare function useChannel(stream: AnyStream, channels: ValueOrGetter<readonly Channel[]>, target?: ValueOrGetter<SelectorTarget>, options?: UseChannelOptions): ReactiveValue<Event[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.svelte.d.cts","names":[],"sources":["../src/selectors.svelte.ts"],"mappings":";;;;;;;;AAuCoC;;;KAO/B,YAAA,6BAAyC,eAAA,CAC5C,SAAA;;;;;;AAiBF;;;;;KAAY,cAAA;EAIN,SAAA;AAAA,IACF,yBAAA,GACA,yBAAA;;AA8HJ;;;;;;;;;;;;;;;;;;;AA6BA;;iBA7BgB,WAAA,CACd,MAAA,EAAQ,SAAA,EACR,MAAA,GAAS,aAAA,CAAc,cAAA,IACtB,aAAA,CAAc,WAAA;;;;;;iBA0BD,YAAA,CACd,MAAA,EAAQ,SAAA,EACR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kBAAA,0BAAA,CACd,MAAA,EAAQ,YAAA,CAAa,SAAA,IACpB,wBAAA,CAAyB,SAAA;AAAA,iBACZ,kBAAA,CAAmB,MAAA,EAAQ,SAAA,GAAY,wBAAA"}
|
|
@@ -73,9 +73,14 @@ declare function useValues<T = unknown>(stream: AnyStream, target: ValueOrGetter
|
|
|
73
73
|
messagesKey?: string;
|
|
74
74
|
}): ReactiveValue<T | undefined>;
|
|
75
75
|
/**
|
|
76
|
-
* Subscribe to a `custom:<name>` stream extension — most-recent
|
|
76
|
+
* Subscribe to a `custom:<name>` stream extension — the most-recent
|
|
77
77
|
* payload emitted by the transformer, scoped to the target namespace.
|
|
78
78
|
*
|
|
79
|
+
* Returns only the latest value and resumes across serial runs, so it is
|
|
80
|
+
* ideal for "current state" panels (progress, score, status). When you
|
|
81
|
+
* need the full history of events rather than just the latest payload,
|
|
82
|
+
* use {@link useChannel} instead.
|
|
83
|
+
*
|
|
79
84
|
* `name` accepts either a plain string or a getter so component
|
|
80
85
|
* state can drive the extension name at runtime.
|
|
81
86
|
*/
|
|
@@ -83,8 +88,13 @@ declare function useExtension<T = unknown>(stream: AnyStream, name: ValueOrGette
|
|
|
83
88
|
/**
|
|
84
89
|
* Raw-events escape hatch. Subscribes to one or more channels at a
|
|
85
90
|
* namespace and returns a bounded buffer of raw protocol events.
|
|
86
|
-
*
|
|
87
|
-
* for the
|
|
91
|
+
*
|
|
92
|
+
* The buffer keeps accumulating across serial runs for the lifetime of
|
|
93
|
+
* the thread, so this is the hook to use for an event log / stream of a
|
|
94
|
+
* custom channel (e.g. `["custom:redaction-stats"]`). When you only need
|
|
95
|
+
* the latest payload of a single `custom:<name>` channel, prefer
|
|
96
|
+
* {@link useExtension}. For the common message/tool/value cases prefer
|
|
97
|
+
* {@link useMessages} / {@link useToolCalls} / {@link useValues}.
|
|
88
98
|
*/
|
|
89
99
|
type UseChannelOptions = ChannelProjectionOptions;
|
|
90
100
|
declare function useChannel(stream: AnyStream, channels: ValueOrGetter<readonly Channel[]>, target?: ValueOrGetter<SelectorTarget>, options?: UseChannelOptions): ReactiveValue<Event[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.svelte.d.ts","names":[],"sources":["../src/selectors.svelte.ts"],"mappings":";;;;;;;;AAuCoC;;;KAO/B,YAAA,6BAAyC,eAAA,CAC5C,SAAA;;;;;;AAiBF;;;;;KAAY,cAAA;EAIN,SAAA;AAAA,IACF,yBAAA,GACA,yBAAA;;AA8HJ;;;;;;;;;;;;;;;;;;;AA6BA;;iBA7BgB,WAAA,CACd,MAAA,EAAQ,SAAA,EACR,MAAA,GAAS,aAAA,CAAc,cAAA,IACtB,aAAA,CAAc,WAAA;;;;;;iBA0BD,YAAA,CACd,MAAA,EAAQ,SAAA,EACR,MAAA,GAAS,aAAA,CAAc,cAAA,IACtB,aAAA,CAAc,iBAAA;AAAA,iBACD,YAAA,GAAA,CACd,MAAA,EAAQ,SAAA,EACR,MAAA,GAAS,aAAA,CAAc,cAAA,IACtB,aAAA,CAAc,cAAA,CAAe,CAAA;;;;;;;;;;AAHhC;;;;;iBA0CgB,SAAA,0BAAA,CACd,MAAA,EAAQ,YAAA,CAAa,SAAA,IACpB,aAAA,CAAc,SAAA;AAAA,iBACD,SAAA,GAAA,CACd,MAAA,EAAQ,SAAA,GACP,aAAA,CAAc,cAAA,CAAe,CAAA;AAAA,iBAChB,SAAA,aAAA,CACd,MAAA,EAAQ,SAAA,EACR,MAAA,EAAQ,aAAA,CAAc,cAAA,GACtB,OAAA;EAAY,WAAA;AAAA,IACX,aAAA,CAAc,CAAA
|
|
1
|
+
{"version":3,"file":"selectors.svelte.d.ts","names":[],"sources":["../src/selectors.svelte.ts"],"mappings":";;;;;;;;AAuCoC;;;KAO/B,YAAA,6BAAyC,eAAA,CAC5C,SAAA;;;;;;AAiBF;;;;;KAAY,cAAA;EAIN,SAAA;AAAA,IACF,yBAAA,GACA,yBAAA;;AA8HJ;;;;;;;;;;;;;;;;;;;AA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AAA,CACd,MAAA,EAAQ,SAAA,EACR,MAAA,GAAS,aAAA,CAAc,cAAA,IACtB,aAAA,CAAc,UAAA;;;AAzJjB;;iBAuKgB,QAAA,CACd,MAAA,EAAQ,SAAA,EACR,MAAA,GAAS,aAAA,CAAc,cAAA,IACtB,aAAA,CAAc,SAAA;;;;;;;;;;;;;;;;iBAyBD,kBAAA,CACd,MAAA,EAAQ,SAAA,EACR,SAAA,EAAW,aAAA,uBACV,aAAA,CAAc,eAAA;;;;AA5JjB;;;;UA0LiB,wBAAA,4BACY,MAAA;EAAA,SAElB,OAAA,EAAS,uBAAA,CAAwB,SAAA;EAAA,SACjC,IAAA;EACT,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.svelte.js
CHANGED
|
@@ -115,9 +115,14 @@ function useValues(stream, target, options) {
|
|
|
115
115
|
return selectFromTarget(stream, target, void 0, (ns) => valuesProjection(ns, messagesKey), `values|${messagesKey}`);
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
|
-
* Subscribe to a `custom:<name>` stream extension — most-recent
|
|
118
|
+
* Subscribe to a `custom:<name>` stream extension — the most-recent
|
|
119
119
|
* payload emitted by the transformer, scoped to the target namespace.
|
|
120
120
|
*
|
|
121
|
+
* Returns only the latest value and resumes across serial runs, so it is
|
|
122
|
+
* ideal for "current state" panels (progress, score, status). When you
|
|
123
|
+
* need the full history of events rather than just the latest payload,
|
|
124
|
+
* use {@link useChannel} instead.
|
|
125
|
+
*
|
|
121
126
|
* `name` accepts either a plain string or a getter so component
|
|
122
127
|
* state can drive the extension name at runtime.
|
|
123
128
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.svelte.js","names":[],"sources":["../src/selectors.svelte.ts"],"sourcesContent":["import 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.svelte.js\";\nimport {\n useProjection,\n type ReactiveValue,\n type ValueOrGetter,\n} from \"./use-projection.svelte.js\";\n\n/**\n * Parameterise selectors on `StateType` alone so callers with a full\n * `useStream<S, I, C>()` handle don't have to redeclare\n * `InterruptType` / `ConfigurableType` at every call site.\n */\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 targets. Callers can pass:\n * - `undefined` / `null` — root namespace (served by the always-on\n * root store; no extra subscription opens);\n * - a {@link SubagentDiscoverySnapshot} (`stream.subagents.get(...)`);\n * - a {@link SubgraphDiscoverySnapshot}\n * (`stream.subgraphs.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\nfunction namespaceKey(namespace: readonly string[]): string {\n return namespace.join(NAMESPACE_SEPARATOR);\n}\n\nfunction isGetter<T>(input: ValueOrGetter<T> | undefined): input is () => T {\n return typeof input === \"function\";\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 when a reactive `target` changes; the controller\n * de-dupes and skips already-promoted ids.\n */\nfunction useResolveSubagentNamespace(\n stream: AnyStream,\n target: ValueOrGetter<SelectorTarget> | undefined\n): void {\n const controller = stream[STREAM_CONTROLLER];\n $effect(() => {\n const resolved = isGetter(target) ? target() : target;\n const id = subagentNeedingNamespace(resolved);\n if (id != null) void controller.resolveSubagentNamespace(id);\n });\n}\n\n/**\n * Internal helper that wires a reactive-or-static target into\n * {@link useProjection}. Encapsulates the bookkeeping every selector\n * otherwise repeats.\n */\nfunction selectFromTarget<T>(\n stream: AnyStream,\n target: ValueOrGetter<SelectorTarget> | undefined,\n initialValue: T,\n makeSpec: (\n namespace: readonly string[]\n ) => import(\"@langchain/langgraph-sdk/stream\").ProjectionSpec<T>,\n keyPrefix: string\n): ReactiveValue<T> {\n if (isGetter(target)) {\n const getTarget = target;\n return useProjection<T>(\n () => {\n const ns = resolveNamespace(getTarget());\n return isRoot(ns) ? null : getRegistry(stream);\n },\n () => makeSpec(resolveNamespace(getTarget())),\n () => `${keyPrefix}|${namespaceKey(resolveNamespace(getTarget()))}`,\n initialValue\n );\n }\n const ns = resolveNamespace(target);\n // Static root: we deliberately don't short-circuit here because\n // each selector owns the root fallback shape (`stream.messages`\n // vs `stream.values` vs `stream.toolCalls`). Callers use the\n // dedicated wrappers below.\n const key = `${keyPrefix}|${namespaceKey(ns)}`;\n return useProjection<T>(\n isRoot(ns) ? null : getRegistry(stream),\n () => makeSpec(ns),\n key,\n initialValue\n );\n}\n\nconst EMPTY_MESSAGES: BaseMessage[] = [];\nconst EMPTY_TOOLCALLS: AssembledToolCall[] = [];\nconst EMPTY_EVENTS: Event[] = [];\nconst EMPTY_AUDIO: AudioMedia[] = [];\nconst EMPTY_IMAGES: ImageMedia[] = [];\nconst EMPTY_VIDEO: VideoMedia[] = [];\nconst EMPTY_FILES: FileMedia[] = [];\n\n/**\n * Subscribe to a scoped `messages` stream.\n *\n * Contract:\n * - At the root (no `target`, or a static target that resolves to\n * the root namespace) returns a handle whose `.current` delegates\n * to `stream.messages` — the always-on root projection. No extra\n * 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 owning\n * component teardown fires (and the registry closes the\n * underlying server subscription when the last consumer leaves).\n * - A reactive `target` (getter form) re-binds the subscription on\n * change. A getter that flips between root and scoped is\n * supported: the root case short-circuits to the initial value\n * because dynamic root delegation isn't meaningful — pass a\n * static undefined/null target for root handles.\n *\n * Messages are always `BaseMessage` class instances from\n * `@langchain/core/messages`.\n */\nexport function useMessages(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<BaseMessage[]> {\n useResolveSubagentNamespace(stream, target);\n if (!isGetter(target)) {\n const ns = resolveNamespace(target);\n if (isRoot(ns)) {\n return {\n get current() {\n return stream.messages;\n },\n };\n }\n }\n return selectFromTarget<BaseMessage[]>(\n stream,\n target,\n EMPTY_MESSAGES,\n (ns) => messagesProjection(ns),\n \"messages\"\n );\n}\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 a\n * handle delegating to `stream.toolCalls`.\n */\nexport function useToolCalls(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<AssembledToolCall[]>;\nexport function useToolCalls<T>(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<InferToolCalls<T>[]>;\nexport function useToolCalls(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<AssembledToolCall[]> {\n useResolveSubagentNamespace(stream, target);\n if (!isGetter(target)) {\n const ns = resolveNamespace(target);\n if (isRoot(ns)) {\n return {\n get current() {\n return stream.toolCalls;\n },\n };\n }\n }\n return selectFromTarget<AssembledToolCall[]>(\n stream,\n target,\n EMPTY_TOOLCALLS,\n (ns) => toolCallsProjection(ns),\n \"toolCalls\"\n );\n}\n\n/**\n * Subscribe to a scoped `values` stream — the most recent state\n * payload for a namespace. At the root returns a handle delegating\n * to `stream.values`.\n *\n * Typing:\n * - **Root** (`useValues(stream)`): returns the `StateType` declared\n * on `useStream<State>()` — non-nullable (the root snapshot\n * always 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): ReactiveValue<StateType>;\nexport function useValues<T>(\n stream: AnyStream\n): ReactiveValue<InferStateType<T>>;\nexport function useValues<T = unknown>(\n stream: AnyStream,\n target: ValueOrGetter<SelectorTarget>,\n options?: { messagesKey?: string }\n): ReactiveValue<T | undefined>;\nexport function useValues(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>,\n options?: { messagesKey?: string }\n): ReactiveValue<unknown> {\n if (!isGetter(target)) {\n const ns = resolveNamespace(target);\n if (isRoot(ns)) {\n return {\n get current() {\n return stream.values;\n },\n };\n }\n }\n const messagesKey = options?.messagesKey ?? \"messages\";\n return selectFromTarget<unknown>(\n stream,\n target,\n undefined,\n (ns) => valuesProjection<unknown>(ns, messagesKey),\n `values|${messagesKey}`\n );\n}\n\n/**\n * Subscribe to a `custom:<name>` stream extension — most-recent\n * payload emitted by the transformer, scoped to the target namespace.\n *\n * `name` accepts either a plain string or a getter so component\n * state can drive the extension name at runtime.\n */\nexport function useExtension<T = unknown>(\n stream: AnyStream,\n name: ValueOrGetter<string>,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<T | undefined> {\n const getName = () => (isGetter(name) ? (name as () => string)() : name);\n if (isGetter(target)) {\n const getTarget = target;\n return useProjection<T | undefined>(\n () => getRegistry(stream),\n () => extensionProjection<T>(getName(), resolveNamespace(getTarget())),\n () =>\n `extension|${getName()}|${namespaceKey(resolveNamespace(getTarget()))}`,\n undefined\n );\n }\n const ns = resolveNamespace(target);\n return useProjection<T | undefined>(\n getRegistry(stream),\n () => extensionProjection<T>(getName(), ns),\n () => `extension|${getName()}|${namespaceKey(ns)}`,\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 * Prefer {@link useMessages} / {@link useToolCalls} / {@link useValues}\n * for the common cases.\n */\nexport type UseChannelOptions = ChannelProjectionOptions;\n\nexport function useChannel(\n stream: AnyStream,\n channels: ValueOrGetter<readonly Channel[]>,\n target?: ValueOrGetter<SelectorTarget>,\n options?: UseChannelOptions\n): ReactiveValue<Event[]> {\n const getChannels = () =>\n isGetter(channels) ? (channels as () => readonly Channel[])() : channels;\n const getTarget = () => (isGetter(target) ? target() : target);\n const bufferSize = options?.bufferSize ?? \"default\";\n const replayMode = (options?.replay ?? true) ? \"replay\" : \"live\";\n return useProjection<Event[]>(\n () => getRegistry(stream),\n () =>\n channelProjection(\n getChannels(),\n resolveNamespace(getTarget()),\n options\n ) as unknown as import(\"@langchain/langgraph-sdk/stream\").ProjectionSpec<\n Event[]\n >,\n () => {\n const sortedChannels = [...getChannels()].sort().join(\",\");\n return `channel|${bufferSize}|${replayMode}|${sortedChannels}|${namespaceKey(resolveNamespace(getTarget()))}`;\n },\n EMPTY_EVENTS\n );\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?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<AudioMedia[]> {\n return selectFromTarget<AudioMedia[]>(\n stream,\n target,\n EMPTY_AUDIO,\n (ns) => audioProjection(ns),\n \"audio\"\n );\n}\n\n/**\n * Subscribe to a scoped image-media stream. Pair with `useMediaURL`\n * for `<img src>`.\n */\nexport function useImages(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<ImageMedia[]> {\n return selectFromTarget<ImageMedia[]>(\n stream,\n target,\n EMPTY_IMAGES,\n (ns) => imagesProjection(ns),\n \"images\"\n );\n}\n\n/**\n * Subscribe to a scoped video-media stream. Pair with `useMediaURL`\n * for `<video src>`.\n */\nexport function useVideo(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<VideoMedia[]> {\n return selectFromTarget<VideoMedia[]>(\n stream,\n target,\n EMPTY_VIDEO,\n (ns) => videoProjection(ns),\n \"video\"\n );\n}\n\n/**\n * Subscribe to a scoped file-media stream. Pair with `useMediaURL`\n * for an `<a download href>` target.\n */\nexport function useFiles(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<FileMedia[]> {\n return selectFromTarget<FileMedia[]>(\n stream,\n target,\n EMPTY_FILES,\n (ns) => filesProjection(ns),\n \"files\"\n );\n}\n\n/**\n * Read metadata recorded for a specific message id — today exposes\n * `parentCheckpointId`, the checkpoint the message was first seen\n * on. Designed for fork / edit flows:\n *\n * ```svelte\n * <script lang=\"ts\">\n * const meta = useMessageMetadata(stream, () => selected?.id);\n * </script>\n * Parent: {meta.current?.parentCheckpointId ?? \"root\"}\n * ```\n *\n * `messageId` accepts a plain string or a getter — the binding\n * re-evaluates whenever the id changes.\n */\nexport function useMessageMetadata(\n stream: AnyStream,\n messageId: ValueOrGetter<string | undefined>\n): ReactiveValue<MessageMetadata | undefined> {\n const store = stream[STREAM_CONTROLLER].messageMetadataStore;\n let map = $state<MessageMetadataMap>(store.getSnapshot());\n\n $effect(() => {\n const unsubscribe = store.subscribe(() => {\n map = store.getSnapshot();\n });\n return unsubscribe;\n });\n\n const getId = () =>\n isGetter(messageId) ? (messageId as () => string | undefined)() : messageId;\n\n return {\n get current(): MessageMetadata | undefined {\n const key = getId();\n if (key == null) return undefined;\n return map.get(key);\n },\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 getters are stable — safe to pass into `{#each}`.\n */\nexport interface UseSubmissionQueueReturn<\n StateType extends object = Record<string, unknown>,\n> {\n readonly entries: SubmissionQueueSnapshot<StateType>;\n readonly size: 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 let entries = $state<SubmissionQueueSnapshot>(store.getSnapshot());\n\n $effect(() => {\n const unsubscribe = store.subscribe(() => {\n entries = store.getSnapshot();\n });\n return unsubscribe;\n });\n\n return {\n get entries() {\n return entries;\n },\n get size() {\n return entries.length;\n },\n cancel: (id) => controller.cancelQueued(id),\n clear: () => controller.clearQueue(),\n };\n}\n\nexport type { SubmissionQueueEntry, SubmissionQueueSnapshot };\n"],"mappings":";;;;AAwEA,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;;AAG9B,SAAS,aAAa,WAAsC;AAC1D,QAAO,UAAU,KAAK,oBAAoB;;AAG5C,SAAS,SAAY,OAAuD;AAC1E,QAAO,OAAO,UAAU;;;;;;;;AAS1B,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,eAAc;EAEZ,MAAM,KAAK,yBADM,SAAS,OAAO,GAAG,QAAQ,GAAG,OACF;AAC7C,MAAI,MAAM,KAAW,YAAW,yBAAyB,GAAG;GAC5D;;;;;;;AAQJ,SAAS,iBACP,QACA,QACA,cACA,UAGA,WACkB;AAClB,KAAI,SAAS,OAAO,EAAE;EACpB,MAAM,YAAY;AAClB,SAAO,oBACC;AAEJ,UAAO,OADI,iBAAiB,WAAW,CAAC,CACvB,GAAG,OAAO,YAAY,OAAO;WAE1C,SAAS,iBAAiB,WAAW,CAAC,CAAC,QACvC,GAAG,UAAU,GAAG,aAAa,iBAAiB,WAAW,CAAC,CAAC,IACjE,aACD;;CAEH,MAAM,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;;;;;;;;;;;AAkBH,SAAgB,mBACd,QACA,WAC4C;CAC5C,MAAM,QAAQ,OAAO,mBAAmB;CACxC,IAAI,MAAM,OAA2B,MAAM,aAAa,CAAC;AAEzD,eAAc;AAIZ,SAHoB,MAAM,gBAAgB;AACxC,SAAM,MAAM,aAAa;IACzB;GAEF;CAEF,MAAM,cACJ,SAAS,UAAU,GAAI,WAAwC,GAAG;AAEpE,QAAO,EACL,IAAI,UAAuC;EACzC,MAAM,MAAM,OAAO;AACnB,MAAI,OAAO,KAAM,QAAO,KAAA;AACxB,SAAO,IAAI,IAAI,IAAI;IAEtB;;AAuBH,SAAgB,mBACd,QAC0B;CAC1B,MAAM,aAAa,OAAO;CAC1B,MAAM,QAAQ,WAAW;CACzB,IAAI,UAAU,OAAgC,MAAM,aAAa,CAAC;AAElE,eAAc;AAIZ,SAHoB,MAAM,gBAAgB;AACxC,aAAU,MAAM,aAAa;IAC7B;GAEF;AAEF,QAAO;EACL,IAAI,UAAU;AACZ,UAAO;;EAET,IAAI,OAAO;AACT,UAAO,QAAQ;;EAEjB,SAAS,OAAO,WAAW,aAAa,GAAG;EAC3C,aAAa,WAAW,YAAY;EACrC"}
|
|
1
|
+
{"version":3,"file":"selectors.svelte.js","names":[],"sources":["../src/selectors.svelte.ts"],"sourcesContent":["import 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.svelte.js\";\nimport {\n useProjection,\n type ReactiveValue,\n type ValueOrGetter,\n} from \"./use-projection.svelte.js\";\n\n/**\n * Parameterise selectors on `StateType` alone so callers with a full\n * `useStream<S, I, C>()` handle don't have to redeclare\n * `InterruptType` / `ConfigurableType` at every call site.\n */\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 targets. Callers can pass:\n * - `undefined` / `null` — root namespace (served by the always-on\n * root store; no extra subscription opens);\n * - a {@link SubagentDiscoverySnapshot} (`stream.subagents.get(...)`);\n * - a {@link SubgraphDiscoverySnapshot}\n * (`stream.subgraphs.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\nfunction namespaceKey(namespace: readonly string[]): string {\n return namespace.join(NAMESPACE_SEPARATOR);\n}\n\nfunction isGetter<T>(input: ValueOrGetter<T> | undefined): input is () => T {\n return typeof input === \"function\";\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 when a reactive `target` changes; the controller\n * de-dupes and skips already-promoted ids.\n */\nfunction useResolveSubagentNamespace(\n stream: AnyStream,\n target: ValueOrGetter<SelectorTarget> | undefined\n): void {\n const controller = stream[STREAM_CONTROLLER];\n $effect(() => {\n const resolved = isGetter(target) ? target() : target;\n const id = subagentNeedingNamespace(resolved);\n if (id != null) void controller.resolveSubagentNamespace(id);\n });\n}\n\n/**\n * Internal helper that wires a reactive-or-static target into\n * {@link useProjection}. Encapsulates the bookkeeping every selector\n * otherwise repeats.\n */\nfunction selectFromTarget<T>(\n stream: AnyStream,\n target: ValueOrGetter<SelectorTarget> | undefined,\n initialValue: T,\n makeSpec: (\n namespace: readonly string[]\n ) => import(\"@langchain/langgraph-sdk/stream\").ProjectionSpec<T>,\n keyPrefix: string\n): ReactiveValue<T> {\n if (isGetter(target)) {\n const getTarget = target;\n return useProjection<T>(\n () => {\n const ns = resolveNamespace(getTarget());\n return isRoot(ns) ? null : getRegistry(stream);\n },\n () => makeSpec(resolveNamespace(getTarget())),\n () => `${keyPrefix}|${namespaceKey(resolveNamespace(getTarget()))}`,\n initialValue\n );\n }\n const ns = resolveNamespace(target);\n // Static root: we deliberately don't short-circuit here because\n // each selector owns the root fallback shape (`stream.messages`\n // vs `stream.values` vs `stream.toolCalls`). Callers use the\n // dedicated wrappers below.\n const key = `${keyPrefix}|${namespaceKey(ns)}`;\n return useProjection<T>(\n isRoot(ns) ? null : getRegistry(stream),\n () => makeSpec(ns),\n key,\n initialValue\n );\n}\n\nconst EMPTY_MESSAGES: BaseMessage[] = [];\nconst EMPTY_TOOLCALLS: AssembledToolCall[] = [];\nconst EMPTY_EVENTS: Event[] = [];\nconst EMPTY_AUDIO: AudioMedia[] = [];\nconst EMPTY_IMAGES: ImageMedia[] = [];\nconst EMPTY_VIDEO: VideoMedia[] = [];\nconst EMPTY_FILES: FileMedia[] = [];\n\n/**\n * Subscribe to a scoped `messages` stream.\n *\n * Contract:\n * - At the root (no `target`, or a static target that resolves to\n * the root namespace) returns a handle whose `.current` delegates\n * to `stream.messages` — the always-on root projection. No extra\n * 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 owning\n * component teardown fires (and the registry closes the\n * underlying server subscription when the last consumer leaves).\n * - A reactive `target` (getter form) re-binds the subscription on\n * change. A getter that flips between root and scoped is\n * supported: the root case short-circuits to the initial value\n * because dynamic root delegation isn't meaningful — pass a\n * static undefined/null target for root handles.\n *\n * Messages are always `BaseMessage` class instances from\n * `@langchain/core/messages`.\n */\nexport function useMessages(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<BaseMessage[]> {\n useResolveSubagentNamespace(stream, target);\n if (!isGetter(target)) {\n const ns = resolveNamespace(target);\n if (isRoot(ns)) {\n return {\n get current() {\n return stream.messages;\n },\n };\n }\n }\n return selectFromTarget<BaseMessage[]>(\n stream,\n target,\n EMPTY_MESSAGES,\n (ns) => messagesProjection(ns),\n \"messages\"\n );\n}\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 a\n * handle delegating to `stream.toolCalls`.\n */\nexport function useToolCalls(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<AssembledToolCall[]>;\nexport function useToolCalls<T>(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<InferToolCalls<T>[]>;\nexport function useToolCalls(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<AssembledToolCall[]> {\n useResolveSubagentNamespace(stream, target);\n if (!isGetter(target)) {\n const ns = resolveNamespace(target);\n if (isRoot(ns)) {\n return {\n get current() {\n return stream.toolCalls;\n },\n };\n }\n }\n return selectFromTarget<AssembledToolCall[]>(\n stream,\n target,\n EMPTY_TOOLCALLS,\n (ns) => toolCallsProjection(ns),\n \"toolCalls\"\n );\n}\n\n/**\n * Subscribe to a scoped `values` stream — the most recent state\n * payload for a namespace. At the root returns a handle delegating\n * to `stream.values`.\n *\n * Typing:\n * - **Root** (`useValues(stream)`): returns the `StateType` declared\n * on `useStream<State>()` — non-nullable (the root snapshot\n * always 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): ReactiveValue<StateType>;\nexport function useValues<T>(\n stream: AnyStream\n): ReactiveValue<InferStateType<T>>;\nexport function useValues<T = unknown>(\n stream: AnyStream,\n target: ValueOrGetter<SelectorTarget>,\n options?: { messagesKey?: string }\n): ReactiveValue<T | undefined>;\nexport function useValues(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>,\n options?: { messagesKey?: string }\n): ReactiveValue<unknown> {\n if (!isGetter(target)) {\n const ns = resolveNamespace(target);\n if (isRoot(ns)) {\n return {\n get current() {\n return stream.values;\n },\n };\n }\n }\n const messagesKey = options?.messagesKey ?? \"messages\";\n return selectFromTarget<unknown>(\n stream,\n target,\n undefined,\n (ns) => valuesProjection<unknown>(ns, messagesKey),\n `values|${messagesKey}`\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 *\n * `name` accepts either a plain string or a getter so component\n * state can drive the extension name at runtime.\n */\nexport function useExtension<T = unknown>(\n stream: AnyStream,\n name: ValueOrGetter<string>,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<T | undefined> {\n const getName = () => (isGetter(name) ? (name as () => string)() : name);\n if (isGetter(target)) {\n const getTarget = target;\n return useProjection<T | undefined>(\n () => getRegistry(stream),\n () => extensionProjection<T>(getName(), resolveNamespace(getTarget())),\n () =>\n `extension|${getName()}|${namespaceKey(resolveNamespace(getTarget()))}`,\n undefined\n );\n }\n const ns = resolveNamespace(target);\n return useProjection<T | undefined>(\n getRegistry(stream),\n () => extensionProjection<T>(getName(), ns),\n () => `extension|${getName()}|${namespaceKey(ns)}`,\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: ValueOrGetter<readonly Channel[]>,\n target?: ValueOrGetter<SelectorTarget>,\n options?: UseChannelOptions\n): ReactiveValue<Event[]> {\n const getChannels = () =>\n isGetter(channels) ? (channels as () => readonly Channel[])() : channels;\n const getTarget = () => (isGetter(target) ? target() : target);\n const bufferSize = options?.bufferSize ?? \"default\";\n const replayMode = (options?.replay ?? true) ? \"replay\" : \"live\";\n return useProjection<Event[]>(\n () => getRegistry(stream),\n () =>\n channelProjection(\n getChannels(),\n resolveNamespace(getTarget()),\n options\n ) as unknown as import(\"@langchain/langgraph-sdk/stream\").ProjectionSpec<\n Event[]\n >,\n () => {\n const sortedChannels = [...getChannels()].sort().join(\",\");\n return `channel|${bufferSize}|${replayMode}|${sortedChannels}|${namespaceKey(resolveNamespace(getTarget()))}`;\n },\n EMPTY_EVENTS\n );\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?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<AudioMedia[]> {\n return selectFromTarget<AudioMedia[]>(\n stream,\n target,\n EMPTY_AUDIO,\n (ns) => audioProjection(ns),\n \"audio\"\n );\n}\n\n/**\n * Subscribe to a scoped image-media stream. Pair with `useMediaURL`\n * for `<img src>`.\n */\nexport function useImages(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<ImageMedia[]> {\n return selectFromTarget<ImageMedia[]>(\n stream,\n target,\n EMPTY_IMAGES,\n (ns) => imagesProjection(ns),\n \"images\"\n );\n}\n\n/**\n * Subscribe to a scoped video-media stream. Pair with `useMediaURL`\n * for `<video src>`.\n */\nexport function useVideo(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<VideoMedia[]> {\n return selectFromTarget<VideoMedia[]>(\n stream,\n target,\n EMPTY_VIDEO,\n (ns) => videoProjection(ns),\n \"video\"\n );\n}\n\n/**\n * Subscribe to a scoped file-media stream. Pair with `useMediaURL`\n * for an `<a download href>` target.\n */\nexport function useFiles(\n stream: AnyStream,\n target?: ValueOrGetter<SelectorTarget>\n): ReactiveValue<FileMedia[]> {\n return selectFromTarget<FileMedia[]>(\n stream,\n target,\n EMPTY_FILES,\n (ns) => filesProjection(ns),\n \"files\"\n );\n}\n\n/**\n * Read metadata recorded for a specific message id — today exposes\n * `parentCheckpointId`, the checkpoint the message was first seen\n * on. Designed for fork / edit flows:\n *\n * ```svelte\n * <script lang=\"ts\">\n * const meta = useMessageMetadata(stream, () => selected?.id);\n * </script>\n * Parent: {meta.current?.parentCheckpointId ?? \"root\"}\n * ```\n *\n * `messageId` accepts a plain string or a getter — the binding\n * re-evaluates whenever the id changes.\n */\nexport function useMessageMetadata(\n stream: AnyStream,\n messageId: ValueOrGetter<string | undefined>\n): ReactiveValue<MessageMetadata | undefined> {\n const store = stream[STREAM_CONTROLLER].messageMetadataStore;\n let map = $state<MessageMetadataMap>(store.getSnapshot());\n\n $effect(() => {\n const unsubscribe = store.subscribe(() => {\n map = store.getSnapshot();\n });\n return unsubscribe;\n });\n\n const getId = () =>\n isGetter(messageId) ? (messageId as () => string | undefined)() : messageId;\n\n return {\n get current(): MessageMetadata | undefined {\n const key = getId();\n if (key == null) return undefined;\n return map.get(key);\n },\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 getters are stable — safe to pass into `{#each}`.\n */\nexport interface UseSubmissionQueueReturn<\n StateType extends object = Record<string, unknown>,\n> {\n readonly entries: SubmissionQueueSnapshot<StateType>;\n readonly size: 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 let entries = $state<SubmissionQueueSnapshot>(store.getSnapshot());\n\n $effect(() => {\n const unsubscribe = store.subscribe(() => {\n entries = store.getSnapshot();\n });\n return unsubscribe;\n });\n\n return {\n get entries() {\n return entries;\n },\n get size() {\n return entries.length;\n },\n cancel: (id) => controller.cancelQueued(id),\n clear: () => controller.clearQueue(),\n };\n}\n\nexport type { SubmissionQueueEntry, SubmissionQueueSnapshot };\n"],"mappings":";;;;AAwEA,MAAM,kBAAqC,EAAE;AAE7C,SAAS,iBAAiB,QAA2C;AACnE,KAAI,UAAU,KAAM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EF,MAAM,cACJ,SAAS,UAAU,GAAI,WAAwC,GAAG;AAEpE,QAAO,EACL,IAAI,UAAuC;EACzC,MAAM,MAAM,OAAO;AACnB,MAAI,OAAO,KAAM,QAAO,KAAA;AACxB,SAAO,IAAI,IAAI,IAAI;IAEtB;;AAuBH,SAAgB,mBACd,QAC0B;CAC1B,MAAM,aAAa,OAAO;CAC1B,MAAM,QAAQ,WAAW;CACzB,IAAI,UAAU,OAAgC,MAAM,aAAa,CAAC;AAElE,eAAc;AAIZ,SAHoB,MAAM,gBAAgB;AACxC,aAAU,MAAM,aAAa;IAC7B;GAEF;AAEF,QAAO;EACL,IAAI,UAAU;AACZ,UAAO;;EAET,IAAI,OAAO;AACT,UAAO,QAAQ;;EAEjB,SAAS,OAAO,WAAW,aAAa,GAAG;EAC3C,aAAa,WAAW,YAAY;EACrC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/svelte",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
4
4
|
"description": "Svelte integration for LangGraph & LangChain",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"directory": "libs/sdk-svelte"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@langchain/langgraph-sdk": "1.9.
|
|
13
|
+
"@langchain/langgraph-sdk": "1.9.18"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@hono/node-server": "^1.19.13",
|