@langgraph-js/pure-graph 1.3.0 → 1.4.0
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/README.md +22 -14
- package/dist/adapter/nextjs/router.js +6 -6
- package/dist/global.d.ts +3 -2
- package/dist/storage/index.d.ts +4 -3
- package/dist/storage/index.js +13 -1
- package/dist/storage/pg/checkpoint.d.ts +2 -0
- package/dist/storage/pg/checkpoint.js +9 -0
- package/dist/storage/pg/threads.d.ts +43 -0
- package/dist/storage/pg/threads.js +304 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +38 -5
- package/.prettierrc +0 -11
- package/bun.lock +0 -209
- package/dist/adapter/hono/zod.d.ts +0 -203
- package/dist/adapter/hono/zod.js +0 -43
- package/dist/adapter/nextjs/zod.d.ts +0 -203
- package/dist/adapter/nextjs/zod.js +0 -60
- package/examples/nextjs/README.md +0 -36
- package/examples/nextjs/app/api/langgraph/[...path]/route.ts +0 -10
- package/examples/nextjs/app/favicon.ico +0 -0
- package/examples/nextjs/app/globals.css +0 -26
- package/examples/nextjs/app/layout.tsx +0 -34
- package/examples/nextjs/app/page.tsx +0 -211
- package/examples/nextjs/next.config.ts +0 -26
- package/examples/nextjs/package.json +0 -24
- package/examples/nextjs/postcss.config.mjs +0 -5
- package/examples/nextjs/tsconfig.json +0 -27
- package/packages/agent-graph/demo.json +0 -35
- package/packages/agent-graph/package.json +0 -18
- package/packages/agent-graph/src/index.ts +0 -47
- package/packages/agent-graph/src/tools/tavily.ts +0 -9
- package/packages/agent-graph/src/tools.ts +0 -38
- package/packages/agent-graph/src/types.ts +0 -42
- package/pnpm-workspace.yaml +0 -4
- package/src/adapter/hono/assistants.ts +0 -24
- package/src/adapter/hono/endpoint.ts +0 -3
- package/src/adapter/hono/index.ts +0 -14
- package/src/adapter/hono/runs.ts +0 -92
- package/src/adapter/hono/threads.ts +0 -37
- package/src/adapter/nextjs/endpoint.ts +0 -2
- package/src/adapter/nextjs/index.ts +0 -2
- package/src/adapter/nextjs/router.ts +0 -206
- package/src/adapter/nextjs/zod.ts +0 -66
- package/src/adapter/zod.ts +0 -144
- package/src/createEndpoint.ts +0 -116
- package/src/e.d.ts +0 -3
- package/src/global.ts +0 -11
- package/src/graph/stream.ts +0 -263
- package/src/graph/stringify.ts +0 -219
- package/src/index.ts +0 -6
- package/src/queue/JsonPlusSerializer.ts +0 -143
- package/src/queue/event_message.ts +0 -30
- package/src/queue/stream_queue.ts +0 -237
- package/src/storage/index.ts +0 -52
- package/src/storage/memory/checkpoint.ts +0 -2
- package/src/storage/memory/queue.ts +0 -91
- package/src/storage/memory/threads.ts +0 -183
- package/src/storage/redis/queue.ts +0 -148
- package/src/storage/sqlite/DB.ts +0 -16
- package/src/storage/sqlite/checkpoint.ts +0 -502
- package/src/storage/sqlite/threads.ts +0 -405
- package/src/storage/sqlite/type.ts +0 -12
- package/src/threads/index.ts +0 -37
- package/src/types.ts +0 -118
- package/src/utils/createEntrypointGraph.ts +0 -20
- package/src/utils/getGraph.ts +0 -44
- package/src/utils/getLangGraphCommand.ts +0 -21
- package/test/graph/entrypoint.ts +0 -21
- package/test/graph/index.ts +0 -60
- package/test/hono.ts +0 -15
- package/tsconfig.json +0 -20
package/test/graph/index.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { interrupt, StateGraph } from '@langchain/langgraph';
|
|
2
|
-
import { HumanInterrupt } from '@langchain/langgraph/prebuilt';
|
|
3
|
-
import { createReactAgentAnnotation } from '@langchain/langgraph/prebuilt';
|
|
4
|
-
import { createState } from '@langgraph-js/pro';
|
|
5
|
-
const state = createState(createReactAgentAnnotation()).build({});
|
|
6
|
-
export const graph = new StateGraph(state)
|
|
7
|
-
.addNode('agent', async (state) => {
|
|
8
|
-
return {
|
|
9
|
-
messages: [
|
|
10
|
-
...state.messages,
|
|
11
|
-
{
|
|
12
|
-
role: 'ai',
|
|
13
|
-
content: 'Processing...',
|
|
14
|
-
},
|
|
15
|
-
],
|
|
16
|
-
};
|
|
17
|
-
})
|
|
18
|
-
.addNode('interrupt', async (state) => {
|
|
19
|
-
// interrupt
|
|
20
|
-
const response = interrupt([
|
|
21
|
-
{
|
|
22
|
-
action_request: {
|
|
23
|
-
action: 'test',
|
|
24
|
-
args: {
|
|
25
|
-
a: 1,
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
config: {
|
|
29
|
-
allow_ignore: true,
|
|
30
|
-
allow_respond: true,
|
|
31
|
-
allow_edit: true,
|
|
32
|
-
allow_accept: true,
|
|
33
|
-
},
|
|
34
|
-
description: 'Please review the tool call',
|
|
35
|
-
} as HumanInterrupt,
|
|
36
|
-
])[0];
|
|
37
|
-
return {
|
|
38
|
-
messages: [
|
|
39
|
-
...state.messages,
|
|
40
|
-
{
|
|
41
|
-
role: 'ai',
|
|
42
|
-
content: response,
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
};
|
|
46
|
-
})
|
|
47
|
-
.addEdge('__start__', 'agent')
|
|
48
|
-
.addConditionalEdges(
|
|
49
|
-
'agent',
|
|
50
|
-
(state) => {
|
|
51
|
-
// 条件:如果消息数量大于1,则走interrupt路径
|
|
52
|
-
return state.messages.length > 1 ? 'interrupt' : '__end__';
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
interrupt: 'interrupt',
|
|
56
|
-
__end__: '__end__',
|
|
57
|
-
},
|
|
58
|
-
)
|
|
59
|
-
.addEdge('interrupt', '__end__')
|
|
60
|
-
.compile();
|
package/test/hono.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { registerGraph } from '../src/createEndpoint';
|
|
2
|
-
import { graph } from './graph/index';
|
|
3
|
-
import { graph as entrypointGraph } from './graph/entrypoint';
|
|
4
|
-
// import { graph as agentGraph } from '../packages/agent-graph/src/index';
|
|
5
|
-
import { Hono } from 'hono';
|
|
6
|
-
import LangGraphApp from '../src/adapter/hono/index';
|
|
7
|
-
|
|
8
|
-
registerGraph('test', graph);
|
|
9
|
-
// registerGraph('agent-graph', agentGraph);
|
|
10
|
-
registerGraph('test-entrypoint', entrypointGraph);
|
|
11
|
-
|
|
12
|
-
const app = new Hono();
|
|
13
|
-
app.route('/', LangGraphApp);
|
|
14
|
-
|
|
15
|
-
export default app;
|
package/tsconfig.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"lib": [],
|
|
4
|
-
"allowJs": true,
|
|
5
|
-
"skipLibCheck": true,
|
|
6
|
-
"strict": true,
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"target": "esnext",
|
|
9
|
-
"module": "esnext",
|
|
10
|
-
"moduleResolution": "bundler",
|
|
11
|
-
"resolveJsonModule": true,
|
|
12
|
-
"isolatedModules": true,
|
|
13
|
-
"jsx": "preserve",
|
|
14
|
-
"incremental": true,
|
|
15
|
-
"outDir": "./dist",
|
|
16
|
-
"declaration": true
|
|
17
|
-
},
|
|
18
|
-
"include": ["src/**/*.ts"],
|
|
19
|
-
"exclude": ["node_modules"]
|
|
20
|
-
}
|