@axiom-lattice/core 2.1.25 → 2.1.27
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 +53 -12
- package/dist/index.d.ts +53 -12
- package/dist/index.js +387 -261
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +405 -280
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -93,6 +93,7 @@ __export(index_exports, {
|
|
|
93
93
|
checkEmptyContent: () => checkEmptyContent,
|
|
94
94
|
clearEncryptionKeyCache: () => clearEncryptionKeyCache,
|
|
95
95
|
createAgentTeam: () => createAgentTeam,
|
|
96
|
+
createExecuteSqlQueryTool: () => createExecuteSqlQueryTool,
|
|
96
97
|
createFileData: () => createFileData,
|
|
97
98
|
createInfoSqlTool: () => createInfoSqlTool,
|
|
98
99
|
createListMetricsDataSourcesTool: () => createListMetricsDataSourcesTool,
|
|
@@ -695,11 +696,11 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
|
|
|
695
696
|
* @param key Lattice键名
|
|
696
697
|
* @param tool 已有的StructuredTool实例
|
|
697
698
|
*/
|
|
698
|
-
registerExistingTool(key,
|
|
699
|
+
registerExistingTool(key, tool47) {
|
|
699
700
|
const config = {
|
|
700
|
-
name:
|
|
701
|
-
description:
|
|
702
|
-
schema:
|
|
701
|
+
name: tool47.name,
|
|
702
|
+
description: tool47.description,
|
|
703
|
+
schema: tool47.schema,
|
|
703
704
|
// StructuredTool的schema已经是Zod兼容的
|
|
704
705
|
needUserApprove: false
|
|
705
706
|
// MCP工具默认不需要用户批准
|
|
@@ -707,7 +708,7 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
|
|
|
707
708
|
const toolLattice = {
|
|
708
709
|
key,
|
|
709
710
|
config,
|
|
710
|
-
client:
|
|
711
|
+
client: tool47
|
|
711
712
|
};
|
|
712
713
|
this.register(key, toolLattice);
|
|
713
714
|
}
|
|
@@ -733,7 +734,7 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
|
|
|
733
734
|
};
|
|
734
735
|
var toolLatticeManager = ToolLatticeManager.getInstance();
|
|
735
736
|
var registerToolLattice = (key, config, executor) => toolLatticeManager.registerLattice(key, config, executor);
|
|
736
|
-
var registerExistingTool = (key,
|
|
737
|
+
var registerExistingTool = (key, tool47) => toolLatticeManager.registerExistingTool(key, tool47);
|
|
737
738
|
var getToolLattice = (key) => toolLatticeManager.getToolLattice(key);
|
|
738
739
|
var getToolDefinition = (key) => toolLatticeManager.getToolDefinition(key);
|
|
739
740
|
var getToolClient = (key) => toolLatticeManager.getToolClient(key);
|
|
@@ -1621,6 +1622,28 @@ var SemanticMetricsClient = class {
|
|
|
1621
1622
|
}
|
|
1622
1623
|
return data.data;
|
|
1623
1624
|
}
|
|
1625
|
+
/**
|
|
1626
|
+
* Execute a custom SQL query
|
|
1627
|
+
* POST /metrics/query
|
|
1628
|
+
*/
|
|
1629
|
+
async executeSqlQuery(request) {
|
|
1630
|
+
const response = await fetch(`${this.baseUrl}/metrics/query`, {
|
|
1631
|
+
method: "POST",
|
|
1632
|
+
headers: {
|
|
1633
|
+
...this.getHeaders(),
|
|
1634
|
+
"Content-Type": "application/json"
|
|
1635
|
+
},
|
|
1636
|
+
body: JSON.stringify(request)
|
|
1637
|
+
});
|
|
1638
|
+
if (!response.ok) {
|
|
1639
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
1640
|
+
}
|
|
1641
|
+
const data = await response.json();
|
|
1642
|
+
if (data.code !== 200) {
|
|
1643
|
+
throw new Error(`API error: ${data.message}`);
|
|
1644
|
+
}
|
|
1645
|
+
return data.data;
|
|
1646
|
+
}
|
|
1624
1647
|
/**
|
|
1625
1648
|
* Get selected data sources for this configuration
|
|
1626
1649
|
*/
|
|
@@ -2089,7 +2112,9 @@ ${serverKeys.map(
|
|
|
2089
2112
|
}
|
|
2090
2113
|
const client = metricsServerManager.getClient(serverKey);
|
|
2091
2114
|
const dataSources = await client.getDataSources();
|
|
2092
|
-
|
|
2115
|
+
const selectedIds = config.selectedDataSources || [];
|
|
2116
|
+
const filteredDataSources = selectedIds.length > 0 ? dataSources.filter((ds) => selectedIds.includes(String(ds.id))) : dataSources;
|
|
2117
|
+
for (const ds of filteredDataSources) {
|
|
2093
2118
|
allDataSources.push({
|
|
2094
2119
|
serverKey,
|
|
2095
2120
|
datasourceId: String(ds.id),
|
|
@@ -2991,8 +3016,105 @@ ${serverKeys.map(
|
|
|
2991
3016
|
);
|
|
2992
3017
|
};
|
|
2993
3018
|
|
|
2994
|
-
// src/tool_lattice/
|
|
3019
|
+
// src/tool_lattice/metrics/execute_sql_query.ts
|
|
2995
3020
|
var import_zod14 = __toESM(require("zod"));
|
|
3021
|
+
var import_langchain12 = require("langchain");
|
|
3022
|
+
var EXECUTE_SQL_QUERY_DESCRIPTION = `Execute Custom SQL Query - Advanced Data Analysis Tool
|
|
3023
|
+
|
|
3024
|
+
Use this tool when you need to perform complex queries that cannot be achieved through the standard semantic metric query interface.
|
|
3025
|
+
|
|
3026
|
+
When to Use This Tool:
|
|
3027
|
+
- When you need custom aggregations, calculations, or joins
|
|
3028
|
+
- When the standard metric query patterns don't meet your requirements
|
|
3029
|
+
- When you need to query raw table data with custom filters
|
|
3030
|
+
- When you want to perform complex analytical queries (e.g., window functions, CTEs)
|
|
3031
|
+
|
|
3032
|
+
When NOT to Use This Tool:
|
|
3033
|
+
- For simple metric queries - use query_semantic_metric_data instead
|
|
3034
|
+
- When you haven't identified the correct datasource yet - use list_metrics_datasources first
|
|
3035
|
+
|
|
3036
|
+
Prerequisites:
|
|
3037
|
+
1. Call list_metrics_datasources to get available datasource IDs
|
|
3038
|
+
2. Call query_tables_list to see available tables and their structures
|
|
3039
|
+
3. Call query_table_definition to understand table columns before writing SQL
|
|
3040
|
+
|
|
3041
|
+
SQL Query Guidelines:
|
|
3042
|
+
- Use named parameters with :paramName syntax (e.g., :year, :category)
|
|
3043
|
+
- Provide parameter values in the params object
|
|
3044
|
+
- Always use proper table and column names from table definitions
|
|
3045
|
+
- Include appropriate WHERE clauses to limit data
|
|
3046
|
+
- Use LIMIT to prevent returning too many rows
|
|
3047
|
+
|
|
3048
|
+
Example:
|
|
3049
|
+
{
|
|
3050
|
+
"serverKey": "production_metrics",
|
|
3051
|
+
"datasourceId": "1",
|
|
3052
|
+
"customSql": "SELECT \\"Code\\" AS period, SUM(\\"LineTotal\\") AS revenue FROM \\"MTC_VW_SalesRevenueCost\\" WHERE \\"Category\\" = :year GROUP BY \\"Code\\" ORDER BY \\"Code\\" ASC",
|
|
3053
|
+
"params": {
|
|
3054
|
+
"year": "2024"
|
|
3055
|
+
},
|
|
3056
|
+
"limit": 1000
|
|
3057
|
+
}`;
|
|
3058
|
+
var createExecuteSqlQueryTool = ({ serverKeys, serverDescriptions }) => {
|
|
3059
|
+
const availableServersText = serverKeys.length > 0 ? `
|
|
3060
|
+
|
|
3061
|
+
Available metrics servers:
|
|
3062
|
+
${serverKeys.map(
|
|
3063
|
+
(key) => `- ${key}${serverDescriptions?.[key] ? `: ${serverDescriptions[key]}` : ""}`
|
|
3064
|
+
).join("\n")}` : "";
|
|
3065
|
+
return (0, import_langchain12.tool)(
|
|
3066
|
+
async ({
|
|
3067
|
+
serverKey,
|
|
3068
|
+
datasourceId,
|
|
3069
|
+
customSql,
|
|
3070
|
+
params,
|
|
3071
|
+
limit
|
|
3072
|
+
}, _exeConfig) => {
|
|
3073
|
+
try {
|
|
3074
|
+
if (!serverKey) {
|
|
3075
|
+
return "Error: serverKey parameter is required. Available servers: " + serverKeys.join(", ");
|
|
3076
|
+
}
|
|
3077
|
+
if (!serverKeys.includes(serverKey)) {
|
|
3078
|
+
return `Error: serverKey "${serverKey}" is not in the allowed list: [${serverKeys.join(", ")}]`;
|
|
3079
|
+
}
|
|
3080
|
+
if (!datasourceId) {
|
|
3081
|
+
return "Error: datasourceId parameter is required.";
|
|
3082
|
+
}
|
|
3083
|
+
if (!customSql || customSql.trim().length === 0) {
|
|
3084
|
+
return "Error: customSql parameter is required and cannot be empty.";
|
|
3085
|
+
}
|
|
3086
|
+
const config = metricsServerManager.getConfig(serverKey);
|
|
3087
|
+
if (config.type !== "semantic") {
|
|
3088
|
+
return `Error: Server "${serverKey}" is not a semantic metrics server. This tool only works with semantic servers.`;
|
|
3089
|
+
}
|
|
3090
|
+
const client = metricsServerManager.getClient(serverKey);
|
|
3091
|
+
const result = await client.executeSqlQuery({
|
|
3092
|
+
datasourceId,
|
|
3093
|
+
customSql,
|
|
3094
|
+
params,
|
|
3095
|
+
limit: limit || 1e3
|
|
3096
|
+
});
|
|
3097
|
+
return JSON.stringify(result, null, 2);
|
|
3098
|
+
} catch (error) {
|
|
3099
|
+
return `Error executing SQL query: ${error instanceof Error ? error.message : String(error)}`;
|
|
3100
|
+
}
|
|
3101
|
+
},
|
|
3102
|
+
{
|
|
3103
|
+
name: "execute_sql_query",
|
|
3104
|
+
description: `${EXECUTE_SQL_QUERY_DESCRIPTION}${availableServersText}`,
|
|
3105
|
+
schema: import_zod14.default.object({
|
|
3106
|
+
serverKey: import_zod14.default.string().describe(`Target semantic metrics server. Choose from: ${serverKeys.join(", ")}`),
|
|
3107
|
+
datasourceId: import_zod14.default.string().describe("The data source ID to execute SQL against."),
|
|
3108
|
+
customSql: import_zod14.default.string().describe("Custom SQL query string with named parameters (e.g., :year, :category). Use double quotes for identifiers."),
|
|
3109
|
+
params: import_zod14.default.record(import_zod14.default.union([import_zod14.default.string(), import_zod14.default.number(), import_zod14.default.boolean()])).optional().describe("Optional parameters for the SQL query. Keys should match the :paramName placeholders in customSql."),
|
|
3110
|
+
limit: import_zod14.default.number().optional().describe("Maximum number of results to return (default: 1000).")
|
|
3111
|
+
})
|
|
3112
|
+
}
|
|
3113
|
+
);
|
|
3114
|
+
};
|
|
3115
|
+
|
|
3116
|
+
// src/tool_lattice/code_eval/index.ts
|
|
3117
|
+
var import_zod15 = __toESM(require("zod"));
|
|
2996
3118
|
|
|
2997
3119
|
// src/sandbox_lattice/SandboxLatticeManager.ts
|
|
2998
3120
|
var import_sandbox = require("@agent-infra/sandbox");
|
|
@@ -3231,7 +3353,7 @@ var getSandBoxManager = (key = "default") => {
|
|
|
3231
3353
|
};
|
|
3232
3354
|
|
|
3233
3355
|
// src/tool_lattice/code_eval/index.ts
|
|
3234
|
-
var
|
|
3356
|
+
var import_langchain13 = require("langchain");
|
|
3235
3357
|
var CODE_EVAL_DESCRIPTION = `Execute code in Python or JavaScript runtime.
|
|
3236
3358
|
|
|
3237
3359
|
Args:
|
|
@@ -3241,7 +3363,7 @@ Args:
|
|
|
3241
3363
|
Returns:
|
|
3242
3364
|
Dict containing output, errors, and execution details`;
|
|
3243
3365
|
var createCodeEvalTool = ({ isolatedLevel }) => {
|
|
3244
|
-
return (0,
|
|
3366
|
+
return (0, import_langchain13.tool)(async (input, exe_config) => {
|
|
3245
3367
|
try {
|
|
3246
3368
|
const runConfig = exe_config.configurable?.runConfig;
|
|
3247
3369
|
const sandboxManager = getSandBoxManager();
|
|
@@ -3282,16 +3404,16 @@ ${traceback.join("\n")}`);
|
|
|
3282
3404
|
}, {
|
|
3283
3405
|
name: "execute_code",
|
|
3284
3406
|
description: CODE_EVAL_DESCRIPTION,
|
|
3285
|
-
schema:
|
|
3286
|
-
language:
|
|
3287
|
-
code:
|
|
3407
|
+
schema: import_zod15.default.object({
|
|
3408
|
+
language: import_zod15.default.enum(["python", "javascript"]).describe("Programming language: 'python' or 'javascript'"),
|
|
3409
|
+
code: import_zod15.default.string().describe("Code to execute")
|
|
3288
3410
|
})
|
|
3289
3411
|
});
|
|
3290
3412
|
};
|
|
3291
3413
|
|
|
3292
3414
|
// src/tool_lattice/code_execute_file/index.ts
|
|
3293
|
-
var
|
|
3294
|
-
var
|
|
3415
|
+
var import_zod16 = __toESM(require("zod"));
|
|
3416
|
+
var import_langchain14 = require("langchain");
|
|
3295
3417
|
var path = __toESM(require("path"));
|
|
3296
3418
|
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.`;
|
|
3297
3419
|
function inferLanguageFromPath(filePath) {
|
|
@@ -3304,7 +3426,7 @@ function inferLanguageFromPath(filePath) {
|
|
|
3304
3426
|
return null;
|
|
3305
3427
|
}
|
|
3306
3428
|
var createCodeExecuteFileTool = ({ isolatedLevel }) => {
|
|
3307
|
-
return (0,
|
|
3429
|
+
return (0, import_langchain14.tool)(
|
|
3308
3430
|
async (input, exe_config) => {
|
|
3309
3431
|
try {
|
|
3310
3432
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -3367,15 +3489,15 @@ ${traceback.join("\n")}`);
|
|
|
3367
3489
|
{
|
|
3368
3490
|
name: "execute_code_file",
|
|
3369
3491
|
description: CODE_EXECUTE_FILE_DESCRIPTION,
|
|
3370
|
-
schema:
|
|
3371
|
-
file_path:
|
|
3492
|
+
schema: import_zod16.default.object({
|
|
3493
|
+
file_path: import_zod16.default.string().describe("Path to the code file to execute (absolute path in sandbox filesystem). Only supports .py (Python) and .js/.mjs (JavaScript) files.")
|
|
3372
3494
|
})
|
|
3373
3495
|
}
|
|
3374
3496
|
);
|
|
3375
3497
|
};
|
|
3376
3498
|
|
|
3377
3499
|
// src/tool_lattice/convert_to_markdown/index.ts
|
|
3378
|
-
var
|
|
3500
|
+
var import_zod17 = __toESM(require("zod"));
|
|
3379
3501
|
var CONVERT_TO_MARKDOWN_DESCRIPTION = `Convert a resource described by an http:, https:, file: or data: URI to markdown.
|
|
3380
3502
|
|
|
3381
3503
|
Args:
|
|
@@ -3392,8 +3514,8 @@ registerToolLattice(
|
|
|
3392
3514
|
name: "convert_to_markdown",
|
|
3393
3515
|
description: CONVERT_TO_MARKDOWN_DESCRIPTION,
|
|
3394
3516
|
needUserApprove: false,
|
|
3395
|
-
schema:
|
|
3396
|
-
uri:
|
|
3517
|
+
schema: import_zod17.default.object({
|
|
3518
|
+
uri: import_zod17.default.string().describe("The URI to convert.")
|
|
3397
3519
|
})
|
|
3398
3520
|
},
|
|
3399
3521
|
async (input, exe_config) => {
|
|
@@ -3416,15 +3538,15 @@ registerToolLattice(
|
|
|
3416
3538
|
);
|
|
3417
3539
|
|
|
3418
3540
|
// src/tool_lattice/browser/browser_navigate.ts
|
|
3419
|
-
var
|
|
3420
|
-
var
|
|
3541
|
+
var import_zod18 = __toESM(require("zod"));
|
|
3542
|
+
var import_langchain15 = require("langchain");
|
|
3421
3543
|
var BROWSER_NAVIGATE_DESCRIPTION = `Navigate to a URL.
|
|
3422
3544
|
|
|
3423
3545
|
Args:
|
|
3424
3546
|
url (str): The URL to navigate to.
|
|
3425
3547
|
`;
|
|
3426
3548
|
var createBrowserNavigateTool = ({ isolatedLevel }) => {
|
|
3427
|
-
return (0,
|
|
3549
|
+
return (0, import_langchain15.tool)(
|
|
3428
3550
|
async (input, exe_config) => {
|
|
3429
3551
|
try {
|
|
3430
3552
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -3444,23 +3566,23 @@ var createBrowserNavigateTool = ({ isolatedLevel }) => {
|
|
|
3444
3566
|
{
|
|
3445
3567
|
name: "browser_navigate",
|
|
3446
3568
|
description: BROWSER_NAVIGATE_DESCRIPTION,
|
|
3447
|
-
schema:
|
|
3448
|
-
url:
|
|
3569
|
+
schema: import_zod18.default.object({
|
|
3570
|
+
url: import_zod18.default.string().describe("The URL to navigate to.")
|
|
3449
3571
|
})
|
|
3450
3572
|
}
|
|
3451
3573
|
);
|
|
3452
3574
|
};
|
|
3453
3575
|
|
|
3454
3576
|
// src/tool_lattice/browser/browser_click.ts
|
|
3455
|
-
var
|
|
3456
|
-
var
|
|
3577
|
+
var import_zod19 = __toESM(require("zod"));
|
|
3578
|
+
var import_langchain16 = require("langchain");
|
|
3457
3579
|
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.
|
|
3458
3580
|
|
|
3459
3581
|
Args:
|
|
3460
3582
|
index (int): Index of the element to click
|
|
3461
3583
|
`;
|
|
3462
3584
|
var createBrowserClickTool = ({ isolatedLevel }) => {
|
|
3463
|
-
return (0,
|
|
3585
|
+
return (0, import_langchain16.tool)(
|
|
3464
3586
|
async (input, exe_config) => {
|
|
3465
3587
|
try {
|
|
3466
3588
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -3480,23 +3602,23 @@ var createBrowserClickTool = ({ isolatedLevel }) => {
|
|
|
3480
3602
|
{
|
|
3481
3603
|
name: "browser_click",
|
|
3482
3604
|
description: BROWSER_CLICK_DESCRIPTION,
|
|
3483
|
-
schema:
|
|
3484
|
-
index:
|
|
3605
|
+
schema: import_zod19.default.object({
|
|
3606
|
+
index: import_zod19.default.number().describe("Index of the element to click")
|
|
3485
3607
|
})
|
|
3486
3608
|
}
|
|
3487
3609
|
);
|
|
3488
3610
|
};
|
|
3489
3611
|
|
|
3490
3612
|
// src/tool_lattice/browser/browser_get_text.ts
|
|
3491
|
-
var
|
|
3492
|
-
var
|
|
3613
|
+
var import_zod20 = __toESM(require("zod"));
|
|
3614
|
+
var import_langchain17 = require("langchain");
|
|
3493
3615
|
var BROWSER_GET_TEXT_DESCRIPTION = `Get the text content of the current page.
|
|
3494
3616
|
|
|
3495
3617
|
Args:
|
|
3496
3618
|
None
|
|
3497
3619
|
`;
|
|
3498
3620
|
var createBrowserGetTextTool = ({ isolatedLevel }) => {
|
|
3499
|
-
return (0,
|
|
3621
|
+
return (0, import_langchain17.tool)(
|
|
3500
3622
|
async (input, exe_config) => {
|
|
3501
3623
|
try {
|
|
3502
3624
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -3514,21 +3636,21 @@ var createBrowserGetTextTool = ({ isolatedLevel }) => {
|
|
|
3514
3636
|
{
|
|
3515
3637
|
name: "browser_get_text",
|
|
3516
3638
|
description: BROWSER_GET_TEXT_DESCRIPTION,
|
|
3517
|
-
schema:
|
|
3639
|
+
schema: import_zod20.default.object({})
|
|
3518
3640
|
}
|
|
3519
3641
|
);
|
|
3520
3642
|
};
|
|
3521
3643
|
|
|
3522
3644
|
// src/tool_lattice/browser/browser_get_markdown.ts
|
|
3523
|
-
var
|
|
3524
|
-
var
|
|
3645
|
+
var import_zod21 = __toESM(require("zod"));
|
|
3646
|
+
var import_langchain18 = require("langchain");
|
|
3525
3647
|
var BROWSER_GET_MARKDOWN_DESCRIPTION = `Get the markdown content of the current page.
|
|
3526
3648
|
|
|
3527
3649
|
Args:
|
|
3528
3650
|
None
|
|
3529
3651
|
`;
|
|
3530
3652
|
var createBrowserGetMarkdownTool = ({ isolatedLevel }) => {
|
|
3531
|
-
return (0,
|
|
3653
|
+
return (0, import_langchain18.tool)(
|
|
3532
3654
|
async (input, exe_config) => {
|
|
3533
3655
|
try {
|
|
3534
3656
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -3546,21 +3668,21 @@ var createBrowserGetMarkdownTool = ({ isolatedLevel }) => {
|
|
|
3546
3668
|
{
|
|
3547
3669
|
name: "browser_get_markdown",
|
|
3548
3670
|
description: BROWSER_GET_MARKDOWN_DESCRIPTION,
|
|
3549
|
-
schema:
|
|
3671
|
+
schema: import_zod21.default.object({})
|
|
3550
3672
|
}
|
|
3551
3673
|
);
|
|
3552
3674
|
};
|
|
3553
3675
|
|
|
3554
3676
|
// src/tool_lattice/browser/browser_evaluate.ts
|
|
3555
|
-
var
|
|
3556
|
-
var
|
|
3677
|
+
var import_zod22 = __toESM(require("zod"));
|
|
3678
|
+
var import_langchain19 = require("langchain");
|
|
3557
3679
|
var BROWSER_EVALUATE_DESCRIPTION = `Execute JavaScript in the browser console.
|
|
3558
3680
|
|
|
3559
3681
|
Args:
|
|
3560
3682
|
script (str): JavaScript code to execute, () => { /* code */ }
|
|
3561
3683
|
`;
|
|
3562
3684
|
var createBrowserEvaluateTool = ({ isolatedLevel }) => {
|
|
3563
|
-
return (0,
|
|
3685
|
+
return (0, import_langchain19.tool)(
|
|
3564
3686
|
async (input, exe_config) => {
|
|
3565
3687
|
try {
|
|
3566
3688
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -3580,16 +3702,16 @@ var createBrowserEvaluateTool = ({ isolatedLevel }) => {
|
|
|
3580
3702
|
{
|
|
3581
3703
|
name: "browser_evaluate",
|
|
3582
3704
|
description: BROWSER_EVALUATE_DESCRIPTION,
|
|
3583
|
-
schema:
|
|
3584
|
-
script:
|
|
3705
|
+
schema: import_zod22.default.object({
|
|
3706
|
+
script: import_zod22.default.string().describe("JavaScript code to execute, () => { /* code */ }")
|
|
3585
3707
|
})
|
|
3586
3708
|
}
|
|
3587
3709
|
);
|
|
3588
3710
|
};
|
|
3589
3711
|
|
|
3590
3712
|
// src/tool_lattice/browser/browser_screenshot.ts
|
|
3591
|
-
var
|
|
3592
|
-
var
|
|
3713
|
+
var import_zod23 = __toESM(require("zod"));
|
|
3714
|
+
var import_langchain20 = require("langchain");
|
|
3593
3715
|
var BROWSER_SCREENSHOT_DESCRIPTION = `Take a screenshot of the current page or a specific element.
|
|
3594
3716
|
|
|
3595
3717
|
Args:
|
|
@@ -3602,7 +3724,7 @@ Args:
|
|
|
3602
3724
|
highlight (bool): Highlight the element
|
|
3603
3725
|
`;
|
|
3604
3726
|
var createBrowserScreenshotTool = ({ isolatedLevel }) => {
|
|
3605
|
-
return (0,
|
|
3727
|
+
return (0, import_langchain20.tool)(
|
|
3606
3728
|
async (input, exe_config) => {
|
|
3607
3729
|
try {
|
|
3608
3730
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -3654,29 +3776,29 @@ var createBrowserScreenshotTool = ({ isolatedLevel }) => {
|
|
|
3654
3776
|
{
|
|
3655
3777
|
name: "browser_screenshot",
|
|
3656
3778
|
description: BROWSER_SCREENSHOT_DESCRIPTION,
|
|
3657
|
-
schema:
|
|
3658
|
-
name:
|
|
3659
|
-
selector:
|
|
3660
|
-
index:
|
|
3661
|
-
width:
|
|
3662
|
-
height:
|
|
3663
|
-
fullPage:
|
|
3664
|
-
highlight:
|
|
3779
|
+
schema: import_zod23.default.object({
|
|
3780
|
+
name: import_zod23.default.string().optional().describe("Name for the screenshot"),
|
|
3781
|
+
selector: import_zod23.default.string().optional().describe("CSS selector for element to screenshot"),
|
|
3782
|
+
index: import_zod23.default.number().optional().describe("index of the element to screenshot"),
|
|
3783
|
+
width: import_zod23.default.number().optional().describe("Width in pixels (default: viewport width)"),
|
|
3784
|
+
height: import_zod23.default.number().optional().describe("Height in pixels (default: viewport height)"),
|
|
3785
|
+
fullPage: import_zod23.default.boolean().optional().describe("Full page screenshot (default: false)"),
|
|
3786
|
+
highlight: import_zod23.default.boolean().default(false).describe("Highlight the element")
|
|
3665
3787
|
})
|
|
3666
3788
|
}
|
|
3667
3789
|
);
|
|
3668
3790
|
};
|
|
3669
3791
|
|
|
3670
3792
|
// src/tool_lattice/browser/browser_scroll.ts
|
|
3671
|
-
var
|
|
3672
|
-
var
|
|
3793
|
+
var import_zod24 = __toESM(require("zod"));
|
|
3794
|
+
var import_langchain21 = require("langchain");
|
|
3673
3795
|
var BROWSER_SCROLL_DESCRIPTION = `Scroll the page.
|
|
3674
3796
|
|
|
3675
3797
|
Args:
|
|
3676
3798
|
amount (int): Pixels to scroll (positive for down, negative for up), if the amount is not provided, scroll to the bottom of the page
|
|
3677
3799
|
`;
|
|
3678
3800
|
var createBrowserScrollTool = ({ isolatedLevel }) => {
|
|
3679
|
-
return (0,
|
|
3801
|
+
return (0, import_langchain21.tool)(
|
|
3680
3802
|
async (input, exe_config) => {
|
|
3681
3803
|
try {
|
|
3682
3804
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -3696,16 +3818,16 @@ var createBrowserScrollTool = ({ isolatedLevel }) => {
|
|
|
3696
3818
|
{
|
|
3697
3819
|
name: "browser_scroll",
|
|
3698
3820
|
description: BROWSER_SCROLL_DESCRIPTION,
|
|
3699
|
-
schema:
|
|
3700
|
-
amount:
|
|
3821
|
+
schema: import_zod24.default.object({
|
|
3822
|
+
amount: import_zod24.default.number().optional().describe("Pixels to scroll (positive for down, negative for up)")
|
|
3701
3823
|
})
|
|
3702
3824
|
}
|
|
3703
3825
|
);
|
|
3704
3826
|
};
|
|
3705
3827
|
|
|
3706
3828
|
// src/tool_lattice/browser/browser_form_input_fill.ts
|
|
3707
|
-
var
|
|
3708
|
-
var
|
|
3829
|
+
var import_zod25 = __toESM(require("zod"));
|
|
3830
|
+
var import_langchain22 = require("langchain");
|
|
3709
3831
|
var BROWSER_FORM_INPUT_FILL_DESCRIPTION = `Fill out an input field, before using the tool, Either 'index' or 'selector' must be provided.
|
|
3710
3832
|
|
|
3711
3833
|
Args:
|
|
@@ -3715,7 +3837,7 @@ Args:
|
|
|
3715
3837
|
clear (bool): Whether to clear existing text before filling
|
|
3716
3838
|
`;
|
|
3717
3839
|
var createBrowserFormInputFillTool = ({ isolatedLevel }) => {
|
|
3718
|
-
return (0,
|
|
3840
|
+
return (0, import_langchain22.tool)(
|
|
3719
3841
|
async (input, exe_config) => {
|
|
3720
3842
|
try {
|
|
3721
3843
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -3738,19 +3860,19 @@ var createBrowserFormInputFillTool = ({ isolatedLevel }) => {
|
|
|
3738
3860
|
{
|
|
3739
3861
|
name: "browser_form_input_fill",
|
|
3740
3862
|
description: BROWSER_FORM_INPUT_FILL_DESCRIPTION,
|
|
3741
|
-
schema:
|
|
3742
|
-
selector:
|
|
3743
|
-
index:
|
|
3744
|
-
value:
|
|
3745
|
-
clear:
|
|
3863
|
+
schema: import_zod25.default.object({
|
|
3864
|
+
selector: import_zod25.default.string().optional().describe("CSS selector for input field"),
|
|
3865
|
+
index: import_zod25.default.number().optional().describe("Index of the element to fill"),
|
|
3866
|
+
value: import_zod25.default.string().describe("Value to fill"),
|
|
3867
|
+
clear: import_zod25.default.boolean().default(false).describe("Whether to clear existing text before filling")
|
|
3746
3868
|
})
|
|
3747
3869
|
}
|
|
3748
3870
|
);
|
|
3749
3871
|
};
|
|
3750
3872
|
|
|
3751
3873
|
// src/tool_lattice/browser/browser_select.ts
|
|
3752
|
-
var
|
|
3753
|
-
var
|
|
3874
|
+
var import_zod26 = __toESM(require("zod"));
|
|
3875
|
+
var import_langchain23 = require("langchain");
|
|
3754
3876
|
var BROWSER_SELECT_DESCRIPTION = `Select an element on the page with index, Either 'index' or 'selector' must be provided.
|
|
3755
3877
|
|
|
3756
3878
|
Args:
|
|
@@ -3759,7 +3881,7 @@ Args:
|
|
|
3759
3881
|
value (str): Value to select
|
|
3760
3882
|
`;
|
|
3761
3883
|
var createBrowserSelectTool = ({ isolatedLevel }) => {
|
|
3762
|
-
return (0,
|
|
3884
|
+
return (0, import_langchain23.tool)(
|
|
3763
3885
|
async (input, exe_config) => {
|
|
3764
3886
|
try {
|
|
3765
3887
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -3781,18 +3903,18 @@ var createBrowserSelectTool = ({ isolatedLevel }) => {
|
|
|
3781
3903
|
{
|
|
3782
3904
|
name: "browser_select",
|
|
3783
3905
|
description: BROWSER_SELECT_DESCRIPTION,
|
|
3784
|
-
schema:
|
|
3785
|
-
index:
|
|
3786
|
-
selector:
|
|
3787
|
-
value:
|
|
3906
|
+
schema: import_zod26.default.object({
|
|
3907
|
+
index: import_zod26.default.number().optional().describe("Index of the element to select"),
|
|
3908
|
+
selector: import_zod26.default.string().optional().describe("CSS selector for element to select"),
|
|
3909
|
+
value: import_zod26.default.string().describe("Value to select")
|
|
3788
3910
|
})
|
|
3789
3911
|
}
|
|
3790
3912
|
);
|
|
3791
3913
|
};
|
|
3792
3914
|
|
|
3793
3915
|
// src/tool_lattice/browser/browser_hover.ts
|
|
3794
|
-
var
|
|
3795
|
-
var
|
|
3916
|
+
var import_zod27 = __toESM(require("zod"));
|
|
3917
|
+
var import_langchain24 = require("langchain");
|
|
3796
3918
|
var BROWSER_HOVER_DESCRIPTION = `Hover an element on the page, Either 'index' or 'selector' must be provided.
|
|
3797
3919
|
|
|
3798
3920
|
Args:
|
|
@@ -3800,7 +3922,7 @@ Args:
|
|
|
3800
3922
|
selector (str): CSS selector for element to hover
|
|
3801
3923
|
`;
|
|
3802
3924
|
var createBrowserHoverTool = ({ isolatedLevel }) => {
|
|
3803
|
-
return (0,
|
|
3925
|
+
return (0, import_langchain24.tool)(
|
|
3804
3926
|
async (input, exe_config) => {
|
|
3805
3927
|
try {
|
|
3806
3928
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -3821,24 +3943,24 @@ var createBrowserHoverTool = ({ isolatedLevel }) => {
|
|
|
3821
3943
|
{
|
|
3822
3944
|
name: "browser_hover",
|
|
3823
3945
|
description: BROWSER_HOVER_DESCRIPTION,
|
|
3824
|
-
schema:
|
|
3825
|
-
index:
|
|
3826
|
-
selector:
|
|
3946
|
+
schema: import_zod27.default.object({
|
|
3947
|
+
index: import_zod27.default.number().optional().describe("Index of the element to hover"),
|
|
3948
|
+
selector: import_zod27.default.string().optional().describe("CSS selector for element to hover")
|
|
3827
3949
|
})
|
|
3828
3950
|
}
|
|
3829
3951
|
);
|
|
3830
3952
|
};
|
|
3831
3953
|
|
|
3832
3954
|
// src/tool_lattice/browser/browser_go_back.ts
|
|
3833
|
-
var
|
|
3834
|
-
var
|
|
3955
|
+
var import_zod28 = __toESM(require("zod"));
|
|
3956
|
+
var import_langchain25 = require("langchain");
|
|
3835
3957
|
var BROWSER_GO_BACK_DESCRIPTION = `Go back to the previous page.
|
|
3836
3958
|
|
|
3837
3959
|
Args:
|
|
3838
3960
|
None
|
|
3839
3961
|
`;
|
|
3840
3962
|
var createBrowserGoBackTool = ({ isolatedLevel }) => {
|
|
3841
|
-
return (0,
|
|
3963
|
+
return (0, import_langchain25.tool)(
|
|
3842
3964
|
async (input, exe_config) => {
|
|
3843
3965
|
try {
|
|
3844
3966
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -3856,21 +3978,21 @@ var createBrowserGoBackTool = ({ isolatedLevel }) => {
|
|
|
3856
3978
|
{
|
|
3857
3979
|
name: "browser_go_back",
|
|
3858
3980
|
description: BROWSER_GO_BACK_DESCRIPTION,
|
|
3859
|
-
schema:
|
|
3981
|
+
schema: import_zod28.default.object({})
|
|
3860
3982
|
}
|
|
3861
3983
|
);
|
|
3862
3984
|
};
|
|
3863
3985
|
|
|
3864
3986
|
// src/tool_lattice/browser/browser_go_forward.ts
|
|
3865
|
-
var
|
|
3866
|
-
var
|
|
3987
|
+
var import_zod29 = __toESM(require("zod"));
|
|
3988
|
+
var import_langchain26 = require("langchain");
|
|
3867
3989
|
var BROWSER_GO_FORWARD_DESCRIPTION = `Go forward to the next page.
|
|
3868
3990
|
|
|
3869
3991
|
Args:
|
|
3870
3992
|
None
|
|
3871
3993
|
`;
|
|
3872
3994
|
var createBrowserGoForwardTool = ({ isolatedLevel }) => {
|
|
3873
|
-
return (0,
|
|
3995
|
+
return (0, import_langchain26.tool)(
|
|
3874
3996
|
async (input, exe_config) => {
|
|
3875
3997
|
try {
|
|
3876
3998
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -3888,21 +4010,21 @@ var createBrowserGoForwardTool = ({ isolatedLevel }) => {
|
|
|
3888
4010
|
{
|
|
3889
4011
|
name: "browser_go_forward",
|
|
3890
4012
|
description: BROWSER_GO_FORWARD_DESCRIPTION,
|
|
3891
|
-
schema:
|
|
4013
|
+
schema: import_zod29.default.object({})
|
|
3892
4014
|
}
|
|
3893
4015
|
);
|
|
3894
4016
|
};
|
|
3895
4017
|
|
|
3896
4018
|
// src/tool_lattice/browser/browser_new_tab.ts
|
|
3897
|
-
var
|
|
3898
|
-
var
|
|
4019
|
+
var import_zod30 = __toESM(require("zod"));
|
|
4020
|
+
var import_langchain27 = require("langchain");
|
|
3899
4021
|
var BROWSER_NEW_TAB_DESCRIPTION = `Open a new tab.
|
|
3900
4022
|
|
|
3901
4023
|
Args:
|
|
3902
4024
|
url (str): URL to open in the new tab
|
|
3903
4025
|
`;
|
|
3904
4026
|
var createBrowserNewTabTool = ({ isolatedLevel }) => {
|
|
3905
|
-
return (0,
|
|
4027
|
+
return (0, import_langchain27.tool)(
|
|
3906
4028
|
async (input, exe_config) => {
|
|
3907
4029
|
try {
|
|
3908
4030
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -3922,23 +4044,23 @@ var createBrowserNewTabTool = ({ isolatedLevel }) => {
|
|
|
3922
4044
|
{
|
|
3923
4045
|
name: "browser_new_tab",
|
|
3924
4046
|
description: BROWSER_NEW_TAB_DESCRIPTION,
|
|
3925
|
-
schema:
|
|
3926
|
-
url:
|
|
4047
|
+
schema: import_zod30.default.object({
|
|
4048
|
+
url: import_zod30.default.string().describe("URL to open in the new tab")
|
|
3927
4049
|
})
|
|
3928
4050
|
}
|
|
3929
4051
|
);
|
|
3930
4052
|
};
|
|
3931
4053
|
|
|
3932
4054
|
// src/tool_lattice/browser/browser_tab_list.ts
|
|
3933
|
-
var
|
|
3934
|
-
var
|
|
4055
|
+
var import_zod31 = __toESM(require("zod"));
|
|
4056
|
+
var import_langchain28 = require("langchain");
|
|
3935
4057
|
var BROWSER_TAB_LIST_DESCRIPTION = `Get the list of tabs.
|
|
3936
4058
|
|
|
3937
4059
|
Args:
|
|
3938
4060
|
None
|
|
3939
4061
|
`;
|
|
3940
4062
|
var createBrowserTabListTool = ({ isolatedLevel }) => {
|
|
3941
|
-
return (0,
|
|
4063
|
+
return (0, import_langchain28.tool)(
|
|
3942
4064
|
async (input, exe_config) => {
|
|
3943
4065
|
try {
|
|
3944
4066
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -3956,21 +4078,21 @@ var createBrowserTabListTool = ({ isolatedLevel }) => {
|
|
|
3956
4078
|
{
|
|
3957
4079
|
name: "browser_tab_list",
|
|
3958
4080
|
description: BROWSER_TAB_LIST_DESCRIPTION,
|
|
3959
|
-
schema:
|
|
4081
|
+
schema: import_zod31.default.object({})
|
|
3960
4082
|
}
|
|
3961
4083
|
);
|
|
3962
4084
|
};
|
|
3963
4085
|
|
|
3964
4086
|
// src/tool_lattice/browser/browser_switch_tab.ts
|
|
3965
|
-
var
|
|
3966
|
-
var
|
|
4087
|
+
var import_zod32 = __toESM(require("zod"));
|
|
4088
|
+
var import_langchain29 = require("langchain");
|
|
3967
4089
|
var BROWSER_SWITCH_TAB_DESCRIPTION = `Switch to a specific tab.
|
|
3968
4090
|
|
|
3969
4091
|
Args:
|
|
3970
4092
|
index (int): Tab index to switch to
|
|
3971
4093
|
`;
|
|
3972
4094
|
var createBrowserSwitchTabTool = ({ isolatedLevel }) => {
|
|
3973
|
-
return (0,
|
|
4095
|
+
return (0, import_langchain29.tool)(
|
|
3974
4096
|
async (input, exe_config) => {
|
|
3975
4097
|
try {
|
|
3976
4098
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -3990,23 +4112,23 @@ var createBrowserSwitchTabTool = ({ isolatedLevel }) => {
|
|
|
3990
4112
|
{
|
|
3991
4113
|
name: "browser_switch_tab",
|
|
3992
4114
|
description: BROWSER_SWITCH_TAB_DESCRIPTION,
|
|
3993
|
-
schema:
|
|
3994
|
-
index:
|
|
4115
|
+
schema: import_zod32.default.object({
|
|
4116
|
+
index: import_zod32.default.number().describe("Tab index to switch to")
|
|
3995
4117
|
})
|
|
3996
4118
|
}
|
|
3997
4119
|
);
|
|
3998
4120
|
};
|
|
3999
4121
|
|
|
4000
4122
|
// src/tool_lattice/browser/browser_close_tab.ts
|
|
4001
|
-
var
|
|
4002
|
-
var
|
|
4123
|
+
var import_zod33 = __toESM(require("zod"));
|
|
4124
|
+
var import_langchain30 = require("langchain");
|
|
4003
4125
|
var BROWSER_CLOSE_TAB_DESCRIPTION = `Close the current tab.
|
|
4004
4126
|
|
|
4005
4127
|
Args:
|
|
4006
4128
|
None
|
|
4007
4129
|
`;
|
|
4008
4130
|
var createBrowserCloseTabTool = ({ isolatedLevel }) => {
|
|
4009
|
-
return (0,
|
|
4131
|
+
return (0, import_langchain30.tool)(
|
|
4010
4132
|
async (input, exe_config) => {
|
|
4011
4133
|
try {
|
|
4012
4134
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -4024,21 +4146,21 @@ var createBrowserCloseTabTool = ({ isolatedLevel }) => {
|
|
|
4024
4146
|
{
|
|
4025
4147
|
name: "browser_close_tab",
|
|
4026
4148
|
description: BROWSER_CLOSE_TAB_DESCRIPTION,
|
|
4027
|
-
schema:
|
|
4149
|
+
schema: import_zod33.default.object({})
|
|
4028
4150
|
}
|
|
4029
4151
|
);
|
|
4030
4152
|
};
|
|
4031
4153
|
|
|
4032
4154
|
// src/tool_lattice/browser/browser_close.ts
|
|
4033
|
-
var
|
|
4034
|
-
var
|
|
4155
|
+
var import_zod34 = __toESM(require("zod"));
|
|
4156
|
+
var import_langchain31 = require("langchain");
|
|
4035
4157
|
var BROWSER_CLOSE_DESCRIPTION = `Close the browser when the task is done and the browser is not needed anymore.
|
|
4036
4158
|
|
|
4037
4159
|
Args:
|
|
4038
4160
|
None
|
|
4039
4161
|
`;
|
|
4040
4162
|
var createBrowserCloseTool = ({ isolatedLevel }) => {
|
|
4041
|
-
return (0,
|
|
4163
|
+
return (0, import_langchain31.tool)(
|
|
4042
4164
|
async (input, exe_config) => {
|
|
4043
4165
|
try {
|
|
4044
4166
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -4056,21 +4178,21 @@ var createBrowserCloseTool = ({ isolatedLevel }) => {
|
|
|
4056
4178
|
{
|
|
4057
4179
|
name: "browser_close",
|
|
4058
4180
|
description: BROWSER_CLOSE_DESCRIPTION,
|
|
4059
|
-
schema:
|
|
4181
|
+
schema: import_zod34.default.object({})
|
|
4060
4182
|
}
|
|
4061
4183
|
);
|
|
4062
4184
|
};
|
|
4063
4185
|
|
|
4064
4186
|
// src/tool_lattice/browser/browser_press_key.ts
|
|
4065
|
-
var
|
|
4066
|
-
var
|
|
4187
|
+
var import_zod35 = __toESM(require("zod"));
|
|
4188
|
+
var import_langchain32 = require("langchain");
|
|
4067
4189
|
var BROWSER_PRESS_KEY_DESCRIPTION = `Press a key on the keyboard.
|
|
4068
4190
|
|
|
4069
4191
|
Args:
|
|
4070
4192
|
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
|
|
4071
4193
|
`;
|
|
4072
4194
|
var createBrowserPressKeyTool = ({ isolatedLevel }) => {
|
|
4073
|
-
return (0,
|
|
4195
|
+
return (0, import_langchain32.tool)(
|
|
4074
4196
|
async (input, exe_config) => {
|
|
4075
4197
|
try {
|
|
4076
4198
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -4090,8 +4212,8 @@ var createBrowserPressKeyTool = ({ isolatedLevel }) => {
|
|
|
4090
4212
|
{
|
|
4091
4213
|
name: "browser_press_key",
|
|
4092
4214
|
description: BROWSER_PRESS_KEY_DESCRIPTION,
|
|
4093
|
-
schema:
|
|
4094
|
-
key:
|
|
4215
|
+
schema: import_zod35.default.object({
|
|
4216
|
+
key: import_zod35.default.enum([
|
|
4095
4217
|
"Enter",
|
|
4096
4218
|
"Tab",
|
|
4097
4219
|
"Escape",
|
|
@@ -4138,15 +4260,15 @@ var createBrowserPressKeyTool = ({ isolatedLevel }) => {
|
|
|
4138
4260
|
};
|
|
4139
4261
|
|
|
4140
4262
|
// src/tool_lattice/browser/browser_read_links.ts
|
|
4141
|
-
var
|
|
4142
|
-
var
|
|
4263
|
+
var import_zod36 = __toESM(require("zod"));
|
|
4264
|
+
var import_langchain33 = require("langchain");
|
|
4143
4265
|
var BROWSER_READ_LINKS_DESCRIPTION = `Get all links on the current page.
|
|
4144
4266
|
|
|
4145
4267
|
Args:
|
|
4146
4268
|
None
|
|
4147
4269
|
`;
|
|
4148
4270
|
var createBrowserReadLinksTool = ({ isolatedLevel }) => {
|
|
4149
|
-
return (0,
|
|
4271
|
+
return (0, import_langchain33.tool)(
|
|
4150
4272
|
async (input, exe_config) => {
|
|
4151
4273
|
try {
|
|
4152
4274
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -4164,21 +4286,21 @@ var createBrowserReadLinksTool = ({ isolatedLevel }) => {
|
|
|
4164
4286
|
{
|
|
4165
4287
|
name: "browser_read_links",
|
|
4166
4288
|
description: BROWSER_READ_LINKS_DESCRIPTION,
|
|
4167
|
-
schema:
|
|
4289
|
+
schema: import_zod36.default.object({})
|
|
4168
4290
|
}
|
|
4169
4291
|
);
|
|
4170
4292
|
};
|
|
4171
4293
|
|
|
4172
4294
|
// src/tool_lattice/browser/browser_get_clickable_elements.ts
|
|
4173
|
-
var
|
|
4174
|
-
var
|
|
4295
|
+
var import_zod37 = __toESM(require("zod"));
|
|
4296
|
+
var import_langchain34 = require("langchain");
|
|
4175
4297
|
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.
|
|
4176
4298
|
|
|
4177
4299
|
Args:
|
|
4178
4300
|
None
|
|
4179
4301
|
`;
|
|
4180
4302
|
var createBrowserGetClickableElementsTool = ({ isolatedLevel }) => {
|
|
4181
|
-
return (0,
|
|
4303
|
+
return (0, import_langchain34.tool)(
|
|
4182
4304
|
async (input, exe_config) => {
|
|
4183
4305
|
try {
|
|
4184
4306
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -4196,21 +4318,21 @@ var createBrowserGetClickableElementsTool = ({ isolatedLevel }) => {
|
|
|
4196
4318
|
{
|
|
4197
4319
|
name: "browser_get_clickable_elements",
|
|
4198
4320
|
description: BROWSER_GET_CLICKABLE_ELEMENTS_DESCRIPTION,
|
|
4199
|
-
schema:
|
|
4321
|
+
schema: import_zod37.default.object({})
|
|
4200
4322
|
}
|
|
4201
4323
|
);
|
|
4202
4324
|
};
|
|
4203
4325
|
|
|
4204
4326
|
// src/tool_lattice/browser/browser_get_download_list.ts
|
|
4205
|
-
var
|
|
4206
|
-
var
|
|
4327
|
+
var import_zod38 = __toESM(require("zod"));
|
|
4328
|
+
var import_langchain35 = require("langchain");
|
|
4207
4329
|
var BROWSER_GET_DOWNLOAD_LIST_DESCRIPTION = `Get the list of downloaded files.
|
|
4208
4330
|
|
|
4209
4331
|
Args:
|
|
4210
4332
|
None
|
|
4211
4333
|
`;
|
|
4212
4334
|
var createBrowserGetDownloadListTool = ({ isolatedLevel }) => {
|
|
4213
|
-
return (0,
|
|
4335
|
+
return (0, import_langchain35.tool)(
|
|
4214
4336
|
async (input, exe_config) => {
|
|
4215
4337
|
try {
|
|
4216
4338
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -4228,14 +4350,14 @@ var createBrowserGetDownloadListTool = ({ isolatedLevel }) => {
|
|
|
4228
4350
|
{
|
|
4229
4351
|
name: "browser_get_download_list",
|
|
4230
4352
|
description: BROWSER_GET_DOWNLOAD_LIST_DESCRIPTION,
|
|
4231
|
-
schema:
|
|
4353
|
+
schema: import_zod38.default.object({})
|
|
4232
4354
|
}
|
|
4233
4355
|
);
|
|
4234
4356
|
};
|
|
4235
4357
|
|
|
4236
4358
|
// src/tool_lattice/browser/get_info.ts
|
|
4237
|
-
var
|
|
4238
|
-
var
|
|
4359
|
+
var import_zod39 = __toESM(require("zod"));
|
|
4360
|
+
var import_langchain36 = require("langchain");
|
|
4239
4361
|
var BROWSER_GET_INFO_DESCRIPTION = `Get information about browser, like CDP URL, viewport size, etc.
|
|
4240
4362
|
|
|
4241
4363
|
Args:
|
|
@@ -4244,7 +4366,7 @@ Args:
|
|
|
4244
4366
|
Returns:
|
|
4245
4367
|
Dict containing browser information including CDP URL, viewport dimensions, and other browser metadata.`;
|
|
4246
4368
|
var createBrowserGetInfoTool = ({ isolatedLevel }) => {
|
|
4247
|
-
return (0,
|
|
4369
|
+
return (0, import_langchain36.tool)(
|
|
4248
4370
|
async (input, exe_config) => {
|
|
4249
4371
|
try {
|
|
4250
4372
|
const runConfig = exe_config.configurable?.runConfig;
|
|
@@ -4262,7 +4384,7 @@ var createBrowserGetInfoTool = ({ isolatedLevel }) => {
|
|
|
4262
4384
|
{
|
|
4263
4385
|
name: "browser_get_info",
|
|
4264
4386
|
description: BROWSER_GET_INFO_DESCRIPTION,
|
|
4265
|
-
schema:
|
|
4387
|
+
schema: import_zod39.default.object({})
|
|
4266
4388
|
}
|
|
4267
4389
|
);
|
|
4268
4390
|
};
|
|
@@ -4351,14 +4473,14 @@ var memory = new import_langgraph2.MemorySaver();
|
|
|
4351
4473
|
registerCheckpointSaver("default", memory);
|
|
4352
4474
|
|
|
4353
4475
|
// src/agent_lattice/builders/state.ts
|
|
4354
|
-
var
|
|
4476
|
+
var import_zod40 = require("@langchain/langgraph/zod");
|
|
4355
4477
|
var import_langgraph3 = require("@langchain/langgraph");
|
|
4356
4478
|
var createReactAgentSchema = (schema) => {
|
|
4357
4479
|
return schema ? import_langgraph3.MessagesZodState.extend(schema.shape) : void 0;
|
|
4358
4480
|
};
|
|
4359
4481
|
|
|
4360
4482
|
// src/agent_lattice/builders/ReActAgentGraphBuilder.ts
|
|
4361
|
-
var
|
|
4483
|
+
var import_langchain46 = require("langchain");
|
|
4362
4484
|
|
|
4363
4485
|
// src/deep_agent_new/backends/sandboxFiles.ts
|
|
4364
4486
|
var import_sandbox2 = require("@agent-infra/sandbox");
|
|
@@ -4637,18 +4759,18 @@ var SandboxFilesystem = class {
|
|
|
4637
4759
|
};
|
|
4638
4760
|
|
|
4639
4761
|
// src/middlewares/codeEvalMiddleware.ts
|
|
4640
|
-
var
|
|
4762
|
+
var import_langchain37 = require("langchain");
|
|
4641
4763
|
function createCodeEvalMiddleware(params = { isolatedLevel: "global" }) {
|
|
4642
4764
|
const codeEvalTool = createCodeEvalTool({ isolatedLevel: params.isolatedLevel });
|
|
4643
4765
|
const codeExecuteFileTool = createCodeExecuteFileTool({ isolatedLevel: params.isolatedLevel });
|
|
4644
|
-
return (0,
|
|
4766
|
+
return (0, import_langchain37.createMiddleware)({
|
|
4645
4767
|
name: "codeEvalMiddleware",
|
|
4646
4768
|
tools: [codeEvalTool, codeExecuteFileTool, getToolClient("convert_to_markdown")]
|
|
4647
4769
|
});
|
|
4648
4770
|
}
|
|
4649
4771
|
|
|
4650
4772
|
// src/middlewares/browserMiddleware.ts
|
|
4651
|
-
var
|
|
4773
|
+
var import_langchain38 = require("langchain");
|
|
4652
4774
|
function createBrowserMiddleware(params = { isolatedLevel: "global" }) {
|
|
4653
4775
|
const isolatedLevel = params.isolatedLevel || "global";
|
|
4654
4776
|
const tools = [
|
|
@@ -4675,18 +4797,18 @@ function createBrowserMiddleware(params = { isolatedLevel: "global" }) {
|
|
|
4675
4797
|
createBrowserGetDownloadListTool({ isolatedLevel }),
|
|
4676
4798
|
createBrowserGetInfoTool({ isolatedLevel })
|
|
4677
4799
|
];
|
|
4678
|
-
return (0,
|
|
4800
|
+
return (0, import_langchain38.createMiddleware)({
|
|
4679
4801
|
name: "browserMiddleware",
|
|
4680
4802
|
tools
|
|
4681
4803
|
});
|
|
4682
4804
|
}
|
|
4683
4805
|
|
|
4684
4806
|
// src/middlewares/sqlMiddleware.ts
|
|
4685
|
-
var
|
|
4807
|
+
var import_langchain39 = require("langchain");
|
|
4686
4808
|
function createSqlMiddleware(params) {
|
|
4687
4809
|
const { databaseKeys, databaseDescriptions } = params;
|
|
4688
4810
|
if (!databaseKeys || databaseKeys.length === 0) {
|
|
4689
|
-
return (0,
|
|
4811
|
+
return (0, import_langchain39.createMiddleware)({
|
|
4690
4812
|
name: "sqlMiddleware",
|
|
4691
4813
|
tools: []
|
|
4692
4814
|
});
|
|
@@ -4695,7 +4817,7 @@ function createSqlMiddleware(params) {
|
|
|
4695
4817
|
databaseKeys,
|
|
4696
4818
|
databaseDescriptions
|
|
4697
4819
|
};
|
|
4698
|
-
return (0,
|
|
4820
|
+
return (0, import_langchain39.createMiddleware)({
|
|
4699
4821
|
name: "sqlMiddleware",
|
|
4700
4822
|
tools: [
|
|
4701
4823
|
createListTablesSqlTool(toolParams),
|
|
@@ -4707,7 +4829,7 @@ function createSqlMiddleware(params) {
|
|
|
4707
4829
|
}
|
|
4708
4830
|
|
|
4709
4831
|
// src/middlewares/skillMiddleware.ts
|
|
4710
|
-
var
|
|
4832
|
+
var import_langchain43 = require("langchain");
|
|
4711
4833
|
|
|
4712
4834
|
// src/store_lattice/InMemoryThreadStore.ts
|
|
4713
4835
|
var InMemoryThreadStore = class {
|
|
@@ -6097,11 +6219,11 @@ storeLatticeManager.registerLattice("default", "tenant", defaultTenantStore);
|
|
|
6097
6219
|
storeLatticeManager.registerLattice("default", "userTenantLink", defaultUserTenantLinkStore);
|
|
6098
6220
|
|
|
6099
6221
|
// src/tool_lattice/skill/load_skills.ts
|
|
6100
|
-
var
|
|
6101
|
-
var
|
|
6222
|
+
var import_zod41 = __toESM(require("zod"));
|
|
6223
|
+
var import_langchain40 = require("langchain");
|
|
6102
6224
|
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.`;
|
|
6103
6225
|
var createLoadSkillsTool = ({ skills } = {}) => {
|
|
6104
|
-
return (0,
|
|
6226
|
+
return (0, import_langchain40.tool)(
|
|
6105
6227
|
async (_input, _exe_config) => {
|
|
6106
6228
|
try {
|
|
6107
6229
|
const storeLattice = getStoreLattice("default", "skill");
|
|
@@ -6125,17 +6247,17 @@ var createLoadSkillsTool = ({ skills } = {}) => {
|
|
|
6125
6247
|
{
|
|
6126
6248
|
name: "load_skills",
|
|
6127
6249
|
description: LOAD_SKILLS_DESCRIPTION,
|
|
6128
|
-
schema:
|
|
6250
|
+
schema: import_zod41.default.object({})
|
|
6129
6251
|
}
|
|
6130
6252
|
);
|
|
6131
6253
|
};
|
|
6132
6254
|
|
|
6133
6255
|
// src/tool_lattice/skill/load_skill_content.ts
|
|
6134
|
-
var
|
|
6135
|
-
var
|
|
6256
|
+
var import_zod42 = __toESM(require("zod"));
|
|
6257
|
+
var import_langchain41 = require("langchain");
|
|
6136
6258
|
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.`;
|
|
6137
6259
|
var createLoadSkillContentTool = () => {
|
|
6138
|
-
return (0,
|
|
6260
|
+
return (0, import_langchain41.tool)(
|
|
6139
6261
|
async (input, _exe_config) => {
|
|
6140
6262
|
try {
|
|
6141
6263
|
const storeLattice = getStoreLattice("default", "skill");
|
|
@@ -6193,19 +6315,19 @@ ${content}`;
|
|
|
6193
6315
|
{
|
|
6194
6316
|
name: "load_skill_content",
|
|
6195
6317
|
description: LOAD_SKILL_CONTENT_DESCRIPTION,
|
|
6196
|
-
schema:
|
|
6197
|
-
skill_name:
|
|
6318
|
+
schema: import_zod42.default.object({
|
|
6319
|
+
skill_name: import_zod42.default.string().describe("The name of the skill to load")
|
|
6198
6320
|
})
|
|
6199
6321
|
}
|
|
6200
6322
|
);
|
|
6201
6323
|
};
|
|
6202
6324
|
|
|
6203
6325
|
// src/tool_lattice/skill/load_skill_resource.ts
|
|
6204
|
-
var
|
|
6205
|
-
var
|
|
6326
|
+
var import_zod43 = __toESM(require("zod"));
|
|
6327
|
+
var import_langchain42 = require("langchain");
|
|
6206
6328
|
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.`;
|
|
6207
6329
|
var createLoadSkillResourceTool = () => {
|
|
6208
|
-
return (0,
|
|
6330
|
+
return (0, import_langchain42.tool)(
|
|
6209
6331
|
async (input, _exe_config) => {
|
|
6210
6332
|
try {
|
|
6211
6333
|
const storeLattice = getStoreLattice("default", "skill");
|
|
@@ -6226,9 +6348,9 @@ var createLoadSkillResourceTool = () => {
|
|
|
6226
6348
|
{
|
|
6227
6349
|
name: "load_skill_resource",
|
|
6228
6350
|
description: LOAD_SKILL_RESOURCE_DESCRIPTION,
|
|
6229
|
-
schema:
|
|
6230
|
-
skill_name:
|
|
6231
|
-
resource_path:
|
|
6351
|
+
schema: import_zod43.default.object({
|
|
6352
|
+
skill_name: import_zod43.default.string().describe("The name of the skill containing the resource"),
|
|
6353
|
+
resource_path: import_zod43.default.string().describe("The path to the resource relative to the skill's resources/ directory")
|
|
6232
6354
|
})
|
|
6233
6355
|
}
|
|
6234
6356
|
);
|
|
@@ -6250,7 +6372,7 @@ function createSkillMiddleware(params = {}) {
|
|
|
6250
6372
|
extraNote = DEFAULT_EXTRA_NOTE
|
|
6251
6373
|
} = params;
|
|
6252
6374
|
let latestSkills = [];
|
|
6253
|
-
return (0,
|
|
6375
|
+
return (0, import_langchain43.createMiddleware)({
|
|
6254
6376
|
name: "skillMiddleware",
|
|
6255
6377
|
tools: [
|
|
6256
6378
|
createLoadSkillsTool({ skills: readAll ? void 0 : skills }),
|
|
@@ -6295,10 +6417,10 @@ ${extraNote}`;
|
|
|
6295
6417
|
}
|
|
6296
6418
|
|
|
6297
6419
|
// src/deep_agent_new/middleware/fs.ts
|
|
6298
|
-
var
|
|
6420
|
+
var import_langchain44 = require("langchain");
|
|
6299
6421
|
var import_langgraph4 = require("@langchain/langgraph");
|
|
6300
6422
|
var import_v3 = require("zod/v3");
|
|
6301
|
-
var
|
|
6423
|
+
var import_zod44 = require("@langchain/langgraph/zod");
|
|
6302
6424
|
|
|
6303
6425
|
// src/deep_agent_new/backends/utils.ts
|
|
6304
6426
|
var import_micromatch = __toESM(require("micromatch"));
|
|
@@ -6762,7 +6884,7 @@ function fileDataReducer(left, right) {
|
|
|
6762
6884
|
return result;
|
|
6763
6885
|
}
|
|
6764
6886
|
var FilesystemStateSchema = import_v3.z.object({
|
|
6765
|
-
files: (0,
|
|
6887
|
+
files: (0, import_zod44.withLangGraph)(
|
|
6766
6888
|
import_v3.z.record(import_v3.z.string(), FileDataSchema).default({}),
|
|
6767
6889
|
{
|
|
6768
6890
|
reducer: {
|
|
@@ -6794,7 +6916,7 @@ var GLOB_TOOL_DESCRIPTION = "Find files matching a glob pattern (e.g., '**/*.py'
|
|
|
6794
6916
|
var GREP_TOOL_DESCRIPTION = "Search for a regex pattern in files. Returns matching files and line numbers";
|
|
6795
6917
|
function createLsTool(backend, options) {
|
|
6796
6918
|
const { customDescription } = options;
|
|
6797
|
-
return (0,
|
|
6919
|
+
return (0, import_langchain44.tool)(
|
|
6798
6920
|
async (input, config) => {
|
|
6799
6921
|
const { runConfig } = config.configurable;
|
|
6800
6922
|
const stateAndStore = {
|
|
@@ -6830,7 +6952,7 @@ function createLsTool(backend, options) {
|
|
|
6830
6952
|
}
|
|
6831
6953
|
function createReadFileTool(backend, options) {
|
|
6832
6954
|
const { customDescription } = options;
|
|
6833
|
-
return (0,
|
|
6955
|
+
return (0, import_langchain44.tool)(
|
|
6834
6956
|
async (input, config) => {
|
|
6835
6957
|
const { runConfig } = config.configurable;
|
|
6836
6958
|
const stateAndStore = {
|
|
@@ -6855,7 +6977,7 @@ function createReadFileTool(backend, options) {
|
|
|
6855
6977
|
}
|
|
6856
6978
|
function createWriteFileTool(backend, options) {
|
|
6857
6979
|
const { customDescription } = options;
|
|
6858
|
-
return (0,
|
|
6980
|
+
return (0, import_langchain44.tool)(
|
|
6859
6981
|
async (input, config) => {
|
|
6860
6982
|
const { runConfig } = config.configurable;
|
|
6861
6983
|
const stateAndStore = {
|
|
@@ -6869,7 +6991,7 @@ function createWriteFileTool(backend, options) {
|
|
|
6869
6991
|
if (result.error) {
|
|
6870
6992
|
return result.error;
|
|
6871
6993
|
}
|
|
6872
|
-
const message = new
|
|
6994
|
+
const message = new import_langchain44.ToolMessage({
|
|
6873
6995
|
content: `Successfully wrote to '${file_path}'`,
|
|
6874
6996
|
tool_call_id: config.toolCall?.id,
|
|
6875
6997
|
name: "write_file",
|
|
@@ -6894,7 +7016,7 @@ function createWriteFileTool(backend, options) {
|
|
|
6894
7016
|
}
|
|
6895
7017
|
function createEditFileTool(backend, options) {
|
|
6896
7018
|
const { customDescription } = options;
|
|
6897
|
-
return (0,
|
|
7019
|
+
return (0, import_langchain44.tool)(
|
|
6898
7020
|
async (input, config) => {
|
|
6899
7021
|
const { runConfig } = config.configurable;
|
|
6900
7022
|
const stateAndStore = {
|
|
@@ -6913,7 +7035,7 @@ function createEditFileTool(backend, options) {
|
|
|
6913
7035
|
if (result.error) {
|
|
6914
7036
|
return result.error;
|
|
6915
7037
|
}
|
|
6916
|
-
const message = new
|
|
7038
|
+
const message = new import_langchain44.ToolMessage({
|
|
6917
7039
|
content: `Successfully replaced ${result.occurrences} occurrence(s) in '${file_path}'`,
|
|
6918
7040
|
tool_call_id: config.toolCall?.id,
|
|
6919
7041
|
name: "edit_file",
|
|
@@ -6940,7 +7062,7 @@ function createEditFileTool(backend, options) {
|
|
|
6940
7062
|
}
|
|
6941
7063
|
function createGlobTool(backend, options) {
|
|
6942
7064
|
const { customDescription } = options;
|
|
6943
|
-
return (0,
|
|
7065
|
+
return (0, import_langchain44.tool)(
|
|
6944
7066
|
async (input, config) => {
|
|
6945
7067
|
const { runConfig } = config.configurable;
|
|
6946
7068
|
const stateAndStore = {
|
|
@@ -6968,7 +7090,7 @@ function createGlobTool(backend, options) {
|
|
|
6968
7090
|
}
|
|
6969
7091
|
function createGrepTool(backend, options) {
|
|
6970
7092
|
const { customDescription } = options;
|
|
6971
|
-
return (0,
|
|
7093
|
+
return (0, import_langchain44.tool)(
|
|
6972
7094
|
async (input, config) => {
|
|
6973
7095
|
const { runConfig } = config.configurable;
|
|
6974
7096
|
const stateAndStore = {
|
|
@@ -7036,7 +7158,7 @@ function createFilesystemMiddleware(options = {}) {
|
|
|
7036
7158
|
customDescription: customToolDescriptions?.grep
|
|
7037
7159
|
})
|
|
7038
7160
|
];
|
|
7039
|
-
return (0,
|
|
7161
|
+
return (0, import_langchain44.createMiddleware)({
|
|
7040
7162
|
name: "FilesystemMiddleware",
|
|
7041
7163
|
stateSchema: FilesystemStateSchema,
|
|
7042
7164
|
tools,
|
|
@@ -7067,7 +7189,7 @@ ${systemPrompt}` : systemPrompt;
|
|
|
7067
7189
|
if (writeResult.error) {
|
|
7068
7190
|
return { message: msg, filesUpdate: null };
|
|
7069
7191
|
}
|
|
7070
|
-
const truncatedMessage = new
|
|
7192
|
+
const truncatedMessage = new import_langchain44.ToolMessage({
|
|
7071
7193
|
content: `Tool result too large (${Math.round(
|
|
7072
7194
|
msg.content.length / 4
|
|
7073
7195
|
)} tokens). Content saved to ${evictPath}`,
|
|
@@ -7081,7 +7203,7 @@ ${systemPrompt}` : systemPrompt;
|
|
|
7081
7203
|
}
|
|
7082
7204
|
return { message: msg, filesUpdate: null };
|
|
7083
7205
|
}
|
|
7084
|
-
if (result instanceof
|
|
7206
|
+
if (result instanceof import_langchain44.ToolMessage) {
|
|
7085
7207
|
const processed = await processToolMessage(result);
|
|
7086
7208
|
if (processed.filesUpdate) {
|
|
7087
7209
|
return new import_langgraph4.Command({
|
|
@@ -7104,7 +7226,7 @@ ${systemPrompt}` : systemPrompt;
|
|
|
7104
7226
|
};
|
|
7105
7227
|
const processedMessages = [];
|
|
7106
7228
|
for (const msg of update.messages) {
|
|
7107
|
-
if (msg instanceof
|
|
7229
|
+
if (msg instanceof import_langchain44.ToolMessage) {
|
|
7108
7230
|
const processed = await processToolMessage(msg);
|
|
7109
7231
|
processedMessages.push(processed.message);
|
|
7110
7232
|
if (processed.filesUpdate) {
|
|
@@ -7131,11 +7253,11 @@ ${systemPrompt}` : systemPrompt;
|
|
|
7131
7253
|
}
|
|
7132
7254
|
|
|
7133
7255
|
// src/middlewares/metricsMiddleware.ts
|
|
7134
|
-
var
|
|
7256
|
+
var import_langchain45 = require("langchain");
|
|
7135
7257
|
function createMetricsMiddleware(params) {
|
|
7136
7258
|
const { serverKeys, serverDescriptions } = params;
|
|
7137
7259
|
if (!serverKeys || serverKeys.length === 0) {
|
|
7138
|
-
return (0,
|
|
7260
|
+
return (0, import_langchain45.createMiddleware)({
|
|
7139
7261
|
name: "metricsMiddleware",
|
|
7140
7262
|
tools: []
|
|
7141
7263
|
});
|
|
@@ -7144,13 +7266,16 @@ function createMetricsMiddleware(params) {
|
|
|
7144
7266
|
serverKeys,
|
|
7145
7267
|
serverDescriptions
|
|
7146
7268
|
};
|
|
7147
|
-
return (0,
|
|
7269
|
+
return (0, import_langchain45.createMiddleware)({
|
|
7148
7270
|
name: "metricsMiddleware",
|
|
7149
7271
|
tools: [
|
|
7150
7272
|
createListMetricsDataSourcesTool(toolParams),
|
|
7151
7273
|
createQueryMetricsListTool(toolParams),
|
|
7152
7274
|
createQueryMetricDefinitionTool(toolParams),
|
|
7153
|
-
createQuerySemanticMetricDataTool(toolParams)
|
|
7275
|
+
createQuerySemanticMetricDataTool(toolParams),
|
|
7276
|
+
createQueryTablesListTool(toolParams),
|
|
7277
|
+
createQueryTableDefinitionTool(toolParams),
|
|
7278
|
+
createExecuteSqlQueryTool(toolParams)
|
|
7154
7279
|
]
|
|
7155
7280
|
});
|
|
7156
7281
|
}
|
|
@@ -7244,14 +7369,14 @@ var ReActAgentGraphBuilder = class {
|
|
|
7244
7369
|
*/
|
|
7245
7370
|
build(agentLattice, params) {
|
|
7246
7371
|
const tools = params.tools.map((t) => {
|
|
7247
|
-
const
|
|
7248
|
-
return
|
|
7249
|
-
}).filter((
|
|
7372
|
+
const tool47 = getToolClient(t.key);
|
|
7373
|
+
return tool47;
|
|
7374
|
+
}).filter((tool47) => tool47 !== void 0);
|
|
7250
7375
|
const stateSchema2 = createReactAgentSchema(params.stateSchema);
|
|
7251
7376
|
const middlewareConfigs = params.middleware || [];
|
|
7252
7377
|
const filesystemBackend = this.createFilesystemBackendFactory(middlewareConfigs);
|
|
7253
7378
|
const middlewares = createCommonMiddlewares(middlewareConfigs, filesystemBackend);
|
|
7254
|
-
return (0,
|
|
7379
|
+
return (0, import_langchain46.createAgent)({
|
|
7255
7380
|
model: params.model,
|
|
7256
7381
|
tools,
|
|
7257
7382
|
systemPrompt: params.prompt,
|
|
@@ -7264,11 +7389,11 @@ var ReActAgentGraphBuilder = class {
|
|
|
7264
7389
|
};
|
|
7265
7390
|
|
|
7266
7391
|
// src/deep_agent_new/agent.ts
|
|
7267
|
-
var
|
|
7392
|
+
var import_langchain50 = require("langchain");
|
|
7268
7393
|
|
|
7269
7394
|
// src/deep_agent_new/middleware/subagents.ts
|
|
7270
7395
|
var import_v32 = require("zod/v3");
|
|
7271
|
-
var
|
|
7396
|
+
var import_langchain47 = require("langchain");
|
|
7272
7397
|
var import_langgraph6 = require("@langchain/langgraph");
|
|
7273
7398
|
var import_messages = require("@langchain/core/messages");
|
|
7274
7399
|
|
|
@@ -7823,7 +7948,7 @@ function returnCommandWithStateUpdate(result, toolCallId) {
|
|
|
7823
7948
|
update: {
|
|
7824
7949
|
...stateUpdate,
|
|
7825
7950
|
messages: [
|
|
7826
|
-
new
|
|
7951
|
+
new import_langchain47.ToolMessage({
|
|
7827
7952
|
content: lastMessage?.content || "Task Failed to complete",
|
|
7828
7953
|
tool_call_id: toolCallId,
|
|
7829
7954
|
name: "task"
|
|
@@ -7848,10 +7973,10 @@ function getSubagents(options) {
|
|
|
7848
7973
|
const generalPurposeMiddleware = [...defaultSubagentMiddleware];
|
|
7849
7974
|
if (defaultInterruptOn) {
|
|
7850
7975
|
generalPurposeMiddleware.push(
|
|
7851
|
-
(0,
|
|
7976
|
+
(0, import_langchain47.humanInTheLoopMiddleware)({ interruptOn: defaultInterruptOn })
|
|
7852
7977
|
);
|
|
7853
7978
|
}
|
|
7854
|
-
const generalPurposeSubagent = (0,
|
|
7979
|
+
const generalPurposeSubagent = (0, import_langchain47.createAgent)({
|
|
7855
7980
|
model: defaultModel,
|
|
7856
7981
|
systemPrompt: DEFAULT_SUBAGENT_PROMPT,
|
|
7857
7982
|
tools: defaultTools,
|
|
@@ -7872,8 +7997,8 @@ function getSubagents(options) {
|
|
|
7872
7997
|
const middleware = agentParams.middleware ? [...defaultSubagentMiddleware, ...agentParams.middleware] : [...defaultSubagentMiddleware];
|
|
7873
7998
|
const interruptOn = agentParams.interruptOn || defaultInterruptOn;
|
|
7874
7999
|
if (interruptOn)
|
|
7875
|
-
middleware.push((0,
|
|
7876
|
-
agents[agentParams.name] = (0,
|
|
8000
|
+
middleware.push((0, import_langchain47.humanInTheLoopMiddleware)({ interruptOn }));
|
|
8001
|
+
agents[agentParams.name] = (0, import_langchain47.createAgent)({
|
|
7877
8002
|
model: agentParams.model ?? defaultModel,
|
|
7878
8003
|
systemPrompt: agentParams.systemPrompt,
|
|
7879
8004
|
tools: agentParams.tools ?? defaultTools,
|
|
@@ -7902,7 +8027,7 @@ function createTaskTool(options) {
|
|
|
7902
8027
|
generalPurposeAgent
|
|
7903
8028
|
});
|
|
7904
8029
|
const finalTaskDescription = taskDescription ? taskDescription : getTaskToolDescription(subagentDescriptions);
|
|
7905
|
-
return (0,
|
|
8030
|
+
return (0, import_langchain47.tool)(
|
|
7906
8031
|
async (input, config) => {
|
|
7907
8032
|
const { description, subagent_type } = input;
|
|
7908
8033
|
try {
|
|
@@ -7932,7 +8057,7 @@ function createTaskTool(options) {
|
|
|
7932
8057
|
return new import_langgraph6.Command({
|
|
7933
8058
|
update: {
|
|
7934
8059
|
messages: [
|
|
7935
|
-
new
|
|
8060
|
+
new import_langchain47.ToolMessage({
|
|
7936
8061
|
content: error instanceof Error ? error.message : "Task Failed to complete",
|
|
7937
8062
|
tool_call_id: config.toolCall.id,
|
|
7938
8063
|
name: "task"
|
|
@@ -7976,7 +8101,7 @@ function createSubAgentMiddleware(options) {
|
|
|
7976
8101
|
generalPurposeAgent,
|
|
7977
8102
|
taskDescription
|
|
7978
8103
|
});
|
|
7979
|
-
return (0,
|
|
8104
|
+
return (0, import_langchain47.createMiddleware)({
|
|
7980
8105
|
name: "subAgentMiddleware",
|
|
7981
8106
|
tools: [taskTool],
|
|
7982
8107
|
wrapModelCall: async (request, handler) => {
|
|
@@ -7996,11 +8121,11 @@ ${systemPrompt}` : systemPrompt;
|
|
|
7996
8121
|
}
|
|
7997
8122
|
|
|
7998
8123
|
// src/deep_agent_new/middleware/patch_tool_calls.ts
|
|
7999
|
-
var
|
|
8124
|
+
var import_langchain48 = require("langchain");
|
|
8000
8125
|
var import_messages2 = require("@langchain/core/messages");
|
|
8001
8126
|
var import_langgraph7 = require("@langchain/langgraph");
|
|
8002
8127
|
function createPatchToolCallsMiddleware() {
|
|
8003
|
-
return (0,
|
|
8128
|
+
return (0, import_langchain48.createMiddleware)({
|
|
8004
8129
|
name: "patchToolCallsMiddleware",
|
|
8005
8130
|
beforeAgent: async (state) => {
|
|
8006
8131
|
const messages = state.messages;
|
|
@@ -8011,15 +8136,15 @@ function createPatchToolCallsMiddleware() {
|
|
|
8011
8136
|
for (let i = 0; i < messages.length; i++) {
|
|
8012
8137
|
const msg = messages[i];
|
|
8013
8138
|
patchedMessages.push(msg);
|
|
8014
|
-
if (
|
|
8139
|
+
if (import_langchain48.AIMessage.isInstance(msg) && msg.tool_calls != null) {
|
|
8015
8140
|
for (const toolCall of msg.tool_calls) {
|
|
8016
8141
|
const correspondingToolMsg = messages.slice(i).find(
|
|
8017
|
-
(m) =>
|
|
8142
|
+
(m) => import_langchain48.ToolMessage.isInstance(m) && m.tool_call_id === toolCall.id
|
|
8018
8143
|
);
|
|
8019
8144
|
if (!correspondingToolMsg) {
|
|
8020
8145
|
const toolMsg = `Tool call ${toolCall.name} with id ${toolCall.id} was cancelled - another message came in before it could be completed.`;
|
|
8021
8146
|
patchedMessages.push(
|
|
8022
|
-
new
|
|
8147
|
+
new import_langchain48.ToolMessage({
|
|
8023
8148
|
content: toolMsg,
|
|
8024
8149
|
name: toolCall.name,
|
|
8025
8150
|
tool_call_id: toolCall.id
|
|
@@ -9132,8 +9257,8 @@ var MemoryBackend = class {
|
|
|
9132
9257
|
|
|
9133
9258
|
// src/deep_agent_new/middleware/todos.ts
|
|
9134
9259
|
var import_langgraph8 = require("@langchain/langgraph");
|
|
9135
|
-
var
|
|
9136
|
-
var
|
|
9260
|
+
var import_zod45 = require("zod");
|
|
9261
|
+
var import_langchain49 = require("langchain");
|
|
9137
9262
|
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.
|
|
9138
9263
|
It also helps the user understand the progress of the task and overall progress of their requests.
|
|
9139
9264
|
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.
|
|
@@ -9360,20 +9485,20 @@ Writing todos takes time and tokens, use it when it is helpful for managing comp
|
|
|
9360
9485
|
## Important To-Do List Usage Notes to Remember
|
|
9361
9486
|
- The \`write_todos\` tool should never be called multiple times in parallel.
|
|
9362
9487
|
- 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.`;
|
|
9363
|
-
var TodoStatus =
|
|
9364
|
-
var TodoSchema =
|
|
9365
|
-
content:
|
|
9488
|
+
var TodoStatus = import_zod45.z.enum(["pending", "in_progress", "completed"]).describe("Status of the todo");
|
|
9489
|
+
var TodoSchema = import_zod45.z.object({
|
|
9490
|
+
content: import_zod45.z.string().describe("Content of the todo item"),
|
|
9366
9491
|
status: TodoStatus
|
|
9367
9492
|
});
|
|
9368
|
-
var stateSchema =
|
|
9493
|
+
var stateSchema = import_zod45.z.object({ todos: import_zod45.z.array(TodoSchema).default([]) });
|
|
9369
9494
|
function todoListMiddleware(options) {
|
|
9370
|
-
const writeTodos = (0,
|
|
9495
|
+
const writeTodos = (0, import_langchain49.tool)(
|
|
9371
9496
|
({ todos }, config) => {
|
|
9372
9497
|
return new import_langgraph8.Command({
|
|
9373
9498
|
update: {
|
|
9374
9499
|
todos,
|
|
9375
9500
|
messages: [
|
|
9376
|
-
new
|
|
9501
|
+
new import_langchain49.ToolMessage({
|
|
9377
9502
|
content: genUIMarkdown("todo_list", todos),
|
|
9378
9503
|
tool_call_id: config.toolCall?.id
|
|
9379
9504
|
})
|
|
@@ -9384,12 +9509,12 @@ function todoListMiddleware(options) {
|
|
|
9384
9509
|
{
|
|
9385
9510
|
name: "write_todos",
|
|
9386
9511
|
description: options?.toolDescription ?? WRITE_TODOS_DESCRIPTION,
|
|
9387
|
-
schema:
|
|
9388
|
-
todos:
|
|
9512
|
+
schema: import_zod45.z.object({
|
|
9513
|
+
todos: import_zod45.z.array(TodoSchema).describe("List of todo items to update")
|
|
9389
9514
|
})
|
|
9390
9515
|
}
|
|
9391
9516
|
);
|
|
9392
|
-
return (0,
|
|
9517
|
+
return (0, import_langchain49.createMiddleware)({
|
|
9393
9518
|
name: "todoListMiddleware",
|
|
9394
9519
|
stateSchema,
|
|
9395
9520
|
tools: [writeTodos],
|
|
@@ -9441,13 +9566,13 @@ ${BASE_PROMPT}` : BASE_PROMPT;
|
|
|
9441
9566
|
backend: filesystemBackend
|
|
9442
9567
|
}),
|
|
9443
9568
|
// Subagent middleware: Automatic conversation summarization when token limits are approached
|
|
9444
|
-
(0,
|
|
9569
|
+
(0, import_langchain50.summarizationMiddleware)({
|
|
9445
9570
|
model,
|
|
9446
9571
|
trigger: { tokens: 17e4 },
|
|
9447
9572
|
keep: { messages: 6 }
|
|
9448
9573
|
}),
|
|
9449
9574
|
// Subagent middleware: Anthropic prompt caching for improved performance
|
|
9450
|
-
(0,
|
|
9575
|
+
(0, import_langchain50.anthropicPromptCachingMiddleware)({
|
|
9451
9576
|
unsupportedModelBehavior: "ignore"
|
|
9452
9577
|
}),
|
|
9453
9578
|
// Subagent middleware: Patches tool calls for compatibility
|
|
@@ -9458,23 +9583,23 @@ ${BASE_PROMPT}` : BASE_PROMPT;
|
|
|
9458
9583
|
generalPurposeAgent: false
|
|
9459
9584
|
}),
|
|
9460
9585
|
// Automatically summarizes conversation history when token limits are approached
|
|
9461
|
-
(0,
|
|
9586
|
+
(0, import_langchain50.summarizationMiddleware)({
|
|
9462
9587
|
model,
|
|
9463
9588
|
trigger: { tokens: 17e4 },
|
|
9464
9589
|
keep: { messages: 6 }
|
|
9465
9590
|
}),
|
|
9466
9591
|
// Enables Anthropic prompt caching for improved performance and reduced costs
|
|
9467
|
-
(0,
|
|
9592
|
+
(0, import_langchain50.anthropicPromptCachingMiddleware)({
|
|
9468
9593
|
unsupportedModelBehavior: "ignore"
|
|
9469
9594
|
}),
|
|
9470
9595
|
// Patches tool calls to ensure compatibility across different model providers
|
|
9471
9596
|
createPatchToolCallsMiddleware()
|
|
9472
9597
|
];
|
|
9473
9598
|
if (interruptOn) {
|
|
9474
|
-
middleware.push((0,
|
|
9599
|
+
middleware.push((0, import_langchain50.humanInTheLoopMiddleware)({ interruptOn }));
|
|
9475
9600
|
}
|
|
9476
9601
|
middleware.push(...customMiddleware);
|
|
9477
|
-
return (0,
|
|
9602
|
+
return (0, import_langchain50.createAgent)({
|
|
9478
9603
|
model,
|
|
9479
9604
|
systemPrompt: finalSystemPrompt,
|
|
9480
9605
|
tools,
|
|
@@ -9532,7 +9657,7 @@ var DeepAgentGraphBuilder = class {
|
|
|
9532
9657
|
const tools = params.tools.map((t) => {
|
|
9533
9658
|
const toolClient = getToolClient(t.key);
|
|
9534
9659
|
return toolClient;
|
|
9535
|
-
}).filter((
|
|
9660
|
+
}).filter((tool47) => tool47 !== void 0);
|
|
9536
9661
|
const subagents = params.subAgents.map((sa) => {
|
|
9537
9662
|
if (sa.client) {
|
|
9538
9663
|
return {
|
|
@@ -9571,7 +9696,7 @@ var DeepAgentGraphBuilder = class {
|
|
|
9571
9696
|
|
|
9572
9697
|
// src/agent_team/agent_team.ts
|
|
9573
9698
|
var import_v35 = require("zod/v3");
|
|
9574
|
-
var
|
|
9699
|
+
var import_langchain53 = require("langchain");
|
|
9575
9700
|
|
|
9576
9701
|
// src/agent_team/types.ts
|
|
9577
9702
|
var TaskStatus = /* @__PURE__ */ ((TaskStatus3) => {
|
|
@@ -10007,13 +10132,13 @@ var InMemoryMailboxStore = class {
|
|
|
10007
10132
|
|
|
10008
10133
|
// src/agent_team/middleware/team.ts
|
|
10009
10134
|
var import_v34 = require("zod/v3");
|
|
10010
|
-
var
|
|
10135
|
+
var import_langchain52 = require("langchain");
|
|
10011
10136
|
var import_langgraph10 = require("@langchain/langgraph");
|
|
10012
10137
|
var import_uuid = require("uuid");
|
|
10013
10138
|
|
|
10014
10139
|
// src/agent_team/middleware/teammate_tools.ts
|
|
10015
10140
|
var import_v33 = require("zod/v3");
|
|
10016
|
-
var
|
|
10141
|
+
var import_langchain51 = require("langchain");
|
|
10017
10142
|
var import_langgraph9 = require("@langchain/langgraph");
|
|
10018
10143
|
|
|
10019
10144
|
// src/agent_team/middleware/formatMessages.ts
|
|
@@ -10038,7 +10163,7 @@ ${meta}${body}`;
|
|
|
10038
10163
|
// src/agent_team/middleware/teammate_tools.ts
|
|
10039
10164
|
function createTeammateTools(options) {
|
|
10040
10165
|
const { teamId, agentId, taskListStore, mailboxStore } = options;
|
|
10041
|
-
const claimTaskTool = (0,
|
|
10166
|
+
const claimTaskTool = (0, import_langchain51.tool)(
|
|
10042
10167
|
async (input) => {
|
|
10043
10168
|
const task = await taskListStore.claimTaskById(
|
|
10044
10169
|
teamId,
|
|
@@ -10068,7 +10193,7 @@ function createTeammateTools(options) {
|
|
|
10068
10193
|
})
|
|
10069
10194
|
}
|
|
10070
10195
|
);
|
|
10071
|
-
const completeTaskTool = (0,
|
|
10196
|
+
const completeTaskTool = (0, import_langchain51.tool)(
|
|
10072
10197
|
async (input) => {
|
|
10073
10198
|
const task = await taskListStore.completeTask(
|
|
10074
10199
|
teamId,
|
|
@@ -10095,7 +10220,7 @@ function createTeammateTools(options) {
|
|
|
10095
10220
|
})
|
|
10096
10221
|
}
|
|
10097
10222
|
);
|
|
10098
|
-
const failTaskTool = (0,
|
|
10223
|
+
const failTaskTool = (0, import_langchain51.tool)(
|
|
10099
10224
|
async (input) => {
|
|
10100
10225
|
const task = await taskListStore.failTask(
|
|
10101
10226
|
teamId,
|
|
@@ -10122,7 +10247,7 @@ function createTeammateTools(options) {
|
|
|
10122
10247
|
})
|
|
10123
10248
|
}
|
|
10124
10249
|
);
|
|
10125
|
-
const sendMessageTool = (0,
|
|
10250
|
+
const sendMessageTool = (0, import_langchain51.tool)(
|
|
10126
10251
|
async (input) => {
|
|
10127
10252
|
await mailboxStore.sendMessage(
|
|
10128
10253
|
teamId,
|
|
@@ -10160,7 +10285,7 @@ function createTeammateTools(options) {
|
|
|
10160
10285
|
read: msg.read
|
|
10161
10286
|
}));
|
|
10162
10287
|
};
|
|
10163
|
-
const readMessagesTool = (0,
|
|
10288
|
+
const readMessagesTool = (0, import_langchain51.tool)(
|
|
10164
10289
|
async (input, config) => {
|
|
10165
10290
|
const formatAndMarkAsRead = async (msgs2) => {
|
|
10166
10291
|
for (const msg of msgs2) {
|
|
@@ -10172,7 +10297,7 @@ function createTeammateTools(options) {
|
|
|
10172
10297
|
if (msgs.length > 0) {
|
|
10173
10298
|
const formatted2 = await formatAndMarkAsRead(msgs);
|
|
10174
10299
|
const relevantMsgs2 = await getRelevantMessagesForState();
|
|
10175
|
-
const toolMessage2 = new
|
|
10300
|
+
const toolMessage2 = new import_langchain51.ToolMessage({
|
|
10176
10301
|
content: formatted2,
|
|
10177
10302
|
tool_call_id: config.toolCall?.id,
|
|
10178
10303
|
name: "read_messages"
|
|
@@ -10197,7 +10322,7 @@ function createTeammateTools(options) {
|
|
|
10197
10322
|
});
|
|
10198
10323
|
const relevantMsgs = await getRelevantMessagesForState();
|
|
10199
10324
|
if (msgs.length === 0) {
|
|
10200
|
-
const toolMessage2 = new
|
|
10325
|
+
const toolMessage2 = new import_langchain51.ToolMessage({
|
|
10201
10326
|
content: "No unread messages.",
|
|
10202
10327
|
tool_call_id: config.toolCall?.id,
|
|
10203
10328
|
name: "read_messages"
|
|
@@ -10207,7 +10332,7 @@ function createTeammateTools(options) {
|
|
|
10207
10332
|
});
|
|
10208
10333
|
}
|
|
10209
10334
|
const formatted = await formatAndMarkAsRead(msgs);
|
|
10210
|
-
const toolMessage = new
|
|
10335
|
+
const toolMessage = new import_langchain51.ToolMessage({
|
|
10211
10336
|
content: formatted,
|
|
10212
10337
|
tool_call_id: config.toolCall?.id,
|
|
10213
10338
|
name: "read_messages"
|
|
@@ -10222,7 +10347,7 @@ function createTeammateTools(options) {
|
|
|
10222
10347
|
schema: import_v33.z.object({})
|
|
10223
10348
|
}
|
|
10224
10349
|
);
|
|
10225
|
-
const checkTasksTool = (0,
|
|
10350
|
+
const checkTasksTool = (0, import_langchain51.tool)(
|
|
10226
10351
|
async () => {
|
|
10227
10352
|
const tasks = await taskListStore.getAllTasks(teamId);
|
|
10228
10353
|
return formatTaskSummary(tasks);
|
|
@@ -10233,7 +10358,7 @@ function createTeammateTools(options) {
|
|
|
10233
10358
|
schema: import_v33.z.object({})
|
|
10234
10359
|
}
|
|
10235
10360
|
);
|
|
10236
|
-
const broadcastMessageTool = (0,
|
|
10361
|
+
const broadcastMessageTool = (0, import_langchain51.tool)(
|
|
10237
10362
|
async (input) => {
|
|
10238
10363
|
const allAgents = await mailboxStore.getRegisteredAgents(teamId);
|
|
10239
10364
|
const recipients = allAgents.filter((a) => a !== agentId);
|
|
@@ -10418,7 +10543,7 @@ You have access to these tools:
|
|
|
10418
10543
|
- \`read_messages\`: Read messages from team_lead or teammates
|
|
10419
10544
|
- \`check_tasks\`: Get current status of all tasks in the team`;
|
|
10420
10545
|
const assistantId = getTeammateAssistantId(ctx.teamId, spec.name);
|
|
10421
|
-
agent = (0,
|
|
10546
|
+
agent = (0, import_langchain52.createAgent)({
|
|
10422
10547
|
model: spec.model ?? ctx.defaultModel,
|
|
10423
10548
|
systemPrompt: teammatePrompt,
|
|
10424
10549
|
tools: allTools,
|
|
@@ -10476,12 +10601,12 @@ async function spawnTeammate(options) {
|
|
|
10476
10601
|
function createTeamMiddleware(options) {
|
|
10477
10602
|
const { teamConfig, taskListStore, mailboxStore } = options;
|
|
10478
10603
|
const defaultModel = teamConfig.model ?? "claude-sonnet-4-5-20250929";
|
|
10479
|
-
const createTeamTool = (0,
|
|
10604
|
+
const createTeamTool = (0, import_langchain52.tool)(
|
|
10480
10605
|
async (input, config) => {
|
|
10481
10606
|
const state = (0, import_langgraph10.getCurrentTaskInput)();
|
|
10482
10607
|
if (state?.team?.teamId) {
|
|
10483
10608
|
const existingId = state.team.teamId;
|
|
10484
|
-
const msg = new
|
|
10609
|
+
const msg = new import_langchain52.ToolMessage({
|
|
10485
10610
|
content: `A team is already active (id: ${existingId}). Use this team_id for \`check_tasks\`, \`read_messages\`, \`add_tasks\`, \`send_message\`, \`assign_task\`, \`set_task_status\`, and \`set_task_dependencies\`. Do not call \`create_team\` again unless you need a fresh team for a new objective.`,
|
|
10486
10611
|
tool_call_id: config.toolCall?.id,
|
|
10487
10612
|
name: "create_team"
|
|
@@ -10566,7 +10691,7 @@ Teammates are now working in the background. Keep calling \`check_tasks\` and \`
|
|
|
10566
10691
|
\`\`\`json
|
|
10567
10692
|
${teamJson}
|
|
10568
10693
|
\`\`\``;
|
|
10569
|
-
const toolMessage = new
|
|
10694
|
+
const toolMessage = new import_langchain52.ToolMessage({
|
|
10570
10695
|
content: summary,
|
|
10571
10696
|
tool_call_id: config.toolCall?.id,
|
|
10572
10697
|
name: "create_team"
|
|
@@ -10651,7 +10776,7 @@ After calling create_team, you MUST:
|
|
|
10651
10776
|
if (state?.team?.teamId) return state.team.teamId;
|
|
10652
10777
|
throw new Error("No team_id provided and no team in state. Call create_team first.");
|
|
10653
10778
|
};
|
|
10654
|
-
const addTasksTool = (0,
|
|
10779
|
+
const addTasksTool = (0, import_langchain52.tool)(
|
|
10655
10780
|
async (input, config) => {
|
|
10656
10781
|
const teamId = resolveTeamId();
|
|
10657
10782
|
const created = await taskListStore.addTasks(
|
|
@@ -10665,7 +10790,7 @@ After calling create_team, you MUST:
|
|
|
10665
10790
|
}))
|
|
10666
10791
|
);
|
|
10667
10792
|
const summary = created.map((t) => `- ${t.id}: "${t.title}"`).join("\n");
|
|
10668
|
-
return new
|
|
10793
|
+
return new import_langchain52.ToolMessage({
|
|
10669
10794
|
content: `Added ${created.length} task(s) to team ${teamId}:
|
|
10670
10795
|
${summary}
|
|
10671
10796
|
Sleeping teammates will wake up and claim these.`,
|
|
@@ -10716,20 +10841,20 @@ IMPORTANT: Assigning to a specific teammate
|
|
|
10716
10841
|
})
|
|
10717
10842
|
}
|
|
10718
10843
|
);
|
|
10719
|
-
const assignTaskTool = (0,
|
|
10844
|
+
const assignTaskTool = (0, import_langchain52.tool)(
|
|
10720
10845
|
async (input, config) => {
|
|
10721
10846
|
const teamId = resolveTeamId();
|
|
10722
10847
|
const task = await taskListStore.updateTask(teamId, input.task_id, {
|
|
10723
10848
|
assignee: input.assignee
|
|
10724
10849
|
});
|
|
10725
10850
|
if (!task) {
|
|
10726
|
-
return new
|
|
10851
|
+
return new import_langchain52.ToolMessage({
|
|
10727
10852
|
content: `Task ${input.task_id} not found in team ${teamId}.`,
|
|
10728
10853
|
tool_call_id: config.toolCall?.id,
|
|
10729
10854
|
name: "assign_task"
|
|
10730
10855
|
});
|
|
10731
10856
|
}
|
|
10732
|
-
return new
|
|
10857
|
+
return new import_langchain52.ToolMessage({
|
|
10733
10858
|
content: `Task "${task.title}" (${task.id}) assigned to ${input.assignee}.`,
|
|
10734
10859
|
tool_call_id: config.toolCall?.id,
|
|
10735
10860
|
name: "assign_task"
|
|
@@ -10744,20 +10869,20 @@ IMPORTANT: Assigning to a specific teammate
|
|
|
10744
10869
|
})
|
|
10745
10870
|
}
|
|
10746
10871
|
);
|
|
10747
|
-
const setTaskStatusTool = (0,
|
|
10872
|
+
const setTaskStatusTool = (0, import_langchain52.tool)(
|
|
10748
10873
|
async (input, config) => {
|
|
10749
10874
|
const teamId = resolveTeamId();
|
|
10750
10875
|
const task = await taskListStore.updateTask(teamId, input.task_id, {
|
|
10751
10876
|
status: input.status
|
|
10752
10877
|
});
|
|
10753
10878
|
if (!task) {
|
|
10754
|
-
return new
|
|
10879
|
+
return new import_langchain52.ToolMessage({
|
|
10755
10880
|
content: `Task ${input.task_id} not found in team ${teamId}.`,
|
|
10756
10881
|
tool_call_id: config.toolCall?.id,
|
|
10757
10882
|
name: "set_task_status"
|
|
10758
10883
|
});
|
|
10759
10884
|
}
|
|
10760
|
-
return new
|
|
10885
|
+
return new import_langchain52.ToolMessage({
|
|
10761
10886
|
content: `Task "${task.title}" (${task.id}) status set to ${input.status}.`,
|
|
10762
10887
|
tool_call_id: config.toolCall?.id,
|
|
10763
10888
|
name: "set_task_status"
|
|
@@ -10772,20 +10897,20 @@ IMPORTANT: Assigning to a specific teammate
|
|
|
10772
10897
|
})
|
|
10773
10898
|
}
|
|
10774
10899
|
);
|
|
10775
|
-
const setTaskDependenciesTool = (0,
|
|
10900
|
+
const setTaskDependenciesTool = (0, import_langchain52.tool)(
|
|
10776
10901
|
async (input, config) => {
|
|
10777
10902
|
const teamId = resolveTeamId();
|
|
10778
10903
|
const task = await taskListStore.updateTask(teamId, input.task_id, {
|
|
10779
10904
|
dependencies: input.dependencies
|
|
10780
10905
|
});
|
|
10781
10906
|
if (!task) {
|
|
10782
|
-
return new
|
|
10907
|
+
return new import_langchain52.ToolMessage({
|
|
10783
10908
|
content: `Task ${input.task_id} not found in team ${teamId}.`,
|
|
10784
10909
|
tool_call_id: config.toolCall?.id,
|
|
10785
10910
|
name: "set_task_dependencies"
|
|
10786
10911
|
});
|
|
10787
10912
|
}
|
|
10788
|
-
return new
|
|
10913
|
+
return new import_langchain52.ToolMessage({
|
|
10789
10914
|
content: `Task "${task.title}" (${task.id}) dependencies set to [${input.dependencies.join(", ")}].`,
|
|
10790
10915
|
tool_call_id: config.toolCall?.id,
|
|
10791
10916
|
name: "set_task_dependencies"
|
|
@@ -10800,7 +10925,7 @@ IMPORTANT: Assigning to a specific teammate
|
|
|
10800
10925
|
})
|
|
10801
10926
|
}
|
|
10802
10927
|
);
|
|
10803
|
-
const checkTasksTool = (0,
|
|
10928
|
+
const checkTasksTool = (0, import_langchain52.tool)(
|
|
10804
10929
|
async (input, config) => {
|
|
10805
10930
|
const teamId = resolveTeamId();
|
|
10806
10931
|
const tasks = await taskListStore.getAllTasks(teamId);
|
|
@@ -10809,7 +10934,7 @@ IMPORTANT: Assigning to a specific teammate
|
|
|
10809
10934
|
update: {
|
|
10810
10935
|
tasks: tasksSnapshot,
|
|
10811
10936
|
messages: [
|
|
10812
|
-
new
|
|
10937
|
+
new import_langchain52.ToolMessage({
|
|
10813
10938
|
content: formatTaskSummary(tasks),
|
|
10814
10939
|
tool_call_id: config.toolCall?.id,
|
|
10815
10940
|
name: "check_tasks"
|
|
@@ -10845,7 +10970,7 @@ Task Status Values:
|
|
|
10845
10970
|
})
|
|
10846
10971
|
}
|
|
10847
10972
|
);
|
|
10848
|
-
const sendMessageTool = (0,
|
|
10973
|
+
const sendMessageTool = (0, import_langchain52.tool)(
|
|
10849
10974
|
async (input, config) => {
|
|
10850
10975
|
const teamId = resolveTeamId();
|
|
10851
10976
|
await mailboxStore.sendMessage(
|
|
@@ -10855,7 +10980,7 @@ Task Status Values:
|
|
|
10855
10980
|
input.content,
|
|
10856
10981
|
"direct_message" /* DIRECT_MESSAGE */
|
|
10857
10982
|
);
|
|
10858
|
-
return new
|
|
10983
|
+
return new import_langchain52.ToolMessage({
|
|
10859
10984
|
content: `Message sent to ${input.to}.`,
|
|
10860
10985
|
tool_call_id: config.toolCall?.id,
|
|
10861
10986
|
name: "send_message"
|
|
@@ -10870,7 +10995,7 @@ Task Status Values:
|
|
|
10870
10995
|
})
|
|
10871
10996
|
}
|
|
10872
10997
|
);
|
|
10873
|
-
const readMessagesTool = (0,
|
|
10998
|
+
const readMessagesTool = (0, import_langchain52.tool)(
|
|
10874
10999
|
async (input, config) => {
|
|
10875
11000
|
const teamId = resolveTeamId();
|
|
10876
11001
|
const formatAndMarkAsRead = async (msgs2) => {
|
|
@@ -10898,7 +11023,7 @@ Task Status Values:
|
|
|
10898
11023
|
if (msgs.length > 0) {
|
|
10899
11024
|
const formatted2 = await formatAndMarkAsRead(msgs);
|
|
10900
11025
|
const allTeamMessages2 = await getAllTeamMessagesForState();
|
|
10901
|
-
const toolMessage2 = new
|
|
11026
|
+
const toolMessage2 = new import_langchain52.ToolMessage({
|
|
10902
11027
|
content: formatted2,
|
|
10903
11028
|
tool_call_id: config.toolCall?.id,
|
|
10904
11029
|
name: "read_messages"
|
|
@@ -10930,7 +11055,7 @@ Task Status Values:
|
|
|
10930
11055
|
);
|
|
10931
11056
|
const allTeamMessages = await getAllTeamMessagesForState();
|
|
10932
11057
|
if (msgs.length === 0) {
|
|
10933
|
-
const toolMessage2 = new
|
|
11058
|
+
const toolMessage2 = new import_langchain52.ToolMessage({
|
|
10934
11059
|
content: "No unread messages from teammates.",
|
|
10935
11060
|
tool_call_id: config.toolCall?.id,
|
|
10936
11061
|
name: "read_messages"
|
|
@@ -10940,7 +11065,7 @@ Task Status Values:
|
|
|
10940
11065
|
});
|
|
10941
11066
|
}
|
|
10942
11067
|
const formatted = await formatAndMarkAsRead(msgs);
|
|
10943
|
-
const toolMessage = new
|
|
11068
|
+
const toolMessage = new import_langchain52.ToolMessage({
|
|
10944
11069
|
content: formatted,
|
|
10945
11070
|
tool_call_id: config.toolCall?.id,
|
|
10946
11071
|
name: "read_messages"
|
|
@@ -10957,7 +11082,7 @@ Task Status Values:
|
|
|
10957
11082
|
})
|
|
10958
11083
|
}
|
|
10959
11084
|
);
|
|
10960
|
-
const disbandTeamTool = (0,
|
|
11085
|
+
const disbandTeamTool = (0, import_langchain52.tool)(
|
|
10961
11086
|
async (input, config) => {
|
|
10962
11087
|
const teamId = resolveTeamId();
|
|
10963
11088
|
await mailboxStore.broadcastMessage(
|
|
@@ -10967,7 +11092,7 @@ Task Status Values:
|
|
|
10967
11092
|
"shutdown_request" /* SHUTDOWN_REQUEST */
|
|
10968
11093
|
);
|
|
10969
11094
|
await new Promise((r) => setTimeout(r, 2e3));
|
|
10970
|
-
return new
|
|
11095
|
+
return new import_langchain52.ToolMessage({
|
|
10971
11096
|
content: `Team ${teamId} has been disbanded. All teammates notified and resources cleaned up.`,
|
|
10972
11097
|
tool_call_id: config.toolCall?.id,
|
|
10973
11098
|
name: "disband_team"
|
|
@@ -10978,7 +11103,7 @@ Task Status Values:
|
|
|
10978
11103
|
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."
|
|
10979
11104
|
}
|
|
10980
11105
|
);
|
|
10981
|
-
const broadcastMessageTool = (0,
|
|
11106
|
+
const broadcastMessageTool = (0, import_langchain52.tool)(
|
|
10982
11107
|
async (input, config) => {
|
|
10983
11108
|
const teamId = resolveTeamId();
|
|
10984
11109
|
await mailboxStore.broadcastMessage(
|
|
@@ -10987,7 +11112,7 @@ Task Status Values:
|
|
|
10987
11112
|
input.content,
|
|
10988
11113
|
"broadcast" /* BROADCAST */
|
|
10989
11114
|
);
|
|
10990
|
-
return new
|
|
11115
|
+
return new import_langchain52.ToolMessage({
|
|
10991
11116
|
content: `Broadcast message sent to all teammates.`,
|
|
10992
11117
|
tool_call_id: config.toolCall?.id,
|
|
10993
11118
|
name: "broadcast_message"
|
|
@@ -11001,7 +11126,7 @@ Task Status Values:
|
|
|
11001
11126
|
})
|
|
11002
11127
|
}
|
|
11003
11128
|
);
|
|
11004
|
-
return (0,
|
|
11129
|
+
return (0, import_langchain52.createMiddleware)({
|
|
11005
11130
|
name: "teamMiddleware",
|
|
11006
11131
|
tools: [
|
|
11007
11132
|
createTeamTool,
|
|
@@ -11109,7 +11234,7 @@ function createAgentTeam(config) {
|
|
|
11109
11234
|
];
|
|
11110
11235
|
const systemPrompt = config.systemPrompt + "\n\n" + TEAM_LEAD_BASE_PROMPT;
|
|
11111
11236
|
const stateSchema2 = createReactAgentSchema(TEAM_STATE_SCHEMA);
|
|
11112
|
-
return (0,
|
|
11237
|
+
return (0, import_langchain53.createAgent)({
|
|
11113
11238
|
model: config.model ?? "claude-sonnet-4-5-20250929",
|
|
11114
11239
|
systemPrompt,
|
|
11115
11240
|
tools: [],
|
|
@@ -11139,7 +11264,7 @@ var TeamAgentGraphBuilder = class {
|
|
|
11139
11264
|
const tools = params.tools.map((t) => {
|
|
11140
11265
|
const toolClient = getToolClient(t.key);
|
|
11141
11266
|
return toolClient;
|
|
11142
|
-
}).filter((
|
|
11267
|
+
}).filter((tool47) => tool47 !== void 0);
|
|
11143
11268
|
const teammates = params.subAgents.map((sa) => {
|
|
11144
11269
|
const baseConfig = sa.config;
|
|
11145
11270
|
return {
|
|
@@ -13799,10 +13924,10 @@ var McpLatticeManager = class _McpLatticeManager extends BaseLatticeManager {
|
|
|
13799
13924
|
}
|
|
13800
13925
|
const tools = await this.getAllTools();
|
|
13801
13926
|
console.log(`[MCP] Registering ${tools.length} tools to Tool Lattice...`);
|
|
13802
|
-
for (const
|
|
13803
|
-
const toolKey = prefix ? `${prefix}_${
|
|
13804
|
-
|
|
13805
|
-
toolLatticeManager.registerExistingTool(toolKey,
|
|
13927
|
+
for (const tool47 of tools) {
|
|
13928
|
+
const toolKey = prefix ? `${prefix}_${tool47.name}` : tool47.name;
|
|
13929
|
+
tool47.name = toolKey;
|
|
13930
|
+
toolLatticeManager.registerExistingTool(toolKey, tool47);
|
|
13806
13931
|
console.log(`[MCP] Registered tool: ${toolKey}`);
|
|
13807
13932
|
}
|
|
13808
13933
|
console.log(`[MCP] Successfully registered ${tools.length} tools to Tool Lattice`);
|
|
@@ -13941,6 +14066,7 @@ function clearEncryptionKeyCache() {
|
|
|
13941
14066
|
checkEmptyContent,
|
|
13942
14067
|
clearEncryptionKeyCache,
|
|
13943
14068
|
createAgentTeam,
|
|
14069
|
+
createExecuteSqlQueryTool,
|
|
13944
14070
|
createFileData,
|
|
13945
14071
|
createInfoSqlTool,
|
|
13946
14072
|
createListMetricsDataSourcesTool,
|