@axiom-lattice/core 2.1.29 → 2.1.31
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 +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +394 -134
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +436 -176
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -511,11 +511,11 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
|
|
|
511
511
|
* @param key Lattice键名
|
|
512
512
|
* @param tool 已有的StructuredTool实例
|
|
513
513
|
*/
|
|
514
|
-
registerExistingTool(key,
|
|
514
|
+
registerExistingTool(key, tool48) {
|
|
515
515
|
const config = {
|
|
516
|
-
name:
|
|
517
|
-
description:
|
|
518
|
-
schema:
|
|
516
|
+
name: tool48.name,
|
|
517
|
+
description: tool48.description,
|
|
518
|
+
schema: tool48.schema,
|
|
519
519
|
// StructuredTool的schema已经是Zod兼容的
|
|
520
520
|
needUserApprove: false
|
|
521
521
|
// MCP工具默认不需要用户批准
|
|
@@ -523,7 +523,7 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
|
|
|
523
523
|
const toolLattice = {
|
|
524
524
|
key,
|
|
525
525
|
config,
|
|
526
|
-
client:
|
|
526
|
+
client: tool48
|
|
527
527
|
};
|
|
528
528
|
this.register(key, toolLattice);
|
|
529
529
|
}
|
|
@@ -549,7 +549,7 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
|
|
|
549
549
|
};
|
|
550
550
|
var toolLatticeManager = ToolLatticeManager.getInstance();
|
|
551
551
|
var registerToolLattice = (key, config, executor) => toolLatticeManager.registerLattice(key, config, executor);
|
|
552
|
-
var registerExistingTool = (key,
|
|
552
|
+
var registerExistingTool = (key, tool48) => toolLatticeManager.registerExistingTool(key, tool48);
|
|
553
553
|
var getToolLattice = (key) => toolLatticeManager.getToolLattice(key);
|
|
554
554
|
var getToolDefinition = (key) => toolLatticeManager.getToolDefinition(key);
|
|
555
555
|
var getToolClient = (key) => toolLatticeManager.getToolClient(key);
|
|
@@ -561,11 +561,17 @@ registerToolLattice(
|
|
|
561
561
|
"get_current_date_time",
|
|
562
562
|
{
|
|
563
563
|
name: "get_current_date_time",
|
|
564
|
-
description: "
|
|
564
|
+
description: "Access the authoritative system clock to synchronize the real-world timeline. Essential for anchoring all relative time expressions (e.g., 'recent', 'last quarter', 'YTD') and establishing precise temporal filters for data retrieval, trend analysis, and decision-making logic. Avoid data hallucinations from training data.",
|
|
565
565
|
schema: z.object({})
|
|
566
566
|
},
|
|
567
567
|
async () => {
|
|
568
|
-
|
|
568
|
+
const now = /* @__PURE__ */ new Date();
|
|
569
|
+
return JSON.stringify({
|
|
570
|
+
local_time: now.toLocaleString(),
|
|
571
|
+
iso_date: now.toISOString().split("T")[0],
|
|
572
|
+
// 方便直接用于 SQL: 2026-03-10
|
|
573
|
+
timestamp: now.toISOString()
|
|
574
|
+
});
|
|
569
575
|
}
|
|
570
576
|
);
|
|
571
577
|
|
|
@@ -1900,7 +1906,7 @@ ${lines.join("\n")}`;
|
|
|
1900
1906
|
);
|
|
1901
1907
|
};
|
|
1902
1908
|
|
|
1903
|
-
// src/tool_lattice/metrics/
|
|
1909
|
+
// src/tool_lattice/metrics/list_datasources.ts
|
|
1904
1910
|
import z8 from "zod";
|
|
1905
1911
|
import { tool as tool7 } from "langchain";
|
|
1906
1912
|
var LIST_METRICS_DATASOURCES_DESCRIPTION = `List all available datasources from all configured metrics servers. Returns a table with Server Key, DataSource ID, and DataSource Name. Use this tool first to discover what datasources are available before querying metrics.`;
|
|
@@ -1972,7 +1978,7 @@ To view all available data sources, please clear the current selection or reopen
|
|
|
1972
1978
|
}
|
|
1973
1979
|
},
|
|
1974
1980
|
{
|
|
1975
|
-
name: "
|
|
1981
|
+
name: "list_datasources",
|
|
1976
1982
|
description: `${LIST_METRICS_DATASOURCES_DESCRIPTION}${availableServersText}`,
|
|
1977
1983
|
schema: z8.object({})
|
|
1978
1984
|
}
|
|
@@ -2874,10 +2880,10 @@ When to Use This Tool:
|
|
|
2874
2880
|
|
|
2875
2881
|
When NOT to Use This Tool:
|
|
2876
2882
|
- For simple metric queries - use query_semantic_metric_data instead
|
|
2877
|
-
- When you haven't identified the correct datasource yet - use
|
|
2883
|
+
- When you haven't identified the correct datasource yet - use list_datasources first
|
|
2878
2884
|
|
|
2879
2885
|
Prerequisites:
|
|
2880
|
-
1. Call
|
|
2886
|
+
1. Call list_datasources to get available datasource IDs
|
|
2881
2887
|
2. Call query_tables_list to see available tables and their structures
|
|
2882
2888
|
3. Call query_table_definition to understand table columns before writing SQL
|
|
2883
2889
|
|
|
@@ -2896,7 +2902,7 @@ Example:
|
|
|
2896
2902
|
"params": {
|
|
2897
2903
|
"year": "2024"
|
|
2898
2904
|
},
|
|
2899
|
-
"limit":
|
|
2905
|
+
"limit": 100
|
|
2900
2906
|
}`;
|
|
2901
2907
|
var createExecuteSqlQueryTool = ({ serverKeys, serverDescriptions }) => {
|
|
2902
2908
|
const availableServersText = serverKeys.length > 0 ? `
|
|
@@ -2954,7 +2960,7 @@ ${serverKeys.map(
|
|
|
2954
2960
|
datasourceId: z14.string().optional().describe("The data source ID to execute SQL against. Optional if configured in runConfig.metricsDataSource"),
|
|
2955
2961
|
customSql: z14.string().describe("Custom SQL query string with named parameters (e.g., :year, :category). Use double quotes for identifiers."),
|
|
2956
2962
|
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."),
|
|
2957
|
-
limit: z14.number().optional().describe("Maximum number of results to return (default:
|
|
2963
|
+
limit: z14.number().optional().describe("Maximum number of results to return (default: 100).")
|
|
2958
2964
|
})
|
|
2959
2965
|
}
|
|
2960
2966
|
);
|
|
@@ -5756,6 +5762,122 @@ var InMemoryMetricsServerConfigStore = class {
|
|
|
5756
5762
|
}
|
|
5757
5763
|
};
|
|
5758
5764
|
|
|
5765
|
+
// src/store_lattice/InMemoryMcpServerConfigStore.ts
|
|
5766
|
+
var InMemoryMcpServerConfigStore = class {
|
|
5767
|
+
constructor() {
|
|
5768
|
+
this.configs = /* @__PURE__ */ new Map();
|
|
5769
|
+
}
|
|
5770
|
+
/**
|
|
5771
|
+
* Get composite key for storage
|
|
5772
|
+
*/
|
|
5773
|
+
getKey(tenantId, id) {
|
|
5774
|
+
return `${tenantId}:${id}`;
|
|
5775
|
+
}
|
|
5776
|
+
/**
|
|
5777
|
+
* Get all MCP server configurations for a tenant
|
|
5778
|
+
*/
|
|
5779
|
+
async getAllConfigs(tenantId) {
|
|
5780
|
+
return Array.from(this.configs.values()).filter(
|
|
5781
|
+
(config) => config.tenantId === tenantId
|
|
5782
|
+
);
|
|
5783
|
+
}
|
|
5784
|
+
/**
|
|
5785
|
+
* Get all MCP server configurations across all tenants
|
|
5786
|
+
*/
|
|
5787
|
+
async getAllConfigsWithoutTenant() {
|
|
5788
|
+
return Array.from(this.configs.values());
|
|
5789
|
+
}
|
|
5790
|
+
/**
|
|
5791
|
+
* Get MCP server configuration by ID
|
|
5792
|
+
*/
|
|
5793
|
+
async getConfigById(tenantId, id) {
|
|
5794
|
+
const key = this.getKey(tenantId, id);
|
|
5795
|
+
return this.configs.get(key) || null;
|
|
5796
|
+
}
|
|
5797
|
+
/**
|
|
5798
|
+
* Get MCP server configuration by business key
|
|
5799
|
+
*/
|
|
5800
|
+
async getConfigByKey(tenantId, key) {
|
|
5801
|
+
const configs = await this.getAllConfigs(tenantId);
|
|
5802
|
+
return configs.find((config) => config.key === key) || null;
|
|
5803
|
+
}
|
|
5804
|
+
/**
|
|
5805
|
+
* Create a new MCP server configuration
|
|
5806
|
+
*/
|
|
5807
|
+
async createConfig(tenantId, id, data) {
|
|
5808
|
+
const now = /* @__PURE__ */ new Date();
|
|
5809
|
+
const entry = {
|
|
5810
|
+
id,
|
|
5811
|
+
tenantId,
|
|
5812
|
+
key: data.key,
|
|
5813
|
+
config: data.config,
|
|
5814
|
+
selectedTools: data.selectedTools || [],
|
|
5815
|
+
isEnvEncrypted: false,
|
|
5816
|
+
status: "disconnected",
|
|
5817
|
+
name: data.name,
|
|
5818
|
+
description: data.description,
|
|
5819
|
+
createdAt: now,
|
|
5820
|
+
updatedAt: now
|
|
5821
|
+
};
|
|
5822
|
+
const storageKey = this.getKey(tenantId, id);
|
|
5823
|
+
this.configs.set(storageKey, entry);
|
|
5824
|
+
return entry;
|
|
5825
|
+
}
|
|
5826
|
+
/**
|
|
5827
|
+
* Update an existing MCP server configuration
|
|
5828
|
+
*/
|
|
5829
|
+
async updateConfig(tenantId, id, updates) {
|
|
5830
|
+
const key = this.getKey(tenantId, id);
|
|
5831
|
+
const existing = this.configs.get(key);
|
|
5832
|
+
if (!existing) {
|
|
5833
|
+
return null;
|
|
5834
|
+
}
|
|
5835
|
+
const updated = {
|
|
5836
|
+
...existing,
|
|
5837
|
+
...updates,
|
|
5838
|
+
config: updates.config ? { ...existing.config, ...updates.config } : existing.config,
|
|
5839
|
+
key: updates.key || existing.key,
|
|
5840
|
+
name: updates.name !== void 0 ? updates.name : existing.name,
|
|
5841
|
+
description: updates.description !== void 0 ? updates.description : existing.description,
|
|
5842
|
+
selectedTools: updates.selectedTools !== void 0 ? updates.selectedTools : existing.selectedTools,
|
|
5843
|
+
status: updates.status !== void 0 ? updates.status : existing.status,
|
|
5844
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
5845
|
+
};
|
|
5846
|
+
this.configs.set(key, updated);
|
|
5847
|
+
return updated;
|
|
5848
|
+
}
|
|
5849
|
+
/**
|
|
5850
|
+
* Delete a MCP server configuration by ID
|
|
5851
|
+
*/
|
|
5852
|
+
async deleteConfig(tenantId, id) {
|
|
5853
|
+
const key = this.getKey(tenantId, id);
|
|
5854
|
+
return this.configs.delete(key);
|
|
5855
|
+
}
|
|
5856
|
+
/**
|
|
5857
|
+
* Check if configuration exists
|
|
5858
|
+
*/
|
|
5859
|
+
async hasConfig(tenantId, id) {
|
|
5860
|
+
const key = this.getKey(tenantId, id);
|
|
5861
|
+
return this.configs.has(key);
|
|
5862
|
+
}
|
|
5863
|
+
/**
|
|
5864
|
+
* Clear all configurations (useful for testing)
|
|
5865
|
+
*/
|
|
5866
|
+
clear() {
|
|
5867
|
+
this.configs.clear();
|
|
5868
|
+
}
|
|
5869
|
+
/**
|
|
5870
|
+
* Clear configurations for a specific tenant
|
|
5871
|
+
*/
|
|
5872
|
+
clearByTenant(tenantId) {
|
|
5873
|
+
for (const key of this.configs.keys()) {
|
|
5874
|
+
if (key.startsWith(`${tenantId}:`)) {
|
|
5875
|
+
this.configs.delete(key);
|
|
5876
|
+
}
|
|
5877
|
+
}
|
|
5878
|
+
}
|
|
5879
|
+
};
|
|
5880
|
+
|
|
5759
5881
|
// src/store_lattice/InMemoryUserStore.ts
|
|
5760
5882
|
var InMemoryUserStore = class {
|
|
5761
5883
|
constructor() {
|
|
@@ -6061,6 +6183,7 @@ var defaultWorkspaceStore = new InMemoryWorkspaceStore();
|
|
|
6061
6183
|
var defaultProjectStore = new InMemoryProjectStore();
|
|
6062
6184
|
var defaultDatabaseConfigStore = new InMemoryDatabaseConfigStore();
|
|
6063
6185
|
var defaultMetricsServerConfigStore = new InMemoryMetricsServerConfigStore();
|
|
6186
|
+
var defaultMcpServerConfigStore = new InMemoryMcpServerConfigStore();
|
|
6064
6187
|
storeLatticeManager.registerLattice("default", "thread", defaultThreadStore);
|
|
6065
6188
|
storeLatticeManager.registerLattice(
|
|
6066
6189
|
"default",
|
|
@@ -6072,6 +6195,7 @@ storeLatticeManager.registerLattice("default", "workspace", defaultWorkspaceStor
|
|
|
6072
6195
|
storeLatticeManager.registerLattice("default", "project", defaultProjectStore);
|
|
6073
6196
|
storeLatticeManager.registerLattice("default", "database", defaultDatabaseConfigStore);
|
|
6074
6197
|
storeLatticeManager.registerLattice("default", "metrics", defaultMetricsServerConfigStore);
|
|
6198
|
+
storeLatticeManager.registerLattice("default", "mcp", defaultMcpServerConfigStore);
|
|
6075
6199
|
var defaultUserStore = new InMemoryUserStore();
|
|
6076
6200
|
var defaultTenantStore = new InMemoryTenantStore();
|
|
6077
6201
|
var defaultUserTenantLinkStore = new InMemoryUserTenantLinkStore();
|
|
@@ -6263,7 +6387,7 @@ ${skillsPrompt}
|
|
|
6263
6387
|
|
|
6264
6388
|
// src/deep_agent_new/middleware/fs.ts
|
|
6265
6389
|
import { createMiddleware as createMiddleware5, tool as tool42, ToolMessage } from "langchain";
|
|
6266
|
-
import { Command, isCommand, getCurrentTaskInput } from "@langchain/langgraph";
|
|
6390
|
+
import { Command, isCommand, getCurrentTaskInput, GraphInterrupt } from "@langchain/langgraph";
|
|
6267
6391
|
import { z as z310 } from "zod/v3";
|
|
6268
6392
|
import { withLangGraph } from "@langchain/langgraph/zod";
|
|
6269
6393
|
|
|
@@ -6980,7 +7104,7 @@ function createFilesystemMiddleware(options = {}) {
|
|
|
6980
7104
|
backend = async (stateAndStore) => new StateBackend(stateAndStore),
|
|
6981
7105
|
systemPrompt: customSystemPrompt = null,
|
|
6982
7106
|
customToolDescriptions = null,
|
|
6983
|
-
toolTokenLimitBeforeEvict =
|
|
7107
|
+
toolTokenLimitBeforeEvict = 1e5
|
|
6984
7108
|
} = options;
|
|
6985
7109
|
const systemPrompt = customSystemPrompt || FILESYSTEM_SYSTEM_PROMPT;
|
|
6986
7110
|
const tools = [
|
|
@@ -7015,7 +7139,24 @@ ${systemPrompt}` : systemPrompt;
|
|
|
7015
7139
|
return handler({ ...request, systemPrompt: newSystemPrompt });
|
|
7016
7140
|
} : void 0,
|
|
7017
7141
|
wrapToolCall: toolTokenLimitBeforeEvict ? (async (request, handler) => {
|
|
7018
|
-
|
|
7142
|
+
let result;
|
|
7143
|
+
try {
|
|
7144
|
+
result = await handler(request);
|
|
7145
|
+
} catch (error) {
|
|
7146
|
+
if (error instanceof GraphInterrupt) {
|
|
7147
|
+
throw error;
|
|
7148
|
+
}
|
|
7149
|
+
console.error(request.toolCall?.name, error);
|
|
7150
|
+
return new Command({
|
|
7151
|
+
update: {
|
|
7152
|
+
messages: [new ToolMessage({
|
|
7153
|
+
content: error instanceof Error ? error.message : "Unknown error",
|
|
7154
|
+
tool_call_id: request.toolCall?.id,
|
|
7155
|
+
name: request.toolCall?.name
|
|
7156
|
+
})]
|
|
7157
|
+
}
|
|
7158
|
+
});
|
|
7159
|
+
}
|
|
7019
7160
|
async function processToolMessage(msg) {
|
|
7020
7161
|
if (typeof msg.content === "string" && msg.content.length > toolTokenLimitBeforeEvict * 4) {
|
|
7021
7162
|
const stateAndStore = {
|
|
@@ -7129,6 +7270,122 @@ function createMetricsMiddleware(params) {
|
|
|
7129
7270
|
});
|
|
7130
7271
|
}
|
|
7131
7272
|
|
|
7273
|
+
// src/middlewares/askUserClarifyMiddleware.ts
|
|
7274
|
+
import { createMiddleware as createMiddleware7, ToolMessage as ToolMessage2 } from "langchain";
|
|
7275
|
+
import { GraphInterrupt as GraphInterrupt2, interrupt as interrupt2 } from "@langchain/langgraph";
|
|
7276
|
+
|
|
7277
|
+
// src/tool_lattice/ask_user_to_clarify/index.ts
|
|
7278
|
+
import { tool as tool43 } from "langchain";
|
|
7279
|
+
import z43 from "zod";
|
|
7280
|
+
var questionSchema = z43.object({
|
|
7281
|
+
question: z43.string().describe("The question text to ask the user"),
|
|
7282
|
+
options: z43.array(z43.string()).describe("List of EXACT, selectable values. Maximum 3 options allowed. DO NOT include any 'placeholder' options that require the user to type (e.g., do NOT add 'Enter manual value'). If manual input is needed, set allowOther to true instead."),
|
|
7283
|
+
type: z43.enum(["single", "multiple"]).describe("Whether the question allows single or multiple selections"),
|
|
7284
|
+
required: z43.boolean().optional().default(false).describe("Whether this question must be answered"),
|
|
7285
|
+
allowOther: z43.boolean().optional().default(true).describe("Set to true to append an 'Other' option that opens a free-text input field. Use this for open-ended answers or when the 3 options cannot cover all possibilities.")
|
|
7286
|
+
});
|
|
7287
|
+
var inputSchema = z43.object({
|
|
7288
|
+
questions: z43.array(questionSchema).min(1, "At least one question is required").describe("A structured sequence of clarification questions. Use these to gather missing parameters or disambiguate user intent before proceeding.")
|
|
7289
|
+
});
|
|
7290
|
+
function createAskUserToClarifyTool() {
|
|
7291
|
+
return tool43(
|
|
7292
|
+
async (input) => {
|
|
7293
|
+
return JSON.stringify(input);
|
|
7294
|
+
},
|
|
7295
|
+
{
|
|
7296
|
+
name: "ask_user_to_clarify",
|
|
7297
|
+
description: "Prompts the user to choose from a list of predefined values OR provide custom input. USE CASES: 1. Use 'options' ONLY for distinct, mutually exclusive choices (e.g., ['Standard', 'Express']). 2. Set 'allowOther: true' ONLY when you need to capture free-text information that doesn't fit into the predefined options. IMPORTANT: Never put placeholders like 'Please specify' or 'Other' inside the 'options' list. ",
|
|
7298
|
+
schema: inputSchema
|
|
7299
|
+
}
|
|
7300
|
+
);
|
|
7301
|
+
}
|
|
7302
|
+
|
|
7303
|
+
// src/middlewares/askUserClarifyMiddleware.ts
|
|
7304
|
+
function createAskUserClarifyMiddleware() {
|
|
7305
|
+
return createMiddleware7({
|
|
7306
|
+
name: "AskUserClarifyMiddleware",
|
|
7307
|
+
tools: [createAskUserToClarifyTool()],
|
|
7308
|
+
wrapToolCall: async (request, handler) => {
|
|
7309
|
+
const toolCall = request.toolCall;
|
|
7310
|
+
const toolName = toolCall?.name;
|
|
7311
|
+
if (toolName !== "ask_user_to_clarify") {
|
|
7312
|
+
try {
|
|
7313
|
+
return await handler(request);
|
|
7314
|
+
} catch (error) {
|
|
7315
|
+
if (error instanceof GraphInterrupt2) {
|
|
7316
|
+
throw error;
|
|
7317
|
+
}
|
|
7318
|
+
console.error(`Error executing tool "${toolName}":`, error);
|
|
7319
|
+
return new ToolMessage2({
|
|
7320
|
+
content: `Error executing tool: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
7321
|
+
tool_call_id: toolCall?.id,
|
|
7322
|
+
name: toolName
|
|
7323
|
+
});
|
|
7324
|
+
}
|
|
7325
|
+
}
|
|
7326
|
+
const input = toolCall?.args;
|
|
7327
|
+
if (!input?.questions || input.questions.length === 0) {
|
|
7328
|
+
return new ToolMessage2({
|
|
7329
|
+
content: "No questions provided.",
|
|
7330
|
+
tool_call_id: toolCall?.id,
|
|
7331
|
+
name: toolName
|
|
7332
|
+
});
|
|
7333
|
+
}
|
|
7334
|
+
const uiData = {
|
|
7335
|
+
questions: input.questions.map((q) => ({
|
|
7336
|
+
question: q.question,
|
|
7337
|
+
options: q.options,
|
|
7338
|
+
type: q.type,
|
|
7339
|
+
required: q.required,
|
|
7340
|
+
allowOther: q.allowOther
|
|
7341
|
+
}))
|
|
7342
|
+
};
|
|
7343
|
+
const md = genUIMarkdown("clarify", uiData);
|
|
7344
|
+
const result = await interrupt2(md);
|
|
7345
|
+
const response = result.data;
|
|
7346
|
+
if (!response?.answers || response.answers.length === 0) {
|
|
7347
|
+
return new ToolMessage2({
|
|
7348
|
+
content: "No clarification questions were answered.",
|
|
7349
|
+
tool_call_id: toolCall?.id,
|
|
7350
|
+
name: toolName
|
|
7351
|
+
});
|
|
7352
|
+
}
|
|
7353
|
+
const answeredQuestions = response.answers.filter(
|
|
7354
|
+
(answer) => answer.selectedOptions.length > 0 || answer.otherText && answer.otherText.trim() !== ""
|
|
7355
|
+
);
|
|
7356
|
+
if (answeredQuestions.length === 0) {
|
|
7357
|
+
return new ToolMessage2({
|
|
7358
|
+
content: "No clarification questions were answered.",
|
|
7359
|
+
tool_call_id: toolCall?.id,
|
|
7360
|
+
name: toolName
|
|
7361
|
+
});
|
|
7362
|
+
}
|
|
7363
|
+
const lines = ["## Clarification Questions Answered", ""];
|
|
7364
|
+
for (const answer of answeredQuestions) {
|
|
7365
|
+
const question = input.questions[answer.questionIndex];
|
|
7366
|
+
if (!question) continue;
|
|
7367
|
+
lines.push(`**Q${answer.questionIndex + 1}: ${question.question}**`);
|
|
7368
|
+
const parts = [];
|
|
7369
|
+
if (answer.selectedOptions.length > 0) {
|
|
7370
|
+
parts.push(...answer.selectedOptions);
|
|
7371
|
+
}
|
|
7372
|
+
if (answer.otherText && answer.otherText.trim() !== "") {
|
|
7373
|
+
parts.push(`Other: ${answer.otherText.trim()}`);
|
|
7374
|
+
}
|
|
7375
|
+
if (parts.length > 0) {
|
|
7376
|
+
lines.push(`A: ${parts.join(", ")}`);
|
|
7377
|
+
}
|
|
7378
|
+
lines.push("");
|
|
7379
|
+
}
|
|
7380
|
+
return new ToolMessage2({
|
|
7381
|
+
content: lines.join("\n"),
|
|
7382
|
+
tool_call_id: toolCall?.id,
|
|
7383
|
+
name: toolName
|
|
7384
|
+
});
|
|
7385
|
+
}
|
|
7386
|
+
});
|
|
7387
|
+
}
|
|
7388
|
+
|
|
7132
7389
|
// src/agent_lattice/builders/commonMiddleware.ts
|
|
7133
7390
|
function createCommonMiddlewares(middlewareConfigs, filesystemBackend) {
|
|
7134
7391
|
const middlewares = [];
|
|
@@ -7175,6 +7432,9 @@ function createCommonMiddlewares(middlewareConfigs, filesystemBackend) {
|
|
|
7175
7432
|
}
|
|
7176
7433
|
}
|
|
7177
7434
|
break;
|
|
7435
|
+
case "ask_user_to_clarify":
|
|
7436
|
+
middlewares.push(createAskUserClarifyMiddleware());
|
|
7437
|
+
break;
|
|
7178
7438
|
}
|
|
7179
7439
|
}
|
|
7180
7440
|
return middlewares;
|
|
@@ -7218,9 +7478,9 @@ var ReActAgentGraphBuilder = class {
|
|
|
7218
7478
|
*/
|
|
7219
7479
|
build(agentLattice, params) {
|
|
7220
7480
|
const tools = params.tools.map((t) => {
|
|
7221
|
-
const
|
|
7222
|
-
return
|
|
7223
|
-
}).filter((
|
|
7481
|
+
const tool48 = getToolClient(t.key);
|
|
7482
|
+
return tool48;
|
|
7483
|
+
}).filter((tool48) => tool48 !== void 0);
|
|
7224
7484
|
const stateSchema2 = createReactAgentSchema(params.stateSchema);
|
|
7225
7485
|
const middlewareConfigs = params.middleware || [];
|
|
7226
7486
|
const filesystemBackend = this.createFilesystemBackendFactory(middlewareConfigs);
|
|
@@ -7246,12 +7506,12 @@ import {
|
|
|
7246
7506
|
} from "langchain";
|
|
7247
7507
|
|
|
7248
7508
|
// src/deep_agent_new/middleware/subagents.ts
|
|
7249
|
-
import { z as
|
|
7509
|
+
import { z as z44 } from "zod/v3";
|
|
7250
7510
|
import {
|
|
7251
|
-
createMiddleware as
|
|
7511
|
+
createMiddleware as createMiddleware8,
|
|
7252
7512
|
createAgent as createAgent2,
|
|
7253
|
-
tool as
|
|
7254
|
-
ToolMessage as
|
|
7513
|
+
tool as tool44,
|
|
7514
|
+
ToolMessage as ToolMessage3,
|
|
7255
7515
|
humanInTheLoopMiddleware
|
|
7256
7516
|
} from "langchain";
|
|
7257
7517
|
import { Command as Command2, getCurrentTaskInput as getCurrentTaskInput2 } from "@langchain/langgraph";
|
|
@@ -7261,7 +7521,7 @@ import { HumanMessage } from "@langchain/core/messages";
|
|
|
7261
7521
|
import {
|
|
7262
7522
|
StateGraph,
|
|
7263
7523
|
END as END2,
|
|
7264
|
-
interrupt as
|
|
7524
|
+
interrupt as interrupt3,
|
|
7265
7525
|
Annotation
|
|
7266
7526
|
} from "@langchain/langgraph";
|
|
7267
7527
|
|
|
@@ -7618,7 +7878,7 @@ async function interruptNode(state) {
|
|
|
7618
7878
|
"Interrupt node called but no interrupt value found in result"
|
|
7619
7879
|
);
|
|
7620
7880
|
}
|
|
7621
|
-
const response = await
|
|
7881
|
+
const response = await interrupt3(interruptValue);
|
|
7622
7882
|
return {
|
|
7623
7883
|
command2: {
|
|
7624
7884
|
resume: response
|
|
@@ -7821,7 +8081,7 @@ function returnCommandWithStateUpdate(result, toolCallId) {
|
|
|
7821
8081
|
update: {
|
|
7822
8082
|
...stateUpdate,
|
|
7823
8083
|
messages: [
|
|
7824
|
-
new
|
|
8084
|
+
new ToolMessage3({
|
|
7825
8085
|
content: lastMessage?.content || "Task Failed to complete",
|
|
7826
8086
|
tool_call_id: toolCallId,
|
|
7827
8087
|
name: "task"
|
|
@@ -7900,7 +8160,7 @@ function createTaskTool(options) {
|
|
|
7900
8160
|
generalPurposeAgent
|
|
7901
8161
|
});
|
|
7902
8162
|
const finalTaskDescription = taskDescription ? taskDescription : getTaskToolDescription(subagentDescriptions);
|
|
7903
|
-
return
|
|
8163
|
+
return tool44(
|
|
7904
8164
|
async (input, config) => {
|
|
7905
8165
|
const { description, subagent_type } = input;
|
|
7906
8166
|
try {
|
|
@@ -7935,7 +8195,7 @@ function createTaskTool(options) {
|
|
|
7935
8195
|
return new Command2({
|
|
7936
8196
|
update: {
|
|
7937
8197
|
messages: [
|
|
7938
|
-
new
|
|
8198
|
+
new ToolMessage3({
|
|
7939
8199
|
content: error instanceof Error ? error.message : "Task Failed to complete",
|
|
7940
8200
|
tool_call_id: config.toolCall.id,
|
|
7941
8201
|
name: "task"
|
|
@@ -7948,9 +8208,9 @@ function createTaskTool(options) {
|
|
|
7948
8208
|
{
|
|
7949
8209
|
name: "task",
|
|
7950
8210
|
description: finalTaskDescription,
|
|
7951
|
-
schema:
|
|
7952
|
-
description:
|
|
7953
|
-
subagent_type:
|
|
8211
|
+
schema: z44.object({
|
|
8212
|
+
description: z44.string().describe("The task to execute with the selected agent"),
|
|
8213
|
+
subagent_type: z44.string().describe(
|
|
7954
8214
|
`Name of the agent to use. Available: ${Object.keys(
|
|
7955
8215
|
subagentGraphs
|
|
7956
8216
|
).join(", ")}`
|
|
@@ -7979,7 +8239,7 @@ function createSubAgentMiddleware(options) {
|
|
|
7979
8239
|
generalPurposeAgent,
|
|
7980
8240
|
taskDescription
|
|
7981
8241
|
});
|
|
7982
|
-
return
|
|
8242
|
+
return createMiddleware8({
|
|
7983
8243
|
name: "subAgentMiddleware",
|
|
7984
8244
|
tools: [taskTool],
|
|
7985
8245
|
wrapModelCall: async (request, handler) => {
|
|
@@ -8000,14 +8260,14 @@ ${systemPrompt}` : systemPrompt;
|
|
|
8000
8260
|
|
|
8001
8261
|
// src/deep_agent_new/middleware/patch_tool_calls.ts
|
|
8002
8262
|
import {
|
|
8003
|
-
createMiddleware as
|
|
8004
|
-
ToolMessage as
|
|
8263
|
+
createMiddleware as createMiddleware9,
|
|
8264
|
+
ToolMessage as ToolMessage4,
|
|
8005
8265
|
AIMessage as AIMessage2
|
|
8006
8266
|
} from "langchain";
|
|
8007
8267
|
import { RemoveMessage } from "@langchain/core/messages";
|
|
8008
8268
|
import { REMOVE_ALL_MESSAGES } from "@langchain/langgraph";
|
|
8009
8269
|
function createPatchToolCallsMiddleware() {
|
|
8010
|
-
return
|
|
8270
|
+
return createMiddleware9({
|
|
8011
8271
|
name: "patchToolCallsMiddleware",
|
|
8012
8272
|
beforeAgent: async (state) => {
|
|
8013
8273
|
const messages = state.messages;
|
|
@@ -8021,12 +8281,12 @@ function createPatchToolCallsMiddleware() {
|
|
|
8021
8281
|
if (AIMessage2.isInstance(msg) && msg.tool_calls != null) {
|
|
8022
8282
|
for (const toolCall of msg.tool_calls) {
|
|
8023
8283
|
const correspondingToolMsg = messages.slice(i).find(
|
|
8024
|
-
(m) =>
|
|
8284
|
+
(m) => ToolMessage4.isInstance(m) && m.tool_call_id === toolCall.id
|
|
8025
8285
|
);
|
|
8026
8286
|
if (!correspondingToolMsg) {
|
|
8027
8287
|
const toolMsg = `Tool call ${toolCall.name} with id ${toolCall.id} was cancelled - another message came in before it could be completed.`;
|
|
8028
8288
|
patchedMessages.push(
|
|
8029
|
-
new
|
|
8289
|
+
new ToolMessage4({
|
|
8030
8290
|
content: toolMsg,
|
|
8031
8291
|
name: toolCall.name,
|
|
8032
8292
|
tool_call_id: toolCall.id
|
|
@@ -9139,8 +9399,8 @@ var MemoryBackend = class {
|
|
|
9139
9399
|
|
|
9140
9400
|
// src/deep_agent_new/middleware/todos.ts
|
|
9141
9401
|
import { Command as Command3 } from "@langchain/langgraph";
|
|
9142
|
-
import { z as
|
|
9143
|
-
import { createMiddleware as
|
|
9402
|
+
import { z as z45 } from "zod";
|
|
9403
|
+
import { createMiddleware as createMiddleware10, tool as tool45, ToolMessage as ToolMessage5 } from "langchain";
|
|
9144
9404
|
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.
|
|
9145
9405
|
It also helps the user understand the progress of the task and overall progress of their requests.
|
|
9146
9406
|
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.
|
|
@@ -9367,20 +9627,20 @@ Writing todos takes time and tokens, use it when it is helpful for managing comp
|
|
|
9367
9627
|
## Important To-Do List Usage Notes to Remember
|
|
9368
9628
|
- The \`write_todos\` tool should never be called multiple times in parallel.
|
|
9369
9629
|
- 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.`;
|
|
9370
|
-
var TodoStatus =
|
|
9371
|
-
var TodoSchema =
|
|
9372
|
-
content:
|
|
9630
|
+
var TodoStatus = z45.enum(["pending", "in_progress", "completed"]).describe("Status of the todo");
|
|
9631
|
+
var TodoSchema = z45.object({
|
|
9632
|
+
content: z45.string().describe("Content of the todo item"),
|
|
9373
9633
|
status: TodoStatus
|
|
9374
9634
|
});
|
|
9375
|
-
var stateSchema =
|
|
9635
|
+
var stateSchema = z45.object({ todos: z45.array(TodoSchema).default([]) });
|
|
9376
9636
|
function todoListMiddleware(options) {
|
|
9377
|
-
const writeTodos =
|
|
9637
|
+
const writeTodos = tool45(
|
|
9378
9638
|
({ todos }, config) => {
|
|
9379
9639
|
return new Command3({
|
|
9380
9640
|
update: {
|
|
9381
9641
|
todos,
|
|
9382
9642
|
messages: [
|
|
9383
|
-
new
|
|
9643
|
+
new ToolMessage5({
|
|
9384
9644
|
content: genUIMarkdown("todo_list", todos),
|
|
9385
9645
|
tool_call_id: config.toolCall?.id
|
|
9386
9646
|
})
|
|
@@ -9391,12 +9651,12 @@ function todoListMiddleware(options) {
|
|
|
9391
9651
|
{
|
|
9392
9652
|
name: "write_todos",
|
|
9393
9653
|
description: options?.toolDescription ?? WRITE_TODOS_DESCRIPTION,
|
|
9394
|
-
schema:
|
|
9395
|
-
todos:
|
|
9654
|
+
schema: z45.object({
|
|
9655
|
+
todos: z45.array(TodoSchema).describe("List of todo items to update")
|
|
9396
9656
|
})
|
|
9397
9657
|
}
|
|
9398
9658
|
);
|
|
9399
|
-
return
|
|
9659
|
+
return createMiddleware10({
|
|
9400
9660
|
name: "todoListMiddleware",
|
|
9401
9661
|
stateSchema,
|
|
9402
9662
|
tools: [writeTodos],
|
|
@@ -9539,7 +9799,7 @@ var DeepAgentGraphBuilder = class {
|
|
|
9539
9799
|
const tools = params.tools.map((t) => {
|
|
9540
9800
|
const toolClient = getToolClient(t.key);
|
|
9541
9801
|
return toolClient;
|
|
9542
|
-
}).filter((
|
|
9802
|
+
}).filter((tool48) => tool48 !== void 0);
|
|
9543
9803
|
const subagents = params.subAgents.map((sa) => {
|
|
9544
9804
|
if (sa.client) {
|
|
9545
9805
|
return {
|
|
@@ -9579,7 +9839,7 @@ var DeepAgentGraphBuilder = class {
|
|
|
9579
9839
|
};
|
|
9580
9840
|
|
|
9581
9841
|
// src/agent_team/agent_team.ts
|
|
9582
|
-
import { z as
|
|
9842
|
+
import { z as z48 } from "zod/v3";
|
|
9583
9843
|
import { createAgent as createAgent5 } from "langchain";
|
|
9584
9844
|
|
|
9585
9845
|
// src/agent_team/types.ts
|
|
@@ -10015,14 +10275,14 @@ var InMemoryMailboxStore = class {
|
|
|
10015
10275
|
};
|
|
10016
10276
|
|
|
10017
10277
|
// src/agent_team/middleware/team.ts
|
|
10018
|
-
import { z as
|
|
10019
|
-
import { createMiddleware as
|
|
10278
|
+
import { z as z47 } from "zod/v3";
|
|
10279
|
+
import { createMiddleware as createMiddleware11, createAgent as createAgent4, tool as tool47, ToolMessage as ToolMessage7 } from "langchain";
|
|
10020
10280
|
import { Command as Command5, getCurrentTaskInput as getCurrentTaskInput3 } from "@langchain/langgraph";
|
|
10021
10281
|
import { v4 as uuidv4 } from "uuid";
|
|
10022
10282
|
|
|
10023
10283
|
// src/agent_team/middleware/teammate_tools.ts
|
|
10024
|
-
import { z as
|
|
10025
|
-
import { tool as
|
|
10284
|
+
import { z as z46 } from "zod/v3";
|
|
10285
|
+
import { tool as tool46, ToolMessage as ToolMessage6 } from "langchain";
|
|
10026
10286
|
import { Command as Command4 } from "@langchain/langgraph";
|
|
10027
10287
|
|
|
10028
10288
|
// src/agent_team/middleware/formatMessages.ts
|
|
@@ -10047,7 +10307,7 @@ ${meta}${body}`;
|
|
|
10047
10307
|
// src/agent_team/middleware/teammate_tools.ts
|
|
10048
10308
|
function createTeammateTools(options) {
|
|
10049
10309
|
const { teamId, agentId, taskListStore, mailboxStore } = options;
|
|
10050
|
-
const claimTaskTool =
|
|
10310
|
+
const claimTaskTool = tool46(
|
|
10051
10311
|
async (input) => {
|
|
10052
10312
|
const task = await taskListStore.claimTaskById(
|
|
10053
10313
|
teamId,
|
|
@@ -10072,12 +10332,12 @@ function createTeammateTools(options) {
|
|
|
10072
10332
|
{
|
|
10073
10333
|
name: "claim_task",
|
|
10074
10334
|
description: "Pick a task to work on by task_id. Use check_tasks first to see all tasks; then call this with the task_id you choose. The task's assignee is set to you and you should focus on that task until you complete_task or fail_task it.",
|
|
10075
|
-
schema:
|
|
10076
|
-
task_id:
|
|
10335
|
+
schema: z46.object({
|
|
10336
|
+
task_id: z46.string().describe("ID of the task to claim (e.g. task-01). Use check_tasks to see IDs.")
|
|
10077
10337
|
})
|
|
10078
10338
|
}
|
|
10079
10339
|
);
|
|
10080
|
-
const completeTaskTool =
|
|
10340
|
+
const completeTaskTool = tool46(
|
|
10081
10341
|
async (input) => {
|
|
10082
10342
|
const task = await taskListStore.completeTask(
|
|
10083
10343
|
teamId,
|
|
@@ -10098,13 +10358,13 @@ function createTeammateTools(options) {
|
|
|
10098
10358
|
{
|
|
10099
10359
|
name: "complete_task",
|
|
10100
10360
|
description: "Mark a claimed task as completed with a result summary. Call this after you have finished working on a task.",
|
|
10101
|
-
schema:
|
|
10102
|
-
task_id:
|
|
10103
|
-
result:
|
|
10361
|
+
schema: z46.object({
|
|
10362
|
+
task_id: z46.string().describe("ID of the task to complete"),
|
|
10363
|
+
result: z46.string().describe("Summary of the task result")
|
|
10104
10364
|
})
|
|
10105
10365
|
}
|
|
10106
10366
|
);
|
|
10107
|
-
const failTaskTool =
|
|
10367
|
+
const failTaskTool = tool46(
|
|
10108
10368
|
async (input) => {
|
|
10109
10369
|
const task = await taskListStore.failTask(
|
|
10110
10370
|
teamId,
|
|
@@ -10125,13 +10385,13 @@ function createTeammateTools(options) {
|
|
|
10125
10385
|
{
|
|
10126
10386
|
name: "fail_task",
|
|
10127
10387
|
description: "Mark a claimed task as failed with an error description. Call this if you cannot complete the task.",
|
|
10128
|
-
schema:
|
|
10129
|
-
task_id:
|
|
10130
|
-
error:
|
|
10388
|
+
schema: z46.object({
|
|
10389
|
+
task_id: z46.string().describe("ID of the task to fail"),
|
|
10390
|
+
error: z46.string().describe("Description of why the task failed")
|
|
10131
10391
|
})
|
|
10132
10392
|
}
|
|
10133
10393
|
);
|
|
10134
|
-
const sendMessageTool =
|
|
10394
|
+
const sendMessageTool = tool46(
|
|
10135
10395
|
async (input) => {
|
|
10136
10396
|
await mailboxStore.sendMessage(
|
|
10137
10397
|
teamId,
|
|
@@ -10145,11 +10405,11 @@ function createTeammateTools(options) {
|
|
|
10145
10405
|
{
|
|
10146
10406
|
name: "send_message",
|
|
10147
10407
|
description: 'Send a message to the team lead or another teammate via the mailbox. Use "team_lead" to message the team lead. Use this to report discoveries, request guidance, or suggest new tasks.',
|
|
10148
|
-
schema:
|
|
10149
|
-
to:
|
|
10408
|
+
schema: z46.object({
|
|
10409
|
+
to: z46.string().describe(
|
|
10150
10410
|
'Recipient agent name (e.g. "team_lead" or a teammate name)'
|
|
10151
10411
|
),
|
|
10152
|
-
content:
|
|
10412
|
+
content: z46.string().describe("Message content")
|
|
10153
10413
|
})
|
|
10154
10414
|
}
|
|
10155
10415
|
);
|
|
@@ -10169,7 +10429,7 @@ function createTeammateTools(options) {
|
|
|
10169
10429
|
read: msg.read
|
|
10170
10430
|
}));
|
|
10171
10431
|
};
|
|
10172
|
-
const readMessagesTool =
|
|
10432
|
+
const readMessagesTool = tool46(
|
|
10173
10433
|
async (input, config) => {
|
|
10174
10434
|
const formatAndMarkAsRead = async (msgs2) => {
|
|
10175
10435
|
for (const msg of msgs2) {
|
|
@@ -10181,7 +10441,7 @@ function createTeammateTools(options) {
|
|
|
10181
10441
|
if (msgs.length > 0) {
|
|
10182
10442
|
const formatted2 = await formatAndMarkAsRead(msgs);
|
|
10183
10443
|
const relevantMsgs2 = await getRelevantMessagesForState();
|
|
10184
|
-
const toolMessage2 = new
|
|
10444
|
+
const toolMessage2 = new ToolMessage6({
|
|
10185
10445
|
content: formatted2,
|
|
10186
10446
|
tool_call_id: config.toolCall?.id,
|
|
10187
10447
|
name: "read_messages"
|
|
@@ -10206,7 +10466,7 @@ function createTeammateTools(options) {
|
|
|
10206
10466
|
});
|
|
10207
10467
|
const relevantMsgs = await getRelevantMessagesForState();
|
|
10208
10468
|
if (msgs.length === 0) {
|
|
10209
|
-
const toolMessage2 = new
|
|
10469
|
+
const toolMessage2 = new ToolMessage6({
|
|
10210
10470
|
content: "No unread messages.",
|
|
10211
10471
|
tool_call_id: config.toolCall?.id,
|
|
10212
10472
|
name: "read_messages"
|
|
@@ -10216,7 +10476,7 @@ function createTeammateTools(options) {
|
|
|
10216
10476
|
});
|
|
10217
10477
|
}
|
|
10218
10478
|
const formatted = await formatAndMarkAsRead(msgs);
|
|
10219
|
-
const toolMessage = new
|
|
10479
|
+
const toolMessage = new ToolMessage6({
|
|
10220
10480
|
content: formatted,
|
|
10221
10481
|
tool_call_id: config.toolCall?.id,
|
|
10222
10482
|
name: "read_messages"
|
|
@@ -10228,10 +10488,10 @@ function createTeammateTools(options) {
|
|
|
10228
10488
|
{
|
|
10229
10489
|
name: "read_messages",
|
|
10230
10490
|
description: "Read unread messages from the mailbox. Returns immediately if messages exist, otherwise waits for up to 3 minutes for new messages.",
|
|
10231
|
-
schema:
|
|
10491
|
+
schema: z46.object({})
|
|
10232
10492
|
}
|
|
10233
10493
|
);
|
|
10234
|
-
const checkTasksTool =
|
|
10494
|
+
const checkTasksTool = tool46(
|
|
10235
10495
|
async () => {
|
|
10236
10496
|
const tasks = await taskListStore.getAllTasks(teamId);
|
|
10237
10497
|
return formatTaskSummary(tasks);
|
|
@@ -10239,10 +10499,10 @@ function createTeammateTools(options) {
|
|
|
10239
10499
|
{
|
|
10240
10500
|
name: "check_tasks",
|
|
10241
10501
|
description: "Use this tool to get the current status of all tasks in a team. This is your primary way to monitor task progress.",
|
|
10242
|
-
schema:
|
|
10502
|
+
schema: z46.object({})
|
|
10243
10503
|
}
|
|
10244
10504
|
);
|
|
10245
|
-
const broadcastMessageTool =
|
|
10505
|
+
const broadcastMessageTool = tool46(
|
|
10246
10506
|
async (input) => {
|
|
10247
10507
|
const allAgents = await mailboxStore.getRegisteredAgents(teamId);
|
|
10248
10508
|
const recipients = allAgents.filter((a) => a !== agentId);
|
|
@@ -10261,8 +10521,8 @@ function createTeammateTools(options) {
|
|
|
10261
10521
|
{
|
|
10262
10522
|
name: "broadcast_message",
|
|
10263
10523
|
description: "Send a message to everyone in the team except yourself. Use this to share updates or information with all teammates and the team lead at once.",
|
|
10264
|
-
schema:
|
|
10265
|
-
content:
|
|
10524
|
+
schema: z46.object({
|
|
10525
|
+
content: z46.string().describe("Message content to broadcast to others")
|
|
10266
10526
|
})
|
|
10267
10527
|
}
|
|
10268
10528
|
);
|
|
@@ -10485,12 +10745,12 @@ async function spawnTeammate(options) {
|
|
|
10485
10745
|
function createTeamMiddleware(options) {
|
|
10486
10746
|
const { teamConfig, taskListStore, mailboxStore } = options;
|
|
10487
10747
|
const defaultModel = teamConfig.model ?? "claude-sonnet-4-5-20250929";
|
|
10488
|
-
const createTeamTool =
|
|
10748
|
+
const createTeamTool = tool47(
|
|
10489
10749
|
async (input, config) => {
|
|
10490
10750
|
const state = getCurrentTaskInput3();
|
|
10491
10751
|
if (state?.team?.teamId) {
|
|
10492
10752
|
const existingId = state.team.teamId;
|
|
10493
|
-
const msg = new
|
|
10753
|
+
const msg = new ToolMessage7({
|
|
10494
10754
|
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.`,
|
|
10495
10755
|
tool_call_id: config.toolCall?.id,
|
|
10496
10756
|
name: "create_team"
|
|
@@ -10575,7 +10835,7 @@ Teammates are now working in the background. Keep calling \`check_tasks\` and \`
|
|
|
10575
10835
|
\`\`\`json
|
|
10576
10836
|
${teamJson}
|
|
10577
10837
|
\`\`\``;
|
|
10578
|
-
const toolMessage = new
|
|
10838
|
+
const toolMessage = new ToolMessage7({
|
|
10579
10839
|
content: summary,
|
|
10580
10840
|
tool_call_id: config.toolCall?.id,
|
|
10581
10841
|
name: "create_team"
|
|
@@ -10636,20 +10896,20 @@ After calling create_team, you MUST:
|
|
|
10636
10896
|
2. When messages indicate task changes, call check_tasks to get full task status
|
|
10637
10897
|
3. Continue until all tasks show "completed" or "failed"
|
|
10638
10898
|
4. Do NOT assume tasks are done - always verify with check_tasks`,
|
|
10639
|
-
schema:
|
|
10640
|
-
tasks:
|
|
10641
|
-
|
|
10642
|
-
id:
|
|
10643
|
-
title:
|
|
10644
|
-
description:
|
|
10645
|
-
dependencies:
|
|
10899
|
+
schema: z47.object({
|
|
10900
|
+
tasks: z47.array(
|
|
10901
|
+
z47.object({
|
|
10902
|
+
id: z47.string().describe("Task ID in format task-01, task-02, etc."),
|
|
10903
|
+
title: z47.string().describe("Short task title"),
|
|
10904
|
+
description: z47.string().describe("Detailed task description - what exactly needs to be done"),
|
|
10905
|
+
dependencies: z47.array(z47.string()).optional().default([]).describe('Array of task IDs that must complete before this task (e.g. ["task-01"])')
|
|
10646
10906
|
})
|
|
10647
10907
|
).describe("List of tasks for teammates to work on. Each task needs unique ID (task-01, task-02, etc.)."),
|
|
10648
|
-
teammates:
|
|
10649
|
-
|
|
10650
|
-
name:
|
|
10651
|
-
role:
|
|
10652
|
-
description:
|
|
10908
|
+
teammates: z47.array(
|
|
10909
|
+
z47.object({
|
|
10910
|
+
name: z47.string().describe("Teammate name (must match a pre-configured teammate type)"),
|
|
10911
|
+
role: z47.string().describe("Role category (e.g. researcher, writer, coder, reviewer)"),
|
|
10912
|
+
description: z47.string().describe("What this teammate will focus on - specific instructions for their work")
|
|
10653
10913
|
})
|
|
10654
10914
|
).describe("Teammate agents to create. Each should have a clear role and focus.")
|
|
10655
10915
|
})
|
|
@@ -10660,7 +10920,7 @@ After calling create_team, you MUST:
|
|
|
10660
10920
|
if (state?.team?.teamId) return state.team.teamId;
|
|
10661
10921
|
throw new Error("No team_id provided and no team in state. Call create_team first.");
|
|
10662
10922
|
};
|
|
10663
|
-
const addTasksTool =
|
|
10923
|
+
const addTasksTool = tool47(
|
|
10664
10924
|
async (input, config) => {
|
|
10665
10925
|
const teamId = resolveTeamId();
|
|
10666
10926
|
const created = await taskListStore.addTasks(
|
|
@@ -10674,7 +10934,7 @@ After calling create_team, you MUST:
|
|
|
10674
10934
|
}))
|
|
10675
10935
|
);
|
|
10676
10936
|
const summary = created.map((t) => `- ${t.id}: "${t.title}"`).join("\n");
|
|
10677
|
-
return new
|
|
10937
|
+
return new ToolMessage7({
|
|
10678
10938
|
content: `Added ${created.length} task(s) to team ${teamId}:
|
|
10679
10939
|
${summary}
|
|
10680
10940
|
Sleeping teammates will wake up and claim these.`,
|
|
@@ -10712,33 +10972,33 @@ IMPORTANT: Dependencies
|
|
|
10712
10972
|
|
|
10713
10973
|
IMPORTANT: Assigning to a specific teammate
|
|
10714
10974
|
- When you need a particular teammate to do the work, set assignee to that teammate's name (e.g. assignee: "researcher"). They can then claim or see the task as assigned to them.`,
|
|
10715
|
-
schema:
|
|
10716
|
-
tasks:
|
|
10717
|
-
|
|
10718
|
-
id:
|
|
10719
|
-
title:
|
|
10720
|
-
description:
|
|
10721
|
-
assignee:
|
|
10722
|
-
dependencies:
|
|
10975
|
+
schema: z47.object({
|
|
10976
|
+
tasks: z47.array(
|
|
10977
|
+
z47.object({
|
|
10978
|
+
id: z47.string().describe("Task ID in format task-01, task-02, etc. Must be unique."),
|
|
10979
|
+
title: z47.string().describe("Short task title"),
|
|
10980
|
+
description: z47.string().describe("Detailed task description - what needs to be done"),
|
|
10981
|
+
assignee: z47.string().optional().describe("Teammate name to assign this task to (use when you need that person to do the work)"),
|
|
10982
|
+
dependencies: z47.array(z47.string()).optional().default([]).describe("Array of task IDs that must complete before this task")
|
|
10723
10983
|
})
|
|
10724
10984
|
).describe("New tasks to add to the team")
|
|
10725
10985
|
})
|
|
10726
10986
|
}
|
|
10727
10987
|
);
|
|
10728
|
-
const assignTaskTool =
|
|
10988
|
+
const assignTaskTool = tool47(
|
|
10729
10989
|
async (input, config) => {
|
|
10730
10990
|
const teamId = resolveTeamId();
|
|
10731
10991
|
const task = await taskListStore.updateTask(teamId, input.task_id, {
|
|
10732
10992
|
assignee: input.assignee
|
|
10733
10993
|
});
|
|
10734
10994
|
if (!task) {
|
|
10735
|
-
return new
|
|
10995
|
+
return new ToolMessage7({
|
|
10736
10996
|
content: `Task ${input.task_id} not found in team ${teamId}.`,
|
|
10737
10997
|
tool_call_id: config.toolCall?.id,
|
|
10738
10998
|
name: "assign_task"
|
|
10739
10999
|
});
|
|
10740
11000
|
}
|
|
10741
|
-
return new
|
|
11001
|
+
return new ToolMessage7({
|
|
10742
11002
|
content: `Task "${task.title}" (${task.id}) assigned to ${input.assignee}.`,
|
|
10743
11003
|
tool_call_id: config.toolCall?.id,
|
|
10744
11004
|
name: "assign_task"
|
|
@@ -10747,26 +11007,26 @@ IMPORTANT: Assigning to a specific teammate
|
|
|
10747
11007
|
{
|
|
10748
11008
|
name: "assign_task",
|
|
10749
11009
|
description: "Assign a task to a specific teammate. Use when you need to reassign work to a different teammate. Omit team_id to use the active team from state.",
|
|
10750
|
-
schema:
|
|
10751
|
-
task_id:
|
|
10752
|
-
assignee:
|
|
11010
|
+
schema: z47.object({
|
|
11011
|
+
task_id: z47.string().describe("Task ID to assign"),
|
|
11012
|
+
assignee: z47.string().describe("Teammate name to assign this task to")
|
|
10753
11013
|
})
|
|
10754
11014
|
}
|
|
10755
11015
|
);
|
|
10756
|
-
const setTaskStatusTool =
|
|
11016
|
+
const setTaskStatusTool = tool47(
|
|
10757
11017
|
async (input, config) => {
|
|
10758
11018
|
const teamId = resolveTeamId();
|
|
10759
11019
|
const task = await taskListStore.updateTask(teamId, input.task_id, {
|
|
10760
11020
|
status: input.status
|
|
10761
11021
|
});
|
|
10762
11022
|
if (!task) {
|
|
10763
|
-
return new
|
|
11023
|
+
return new ToolMessage7({
|
|
10764
11024
|
content: `Task ${input.task_id} not found in team ${teamId}.`,
|
|
10765
11025
|
tool_call_id: config.toolCall?.id,
|
|
10766
11026
|
name: "set_task_status"
|
|
10767
11027
|
});
|
|
10768
11028
|
}
|
|
10769
|
-
return new
|
|
11029
|
+
return new ToolMessage7({
|
|
10770
11030
|
content: `Task "${task.title}" (${task.id}) status set to ${input.status}.`,
|
|
10771
11031
|
tool_call_id: config.toolCall?.id,
|
|
10772
11032
|
name: "set_task_status"
|
|
@@ -10775,26 +11035,26 @@ IMPORTANT: Assigning to a specific teammate
|
|
|
10775
11035
|
{
|
|
10776
11036
|
name: "set_task_status",
|
|
10777
11037
|
description: "Set a task's status. Use to reopen a task (set to pending), mark as failed, or correct status. Values: pending, claimed, in_progress, completed, failed. Omit team_id to use the active team from state.",
|
|
10778
|
-
schema:
|
|
10779
|
-
task_id:
|
|
10780
|
-
status:
|
|
11038
|
+
schema: z47.object({
|
|
11039
|
+
task_id: z47.string().describe("Task ID to update"),
|
|
11040
|
+
status: z47.enum(["pending", "claimed", "in_progress", "completed", "failed"]).describe("New status for the task")
|
|
10781
11041
|
})
|
|
10782
11042
|
}
|
|
10783
11043
|
);
|
|
10784
|
-
const setTaskDependenciesTool =
|
|
11044
|
+
const setTaskDependenciesTool = tool47(
|
|
10785
11045
|
async (input, config) => {
|
|
10786
11046
|
const teamId = resolveTeamId();
|
|
10787
11047
|
const task = await taskListStore.updateTask(teamId, input.task_id, {
|
|
10788
11048
|
dependencies: input.dependencies
|
|
10789
11049
|
});
|
|
10790
11050
|
if (!task) {
|
|
10791
|
-
return new
|
|
11051
|
+
return new ToolMessage7({
|
|
10792
11052
|
content: `Task ${input.task_id} not found in team ${teamId}.`,
|
|
10793
11053
|
tool_call_id: config.toolCall?.id,
|
|
10794
11054
|
name: "set_task_dependencies"
|
|
10795
11055
|
});
|
|
10796
11056
|
}
|
|
10797
|
-
return new
|
|
11057
|
+
return new ToolMessage7({
|
|
10798
11058
|
content: `Task "${task.title}" (${task.id}) dependencies set to [${input.dependencies.join(", ")}].`,
|
|
10799
11059
|
tool_call_id: config.toolCall?.id,
|
|
10800
11060
|
name: "set_task_dependencies"
|
|
@@ -10803,13 +11063,13 @@ IMPORTANT: Assigning to a specific teammate
|
|
|
10803
11063
|
{
|
|
10804
11064
|
name: "set_task_dependencies",
|
|
10805
11065
|
description: 'Set which task IDs must complete before this task can be claimed. Pass an array of task IDs (e.g. ["task-01", "task-02"]). Use to fix task order or add/remove dependencies. Omit team_id to use the active team from state.',
|
|
10806
|
-
schema:
|
|
10807
|
-
task_id:
|
|
10808
|
-
dependencies:
|
|
11066
|
+
schema: z47.object({
|
|
11067
|
+
task_id: z47.string().describe("Task ID to update"),
|
|
11068
|
+
dependencies: z47.array(z47.string()).describe("Task IDs that must complete before this task can be claimed")
|
|
10809
11069
|
})
|
|
10810
11070
|
}
|
|
10811
11071
|
);
|
|
10812
|
-
const checkTasksTool =
|
|
11072
|
+
const checkTasksTool = tool47(
|
|
10813
11073
|
async (input, config) => {
|
|
10814
11074
|
const teamId = resolveTeamId();
|
|
10815
11075
|
const tasks = await taskListStore.getAllTasks(teamId);
|
|
@@ -10818,7 +11078,7 @@ IMPORTANT: Assigning to a specific teammate
|
|
|
10818
11078
|
update: {
|
|
10819
11079
|
tasks: tasksSnapshot,
|
|
10820
11080
|
messages: [
|
|
10821
|
-
new
|
|
11081
|
+
new ToolMessage7({
|
|
10822
11082
|
content: formatTaskSummary(tasks),
|
|
10823
11083
|
tool_call_id: config.toolCall?.id,
|
|
10824
11084
|
name: "check_tasks"
|
|
@@ -10849,12 +11109,12 @@ Task Status Values:
|
|
|
10849
11109
|
- in_progress: Teammate is actively working on this task
|
|
10850
11110
|
- completed: Task finished successfully
|
|
10851
11111
|
- failed: Task encountered an error`,
|
|
10852
|
-
schema:
|
|
10853
|
-
team_id:
|
|
11112
|
+
schema: z47.object({
|
|
11113
|
+
team_id: z47.string().optional().describe("Team ID (omit to use active team)")
|
|
10854
11114
|
})
|
|
10855
11115
|
}
|
|
10856
11116
|
);
|
|
10857
|
-
const sendMessageTool =
|
|
11117
|
+
const sendMessageTool = tool47(
|
|
10858
11118
|
async (input, config) => {
|
|
10859
11119
|
const teamId = resolveTeamId();
|
|
10860
11120
|
await mailboxStore.sendMessage(
|
|
@@ -10864,7 +11124,7 @@ Task Status Values:
|
|
|
10864
11124
|
input.content,
|
|
10865
11125
|
"direct_message" /* DIRECT_MESSAGE */
|
|
10866
11126
|
);
|
|
10867
|
-
return new
|
|
11127
|
+
return new ToolMessage7({
|
|
10868
11128
|
content: `Message sent to ${input.to}.`,
|
|
10869
11129
|
tool_call_id: config.toolCall?.id,
|
|
10870
11130
|
name: "send_message"
|
|
@@ -10873,13 +11133,13 @@ Task Status Values:
|
|
|
10873
11133
|
{
|
|
10874
11134
|
name: "send_message",
|
|
10875
11135
|
description: "Send a message to a specific teammate in the team. Omit team_id to use the active team from state.",
|
|
10876
|
-
schema:
|
|
10877
|
-
to:
|
|
10878
|
-
content:
|
|
11136
|
+
schema: z47.object({
|
|
11137
|
+
to: z47.string().describe("Recipient teammate name"),
|
|
11138
|
+
content: z47.string().describe("Message content")
|
|
10879
11139
|
})
|
|
10880
11140
|
}
|
|
10881
11141
|
);
|
|
10882
|
-
const readMessagesTool =
|
|
11142
|
+
const readMessagesTool = tool47(
|
|
10883
11143
|
async (input, config) => {
|
|
10884
11144
|
const teamId = resolveTeamId();
|
|
10885
11145
|
const formatAndMarkAsRead = async (msgs2) => {
|
|
@@ -10907,7 +11167,7 @@ Task Status Values:
|
|
|
10907
11167
|
if (msgs.length > 0) {
|
|
10908
11168
|
const formatted2 = await formatAndMarkAsRead(msgs);
|
|
10909
11169
|
const allTeamMessages2 = await getAllTeamMessagesForState();
|
|
10910
|
-
const toolMessage2 = new
|
|
11170
|
+
const toolMessage2 = new ToolMessage7({
|
|
10911
11171
|
content: formatted2,
|
|
10912
11172
|
tool_call_id: config.toolCall?.id,
|
|
10913
11173
|
name: "read_messages"
|
|
@@ -10939,7 +11199,7 @@ Task Status Values:
|
|
|
10939
11199
|
);
|
|
10940
11200
|
const allTeamMessages = await getAllTeamMessagesForState();
|
|
10941
11201
|
if (msgs.length === 0) {
|
|
10942
|
-
const toolMessage2 = new
|
|
11202
|
+
const toolMessage2 = new ToolMessage7({
|
|
10943
11203
|
content: "No unread messages from teammates.",
|
|
10944
11204
|
tool_call_id: config.toolCall?.id,
|
|
10945
11205
|
name: "read_messages"
|
|
@@ -10949,7 +11209,7 @@ Task Status Values:
|
|
|
10949
11209
|
});
|
|
10950
11210
|
}
|
|
10951
11211
|
const formatted = await formatAndMarkAsRead(msgs);
|
|
10952
|
-
const toolMessage = new
|
|
11212
|
+
const toolMessage = new ToolMessage7({
|
|
10953
11213
|
content: formatted,
|
|
10954
11214
|
tool_call_id: config.toolCall?.id,
|
|
10955
11215
|
name: "read_messages"
|
|
@@ -10961,12 +11221,12 @@ Task Status Values:
|
|
|
10961
11221
|
{
|
|
10962
11222
|
name: "read_messages",
|
|
10963
11223
|
description: "Read unread messages from teammates. Returns immediately if messages exist, otherwise waits for up to 3 minutes for new messages.",
|
|
10964
|
-
schema:
|
|
10965
|
-
team_id:
|
|
11224
|
+
schema: z47.object({
|
|
11225
|
+
team_id: z47.string().optional().describe("Team ID (omit to use active team)")
|
|
10966
11226
|
})
|
|
10967
11227
|
}
|
|
10968
11228
|
);
|
|
10969
|
-
const disbandTeamTool =
|
|
11229
|
+
const disbandTeamTool = tool47(
|
|
10970
11230
|
async (input, config) => {
|
|
10971
11231
|
const teamId = resolveTeamId();
|
|
10972
11232
|
await mailboxStore.broadcastMessage(
|
|
@@ -10976,7 +11236,7 @@ Task Status Values:
|
|
|
10976
11236
|
"shutdown_request" /* SHUTDOWN_REQUEST */
|
|
10977
11237
|
);
|
|
10978
11238
|
await new Promise((r) => setTimeout(r, 2e3));
|
|
10979
|
-
return new
|
|
11239
|
+
return new ToolMessage7({
|
|
10980
11240
|
content: `Team ${teamId} has been disbanded. All teammates notified and resources cleaned up.`,
|
|
10981
11241
|
tool_call_id: config.toolCall?.id,
|
|
10982
11242
|
name: "disband_team"
|
|
@@ -10987,7 +11247,7 @@ Task Status Values:
|
|
|
10987
11247
|
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."
|
|
10988
11248
|
}
|
|
10989
11249
|
);
|
|
10990
|
-
const broadcastMessageTool =
|
|
11250
|
+
const broadcastMessageTool = tool47(
|
|
10991
11251
|
async (input, config) => {
|
|
10992
11252
|
const teamId = resolveTeamId();
|
|
10993
11253
|
await mailboxStore.broadcastMessage(
|
|
@@ -10996,7 +11256,7 @@ Task Status Values:
|
|
|
10996
11256
|
input.content,
|
|
10997
11257
|
"broadcast" /* BROADCAST */
|
|
10998
11258
|
);
|
|
10999
|
-
return new
|
|
11259
|
+
return new ToolMessage7({
|
|
11000
11260
|
content: `Broadcast message sent to all teammates.`,
|
|
11001
11261
|
tool_call_id: config.toolCall?.id,
|
|
11002
11262
|
name: "broadcast_message"
|
|
@@ -11005,12 +11265,12 @@ Task Status Values:
|
|
|
11005
11265
|
{
|
|
11006
11266
|
name: "broadcast_message",
|
|
11007
11267
|
description: "Send a message to all teammates at once. Use this to communicate with everyone in the team. Omit team_id to use the active team from state.",
|
|
11008
|
-
schema:
|
|
11009
|
-
content:
|
|
11268
|
+
schema: z47.object({
|
|
11269
|
+
content: z47.string().describe("Message content to broadcast to all teammates")
|
|
11010
11270
|
})
|
|
11011
11271
|
}
|
|
11012
11272
|
);
|
|
11013
|
-
return
|
|
11273
|
+
return createMiddleware11({
|
|
11014
11274
|
name: "teamMiddleware",
|
|
11015
11275
|
tools: [
|
|
11016
11276
|
createTeamTool,
|
|
@@ -11038,37 +11298,37 @@ ${TEAM_SYSTEM_PROMPT}` : TEAM_SYSTEM_PROMPT;
|
|
|
11038
11298
|
}
|
|
11039
11299
|
|
|
11040
11300
|
// src/agent_team/agent_team.ts
|
|
11041
|
-
var TeammateInfoSchema =
|
|
11042
|
-
name:
|
|
11043
|
-
role:
|
|
11044
|
-
description:
|
|
11301
|
+
var TeammateInfoSchema = z48.object({
|
|
11302
|
+
name: z48.string().describe("Teammate name"),
|
|
11303
|
+
role: z48.string().describe("Role category (e.g. research, writing, review)"),
|
|
11304
|
+
description: z48.string().describe("What this teammate focuses on")
|
|
11045
11305
|
});
|
|
11046
|
-
var TeamTaskInfoSchema =
|
|
11047
|
-
id:
|
|
11048
|
-
title:
|
|
11049
|
-
description:
|
|
11050
|
-
status:
|
|
11306
|
+
var TeamTaskInfoSchema = z48.object({
|
|
11307
|
+
id: z48.string(),
|
|
11308
|
+
title: z48.string(),
|
|
11309
|
+
description: z48.string(),
|
|
11310
|
+
status: z48.string().optional()
|
|
11051
11311
|
});
|
|
11052
|
-
var MailboxMessageSchema =
|
|
11053
|
-
id:
|
|
11054
|
-
from:
|
|
11055
|
-
to:
|
|
11056
|
-
content:
|
|
11057
|
-
timestamp:
|
|
11058
|
-
type:
|
|
11059
|
-
read:
|
|
11312
|
+
var MailboxMessageSchema = z48.object({
|
|
11313
|
+
id: z48.string().describe("Unique message identifier"),
|
|
11314
|
+
from: z48.string().describe("Sender agent name"),
|
|
11315
|
+
to: z48.string().describe("Recipient agent name"),
|
|
11316
|
+
content: z48.string().describe("Message content"),
|
|
11317
|
+
timestamp: z48.string().describe("ISO timestamp when the message was sent"),
|
|
11318
|
+
type: z48.nativeEnum(MessageType).describe("Message type"),
|
|
11319
|
+
read: z48.boolean().describe("Whether the recipient has read this message")
|
|
11060
11320
|
});
|
|
11061
|
-
var TeamInfoSchema =
|
|
11062
|
-
teamId:
|
|
11063
|
-
teamLeadId:
|
|
11064
|
-
teammates:
|
|
11065
|
-
tasks:
|
|
11066
|
-
createdAt:
|
|
11321
|
+
var TeamInfoSchema = z48.object({
|
|
11322
|
+
teamId: z48.string().describe("Unique team identifier"),
|
|
11323
|
+
teamLeadId: z48.string().default("team_lead").describe("Team lead agent ID"),
|
|
11324
|
+
teammates: z48.array(TeammateInfoSchema).describe("Active teammates in this team"),
|
|
11325
|
+
tasks: z48.array(TeamTaskInfoSchema).optional().describe("Initial tasks snapshot"),
|
|
11326
|
+
createdAt: z48.string().optional().describe("ISO timestamp when team was created")
|
|
11067
11327
|
});
|
|
11068
|
-
var TEAM_STATE_SCHEMA =
|
|
11328
|
+
var TEAM_STATE_SCHEMA = z48.object({
|
|
11069
11329
|
team: TeamInfoSchema.optional().describe("Team info: teamId, teamLeadId, teammates, tasks. Set when create_team succeeds."),
|
|
11070
|
-
tasks:
|
|
11071
|
-
team_mailbox:
|
|
11330
|
+
tasks: z48.array(TeamTaskInfoSchema).optional().describe("Current tasks snapshot from check_tasks. Updated on each check."),
|
|
11331
|
+
team_mailbox: z48.array(MailboxMessageSchema).optional().describe("All team mailbox messages for display")
|
|
11072
11332
|
});
|
|
11073
11333
|
var TEAM_LEAD_BASE_PROMPT = `You are a team lead that coordinates a team of specialized agents. In order to complete the objective that the user asks of you, you will need to:
|
|
11074
11334
|
|
|
@@ -11148,7 +11408,7 @@ var TeamAgentGraphBuilder = class {
|
|
|
11148
11408
|
const tools = params.tools.map((t) => {
|
|
11149
11409
|
const toolClient = getToolClient(t.key);
|
|
11150
11410
|
return toolClient;
|
|
11151
|
-
}).filter((
|
|
11411
|
+
}).filter((tool48) => tool48 !== void 0);
|
|
11152
11412
|
const teammates = params.subAgents.map((sa) => {
|
|
11153
11413
|
const baseConfig = sa.config;
|
|
11154
11414
|
return {
|
|
@@ -13825,10 +14085,10 @@ var McpLatticeManager = class _McpLatticeManager extends BaseLatticeManager {
|
|
|
13825
14085
|
}
|
|
13826
14086
|
const tools = await this.getAllTools();
|
|
13827
14087
|
console.log(`[MCP] Registering ${tools.length} tools to Tool Lattice...`);
|
|
13828
|
-
for (const
|
|
13829
|
-
const toolKey = prefix ? `${prefix}_${
|
|
13830
|
-
|
|
13831
|
-
toolLatticeManager.registerExistingTool(toolKey,
|
|
14088
|
+
for (const tool48 of tools) {
|
|
14089
|
+
const toolKey = prefix ? `${prefix}_${tool48.name}` : tool48.name;
|
|
14090
|
+
tool48.name = toolKey;
|
|
14091
|
+
toolLatticeManager.registerExistingTool(toolKey, tool48);
|
|
13832
14092
|
console.log(`[MCP] Registered tool: ${toolKey}`);
|
|
13833
14093
|
}
|
|
13834
14094
|
console.log(`[MCP] Successfully registered ${tools.length} tools to Tool Lattice`);
|