@axiom-lattice/core 2.1.95 → 2.1.97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -7081,6 +7081,31 @@ 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
+ title: "Code Evaluation Configuration",
7092
+ description: "Configure code execution sandbox settings",
7093
+ required: ["vmIsolation"],
7094
+ properties: {
7095
+ vmIsolation: {
7096
+ type: "string",
7097
+ title: "VM Isolation",
7098
+ description: "Controls how code execution is isolated between agents and projects",
7099
+ enum: ["global", "agent", "project"],
7100
+ default: "global",
7101
+ widget: "segmented"
7102
+ }
7103
+ }
7104
+ },
7105
+ defaultConfig: { vmIsolation: "global" }
7106
+ },
7107
+ middleware: (cfg) => createCodeEvalMiddleware(cfg)
7108
+ };
7084
7109
 
7085
7110
  // src/middlewares/browserMiddleware.ts
7086
7111
  import { createMiddleware as createMiddleware2 } from "langchain";
@@ -7116,6 +7141,31 @@ function createBrowserMiddleware(params = { vmIsolation: "agent" }) {
7116
7141
  tools
7117
7142
  });
7118
7143
  }
7144
+ var browserPlugin = {
7145
+ meta: {
7146
+ type: "browser",
7147
+ name: "Browser",
7148
+ description: "Provides browser automation capabilities",
7149
+ configSchema: {
7150
+ type: "object",
7151
+ title: "Browser Configuration",
7152
+ description: "Configure browser automation settings",
7153
+ required: ["vmIsolation"],
7154
+ properties: {
7155
+ vmIsolation: {
7156
+ type: "string",
7157
+ title: "VM Isolation",
7158
+ description: "Controls how browser instances are isolated between agents and projects",
7159
+ enum: ["global", "agent", "project"],
7160
+ default: "agent",
7161
+ widget: "segmented"
7162
+ }
7163
+ }
7164
+ },
7165
+ defaultConfig: { headless: true, vmIsolation: "agent" }
7166
+ },
7167
+ middleware: (cfg) => createBrowserMiddleware(cfg)
7168
+ };
7119
7169
 
7120
7170
  // src/middlewares/sqlMiddleware.ts
7121
7171
  import { createMiddleware as createMiddleware3 } from "langchain";
@@ -7142,6 +7192,36 @@ function createSqlMiddleware(params) {
7142
7192
  ]
7143
7193
  });
7144
7194
  }
7195
+ var sqlPlugin = {
7196
+ meta: {
7197
+ type: "sql",
7198
+ name: "SQL Database",
7199
+ description: "Provides SQL database query capabilities",
7200
+ tools: [
7201
+ { name: "list_tables_sql", description: "List all tables in a database" },
7202
+ { name: "info_sql", description: "Get information about a database connection" },
7203
+ { name: "query_checker_sql", description: "Check a SQL query for correctness" },
7204
+ { name: "query_sql", description: "Execute a SQL query" }
7205
+ ],
7206
+ configSchema: {
7207
+ type: "object",
7208
+ title: "SQL Configuration",
7209
+ description: "Configure database connection settings",
7210
+ required: ["databaseKeys"],
7211
+ properties: {
7212
+ databaseKeys: {
7213
+ type: "array",
7214
+ title: "Select Databases",
7215
+ description: "Select databases this agent can access (multi-select from registered databases)",
7216
+ items: { type: "string" },
7217
+ widget: "databaseSelect"
7218
+ }
7219
+ }
7220
+ },
7221
+ defaultConfig: { databaseKeys: [] }
7222
+ },
7223
+ middleware: (cfg) => createSqlMiddleware(cfg)
7224
+ };
7145
7225
 
7146
7226
  // src/middlewares/skillMiddleware.ts
7147
7227
  import { createMiddleware as createMiddleware4 } from "langchain";
@@ -7842,12 +7922,23 @@ Response: \`{"message":"Hello, Simon!"}\`
7842
7922
  From your frontend JS, call the API using relative paths:
7843
7923
 
7844
7924
  \`\`\`js
7845
- // main.js
7925
+ // main.js \u2014 GET
7846
7926
  const res = await fetch(\`./api/hello.js?name=\${name}\`);
7847
7927
  const data = await res.json();
7848
7928
  console.log(data.message);
7929
+
7930
+ // POST with JSON body
7931
+ await fetch("./api/hello.js", {
7932
+ method: "POST",
7933
+ body: JSON.stringify({ title: "New Task", done: false }),
7934
+ });
7935
+
7936
+ // PUT / DELETE \u2014 same pattern
7937
+ await fetch("./api/hello.js", { method: "PUT", body: JSON.stringify({ id: 1, title: "Updated" }) });
7938
+ await fetch("./api/hello.js", { method: "DELETE", body: JSON.stringify({ id: 1 }) });
7849
7939
  \`\`\`
7850
7940
 
7941
+ The API receives the body as \`API_BODY\` env var (raw string), method as \`API_METHOD\`.
7851
7942
  The \`<base>\` tag injected into HTML ensures relative URLs resolve through the share proxy.
7852
7943
 
7853
7944
  ## 4. File Upload
@@ -8134,6 +8225,39 @@ ${skillsPrompt}
8134
8225
  }
8135
8226
  });
8136
8227
  }
8228
+ var skillPlugin = {
8229
+ meta: {
8230
+ type: "skill",
8231
+ name: "Skills",
8232
+ description: "Provides skill loading capabilities for the agent",
8233
+ configSchema: {
8234
+ type: "object",
8235
+ title: "Skills Configuration",
8236
+ description: "Configure which skills this agent can use",
8237
+ properties: {
8238
+ readAll: {
8239
+ type: "boolean",
8240
+ title: "Read All Skills",
8241
+ description: "When enabled, the agent will have access to all available skills automatically",
8242
+ default: false,
8243
+ widget: "switch"
8244
+ },
8245
+ skills: {
8246
+ type: "array",
8247
+ title: "Select Skills",
8248
+ description: "Select which skills this agent can use (ignored if 'Read All Skills' is enabled)",
8249
+ items: { type: "string" },
8250
+ widget: "skillSelect"
8251
+ }
8252
+ }
8253
+ },
8254
+ defaultConfig: {
8255
+ readAll: false,
8256
+ skills: []
8257
+ }
8258
+ },
8259
+ middleware: (cfg) => createSkillMiddleware(cfg)
8260
+ };
8137
8261
 
8138
8262
  // src/deep_agent_new/middleware/fs.ts
8139
8263
  import { createMiddleware as createMiddleware5, tool as tool40, ToolMessage } from "langchain";
@@ -9001,6 +9125,31 @@ ${systemPrompt}` : systemPrompt;
9001
9125
  }) : void 0
