@langchain/langgraph 0.0.8 → 0.0.9

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.
@@ -12,6 +12,7 @@ const reserved_js_1 = require("./reserved.cjs");
12
12
  const io_js_1 = require("./io.cjs");
13
13
  const write_js_1 = require("./write.cjs");
14
14
  const constants_js_1 = require("../constants.cjs");
15
+ const async_local_storage_js_1 = require("../setup/async_local_storage.cjs");
15
16
  const DEFAULT_RECURSION_LIMIT = 25;
16
17
  class GraphRecursionError extends Error {
17
18
  constructor(message) {
@@ -95,7 +96,7 @@ class Pregel extends runnables_1.Runnable {
95
96
  return "LangGraph";
96
97
  }
97
98
  constructor(fields) {
98
- super();
99
+ super(fields);
99
100
  // Because Pregel extends `Runnable`.
100
101
  Object.defineProperty(this, "lc_namespace", {
101
102
  enumerable: true,
@@ -157,6 +158,8 @@ class Pregel extends runnables_1.Runnable {
157
158
  writable: true,
158
159
  value: []
159
160
  });
161
+ // Initialize global async local storage instance for tracing
162
+ (0, async_local_storage_js_1.initializeAsyncLocalStorageSingleton)();
160
163
  this.channels = fields.channels ?? this.channels;
161
164
  this.output = fields.output ?? this.output;
162
165
  this.input = fields.input ?? this.input;
@@ -9,6 +9,7 @@ import { ReservedChannelsMap } from "./reserved.js";
9
9
  import { mapInput, mapOutput } from "./io.js";
10
10
  import { ChannelWrite } from "./write.js";
11
11
  import { CONFIG_KEY_READ, CONFIG_KEY_SEND } from "../constants.js";
12
+ import { initializeAsyncLocalStorageSingleton } from "../setup/async_local_storage.js";
12
13
  const DEFAULT_RECURSION_LIMIT = 25;
13
14
  export class GraphRecursionError extends Error {
14
15
  constructor(message) {
@@ -90,7 +91,7 @@ export class Pregel extends Runnable {
90
91
  return "LangGraph";
91
92
  }
92
93
  constructor(fields) {
93
- super();
94
+ super(fields);
94
95
  // Because Pregel extends `Runnable`.
95
96
  Object.defineProperty(this, "lc_namespace", {
96
97
  enumerable: true,
@@ -152,6 +153,8 @@ export class Pregel extends Runnable {
152
153
  writable: true,
153
154
  value: []
154
155
  });
156
+ // Initialize global async local storage instance for tracing
157
+ initializeAsyncLocalStorageSingleton();
155
158
  this.channels = fields.channels ?? this.channels;
156
159
  this.output = fields.output ?? this.output;
157
160
  this.input = fields.input ?? this.input;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initializeAsyncLocalStorageSingleton = void 0;
4
+ const singletons_1 = require("@langchain/core/singletons");
5
+ const async_hooks_1 = require("async_hooks");
6
+ function initializeAsyncLocalStorageSingleton() {
7
+ singletons_1.AsyncLocalStorageProviderSingleton.initializeGlobalInstance(new async_hooks_1.AsyncLocalStorage());
8
+ }
9
+ exports.initializeAsyncLocalStorageSingleton = initializeAsyncLocalStorageSingleton;
@@ -0,0 +1 @@
1
+ export declare function initializeAsyncLocalStorageSingleton(): void;
@@ -0,0 +1,5 @@
1
+ import { AsyncLocalStorageProviderSingleton } from "@langchain/core/singletons";
2
+ import { AsyncLocalStorage } from "async_hooks";
3
+ export function initializeAsyncLocalStorageSingleton() {
4
+ AsyncLocalStorageProviderSingleton.initializeGlobalInstance(new AsyncLocalStorage());
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "LangGraph",
5
5
  "type": "module",
6
6
  "engines": {
@@ -37,7 +37,7 @@
37
37
  "author": "LangChain",
38
38
  "license": "MIT",
39
39
  "dependencies": {
40
- "@langchain/core": "^0.1.27"
40
+ "@langchain/core": "^0.1.33"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@jest/globals": "^29.5.0",