@axiom-lattice/core 2.1.26 → 2.1.28

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.mjs CHANGED
@@ -508,11 +508,11 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
508
508
  * @param key Lattice键名
509
509
  * @param tool 已有的StructuredTool实例
510
510
  */
511
- registerExistingTool(key, tool46) {
511
+ registerExistingTool(key, tool47) {
512
512
  const config = {
513
- name: tool46.name,
514
- description: tool46.description,
515
- schema: tool46.schema,
513
+ name: tool47.name,
514
+ description: tool47.description,
515
+ schema: tool47.schema,
516
516
  // StructuredTool的schema已经是Zod兼容的
517
517
  needUserApprove: false
518
518
  // MCP工具默认不需要用户批准
@@ -520,7 +520,7 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
520
520
  const toolLattice = {
521
521
  key,
522
522
  config,
523
- client: tool46
523
+ client: tool47
524
524
  };
525
525
  this.register(key, toolLattice);
526
526
  }
@@ -546,7 +546,7 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
546
546
  };
547
547
  var toolLatticeManager = ToolLatticeManager.getInstance();
548
548
  var registerToolLattice = (key, config, executor) => toolLatticeManager.registerLattice(key, config, executor);
549
- var registerExistingTool = (key, tool46) => toolLatticeManager.registerExistingTool(key, tool46);
549
+ var registerExistingTool = (key, tool47) => toolLatticeManager.registerExistingTool(key, tool47);
550
550
  var getToolLattice = (key) => toolLatticeManager.getToolLattice(key);
551
551
  var getToolDefinition = (key) => toolLatticeManager.getToolDefinition(key);
552
552
  var getToolClient = (key) => toolLatticeManager.getToolClient(key);
@@ -1434,6 +1434,28 @@ var SemanticMetricsClient = class {
1434
1434
  }
1435
1435
  return data.data;
1436
1436
  }
