@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.
Files changed (71) hide show
  1. package/README.md +22 -14
  2. package/dist/adapter/nextjs/router.js +6 -6
  3. package/dist/global.d.ts +3 -2
  4. package/dist/storage/index.d.ts +4 -3
  5. package/dist/storage/index.js +13 -1
  6. package/dist/storage/pg/checkpoint.d.ts +2 -0
  7. package/dist/storage/pg/checkpoint.js +9 -0
  8. package/dist/storage/pg/threads.d.ts +43 -0
  9. package/dist/storage/pg/threads.js +304 -0
  10. package/dist/tsconfig.tsbuildinfo +1 -0
  11. package/package.json +38 -5
  12. package/.prettierrc +0 -11
  13. package/bun.lock +0 -209
  14. package/dist/adapter/hono/zod.d.ts +0 -203
  15. package/dist/adapter/hono/zod.js +0 -43
  16. package/dist/adapter/nextjs/zod.d.ts +0 -203
  17. package/dist/adapter/nextjs/zod.js +0 -60
  18. package/examples/nextjs/README.md +0 -36
  19. package/examples/nextjs/app/api/langgraph/[...path]/route.ts +0 -10
  20. package/examples/nextjs/app/favicon.ico +0 -0
  21. package/examples/nextjs/app/globals.css +0 -26
  22. package/examples/nextjs/app/layout.tsx +0 -34
  23. package/examples/nextjs/app/page.tsx +0 -211
  24. package/examples/nextjs/next.config.ts +0 -26
  25. package/examples/nextjs/package.json +0 -24
  26. package/examples/nextjs/postcss.config.mjs +0 -5
  27. package/examples/nextjs/tsconfig.json +0 -27
  28. package/packages/agent-graph/demo.json +0 -35
  29. package/packages/agent-graph/package.json +0 -18
  30. package/packages/agent-graph/src/index.ts +0 -47
  31. package/packages/agent-graph/src/tools/tavily.ts +0 -9
  32. package/packages/agent-graph/src/tools.ts +0 -38
  33. package/packages/agent-graph/src/types.ts +0 -42
  34. package/pnpm-workspace.yaml +0 -4
  35. package/src/adapter/hono/assistants.ts +0 -24
  36. package/src/adapter/hono/endpoint.ts +0 -3
  37. package/src/adapter/hono/index.ts +0 -14
  38. package/src/adapter/hono/runs.ts +0 -92
  39. package/src/adapter/hono/threads.ts +0 -37
  40. package/src/adapter/nextjs/endpoint.ts +0 -2
  41. package/src/adapter/nextjs/index.ts +0 -2
  42. package/src/adapter/nextjs/router.ts +0 -206
  43. package/src/adapter/nextjs/zod.ts +0 -66
  44. package/src/adapter/zod.ts +0 -144
  45. package/src/createEndpoint.ts +0 -116
  46. package/src/e.d.ts +0 -3
  47. package/src/global.ts +0 -11
  48. package/src/graph/stream.ts +0 -263
  49. package/src/graph/stringify.ts +0 -219
  50. package/src/index.ts +0 -6
  51. package/src/queue/JsonPlusSerializer.ts +0 -143
  52. package/src/queue/event_message.ts +0 -30
  53. package/src/queue/stream_queue.ts +0 -237
  54. package/src/storage/index.ts +0 -52
  55. package/src/storage/memory/checkpoint.ts +0 -2
  56. package/src/storage/memory/queue.ts +0 -91
  57. package/src/storage/memory/threads.ts +0 -183
  58. package/src/storage/redis/queue.ts +0 -148
  59. package/src/storage/sqlite/DB.ts +0 -16
  60. package/src/storage/sqlite/checkpoint.ts +0 -502
  61. package/src/storage/sqlite/threads.ts +0 -405
  62. package/src/storage/sqlite/type.ts +0 -12
  63. package/src/threads/index.ts +0 -37
  64. package/src/types.ts +0 -118
  65. package/src/utils/createEntrypointGraph.ts +0 -20
  66. package/src/utils/getGraph.ts +0 -44
  67. package/src/utils/getLangGraphCommand.ts +0 -21
  68. package/test/graph/entrypoint.ts +0 -21
  69. package/test/graph/index.ts +0 -60
  70. package/test/hono.ts +0 -15
  71. package/tsconfig.json +0 -20
@@ -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
- }