@axiom-lattice/core 6.3.1 → 6.3.3
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 +78 -1
- package/dist/index.d.ts +78 -1
- package/dist/index.js +182 -53
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +177 -53
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1790,6 +1790,7 @@ __export(index_exports, {
|
|
|
1790
1790
|
clearEncryptionKeyCache: () => clearEncryptionKeyCache,
|
|
1791
1791
|
clearEvalRunService: () => clearEvalRunService,
|
|
1792
1792
|
clearSandboxOpenCredentialProviderForTests: () => clearSandboxOpenCredentialProviderForTests,
|
|
1793
|
+
collectPluginSources: () => collectPluginSources,
|
|
1793
1794
|
collectionLatticeManager: () => collectionLatticeManager,
|
|
1794
1795
|
compileInternal: () => compileInternal,
|
|
1795
1796
|
compileSandboxPlugin: () => compileSandboxPlugin,
|
|
@@ -1799,6 +1800,7 @@ __export(index_exports, {
|
|
|
1799
1800
|
configurePluginCatalogSync: () => configurePluginCatalogSync,
|
|
1800
1801
|
configureStores: () => configureStores,
|
|
1801
1802
|
connectAllChannels: () => connectAllChannels,
|
|
1803
|
+
connectionSecretFields: () => connectionSecretFields,
|
|
1802
1804
|
convertToConnection: () => convertToConnection,
|
|
1803
1805
|
createAgentNode: () => createAgentNode,
|
|
1804
1806
|
createAgentTeam: () => createAgentTeam,
|
|
@@ -1839,11 +1841,13 @@ __export(index_exports, {
|
|
|
1839
1841
|
createUnknownToolHandlerMiddleware: () => createUnknownToolHandlerMiddleware,
|
|
1840
1842
|
createWidgetMiddleware: () => createWidgetMiddleware,
|
|
1841
1843
|
decrypt: () => decrypt,
|
|
1844
|
+
decryptConfigFields: () => decryptConfigFields,
|
|
1842
1845
|
describeCronExpression: () => describeCronExpression,
|
|
1843
1846
|
documentLearningPlugin: () => documentLearningPlugin,
|
|
1844
1847
|
documentParserPlugin: () => documentParserPlugin,
|
|
1845
1848
|
embeddingsLatticeManager: () => embeddingsLatticeManager,
|
|
1846
1849
|
encrypt: () => encrypt,
|
|
1850
|
+
encryptConfigFields: () => encryptConfigFields,
|
|
1847
1851
|
ensureBuiltinAgentsForTenant: () => ensureBuiltinAgentsForTenant,
|
|
1848
1852
|
ensurePluginSkillInSandbox: () => ensurePluginSkillInSandbox,
|
|
1849
1853
|
evaluateLatticeCaseWithLogs: () => evaluateLatticeCaseWithLogs,
|
|
@@ -1926,6 +1930,7 @@ __export(index_exports, {
|
|
|
1926
1930
|
jsonSchemaToZod: () => jsonSchemaToZod,
|
|
1927
1931
|
listCollectionEntries: () => listCollectionEntries,
|
|
1928
1932
|
listSandboxProviderTypes: () => listSandboxProviderTypes,
|
|
1933
|
+
listTenantPlugins: () => listTenantPlugins,
|
|
1929
1934
|
loggerLatticeManager: () => loggerLatticeManager,
|
|
1930
1935
|
mcpManager: () => mcpManager,
|
|
1931
1936
|
mergeCapabilityBundles: () => mergeCapabilityBundles,
|
|
@@ -16248,6 +16253,22 @@ function setSandboxPluginCatalog(instance) {
|
|
|
16248
16253
|
catalog = instance;
|
|
16249
16254
|
}
|
|
16250
16255
|
|
|
16256
|
+
// src/plugin/listTenantPlugins.ts
|
|
16257
|
+
async function collectPluginSources(tenantId2) {
|
|
16258
|
+
const globalPlugins = PluginRegistry.list().map((type) => PluginRegistry.get(type)).filter((plugin) => Boolean(plugin));
|
|
16259
|
+
let tenantPlugins = [];
|
|
16260
|
+
try {
|
|
16261
|
+
tenantPlugins = (await getSandboxPluginCatalog().ensureLoaded(tenantId2)).plugins;
|
|
16262
|
+
} catch {
|
|
16263
|
+
tenantPlugins = [];
|
|
16264
|
+
}
|
|
16265
|
+
return { globalPlugins, tenantPlugins };
|
|
16266
|
+
}
|
|
16267
|
+
async function listTenantPlugins(tenantId2) {
|
|
16268
|
+
const { globalPlugins, tenantPlugins } = await collectPluginSources(tenantId2);
|
|
16269
|
+
return mergePluginSources(globalPlugins, tenantPlugins);
|
|
16270
|
+
}
|
|
16271
|
+
|
|
16251
16272
|
// src/agent_lattice/builders/taskMiddlewareValidation.ts
|
|
16252
16273
|
var REQUIRED_TASK_TOOLS = ["manage_task", "task"];
|
|
16253
16274
|
function validateTaskReviewMode(reviewMode) {
|
|
@@ -16812,13 +16833,7 @@ async function createCommonMiddlewares(middlewareConfigs, filesystemBackend, fsI
|
|
|
16812
16833
|
));
|
|
16813
16834
|
}
|
|
16814
16835
|
}
|
|
16815
|
-
|
|
16816
|
-
try {
|
|
16817
|
-
tenantPlugins = (await getSandboxPluginCatalog().ensureLoaded(tenantId2 ?? "default")).plugins;
|
|
16818
|
-
} catch {
|
|
16819
|
-
tenantPlugins = [];
|
|
16820
|
-
}
|
|
16821
|
-
const globalPlugins = PluginRegistry.list().map((type) => PluginRegistry.get(type)).filter((p) => Boolean(p));
|
|
16836
|
+
const { globalPlugins, tenantPlugins } = await collectPluginSources(tenantId2 ?? "default");
|
|
16822
16837
|
const mergedPlugins = mergePluginSources(globalPlugins, tenantPlugins);
|
|
16823
16838
|
const mergedByType = new Map(mergedPlugins.map((p) => [p.meta.type, p]));
|
|
16824
16839
|
const enabledPluginTypes = new Set(
|
|
@@ -31314,10 +31329,8 @@ function getAvailableTools(tenantId2) {
|
|
|
31314
31329
|
function getAvailableModels() {
|
|
31315
31330
|
return modelLatticeManager.getAllByTenant("default");
|
|
31316
31331
|
}
|
|
31317
|
-
function getAvailableMiddlewareTypes() {
|
|
31318
|
-
return
|
|
31319
|
-
(type) => typeof PluginRegistry.get(type)?.middleware === "function"
|
|
31320
|
-
);
|
|
31332
|
+
async function getAvailableMiddlewareTypes(tenantId2) {
|
|
31333
|
+
return (await listTenantPlugins(tenantId2)).filter((plugin) => typeof plugin.middleware === "function").map((plugin) => plugin.meta.type);
|
|
31321
31334
|
}
|
|
31322
31335
|
function normalizeProjectScope(projectId) {
|
|
31323
31336
|
return !projectId || projectId === "default" ? "default" : projectId;
|
|
@@ -31356,7 +31369,7 @@ function requireSkillDeclaration(skillLoaded) {
|
|
|
31356
31369
|
}
|
|
31357
31370
|
async function validateAgentReferences(input, tenantId2) {
|
|
31358
31371
|
const availableTools = getAvailableTools(tenantId2).map((tool68) => tool68.key);
|
|
31359
|
-
const availableMiddlewareTypes = getAvailableMiddlewareTypes();
|
|
31372
|
+
const availableMiddlewareTypes = await getAvailableMiddlewareTypes(tenantId2);
|
|
31360
31373
|
const availableCustomMiddlewareKeys = CustomMiddlewareRegistry.list().filter(
|
|
31361
31374
|
(key5) => CustomMiddlewareRegistry.get(key5) !== void 0
|
|
31362
31375
|
);
|
|
@@ -32036,9 +32049,10 @@ registerToolLattice(
|
|
|
32036
32049
|
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\uFF1B\u65B0\u8FDE\u63A5\u578B\u63D2\u4EF6\u4F7F\u7528 connections \u548C connectAll\uFF0C\u5185\u7F6E\u65E7\u63D2\u4EF6\u7684 selector \u5B57\u6BB5\u7531 core \u7684 legacy compatibility map \u5B9A\u4E49\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",
|
|
32037
32050
|
schema: import_zod50.default.object({})
|
|
32038
32051
|
},
|
|
32039
|
-
async () => {
|
|
32040
|
-
const
|
|
32041
|
-
const
|
|
32052
|
+
async (_input, exeConfig) => {
|
|
32053
|
+
const tenantId2 = getTenantId2(exeConfig);
|
|
32054
|
+
const plugins = await listTenantPlugins(tenantId2);
|
|
32055
|
+
const metas = plugins.filter((plugin) => typeof plugin.middleware === "function").map(serializePluginMeta);
|
|
32042
32056
|
return JSON.stringify(metas);
|
|
32043
32057
|
}
|
|
32044
32058
|
);
|
|
@@ -32349,14 +32363,7 @@ function ensureBuiltinAgentsForTenant(tenantId2) {
|
|
|
32349
32363
|
|
|
32350
32364
|
// src/agent_lattice/pluginAgents.ts
|
|
32351
32365
|
async function ensurePluginAgentsForTenant(tenantId2) {
|
|
32352
|
-
const
|
|
32353
|
-
let tenantPlugins = [];
|
|
32354
|
-
try {
|
|
32355
|
-
tenantPlugins = (await getSandboxPluginCatalog().ensureLoaded(tenantId2)).plugins;
|
|
32356
|
-
} catch {
|
|
32357
|
-
tenantPlugins = [];
|
|
32358
|
-
}
|
|
32359
|
-
for (const plugin of mergePluginSources(globalPlugins, tenantPlugins)) {
|
|
32366
|
+
for (const plugin of await listTenantPlugins(tenantId2)) {
|
|
32360
32367
|
if (!plugin.agents) continue;
|
|
32361
32368
|
for (const [key5, config] of Object.entries(plugin.agents)) {
|
|
32362
32369
|
try {
|
|
@@ -42169,6 +42176,33 @@ function clearEncryptionKeyCache() {
|
|
|
42169
42176
|
cachedKey = null;
|
|
42170
42177
|
keyValidated = false;
|
|
42171
42178
|
}
|
|
42179
|
+
function encryptConfigFields(config, fields) {
|
|
42180
|
+
if (!fields?.length) return config;
|
|
42181
|
+
const out = { ...config };
|
|
42182
|
+
for (const field of fields) {
|
|
42183
|
+
const value = out[field];
|
|
42184
|
+
if (typeof value === "string" && value.length > 0) {
|
|
42185
|
+
out[field] = encrypt(value);
|
|
42186
|
+
}
|
|
42187
|
+
}
|
|
42188
|
+
return out;
|
|
42189
|
+
}
|
|
42190
|
+
function decryptConfigFields(config, fields) {
|
|
42191
|
+
if (!fields?.length) return config;
|
|
42192
|
+
const out = { ...config };
|
|
42193
|
+
for (const field of fields) {
|
|
42194
|
+
const value = out[field];
|
|
42195
|
+
if (typeof value === "string" && value.length > 0) {
|
|
42196
|
+
try {
|
|
42197
|
+
out[field] = decrypt(value);
|
|
42198
|
+
} catch (error) {
|
|
42199
|
+
console.error(`Failed to decrypt connection field "${field}":`, error);
|
|
42200
|
+
throw new Error("Failed to decrypt connection configuration");
|
|
42201
|
+
}
|
|
42202
|
+
}
|
|
42203
|
+
}
|
|
42204
|
+
return out;
|
|
42205
|
+
}
|
|
42172
42206
|
|
|
42173
42207
|
// src/util/safeUpstreamUrl.ts
|
|
42174
42208
|
var UnsafeUpstreamUrlError = class extends Error {
|
|
@@ -45697,7 +45731,7 @@ function createTaskMiddleware(options = {}) {
|
|
|
45697
45731
|
error: "Task changed before activity could be recorded."
|
|
45698
45732
|
});
|
|
45699
45733
|
markMutation();
|
|
45700
|
-
return JSON.stringify({ success: true, data: activity });
|
|
45734
|
+
return JSON.stringify({ success: true, data: activity, task: existing });
|
|
45701
45735
|
}
|
|
45702
45736
|
case "update": {
|
|
45703
45737
|
taskUpdateDebug("update:enter", {
|
|
@@ -48183,6 +48217,12 @@ var import_langchain88 = require("langchain");
|
|
|
48183
48217
|
var import_zod71 = require("zod");
|
|
48184
48218
|
var import_protocols38 = require("@axiom-lattice/protocols");
|
|
48185
48219
|
|
|
48220
|
+
// src/connection/connectionSecretFields.ts
|
|
48221
|
+
function connectionSecretFields(plugin) {
|
|
48222
|
+
const fields = plugin?.connection?.fields ?? [];
|
|
48223
|
+
return fields.filter((field) => field.type === "password" || field.widget === "password").map((field) => field.key);
|
|
48224
|
+
}
|
|
48225
|
+
|
|
48186
48226
|
// src/middlewares/sandboxPluginsSkills.ts
|
|
48187
48227
|
var PLUGIN_JSON_TEMPLATE = `{
|
|
48188
48228
|
"schemaVersion": 1,
|
|
@@ -48238,13 +48278,13 @@ var TEST_TEMPLATE = `const data = process.env.PLUGIN_CONNECTION_FILE
|
|
|
48238
48278
|
: {};
|
|
48239
48279
|
const conn = data.connection ?? data.connections?.[0]?.config ?? {};
|
|
48240
48280
|
const message = conn.apiKey ? "ok" : "missing apiKey";
|
|
48241
|
-
process.stdout.write(JSON.stringify({ ok: Boolean(conn.apiKey), message }));
|
|
48281
|
+
process.stdout.write(JSON.stringify({ ok: true, result: { ok: Boolean(conn.apiKey), message } }));
|
|
48242
48282
|
`;
|
|
48243
48283
|
var DISCOVER_TEMPLATE = `const data = process.env.PLUGIN_CONNECTION_FILE
|
|
48244
48284
|
? JSON.parse(require("fs").readFileSync(process.env.PLUGIN_CONNECTION_FILE, "utf8"))
|
|
48245
48285
|
: {};
|
|
48246
48286
|
const conn = data.connection ?? data.connections?.[0]?.config ?? {};
|
|
48247
|
-
process.stdout.write(JSON.stringify([{ id: "sample", name: "Sample resource" }]));
|
|
48287
|
+
process.stdout.write(JSON.stringify({ ok: true, result: [{ id: "sample", name: "Sample resource" }] }));
|
|
48248
48288
|
`;
|
|
48249
48289
|
var UI_TEMPLATE = `<!doctype html>
|
|
48250
48290
|
<html>
|
|
@@ -48797,7 +48837,7 @@ captured).
|
|
|
48797
48837
|
}
|
|
48798
48838
|
},
|
|
48799
48839
|
"sandbox-plugins-connection": {
|
|
48800
|
-
version: "1.
|
|
48840
|
+
version: "1.1.0",
|
|
48801
48841
|
content: `---
|
|
48802
48842
|
name: sandbox-plugins-connection
|
|
48803
48843
|
description: Define connection fields and test/discover handlers for a tenant sandbox plugin. Trigger: plugin needs credentials or resource discovery.
|
|
@@ -48813,17 +48853,20 @@ The resolved connection is injected at execution time as an
|
|
|
48813
48853
|
\`PLUGIN_CONNECTION_FILE\` (never inline; credentials stay out of argv). It is never hardcoded.
|
|
48814
48854
|
|
|
48815
48855
|
## test handler
|
|
48816
|
-
Print \`{ ok, message }\`:
|
|
48856
|
+
Print the two-level result envelope \`{ ok, result: { ok, message } }\`: the outer
|
|
48857
|
+
\`ok\` means the handler ran, the inner \`ok\`/\`message\` is the connection verdict.
|
|
48858
|
+
Put extra diagnostics under \`result.details\`. A single-level \`{ ok, message }\`
|
|
48859
|
+
is rejected as an invalid result.
|
|
48817
48860
|
\`\`\`js
|
|
48818
48861
|
const data = JSON.parse(require("fs").readFileSync(process.env.PLUGIN_CONNECTION_FILE, "utf8"));
|
|
48819
48862
|
const conn = data.connection ?? data.connections?.[0]?.config ?? {};
|
|
48820
|
-
process.stdout.write(JSON.stringify({ ok: Boolean(conn.apiKey), message: conn.apiKey ? "ok" : "missing apiKey" }));
|
|
48863
|
+
process.stdout.write(JSON.stringify({ ok: true, result: { ok: Boolean(conn.apiKey), message: conn.apiKey ? "ok" : "missing apiKey" } }));
|
|
48821
48864
|
\`\`\`
|
|
48822
48865
|
|
|
48823
48866
|
## discover handler
|
|
48824
|
-
Print
|
|
48867
|
+
Print \`{ ok: true, result: [ ...resources ] }\`:
|
|
48825
48868
|
\`\`\`js
|
|
48826
|
-
process.stdout.write(JSON.stringify([{ id: "a", name: "A", group: "G" }]));
|
|
48869
|
+
process.stdout.write(JSON.stringify({ ok: true, result: [{ id: "a", name: "A", group: "G" }] }));
|
|
48827
48870
|
\`\`\`
|
|
48828
48871
|
|
|
48829
48872
|
Set \`connection.resourceLabel\` for the selection panel title.
|
|
@@ -48846,11 +48889,25 @@ Use the \`manage_plugin\` tool. The loop:
|
|
|
48846
48889
|
|
|
48847
48890
|
1. \`action: "validate"\` with \`{ type, manifest, handlers }\` \u2014 dry-run, no writes, returns diagnostics.
|
|
48848
48891
|
2. \`action: "create"\` or \`"update"\` \u2014 writes files, bumps version, reloads.
|
|
48849
|
-
3.
|
|
48892
|
+
3. If the plugin has \`connection.fields\` and a tool reads credentials: a **human**
|
|
48893
|
+
must configure a connection of this plugin type. You cannot create credentials.
|
|
48894
|
+
Call \`list_connections { type }\` first \u2014 if none exist, use \`ask_user_to_clarify\`
|
|
48895
|
+
to state explicitly that only the human can configure the connector, ask them to
|
|
48896
|
+
add it (Console \u2192 Connections) and to give you the connection key. Do not claim
|
|
48897
|
+
the tool works until a real \`connectionKey\` test passes.
|
|
48898
|
+
4. \`action: "test"\` to exercise a handler without an LLM:
|
|
48850
48899
|
- Tool: \`{ type, target: { kind: "tool", name, input, connectionKey? } }\`
|
|
48851
48900
|
- Connection: \`{ type, target: { kind: "connection-test" } }\` or \`{ kind: "connection-discover" }\`
|
|
48852
48901
|
Returns \`{ ok, result, exitCode, durationMs, stdout, stderr }\`.
|
|
48853
|
-
|
|
48902
|
+
For credentialed tools, pass the real \`connectionKey\`. Without one, the handler
|
|
48903
|
+
receives an empty connection \u2014 that only checks plumbing, NOT functional success.
|
|
48904
|
+
5. \`action: "reload"\` if you edited files directly.
|
|
48905
|
+
|
|
48906
|
+
## Secrets
|
|
48907
|
+
- \`list_connections\` returns identifiers only (\`key\`/\`name\`/\`description\`), never config or secrets.
|
|
48908
|
+
- \`test\` output is redacted: real connection secret values are replaced with
|
|
48909
|
+
\`[redacted]\`. Never rely on echoing credentials to verify a handler \u2014 assert on
|
|
48910
|
+
functional output instead.
|
|
48854
48911
|
|
|
48855
48912
|
## Common failures
|
|
48856
48913
|
| Symptom | Cause |
|
|
@@ -48860,9 +48917,12 @@ Use the \`manage_plugin\` tool. The loop:
|
|
|
48860
48917
|
| TOOL_SCHEMA | unsupported JSON Schema keyword |
|
|
48861
48918
|
| non-zero exit | handler threw; read stdout/stderr from \`test\` |
|
|
48862
48919
|
| old behaviour after edit | version/hash unchanged \u2014 bump \`version\` or call \`reload\` |
|
|
48920
|
+
| empty connection in handler | no \`connectionKey\` passed, or no connection configured for this type |
|
|
48863
48921
|
|
|
48864
48922
|
Fall back to \`execute_code\`/\`shell\` to run \`node handlers/x.js\` manually with
|
|
48865
|
-
\`PLUGIN_INPUT\`
|
|
48923
|
+
\`PLUGIN_INPUT\` and a synthetic \`PLUGIN_CONNECTION_FILE\` to reproduce logic bugs.
|
|
48924
|
+
A synthetic fixture only verifies plumbing \u2014 a real upstream call requires a real
|
|
48925
|
+
\`connectionKey\` configured by a human.
|
|
48866
48926
|
`,
|
|
48867
48927
|
resources: {}
|
|
48868
48928
|
}
|
|
@@ -48893,8 +48953,13 @@ implemented", "UI added", "validated/tested via manage_plugin"). As you work,
|
|
|
48893
48953
|
update each Task's status to reflect reality. Never use \`write_todos\`.
|
|
48894
48954
|
|
|
48895
48955
|
Author with the \`manage_plugin\` tool: validate, then create/update, then test.
|
|
48896
|
-
|
|
48897
|
-
\`
|
|
48956
|
+
If a tool needs credentials, a human must configure the connection \u2014 use
|
|
48957
|
+
\`list_connections\` to check, and \`ask_user_to_clarify\` to ask the human to add
|
|
48958
|
+
the connector and give you its key. Only after a real \`connectionKey\` test
|
|
48959
|
+
passes may you call the tool verified; without it, report functionality as
|
|
48960
|
+
unverified (missing credentials), not as passing. Use \`shell_exec\` (the tool
|
|
48961
|
+
provided by the \`code_eval\` middleware) to run \`node handlers/x.js\` for manual
|
|
48962
|
+
checks when reproducing a failure.`;
|
|
48898
48963
|
|
|
48899
48964
|
// src/middlewares/sandboxPluginsMiddleware.ts
|
|
48900
48965
|
var PLUGIN_BUILDER_SKILLS = [...Object.keys(SANDBOX_PLUGIN_SKILLS), "task-tracking"];
|
|
@@ -48902,6 +48967,37 @@ function tenantIdFrom(exeConfig) {
|
|
|
48902
48967
|
const c = exeConfig;
|
|
48903
48968
|
return c?.configurable?.runConfig?.tenantId ?? "default";
|
|
48904
48969
|
}
|
|
48970
|
+
function collectSecretValues(connection, fields) {
|
|
48971
|
+
if (!connection) return [];
|
|
48972
|
+
const values = [];
|
|
48973
|
+
for (const field of fields) {
|
|
48974
|
+
const value = connection[field];
|
|
48975
|
+
if (typeof value === "string" && value.length > 0) values.push(value);
|
|
48976
|
+
}
|
|
48977
|
+
return values;
|
|
48978
|
+
}
|
|
48979
|
+
function errorText(err) {
|
|
48980
|
+
return err instanceof Error ? err.message : String(err);
|
|
48981
|
+
}
|
|
48982
|
+
function redactString(value, secrets) {
|
|
48983
|
+
let out = value;
|
|
48984
|
+
for (const secret of secrets) out = out.split(secret).join("[redacted]");
|
|
48985
|
+
return out;
|
|
48986
|
+
}
|
|
48987
|
+
function redactSecretValues(payload, secrets) {
|
|
48988
|
+
if (secrets.length === 0) return payload;
|
|
48989
|
+
const walk = (node) => {
|
|
48990
|
+
if (typeof node === "string") return redactString(node, secrets);
|
|
48991
|
+
if (Array.isArray(node)) return node.map(walk);
|
|
48992
|
+
if (node !== null && typeof node === "object") {
|
|
48993
|
+
const out = {};
|
|
48994
|
+
for (const [key5, value] of Object.entries(node)) out[key5] = walk(value);
|
|
48995
|
+
return out;
|
|
48996
|
+
}
|
|
48997
|
+
return node;
|
|
48998
|
+
};
|
|
48999
|
+
return walk(payload);
|
|
49000
|
+
}
|
|
48905
49001
|
var managePluginSchema = import_zod71.z.object({
|
|
48906
49002
|
action: import_zod71.z.enum(["list", "get", "validate", "create", "update", "delete", "reload", "test"]),
|
|
48907
49003
|
type: import_zod71.z.string().optional(),
|
|
@@ -48933,6 +49029,10 @@ var sandboxPluginsPlugin = {
|
|
|
48933
49029
|
description: "Author and manage tenant plugins in the shared sandbox: clarify goal, inputs/outputs, credentials, and whether a UI is needed; then write the manifest and JS handlers, add an optional HTML MCP App UI, and validate/test with the manage_plugin tool.",
|
|
48934
49030
|
type: import_protocols38.AgentType.DEEP_AGENT,
|
|
48935
49031
|
prompt: PLUGIN_BUILDER_PROMPT,
|
|
49032
|
+
// Read-only discovery of connection identifiers (metadata only — never
|
|
49033
|
+
// config/secrets) so the builder can confirm a human configured a
|
|
49034
|
+
// connector and pass its key to `manage_plugin test`.
|
|
49035
|
+
tools: ["list_connections"],
|
|
48936
49036
|
middleware: [
|
|
48937
49037
|
{
|
|
48938
49038
|
id: "sandbox-plugins",
|
|
@@ -49068,8 +49168,19 @@ var sandboxPluginsPlugin = {
|
|
|
49068
49168
|
input.target.connectionKey ? { connections: [input.target.connectionKey] } : { connectAll: true },
|
|
49069
49169
|
{ tenantId: tenantId2 }
|
|
49070
49170
|
);
|
|
49071
|
-
const
|
|
49072
|
-
|
|
49171
|
+
const secrets2 = collectSecretValues(connection, connectionSecretFields(plugin));
|
|
49172
|
+
try {
|
|
49173
|
+
const result = await plugin.connection?.test?.(connection ?? {});
|
|
49174
|
+
return JSON.stringify(redactSecretValues(
|
|
49175
|
+
result ?? { ok: false, message: "no test handler" },
|
|
49176
|
+
secrets2
|
|
49177
|
+
));
|
|
49178
|
+
} catch (err) {
|
|
49179
|
+
return JSON.stringify(redactSecretValues(
|
|
49180
|
+
{ ok: false, message: errorText(err) },
|
|
49181
|
+
secrets2
|
|
49182
|
+
));
|
|
49183
|
+
}
|
|
49073
49184
|
}
|
|
49074
49185
|
if (input.target.kind === "connection-discover") {
|
|
49075
49186
|
const { connection } = await resolveSandboxPluginConnections(
|
|
@@ -49077,8 +49188,16 @@ var sandboxPluginsPlugin = {
|
|
|
49077
49188
|
input.target.connectionKey ? { connections: [input.target.connectionKey] } : { connectAll: true },
|
|
49078
49189
|
{ tenantId: tenantId2 }
|
|
49079
49190
|
);
|
|
49080
|
-
const
|
|
49081
|
-
|
|
49191
|
+
const secrets2 = collectSecretValues(connection, connectionSecretFields(plugin));
|
|
49192
|
+
try {
|
|
49193
|
+
const result = await plugin.connection?.discover?.(connection ?? {});
|
|
49194
|
+
return JSON.stringify(redactSecretValues(result ?? [], secrets2));
|
|
49195
|
+
} catch (err) {
|
|
49196
|
+
return JSON.stringify(redactSecretValues(
|
|
49197
|
+
{ error: errorText(err) },
|
|
49198
|
+
secrets2
|
|
49199
|
+
));
|
|
49200
|
+
}
|
|
49082
49201
|
}
|
|
49083
49202
|
const executor = catalog2.getExecutor();
|
|
49084
49203
|
const manifestContent = await catalog2.readPluginFile(tenantId2, input.type, "plugin.json");
|
|
@@ -49096,19 +49215,24 @@ var sandboxPluginsPlugin = {
|
|
|
49096
49215
|
{ connections: [input.target.connectionKey] },
|
|
49097
49216
|
{ tenantId: tenantId2 }
|
|
49098
49217
|
) : {};
|
|
49099
|
-
const
|
|
49100
|
-
|
|
49101
|
-
|
|
49102
|
-
|
|
49103
|
-
|
|
49104
|
-
|
|
49105
|
-
|
|
49106
|
-
|
|
49107
|
-
tenantId: tenantId2,
|
|
49108
|
-
|
|
49109
|
-
|
|
49110
|
-
|
|
49111
|
-
|
|
49218
|
+
const secrets = collectSecretValues(resolved.connection, connectionSecretFields(plugin));
|
|
49219
|
+
try {
|
|
49220
|
+
const result = await executor.invoke({
|
|
49221
|
+
manifest: parsedManifest,
|
|
49222
|
+
handler: toolDef.handler,
|
|
49223
|
+
input: input.target.input ?? null,
|
|
49224
|
+
connection: resolved.connection,
|
|
49225
|
+
connections: resolved.connections,
|
|
49226
|
+
context: { tenantId: tenantId2, pluginType: input.type, tool: toolDef.name },
|
|
49227
|
+
runConfig: {
|
|
49228
|
+
tenantId: tenantId2,
|
|
49229
|
+
assistantId: typeof runCfg.assistant_id === "string" ? runCfg.assistant_id : void 0
|
|
49230
|
+
}
|
|
49231
|
+
});
|
|
49232
|
+
return JSON.stringify(redactSecretValues(result, secrets));
|
|
49233
|
+
} catch (err) {
|
|
49234
|
+
return JSON.stringify(redactSecretValues({ ok: false, error: errorText(err) }, secrets));
|
|
49235
|
+
}
|
|
49112
49236
|
}
|
|
49113
49237
|
default:
|
|
49114
49238
|
return `unsupported action: ${input.action}`;
|
|
@@ -49770,6 +49894,7 @@ registerBuiltinPlugins();
|
|
|
49770
49894
|
clearEncryptionKeyCache,
|
|
49771
49895
|
clearEvalRunService,
|
|
49772
49896
|
clearSandboxOpenCredentialProviderForTests,
|
|
49897
|
+
collectPluginSources,
|
|
49773
49898
|
collectionLatticeManager,
|
|
49774
49899
|
compileInternal,
|
|
49775
49900
|
compileSandboxPlugin,
|
|
@@ -49779,6 +49904,7 @@ registerBuiltinPlugins();
|
|
|
49779
49904
|
configurePluginCatalogSync,
|
|
49780
49905
|
configureStores,
|
|
49781
49906
|
connectAllChannels,
|
|
49907
|
+
connectionSecretFields,
|
|
49782
49908
|
convertToConnection,
|
|
49783
49909
|
createAgentNode,
|
|
49784
49910
|
createAgentTeam,
|
|
@@ -49819,11 +49945,13 @@ registerBuiltinPlugins();
|
|
|
49819
49945
|
createUnknownToolHandlerMiddleware,
|
|
49820
49946
|
createWidgetMiddleware,
|
|
49821
49947
|
decrypt,
|
|
49948
|
+
decryptConfigFields,
|
|
49822
49949
|
describeCronExpression,
|
|
49823
49950
|
documentLearningPlugin,
|
|
49824
49951
|
documentParserPlugin,
|
|
49825
49952
|
embeddingsLatticeManager,
|
|
49826
49953
|
encrypt,
|
|
49954
|
+
encryptConfigFields,
|
|
49827
49955
|
ensureBuiltinAgentsForTenant,
|
|
49828
49956
|
ensurePluginSkillInSandbox,
|
|
49829
49957
|
evaluateLatticeCaseWithLogs,
|
|
@@ -49906,6 +50034,7 @@ registerBuiltinPlugins();
|
|
|
49906
50034
|
jsonSchemaToZod,
|
|
49907
50035
|
listCollectionEntries,
|
|
49908
50036
|
listSandboxProviderTypes,
|
|
50037
|
+
listTenantPlugins,
|
|
49909
50038
|
loggerLatticeManager,
|
|
49910
50039
|
mcpManager,
|
|
49911
50040
|
mergeCapabilityBundles,
|