@axiom-lattice/core 1.0.26 → 1.0.29

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/dist/index.js CHANGED
@@ -38,19 +38,27 @@ __export(index_exports, {
38
38
  MemoryType: () => import_protocols2.MemoryType,
39
39
  ModelLatticeManager: () => ModelLatticeManager,
40
40
  Protocols: () => Protocols,
41
+ ToolLatticeManager: () => ToolLatticeManager,
41
42
  agentLatticeManager: () => agentLatticeManager,
42
43
  getAgentClient: () => getAgentClient,
43
44
  getAgentConfig: () => getAgentConfig,
44
45
  getAgentLattice: () => getAgentLattice,
45
46
  getAllAgentConfigs: () => getAllAgentConfigs,
47
+ getAllToolDefinitions: () => getAllToolDefinitions,
46
48
  getCheckpointSaver: () => getCheckpointSaver,
47
49
  getModelLattice: () => getModelLattice,
50
+ getToolClient: () => getToolClient,
51
+ getToolDefinition: () => getToolDefinition,
52
+ getToolLattice: () => getToolLattice,
48
53
  modelLatticeManager: () => modelLatticeManager,
49
54
  registerAgentLattice: () => registerAgentLattice,
50
55
  registerAgentLattices: () => registerAgentLattices,
51
56
  registerCheckpointSaver: () => registerCheckpointSaver,
52
57
  registerModelLattice: () => registerModelLattice,
53
- validateAgentInput: () => validateAgentInput
58
+ registerToolLattice: () => registerToolLattice,
59
+ toolLatticeManager: () => toolLatticeManager,
60
+ validateAgentInput: () => validateAgentInput,
61
+ validateToolInput: () => validateToolInput
54
62
  });
55
63
  module.exports = __toCommonJS(index_exports);
56
64
 
@@ -533,7 +541,11 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
533
541
  };
534
542
  var toolLatticeManager = ToolLatticeManager.getInstance();
535
543
  var registerToolLattice = (key, config, executor) => toolLatticeManager.registerLattice(key, config, executor);
544
+ var getToolLattice = (key) => toolLatticeManager.getToolLattice(key);
545
+ var getToolDefinition = (key) => toolLatticeManager.getToolDefinition(key);
536
546
  var getToolClient = (key) => toolLatticeManager.getToolClient(key);
547
+ var getAllToolDefinitions = () => toolLatticeManager.getAllToolDefinitions();
548
+ var validateToolInput = (key, input) => toolLatticeManager.validateToolInput(key, input);
537
549
 
538
550
  // src/tool_lattice/get_current_date_time/index.ts
