@langchain/langgraph-sdk 0.0.101 → 0.0.102
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 +6 -0
- package/dist/logging/index.cjs +36 -0
- package/dist/logging/index.d.ts +43 -0
- package/dist/logging/index.js +32 -0
- package/logging.cjs +1 -0
- package/logging.d.cts +1 -0
- package/logging.d.ts +1 -0
- package/logging.js +1 -0
- package/package.json +14 -1
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLogger = void 0;
|
|
4
|
+
const GLOBAL_LOGGER = Symbol.for("langgraph.api.sdk-logger");
|
|
5
|
+
/**
|
|
6
|
+
* Retrieves the global logger instance for LangGraph Platform.
|
|
7
|
+
*
|
|
8
|
+
* The logger provides structured logging capabilities with
|
|
9
|
+
* various log levels (error, warn, info, debug, etc.) and extra metadata such as node name etc.
|
|
10
|
+
*
|
|
11
|
+
* @returns {Logger} The global logger instance with leveled logging methods
|
|
12
|
+
*
|
|
13
|
+
* @throws {Error} When the logger is not available in the current environment
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // Safe usage with fallback
|
|
18
|
+
* const logger = getLogger();
|
|
19
|
+
* logger.info("This will only work in LangGraph Platform environment");
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* This method is designed to work specifically within the LangGraph Platform
|
|
24
|
+
* environment where a global logger is automatically registered. If you're
|
|
25
|
+
* developing locally or in an environment where LangGraph Platform is not
|
|
26
|
+
* available, this function will throw an error.
|
|
27
|
+
*/
|
|
28
|
+
const getLogger = () => {
|
|
29
|
+
const maybeGlobal = globalThis;
|
|
30
|
+
if (GLOBAL_LOGGER in maybeGlobal)
|
|
31
|
+
return maybeGlobal[GLOBAL_LOGGER];
|
|
32
|
+
throw new Error("Logger not available in current environment. " +
|
|
33
|
+
"This method requires LangGraph Platform environment where a global logger is automatically registered. " +
|
|
34
|
+
"If you're developing locally, consider using `console.log` or a local logging library instead.");
|
|
35
|
+
};
|
|
36
|
+
exports.getLogger = getLogger;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
interface LeveledLogMethod {
|
|
2
|
+
(message: string, ...meta: any[]): Logger;
|
|
3
|
+
(message: any): Logger;
|
|
4
|
+
(infoObject: object): Logger;
|
|
5
|
+
}
|
|
6
|
+
interface Logger {
|
|
7
|
+
error: LeveledLogMethod;
|
|
8
|
+
warn: LeveledLogMethod;
|
|
9
|
+
help: LeveledLogMethod;
|
|
10
|
+
data: LeveledLogMethod;
|
|
11
|
+
info: LeveledLogMethod;
|
|
12
|
+
debug: LeveledLogMethod;
|
|
13
|
+
prompt: LeveledLogMethod;
|
|
14
|
+
http: LeveledLogMethod;
|
|
15
|
+
verbose: LeveledLogMethod;
|
|
16
|
+
input: LeveledLogMethod;
|
|
17
|
+
silly: LeveledLogMethod;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves the global logger instance for LangGraph Platform.
|
|
21
|
+
*
|
|
22
|
+
* The logger provides structured logging capabilities with
|
|
23
|
+
* various log levels (error, warn, info, debug, etc.) and extra metadata such as node name etc.
|
|
24
|
+
*
|
|
25
|
+
* @returns {Logger} The global logger instance with leveled logging methods
|
|
26
|
+
*
|
|
27
|
+
* @throws {Error} When the logger is not available in the current environment
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* // Safe usage with fallback
|
|
32
|
+
* const logger = getLogger();
|
|
33
|
+
* logger.info("This will only work in LangGraph Platform environment");
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* This method is designed to work specifically within the LangGraph Platform
|
|
38
|
+
* environment where a global logger is automatically registered. If you're
|
|
39
|
+
* developing locally or in an environment where LangGraph Platform is not
|
|
40
|
+
* available, this function will throw an error.
|
|
41
|
+
*/
|
|
42
|
+
export declare const getLogger: () => Logger;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const GLOBAL_LOGGER = Symbol.for("langgraph.api.sdk-logger");
|
|
2
|
+
/**
|
|
3
|
+
* Retrieves the global logger instance for LangGraph Platform.
|
|
4
|
+
*
|
|
5
|
+
* The logger provides structured logging capabilities with
|
|
6
|
+
* various log levels (error, warn, info, debug, etc.) and extra metadata such as node name etc.
|
|
7
|
+
*
|
|
8
|
+
* @returns {Logger} The global logger instance with leveled logging methods
|
|
9
|
+
*
|
|
10
|
+
* @throws {Error} When the logger is not available in the current environment
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* // Safe usage with fallback
|
|
15
|
+
* const logger = getLogger();
|
|
16
|
+
* logger.info("This will only work in LangGraph Platform environment");
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* This method is designed to work specifically within the LangGraph Platform
|
|
21
|
+
* environment where a global logger is automatically registered. If you're
|
|
22
|
+
* developing locally or in an environment where LangGraph Platform is not
|
|
23
|
+
* available, this function will throw an error.
|
|
24
|
+
*/
|
|
25
|
+
export const getLogger = () => {
|
|
26
|
+
const maybeGlobal = globalThis;
|
|
27
|
+
if (GLOBAL_LOGGER in maybeGlobal)
|
|
28
|
+
return maybeGlobal[GLOBAL_LOGGER];
|
|
29
|
+
throw new Error("Logger not available in current environment. " +
|
|
30
|
+
"This method requires LangGraph Platform environment where a global logger is automatically registered. " +
|
|
31
|
+
"If you're developing locally, consider using `console.log` or a local logging library instead.");
|
|
32
|
+
};
|
package/logging.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/logging/index.cjs');
|
package/logging.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/logging/index.js'
|
package/logging.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/logging/index.js'
|
package/logging.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/logging/index.js'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/langgraph-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.102",
|
|
4
4
|
"description": "Client library for interacting with the LangGraph API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -100,6 +100,15 @@
|
|
|
100
100
|
"import": "./react.js",
|
|
101
101
|
"require": "./react.cjs"
|
|
102
102
|
},
|
|
103
|
+
"./logging": {
|
|
104
|
+
"types": {
|
|
105
|
+
"import": "./logging.d.ts",
|
|
106
|
+
"require": "./logging.d.cts",
|
|
107
|
+
"default": "./logging.d.ts"
|
|
108
|
+
},
|
|
109
|
+
"import": "./logging.js",
|
|
110
|
+
"require": "./logging.cjs"
|
|
111
|
+
},
|
|
103
112
|
"./react-ui": {
|
|
104
113
|
"types": {
|
|
105
114
|
"import": "./react-ui.d.ts",
|
|
@@ -138,6 +147,10 @@
|
|
|
138
147
|
"react.js",
|
|
139
148
|
"react.d.ts",
|
|
140
149
|
"react.d.cts",
|
|
150
|
+
"logging.cjs",
|
|
151
|
+
"logging.js",
|
|
152
|
+
"logging.d.ts",
|
|
153
|
+
"logging.d.cts",
|
|
141
154
|
"react-ui.cjs",
|
|
142
155
|
"react-ui.js",
|
|
143
156
|
"react-ui.d.ts",
|