@langchain/langgraph-ui 1.1.1 → 1.1.8
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 +4 -3
- package/CHANGELOG.md +0 -112
- package/dist/api.d.mts +0 -28
- package/dist/api.mjs +0 -66
- package/dist/bundler.d.mts +0 -21
- package/dist/bundler.mjs +0 -86
- package/dist/cli.mjs +0 -13
- package/dist/index.d.mts +0 -1
- package/dist/index.mjs +0 -1
- package/dist/render.template.mts +0 -27
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/langgraph-ui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": "^18.19.0 || >=20.16.0"
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
],
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
|
-
"url": "git@github.com
|
|
18
|
+
"url": "git+ssh://git@github.com/langchain-ai/langgraphjs.git",
|
|
19
|
+
"directory": "libs/langgraph-ui"
|
|
19
20
|
},
|
|
20
21
|
"scripts": {
|
|
21
22
|
"clean": "rm -rf dist/ .turbo/",
|
|
@@ -41,4 +42,4 @@
|
|
|
41
42
|
"typescript": "^4.9.5 || ^5.4.5",
|
|
42
43
|
"vitest": "^3.2.4"
|
|
43
44
|
}
|
|
44
|
-
}
|
|
45
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
# @langchain/langgraph-ui
|
|
2
|
-
|
|
3
|
-
## 1.1.1
|
|
4
|
-
|
|
5
|
-
## 1.1.0
|
|
6
|
-
|
|
7
|
-
## 1.0.4
|
|
8
|
-
|
|
9
|
-
## 1.0.3
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- 6cd8ecb: Remove Zod 3.x dependency constraint to allow Zod 4.x and avoid installing duplicate Zod packages
|
|
14
|
-
|
|
15
|
-
## 1.0.2
|
|
16
|
-
|
|
17
|
-
## 1.0.1
|
|
18
|
-
|
|
19
|
-
## 1.0.0
|
|
20
|
-
|
|
21
|
-
### Major Changes
|
|
22
|
-
|
|
23
|
-
- 1e1ecbb: This release updates the package for compatibility with LangGraph v1.0. See the [v1.0 release notes](https://docs.langchain.com/oss/javascript/releases/langgraph-v1) for details on what's new.
|
|
24
|
-
|
|
25
|
-
## 0.0.71
|
|
26
|
-
|
|
27
|
-
## 0.0.70
|
|
28
|
-
|
|
29
|
-
## 0.0.69
|
|
30
|
-
|
|
31
|
-
## 0.0.68
|
|
32
|
-
|
|
33
|
-
## 0.0.67
|
|
34
|
-
|
|
35
|
-
## 0.0.66
|
|
36
|
-
|
|
37
|
-
## 0.0.65
|
|
38
|
-
|
|
39
|
-
## 0.0.64
|
|
40
|
-
|
|
41
|
-
## 0.0.63
|
|
42
|
-
|
|
43
|
-
## 0.0.62
|
|
44
|
-
|
|
45
|
-
## 0.0.61
|
|
46
|
-
|
|
47
|
-
## 0.0.60
|
|
48
|
-
|
|
49
|
-
## 0.0.59
|
|
50
|
-
|
|
51
|
-
## 0.0.58
|
|
52
|
-
|
|
53
|
-
## 0.0.57
|
|
54
|
-
|
|
55
|
-
## 0.0.56
|
|
56
|
-
|
|
57
|
-
## 0.0.55
|
|
58
|
-
|
|
59
|
-
## 0.0.54
|
|
60
|
-
|
|
61
|
-
## 0.0.53
|
|
62
|
-
|
|
63
|
-
## 0.0.52
|
|
64
|
-
|
|
65
|
-
## 0.0.51
|
|
66
|
-
|
|
67
|
-
## 0.0.50
|
|
68
|
-
|
|
69
|
-
## 0.0.49
|
|
70
|
-
|
|
71
|
-
## 0.0.48
|
|
72
|
-
|
|
73
|
-
### Patch Changes
|
|
74
|
-
|
|
75
|
-
- ac7b067: fix(sdk): use `kind` when checking for Studio user
|
|
76
|
-
|
|
77
|
-
## 0.0.47
|
|
78
|
-
|
|
79
|
-
### Patch Changes
|
|
80
|
-
|
|
81
|
-
- 39cc88f: Fix apply namespace to messages-tuple stream mode
|
|
82
|
-
- c1ddda1: Embed methods for obtaining state should use `getGraph(...)`
|
|
83
|
-
|
|
84
|
-
## 0.0.46
|
|
85
|
-
|
|
86
|
-
### Patch Changes
|
|
87
|
-
|
|
88
|
-
- d172de3: Fix apply namespace to messages-tuple stream mode
|
|
89
|
-
|
|
90
|
-
## 0.0.45
|
|
91
|
-
|
|
92
|
-
### Patch Changes
|
|
93
|
-
|
|
94
|
-
- 603daa6: Embed should properly handle `payload.checkpoint` and `payload.checkpoint_id`
|
|
95
|
-
|
|
96
|
-
## 0.0.44
|
|
97
|
-
|
|
98
|
-
### Patch Changes
|
|
99
|
-
|
|
100
|
-
- 2f26f2f: Expose get/delete thread endpoint to embed server
|
|
101
|
-
|
|
102
|
-
## 0.0.43
|
|
103
|
-
|
|
104
|
-
### Patch Changes
|
|
105
|
-
|
|
106
|
-
- ce0a39a: Fix invalid package.json dependencies
|
|
107
|
-
|
|
108
|
-
## 0.0.42
|
|
109
|
-
|
|
110
|
-
### Patch Changes
|
|
111
|
-
|
|
112
|
-
- 972b66a: Support gen UI components namespaced with a hyphen
|
package/dist/api.d.mts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/v3";
|
|
2
|
-
declare const ConfigSchema: z.ZodObject<{
|
|
3
|
-
shared: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
4
|
-
}, "strip", z.ZodTypeAny, {
|
|
5
|
-
shared?: string[];
|
|
6
|
-
}, {
|
|
7
|
-
shared?: string[];
|
|
8
|
-
}>;
|
|
9
|
-
declare const DefsSchema: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
10
|
-
interface BuildEnvType {
|
|
11
|
-
cwd?: string;
|
|
12
|
-
defs?: z.infer<typeof DefsSchema>;
|
|
13
|
-
config?: z.infer<typeof ConfigSchema>;
|
|
14
|
-
}
|
|
15
|
-
interface BuildOptionsType extends BuildEnvType {
|
|
16
|
-
output: string;
|
|
17
|
-
}
|
|
18
|
-
export declare function build(options: BuildOptionsType): Promise<void>;
|
|
19
|
-
type WatchOptionsType = ({
|
|
20
|
-
output: string;
|
|
21
|
-
} | {
|
|
22
|
-
onOutput: (graphId: string, result: {
|
|
23
|
-
basename: string;
|
|
24
|
-
contents: Uint8Array;
|
|
25
|
-
}[]) => void;
|
|
26
|
-
}) & BuildEnvType;
|
|
27
|
-
export declare function watch(options: WatchOptionsType): Promise<void>;
|
|
28
|
-
export {};
|
package/dist/api.mjs
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/v3";
|
|
2
|
-
import * as fs from "node:fs/promises";
|
|
3
|
-
import * as path from "node:path";
|
|
4
|
-
import * as bundler from "./bundler.mjs";
|
|
5
|
-
const ConfigSchema = z.object({ shared: z.array(z.string()).optional() });
|
|
6
|
-
const DefsSchema = z.record(z.string(), z.string());
|
|
7
|
-
function getBuildEnv(options) {
|
|
8
|
-
const cwd = options?.cwd ?? process.cwd();
|
|
9
|
-
const defs = options?.defs ??
|
|
10
|
-
DefsSchema.parse(JSON.parse(process.env.LANGGRAPH_UI || "{}"));
|
|
11
|
-
const config = options?.config ??
|
|
12
|
-
ConfigSchema.parse(JSON.parse(process.env.LANGGRAPH_UI_CONFIG || "{}"));
|
|
13
|
-
return { cwd, defs, config };
|
|
14
|
-
}
|
|
15
|
-
export async function build(options) {
|
|
16
|
-
const { cwd, defs, config } = getBuildEnv(options);
|
|
17
|
-
const fullPath = path.resolve(cwd, options.output);
|
|
18
|
-
const publicPath = path.resolve(fullPath, "public");
|
|
19
|
-
const schemasPath = path.resolve(fullPath, "schemas.json");
|
|
20
|
-
const schemas = {};
|
|
21
|
-
await Promise.all(Object.entries(defs).map(async ([graphId, userPath]) => {
|
|
22
|
-
const folder = path.resolve(publicPath, graphId);
|
|
23
|
-
await fs.mkdir(folder, { recursive: true });
|
|
24
|
-
const files = await bundler.build(graphId, { userPath, cwd, config });
|
|
25
|
-
await Promise.all(files.map(async (item) => {
|
|
26
|
-
const target = path.resolve(folder, item.basename);
|
|
27
|
-
await fs.writeFile(target, item.contents);
|
|
28
|
-
schemas[graphId] ??= { assets: [], name: graphId };
|
|
29
|
-
schemas[graphId].assets.push(path.relative(folder, target));
|
|
30
|
-
}));
|
|
31
|
-
}));
|
|
32
|
-
await fs.writeFile(schemasPath, JSON.stringify(schemas), {
|
|
33
|
-
encoding: "utf-8",
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
export async function watch(options) {
|
|
37
|
-
const { cwd, config, defs } = getBuildEnv(options);
|
|
38
|
-
if ("onOutput" in options) {
|
|
39
|
-
await Promise.all(Object.entries(defs).map(async ([graphId, userPath]) => {
|
|
40
|
-
await bundler.watch(graphId, { cwd, config, userPath }, (files) => options.onOutput(graphId, files));
|
|
41
|
-
}));
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const fullPath = path.resolve(cwd, options.output);
|
|
45
|
-
const publicPath = path.resolve(fullPath, "public");
|
|
46
|
-
const schemasPath = path.resolve(fullPath, "schemas.json");
|
|
47
|
-
let promiseSeq = Promise.resolve();
|
|
48
|
-
const schemas = {};
|
|
49
|
-
await Promise.all(Object.entries(defs).map(async ([graphId, userPath]) => {
|
|
50
|
-
const folder = path.resolve(publicPath, graphId);
|
|
51
|
-
await fs.mkdir(folder, { recursive: true });
|
|
52
|
-
await bundler.watch(graphId, { cwd, userPath, config }, (files) => {
|
|
53
|
-
promiseSeq = promiseSeq.then(async () => {
|
|
54
|
-
await Promise.all(files.map(async ({ basename, contents }) => {
|
|
55
|
-
const target = path.resolve(folder, basename);
|
|
56
|
-
await fs.writeFile(target, contents);
|
|
57
|
-
schemas[graphId] ??= { assets: [], name: graphId };
|
|
58
|
-
schemas[graphId].assets.push(path.relative(folder, target));
|
|
59
|
-
}));
|
|
60
|
-
await fs.writeFile(schemasPath, JSON.stringify(schemas), {
|
|
61
|
-
encoding: "utf-8",
|
|
62
|
-
});
|
|
63
|
-
}, (e) => console.error(e));
|
|
64
|
-
});
|
|
65
|
-
}));
|
|
66
|
-
}
|
package/dist/bundler.d.mts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type BuildOptions } from "esbuild";
|
|
2
|
-
export declare function build(agentName: string, args: {
|
|
3
|
-
cwd: string;
|
|
4
|
-
userPath: string;
|
|
5
|
-
config?: {
|
|
6
|
-
shared?: string[];
|
|
7
|
-
};
|
|
8
|
-
}): Promise<{
|
|
9
|
-
basename: string;
|
|
10
|
-
contents: Uint8Array;
|
|
11
|
-
}[]>;
|
|
12
|
-
export declare function watch(agentName: string, args: {
|
|
13
|
-
cwd: string;
|
|
14
|
-
userPath: string;
|
|
15
|
-
config?: {
|
|
16
|
-
shared?: string[];
|
|
17
|
-
};
|
|
18
|
-
}, onResult: (result: {
|
|
19
|
-
basename: string;
|
|
20
|
-
contents: Uint8Array;
|
|
21
|
-
}[]) => void): Promise<import("esbuild").BuildContext<BuildOptions>>;
|
package/dist/bundler.mjs
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import * as path from "node:path";
|
|
2
|
-
import * as url from "node:url";
|
|
3
|
-
import * as fs from "node:fs";
|
|
4
|
-
import { build as runBuild, context as runContext, } from "esbuild";
|
|
5
|
-
import tailwind from "esbuild-plugin-tailwindcss";
|
|
6
|
-
const renderTemplate = await fs.promises.readFile(url.fileURLToPath(new URL("./render.template.mts", import.meta.url)), "utf-8");
|
|
7
|
-
function entrypointPlugin(paths) {
|
|
8
|
-
const fullPath = path.resolve(paths.cwd, paths.userPath);
|
|
9
|
-
let relativeUiPath = path
|
|
10
|
-
.relative(paths.cwd, fullPath)
|
|
11
|
-
.replaceAll(path.sep, "/");
|
|
12
|
-
if (relativeUiPath.startsWith("../")) {
|
|
13
|
-
throw new Error(`UI path must be relative to the project root. Received: "${relativeUiPath}"`);
|
|
14
|
-
}
|
|
15
|
-
if (!relativeUiPath.startsWith("./"))
|
|
16
|
-
relativeUiPath = `./${relativeUiPath}`;
|
|
17
|
-
return {
|
|
18
|
-
name: "entrypoint",
|
|
19
|
-
setup(build) {
|
|
20
|
-
build.onResolve({ filter: /^entrypoint$/ }, () => ({
|
|
21
|
-
path: path.resolve(path.dirname(fullPath), "ui.entrypoint.tsx"),
|
|
22
|
-
namespace: "entrypoint-ns",
|
|
23
|
-
}));
|
|
24
|
-
build.onLoad({ filter: /.*/, namespace: "entrypoint-ns" }, () => ({
|
|
25
|
-
resolveDir: paths.cwd,
|
|
26
|
-
contents: [
|
|
27
|
-
`import ui from "${relativeUiPath}"`,
|
|
28
|
-
renderTemplate,
|
|
29
|
-
`export const render = createRenderer(ui)`,
|
|
30
|
-
].join("\n"),
|
|
31
|
-
loader: "tsx",
|
|
32
|
-
}));
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function registerPlugin(onEnd) {
|
|
37
|
-
const textEncoder = new TextEncoder();
|
|
38
|
-
return {
|
|
39
|
-
name: "require-transform",
|
|
40
|
-
setup(build) {
|
|
41
|
-
build.onEnd(async (result) => {
|
|
42
|
-
const newResult = [];
|
|
43
|
-
for (const item of result.outputFiles ?? []) {
|
|
44
|
-
let basename = path.basename(item.path);
|
|
45
|
-
let contents = item.contents;
|
|
46
|
-
if (basename === "entrypoint.js") {
|
|
47
|
-
contents = textEncoder.encode(item.text.replaceAll(`typeof require !== "undefined" ? require`, `typeof globalThis[Symbol.for("LGUI_REQUIRE")] !== "undefined" ? globalThis[Symbol.for("LGUI_REQUIRE")]`));
|
|
48
|
-
}
|
|
49
|
-
newResult.push({ basename, contents });
|
|
50
|
-
}
|
|
51
|
-
if (newResult.length > 0)
|
|
52
|
-
onEnd(newResult);
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
function setup(agentName, args, onResult) {
|
|
58
|
-
return {
|
|
59
|
-
write: false,
|
|
60
|
-
outdir: path.resolve(args.cwd, "dist"),
|
|
61
|
-
entryPoints: ["entrypoint"],
|
|
62
|
-
bundle: true,
|
|
63
|
-
platform: "browser",
|
|
64
|
-
target: "es2020",
|
|
65
|
-
jsx: "automatic",
|
|
66
|
-
external: [
|
|
67
|
-
"react",
|
|
68
|
-
"react-dom",
|
|
69
|
-
"@langchain/langgraph-sdk",
|
|
70
|
-
"@langchain/langgraph-sdk/react-ui",
|
|
71
|
-
...(args.config?.shared ?? []),
|
|
72
|
-
],
|
|
73
|
-
plugins: [tailwind(), entrypointPlugin(args), registerPlugin(onResult)],
|
|
74
|
-
globalName: `__LGUI_${agentName.replace(/[^a-zA-Z0-9]/g, "_")}`,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
export async function build(agentName, args) {
|
|
78
|
-
let results = [];
|
|
79
|
-
await runBuild(setup(agentName, args, (result) => (results = result)));
|
|
80
|
-
return results;
|
|
81
|
-
}
|
|
82
|
-
export async function watch(agentName, args, onResult) {
|
|
83
|
-
const ctx = await runContext(setup(agentName, args, onResult));
|
|
84
|
-
await ctx.watch();
|
|
85
|
-
return ctx;
|
|
86
|
-
}
|
package/dist/cli.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { Command } from "@commander-js/extra-typings";
|
|
3
|
-
import * as api from "./api.mjs";
|
|
4
|
-
const builder = new Command().name("langgraphjs-ui");
|
|
5
|
-
builder
|
|
6
|
-
.command("build")
|
|
7
|
-
.requiredOption("-o, --output <string>", "Output directory")
|
|
8
|
-
.action(api.build);
|
|
9
|
-
builder
|
|
10
|
-
.command("watch")
|
|
11
|
-
.requiredOption("-o, --output <string>", "Output directory")
|
|
12
|
-
.action(api.watch);
|
|
13
|
-
builder.parse();
|
package/dist/index.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { build, watch } from "./api.mjs";
|
package/dist/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { build, watch } from "./api.mjs";
|
package/dist/render.template.mts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { ComponentClass, FunctionComponent } from "react";
|
|
2
|
-
|
|
3
|
-
const STORE_SYMBOL = Symbol.for("LGUI_EXT_STORE");
|
|
4
|
-
|
|
5
|
-
declare global {
|
|
6
|
-
interface Window {
|
|
7
|
-
[STORE_SYMBOL]: {
|
|
8
|
-
respond: (
|
|
9
|
-
shadowRootId: string,
|
|
10
|
-
component: FunctionComponent | ComponentClass,
|
|
11
|
-
renderEl: HTMLElement
|
|
12
|
-
) => void;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
function createRenderer(
|
|
19
|
-
components: Record<string, FunctionComponent | ComponentClass>
|
|
20
|
-
) {
|
|
21
|
-
return (name: string, shadowRootId: string) => {
|
|
22
|
-
const root = document.getElementById(shadowRootId)!.shadowRoot;
|
|
23
|
-
const renderEl = document.createElement("div");
|
|
24
|
-
root!.appendChild(renderEl);
|
|
25
|
-
window[STORE_SYMBOL].respond(shadowRootId, components[name], renderEl);
|
|
26
|
-
};
|
|
27
|
-
}
|