9002
9126
  });
9003
9127
  }
9128
+ var filesystemPlugin = {
9129
+ meta: {
9130
+ type: "filesystem",
9131
+ name: "Filesystem",
9132
+ description: "Provides file system operations for reading, writing, and managing files",
9133
+ configSchema: {
9134
+ type: "object",
9135
+ title: "Filesystem Configuration",
9136
+ description: "Configure filesystem isolation and access settings",
9137
+ required: ["vmIsolation"],
9138
+ properties: {
9139
+ vmIsolation: {
9140
+ type: "string",
9141
+ title: "VM Isolation",
9142
+ description: "Controls how filesystem access is isolated between agents and projects",
9143
+ enum: ["global", "agent", "project"],
9144
+ default: "global",
9145
+ widget: "segmented"
9146
+ }
9147
+ }
9148
+ },
9149
+ defaultConfig: { vmIsolation: "global" }
9150
+ },
9151
+ middleware: (cfg) => createFilesystemMiddleware(cfg)
9152
+ };
9004
9153
 
9005
9154
  // src/middlewares/metricsMiddleware.ts
9006
9155
  import { createMiddleware as createMiddleware6 } from "langchain";
@@ -9035,6 +9184,45 @@ function createMetricsMiddleware(params) {
9035
9184
  ]
9036
9185
  });
9037
9186
  }
9187
+ var metricsPlugin = {
9188
+ meta: {
9189
+ type: "metrics",
9190
+ name: "Metrics",
9191
+ description: "Provides metrics querying capabilities",
9192
+ tools: [
9193
+ { name: "list_datasources", description: "List all datasources from all configured servers" },
9194
+ { name: "query_metrics_list", description: "Query available metrics from datasources" },
9195
+ { name: "query_metric_definition", description: "Get detailed definition of a specific metric" },
9196
+ { name: "query_semantic_metric_data", description: "Query actual metric data" },
9197
+ { name: "query_tables_list", description: "Query available tables from datasources" },
9198
+ { name: "query_table_definition", description: "Get detailed definition of a specific table" },
9199
+ { name: "execute_sql_query", description: "Execute custom SQL queries" }
9200
+ ],
9201
+ configSchema: {
9202
+ type: "object",
9203
+ title: "Metrics Configuration",
9204
+ description: "Configure metrics server access settings",
9205
+ properties: {
9206
+ connectAll: {
9207
+ type: "boolean",
9208
+ title: "Connect All Servers",
9209
+ description: "When enabled, the agent will connect to all available metrics servers automatically",
9210
+ default: false,
9211
+ widget: "switch"
9212
+ },
9213
+ serverKeys: {
9214
+ type: "array",
9215
+ title: "Select Metrics Servers",
9216
+ description: "Select metrics servers this agent can query (ignored if 'Connect All Servers' is enabled)",
9217
+ items: { type: "string" },
9218
+ widget: "metricsSelect"
9219
+ }
9220
+ }
9221
+ },
9222
+ defaultConfig: { connectAll: false, serverKeys: [] }
9223
+ },
9224
+ middleware: (cfg) => createMetricsMiddleware(cfg)
9225
+ };
9038
9226
 
9039
9227
  // src/middlewares/collectionMiddleware.ts
9040
9228
  import { createMiddleware as createMiddleware7 } from "langchain";
@@ -9618,6 +9806,48 @@ function createCollectionMiddleware(params) {
9618
9806
  ]
9619
9807
  });
9620
9808
  }
9809
+ var collectionPlugin = {
9810
+ meta: {
9811
+ type: "collection",
9812
+ name: "Collection",
9813
+ description: "Provides vector search and CRUD access to knowledge collections",
9814
+ tools: [
9815
+ { name: "list_collections", description: "List all available collections" },
9816
+ { name: "search_collection", description: "Search for documents in a collection" },
9817
+ { name: "get_collection", description: "Get a specific collection's details" },
9818
+ { name: "list_entries", description: "List entries in a collection" },
9819
+ { name: "create_collection", description: "Create a new collection" },
9820
+ { name: "update_collection", description: "Update an existing collection" },
9821
+ { name: "delete_collection", description: "Delete a collection" },
9822
+ { name: "add_entry", description: "Add an entry to a collection" },
9823
+ { name: "update_entry", description: "Update an entry in a collection" },
9824
+ { name: "delete_entry", description: "Delete an entry from a collection" }
9825
+ ],
9826
+ configSchema: {
9827
+ type: "object",
9828
+ title: "Collection Configuration",
9829
+ description: "Configure collection access for this agent",
9830
+ properties: {
9831
+ connectAll: {
9832
+ type: "boolean",
9833
+ title: "Connect All Collections",
9834
+ description: "When enabled, the agent will have access to all collections automatically",
9835
+ default: false,
9836
+ widget: "switch"
9837
+ },
9838
+ collectionKeys: {
9839
+ type: "array",
9840
+ title: "Select Collections",
9841
+ description: "Select which collections this agent can access",
9842
+ items: { type: "string" },
9843
+ widget: "collectionSelect"
9844
+ }
9845
+ }
9846
+ },
9847
+ defaultConfig: { connectAll: false, collectionKeys: [] }
9848
+ },
9849
+ middleware: (cfg) => createCollectionMiddleware(cfg)
9850
+ };
9621
9851
 
9622
9852
  // src/middlewares/askUserClarifyMiddleware.ts
9623
9853
  import { createMiddleware as createMiddleware8, ToolMessage as ToolMessage2 } from "langchain";
@@ -9738,6 +9968,21 @@ function createAskUserClarifyMiddleware() {
9738
9968
  }
9739
9969
  });
9740
9970
  }
