@axiom-lattice/core 2.1.2 → 2.1.4

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
@@ -30,20 +30,26 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ AGENT_TASK_EVENT: () => AGENT_TASK_EVENT,
33
34
  AgentConfig: () => import_protocols.AgentConfig,
34
35
  AgentLatticeManager: () => AgentLatticeManager,
36
+ AgentManager: () => AgentManager,
35
37
  AgentType: () => import_protocols.AgentType,
36
38
  ChunkBuffer: () => ChunkBuffer,
37
39
  ChunkBufferLatticeManager: () => ChunkBufferLatticeManager,
38
40
  GraphBuildOptions: () => import_protocols.GraphBuildOptions,
39
41
  InMemoryChunkBuffer: () => InMemoryChunkBuffer,
40
42
  MemoryLatticeManager: () => MemoryLatticeManager,
43
+ MemoryQueueClient: () => MemoryQueueClient,
41
44
  MemoryType: () => import_protocols2.MemoryType,
42
45
  ModelLatticeManager: () => ModelLatticeManager,
43
46
  Protocols: () => Protocols,
47
+ QueueLatticeManager: () => QueueLatticeManager,
44
48
  ThreadStatus: () => ThreadStatus,
45
49
  ToolLatticeManager: () => ToolLatticeManager,
46
50
  agentLatticeManager: () => agentLatticeManager,
51
+ eventBus: () => eventBus,
52
+ eventBusDefault: () => event_bus_default,
47
53
  getAgentClient: () => getAgentClient,
48
54
  getAgentConfig: () => getAgentConfig,
49
55
  getAgentLattice: () => getAgentLattice,
