@axiom-lattice/core 2.1.95 → 2.1.96
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 +62 -17
- package/dist/index.d.ts +62 -17
- package/dist/index.js +540 -145
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +536 -145
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -7081,6 +7081,21 @@ function createCodeEvalMiddleware(params = { vmIsolation: "agent" }) {
|
|
|
7081
7081
|
tools: [createShellExecTool({ vmIsolation: params.vmIsolation })]
|
|
7082
7082
|
});
|
|
7083
7083
|
}
|
|
7084
|
+
var codeEvalPlugin = {
|
|
7085
|
+
meta: {
|
|
7086
|
+
type: "code_eval",
|
|
7087
|
+
name: "Code Evaluation",
|
|
7088
|
+
description: "Enables safe code execution",
|
|
7089
|
+
configSchema: {
|
|
7090
|
+
type: "object",
|
|
7091
|
+
properties: {
|
|
7092
|
+
vmIsolation: { type: "string" }
|
|
7093
|
+
}
|
|
7094
|
+
},
|
|
7095
|
+
defaultConfig: { vmIsolation: "global" }
|
|
7096
|
+
},
|
|
7097
|
+
middleware: (cfg) => createCodeEvalMiddleware(cfg)
|
|
7098
|
+
};
|
|
7084
7099
|
|
|
7085
7100
|
// src/middlewares/browserMiddleware.ts
|
|
7086
7101
|
import { createMiddleware as createMiddleware2 } from "langchain";
|
|
@@ -7116,6 +7131,22 @@ function createBrowserMiddleware(params = { vmIsolation: "agent" }) {
|
|
|
7116
7131
|
tools
|
|
7117
7132
|
});
|
|
7118
7133
|
}
|
|
7134
|
+
var browserPlugin = {
|
|
7135
|
+
meta: {
|
|
7136
|
+
type: "browser",
|
|
7137
|
+
name: "Browser",
|
|
7138
|
+
description: "Provides browser automation capabilities",
|
|
7139
|
+
configSchema: {
|
|
7140
|
+
type: "object",
|
|
7141
|
+
properties: {
|
|
7142
|
+
vmIsolation: { type: "string" },
|
|
7143
|
+
headless: { type: "boolean" }
|
|
7144
|
+
}
|
|
7145
|
+
},
|
|
7146
|
+
defaultConfig: { headless: true, vmIsolation: "agent" }
|
|
7147
|
+
},
|
|
7148
|
+
middleware: (cfg) => createBrowserMiddleware(cfg)
|
|
7149
|
+
};
|
|
7119
7150
|
|
|
7120
7151
|
// src/middlewares/sqlMiddleware.ts
|
|
7121
7152
|
import { createMiddleware as createMiddleware3 } from "langchain";
|
|
@@ -7142,6 +7173,27 @@ function createSqlMiddleware(params) {
|
|
|
7142
7173
|
]
|
|
7143
7174
|
});
|
|
7144
7175
|
}
|
|
7176
|
+
var sqlPlugin = {
|
|
7177
|
+
meta: {
|
|
7178
|
+
type: "sql",
|
|
7179
|
+
name: "SQL Database",
|
|
7180
|
+
description: "Provides SQL database query capabilities",
|
|
7181
|
+
tools: [
|
|
7182
|
+
{ name: "list_tables_sql", description: "List all tables in a database" },
|
|
7183
|
+
{ name: "info_sql", description: "Get information about a database connection" },
|
|
7184
|
+
{ name: "query_checker_sql", description: "Check a SQL query for correctness" },
|
|
7185
|
+
{ name: "query_sql", description: "Execute a SQL query" }
|
|
7186
|
+
],
|
|
7187
|
+
configSchema: {
|
|
7188
|
+
type: "object",
|
|
7189
|
+
properties: {
|
|
7190
|
+
databaseKeys: { type: "array", items: { type: "string" }, widget: "databaseSelect" }
|
|
7191
|
+
}
|
|
7192
|
+
},
|
|
7193
|
+
defaultConfig: { databaseKeys: [] }
|
|
7194
|
+
},
|
|
7195
|
+
middleware: (cfg) => createSqlMiddleware(cfg)
|
|
7196
|
+
};
|
|
7145
7197
|
|
|
7146
7198
|
// src/middlewares/skillMiddleware.ts
|
|
7147
7199
|
import { createMiddleware as createMiddleware4 } from "langchain";
|
|
@@ -7842,12 +7894,23 @@ Response: \`{"message":"Hello, Simon!"}\`
|
|
|
7842
7894
|
From your frontend JS, call the API using relative paths:
|
|
7843
7895
|
|
|
7844
7896
|
\`\`\`js
|
|
7845
|
-
// main.js
|
|
7897
|
+
// main.js \u2014 GET
|
|
7846
7898
|
const res = await fetch(\`./api/hello.js?name=\${name}\`);
|
|
7847
7899
|
const data = await res.json();
|
|
7848
7900
|
console.log(data.message);
|
|
7901
|
+
|
|
7902
|
+
// POST with JSON body
|
|
7903
|
+
await fetch("./api/hello.js", {
|
|
7904
|
+
method: "POST",
|
|
7905
|
+
body: JSON.stringify({ title: "New Task", done: false }),
|
|
7906
|
+
});
|
|
7907
|
+
|
|
7908
|
+
// PUT / DELETE \u2014 same pattern
|
|
7909
|
+
await fetch("./api/hello.js", { method: "PUT", body: JSON.stringify({ id: 1, title: "Updated" }) });
|
|
7910
|
+
await fetch("./api/hello.js", { method: "DELETE", body: JSON.stringify({ id: 1 }) });
|
|
7849
7911
|
\`\`\`
|
|
7850
7912
|
|
|
7913
|
+
The API receives the body as \`API_BODY\` env var (raw string), method as \`API_METHOD\`.
|
|
7851
7914
|
The \`<base>\` tag injected into HTML ensures relative URLs resolve through the share proxy.
|
|
7852
7915
|
|
|
7853
7916
|
## 4. File Upload
|
|
@@ -8134,6 +8197,14 @@ ${skillsPrompt}
|
|
|
8134
8197
|
}
|
|
8135
8198
|
});
|
|
8136
8199
|
}
|
|
8200
|
+
var skillPlugin = {
|
|
8201
|
+
meta: {
|
|
8202
|
+
type: "skill",
|
|
8203
|
+
name: "Skills",
|
|
8204
|
+
description: "Provides skill loading capabilities for the agent"
|
|
8205
|
+
},
|
|
8206
|
+
middleware: (cfg) => createSkillMiddleware(cfg)
|
|
8207
|
+
};
|
|
8137
8208
|
|
|
8138
8209
|
// src/deep_agent_new/middleware/fs.ts
|
|
8139
8210
|
import { createMiddleware as createMiddleware5, tool as tool40, ToolMessage } from "langchain";
|
|
@@ -9001,6 +9072,21 @@ ${systemPrompt}` : systemPrompt;
|
|
|
9001
9072
|
}) : void 0
|
|
9002
9073
|
});
|
|
9003
9074
|
}
|
|
9075
|
+
var filesystemPlugin = {
|
|
9076
|
+
meta: {
|
|
9077
|
+
type: "filesystem",
|
|
9078
|
+
name: "Filesystem",
|
|
9079
|
+
description: "Provides file system operations for reading, writing, and managing files",
|
|
9080
|
+
configSchema: {
|
|
9081
|
+
type: "object",
|
|
9082
|
+
properties: {
|
|
9083
|
+
vmIsolation: { type: "string" }
|
|
9084
|
+
}
|
|
9085
|
+
},
|
|
9086
|
+
defaultConfig: { vmIsolation: "global" }
|
|
9087
|
+
},
|
|
9088
|
+
middleware: (cfg) => createFilesystemMiddleware(cfg)
|
|
9089
|
+
};
|
|
9004
9090
|
|
|
9005
9091
|
// src/middlewares/metricsMiddleware.ts
|
|
9006
9092
|
import { createMiddleware as createMiddleware6 } from "langchain";
|
|
@@ -9035,6 +9121,31 @@ function createMetricsMiddleware(params) {
|
|
|
9035
9121
|
]
|
|
9036
9122
|
});
|
|
9037
9123
|
}
|
|
9124
|
+
var metricsPlugin = {
|
|
9125
|
+
meta: {
|
|
9126
|
+
type: "metrics",
|
|
9127
|
+
name: "Metrics",
|
|
9128
|
+
description: "Provides metrics querying capabilities",
|
|
9129
|
+
tools: [
|
|
9130
|
+
{ name: "list_datasources", description: "List all datasources from all configured servers" },
|
|
9131
|
+
{ name: "query_metrics_list", description: "Query available metrics from datasources" },
|
|
9132
|
+
{ name: "query_metric_definition", description: "Get detailed definition of a specific metric" },
|
|
9133
|
+
{ name: "query_semantic_metric_data", description: "Query actual metric data" },
|
|
9134
|
+
{ name: "query_tables_list", description: "Query available tables from datasources" },
|
|
9135
|
+
{ name: "query_table_definition", description: "Get detailed definition of a specific table" },
|
|
9136
|
+
{ name: "execute_sql_query", description: "Execute custom SQL queries" }
|
|
9137
|
+
],
|
|
9138
|
+
configSchema: {
|
|
9139
|
+
type: "object",
|
|
9140
|
+
properties: {
|
|
9141
|
+
connectAll: { type: "boolean" },
|
|
9142
|
+
serverKeys: { type: "array", items: { type: "string" } }
|
|
9143
|
+
}
|
|
9144
|
+
},
|
|
9145
|
+
defaultConfig: { connectAll: false, serverKeys: [] }
|
|
9146
|
+
},
|
|
9147
|
+
middleware: (cfg) => createMetricsMiddleware(cfg)
|
|
9148
|
+
};
|
|
9038
9149
|
|
|
9039
9150
|
// src/middlewares/collectionMiddleware.ts
|
|
9040
9151
|
import { createMiddleware as createMiddleware7 } from "langchain";
|
|
@@ -9618,6 +9729,34 @@ function createCollectionMiddleware(params) {
|
|
|
9618
9729
|
]
|
|
9619
9730
|
});
|
|
9620
9731
|
}
|
|
9732
|
+
var collectionPlugin = {
|
|
9733
|
+
meta: {
|
|
9734
|
+
type: "collection",
|
|
9735
|
+
name: "Collection",
|
|
9736
|
+
description: "Provides vector search and CRUD access to knowledge collections",
|
|
9737
|
+
tools: [
|
|
9738
|
+
{ name: "list_collections", description: "List all available collections" },
|
|
9739
|
+
{ name: "search_collection", description: "Search for documents in a collection" },
|
|
9740
|
+
{ name: "get_collection", description: "Get a specific collection's details" },
|
|
9741
|
+
{ name: "list_entries", description: "List entries in a collection" },
|
|
9742
|
+
{ name: "create_collection", description: "Create a new collection" },
|
|
9743
|
+
{ name: "update_collection", description: "Update an existing collection" },
|
|
9744
|
+
{ name: "delete_collection", description: "Delete a collection" },
|
|
9745
|
+
{ name: "add_entry", description: "Add an entry to a collection" },
|
|
9746
|
+
{ name: "update_entry", description: "Update an entry in a collection" },
|
|
9747
|
+
{ name: "delete_entry", description: "Delete an entry from a collection" }
|
|
9748
|
+
],
|
|
9749
|
+
configSchema: {
|
|
9750
|
+
type: "object",
|
|
9751
|
+
properties: {
|
|
9752
|
+
connectAll: { type: "boolean" },
|
|
9753
|
+
collectionKeys: { type: "array", items: { type: "string" } }
|
|
9754
|
+
}
|
|
9755
|
+
},
|
|
9756
|
+
defaultConfig: { connectAll: false, collectionKeys: [] }
|
|
9757
|
+
},
|
|
9758
|
+
middleware: (cfg) => createCollectionMiddleware(cfg)
|
|
9759
|
+
};
|
|
9621
9760
|
|
|
9622
9761
|
// src/middlewares/askUserClarifyMiddleware.ts
|
|
9623
9762
|
import { createMiddleware as createMiddleware8, ToolMessage as ToolMessage2 } from "langchain";
|
|
@@ -9738,6 +9877,14 @@ function createAskUserClarifyMiddleware() {
|
|
|
9738
9877
|
}
|
|
9739
9878
|
});
|
|
9740
9879
|
}
|
|
9880
|
+
var askUserClarifyPlugin = {
|
|
9881
|
+
meta: {
|
|
9882
|
+
type: "ask_user_to_clarify",
|
|
9883
|
+
name: "Ask User To Clarify",
|
|
9884
|
+
description: "Enables the agent to ask users clarifying questions"
|
|
9885
|
+
},
|
|
9886
|
+
middleware: () => createAskUserClarifyMiddleware()
|
|
9887
|
+
};
|
|
9741
9888
|
|
|
9742
9889
|
// src/middlewares/widgetMiddleware.ts
|
|
9743
9890
|
import { createMiddleware as createMiddleware9 } from "langchain";
|
|
@@ -10628,6 +10775,14 @@ function createWidgetMiddleware() {
|
|
|
10628
10775
|
tools
|
|
10629
10776
|
});
|
|
10630
10777
|
}
|
|
10778
|
+
var widgetPlugin = {
|
|
10779
|
+
meta: {
|
|
10780
|
+
type: "widget",
|
|
10781
|
+
name: "Widget",
|
|
10782
|
+
description: "Enables the agent to render interactive HTML widgets"
|
|
10783
|
+
},
|
|
10784
|
+
middleware: () => createWidgetMiddleware()
|
|
10785
|
+
};
|
|
10631
10786
|
|
|
10632
10787
|
// src/middlewares/modelSelectorMiddleware.ts
|
|
10633
10788
|
import { createMiddleware as createMiddleware10 } from "langchain";
|
|
@@ -11243,6 +11398,14 @@ ${startupSections.join("\n\n")}
|
|
|
11243
11398
|
}
|
|
11244
11399
|
});
|
|
11245
11400
|
}
|
|
11401
|
+
var clawPlugin = {
|
|
11402
|
+
meta: {
|
|
11403
|
+
type: "claw",
|
|
11404
|
+
name: "Memory",
|
|
11405
|
+
description: "Injects and manages memory/bootstrap files in the runtime workspace"
|
|
11406
|
+
},
|
|
11407
|
+
middleware: (cfg) => createClawMiddleware(cfg)
|
|
11408
|
+
};
|
|
11246
11409
|
|
|
11247
11410
|
// src/middlewares/unknownToolHandlerMiddleware.ts
|
|
11248
11411
|
import { createMiddleware as createMiddleware12 } from "langchain";
|
|
@@ -11431,6 +11594,14 @@ ${currentSystemPrompt}` : dateContext;
|
|
|
11431
11594
|
}
|
|
11432
11595
|
});
|
|
11433
11596
|
}
|
|
11597
|
+
var datePlugin = {
|
|
11598
|
+
meta: {
|
|
11599
|
+
type: "date",
|
|
11600
|
+
name: "Current Date",
|
|
11601
|
+
description: "Injects the current date into the agent system prompt"
|
|
11602
|
+
},
|
|
11603
|
+
middleware: (cfg) => createDateMiddleware(cfg)
|
|
11604
|
+
};
|
|
11434
11605
|
|
|
11435
11606
|
// src/deep_agent_new/middleware/scheduler.ts
|
|
11436
11607
|
import { tool as tool55, createMiddleware as createMiddleware14 } from "langchain";
|
|
@@ -14447,6 +14618,14 @@ function createSchedulerMiddleware(options = {}) {
|
|
|
14447
14618
|
]
|
|
14448
14619
|
});
|
|
14449
14620
|
}
|
|
14621
|
+
var schedulerPlugin = {
|
|
14622
|
+
meta: {
|
|
14623
|
+
type: "scheduler",
|
|
14624
|
+
name: "Scheduler",
|
|
14625
|
+
description: "Enables the agent to schedule future work"
|
|
14626
|
+
},
|
|
14627
|
+
middleware: (cfg) => createSchedulerMiddleware(cfg)
|
|
14628
|
+
};
|
|
14450
14629
|
|
|
14451
14630
|
// src/middlewares/taskMiddleware.ts
|
|
14452
14631
|
import { createMiddleware as createMiddleware15, tool as tool56 } from "langchain";
|
|
@@ -14579,28 +14758,121 @@ function createTaskMiddleware() {
|
|
|
14579
14758
|
]
|
|
14580
14759
|
});
|
|
14581
14760
|
}
|
|
14761
|
+
var taskPlugin = {
|
|
14762
|
+
meta: {
|
|
14763
|
+
type: "task",
|
|
14764
|
+
name: "Task Management",
|
|
14765
|
+
description: "Enables persistent task management with delegation and tracking"
|
|
14766
|
+
},
|
|
14767
|
+
middleware: () => createTaskMiddleware()
|
|
14768
|
+
};
|
|
14769
|
+
|
|
14770
|
+
// src/plugin/metaSerializer.ts
|
|
14771
|
+
function tryExtractTools(plugin) {
|
|
14772
|
+
if (!plugin.middleware) return [];
|
|
14773
|
+
try {
|
|
14774
|
+
const result = plugin.middleware({});
|
|
14775
|
+
if (result instanceof Promise) return [];
|
|
14776
|
+
const mw = result;
|
|
14777
|
+
if (Array.isArray(mw.tools)) {
|
|
14778
|
+
return mw.tools.map((t) => ({
|
|
14779
|
+
name: t.name || "",
|
|
14780
|
+
description: t.description || ""
|
|
14781
|
+
}));
|
|
14782
|
+
}
|
|
14783
|
+
} catch {
|
|
14784
|
+
}
|
|
14785
|
+
return [];
|
|
14786
|
+
}
|
|
14787
|
+
function serializePluginMeta(plugin) {
|
|
14788
|
+
const meta = {
|
|
14789
|
+
type: plugin.meta.type,
|
|
14790
|
+
name: plugin.meta.name,
|
|
14791
|
+
description: plugin.meta.description,
|
|
14792
|
+
version: plugin.meta.version,
|
|
14793
|
+
source: plugin.meta.source,
|
|
14794
|
+
icon: plugin.meta.icon,
|
|
14795
|
+
tools: plugin.meta.tools ?? tryExtractTools(plugin),
|
|
14796
|
+
configSchema: plugin.meta.configSchema,
|
|
14797
|
+
defaultConfig: plugin.meta.defaultConfig
|
|
14798
|
+
};
|
|
14799
|
+
if (plugin.connection) {
|
|
14800
|
+
meta.connectionSchema = {
|
|
14801
|
+
fields: plugin.connection.fields,
|
|
14802
|
+
hasTest: typeof plugin.connection.test === "function",
|
|
14803
|
+
hasDiscover: typeof plugin.connection.discover === "function",
|
|
14804
|
+
resourceLabel: plugin.connection.resourceLabel
|
|
14805
|
+
};
|
|
14806
|
+
}
|
|
14807
|
+
return meta;
|
|
14808
|
+
}
|
|
14809
|
+
|
|
14810
|
+
// src/plugin/PluginRegistry.ts
|
|
14811
|
+
var PluginRegistry = class {
|
|
14812
|
+
/** Register a plugin (overwrites if type conflicts) */
|
|
14813
|
+
static register(plugin) {
|
|
14814
|
+
const key4 = plugin.meta.type;
|
|
14815
|
+
if (this.plugins.has(key4)) {
|
|
14816
|
+
console.warn(`[PluginRegistry] "${key4}" overwritten`);
|
|
14817
|
+
}
|
|
14818
|
+
this.plugins.set(key4, plugin);
|
|
14819
|
+
}
|
|
14820
|
+
/** Unregister */
|
|
14821
|
+
static unregister(key4) {
|
|
14822
|
+
return this.plugins.delete(key4);
|
|
14823
|
+
}
|
|
14824
|
+
/** Get plugin instance */
|
|
14825
|
+
static get(key4) {
|
|
14826
|
+
return this.plugins.get(key4);
|
|
14827
|
+
}
|
|
14828
|
+
/** Check if registered */
|
|
14829
|
+
static has(key4) {
|
|
14830
|
+
return this.plugins.has(key4);
|
|
14831
|
+
}
|
|
14832
|
+
/** List all registered plugin keys */
|
|
14833
|
+
static list() {
|
|
14834
|
+
return Array.from(this.plugins.keys());
|
|
14835
|
+
}
|
|
14836
|
+
/** Serialize all registered plugins to API-ready meta list */
|
|
14837
|
+
static listMeta() {
|
|
14838
|
+
return Array.from(this.plugins.values()).map(serializePluginMeta);
|
|
14839
|
+
}
|
|
14840
|
+
};
|
|
14841
|
+
PluginRegistry.plugins = /* @__PURE__ */ new Map();
|
|
14582
14842
|
|
|
14583
14843
|
// src/agent_lattice/builders/CustomMiddlewareRegistry.ts
|
|
14584
14844
|
var CustomMiddlewareRegistry = class {
|
|
14585
14845
|
/**
|
|
14586
14846
|
* Register a custom middleware factory under the given key.
|
|
14587
14847
|
*
|
|
14588
|
-
*
|
|
14589
|
-
*
|
|
14590
|
-
*
|
|
14848
|
+
* Supports three calling conventions:
|
|
14849
|
+
* - register(key, factory) — legacy, wraps factory as anonymous Plugin
|
|
14850
|
+
* - register(key, factory, meta) — legacy with optional meta
|
|
14851
|
+
*
|
|
14852
|
+
* For new code, prefer PluginRegistry.register(plugin).
|
|
14591
14853
|
*
|
|
14592
14854
|
* @param key - Unique identifier, referenced in database config as `config.key`
|
|
14593
14855
|
* @param factory - Function that receives config (minus `key`) and returns an AgentMiddleware
|
|
14594
|
-
*
|
|
14595
|
-
* @example
|
|
14596
|
-
* ```ts
|
|
14597
|
-
* CustomMiddlewareRegistry.register("my-logger", (config) =>
|
|
14598
|
-
* createMiddleware({ name: "Logger", beforeAgent: async () => { ... } }),
|
|
14599
|
-
* );
|
|
14600
|
-
* ```
|
|
14856
|
+
* @param deprecatedMeta - Optional metadata for API discovery
|
|
14601
14857
|
*/
|
|
14602
|
-
static register(key4, factory) {
|
|
14858
|
+
static register(key4, factory, deprecatedMeta) {
|
|
14603
14859
|
this.factories.set(key4, factory);
|
|
14860
|
+
const existing = PluginRegistry.get(key4);
|
|
14861
|
+
if (existing) return;
|
|
14862
|
+
const plugin = {
|
|
14863
|
+
meta: {
|
|
14864
|
+
type: key4,
|
|
14865
|
+
name: deprecatedMeta?.name || key4,
|
|
14866
|
+
description: deprecatedMeta?.description || "",
|
|
14867
|
+
version: deprecatedMeta?.version,
|
|
14868
|
+
source: deprecatedMeta?.source,
|
|
14869
|
+
tools: deprecatedMeta?.tools,
|
|
14870
|
+
configSchema: deprecatedMeta?.configSchema,
|
|
14871
|
+
defaultConfig: deprecatedMeta?.defaultConfig
|
|
14872
|
+
},
|
|
14873
|
+
middleware: factory
|
|
14874
|
+
};
|
|
14875
|
+
PluginRegistry.register(plugin);
|
|
14604
14876
|
}
|
|
14605
14877
|
/**
|
|
14606
14878
|
* Remove a previously registered factory.
|
|
@@ -14609,6 +14881,7 @@ var CustomMiddlewareRegistry = class {
|
|
|
14609
14881
|
* @returns `true` if a factory was removed, `false` if the key was not found
|
|
14610
14882
|
*/
|
|
14611
14883
|
static unregister(key4) {
|
|
14884
|
+
PluginRegistry.unregister(key4);
|
|
14612
14885
|
return this.factories.delete(key4);
|
|
14613
14886
|
}
|
|
14614
14887
|
/**
|
|
@@ -14618,29 +14891,73 @@ var CustomMiddlewareRegistry = class {
|
|
|
14618
14891
|
* @returns The factory function, or `undefined` if not registered
|
|
14619
14892
|
*/
|
|
14620
14893
|
static get(key4) {
|
|
14621
|
-
|
|
14894
|
+
const factory = this.factories.get(key4);
|
|
14895
|
+
if (factory) return factory;
|
|
14896
|
+
const plugin = PluginRegistry.get(key4);
|
|
14897
|
+
if (plugin?.middleware) {
|
|
14898
|
+
return ((config) => plugin.middleware(config));
|
|
14899
|
+
}
|
|
14900
|
+
return void 0;
|
|
14622
14901
|
}
|
|
14623
14902
|
/**
|
|
14624
14903
|
* Check whether a factory is registered under the given key.
|
|
14625
|
-
*
|
|
14626
|
-
* @param key - The factory key to check
|
|
14627
14904
|
*/
|
|
14628
14905
|
static has(key4) {
|
|
14629
|
-
return this.factories.has(key4);
|
|
14906
|
+
return this.factories.has(key4) || PluginRegistry.has(key4);
|
|
14630
14907
|
}
|
|
14631
14908
|
/**
|
|
14632
14909
|
* Get all currently registered factory keys.
|
|
14633
|
-
*
|
|
14634
|
-
* @returns Array of registered key strings
|
|
14635
14910
|
*/
|
|
14636
14911
|
static list() {
|
|
14637
|
-
|
|
14912
|
+
const keys = new Set(this.factories.keys());
|
|
14913
|
+
for (const k of PluginRegistry.list()) keys.add(k);
|
|
14914
|
+
return Array.from(keys);
|
|
14638
14915
|
}
|
|
14639
14916
|
};
|
|
14640
14917
|
CustomMiddlewareRegistry.factories = /* @__PURE__ */ new Map();
|
|
14641
14918
|
|
|
14919
|
+
// src/connection/ConnectionRegistry.ts
|
|
14920
|
+
var ConnectionRegistry = class {
|
|
14921
|
+
static setStore(store) {
|
|
14922
|
+
this.store = store;
|
|
14923
|
+
}
|
|
14924
|
+
static async list(type, tenantId) {
|
|
14925
|
+
this.ensureStore();
|
|
14926
|
+
return this.store.listByType(tenantId, type);
|
|
14927
|
+
}
|
|
14928
|
+
static async get(type, key4, tenantId) {
|
|
14929
|
+
this.ensureStore();
|
|
14930
|
+
return this.store.getByKey(tenantId, type, key4);
|
|
14931
|
+
}
|
|
14932
|
+
static async create(entry) {
|
|
14933
|
+
this.ensureStore();
|
|
14934
|
+
return this.store.create(entry);
|
|
14935
|
+
}
|
|
14936
|
+
static async update(tenantId, type, key4, updates) {
|
|
14937
|
+
this.ensureStore();
|
|
14938
|
+
return this.store.update(tenantId, type, key4, updates);
|
|
14939
|
+
}
|
|
14940
|
+
static async delete(tenantId, type, key4) {
|
|
14941
|
+
this.ensureStore();
|
|
14942
|
+
return this.store.delete(tenantId, type, key4);
|
|
14943
|
+
}
|
|
14944
|
+
static ensureStore() {
|
|
14945
|
+
if (!this.store) throw new Error("ConnectionStore not configured");
|
|
14946
|
+
}
|
|
14947
|
+
};
|
|
14948
|
+
ConnectionRegistry.store = null;
|
|
14949
|
+
|
|
14642
14950
|
// src/agent_lattice/builders/commonMiddleware.ts
|
|
14643
|
-
|
|
14951
|
+
function applyToolFilter(mw, allowedTools) {
|
|
14952
|
+
if (allowedTools?.length && mw.tools?.length) {
|
|
14953
|
+
mw.tools = mw.tools.filter((t) => {
|
|
14954
|
+
const toolName = t.name;
|
|
14955
|
+
return typeof toolName === "string" && allowedTools.includes(toolName);
|
|
14956
|
+
});
|
|
14957
|
+
}
|
|
14958
|
+
return mw;
|
|
14959
|
+
}
|
|
14960
|
+
async function createCommonMiddlewares(middlewareConfigs, filesystemBackend, fsIsExised, tenantId) {
|
|
14644
14961
|
const middlewares = [];
|
|
14645
14962
|
middlewares.push(createUnknownToolHandlerMiddleware());
|
|
14646
14963
|
middlewares.push(createModelSelectorMiddleware());
|
|
@@ -14650,17 +14967,26 @@ async function createCommonMiddlewares(middlewareConfigs, filesystemBackend, fsI
|
|
|
14650
14967
|
if (needsFilesystemBackend && filesystemBackend) {
|
|
14651
14968
|
if (!fsIsExised) {
|
|
14652
14969
|
const options = { backend: filesystemBackend };
|
|
14653
|
-
middlewares.push(
|
|
14970
|
+
middlewares.push(applyToolFilter(
|
|
14971
|
+
createFilesystemMiddleware(options),
|
|
14972
|
+
filesystemConfig?.allowedTools
|
|
14973
|
+
));
|
|
14654
14974
|
}
|
|
14655
14975
|
}
|
|
14656
14976
|
for (const config of middlewareConfigs) {
|
|
14657
14977
|
if (!config.enabled || config.type === "filesystem") continue;
|
|
14658
14978
|
switch (config.type) {
|
|
14659
14979
|
case "code_eval":
|
|
14660
|
-
middlewares.push(
|
|
14980
|
+
middlewares.push(applyToolFilter(
|
|
14981
|
+
createCodeEvalMiddleware(config.config),
|
|
14982
|
+
config.allowedTools
|
|
14983
|
+
));
|
|
14661
14984
|
break;
|
|
14662
14985
|
case "browser":
|
|
14663
|
-
middlewares.push(
|
|
14986
|
+
middlewares.push(applyToolFilter(
|
|
14987
|
+
createBrowserMiddleware(config.config),
|
|
14988
|
+
config.allowedTools
|
|
14989
|
+
));
|
|
14664
14990
|
break;
|
|
14665
14991
|
case "sql":
|
|
14666
14992
|
{
|
|
@@ -14673,21 +14999,30 @@ async function createCommonMiddlewares(middlewareConfigs, filesystemBackend, fsI
|
|
|
14673
14999
|
descriptions[db.key] = db.description || db.name || "";
|
|
14674
15000
|
}
|
|
14675
15001
|
}
|
|
14676
|
-
middlewares.push(
|
|
14677
|
-
|
|
14678
|
-
|
|
14679
|
-
|
|
15002
|
+
middlewares.push(applyToolFilter(
|
|
15003
|
+
createSqlMiddleware({
|
|
15004
|
+
databaseKeys: sqlConfig.databaseKeys,
|
|
15005
|
+
databaseDescriptions: descriptions
|
|
15006
|
+
}),
|
|
15007
|
+
config.allowedTools
|
|
15008
|
+
));
|
|
14680
15009
|
}
|
|
14681
15010
|
}
|
|
14682
15011
|
break;
|
|
14683
15012
|
case "skill":
|
|
14684
|
-
middlewares.push(
|
|
15013
|
+
middlewares.push(applyToolFilter(
|
|
15014
|
+
createSkillMiddleware(config.config),
|
|
15015
|
+
config.allowedTools
|
|
15016
|
+
));
|
|
14685
15017
|
break;
|
|
14686
15018
|
case "metrics":
|
|
14687
15019
|
{
|
|
14688
15020
|
const metricsConfig = config.config;
|
|
14689
15021
|
if (metricsConfig.connectAll || metricsConfig.serverKeys && metricsConfig.serverKeys.length > 0) {
|
|
14690
|
-
middlewares.push(
|
|
15022
|
+
middlewares.push(applyToolFilter(
|
|
15023
|
+
createMetricsMiddleware(metricsConfig),
|
|
15024
|
+
config.allowedTools
|
|
15025
|
+
));
|
|
14691
15026
|
}
|
|
14692
15027
|
}
|
|
14693
15028
|
break;
|
|
@@ -14695,36 +15030,57 @@ async function createCommonMiddlewares(middlewareConfigs, filesystemBackend, fsI
|
|
|
14695
15030
|
{
|
|
14696
15031
|
const collectionConfig = config.config;
|
|
14697
15032
|
if (collectionConfig.connectAll || collectionConfig.collectionKeys && collectionConfig.collectionKeys.length > 0) {
|
|
14698
|
-
middlewares.push(
|
|
15033
|
+
middlewares.push(applyToolFilter(
|
|
15034
|
+
createCollectionMiddleware(collectionConfig),
|
|
15035
|
+
config.allowedTools
|
|
15036
|
+
));
|
|
14699
15037
|
}
|
|
14700
15038
|
}
|
|
14701
15039
|
break;
|
|
14702
15040
|
case "ask_user_to_clarify":
|
|
14703
|
-
middlewares.push(
|
|
15041
|
+
middlewares.push(applyToolFilter(
|
|
15042
|
+
createAskUserClarifyMiddleware(),
|
|
15043
|
+
config.allowedTools
|
|
15044
|
+
));
|
|
14704
15045
|
break;
|
|
14705
15046
|
case "widget":
|
|
14706
|
-
middlewares.push(
|
|
15047
|
+
middlewares.push(applyToolFilter(
|
|
15048
|
+
createWidgetMiddleware(),
|
|
15049
|
+
config.allowedTools
|
|
15050
|
+
));
|
|
14707
15051
|
break;
|
|
14708
15052
|
case "claw":
|
|
14709
15053
|
if (filesystemBackend) {
|
|
14710
15054
|
const clawMiddlewareConfig = config.config;
|
|
14711
|
-
middlewares.push(
|
|
14712
|
-
|
|
14713
|
-
|
|
14714
|
-
|
|
14715
|
-
|
|
15055
|
+
middlewares.push(applyToolFilter(
|
|
15056
|
+
createClawMiddleware({
|
|
15057
|
+
backend: filesystemBackend,
|
|
15058
|
+
injectBootstrapFiles: clawMiddlewareConfig.injectBootstrapFiles ?? true,
|
|
15059
|
+
bootstrapFiles: clawMiddlewareConfig.bootstrapFiles ?? {}
|
|
15060
|
+
}),
|
|
15061
|
+
config.allowedTools
|
|
15062
|
+
));
|
|
14716
15063
|
} else {
|
|
14717
15064
|
console.warn("[claw middleware] Filesystem backend not available. Claw middleware requires filesystem backend to function.");
|
|
14718
15065
|
}
|
|
14719
15066
|
break;
|
|
14720
15067
|
case "date":
|
|
14721
|
-
middlewares.push(
|
|
15068
|
+
middlewares.push(applyToolFilter(
|
|
15069
|
+
createDateMiddleware(config.config),
|
|
15070
|
+
config.allowedTools
|
|
15071
|
+
));
|
|
14722
15072
|
break;
|
|
14723
15073
|
case "scheduler":
|
|
14724
|
-
middlewares.push(
|
|
15074
|
+
middlewares.push(applyToolFilter(
|
|
15075
|
+
createSchedulerMiddleware(config.config),
|
|
15076
|
+
config.allowedTools
|
|
15077
|
+
));
|
|
14725
15078
|
break;
|
|
14726
15079
|
case "task":
|
|
14727
|
-
middlewares.push(
|
|
15080
|
+
middlewares.push(applyToolFilter(
|
|
15081
|
+
createTaskMiddleware(),
|
|
15082
|
+
config.allowedTools
|
|
15083
|
+
));
|
|
14728
15084
|
break;
|
|
14729
15085
|
case "custom":
|
|
14730
15086
|
{
|
|
@@ -14732,8 +15088,20 @@ async function createCommonMiddlewares(middlewareConfigs, filesystemBackend, fsI
|
|
|
14732
15088
|
const { key: key4, ...rest } = customConfig;
|
|
14733
15089
|
const factory = CustomMiddlewareRegistry.get(key4);
|
|
14734
15090
|
if (factory) {
|
|
15091
|
+
if (rest.connections?.length && tenantId) {
|
|
15092
|
+
const resolved = (await Promise.all(
|
|
15093
|
+
rest.connections.map(async (connKey) => {
|
|
15094
|
+
const entry = await ConnectionRegistry.get(key4, connKey, tenantId);
|
|
15095
|
+
return entry ? { key: connKey, config: entry.config } : null;
|
|
15096
|
+
})
|
|
15097
|
+
)).filter(Boolean);
|
|
15098
|
+
rest._resolvedConnections = resolved;
|
|
15099
|
+
}
|
|
14735
15100
|
const middleware = factory(rest);
|
|
14736
|
-
middlewares.push(
|
|
15101
|
+
middlewares.push(applyToolFilter(
|
|
15102
|
+
middleware instanceof Promise ? await middleware : middleware,
|
|
15103
|
+
config.allowedTools
|
|
15104
|
+
));
|
|
14737
15105
|
} else {
|
|
14738
15106
|
console.warn(
|
|
14739
15107
|
`[custom middleware] No factory registered for key "${key4}". Use CustomMiddlewareRegistry.register("${key4}", factory) before building the agent.`
|
|
@@ -14741,6 +15109,30 @@ async function createCommonMiddlewares(middlewareConfigs, filesystemBackend, fsI
|
|
|
14741
15109
|
}
|
|
14742
15110
|
}
|
|
14743
15111
|
break;
|
|
15112
|
+
default:
|
|
15113
|
+
{
|
|
15114
|
+
const plugin = PluginRegistry.get(config.type);
|
|
15115
|
+
if (plugin?.middleware) {
|
|
15116
|
+
const pluginConfig = config.config;
|
|
15117
|
+
if (pluginConfig.connections?.length && tenantId) {
|
|
15118
|
+
const resolved = (await Promise.all(
|
|
15119
|
+
pluginConfig.connections.map(async (connKey) => {
|
|
15120
|
+
const entry = await ConnectionRegistry.get(config.type, connKey, tenantId);
|
|
15121
|
+
return entry ? { key: connKey, config: entry.config } : null;
|
|
15122
|
+
})
|
|
15123
|
+
)).filter(Boolean);
|
|
15124
|
+
pluginConfig._resolvedConnections = resolved;
|
|
15125
|
+
}
|
|
15126
|
+
const mw = plugin.middleware(pluginConfig);
|
|
15127
|
+
middlewares.push(applyToolFilter(
|
|
15128
|
+
mw instanceof Promise ? await mw : mw,
|
|
15129
|
+
config.allowedTools
|
|
15130
|
+
));
|
|
15131
|
+
} else {
|
|
15132
|
+
console.warn(`[commonMiddleware] Unknown middleware type "${config.type}" \u2014 skipping`);
|
|
15133
|
+
}
|
|
15134
|
+
}
|
|
15135
|
+
break;
|
|
14744
15136
|
}
|
|
14745
15137
|
}
|
|
14746
15138
|
return middlewares;
|
|
@@ -14924,8 +15316,8 @@ function createFilesystemBackendFactory(middlewareConfigs) {
|
|
|
14924
15316
|
|
|
14925
15317
|
// src/agent_lattice/builders/ReActAgentGraphBuilder.ts
|
|
14926
15318
|
var ReActAgentGraphBuilder = class {
|
|
14927
|
-
async createMiddlewares(middlewareConfigs) {
|
|
14928
|
-
return await createCommonMiddlewares(middlewareConfigs);
|
|
15319
|
+
async createMiddlewares(middlewareConfigs, tenantId) {
|
|
15320
|
+
return await createCommonMiddlewares(middlewareConfigs, void 0, void 0, tenantId);
|
|
14929
15321
|
}
|
|
14930
15322
|
/**
|
|
14931
15323
|
* 构建ReAct Agent Graph
|
|
@@ -14942,7 +15334,7 @@ var ReActAgentGraphBuilder = class {
|
|
|
14942
15334
|
const stateSchema2 = createReactAgentSchema(params.stateSchema);
|
|
14943
15335
|
const middlewareConfigs = params.middleware || [];
|
|
14944
15336
|
const filesystemBackend = createFilesystemBackendFactory(middlewareConfigs);
|
|
14945
|
-
const middlewares = await createCommonMiddlewares(middlewareConfigs, filesystemBackend);
|
|
15337
|
+
const middlewares = await createCommonMiddlewares(middlewareConfigs, filesystemBackend, void 0, params.tenantId);
|
|
14946
15338
|
return createAgent({
|
|
14947
15339
|
model: params.model,
|
|
14948
15340
|
tools,
|
|
@@ -17310,7 +17702,7 @@ var DeepAgentGraphBuilder = class {
|
|
|
17310
17702
|
}));
|
|
17311
17703
|
const middlewareConfigs = params.middleware || [];
|
|
17312
17704
|
const filesystemBackend = createFilesystemBackendFactory(middlewareConfigs);
|
|
17313
|
-
const middlewares = await createCommonMiddlewares(middlewareConfigs, filesystemBackend, true);
|
|
17705
|
+
const middlewares = await createCommonMiddlewares(middlewareConfigs, filesystemBackend, true, params.tenantId);
|
|
17314
17706
|
const deepAgent = createDeepAgent({
|
|
17315
17707
|
tools,
|
|
17316
17708
|
model: params.model,
|
|
@@ -19359,7 +19751,7 @@ var ProcessingAgentGraphBuilder = class {
|
|
|
19359
19751
|
}));
|
|
19360
19752
|
const middlewareConfigs = params.middleware || [];
|
|
19361
19753
|
const filesystemBackend = createFilesystemBackendFactory(middlewareConfigs);
|
|
19362
|
-
const middlewares = await createCommonMiddlewares(middlewareConfigs, filesystemBackend, true);
|
|
19754
|
+
const middlewares = await createCommonMiddlewares(middlewareConfigs, filesystemBackend, true, params.tenantId);
|
|
19363
19755
|
const topologyConfig = middlewareConfigs.find(
|
|
19364
19756
|
(m) => m.type === "topology" && m.enabled
|
|
19365
19757
|
);
|
|
@@ -19619,7 +20011,7 @@ var WorkflowAgentGraphBuilder = class {
|
|
|
19619
20011
|
const checkpointer = getCheckpointSaver("default");
|
|
19620
20012
|
const tools = params.tools.map((t) => t.executor).filter(Boolean);
|
|
19621
20013
|
const middlewareConfigs = params.middleware || [];
|
|
19622
|
-
const middlewares = await createCommonMiddlewares(middlewareConfigs, void 0, false);
|
|
20014
|
+
const middlewares = await createCommonMiddlewares(middlewareConfigs, void 0, false, params.tenantId);
|
|
19623
20015
|
const askMiddlewares = await createCommonMiddlewares([
|
|
19624
20016
|
{
|
|
19625
20017
|
id: "ask_user_to_clarify",
|
|
@@ -20051,6 +20443,10 @@ async function configureStores(stores, options = {}) {
|
|
|
20051
20443
|
}
|
|
20052
20444
|
storeLatticeManager.registerLattice("default", type, store);
|
|
20053
20445
|
}
|
|
20446
|
+
if (storeLatticeManager.hasLattice("default", "connection")) {
|
|
20447
|
+
const connectionStore = storeLatticeManager.getStoreLattice("default", "connection").store;
|
|
20448
|
+
ConnectionRegistry.setStore(connectionStore);
|
|
20449
|
+
}
|
|
20054
20450
|
if (schedule !== void 0) {
|
|
20055
20451
|
await initAndRegister(schedule, localDisposables);
|
|
20056
20452
|
const scheduleConfig = {
|
|
@@ -21287,6 +21683,53 @@ registerToolLattice(
|
|
|
21287
21683
|
}
|
|
21288
21684
|
}
|
|
21289
21685
|
);
|
|
21686
|
+
registerToolLattice(
|
|
21687
|
+
"list_middleware_types",
|
|
21688
|
+
{
|
|
21689
|
+
name: "list_middleware_types",
|
|
21690
|
+
description: "\u5217\u51FA\u5F53\u524D\u7CFB\u7EDF\u4E2D\u6240\u6709\u53EF\u7528\u7684\u4E2D\u95F4\u4EF6\u7C7B\u578B\uFF08Middlewares\uFF09\uFF0C\u5305\u62EC\u5185\u7F6E\u548C\u81EA\u5B9A\u4E49\u63D2\u4EF6\u3002\u8FD4\u56DE\u6BCF\u4E2A\u4E2D\u95F4\u4EF6\u7684 type\u3001name\u3001description\u3001tools \u6E05\u5355\uFF08\u652F\u6301 allowedTools \u8FC7\u6EE4\uFF09\u3001configSchema\uFF08\u914D\u7F6E\u9762\u677F\u9700\u8981\u54EA\u4E9B\u5B57\u6BB5\uFF09\u548C connectionSchema\uFF08\u662F\u5426\u652F\u6301\u8FDE\u63A5\u6D4B\u8BD5\u548C\u8D44\u6E90\u53D1\u73B0\uFF09\u3002\n\n\u4F7F\u7528\u573A\u666F\uFF1A\n1. \u5728\u521B\u5EFA agent \u524D\uFF0C\u5148\u8C03\u6B64\u5DE5\u5177\u4E86\u89E3\u6709\u54EA\u4E9B\u4E2D\u95F4\u4EF6\u53EF\u914D\u7F6E\n2. \u6839\u636E configSchema \u51B3\u5B9A\u9700\u8981\u63D0\u4F9B\u54EA\u4E9B\u914D\u7F6E\u5B57\u6BB5\uFF08\u5982 databaseKeys\u3001connections \u7B49\uFF09\n3. \u5982\u679C\u67D0\u4E2A\u4E2D\u95F4\u4EF6\u7684 connectionSchema \u5B58\u5728\uFF0C\u8BF4\u660E\u5B83\u662F\u8FDE\u63A5\u578B\u4E2D\u95F4\u4EF6\uFF0C\u9700\u8981\u518D\u8C03 list_connections \u83B7\u53D6\u53EF\u7528\u8FDE\u63A5\n4. \u7528\u8FD4\u56DE\u7684 type \u5B57\u6BB5\u6784\u5EFA middleware \u6570\u7EC4\u4F20\u7ED9 create_agent / update_agent",
|
|
21691
|
+
schema: z66.object({})
|
|
21692
|
+
},
|
|
21693
|
+
async () => {
|
|
21694
|
+
const metas = PluginRegistry.listMeta();
|
|
21695
|
+
return JSON.stringify(metas);
|
|
21696
|
+
}
|
|
21697
|
+
);
|
|
21698
|
+
registerToolLattice(
|
|
21699
|
+
"list_connections",
|
|
21700
|
+
{
|
|
21701
|
+
name: "list_connections",
|
|
21702
|
+
description: "\u5217\u51FA\u6307\u5B9A\u63D2\u4EF6\u7C7B\u578B\u7684\u6240\u6709\u5DF2\u914D\u7F6E\u8FDE\u63A5\u3002\u7528\u4E8E\u67E5\u8BE2\u6709\u54EA\u4E9B\u53EF\u7528\u7684\u8FDE\u63A5\u5B9E\u4F8B\uFF08\u5982 'sap-prod', 'sap-dev'\uFF09\uFF0C\u65B9\u4FBF\u5728 agent \u914D\u7F6E\u4E2D\u9009\u62E9\u5177\u4F53\u8FDE\u63A5\u3002\n\n\u4F7F\u7528\u573A\u666F\uFF1A\n1. \u5148\u8C03 list_middleware_types \u786E\u5B9A\u67D0\u4E2A\u4E2D\u95F4\u4EF6\u662F\u8FDE\u63A5\u578B\uFF08\u6709 connectionSchema\uFF09\n2. \u8C03\u6B64\u5DE5\u5177\u4F20\u5165 type\uFF08\u5982 'erp'\uFF09\uFF0C\u83B7\u53D6\u8BE5\u7C7B\u578B\u4E0B\u5DF2\u914D\u597D\u7684\u8FDE\u63A5\u5217\u8868\n3. \u5728 create_agent \u7684 middleware[i].config.connections \u4E2D\u586B\u5165\u5BF9\u5E94\u7684 key \u503C\n\n\u8FD4\u56DE\u683C\u5F0F\uFF1A{ success: true, data: { records: [{ key, name, ... }] } }",
|
|
21703
|
+
schema: z66.object({
|
|
21704
|
+
type: z66.string().describe("\u63D2\u4EF6\u7C7B\u578B\u6807\u8BC6\uFF0C\u5982 'erp'\u3002\u4ECE list_middleware_types \u7684\u8FD4\u56DE\u4E2D\u83B7\u53D6")
|
|
21705
|
+
}),
|
|
21706
|
+
needUserApprove: false
|
|
21707
|
+
},
|
|
21708
|
+
async (input, config) => {
|
|
21709
|
+
const tenantId = getTenantId(config);
|
|
21710
|
+
try {
|
|
21711
|
+
const entries = await ConnectionRegistry.list(input.type, tenantId);
|
|
21712
|
+
return JSON.stringify({
|
|
21713
|
+
success: true,
|
|
21714
|
+
data: {
|
|
21715
|
+
records: entries.map((e) => ({
|
|
21716
|
+
key: e.key,
|
|
21717
|
+
name: e.name,
|
|
21718
|
+
description: e.description,
|
|
21719
|
+
updatedAt: e.updatedAt
|
|
21720
|
+
})),
|
|
21721
|
+
total: entries.length
|
|
21722
|
+
}
|
|
21723
|
+
});
|
|
21724
|
+
} catch (error) {
|
|
21725
|
+
return JSON.stringify({
|
|
21726
|
+
success: false,
|
|
21727
|
+
error: error.message,
|
|
21728
|
+
hint: "\u8BF7\u786E\u8BA4 ConnectionStore \u5DF2\u914D\u7F6E\u4E14\u63D2\u4EF6\u7C7B\u578B\u6B63\u786E\u3002\u8C03\u7528 list_middleware_types \u67E5\u770B\u53EF\u7528\u7C7B\u578B\u3002"
|
|
21729
|
+
});
|
|
21730
|
+
}
|
|
21731
|
+
}
|
|
21732
|
+
);
|
|
21290
21733
|
|
|
21291
21734
|
// src/agent_lattice/agentArchitectConfig.ts
|
|
21292
21735
|
import { AgentType as AgentType5 } from "@axiom-lattice/protocols";
|
|
@@ -21606,101 +22049,29 @@ Returns: \`{ valid: boolean, stepCount, issues: [{ type: "error"|"warning", mess
|
|
|
21606
22049
|
|
|
21607
22050
|
### Middleware Config Reference
|
|
21608
22051
|
|
|
22052
|
+
**Always call \`list_middleware_types\` first** to see what middleware types are currently available, their config schemas, and whether they are connection-type middleware. The static list below may be outdated \u2014 the tool is the source of truth.
|
|
22053
|
+
|
|
21609
22054
|
Each middleware entry uses this base shape:
|
|
21610
22055
|
|
|
21611
22056
|
\`\`\`typescript
|
|
21612
22057
|
{
|
|
21613
22058
|
id: string, // Unique ID, usually same as type
|
|
21614
|
-
type: string, // Middleware type from
|
|
22059
|
+
type: string, // Middleware type from list_middleware_types
|
|
21615
22060
|
name: string, // Display name
|
|
21616
22061
|
description: string, // What this middleware provides
|
|
21617
22062
|
enabled: true, // Always true for active middleware
|
|
21618
|
-
config: { ... } // Type-specific config (see
|
|
22063
|
+
config: { ... } // Type-specific config (see list_middleware_types result)
|
|
21619
22064
|
}
|
|
21620
22065
|
\`\`\`
|
|
21621
22066
|
|
|
21622
|
-
|
|
21623
|
-
|
|
21624
|
-
|
|
21625
|
-
|
|
21626
|
-
|
|
21627
|
-
|
|
21628
|
-
|
|
21629
|
-
|
|
21630
|
-
Provides: \`run_code\` \u2014 execute Python/JavaScript in a sandbox
|
|
21631
|
-
| config field | type | description |
|
|
21632
|
-
|-------------|------|-------------|
|
|
21633
|
-
| vmIsolation | "agent" | "project" | "global" | Sandbox isolation level. Default recommended: \`"agent"\` |
|
|
21634
|
-
| timeout | number? | Execution timeout in milliseconds |
|
|
21635
|
-
| memoryLimit | number? | Memory limit in MB |
|
|
21636
|
-
|
|
21637
|
-
#### browser
|
|
21638
|
-
Provides: \`browser_navigate\`, \`browser_click\`, \`browser_screenshot\`, \`browser_get_markdown\`, etc. (21 tools)
|
|
21639
|
-
| config field | type | description |
|
|
21640
|
-
|-------------|------|-------------|
|
|
21641
|
-
| vmIsolation | "agent" | "project" | "global" | Sandbox isolation level. Default recommended: \`"agent"\` |
|
|
21642
|
-
| headless | boolean? | Whether to run in headless mode |
|
|
21643
|
-
|
|
21644
|
-
#### sql
|
|
21645
|
-
Provides: \`sql_list_tables\`, \`sql_table_info\`, \`sql_query_checker\`, \`sql_query\`
|
|
21646
|
-
| config field | type | description |
|
|
21647
|
-
|-------------|------|-------------|
|
|
21648
|
-
| databaseKeys | string[] | Array of database config keys to expose. Required. |
|
|
21649
|
-
| databaseDescriptions | Record<string,string>? | Optional human-readable descriptions keyed by database key |
|
|
21650
|
-
|
|
21651
|
-
#### skill
|
|
21652
|
-
Provides: \`load_skill_content\` \u2014 load and read detailed skill instructions
|
|
21653
|
-
| config field | type | description |
|
|
21654
|
-
|-------------|------|-------------|
|
|
21655
|
-
| skills | string[]? | List of specific skill IDs to expose |
|
|
21656
|
-
| readAll | boolean? | When \`true\`, all available skills are exposed (recommended) |
|
|
21657
|
-
| heading | string? | Optional heading for the skills section |
|
|
21658
|
-
| extraNote | string? | Optional extra note appended after skills list |
|
|
21659
|
-
|
|
21660
|
-
#### metrics
|
|
21661
|
-
Provides: \`list_datasources\`, \`query_metrics_list\`, \`query_semantic_metric_data\`, \`query_tables_list\`, \`execute_sql_query\`, etc. (7 tools)
|
|
21662
|
-
| config field | type | description |
|
|
21663
|
-
|-------------|------|-------------|
|
|
21664
|
-
| serverKeys | string[] | List of metrics server keys. Required. |
|
|
21665
|
-
| serverDescriptions | Record<string,string>? | Optional descriptions for each server |
|
|
21666
|
-
| connectAll | boolean? | When \`true\`, connects to all available metrics servers automatically |
|
|
21667
|
-
|
|
21668
|
-
#### ask_user_to_clarify
|
|
21669
|
-
Provides: \`ask_user_to_clarify\` \u2014 pause execution and present questions with predefined options to the user. The agent halts until the user responds, then receives the answers as structured data.
|
|
21670
|
-
**Use this when:** the agent needs to confirm an action, get user approval, ask "which one?", or gather missing parameters. Without this middleware, the agent CANNOT interact with the user mid-execution.
|
|
21671
|
-
Config: \`{}\` \u2014 no configuration needed.
|
|
21672
|
-
|
|
21673
|
-
#### widget
|
|
21674
|
-
Provides: \`load_guidelines\`, \`show_widget\` \u2014 render interactive HTML widgets and SVG diagrams
|
|
21675
|
-
Config: \`{}\` \u2014 no configuration needed.
|
|
21676
|
-
|
|
21677
|
-
#### claw
|
|
21678
|
-
Provides: bootstrap file management (AGENTS.md, SOUL.md, etc.) \u2014 injects project context into system prompt
|
|
21679
|
-
| config field | type | description |
|
|
21680
|
-
|-------------|------|-------------|
|
|
21681
|
-
| injectBootstrapFiles | boolean? | Whether to inject bootstrap files into system prompt. Default: \`true\` |
|
|
21682
|
-
| bootstrapFiles | object? | Custom content for each bootstrap file |
|
|
21683
|
-
|
|
21684
|
-
\`bootstrapFiles\` sub-fields: \`agents\`, \`soul\`, \`identity\`, \`user\`, \`tools\`, \`bootstrap\` \u2014 each is an optional string.
|
|
21685
|
-
|
|
21686
|
-
#### date
|
|
21687
|
-
Provides: \`get_current_date_time\` \u2014 get current date and time
|
|
21688
|
-
| config field | type | description |
|
|
21689
|
-
|-------------|------|-------------|
|
|
21690
|
-
| timezone | string? | IANA timezone like \`"Asia/Shanghai"\` or \`"America/New_York"\`. Default: \`"UTC"\` |
|
|
21691
|
-
|
|
21692
|
-
#### scheduler
|
|
21693
|
-
Provides: \`schedule_at\`, \`schedule_after\`, \`schedule_recurring\`, \`cancel_scheduled_task\`, \`list_scheduled_tasks\`
|
|
21694
|
-
| config field | type | description |
|
|
21695
|
-
|-------------|------|-------------|
|
|
21696
|
-
| defaultMaxRetries | number? | Default max retries for scheduled tasks. Default: \`0\` |
|
|
21697
|
-
|
|
21698
|
-
#### topology [DEPRECATED \u2014 use WORKFLOW DSL instead]
|
|
21699
|
-
Provides: \`read_topo_progress\` \u2014 enforces multi-agent workflow topology for PROCESSING agents only. Not needed for WORKFLOW agents.
|
|
21700
|
-
| config field | type | description |
|
|
21701
|
-
|-------------|------|-------------|
|
|
21702
|
-
| edges | TopologyEdge[] | **Required.** Directed edges: \`{ from: string, to: string, purpose: string }\`. The \`purpose\` must describe the business intent of this delegation step. |
|
|
21703
|
-
| trackingStore | object? | Optional persistence for workflow run tracking | |
|
|
22067
|
+
**Connection-type middleware** (those with \`connectionSchema\` in list_middleware_types output):
|
|
22068
|
+
1. Call \`list_connections(type="xxx")\` to see available connection keys
|
|
22069
|
+
2. Use the returned keys in \`config.connections: ["sap-prod", "sap-dev"]\`
|
|
22070
|
+
|
|
22071
|
+
**Tool filtering:** Use \`allowedTools\` to restrict which tools a middleware exposes:
|
|
22072
|
+
\`\`\`typescript
|
|
22073
|
+
{ type: "browser", enabled: true, config: {}, allowedTools: ["browser_navigate", "browser_screenshot"] }
|
|
22074
|
+
\`\`\`
|
|
21704
22075
|
|
|
21705
22076
|
### When to use ask_user_to_clarify Middleware
|
|
21706
22077
|
|
|
@@ -21723,19 +22094,6 @@ Provides: \`read_topo_progress\` \u2014 enforces multi-agent workflow topology f
|
|
|
21723
22094
|
|
|
21724
22095
|
**Design rule:** If your agent's system prompt says anything like "confirm with the user before...", "ask the user to choose...", or "get approval for...", you MUST include the \`ask_user_to_clarify\` middleware.
|
|
21725
22096
|
|
|
21726
|
-
### Quick Pick: Common Middleware Combos
|
|
21727
|
-
|
|
21728
|
-
| Agent Role | Recommended Middleware |
|
|
21729
|
-
|-----------|----------------------|
|
|
21730
|
-
| Code assistant | code_eval, widget |
|
|
21731
|
-
| Data analyst | sql, code_eval, widget |
|
|
21732
|
-
| Web researcher | browser, widget |
|
|
21733
|
-
| Operations / SRE | metrics, sql, widget |
|
|
21734
|
-
| Process orchestrator | skill, date, scheduler, widget |
|
|
21735
|
-
| General assistant | date, widget |
|
|
21736
|
-
| Approval-gated operations | ask_user_to_clarify, widget |
|
|
21737
|
-
| Interactive Q&A | ask_user_to_clarify, date, widget |
|
|
21738
|
-
|
|
21739
22097
|
### manage_binding Reference
|
|
21740
22098
|
|
|
21741
22099
|
Use \`manage_binding\` to bind external senders (email, Lark, Slack) to agents. A binding routes inbound messages from the sender to the specified agent.
|
|
@@ -21866,6 +22224,8 @@ var agentArchitectConfig = {
|
|
|
21866
22224
|
tools: [
|
|
21867
22225
|
"list_agents",
|
|
21868
22226
|
"list_tools",
|
|
22227
|
+
"list_middleware_types",
|
|
22228
|
+
"list_connections",
|
|
21869
22229
|
"get_agent",
|
|
21870
22230
|
"create_agent",
|
|
21871
22231
|
"create_workflow",
|
|
@@ -25032,7 +25392,9 @@ function generateToken() {
|
|
|
25032
25392
|
function createSharePayload(tenantId, workspaceId, projectId, userId, request) {
|
|
25033
25393
|
const resourcePath = (request.resourcePath || "").replace(/^\/?project\/?/, "").replace(/\/+$/, "");
|
|
25034
25394
|
if (!resourcePath || resourcePath === "/") {
|
|
25035
|
-
|
|
25395
|
+
if (request.visibility !== "internal") {
|
|
25396
|
+
throw new Error("Cannot share project root \u2014 share a subdirectory or file instead");
|
|
25397
|
+
}
|
|
25036
25398
|
}
|
|
25037
25399
|
return {
|
|
25038
25400
|
address: createResourceAddress({
|
|
@@ -25159,6 +25521,28 @@ function clearEncryptionKeyCache() {
|
|
|
25159
25521
|
keyValidated = false;
|
|
25160
25522
|
}
|
|
25161
25523
|
|
|
25524
|
+
// src/plugin/BuiltinPlugins.ts
|
|
25525
|
+
var BUILTIN_PLUGINS = [
|
|
25526
|
+
filesystemPlugin,
|
|
25527
|
+
codeEvalPlugin,
|
|
25528
|
+
browserPlugin,
|
|
25529
|
+
sqlPlugin,
|
|
25530
|
+
skillPlugin,
|
|
25531
|
+
metricsPlugin,
|
|
25532
|
+
askUserClarifyPlugin,
|
|
25533
|
+
widgetPlugin,
|
|
25534
|
+
clawPlugin,
|
|
25535
|
+
datePlugin,
|
|
25536
|
+
schedulerPlugin,
|
|
25537
|
+
taskPlugin,
|
|
25538
|
+
collectionPlugin
|
|
25539
|
+
];
|
|
25540
|
+
function registerBuiltinPlugins() {
|
|
25541
|
+
for (const plugin of BUILTIN_PLUGINS) {
|
|
25542
|
+
PluginRegistry.register(plugin);
|
|
25543
|
+
}
|
|
25544
|
+
}
|
|
25545
|
+
|
|
25162
25546
|
// src/personal_assistant/PersonalAssistantConfig.ts
|
|
25163
25547
|
function deepClone(obj) {
|
|
25164
25548
|
return JSON.parse(JSON.stringify(obj));
|
|
@@ -25309,6 +25693,9 @@ var PersonalAssistantConfig = class {
|
|
|
25309
25693
|
}
|
|
25310
25694
|
};
|
|
25311
25695
|
PersonalAssistantConfig._config = deepClone(DEFAULT_CONFIG);
|
|
25696
|
+
|
|
25697
|
+
// src/index.ts
|
|
25698
|
+
registerBuiltinPlugins();
|
|
25312
25699
|
export {
|
|
25313
25700
|
AGENT_TASK_EVENT,
|
|
25314
25701
|
Agent,
|
|
@@ -25316,11 +25703,13 @@ export {
|
|
|
25316
25703
|
AgentLatticeManager,
|
|
25317
25704
|
AgentManager,
|
|
25318
25705
|
AgentType,
|
|
25706
|
+
BUILTIN_PLUGINS,
|
|
25319
25707
|
BUILTIN_SKILLS,
|
|
25320
25708
|
ChunkBuffer,
|
|
25321
25709
|
ChunkBufferLatticeManager,
|
|
25322
25710
|
CollectionLatticeManager,
|
|
25323
25711
|
CompositeBackend,
|
|
25712
|
+
ConnectionRegistry,
|
|
25324
25713
|
ConsoleLoggerClient,
|
|
25325
25714
|
CustomMetricsClient,
|
|
25326
25715
|
CustomMiddlewareRegistry,
|
|
@@ -25370,6 +25759,7 @@ export {
|
|
|
25370
25759
|
MysqlDatabase,
|
|
25371
25760
|
PersonalAssistantConfig,
|
|
25372
25761
|
PinoLoggerClient,
|
|
25762
|
+
PluginRegistry,
|
|
25373
25763
|
PostgresDatabase,
|
|
25374
25764
|
PrometheusClient,
|
|
25375
25765
|
Protocols,
|
|
@@ -25532,6 +25922,7 @@ export {
|
|
|
25532
25922
|
sandboxLatticeManager,
|
|
25533
25923
|
sanitizeToolCallId,
|
|
25534
25924
|
scheduleLatticeManager,
|
|
25925
|
+
serializePluginMeta,
|
|
25535
25926
|
setBindingRegistry,
|
|
25536
25927
|
setMenuRegistry,
|
|
25537
25928
|
skillLatticeManager,
|