9971
+ var askUserClarifyPlugin = {
9972
+ meta: {
9973
+ type: "ask_user_to_clarify",
9974
+ name: "Ask User To Clarify",
9975
+ description: "Enables the agent to ask users clarifying questions",
9976
+ configSchema: {
9977
+ type: "object",
9978
+ title: "Ask User To Clarify Configuration",
9979
+ description: "Configure user clarification settings",
9980
+ properties: {}
9981
+ },
9982
+ defaultConfig: {}
9983
+ },
9984
+ middleware: () => createAskUserClarifyMiddleware()
9985
+ };
9741
9986
 
9742
9987
  // src/middlewares/widgetMiddleware.ts
9743
9988
  import { createMiddleware as createMiddleware9 } from "langchain";
@@ -10628,6 +10873,21 @@ function createWidgetMiddleware() {
10628
10873
  tools
10629
10874
  });
10630
10875
  }
10876
+ var widgetPlugin = {
10877
+ meta: {
10878
+ type: "widget",
10879
+ name: "Widget",
10880
+ description: "Enables the agent to render interactive HTML widgets",
10881
+ configSchema: {
10882
+ type: "object",
10883
+ title: "Widget Configuration",
10884
+ description: "Configure widget rendering capabilities (zero configuration required)",
10885
+ properties: {}
10886
+ },
10887
+ defaultConfig: {}
10888
+ },
10889
+ middleware: () => createWidgetMiddleware()
10890
+ };
10631
10891
 
10632
10892
  // src/middlewares/modelSelectorMiddleware.ts
10633
10893
  import { createMiddleware as createMiddleware10 } from "langchain";
@@ -11243,6 +11503,31 @@ ${startupSections.join("\n\n")}
11243
11503
  }
11244
11504
  });
11245
11505
  }
11506
+ var clawPlugin = {
11507
+ meta: {
11508
+ type: "claw",
11509
+ name: "Memory",
11510
+ description: "Injects and manages memory/bootstrap files in the runtime workspace",
11511
+ configSchema: {
11512
+ type: "object",
11513
+ title: "Memory Configuration",
11514
+ description: "Configure bootstrap file injection behavior",
11515
+ properties: {
11516
+ injectBootstrapFiles: {
11517
+ type: "boolean",
11518
+ title: "Inject Bootstrap Files",
11519
+ description: "Automatically inject default bootstrap files into the workspace context",
11520
+ default: true,
11521
+ widget: "switch"
11522
+ }
11523
+ }
11524
+ },
11525
+ defaultConfig: {
11526
+ injectBootstrapFiles: true
11527
+ }
11528
+ },
11529
+ middleware: (cfg) => createClawMiddleware(cfg)
11530
+ };
11246
11531
 
11247
11532
  // src/middlewares/unknownToolHandlerMiddleware.ts
11248
11533
  import { createMiddleware as createMiddleware12 } from "langchain";
