@axiom-lattice/core 2.1.27 → 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.d.mts +41 -40
- package/dist/index.d.ts +41 -40
- package/dist/index.js +109 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +109 -44
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1911,6 +1911,20 @@ ${serverKeys.map(
|
|
|
1911
1911
|
return tool7(
|
|
1912
1912
|
async (_input, _exeConfig) => {
|
|
1913
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
|
+
}
|
|
1914
1928
|
if (serverKeys.length === 0) {
|
|
1915
1929
|
return "No metrics servers configured.";
|
|
1916
1930
|
}
|
|
@@ -2006,10 +2020,13 @@ ${serverKeys.map(
|
|
|
2006
2020
|
).join("\n")}` : "";
|
|
2007
2021
|
return tool8(
|
|
2008
2022
|
async ({
|
|
2009
|
-
serverKey,
|
|
2023
|
+
serverKey: inputServerKey,
|
|
2010
2024
|
datasourceIds
|
|
2011
2025
|
}, _exeConfig) => {
|
|
2012
2026
|
try {
|
|
2027
|
+
const runConfig = _exeConfig?.configurable?.runConfig || {};
|
|
2028
|
+
const metricsDataSource = runConfig.metricsDataSource;
|
|
2029
|
+
const serverKey = metricsDataSource?.serverKey || inputServerKey;
|
|
2013
2030
|
if (!serverKey) {
|
|
2014
2031
|
return "Error: serverKey parameter is required. Available servers: " + serverKeys.join(", ");
|
|
2015
2032
|
}
|
|
@@ -2021,7 +2038,7 @@ ${serverKeys.map(
|
|
|
2021
2038
|
return `Error: Server "${serverKey}" is not a semantic metrics server. This tool only works with semantic servers.`;
|
|
2022
2039
|
}
|
|
2023
2040
|
const client = metricsServerManager.getClient(serverKey);
|
|
2024
|
-
const targetDatasourceIds = datasourceIds && datasourceIds.length > 0 ? datasourceIds : client.getSelectedDataSources();
|
|
2041
|
+
const targetDatasourceIds = datasourceIds && datasourceIds.length > 0 ? datasourceIds : metricsDataSource?.datasourceId ? [metricsDataSource.datasourceId] : client.getSelectedDataSources();
|
|
2025
2042
|
if (targetDatasourceIds.length === 0) {
|
|
2026
2043
|
return `Error: No data sources specified and no default data sources configured for server "${serverKey}".`;
|
|
2027
2044
|
}
|
|
@@ -2069,7 +2086,7 @@ ${serverKeys.map(
|
|
|
2069
2086
|
for (const dsId of sortedDatasourceIds) {
|
|
2070
2087
|
const metrics = metricsByDatasource.get(dsId);
|
|
2071
2088
|
const sortedMetrics = metrics.sort((a, b) => {
|
|
2072
|
-
if (a.domain !== b.domain) {
|
|
2089
|
+
if (a.domain && a.domain !== b.domain) {
|
|
2073
2090
|
return a.domain.localeCompare(b.domain);
|
|
2074
2091
|
}
|
|
2075
2092
|
return a.metricName.localeCompare(b.metricName);
|
|
@@ -2096,8 +2113,8 @@ ${serverKeys.map(
|
|
|
2096
2113
|
name: "query_metrics_list",
|
|
2097
2114
|
description: `${QUERY_METRICS_LIST_DESCRIPTION}${availableServersText}`,
|
|
2098
2115
|
schema: z9.object({
|
|
2099
|
-
serverKey: z9.string().describe(`Target semantic metrics server. Choose from: ${serverKeys.join(", ")}`),
|
|
2100
|
-
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.")
|
|
2101
2118
|
})
|
|
2102
2119
|
}
|
|
2103
2120
|
);
|
|
@@ -2154,11 +2171,15 @@ ${serverKeys.map(
|
|
|
2154
2171
|
).join("\n")}` : "";
|
|
2155
2172
|
return tool9(
|
|
2156
2173
|
async ({
|
|
2157
|
-
serverKey,
|
|
2174
|
+
serverKey: inputServerKey,
|
|
2158
2175
|
metricName,
|
|
2159
|
-
datasourceId
|
|
2176
|
+
datasourceId: inputDatasourceId
|
|
2160
2177
|
}, _exeConfig) => {
|
|
2161
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;
|
|
2162
2183
|
if (!serverKey) {
|
|
2163
2184
|
return "Error: serverKey parameter is required. Available servers: " + serverKeys.join(", ");
|
|
2164
2185
|
}
|
|
@@ -2217,12 +2238,20 @@ ${serverKeys.map(
|
|
|
2217
2238
|
lines.push(foundDetail.description);
|
|
2218
2239
|
lines.push("");
|
|
2219
2240
|
if (foundDetail.defaultTimeContext) {
|
|
2241
|
+
const dtc = foundDetail.defaultTimeContext;
|
|
2220
2242
|
lines.push(`## \u65F6\u95F4\u4E0A\u4E0B\u6587`);
|
|
2221
2243
|
lines.push("");
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
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"}`);
|
|
2226
2255
|
lines.push("");
|
|
2227
2256
|
}
|
|
2228
2257
|
if (foundDetail.supportedDimensions && foundDetail.supportedDimensions.length > 0) {
|
|
@@ -2286,10 +2315,12 @@ ${serverKeys.map(
|
|
|
2286
2315
|
const aiContext = foundDetail.aiAgentContext;
|
|
2287
2316
|
lines.push(`## AI \u5206\u6790\u4E0A\u4E0B\u6587`);
|
|
2288
2317
|
lines.push("");
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
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
|
+
}
|
|
2293
2324
|
if (aiContext.synonyms && aiContext.synonyms.length > 0) {
|
|
2294
2325
|
lines.push(`### \u540C\u4E49\u8BCD/\u522B\u540D`);
|
|
2295
2326
|
lines.push("");
|
|
@@ -2312,7 +2343,9 @@ ${serverKeys.map(
|
|
|
2312
2343
|
if (aiContext.diagnosticWorkflow.trigger && aiContext.diagnosticWorkflow.trigger.any_of) {
|
|
2313
2344
|
lines.push(`**\u89E6\u53D1\u6761\u4EF6** (\u6EE1\u8DB3\u4EFB\u4E00):`);
|
|
2314
2345
|
for (const trigger of aiContext.diagnosticWorkflow.trigger.any_of) {
|
|
2315
|
-
|
|
2346
|
+
if (trigger.metric && trigger.operator) {
|
|
2347
|
+
lines.push(`- ${trigger.metric} ${trigger.operator} ${trigger.value ?? "N/A"}`);
|
|
2348
|
+
}
|
|
2316
2349
|
}
|
|
2317
2350
|
lines.push("");
|
|
2318
2351
|
}
|
|
@@ -2320,14 +2353,17 @@ ${serverKeys.map(
|
|
|
2320
2353
|
lines.push(`**\u5206\u6790\u52A8\u4F5C**:`);
|
|
2321
2354
|
for (let i = 0; i < aiContext.diagnosticWorkflow.actions.length; i++) {
|
|
2322
2355
|
const action = aiContext.diagnosticWorkflow.actions[i];
|
|
2323
|
-
|
|
2356
|
+
if (!action) continue;
|
|
2357
|
+
lines.push(`${i + 1}. **${action.type ?? "\u672A\u547D\u540D\u52A8\u4F5C"}**`);
|
|
2324
2358
|
if (action.metric) {
|
|
2325
2359
|
lines.push(` - \u5BF9\u6BD4\u6307\u6807: ${action.metric}`);
|
|
2326
2360
|
}
|
|
2327
2361
|
if (action.dimensions && action.dimensions.length > 0) {
|
|
2328
2362
|
lines.push(` - \u4E0B\u94BB\u7EF4\u5EA6: ${action.dimensions.join("\u3001")}`);
|
|
2329
2363
|
}
|
|
2330
|
-
|
|
2364
|
+
if (action.intent) {
|
|
2365
|
+
lines.push(` - \u76EE\u7684: ${action.intent}`);
|
|
2366
|
+
}
|
|
2331
2367
|
}
|
|
2332
2368
|
lines.push("");
|
|
2333
2369
|
}
|
|
@@ -2361,9 +2397,9 @@ ${serverKeys.map(
|
|
|
2361
2397
|
name: "query_metric_definition",
|
|
2362
2398
|
description: `${QUERY_METRIC_DEFINITION_DESCRIPTION}${availableServersText}`,
|
|
2363
2399
|
schema: z10.object({
|
|
2364
|
-
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`),
|
|
2365
2401
|
metricName: z10.string().describe("The name of the metric to get definition for."),
|
|
2366
|
-
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.")
|
|
2367
2403
|
})
|
|
2368
2404
|
}
|
|
2369
2405
|
);
|
|
@@ -2555,14 +2591,18 @@ ${serverKeys.map(
|
|
|
2555
2591
|
).join("\n")}` : "";
|
|
2556
2592
|
return tool10(
|
|
2557
2593
|
async ({
|
|
2558
|
-
serverKey,
|
|
2559
|
-
datasourceId,
|
|
2594
|
+
serverKey: inputServerKey,
|
|
2595
|
+
datasourceId: inputDatasourceId,
|
|
2560
2596
|
metrics,
|
|
2561
2597
|
groupBy,
|
|
2562
2598
|
filters,
|
|
2563
2599
|
limit
|
|
2564
2600
|
}, _exeConfig) => {
|
|
2565
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;
|
|
2566
2606
|
if (!serverKey) {
|
|
2567
2607
|
return "Error: serverKey parameter is required. Available servers: " + serverKeys.join(", ");
|
|
2568
2608
|
}
|
|
@@ -2585,6 +2625,7 @@ ${serverKeys.map(
|
|
|
2585
2625
|
operator: f.operator,
|
|
2586
2626
|
values: f.values
|
|
2587
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}`);
|
|
2588
2629
|
const result = await client.semanticQuery({
|
|
2589
2630
|
datasourceId,
|
|
2590
2631
|
metrics,
|
|
@@ -2605,8 +2646,8 @@ ${serverKeys.map(
|
|
|
2605
2646
|
name: "query_semantic_metric_data",
|
|
2606
2647
|
description: `${QUERY_SEMANTIC_METRIC_DATA_DESCRIPTION}${availableServersText}`,
|
|
2607
2648
|
schema: z11.object({
|
|
2608
|
-
serverKey: z11.string().describe(`Target semantic metrics server. Choose from: ${serverKeys.join(", ")}`),
|
|
2609
|
-
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"),
|
|
2610
2651
|
metrics: z11.array(z11.string()).describe("Array of metric names to query (e.g., ['net_sales_amt', 'gross_profit'])."),
|
|
2611
2652
|
groupBy: z11.array(z11.string()).optional().describe("Optional array of dimensions to group by (e.g., ['DocDate__month', 'CustomerCode'])."),
|
|
2612
2653
|
filters: z11.array(z11.object({
|
|
@@ -2633,10 +2674,13 @@ ${serverKeys.map(
|
|
|
2633
2674
|
).join("\n")}` : "";
|
|
2634
2675
|
return tool11(
|
|
2635
2676
|
async ({
|
|
2636
|
-
serverKey,
|
|
2677
|
+
serverKey: inputServerKey,
|
|
2637
2678
|
datasourceIds
|
|
2638
2679
|
}, _exeConfig) => {
|
|
2639
2680
|
try {
|
|
2681
|
+
const runConfig = _exeConfig?.configurable?.runConfig || {};
|
|
2682
|
+
const metricsDataSource = runConfig.metricsDataSource;
|
|
2683
|
+
const serverKey = metricsDataSource?.serverKey || inputServerKey;
|
|
2640
2684
|
if (!serverKey) {
|
|
2641
2685
|
return "Error: serverKey parameter is required. Available servers: " + serverKeys.join(", ");
|
|
2642
2686
|
}
|
|
@@ -2648,7 +2692,7 @@ ${serverKeys.map(
|
|
|
2648
2692
|
return `Error: Server "${serverKey}" is not a semantic metrics server. This tool only works with semantic servers.`;
|
|
2649
2693
|
}
|
|
2650
2694
|
const client = metricsServerManager.getClient(serverKey);
|
|
2651
|
-
const targetDatasourceIds = datasourceIds && datasourceIds.length > 0 ? datasourceIds : client.getSelectedDataSources();
|
|
2695
|
+
const targetDatasourceIds = datasourceIds && datasourceIds.length > 0 ? datasourceIds : metricsDataSource?.datasourceId ? [metricsDataSource.datasourceId] : client.getSelectedDataSources();
|
|
2652
2696
|
if (targetDatasourceIds.length === 0) {
|
|
2653
2697
|
return `Error: No data sources specified and no default data sources configured for server "${serverKey}".`;
|
|
2654
2698
|
}
|
|
@@ -2708,8 +2752,8 @@ ${serverKeys.map(
|
|
|
2708
2752
|
name: "query_tables_list",
|
|
2709
2753
|
description: `${QUERY_TABLES_LIST_DESCRIPTION}${availableServersText}`,
|
|
2710
2754
|
schema: z12.object({
|
|
2711
|
-
serverKey: z12.string().describe(`Target semantic metrics server. Choose from: ${serverKeys.join(", ")}`),
|
|
2712
|
-
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.")
|
|
2713
2757
|
})
|
|
2714
2758
|
}
|
|
2715
2759
|
);
|
|
@@ -2728,11 +2772,15 @@ ${serverKeys.map(
|
|
|
2728
2772
|
).join("\n")}` : "";
|
|
2729
2773
|
return tool12(
|
|
2730
2774
|
async ({
|
|
2731
|
-
serverKey,
|
|
2775
|
+
serverKey: inputServerKey,
|
|
2732
2776
|
tableName,
|
|
2733
|
-
datasourceId
|
|
2777
|
+
datasourceId: inputDatasourceId
|
|
2734
2778
|
}, _exeConfig) => {
|
|
2735
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;
|
|
2736
2784
|
if (!serverKey) {
|
|
2737
2785
|
return "Error: serverKey parameter is required. Available servers: " + serverKeys.join(", ");
|
|
2738
2786
|
}
|
|
@@ -2820,9 +2868,9 @@ ${serverKeys.map(
|
|
|
2820
2868
|
name: "query_table_definition",
|
|
2821
2869
|
description: `${QUERY_TABLE_DEFINITION_DESCRIPTION}${availableServersText}`,
|
|
2822
2870
|
schema: z13.object({
|
|
2823
|
-
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`),
|
|
2824
2872
|
tableName: z13.string().describe("The name of the table to get definition for."),
|
|
2825
|
-
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.")
|
|
2826
2874
|
})
|
|
2827
2875
|
}
|
|
2828
2876
|
);
|
|
@@ -2876,13 +2924,17 @@ ${serverKeys.map(
|
|
|
2876
2924
|
).join("\n")}` : "";
|
|
2877
2925
|
return tool13(
|
|
2878
2926
|
async ({
|
|
2879
|
-
serverKey,
|
|
2880
|
-
datasourceId,
|
|
2927
|
+
serverKey: inputServerKey,
|
|
2928
|
+
datasourceId: inputDatasourceId,
|
|
2881
2929
|
customSql,
|
|
2882
2930
|
params,
|
|
2883
2931
|
limit
|
|
2884
2932
|
}, _exeConfig) => {
|
|
2885
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;
|
|
2886
2938
|
if (!serverKey) {
|
|
2887
2939
|
return "Error: serverKey parameter is required. Available servers: " + serverKeys.join(", ");
|
|
2888
2940
|
}
|
|
@@ -2915,8 +2967,8 @@ ${serverKeys.map(
|
|
|
2915
2967
|
name: "execute_sql_query",
|
|
2916
2968
|
description: `${EXECUTE_SQL_QUERY_DESCRIPTION}${availableServersText}`,
|
|
2917
2969
|
schema: z14.object({
|
|
2918
|
-
serverKey: z14.string().describe(`Target semantic metrics server. Choose from: ${serverKeys.join(", ")}`),
|
|
2919
|
-
datasourceId: z14.string().describe("The data source ID to execute SQL against."),
|
|
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"),
|
|
2920
2972
|
customSql: z14.string().describe("Custom SQL query string with named parameters (e.g., :year, :category). Use double quotes for identifiers."),
|
|
2921
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."),
|
|
2922
2974
|
limit: z14.number().optional().describe("Maximum number of results to return (default: 1000).")
|
|
@@ -7549,6 +7601,11 @@ var AgentWorkerState = Annotation.Root({
|
|
|
7549
7601
|
reducer: (x, y) => y ?? x,
|
|
7550
7602
|
default: () => void 0
|
|
7551
7603
|
}),
|
|
7604
|
+
// RunConfig for passing configuration through the graph
|
|
7605
|
+
runConfig: Annotation({
|
|
7606
|
+
reducer: (x, y) => y ?? x,
|
|
7607
|
+
default: () => void 0
|
|
7608
|
+
}),
|
|
7552
7609
|
// Execution result
|
|
7553
7610
|
result: Annotation({
|
|
7554
7611
|
reducer: (x, y) => y ?? x,
|
|
@@ -7566,12 +7623,13 @@ var AgentWorkerState = Annotation.Root({
|
|
|
7566
7623
|
})
|
|
7567
7624
|
});
|
|
7568
7625
|
async function executeNode(state) {
|
|
7569
|
-
const { assistant_id, thread_id, input, command2 } = state;
|
|
7626
|
+
const { assistant_id, thread_id, input, command2, runConfig } = state;
|
|
7570
7627
|
const callParams = {
|
|
7571
7628
|
assistant_id,
|
|
7572
7629
|
thread_id,
|
|
7573
7630
|
input,
|
|
7574
|
-
command: command2
|
|
7631
|
+
command: command2,
|
|
7632
|
+
runConfig
|
|
7575
7633
|
};
|
|
7576
7634
|
const result = await AgentManager.getInstance().callAgentInQueue(
|
|
7577
7635
|
callParams,
|
|
@@ -7636,7 +7694,7 @@ var DEFAULT_SUBAGENT_PROMPT = "In order to complete the objective that the user
|
|
|
7636
7694
|
var EXCLUDED_STATE_KEYS = ["messages", "todos", "jumpTo"];
|
|
7637
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.";
|
|
7638
7696
|
function getTaskToolDescription(subagentDescriptions) {
|
|
7639
|
-
return `
|
|
7697
|
+
return subagentDescriptions.length > 0 ? `
|
|
7640
7698
|
Launch an ephemeral subagent to handle complex, multi-step independent tasks with isolated context windows.
|
|
7641
7699
|
|
|
7642
7700
|
Available agent types and the tools they have access to:
|
|
@@ -7746,7 +7804,7 @@ Since the user is greeting, use the greeting-responder agent to respond with a f
|
|
|
7746
7804
|
</commentary>
|
|
7747
7805
|
assistant: "I'm going to use the Task tool to launch with the greeting-responder agent"
|
|
7748
7806
|
</example>
|
|
7749
|
-
`.trim();
|
|
7807
|
+
`.trim() : "No subagents available, you DON'T NEED TO USE THE TASK TOOL, just use the tools directly.";
|
|
7750
7808
|
}
|
|
7751
7809
|
var TASK_SYSTEM_PROMPT = `## \`task\` (subagent spawner)
|
|
7752
7810
|
|
|
@@ -7833,16 +7891,16 @@ function getSubagents(options) {
|
|
|
7833
7891
|
}
|
|
7834
7892
|
for (const agentParams of subagents) {
|
|
7835
7893
|
subagentDescriptions.push(
|
|
7836
|
-
`- ${agentParams.
|
|
7894
|
+
`- ${agentParams.key}: ${agentParams.name} - ${agentParams.description}`
|
|
7837
7895
|
);
|
|
7838
7896
|
if ("runnable" in agentParams) {
|
|
7839
|
-
agents[agentParams.
|
|
7897
|
+
agents[agentParams.key] = agentParams.runnable;
|
|
7840
7898
|
} else {
|
|
7841
7899
|
const middleware = agentParams.middleware ? [...defaultSubagentMiddleware, ...agentParams.middleware] : [...defaultSubagentMiddleware];
|
|
7842
7900
|
const interruptOn = agentParams.interruptOn || defaultInterruptOn;
|
|
7843
7901
|
if (interruptOn)
|
|
7844
7902
|
middleware.push(humanInTheLoopMiddleware({ interruptOn }));
|
|
7845
|
-
agents[agentParams.
|
|
7903
|
+
agents[agentParams.key] = createAgent2({
|
|
7846
7904
|
model: agentParams.model ?? defaultModel,
|
|
7847
7905
|
systemPrompt: agentParams.systemPrompt,
|
|
7848
7906
|
tools: agentParams.tools ?? defaultTools,
|
|
@@ -7890,7 +7948,12 @@ function createTaskTool(options) {
|
|
|
7890
7948
|
const workerResult = await agentWorkerGraph.invoke({
|
|
7891
7949
|
assistant_id: subagent_type,
|
|
7892
7950
|
thread_id: subagent_thread_id,
|
|
7893
|
-
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
|
+
}
|
|
7894
7957
|
});
|
|
7895
7958
|
const result = workerResult.finalState?.values;
|
|
7896
7959
|
if (!config.toolCall?.id) {
|
|
@@ -9509,6 +9572,7 @@ var DeepAgentGraphBuilder = class {
|
|
|
9509
9572
|
const subagents = params.subAgents.map((sa) => {
|
|
9510
9573
|
if (sa.client) {
|
|
9511
9574
|
return {
|
|
9575
|
+
key: sa.config.key,
|
|
9512
9576
|
name: sa.config.name,
|
|
9513
9577
|
description: sa.config.description,
|
|
9514
9578
|
runnable: sa.client
|
|
@@ -9518,6 +9582,7 @@ var DeepAgentGraphBuilder = class {
|
|
|
9518
9582
|
config: sa.config
|
|
9519
9583
|
});
|
|
9520
9584
|
return {
|
|
9585
|
+
key: sa.config.key,
|
|
9521
9586
|
name: sa.config.name,
|
|
9522
9587
|
description: sa.config.description,
|
|
9523
9588
|
runnable: subagentClient
|