@@ -52,16 +58,19 @@ __export(index_exports, {
52
58
  getCheckpointSaver: () => getCheckpointSaver,
53
59
  getChunkBuffer: () => getChunkBuffer,
54
60
  getModelLattice: () => getModelLattice,
61
+ getQueueLattice: () => getQueueLattice,
55
62
  getToolClient: () => getToolClient,
56
63
  getToolDefinition: () => getToolDefinition,
57
64
  getToolLattice: () => getToolLattice,
58
65
  hasChunkBuffer: () => hasChunkBuffer,
59
66
  modelLatticeManager: () => modelLatticeManager,
67
+ queueLatticeManager: () => queueLatticeManager,
60
68
  registerAgentLattice: () => registerAgentLattice,
61
69
  registerAgentLattices: () => registerAgentLattices,
62
70
  registerCheckpointSaver: () => registerCheckpointSaver,
63
71
  registerChunkBuffer: () => registerChunkBuffer,
64
72
  registerModelLattice: () => registerModelLattice,
73
+ registerQueueLattice: () => registerQueueLattice,
65
74
  registerToolLattice: () => registerToolLattice,
66
75
  toolLatticeManager: () => toolLatticeManager,
67
76
  validateAgentInput: () => validateAgentInput,
@@ -627,7 +636,7 @@ registerToolLattice(
627
636
  {
628
637
  name: "internet_search",
629
638
  description: "Run a web search",
630
- needUserApprove: false,
639
+ needUserApprove: true,
631
640
  schema: import_zod2.default.object({
632
641
  query: import_zod2.default.string().describe("The search query"),
633
642
  maxResults: import_zod2.default.number().optional().default(5).describe("Maximum number of results to return"),
@@ -1519,8 +1528,402 @@ ${systemPrompt}` : systemPrompt;
1519
1528
  // src/deep_agent_new/middleware/subagents.ts
1520
1529
  var import_v32 = require("zod/v3");
1521
1530
  var import_langchain3 = require("langchain");
1522
- var import_langgraph5 = require("@langchain/langgraph");
1531
+ var import_langgraph6 = require("@langchain/langgraph");
1523
1532
  var import_messages = require("@langchain/core/messages");
1533
+
1534
+ // src/agent_worker/agent_worker_graph.ts
1535
+ var import_langgraph5 = require("@langchain/langgraph");
1536
+
1537
+ // src/constants/agent_task_types.ts
1538
+ var AGENT_TASK_EVENT = "agent:execute";
1539
+
1540
+ // src/services/event_bus.ts
1541
+ var import_events = require("events");
1542
+
1543
+ // src/queue_lattice/QueueLatticeManager.ts
1544
+ var import_protocols3 = require("@axiom-lattice/protocols");
1545
+
1546
+ // src/queue_lattice/MemoryQueueClient.ts
1547
+ var queues = /* @__PURE__ */ new Map();
1548
+ var ensureQueue = (queueName) => {
1549
+ if (!queues.has(queueName)) {
1550
+ queues.set(queueName, []);
1551
+ }
1552
+ };
1553
+ var MemoryQueueClient = class {
1554
+ constructor(queueName = "tasks") {
1555
+ this.queueName = queueName;
1556
+ ensureQueue(this.queueName);
1557
+ }
1558
+ /**
1559
+ * Enqueue message (equivalent to lPush - push to left/beginning)
1560
+ */
1561
+ async push(item) {
1562
+ try {
1563
+ ensureQueue(this.queueName);
1564
+ const queue = queues.get(this.queueName);
1565
+ queue.unshift(item);
1566
+ const result = queue.length;
1567
+ console.log("lPush (memory)", result);
1568
+ return { data: result, error: null };
1569
+ } catch (error) {
1570
+ console.error(error);
1571
+ return { data: null, error };
1572
+ }
1573
+ }
1574
+ /**
1575
+ * Dequeue message (equivalent to rPop - pop from right/end)
1576
+ */
1577
+ async pop() {
1578
+ try {
1579
+ ensureQueue(this.queueName);
1580
+ const queue = queues.get(this.queueName);
1581
+ const message = queue.pop();
1582
+ if (message) {
1583
+ return { data: message, error: null };
1584
+ }
1585
+ return { data: null, error: null };
1586
+ } catch (error) {
1587
+ console.error(error);
1588
+ return { data: null, error };
1589
+ }
1590
+ }
1591
+ /**
1592
+ * Create queue (initialize in memory)
1593
+ */
1594
+ async createQueue() {
1595
+ try {
1596
+ ensureQueue(this.queueName);
1597
+ const queue = queues.get(this.queueName);
1598
+ const exists = queue !== void 0;
1599
+ return { success: true, queue_name: this.queueName };
1600
+ } catch (error) {
1601
+ console.error(error);
1602
+ return { success: false, error };
1603
+ }
1604
+ }
1605
+ };
1606
+
1607
+ // src/queue_lattice/QueueLatticeManager.ts
1608
+ var QueueLatticeManager = class _QueueLatticeManager extends BaseLatticeManager {
1609
+ /**
1610
+ * Get QueueLatticeManager singleton instance
1611
+ */
1612
+ static getInstance() {
1613
+ if (!_QueueLatticeManager._instance) {
1614
+ _QueueLatticeManager._instance = new _QueueLatticeManager();
1615
+ }
1616
+ return _QueueLatticeManager._instance;
1617
+ }
1618
+ /**
1619
+ * Get Lattice type prefix
1620
+ */
1621
+ getLatticeType() {
1622
+ return "queues";
1623
+ }
1624
+ /**
1625
+ * Register queue Lattice
1626
+ * @param key Lattice key name
1627
+ * @param config Queue configuration
1628
+ * @param client Optional queue client. If not provided, will create based on config type.
1629
+ * For REDIS type, client must be provided (use @axiom-lattice/queue-redis).
1630
+ */
1631
+ registerLattice(key, config, client) {
1632
+ let queueClient;
1633
+ if (client) {
1634
+ queueClient = client;
1635
+ } else {
1636
+ const queueName = config.queueName || process.env.QUEUE_NAME || "tasks";
1637
+ if (config.type === import_protocols3.QueueType.REDIS) {
1638
+ throw new Error(
1639
+ `Redis queue client must be provided. Please install @axiom-lattice/queue-redis and pass the client to registerLattice. Example: registerLattice(key, config, new RedisQueueClient(queueName, options))`
1640
+ );
1641
+ } else {
1642
+ queueClient = new MemoryQueueClient(queueName);
1643
+ }
1644
+ }
1645
+ const queueLattice = {
1646
+ key,
1647
+ config,
1648
+ client: queueClient,
1649
+ push: async (item) => {
1650
+ return queueClient.push(item);
1651
+ },
1652
+ pop: async () => {
1653
+ return queueClient.pop();
1654
+ },
1655
+ createQueue: queueClient.createQueue ? async () => {
1656
+ return queueClient.createQueue();
1657
+ } : void 0
1658
+ };
1659
+ this.register(key, queueLattice);
1660
+ }
1661
+ /**
1662
+ * Get QueueLattice
1663
+ * @param key Lattice key name
1664
+ */
1665
+ getQueueLattice(key) {
1666
+ const queueLattice = this.get(key);
1667
+ if (!queueLattice) {
1668
+ throw new Error(`QueueLattice ${key} not found`);
1669
+ }
1670
+ return queueLattice;
1671
+ }
1672
+ /**
1673
+ * Get all Lattices
1674
+ */
1675
+ getAllLattices() {
1676
+ return this.getAll();
1677
+ }
1678
+ /**
1679
+ * Check if Lattice exists
1680
+ * @param key Lattice key name
1681
+ */
1682
+ hasLattice(key) {
1683
+ return this.has(key);
1684
+ }
1685
+ /**
1686
+ * Remove Lattice
1687
+ * @param key Lattice key name
1688
+ */
1689
+ removeLattice(key) {
1690
+ return this.remove(key);
1691
+ }
1692
+ /**
1693
+ * Clear all Lattices
1694
+ */
1695
+ clearLattices() {
1696
+ this.clear();
1697
+ }
1698
+ /**
1699
+ * Get Lattice count
1700
+ */
1701
+ getLatticeCount() {
1702
+ return this.count();
1703
+ }
1704
+ /**
1705
+ * Get Lattice key list
1706
+ */
1707
+ getLatticeKeys() {
1708
+ return this.keys();
1709
+ }
1710
+ };
1711
+ var queueLatticeManager = QueueLatticeManager.getInstance();
1712
+ var registerQueueLattice = (key, config, client) => queueLatticeManager.registerLattice(key, config, client);
1713
+ var getQueueLattice = (key) => queueLatticeManager.getQueueLattice(key);
1714
+
1715
+ // src/services/event_bus.ts
1716
+ var EventBus = class {
1717
+ constructor() {
1718
+ this.defaultQueueKey = "default";
1719
+ this.emitter = new import_events.EventEmitter();
1720
+ this.emitter.setMaxListeners(100);
1721
+ }
1722
+ /**
1723
+ * Set the default queue key for queue operations
1724
+ * @param queueKey Queue key name
1725
+ */
1726
+ setDefaultQueueKey(queueKey) {
1727
+ this.defaultQueueKey = queueKey;
1728
+ }
1729
+ /**
1730
+ * Publish event
1731
+ * @param eventName Event name
1732
+ * @param data Event data
1733
+ * @param useQueue Whether to use queue for publishing
1734
+ */
1735
+ publish(eventName, data, useQueue = false) {
1736
+ if (useQueue) {
1737
+ if (queueLatticeManager.hasLattice(this.defaultQueueKey)) {
1738
+ const queue = queueLatticeManager.getQueueLattice(this.defaultQueueKey);
1739
+ queue.push(data).catch((error) => {
1740
+ console.error("Failed to push event to queue:", error);
1741
+ });
1742
+ } else {
1743
+ console.warn(
1744
+ `Queue "${this.defaultQueueKey}" not found. Event will not be queued.`
1745
+ );
1746
+ }
1747
+ } else {
1748
+ this.emitter.emit(eventName, data);
1749
+ }
1750
+ }
1751
+ /**
1752
+ * Subscribe to event
1753
+ * @param eventName Event name
1754
+ * @param callback Callback function
1755
+ */
1756
+ subscribe(eventName, callback) {
1757
+ this.emitter.on(eventName, callback);
1758
+ }
1759
+ /**
1760
+ * Unsubscribe from event
1761
+ * @param eventName Event name
1762
+ * @param callback Callback function
1763
+ */
1764
+ unsubscribe(eventName, callback) {
1765
+ this.emitter.off(eventName, callback);
1766
+ }
1767
+ /**
1768
+ * Subscribe to event once
1769
+ * @param eventName Event name
1770
+ * @param callback Callback function
1771
+ */
1772
+ subscribeOnce(eventName, callback) {
1773
+ this.emitter.once(eventName, callback);
1774
+ }
1775
+ };
1776
+ var eventBus = new EventBus();
1777
+ var event_bus_default = eventBus;
1778
+
1779
+ // src/services/AgentManager.ts
1780
+ var AgentManager = class _AgentManager {
1781
+ constructor() {
1782
+ this.agents = [];
1783
+ }
1784
+ static getInstance() {
1785
+ if (!_AgentManager.instance) {
1786
+ _AgentManager.instance = new _AgentManager();
1787
+ }
1788
+ return _AgentManager.instance;
1789
+ }
1790
+ callAgentInQueue(queue, return_agent_state) {
1791
+ return new Promise((resolve, reject) => {
1792
+ const callback_event = `${queue.assistant_id}::${queue.thread_id}`;
1793
+ if (return_agent_state) {
1794
+ event_bus_default.subscribeOnce(callback_event, (data) => {
1795
+ if (data.success) {
1796
+ console.log("AgentManager callAgentInQueue success", data);
1797
+ resolve(data.state);
1798
+ } else {
1799
+ console.log("AgentManager callAgentInQueue error", data);
1800
+ reject(data.error);
1801
+ }
1802
+ });
1803
+ }
1804
+ try {
1805
+ event_bus_default.publish(
1806
+ AGENT_TASK_EVENT,
1807
+ {
1808
+ ...queue,
1809
+ callback_event
1810
+ },
1811
+ true
1812
+ );
1813
+ !return_agent_state && resolve({ callback_event_id: callback_event, success: true });
1814
+ } catch (error) {
1815
+ !return_agent_state && reject({
1816
+ callback_event_id: callback_event,
1817
+ success: false,
1818
+ error
1819
+ });
1820
+ }
1821
+ });
1822
+ }
1823
+ };
1824
+
1825
+ // src/agent_worker/agent_worker_graph.ts
1826
+ var AgentWorkerState = import_langgraph5.Annotation.Root({
1827
+ // Input parameters
1828
+ assistant_id: (0, import_langgraph5.Annotation)({
1829
+ reducer: (x, y) => y ?? x,
1830
+ default: () => ""
1831
+ }),
1832
+ thread_id: (0, import_langgraph5.Annotation)({
1833
+ reducer: (x, y) => y ?? x,
1834
+ default: () => ""
1835
+ }),
1836
+ input: (0, import_langgraph5.Annotation)({
1837
+ reducer: (x, y) => y ?? x,
1838
+ default: () => ({})
1839
+ }),
1840
+ command2: (0, import_langgraph5.Annotation)({
1841
+ reducer: (x, y) => y ?? x,
1842
+ default: () => void 0
1843
+ }),
1844
+ // Execution result
1845
+ result: (0, import_langgraph5.Annotation)({
1846
+ reducer: (x, y) => y ?? x,
1847
+ default: () => void 0
1848
+ }),
1849
+ // Interrupt data
1850
+ interruptValue: (0, import_langgraph5.Annotation)({
1851
+ reducer: (x, y) => y ?? x,
1852
+ default: () => void 0
1853
+ }),
1854
+ // Final state to return
1855
+ finalState: (0, import_langgraph5.Annotation)({
1856
+ reducer: (x, y) => y ?? x,
1857
+ default: () => void 0
1858
+ })
1859
+ });
1860
+ async function executeNode(state) {
1861
+ const { assistant_id, thread_id, input, command2 } = state;
1862
+ const callParams = {
1863
+ assistant_id,
1864
+ thread_id,
1865
+ input,
1866
+ command: command2
1867
+ };
1868
+ const result = await AgentManager.getInstance().callAgentInQueue(
1869
+ callParams,
1870
+ true
1871
+ );
1872
+ return {
1873
+ result
1874
+ };
1875
+ }
1876
+ async function interruptNode(state) {
1877
+ const { result } = state;
1878
+ const interruptValue = result?.tasks?.[0]?.interrupts?.[0]?.value;
1879
+ if (!interruptValue) {
1880
+ throw new Error(
1881
+ "Interrupt node called but no interrupt value found in result"
1882
+ );
1883
+ }
1884
+ const response = await (0, import_langgraph5.interrupt)(interruptValue);
1885
+ return {
1886
+ command2: {
1887
+ resume: response
1888
+ }
1889
+ };
1890
+ }
1891
+ function shouldInterrupt(state) {
1892
+ const { result } = state;
1893
+ if (result?.tasks && Array.isArray(result.tasks) && result.tasks.length > 0) {
1894
+ if (result.tasks[0]?.interrupts && result.tasks[0].interrupts.length > 0) {
1895
+ return "interrupt";
1896
+ }
1897
+ }
1898
+ return "end";
1899
+ }
1900
+ function endNode(state) {
1901
+ const finalState = state.result;
1902
+ return {
1903
+ finalState,
1904
+ // Clear intermediate states
1905
+ result: void 0,
1906
+ interruptValue: void 0,
1907
+ command2: void 0
1908
+ };
1909
+ }
1910
+ function createAgentWorkerGraph() {
1911
+ const workflow = new import_langgraph5.StateGraph(AgentWorkerState);
1912
+ workflow.addNode("execute", executeNode);
1913
+ workflow.addNode("interrupt", interruptNode);
1914
+ workflow.addNode("end", endNode);
1915
+ workflow.setEntryPoint("execute");
1916
+ workflow.addConditionalEdges("execute", shouldInterrupt, {
1917
+ interrupt: "interrupt",
1918
+ end: "end"
1919
+ });
1920
+ workflow.addEdge("interrupt", "execute");
1921
+ workflow.addEdge("end", import_langgraph5.END);
1922
+ return workflow.compile();
1923
+ }
1924
+ var agentWorkerGraph = createAgentWorkerGraph();
1925
+
1926
+ // src/deep_agent_new/middleware/subagents.ts
1524
1927
  var DEFAULT_SUBAGENT_PROMPT = "In order to complete the objective that the user asks of you, you have access to a number of standard tools.";
1525
1928
  var EXCLUDED_STATE_KEYS = ["messages", "todos", "jumpTo"];
1526
1929
  var DEFAULT_GENERAL_PURPOSE_DESCRIPTION = "General-purpose agent for researching complex questions, searching for files and content, and executing multi-step tasks. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries use this agent to perform the search for you. This agent has access to all tools as the main agent.";
@@ -1677,7 +2080,7 @@ function returnCommandWithStateUpdate(result, toolCallId) {
1677
2080
  const stateUpdate = filterStateForSubagent(result);
1678
2081
  const messages = result.messages;
1679
2082
  const lastMessage = messages?.[messages.length - 1];
1680
- return new import_langgraph5.Command({
2083
+ return new import_langgraph6.Command({
1681
2084
  update: {
1682
2085
  ...stateUpdate,
1683
2086
  messages: [
@@ -1770,10 +2173,18 @@ function createTaskTool(options) {
1770
2173
  );
1771
2174
  }
1772
2175
  const subagent = subagentGraphs[subagent_type];
1773
- const currentState = (0, import_langgraph5.getCurrentTaskInput)();
2176
+ const currentState = (0, import_langgraph6.getCurrentTaskInput)();
1774
2177
  const subagentState = filterStateForSubagent(currentState);
1775
2178
  subagentState.messages = [new import_messages.HumanMessage({ content: description })];
1776
- const result = await subagent.invoke(subagentState, config);
2179
+ const subagent_thread_id = config.configurable?.thread_id + "_" + subagent_type + "_" + config.toolCall.id;
2180
+ console.log(subagent_thread_id);
2181
+ const workerResult = await agentWorkerGraph.invoke({
2182
+ assistant_id: subagent_type,
2183
+ thread_id: subagent_thread_id,
2184
+ input: { ...subagentState, message: description }
2185
+ });
2186
+ const result = workerResult.finalState?.values;
2187
+ console.log("workerResult", workerResult);
1777
2188
  if (!config.toolCall?.id) {
1778
2189
  throw new Error("Tool call ID is required for subagent invocation");
1779
2190
  }
@@ -1835,7 +2246,7 @@ ${systemPrompt}` : systemPrompt;
1835
2246
  // src/deep_agent_new/middleware/patch_tool_calls.ts
1836
2247
  var import_langchain4 = require("langchain");
1837
2248
  var import_messages2 = require("@langchain/core/messages");
1838
- var import_langgraph6 = require("@langchain/langgraph");
2249
+ var import_langgraph7 = require("@langchain/langgraph");
1839
2250
  function createPatchToolCallsMiddleware() {
1840
2251
  return (0, import_langchain4.createMiddleware)({
1841
2252
  name: "patchToolCallsMiddleware",
@@ -1868,7 +2279,7 @@ function createPatchToolCallsMiddleware() {
1868
2279
  }
1869
2280
  return {
1870
2281
  messages: [
1871
- new import_messages2.RemoveMessage({ id: import_langgraph6.REMOVE_ALL_MESSAGES }),
2282
+ new import_messages2.RemoveMessage({ id: import_langgraph7.REMOVE_ALL_MESSAGES }),
1872
2283
  ...patchedMessages
1873
2284
  ]
1874
2285
  };
@@ -1883,7 +2294,7 @@ var import_micromatch2 = __toESM(require("micromatch"));
1883
2294
  var SUPPORTS_NOFOLLOW = fsSync.constants.O_NOFOLLOW !== void 0;
1884
2295
 
1885
2296
  // src/deep_agent_new/middleware/todos.ts
1886
- var import_langgraph7 = require("@langchain/langgraph");
2297
+ var import_langgraph8 = require("@langchain/langgraph");
1887
2298
  var import_zod5 = require("zod");
1888
2299
  var import_langchain5 = require("langchain");
1889
2300
  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.
@@ -2121,7 +2532,7 @@ var stateSchema = import_zod5.z.object({ todos: import_zod5.z.array(TodoSchema).
2121
2532
  function todoListMiddleware(options) {
2122
2533
  const writeTodos = (0, import_langchain5.tool)(
2123
2534
  ({ todos }, config) => {
2124
- return new import_langgraph7.Command({
2535
+ return new import_langgraph8.Command({
2125
2536
  update: {
2126
2537
  todos,
2127
2538
  messages: [
@@ -2329,7 +2740,7 @@ var AgentGraphBuilderFactory = class _AgentGraphBuilderFactory {
2329
2740
  };
2330
2741
 
2331
2742
  // src/agent_lattice/builders/AgentParamsBuilder.ts
2332
- var import_protocols3 = require("@axiom-lattice/protocols");
2743
+ var import_protocols4 = require("@axiom-lattice/protocols");
2333
2744
  var AgentParamsBuilder = class {
2334
2745
  /**
2335
2746
  * constructor
@@ -2347,7 +2758,7 @@ var AgentParamsBuilder = class {
2347
2758
  * @returns Agent build parameters
2348
2759
  */
2349
2760
  buildParams(agentLattice, options) {
2350
- const toolKeys = options?.overrideTools || (0, import_protocols3.getToolsFromConfig)(agentLattice.config);
2761
+ const toolKeys = options?.overrideTools || (0, import_protocols4.getToolsFromConfig)(agentLattice.config);
2351
2762
  const tools = toolKeys.map((toolKey) => {
2352
2763
  const toolLattice = toolLatticeManager.getToolLattice(toolKey);
2353
2764
  if (!toolLattice) {
@@ -2364,7 +2775,7 @@ var AgentParamsBuilder = class {
2364
2775
  if (!model) {
2365
2776
  throw new Error(`Model "${modelKey}" does not exist`);
2366
2777
  }
2367
- const subAgentKeys = (0, import_protocols3.getSubAgentsFromConfig)(agentLattice.config);
2778
+ const subAgentKeys = (0, import_protocols4.getSubAgentsFromConfig)(agentLattice.config);
2368
2779
  const subAgents = subAgentKeys.map((agentKey) => {
2369
2780
  const subAgentLattice = this.getAgentLatticeFunc(agentKey);
2370
2781
  if (!subAgentLattice) {
@@ -2377,7 +2788,7 @@ var AgentParamsBuilder = class {
2377
2788
  };
2378
2789
  });
2379
2790
  let internalSubAgents = [];
2380
- if ((0, import_protocols3.isDeepAgentConfig)(agentLattice.config)) {
2791
+ if ((0, import_protocols4.isDeepAgentConfig)(agentLattice.config)) {
2381
2792
  internalSubAgents = agentLattice.config.internalSubAgents?.map((i) => ({
2382
2793
  key: i.key,
2383
2794
  config: i
@@ -2872,20 +3283,26 @@ var hasChunkBuffer = (key) => ChunkBufferLatticeManager.getInstance().has(key);
2872
3283
  var Protocols = __toESM(require("@axiom-lattice/protocols"));
2873
3284
  // Annotate the CommonJS export names for ESM import in node:
2874
3285
  0 && (module.exports = {
3286
+ AGENT_TASK_EVENT,
2875
3287
  AgentConfig,
2876
3288
  AgentLatticeManager,
3289
+ AgentManager,
2877
3290
  AgentType,
2878
3291
  ChunkBuffer,
2879
3292
  ChunkBufferLatticeManager,
2880
3293
  GraphBuildOptions,
2881
3294
  InMemoryChunkBuffer,
2882
3295
  MemoryLatticeManager,
3296
+ MemoryQueueClient,
2883
3297
  MemoryType,
2884
3298
  ModelLatticeManager,
2885
3299
  Protocols,
3300
+ QueueLatticeManager,
2886
3301
  ThreadStatus,
2887
3302
  ToolLatticeManager,
2888
3303
  agentLatticeManager,
3304
+ eventBus,
3305
+ eventBusDefault,
2889
3306
  getAgentClient,
2890
3307
  getAgentConfig,
2891
3308
  getAgentLattice,
@@ -2894,16 +3311,19 @@ var Protocols = __toESM(require("@axiom-lattice/protocols"));
2894
3311
  getCheckpointSaver,
2895
3312
  getChunkBuffer,
2896
3313
  getModelLattice,
3314
+ getQueueLattice,
2897
3315
  getToolClient,
2898
3316
  getToolDefinition,
2899
3317
  getToolLattice,
2900
3318
  hasChunkBuffer,
2901
3319
  modelLatticeManager,
3320
+ queueLatticeManager,
2902
3321
  registerAgentLattice,
2903
3322
  registerAgentLattices,
2904
3323
  registerCheckpointSaver,
2905
3324
  registerChunkBuffer,
2906
3325
  registerModelLattice,
3326
+ registerQueueLattice,
2907
3327
  registerToolLattice,
2908
3328
  toolLatticeManager,
2909
3329
  validateAgentInput,