@@ -11431,6 +11716,53 @@ ${currentSystemPrompt}` : dateContext;
11431
11716
  }
11432
11717
  });
11433
11718
  }
11719
+ var datePlugin = {
11720
+ meta: {
11721
+ type: "date",
11722
+ name: "Current Date",
11723
+ description: "Injects the current date into the agent system prompt",
11724
+ configSchema: {
11725
+ type: "object",
11726
+ title: "Date Configuration",
11727
+ description: "Configure timezone for the current date",
11728
+ properties: {
11729
+ timezone: {
11730
+ type: "string",
11731
+ title: "Timezone",
11732
+ description: "Select timezone for displaying the current date",
11733
+ default: "UTC",
11734
+ enumLabels: {
11735
+ "UTC": "UTC (Coordinated Universal Time)",
11736
+ "America/New_York": "New York (EST/EDT)",
11737
+ "America/Chicago": "Chicago (CST/CDT)",
11738
+ "America/Denver": "Denver (MST/MDT)",
11739
+ "America/Los_Angeles": "Los Angeles (PST/PDT)",
11740
+ "America/Toronto": "Toronto (EST/EDT)",
11741
+ "America/Sao_Paulo": "S\xE3o Paulo (BRT)",
11742
+ "Europe/London": "London (GMT/BST)",
11743
+ "Europe/Paris": "Paris (CET/CEST)",
11744
+ "Europe/Berlin": "Berlin (CET/CEST)",
11745
+ "Europe/Moscow": "Moscow (MSK)",
11746
+ "Asia/Dubai": "Dubai (GST)",
11747
+ "Asia/Kolkata": "Kolkata (IST)",
11748
+ "Asia/Shanghai": "Shanghai (CST)",
11749
+ "Asia/Hong_Kong": "Hong Kong (HKT)",
11750
+ "Asia/Singapore": "Singapore (SGT)",
11751
+ "Asia/Tokyo": "Tokyo (JST)",
11752
+ "Asia/Seoul": "Seoul (KST)",
11753
+ "Australia/Sydney": "Sydney (AEDT/AEST)",
11754
+ "Pacific/Auckland": "Auckland (NZDT/NZST)"
11755
+ },
11756
+ widget: "select"
11757
+ }
11758
+ }
11759
+ },
11760
+ defaultConfig: {
11761
+ timezone: "UTC"
11762
+ }
11763
+ },
11764
+ middleware: (cfg) => createDateMiddleware(cfg)
11765
+ };
11434
11766
 
11435
11767
  // src/deep_agent_new/middleware/scheduler.ts
11436
11768
  import { tool as tool55, createMiddleware as createMiddleware14 } from "langchain";
@@ -14447,6 +14779,32 @@ function createSchedulerMiddleware(options = {}) {
14447
14779
  ]
14448
14780
  });
14449
14781
  }
14782
+ var schedulerPlugin = {
14783
+ meta: {
14784
+ type: "scheduler",
14785
+ name: "Scheduler",
14786
+ description: "Enables the agent to schedule future work",
14787
+ configSchema: {
14788
+ type: "object",
14789
+ title: "Scheduler Configuration",
14790
+ description: "Configure retry behavior for scheduled tasks",
14791
+ properties: {
14792
+ defaultMaxRetries: {
14793
+ type: "integer",
14794
+ title: "Default Max Retries",
14795
+ description: "Default retry count for scheduled tasks created through the middleware",
14796
+ default: 0,
14797
+ minimum: 0,
14798
+ widget: "numberInput"
14799
+ }
14800
+ }
14801
+ },
14802
+ defaultConfig: {
14803
+ defaultMaxRetries: 0
14804
+ }
14805
+ },
14806
+ middleware: (cfg) => createSchedulerMiddleware(cfg)
14807
+ };
14450
14808
 
14451
14809
  // src/middlewares/taskMiddleware.ts
14452
14810
  import { createMiddleware as createMiddleware15, tool as tool56 } from "langchain";
@@ -14579,28 +14937,128 @@ function createTaskMiddleware() {
14579
14937
  ]
14580
14938
  });
14581
14939
  }
14940
+ var taskPlugin = {
14941
+ meta: {
14942
+ type: "task",
14943
+ name: "Task Management",
14944
+ description: "Enables persistent task management with delegation and tracking",
14945
+ configSchema: {
14946
+ type: "object",
14947
+ title: "Task Management Configuration",
14948
+ description: "Zero-configuration task management",
14949
+ properties: {}
14950
+ },
14951
+ defaultConfig: {}
14952
+ },
14953
+ middleware: () => createTaskMiddleware()
14954
+ };
14955
+
14956
+ // src/plugin/metaSerializer.ts
14957
+ function tryExtractTools(plugin) {
14958
+ if (!plugin.middleware) return [];
14959
+ try {
14960
+ const result = plugin.middleware({});
14961
+ if (result instanceof Promise) return [];
14962
+ const mw = result;
14963
+ if (Array.isArray(mw.tools)) {
14964
+ return mw.tools.map((t) => ({
14965
+ name: t.name || "",
14966
+ description: t.description || ""
14967
+ }));
14968
+ }
14969
+ } catch {
14970
+ }
14971
+ return [];
14972
+ }
14973
+ function serializePluginMeta(plugin) {
14974
+ const meta = {
14975
+ type: plugin.meta.type,
14976
+ name: plugin.meta.name,
14977
+ description: plugin.meta.description,
14978
+ version: plugin.meta.version,
14979
+ source: plugin.meta.source,
14980
+ icon: plugin.meta.icon,
14981
+ tools: plugin.meta.tools ?? tryExtractTools(plugin),
14982
+ configSchema: plugin.meta.configSchema,
14983
+ defaultConfig: plugin.meta.defaultConfig
14984
+ };
14985
+ if (plugin.connection) {
14986
+ meta.connectionSchema = {
14987
+ fields: plugin.connection.fields,
14988
+ hasTest: typeof plugin.connection.test === "function",
14989
+ hasDiscover: typeof plugin.connection.discover === "function",
14990
+ resourceLabel: plugin.connection.resourceLabel
14991
+ };
14992
+ }
14993
+ return meta;
14994
+ }
14995
+
14996
+ // src/plugin/PluginRegistry.ts
14997
+ var PluginRegistry = class {
14998
+ /** Register a plugin (overwrites if type conflicts) */
14999
+ static register(plugin) {
15000
+ const key4 = plugin.meta.type;
15001
+ if (this.plugins.has(key4)) {
15002
+ console.warn(`[PluginRegistry] "${key4}" overwritten`);
15003
+ }
15004
+ this.plugins.set(key4, plugin);
15005
+ }
15006
+ /** Unregister */
15007
+ static unregister(key4) {
15008
+ return this.plugins.delete(key4);
15009
+ }
15010
+ /** Get plugin instance */
15011
+ static get(key4) {
15012
+ return this.plugins.get(key4);
15013
+ }
15014
+ /** Check if registered */
15015
+ static has(key4) {
15016
+ return this.plugins.has(key4);
15017
+ }
15018
+ /** List all registered plugin keys */
15019
+ static list() {
15020
+ return Array.from(this.plugins.keys());
15021
+ }
15022
+ /** Serialize all registered plugins to API-ready meta list */
15023
+ static listMeta() {
15024
+ return Array.from(this.plugins.values()).map(serializePluginMeta);
15025
+ }
15026
+ };
15027
+ PluginRegistry.plugins = /* @__PURE__ */ new Map();
14582
15028
 
14583
15029
  // src/agent_lattice/builders/CustomMiddlewareRegistry.ts
14584
15030
  var CustomMiddlewareRegistry = class {
14585
15031
  /**
14586
15032
  * Register a custom middleware factory under the given key.
14587
15033
  *
14588
- * The key is referenced by `config.key` in the database middleware configuration.
14589
- * When an agent is built, the framework looks up this key and calls the factory
14590
- * with the remaining config fields.
15034
+ * Supports three calling conventions:
15035
+ * - register(key, factory) legacy, wraps factory as anonymous Plugin
15036
+ * - register(key, factory, meta) — legacy with optional meta
15037
+ *
15038
+ * For new code, prefer PluginRegistry.register(plugin).
14591
15039
  *
14592
15040
  * @param key - Unique identifier, referenced in database config as `config.key`
14593
15041
  * @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
- * ```
15042
+ * @param deprecatedMeta - Optional metadata for API discovery
14601
15043
  */
