@langchain/langgraph-sdk 1.3.1 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/CHANGELOG.md +0 -281
- package/dist/_virtual/rolldown_runtime.cjs +0 -25
- package/dist/auth/error.cjs +0 -79
- package/dist/auth/error.cjs.map +0 -1
- package/dist/auth/error.d.cts +0 -13
- package/dist/auth/error.d.cts.map +0 -1
- package/dist/auth/error.d.ts +0 -13
- package/dist/auth/error.d.ts.map +0 -1
- package/dist/auth/error.js +0 -78
- package/dist/auth/error.js.map +0 -1
- package/dist/auth/index.cjs +0 -39
- package/dist/auth/index.cjs.map +0 -1
- package/dist/auth/index.d.cts +0 -31
- package/dist/auth/index.d.cts.map +0 -1
- package/dist/auth/index.d.ts +0 -31
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js +0 -37
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/types.d.cts +0 -294
- package/dist/auth/types.d.cts.map +0 -1
- package/dist/auth/types.d.ts +0 -294
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/client.cjs +0 -1219
- package/dist/client.cjs.map +0 -1
- package/dist/client.d.cts +0 -803
- package/dist/client.d.cts.map +0 -1
- package/dist/client.d.ts +0 -803
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -1212
- package/dist/client.js.map +0 -1
- package/dist/index.cjs +0 -6
- package/dist/index.d.cts +0 -7
- package/dist/index.d.ts +0 -7
- package/dist/index.js +0 -4
- package/dist/logging/index.cjs +0 -35
- package/dist/logging/index.cjs.map +0 -1
- package/dist/logging/index.d.cts +0 -47
- package/dist/logging/index.d.cts.map +0 -1
- package/dist/logging/index.d.ts +0 -47
- package/dist/logging/index.d.ts.map +0 -1
- package/dist/logging/index.js +0 -34
- package/dist/logging/index.js.map +0 -1
- package/dist/react/index.cjs +0 -5
- package/dist/react/index.d.cts +0 -4
- package/dist/react/index.d.ts +0 -4
- package/dist/react/index.js +0 -4
- package/dist/react/stream.cjs +0 -18
- package/dist/react/stream.cjs.map +0 -1
- package/dist/react/stream.custom.cjs +0 -129
- package/dist/react/stream.custom.cjs.map +0 -1
- package/dist/react/stream.custom.d.cts +0 -39
- package/dist/react/stream.custom.d.cts.map +0 -1
- package/dist/react/stream.custom.d.ts +0 -39
- package/dist/react/stream.custom.d.ts.map +0 -1
- package/dist/react/stream.custom.js +0 -127
- package/dist/react/stream.custom.js.map +0 -1
- package/dist/react/stream.d.cts +0 -73
- package/dist/react/stream.d.cts.map +0 -1
- package/dist/react/stream.d.ts +0 -73
- package/dist/react/stream.d.ts.map +0 -1
- package/dist/react/stream.js +0 -17
- package/dist/react/stream.js.map +0 -1
- package/dist/react/stream.lgp.cjs +0 -446
- package/dist/react/stream.lgp.cjs.map +0 -1
- package/dist/react/stream.lgp.js +0 -445
- package/dist/react/stream.lgp.js.map +0 -1
- package/dist/react/thread.cjs +0 -22
- package/dist/react/thread.cjs.map +0 -1
- package/dist/react/thread.js +0 -21
- package/dist/react/thread.js.map +0 -1
- package/dist/react/types.d.cts +0 -363
- package/dist/react/types.d.cts.map +0 -1
- package/dist/react/types.d.ts +0 -363
- package/dist/react/types.d.ts.map +0 -1
- package/dist/react-ui/client.cjs +0 -137
- package/dist/react-ui/client.cjs.map +0 -1
- package/dist/react-ui/client.d.cts +0 -90
- package/dist/react-ui/client.d.cts.map +0 -1
- package/dist/react-ui/client.d.ts +0 -90
- package/dist/react-ui/client.d.ts.map +0 -1
- package/dist/react-ui/client.js +0 -134
- package/dist/react-ui/client.js.map +0 -1
- package/dist/react-ui/index.cjs +0 -14
- package/dist/react-ui/index.cjs.map +0 -1
- package/dist/react-ui/index.d.cts +0 -3
- package/dist/react-ui/index.d.ts +0 -3
- package/dist/react-ui/index.js +0 -9
- package/dist/react-ui/index.js.map +0 -1
- package/dist/react-ui/server/index.cjs +0 -5
- package/dist/react-ui/server/index.d.cts +0 -3
- package/dist/react-ui/server/index.d.ts +0 -3
- package/dist/react-ui/server/index.js +0 -4
- package/dist/react-ui/server/server.cjs +0 -57
- package/dist/react-ui/server/server.cjs.map +0 -1
- package/dist/react-ui/server/server.d.cts +0 -55
- package/dist/react-ui/server/server.d.cts.map +0 -1
- package/dist/react-ui/server/server.d.ts +0 -55
- package/dist/react-ui/server/server.d.ts.map +0 -1
- package/dist/react-ui/server/server.js +0 -56
- package/dist/react-ui/server/server.js.map +0 -1
- package/dist/react-ui/types.cjs +0 -38
- package/dist/react-ui/types.cjs.map +0 -1
- package/dist/react-ui/types.d.cts +0 -25
- package/dist/react-ui/types.d.cts.map +0 -1
- package/dist/react-ui/types.d.ts +0 -25
- package/dist/react-ui/types.d.ts.map +0 -1
- package/dist/react-ui/types.js +0 -35
- package/dist/react-ui/types.js.map +0 -1
- package/dist/schema.d.cts +0 -284
- package/dist/schema.d.cts.map +0 -1
- package/dist/schema.d.ts +0 -284
- package/dist/schema.d.ts.map +0 -1
- package/dist/singletons/fetch.cjs +0 -24
- package/dist/singletons/fetch.cjs.map +0 -1
- package/dist/singletons/fetch.d.cts +0 -14
- package/dist/singletons/fetch.d.cts.map +0 -1
- package/dist/singletons/fetch.d.ts +0 -14
- package/dist/singletons/fetch.d.ts.map +0 -1
- package/dist/singletons/fetch.js +0 -22
- package/dist/singletons/fetch.js.map +0 -1
- package/dist/types.d.cts +0 -187
- package/dist/types.d.cts.map +0 -1
- package/dist/types.d.ts +0 -187
- package/dist/types.d.ts.map +0 -1
- package/dist/types.messages.d.cts +0 -91
- package/dist/types.messages.d.cts.map +0 -1
- package/dist/types.messages.d.ts +0 -91
- package/dist/types.messages.d.ts.map +0 -1
- package/dist/types.stream.d.cts +0 -235
- package/dist/types.stream.d.cts.map +0 -1
- package/dist/types.stream.d.ts +0 -235
- package/dist/types.stream.d.ts.map +0 -1
- package/dist/ui/branching.cjs +0 -153
- package/dist/ui/branching.cjs.map +0 -1
- package/dist/ui/branching.d.cts +0 -22
- package/dist/ui/branching.d.cts.map +0 -1
- package/dist/ui/branching.d.ts +0 -22
- package/dist/ui/branching.d.ts.map +0 -1
- package/dist/ui/branching.js +0 -152
- package/dist/ui/branching.js.map +0 -1
- package/dist/ui/errors.cjs +0 -15
- package/dist/ui/errors.cjs.map +0 -1
- package/dist/ui/errors.js +0 -14
- package/dist/ui/errors.js.map +0 -1
- package/dist/ui/manager.cjs +0 -182
- package/dist/ui/manager.cjs.map +0 -1
- package/dist/ui/manager.js +0 -182
- package/dist/ui/manager.js.map +0 -1
- package/dist/ui/messages.cjs +0 -70
- package/dist/ui/messages.cjs.map +0 -1
- package/dist/ui/messages.js +0 -68
- package/dist/ui/messages.js.map +0 -1
- package/dist/ui/utils.cjs +0 -14
- package/dist/ui/utils.cjs.map +0 -1
- package/dist/ui/utils.js +0 -12
- package/dist/ui/utils.js.map +0 -1
- package/dist/utils/async_caller.cjs +0 -111
- package/dist/utils/async_caller.cjs.map +0 -1
- package/dist/utils/async_caller.d.cts +0 -53
- package/dist/utils/async_caller.d.cts.map +0 -1
- package/dist/utils/async_caller.d.ts +0 -53
- package/dist/utils/async_caller.d.ts.map +0 -1
- package/dist/utils/async_caller.js +0 -110
- package/dist/utils/async_caller.js.map +0 -1
- package/dist/utils/env.cjs +0 -13
- package/dist/utils/env.cjs.map +0 -1
- package/dist/utils/env.js +0 -12
- package/dist/utils/env.js.map +0 -1
- package/dist/utils/error.cjs +0 -17
- package/dist/utils/error.cjs.map +0 -1
- package/dist/utils/error.js +0 -16
- package/dist/utils/error.js.map +0 -1
- package/dist/utils/signals.cjs +0 -20
- package/dist/utils/signals.cjs.map +0 -1
- package/dist/utils/signals.js +0 -19
- package/dist/utils/signals.js.map +0 -1
- package/dist/utils/sse.cjs +0 -124
- package/dist/utils/sse.cjs.map +0 -1
- package/dist/utils/sse.js +0 -122
- package/dist/utils/sse.js.map +0 -1
- package/dist/utils/stream.cjs +0 -176
- package/dist/utils/stream.cjs.map +0 -1
- package/dist/utils/stream.js +0 -175
- package/dist/utils/stream.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.cts","names":["React","JsxRuntime","UIMessage","useStream","UseStream","UseStreamContext","Record","Context","BagTemplate","GetMetaType","Bag","StateType","useStreamContext","ComponentTarget","FunctionComponent","ComponentClass","HTMLElement","ComponentStore","EXT_STORE_SYMBOL","REQUIRE_SYMBOL","REQUIRE_EXTRA_SYMBOL","LoadExternalComponentProps","HTMLDivElement","HTMLAttributes","ReturnType","ReactNode","Pick","LoadExternalComponent","stream","namespace","message","meta","fallback","components","JSX","Element","_0","sideEffect","experimental_loadShare","bootstrapUiContext"],"sources":["../../src/react-ui/client.d.ts"],"sourcesContent":["import * as React from \"react\";\nimport * as JsxRuntime from \"react/jsx-runtime\";\nimport type { UIMessage } from \"./types.js\";\nimport { useStream } from \"../react/index.js\";\nimport type { UseStream } from \"../react/types.js\";\ndeclare const UseStreamContext: React.Context<{\n stream: UseStream<Record<string, unknown>, {\n ConfigurableType?: Record<string, unknown> | undefined;\n InterruptType?: unknown;\n CustomEventType?: unknown;\n UpdateType?: unknown;\n }>;\n meta: unknown;\n}>;\ntype BagTemplate = {\n ConfigurableType?: Record<string, unknown>;\n InterruptType?: unknown;\n CustomEventType?: unknown;\n UpdateType?: unknown;\n MetaType?: unknown;\n};\ntype GetMetaType<Bag extends BagTemplate> = Bag extends {\n MetaType: unknown;\n} ? Bag[\"MetaType\"] : unknown;\ninterface UseStreamContext<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends BagTemplate = BagTemplate> extends UseStream<StateType, Bag> {\n meta?: GetMetaType<Bag>;\n}\nexport declare function useStreamContext<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends {\n ConfigurableType?: Record<string, unknown>;\n InterruptType?: unknown;\n CustomEventType?: unknown;\n UpdateType?: unknown;\n MetaType?: unknown;\n} = BagTemplate>(): UseStreamContext<StateType, Bag>;\ninterface ComponentTarget {\n comp: React.FunctionComponent | React.ComponentClass;\n target: HTMLElement;\n}\ndeclare class ComponentStore {\n private cache;\n private boundCache;\n private callbacks;\n respond(shadowRootId: string, comp: React.FunctionComponent | React.ComponentClass, targetElement: HTMLElement): void;\n getBoundStore(shadowRootId: string): {\n subscribe: (onStoreChange: () => void) => () => void;\n getSnapshot: () => ComponentTarget | undefined;\n };\n}\ndeclare const EXT_STORE_SYMBOL: unique symbol;\ndeclare const REQUIRE_SYMBOL: unique symbol;\ndeclare const REQUIRE_EXTRA_SYMBOL: unique symbol;\ninterface LoadExternalComponentProps extends Pick<React.HTMLAttributes<HTMLDivElement>, \"style\" | \"className\"> {\n /** Stream of the assistant */\n stream: ReturnType<typeof useStream>;\n /** Namespace of UI components. Defaults to assistant ID. */\n namespace?: string;\n /** UI message to be rendered */\n message: UIMessage;\n /** Additional context to be passed to the child component */\n meta?: unknown;\n /** Fallback to be rendered when the component is loading */\n fallback?: React.ReactNode | Record<string, React.ReactNode>;\n /**\n * Map of components that can be rendered directly without fetching the UI code\n * from the server.\n */\n components?: Record<string, React.FunctionComponent | React.ComponentClass>;\n}\nexport declare function LoadExternalComponent({ stream, namespace, message, meta, fallback, components, ...props }: LoadExternalComponentProps): JsxRuntime.JSX.Element;\ndeclare global {\n interface Window {\n [EXT_STORE_SYMBOL]: ComponentStore;\n [REQUIRE_SYMBOL]: (name: string) => unknown;\n [REQUIRE_EXTRA_SYMBOL]: Record<string, unknown>;\n }\n}\nexport declare function experimental_loadShare(name: string, module: unknown): void;\nexport declare function bootstrapUiContext(): void;\nexport {};\n"],"mappings":";;;;;;;cAKcK,kBAAkBL,KAAAA,CAAMO;UAC1BH,UAAUE;IADRD,gBAQZ,CAAA,EANyBC,MAMzB,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,SAAA;IAAA,aAAA,CAAA,EAAA,OAAA;IAPoBA,eAAAA,CAAAA,EAAAA,OAAAA;IACKA,UAAAA,CAAAA,EAAAA,OAAAA;;MAFKN,EAAAA,OAAMO;;AAAO,KASxCC,WAAAA,GAAW;EAOXC,gBAAW,CAAA,EANO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GAAuBd;EALRqB;;AAAwBC,iBAQxBU,sBAAAA,CARwBV,IAAAA,EAAAA,MAAAA,EAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EAAAA,IAAAA"}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { UIMessage } from "./types.js";
|
|
2
|
-
import { UseStream } from "../react/types.js";
|
|
3
|
-
import { useStream } from "../react/stream.js";
|
|
4
|
-
import * as React from "react";
|
|
5
|
-
import * as JsxRuntime from "react/jsx-runtime";
|
|
6
|
-
|
|
7
|
-
//#region src/react-ui/client.d.ts
|
|
8
|
-
declare const UseStreamContext: React.Context<{
|
|
9
|
-
stream: UseStream<Record<string, unknown>, {
|
|
10
|
-
ConfigurableType?: Record<string, unknown> | undefined;
|
|
11
|
-
InterruptType?: unknown;
|
|
12
|
-
CustomEventType?: unknown;
|
|
13
|
-
UpdateType?: unknown;
|
|
14
|
-
}>;
|
|
15
|
-
meta: unknown;
|
|
16
|
-
}>;
|
|
17
|
-
type BagTemplate = {
|
|
18
|
-
ConfigurableType?: Record<string, unknown>;
|
|
19
|
-
InterruptType?: unknown;
|
|
20
|
-
CustomEventType?: unknown;
|
|
21
|
-
UpdateType?: unknown;
|
|
22
|
-
MetaType?: unknown;
|
|
23
|
-
};
|
|
24
|
-
type GetMetaType<Bag extends BagTemplate> = Bag extends {
|
|
25
|
-
MetaType: unknown;
|
|
26
|
-
} ? Bag["MetaType"] : unknown;
|
|
27
|
-
interface UseStreamContext<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends BagTemplate = BagTemplate> extends UseStream<StateType, Bag> {
|
|
28
|
-
meta?: GetMetaType<Bag>;
|
|
29
|
-
}
|
|
30
|
-
declare function useStreamContext<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends {
|
|
31
|
-
ConfigurableType?: Record<string, unknown>;
|
|
32
|
-
InterruptType?: unknown;
|
|
33
|
-
CustomEventType?: unknown;
|
|
34
|
-
UpdateType?: unknown;
|
|
35
|
-
MetaType?: unknown;
|
|
36
|
-
} = BagTemplate>(): UseStreamContext<StateType, Bag>;
|
|
37
|
-
interface ComponentTarget {
|
|
38
|
-
comp: React.FunctionComponent | React.ComponentClass;
|
|
39
|
-
target: HTMLElement;
|
|
40
|
-
}
|
|
41
|
-
declare class ComponentStore {
|
|
42
|
-
private cache;
|
|
43
|
-
private boundCache;
|
|
44
|
-
private callbacks;
|
|
45
|
-
respond(shadowRootId: string, comp: React.FunctionComponent | React.ComponentClass, targetElement: HTMLElement): void;
|
|
46
|
-
getBoundStore(shadowRootId: string): {
|
|
47
|
-
subscribe: (onStoreChange: () => void) => () => void;
|
|
48
|
-
getSnapshot: () => ComponentTarget | undefined;
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
declare const EXT_STORE_SYMBOL: unique symbol;
|
|
52
|
-
declare const REQUIRE_SYMBOL: unique symbol;
|
|
53
|
-
declare const REQUIRE_EXTRA_SYMBOL: unique symbol;
|
|
54
|
-
interface LoadExternalComponentProps extends Pick<React.HTMLAttributes<HTMLDivElement>, "style" | "className"> {
|
|
55
|
-
/** Stream of the assistant */
|
|
56
|
-
stream: ReturnType<typeof useStream>;
|
|
57
|
-
/** Namespace of UI components. Defaults to assistant ID. */
|
|
58
|
-
namespace?: string;
|
|
59
|
-
/** UI message to be rendered */
|
|
60
|
-
message: UIMessage;
|
|
61
|
-
/** Additional context to be passed to the child component */
|
|
62
|
-
meta?: unknown;
|
|
63
|
-
/** Fallback to be rendered when the component is loading */
|
|
64
|
-
fallback?: React.ReactNode | Record<string, React.ReactNode>;
|
|
65
|
-
/**
|
|
66
|
-
* Map of components that can be rendered directly without fetching the UI code
|
|
67
|
-
* from the server.
|
|
68
|
-
*/
|
|
69
|
-
components?: Record<string, React.FunctionComponent | React.ComponentClass>;
|
|
70
|
-
}
|
|
71
|
-
declare function LoadExternalComponent({
|
|
72
|
-
stream,
|
|
73
|
-
namespace,
|
|
74
|
-
message,
|
|
75
|
-
meta,
|
|
76
|
-
fallback,
|
|
77
|
-
components,
|
|
78
|
-
...props
|
|
79
|
-
}: LoadExternalComponentProps): JsxRuntime.JSX.Element;
|
|
80
|
-
declare global {
|
|
81
|
-
interface Window {
|
|
82
|
-
[EXT_STORE_SYMBOL]: ComponentStore;
|
|
83
|
-
[REQUIRE_SYMBOL]: (name: string) => unknown;
|
|
84
|
-
[REQUIRE_EXTRA_SYMBOL]: Record<string, unknown>;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
declare function experimental_loadShare(name: string, module: unknown): void;
|
|
88
|
-
//#endregion
|
|
89
|
-
export { LoadExternalComponent, experimental_loadShare, useStreamContext };
|
|
90
|
-
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","names":["React","JsxRuntime","UIMessage","useStream","UseStream","UseStreamContext","Record","Context","BagTemplate","GetMetaType","Bag","StateType","useStreamContext","ComponentTarget","FunctionComponent","ComponentClass","HTMLElement","ComponentStore","EXT_STORE_SYMBOL","REQUIRE_SYMBOL","REQUIRE_EXTRA_SYMBOL","LoadExternalComponentProps","HTMLDivElement","HTMLAttributes","ReturnType","ReactNode","Pick","LoadExternalComponent","stream","namespace","message","meta","fallback","components","JSX","Element","_0","sideEffect","experimental_loadShare","bootstrapUiContext"],"sources":["../../src/react-ui/client.d.ts"],"sourcesContent":["import * as React from \"react\";\nimport * as JsxRuntime from \"react/jsx-runtime\";\nimport type { UIMessage } from \"./types.js\";\nimport { useStream } from \"../react/index.js\";\nimport type { UseStream } from \"../react/types.js\";\ndeclare const UseStreamContext: React.Context<{\n stream: UseStream<Record<string, unknown>, {\n ConfigurableType?: Record<string, unknown> | undefined;\n InterruptType?: unknown;\n CustomEventType?: unknown;\n UpdateType?: unknown;\n }>;\n meta: unknown;\n}>;\ntype BagTemplate = {\n ConfigurableType?: Record<string, unknown>;\n InterruptType?: unknown;\n CustomEventType?: unknown;\n UpdateType?: unknown;\n MetaType?: unknown;\n};\ntype GetMetaType<Bag extends BagTemplate> = Bag extends {\n MetaType: unknown;\n} ? Bag[\"MetaType\"] : unknown;\ninterface UseStreamContext<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends BagTemplate = BagTemplate> extends UseStream<StateType, Bag> {\n meta?: GetMetaType<Bag>;\n}\nexport declare function useStreamContext<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends {\n ConfigurableType?: Record<string, unknown>;\n InterruptType?: unknown;\n CustomEventType?: unknown;\n UpdateType?: unknown;\n MetaType?: unknown;\n} = BagTemplate>(): UseStreamContext<StateType, Bag>;\ninterface ComponentTarget {\n comp: React.FunctionComponent | React.ComponentClass;\n target: HTMLElement;\n}\ndeclare class ComponentStore {\n private cache;\n private boundCache;\n private callbacks;\n respond(shadowRootId: string, comp: React.FunctionComponent | React.ComponentClass, targetElement: HTMLElement): void;\n getBoundStore(shadowRootId: string): {\n subscribe: (onStoreChange: () => void) => () => void;\n getSnapshot: () => ComponentTarget | undefined;\n };\n}\ndeclare const EXT_STORE_SYMBOL: unique symbol;\ndeclare const REQUIRE_SYMBOL: unique symbol;\ndeclare const REQUIRE_EXTRA_SYMBOL: unique symbol;\ninterface LoadExternalComponentProps extends Pick<React.HTMLAttributes<HTMLDivElement>, \"style\" | \"className\"> {\n /** Stream of the assistant */\n stream: ReturnType<typeof useStream>;\n /** Namespace of UI components. Defaults to assistant ID. */\n namespace?: string;\n /** UI message to be rendered */\n message: UIMessage;\n /** Additional context to be passed to the child component */\n meta?: unknown;\n /** Fallback to be rendered when the component is loading */\n fallback?: React.ReactNode | Record<string, React.ReactNode>;\n /**\n * Map of components that can be rendered directly without fetching the UI code\n * from the server.\n */\n components?: Record<string, React.FunctionComponent | React.ComponentClass>;\n}\nexport declare function LoadExternalComponent({ stream, namespace, message, meta, fallback, components, ...props }: LoadExternalComponentProps): JsxRuntime.JSX.Element;\ndeclare global {\n interface Window {\n [EXT_STORE_SYMBOL]: ComponentStore;\n [REQUIRE_SYMBOL]: (name: string) => unknown;\n [REQUIRE_EXTRA_SYMBOL]: Record<string, unknown>;\n }\n}\nexport declare function experimental_loadShare(name: string, module: unknown): void;\nexport declare function bootstrapUiContext(): void;\nexport {};\n"],"mappings":";;;;;;;cAKcK,kBAAkBL,KAAAA,CAAMO;UAC1BH,UAAUE;IADRD,gBAQZ,CAAA,EANyBC,MAMzB,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,SAAA;IAAA,aAAA,CAAA,EAAA,OAAA;IAPoBA,eAAAA,CAAAA,EAAAA,OAAAA;IACKA,UAAAA,CAAAA,EAAAA,OAAAA;;MAFKN,EAAAA,OAAMO;;AAAO,KASxCC,WAAAA,GAAW;EAOXC,gBAAW,CAAA,EANOH,MAMP,CAAA,MAAA,EAAA,OAAA,CAAA;EAAA,aAAA,CAAA,EAAA,OAAA;iBAAaE,CAAAA,EAAAA,OAAAA;YAAeE,CAAAA,EAAAA,OAAAA;UAExCA,CAAAA,EAAAA,OAAAA;;AAAG,KAFFD,WAGKJ,CAAAA,YAHmBG,WAGH,CAAA,GAHkBE,GAGlB,SAAA;EAAA,QAAA,EAAA,OAAA;IADtBA,GACyCJ,CAAAA,UAAAA,CAAAA,GAAAA,OAAAA;UAAnCD,gBAA6DC,CAAAA,kBAA1BA,MAA0BA,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,GAAAA,MAAAA,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EAAAA,YAAqCE,WAArCF,GAAmDE,WAAnDF,CAAAA,SAAwEF,SAAxEE,CAAkFK,SAAlFL,EAA6FI,GAA7FJ,CAAAA,CAAAA;MAAqCE,CAAAA,EACjGC,WADiGD,CACrFE,GADqFF,CAAAA;;AAA6CG,iBAGjIC,gBAHiID,CAAAA,kBAG9FL,MAH8FK,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,GAGpEL,MAHoEK,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EAAAA,YAAAA;kBAAWD,CAAAA,EAI7IJ,MAJ6II,CAAAA,MAAAA,EAAA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AAAYnB,iBAOTqB,qBAAAA,CAPSrB;EAAAA,MAAAA;EAAAA,SAAAA;EAAAA,OAAAA;EAAAA,IAAAA;EAAAA,QAAAA;EAAAA,UAAAA;EAAAA,GAAAA;AAAAA,CAAAA,EAOmFe,0BAPnFf,CAAAA,EAOgHL,UAAAA,CAAWiC,GAAAA,CAAIC,OAP/H7B;QAKDN,MAAMc,CAAAA;YAA0BC,MAAAA,CAAAA;IAA/CT,CAKRY,gBAAAA,CALQZ,EAKWW,cALXX;IAf4BoB,CAqBpCP,cAAAA,CArBoCO,EAAAA,CAAAA,IAAAA,EAAAA,MAAAA,EAAAA,GAAAA,OAAAA;KAsBpCN,oBAAAA,GAAuBd;EALRqB;;AAAwBC,iBAQxBU,sBAAAA,CARwBV,IAAAA,EAAAA,MAAAA,EAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EAAAA,IAAAA"}
|
package/dist/react-ui/client.js
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { useStream } from "../react/stream.js";
|
|
5
|
-
import "../react/index.js";
|
|
6
|
-
import * as React from "react";
|
|
7
|
-
import * as ReactDOM from "react-dom";
|
|
8
|
-
import * as JsxRuntime from "react/jsx-runtime";
|
|
9
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
|
|
11
|
-
//#region src/react-ui/client.tsx
|
|
12
|
-
const UseStreamContext = React.createContext(null);
|
|
13
|
-
function useStreamContext() {
|
|
14
|
-
const ctx = React.useContext(UseStreamContext);
|
|
15
|
-
if (!ctx) throw new Error("useStreamContext must be used within a LoadExternalComponent");
|
|
16
|
-
return new Proxy(ctx, { get(target, prop) {
|
|
17
|
-
if (prop === "meta") return target.meta;
|
|
18
|
-
return target.stream[prop];
|
|
19
|
-
} });
|
|
20
|
-
}
|
|
21
|
-
var ComponentStore = class {
|
|
22
|
-
cache = {};
|
|
23
|
-
boundCache = {};
|
|
24
|
-
callbacks = {};
|
|
25
|
-
respond(shadowRootId, comp, targetElement) {
|
|
26
|
-
this.cache[shadowRootId] = {
|
|
27
|
-
comp,
|
|
28
|
-
target: targetElement
|
|
29
|
-
};
|
|
30
|
-
this.callbacks[shadowRootId]?.forEach((c) => c(comp, targetElement));
|
|
31
|
-
}
|
|
32
|
-
getBoundStore(shadowRootId) {
|
|
33
|
-
this.boundCache[shadowRootId] ??= {
|
|
34
|
-
subscribe: (onStoreChange) => {
|
|
35
|
-
this.callbacks[shadowRootId] ??= [];
|
|
36
|
-
this.callbacks[shadowRootId].push(onStoreChange);
|
|
37
|
-
return () => {
|
|
38
|
-
this.callbacks[shadowRootId] = this.callbacks[shadowRootId].filter((c) => c !== onStoreChange);
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
getSnapshot: () => this.cache[shadowRootId]
|
|
42
|
-
};
|
|
43
|
-
return this.boundCache[shadowRootId];
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const COMPONENT_STORE = new ComponentStore();
|
|
47
|
-
const EXT_STORE_SYMBOL = Symbol.for("LGUI_EXT_STORE");
|
|
48
|
-
const REQUIRE_SYMBOL = Symbol.for("LGUI_REQUIRE");
|
|
49
|
-
const REQUIRE_EXTRA_SYMBOL = Symbol.for("LGUI_REQUIRE_EXTRA");
|
|
50
|
-
const isIterable = (value) => value != null && typeof value === "object" && Symbol.iterator in value;
|
|
51
|
-
const isPromise = (value) => value != null && typeof value === "object" && "then" in value && typeof value.then === "function";
|
|
52
|
-
const isReactNode = (value) => {
|
|
53
|
-
if (React.isValidElement(value)) return true;
|
|
54
|
-
if (value == null) return true;
|
|
55
|
-
if (typeof value === "string" || typeof value === "number" || typeof value === "bigint" || typeof value === "boolean") return true;
|
|
56
|
-
if (isIterable(value)) return true;
|
|
57
|
-
if (isPromise(value)) return true;
|
|
58
|
-
return false;
|
|
59
|
-
};
|
|
60
|
-
function LoadExternalComponent({ stream, namespace, message, meta, fallback, components,...props }) {
|
|
61
|
-
const ref = React.useRef(null);
|
|
62
|
-
const id = React.useId();
|
|
63
|
-
const shadowRootId = `child-shadow-${id}`;
|
|
64
|
-
const store = React.useMemo(() => COMPONENT_STORE.getBoundStore(shadowRootId), [shadowRootId]);
|
|
65
|
-
const state = React.useSyncExternalStore(store.subscribe, store.getSnapshot);
|
|
66
|
-
const clientComponent = components?.[message.name];
|
|
67
|
-
const hasClientComponent = clientComponent != null;
|
|
68
|
-
let fallbackComponent = null;
|
|
69
|
-
if (isReactNode(fallback)) fallbackComponent = fallback;
|
|
70
|
-
else if (typeof fallback === "object" && fallback != null) fallbackComponent = fallback?.[message.name];
|
|
71
|
-
const uiNamespace = namespace ?? stream.assistantId;
|
|
72
|
-
const uiClient = stream.client["~ui"];
|
|
73
|
-
React.useEffect(() => {
|
|
74
|
-
if (hasClientComponent) return;
|
|
75
|
-
uiClient.getComponent(uiNamespace, message.name).then((html) => {
|
|
76
|
-
const dom = ref.current;
|
|
77
|
-
if (!dom) return;
|
|
78
|
-
const root = dom.shadowRoot ?? dom.attachShadow({ mode: "open" });
|
|
79
|
-
const fragment = document.createRange().createContextualFragment(html.replace("{{shadowRootId}}", shadowRootId));
|
|
80
|
-
root.appendChild(fragment);
|
|
81
|
-
});
|
|
82
|
-
}, [
|
|
83
|
-
uiClient,
|
|
84
|
-
uiNamespace,
|
|
85
|
-
message.name,
|
|
86
|
-
shadowRootId,
|
|
87
|
-
hasClientComponent
|
|
88
|
-
]);
|
|
89
|
-
if (hasClientComponent) return /* @__PURE__ */ jsx(UseStreamContext.Provider, {
|
|
90
|
-
value: {
|
|
91
|
-
stream,
|
|
92
|
-
meta
|
|
93
|
-
},
|
|
94
|
-
children: React.createElement(clientComponent, message.props)
|
|
95
|
-
});
|
|
96
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
97
|
-
id: shadowRootId,
|
|
98
|
-
ref,
|
|
99
|
-
...props
|
|
100
|
-
}), /* @__PURE__ */ jsx(UseStreamContext.Provider, {
|
|
101
|
-
value: {
|
|
102
|
-
stream,
|
|
103
|
-
meta
|
|
104
|
-
},
|
|
105
|
-
children: state?.target != null ? ReactDOM.createPortal(React.createElement(state.comp, message.props), state.target) : fallbackComponent
|
|
106
|
-
})] });
|
|
107
|
-
}
|
|
108
|
-
function experimental_loadShare(name, module) {
|
|
109
|
-
if (typeof window === "undefined") return;
|
|
110
|
-
window[REQUIRE_EXTRA_SYMBOL] ??= {};
|
|
111
|
-
window[REQUIRE_EXTRA_SYMBOL][name] = module;
|
|
112
|
-
}
|
|
113
|
-
function bootstrapUiContext() {
|
|
114
|
-
if (typeof window === "undefined") return;
|
|
115
|
-
window[EXT_STORE_SYMBOL] = COMPONENT_STORE;
|
|
116
|
-
window[REQUIRE_SYMBOL] = (name) => {
|
|
117
|
-
if (name === "react") return React;
|
|
118
|
-
if (name === "react-dom") return ReactDOM;
|
|
119
|
-
if (name === "react/jsx-runtime") return JsxRuntime;
|
|
120
|
-
if (name === "@langchain/langgraph-sdk/react") return { useStream };
|
|
121
|
-
if (name === "@langchain/langgraph-sdk/react-ui") return {
|
|
122
|
-
useStreamContext,
|
|
123
|
-
LoadExternalComponent: () => {
|
|
124
|
-
throw new Error("Nesting LoadExternalComponent is not supported");
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
if (window[REQUIRE_EXTRA_SYMBOL] != null && typeof window[REQUIRE_EXTRA_SYMBOL] === "object" && name in window[REQUIRE_EXTRA_SYMBOL]) return window[REQUIRE_EXTRA_SYMBOL][name];
|
|
128
|
-
throw new Error(`Unknown module...: ${name}`);
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
//#endregion
|
|
133
|
-
export { LoadExternalComponent, bootstrapUiContext, experimental_loadShare, useStreamContext };
|
|
134
|
-
//# sourceMappingURL=client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":[],"sources":["../../src/react-ui/client.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport * as JsxRuntime from \"react/jsx-runtime\";\nimport type { UIMessage } from \"./types.js\";\nimport { useStream } from \"../react/index.js\";\nimport type { UseStream } from \"../react/types.js\";\n\nconst UseStreamContext = React.createContext<{\n stream: ReturnType<typeof useStream>;\n meta: unknown;\n}>(null!);\n\ntype BagTemplate = {\n ConfigurableType?: Record<string, unknown>;\n InterruptType?: unknown;\n CustomEventType?: unknown;\n UpdateType?: unknown;\n MetaType?: unknown;\n};\n\ntype GetMetaType<Bag extends BagTemplate> = Bag extends { MetaType: unknown }\n ? Bag[\"MetaType\"]\n : unknown;\n\ninterface UseStreamContext<\n StateType extends Record<string, unknown> = Record<string, unknown>,\n Bag extends BagTemplate = BagTemplate\n> extends UseStream<StateType, Bag> {\n meta?: GetMetaType<Bag>;\n}\n\nexport function useStreamContext<\n StateType extends Record<string, unknown> = Record<string, unknown>,\n Bag extends {\n ConfigurableType?: Record<string, unknown>;\n InterruptType?: unknown;\n CustomEventType?: unknown;\n UpdateType?: unknown;\n MetaType?: unknown;\n } = BagTemplate\n>(): UseStreamContext<StateType, Bag> {\n const ctx = React.useContext(UseStreamContext);\n if (!ctx) {\n throw new Error(\n \"useStreamContext must be used within a LoadExternalComponent\"\n );\n }\n\n return new Proxy(ctx, {\n get(target, prop: keyof UseStreamContext<StateType, Bag>) {\n if (prop === \"meta\") return target.meta;\n return target.stream[prop];\n },\n }) as unknown as UseStreamContext<StateType, Bag>;\n}\n\ninterface ComponentTarget {\n comp: React.FunctionComponent | React.ComponentClass;\n target: HTMLElement;\n}\n\nclass ComponentStore {\n private cache: Record<string, ComponentTarget> = {};\n\n private boundCache: Record<\n string,\n {\n subscribe: (onStoreChange: () => void) => () => void;\n getSnapshot: () => ComponentTarget | undefined;\n }\n > = {};\n\n private callbacks: Record<\n string,\n ((\n comp: React.FunctionComponent | React.ComponentClass,\n el: HTMLElement\n ) => void)[]\n > = {};\n\n respond(\n shadowRootId: string,\n comp: React.FunctionComponent | React.ComponentClass,\n targetElement: HTMLElement\n ) {\n this.cache[shadowRootId] = { comp, target: targetElement };\n this.callbacks[shadowRootId]?.forEach((c) => c(comp, targetElement));\n }\n\n getBoundStore(shadowRootId: string) {\n this.boundCache[shadowRootId] ??= {\n subscribe: (onStoreChange: () => void) => {\n this.callbacks[shadowRootId] ??= [];\n this.callbacks[shadowRootId].push(onStoreChange);\n return () => {\n this.callbacks[shadowRootId] = this.callbacks[shadowRootId].filter(\n (c) => c !== onStoreChange\n );\n };\n },\n getSnapshot: () => this.cache[shadowRootId],\n };\n\n return this.boundCache[shadowRootId];\n }\n}\n\nconst COMPONENT_STORE = new ComponentStore();\nconst EXT_STORE_SYMBOL = Symbol.for(\"LGUI_EXT_STORE\");\nconst REQUIRE_SYMBOL = Symbol.for(\"LGUI_REQUIRE\");\nconst REQUIRE_EXTRA_SYMBOL = Symbol.for(\"LGUI_REQUIRE_EXTRA\");\n\ninterface LoadExternalComponentProps\n extends Pick<React.HTMLAttributes<HTMLDivElement>, \"style\" | \"className\"> {\n /** Stream of the assistant */\n stream: ReturnType<typeof useStream>;\n\n /** Namespace of UI components. Defaults to assistant ID. */\n namespace?: string;\n\n /** UI message to be rendered */\n message: UIMessage;\n\n /** Additional context to be passed to the child component */\n meta?: unknown;\n\n /** Fallback to be rendered when the component is loading */\n fallback?: React.ReactNode | Record<string, React.ReactNode>;\n\n /**\n * Map of components that can be rendered directly without fetching the UI code\n * from the server.\n */\n components?: Record<string, React.FunctionComponent | React.ComponentClass>;\n}\n\nconst isIterable = (value: unknown): value is Iterable<unknown> =>\n value != null && typeof value === \"object\" && Symbol.iterator in value;\n\nconst isPromise = (value: unknown): value is Promise<unknown> =>\n value != null &&\n typeof value === \"object\" &&\n \"then\" in value &&\n typeof value.then === \"function\";\n\nconst isReactNode = (value: unknown): value is React.ReactNode => {\n if (React.isValidElement(value)) return true;\n if (value == null) return true;\n if (\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"bigint\" ||\n typeof value === \"boolean\"\n ) {\n return true;\n }\n\n if (isIterable(value)) return true;\n if (isPromise(value)) return true;\n\n return false;\n};\n\nexport function LoadExternalComponent({\n stream,\n namespace,\n message,\n meta,\n fallback,\n components,\n ...props\n}: LoadExternalComponentProps) {\n const ref = React.useRef<HTMLDivElement>(null);\n const id = React.useId();\n const shadowRootId = `child-shadow-${id}`;\n\n const store = React.useMemo(\n () => COMPONENT_STORE.getBoundStore(shadowRootId),\n [shadowRootId]\n );\n const state = React.useSyncExternalStore(store.subscribe, store.getSnapshot);\n\n const clientComponent = components?.[message.name];\n const hasClientComponent = clientComponent != null;\n\n let fallbackComponent = null;\n if (isReactNode(fallback)) {\n fallbackComponent = fallback;\n } else if (typeof fallback === \"object\" && fallback != null) {\n fallbackComponent = fallback?.[message.name];\n }\n\n const uiNamespace = namespace ?? stream.assistantId;\n const uiClient = stream.client[\"~ui\"];\n React.useEffect(() => {\n if (hasClientComponent) return;\n void uiClient.getComponent(uiNamespace, message.name).then((html) => {\n const dom = ref.current;\n if (!dom) return;\n const root = dom.shadowRoot ?? dom.attachShadow({ mode: \"open\" });\n const fragment = document\n .createRange()\n .createContextualFragment(\n html.replace(\"{{shadowRootId}}\", shadowRootId)\n );\n root.appendChild(fragment);\n });\n }, [uiClient, uiNamespace, message.name, shadowRootId, hasClientComponent]);\n\n if (hasClientComponent) {\n return (\n <UseStreamContext.Provider value={{ stream, meta }}>\n {React.createElement(clientComponent, message.props)}\n </UseStreamContext.Provider>\n );\n }\n\n return (\n <>\n <div id={shadowRootId} ref={ref} {...props} />\n\n <UseStreamContext.Provider value={{ stream, meta }}>\n {state?.target != null\n ? ReactDOM.createPortal(\n React.createElement(state.comp, message.props),\n state.target\n )\n : fallbackComponent}\n </UseStreamContext.Provider>\n </>\n );\n}\n\ndeclare global {\n interface Window {\n [EXT_STORE_SYMBOL]: ComponentStore;\n [REQUIRE_SYMBOL]: (name: string) => unknown;\n [REQUIRE_EXTRA_SYMBOL]: Record<string, unknown>;\n }\n}\n\nexport function experimental_loadShare(name: string, module: unknown) {\n if (typeof window === \"undefined\") return;\n\n window[REQUIRE_EXTRA_SYMBOL] ??= {};\n window[REQUIRE_EXTRA_SYMBOL][name] = module;\n}\n\nexport function bootstrapUiContext() {\n if (typeof window === \"undefined\") {\n return;\n }\n\n window[EXT_STORE_SYMBOL] = COMPONENT_STORE;\n window[REQUIRE_SYMBOL] = (name: string) => {\n if (name === \"react\") return React;\n if (name === \"react-dom\") return ReactDOM;\n if (name === \"react/jsx-runtime\") return JsxRuntime;\n if (name === \"@langchain/langgraph-sdk/react\") return { useStream };\n if (name === \"@langchain/langgraph-sdk/react-ui\") {\n return {\n useStreamContext,\n LoadExternalComponent: () => {\n throw new Error(\"Nesting LoadExternalComponent is not supported\");\n },\n };\n }\n\n if (\n window[REQUIRE_EXTRA_SYMBOL] != null &&\n typeof window[REQUIRE_EXTRA_SYMBOL] === \"object\" &&\n name in window[REQUIRE_EXTRA_SYMBOL]\n ) {\n return window[REQUIRE_EXTRA_SYMBOL][name];\n }\n\n throw new Error(`Unknown module...: ${name}`);\n };\n}\n"],"mappings":";;;;;;;;;;;AASA,MAAM,mBAAmB,MAAM,cAG5B;AAqBH,SAAgB,mBASsB;CACpC,MAAM,MAAM,MAAM,WAAW;AAC7B,KAAI,CAAC,IACH,OAAM,IAAI,MACR;AAIJ,QAAO,IAAI,MAAM,KAAK,EACpB,IAAI,QAAQ,MAA8C;AACxD,MAAI,SAAS,OAAQ,QAAO,OAAO;AACnC,SAAO,OAAO,OAAO;;;AAU3B,IAAM,iBAAN,MAAqB;CACnB,AAAQ,QAAyC;CAEjD,AAAQ,aAMJ;CAEJ,AAAQ,YAMJ;CAEJ,QACE,cACA,MACA,eACA;AACA,OAAK,MAAM,gBAAgB;GAAE;GAAM,QAAQ;;AAC3C,OAAK,UAAU,eAAe,SAAS,MAAM,EAAE,MAAM;;CAGvD,cAAc,cAAsB;AAClC,OAAK,WAAW,kBAAkB;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 @@
|
|
|
1
|
-
const require_client = require('./client.cjs');
|
|
2
|
-
const require_types = require('./types.cjs');
|
|
3
|
-
|
|
4
|
-
//#region src/react-ui/index.ts
|
|
5
|
-
require_client.bootstrapUiContext();
|
|
6
|
-
|
|
7
|
-
//#endregion
|
|
8
|
-
exports.LoadExternalComponent = require_client.LoadExternalComponent;
|
|
9
|
-
exports.experimental_loadShare = require_client.experimental_loadShare;
|
|
10
|
-
exports.isRemoveUIMessage = require_types.isRemoveUIMessage;
|
|
11
|
-
exports.isUIMessage = require_types.isUIMessage;
|
|
12
|
-
exports.uiMessageReducer = require_types.uiMessageReducer;
|
|
13
|
-
exports.useStreamContext = require_client.useStreamContext;
|
|
14
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["bootstrapUiContext"],"sources":["../../src/react-ui/index.ts"],"sourcesContent":["import { bootstrapUiContext } from \"./client.js\";\n\nbootstrapUiContext();\n\nexport {\n useStreamContext,\n LoadExternalComponent,\n experimental_loadShare,\n} from \"./client.js\";\nexport {\n uiMessageReducer,\n isUIMessage,\n isRemoveUIMessage,\n type UIMessage,\n type RemoveUIMessage,\n} from \"./types.js\";\n"],"mappings":";;;;AAEAA"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { RemoveUIMessage, UIMessage, isRemoveUIMessage, isUIMessage, uiMessageReducer } from "./types.cjs";
|
|
2
|
-
import { LoadExternalComponent, experimental_loadShare, useStreamContext } from "./client.cjs";
|
|
3
|
-
export { LoadExternalComponent, type RemoveUIMessage, type UIMessage, experimental_loadShare, isRemoveUIMessage, isUIMessage, uiMessageReducer, useStreamContext };
|
package/dist/react-ui/index.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { RemoveUIMessage, UIMessage, isRemoveUIMessage, isUIMessage, uiMessageReducer } from "./types.js";
|
|
2
|
-
import { LoadExternalComponent, experimental_loadShare, useStreamContext } from "./client.js";
|
|
3
|
-
export { LoadExternalComponent, type RemoveUIMessage, type UIMessage, experimental_loadShare, isRemoveUIMessage, isUIMessage, uiMessageReducer, useStreamContext };
|
package/dist/react-ui/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { LoadExternalComponent, bootstrapUiContext, experimental_loadShare, useStreamContext } from "./client.js";
|
|
2
|
-
import { isRemoveUIMessage, isUIMessage, uiMessageReducer } from "./types.js";
|
|
3
|
-
|
|
4
|
-
//#region src/react-ui/index.ts
|
|
5
|
-
bootstrapUiContext();
|
|
6
|
-
|
|
7
|
-
//#endregion
|
|
8
|
-
export { LoadExternalComponent, experimental_loadShare, isRemoveUIMessage, isUIMessage, uiMessageReducer, useStreamContext };
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/react-ui/index.ts"],"sourcesContent":["import { bootstrapUiContext } from \"./client.js\";\n\nbootstrapUiContext();\n\nexport {\n useStreamContext,\n LoadExternalComponent,\n experimental_loadShare,\n} from \"./client.js\";\nexport {\n uiMessageReducer,\n isUIMessage,\n isRemoveUIMessage,\n type UIMessage,\n type RemoveUIMessage,\n} from \"./types.js\";\n"],"mappings":";;;;AAEA"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const uuid = require_rolldown_runtime.__toESM(require("uuid"));
|
|
3
|
-
|
|
4
|
-
//#region src/react-ui/server/server.ts
|
|
5
|
-
/**
|
|
6
|
-
* Helper to send and persist UI messages. Accepts a map of component names to React components
|
|
7
|
-
* as type argument to provide type safety. Will also write to the `options?.stateKey` state.
|
|
8
|
-
*
|
|
9
|
-
* @param config LangGraphRunnableConfig
|
|
10
|
-
* @param options
|
|
11
|
-
* @returns
|
|
12
|
-
*/
|
|
13
|
-
const typedUi = (config, options) => {
|
|
14
|
-
const items = [];
|
|
15
|
-
const stateKey = options?.stateKey ?? "ui";
|
|
16
|
-
const runId = config.metadata?.run_id ?? config.runId;
|
|
17
|
-
if (!runId) throw new Error("run_id is required");
|
|
18
|
-
function handlePush(message, options$1) {
|
|
19
|
-
const evt = {
|
|
20
|
-
type: "ui",
|
|
21
|
-
id: message?.id ?? (0, uuid.v4)(),
|
|
22
|
-
name: message?.name,
|
|
23
|
-
props: message?.props,
|
|
24
|
-
metadata: {
|
|
25
|
-
merge: options$1?.merge || void 0,
|
|
26
|
-
run_id: runId,
|
|
27
|
-
tags: config.tags,
|
|
28
|
-
name: config.runName,
|
|
29
|
-
...message?.metadata,
|
|
30
|
-
...options$1?.message ? { message_id: options$1.message.id } : null
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
items.push(evt);
|
|
34
|
-
config.writer?.(evt);
|
|
35
|
-
config.configurable?.__pregel_send?.([[stateKey, evt]]);
|
|
36
|
-
return evt;
|
|
37
|
-
}
|
|
38
|
-
const handleDelete = (id) => {
|
|
39
|
-
const evt = {
|
|
40
|
-
type: "remove-ui",
|
|
41
|
-
id
|
|
42
|
-
};
|
|
43
|
-
items.push(evt);
|
|
44
|
-
config.writer?.(evt);
|
|
45
|
-
config.configurable?.__pregel_send?.([[stateKey, evt]]);
|
|
46
|
-
return evt;
|
|
47
|
-
};
|
|
48
|
-
return {
|
|
49
|
-
push: handlePush,
|
|
50
|
-
delete: handleDelete,
|
|
51
|
-
items
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
//#endregion
|
|
56
|
-
exports.typedUi = typedUi;
|
|
57
|
-
//# sourceMappingURL=server.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.cjs","names":["items: (UIMessage | RemoveUIMessage)[]","evt: UIMessage<K, PropMap[K] | Partial<PropMap[K]>>","options","evt: RemoveUIMessage"],"sources":["../../../src/react-ui/server/server.ts"],"sourcesContent":["import { v4 as uuidv4 } from \"uuid\";\nimport type { ComponentPropsWithoutRef, ElementType } from \"react\";\nimport type { RemoveUIMessage, UIMessage } from \"../types.js\";\n\ninterface MessageLike {\n id?: string;\n}\n\n/**\n * Helper to send and persist UI messages. Accepts a map of component names to React components\n * as type argument to provide type safety. Will also write to the `options?.stateKey` state.\n *\n * @param config LangGraphRunnableConfig\n * @param options\n * @returns\n */\nexport const typedUi = <Decl extends Record<string, ElementType>>(\n config: {\n writer?: (chunk: unknown) => void;\n runId?: string;\n metadata?: Record<string, unknown>;\n tags?: string[];\n runName?: string;\n configurable?: {\n __pregel_send?: (writes_: [string, unknown][]) => void;\n [key: string]: unknown;\n };\n },\n options?: {\n /** The key to write the UI messages to. Defaults to `ui`. */\n stateKey?: string;\n }\n) => {\n type PropMap = { [K in keyof Decl]: ComponentPropsWithoutRef<Decl[K]> };\n const items: (UIMessage | RemoveUIMessage)[] = [];\n const stateKey = options?.stateKey ?? \"ui\";\n\n const runId = (config.metadata?.run_id as string | undefined) ?? config.runId;\n if (!runId) throw new Error(\"run_id is required\");\n\n function handlePush<K extends keyof PropMap & string>(\n message: {\n id?: string;\n name: K;\n props: PropMap[K];\n metadata?: Record<string, unknown>;\n },\n options?: { message?: MessageLike; merge?: boolean }\n ): UIMessage<K, PropMap[K]>;\n\n function handlePush<K extends keyof PropMap & string>(\n message: {\n id?: string;\n name: K;\n props: Partial<PropMap[K]>;\n metadata?: Record<string, unknown>;\n },\n options: { message?: MessageLike; merge: true }\n ): UIMessage<K, Partial<PropMap[K]>>;\n\n function handlePush<K extends keyof PropMap & string>(\n message: {\n id?: string;\n name: K;\n props: PropMap[K] | Partial<PropMap[K]>;\n metadata?: Record<string, unknown>;\n },\n options?: { message?: MessageLike; merge?: boolean }\n ): UIMessage<K, PropMap[K] | Partial<PropMap[K]>> {\n const evt: UIMessage<K, PropMap[K] | Partial<PropMap[K]>> = {\n type: \"ui\" as const,\n id: message?.id ?? uuidv4(),\n name: message?.name,\n props: message?.props,\n metadata: {\n merge: options?.merge || undefined,\n run_id: runId,\n tags: config.tags,\n name: config.runName,\n ...message?.metadata,\n ...(options?.message ? { message_id: options.message.id } : null),\n },\n };\n items.push(evt);\n config.writer?.(evt);\n config.configurable?.__pregel_send?.([[stateKey, evt]]);\n return evt;\n }\n\n const handleDelete = (id: string): RemoveUIMessage => {\n const evt: RemoveUIMessage = { type: \"remove-ui\", id };\n items.push(evt);\n config.writer?.(evt);\n config.configurable?.__pregel_send?.([[stateKey, evt]]);\n return evt;\n };\n\n return { push: handlePush, delete: handleDelete, items };\n};\n"],"mappings":";;;;;;;;;;;;AAgBA,MAAa,WACX,QAWA,YAIG;CAEH,MAAMA,QAAyC;CAC/C,MAAM,WAAW,SAAS,YAAY;CAEtC,MAAM,QAAS,OAAO,UAAU,UAAiC,OAAO;AACxE,KAAI,CAAC,MAAO,OAAM,IAAI,MAAM;CAsB5B,SAAS,WACP,SAMA,WACgD;EAChD,MAAMC,MAAsD;GAC1D,MAAM;GACN,IAAI,SAAS;GACb,MAAM,SAAS;GACf,OAAO,SAAS;GAChB,UAAU;IACR,OAAOC,WAAS,SAAS;IACzB,QAAQ;IACR,MAAM,OAAO;IACb,MAAM,OAAO;IACb,GAAG,SAAS;IACZ,GAAIA,WAAS,UAAU,EAAE,YAAYA,UAAQ,QAAQ,OAAO;;;AAGhE,QAAM,KAAK;AACX,SAAO,SAAS;AAChB,SAAO,cAAc,gBAAgB,CAAC,CAAC,UAAU;AACjD,SAAO;;CAGT,MAAM,gBAAgB,OAAgC;EACpD,MAAMC,MAAuB;GAAE,MAAM;GAAa;;AAClD,QAAM,KAAK;AACX,SAAO,SAAS;AAChB,SAAO,cAAc,gBAAgB,CAAC,CAAC,UAAU;AACjD,SAAO;;AAGT,QAAO;EAAE,MAAM;EAAY,QAAQ;EAAc"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { RemoveUIMessage, UIMessage } from "../types.cjs";
|
|
2
|
-
import { ComponentPropsWithoutRef, ElementType } from "react";
|
|
3
|
-
|
|
4
|
-
//#region src/react-ui/server/server.d.ts
|
|
5
|
-
interface MessageLike {
|
|
6
|
-
id?: string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Helper to send and persist UI messages. Accepts a map of component names to React components
|
|
10
|
-
* as type argument to provide type safety. Will also write to the `options?.stateKey` state.
|
|
11
|
-
*
|
|
12
|
-
* @param config LangGraphRunnableConfig
|
|
13
|
-
* @param options
|
|
14
|
-
* @returns
|
|
15
|
-
*/
|
|
16
|
-
declare const typedUi: <Decl extends Record<string, ElementType>>(config: {
|
|
17
|
-
writer?: ((chunk: unknown) => void) | undefined;
|
|
18
|
-
runId?: string | undefined;
|
|
19
|
-
metadata?: Record<string, unknown> | undefined;
|
|
20
|
-
tags?: string[] | undefined;
|
|
21
|
-
runName?: string | undefined;
|
|
22
|
-
configurable?: {
|
|
23
|
-
[key: string]: unknown;
|
|
24
|
-
__pregel_send?: ((writes_: [string, unknown][]) => void) | undefined;
|
|
25
|
-
} | undefined;
|
|
26
|
-
}, options?: {
|
|
27
|
-
/** The key to write the UI messages to. Defaults to `ui`. */
|
|
28
|
-
stateKey?: string | undefined;
|
|
29
|
-
} | undefined) => {
|
|
30
|
-
push: {
|
|
31
|
-
<K extends keyof Decl & string>(message: {
|
|
32
|
-
id?: string | undefined;
|
|
33
|
-
name: K;
|
|
34
|
-
props: { [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]> }[K];
|
|
35
|
-
metadata?: Record<string, unknown> | undefined;
|
|
36
|
-
}, options?: {
|
|
37
|
-
message?: MessageLike | undefined;
|
|
38
|
-
merge?: boolean | undefined;
|
|
39
|
-
} | undefined): UIMessage<K, { [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]> }[K]>;
|
|
40
|
-
<K extends keyof Decl & string>(message: {
|
|
41
|
-
id?: string | undefined;
|
|
42
|
-
name: K;
|
|
43
|
-
props: Partial<{ [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]> }[K]>;
|
|
44
|
-
metadata?: Record<string, unknown> | undefined;
|
|
45
|
-
}, options: {
|
|
46
|
-
message?: MessageLike | undefined;
|
|
47
|
-
merge: true;
|
|
48
|
-
}): UIMessage<K, Partial<{ [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]> }[K]>>;
|
|
49
|
-
};
|
|
50
|
-
delete: (id: string) => RemoveUIMessage;
|
|
51
|
-
items: (RemoveUIMessage | UIMessage<string, Record<string, unknown>>)[];
|
|
52
|
-
};
|
|
53
|
-
//#endregion
|
|
54
|
-
export { typedUi };
|
|
55
|
-
//# sourceMappingURL=server.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.cts","names":["ComponentPropsWithoutRef","ElementType","RemoveUIMessage","UIMessage","MessageLike","typedUi","Record","Decl","K","K_1","Partial"],"sources":["../../../src/react-ui/server/server.d.ts"],"sourcesContent":["import type { ComponentPropsWithoutRef, ElementType } from \"react\";\nimport type { RemoveUIMessage, UIMessage } from \"../types.js\";\ninterface MessageLike {\n id?: string;\n}\n/**\n * Helper to send and persist UI messages. Accepts a map of component names to React components\n * as type argument to provide type safety. Will also write to the `options?.stateKey` state.\n *\n * @param config LangGraphRunnableConfig\n * @param options\n * @returns\n */\nexport declare const typedUi: <Decl extends Record<string, ElementType>>(config: {\n writer?: ((chunk: unknown) => void) | undefined;\n runId?: string | undefined;\n metadata?: Record<string, unknown> | undefined;\n tags?: string[] | undefined;\n runName?: string | undefined;\n configurable?: {\n [key: string]: unknown;\n __pregel_send?: ((writes_: [string, unknown][]) => void) | undefined;\n } | undefined;\n}, options?: {\n /** The key to write the UI messages to. Defaults to `ui`. */\n stateKey?: string | undefined;\n} | undefined) => {\n push: {\n <K extends keyof Decl & string>(message: {\n id?: string | undefined;\n name: K;\n props: { [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K];\n metadata?: Record<string, unknown> | undefined;\n }, options?: {\n message?: MessageLike | undefined;\n merge?: boolean | undefined;\n } | undefined): UIMessage<K, { [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K]>;\n <K extends keyof Decl & string>(message: {\n id?: string | undefined;\n name: K;\n props: Partial<{ [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K]>;\n metadata?: Record<string, unknown> | undefined;\n }, options: {\n message?: MessageLike | undefined;\n merge: true;\n }): UIMessage<K, Partial<{ [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K]>>;\n };\n delete: (id: string) => RemoveUIMessage;\n items: (RemoveUIMessage | UIMessage<string, Record<string, unknown>>)[];\n};\nexport {};\n"],"mappings":";;;;UAEUI,WAAAA;;AADoD;AAY9D;;;;;;;;AAkBmEG,cAlB9CF,OAkB8CE,EAAAA,CAAAA,aAlBvBD,MAkBuBC,CAAAA,MAAAA,EAlBRN,WAkBQM,CAAAA,CAAAA,CAAAA,MAAAA,EAAAA;QAAKE,CAAAA,EAAAA,CAAAA,CAAAA,KAAAA,EAAAA,OAAAA,EAAAA,GAAAA,IAAAA,CAAAA,GAAAA,SAAAA;OAA9BT,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;UAAuCQ,CAAAA,EAflEF,MAekEE,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,GAAAA,SAAAA;MAC1DF,CAAAA,EAAAA,MAAAA,EAAAA,GAAAA,SAAAA;SAEDF,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;cAEYI,CAAAA,EAAAA;IAAmBD,CAAAA,GAAAA,EAAAA,MAAAA,CAAAA,EAAAA,OAAAA;IAAgCA,aAAAA,CAAAA,EAAAA,CAAAA,CAAAA,OAAAA,EAAAA,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EAAAA,EAAAA,GAAAA,IAAAA,CAAAA,GAAAA,SAAAA;MAAKE,SAAAA;UACjEF,CADmCP,EAAAA;;UAApCG,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;aACCI,EAAAA,GAAAA;MAEPC,EA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D,KAAAA,EAAAA,IAAAA;IAChBA,CAAAA,CAAAA,EAHAC,SAGAD,CAHUM,CAGVN,EAHaQ,OAGbR,CAAAA,UAAAA,MAHqCK,IAGrCL,GAH4CF,wBAG5CE,CAHqEK,IAGrEL,CAH0EO,GAG1EP,CAAAA,CAAAA,EAAAA,CAHmFM,CAGnFN,CAAAA,CAAAA,CAAAA;;QAAkBC,EAAAA,CAAAA,EAAAA,EAAAA,MAAAA,EAAAA,GADFD,eACEC;UAAlBD,kBAAkBC,kBAAkBG"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { RemoveUIMessage, UIMessage } from "../types.js";
|
|
2
|
-
import { ComponentPropsWithoutRef, ElementType } from "react";
|
|
3
|
-
|
|
4
|
-
//#region src/react-ui/server/server.d.ts
|
|
5
|
-
interface MessageLike {
|
|
6
|
-
id?: string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Helper to send and persist UI messages. Accepts a map of component names to React components
|
|
10
|
-
* as type argument to provide type safety. Will also write to the `options?.stateKey` state.
|
|
11
|
-
*
|
|
12
|
-
* @param config LangGraphRunnableConfig
|
|
13
|
-
* @param options
|
|
14
|
-
* @returns
|
|
15
|
-
*/
|
|
16
|
-
declare const typedUi: <Decl extends Record<string, ElementType>>(config: {
|
|
17
|
-
writer?: ((chunk: unknown) => void) | undefined;
|
|
18
|
-
runId?: string | undefined;
|
|
19
|
-
metadata?: Record<string, unknown> | undefined;
|
|
20
|
-
tags?: string[] | undefined;
|
|
21
|
-
runName?: string | undefined;
|
|
22
|
-
configurable?: {
|
|
23
|
-
[key: string]: unknown;
|
|
24
|
-
__pregel_send?: ((writes_: [string, unknown][]) => void) | undefined;
|
|
25
|
-
} | undefined;
|
|
26
|
-
}, options?: {
|
|
27
|
-
/** The key to write the UI messages to. Defaults to `ui`. */
|
|
28
|
-
stateKey?: string | undefined;
|
|
29
|
-
} | undefined) => {
|
|
30
|
-
push: {
|
|
31
|
-
<K extends keyof Decl & string>(message: {
|
|
32
|
-
id?: string | undefined;
|
|
33
|
-
name: K;
|
|
34
|
-
props: { [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]> }[K];
|
|
35
|
-
metadata?: Record<string, unknown> | undefined;
|
|
36
|
-
}, options?: {
|
|
37
|
-
message?: MessageLike | undefined;
|
|
38
|
-
merge?: boolean | undefined;
|
|
39
|
-
} | undefined): UIMessage<K, { [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]> }[K]>;
|
|
40
|
-
<K extends keyof Decl & string>(message: {
|
|
41
|
-
id?: string | undefined;
|
|
42
|
-
name: K;
|
|
43
|
-
props: Partial<{ [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]> }[K]>;
|
|
44
|
-
metadata?: Record<string, unknown> | undefined;
|
|
45
|
-
}, options: {
|
|
46
|
-
message?: MessageLike | undefined;
|
|
47
|
-
merge: true;
|
|
48
|
-
}): UIMessage<K, Partial<{ [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]> }[K]>>;
|
|
49
|
-
};
|
|
50
|
-
delete: (id: string) => RemoveUIMessage;
|
|
51
|
-
items: (RemoveUIMessage | UIMessage<string, Record<string, unknown>>)[];
|
|
52
|
-
};
|
|
53
|
-
//#endregion
|
|
54
|
-
export { typedUi };
|
|
55
|
-
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","names":["ComponentPropsWithoutRef","ElementType","RemoveUIMessage","UIMessage","MessageLike","typedUi","Record","Decl","K","K_1","Partial"],"sources":["../../../src/react-ui/server/server.d.ts"],"sourcesContent":["import type { ComponentPropsWithoutRef, ElementType } from \"react\";\nimport type { RemoveUIMessage, UIMessage } from \"../types.js\";\ninterface MessageLike {\n id?: string;\n}\n/**\n * Helper to send and persist UI messages. Accepts a map of component names to React components\n * as type argument to provide type safety. Will also write to the `options?.stateKey` state.\n *\n * @param config LangGraphRunnableConfig\n * @param options\n * @returns\n */\nexport declare const typedUi: <Decl extends Record<string, ElementType>>(config: {\n writer?: ((chunk: unknown) => void) | undefined;\n runId?: string | undefined;\n metadata?: Record<string, unknown> | undefined;\n tags?: string[] | undefined;\n runName?: string | undefined;\n configurable?: {\n [key: string]: unknown;\n __pregel_send?: ((writes_: [string, unknown][]) => void) | undefined;\n } | undefined;\n}, options?: {\n /** The key to write the UI messages to. Defaults to `ui`. */\n stateKey?: string | undefined;\n} | undefined) => {\n push: {\n <K extends keyof Decl & string>(message: {\n id?: string | undefined;\n name: K;\n props: { [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K];\n metadata?: Record<string, unknown> | undefined;\n }, options?: {\n message?: MessageLike | undefined;\n merge?: boolean | undefined;\n } | undefined): UIMessage<K, { [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K]>;\n <K extends keyof Decl & string>(message: {\n id?: string | undefined;\n name: K;\n props: Partial<{ [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K]>;\n metadata?: Record<string, unknown> | undefined;\n }, options: {\n message?: MessageLike | undefined;\n merge: true;\n }): UIMessage<K, Partial<{ [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K]>>;\n };\n delete: (id: string) => RemoveUIMessage;\n items: (RemoveUIMessage | UIMessage<string, Record<string, unknown>>)[];\n};\nexport {};\n"],"mappings":";;;;UAEUI,WAAAA;;AADoD;AAY9D;;;;;;;;AAkBmEG,cAlB9CF,OAkB8CE,EAAAA,CAAAA,aAlBvBD,MAkBuBC,CAAAA,MAAAA,EAlBRN,WAkBQM,CAAAA,CAAAA,CAAAA,MAAAA,EAAAA;QAAKE,CAAAA,EAAAA,CAAAA,CAAAA,KAAAA,EAAAA,OAAAA,EAAAA,GAAAA,IAAAA,CAAAA,GAAAA,SAAAA;OAA9BT,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;UAAuCQ,CAAAA,EAflEF,MAekEE,CAAAA,MA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QwBA,GAAAA,MAAAA,CAAAA,CAAAA,OAAAA,EAAAA;MAAgCA,EAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;MAAKE,IAAAA,EANpED,CAMoEC;MAA9BT,KAAAA,EALrCU,OAKqCV,CAAAA,UAAAA,MALbO,IAKaP,GALNA,wBAKMA,CALmBO,IAKnBP,CALwBS,GAKxBT,CAAAA,CAAAA,EAAAA,CALiCQ,CAKjCR,CAAAA,CAAAA;MAAuCQ,QAAAA,CAAAA,EAJxEF,MAIwEE,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,GAAAA,SAAAA;IAAtEE,CAAAA,EAAAA,OAAAA,EAAAA;MAAbP,OAAAA,CAAAA,EAFUC,WAEVD,GAAAA,SAAAA;MAEgBD,KAAAA,EAAAA,IAAAA;IAChBA,CAAAA,CAAAA,EAHAC,SAGAD,CAHUM,CAGVN,EAHaQ,OAGbR,CAAAA,UAAAA,MAHqCK,IAGrCL,GAH4CF,wBAG5CE,CAHqEK,IAGrEL,CAH0EO,GAG1EP,CAAAA,CAAAA,EAAAA,CAHmFM,CAGnFN,CAAAA,CAAAA,CAAAA;;QAAkBC,EAAAA,CAAAA,EAAAA,EAAAA,MAAAA,EAAAA,GADFD,eACEC;UAAlBD,kBAAkBC,kBAAkBG"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { v4 } from "uuid";
|
|
2
|
-
|
|
3
|
-
//#region src/react-ui/server/server.ts
|
|
4
|
-
/**
|
|
5
|
-
* Helper to send and persist UI messages. Accepts a map of component names to React components
|
|
6
|
-
* as type argument to provide type safety. Will also write to the `options?.stateKey` state.
|
|
7
|
-
*
|
|
8
|
-
* @param config LangGraphRunnableConfig
|
|
9
|
-
* @param options
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
const typedUi = (config, options) => {
|
|
13
|
-
const items = [];
|
|
14
|
-
const stateKey = options?.stateKey ?? "ui";
|
|
15
|
-
const runId = config.metadata?.run_id ?? config.runId;
|
|
16
|
-
if (!runId) throw new Error("run_id is required");
|
|
17
|
-
function handlePush(message, options$1) {
|
|
18
|
-
const evt = {
|
|
19
|
-
type: "ui",
|
|
20
|
-
id: message?.id ?? v4(),
|
|
21
|
-
name: message?.name,
|
|
22
|
-
props: message?.props,
|
|
23
|
-
metadata: {
|
|
24
|
-
merge: options$1?.merge || void 0,
|
|
25
|
-
run_id: runId,
|
|
26
|
-
tags: config.tags,
|
|
27
|
-
name: config.runName,
|
|
28
|
-
...message?.metadata,
|
|
29
|
-
...options$1?.message ? { message_id: options$1.message.id } : null
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
items.push(evt);
|
|
33
|
-
config.writer?.(evt);
|
|
34
|
-
config.configurable?.__pregel_send?.([[stateKey, evt]]);
|
|
35
|
-
return evt;
|
|
36
|
-
}
|
|
37
|
-
const handleDelete = (id) => {
|
|
38
|
-
const evt = {
|
|
39
|
-
type: "remove-ui",
|
|
40
|
-
id
|
|
41
|
-
};
|
|
42
|
-
items.push(evt);
|
|
43
|
-
config.writer?.(evt);
|
|
44
|
-
config.configurable?.__pregel_send?.([[stateKey, evt]]);
|
|
45
|
-
return evt;
|
|
46
|
-
};
|
|
47
|
-
return {
|
|
48
|
-
push: handlePush,
|
|
49
|
-
delete: handleDelete,
|
|
50
|
-
items
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
//#endregion
|
|
55
|
-
export { typedUi };
|
|
56
|
-
//# sourceMappingURL=server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","names":["items: (UIMessage | RemoveUIMessage)[]","evt: UIMessage<K, PropMap[K] | Partial<PropMap[K]>>","uuidv4","options","evt: RemoveUIMessage"],"sources":["../../../src/react-ui/server/server.ts"],"sourcesContent":["import { v4 as uuidv4 } from \"uuid\";\nimport type { ComponentPropsWithoutRef, ElementType } from \"react\";\nimport type { RemoveUIMessage, UIMessage } from \"../types.js\";\n\ninterface MessageLike {\n id?: string;\n}\n\n/**\n * Helper to send and persist UI messages. Accepts a map of component names to React components\n * as type argument to provide type safety. Will also write to the `options?.stateKey` state.\n *\n * @param config LangGraphRunnableConfig\n * @param options\n * @returns\n */\nexport const typedUi = <Decl extends Record<string, ElementType>>(\n config: {\n writer?: (chunk: unknown) => void;\n runId?: string;\n metadata?: Record<string, unknown>;\n tags?: string[];\n runName?: string;\n configurable?: {\n __pregel_send?: (writes_: [string, unknown][]) => void;\n [key: string]: unknown;\n };\n },\n options?: {\n /** The key to write the UI messages to. Defaults to `ui`. */\n stateKey?: string;\n }\n) => {\n type PropMap = { [K in keyof Decl]: ComponentPropsWithoutRef<Decl[K]> };\n const items: (UIMessage | RemoveUIMessage)[] = [];\n const stateKey = options?.stateKey ?? \"ui\";\n\n const runId = (config.metadata?.run_id as string | undefined) ?? config.runId;\n if (!runId) throw new Error(\"run_id is required\");\n\n function handlePush<K extends keyof PropMap & string>(\n message: {\n id?: string;\n name: K;\n props: PropMap[K];\n metadata?: Record<string, unknown>;\n },\n options?: { message?: MessageLike; merge?: boolean }\n ): UIMessage<K, PropMap[K]>;\n\n function handlePush<K extends keyof PropMap & string>(\n message: {\n id?: string;\n name: K;\n props: Partial<PropMap[K]>;\n metadata?: Record<string, unknown>;\n },\n options: { message?: MessageLike; merge: true }\n ): UIMessage<K, Partial<PropMap[K]>>;\n\n function handlePush<K extends keyof PropMap & string>(\n message: {\n id?: string;\n name: K;\n props: PropMap[K] | Partial<PropMap[K]>;\n metadata?: Record<string, unknown>;\n },\n options?: { message?: MessageLike; merge?: boolean }\n ): UIMessage<K, PropMap[K] | Partial<PropMap[K]>> {\n const evt: UIMessage<K, PropMap[K] | Partial<PropMap[K]>> = {\n type: \"ui\" as const,\n id: message?.id ?? uuidv4(),\n name: message?.name,\n props: message?.props,\n metadata: {\n merge: options?.merge || undefined,\n run_id: runId,\n tags: config.tags,\n name: config.runName,\n ...message?.metadata,\n ...(options?.message ? { message_id: options.message.id } : null),\n },\n };\n items.push(evt);\n config.writer?.(evt);\n config.configurable?.__pregel_send?.([[stateKey, evt]]);\n return evt;\n }\n\n const handleDelete = (id: string): RemoveUIMessage => {\n const evt: RemoveUIMessage = { type: \"remove-ui\", id };\n items.push(evt);\n config.writer?.(evt);\n config.configurable?.__pregel_send?.([[stateKey, evt]]);\n return evt;\n };\n\n return { push: handlePush, delete: handleDelete, items };\n};\n"],"mappings":";;;;;;;;;;;AAgBA,MAAa,WACX,QAWA,YAIG;CAEH,MAAMA,QAAyC;CAC/C,MAAM,WAAW,SAAS,YAAY;CAEtC,MAAM,QAAS,OAAO,UAAU,UAAiC,OAAO;AACxE,KAAI,CAAC,MAAO,OAAM,IAAI,MAAM;CAsB5B,SAAS,WACP,SAMA,WACgD;EAChD,MAAMC,MAAsD;GAC1D,MAAM;GACN,IAAI,SAAS,MAAMC;GACnB,MAAM,SAAS;GACf,OAAO,SAAS;GAChB,UAAU;IACR,OAAOC,WAAS,SAAS;IACzB,QAAQ;IACR,MAAM,OAAO;IACb,MAAM,OAAO;IACb,GAAG,SAAS;IACZ,GAAIA,WAAS,UAAU,EAAE,YAAYA,UAAQ,QAAQ,OAAO;;;AAGhE,QAAM,KAAK;AACX,SAAO,SAAS;AAChB,SAAO,cAAc,gBAAgB,CAAC,CAAC,UAAU;AACjD,SAAO;;CAGT,MAAM,gBAAgB,OAAgC;EACpD,MAAMC,MAAuB;GAAE,MAAM;GAAa;;AAClD,QAAM,KAAK;AACX,SAAO,SAAS;AAChB,SAAO,cAAc,gBAAgB,CAAC,CAAC,UAAU;AACjD,SAAO;;AAGT,QAAO;EAAE,MAAM;EAAY,QAAQ;EAAc"}
|