@langchain/langgraph-cli 0.0.56 → 0.0.57

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @langchain/langgraph-cli
2
2
 
3
+ ## 0.0.57
4
+
5
+ ### Patch Changes
6
+
7
+ - 31cc9f7: support description property for `langgraph.json`
8
+ - 679a1be: Fix sysinfo command for PNPM
9
+ - 2f179e5: feat(cli): accept BROWSER=none to prevent spawning a browser
10
+ - Updated dependencies [31cc9f7]
11
+ - @langchain/langgraph-api@0.0.57
12
+
3
13
  ## 0.0.56
4
14
 
5
15
  ### Patch Changes
package/dist/cli/dev.mjs CHANGED
@@ -44,9 +44,10 @@ builder
44
44
  let child = undefined;
45
45
  let tunnel = undefined;
46
46
  let hostUrl = "https://smith.langchain.com";
47
+ let envNoBrowser = process.env.BROWSER === "none";
47
48
  server.on("data", async (data) => {
48
49
  const response = z.object({ queryParams: z.string() }).parse(data);
49
- if (options.browser && !hasOpenedFlag) {
50
+ if (options.browser && !envNoBrowser && !hasOpenedFlag) {
50
51
  hasOpenedFlag = true;
51
52
  const queryParams = new URLSearchParams(response.queryParams);
52
53
  const tunnelUrl = await tunnel?.tunnelUrl;
@@ -112,6 +113,7 @@ builder
112
113
  tunnel.child.kill();
113
114
  if (options.tunnel)
114
115
  tunnel = await startCloudflareTunnel(options.port);
116
+ envNoBrowser = process.env.BROWSER === "none" || env.BROWSER === "none";
115
117
  if ("python_version" in config) {
116
118
  logger.warn("Launching Python server from @langchain/langgraph-cli is experimental. Please use the `langgraph-cli` package from PyPi instead.");
117
119
  const { spawnPythonServer } = await import("./dev.python.mjs");
@@ -33,7 +33,7 @@ builder
33
33
  const gatherMatch = (str, regex) => {
34
34
  return [...new Set(str.matchAll(regex).map((match) => match[0]))];
35
35
  };
36
- const packages = gatherMatch(output.stdout, /(@langchain\/[^\s@]+|langsmith|langchain)/g);
36
+ const packages = gatherMatch(output.stdout, /(@langchain\/[^\s@]+|langsmith|langchain|zod|zod-to-json-schema)/g);
37
37
  async function getPackageInfo(packageName) {
38
38
  switch (manager?.name) {
39
39
  case "npm":
@@ -55,9 +55,9 @@ builder
55
55
  const info = await getPackageInfo(pkg);
56
56
  if (!info)
57
57
  continue;
58
- const targetRegex = new RegExp(escapeRegExp(pkg) + "@[^\\s]*", "g");
58
+ const targetRegex = new RegExp(escapeRegExp(pkg) + "[@\\s][^\\s]*", "g");
59
59
  console.log(pkg, "->", gatherMatch(info, targetRegex)
60
- .map((i) => i.slice(pkg.length))
60
+ .map((i) => i.slice(pkg.length).trim())
61
61
  .join(", "));
62
62
  }
63
63
  });
@@ -138,7 +138,9 @@ export async function assembleLocalDeps(configPath, config) {
138
138
  return { pipReqs, realPkgs, fauxPkgs, workingDir, reloadDir, rebuildFiles };
139
139
  }
140
140
  async function updateGraphPaths(configPath, config, localDeps) {
141
- for (const [graphId, importStr] of Object.entries(config.graphs)) {
141
+ for (const [graphId, graphDef] of Object.entries(config.graphs)) {
142
+ const importStr = typeof graphDef === "string" ? graphDef : graphDef.path;
143
+ const description = typeof graphDef === "string" ? undefined : graphDef.description;
142
144
  let [moduleStr, attrStr] = importStr.split(":", 2);
143
145
  if (!moduleStr || !attrStr) {
144
146
  throw new Error(`Import string "${importStr}" must be in format "<module>:<attribute>".`);
@@ -173,7 +175,13 @@ async function updateGraphPaths(configPath, config, localDeps) {
173
175
  throw new Error(`Module '${importStr}' not found in 'dependencies' list. Add its containing package to 'dependencies' list.`);
174
176
  }
175
177
  }
176
- config["graphs"][graphId] = `${moduleStr}:${attrStr}`;
178
+ const resolvedPath = `${moduleStr}:${attrStr}`;
179
+ config["graphs"][graphId] = description
180
+ ? {
181
+ path: resolvedPath,
182
+ description,
183
+ }
184
+ : resolvedPath;
177
185
  }
178
186
  }
179
187
  }
@@ -1,11 +1,18 @@
1
1
  import { z } from "zod";
2
2
  import { extname } from "node:path";
3
+ const GraphPathSchema = z.string().refine((i) => i.includes(":"), {
4
+ message: "Import string must be in format '<file>:<export>'",
5
+ });
3
6
  const BaseConfigSchema = z.object({
4
7
  docker_compose_file: z.string().optional(),
5
8
  dockerfile_lines: z.array(z.string()).default([]),
6
- graphs: z.record(z.string().refine((i) => i.includes(":"), {
7
- message: "Import string must be in format '<file>:<export>'",
8
- })),
9
+ graphs: z.record(z.union([
10
+ GraphPathSchema,
11
+ z.object({
12
+ path: GraphPathSchema,
13
+ description: z.string().optional(),
14
+ }),
15
+ ])),
9
16
  ui: z.record(z.string()).optional(),
10
17
  ui_config: z.object({ shared: z.array(z.string()).optional() }).optional(),
11
18
  _INTERNAL_docker_tag: z.string().optional(),
@@ -71,7 +78,10 @@ const ConfigSchema = z.union([NodeConfigSchema, PythonConfigSchema]);
71
78
  export const getConfig = (config) => {
72
79
  let input = typeof config === "string" ? JSON.parse(config) : config;
73
80
  const { graphs } = BaseConfigSchema.parse(input);
74
- const isPython = Object.values(graphs).map((i) => PYTHON_EXTENSIONS.includes(extname(i.split(":")[0])));
81
+ const isPython = Object.values(graphs).map((graphDef) => {
82
+ const importStr = typeof graphDef === "string" ? graphDef : graphDef.path;
83
+ return PYTHON_EXTENSIONS.includes(extname(importStr.split(":")[0]));
84
+ });
75
85
  const somePython = isPython.some((i) => i);
76
86
  const someNode = !isPython.every((i) => i);
77
87
  const node_version = someNode
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph-cli",
3
- "version": "0.0.56",
3
+ "version": "0.0.57",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": "^18.19.0 || >=20.16.0"
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "@babel/code-frame": "^7.26.2",
35
35
  "@commander-js/extra-typings": "^13.0.0",
36
- "@langchain/langgraph-api": "0.0.56",
36
+ "@langchain/langgraph-api": "0.0.57",
37
37
  "chokidar": "^4.0.3",
38
38
  "commander": "^13.0.0",
39
39
  "dedent": "^1.5.3",