14602
- static register(key4, factory) {
15044
+ static register(key4, factory, deprecatedMeta) {
14603
15045
  this.factories.set(key4, factory);
15046
+ const existing = PluginRegistry.get(key4);
15047
+ if (existing) return;
15048
+ const plugin = {
15049
+ meta: {
15050
+ type: key4,
15051
+ name: deprecatedMeta?.name || key4,
15052
+ description: deprecatedMeta?.description || "",
15053
+ version: deprecatedMeta?.version,
15054
+ source: deprecatedMeta?.source,
15055
+ tools: deprecatedMeta?.tools,
15056
+ configSchema: deprecatedMeta?.configSchema,
15057
+ defaultConfig: deprecatedMeta?.defaultConfig
15058
+ },
15059
+ middleware: factory
15060
+ };
15061
+ PluginRegistry.register(plugin);
14604
15062
  }
14605
15063
  /**
14606
15064
  * Remove a previously registered factory.
@@ -14609,6 +15067,7 @@ var CustomMiddlewareRegistry = class {
14609
15067
  * @returns `true` if a factory was removed, `false` if the key was not found
14610
15068
  */
14611
15069
  static unregister(key4) {
15070
+ PluginRegistry.unregister(key4);
14612
15071
  return this.factories.delete(key4);
14613
15072
  }
14614
15073
  /**
@@ -14618,29 +15077,73 @@ var CustomMiddlewareRegistry = class {
14618
15077
  * @returns The factory function, or `undefined` if not registered
14619
15078
  */
14620
15079
  static get(key4) {
14621
- return this.factories.get(key4);
15080
+ const factory = this.factories.get(key4);
15081
+ if (factory) return factory;
15082
+ const plugin = PluginRegistry.get(key4);
15083
+ if (plugin?.middleware) {
15084
+ return ((config) => plugin.middleware(config));
15085
+ }
15086
+ return void 0;
14622
15087
  }
14623
15088
  /**
14624
15089
  * Check whether a factory is registered under the given key.
14625
- *
14626
- * @param key - The factory key to check
14627
15090
  */
14628
15091
  static has(key4) {
14629
- return this.factories.has(key4);
15092
+ return this.factories.has(key4) || PluginRegistry.has(key4);
14630
15093
  }
14631
15094
  /**
14632
15095
  * Get all currently registered factory keys.
14633
- *
14634
- * @returns Array of registered key strings
14635
15096
  */
14636
15097
  static list() {
14637
- return Array.from(this.factories.keys());
15098
+ const keys = new Set(this.factories.keys());
15099
+ for (const k of PluginRegistry.list()) keys.add(k);
15100
+ return Array.from(keys);
14638
15101
  }
14639
15102
  };
14640
15103
  CustomMiddlewareRegistry.factories = /* @__PURE__ */ new Map();
14641
15104
 
15105
+ // src/connection/ConnectionRegistry.ts
15106
+ var ConnectionRegistry = class {
15107
+ static setStore(store) {
15108
+ this.store = store;
15109
+ }
15110
+ static async list(type, tenantId) {
15111
+ this.ensureStore();
15112
+ return this.store.listByType(tenantId, type);
15113
+ }
15114
+ static async get(type, key4, tenantId) {
15115
+ this.ensureStore();
15116
+ return this.store.getByKey(tenantId, type, key4);
15117
+ }
15118
+ static async create(entry) {
15119
+ this.ensureStore();
15120
+ return this.store.create(entry);
15121
+ }
15122
+ static async update(tenantId, type, key4, updates) {
15123
+ this.ensureStore();
15124
+ return this.store.update(tenantId, type, key4, updates);
15125
+ }
15126
+ static async delete(tenantId, type, key4) {
15127
+ this.ensureStore();
15128
+ return this.store.delete(tenantId, type, key4);
15129
+ }
15130
+ static ensureStore() {
15131
+ if (!this.store) throw new Error("ConnectionStore not configured");
15132
+ }
15133
+ };
15134
+ ConnectionRegistry.store = null;
15135
+
14642
15136
  // src/agent_lattice/builders/commonMiddleware.ts
