@langchain/langgraph-api 1.1.2 → 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 +9 -8
- package/CHANGELOG.md +0 -297
- package/dist/api/assistants.d.mts +0 -3
- package/dist/api/assistants.mjs +0 -193
- package/dist/api/meta.d.mts +0 -3
- package/dist/api/meta.mjs +0 -65
- package/dist/api/runs.d.mts +0 -3
- package/dist/api/runs.mjs +0 -324
- package/dist/api/store.d.mts +0 -3
- package/dist/api/store.mjs +0 -111
- package/dist/api/threads.d.mts +0 -3
- package/dist/api/threads.mjs +0 -143
- package/dist/auth/custom.d.mts +0 -9
- package/dist/auth/custom.mjs +0 -32
- package/dist/auth/index.d.mts +0 -43
- package/dist/auth/index.mjs +0 -163
- package/dist/cli/entrypoint.d.mts +0 -1
- package/dist/cli/entrypoint.mjs +0 -41
- package/dist/cli/spawn.d.mts +0 -42
- package/dist/cli/spawn.mjs +0 -47
- package/dist/cli/utils/ipc/client.d.mts +0 -5
- package/dist/cli/utils/ipc/client.mjs +0 -47
- package/dist/cli/utils/ipc/utils/get-pipe-path.d.mts +0 -1
- package/dist/cli/utils/ipc/utils/get-pipe-path.mjs +0 -29
- package/dist/cli/utils/ipc/utils/temporary-directory.d.mts +0 -5
- package/dist/cli/utils/ipc/utils/temporary-directory.mjs +0 -40
- package/dist/command.d.mts +0 -11
- package/dist/command.mjs +0 -15
- package/dist/experimental/embed.d.mts +0 -42
- package/dist/experimental/embed.mjs +0 -299
- package/dist/graph/api.d.mts +0 -1
- package/dist/graph/api.mjs +0 -2
- package/dist/graph/load.d.mts +0 -19
- package/dist/graph/load.hooks.d.mts +0 -2
- package/dist/graph/load.hooks.mjs +0 -52
- package/dist/graph/load.mjs +0 -96
- package/dist/graph/load.utils.d.mts +0 -22
- package/dist/graph/load.utils.mjs +0 -49
- package/dist/graph/parser/index.d.mts +0 -23
- package/dist/graph/parser/index.mjs +0 -58
- package/dist/graph/parser/parser.d.mts +0 -77
- package/dist/graph/parser/parser.mjs +0 -429
- package/dist/graph/parser/parser.worker.d.mts +0 -1
- package/dist/graph/parser/parser.worker.mjs +0 -7
- package/dist/graph/parser/schema/types.d.mts +0 -154
- package/dist/graph/parser/schema/types.mjs +0 -1496
- package/dist/graph/parser/schema/types.template.d.mts +0 -1
- package/dist/graph/parser/schema/types.template.mts +0 -92
- package/dist/http/custom.d.mts +0 -6
- package/dist/http/custom.mjs +0 -10
- package/dist/http/middleware.d.mts +0 -11
- package/dist/http/middleware.mjs +0 -57
- package/dist/logging.d.mts +0 -10
- package/dist/logging.mjs +0 -115
- package/dist/loopback.d.mts +0 -4
- package/dist/loopback.mjs +0 -10
- package/dist/preload.d.mts +0 -1
- package/dist/preload.mjs +0 -29
- package/dist/queue.d.mts +0 -2
- package/dist/queue.mjs +0 -119
- package/dist/schemas.d.mts +0 -1552
- package/dist/schemas.mjs +0 -492
- package/dist/semver/index.d.mts +0 -15
- package/dist/semver/index.mjs +0 -46
- package/dist/server.d.mts +0 -175
- package/dist/server.mjs +0 -181
- package/dist/state.d.mts +0 -3
- package/dist/state.mjs +0 -30
- package/dist/storage/checkpoint.d.mts +0 -19
- package/dist/storage/checkpoint.mjs +0 -127
- package/dist/storage/context.d.mts +0 -3
- package/dist/storage/context.mjs +0 -11
- package/dist/storage/importMap.d.mts +0 -55
- package/dist/storage/importMap.mjs +0 -55
- package/dist/storage/ops.d.mts +0 -169
- package/dist/storage/ops.mjs +0 -1262
- package/dist/storage/persist.d.mts +0 -18
- package/dist/storage/persist.mjs +0 -81
- package/dist/storage/store.d.mts +0 -17
- package/dist/storage/store.mjs +0 -41
- package/dist/storage/types.d.mts +0 -301
- package/dist/storage/types.mjs +0 -1
- package/dist/stream.d.mts +0 -43
- package/dist/stream.mjs +0 -235
- package/dist/ui/load.d.mts +0 -8
- package/dist/ui/load.mjs +0 -53
- package/dist/utils/abort.d.mts +0 -1
- package/dist/utils/abort.mjs +0 -8
- package/dist/utils/hono.d.mts +0 -5
- package/dist/utils/hono.mjs +0 -24
- package/dist/utils/importMap.d.mts +0 -55
- package/dist/utils/importMap.mjs +0 -55
- package/dist/utils/runnableConfig.d.mts +0 -3
- package/dist/utils/runnableConfig.mjs +0 -45
- package/dist/utils/serde.d.mts +0 -5
- package/dist/utils/serde.mjs +0 -20
- package/dist/vitest.config.d.ts +0 -2
- package/dist/vitest.config.js +0 -12
- package/dist/webhook.d.mts +0 -11
- package/dist/webhook.mjs +0 -30
package/dist/auth/index.mjs
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { HTTPException } from "hono/http-exception";
|
|
2
|
-
import * as url from "node:url";
|
|
3
|
-
import * as path from "node:path";
|
|
4
|
-
let CUSTOM_AUTH;
|
|
5
|
-
let DISABLE_STUDIO_AUTH = false;
|
|
6
|
-
export const isAuthRegistered = () => CUSTOM_AUTH != null;
|
|
7
|
-
export const isStudioAuthDisabled = () => DISABLE_STUDIO_AUTH;
|
|
8
|
-
function convertError(error) {
|
|
9
|
-
const isHTTPAuthException = (error) => {
|
|
10
|
-
return (typeof error === "object" &&
|
|
11
|
-
error != null &&
|
|
12
|
-
"status" in error &&
|
|
13
|
-
"headers" in error);
|
|
14
|
-
};
|
|
15
|
-
if (isHTTPAuthException(error)) {
|
|
16
|
-
throw new HTTPException(error.status, {
|
|
17
|
-
message: error.message,
|
|
18
|
-
res: new Response(error.message || "Unauthorized", {
|
|
19
|
-
status: error.status,
|
|
20
|
-
headers: error.headers,
|
|
21
|
-
}),
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
throw error;
|
|
25
|
-
}
|
|
26
|
-
export async function authorize(payload) {
|
|
27
|
-
// find filters and execute them
|
|
28
|
-
const handlers = CUSTOM_AUTH?.["~handlerCache"];
|
|
29
|
-
if (!handlers)
|
|
30
|
-
return { filters: undefined, value: payload.value };
|
|
31
|
-
const cbKey = [
|
|
32
|
-
`${payload.resource}:${payload.action}`,
|
|
33
|
-
`${payload.resource}`,
|
|
34
|
-
`*:${payload.action}`,
|
|
35
|
-
`*`,
|
|
36
|
-
].find((priority) => handlers.callbacks?.[priority]);
|
|
37
|
-
const handler = cbKey ? handlers.callbacks?.[cbKey] : undefined;
|
|
38
|
-
if (!handler || !payload.context) {
|
|
39
|
-
return { filters: undefined, value: payload.value };
|
|
40
|
-
}
|
|
41
|
-
try {
|
|
42
|
-
const result = await handler({
|
|
43
|
-
event: `${payload.resource}:${payload.action}`,
|
|
44
|
-
resource: payload.resource,
|
|
45
|
-
action: payload.action,
|
|
46
|
-
value: payload.value,
|
|
47
|
-
permissions: payload.context?.scopes,
|
|
48
|
-
user: payload.context?.user,
|
|
49
|
-
});
|
|
50
|
-
if (result == null || result == true) {
|
|
51
|
-
return { filters: undefined, value: payload.value };
|
|
52
|
-
}
|
|
53
|
-
if (result === false)
|
|
54
|
-
throw new HTTPException(403);
|
|
55
|
-
if (typeof result !== "object") {
|
|
56
|
-
throw new HTTPException(500, {
|
|
57
|
-
message: `Auth handler returned invalid result. Expected filter object, null, undefined or boolean. Got "${typeof result}" instead.`,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
return { filters: result, value: payload.value };
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
throw convertError(error);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
export async function authenticate(request) {
|
|
67
|
-
const handlers = CUSTOM_AUTH?.["~handlerCache"];
|
|
68
|
-
if (!handlers?.authenticate)
|
|
69
|
-
return undefined;
|
|
70
|
-
try {
|
|
71
|
-
const response = await handlers.authenticate(request);
|
|
72
|
-
// normalize auth response
|
|
73
|
-
const { scopes, user } = (() => {
|
|
74
|
-
if (typeof response === "string") {
|
|
75
|
-
return {
|
|
76
|
-
scopes: [],
|
|
77
|
-
user: {
|
|
78
|
-
permissions: [],
|
|
79
|
-
identity: response,
|
|
80
|
-
display_name: response,
|
|
81
|
-
is_authenticated: true,
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
if ("identity" in response && typeof response.identity === "string") {
|
|
86
|
-
const scopes = "permissions" in response && Array.isArray(response.permissions)
|
|
87
|
-
? response.permissions
|
|
88
|
-
: [];
|
|
89
|
-
return {
|
|
90
|
-
scopes,
|
|
91
|
-
user: {
|
|
92
|
-
...response,
|
|
93
|
-
permissions: scopes,
|
|
94
|
-
is_authenticated: response.is_authenticated ?? true,
|
|
95
|
-
display_name: response.display_name ?? response.identity,
|
|
96
|
-
},
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
throw new Error("Invalid auth response received. Make sure to either return a `string` or an object with `identity` property.");
|
|
100
|
-
})();
|
|
101
|
-
return { scopes, user };
|
|
102
|
-
}
|
|
103
|
-
catch (error) {
|
|
104
|
-
throw convertError(error);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
export async function registerAuth(auth, options) {
|
|
108
|
-
if (!auth.path)
|
|
109
|
-
return;
|
|
110
|
-
// TODO: handle options.auth.disable_studio_auth
|
|
111
|
-
const [userFile, exportSymbol] = auth.path.split(":", 2);
|
|
112
|
-
const sourceFile = path.resolve(options.cwd, userFile);
|
|
113
|
-
const module = (await import(url.pathToFileURL(sourceFile).toString()).then((module) => module[exportSymbol || "default"]));
|
|
114
|
-
if (!module)
|
|
115
|
-
throw new Error(`Failed to load auth: ${auth.path}`);
|
|
116
|
-
if (!("~handlerCache" in module))
|
|
117
|
-
throw new Error(`Auth must be an instance of Auth: ${auth.path}`);
|
|
118
|
-
CUSTOM_AUTH = module;
|
|
119
|
-
DISABLE_STUDIO_AUTH = auth.disable_studio_auth ?? false;
|
|
120
|
-
}
|
|
121
|
-
export const handleAuthEvent = async (context, event, value) => {
|
|
122
|
-
const [resource, action] = event.split(":");
|
|
123
|
-
const result = await authorize({
|
|
124
|
-
resource,
|
|
125
|
-
action,
|
|
126
|
-
context,
|
|
127
|
-
value,
|
|
128
|
-
});
|
|
129
|
-
return [result.filters, result.value];
|
|
130
|
-
};
|
|
131
|
-
export function isAuthMatching(metadata, filters) {
|
|
132
|
-
if (filters == null)
|
|
133
|
-
return true;
|
|
134
|
-
for (const [key, value] of Object.entries(filters)) {
|
|
135
|
-
if (typeof value === "object" && value != null) {
|
|
136
|
-
if (value.$eq) {
|
|
137
|
-
if (metadata?.[key] !== value.$eq)
|
|
138
|
-
return false;
|
|
139
|
-
}
|
|
140
|
-
else if (value.$contains) {
|
|
141
|
-
if (!Array.isArray(metadata?.[key])) {
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
if (Array.isArray(value.$contains)) {
|
|
145
|
-
// Match Postgres list containment semantics (at the top level).
|
|
146
|
-
if (!value.$contains.every((v) => (metadata?.[key]).includes(v))) {
|
|
147
|
-
return false;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
if (!metadata?.[key].includes(value.$contains)) {
|
|
152
|
-
return false;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
if (metadata?.[key] !== value)
|
|
159
|
-
return false;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
return true;
|
|
163
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/cli/entrypoint.mjs
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { asyncExitHook } from "exit-hook";
|
|
2
|
-
import * as process from "node:process";
|
|
3
|
-
import { startServer, StartServerSchema } from "../server.mjs";
|
|
4
|
-
import { connectToServer } from "./utils/ipc/client.mjs";
|
|
5
|
-
import { Client as LangSmithClient } from "langsmith";
|
|
6
|
-
import { logger } from "../logging.mjs";
|
|
7
|
-
logger.info(`Starting server...`);
|
|
8
|
-
const [ppid, payload] = process.argv.slice(-2);
|
|
9
|
-
const sendToParent = await connectToServer(+ppid);
|
|
10
|
-
// TODO: re-export langsmith/isTracingEnabled
|
|
11
|
-
const isTracingEnabled = () => {
|
|
12
|
-
const value = process.env?.LANGSMITH_TRACING_V2 ||
|
|
13
|
-
process.env?.LANGCHAIN_TRACING_V2 ||
|
|
14
|
-
process.env?.LANGSMITH_TRACING ||
|
|
15
|
-
process.env?.LANGCHAIN_TRACING;
|
|
16
|
-
return value === "true";
|
|
17
|
-
};
|
|
18
|
-
const options = StartServerSchema.parse(JSON.parse(payload));
|
|
19
|
-
// Export PORT to the environment
|
|
20
|
-
process.env.PORT = options.port.toString();
|
|
21
|
-
const [{ host, cleanup }, organizationId] = await Promise.all([
|
|
22
|
-
startServer(options),
|
|
23
|
-
(async () => {
|
|
24
|
-
if (isTracingEnabled()) {
|
|
25
|
-
try {
|
|
26
|
-
// @ts-expect-error Private method
|
|
27
|
-
return await new LangSmithClient()._getTenantId();
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
logger.warn("Failed to get organization ID. Tracing to LangSmith will not work.", { error });
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return null;
|
|
34
|
-
})(),
|
|
35
|
-
]);
|
|
36
|
-
logger.info(`Server running at ${host}`);
|
|
37
|
-
let queryParams = `?baseUrl=http://${options.host}:${options.port}`;
|
|
38
|
-
if (organizationId)
|
|
39
|
-
queryParams += `&organizationId=${organizationId}`;
|
|
40
|
-
asyncExitHook(cleanup, { wait: 3_000 });
|
|
41
|
-
sendToParent?.({ queryParams });
|
package/dist/cli/spawn.d.mts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export declare function spawnServer(args: {
|
|
2
|
-
host: string;
|
|
3
|
-
port: string;
|
|
4
|
-
nJobsPerWorker: string;
|
|
5
|
-
}, context: {
|
|
6
|
-
config: {
|
|
7
|
-
graphs: Record<string, string | {
|
|
8
|
-
path: string;
|
|
9
|
-
description?: string;
|
|
10
|
-
}>;
|
|
11
|
-
ui?: Record<string, string>;
|
|
12
|
-
ui_config?: {
|
|
13
|
-
shared?: string[];
|
|
14
|
-
};
|
|
15
|
-
auth?: {
|
|
16
|
-
path?: string;
|
|
17
|
-
disable_studio_auth?: boolean;
|
|
18
|
-
};
|
|
19
|
-
http?: {
|
|
20
|
-
app?: string;
|
|
21
|
-
disable_assistants?: boolean;
|
|
22
|
-
disable_threads?: boolean;
|
|
23
|
-
disable_runs?: boolean;
|
|
24
|
-
disable_store?: boolean;
|
|
25
|
-
disable_meta?: boolean;
|
|
26
|
-
cors?: {
|
|
27
|
-
allow_origins?: string[];
|
|
28
|
-
allow_methods?: string[];
|
|
29
|
-
allow_headers?: string[];
|
|
30
|
-
allow_credentials?: boolean;
|
|
31
|
-
allow_origin_regex?: string;
|
|
32
|
-
expose_headers?: string[];
|
|
33
|
-
max_age?: number;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
env: NodeJS.ProcessEnv;
|
|
38
|
-
hostUrl: string;
|
|
39
|
-
}, options: {
|
|
40
|
-
pid: number;
|
|
41
|
-
projectCwd: string;
|
|
42
|
-
}): Promise<import("child_process").ChildProcess>;
|
package/dist/cli/spawn.mjs
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { fileURLToPath } from "node:url";
|
|
2
|
-
import { spawn } from "node:child_process";
|
|
3
|
-
export async function spawnServer(args, context, options) {
|
|
4
|
-
const localUrl = `http://${args.host}:${args.port}`;
|
|
5
|
-
const studioUrl = `${context.hostUrl}/studio?baseUrl=${localUrl}`;
|
|
6
|
-
console.log(`
|
|
7
|
-
Welcome to
|
|
8
|
-
|
|
9
|
-
╦ ┌─┐┌┐┌┌─┐╔═╗┬─┐┌─┐┌─┐┬ ┬
|
|
10
|
-
║ ├─┤││││ ┬║ ╦├┬┘├─┤├─┘├─┤
|
|
11
|
-
╩═╝┴ ┴┘└┘└─┘╚═╝┴└─┴ ┴┴ ┴ ┴.js
|
|
12
|
-
|
|
13
|
-
- 🚀 API: \x1b[36m${localUrl}\x1b[0m
|
|
14
|
-
- 🎨 Studio UI: \x1b[36m${studioUrl}\x1b[0m
|
|
15
|
-
|
|
16
|
-
This in-memory server is designed for development and testing.
|
|
17
|
-
For production use, please use LangSmith Deployment.
|
|
18
|
-
|
|
19
|
-
`);
|
|
20
|
-
return spawn(process.execPath, [
|
|
21
|
-
fileURLToPath(new URL("../../cli.mjs", import.meta.resolve("tsx/esm/api"))),
|
|
22
|
-
"watch",
|
|
23
|
-
"--clear-screen=false",
|
|
24
|
-
"--import",
|
|
25
|
-
new URL(import.meta.resolve("../preload.mjs")).toString(),
|
|
26
|
-
fileURLToPath(new URL(import.meta.resolve("./entrypoint.mjs"))),
|
|
27
|
-
options.pid.toString(),
|
|
28
|
-
JSON.stringify({
|
|
29
|
-
port: Number.parseInt(args.port, 10),
|
|
30
|
-
nWorkers: Number.parseInt(args.nJobsPerWorker, 10),
|
|
31
|
-
host: args.host,
|
|
32
|
-
graphs: context.config.graphs,
|
|
33
|
-
auth: context.config.auth,
|
|
34
|
-
ui: context.config.ui,
|
|
35
|
-
ui_config: context.config.ui_config,
|
|
36
|
-
cwd: options.projectCwd,
|
|
37
|
-
http: context.config.http,
|
|
38
|
-
}),
|
|
39
|
-
], {
|
|
40
|
-
stdio: ["inherit", "inherit", "inherit", "ipc"],
|
|
41
|
-
env: {
|
|
42
|
-
...context.env,
|
|
43
|
-
NODE_ENV: "development",
|
|
44
|
-
LANGGRAPH_API_URL: localUrl,
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// MIT License
|
|
2
|
-
//
|
|
3
|
-
// Copyright (c) Hiroki Osame <hiroki.osame@gmail.com>
|
|
4
|
-
//
|
|
5
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
// in the Software without restriction, including without limitation the rights
|
|
8
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
// furnished to do so, subject to the following conditions:
|
|
11
|
-
//
|
|
12
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
// copies or substantial portions of the Software.
|
|
14
|
-
//
|
|
15
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
// SOFTWARE.
|
|
22
|
-
//
|
|
23
|
-
// https://github.com/privatenumber/tsx/tree/28a3e7d2b8fd72b683aab8a98dd1fcee4624e4cb
|
|
24
|
-
import net from "node:net";
|
|
25
|
-
import { getPipePath } from "./utils/get-pipe-path.mjs";
|
|
26
|
-
export const connectToServer = (processId = process.ppid) => new Promise((resolve) => {
|
|
27
|
-
const pipePath = getPipePath(processId);
|
|
28
|
-
const socket = net.createConnection(pipePath, () => {
|
|
29
|
-
const sendToParent = (data) => {
|
|
30
|
-
const messageBuffer = Buffer.from(JSON.stringify(data));
|
|
31
|
-
const lengthBuffer = Buffer.alloc(4);
|
|
32
|
-
lengthBuffer.writeInt32BE(messageBuffer.length, 0);
|
|
33
|
-
socket.write(Buffer.concat([lengthBuffer, messageBuffer]));
|
|
34
|
-
};
|
|
35
|
-
resolve(sendToParent);
|
|
36
|
-
});
|
|
37
|
-
/**
|
|
38
|
-
* Ignore error when:
|
|
39
|
-
* - Called as a loader and there is no server
|
|
40
|
-
* - Nested process when using --test and the ppid is incorrect
|
|
41
|
-
*/
|
|
42
|
-
socket.on("error", () => {
|
|
43
|
-
resolve(undefined);
|
|
44
|
-
});
|
|
45
|
-
// Prevent Node from waiting for this socket to close before exiting
|
|
46
|
-
socket.unref();
|
|
47
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getPipePath: (processId: number) => string;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// MIT License
|
|
2
|
-
//
|
|
3
|
-
// Copyright (c) Hiroki Osame <hiroki.osame@gmail.com>
|
|
4
|
-
//
|
|
5
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
// in the Software without restriction, including without limitation the rights
|
|
8
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
// furnished to do so, subject to the following conditions:
|
|
11
|
-
//
|
|
12
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
// copies or substantial portions of the Software.
|
|
14
|
-
//
|
|
15
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
// SOFTWARE.
|
|
22
|
-
//
|
|
23
|
-
// https://github.com/privatenumber/tsx/tree/28a3e7d2b8fd72b683aab8a98dd1fcee4624e4cb
|
|
24
|
-
import path from "node:path";
|
|
25
|
-
import { tmpdir } from "./temporary-directory.mjs";
|
|
26
|
-
export const getPipePath = (processId) => {
|
|
27
|
-
const pipePath = path.join(tmpdir, `${processId}.pipe`);
|
|
28
|
-
return process.platform === "win32" ? `\\\\?\\pipe\\${pipePath}` : pipePath;
|
|
29
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// MIT License
|
|
2
|
-
//
|
|
3
|
-
// Copyright (c) Hiroki Osame <hiroki.osame@gmail.com>
|
|
4
|
-
//
|
|
5
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
// in the Software without restriction, including without limitation the rights
|
|
8
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
// furnished to do so, subject to the following conditions:
|
|
11
|
-
//
|
|
12
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
// copies or substantial portions of the Software.
|
|
14
|
-
//
|
|
15
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
// SOFTWARE.
|
|
22
|
-
//
|
|
23
|
-
// https://github.com/privatenumber/tsx/tree/28a3e7d2b8fd72b683aab8a98dd1fcee4624e4cb
|
|
24
|
-
import path from "node:path";
|
|
25
|
-
import os from "node:os";
|
|
26
|
-
/**
|
|
27
|
-
* Cache directory is based on the user's identifier
|
|
28
|
-
* to avoid permission issues when accessed by a different user
|
|
29
|
-
*/
|
|
30
|
-
const { geteuid } = process;
|
|
31
|
-
const userId = geteuid
|
|
32
|
-
? // For Linux users with virtual users on CI (e.g. Docker)
|
|
33
|
-
geteuid()
|
|
34
|
-
: // Use username on Windows because it doesn't have id
|
|
35
|
-
os.userInfo().username;
|
|
36
|
-
/**
|
|
37
|
-
* This ensures that the cache directory is unique per user
|
|
38
|
-
* and has the appropriate permissions
|
|
39
|
-
*/
|
|
40
|
-
export const tmpdir = path.join(os.tmpdir(), `tsx-${userId}`);
|
package/dist/command.d.mts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Command } from "@langchain/langgraph";
|
|
2
|
-
export interface RunSend {
|
|
3
|
-
node: string;
|
|
4
|
-
input?: unknown;
|
|
5
|
-
}
|
|
6
|
-
export interface RunCommand {
|
|
7
|
-
goto?: string | RunSend | Array<RunSend | string>;
|
|
8
|
-
update?: Record<string, unknown> | [string, unknown][];
|
|
9
|
-
resume?: unknown;
|
|
10
|
-
}
|
|
11
|
-
export declare const getLangGraphCommand: (command: RunCommand) => Command<unknown, Record<string, unknown>, string>;
|
package/dist/command.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Command, Send } from "@langchain/langgraph";
|
|
2
|
-
export const getLangGraphCommand = (command) => {
|
|
3
|
-
let goto = command.goto != null && !Array.isArray(command.goto)
|
|
4
|
-
? [command.goto]
|
|
5
|
-
: command.goto;
|
|
6
|
-
return new Command({
|
|
7
|
-
goto: goto?.map((item) => {
|
|
8
|
-
if (typeof item !== "string")
|
|
9
|
-
return new Send(item.node, item.input);
|
|
10
|
-
return item;
|
|
11
|
-
}),
|
|
12
|
-
update: command.update,
|
|
13
|
-
resume: command.resume,
|
|
14
|
-
});
|
|
15
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { BaseCheckpointSaver, BaseStore, Pregel } from "@langchain/langgraph";
|
|
2
|
-
import { Hono } from "hono";
|
|
3
|
-
import type { Metadata } from "../storage/types.mjs";
|
|
4
|
-
type AnyPregel = Pregel<any, any, any, any, any>;
|
|
5
|
-
interface Thread {
|
|
6
|
-
thread_id: string;
|
|
7
|
-
metadata: Metadata;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Interface for storing and retrieving threads used by `createEmbedServer`.
|
|
11
|
-
* @experimental Does not follow semver.
|
|
12
|
-
*/
|
|
13
|
-
export interface ThreadSaver {
|
|
14
|
-
get: (id: string) => Promise<Thread>;
|
|
15
|
-
set: (id: string, options: {
|
|
16
|
-
kind: "put" | "patch";
|
|
17
|
-
metadata?: Metadata;
|
|
18
|
-
}) => Promise<Thread>;
|
|
19
|
-
delete: (id: string) => Promise<void>;
|
|
20
|
-
search?: (options: {
|
|
21
|
-
metadata?: Metadata;
|
|
22
|
-
limit: number;
|
|
23
|
-
offset: number;
|
|
24
|
-
sortBy: "created_at" | "updated_at";
|
|
25
|
-
sortOrder: "asc" | "desc";
|
|
26
|
-
}) => AsyncGenerator<{
|
|
27
|
-
thread: Thread;
|
|
28
|
-
total: number;
|
|
29
|
-
}>;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Create a Hono server with a subset of LangGraph Platform routes.
|
|
33
|
-
*
|
|
34
|
-
* @experimental Does not follow semver.
|
|
35
|
-
*/
|
|
36
|
-
export declare function createEmbedServer(options: {
|
|
37
|
-
graph: Record<string, AnyPregel>;
|
|
38
|
-
threads: ThreadSaver;
|
|
39
|
-
checkpointer: BaseCheckpointSaver;
|
|
40
|
-
store?: BaseStore;
|
|
41
|
-
}): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
|
|
42
|
-
export {};
|