1437
+ /**
1438
+ * Execute a custom SQL query
1439
+ * POST /metrics/query
1440
+ */
1441
+ async executeSqlQuery(request) {
1442
+ const response = await fetch(`${this.baseUrl}/metrics/query`, {
1443
+ method: "POST",
1444
+ headers: {
1445
+ ...this.getHeaders(),
1446
+ "Content-Type": "application/json"
1447
+ },
1448
+ body: JSON.stringify(request)
1449
+ });
1450
+ if (!response.ok) {
1451
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`);
1452
+ }
1453
+ const data = await response.json();
1454
+ if (data.code !== 200) {
1455
+ throw new Error(`API error: ${data.message}`);
1456
+ }
1457
+ return data.data;
1458
+ }
1437
1459
  /**
1438
1460
  * Get selected data sources for this configuration
1439
1461
  */
@@ -1889,6 +1911,20 @@ ${serverKeys.map(
1889
1911
  return tool7(
1890
1912
  async (_input, _exeConfig) => {
1891
1913
  try {
1914
+ const runConfig = _exeConfig?.configurable?.runConfig || {};
1915
+ const metricsDataSource = runConfig.metricsDataSource;
1916
+ if (metricsDataSource) {
1917
+ const { serverKey, datasourceId } = metricsDataSource;
1918
+ return `\u2139\uFE0F **\u5F53\u524D\u5DF2\u9009\u4E2D\u6570\u636E\u6E90**
1919
+
1920
+ \u60A8\u5DF2\u901A\u8FC7\u754C\u9762\u9009\u4E2D\u4E86\u7279\u5B9A\u7684\u6570\u636E\u6E90\uFF0C\u6240\u6709 metrics \u67E5\u8BE2\u5C06\u4E13\u6CE8\u4E8E\uFF1A
1921
+ - **\u670D\u52A1\u5668**: ${serverKey}
1922
+ - **\u6570\u636E\u6E90ID**: ${datasourceId}
1923
+
1924
+ \u60A8\u53EF\u4EE5\u76F4\u63A5\u4F7F\u7528\u5176\u4ED6 metrics \u5DE5\u5177\uFF08\u5982 query_metrics_list\u3001query_semantic_metric_data \u7B49\uFF09\uFF0C\u65E0\u9700\u518D\u6307\u5B9A serverKey \u548C datasourceId \u53C2\u6570\u3002
1925
+
1926
+ \u5982\u9700\u67E5\u770B\u6240\u6709\u53EF\u7528\u7684\u6570\u636E\u6E90\uFF0C\u8BF7\u6E05\u9664\u5F53\u524D\u9009\u62E9\u6216\u91CD\u65B0\u6253\u5F00\u6570\u636E\u6E90\u9009\u62E9\u5668\u3002`;
1927
+ }
1892
1928
  if (serverKeys.length === 0) {
1893
1929
  return "No metrics servers configured.";
1894
1930
  }
@@ -1984,10 +2020,13 @@ ${serverKeys.map(
1984
2020
  ).join("\n")}` : "";
1985
2021
  return tool8(
1986
2022
  async ({
1987
- serverKey,
2023
+ serverKey: inputServerKey,
1988
2024
  datasourceIds
1989
2025
  }, _exeConfig) => {
1990
2026
  try {
2027
+ const runConfig = _exeConfig?.configurable?.runConfig || {};
2028
+ const metricsDataSource = runConfig.metricsDataSource;
2029
+ const serverKey = metricsDataSource?.serverKey || inputServerKey;
1991
2030
  if (!serverKey) {
1992
2031
  return "Error: serverKey parameter is required. Available servers: " + serverKeys.join(", ");
1993
2032
  }
@@ -1999,7 +2038,7 @@ ${serverKeys.map(
1999
2038
  return `Error: Server "${serverKey}" is not a semantic metrics server. This tool only works with semantic servers.`;
2000
2039
  }
2001
2040
  const client = metricsServerManager.getClient(serverKey);
2002
- const targetDatasourceIds = datasourceIds && datasourceIds.length > 0 ? datasourceIds : client.getSelectedDataSources();
2041
+ const targetDatasourceIds = datasourceIds && datasourceIds.length > 0 ? datasourceIds : metricsDataSource?.datasourceId ? [metricsDataSource.datasourceId] : client.getSelectedDataSources();
2003
2042
  if (targetDatasourceIds.length === 0) {
2004
2043
  return `Error: No data sources specified and no default data sources configured for server "${serverKey}".`;
2005
2044
  }
@@ -2047,7 +2086,7 @@ ${serverKeys.map(
2047
2086
  for (const dsId of sortedDatasourceIds) {
2048
2087
  const metrics = metricsByDatasource.get(dsId);
2049
2088
  const sortedMetrics = metrics.sort((a, b) => {
2050
- if (a.domain !== b.domain) {
2089
+ if (a.domain && a.domain !== b.domain) {
2051
2090
  return a.domain.localeCompare(b.domain);
2052
2091
  }
2053
2092
  return a.metricName.localeCompare(b.metricName);
@@ -2074,8 +2113,8 @@ ${serverKeys.map(
2074
2113
  name: "query_metrics_list",
2075
2114
  description: `${QUERY_METRICS_LIST_DESCRIPTION}${availableServersText}`,
2076
2115
  schema: z9.object({
2077
- serverKey: z9.string().describe(`Target semantic metrics server. Choose from: ${serverKeys.join(", ")}`),
2078
- datasourceIds: z9.array(z9.string()).optional().describe("Optional array of datasource IDs to query. If not provided, uses all selected datasources.")
2116
+ serverKey: z9.string().optional().describe(`Target semantic metrics server. Choose from: ${serverKeys.join(", ")}. Optional if configured in runConfig.metricsDataSource`),
2117
+ datasourceIds: z9.array(z9.string()).optional().describe("Optional array of datasource IDs to query. If not provided, uses all selected datasources or the one configured in runConfig.metricsDataSource.")
2079
2118
  })
2080
2119
  }
2081
2120
  );
@@ -2132,11 +2171,15 @@ ${serverKeys.map(
2132
2171
  ).join("\n")}` : "";
2133
2172
  return tool9(
2134
2173
  async ({
2135
- serverKey,
2174
+ serverKey: inputServerKey,
2136
2175
  metricName,
2137
- datasourceId
2176
+ datasourceId: inputDatasourceId
2138
2177
  }, _exeConfig) => {
2139
2178
  try {
2179
+ const runConfig = _exeConfig?.configurable?.runConfig || {};
2180
+ const metricsDataSource = runConfig.metricsDataSource;
2181
+ const serverKey = metricsDataSource?.serverKey || inputServerKey;
2182
+ const datasourceId = inputDatasourceId || metricsDataSource?.datasourceId;
2140
2183
  if (!serverKey) {
2141
2184
  return "Error: serverKey parameter is required. Available servers: " + serverKeys.join(", ");
2142
2185
  }
@@ -2195,12 +2238,20 @@ ${serverKeys.map(
2195
2238
  lines.push(foundDetail.description);
2196
2239
  lines.push("");
2197
2240
  if (foundDetail.defaultTimeContext) {
2241
+ const dtc = foundDetail.defaultTimeContext;
2198
2242
  lines.push(`## \u65F6\u95F4\u4E0A\u4E0B\u6587`);
2199
2243
  lines.push("");
2200
- lines.push(`- **\u65F6\u95F4\u7EF4\u5EA6**: ${foundDetail.defaultTimeContext.timeDimension} (${foundDetail.defaultTimeContext.label})`);
2201
- lines.push(`- **\u9ED8\u8BA4\u7C92\u5EA6**: ${foundDetail.defaultTimeContext.granularity}`);
2202
- lines.push(`- **\u9ED8\u8BA4\u7A97\u53E3**: ${foundDetail.defaultTimeContext.window}`);
2203
- lines.push(`- **\u652F\u6301\u7684\u7C92\u5EA6**: ${foundDetail.defaultTimeContext.supportedGrains.join("\u3001")}`);
2244
+ if (dtc.timeDimension) {
2245
+ lines.push(`- **\u65F6\u95F4\u7EF4\u5EA6**: ${dtc.timeDimension}${dtc.label ? ` (${dtc.label})` : ""}`);
2246
+ }
2247
+ if (dtc.granularity) {
2248
+ lines.push(`- **\u9ED8\u8BA4\u7C92\u5EA6**: ${dtc.granularity}`);
2249
+ }
2250
+ if (dtc.window) {
2251
+ lines.push(`- **\u9ED8\u8BA4\u7A97\u53E3**: ${dtc.window}`);
2252
+ }
2253
+ const grains = dtc.supportedGrains;
2254
+ lines.push(`- **\u652F\u6301\u7684\u7C92\u5EA6**: ${Array.isArray(grains) && grains.length > 0 ? grains.join("\u3001") : "\u672A\u914D\u7F6E"}`);
2204
2255
  lines.push("");
2205
2256
  }
2206
2257
  if (foundDetail.supportedDimensions && foundDetail.supportedDimensions.length > 0) {
@@ -2264,10 +2315,12 @@ ${serverKeys.map(
2264
2315
  const aiContext = foundDetail.aiAgentContext;
2265
2316
  lines.push(`## AI \u5206\u6790\u4E0A\u4E0B\u6587`);
2266
2317
  lines.push("");
2267
- lines.push(`### \u6307\u6807\u6781\u6027`);
2268
- lines.push("");
2269
- lines.push(aiContext.polarity === "positive" ? "\u6B63\u5411\u6307\u6807\uFF08\u8D8A\u9AD8\u8D8A\u597D\uFF09" : "\u8D1F\u5411\u6307\u6807\uFF08\u8D8A\u4F4E\u8D8A\u597D\uFF09");
2270
- lines.push("");
2318
+ if (aiContext.polarity) {
2319
+ lines.push(`### \u6307\u6807\u6781\u6027`);
2320
+ lines.push("");
2321
+ lines.push(aiContext.polarity === "positive" ? "\u6B63\u5411\u6307\u6807\uFF08\u8D8A\u9AD8\u8D8A\u597D\uFF09" : "\u8D1F\u5411\u6307\u6807\uFF08\u8D8A\u4F4E\u8D8A\u597D\uFF09");
2322
+ lines.push("");
2323
+ }
2271
2324
  if (aiContext.synonyms && aiContext.synonyms.length > 0) {
2272
2325
  lines.push(`### \u540C\u4E49\u8BCD/\u522B\u540D`);
2273
2326
  lines.push("");
@@ -2290,7 +2343,9 @@ ${serverKeys.map(
2290
2343
  if (aiContext.diagnosticWorkflow.trigger && aiContext.diagnosticWorkflow.trigger.any_of) {
2291
2344
  lines.push(`**\u89E6\u53D1\u6761\u4EF6** (\u6EE1\u8DB3\u4EFB\u4E00):`);
2292
2345
  for (const trigger of aiContext.diagnosticWorkflow.trigger.any_of) {
2293
- lines.push(`- ${trigger.metric} ${trigger.operator} ${trigger.value}`);
2346
+ if (trigger.metric && trigger.operator) {
2347
+ lines.push(`- ${trigger.metric} ${trigger.operator} ${trigger.value ?? "N/A"}`);
2348
+ }
2294
2349
  }
2295
2350
  lines.push("");
2296
2351
  }
@@ -2298,14 +2353,17 @@ ${serverKeys.map(
2298
2353
  lines.push(`**\u5206\u6790\u52A8\u4F5C**:`);
2299
2354
  for (let i = 0; i < aiContext.diagnosticWorkflow.actions.length; i++) {
2300
2355
  const action = aiContext.diagnosticWorkflow.actions[i];
2301
- lines.push(`${i + 1}. **${action.type}**`);
2356
+ if (!action) continue;
2357
+ lines.push(`${i + 1}. **${action.type ?? "\u672A\u547D\u540D\u52A8\u4F5C"}**`);
2302
2358
  if (action.metric) {
2303
2359
  lines.push(` - \u5BF9\u6BD4\u6307\u6807: ${action.metric}`);
2304
2360
  }
2305
2361
  if (action.dimensions && action.dimensions.length > 0) {
2306
2362
  lines.push(` - \u4E0B\u94BB\u7EF4\u5EA6: ${action.dimensions.join("\u3001")}`);
2307
2363
  }
2308
- lines.push(` - \u76EE\u7684: ${action.intent}`);
2364
+ if (action.intent) {
2365
+ lines.push(` - \u76EE\u7684: ${action.intent}`);
2366
+ }
2309
2367
  }
2310
2368
  lines.push("");
2311
2369
  }
@@ -2339,9 +2397,9 @@ ${serverKeys.map(
2339
2397
  name: "query_metric_definition",
2340
2398
  description: `${QUERY_METRIC_DEFINITION_DESCRIPTION}${availableServersText}`,
2341
2399
  schema: z10.object({
2342
- serverKey: z10.string().describe(`Target semantic metrics server. Choose from: ${serverKeys.join(", ")}`),
2400
+ serverKey: z10.string().optional().describe(`Target semantic metrics server. Choose from: ${serverKeys.join(", ")}. Optional if configured in runConfig.metricsDataSource`),
2343
2401
  metricName: z10.string().describe("The name of the metric to get definition for."),
2344
- datasourceId: z10.string().optional().describe("Optional specific datasource ID to search in. If not provided, searches all selected datasources.")
2402
+ datasourceId: z10.string().optional().describe("Optional specific datasource ID to search in. If not provided, uses the one configured in runConfig.metricsDataSource or searches all selected datasources.")
2345
2403
  })
2346
2404
  }
2347
2405
  );
@@ -2533,14 +2591,18 @@ ${serverKeys.map(
2533
2591
  ).join("\n")}` : "";
2534
2592
  return tool10(
2535
2593
  async ({
2536
- serverKey,
2537
- datasourceId,
2594
+ serverKey: inputServerKey,
2595
+ datasourceId: inputDatasourceId,
2538
2596
  metrics,
2539
2597
  groupBy,
2540
2598
  filters,
2541
2599
  limit
2542
2600
  }, _exeConfig) => {
2543
2601
  try {
2602
+ const runConfig = _exeConfig?.configurable?.runConfig || {};
2603
+ const metricsDataSource = runConfig.metricsDataSource;
2604
+ const serverKey = metricsDataSource?.serverKey || inputServerKey;
2605
+ const datasourceId = metricsDataSource?.datasourceId || inputDatasourceId;
2544
2606
  if (!serverKey) {
2545
2607
  return "Error: serverKey parameter is required. Available servers: " + serverKeys.join(", ");
2546
2608
  }
@@ -2563,6 +2625,7 @@ ${serverKeys.map(
2563
2625
  operator: f.operator,
2564
2626
  values: f.values
2565
2627
  }));
2628
+ console.log(`[query_semantic_metric_data] Querying: server=${serverKey}, datasource=${datasourceId}, metrics=[${metrics.join(", ")}], groupBy=[${groupBy?.join(", ") || ""}], filters=${JSON.stringify(filters)}, limit=${limit || 1e3}`);
2566
2629
  const result = await client.semanticQuery({
2567
2630
  datasourceId,
2568
2631
  metrics,
@@ -2583,8 +2646,8 @@ ${serverKeys.map(
2583
2646
  name: "query_semantic_metric_data",
2584
2647
  description: `${QUERY_SEMANTIC_METRIC_DATA_DESCRIPTION}${availableServersText}`,
2585
2648
  schema: z11.object({
2586
- serverKey: z11.string().describe(`Target semantic metrics server. Choose from: ${serverKeys.join(", ")}`),
2587
- datasourceId: z11.string().describe("The data source ID to query metrics from."),
2649
+ serverKey: z11.string().optional().describe(`Target semantic metrics server. Choose from: ${serverKeys.join(", ")}. Optional if configured in runConfig.metricsDataSource`),
2650
+ datasourceId: z11.string().optional().describe("The data source ID to query metrics from. Optional if configured in runConfig.metricsDataSource"),
2588
2651
  metrics: z11.array(z11.string()).describe("Array of metric names to query (e.g., ['net_sales_amt', 'gross_profit'])."),
2589
2652
  groupBy: z11.array(z11.string()).optional().describe("Optional array of dimensions to group by (e.g., ['DocDate__month', 'CustomerCode'])."),
2590
2653
  filters: z11.array(z11.object({
@@ -2611,10 +2674,13 @@ ${serverKeys.map(
2611
2674
  ).join("\n")}` : "";
2612
2675
  return tool11(
2613
2676
  async ({
2614
- serverKey,
2677
+ serverKey: inputServerKey,
2615
2678
  datasourceIds
2616
2679
  }, _exeConfig) => {
2617
2680
  try {
2681
+ const runConfig = _exeConfig?.configurable?.runConfig || {};
2682
+ const metricsDataSource = runConfig.metricsDataSource;
2683
+ const serverKey = metricsDataSource?.serverKey || inputServerKey;
2618
2684
  if (!serverKey) {
2619
2685
  return "Error: serverKey parameter is required. Available servers: " + serverKeys.join(", ");
2620
2686
  }
@@ -2626,7 +2692,7 @@ ${serverKeys.map(
2626
2692
  return `Error: Server "${serverKey}" is not a semantic metrics server. This tool only works with semantic servers.`;
2627
2693
  }
2628
2694
  const client = metricsServerManager.getClient(serverKey);
2629
- const targetDatasourceIds = datasourceIds && datasourceIds.length > 0 ? datasourceIds : client.getSelectedDataSources();
2695
+ const targetDatasourceIds = datasourceIds && datasourceIds.length > 0 ? datasourceIds : metricsDataSource?.datasourceId ? [metricsDataSource.datasourceId] : client.getSelectedDataSources();
2630
2696
  if (targetDatasourceIds.length === 0) {
2631
2697
  return `Error: No data sources specified and no default data sources configured for server "${serverKey}".`;
2632
2698
  }
@@ -2686,8 +2752,8 @@ ${serverKeys.map(
2686
2752
  name: "query_tables_list",
2687
2753
  description: `${QUERY_TABLES_LIST_DESCRIPTION}${availableServersText}`,
2688
2754
  schema: z12.object({
2689
- serverKey: z12.string().describe(`Target semantic metrics server. Choose from: ${serverKeys.join(", ")}`),
2690
- datasourceIds: z12.array(z12.string()).optional().describe("Optional array of datasource IDs to query. If not provided, uses all selected datasources.")
2755
+ serverKey: z12.string().optional().describe(`Target semantic metrics server. Choose from: ${serverKeys.join(", ")}. Optional if configured in runConfig.metricsDataSource`),
2756
+ datasourceIds: z12.array(z12.string()).optional().describe("Optional array of datasource IDs to query. If not provided, uses the one configured in runConfig.metricsDataSource or all selected datasources.")
2691
2757
  })
2692
2758
  }
2693
2759
  );
@@ -2706,11 +2772,15 @@ ${serverKeys.map(
2706
2772
  ).join("\n")}` : "";
2707
2773
  return tool12(
2708
2774
  async ({
2709
- serverKey,
2775
+ serverKey: inputServerKey,
2710
2776
  tableName,
2711
- datasourceId
2777
+ datasourceId: inputDatasourceId
2712
2778
  }, _exeConfig) => {
2713
2779
  try {
2780
+ const runConfig = _exeConfig?.configurable?.runConfig || {};
2781
+ const metricsDataSource = runConfig.metricsDataSource;
2782
+ const serverKey = metricsDataSource?.serverKey || inputServerKey;
2783
+ const datasourceId = inputDatasourceId || metricsDataSource?.datasourceId;
2714
2784
  if (!serverKey) {
2715
2785
  return "Error: serverKey parameter is required. Available servers: " + serverKeys.join(", ");
2716
2786
  }
@@ -2798,16 +2868,117 @@ ${serverKeys.map(
2798
2868
  name: "query_table_definition",
2799
2869
  description: `${QUERY_TABLE_DEFINITION_DESCRIPTION}${availableServersText}`,
2800
2870
  schema: z13.object({
2801
- serverKey: z13.string().describe(`Target semantic metrics server. Choose from: ${serverKeys.join(", ")}`),
2871
+ serverKey: z13.string().optional().describe(`Target semantic metrics server. Choose from: ${serverKeys.join(", ")}. Optional if configured in runConfig.metricsDataSource`),
2802
2872
  tableName: z13.string().describe("The name of the table to get definition for."),
2803
- datasourceId: z13.string().optional().describe("Optional specific datasource ID to search in. If not provided, searches all selected datasources.")
2873
+ datasourceId: z13.string().optional().describe("Optional specific datasource ID to search in. If not provided, uses the one configured in runConfig.metricsDataSource or searches all selected datasources.")
2804
2874
  })
2805
2875
  }
2806
2876
  );
2807
2877
  };
2808
2878
 
2809
- // src/tool_lattice/code_eval/index.ts
2879
+ // src/tool_lattice/metrics/execute_sql_query.ts
2810
2880
  import z14 from "zod";
2881
+ import { tool as tool13 } from "langchain";
2882
+ var EXECUTE_SQL_QUERY_DESCRIPTION = `Execute Custom SQL Query - Advanced Data Analysis Tool
2883
+
2884
+ Use this tool when you need to perform complex queries that cannot be achieved through the standard semantic metric query interface.
2885
+
2886
+ When to Use This Tool:
2887
+ - When you need custom aggregations, calculations, or joins
2888
+ - When the standard metric query patterns don't meet your requirements
2889
+ - When you need to query raw table data with custom filters
2890
+ - When you want to perform complex analytical queries (e.g., window functions, CTEs)
2891
+
2892
+ When NOT to Use This Tool:
2893
+ - For simple metric queries - use query_semantic_metric_data instead
2894
+ - When you haven't identified the correct datasource yet - use list_metrics_datasources first
2895
+
2896
+ Prerequisites:
2897
+ 1. Call list_metrics_datasources to get available datasource IDs
2898
+ 2. Call query_tables_list to see available tables and their structures
2899
+ 3. Call query_table_definition to understand table columns before writing SQL
2900
+
2901
+ SQL Query Guidelines:
2902
+ - Use named parameters with :paramName syntax (e.g., :year, :category)
2903
+ - Provide parameter values in the params object
2904
+ - Always use proper table and column names from table definitions
2905
+ - Include appropriate WHERE clauses to limit data
2906
+ - Use LIMIT to prevent returning too many rows
2907
+
2908
+ Example:
2909
+ {
2910
+ "serverKey": "production_metrics",
2911
+ "datasourceId": "1",
2912
+ "customSql": "SELECT \\"Code\\" AS period, SUM(\\"LineTotal\\") AS revenue FROM \\"MTC_VW_SalesRevenueCost\\" WHERE \\"Category\\" = :year GROUP BY \\"Code\\" ORDER BY \\"Code\\" ASC",
2913
+ "params": {
2914
+ "year": "2024"
2915
+ },
2916
+ "limit": 1000
2917
+ }`;
2918
+ var createExecuteSqlQueryTool = ({ serverKeys, serverDescriptions }) => {
2919
+ const availableServersText = serverKeys.length > 0 ? `
2920
+
2921
+ Available metrics servers:
2922
+ ${serverKeys.map(
2923
+ (key) => `- ${key}${serverDescriptions?.[key] ? `: ${serverDescriptions[key]}` : ""}`
2924
+ ).join("\n")}` : "";
2925
+ return tool13(
2926
+ async ({
2927
+ serverKey: inputServerKey,
2928
+ datasourceId: inputDatasourceId,
2929
+ customSql,
2930
+ params,
2931
+ limit
2932
+ }, _exeConfig) => {
2933
+ try {
2934
+ const runConfig = _exeConfig?.configurable?.runConfig || {};
2935
+ const metricsDataSource = runConfig.metricsDataSource;
2936
+ const serverKey = metricsDataSource?.serverKey || inputServerKey;
2937
+ const datasourceId = metricsDataSource?.datasourceId || inputDatasourceId;
2938
+ if (!serverKey) {
2939
+ return "Error: serverKey parameter is required. Available servers: " + serverKeys.join(", ");
2940
+ }
2941
+ if (!serverKeys.includes(serverKey)) {
2942
+ return `Error: serverKey "${serverKey}" is not in the allowed list: [${serverKeys.join(", ")}]`;
2943
+ }
2944
+ if (!datasourceId) {
2945
+ return "Error: datasourceId parameter is required.";
2946
+ }
2947
+ if (!customSql || customSql.trim().length === 0) {
2948
+ return "Error: customSql parameter is required and cannot be empty.";
2949
+ }
2950
+ const config = metricsServerManager.getConfig(serverKey);
2951
+ if (config.type !== "semantic") {
2952
+ return `Error: Server "${serverKey}" is not a semantic metrics server. This tool only works with semantic servers.`;
2953
+ }
2954
+ const client = metricsServerManager.getClient(serverKey);
2955
+ const result = await client.executeSqlQuery({
2956
+ datasourceId,
2957
+ customSql,
2958
+ params,
2959
+ limit: limit || 1e3
2960
+ });
2961
+ return JSON.stringify(result, null, 2);
2962
+ } catch (error) {
2963
+ return `Error executing SQL query: ${error instanceof Error ? error.message : String(error)}`;
2964
+ }
2965
+ },
2966
+ {
2967
+ name: "execute_sql_query",
2968
+ description: `${EXECUTE_SQL_QUERY_DESCRIPTION}${availableServersText}`,
2969
+ schema: z14.object({
2970
+ serverKey: z14.string().optional().describe(`Target semantic metrics server. Choose from: ${serverKeys.join(", ")}. Optional if configured in runConfig.metricsDataSource`),
2971
+ datasourceId: z14.string().optional().describe("The data source ID to execute SQL against. Optional if configured in runConfig.metricsDataSource"),
2972
+ customSql: z14.string().describe("Custom SQL query string with named parameters (e.g., :year, :category). Use double quotes for identifiers."),
2973
+ params: z14.record(z14.union([z14.string(), z14.number(), z14.boolean()])).optional().describe("Optional parameters for the SQL query. Keys should match the :paramName placeholders in customSql."),
2974
+ limit: z14.number().optional().describe("Maximum number of results to return (default: 1000).")
2975
+ })
2976
+ }
2977
+ );
2978
+ };
2979
+
2980
+ // src/tool_lattice/code_eval/index.ts
2981
+ import z15 from "zod";
2811
2982
 
2812
2983
  // src/sandbox_lattice/SandboxLatticeManager.ts
2813
2984
  import { SandboxClient } from "@agent-infra/sandbox";
@@ -3046,7 +3217,7 @@ var getSandBoxManager = (key = "default") => {
3046
3217
  };
3047
3218
 
3048
3219
  // src/tool_lattice/code_eval/index.ts
3049
- import { tool as tool13 } from "langchain";
3220
+ import { tool as tool14 } from "langchain";
3050
3221
  var CODE_EVAL_DESCRIPTION = `Execute code in Python or JavaScript runtime.
3051
3222
 
3052
3223
  Args:
@@ -3056,7 +3227,7 @@ Args:
3056
3227
  Returns:
3057
3228
  Dict containing output, errors, and execution details`;
3058
3229
  var createCodeEvalTool = ({ isolatedLevel }) => {
3059
- return tool13(async (input, exe_config) => {
3230
+ return tool14(async (input, exe_config) => {
3060
3231
  try {
3061
3232
  const runConfig = exe_config.configurable?.runConfig;
3062
3233
  const sandboxManager = getSandBoxManager();
@@ -3097,16 +3268,16 @@ ${traceback.join("\n")}`);
3097
3268
  }, {
3098
3269
  name: "execute_code",
3099
3270
  description: CODE_EVAL_DESCRIPTION,
3100
- schema: z14.object({
3101
- language: z14.enum(["python", "javascript"]).describe("Programming language: 'python' or 'javascript'"),
3102
- code: z14.string().describe("Code to execute")
3271
+ schema: z15.object({
3272
+ language: z15.enum(["python", "javascript"]).describe("Programming language: 'python' or 'javascript'"),
3273
+ code: z15.string().describe("Code to execute")
3103
3274
  })
3104
3275
  });
3105
3276
  };
3106
3277
 
3107
3278
  // src/tool_lattice/code_execute_file/index.ts
3108
- import z15 from "zod";
3109
- import { tool as tool14 } from "langchain";
3279
+ import z16 from "zod";
3280
+ import { tool as tool15 } from "langchain";
3110
3281
  import * as path from "path";
3111
3282
  var CODE_EXECUTE_FILE_DESCRIPTION = `Execute a code file from the sandbox filesystem. Only supports Python (.py) and JavaScript (.js, .mjs) files. Other file types are not supported. The tool reads the file content and executes it in an isolated sandbox environment. Language is automatically inferred from the file extension. Output is returned via stdout; errors appear in stderr and traceback.`;
3112
3283
  function inferLanguageFromPath(filePath) {
@@ -3119,7 +3290,7 @@ function inferLanguageFromPath(filePath) {
3119
3290
  return null;
3120
3291
  }
3121
3292
  var createCodeExecuteFileTool = ({ isolatedLevel }) => {
3122
- return tool14(
3293
+ return tool15(
3123
3294
  async (input, exe_config) => {
3124
3295
  try {
3125
3296
  const runConfig = exe_config.configurable?.runConfig;
@@ -3182,15 +3353,15 @@ ${traceback.join("\n")}`);
3182
3353
  {
3183
3354
  name: "execute_code_file",
3184
3355
  description: CODE_EXECUTE_FILE_DESCRIPTION,
3185
- schema: z15.object({
3186
- file_path: z15.string().describe("Path to the code file to execute (absolute path in sandbox filesystem). Only supports .py (Python) and .js/.mjs (JavaScript) files.")
3356
+ schema: z16.object({
3357
+ file_path: z16.string().describe("Path to the code file to execute (absolute path in sandbox filesystem). Only supports .py (Python) and .js/.mjs (JavaScript) files.")
3187
3358
  })
3188
3359
  }
3189
3360
  );
3190
3361
  };
3191
3362
 
3192
3363
  // src/tool_lattice/convert_to_markdown/index.ts
3193
- import z16 from "zod";
3364
+ import z17 from "zod";
3194
3365
  var CONVERT_TO_MARKDOWN_DESCRIPTION = `Convert a resource described by an http:, https:, file: or data: URI to markdown.
3195
3366
 
3196
3367
  Args:
@@ -3207,8 +3378,8 @@ registerToolLattice(
3207
3378
  name: "convert_to_markdown",
3208
3379
  description: CONVERT_TO_MARKDOWN_DESCRIPTION,
3209
3380
  needUserApprove: false,
3210
- schema: z16.object({
3211
- uri: z16.string().describe("The URI to convert.")
3381
+ schema: z17.object({
3382
+ uri: z17.string().describe("The URI to convert.")
3212
3383
  })
3213
3384
  },
3214
3385
  async (input, exe_config) => {
@@ -3231,15 +3402,15 @@ registerToolLattice(
3231
3402
  );
3232
3403
 
3233
3404
  // src/tool_lattice/browser/browser_navigate.ts
3234
- import z17 from "zod";
3235
- import { tool as tool15 } from "langchain";
3405
+ import z18 from "zod";
3406
+ import { tool as tool16 } from "langchain";
3236
3407
  var BROWSER_NAVIGATE_DESCRIPTION = `Navigate to a URL.
3237
3408
 
3238
3409
  Args:
3239
3410
  url (str): The URL to navigate to.
3240
3411
  `;
3241
3412
  var createBrowserNavigateTool = ({ isolatedLevel }) => {
3242
- return tool15(
3413
+ return tool16(
3243
3414
  async (input, exe_config) => {
3244
3415
  try {
3245
3416
  const runConfig = exe_config.configurable?.runConfig;
@@ -3259,23 +3430,23 @@ var createBrowserNavigateTool = ({ isolatedLevel }) => {
3259
3430
  {
3260
3431
  name: "browser_navigate",
3261
3432
  description: BROWSER_NAVIGATE_DESCRIPTION,
3262
- schema: z17.object({
3263
- url: z17.string().describe("The URL to navigate to.")
3433
+ schema: z18.object({
3434
+ url: z18.string().describe("The URL to navigate to.")
3264
3435
  })
3265
3436
  }
3266
3437
  );
3267
3438
  };
3268
3439
 
3269
3440
  // src/tool_lattice/browser/browser_click.ts
3270
- import z18 from "zod";
3271
- import { tool as tool16 } from "langchain";
3441
+ import z19 from "zod";
3442
+ import { tool as tool17 } from "langchain";
3272
3443
  var BROWSER_CLICK_DESCRIPTION = `Click an element on the page, before using the tool, use \`browser_get_clickable_elements\` to get the index of the element, but not call \`browser_get_clickable_elements\` multiple times.
3273
3444
 
3274
3445
  Args:
3275
3446
  index (int): Index of the element to click
3276
3447
  `;
3277
3448
  var createBrowserClickTool = ({ isolatedLevel }) => {
3278
- return tool16(
3449
+ return tool17(
3279
3450
  async (input, exe_config) => {
3280
3451
  try {
3281
3452
  const runConfig = exe_config.configurable?.runConfig;
@@ -3295,23 +3466,23 @@ var createBrowserClickTool = ({ isolatedLevel }) => {
3295
3466
  {
3296
3467
  name: "browser_click",
3297
3468
  description: BROWSER_CLICK_DESCRIPTION,
3298
- schema: z18.object({
3299
- index: z18.number().describe("Index of the element to click")
3469
+ schema: z19.object({
3470
+ index: z19.number().describe("Index of the element to click")
3300
3471
  })
3301
3472
  }
3302
3473
  );
3303
3474
  };
3304
3475
 
3305
3476
  // src/tool_lattice/browser/browser_get_text.ts
3306
- import z19 from "zod";
3307
- import { tool as tool17 } from "langchain";
3477
+ import z20 from "zod";
3478
+ import { tool as tool18 } from "langchain";
3308
3479
  var BROWSER_GET_TEXT_DESCRIPTION = `Get the text content of the current page.
3309
3480
 
3310
3481
  Args:
3311
3482
  None
3312
3483
  `;
3313
3484
  var createBrowserGetTextTool = ({ isolatedLevel }) => {
3314
- return tool17(
3485
+ return tool18(
3315
3486
  async (input, exe_config) => {
3316
3487
  try {
3317
3488
  const runConfig = exe_config.configurable?.runConfig;
@@ -3329,21 +3500,21 @@ var createBrowserGetTextTool = ({ isolatedLevel }) => {
3329
3500
  {
3330
3501
  name: "browser_get_text",
3331
3502
  description: BROWSER_GET_TEXT_DESCRIPTION,
3332
- schema: z19.object({})
3503
+ schema: z20.object({})
3333
3504
  }
3334
3505
  );
3335
3506
  };
3336
3507
 
3337
3508
  // src/tool_lattice/browser/browser_get_markdown.ts
3338
- import z20 from "zod";
3339
- import { tool as tool18 } from "langchain";
3509
+ import z21 from "zod";
3510
+ import { tool as tool19 } from "langchain";
3340
3511
  var BROWSER_GET_MARKDOWN_DESCRIPTION = `Get the markdown content of the current page.
3341
3512
 
3342
3513
  Args:
3343
3514
  None
3344
3515
  `;
3345
3516
  var createBrowserGetMarkdownTool = ({ isolatedLevel }) => {
3346
- return tool18(
3517
+ return tool19(
3347
3518
  async (input, exe_config) => {
3348
3519
  try {
3349
3520
  const runConfig = exe_config.configurable?.runConfig;
@@ -3361,21 +3532,21 @@ var createBrowserGetMarkdownTool = ({ isolatedLevel }) => {
3361
3532
  {
3362
3533
  name: "browser_get_markdown",
3363
3534
  description: BROWSER_GET_MARKDOWN_DESCRIPTION,
3364
- schema: z20.object({})
3535
+ schema: z21.object({})
3365
3536
  }
3366
3537
  );
3367
3538
  };
3368
3539
 
3369
3540
  // src/tool_lattice/browser/browser_evaluate.ts
3370
- import z21 from "zod";
3371
- import { tool as tool19 } from "langchain";
3541
+ import z22 from "zod";
3542
+ import { tool as tool20 } from "langchain";
3372
3543
  var BROWSER_EVALUATE_DESCRIPTION = `Execute JavaScript in the browser console.
3373
3544
 
3374
3545
  Args:
3375
3546
  script (str): JavaScript code to execute, () => { /* code */ }
3376
3547
  `;
3377
3548
  var createBrowserEvaluateTool = ({ isolatedLevel }) => {
3378
- return tool19(
3549
+ return tool20(
3379
3550
  async (input, exe_config) => {
3380
3551
  try {
3381
3552
  const runConfig = exe_config.configurable?.runConfig;
@@ -3395,16 +3566,16 @@ var createBrowserEvaluateTool = ({ isolatedLevel }) => {
3395
3566
  {
3396
3567
  name: "browser_evaluate",
3397
3568
  description: BROWSER_EVALUATE_DESCRIPTION,
3398
- schema: z21.object({
3399
- script: z21.string().describe("JavaScript code to execute, () => { /* code */ }")
3569
+ schema: z22.object({
3570
+ script: z22.string().describe("JavaScript code to execute, () => { /* code */ }")
3400
3571
  })
3401
3572
  }
3402
3573
  );
3403
3574
  };
3404
3575
 
3405
3576
  // src/tool_lattice/browser/browser_screenshot.ts
3406
- import z22 from "zod";
3407
- import { tool as tool20 } from "langchain";
3577
+ import z23 from "zod";
3578
+ import { tool as tool21 } from "langchain";
3408
3579
  var BROWSER_SCREENSHOT_DESCRIPTION = `Take a screenshot of the current page or a specific element.
3409
3580
 
3410
3581
  Args:
@@ -3417,7 +3588,7 @@ Args:
3417
3588
  highlight (bool): Highlight the element
3418
3589
  `;
3419
3590
  var createBrowserScreenshotTool = ({ isolatedLevel }) => {
3420
- return tool20(
3591
+ return tool21(
3421
3592
  async (input, exe_config) => {
3422
3593
  try {
3423
3594
  const runConfig = exe_config.configurable?.runConfig;
@@ -3469,29 +3640,29 @@ var createBrowserScreenshotTool = ({ isolatedLevel }) => {
3469
3640
  {
3470
3641
  name: "browser_screenshot",
3471
3642
  description: BROWSER_SCREENSHOT_DESCRIPTION,
3472
- schema: z22.object({
3473
- name: z22.string().optional().describe("Name for the screenshot"),
3474
- selector: z22.string().optional().describe("CSS selector for element to screenshot"),
3475
- index: z22.number().optional().describe("index of the element to screenshot"),
3476
- width: z22.number().optional().describe("Width in pixels (default: viewport width)"),
3477
- height: z22.number().optional().describe("Height in pixels (default: viewport height)"),
3478
- fullPage: z22.boolean().optional().describe("Full page screenshot (default: false)"),
3479
- highlight: z22.boolean().default(false).describe("Highlight the element")
3643
+ schema: z23.object({
3644
+ name: z23.string().optional().describe("Name for the screenshot"),
3645
+ selector: z23.string().optional().describe("CSS selector for element to screenshot"),
3646
+ index: z23.number().optional().describe("index of the element to screenshot"),
3647
+ width: z23.number().optional().describe("Width in pixels (default: viewport width)"),
3648
+ height: z23.number().optional().describe("Height in pixels (default: viewport height)"),
3649
+ fullPage: z23.boolean().optional().describe("Full page screenshot (default: false)"),
3650
+ highlight: z23.boolean().default(false).describe("Highlight the element")
3480
3651
  })
3481
3652
  }
3482
3653
  );
3483
3654
  };
3484
3655
 
3485
3656
  // src/tool_lattice/browser/browser_scroll.ts
3486
- import z23 from "zod";
3487
- import { tool as tool21 } from "langchain";
3657
+ import z24 from "zod";
3658
+ import { tool as tool22 } from "langchain";
3488
3659
  var BROWSER_SCROLL_DESCRIPTION = `Scroll the page.
3489
3660
 
3490
3661
  Args:
3491
3662
  amount (int): Pixels to scroll (positive for down, negative for up), if the amount is not provided, scroll to the bottom of the page
3492
3663
  `;
3493
3664
  var createBrowserScrollTool = ({ isolatedLevel }) => {
3494
- return tool21(
3665
+ return tool22(
3495
3666
  async (input, exe_config) => {
3496
3667
  try {
3497
3668
  const runConfig = exe_config.configurable?.runConfig;
@@ -3511,16 +3682,16 @@ var createBrowserScrollTool = ({ isolatedLevel }) => {
3511
3682
  {
3512
3683
  name: "browser_scroll",
3513
3684
  description: BROWSER_SCROLL_DESCRIPTION,
3514
- schema: z23.object({
3515
- amount: z23.number().optional().describe("Pixels to scroll (positive for down, negative for up)")
3685
+ schema: z24.object({
3686
+ amount: z24.number().optional().describe("Pixels to scroll (positive for down, negative for up)")
3516
3687
  })
3517
3688
  }
3518
3689
  );
3519
3690
  };
3520
3691
 
3521
3692
  // src/tool_lattice/browser/browser_form_input_fill.ts
3522
- import z24 from "zod";
3523
- import { tool as tool22 } from "langchain";
3693
+ import z25 from "zod";
3694
+ import { tool as tool23 } from "langchain";
3524
3695
  var BROWSER_FORM_INPUT_FILL_DESCRIPTION = `Fill out an input field, before using the tool, Either 'index' or 'selector' must be provided.
3525
3696
 
3526
3697
  Args:
@@ -3530,7 +3701,7 @@ Args:
3530
3701
  clear (bool): Whether to clear existing text before filling
3531
3702
  `;
3532
3703
  var createBrowserFormInputFillTool = ({ isolatedLevel }) => {
3533
- return tool22(
3704
+ return tool23(
3534
3705
  async (input, exe_config) => {
3535
3706
  try {
3536
3707
  const runConfig = exe_config.configurable?.runConfig;
@@ -3553,19 +3724,19 @@ var createBrowserFormInputFillTool = ({ isolatedLevel }) => {
3553
3724
  {
3554
3725
  name: "browser_form_input_fill",
3555
3726
  description: BROWSER_FORM_INPUT_FILL_DESCRIPTION,
3556
- schema: z24.object({
3557
- selector: z24.string().optional().describe("CSS selector for input field"),
3558
- index: z24.number().optional().describe("Index of the element to fill"),
3559
- value: z24.string().describe("Value to fill"),
3560
- clear: z24.boolean().default(false).describe("Whether to clear existing text before filling")
3727
+ schema: z25.object({
3728
+ selector: z25.string().optional().describe("CSS selector for input field"),
3729
+ index: z25.number().optional().describe("Index of the element to fill"),
3730
+ value: z25.string().describe("Value to fill"),
3731
+ clear: z25.boolean().default(false).describe("Whether to clear existing text before filling")
3561
3732
  })
3562
3733
  }
3563
3734
  );
3564
3735
  };
3565
3736
 
3566
3737
  // src/tool_lattice/browser/browser_select.ts
3567
- import z25 from "zod";
3568
- import { tool as tool23 } from "langchain";
3738
+ import z26 from "zod";
3739
+ import { tool as tool24 } from "langchain";
3569
3740
  var BROWSER_SELECT_DESCRIPTION = `Select an element on the page with index, Either 'index' or 'selector' must be provided.
3570
3741
 
3571
3742
  Args:
@@ -3574,7 +3745,7 @@ Args:
3574
3745
  value (str): Value to select
3575
3746
  `;
3576
3747
  var createBrowserSelectTool = ({ isolatedLevel }) => {
3577
- return tool23(
3748
+ return tool24(
3578
3749
  async (input, exe_config) => {
3579
3750
  try {
3580
3751
  const runConfig = exe_config.configurable?.runConfig;
@@ -3596,18 +3767,18 @@ var createBrowserSelectTool = ({ isolatedLevel }) => {
3596
3767
  {
3597
3768
  name: "browser_select",
3598
3769
  description: BROWSER_SELECT_DESCRIPTION,
3599
- schema: z25.object({
3600
- index: z25.number().optional().describe("Index of the element to select"),
3601
- selector: z25.string().optional().describe("CSS selector for element to select"),
3602
- value: z25.string().describe("Value to select")
3770
+ schema: z26.object({
3771
+ index: z26.number().optional().describe("Index of the element to select"),
3772
+ selector: z26.string().optional().describe("CSS selector for element to select"),
3773
+ value: z26.string().describe("Value to select")
3603
3774
  })
3604
3775
  }
3605
3776
  );
3606
3777
  };
3607
3778
 
3608
3779
  // src/tool_lattice/browser/browser_hover.ts
3609
- import z26 from "zod";
3610
- import { tool as tool24 } from "langchain";
3780
+ import z27 from "zod";
3781
+ import { tool as tool25 } from "langchain";
3611
3782
  var BROWSER_HOVER_DESCRIPTION = `Hover an element on the page, Either 'index' or 'selector' must be provided.
3612
3783
 
3613
3784
  Args:
@@ -3615,7 +3786,7 @@ Args:
3615
3786
  selector (str): CSS selector for element to hover
3616
3787
  `;
3617
3788
  var createBrowserHoverTool = ({ isolatedLevel }) => {
3618
- return tool24(
3789
+ return tool25(
3619
3790
  async (input, exe_config) => {
3620
3791
  try {
3621
3792
  const runConfig = exe_config.configurable?.runConfig;
@@ -3636,24 +3807,24 @@ var createBrowserHoverTool = ({ isolatedLevel }) => {
3636
3807
  {
3637
3808
  name: "browser_hover",
3638
3809
  description: BROWSER_HOVER_DESCRIPTION,
3639
- schema: z26.object({
3640
- index: z26.number().optional().describe("Index of the element to hover"),
3641
- selector: z26.string().optional().describe("CSS selector for element to hover")
3810
+ schema: z27.object({
3811
+ index: z27.number().optional().describe("Index of the element to hover"),
3812
+ selector: z27.string().optional().describe("CSS selector for element to hover")
3642
3813
  })
3643
3814
  }
3644
3815
  );
3645
3816
  };
3646
3817
 
3647
3818
  // src/tool_lattice/browser/browser_go_back.ts
3648
- import z27 from "zod";
3649
- import { tool as tool25 } from "langchain";
3819
+ import z28 from "zod";
3820
+ import { tool as tool26 } from "langchain";
3650
3821
  var BROWSER_GO_BACK_DESCRIPTION = `Go back to the previous page.
3651
3822
 
3652
3823
  Args:
3653
3824
  None
3654
3825
  `;
3655
3826
  var createBrowserGoBackTool = ({ isolatedLevel }) => {
3656
- return tool25(
3827
+ return tool26(
3657
3828
  async (input, exe_config) => {
3658
3829
  try {
3659
3830
  const runConfig = exe_config.configurable?.runConfig;
@@ -3671,21 +3842,21 @@ var createBrowserGoBackTool = ({ isolatedLevel }) => {
3671
3842
  {
3672
3843
  name: "browser_go_back",
3673
3844
  description: BROWSER_GO_BACK_DESCRIPTION,
3674
- schema: z27.object({})
3845
+ schema: z28.object({})
3675
3846
  }
3676
3847
  );
3677
3848
  };
3678
3849
 
3679
3850
  // src/tool_lattice/browser/browser_go_forward.ts
3680
- import z28 from "zod";
3681
- import { tool as tool26 } from "langchain";
3851
+ import z29 from "zod";
3852
+ import { tool as tool27 } from "langchain";
3682
3853
  var BROWSER_GO_FORWARD_DESCRIPTION = `Go forward to the next page.
3683
3854
 
3684
3855
  Args:
3685
3856
  None
3686
3857
  `;
3687
3858
  var createBrowserGoForwardTool = ({ isolatedLevel }) => {
3688
- return tool26(
3859
+ return tool27(
3689
3860
  async (input, exe_config) => {
3690
3861
  try {
3691
3862
  const runConfig = exe_config.configurable?.runConfig;
@@ -3703,21 +3874,21 @@ var createBrowserGoForwardTool = ({ isolatedLevel }) => {
3703
3874
  {
3704
3875
  name: "browser_go_forward",
3705
3876
  description: BROWSER_GO_FORWARD_DESCRIPTION,
3706
- schema: z28.object({})
3877
+ schema: z29.object({})
3707
3878
  }
3708
3879
  );
3709
3880
  };
3710
3881
 
3711
3882
  // src/tool_lattice/browser/browser_new_tab.ts
3712
- import z29 from "zod";
3713
- import { tool as tool27 } from "langchain";
3883
+ import z30 from "zod";
3884
+ import { tool as tool28 } from "langchain";
3714
3885
  var BROWSER_NEW_TAB_DESCRIPTION = `Open a new tab.
3715
3886
 
3716
3887
  Args:
3717
3888
  url (str): URL to open in the new tab
3718
3889
  `;
3719
3890
  var createBrowserNewTabTool = ({ isolatedLevel }) => {
3720
- return tool27(
3891
+ return tool28(
3721
3892
  async (input, exe_config) => {
3722
3893
  try {
3723
3894
  const runConfig = exe_config.configurable?.runConfig;
@@ -3737,23 +3908,23 @@ var createBrowserNewTabTool = ({ isolatedLevel }) => {
3737
3908
  {
3738
3909
  name: "browser_new_tab",
3739
3910
  description: BROWSER_NEW_TAB_DESCRIPTION,
3740
- schema: z29.object({
3741
- url: z29.string().describe("URL to open in the new tab")
3911
+ schema: z30.object({
3912
+ url: z30.string().describe("URL to open in the new tab")
3742
3913
  })
3743
3914
  }
3744
3915
  );
3745
3916
  };
3746
3917
 
3747
3918
  // src/tool_lattice/browser/browser_tab_list.ts
3748
- import z30 from "zod";
3749
- import { tool as tool28 } from "langchain";
3919
+ import z31 from "zod";
3920
+ import { tool as tool29 } from "langchain";
3750
3921
  var BROWSER_TAB_LIST_DESCRIPTION = `Get the list of tabs.
3751
3922
 
3752
3923
  Args:
3753
3924
  None
3754
3925
  `;
3755
3926
  var createBrowserTabListTool = ({ isolatedLevel }) => {
3756
- return tool28(
3927
+ return tool29(
3757
3928
  async (input, exe_config) => {
3758
3929
  try {
3759
3930
  const runConfig = exe_config.configurable?.runConfig;
@@ -3771,21 +3942,21 @@ var createBrowserTabListTool = ({ isolatedLevel }) => {
3771
3942
  {
3772
3943
  name: "browser_tab_list",
3773
3944
  description: BROWSER_TAB_LIST_DESCRIPTION,
3774
- schema: z30.object({})
3945
+ schema: z31.object({})
3775
3946
  }
3776
3947
  );
3777
3948
  };
3778
3949
 
3779
3950
  // src/tool_lattice/browser/browser_switch_tab.ts
3780
- import z31 from "zod";
3781
- import { tool as tool29 } from "langchain";
3951
+ import z32 from "zod";
3952
+ import { tool as tool30 } from "langchain";
3782
3953
  var BROWSER_SWITCH_TAB_DESCRIPTION = `Switch to a specific tab.
3783
3954
 
3784
3955
  Args:
3785
3956
  index (int): Tab index to switch to
3786
3957
  `;
3787
3958
  var createBrowserSwitchTabTool = ({ isolatedLevel }) => {
3788
- return tool29(
3959
+ return tool30(
3789
3960
  async (input, exe_config) => {
3790
3961
  try {
3791
3962
  const runConfig = exe_config.configurable?.runConfig;
@@ -3805,23 +3976,23 @@ var createBrowserSwitchTabTool = ({ isolatedLevel }) => {
3805
3976
  {
3806
3977
  name: "browser_switch_tab",
3807
3978
  description: BROWSER_SWITCH_TAB_DESCRIPTION,
3808
- schema: z31.object({
3809
- index: z31.number().describe("Tab index to switch to")
3979
+ schema: z32.object({
3980
+ index: z32.number().describe("Tab index to switch to")
3810
3981
  })
3811
3982
  }
3812
3983
  );
3813
3984
  };
3814
3985
 
3815
3986
  // src/tool_lattice/browser/browser_close_tab.ts
3816
- import z32 from "zod";
3817
- import { tool as tool30 } from "langchain";
3987
+ import z33 from "zod";
3988
+ import { tool as tool31 } from "langchain";
3818
3989
  var BROWSER_CLOSE_TAB_DESCRIPTION = `Close the current tab.
3819
3990
 
3820
3991
  Args:
3821
3992
  None
3822
3993
  `;
3823
3994
  var createBrowserCloseTabTool = ({ isolatedLevel }) => {
3824
- return tool30(
3995
+ return tool31(
3825
3996
  async (input, exe_config) => {
3826
3997
  try {
3827
3998
  const runConfig = exe_config.configurable?.runConfig;
@@ -3839,21 +4010,21 @@ var createBrowserCloseTabTool = ({ isolatedLevel }) => {
3839
4010
  {
3840
4011
  name: "browser_close_tab",
3841
4012
  description: BROWSER_CLOSE_TAB_DESCRIPTION,
3842
- schema: z32.object({})
4013
+ schema: z33.object({})
3843
4014
  }
3844
4015
  );
3845
4016
  };
3846
4017
 
3847
4018
  // src/tool_lattice/browser/browser_close.ts
3848
- import z33 from "zod";
3849
- import { tool as tool31 } from "langchain";
4019
+ import z34 from "zod";
4020
+ import { tool as tool32 } from "langchain";
3850
4021
  var BROWSER_CLOSE_DESCRIPTION = `Close the browser when the task is done and the browser is not needed anymore.
3851
4022
 
3852
4023
  Args:
3853
4024
  None
3854
4025
  `;
3855
4026
  var createBrowserCloseTool = ({ isolatedLevel }) => {
3856
- return tool31(
4027
+ return tool32(
3857
4028
  async (input, exe_config) => {
3858
4029
  try {
3859
4030
  const runConfig = exe_config.configurable?.runConfig;
@@ -3871,21 +4042,21 @@ var createBrowserCloseTool = ({ isolatedLevel }) => {
3871
4042
  {
3872
4043
  name: "browser_close",
3873
4044
  description: BROWSER_CLOSE_DESCRIPTION,
3874
- schema: z33.object({})
4045
+ schema: z34.object({})
3875
4046
  }
3876
4047
  );
3877
4048
  };
3878
4049
 
3879
4050
  // src/tool_lattice/browser/browser_press_key.ts
3880
- import z34 from "zod";
3881
- import { tool as tool32 } from "langchain";
4051
+ import z35 from "zod";
4052
+ import { tool as tool33 } from "langchain";
3882
4053
  var BROWSER_PRESS_KEY_DESCRIPTION = `Press a key on the keyboard.
3883
4054
 
3884
4055
  Args:
3885
4056
  key (str): Name of the key to press or a character to generate, such as Enter, Tab, Escape, Backspace, Delete, Insert, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, ArrowLeft, ArrowRight, ArrowUp, ArrowDown, PageUp, PageDown, Home, End, ShiftLeft, ShiftRight, ControlLeft, ControlRight, AltLeft, AltRight, MetaLeft, MetaRight, CapsLock, PrintScreen, ScrollLock, Pause, ContextMenu
3886
4057
  `;
3887
4058
  var createBrowserPressKeyTool = ({ isolatedLevel }) => {
3888
- return tool32(
4059
+ return tool33(
3889
4060
  async (input, exe_config) => {
3890
4061
  try {
3891
4062
  const runConfig = exe_config.configurable?.runConfig;
@@ -3905,8 +4076,8 @@ var createBrowserPressKeyTool = ({ isolatedLevel }) => {
3905
4076
  {
3906
4077
  name: "browser_press_key",
3907
4078
  description: BROWSER_PRESS_KEY_DESCRIPTION,
3908
- schema: z34.object({
3909
- key: z34.enum([
4079
+ schema: z35.object({
4080
+ key: z35.enum([
3910
4081
  "Enter",
3911
4082
  "Tab",
3912
4083
  "Escape",
@@ -3953,15 +4124,15 @@ var createBrowserPressKeyTool = ({ isolatedLevel }) => {
3953
4124
  };
3954
4125
 
3955
4126
  // src/tool_lattice/browser/browser_read_links.ts
3956
- import z35 from "zod";
3957
- import { tool as tool33 } from "langchain";
4127
+ import z36 from "zod";
4128
+ import { tool as tool34 } from "langchain";
3958
4129
  var BROWSER_READ_LINKS_DESCRIPTION = `Get all links on the current page.
3959
4130
 
3960
4131
  Args:
3961
4132
  None
3962
4133
  `;
3963
4134
  var createBrowserReadLinksTool = ({ isolatedLevel }) => {
3964
- return tool33(
4135
+ return tool34(
3965
4136
  async (input, exe_config) => {
3966
4137
  try {
3967
4138
  const runConfig = exe_config.configurable?.runConfig;
@@ -3979,21 +4150,21 @@ var createBrowserReadLinksTool = ({ isolatedLevel }) => {
3979
4150
  {
3980
4151
  name: "browser_read_links",
3981
4152
  description: BROWSER_READ_LINKS_DESCRIPTION,
3982
- schema: z35.object({})
4153
+ schema: z36.object({})
3983
4154
  }
3984
4155
  );
3985
4156
  };
3986
4157
 
3987
4158
  // src/tool_lattice/browser/browser_get_clickable_elements.ts
3988
- import z36 from "zod";
3989
- import { tool as tool34 } from "langchain";
4159
+ import z37 from "zod";
4160
+ import { tool as tool35 } from "langchain";
3990
4161
  var BROWSER_GET_CLICKABLE_ELEMENTS_DESCRIPTION = `Get the clickable or hoverable or selectable elements on the current page, don't call this tool multiple times.
3991
4162
 
3992
4163
  Args:
3993
4164
  None
3994
4165
  `;
3995
4166
  var createBrowserGetClickableElementsTool = ({ isolatedLevel }) => {
3996
- return tool34(
4167
+ return tool35(
3997
4168
  async (input, exe_config) => {
3998
4169
  try {
3999
4170
  const runConfig = exe_config.configurable?.runConfig;
@@ -4011,21 +4182,21 @@ var createBrowserGetClickableElementsTool = ({ isolatedLevel }) => {
4011
4182
  {
4012
4183
  name: "browser_get_clickable_elements",
4013
4184
  description: BROWSER_GET_CLICKABLE_ELEMENTS_DESCRIPTION,
4014
- schema: z36.object({})
4185
+ schema: z37.object({})
4015
4186
  }
4016
4187
  );
4017
4188
  };
4018
4189
 
4019
4190
  // src/tool_lattice/browser/browser_get_download_list.ts
4020
- import z37 from "zod";
4021
- import { tool as tool35 } from "langchain";
4191
+ import z38 from "zod";
4192
+ import { tool as tool36 } from "langchain";
4022
4193
  var BROWSER_GET_DOWNLOAD_LIST_DESCRIPTION = `Get the list of downloaded files.
4023
4194
 
4024
4195
  Args:
4025
4196
  None
4026
4197
  `;
4027
4198
  var createBrowserGetDownloadListTool = ({ isolatedLevel }) => {
4028
- return tool35(
4199
+ return tool36(
4029
4200
  async (input, exe_config) => {
4030
4201
  try {
4031
4202
  const runConfig = exe_config.configurable?.runConfig;
@@ -4043,14 +4214,14 @@ var createBrowserGetDownloadListTool = ({ isolatedLevel }) => {
4043
4214
  {
4044
4215
  name: "browser_get_download_list",
4045
4216
  description: BROWSER_GET_DOWNLOAD_LIST_DESCRIPTION,
4046
- schema: z37.object({})
4217
+ schema: z38.object({})
4047
4218
  }
4048
4219
  );
4049
4220
  };
4050
4221
 
4051
4222
  // src/tool_lattice/browser/get_info.ts
4052
- import z38 from "zod";
4053
- import { tool as tool36 } from "langchain";
4223
+ import z39 from "zod";
4224
+ import { tool as tool37 } from "langchain";
4054
4225
  var BROWSER_GET_INFO_DESCRIPTION = `Get information about browser, like CDP URL, viewport size, etc.
4055
4226
 
4056
4227
  Args:
@@ -4059,7 +4230,7 @@ Args:
4059
4230
  Returns:
4060
4231
  Dict containing browser information including CDP URL, viewport dimensions, and other browser metadata.`;
4061
4232
  var createBrowserGetInfoTool = ({ isolatedLevel }) => {
4062
- return tool36(
4233
+ return tool37(
4063
4234
  async (input, exe_config) => {
4064
4235
  try {
4065
4236
  const runConfig = exe_config.configurable?.runConfig;
@@ -4077,7 +4248,7 @@ var createBrowserGetInfoTool = ({ isolatedLevel }) => {
4077
4248
  {
4078
4249
  name: "browser_get_info",
4079
4250
  description: BROWSER_GET_INFO_DESCRIPTION,
4080
- schema: z38.object({})
4251
+ schema: z39.object({})
4081
4252
  }
4082
4253
  );
4083
4254
  };
@@ -5926,11 +6097,11 @@ storeLatticeManager.registerLattice("default", "tenant", defaultTenantStore);
5926
6097
  storeLatticeManager.registerLattice("default", "userTenantLink", defaultUserTenantLinkStore);
5927
6098
 
5928
6099
  // src/tool_lattice/skill/load_skills.ts
5929
- import z39 from "zod";
5930
- import { tool as tool38 } from "langchain";
6100
+ import z40 from "zod";
6101
+ import { tool as tool39 } from "langchain";
5931
6102
  var LOAD_SKILLS_DESCRIPTION = `Load all available skills and return their metadata (name, description, license, compatibility, metadata, and subSkills) without the content. This tool returns skill information including hierarchical relationships (subSkills). Use this to discover what skills are available and their structure.`;
5932
6103
  var createLoadSkillsTool = ({ skills } = {}) => {
5933
- return tool38(
6104
+ return tool39(
5934
6105
  async (_input, _exe_config) => {
5935
6106
  try {
5936
6107
  const storeLattice = getStoreLattice("default", "skill");
@@ -5954,17 +6125,17 @@ var createLoadSkillsTool = ({ skills } = {}) => {
5954
6125
  {
5955
6126
  name: "load_skills",
5956
6127
  description: LOAD_SKILLS_DESCRIPTION,
5957
- schema: z39.object({})
6128
+ schema: z40.object({})
5958
6129
  }
5959
6130
  );
5960
6131
  };
5961
6132
 
5962
6133
  // src/tool_lattice/skill/load_skill_content.ts
5963
- import z40 from "zod";
5964
- import { tool as tool39 } from "langchain";
6134
+ import z41 from "zod";
6135
+ import { tool as tool40 } from "langchain";
5965
6136
  var LOAD_SKILL_CONTENT_DESCRIPTION = `Load a specific skill's content by name and return its full content including markdown body. This tool returns the complete skill content including frontmatter and markdown body. If the skill has resources, they will be listed at the end of the content with instructions on how to access them. Use this tool to get the complete skill content for a skill that you want to use.`;
5966
6137
  var createLoadSkillContentTool = () => {
5967
- return tool39(
6138
+ return tool40(
5968
6139
  async (input, _exe_config) => {
5969
6140
  try {
5970
6141
  const storeLattice = getStoreLattice("default", "skill");
@@ -6022,19 +6193,19 @@ ${content}`;
6022
6193
  {
6023
6194
  name: "load_skill_content",
6024
6195
  description: LOAD_SKILL_CONTENT_DESCRIPTION,
6025
- schema: z40.object({
6026
- skill_name: z40.string().describe("The name of the skill to load")
6196
+ schema: z41.object({
6197
+ skill_name: z41.string().describe("The name of the skill to load")
6027
6198
  })
6028
6199
  }
6029
6200
  );
6030
6201
  };
6031
6202
 
6032
6203
  // src/tool_lattice/skill/load_skill_resource.ts
6033
- import z41 from "zod";
6034
- import { tool as tool40 } from "langchain";
6204
+ import z42 from "zod";
6205
+ import { tool as tool41 } from "langchain";
6035
6206
  var LOAD_SKILL_RESOURCE_DESCRIPTION = `Load a specific resource file from a skill's resources directory. Use this tool when you need to access template files, example data, or other resources bundled with a skill. The resource paths are listed in the skill content when using the load_skill_content tool.`;
6036
6207
  var createLoadSkillResourceTool = () => {
6037
- return tool40(
6208
+ return tool41(
6038
6209
  async (input, _exe_config) => {
6039
6210
  try {
6040
6211
  const storeLattice = getStoreLattice("default", "skill");
@@ -6055,9 +6226,9 @@ var createLoadSkillResourceTool = () => {
6055
6226
  {
6056
6227
  name: "load_skill_resource",
6057
6228
  description: LOAD_SKILL_RESOURCE_DESCRIPTION,
6058
- schema: z41.object({
6059
- skill_name: z41.string().describe("The name of the skill containing the resource"),
6060
- resource_path: z41.string().describe("The path to the resource relative to the skill's resources/ directory")
6229
+ schema: z42.object({
6230
+ skill_name: z42.string().describe("The name of the skill containing the resource"),
6231
+ resource_path: z42.string().describe("The path to the resource relative to the skill's resources/ directory")
6061
6232
  })
6062
6233
  }
6063
6234
  );
@@ -6124,7 +6295,7 @@ ${extraNote}`;
6124
6295
  }
6125
6296
 
6126
6297
  // src/deep_agent_new/middleware/fs.ts
6127
- import { createMiddleware as createMiddleware5, tool as tool41, ToolMessage } from "langchain";
6298
+ import { createMiddleware as createMiddleware5, tool as tool42, ToolMessage } from "langchain";
6128
6299
  import { Command, isCommand, getCurrentTaskInput } from "@langchain/langgraph";
6129
6300
  import { z as z310 } from "zod/v3";
6130
6301
  import { withLangGraph } from "@langchain/langgraph/zod";
@@ -6623,7 +6794,7 @@ var GLOB_TOOL_DESCRIPTION = "Find files matching a glob pattern (e.g., '**/*.py'
6623
6794
  var GREP_TOOL_DESCRIPTION = "Search for a regex pattern in files. Returns matching files and line numbers";
6624
6795
  function createLsTool(backend, options) {
6625
6796
  const { customDescription } = options;
6626
- return tool41(
6797
+ return tool42(
6627
6798
  async (input, config) => {
6628
6799
  const { runConfig } = config.configurable;
6629
6800
  const stateAndStore = {
@@ -6659,7 +6830,7 @@ function createLsTool(backend, options) {
6659
6830
  }
6660
6831
  function createReadFileTool(backend, options) {
6661
6832
  const { customDescription } = options;
6662
- return tool41(
6833
+ return tool42(
6663
6834
  async (input, config) => {
6664
6835
  const { runConfig } = config.configurable;
6665
6836
  const stateAndStore = {
@@ -6684,7 +6855,7 @@ function createReadFileTool(backend, options) {
6684
6855
  }
6685
6856
  function createWriteFileTool(backend, options) {
6686
6857
  const { customDescription } = options;
6687
- return tool41(
6858
+ return tool42(
6688
6859
  async (input, config) => {
6689
6860
  const { runConfig } = config.configurable;
6690
6861
  const stateAndStore = {
@@ -6723,7 +6894,7 @@ function createWriteFileTool(backend, options) {
6723
6894
  }
6724
6895
  function createEditFileTool(backend, options) {
6725
6896
  const { customDescription } = options;
6726
- return tool41(
6897
+ return tool42(
6727
6898
  async (input, config) => {
6728
6899
  const { runConfig } = config.configurable;
6729
6900
  const stateAndStore = {
@@ -6769,7 +6940,7 @@ function createEditFileTool(backend, options) {
6769
6940
  }
6770
6941
  function createGlobTool(backend, options) {
6771
6942
  const { customDescription } = options;
6772
- return tool41(
6943
+ return tool42(
6773
6944
  async (input, config) => {
6774
6945
  const { runConfig } = config.configurable;
6775
6946
  const stateAndStore = {
@@ -6797,7 +6968,7 @@ function createGlobTool(backend, options) {
6797
6968
  }
6798
6969
  function createGrepTool(backend, options) {
6799
6970
  const { customDescription } = options;
6800
- return tool41(
6971
+ return tool42(
6801
6972
  async (input, config) => {
6802
6973
  const { runConfig } = config.configurable;
6803
6974
  const stateAndStore = {
@@ -6981,7 +7152,8 @@ function createMetricsMiddleware(params) {
6981
7152
  createQueryMetricDefinitionTool(toolParams),
6982
7153
  createQuerySemanticMetricDataTool(toolParams),
6983
7154
  createQueryTablesListTool(toolParams),
6984
- createQueryTableDefinitionTool(toolParams)
7155
+ createQueryTableDefinitionTool(toolParams),
7156
+ createExecuteSqlQueryTool(toolParams)
6985
7157
  ]
6986
7158
  });
6987
7159
  }
@@ -7075,9 +7247,9 @@ var ReActAgentGraphBuilder = class {
7075
7247
  */
7076
7248
  build(agentLattice, params) {
7077
7249
  const tools = params.tools.map((t) => {
7078
- const tool46 = getToolClient(t.key);
7079
- return tool46;
7080
- }).filter((tool46) => tool46 !== void 0);
7250
+ const tool47 = getToolClient(t.key);
7251
+ return tool47;
7252
+ }).filter((tool47) => tool47 !== void 0);
7081
7253
  const stateSchema2 = createReactAgentSchema(params.stateSchema);
7082
7254
  const middlewareConfigs = params.middleware || [];
7083
7255
  const filesystemBackend = this.createFilesystemBackendFactory(middlewareConfigs);
@@ -7103,11 +7275,11 @@ import {
7103
7275
  } from "langchain";
7104
7276
 
7105
7277
  // src/deep_agent_new/middleware/subagents.ts
7106
- import { z as z42 } from "zod/v3";
7278
+ import { z as z43 } from "zod/v3";
7107
7279
  import {
7108
7280
  createMiddleware as createMiddleware7,
7109
7281
  createAgent as createAgent2,
7110
- tool as tool42,
7282
+ tool as tool43,
7111
7283
  ToolMessage as ToolMessage2,
7112
7284
  humanInTheLoopMiddleware
7113
7285
  } from "langchain";
@@ -7429,6 +7601,11 @@ var AgentWorkerState = Annotation.Root({
7429
7601
  reducer: (x, y) => y ?? x,
7430
7602
  default: () => void 0
7431
7603
  }),
7604
+ // RunConfig for passing configuration through the graph
7605
+ runConfig: Annotation({
7606
+ reducer: (x, y) => y ?? x,
7607
+ default: () => void 0
7608
+ }),
7432
7609
  // Execution result
7433
7610
  result: Annotation({
7434
7611
  reducer: (x, y) => y ?? x,
@@ -7446,12 +7623,13 @@ var AgentWorkerState = Annotation.Root({
7446
7623
  })
7447
7624
  });
7448
7625
  async function executeNode(state) {
7449
- const { assistant_id, thread_id, input, command2 } = state;
7626
+ const { assistant_id, thread_id, input, command2, runConfig } = state;
7450
7627
  const callParams = {
7451
7628
  assistant_id,
7452
7629
  thread_id,
7453
7630
  input,
7454
- command: command2
7631
+ command: command2,
7632
+ runConfig
7455
7633
  };
7456
7634
  const result = await AgentManager.getInstance().callAgentInQueue(
7457
7635
  callParams,
@@ -7516,7 +7694,7 @@ var DEFAULT_SUBAGENT_PROMPT = "In order to complete the objective that the user
7516
7694
  var EXCLUDED_STATE_KEYS = ["messages", "todos", "jumpTo"];
7517
7695
  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.";
7518
7696
  function getTaskToolDescription(subagentDescriptions) {
7519
- return `
7697
+ return subagentDescriptions.length > 0 ? `
7520
7698
  Launch an ephemeral subagent to handle complex, multi-step independent tasks with isolated context windows.
7521
7699
 
7522
7700
  Available agent types and the tools they have access to:
@@ -7626,7 +7804,7 @@ Since the user is greeting, use the greeting-responder agent to respond with a f
7626
7804
  </commentary>
7627
7805
  assistant: "I'm going to use the Task tool to launch with the greeting-responder agent"
7628
7806
  </example>
7629
- `.trim();
7807
+ `.trim() : "No subagents available, you DON'T NEED TO USE THE TASK TOOL, just use the tools directly.";
7630
7808
  }
7631
7809
  var TASK_SYSTEM_PROMPT = `## \`task\` (subagent spawner)
7632
7810
 
@@ -7713,16 +7891,16 @@ function getSubagents(options) {
7713
7891
  }
7714
7892
  for (const agentParams of subagents) {
7715
7893
  subagentDescriptions.push(
7716
- `- ${agentParams.name}: ${agentParams.description}`
7894
+ `- ${agentParams.key}: ${agentParams.name} - ${agentParams.description}`
7717
7895
  );
7718
7896
  if ("runnable" in agentParams) {
7719
- agents[agentParams.name] = agentParams.runnable;
7897
+ agents[agentParams.key] = agentParams.runnable;
7720
7898
  } else {
7721
7899
  const middleware = agentParams.middleware ? [...defaultSubagentMiddleware, ...agentParams.middleware] : [...defaultSubagentMiddleware];
7722
7900
  const interruptOn = agentParams.interruptOn || defaultInterruptOn;
7723
7901
  if (interruptOn)
7724
7902
  middleware.push(humanInTheLoopMiddleware({ interruptOn }));
7725
- agents[agentParams.name] = createAgent2({
7903
+ agents[agentParams.key] = createAgent2({
7726
7904
  model: agentParams.model ?? defaultModel,
7727
7905
  systemPrompt: agentParams.systemPrompt,
7728
7906
  tools: agentParams.tools ?? defaultTools,
@@ -7751,7 +7929,7 @@ function createTaskTool(options) {
7751
7929
  generalPurposeAgent
7752
7930
  });
7753
7931
  const finalTaskDescription = taskDescription ? taskDescription : getTaskToolDescription(subagentDescriptions);
7754
- return tool42(
7932
+ return tool43(
7755
7933
  async (input, config) => {
7756
7934
  const { description, subagent_type } = input;
7757
7935
  try {
@@ -7770,7 +7948,12 @@ function createTaskTool(options) {
7770
7948
  const workerResult = await agentWorkerGraph.invoke({
7771
7949
  assistant_id: subagent_type,
7772
7950
  thread_id: subagent_thread_id,
7773
- input: { ...subagentState, message: description }
7951
+ input: { ...subagentState, message: description },
7952
+ runConfig: {
7953
+ ...config.configurable?.runConfig,
7954
+ assistant_id: subagent_type,
7955
+ thread_id: subagent_thread_id
7956
+ }
7774
7957
  });
7775
7958
  const result = workerResult.finalState?.values;
7776
7959
  if (!config.toolCall?.id) {
@@ -7794,9 +7977,9 @@ function createTaskTool(options) {
7794
7977
  {
7795
7978
  name: "task",
7796
7979
  description: finalTaskDescription,
7797
- schema: z42.object({
7798
- description: z42.string().describe("The task to execute with the selected agent"),
7799
- subagent_type: z42.string().describe(
7980
+ schema: z43.object({
7981
+ description: z43.string().describe("The task to execute with the selected agent"),
7982
+ subagent_type: z43.string().describe(
7800
7983
  `Name of the agent to use. Available: ${Object.keys(
7801
7984
  subagentGraphs
7802
7985
  ).join(", ")}`
@@ -8985,8 +9168,8 @@ var MemoryBackend = class {
8985
9168
 
8986
9169
  // src/deep_agent_new/middleware/todos.ts
8987
9170
  import { Command as Command3 } from "@langchain/langgraph";
8988
- import { z as z43 } from "zod";
8989
- import { createMiddleware as createMiddleware9, tool as tool43, ToolMessage as ToolMessage4 } from "langchain";
9171
+ import { z as z44 } from "zod";
9172
+ import { createMiddleware as createMiddleware9, tool as tool44, ToolMessage as ToolMessage4 } from "langchain";
8990
9173
  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.
8991
9174
  It also helps the user understand the progress of the task and overall progress of their requests.
8992
9175
  Only use this tool if you think it will be helpful in staying organized. If the user's request is trivial and takes less than 3 steps, it is better to NOT use this tool and just do the taks directly.
@@ -9213,14 +9396,14 @@ Writing todos takes time and tokens, use it when it is helpful for managing comp
9213
9396
  ## Important To-Do List Usage Notes to Remember
9214
9397
  - The \`write_todos\` tool should never be called multiple times in parallel.
9215
9398
  - Don't be afraid to revise the To-Do list as you go. New information may reveal new tasks that need to be done, or old tasks that are irrelevant.`;
9216
- var TodoStatus = z43.enum(["pending", "in_progress", "completed"]).describe("Status of the todo");
9217
- var TodoSchema = z43.object({
9218
- content: z43.string().describe("Content of the todo item"),
9399
+ var TodoStatus = z44.enum(["pending", "in_progress", "completed"]).describe("Status of the todo");
9400
+ var TodoSchema = z44.object({
9401
+ content: z44.string().describe("Content of the todo item"),
9219
9402
  status: TodoStatus
9220
9403
  });
9221
- var stateSchema = z43.object({ todos: z43.array(TodoSchema).default([]) });
9404
+ var stateSchema = z44.object({ todos: z44.array(TodoSchema).default([]) });
9222
9405
  function todoListMiddleware(options) {
9223
- const writeTodos = tool43(
9406
+ const writeTodos = tool44(
9224
9407
  ({ todos }, config) => {
9225
9408
  return new Command3({
9226
9409
  update: {
@@ -9237,8 +9420,8 @@ function todoListMiddleware(options) {
9237
9420
  {
9238
9421
  name: "write_todos",
9239
9422
  description: options?.toolDescription ?? WRITE_TODOS_DESCRIPTION,
9240
- schema: z43.object({
9241
- todos: z43.array(TodoSchema).describe("List of todo items to update")
9423
+ schema: z44.object({
9424
+ todos: z44.array(TodoSchema).describe("List of todo items to update")
9242
9425
  })
9243
9426
  }
9244
9427
  );
@@ -9385,10 +9568,11 @@ var DeepAgentGraphBuilder = class {
9385
9568
  const tools = params.tools.map((t) => {
9386
9569
  const toolClient = getToolClient(t.key);
9387
9570
  return toolClient;
9388
- }).filter((tool46) => tool46 !== void 0);
9571
+ }).filter((tool47) => tool47 !== void 0);
9389
9572
  const subagents = params.subAgents.map((sa) => {
9390
9573
  if (sa.client) {
9391
9574
  return {
9575
+ key: sa.config.key,
9392
9576
  name: sa.config.name,
9393
9577
  description: sa.config.description,
9394
9578
  runnable: sa.client
@@ -9398,6 +9582,7 @@ var DeepAgentGraphBuilder = class {
9398
9582
  config: sa.config
9399
9583
  });
9400
9584
  return {
9585
+ key: sa.config.key,
9401
9586
  name: sa.config.name,
9402
9587
  description: sa.config.description,
9403
9588
  runnable: subagentClient
@@ -9423,7 +9608,7 @@ var DeepAgentGraphBuilder = class {
9423
9608
  };
9424
9609
 
9425
9610
  // src/agent_team/agent_team.ts
9426
- import { z as z46 } from "zod/v3";
9611
+ import { z as z47 } from "zod/v3";
9427
9612
  import { createAgent as createAgent5 } from "langchain";
9428
9613
 
9429
9614
  // src/agent_team/types.ts
@@ -9859,14 +10044,14 @@ var InMemoryMailboxStore = class {
9859
10044
  };
9860
10045
 
9861
10046
  // src/agent_team/middleware/team.ts
9862
- import { z as z45 } from "zod/v3";
9863
- import { createMiddleware as createMiddleware10, createAgent as createAgent4, tool as tool45, ToolMessage as ToolMessage6 } from "langchain";
10047
+ import { z as z46 } from "zod/v3";
10048
+ import { createMiddleware as createMiddleware10, createAgent as createAgent4, tool as tool46, ToolMessage as ToolMessage6 } from "langchain";
9864
10049
  import { Command as Command5, getCurrentTaskInput as getCurrentTaskInput3 } from "@langchain/langgraph";
9865
10050
  import { v4 as uuidv4 } from "uuid";
9866
10051
 
9867
10052
  // src/agent_team/middleware/teammate_tools.ts
9868
- import { z as z44 } from "zod/v3";
9869
- import { tool as tool44, ToolMessage as ToolMessage5 } from "langchain";
10053
+ import { z as z45 } from "zod/v3";
10054
+ import { tool as tool45, ToolMessage as ToolMessage5 } from "langchain";
9870
10055
  import { Command as Command4 } from "@langchain/langgraph";
9871
10056
 
9872
10057
  // src/agent_team/middleware/formatMessages.ts
@@ -9891,7 +10076,7 @@ ${meta}${body}`;
9891
10076
  // src/agent_team/middleware/teammate_tools.ts
9892
10077
  function createTeammateTools(options) {
9893
10078
  const { teamId, agentId, taskListStore, mailboxStore } = options;
9894
- const claimTaskTool = tool44(
10079
+ const claimTaskTool = tool45(
9895
10080
  async (input) => {
9896
10081
  const task = await taskListStore.claimTaskById(
9897
10082
  teamId,
@@ -9916,12 +10101,12 @@ function createTeammateTools(options) {
9916
10101
  {
9917
10102
  name: "claim_task",
9918
10103
  description: "Pick a task to work on by task_id. Use check_tasks first to see all tasks; then call this with the task_id you choose. The task's assignee is set to you and you should focus on that task until you complete_task or fail_task it.",
9919
- schema: z44.object({
9920
- task_id: z44.string().describe("ID of the task to claim (e.g. task-01). Use check_tasks to see IDs.")
10104
+ schema: z45.object({
10105
+ task_id: z45.string().describe("ID of the task to claim (e.g. task-01). Use check_tasks to see IDs.")
9921
10106
  })
9922
10107
  }
9923
10108
  );
9924
- const completeTaskTool = tool44(
10109
+ const completeTaskTool = tool45(
9925
10110
  async (input) => {
9926
10111
  const task = await taskListStore.completeTask(
9927
10112
  teamId,
@@ -9942,13 +10127,13 @@ function createTeammateTools(options) {
9942
10127
  {
9943
10128
  name: "complete_task",
9944
10129
  description: "Mark a claimed task as completed with a result summary. Call this after you have finished working on a task.",
9945
- schema: z44.object({
9946
- task_id: z44.string().describe("ID of the task to complete"),
9947
- result: z44.string().describe("Summary of the task result")
10130
+ schema: z45.object({
10131
+ task_id: z45.string().describe("ID of the task to complete"),
10132
+ result: z45.string().describe("Summary of the task result")
9948
10133
  })
9949
10134
  }
9950
10135
  );
9951
- const failTaskTool = tool44(
10136
+ const failTaskTool = tool45(
9952
10137
  async (input) => {
9953
10138
  const task = await taskListStore.failTask(
9954
10139
  teamId,
@@ -9969,13 +10154,13 @@ function createTeammateTools(options) {
9969
10154
  {
9970
10155
  name: "fail_task",
9971
10156
  description: "Mark a claimed task as failed with an error description. Call this if you cannot complete the task.",
9972
- schema: z44.object({
9973
- task_id: z44.string().describe("ID of the task to fail"),
9974
- error: z44.string().describe("Description of why the task failed")
10157
+ schema: z45.object({
10158
+ task_id: z45.string().describe("ID of the task to fail"),
10159
+ error: z45.string().describe("Description of why the task failed")
9975
10160
  })
9976
10161
  }
9977
10162
  );
9978
- const sendMessageTool = tool44(
10163
+ const sendMessageTool = tool45(
9979
10164
  async (input) => {
9980
10165
  await mailboxStore.sendMessage(
9981
10166
  teamId,
@@ -9989,11 +10174,11 @@ function createTeammateTools(options) {
9989
10174
  {
9990
10175
  name: "send_message",
9991
10176
  description: 'Send a message to the team lead or another teammate via the mailbox. Use "team_lead" to message the team lead. Use this to report discoveries, request guidance, or suggest new tasks.',
9992
- schema: z44.object({
9993
- to: z44.string().describe(
10177
+ schema: z45.object({
10178
+ to: z45.string().describe(
9994
10179
  'Recipient agent name (e.g. "team_lead" or a teammate name)'
9995
10180
  ),
9996
- content: z44.string().describe("Message content")
10181
+ content: z45.string().describe("Message content")
9997
10182
  })
9998
10183
  }
9999
10184
  );
@@ -10013,7 +10198,7 @@ function createTeammateTools(options) {
10013
10198
  read: msg.read
10014
10199
  }));
10015
10200
  };
10016
- const readMessagesTool = tool44(
10201
+ const readMessagesTool = tool45(
10017
10202
  async (input, config) => {
10018
10203
  const formatAndMarkAsRead = async (msgs2) => {
10019
10204
  for (const msg of msgs2) {
@@ -10072,10 +10257,10 @@ function createTeammateTools(options) {
10072
10257
  {
10073
10258
  name: "read_messages",
10074
10259
  description: "Read unread messages from the mailbox. Returns immediately if messages exist, otherwise waits for up to 3 minutes for new messages.",
10075
- schema: z44.object({})
10260
+ schema: z45.object({})
10076
10261
  }
10077
10262
  );
10078
- const checkTasksTool = tool44(
10263
+ const checkTasksTool = tool45(
10079
10264
  async () => {
10080
10265
  const tasks = await taskListStore.getAllTasks(teamId);
10081
10266
  return formatTaskSummary(tasks);
@@ -10083,10 +10268,10 @@ function createTeammateTools(options) {
10083
10268
  {
10084
10269
  name: "check_tasks",
10085
10270
  description: "Use this tool to get the current status of all tasks in a team. This is your primary way to monitor task progress.",
10086
- schema: z44.object({})
10271
+ schema: z45.object({})
10087
10272
  }
10088
10273
  );
10089
- const broadcastMessageTool = tool44(
10274
+ const broadcastMessageTool = tool45(
10090
10275
  async (input) => {
10091
10276
  const allAgents = await mailboxStore.getRegisteredAgents(teamId);
10092
10277
  const recipients = allAgents.filter((a) => a !== agentId);
@@ -10105,8 +10290,8 @@ function createTeammateTools(options) {
10105
10290
  {
10106
10291
  name: "broadcast_message",
10107
10292
  description: "Send a message to everyone in the team except yourself. Use this to share updates or information with all teammates and the team lead at once.",
10108
- schema: z44.object({
10109
- content: z44.string().describe("Message content to broadcast to others")
10293
+ schema: z45.object({
10294
+ content: z45.string().describe("Message content to broadcast to others")
10110
10295
  })
10111
10296
  }
10112
10297
  );
@@ -10329,7 +10514,7 @@ async function spawnTeammate(options) {
10329
10514
  function createTeamMiddleware(options) {
10330
10515
  const { teamConfig, taskListStore, mailboxStore } = options;
10331
10516
  const defaultModel = teamConfig.model ?? "claude-sonnet-4-5-20250929";
10332
- const createTeamTool = tool45(
10517
+ const createTeamTool = tool46(
10333
10518
  async (input, config) => {
10334
10519
  const state = getCurrentTaskInput3();
10335
10520
  if (state?.team?.teamId) {
@@ -10480,20 +10665,20 @@ After calling create_team, you MUST:
10480
10665
  2. When messages indicate task changes, call check_tasks to get full task status
10481
10666
  3. Continue until all tasks show "completed" or "failed"
10482
10667
  4. Do NOT assume tasks are done - always verify with check_tasks`,
10483
- schema: z45.object({
10484
- tasks: z45.array(
10485
- z45.object({
10486
- id: z45.string().describe("Task ID in format task-01, task-02, etc."),
10487
- title: z45.string().describe("Short task title"),
10488
- description: z45.string().describe("Detailed task description - what exactly needs to be done"),
10489
- dependencies: z45.array(z45.string()).optional().default([]).describe('Array of task IDs that must complete before this task (e.g. ["task-01"])')
10668
+ schema: z46.object({
10669
+ tasks: z46.array(
10670
+ z46.object({
10671
+ id: z46.string().describe("Task ID in format task-01, task-02, etc."),
10672
+ title: z46.string().describe("Short task title"),
10673
+ description: z46.string().describe("Detailed task description - what exactly needs to be done"),
10674
+ dependencies: z46.array(z46.string()).optional().default([]).describe('Array of task IDs that must complete before this task (e.g. ["task-01"])')
10490
10675
  })
10491
10676
  ).describe("List of tasks for teammates to work on. Each task needs unique ID (task-01, task-02, etc.)."),
10492
- teammates: z45.array(
10493
- z45.object({
10494
- name: z45.string().describe("Teammate name (must match a pre-configured teammate type)"),
10495
- role: z45.string().describe("Role category (e.g. researcher, writer, coder, reviewer)"),
10496
- description: z45.string().describe("What this teammate will focus on - specific instructions for their work")
10677
+ teammates: z46.array(
10678
+ z46.object({
10679
+ name: z46.string().describe("Teammate name (must match a pre-configured teammate type)"),
10680
+ role: z46.string().describe("Role category (e.g. researcher, writer, coder, reviewer)"),
10681
+ description: z46.string().describe("What this teammate will focus on - specific instructions for their work")
10497
10682
  })
10498
10683
  ).describe("Teammate agents to create. Each should have a clear role and focus.")
10499
10684
  })
@@ -10504,7 +10689,7 @@ After calling create_team, you MUST:
10504
10689
  if (state?.team?.teamId) return state.team.teamId;
10505
10690
  throw new Error("No team_id provided and no team in state. Call create_team first.");
10506
10691
  };
10507
- const addTasksTool = tool45(
10692
+ const addTasksTool = tool46(
10508
10693
  async (input, config) => {
10509
10694
  const teamId = resolveTeamId();
10510
10695
  const created = await taskListStore.addTasks(
@@ -10556,20 +10741,20 @@ IMPORTANT: Dependencies
10556
10741
 
10557
10742
  IMPORTANT: Assigning to a specific teammate
10558
10743
  - When you need a particular teammate to do the work, set assignee to that teammate's name (e.g. assignee: "researcher"). They can then claim or see the task as assigned to them.`,
10559
- schema: z45.object({
10560
- tasks: z45.array(
10561
- z45.object({
10562
- id: z45.string().describe("Task ID in format task-01, task-02, etc. Must be unique."),
10563
- title: z45.string().describe("Short task title"),
10564
- description: z45.string().describe("Detailed task description - what needs to be done"),
10565
- assignee: z45.string().optional().describe("Teammate name to assign this task to (use when you need that person to do the work)"),
10566
- dependencies: z45.array(z45.string()).optional().default([]).describe("Array of task IDs that must complete before this task")
10744
+ schema: z46.object({
10745
+ tasks: z46.array(
10746
+ z46.object({
10747
+ id: z46.string().describe("Task ID in format task-01, task-02, etc. Must be unique."),
10748
+ title: z46.string().describe("Short task title"),
10749
+ description: z46.string().describe("Detailed task description - what needs to be done"),
10750
+ assignee: z46.string().optional().describe("Teammate name to assign this task to (use when you need that person to do the work)"),
10751
+ dependencies: z46.array(z46.string()).optional().default([]).describe("Array of task IDs that must complete before this task")
10567
10752
  })
10568
10753
  ).describe("New tasks to add to the team")
10569
10754
  })
10570
10755
  }
10571
10756
  );
10572
- const assignTaskTool = tool45(
10757
+ const assignTaskTool = tool46(
10573
10758
  async (input, config) => {
10574
10759
  const teamId = resolveTeamId();
10575
10760
  const task = await taskListStore.updateTask(teamId, input.task_id, {
@@ -10591,13 +10776,13 @@ IMPORTANT: Assigning to a specific teammate
10591
10776
  {
10592
10777
  name: "assign_task",
10593
10778
  description: "Assign a task to a specific teammate. Use when you need to reassign work to a different teammate. Omit team_id to use the active team from state.",
10594
- schema: z45.object({
10595
- task_id: z45.string().describe("Task ID to assign"),
10596
- assignee: z45.string().describe("Teammate name to assign this task to")
10779
+ schema: z46.object({
10780
+ task_id: z46.string().describe("Task ID to assign"),
10781
+ assignee: z46.string().describe("Teammate name to assign this task to")
10597
10782
  })
10598
10783
  }
10599
10784
  );
10600
- const setTaskStatusTool = tool45(
10785
+ const setTaskStatusTool = tool46(
10601
10786
  async (input, config) => {
10602
10787
  const teamId = resolveTeamId();
10603
10788
  const task = await taskListStore.updateTask(teamId, input.task_id, {
@@ -10619,13 +10804,13 @@ IMPORTANT: Assigning to a specific teammate
10619
10804
  {
10620
10805
  name: "set_task_status",
10621
10806
  description: "Set a task's status. Use to reopen a task (set to pending), mark as failed, or correct status. Values: pending, claimed, in_progress, completed, failed. Omit team_id to use the active team from state.",
10622
- schema: z45.object({
10623
- task_id: z45.string().describe("Task ID to update"),
10624
- status: z45.enum(["pending", "claimed", "in_progress", "completed", "failed"]).describe("New status for the task")
10807
+ schema: z46.object({
10808
+ task_id: z46.string().describe("Task ID to update"),
10809
+ status: z46.enum(["pending", "claimed", "in_progress", "completed", "failed"]).describe("New status for the task")
10625
10810
  })
10626
10811
  }
10627
10812
  );
10628
- const setTaskDependenciesTool = tool45(
10813
+ const setTaskDependenciesTool = tool46(
10629
10814
  async (input, config) => {
10630
10815
  const teamId = resolveTeamId();
10631
10816
  const task = await taskListStore.updateTask(teamId, input.task_id, {
@@ -10647,13 +10832,13 @@ IMPORTANT: Assigning to a specific teammate
10647
10832
  {
10648
10833
  name: "set_task_dependencies",
10649
10834
  description: 'Set which task IDs must complete before this task can be claimed. Pass an array of task IDs (e.g. ["task-01", "task-02"]). Use to fix task order or add/remove dependencies. Omit team_id to use the active team from state.',
10650
- schema: z45.object({
10651
- task_id: z45.string().describe("Task ID to update"),
10652
- dependencies: z45.array(z45.string()).describe("Task IDs that must complete before this task can be claimed")
10835
+ schema: z46.object({
10836
+ task_id: z46.string().describe("Task ID to update"),
10837
+ dependencies: z46.array(z46.string()).describe("Task IDs that must complete before this task can be claimed")
10653
10838
  })
10654
10839
  }
10655
10840
  );
10656
- const checkTasksTool = tool45(
10841
+ const checkTasksTool = tool46(
10657
10842
  async (input, config) => {
10658
10843
  const teamId = resolveTeamId();
10659
10844
  const tasks = await taskListStore.getAllTasks(teamId);
@@ -10693,12 +10878,12 @@ Task Status Values:
10693
10878
  - in_progress: Teammate is actively working on this task
10694
10879
  - completed: Task finished successfully
10695
10880
  - failed: Task encountered an error`,
10696
- schema: z45.object({
10697
- team_id: z45.string().optional().describe("Team ID (omit to use active team)")
10881
+ schema: z46.object({
10882
+ team_id: z46.string().optional().describe("Team ID (omit to use active team)")
10698
10883
  })
10699
10884
  }
10700
10885
  );
10701
- const sendMessageTool = tool45(
10886
+ const sendMessageTool = tool46(
10702
10887
  async (input, config) => {
10703
10888
  const teamId = resolveTeamId();
10704
10889
  await mailboxStore.sendMessage(
@@ -10717,13 +10902,13 @@ Task Status Values:
10717
10902
  {
10718
10903
  name: "send_message",
10719
10904
  description: "Send a message to a specific teammate in the team. Omit team_id to use the active team from state.",
10720
- schema: z45.object({
10721
- to: z45.string().describe("Recipient teammate name"),
10722
- content: z45.string().describe("Message content")
10905
+ schema: z46.object({
10906
+ to: z46.string().describe("Recipient teammate name"),
10907
+ content: z46.string().describe("Message content")
10723
10908
  })
10724
10909
  }
10725
10910
  );
10726
- const readMessagesTool = tool45(
10911
+ const readMessagesTool = tool46(
10727
10912
  async (input, config) => {
10728
10913
  const teamId = resolveTeamId();
10729
10914
  const formatAndMarkAsRead = async (msgs2) => {
@@ -10805,12 +10990,12 @@ Task Status Values:
10805
10990
  {
10806
10991
  name: "read_messages",
10807
10992
  description: "Read unread messages from teammates. Returns immediately if messages exist, otherwise waits for up to 3 minutes for new messages.",
10808
- schema: z45.object({
10809
- team_id: z45.string().optional().describe("Team ID (omit to use active team)")
10993
+ schema: z46.object({
10994
+ team_id: z46.string().optional().describe("Team ID (omit to use active team)")
10810
10995
  })
10811
10996
  }
10812
10997
  );
10813
- const disbandTeamTool = tool45(
10998
+ const disbandTeamTool = tool46(
10814
10999
  async (input, config) => {
10815
11000
  const teamId = resolveTeamId();
10816
11001
  await mailboxStore.broadcastMessage(
@@ -10831,7 +11016,7 @@ Task Status Values:
10831
11016
  description: "Disband a team when all work is done. Before calling: (1) Call check_tasks to verify no tasks are still pending/in_progress; (2) if any are, discuss with the team via read_messages and broadcast_message/send_message whether to continue or stop/cancel them; (3) only after alignment (all tasks completed/failed or explicitly stopped), then call this tool. This will: 1) Send a shutdown message to all teammates, 2) Wait briefly for them to clean up, 3) Clear all tasks and messages. Omit team_id to use the active team from state."
10832
11017
  }
10833
11018
  );
10834
- const broadcastMessageTool = tool45(
11019
+ const broadcastMessageTool = tool46(
10835
11020
  async (input, config) => {
10836
11021
  const teamId = resolveTeamId();
10837
11022
  await mailboxStore.broadcastMessage(
@@ -10849,8 +11034,8 @@ Task Status Values:
10849
11034
  {
10850
11035
  name: "broadcast_message",
10851
11036
  description: "Send a message to all teammates at once. Use this to communicate with everyone in the team. Omit team_id to use the active team from state.",
10852
- schema: z45.object({
10853
- content: z45.string().describe("Message content to broadcast to all teammates")
11037
+ schema: z46.object({
11038
+ content: z46.string().describe("Message content to broadcast to all teammates")
10854
11039
  })
10855
11040
  }
10856
11041
  );
@@ -10882,37 +11067,37 @@ ${TEAM_SYSTEM_PROMPT}` : TEAM_SYSTEM_PROMPT;
10882
11067
  }
10883
11068
 
10884
11069
  // src/agent_team/agent_team.ts
10885
- var TeammateInfoSchema = z46.object({
10886
- name: z46.string().describe("Teammate name"),
10887
- role: z46.string().describe("Role category (e.g. research, writing, review)"),
10888
- description: z46.string().describe("What this teammate focuses on")
11070
+ var TeammateInfoSchema = z47.object({
11071
+ name: z47.string().describe("Teammate name"),
11072
+ role: z47.string().describe("Role category (e.g. research, writing, review)"),
11073
+ description: z47.string().describe("What this teammate focuses on")
10889
11074
  });
10890
- var TeamTaskInfoSchema = z46.object({
10891
- id: z46.string(),
10892
- title: z46.string(),
10893
- description: z46.string(),
10894
- status: z46.string().optional()
11075
+ var TeamTaskInfoSchema = z47.object({
11076
+ id: z47.string(),
11077
+ title: z47.string(),
11078
+ description: z47.string(),
11079
+ status: z47.string().optional()
10895
11080
  });
10896
- var MailboxMessageSchema = z46.object({
10897
- id: z46.string().describe("Unique message identifier"),
10898
- from: z46.string().describe("Sender agent name"),
10899
- to: z46.string().describe("Recipient agent name"),
10900
- content: z46.string().describe("Message content"),
10901
- timestamp: z46.string().describe("ISO timestamp when the message was sent"),
10902
- type: z46.nativeEnum(MessageType).describe("Message type"),
10903
- read: z46.boolean().describe("Whether the recipient has read this message")
11081
+ var MailboxMessageSchema = z47.object({
11082
+ id: z47.string().describe("Unique message identifier"),
11083
+ from: z47.string().describe("Sender agent name"),
11084
+ to: z47.string().describe("Recipient agent name"),
11085
+ content: z47.string().describe("Message content"),
11086
+ timestamp: z47.string().describe("ISO timestamp when the message was sent"),
11087
+ type: z47.nativeEnum(MessageType).describe("Message type"),
11088
+ read: z47.boolean().describe("Whether the recipient has read this message")
10904
11089
  });
10905
- var TeamInfoSchema = z46.object({
10906
- teamId: z46.string().describe("Unique team identifier"),
10907
- teamLeadId: z46.string().default("team_lead").describe("Team lead agent ID"),
10908
- teammates: z46.array(TeammateInfoSchema).describe("Active teammates in this team"),
10909
- tasks: z46.array(TeamTaskInfoSchema).optional().describe("Initial tasks snapshot"),
10910
- createdAt: z46.string().optional().describe("ISO timestamp when team was created")
11090
+ var TeamInfoSchema = z47.object({
11091
+ teamId: z47.string().describe("Unique team identifier"),
11092
+ teamLeadId: z47.string().default("team_lead").describe("Team lead agent ID"),
11093
+ teammates: z47.array(TeammateInfoSchema).describe("Active teammates in this team"),
11094
+ tasks: z47.array(TeamTaskInfoSchema).optional().describe("Initial tasks snapshot"),
11095
+ createdAt: z47.string().optional().describe("ISO timestamp when team was created")
10911
11096
  });
10912
- var TEAM_STATE_SCHEMA = z46.object({
11097
+ var TEAM_STATE_SCHEMA = z47.object({
10913
11098
  team: TeamInfoSchema.optional().describe("Team info: teamId, teamLeadId, teammates, tasks. Set when create_team succeeds."),
10914
- tasks: z46.array(TeamTaskInfoSchema).optional().describe("Current tasks snapshot from check_tasks. Updated on each check."),
10915
- team_mailbox: z46.array(MailboxMessageSchema).optional().describe("All team mailbox messages for display")
11099
+ tasks: z47.array(TeamTaskInfoSchema).optional().describe("Current tasks snapshot from check_tasks. Updated on each check."),
11100
+ team_mailbox: z47.array(MailboxMessageSchema).optional().describe("All team mailbox messages for display")
10916
11101
  });
10917
11102
  var TEAM_LEAD_BASE_PROMPT = `You are a team lead that coordinates a team of specialized agents. In order to complete the objective that the user asks of you, you will need to:
10918
11103
 
@@ -10992,7 +11177,7 @@ var TeamAgentGraphBuilder = class {
10992
11177
  const tools = params.tools.map((t) => {
10993
11178
  const toolClient = getToolClient(t.key);
10994
11179
  return toolClient;
10995
- }).filter((tool46) => tool46 !== void 0);
11180
+ }).filter((tool47) => tool47 !== void 0);
10996
11181
  const teammates = params.subAgents.map((sa) => {
10997
11182
  const baseConfig = sa.config;
10998
11183
  return {
@@ -13669,10 +13854,10 @@ var McpLatticeManager = class _McpLatticeManager extends BaseLatticeManager {
13669
13854
  }
13670
13855
  const tools = await this.getAllTools();
13671
13856
  console.log(`[MCP] Registering ${tools.length} tools to Tool Lattice...`);
13672
- for (const tool46 of tools) {
13673
- const toolKey = prefix ? `${prefix}_${tool46.name}` : tool46.name;
13674
- tool46.name = toolKey;
13675
- toolLatticeManager.registerExistingTool(toolKey, tool46);
13857
+ for (const tool47 of tools) {
13858
+ const toolKey = prefix ? `${prefix}_${tool47.name}` : tool47.name;
13859
+ tool47.name = toolKey;
13860
+ toolLatticeManager.registerExistingTool(toolKey, tool47);
13676
13861
  console.log(`[MCP] Registered tool: ${toolKey}`);
13677
13862
  }
13678
13863
  console.log(`[MCP] Successfully registered ${tools.length} tools to Tool Lattice`);
@@ -13810,6 +13995,7 @@ export {
13810
13995
  checkEmptyContent,
13811
13996
  clearEncryptionKeyCache,
13812
13997
  createAgentTeam,
13998
+ createExecuteSqlQueryTool,
13813
13999
  createFileData,
13814
14000
  createInfoSqlTool,
13815
14001
  createListMetricsDataSourcesTool,