14643
- async function createCommonMiddlewares(middlewareConfigs, filesystemBackend, fsIsExised) {
15137
+ function applyToolFilter(mw, allowedTools) {
15138
+ if (allowedTools?.length && mw.tools?.length) {
15139
+ mw.tools = mw.tools.filter((t) => {
15140
+ const toolName = t.name;
15141
+ return typeof toolName === "string" && allowedTools.includes(toolName);
15142
+ });
15143
+ }
15144
+ return mw;
15145
+ }
15146
+ async function createCommonMiddlewares(middlewareConfigs, filesystemBackend, fsIsExised, tenantId) {
14644
15147
  const middlewares = [];
14645
15148
  middlewares.push(createUnknownToolHandlerMiddleware());
14646
15149
  middlewares.push(createModelSelectorMiddleware());
@@ -14650,17 +15153,26 @@ async function createCommonMiddlewares(middlewareConfigs, filesystemBackend, fsI
14650
15153
  if (needsFilesystemBackend && filesystemBackend) {
14651
15154
  if (!fsIsExised) {
14652
15155
  const options = { backend: filesystemBackend };
14653
- middlewares.push(createFilesystemMiddleware(options));
15156
+ middlewares.push(applyToolFilter(
15157
+ createFilesystemMiddleware(options),
15158
+ filesystemConfig?.allowedTools
15159
+ ));
14654
15160
  }
14655
15161
  }
14656
15162
  for (const config of middlewareConfigs) {
14657
15163
  if (!config.enabled || config.type === "filesystem") continue;
14658
15164
  switch (config.type) {
14659
15165
  case "code_eval":
14660
- middlewares.push(createCodeEvalMiddleware(config.config));
15166
+ middlewares.push(applyToolFilter(
15167
+ createCodeEvalMiddleware(config.config),
15168
+ config.allowedTools
15169
+ ));
14661
15170
  break;
14662
15171
  case "browser":
14663
- middlewares.push(createBrowserMiddleware(config.config));
15172
+ middlewares.push(applyToolFilter(
15173
+ createBrowserMiddleware(config.config),
15174
+ config.allowedTools
15175
+ ));
14664
15176
  break;
14665
15177
  case "sql":
14666
15178
  {
@@ -14673,21 +15185,30 @@ async function createCommonMiddlewares(middlewareConfigs, filesystemBackend, fsI
14673
15185
  descriptions[db.key] = db.description || db.name || "";
14674
15186
  }
14675
15187
  }
14676
- middlewares.push(createSqlMiddleware({
14677
- databaseKeys: sqlConfig.databaseKeys,
14678
- databaseDescriptions: descriptions
14679
- }));
15188
+ middlewares.push(applyToolFilter(
15189
+ createSqlMiddleware({
15190
+ databaseKeys: sqlConfig.databaseKeys,
15191
+ databaseDescriptions: descriptions
15192
+ }),
15193
+ config.allowedTools
15194
+ ));
14680
15195
  }
14681
15196
  }
14682
15197
  break;
14683
15198
  case "skill":
14684
- middlewares.push(createSkillMiddleware(config.config));
15199
+ middlewares.push(applyToolFilter(
15200
+ createSkillMiddleware(config.config),
15201
+ config.allowedTools
15202
+ ));
14685
15203
  break;
14686
15204
  case "metrics":
14687
15205
  {
14688
15206
  const metricsConfig = config.config;
14689
15207
  if (metricsConfig.connectAll || metricsConfig.serverKeys && metricsConfig.serverKeys.length > 0) {
14690
- middlewares.push(createMetricsMiddleware(metricsConfig));
15208
+ middlewares.push(applyToolFilter(
15209
+ createMetricsMiddleware(metricsConfig),
15210
+ config.allowedTools
15211
+ ));
14691
15212
  }
14692
15213
  }
14693
15214
  break;
@@ -14695,36 +15216,57 @@ async function createCommonMiddlewares(middlewareConfigs, filesystemBackend, fsI
14695
15216
  {
14696
15217
  const collectionConfig = config.config;
14697
15218
  if (collectionConfig.connectAll || collectionConfig.collectionKeys && collectionConfig.collectionKeys.length > 0) {
14698
- middlewares.push(createCollectionMiddleware(collectionConfig));
15219
+ middlewares.push(applyToolFilter(
15220
+ createCollectionMiddleware(collectionConfig),
15221
+ config.allowedTools
15222
+ ));
14699
15223
  }
14700
15224
  }
14701
15225
  break;
14702
15226
  case "ask_user_to_clarify":
14703
- middlewares.push(createAskUserClarifyMiddleware());
15227
+ middlewares.push(applyToolFilter(
15228
+ createAskUserClarifyMiddleware(),
15229
+ config.allowedTools
15230
+ ));
14704
15231
  break;
14705
15232
  case "widget":
14706
- middlewares.push(createWidgetMiddleware());
15233
+ middlewares.push(applyToolFilter(
15234
+ createWidgetMiddleware(),
15235
+ config.allowedTools
15236
+ ));
14707
15237
  break;
14708
15238
  case "claw":
14709
15239
  if (filesystemBackend) {
14710
15240
  const clawMiddlewareConfig = config.config;
14711
- middlewares.push(createClawMiddleware({
14712
- backend: filesystemBackend,
14713
- injectBootstrapFiles: clawMiddlewareConfig.injectBootstrapFiles ?? true,
14714
- bootstrapFiles: clawMiddlewareConfig.bootstrapFiles ?? {}
14715
- }));
15241
+ middlewares.push(applyToolFilter(
15242
+ createClawMiddleware({
15243
+ backend: filesystemBackend,
15244
+ injectBootstrapFiles: clawMiddlewareConfig.injectBootstrapFiles ?? true,
15245
+ bootstrapFiles: clawMiddlewareConfig.bootstrapFiles ?? {}
15246
+ }),
15247
+ config.allowedTools
15248
+ ));
14716
15249
  } else {
14717
15250
  console.warn("[claw middleware] Filesystem backend not available. Claw middleware requires filesystem backend to function.");
14718
15251
  }
14719
15252
  break;
14720
15253
  case "date":
14721
- middlewares.push(createDateMiddleware(config.config));
15254
+ middlewares.push(applyToolFilter(
15255
+ createDateMiddleware(config.config),
15256
+ config.allowedTools
15257
+ ));
14722
15258
  break;
14723
15259
  case "scheduler":
14724
- middlewares.push(createSchedulerMiddleware(config.config));
15260
+ middlewares.push(applyToolFilter(
15261
+ createSchedulerMiddleware(config.config),
15262
+ config.allowedTools
15263
+ ));
14725
15264
  break;
14726
15265
  case "task":
14727
- middlewares.push(createTaskMiddleware());
15266
+ middlewares.push(applyToolFilter(
15267
+ createTaskMiddleware(),
15268
+ config.allowedTools
15269
+ ));
14728
15270
  break;
14729
15271
  case "custom":
14730
15272
  {
@@ -14732,8 +15274,20 @@ async function createCommonMiddlewares(middlewareConfigs, filesystemBackend, fsI
14732
15274
  const { key: key4, ...rest } = customConfig;
14733
15275
  const factory = CustomMiddlewareRegistry.get(key4);
14734
15276
  if (factory) {
15277
+ if (rest.connections?.length && tenantId) {
15278
+ const resolved = (await Promise.all(
15279
+ rest.connections.map(async (connKey) => {
15280
+ const entry = await ConnectionRegistry.get(key4, connKey, tenantId);
15281
+ return entry ? { key: connKey, config: entry.config } : null;
15282
+ })
15283
+ )).filter(Boolean);
15284
+ rest._resolvedConnections = resolved;
15285
+ }
14735
15286
  const middleware = factory(rest);
14736
- middlewares.push(middleware instanceof Promise ? await middleware : middleware);
15287
+ middlewares.push(applyToolFilter(
15288
+ middleware instanceof Promise ? await middleware : middleware,
15289
+ config.allowedTools
15290
+ ));
14737
15291
  } else {
14738
15292
  console.warn(
14739
15293
  `[custom middleware] No factory registered for key "${key4}". Use CustomMiddlewareRegistry.register("${key4}", factory) before building the agent.`
@@ -14741,6 +15295,30 @@ async function createCommonMiddlewares(middlewareConfigs, filesystemBackend, fsI
14741
15295
  }
14742
15296
  }
14743
15297
  break;
15298
+ default:
15299
+ {
15300
+ const plugin = PluginRegistry.get(config.type);
15301
+ if (plugin?.middleware) {
15302
+ const pluginConfig = config.config;
15303
+ if (pluginConfig.connections?.length && tenantId) {
15304
+ const resolved = (await Promise.all(
15305
+ pluginConfig.connections.map(async (connKey) => {
15306
+ const entry = await ConnectionRegistry.get(config.type, connKey, tenantId);
15307
+ return entry ? { key: connKey, config: entry.config } : null;
15308
+ })
15309
+ )).filter(Boolean);
15310
+ pluginConfig._resolvedConnections = resolved;
15311
+ }
15312
+ const mw = plugin.middleware(pluginConfig);
15313
+ middlewares.push(applyToolFilter(
15314
+ mw instanceof Promise ? await mw : mw,
15315
+ config.allowedTools
15316
+ ));
15317
+ } else {
15318
+ console.warn(`[commonMiddleware] Unknown middleware type "${config.type}" \u2014 skipping`);
15319
+ }
15320
+ }
15321
+ break;
14744
15322
  }
14745
15323
  }
14746
15324
  return middlewares;
@@ -14924,8 +15502,8 @@ function createFilesystemBackendFactory(middlewareConfigs) {
14924
15502
 
14925
15503
  // src/agent_lattice/builders/ReActAgentGraphBuilder.ts
14926
15504
  var ReActAgentGraphBuilder = class {
14927
- async createMiddlewares(middlewareConfigs) {
14928
- return await createCommonMiddlewares(middlewareConfigs);
15505
+ async createMiddlewares(middlewareConfigs, tenantId) {
15506
+ return await createCommonMiddlewares(middlewareConfigs, void 0, void 0, tenantId);
14929
15507
  }
14930
15508
  /**
14931
15509
  * 构建ReAct Agent Graph
@@ -14942,7 +15520,7 @@ var ReActAgentGraphBuilder = class {
14942
15520
  const stateSchema2 = createReactAgentSchema(params.stateSchema);
14943
15521
  const middlewareConfigs = params.middleware || [];
14944
15522
  const filesystemBackend = createFilesystemBackendFactory(middlewareConfigs);
14945
- const middlewares = await createCommonMiddlewares(middlewareConfigs, filesystemBackend);
15523
+ const middlewares = await createCommonMiddlewares(middlewareConfigs, filesystemBackend, void 0, params.tenantId);
14946
15524
  return createAgent({
14947
15525
  model: params.model,
14948
15526
  tools,
@@ -17310,7 +17888,7 @@ var DeepAgentGraphBuilder = class {
17310
17888
  }));
17311
17889
  const middlewareConfigs = params.middleware || [];
17312
17890
  const filesystemBackend = createFilesystemBackendFactory(middlewareConfigs);
17313
- const middlewares = await createCommonMiddlewares(middlewareConfigs, filesystemBackend, true);
17891
+ const middlewares = await createCommonMiddlewares(middlewareConfigs, filesystemBackend, true, params.tenantId);
17314
17892
  const deepAgent = createDeepAgent({
17315
17893
  tools,
17316
17894
  model: params.model,
@@ -19359,7 +19937,7 @@ var ProcessingAgentGraphBuilder = class {
19359
19937
  }));
19360
19938
  const middlewareConfigs = params.middleware || [];
19361
19939
  const filesystemBackend = createFilesystemBackendFactory(middlewareConfigs);
19362
- const middlewares = await createCommonMiddlewares(middlewareConfigs, filesystemBackend, true);
19940
+ const middlewares = await createCommonMiddlewares(middlewareConfigs, filesystemBackend, true, params.tenantId);
19363
19941
  const topologyConfig = middlewareConfigs.find(
19364
19942
  (m) => m.type === "topology" && m.enabled
19365
19943
  );
@@ -19619,7 +20197,7 @@ var WorkflowAgentGraphBuilder = class {
19619
20197
  const checkpointer = getCheckpointSaver("default");
19620
20198
  const tools = params.tools.map((t) => t.executor).filter(Boolean);
19621
20199
  const middlewareConfigs = params.middleware || [];
19622
- const middlewares = await createCommonMiddlewares(middlewareConfigs, void 0, false);
20200
+ const middlewares = await createCommonMiddlewares(middlewareConfigs, void 0, false, params.tenantId);
19623
20201
  const askMiddlewares = await createCommonMiddlewares([
19624
20202
  {
19625
20203
  id: "ask_user_to_clarify",
@@ -20051,6 +20629,10 @@ async function configureStores(stores, options = {}) {
20051
20629
  }
20052
20630
  storeLatticeManager.registerLattice("default", type, store);
20053
20631
  }
20632
+ if (storeLatticeManager.hasLattice("default", "connection")) {
20633
+ const connectionStore = storeLatticeManager.getStoreLattice("default", "connection").store;
20634
+ ConnectionRegistry.setStore(connectionStore);
20635
+ }
20054
20636
  if (schedule !== void 0) {
20055
20637
  await initAndRegister(schedule, localDisposables);
20056
20638
  const scheduleConfig = {
@@ -21287,6 +21869,53 @@ registerToolLattice(
21287
21869
  }
21288
21870
  }
21289
21871
  );
21872
+ registerToolLattice(
21873
+ "list_middleware_types",
21874
+ {
21875
+ name: "list_middleware_types",
21876
+ 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",
21877
+ schema: z66.object({})
21878
+ },
21879
+ async () => {
21880
+ const metas = PluginRegistry.listMeta();
21881
+ return JSON.stringify(metas);
21882
+ }
21883
+ );
21884
+ registerToolLattice(
21885
+ "list_connections",
21886
+ {
21887
+ name: "list_connections",
21888
+ 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, ... }] } }",
21889
+ schema: z66.object({
21890
+ type: z66.string().describe("\u63D2\u4EF6\u7C7B\u578B\u6807\u8BC6\uFF0C\u5982 'erp'\u3002\u4ECE list_middleware_types \u7684\u8FD4\u56DE\u4E2D\u83B7\u53D6")
21891
+ }),
21892
+ needUserApprove: false
21893
+ },
21894
+ async (input, config) => {
21895
+ const tenantId = getTenantId(config);
21896
+ try {
21897
+ const entries = await ConnectionRegistry.list(input.type, tenantId);
21898
+ return JSON.stringify({
21899
+ success: true,
21900
+ data: {
21901
+ records: entries.map((e) => ({
21902
+ key: e.key,
21903
+ name: e.name,
21904
+ description: e.description,
21905
+ updatedAt: e.updatedAt
21906
+ })),
21907
+ total: entries.length
21908
+ }
21909
+ });
21910
+ } catch (error) {
21911
+ return JSON.stringify({
21912
+ success: false,
21913
+ error: error.message,
21914
+ 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"
21915
+ });
21916
+ }
21917
+ }
21918
+ );
21290
21919
 
21291
21920
  // src/agent_lattice/agentArchitectConfig.ts
21292
21921
  import { AgentType as AgentType5 } from "@axiom-lattice/protocols";
@@ -21606,101 +22235,29 @@ Returns: \`{ valid: boolean, stepCount, issues: [{ type: "error"|"warning", mess
21606
22235
 
21607
22236
  ### Middleware Config Reference
21608
22237
 
22238
+ **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.
22239
+
21609
22240
  Each middleware entry uses this base shape:
21610
22241
 
21611
22242
  \`\`\`typescript
21612
22243
  {
21613
22244
  id: string, // Unique ID, usually same as type
21614
- type: string, // Middleware type from the table below
22245
+ type: string, // Middleware type from list_middleware_types
21615
22246
  name: string, // Display name
21616
22247
  description: string, // What this middleware provides
21617
22248
  enabled: true, // Always true for active middleware
21618
- config: { ... } // Type-specific config (see table)
22249
+ config: { ... } // Type-specific config (see list_middleware_types result)
21619
22250
  }
21620
22251
  \`\`\`
21621
22252
 
21622
- #### filesystem
21623
- Provides: \`ls\`, \`read_file\`, \`write_file\`, \`edit_file\`, \`glob\`, \`grep\`
21624
- | config field | type | description |
21625
- |-------------|------|-------------|
21626
- | backend | string | Pluggable backend, usually omitted (uses default) |
21627
- | systemPrompt | string? | Custom system prompt override for filesystem conventions |
21628
-
21629
- #### code_eval
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 | |
22253
+ **Connection-type middleware** (those with \`connectionSchema\` in list_middleware_types output):
22254
+ 1. Call \`list_connections(type="xxx")\` to see available connection keys
22255
+ 2. Use the returned keys in \`config.connections: ["sap-prod", "sap-dev"]\`
22256
+
22257
+ **Tool filtering:** Use \`allowedTools\` to restrict which tools a middleware exposes:
22258
+ \`\`\`typescript
22259
+ { type: "browser", enabled: true, config: {}, allowedTools: ["browser_navigate", "browser_screenshot"] }
22260
+ \`\`\`
21704
22261
 
21705
22262
  ### When to use ask_user_to_clarify Middleware
21706
22263
 
@@ -21723,19 +22280,6 @@ Provides: \`read_topo_progress\` \u2014 enforces multi-agent workflow topology f
21723
22280
 
21724
22281
  **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
22282
 
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
22283
  ### manage_binding Reference
21740
22284
 
21741
22285
  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 +22410,8 @@ var agentArchitectConfig = {
21866
22410
  tools: [
21867
22411
  "list_agents",
21868
22412
  "list_tools",
22413
+ "list_middleware_types",
22414
+ "list_connections",
21869
22415
  "get_agent",
21870
22416
  "create_agent",
21871
22417
  "create_workflow",
@@ -25032,7 +25578,9 @@ function generateToken() {
25032
25578
  function createSharePayload(tenantId, workspaceId, projectId, userId, request) {
25033
25579
  const resourcePath = (request.resourcePath || "").replace(/^\/?project\/?/, "").replace(/\/+$/, "");
25034
25580
  if (!resourcePath || resourcePath === "/") {
25035
- throw new Error("Cannot share project root \u2014 share a subdirectory or file instead");
25581
+ if (request.visibility !== "internal") {
25582
+ throw new Error("Cannot share project root \u2014 share a subdirectory or file instead");
25583
+ }
25036
25584
  }
25037
25585
  return {
25038
25586
  address: createResourceAddress({
@@ -25159,6 +25707,28 @@ function clearEncryptionKeyCache() {
25159
25707
  keyValidated = false;
25160
25708
  }
25161
25709
 
25710
+ // src/plugin/BuiltinPlugins.ts
25711
+ var BUILTIN_PLUGINS = [
25712
+ filesystemPlugin,
25713
+ codeEvalPlugin,
25714
+ browserPlugin,
25715
+ sqlPlugin,
25716
+ skillPlugin,
25717
+ metricsPlugin,
25718
+ askUserClarifyPlugin,
25719
+ widgetPlugin,
25720
+ clawPlugin,
25721
+ datePlugin,
25722
+ schedulerPlugin,
25723
+ taskPlugin,
25724
+ collectionPlugin
25725
+ ];
25726
+ function registerBuiltinPlugins() {
25727
+ for (const plugin of BUILTIN_PLUGINS) {
25728
+ PluginRegistry.register(plugin);
25729
+ }
25730
+ }
25731
+
25162
25732
  // src/personal_assistant/PersonalAssistantConfig.ts
25163
25733
  function deepClone(obj) {
25164
25734
  return JSON.parse(JSON.stringify(obj));
@@ -25309,6 +25879,9 @@ var PersonalAssistantConfig = class {
25309
25879
  }
25310
25880
  };
25311
25881
  PersonalAssistantConfig._config = deepClone(DEFAULT_CONFIG);
25882
+
25883
+ // src/index.ts
25884
+ registerBuiltinPlugins();
25312
25885
  export {
25313
25886
  AGENT_TASK_EVENT,
25314
25887
  Agent,
@@ -25316,11 +25889,13 @@ export {
25316
25889
  AgentLatticeManager,
25317
25890
  AgentManager,
25318
25891
  AgentType,
25892
+ BUILTIN_PLUGINS,
25319
25893
  BUILTIN_SKILLS,
25320
25894
  ChunkBuffer,
25321
25895
  ChunkBufferLatticeManager,
25322
25896
  CollectionLatticeManager,
25323
25897
  CompositeBackend,
25898
+ ConnectionRegistry,
25324
25899
  ConsoleLoggerClient,
25325
25900
  CustomMetricsClient,
25326
25901
  CustomMiddlewareRegistry,
@@ -25370,6 +25945,7 @@ export {
25370
25945
  MysqlDatabase,
25371
25946
  PersonalAssistantConfig,
25372
25947
  PinoLoggerClient,
25948
+ PluginRegistry,
25373
25949
  PostgresDatabase,
25374
25950
  PrometheusClient,
25375
25951
  Protocols,
@@ -25532,6 +26108,7 @@ export {
25532
26108
  sandboxLatticeManager,
25533
26109
  sanitizeToolCallId,
25534
26110
  scheduleLatticeManager,
26111
+ serializePluginMeta,
25535
26112
  setBindingRegistry,
25536
26113
  setMenuRegistry,
25537
26114
  skillLatticeManager,