539
551
  registerToolLattice(
@@ -596,6 +608,101 @@ var import_protocols = require("@axiom-lattice/protocols");
596
608
 
597
609
  // src/agent_lattice/builders/ReActAgentGraphBuilder.ts
598
610
  var import_prebuilt = require("@langchain/langgraph/prebuilt");
611
+
612
+ // src/memory_lattice/DefaultMemorySaver.ts
613
+ var import_langgraph = require("@langchain/langgraph");
614
+
615
+ // src/memory_lattice/MemoryLatticeManager.ts
616
+ var import_protocols2 = require("@axiom-lattice/protocols");
617
+ var _MemoryLatticeManager = class _MemoryLatticeManager extends BaseLatticeManager {
618
+ /**
619
+ * 私有构造函数,防止外部直接实例化
620
+ */
621
+ constructor() {
622
+ super();
623
+ }
624
+ /**
625
+ * 获取单例实例
626
+ */
627
+ static getInstance() {
628
+ if (!_MemoryLatticeManager.instance) {
629
+ _MemoryLatticeManager.instance = new _MemoryLatticeManager();
630
+ }
631
+ return _MemoryLatticeManager.instance;
632
+ }
633
+ /**
634
+ * 获取Lattice类型
635
+ */
636
+ getLatticeType() {
637
+ return "memory";
638
+ }
639
+ /**
640
+ * 注册检查点保存器
641
+ * @param key 保存器键名
642
+ * @param saver 检查点保存器实例
643
+ */
644
+ registerCheckpointSaver(key, saver) {
645
+ if (_MemoryLatticeManager.checkpointSavers.has(key)) {
646
+ throw new Error(`\u68C0\u67E5\u70B9\u4FDD\u5B58\u5668 "${key}" \u5DF2\u7ECF\u5B58\u5728\uFF0C\u65E0\u6CD5\u91CD\u590D\u6CE8\u518C`);
647
+ }
648
+ _MemoryLatticeManager.checkpointSavers.set(key, saver);
649
+ }
650
+ /**
651
+ * 获取检查点保存器
652
+ * @param key 保存器键名
653
+ */
654
+ getCheckpointSaver(key) {
655
+ const saver = _MemoryLatticeManager.checkpointSavers.get(key);
656
+ if (!saver) {
657
+ throw new Error(`\u68C0\u67E5\u70B9\u4FDD\u5B58\u5668 "${key}" \u4E0D\u5B58\u5728`);
658
+ }
659
+ return saver;
660
+ }
661
+ /**
662
+ * 获取所有已注册的检查点保存器键名
663
+ */
664
+ getCheckpointSaverKeys() {
665
+ return Array.from(_MemoryLatticeManager.checkpointSavers.keys());
666
+ }
667
+ /**
668
+ * 检查检查点保存器是否存在
669
+ * @param key 保存器键名
670
+ */
671
+ hasCheckpointSaver(key) {
672
+ return _MemoryLatticeManager.checkpointSavers.has(key);
673
+ }
674
+ /**
675
+ * 移除检查点保存器
676
+ * @param key 保存器键名
677
+ */
678
+ removeCheckpointSaver(key) {
679
+ return _MemoryLatticeManager.checkpointSavers.delete(key);
680
+ }
681
+ };
682
+ // 检查点保存器注册表
683
+ _MemoryLatticeManager.checkpointSavers = /* @__PURE__ */ new Map();
684
+ var MemoryLatticeManager = _MemoryLatticeManager;
685
+ var getCheckpointSaver = (key) => MemoryLatticeManager.getInstance().getCheckpointSaver(key);
686
+ var registerCheckpointSaver = (key, saver) => MemoryLatticeManager.getInstance().registerCheckpointSaver(key, saver);
687
+
688
+ // src/memory_lattice/DefaultMemorySaver.ts
689
+ var memory = new import_langgraph.MemorySaver();
690
+ registerCheckpointSaver("default", memory);
691
+
692
+ // src/agent_lattice/builders/state.ts
693
+ var import_zod3 = require("@langchain/langgraph/zod");
694
+ var import_langgraph2 = require("@langchain/langgraph");
695
+ var import_zod4 = require("zod");
696
+ var ReActAgentState = import_langgraph2.MessagesZodState.extend({
697
+ files: import_zod4.z.object({
698
+ final_output: import_zod4.z.record(import_zod4.z.any())
699
+ })
700
+ });
701
+ var createReactAgentSchema = (schema) => {
702
+ return schema ? import_langgraph2.MessagesZodState.extend(schema.shape) : void 0;
703
+ };
704
+
705
+ // src/agent_lattice/builders/ReActAgentGraphBuilder.ts
599
706
  var ReActAgentGraphBuilder = class {
600
707
  /**
601
708
  * 构建ReAct Agent Graph
@@ -609,11 +716,14 @@ var ReActAgentGraphBuilder = class {
609
716
  const tool5 = getToolClient(t.key);
610
717
  return tool5;
611
718
  }).filter((tool5) => tool5 !== void 0);
719
+ const stateSchema = createReactAgentSchema(params.stateSchema);
612
720
  return (0, import_prebuilt.createReactAgent)({
613
721
  llm: params.model,
614
722
  tools,
615
723
  prompt: params.prompt,
616
- name: agentLattice.config.name
724
+ name: agentLattice.config.name,
725
+ checkpointer: getCheckpointSaver("default"),
726
+ stateSchema
617
727
  });
618
728
  }
619
729
  };
@@ -621,15 +731,15 @@ var ReActAgentGraphBuilder = class {
621
731
  // src/deep_agent/subAgent.ts
622
732
  var import_tools3 = require("@langchain/core/tools");
623
733
  var import_messages2 = require("@langchain/core/messages");
624
- var import_langgraph2 = require("@langchain/langgraph");
734
+ var import_langgraph4 = require("@langchain/langgraph");
625
735
  var import_prebuilt2 = require("@langchain/langgraph/prebuilt");
626
- var import_zod4 = require("zod");
736
+ var import_zod6 = require("zod");
627
737
 
628
738
  // src/deep_agent/tools.ts
629
739
  var import_tools2 = require("@langchain/core/tools");
630
740
  var import_messages = require("@langchain/core/messages");
631
- var import_langgraph = require("@langchain/langgraph");
632
- var import_zod3 = require("zod");
741
+ var import_langgraph3 = require("@langchain/langgraph");
742
+ var import_zod5 = require("zod");
633
743
 
634
744
  // src/deep_agent/prompts.ts
635
745
  var WRITE_TODOS_DESCRIPTION = `Use this tool to create and manage a structured task list for your current work session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user. It also helps the user understand the progress of the task and overall progress of their requests.
@@ -894,7 +1004,7 @@ var genUIMarkdown = (type, data) => {
894
1004
  // src/deep_agent/tools.ts
895
1005
  var writeTodos = (0, import_tools2.tool)(
896
1006
  (input, config) => {
897
- return new import_langgraph.Command({
1007
+ return new import_langgraph3.Command({
898
1008
  update: {
899
1009
  todos: input.todos,
900
1010
  messages: [
@@ -909,11 +1019,11 @@ var writeTodos = (0, import_tools2.tool)(
909
1019
  {
910
1020
  name: "write_todos",
911
1021
  description: WRITE_TODOS_DESCRIPTION,
912
- schema: import_zod3.z.object({
913
- todos: import_zod3.z.array(
914
- import_zod3.z.object({
915
- content: import_zod3.z.string().describe("Content of the todo item"),
916
- status: import_zod3.z.enum(["pending", "in_progress", "completed"]).describe("Status of the todo")
1022
+ schema: import_zod5.z.object({
1023
+ todos: import_zod5.z.array(
1024
+ import_zod5.z.object({
1025
+ content: import_zod5.z.string().describe("Content of the todo item"),
1026
+ status: import_zod5.z.enum(["pending", "in_progress", "completed"]).describe("Status of the todo")
917
1027
  })
918
1028
  ).describe("List of todo items to update")
919
1029
  })
@@ -921,19 +1031,19 @@ var writeTodos = (0, import_tools2.tool)(
921
1031
  );
922
1032
  var ls = (0, import_tools2.tool)(
923
1033
  () => {
924
- const state = (0, import_langgraph.getCurrentTaskInput)();
1034
+ const state = (0, import_langgraph3.getCurrentTaskInput)();
925
1035
  const files = state.files || {};
926
1036
  return Object.keys(files);
927
1037
  },
928
1038
  {
929
1039
  name: "ls",
930
1040
  description: "List all files in the mock filesystem",
931
- schema: import_zod3.z.object({})
1041
+ schema: import_zod5.z.object({})
932
1042
  }
933
1043
  );
934
1044
  var readFile = (0, import_tools2.tool)(
935
1045
  (input) => {
936
- const state = (0, import_langgraph.getCurrentTaskInput)();
1046
+ const state = (0, import_langgraph3.getCurrentTaskInput)();
937
1047
  const mockFilesystem = state.files || {};
938
1048
  const { file_path, offset = 0, limit = 2e3 } = input;
939
1049
  if (!(file_path in mockFilesystem)) {
@@ -963,19 +1073,19 @@ var readFile = (0, import_tools2.tool)(
963
1073
  {
964
1074
  name: "read_file",
965
1075
  description: TOOL_DESCRIPTION,
966
- schema: import_zod3.z.object({
967
- file_path: import_zod3.z.string().describe("Absolute path to the file to read"),
968
- offset: import_zod3.z.number().optional().default(0).describe("Line offset to start reading from"),
969
- limit: import_zod3.z.number().optional().default(2e3).describe("Maximum number of lines to read")
1076
+ schema: import_zod5.z.object({
1077
+ file_path: import_zod5.z.string().describe("Absolute path to the file to read"),
1078
+ offset: import_zod5.z.number().optional().default(0).describe("Line offset to start reading from"),
1079
+ limit: import_zod5.z.number().optional().default(2e3).describe("Maximum number of lines to read")
970
1080
  })
971
1081
  }
972
1082
  );
973
1083
  var writeFile = (0, import_tools2.tool)(
974
1084
  (input, config) => {
975
- const state = (0, import_langgraph.getCurrentTaskInput)();
1085
+ const state = (0, import_langgraph3.getCurrentTaskInput)();
976
1086
  const files = { ...state.files || {} };
977
1087
  files[input.file_path] = input.content;
978
- return new import_langgraph.Command({
1088
+ return new import_langgraph3.Command({
979
1089
  update: {
980
1090
  files,
981
1091
  messages: [
@@ -990,15 +1100,15 @@ var writeFile = (0, import_tools2.tool)(
990
1100
  {
991
1101
  name: "write_file",
992
1102
  description: "Write content to a file in the mock filesystem",
993
- schema: import_zod3.z.object({
994
- file_path: import_zod3.z.string().describe("Absolute path to the file to write"),
995
- content: import_zod3.z.string().describe("Content to write to the file")
1103
+ schema: import_zod5.z.object({
1104
+ file_path: import_zod5.z.string().describe("Absolute path to the file to write"),
1105
+ content: import_zod5.z.string().describe("Content to write to the file")
996
1106
  })
997
1107
  }
998
1108
  );
999
1109
  var editFile = (0, import_tools2.tool)(
1000
1110
  (input, config) => {
1001
- const state = (0, import_langgraph.getCurrentTaskInput)();
1111
+ const state = (0, import_langgraph3.getCurrentTaskInput)();
1002
1112
  const mockFilesystem = { ...state.files || {} };
1003
1113
  const { file_path, old_string, new_string, replace_all = false } = input;
1004
1114
  if (!(file_path in mockFilesystem)) {
@@ -1034,7 +1144,7 @@ var editFile = (0, import_tools2.tool)(
1034
1144
  newContent = content.replace(old_string, new_string);
1035
1145
  }
1036
1146
  mockFilesystem[file_path] = newContent;
1037
- return new import_langgraph.Command({
1147
+ return new import_langgraph3.Command({
1038
1148
  update: {
1039
1149
  files: mockFilesystem,
1040
1150
  messages: [
@@ -1049,11 +1159,11 @@ var editFile = (0, import_tools2.tool)(
1049
1159
  {
1050
1160
  name: "edit_file",
1051
1161
  description: EDIT_DESCRIPTION,
1052
- schema: import_zod3.z.object({
1053
- file_path: import_zod3.z.string().describe("Absolute path to the file to edit"),
1054
- old_string: import_zod3.z.string().describe("String to be replaced (must match exactly)"),
1055
- new_string: import_zod3.z.string().describe("String to replace with"),
1056
- replace_all: import_zod3.z.boolean().optional().default(false).describe("Whether to replace all occurrences")
1162
+ schema: import_zod5.z.object({
1163
+ file_path: import_zod5.z.string().describe("Absolute path to the file to edit"),
1164
+ old_string: import_zod5.z.string().describe("String to be replaced (must match exactly)"),
1165
+ new_string: import_zod5.z.string().describe("String to replace with"),
1166
+ replace_all: import_zod5.z.boolean().optional().default(false).describe("Whether to replace all occurrences")
1057
1167
  })
1058
1168
  }
1059
1169
  );
@@ -1113,7 +1223,7 @@ function createTaskTool(inputs) {
1113
1223
  ).join(", ")}`;
1114
1224
  }
1115
1225
  try {
1116
- const currentState = (0, import_langgraph2.getCurrentTaskInput)();
1226
+ const currentState = (0, import_langgraph4.getCurrentTaskInput)();
1117
1227
  const modifiedState = {
1118
1228
  ...currentState,
1119
1229
  messages: [
@@ -1124,7 +1234,7 @@ function createTaskTool(inputs) {
1124
1234
  ]
1125
1235
  };
1126
1236
  const result = await reactAgent.invoke(modifiedState, config);
1127
- return new import_langgraph2.Command({
1237
+ return new import_langgraph4.Command({
1128
1238
  update: {
1129
1239
  files: result.files || {},
1130
1240
  messages: [
@@ -1136,11 +1246,11 @@ function createTaskTool(inputs) {
1136
1246
  }
1137
1247
  });
1138
1248
  } catch (error) {
1139
- if (error instanceof import_langgraph2.GraphInterrupt) {
1249
+ if (error instanceof import_langgraph4.GraphInterrupt) {
1140
1250
  throw error;
1141
1251
  }
1142
1252
  const errorMessage = error instanceof Error ? error.message : String(error);
1143
- return new import_langgraph2.Command({
1253
+ return new import_langgraph4.Command({
1144
1254
  update: {
1145
1255
  messages: [
1146
1256
  new import_messages2.ToolMessage({
@@ -1158,9 +1268,9 @@ function createTaskTool(inputs) {
1158
1268
  "{other_agents}",
1159
1269
  subagents.map((a) => `- ${a.name}: ${a.description}`).join("\n")
1160
1270
  ) + TASK_DESCRIPTION_SUFFIX,
1161
- schema: import_zod4.z.object({
1162
- description: import_zod4.z.string().describe("The task to execute with the selected agent"),
1163
- subagent_type: import_zod4.z.string().describe(
1271
+ schema: import_zod6.z.object({
1272
+ description: import_zod6.z.string().describe("The task to execute with the selected agent"),
1273
+ subagent_type: import_zod6.z.string().describe(
1164
1274
  `Name of the agent to use. Available: ${subagents.map((a) => a.name).join(", ")}`
1165
1275
  )
1166
1276
  })
@@ -1169,10 +1279,10 @@ function createTaskTool(inputs) {
1169
1279
  }
1170
1280
 
1171
1281
  // src/deep_agent/state.ts
1172
- var import_zod5 = require("@langchain/langgraph/zod");
1173
- var import_langgraph3 = require("@langchain/langgraph");
1174
- var import_zod6 = require("@langchain/langgraph/zod");
1175
- var import_zod7 = require("zod");
1282
+ var import_zod7 = require("@langchain/langgraph/zod");
1283
+ var import_langgraph5 = require("@langchain/langgraph");
1284
+ var import_zod8 = require("@langchain/langgraph/zod");
1285
+ var import_zod9 = require("zod");
1176
1286
  function fileReducer(left, right) {
1177
1287
  if (left == null) {
1178
1288
  return right || {};
@@ -1188,16 +1298,16 @@ function todoReducer(left, right) {
1188
1298
  }
1189
1299
  return left || [];
1190
1300
  }
1191
- var DeepAgentState = import_langgraph3.MessagesZodState.extend({
1192
- todos: (0, import_zod6.withLangGraph)(import_zod7.z.custom(), {
1301
+ var DeepAgentState = import_langgraph5.MessagesZodState.extend({
1302
+ todos: (0, import_zod8.withLangGraph)(import_zod9.z.custom(), {
1193
1303
  reducer: {
1194
- schema: import_zod7.z.custom(),
1304
+ schema: import_zod9.z.custom(),
1195
1305
  fn: todoReducer
1196
1306
  }
1197
1307
  }),
1198
- files: (0, import_zod6.withLangGraph)(import_zod7.z.custom(), {
1308
+ files: (0, import_zod8.withLangGraph)(import_zod9.z.custom(), {
1199
1309
  reducer: {
1200
- schema: import_zod7.z.custom(),
1310
+ schema: import_zod9.z.custom(),
1201
1311
  fn: fileReducer
1202
1312
  }
1203
1313
  })
@@ -1205,81 +1315,6 @@ var DeepAgentState = import_langgraph3.MessagesZodState.extend({
1205
1315
 
1206
1316
  // src/deep_agent/graph.ts
1207
1317
  var import_prebuilt3 = require("@langchain/langgraph/prebuilt");
1208
-
1209
- // src/memory_lattice/MemoryLatticeManager.ts
1210
- var import_protocols2 = require("@axiom-lattice/protocols");
1211
- var _MemoryLatticeManager = class _MemoryLatticeManager extends BaseLatticeManager {
1212
- /**
1213
- * 私有构造函数,防止外部直接实例化
1214
- */
1215
- constructor() {
1216
- super();
1217
- }
1218
- /**
1219
- * 获取单例实例
1220
- */
1221
- static getInstance() {
1222
- if (!_MemoryLatticeManager.instance) {
1223
- _MemoryLatticeManager.instance = new _MemoryLatticeManager();
1224
- }
1225
- return _MemoryLatticeManager.instance;
1226
- }
1227
- /**
1228
- * 获取Lattice类型
1229
- */
1230
- getLatticeType() {
1231
- return "memory";
1232
- }
1233
- /**
1234
- * 注册检查点保存器
1235
- * @param key 保存器键名
1236
- * @param saver 检查点保存器实例
1237
- */
1238
- registerCheckpointSaver(key, saver) {
1239
- if (_MemoryLatticeManager.checkpointSavers.has(key)) {
1240
- throw new Error(`\u68C0\u67E5\u70B9\u4FDD\u5B58\u5668 "${key}" \u5DF2\u7ECF\u5B58\u5728\uFF0C\u65E0\u6CD5\u91CD\u590D\u6CE8\u518C`);
1241
- }
1242
- _MemoryLatticeManager.checkpointSavers.set(key, saver);
1243
- }
1244
- /**
1245
- * 获取检查点保存器
1246
- * @param key 保存器键名
1247
- */
1248
- getCheckpointSaver(key) {
1249
- const saver = _MemoryLatticeManager.checkpointSavers.get(key);
1250
- if (!saver) {
1251
- throw new Error(`\u68C0\u67E5\u70B9\u4FDD\u5B58\u5668 "${key}" \u4E0D\u5B58\u5728`);
1252
- }
1253
- return saver;
1254
- }
1255
- /**
1256
- * 获取所有已注册的检查点保存器键名
1257
- */
1258
- getCheckpointSaverKeys() {
1259
- return Array.from(_MemoryLatticeManager.checkpointSavers.keys());
1260
- }
1261
- /**
1262
- * 检查检查点保存器是否存在
1263
- * @param key 保存器键名
1264
- */
1265
- hasCheckpointSaver(key) {
1266
- return _MemoryLatticeManager.checkpointSavers.has(key);
1267
- }
1268
- /**
1269
- * 移除检查点保存器
1270
- * @param key 保存器键名
1271
- */
1272
- removeCheckpointSaver(key) {
1273
- return _MemoryLatticeManager.checkpointSavers.delete(key);
1274
- }
1275
- };
1276
- // 检查点保存器注册表
1277
- _MemoryLatticeManager.checkpointSavers = /* @__PURE__ */ new Map();
1278
- var MemoryLatticeManager = _MemoryLatticeManager;
1279
- var getCheckpointSaver = (key) => MemoryLatticeManager.getInstance().getCheckpointSaver(key);
1280
- var registerCheckpointSaver = (key, saver) => MemoryLatticeManager.getInstance().registerCheckpointSaver(key, saver);
1281
-
1282
- // src/deep_agent/graph.ts
1283
1318
  var BASE_PROMPT = `You have access to a number of standard tools
1284
1319
 
1285
1320
  ## \`write_todos\`
@@ -1364,9 +1399,9 @@ var DeepAgentGraphBuilder = class {
1364
1399
  };
1365
1400
 
1366
1401
  // src/createPlanExecuteAgent.ts
1367
- var import_langgraph5 = require("@langchain/langgraph");
1402
+ var import_langgraph7 = require("@langchain/langgraph");
1368
1403
  var import_messages6 = require("@langchain/core/messages");
1369
- var import_zod8 = require("zod");
1404
+ var import_zod10 = require("zod");
1370
1405
 
1371
1406
  // src/logger/Logger.ts
1372
1407
  var import_pino = __toESM(require("pino"));
@@ -1564,54 +1599,54 @@ var getLastHumanMessageData = (messages) => {
1564
1599
  var import_tools7 = require("@langchain/core/tools");
1565
1600
 
1566
1601
  // src/util/PGMemory.ts
1567
- var import_langgraph4 = require("@langchain/langgraph");
1602
+ var import_langgraph6 = require("@langchain/langgraph");
1568
1603
  var import_langgraph_checkpoint_postgres = require("@langchain/langgraph-checkpoint-postgres");
1569
1604
  var globalMemory = import_langgraph_checkpoint_postgres.PostgresSaver.fromConnString(process.env.DATABASE_URL);
1570
- var memory = new import_langgraph4.MemorySaver();
1605
+ var memory2 = new import_langgraph6.MemorySaver();
1571
1606
  var _MemoryManager = class _MemoryManager {
1572
1607
  static getInstance() {
1573
1608
  return _MemoryManager.instance;
1574
1609
  }
1575
1610
  };
1576
- _MemoryManager.instance = memory;
1611
+ _MemoryManager.instance = memory2;
1577
1612
  var MemoryManager = _MemoryManager;
1578
1613
 
1579
1614
  // src/createPlanExecuteAgent.ts
1580
1615
  var import_prebuilt4 = require("@langchain/langgraph/prebuilt");
1581
- var PlanExecuteState = import_langgraph5.Annotation.Root({
1616
+ var PlanExecuteState = import_langgraph7.Annotation.Root({
1582
1617
  // 输入
1583
- input: (0, import_langgraph5.Annotation)({
1618
+ input: (0, import_langgraph7.Annotation)({
1584
1619
  reducer: (x, y) => y ?? x ?? ""
1585
1620
  }),
1586
1621
  // 计划步骤列表
1587
- plan: (0, import_langgraph5.Annotation)({
1622
+ plan: (0, import_langgraph7.Annotation)({
1588
1623
  reducer: (x, y) => y ?? x ?? []
1589
1624
  }),
1590
1625
  // 已执行的步骤 [步骤名称, 执行结果]
1591
- pastSteps: (0, import_langgraph5.Annotation)({
1626
+ pastSteps: (0, import_langgraph7.Annotation)({
1592
1627
  reducer: (x, y) => x.concat(y),
1593
1628
  default: () => []
1594
1629
  }),
1595
1630
  // 最终响应
1596
- response: (0, import_langgraph5.Annotation)({
1631
+ response: (0, import_langgraph7.Annotation)({
1597
1632
  reducer: (x, y) => y ?? x
1598
1633
  }),
1599
1634
  // 错误信息
1600
- error: (0, import_langgraph5.Annotation)({
1635
+ error: (0, import_langgraph7.Annotation)({
1601
1636
  reducer: (x, y) => y ?? x
1602
1637
  }),
1603
1638
  // 继承基础状态
1604
- "x-tenant-id": (0, import_langgraph5.Annotation)(),
1605
- messages: (0, import_langgraph5.Annotation)({
1606
- reducer: import_langgraph5.messagesStateReducer,
1639
+ "x-tenant-id": (0, import_langgraph7.Annotation)(),
1640
+ messages: (0, import_langgraph7.Annotation)({
1641
+ reducer: import_langgraph7.messagesStateReducer,
1607
1642
  default: () => []
1608
1643
  })
1609
1644
  });
1610
- var planSchema = import_zod8.z.object({
1611
- steps: import_zod8.z.array(import_zod8.z.string()).describe("\u9700\u8981\u6267\u884C\u7684\u6B65\u9AA4\u5217\u8868\uFF0C\u5E94\u6309\u7167\u6267\u884C\u987A\u5E8F\u6392\u5E8F")
1645
+ var planSchema = import_zod10.z.object({
1646
+ steps: import_zod10.z.array(import_zod10.z.string()).describe("\u9700\u8981\u6267\u884C\u7684\u6B65\u9AA4\u5217\u8868\uFF0C\u5E94\u6309\u7167\u6267\u884C\u987A\u5E8F\u6392\u5E8F")
1612
1647
  });
1613
- var responseSchema = import_zod8.z.object({
1614
- response: import_zod8.z.string().describe("\u7ED9\u7528\u6237\u7684\u6700\u7EC8\u54CD\u5E94\uFF0C\u5982\u679C\u4E0D\u9700\u8981\u6267\u884C\u6B65\u9AA4\uFF0C\u5219\u8FD4\u56DE\u8FD9\u4E2A\u5B57\u6BB5")
1648
+ var responseSchema = import_zod10.z.object({
1649
+ response: import_zod10.z.string().describe("\u7ED9\u7528\u6237\u7684\u6700\u7EC8\u54CD\u5E94\uFF0C\u5982\u679C\u4E0D\u9700\u8981\u6267\u884C\u6B65\u9AA4\uFF0C\u5219\u8FD4\u56DE\u8FD9\u4E2A\u5B57\u6BB5")
1615
1650
  });
1616
1651
  function createPlanExecuteAgent(config) {
1617
1652
  const {
@@ -1703,7 +1738,7 @@ ${executorTools.map((tool5) => tool5.name).join("\n")}
1703
1738
  error: void 0
1704
1739
  };
1705
1740
  } catch (error) {
1706
- if (error instanceof import_langgraph5.GraphInterrupt) {
1741
+ if (error instanceof import_langgraph7.GraphInterrupt) {
1707
1742
  throw error;
1708
1743
  }
1709
1744
  const errorMsg = `\u4EFB\u52A1\u6267\u884C\u5931\u8D25: ${error instanceof Error ? error.message : "\u672A\u77E5\u9519\u8BEF"}`;
@@ -1796,7 +1831,7 @@ Only add steps to the plan that still NEED to be done. Do not return previously
1796
1831
  };
1797
1832
  }
1798
1833
  } catch (error) {
1799
- if (error instanceof import_langgraph5.GraphInterrupt) {
1834
+ if (error instanceof import_langgraph7.GraphInterrupt) {
1800
1835
  throw error;
1801
1836
  }
1802
1837
  const errorMsg = `\u91CD\u65B0\u89C4\u5212\u5931\u8D25: ${error instanceof Error ? error.message : "\u672A\u77E5\u9519\u8BEF"}`;
@@ -1828,8 +1863,8 @@ Only add steps to the plan that still NEED to be done. Do not return previously
1828
1863
  }
1829
1864
  return "continue";
1830
1865
  }
1831
- const workflow = new import_langgraph5.StateGraph(PlanExecuteState).addNode("planner", planStep).addNode("executor", executeStep).addNode("replanner", replanStep).addEdge(import_langgraph5.START, "planner").addEdge("planner", "executor").addEdge("executor", "replanner").addConditionalEdges("replanner", shouldEnd, {
1832
- end: import_langgraph5.END,
1866
+ const workflow = new import_langgraph7.StateGraph(PlanExecuteState).addNode("planner", planStep).addNode("executor", executeStep).addNode("replanner", replanStep).addEdge(import_langgraph7.START, "planner").addEdge("planner", "executor").addEdge("executor", "replanner").addConditionalEdges("replanner", shouldEnd, {
1867
+ end: import_langgraph7.END,
1833
1868
  continue: "executor"
1834
1869
  });
1835
1870
  const compiledGraph = workflow.compile({
@@ -2009,7 +2044,8 @@ var AgentParamsBuilder = class {
2009
2044
  tools,
2010
2045
  model,
2011
2046
  subAgents,
2012
- prompt: agentLattice.config.prompt
2047
+ prompt: agentLattice.config.prompt,
2048
+ stateSchema: agentLattice.config.schema
2013
2049
  };
2014
2050
  }
2015
2051
  };
@@ -2155,11 +2191,6 @@ var getAllAgentConfigs = () => agentLatticeManager.getAllAgentConfigs();
2155
2191
  var validateAgentInput = (key, input) => agentLatticeManager.validateAgentInput(key, input);
2156
2192
  var getAgentClient = (key, options) => agentLatticeManager.initializeClient(key, options);
2157
2193
 
2158
- // src/memory_lattice/DefaultMemorySaver.ts
2159
- var import_langgraph6 = require("@langchain/langgraph");
2160
- var memory2 = new import_langgraph6.MemorySaver();
2161
- registerCheckpointSaver("default", memory2);
2162
-
2163
2194
  // src/index.ts
2164
2195
  var Protocols = __toESM(require("@axiom-lattice/protocols"));
2165
2196
  // Annotate the CommonJS export names for ESM import in node:
@@ -2172,18 +2203,26 @@ var Protocols = __toESM(require("@axiom-lattice/protocols"));
2172
2203
  MemoryType,
2173
2204
  ModelLatticeManager,
2174
2205
  Protocols,
2206
+ ToolLatticeManager,
2175
2207
  agentLatticeManager,
2176
2208
  getAgentClient,
2177
2209
  getAgentConfig,
2178
2210
  getAgentLattice,
2179
2211
  getAllAgentConfigs,
2212
+ getAllToolDefinitions,
2180
2213
  getCheckpointSaver,
2181
2214
  getModelLattice,
2215
+ getToolClient,
2216
+ getToolDefinition,
2217
+ getToolLattice,
2182
2218
  modelLatticeManager,
2183
2219
  registerAgentLattice,
2184
2220
  registerAgentLattices,
2185
2221
  registerCheckpointSaver,
2186
2222
  registerModelLattice,
2187
- validateAgentInput
2223
+ registerToolLattice,
2224
+ toolLatticeManager,
2225
+ validateAgentInput,
2226
+ validateToolInput
2188
2227
  });
2189
2228
  //# sourceMappingURL=index.js.map