@langchain/langgraph-sdk 0.0.60 → 0.0.61
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/react/stream.cjs +2 -2
- package/dist/react/stream.js +2 -2
- package/dist/react-ui/client.cjs +14 -1
- package/dist/react-ui/client.d.ts +3 -0
- package/dist/react-ui/client.js +12 -0
- package/dist/react-ui/index.cjs +2 -1
- package/dist/react-ui/index.d.ts +1 -1
- package/dist/react-ui/index.js +1 -1
- package/dist/schema.d.ts +4 -4
- package/package.json +1 -1
package/dist/react/stream.cjs
CHANGED
|
@@ -335,7 +335,7 @@ function useStream(options) {
|
|
|
335
335
|
// @ts-expect-error
|
|
336
336
|
if (checkpoint != null)
|
|
337
337
|
delete checkpoint.thread_id;
|
|
338
|
-
const run =
|
|
338
|
+
const run = client.runs.stream(usableThreadId, assistantId, {
|
|
339
339
|
input: values,
|
|
340
340
|
config: submitOptions?.config,
|
|
341
341
|
command: submitOptions?.command,
|
|
@@ -348,7 +348,7 @@ function useStream(options) {
|
|
|
348
348
|
signal: abortRef.current.signal,
|
|
349
349
|
checkpoint,
|
|
350
350
|
streamMode,
|
|
351
|
-
})
|
|
351
|
+
});
|
|
352
352
|
// Unbranch things
|
|
353
353
|
const newPath = submitOptions?.checkpoint?.checkpoint_id
|
|
354
354
|
? branchByCheckpoint[submitOptions?.checkpoint?.checkpoint_id]?.branch
|
package/dist/react/stream.js
CHANGED
|
@@ -332,7 +332,7 @@ export function useStream(options) {
|
|
|
332
332
|
// @ts-expect-error
|
|
333
333
|
if (checkpoint != null)
|
|
334
334
|
delete checkpoint.thread_id;
|
|
335
|
-
const run =
|
|
335
|
+
const run = client.runs.stream(usableThreadId, assistantId, {
|
|
336
336
|
input: values,
|
|
337
337
|
config: submitOptions?.config,
|
|
338
338
|
command: submitOptions?.command,
|
|
@@ -345,7 +345,7 @@ export function useStream(options) {
|
|
|
345
345
|
signal: abortRef.current.signal,
|
|
346
346
|
checkpoint,
|
|
347
347
|
streamMode,
|
|
348
|
-
})
|
|
348
|
+
});
|
|
349
349
|
// Unbranch things
|
|
350
350
|
const newPath = submitOptions?.checkpoint?.checkpoint_id
|
|
351
351
|
? branchByCheckpoint[submitOptions?.checkpoint?.checkpoint_id]?.branch
|
package/dist/react-ui/client.cjs
CHANGED
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
return result;
|
|
25
25
|
};
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.bootstrapUiContext = exports.LoadExternalComponent = exports.useStreamContext = void 0;
|
|
27
|
+
exports.bootstrapUiContext = exports.experimental_loadShare = exports.LoadExternalComponent = exports.useStreamContext = void 0;
|
|
28
28
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
29
29
|
const index_js_1 = require("../react/index.cjs");
|
|
30
30
|
const React = __importStar(require("react"));
|
|
@@ -87,6 +87,7 @@ class ComponentStore {
|
|
|
87
87
|
const COMPONENT_STORE = new ComponentStore();
|
|
88
88
|
const EXT_STORE_SYMBOL = Symbol.for("LGUI_EXT_STORE");
|
|
89
89
|
const REQUIRE_SYMBOL = Symbol.for("LGUI_REQUIRE");
|
|
90
|
+
const REQUIRE_EXTRA_SYMBOL = Symbol.for("LGUI_REQUIRE_EXTRA");
|
|
90
91
|
function LoadExternalComponent({ stream, namespace, message, meta, fallback, components, ...props }) {
|
|
91
92
|
const ref = React.useRef(null);
|
|
92
93
|
const id = React.useId();
|
|
@@ -119,6 +120,13 @@ function LoadExternalComponent({ stream, namespace, message, meta, fallback, com
|
|
|
119
120
|
: fallback })] }));
|
|
120
121
|
}
|
|
121
122
|
exports.LoadExternalComponent = LoadExternalComponent;
|
|
123
|
+
function experimental_loadShare(name, module) {
|
|
124
|
+
if (typeof window === "undefined")
|
|
125
|
+
return;
|
|
126
|
+
window[REQUIRE_EXTRA_SYMBOL] ??= {};
|
|
127
|
+
window[REQUIRE_EXTRA_SYMBOL][name] = module;
|
|
128
|
+
}
|
|
129
|
+
exports.experimental_loadShare = experimental_loadShare;
|
|
122
130
|
function bootstrapUiContext() {
|
|
123
131
|
if (typeof window === "undefined") {
|
|
124
132
|
console.warn("Attempting to bootstrap UI context outside of browser environment. " +
|
|
@@ -143,6 +151,11 @@ function bootstrapUiContext() {
|
|
|
143
151
|
},
|
|
144
152
|
};
|
|
145
153
|
}
|
|
154
|
+
if (window[REQUIRE_EXTRA_SYMBOL] != null &&
|
|
155
|
+
typeof window[REQUIRE_EXTRA_SYMBOL] === "object" &&
|
|
156
|
+
name in window[REQUIRE_EXTRA_SYMBOL]) {
|
|
157
|
+
return window[REQUIRE_EXTRA_SYMBOL][name];
|
|
158
|
+
}
|
|
146
159
|
throw new Error(`Unknown module...: ${name}`);
|
|
147
160
|
};
|
|
148
161
|
}
|
|
@@ -48,6 +48,7 @@ declare class ComponentStore {
|
|
|
48
48
|
}
|
|
49
49
|
declare const EXT_STORE_SYMBOL: unique symbol;
|
|
50
50
|
declare const REQUIRE_SYMBOL: unique symbol;
|
|
51
|
+
declare const REQUIRE_EXTRA_SYMBOL: unique symbol;
|
|
51
52
|
interface LoadExternalComponentProps extends Pick<React.HTMLAttributes<HTMLDivElement>, "style" | "className"> {
|
|
52
53
|
/** Stream of the assistant */
|
|
53
54
|
stream: ReturnType<typeof useStream>;
|
|
@@ -70,7 +71,9 @@ declare global {
|
|
|
70
71
|
interface Window {
|
|
71
72
|
[EXT_STORE_SYMBOL]: ComponentStore;
|
|
72
73
|
[REQUIRE_SYMBOL]: (name: string) => unknown;
|
|
74
|
+
[REQUIRE_EXTRA_SYMBOL]: Record<string, unknown>;
|
|
73
75
|
}
|
|
74
76
|
}
|
|
77
|
+
export declare function experimental_loadShare(name: string, module: unknown): void;
|
|
75
78
|
export declare function bootstrapUiContext(): void;
|
|
76
79
|
export {};
|
package/dist/react-ui/client.js
CHANGED
|
@@ -60,6 +60,7 @@ class ComponentStore {
|
|
|
60
60
|
const COMPONENT_STORE = new ComponentStore();
|
|
61
61
|
const EXT_STORE_SYMBOL = Symbol.for("LGUI_EXT_STORE");
|
|
62
62
|
const REQUIRE_SYMBOL = Symbol.for("LGUI_REQUIRE");
|
|
63
|
+
const REQUIRE_EXTRA_SYMBOL = Symbol.for("LGUI_REQUIRE_EXTRA");
|
|
63
64
|
export function LoadExternalComponent({ stream, namespace, message, meta, fallback, components, ...props }) {
|
|
64
65
|
const ref = React.useRef(null);
|
|
65
66
|
const id = React.useId();
|
|
@@ -91,6 +92,12 @@ export function LoadExternalComponent({ stream, namespace, message, meta, fallba
|
|
|
91
92
|
? ReactDOM.createPortal(React.createElement(state.comp, message.props), state.target)
|
|
92
93
|
: fallback })] }));
|
|
93
94
|
}
|
|
95
|
+
export function experimental_loadShare(name, module) {
|
|
96
|
+
if (typeof window === "undefined")
|
|
97
|
+
return;
|
|
98
|
+
window[REQUIRE_EXTRA_SYMBOL] ??= {};
|
|
99
|
+
window[REQUIRE_EXTRA_SYMBOL][name] = module;
|
|
100
|
+
}
|
|
94
101
|
export function bootstrapUiContext() {
|
|
95
102
|
if (typeof window === "undefined") {
|
|
96
103
|
console.warn("Attempting to bootstrap UI context outside of browser environment. " +
|
|
@@ -115,6 +122,11 @@ export function bootstrapUiContext() {
|
|
|
115
122
|
},
|
|
116
123
|
};
|
|
117
124
|
}
|
|
125
|
+
if (window[REQUIRE_EXTRA_SYMBOL] != null &&
|
|
126
|
+
typeof window[REQUIRE_EXTRA_SYMBOL] === "object" &&
|
|
127
|
+
name in window[REQUIRE_EXTRA_SYMBOL]) {
|
|
128
|
+
return window[REQUIRE_EXTRA_SYMBOL][name];
|
|
129
|
+
}
|
|
118
130
|
throw new Error(`Unknown module...: ${name}`);
|
|
119
131
|
};
|
|
120
132
|
}
|
package/dist/react-ui/index.cjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uiMessageReducer = exports.LoadExternalComponent = exports.useStreamContext = void 0;
|
|
3
|
+
exports.uiMessageReducer = exports.experimental_loadShare = exports.LoadExternalComponent = exports.useStreamContext = void 0;
|
|
4
4
|
const client_js_1 = require("./client.cjs");
|
|
5
5
|
(0, client_js_1.bootstrapUiContext)();
|
|
6
6
|
var client_js_2 = require("./client.cjs");
|
|
7
7
|
Object.defineProperty(exports, "useStreamContext", { enumerable: true, get: function () { return client_js_2.useStreamContext; } });
|
|
8
8
|
Object.defineProperty(exports, "LoadExternalComponent", { enumerable: true, get: function () { return client_js_2.LoadExternalComponent; } });
|
|
9
|
+
Object.defineProperty(exports, "experimental_loadShare", { enumerable: true, get: function () { return client_js_2.experimental_loadShare; } });
|
|
9
10
|
var types_js_1 = require("./types.cjs");
|
|
10
11
|
Object.defineProperty(exports, "uiMessageReducer", { enumerable: true, get: function () { return types_js_1.uiMessageReducer; } });
|
package/dist/react-ui/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { useStreamContext, LoadExternalComponent } from "./client.js";
|
|
1
|
+
export { useStreamContext, LoadExternalComponent, experimental_loadShare, } from "./client.js";
|
|
2
2
|
export { uiMessageReducer, type UIMessage, type RemoveUIMessage, } from "./types.js";
|
package/dist/react-ui/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { bootstrapUiContext } from "./client.js";
|
|
2
2
|
bootstrapUiContext();
|
|
3
|
-
export { useStreamContext, LoadExternalComponent } from "./client.js";
|
|
3
|
+
export { useStreamContext, LoadExternalComponent, experimental_loadShare, } from "./client.js";
|
|
4
4
|
export { uiMessageReducer, } from "./types.js";
|
package/dist/schema.d.ts
CHANGED
|
@@ -39,22 +39,22 @@ export interface GraphSchema {
|
|
|
39
39
|
* The schema for the input state.
|
|
40
40
|
* Missing if unable to generate JSON schema from graph.
|
|
41
41
|
*/
|
|
42
|
-
input_schema?: JSONSchema7;
|
|
42
|
+
input_schema?: JSONSchema7 | null | undefined;
|
|
43
43
|
/**
|
|
44
44
|
* The schema for the output state.
|
|
45
45
|
* Missing if unable to generate JSON schema from graph.
|
|
46
46
|
*/
|
|
47
|
-
output_schema?: JSONSchema7;
|
|
47
|
+
output_schema?: JSONSchema7 | null | undefined;
|
|
48
48
|
/**
|
|
49
49
|
* The schema for the graph state.
|
|
50
50
|
* Missing if unable to generate JSON schema from graph.
|
|
51
51
|
*/
|
|
52
|
-
state_schema?: JSONSchema7;
|
|
52
|
+
state_schema?: JSONSchema7 | null | undefined;
|
|
53
53
|
/**
|
|
54
54
|
* The schema for the graph config.
|
|
55
55
|
* Missing if unable to generate JSON schema from graph.
|
|
56
56
|
*/
|
|
57
|
-
config_schema?: JSONSchema7;
|
|
57
|
+
config_schema?: JSONSchema7 | null | undefined;
|
|
58
58
|
}
|
|
59
59
|
export type Subgraphs = Record<string, GraphSchema>;
|
|
60
60
|
export type Metadata = Optional<{
|