@axiom-lattice/core 10.0.5 → 11.0.0
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 +499 -11
- package/dist/index.d.ts +499 -11
- package/dist/index.js +1764 -344
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1661 -255
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -11349,25 +11349,38 @@ domains your configured middleware exposes \u2014 and nothing beyond it.
|
|
|
11349
11349
|
|
|
11350
11350
|
## Client
|
|
11351
11351
|
|
|
11352
|
-
The sandbox
|
|
11353
|
-
|
|
11354
|
-
|
|
11355
|
-
- **Preinstalled in the sandbox image** (recommended): \`open-mcp\` is on \`PATH\`; for
|
|
11356
|
-
\`require("@axiom-lattice/open-mcp-client")\` to resolve, install it into the working
|
|
11357
|
-
directory or point \`NODE_PATH\` at the global \`node_modules\`.
|
|
11358
|
-
- **Install it in this run** when the sandbox has network + npm:
|
|
11359
|
-
|
|
11360
|
-
\`\`\`bash
|
|
11361
|
-
npm install @axiom-lattice/open-mcp-client
|
|
11362
|
-
# or use without installing:
|
|
11363
|
-
npx @axiom-lattice/open-mcp-client tools list --json
|
|
11364
|
-
\`\`\`
|
|
11352
|
+
The sandbox image provides the zero-dependency \`@axiom-lattice/open-mcp-client\`
|
|
11353
|
+
package. Use the bare module:
|
|
11365
11354
|
|
|
11366
11355
|
\`\`\`js
|
|
11367
11356
|
const { OpenMcpClient } = require("@axiom-lattice/open-mcp-client");
|
|
11368
11357
|
const client = OpenMcpClient.fromEnv(); // reads API_GATEWAY_URL + OPEN_API_TOKEN
|
|
11369
11358
|
\`\`\`
|
|
11370
11359
|
|
|
11360
|
+
## Plugin handlers
|
|
11361
|
+
|
|
11362
|
+
A sandbox plugin handler reads the platform API key from its connection:
|
|
11363
|
+
|
|
11364
|
+
\`\`\`js
|
|
11365
|
+
const conn = JSON.parse(
|
|
11366
|
+
require("fs").readFileSync(process.env.PLUGIN_CONNECTION_FILE, "utf8"),
|
|
11367
|
+
).connection;
|
|
11368
|
+
const client = new OpenMcpClient({
|
|
11369
|
+
url: process.env.API_GATEWAY_URL,
|
|
11370
|
+
token: conn.platformApiKey, // \u4F5C\u8005\u5728 connection.fields \u91CC\u5B9A\u4E49\u7684\u5B57\u6BB5
|
|
11371
|
+
});
|
|
11372
|
+
\`\`\`
|
|
11373
|
+
|
|
11374
|
+
- The platform key is a normal password field defined by the plugin author; the
|
|
11375
|
+
framework does not inject or rename it.
|
|
11376
|
+
- \`OPEN_API_TOKEN\` is only for agent \`code_eval\`; plugin handlers use the
|
|
11377
|
+
connection key directly.
|
|
11378
|
+
- Caller grants gate entry and connection selection; after that, the connection
|
|
11379
|
+
key's grants apply (service-account model).
|
|
11380
|
+
|
|
11381
|
+
Resource selection is not the handler's job: Open MCP tools are already bound to
|
|
11382
|
+
their resources. Use \`listTools()\` and \`callTool()\` only.
|
|
11383
|
+
|
|
11371
11384
|
CLI equivalents (config comes from the same env vars):
|
|
11372
11385
|
|
|
11373
11386
|
\`\`\`bash
|
|
@@ -12072,6 +12085,142 @@ var InMemoryMenuStore = class {
|
|
|
12072
12085
|
}
|
|
12073
12086
|
};
|
|
12074
12087
|
|
|
12088
|
+
// src/store_lattice/InMemorySharedResourceStore.ts
|
|
12089
|
+
var DuplicateShareTokenError = class extends Error {
|
|
12090
|
+
/**
|
|
12091
|
+
* Creates a duplicate share token error.
|
|
12092
|
+
*
|
|
12093
|
+
* @param token - Token that is already present in the store.
|
|
12094
|
+
*/
|
|
12095
|
+
constructor(token) {
|
|
12096
|
+
super(`Share token '${token}' already exists`);
|
|
12097
|
+
/** Machine-readable failure code. */
|
|
12098
|
+
this.code = "DUPLICATE_SHARE_TOKEN";
|
|
12099
|
+
this.name = "DuplicateShareTokenError";
|
|
12100
|
+
this.token = token;
|
|
12101
|
+
}
|
|
12102
|
+
};
|
|
12103
|
+
var MUTABLE_FIELDS = [
|
|
12104
|
+
"title",
|
|
12105
|
+
"expiresAt",
|
|
12106
|
+
"maxAccess",
|
|
12107
|
+
"revoked",
|
|
12108
|
+
"visibility",
|
|
12109
|
+
"passwordHash"
|
|
12110
|
+
];
|
|
12111
|
+
function cloneShareRecord(record) {
|
|
12112
|
+
return structuredClone(record);
|
|
12113
|
+
}
|
|
12114
|
+
var InMemorySharedResourceStore = class {
|
|
12115
|
+
constructor() {
|
|
12116
|
+
this.records = /* @__PURE__ */ new Map();
|
|
12117
|
+
}
|
|
12118
|
+
/**
|
|
12119
|
+
* Finds a share by its token.
|
|
12120
|
+
*
|
|
12121
|
+
* @param token - Share token to look up.
|
|
12122
|
+
* @returns An independent copy of the record, or `null` when absent.
|
|
12123
|
+
*/
|
|
12124
|
+
async findByToken(token) {
|
|
12125
|
+
const record = this.records.get(token);
|
|
12126
|
+
return record ? cloneShareRecord(record) : null;
|
|
12127
|
+
}
|
|
12128
|
+
/**
|
|
12129
|
+
* Inserts a new share record with `accessCount: 0`, `version: 1`, and the
|
|
12130
|
+
* current `createdAt`.
|
|
12131
|
+
*
|
|
12132
|
+
* @param record - Insert shape for the new share.
|
|
12133
|
+
* @returns An independent copy of the stored record.
|
|
12134
|
+
* @throws {DuplicateShareTokenError} When the token is already stored.
|
|
12135
|
+
*/
|
|
12136
|
+
async create(record) {
|
|
12137
|
+
if (this.records.has(record.token)) {
|
|
12138
|
+
throw new DuplicateShareTokenError(record.token);
|
|
12139
|
+
}
|
|
12140
|
+
const stored = {
|
|
12141
|
+
...record,
|
|
12142
|
+
accessCount: 0,
|
|
12143
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
12144
|
+
version: 1
|
|
12145
|
+
};
|
|
12146
|
+
this.records.set(stored.token, cloneShareRecord(stored));
|
|
12147
|
+
return cloneShareRecord(stored);
|
|
12148
|
+
}
|
|
12149
|
+
/**
|
|
12150
|
+
* Applies a patch to an existing share.
|
|
12151
|
+
*
|
|
12152
|
+
* Only `title`, `expiresAt`, `maxAccess`, `revoked`, `visibility`, and
|
|
12153
|
+
* `passwordHash` are applied; other keys (for example `token`, `kind`, or
|
|
12154
|
+
* `address`) are ignored. `undefined` values are treated as "no change".
|
|
12155
|
+
* Missing tokens are a no-op.
|
|
12156
|
+
*
|
|
12157
|
+
* @param token - Token of the share to update.
|
|
12158
|
+
* @param patch - Mutable fields to apply.
|
|
12159
|
+
*/
|
|
12160
|
+
async update(token, patch) {
|
|
12161
|
+
const current = this.records.get(token);
|
|
12162
|
+
if (!current) return;
|
|
12163
|
+
const updates = {};
|
|
12164
|
+
for (const field of MUTABLE_FIELDS) {
|
|
12165
|
+
if (patch[field] !== void 0) {
|
|
12166
|
+
updates[field] = patch[field];
|
|
12167
|
+
}
|
|
12168
|
+
}
|
|
12169
|
+
if (Object.keys(updates).length === 0) return;
|
|
12170
|
+
const next = cloneShareRecord(current);
|
|
12171
|
+
Object.assign(next, updates);
|
|
12172
|
+
this.records.set(token, cloneShareRecord(next));
|
|
12173
|
+
}
|
|
12174
|
+
/**
|
|
12175
|
+
* Lists a user's shares within a tenant, newest first by `createdAt`.
|
|
12176
|
+
*
|
|
12177
|
+
* @param tenantId - Tenant to scope the listing to.
|
|
12178
|
+
* @param userId - Creator (`createdBy`) to scope the listing to.
|
|
12179
|
+
* @returns Independent copies of matching records.
|
|
12180
|
+
*/
|
|
12181
|
+
async listByUser(tenantId2, userId) {
|
|
12182
|
+
return [...this.records.values()].map((record, insertionIndex) => ({ record, insertionIndex })).filter(
|
|
12183
|
+
({ record }) => record.tenantId === tenantId2 && record.createdBy === userId
|
|
12184
|
+
).sort(
|
|
12185
|
+
(left, right) => right.record.createdAt.getTime() - left.record.createdAt.getTime() || right.insertionIndex - left.insertionIndex
|
|
12186
|
+
).map(({ record }) => cloneShareRecord(record));
|
|
12187
|
+
}
|
|
12188
|
+
/**
|
|
12189
|
+
* Increments `accessCount` unconditionally when the token exists.
|
|
12190
|
+
*
|
|
12191
|
+
* Use {@link atomicIncrementAccess} when revocation, expiry, and `maxAccess`
|
|
12192
|
+
* must be enforced.
|
|
12193
|
+
*
|
|
12194
|
+
* @param token - Token of the share to count.
|
|
12195
|
+
*/
|
|
12196
|
+
async incrementAccess(token) {
|
|
12197
|
+
const current = this.records.get(token);
|
|
12198
|
+
if (current) current.accessCount += 1;
|
|
12199
|
+
}
|
|
12200
|
+
/**
|
|
12201
|
+
* Atomically increments `accessCount` only when the share is usable and the
|
|
12202
|
+
* access limit has not been reached.
|
|
12203
|
+
*
|
|
12204
|
+
* A share is considered expired when `expiresAt.getTime() <= Date.now()`,
|
|
12205
|
+
* matching PostgreSQL's `expires_at > NOW()` check.
|
|
12206
|
+
*
|
|
12207
|
+
* @param token - Token of the share to count.
|
|
12208
|
+
* @returns `true` when access was granted, `false` otherwise.
|
|
12209
|
+
*/
|
|
12210
|
+
async atomicIncrementAccess(token) {
|
|
12211
|
+
const current = this.records.get(token);
|
|
12212
|
+
if (!current || current.revoked) return false;
|
|
12213
|
+
if (current.expiresAt && current.expiresAt.getTime() <= Date.now()) {
|
|
12214
|
+
return false;
|
|
12215
|
+
}
|
|
12216
|
+
if (current.maxAccess !== null && current.accessCount >= current.maxAccess) {
|
|
12217
|
+
return false;
|
|
12218
|
+
}
|
|
12219
|
+
current.accessCount += 1;
|
|
12220
|
+
return true;
|
|
12221
|
+
}
|
|
12222
|
+
};
|
|
12223
|
+
|
|
12075
12224
|
// src/model_lattice/ModelLatticeManager.ts
|
|
12076
12225
|
var TENANT_DEFAULT_MISS_TTL_MS = 3e4;
|
|
12077
12226
|
var ModelLatticeManager = class _ModelLatticeManager extends BaseLatticeManager {
|
|
@@ -12620,11 +12769,11 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
|
|
|
12620
12769
|
* @param key Lattice键名
|
|
12621
12770
|
* @param tool 已有的StructuredTool实例
|
|
12622
12771
|
*/
|
|
12623
|
-
registerExistingTool(key5,
|
|
12772
|
+
registerExistingTool(key5, tool68) {
|
|
12624
12773
|
const config = {
|
|
12625
|
-
name:
|
|
12626
|
-
description:
|
|
12627
|
-
schema:
|
|
12774
|
+
name: tool68.name,
|
|
12775
|
+
description: tool68.description,
|
|
12776
|
+
schema: tool68.schema,
|
|
12628
12777
|
// StructuredTool的schema已经是Zod兼容的
|
|
12629
12778
|
needUserApprove: false
|
|
12630
12779
|
// MCP工具默认不需要用户批准
|
|
@@ -12632,7 +12781,7 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
|
|
|
12632
12781
|
const toolLattice = {
|
|
12633
12782
|
key: key5,
|
|
12634
12783
|
config,
|
|
12635
|
-
client:
|
|
12784
|
+
client: tool68
|
|
12636
12785
|
};
|
|
12637
12786
|
this.register(key5, toolLattice);
|
|
12638
12787
|
}
|
|
@@ -12643,14 +12792,14 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
|
|
|
12643
12792
|
* @param key - tool lattice key (no tenant prefix)
|
|
12644
12793
|
* @param tool - the StructuredTool client
|
|
12645
12794
|
*/
|
|
12646
|
-
registerExistingToolWithTenant(tenantId2, key5,
|
|
12795
|
+
registerExistingToolWithTenant(tenantId2, key5, tool68) {
|
|
12647
12796
|
const config = {
|
|
12648
|
-
name:
|
|
12649
|
-
description:
|
|
12650
|
-
schema:
|
|
12797
|
+
name: tool68.name,
|
|
12798
|
+
description: tool68.description,
|
|
12799
|
+
schema: tool68.schema,
|
|
12651
12800
|
needUserApprove: false
|
|
12652
12801
|
};
|
|
12653
|
-
const toolLattice = { key: key5, config, client:
|
|
12802
|
+
const toolLattice = { key: key5, config, client: tool68 };
|
|
12654
12803
|
this.registerWithTenant(tenantId2, key5, toolLattice);
|
|
12655
12804
|
}
|
|
12656
12805
|
/**
|
|
@@ -12700,8 +12849,8 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
|
|
|
12700
12849
|
};
|
|
12701
12850
|
var toolLatticeManager = ToolLatticeManager.getInstance();
|
|
12702
12851
|
var registerToolLattice = (key5, config, executor) => toolLatticeManager.registerLattice(key5, config, executor);
|
|
12703
|
-
var registerExistingTool = (key5,
|
|
12704
|
-
var registerExistingToolWithTenant = (tenantId2, key5,
|
|
12852
|
+
var registerExistingTool = (key5, tool68) => toolLatticeManager.registerExistingTool(key5, tool68);
|
|
12853
|
+
var registerExistingToolWithTenant = (tenantId2, key5, tool68) => toolLatticeManager.registerExistingToolWithTenant(tenantId2, key5, tool68);
|
|
12705
12854
|
var getToolLattice = (key5) => toolLatticeManager.getToolLattice(key5);
|
|
12706
12855
|
var getToolClientWithTenant = (tenantId2, key5) => toolLatticeManager.getToolClientWithTenant(tenantId2, key5);
|
|
12707
12856
|
var getToolDefinition = (key5) => toolLatticeManager.getToolDefinition(key5);
|
|
@@ -15691,6 +15840,7 @@ var SANDBOX_OPEN_GATEWAY_URL_ENV = "API_GATEWAY_URL";
|
|
|
15691
15840
|
var SANDBOX_OPEN_TOKEN_ENV = "OPEN_API_TOKEN";
|
|
15692
15841
|
var provider;
|
|
15693
15842
|
var providerErrorHandler;
|
|
15843
|
+
var gatewayUrlProvider;
|
|
15694
15844
|
function registerSandboxOpenCredentialProvider(next, options = {}) {
|
|
15695
15845
|
provider = next;
|
|
15696
15846
|
providerErrorHandler = options.onError;
|
|
@@ -15713,6 +15863,15 @@ async function getSandboxOpenCredential(context) {
|
|
|
15713
15863
|
return void 0;
|
|
15714
15864
|
}
|
|
15715
15865
|
}
|
|
15866
|
+
function registerSandboxOpenGatewayUrlProvider(next) {
|
|
15867
|
+
gatewayUrlProvider = next;
|
|
15868
|
+
return () => {
|
|
15869
|
+
if (gatewayUrlProvider === next) gatewayUrlProvider = void 0;
|
|
15870
|
+
};
|
|
15871
|
+
}
|
|
15872
|
+
function getSandboxOpenGatewayUrl() {
|
|
15873
|
+
return gatewayUrlProvider?.();
|
|
15874
|
+
}
|
|
15716
15875
|
function buildSandboxOpenEnv(credential) {
|
|
15717
15876
|
return `export ${SANDBOX_OPEN_GATEWAY_URL_ENV}=${shellSingleQuote(credential.gatewayUrl)} && export ${SANDBOX_OPEN_TOKEN_ENV}=${shellSingleQuote(credential.token)}`;
|
|
15718
15877
|
}
|
|
@@ -15722,6 +15881,7 @@ function shellSingleQuote(value) {
|
|
|
15722
15881
|
function clearSandboxOpenCredentialProviderForTests() {
|
|
15723
15882
|
provider = void 0;
|
|
15724
15883
|
providerErrorHandler = void 0;
|
|
15884
|
+
gatewayUrlProvider = void 0;
|
|
15725
15885
|
}
|
|
15726
15886
|
|
|
15727
15887
|
// src/tool_lattice/shell_exec/index.ts
|
|
@@ -19633,6 +19793,48 @@ function ensurePatchToolCallsMiddleware(middleware) {
|
|
|
19633
19793
|
});
|
|
19634
19794
|
}
|
|
19635
19795
|
|
|
19796
|
+
// src/deep_agent_new/middleware/structuredOutputCarrier.ts
|
|
19797
|
+
import { AIMessage as AIMessage5, createMiddleware as createMiddleware12 } from "langchain";
|
|
19798
|
+
var STRUCTURED_OUTPUT_CARRIER_MIDDLEWARE_NAME = "structuredOutputCarrierMiddleware";
|
|
19799
|
+
function createStructuredOutputCarrierMiddleware() {
|
|
19800
|
+
return createMiddleware12({
|
|
19801
|
+
name: STRUCTURED_OUTPUT_CARRIER_MIDDLEWARE_NAME,
|
|
19802
|
+
wrapModelCall: async (request, handler) => {
|
|
19803
|
+
const result = await handler(request);
|
|
19804
|
+
if (AIMessage5.isInstance(result)) return result;
|
|
19805
|
+
const structured = readStructuredOutputResult(result);
|
|
19806
|
+
if (!structured) return result;
|
|
19807
|
+
const carrier = new AIMessage5({ content: "" });
|
|
19808
|
+
carrier.structuredResponse = structured.structuredResponse;
|
|
19809
|
+
carrier.messages = structured.messages;
|
|
19810
|
+
return carrier;
|
|
19811
|
+
}
|
|
19812
|
+
});
|
|
19813
|
+
}
|
|
19814
|
+
function ensureStructuredOutputCarrierMiddleware(middleware) {
|
|
19815
|
+
const matches = middleware.filter(
|
|
19816
|
+
(candidate) => candidate.name === STRUCTURED_OUTPUT_CARRIER_MIDDLEWARE_NAME
|
|
19817
|
+
);
|
|
19818
|
+
const withoutCarrier = middleware.filter(
|
|
19819
|
+
(candidate) => candidate.name !== STRUCTURED_OUTPUT_CARRIER_MIDDLEWARE_NAME
|
|
19820
|
+
);
|
|
19821
|
+
const carrier = matches[0] ?? createStructuredOutputCarrierMiddleware();
|
|
19822
|
+
if (matches.length === 1 && middleware[middleware.length - 1] === carrier) {
|
|
19823
|
+
return middleware;
|
|
19824
|
+
}
|
|
19825
|
+
return [...withoutCarrier, carrier];
|
|
19826
|
+
}
|
|
19827
|
+
function readStructuredOutputResult(value) {
|
|
19828
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
19829
|
+
if (!("structuredResponse" in value)) return void 0;
|
|
19830
|
+
const record = value;
|
|
19831
|
+
if (!Array.isArray(record.messages)) return void 0;
|
|
19832
|
+
return {
|
|
19833
|
+
structuredResponse: record.structuredResponse,
|
|
19834
|
+
messages: record.messages
|
|
19835
|
+
};
|
|
19836
|
+
}
|
|
19837
|
+
|
|
19636
19838
|
// src/agent_lattice/builders/commonMiddleware.ts
|
|
19637
19839
|
import { summarizationMiddleware } from "langchain";
|
|
19638
19840
|
|
|
@@ -19725,7 +19927,7 @@ function createSandboxResolver(getSandboxFromConfig) {
|
|
|
19725
19927
|
}
|
|
19726
19928
|
|
|
19727
19929
|
// src/middlewares/evalMiddleware.ts
|
|
19728
|
-
import { createMiddleware as
|
|
19930
|
+
import { createMiddleware as createMiddleware13, tool as tool39 } from "langchain";
|
|
19729
19931
|
import { z as z44 } from "zod";
|
|
19730
19932
|
import { v4 as uuidv43 } from "uuid";
|
|
19731
19933
|
|
|
@@ -20393,7 +20595,7 @@ var evalPlugin = {
|
|
|
20393
20595
|
defaultConfig: {}
|
|
20394
20596
|
},
|
|
20395
20597
|
skills: EVAL_SKILLS,
|
|
20396
|
-
middleware: () =>
|
|
20598
|
+
middleware: () => createMiddleware13({
|
|
20397
20599
|
name: "EvalMiddleware",
|
|
20398
20600
|
tools: [createReadEvalTool(), createManageEvalTool(), createRunEvalTool()]
|
|
20399
20601
|
})
|
|
@@ -20556,11 +20758,13 @@ function errorFromStdout(stdout) {
|
|
|
20556
20758
|
return text.slice(0, 4096);
|
|
20557
20759
|
}
|
|
20558
20760
|
function buildResidentPayload(args, timeoutMs) {
|
|
20761
|
+
const gatewayUrl = getSandboxOpenGatewayUrl();
|
|
20559
20762
|
return {
|
|
20560
20763
|
handler: args.handler,
|
|
20561
20764
|
input: args.input,
|
|
20562
20765
|
...args.connection === void 0 ? {} : { connection: args.connection },
|
|
20563
20766
|
...args.connections === void 0 ? {} : { connections: args.connections },
|
|
20767
|
+
...gatewayUrl === void 0 ? {} : { apiGatewayUrl: gatewayUrl },
|
|
20564
20768
|
context: args.context,
|
|
20565
20769
|
timeoutMs
|
|
20566
20770
|
};
|
|
@@ -20815,15 +21019,7 @@ var SandboxPluginExecutor = class {
|
|
|
20815
21019
|
workspaceId: args.runConfig?.workspaceId,
|
|
20816
21020
|
projectId: args.runConfig?.projectId
|
|
20817
21021
|
});
|
|
20818
|
-
const
|
|
20819
|
-
tenantId: tenantId2,
|
|
20820
|
-
workspaceId: args.runConfig?.workspaceId,
|
|
20821
|
-
projectId: args.runConfig?.projectId,
|
|
20822
|
-
sandboxName: sandbox.name,
|
|
20823
|
-
assistantId: args.runConfig?.assistantId,
|
|
20824
|
-
threadId: args.runConfig?.threadId,
|
|
20825
|
-
depth: args.runConfig?.depth
|
|
20826
|
-
}) : void 0;
|
|
21022
|
+
const gatewayUrl = getSandboxOpenGatewayUrl();
|
|
20827
21023
|
const timeoutMs = clamp(args.timeoutMs ?? DEFAULT_TIMEOUT_MS, MIN_TIMEOUT_MS, MAX_TIMEOUT_MS);
|
|
20828
21024
|
const cap = clamp(
|
|
20829
21025
|
args.maxResultBytes ?? DEFAULT_MAX_RESULT_BYTES,
|
|
@@ -20854,13 +21050,12 @@ var SandboxPluginExecutor = class {
|
|
|
20854
21050
|
envParts.push(`PLUGIN_CONNECTION_FILE=${quotePosixShellArg(connectionFile)}`);
|
|
20855
21051
|
}
|
|
20856
21052
|
envParts.push(`PLUGIN_CONTEXT=${quotePosixShellArg(encode(args.context))}`);
|
|
20857
|
-
if (
|
|
21053
|
+
if (gatewayUrl) {
|
|
20858
21054
|
envParts.push(
|
|
20859
|
-
`${SANDBOX_OPEN_GATEWAY_URL_ENV}=${quotePosixShellArg(
|
|
21055
|
+
`${SANDBOX_OPEN_GATEWAY_URL_ENV}=${quotePosixShellArg(gatewayUrl)}`
|
|
20860
21056
|
);
|
|
20861
|
-
envParts.push(`${SANDBOX_OPEN_TOKEN_ENV}=${quotePosixShellArg(openCredential.token)}`);
|
|
20862
21057
|
}
|
|
20863
|
-
const command =
|
|
21058
|
+
const command = `unset OPEN_API_TOKEN; unset API_GATEWAY_URL; ${envParts.join(" ")} node ${quotePosixShellArg(handlerAbs)}`;
|
|
20864
21059
|
const execResult = await sandbox.shell.execCommand({
|
|
20865
21060
|
command,
|
|
20866
21061
|
exec_dir: pluginDir,
|
|
@@ -21011,7 +21206,7 @@ function isSafeUiPath(path8) {
|
|
|
21011
21206
|
}
|
|
21012
21207
|
function validateSandboxPluginManifest(args) {
|
|
21013
21208
|
const diagnostics = [];
|
|
21014
|
-
const error = (code, message, pluginType,
|
|
21209
|
+
const error = (code, message, pluginType, tool68) => diagnostics.push({ level: "error", code, message, pluginType, tool: tool68 });
|
|
21015
21210
|
const raw = args.raw;
|
|
21016
21211
|
if (!isRecord7(raw)) {
|
|
21017
21212
|
error("MANIFEST_NOT_OBJECT", "manifest must be a JSON object", args.dirName);
|
|
@@ -21253,7 +21448,7 @@ function validateSandboxPluginManifest(args) {
|
|
|
21253
21448
|
}
|
|
21254
21449
|
|
|
21255
21450
|
// src/sandbox_plugin/SandboxPluginCompiler.ts
|
|
21256
|
-
import { createMiddleware as
|
|
21451
|
+
import { createMiddleware as createMiddleware14, tool as tool40 } from "langchain";
|
|
21257
21452
|
|
|
21258
21453
|
// src/connection/PluginConnectionResolver.ts
|
|
21259
21454
|
async function resolvePluginConnections(type, config, scope) {
|
|
@@ -21314,14 +21509,20 @@ function sandboxRunConfigFrom(exeConfig) {
|
|
|
21314
21509
|
// src/mcp_lattice/mcpUi.ts
|
|
21315
21510
|
import { DynamicStructuredTool } from "@langchain/core/tools";
|
|
21316
21511
|
var isObj = (v) => typeof v === "object" && v !== null;
|
|
21317
|
-
function extractAppsRef(meta, serverKey) {
|
|
21512
|
+
function extractAppsRef(meta, serverKey, toolName2) {
|
|
21318
21513
|
if (!isObj(meta)) return null;
|
|
21319
21514
|
const ui = isObj(meta.ui) ? meta.ui : void 0;
|
|
21320
21515
|
const nested = ui && typeof ui.resourceUri === "string" ? ui.resourceUri : "";
|
|
21321
21516
|
const flat = typeof meta["ui/resourceUri"] === "string" ? meta["ui/resourceUri"] : "";
|
|
21322
21517
|
const uri = nested || flat;
|
|
21323
21518
|
if (!uri.startsWith("ui://")) return null;
|
|
21324
|
-
return {
|
|
21519
|
+
return {
|
|
21520
|
+
kind: "mcp",
|
|
21521
|
+
serverKey,
|
|
21522
|
+
resourceUri: uri,
|
|
21523
|
+
displayMode: "inline",
|
|
21524
|
+
...toolName2 ? { toolName: toolName2 } : {}
|
|
21525
|
+
};
|
|
21325
21526
|
}
|
|
21326
21527
|
function extractLegacyRefs(content, serverKey) {
|
|
21327
21528
|
const blocks = Array.isArray(content) ? content : [];
|
|
@@ -21601,6 +21802,7 @@ function compileSandboxPlugin(args) {
|
|
|
21601
21802
|
pluginType: manifest.type,
|
|
21602
21803
|
resource: ui.resource,
|
|
21603
21804
|
displayMode: ui.displayMode ?? "inline",
|
|
21805
|
+
toolName: t.name,
|
|
21604
21806
|
...scope ? { scope } : {}
|
|
21605
21807
|
} : null;
|
|
21606
21808
|
return ref ? appendUiFence(text, ref) : text;
|
|
@@ -21608,7 +21810,7 @@ function compileSandboxPlugin(args) {
|
|
|
21608
21810
|
{ name: t.name, description: t.description, schema: jsonSchemaToZod(t.schema) }
|
|
21609
21811
|
)
|
|
21610
21812
|
);
|
|
21611
|
-
return
|
|
21813
|
+
return createMiddleware14({ name: `SandboxPlugin:${manifest.type}`, tools });
|
|
21612
21814
|
},
|
|
21613
21815
|
skills: manifest.skills,
|
|
21614
21816
|
agents: manifest.agents
|
|
@@ -22373,9 +22575,9 @@ function freezeMetadata(metadata) {
|
|
|
22373
22575
|
...resourceSelector ? { resourceSelector } : {}
|
|
22374
22576
|
});
|
|
22375
22577
|
}
|
|
22376
|
-
function toolName(
|
|
22377
|
-
if (typeof
|
|
22378
|
-
return typeof
|
|
22578
|
+
function toolName(tool68) {
|
|
22579
|
+
if (typeof tool68 !== "object" || tool68 === null || !("name" in tool68)) return void 0;
|
|
22580
|
+
return typeof tool68.name === "string" ? tool68.name : void 0;
|
|
22379
22581
|
}
|
|
22380
22582
|
function schemaHasConnectionKey(schema6) {
|
|
22381
22583
|
const definition = isRecord10(schema6._def) ? schema6._def : void 0;
|
|
@@ -22383,10 +22585,10 @@ function schemaHasConnectionKey(schema6) {
|
|
|
22383
22585
|
const fields = typeof shape === "function" ? shape() : shape;
|
|
22384
22586
|
return isRecord10(fields) && Object.prototype.hasOwnProperty.call(fields, "connectionKey");
|
|
22385
22587
|
}
|
|
22386
|
-
function hasConnectionKeySchema(
|
|
22387
|
-
if (!isRecord10(
|
|
22388
|
-
if (schemaHasConnectionKey(
|
|
22389
|
-
const definition = isRecord10(
|
|
22588
|
+
function hasConnectionKeySchema(tool68) {
|
|
22589
|
+
if (!isRecord10(tool68) || !isRecord10(tool68.schema)) return false;
|
|
22590
|
+
if (schemaHasConnectionKey(tool68.schema)) return true;
|
|
22591
|
+
const definition = isRecord10(tool68.schema._def) ? tool68.schema._def : void 0;
|
|
22390
22592
|
if (Array.isArray(definition?.options) && definition.options.length > 0) {
|
|
22391
22593
|
return definition.options.every(
|
|
22392
22594
|
(option) => isRecord10(option) && schemaHasConnectionKey(option)
|
|
@@ -22441,8 +22643,8 @@ var CapabilityToolRegistry = class {
|
|
|
22441
22643
|
* @remarks Standard connection authorization is captured only for tools whose
|
|
22442
22644
|
* schema declares `connectionKey`; legacy selectors remain explicit metadata.
|
|
22443
22645
|
*/
|
|
22444
|
-
register(name, metadata,
|
|
22445
|
-
this.registerInternal(name, metadata, hasConnectionKeySchema(
|
|
22646
|
+
register(name, metadata, tool68) {
|
|
22647
|
+
this.registerInternal(name, metadata, hasConnectionKeySchema(tool68));
|
|
22446
22648
|
}
|
|
22447
22649
|
/**
|
|
22448
22650
|
* Registers all tools actually exposed by a middleware instance.
|
|
@@ -22453,13 +22655,13 @@ var CapabilityToolRegistry = class {
|
|
|
22453
22655
|
* @returns Nothing.
|
|
22454
22656
|
*/
|
|
22455
22657
|
registerMiddleware(capabilityType, middleware, resourceSelectors = {}) {
|
|
22456
|
-
for (const
|
|
22457
|
-
const name = toolName(
|
|
22658
|
+
for (const tool68 of middleware.tools ?? []) {
|
|
22659
|
+
const name = toolName(tool68);
|
|
22458
22660
|
if (name) {
|
|
22459
22661
|
this.registerInternal(name, {
|
|
22460
22662
|
capabilityType,
|
|
22461
22663
|
resourceSelector: resourceSelectors[name]
|
|
22462
|
-
}, hasConnectionKeySchema(
|
|
22664
|
+
}, hasConnectionKeySchema(tool68));
|
|
22463
22665
|
}
|
|
22464
22666
|
}
|
|
22465
22667
|
}
|
|
@@ -22485,7 +22687,7 @@ var CapabilityToolRegistry = class {
|
|
|
22485
22687
|
|
|
22486
22688
|
// src/middlewares/capabilityGuardMiddleware.ts
|
|
22487
22689
|
import { ToolMessage as ToolMessage6 } from "@langchain/core/messages";
|
|
22488
|
-
import { createMiddleware as
|
|
22690
|
+
import { createMiddleware as createMiddleware15 } from "langchain";
|
|
22489
22691
|
function isRecord11(value) {
|
|
22490
22692
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22491
22693
|
}
|
|
@@ -22551,7 +22753,7 @@ function denialMessage(toolCall, denial) {
|
|
|
22551
22753
|
});
|
|
22552
22754
|
}
|
|
22553
22755
|
function createCapabilityGuardMiddleware(registry4) {
|
|
22554
|
-
return
|
|
22756
|
+
return createMiddleware15({
|
|
22555
22757
|
name: "CapabilityGuardMiddleware",
|
|
22556
22758
|
wrapToolCall: async (request, handler) => {
|
|
22557
22759
|
const toolName2 = request.toolCall.name;
|
|
@@ -22920,7 +23122,7 @@ async function createCommonMiddlewares(middlewareConfigs, filesystemBackend, fsI
|
|
|
22920
23122
|
break;
|
|
22921
23123
|
}
|
|
22922
23124
|
}
|
|
22923
|
-
return middlewares;
|
|
23125
|
+
return ensureStructuredOutputCarrierMiddleware(middlewares);
|
|
22924
23126
|
}
|
|
22925
23127
|
|
|
22926
23128
|
// src/deep_agent_new/backends/sandboxFiles.ts
|
|
@@ -23142,9 +23344,9 @@ var ReActAgentGraphBuilder = class {
|
|
|
23142
23344
|
*/
|
|
23143
23345
|
async build(agentLattice, params) {
|
|
23144
23346
|
const tools = params.tools.map((t) => {
|
|
23145
|
-
const
|
|
23146
|
-
return
|
|
23147
|
-
}).filter((
|
|
23347
|
+
const tool68 = getToolClientWithTenant(params.tenantId ?? "default", t.key);
|
|
23348
|
+
return tool68;
|
|
23349
|
+
}).filter((tool68) => tool68 !== void 0);
|
|
23148
23350
|
const stateSchema2 = createReactAgentSchema(params.stateSchema);
|
|
23149
23351
|
const middlewareConfigs = params.middleware || [];
|
|
23150
23352
|
const filesystemBackend = createFilesystemBackendFactory(middlewareConfigs);
|
|
@@ -23172,7 +23374,7 @@ import {
|
|
|
23172
23374
|
// src/deep_agent_new/middleware/subagents.ts
|
|
23173
23375
|
import { z as z47 } from "zod/v3";
|
|
23174
23376
|
import {
|
|
23175
|
-
createMiddleware as
|
|
23377
|
+
createMiddleware as createMiddleware16,
|
|
23176
23378
|
createAgent as createAgent2,
|
|
23177
23379
|
tool as tool41,
|
|
23178
23380
|
ToolMessage as ToolMessage8,
|
|
@@ -23875,7 +24077,7 @@ function normalizeAgentInterrupts(state, threadId) {
|
|
|
23875
24077
|
}
|
|
23876
24078
|
|
|
23877
24079
|
// src/services/Agent.ts
|
|
23878
|
-
import { AIMessage as
|
|
24080
|
+
import { AIMessage as AIMessage6, filterMessages, HumanMessage as HumanMessage4, SystemMessage as SystemMessage2, ToolMessage as ToolMessage7 } from "langchain";
|
|
23879
24081
|
|
|
23880
24082
|
// src/chunk_buffer_lattice/types.ts
|
|
23881
24083
|
var ThreadEndError = class extends Error {
|
|
@@ -25225,8 +25427,8 @@ function validateCapability(value, index) {
|
|
|
25225
25427
|
fieldPath: `/capabilities/${index}/allowedTools`
|
|
25226
25428
|
});
|
|
25227
25429
|
}
|
|
25228
|
-
for (const [toolIndex,
|
|
25229
|
-
if (typeof
|
|
25430
|
+
for (const [toolIndex, tool68] of capability.allowedTools.entries()) {
|
|
25431
|
+
if (typeof tool68 !== "string") {
|
|
25230
25432
|
throw new CapabilityBundleValidationError(
|
|
25231
25433
|
"CAPABILITY_BUNDLE_INVALID_CAPABILITY",
|
|
25232
25434
|
"allowedTools entries must be strings",
|
|
@@ -25240,10 +25442,10 @@ function validateCapability(value, index) {
|
|
|
25240
25442
|
fieldPath: `/capabilities/${index}/allowedTools`
|
|
25241
25443
|
});
|
|
25242
25444
|
}
|
|
25243
|
-
const toolNames = new Set(plugin.meta.tools.map((
|
|
25244
|
-
for (const [toolIndex,
|
|
25245
|
-
if (typeof
|
|
25246
|
-
throw new CapabilityBundleValidationError("CAPABILITY_BUNDLE_UNKNOWN_TOOL", `Unknown tool '${String(
|
|
25445
|
+
const toolNames = new Set(plugin.meta.tools.map((tool68) => tool68.name));
|
|
25446
|
+
for (const [toolIndex, tool68] of capability.allowedTools.entries()) {
|
|
25447
|
+
if (typeof tool68 !== "string" || !toolNames.has(tool68)) {
|
|
25448
|
+
throw new CapabilityBundleValidationError("CAPABILITY_BUNDLE_UNKNOWN_TOOL", `Unknown tool '${String(tool68)}'`, {
|
|
25247
25449
|
capabilityType,
|
|
25248
25450
|
fieldPath: `/capabilities/${index}/allowedTools/${toolIndex}`
|
|
25249
25451
|
});
|
|
@@ -25726,7 +25928,7 @@ function applyStaticCeiling(capabilities, staticMiddleware) {
|
|
|
25726
25928
|
const projectTools = capability.allowedTools;
|
|
25727
25929
|
const staticTools = ceiling.allowedTools;
|
|
25728
25930
|
const effectiveStaticTools = staticTools?.length === 0 ? void 0 : staticTools;
|
|
25729
|
-
const allowedTools = projectTools === void 0 ? effectiveStaticTools : effectiveStaticTools === void 0 ? projectTools : projectTools.filter((
|
|
25931
|
+
const allowedTools = projectTools === void 0 ? effectiveStaticTools : effectiveStaticTools === void 0 ? projectTools : projectTools.filter((tool68) => effectiveStaticTools.includes(tool68));
|
|
25730
25932
|
runtime[capability.type] = structuredClone({
|
|
25731
25933
|
...capability,
|
|
25732
25934
|
config: applyStaticResourceCeiling(capability, ceiling),
|
|
@@ -26657,7 +26859,7 @@ function executeRunInputMessages(input, fallbackMessageId) {
|
|
|
26657
26859
|
case "system":
|
|
26658
26860
|
return new SystemMessage2(fields);
|
|
26659
26861
|
case "assistant":
|
|
26660
|
-
return new
|
|
26862
|
+
return new AIMessage6(fields);
|
|
26661
26863
|
case "tool":
|
|
26662
26864
|
return new ToolMessage7({
|
|
26663
26865
|
...fields,
|
|
@@ -27530,7 +27732,7 @@ var Agent = class {
|
|
|
27530
27732
|
case "system":
|
|
27531
27733
|
return new SystemMessage2(fields);
|
|
27532
27734
|
case "assistant":
|
|
27533
|
-
return new
|
|
27735
|
+
return new AIMessage6(fields);
|
|
27534
27736
|
case "tool":
|
|
27535
27737
|
return new ToolMessage7({
|
|
27536
27738
|
...fields,
|
|
@@ -29927,7 +30129,7 @@ function createGeneralPurposeAgent(options) {
|
|
|
29927
30129
|
model: options.model,
|
|
29928
30130
|
systemPrompt: DEFAULT_SUBAGENT_PROMPT,
|
|
29929
30131
|
tools: options.tools,
|
|
29930
|
-
middleware,
|
|
30132
|
+
middleware: ensureStructuredOutputCarrierMiddleware(middleware),
|
|
29931
30133
|
stateSchema: withRunGovernanceStateSchema(withToolCallLimitStateSchema()),
|
|
29932
30134
|
checkpointer: getCheckpointSaver("default"),
|
|
29933
30135
|
name: "general-purpose"
|
|
@@ -30139,7 +30341,7 @@ function getSubagents(options) {
|
|
|
30139
30341
|
model: agentParams.model ?? defaultModel,
|
|
30140
30342
|
systemPrompt: agentParams.systemPrompt,
|
|
30141
30343
|
tools: agentParams.tools ?? defaultTools,
|
|
30142
|
-
middleware,
|
|
30344
|
+
middleware: ensureStructuredOutputCarrierMiddleware(middleware),
|
|
30143
30345
|
stateSchema: withRunGovernanceStateSchema(withToolCallLimitStateSchema()),
|
|
30144
30346
|
checkpointer: getCheckpointSaver("default")
|
|
30145
30347
|
});
|
|
@@ -30309,7 +30511,7 @@ function createSubAgentMiddleware(options) {
|
|
|
30309
30511
|
});
|
|
30310
30512
|
const allTools = [taskTool];
|
|
30311
30513
|
const effectiveSystemPrompt = systemPrompt;
|
|
30312
|
-
return
|
|
30514
|
+
return createMiddleware16({
|
|
30313
30515
|
name: "subAgentMiddleware",
|
|
30314
30516
|
tools: allTools,
|
|
30315
30517
|
wrapModelCall: async (request, handler) => {
|
|
@@ -30329,7 +30531,7 @@ ${effectiveSystemPrompt}` : effectiveSystemPrompt;
|
|
|
30329
30531
|
}
|
|
30330
30532
|
|
|
30331
30533
|
// src/deep_agent_new/middleware/date.ts
|
|
30332
|
-
import { createMiddleware as
|
|
30534
|
+
import { createMiddleware as createMiddleware17, tool as tool42 } from "langchain";
|
|
30333
30535
|
import { z as z48 } from "zod";
|
|
30334
30536
|
function formatCurrentDate(timezone = "UTC") {
|
|
30335
30537
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -30358,7 +30560,7 @@ function generateDateContext(timezone = "UTC") {
|
|
|
30358
30560
|
function createDateMiddleware(options = {}) {
|
|
30359
30561
|
const timezone = options.timezone || "UTC";
|
|
30360
30562
|
const dateContext = generateDateContext(timezone);
|
|
30361
|
-
return
|
|
30563
|
+
return createMiddleware17({
|
|
30362
30564
|
name: "DateMiddleware",
|
|
30363
30565
|
tools: [
|
|
30364
30566
|
tool42(
|
|
@@ -30457,7 +30659,7 @@ var datePlugin = {
|
|
|
30457
30659
|
};
|
|
30458
30660
|
|
|
30459
30661
|
// src/deep_agent_new/middleware/scheduler.ts
|
|
30460
|
-
import { tool as tool43, createMiddleware as
|
|
30662
|
+
import { tool as tool43, createMiddleware as createMiddleware18 } from "langchain";
|
|
30461
30663
|
import { z as z49 } from "zod";
|
|
30462
30664
|
import { v4 as uuidv44 } from "uuid";
|
|
30463
30665
|
import { ScheduledTaskStatus as ScheduledTaskStatus3, ScheduleExecutionType as ScheduleExecutionType3 } from "@axiom-lattice/protocols";
|
|
@@ -30539,7 +30741,7 @@ function registerAgentAddMessageHandler() {
|
|
|
30539
30741
|
function createSchedulerMiddleware(options = {}) {
|
|
30540
30742
|
const defaultMaxRetries = options.defaultMaxRetries ?? 0;
|
|
30541
30743
|
registerAgentAddMessageHandler();
|
|
30542
|
-
return
|
|
30744
|
+
return createMiddleware18({
|
|
30543
30745
|
name: "SchedulerMiddleware",
|
|
30544
30746
|
tools: [
|
|
30545
30747
|
tool43(
|
|
@@ -31954,7 +32156,7 @@ var MemoryBackend = class {
|
|
|
31954
32156
|
// src/deep_agent_new/middleware/todos.ts
|
|
31955
32157
|
import { Command as Command4 } from "@langchain/langgraph";
|
|
31956
32158
|
import { z as z50 } from "zod";
|
|
31957
|
-
import { createMiddleware as
|
|
32159
|
+
import { createMiddleware as createMiddleware19, tool as tool44, ToolMessage as ToolMessage9 } from "langchain";
|
|
31958
32160
|
var WRITE_TODOS_DESCRIPTION = `Use this tool to create and manage a structured task list for your current work session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
|
|
31959
32161
|
It also helps the user understand the progress of the task and overall progress of their requests.
|
|
31960
32162
|
Only use this tool if you think it will be helpful in staying organized. If the user's request is trivial and takes less than 3 steps, it is better to NOT use this tool and just do the taks directly.
|
|
@@ -32210,7 +32412,7 @@ function todoListMiddleware(options) {
|
|
|
32210
32412
|
})
|
|
32211
32413
|
}
|
|
32212
32414
|
);
|
|
32213
|
-
return
|
|
32415
|
+
return createMiddleware19({
|
|
32214
32416
|
name: "todoListMiddleware",
|
|
32215
32417
|
stateSchema,
|
|
32216
32418
|
tools: [writeTodos],
|
|
@@ -32258,7 +32460,7 @@ function createDeepAgent(params = {}) {
|
|
|
32258
32460
|
${BASE_PROMPT}` : BASE_PROMPT;
|
|
32259
32461
|
const filesystemBackend = backend ? backend : async (config) => new StateBackend(config);
|
|
32260
32462
|
const postDelegationMiddleware = interruptOn ? [humanInTheLoopMiddleware2({ interruptOn })] : [];
|
|
32261
|
-
const middleware = ensurePatchToolCallsMiddleware(assembleDeepAgentMiddleware(
|
|
32463
|
+
const middleware = ensureStructuredOutputCarrierMiddleware(ensurePatchToolCallsMiddleware(assembleDeepAgentMiddleware(
|
|
32262
32464
|
customMiddleware,
|
|
32263
32465
|
[
|
|
32264
32466
|
// Provides todo list management capabilities for tracking tasks
|
|
@@ -32294,7 +32496,7 @@ ${BASE_PROMPT}` : BASE_PROMPT;
|
|
|
32294
32496
|
// unsupportedModelBehavior: "ignore",
|
|
32295
32497
|
// })
|
|
32296
32498
|
postDelegationMiddleware
|
|
32297
|
-
));
|
|
32499
|
+
)));
|
|
32298
32500
|
return createAgent3({
|
|
32299
32501
|
model,
|
|
32300
32502
|
systemPrompt: finalSystemPrompt,
|
|
@@ -32323,7 +32525,7 @@ var DeepAgentGraphBuilder = class {
|
|
|
32323
32525
|
const tools = params.tools.map((t) => {
|
|
32324
32526
|
const toolClient = getToolClientWithTenant(params.tenantId ?? "default", t.key);
|
|
32325
32527
|
return toolClient;
|
|
32326
|
-
}).filter((
|
|
32528
|
+
}).filter((tool68) => tool68 !== void 0);
|
|
32327
32529
|
const subagents = await Promise.all(params.subAgents.map(async (sa) => {
|
|
32328
32530
|
if (sa.client) {
|
|
32329
32531
|
return {
|
|
@@ -32388,7 +32590,7 @@ var DeepAgentGraphBuilder = class {
|
|
|
32388
32590
|
|
|
32389
32591
|
// src/agent_lattice/builders/RemoteAgentGraphBuilder.ts
|
|
32390
32592
|
import { StateGraph as StateGraph2, MessagesAnnotation } from "@langchain/langgraph";
|
|
32391
|
-
import { AIMessage as
|
|
32593
|
+
import { AIMessage as AIMessage7 } from "@langchain/core/messages";
|
|
32392
32594
|
|
|
32393
32595
|
// src/services/a2a-client.ts
|
|
32394
32596
|
import { v4 as uuidv45 } from "uuid";
|
|
@@ -32707,7 +32909,13 @@ var A2ARemoteClient = _A2ARemoteClient;
|
|
|
32707
32909
|
|
|
32708
32910
|
// src/agent_lattice/builders/RemoteAgentGraphBuilder.ts
|
|
32709
32911
|
import { AgentType as AgentType3 } from "@axiom-lattice/protocols";
|
|
32912
|
+
function resolveA2ARemoteContextId(assistantKey, threadId) {
|
|
32913
|
+
return threadId ? `a2a-remote:${assistantKey}:${threadId}` : void 0;
|
|
32914
|
+
}
|
|
32710
32915
|
var RemoteAgentGraphBuilder = class {
|
|
32916
|
+
constructor(deps = {}) {
|
|
32917
|
+
this.deps = deps;
|
|
32918
|
+
}
|
|
32711
32919
|
async build(agentLattice, params) {
|
|
32712
32920
|
if (agentLattice.config.type !== AgentType3.A2A_REMOTE) {
|
|
32713
32921
|
throw new Error(
|
|
@@ -32715,7 +32923,7 @@ var RemoteAgentGraphBuilder = class {
|
|
|
32715
32923
|
);
|
|
32716
32924
|
}
|
|
32717
32925
|
const config = agentLattice.config;
|
|
32718
|
-
const client = new A2ARemoteClient({
|
|
32926
|
+
const client = this.deps.createClient?.(config) ?? new A2ARemoteClient({
|
|
32719
32927
|
agentCardUrl: config.agentCardUrl,
|
|
32720
32928
|
apiKey: config.apiKey,
|
|
32721
32929
|
timeout: config.timeout
|
|
@@ -32727,28 +32935,22 @@ var RemoteAgentGraphBuilder = class {
|
|
|
32727
32935
|
if (!text) {
|
|
32728
32936
|
return {
|
|
32729
32937
|
messages: [
|
|
32730
|
-
new
|
|
32938
|
+
new AIMessage7("No text input provided to remote agent.")
|
|
32731
32939
|
]
|
|
32732
32940
|
};
|
|
32733
32941
|
}
|
|
32734
|
-
|
|
32735
|
-
const fullPrompt = params.prompt ? `${params.prompt}
|
|
32942
|
+
const fullPrompt = params.prompt ? `${params.prompt}
|
|
32736
32943
|
|
|
32737
32944
|
User request:
|
|
32738
32945
|
${text}` : text;
|
|
32739
|
-
|
|
32740
|
-
|
|
32741
|
-
|
|
32742
|
-
|
|
32743
|
-
|
|
32744
|
-
|
|
32745
|
-
|
|
32746
|
-
|
|
32747
|
-
messages: [
|
|
32748
|
-
new AIMessage6(`Remote A2A agent error: ${msg}`)
|
|
32749
|
-
]
|
|
32750
|
-
};
|
|
32751
|
-
}
|
|
32946
|
+
const threadId = langGraphConfig?.configurable?.thread_id;
|
|
32947
|
+
const response = await client.sendMessage(
|
|
32948
|
+
fullPrompt,
|
|
32949
|
+
resolveA2ARemoteContextId(config.key, threadId)
|
|
32950
|
+
);
|
|
32951
|
+
return {
|
|
32952
|
+
messages: [new AIMessage7(response)]
|
|
32953
|
+
};
|
|
32752
32954
|
};
|
|
32753
32955
|
const workflow = new StateGraph2(MessagesAnnotation).addNode("remote_call", remoteCallNode).addEdge("__start__", "remote_call").addEdge("remote_call", "__end__");
|
|
32754
32956
|
return workflow.compile({ checkpointer: getCheckpointSaver("default") });
|
|
@@ -32835,7 +33037,8 @@ var WorkflowAgentGraphBuilder = class {
|
|
|
32835
33037
|
}
|
|
32836
33038
|
], void 0, false, void 0, params.model);
|
|
32837
33039
|
const preservedMiddlewareNames = [
|
|
32838
|
-
"patchToolCallsMiddleware"
|
|
33040
|
+
"patchToolCallsMiddleware",
|
|
33041
|
+
STRUCTURED_OUTPUT_CARRIER_MIDDLEWARE_NAME
|
|
32839
33042
|
];
|
|
32840
33043
|
const noWrapMiddlewares = stripWrapModelCallHook(middlewares, preservedMiddlewareNames);
|
|
32841
33044
|
const noWrapAskMiddlewares = stripWrapModelCallHook(askMiddlewares, preservedMiddlewareNames);
|
|
@@ -33127,7 +33330,7 @@ function requireSkillDeclaration(skillLoaded) {
|
|
|
33127
33330
|
return void 0;
|
|
33128
33331
|
}
|
|
33129
33332
|
async function validateAgentReferences(input, tenantId2) {
|
|
33130
|
-
const availableTools = getAvailableTools(tenantId2).map((
|
|
33333
|
+
const availableTools = getAvailableTools(tenantId2).map((tool68) => tool68.key);
|
|
33131
33334
|
const availableMiddlewareTypes = await getAvailableMiddlewareTypes(tenantId2);
|
|
33132
33335
|
const availableCustomMiddlewareKeys = CustomMiddlewareRegistry.list().filter(
|
|
33133
33336
|
(key5) => CustomMiddlewareRegistry.get(key5) !== void 0
|
|
@@ -35700,11 +35903,11 @@ async function withTimeout(operation, ms, onTimeout) {
|
|
|
35700
35903
|
|
|
35701
35904
|
// src/mcp_lattice/McpLatticeManager.ts
|
|
35702
35905
|
var realClientFactory = ({ mcpServers }) => new MultiServerMCPClient({ mcpServers });
|
|
35703
|
-
function extractRawCall(
|
|
35704
|
-
const rawCall =
|
|
35705
|
-
if (typeof rawCall === "function") return rawCall.bind(
|
|
35906
|
+
function extractRawCall(tool68) {
|
|
35907
|
+
const rawCall = tool68._call;
|
|
35908
|
+
if (typeof rawCall === "function") return rawCall.bind(tool68);
|
|
35706
35909
|
return async (...args) => {
|
|
35707
|
-
const invoke =
|
|
35910
|
+
const invoke = tool68.invoke.bind(tool68);
|
|
35708
35911
|
return invoke(args[0], args[2]);
|
|
35709
35912
|
};
|
|
35710
35913
|
}
|
|
@@ -36252,16 +36455,16 @@ var McpLatticeManager = class _McpLatticeManager extends BaseLatticeManager {
|
|
|
36252
36455
|
const metaByName = new Map(metaList.map((m) => [m.name, m.meta]));
|
|
36253
36456
|
this.unregisterServerTools(tenantId2, serverKey);
|
|
36254
36457
|
const keys = [];
|
|
36255
|
-
for (const
|
|
36256
|
-
if (rt.selectedTools && !rt.selectedTools.includes(
|
|
36257
|
-
const meta = metaByName.get(
|
|
36458
|
+
for (const tool68 of tools) {
|
|
36459
|
+
if (rt.selectedTools && !rt.selectedTools.includes(tool68.name)) continue;
|
|
36460
|
+
const meta = metaByName.get(tool68.name);
|
|
36258
36461
|
const rawVisibility = meta?.ui?.visibility;
|
|
36259
36462
|
const visibility = Array.isArray(rawVisibility) ? rawVisibility : typeof rawVisibility === "string" ? [rawVisibility] : void 0;
|
|
36260
36463
|
if (visibility && !visibility.includes("model")) continue;
|
|
36261
|
-
const ref = extractAppsRef(meta, serverKey);
|
|
36262
|
-
const resilient = this.wrapToolForResilience(rt,
|
|
36464
|
+
const ref = extractAppsRef(meta, serverKey, tool68.name);
|
|
36465
|
+
const resilient = this.wrapToolForResilience(rt, tool68);
|
|
36263
36466
|
const registered = ref ? wrapMcpToolWithUi(resilient, ref) : resilient;
|
|
36264
|
-
const toolKey = _McpLatticeManager.buildToolKey(serverKey,
|
|
36467
|
+
const toolKey = _McpLatticeManager.buildToolKey(serverKey, tool68.name);
|
|
36265
36468
|
try {
|
|
36266
36469
|
toolLatticeManager.registerExistingToolWithTenant(tenantId2, toolKey, registered);
|
|
36267
36470
|
keys.push(toolKey);
|
|
@@ -38643,17 +38846,30 @@ var TokenCache = class {
|
|
|
38643
38846
|
import { randomBytes as randomBytes3 } from "crypto";
|
|
38644
38847
|
import bcrypt from "bcryptjs";
|
|
38645
38848
|
var TOKEN_BYTES = 24;
|
|
38849
|
+
var MAX_MCP_APP_PAYLOAD_BYTES = 256 * 1024;
|
|
38646
38850
|
function generateToken() {
|
|
38647
38851
|
return randomBytes3(TOKEN_BYTES).toString("base64url");
|
|
38648
38852
|
}
|
|
38853
|
+
function normalizeShareResourcePath(raw) {
|
|
38854
|
+
const withoutLeadingSlash = raw.startsWith("/") ? raw.slice(1) : raw;
|
|
38855
|
+
const withoutProject = withoutLeadingSlash.replace(/^project(?:\/|$)/, "");
|
|
38856
|
+
const segments = withoutProject.split("/");
|
|
38857
|
+
if (segments.some((segment) => segment === "..")) return null;
|
|
38858
|
+
const cleaned = segments.filter(
|
|
38859
|
+
(segment) => segment !== "" && segment !== "."
|
|
38860
|
+
);
|
|
38861
|
+
if (cleaned.length === 0) return null;
|
|
38862
|
+
return cleaned.join("/");
|
|
38863
|
+
}
|
|
38649
38864
|
function createSharePayload(tenantId2, workspaceId, projectId, userId, request) {
|
|
38650
|
-
const resourcePath = (request.resourcePath || "")
|
|
38651
|
-
if (
|
|
38652
|
-
|
|
38653
|
-
|
|
38654
|
-
|
|
38865
|
+
const resourcePath = normalizeShareResourcePath(request.resourcePath || "");
|
|
38866
|
+
if (resourcePath === null) {
|
|
38867
|
+
throw new Error(
|
|
38868
|
+
"Invalid resource path \u2014 share a file or subdirectory inside the project"
|
|
38869
|
+
);
|
|
38655
38870
|
}
|
|
38656
38871
|
return {
|
|
38872
|
+
kind: "file",
|
|
38657
38873
|
address: createResourceAddress({
|
|
38658
38874
|
tenantId: tenantId2,
|
|
38659
38875
|
workspaceId,
|
|
@@ -38675,6 +38891,46 @@ function createSharePayload(tenantId2, workspaceId, projectId, userId, request)
|
|
|
38675
38891
|
revoked: false
|
|
38676
38892
|
};
|
|
38677
38893
|
}
|
|
38894
|
+
var SharePayloadError = class extends Error {
|
|
38895
|
+
/**
|
|
38896
|
+
* @param code - The stable failure code.
|
|
38897
|
+
*/
|
|
38898
|
+
constructor(code) {
|
|
38899
|
+
super(code);
|
|
38900
|
+
this.code = code;
|
|
38901
|
+
this.name = "SharePayloadError";
|
|
38902
|
+
}
|
|
38903
|
+
};
|
|
38904
|
+
function createMcpAppSharePayload(input) {
|
|
38905
|
+
if (input.visibility === "internal") {
|
|
38906
|
+
throw new SharePayloadError("INTERNAL_NOT_SUPPORTED");
|
|
38907
|
+
}
|
|
38908
|
+
const app = { ...input.app, toolInput: input.app.toolInput ?? {} };
|
|
38909
|
+
if (typeof app.toolName !== "string" || app.toolName.trim() === "") {
|
|
38910
|
+
throw new SharePayloadError("TOOL_NAME_REQUIRED");
|
|
38911
|
+
}
|
|
38912
|
+
const size = Buffer.byteLength(JSON.stringify(app), "utf8");
|
|
38913
|
+
if (size > MAX_MCP_APP_PAYLOAD_BYTES) {
|
|
38914
|
+
throw new SharePayloadError("PAYLOAD_TOO_LARGE");
|
|
38915
|
+
}
|
|
38916
|
+
return {
|
|
38917
|
+
token: generateToken(),
|
|
38918
|
+
kind: "mcpApp",
|
|
38919
|
+
address: { kind: "mcpApp", app },
|
|
38920
|
+
title: input.title ?? app.title ?? app.toolName ?? "Shared app",
|
|
38921
|
+
createdBy: input.createdBy,
|
|
38922
|
+
tenantId: input.tenantId,
|
|
38923
|
+
workspaceId: input.workspaceId,
|
|
38924
|
+
projectId: input.projectId,
|
|
38925
|
+
assistantId: null,
|
|
38926
|
+
vmIsolation: "project",
|
|
38927
|
+
visibility: input.visibility,
|
|
38928
|
+
passwordHash: input.password ? bcrypt.hashSync(input.password, 10) : null,
|
|
38929
|
+
expiresAt: input.expiresAt ?? null,
|
|
38930
|
+
maxAccess: input.maxAccess ?? null,
|
|
38931
|
+
revoked: false
|
|
38932
|
+
};
|
|
38933
|
+
}
|
|
38678
38934
|
|
|
38679
38935
|
// src/channel/connectAllChannels.ts
|
|
38680
38936
|
async function connectAllChannels(getAdapter, options = {}) {
|
|
@@ -40862,6 +41118,42 @@ function snapshotCanonicalScoped(value, expected) {
|
|
|
40862
41118
|
};
|
|
40863
41119
|
}
|
|
40864
41120
|
|
|
41121
|
+
// src/services/ProjectRoomMessageNotifier.ts
|
|
41122
|
+
var ProjectRoomMessageNotifier = class {
|
|
41123
|
+
constructor() {
|
|
41124
|
+
this.listeners = /* @__PURE__ */ new Set();
|
|
41125
|
+
}
|
|
41126
|
+
/**
|
|
41127
|
+
* Registers a committed-message listener.
|
|
41128
|
+
*
|
|
41129
|
+
* @param listener Observer invoked for later commits.
|
|
41130
|
+
* @returns An idempotent unsubscribe callback.
|
|
41131
|
+
*/
|
|
41132
|
+
subscribe(listener) {
|
|
41133
|
+
this.listeners.add(listener);
|
|
41134
|
+
return () => {
|
|
41135
|
+
this.listeners.delete(listener);
|
|
41136
|
+
};
|
|
41137
|
+
}
|
|
41138
|
+
/**
|
|
41139
|
+
* Delivers one committed message to every registered listener.
|
|
41140
|
+
*
|
|
41141
|
+
* @param message Canonical persisted room message.
|
|
41142
|
+
* @returns Nothing; each listener receives its own clone and failures are contained.
|
|
41143
|
+
*/
|
|
41144
|
+
notify(message) {
|
|
41145
|
+
if (this.listeners.size === 0) return;
|
|
41146
|
+
for (const listener of [...this.listeners]) {
|
|
41147
|
+
try {
|
|
41148
|
+
const result = listener(structuredClone(message));
|
|
41149
|
+
if (result !== void 0) void Promise.resolve(result).catch(() => void 0);
|
|
41150
|
+
} catch {
|
|
41151
|
+
}
|
|
41152
|
+
}
|
|
41153
|
+
}
|
|
41154
|
+
};
|
|
41155
|
+
var projectRoomMessageNotifier = new ProjectRoomMessageNotifier();
|
|
41156
|
+
|
|
40865
41157
|
// src/services/ProjectTaskOwnerPolicy.ts
|
|
40866
41158
|
import { snapshotExactRecord as snapshotExactRecord6 } from "@axiom-lattice/protocols";
|
|
40867
41159
|
var MEMBERSHIP_REQUIRED_KEYS = [
|
|
@@ -44852,7 +45144,7 @@ async function assertSafeUpstreamUrl(raw) {
|
|
|
44852
45144
|
}
|
|
44853
45145
|
|
|
44854
45146
|
// src/middlewares/skillMiddleware.ts
|
|
44855
|
-
import { createMiddleware as
|
|
45147
|
+
import { createMiddleware as createMiddleware20 } from "langchain";
|
|
44856
45148
|
|
|
44857
45149
|
// src/tool_lattice/skill/load_skills.ts
|
|
44858
45150
|
import z52 from "zod";
|
|
@@ -45255,7 +45547,7 @@ function createSkillMiddleware(params = {}) {
|
|
|
45255
45547
|
} = params;
|
|
45256
45548
|
const skills = params.skills;
|
|
45257
45549
|
let latestSkills = [];
|
|
45258
|
-
return
|
|
45550
|
+
return createMiddleware20({
|
|
45259
45551
|
name: "skillMiddleware",
|
|
45260
45552
|
contextSchema,
|
|
45261
45553
|
tools: [
|
|
@@ -45405,7 +45697,7 @@ var skillPlugin = {
|
|
|
45405
45697
|
};
|
|
45406
45698
|
|
|
45407
45699
|
// src/middlewares/collectionMiddleware.ts
|
|
45408
|
-
import { createMiddleware as
|
|
45700
|
+
import { createMiddleware as createMiddleware21 } from "langchain";
|
|
45409
45701
|
|
|
45410
45702
|
// src/tool_lattice/collection/list_collections.ts
|
|
45411
45703
|
import z56 from "zod";
|
|
@@ -45822,7 +46114,7 @@ var createDeleteEntryTool = (scope = { collectionKeys: [], connectAll: true }) =
|
|
|
45822
46114
|
function createCollectionMiddleware(params) {
|
|
45823
46115
|
const { collectionKeys, connectAll, compileStableCandidateTools = false } = params;
|
|
45824
46116
|
if (!compileStableCandidateTools && !connectAll && (!collectionKeys || collectionKeys.length === 0)) {
|
|
45825
|
-
return
|
|
46117
|
+
return createMiddleware21({
|
|
45826
46118
|
name: "collectionMiddleware",
|
|
45827
46119
|
contextSchema,
|
|
45828
46120
|
tools: [
|
|
@@ -45832,7 +46124,7 @@ function createCollectionMiddleware(params) {
|
|
|
45832
46124
|
});
|
|
45833
46125
|
}
|
|
45834
46126
|
const toolParams = { collectionKeys, connectAll };
|
|
45835
|
-
return
|
|
46127
|
+
return createMiddleware21({
|
|
45836
46128
|
name: "collectionMiddleware",
|
|
45837
46129
|
contextSchema,
|
|
45838
46130
|
tools: [
|
|
@@ -45895,7 +46187,7 @@ var collectionPlugin = {
|
|
|
45895
46187
|
};
|
|
45896
46188
|
|
|
45897
46189
|
// src/middlewares/askUserClarifyMiddleware.ts
|
|
45898
|
-
import { createMiddleware as
|
|
46190
|
+
import { createMiddleware as createMiddleware22, ToolMessage as ToolMessage10 } from "langchain";
|
|
45899
46191
|
import { interrupt as interrupt3 } from "@langchain/langgraph";
|
|
45900
46192
|
|
|
45901
46193
|
// src/tool_lattice/ask_user_to_clarify/index.ts
|
|
@@ -45937,7 +46229,7 @@ function isProjectRoomRun(request) {
|
|
|
45937
46229
|
return isRecord13(runConfig?.projectRoom);
|
|
45938
46230
|
}
|
|
45939
46231
|
function createAskUserClarifyMiddleware() {
|
|
45940
|
-
return
|
|
46232
|
+
return createMiddleware22({
|
|
45941
46233
|
name: "AskUserClarifyMiddleware",
|
|
45942
46234
|
tools: [createAskUserToClarifyTool()],
|
|
45943
46235
|
wrapToolCall: async (request, handler) => {
|
|
@@ -46041,7 +46333,7 @@ var askUserClarifyPlugin = {
|
|
|
46041
46333
|
};
|
|
46042
46334
|
|
|
46043
46335
|
// src/middlewares/widgetMiddleware.ts
|
|
46044
|
-
import { createMiddleware as
|
|
46336
|
+
import { createMiddleware as createMiddleware23 } from "langchain";
|
|
46045
46337
|
|
|
46046
46338
|
// src/tool_lattice/widget/loadGuidelines.ts
|
|
46047
46339
|
import { tool as tool60 } from "langchain";
|
|
@@ -46999,7 +47291,7 @@ function createWidgetMiddleware() {
|
|
|
46999
47291
|
createLoadGuidelinesTool(),
|
|
47000
47292
|
createShowWidgetTool()
|
|
47001
47293
|
];
|
|
47002
|
-
return
|
|
47294
|
+
return createMiddleware23({
|
|
47003
47295
|
name: "widgetMiddleware",
|
|
47004
47296
|
contextSchema,
|
|
47005
47297
|
tools
|
|
@@ -47023,7 +47315,7 @@ var widgetPlugin = {
|
|
|
47023
47315
|
};
|
|
47024
47316
|
|
|
47025
47317
|
// src/middlewares/taskMiddleware.ts
|
|
47026
|
-
import { createMiddleware as
|
|
47318
|
+
import { createMiddleware as createMiddleware24, tool as tool62, ToolMessage as ToolMessage11 } from "langchain";
|
|
47027
47319
|
import { z as z69 } from "zod";
|
|
47028
47320
|
import { GraphInterrupt as GraphInterrupt3, interrupt as interrupt4 } from "@langchain/langgraph";
|
|
47029
47321
|
import { resolveRunScope as resolveRunScope3 } from "@axiom-lattice/protocols";
|
|
@@ -49364,7 +49656,7 @@ function createTaskMiddleware(options = {}) {
|
|
|
49364
49656
|
...trustedCaller ? { callerMembershipId: trustedCaller.membershipId, callerAssistantId: trustedCaller.assistantId } : rc.assistant_id ? { callerAssistantId: rc.assistant_id } : {}
|
|
49365
49657
|
}));
|
|
49366
49658
|
};
|
|
49367
|
-
return
|
|
49659
|
+
return createMiddleware24({
|
|
49368
49660
|
name: "TaskMiddleware",
|
|
49369
49661
|
contextSchema,
|
|
49370
49662
|
// Persisted between invocations (ADRs: the run↔task binding survives turns).
|
|
@@ -49696,7 +49988,7 @@ canonical Belief State:
|
|
|
49696
49988
|
};
|
|
49697
49989
|
|
|
49698
49990
|
// src/middlewares/documentLearningMiddleware.ts
|
|
49699
|
-
import { createMiddleware as
|
|
49991
|
+
import { createMiddleware as createMiddleware25 } from "langchain";
|
|
49700
49992
|
|
|
49701
49993
|
// src/middlewares/documentLearningSkills.ts
|
|
49702
49994
|
var LEARN_CAPABILITY_SKILL = `---
|
|
@@ -49935,7 +50227,7 @@ patterns discovered, recommendations. Include validation coverage: user-sample N
|
|
|
49935
50227
|
`;
|
|
49936
50228
|
|
|
49937
50229
|
// src/middlewares/documentLearningMiddleware.ts
|
|
49938
|
-
var createDocumentLearningMiddleware = () =>
|
|
50230
|
+
var createDocumentLearningMiddleware = () => createMiddleware25({
|
|
49939
50231
|
name: "DocumentLearningMiddleware",
|
|
49940
50232
|
contextSchema,
|
|
49941
50233
|
tools: []
|
|
@@ -49958,7 +50250,7 @@ var documentLearningPlugin = {
|
|
|
49958
50250
|
};
|
|
49959
50251
|
|
|
49960
50252
|
// src/middlewares/documentParserMiddleware.ts
|
|
49961
|
-
import { createMiddleware as
|
|
50253
|
+
import { createMiddleware as createMiddleware26 } from "langchain";
|
|
49962
50254
|
|
|
49963
50255
|
// src/tool_lattice/document_parser/index.ts
|
|
49964
50256
|
import * as path7 from "path";
|
|
@@ -50623,7 +50915,7 @@ function createDocumentParserMiddleware(config) {
|
|
|
50623
50915
|
const baseUrl = config.baseUrl || "";
|
|
50624
50916
|
const apiKey = config.apiKey || "";
|
|
50625
50917
|
const connections = Array.isArray(config.connections) ? config.connections.filter((key5) => typeof key5 === "string") : [];
|
|
50626
|
-
return
|
|
50918
|
+
return createMiddleware26({
|
|
50627
50919
|
name: "DocumentParser",
|
|
50628
50920
|
contextSchema,
|
|
50629
50921
|
tools: [createParseDocumentTool({ connectAll, connections, baseUrl, apiKey })]
|
|
@@ -50811,7 +51103,7 @@ import {
|
|
|
50811
51103
|
snapshotExactArray as snapshotExactArray2,
|
|
50812
51104
|
snapshotExactRecord as snapshotExactRecord7
|
|
50813
51105
|
} from "@axiom-lattice/protocols";
|
|
50814
|
-
import { createMiddleware as
|
|
51106
|
+
import { createMiddleware as createMiddleware27, tool as tool64 } from "langchain";
|
|
50815
51107
|
import { z as z71 } from "zod";
|
|
50816
51108
|
var PROJECT_ROOM_CONTEXT_REQUIRED = "PROJECT_ROOM_CONTEXT_REQUIRED";
|
|
50817
51109
|
var PROJECT_ROOM_POST_FAILED = "PROJECT_ROOM_POST_FAILED";
|
|
@@ -50920,7 +51212,7 @@ async function hasActiveCurrentMembership(scope) {
|
|
|
50920
51212
|
return true;
|
|
50921
51213
|
}
|
|
50922
51214
|
function createProjectRoomMiddleware() {
|
|
50923
|
-
return
|
|
51215
|
+
return createMiddleware27({
|
|
50924
51216
|
name: "ProjectRoomMiddleware",
|
|
50925
51217
|
tools: [
|
|
50926
51218
|
tool64(async (input, config) => {
|
|
@@ -50931,7 +51223,8 @@ function createProjectRoomMiddleware() {
|
|
|
50931
51223
|
try {
|
|
50932
51224
|
const service3 = new RoomAgentMessageService({
|
|
50933
51225
|
memberships: getStoreLattice("default", "projectBotMembership").store,
|
|
50934
|
-
messages: getStoreLattice("default", "projectRoomMessage").store
|
|
51226
|
+
messages: getStoreLattice("default", "projectRoomMessage").store,
|
|
51227
|
+
onMessageCommitted: (message) => projectRoomMessageNotifier.notify(message)
|
|
50935
51228
|
});
|
|
50936
51229
|
await service3.post({
|
|
50937
51230
|
tenantId: scope.tenantId,
|
|
@@ -51015,16 +51308,153 @@ var projectRoomPlugin = {
|
|
|
51015
51308
|
};
|
|
51016
51309
|
|
|
51017
51310
|
// src/middlewares/sandboxPluginsMiddleware.ts
|
|
51018
|
-
import { createMiddleware as
|
|
51311
|
+
import { createMiddleware as createMiddleware28, tool as tool65 } from "langchain";
|
|
51019
51312
|
import { z as z72 } from "zod";
|
|
51020
51313
|
import { AgentType as AgentType10 } from "@axiom-lattice/protocols";
|
|
51021
51314
|
|
|
51315
|
+
// src/services/PluginUiToolRunner.ts
|
|
51316
|
+
var PluginNotFoundError = class extends Error {
|
|
51317
|
+
/**
|
|
51318
|
+
* @param pluginType - Plugin type that was not found or failed validation.
|
|
51319
|
+
*/
|
|
51320
|
+
constructor(pluginType) {
|
|
51321
|
+
super(`plugin "${pluginType}" not found`);
|
|
51322
|
+
this.pluginType = pluginType;
|
|
51323
|
+
this.name = "PluginNotFoundError";
|
|
51324
|
+
}
|
|
51325
|
+
};
|
|
51326
|
+
var ToolNotFoundError = class extends Error {
|
|
51327
|
+
/**
|
|
51328
|
+
* @param toolName - Tool name that was not found.
|
|
51329
|
+
*/
|
|
51330
|
+
constructor(toolName2) {
|
|
51331
|
+
super(`tool "${toolName2}" not found`);
|
|
51332
|
+
this.toolName = toolName2;
|
|
51333
|
+
this.name = "ToolNotFoundError";
|
|
51334
|
+
}
|
|
51335
|
+
};
|
|
51336
|
+
var ToolNotUiError = class extends Error {
|
|
51337
|
+
/**
|
|
51338
|
+
* @param toolName - Tool that has no `ui` resource.
|
|
51339
|
+
*/
|
|
51340
|
+
constructor(toolName2) {
|
|
51341
|
+
super(`tool "${toolName2}" has no ui`);
|
|
51342
|
+
this.toolName = toolName2;
|
|
51343
|
+
this.name = "ToolNotUiError";
|
|
51344
|
+
}
|
|
51345
|
+
};
|
|
51346
|
+
var ScopeUnavailableError = class extends Error {
|
|
51347
|
+
/**
|
|
51348
|
+
* @param text - Redacted handler text produced before signing failed.
|
|
51349
|
+
*/
|
|
51350
|
+
constructor(text) {
|
|
51351
|
+
super("MCP UI scope is unavailable");
|
|
51352
|
+
this.text = text;
|
|
51353
|
+
this.name = "ScopeUnavailableError";
|
|
51354
|
+
}
|
|
51355
|
+
};
|
|
51356
|
+
var PluginUiToolExecutionError = class extends Error {
|
|
51357
|
+
/**
|
|
51358
|
+
* @param detail - Handler error detail.
|
|
51359
|
+
* @param text - Redacted handler text produced by the failed invocation.
|
|
51360
|
+
*/
|
|
51361
|
+
constructor(detail, text) {
|
|
51362
|
+
super(detail);
|
|
51363
|
+
this.detail = detail;
|
|
51364
|
+
this.text = text;
|
|
51365
|
+
this.name = "PluginUiToolExecutionError";
|
|
51366
|
+
}
|
|
51367
|
+
};
|
|
51368
|
+
async function runSandboxPluginUiTool(input) {
|
|
51369
|
+
const manifest = input.manifest ?? await input.catalog.getValidatedManifest(input.tenantId, input.pluginType);
|
|
51370
|
+
if (!manifest) throw new PluginNotFoundError(input.pluginType);
|
|
51371
|
+
const toolDef = manifest.tools?.find((tool68) => tool68.name === input.toolName);
|
|
51372
|
+
if (!toolDef) throw new ToolNotFoundError(input.toolName);
|
|
51373
|
+
if (!toolDef.ui?.resource) throw new ToolNotUiError(input.toolName);
|
|
51374
|
+
const executor = input.catalog.getExecutor();
|
|
51375
|
+
const result = await executor.invoke({
|
|
51376
|
+
manifest,
|
|
51377
|
+
handler: toolDef.handler,
|
|
51378
|
+
input: input.input,
|
|
51379
|
+
...input.connection === void 0 ? {} : { connection: input.connection },
|
|
51380
|
+
...input.connections === void 0 ? {} : { connections: input.connections },
|
|
51381
|
+
context: {
|
|
51382
|
+
tenantId: input.tenantId,
|
|
51383
|
+
pluginType: input.pluginType,
|
|
51384
|
+
tool: input.toolName
|
|
51385
|
+
},
|
|
51386
|
+
runConfig: input.runConfig
|
|
51387
|
+
});
|
|
51388
|
+
const redacted = input.redact ? input.redact(result) : result;
|
|
51389
|
+
const text = handlerResultText(redacted);
|
|
51390
|
+
if (!result.ok) {
|
|
51391
|
+
const detail = result.error ?? "sandbox plugin execution failed";
|
|
51392
|
+
throw new PluginUiToolExecutionError(
|
|
51393
|
+
input.redact ? input.redact(detail) : detail,
|
|
51394
|
+
text
|
|
51395
|
+
);
|
|
51396
|
+
}
|
|
51397
|
+
const scope = signMcpUiScope({
|
|
51398
|
+
tid: input.runConfig.tenantId || input.tenantId,
|
|
51399
|
+
thid: typeof input.runConfig.threadId === "string" ? input.runConfig.threadId : void 0,
|
|
51400
|
+
aid: typeof input.runConfig.assistantId === "string" ? input.runConfig.assistantId : void 0,
|
|
51401
|
+
wid: typeof input.runConfig.workspaceId === "string" ? input.runConfig.workspaceId : void 0,
|
|
51402
|
+
pid: typeof input.runConfig.projectId === "string" ? input.runConfig.projectId : void 0,
|
|
51403
|
+
plugin: input.pluginType,
|
|
51404
|
+
resource: toolDef.ui.resource,
|
|
51405
|
+
ck: input.connectionKey
|
|
51406
|
+
});
|
|
51407
|
+
if (!scope) throw new ScopeUnavailableError(text);
|
|
51408
|
+
return {
|
|
51409
|
+
text,
|
|
51410
|
+
toolResult: text,
|
|
51411
|
+
uiRef: {
|
|
51412
|
+
kind: "plugin",
|
|
51413
|
+
pluginType: input.pluginType,
|
|
51414
|
+
resource: toolDef.ui.resource,
|
|
51415
|
+
displayMode: toolDef.ui.displayMode ?? "inline",
|
|
51416
|
+
toolName: input.toolName,
|
|
51417
|
+
scope
|
|
51418
|
+
}
|
|
51419
|
+
};
|
|
51420
|
+
}
|
|
51421
|
+
|
|
51022
51422
|
// src/connection/connectionSecretFields.ts
|
|
51023
51423
|
function connectionSecretFields(plugin) {
|
|
51024
51424
|
const fields = plugin?.connection?.fields ?? [];
|
|
51025
51425
|
return fields.filter((field) => field.type === "password" || field.widget === "password").map((field) => field.key);
|
|
51026
51426
|
}
|
|
51027
51427
|
|
|
51428
|
+
// src/services/connectionSecretRedaction.ts
|
|
51429
|
+
function collectSecretValues(connection, fields) {
|
|
51430
|
+
if (!connection) return [];
|
|
51431
|
+
const values = [];
|
|
51432
|
+
for (const field of fields) {
|
|
51433
|
+
const value = connection[field];
|
|
51434
|
+
if (typeof value === "string" && value.length > 0) values.push(value);
|
|
51435
|
+
}
|
|
51436
|
+
return values;
|
|
51437
|
+
}
|
|
51438
|
+
function redactString(value, secrets) {
|
|
51439
|
+
let out = value;
|
|
51440
|
+
for (const secret of secrets) out = out.split(secret).join("[redacted]");
|
|
51441
|
+
return out;
|
|
51442
|
+
}
|
|
51443
|
+
function redactSecretValues(payload, secrets) {
|
|
51444
|
+
if (secrets.length === 0) return payload;
|
|
51445
|
+
const walk = (node) => {
|
|
51446
|
+
if (typeof node === "string") return redactString(node, secrets);
|
|
51447
|
+
if (Array.isArray(node)) return node.map(walk);
|
|
51448
|
+
if (node !== null && typeof node === "object") {
|
|
51449
|
+
const out = {};
|
|
51450
|
+
for (const [key5, value] of Object.entries(node)) out[key5] = walk(value);
|
|
51451
|
+
return out;
|
|
51452
|
+
}
|
|
51453
|
+
return node;
|
|
51454
|
+
};
|
|
51455
|
+
return walk(payload);
|
|
51456
|
+
}
|
|
51457
|
+
|
|
51028
51458
|
// src/middlewares/sandboxPluginsSkills.ts
|
|
51029
51459
|
var PLUGIN_JSON_TEMPLATE = `{
|
|
51030
51460
|
"schemaVersion": 1,
|
|
@@ -51574,6 +52004,12 @@ The official \`@modelcontextprotocol/ext-apps\` client SDK reports size
|
|
|
51574
52004
|
automatically. Otherwise the panel stays at a default height and content taller
|
|
51575
52005
|
than the host max scrolls; \`templates/ui.html\` already includes this helper.
|
|
51576
52006
|
|
|
52007
|
+
## Publishing the UI
|
|
52008
|
+
If the human explicitly asks to publish, share, or pin this UI, load
|
|
52009
|
+
\`app-share-publishing\`. Use \`publish_target\` with \`mode:"link"\` for a URL or
|
|
52010
|
+
\`mode:"menu"\` for the workspace menu; call \`list_menu_groups\` before choosing
|
|
52011
|
+
a group. MCP Apps re-run on every open.
|
|
52012
|
+
|
|
51577
52013
|
## Publishing the UI to external MCP clients
|
|
51578
52014
|
If the tool also sets \`"expose": true\`, its UI is published to Axiom's Open/MCP
|
|
51579
52015
|
surface as \`ui://<type>/<ui.resource>\`, gated by the API key's grants (item-level
|
|
@@ -51672,28 +52108,102 @@ MCP endpoint. Reach for this when a tool should orchestrate existing capabilitie
|
|
|
51672
52108
|
(read the knowledge base, create a task, invoke an agent) instead of
|
|
51673
52109
|
re-implementing them.
|
|
51674
52110
|
|
|
51675
|
-
##
|
|
51676
|
-
|
|
51677
|
-
|
|
51678
|
-
|
|
52111
|
+
## Two different keys \u2014 do not mix them
|
|
52112
|
+
|
|
52113
|
+
| Key | Where | Used for |
|
|
52114
|
+
|---|---|---|
|
|
52115
|
+
| External service key (e.g. \`boStoreKey\`) | connection config | calling your upstream service |
|
|
52116
|
+
| Platform key (e.g. \`platformApiKey\`) | connection config | calling \`/open/mcp\` |
|
|
51679
52117
|
|
|
51680
|
-
|
|
51681
|
-
|
|
51682
|
-
|
|
52118
|
+
Both are declared by **you** in \`connection.fields\`. The platform key is a normal
|
|
52119
|
+
password field; the framework does not inject or rename it. Use a password field
|
|
52120
|
+
so it is encrypted at rest, and never log or write the key from the handler.
|
|
52121
|
+
|
|
52122
|
+
## Do not use \`OPEN_API_TOKEN\` / \`fromEnv()\` here
|
|
52123
|
+
|
|
52124
|
+
\`OpenMcpClient.fromEnv()\` reads \`API_GATEWAY_URL + OPEN_API_TOKEN\`. That pair is
|
|
52125
|
+
only for agent \`code_eval\`. A plugin handler must read the platform key from
|
|
52126
|
+
\`PLUGIN_CONNECTION_FILE\` and pass it explicitly:
|
|
52127
|
+
|
|
52128
|
+
\`\`\`js
|
|
52129
|
+
const client = new OpenMcpClient({
|
|
52130
|
+
url: process.env.API_GATEWAY_URL,
|
|
52131
|
+
token: conn.platformApiKey, // YOUR connection field
|
|
52132
|
+
});
|
|
52133
|
+
\`\`\`
|
|
52134
|
+
|
|
52135
|
+
\`OPEN_API_TOKEN\` is **not** injected for plugin handlers. If you find yourself
|
|
52136
|
+
calling \`fromEnv()\` in a plugin handler, stop and switch to the connection key.
|
|
52137
|
+
|
|
52138
|
+
## Probe first (recommended)
|
|
52139
|
+
|
|
52140
|
+
The platform key belongs to a human. Before writing the real handler:
|
|
52141
|
+
|
|
52142
|
+
1. Declare the platform-key password field in \`connection.fields\`.
|
|
52143
|
+
2. Write a temporary \`handlers/probe.js\` that reads \`PLUGIN_CONNECTION_FILE\`,
|
|
52144
|
+
creates \`OpenMcpClient\` with the connection key, and prints
|
|
52145
|
+
\`listTools()\` (name, description, inputSchema) as JSON.
|
|
52146
|
+
3. Ask the human to configure the connection + platform key (only a human can
|
|
52147
|
+
create the key). Use \`list_connections\` to check whether a connection exists.
|
|
52148
|
+
4. Run \`manage_plugin test\` with the real \`connectionKey\`, e.g.
|
|
52149
|
+
\`{ "kind": "tool", "name": "probe", "input": {}, "connectionKey": "prod" }\`.
|
|
52150
|
+
5. Read the returned tool list; use it to choose the downstream tool names and
|
|
52151
|
+
argument shapes.
|
|
52152
|
+
6. Write the real handler. Delete the probe or keep it as a debug tool.
|
|
52153
|
+
|
|
52154
|
+
A ready-to-copy probe is in \`templates/probe-handler.js\`.
|
|
52155
|
+
|
|
52156
|
+
### What the probe cannot show
|
|
52157
|
+
|
|
52158
|
+
\`listTools()\` shows the key's **tools**, not its full resource scope. The gateway
|
|
52159
|
+
enforces the key's tenant/project/selector on every call; the handler does **not**
|
|
52160
|
+
need to re-check them to call a tool.
|
|
52161
|
+
|
|
52162
|
+
Ask the human only when the plugin's behavior depends on which project/connection
|
|
52163
|
+
is used, or when a tool schema takes a \`connectionKey\` and multiple connections
|
|
52164
|
+
are possible. A key may intentionally point at another project/tenant \u2014 that is a
|
|
52165
|
+
feature, not an error. Do not guess a connection key.
|
|
52166
|
+
|
|
52167
|
+
## Worked example
|
|
52168
|
+
|
|
52169
|
+
|
|
52170
|
+
### 1. Declare the field in \`plugin.json\`
|
|
52171
|
+
|
|
52172
|
+
\`\`\`json
|
|
52173
|
+
{
|
|
52174
|
+
"connection": {
|
|
52175
|
+
"fields": [
|
|
52176
|
+
{ "key": "baseUrl", "type": "string", "title": "Upstream URL" },
|
|
52177
|
+
{ "key": "boStoreKey", "type": "password", "title": "Upstream password" },
|
|
52178
|
+
{
|
|
52179
|
+
"key": "platformApiKey",
|
|
52180
|
+
"type": "password",
|
|
52181
|
+
"widget": "password",
|
|
52182
|
+
"title": "Platform Open API Key"
|
|
52183
|
+
}
|
|
52184
|
+
]
|
|
52185
|
+
}
|
|
52186
|
+
}
|
|
52187
|
+
\`\`\`
|
|
52188
|
+
|
|
52189
|
+
### 2. Read it in the handler
|
|
51683
52190
|
|
|
51684
|
-
## Discover, then call
|
|
51685
|
-
Never hardcode the tool list: the callable set is **reflected per tenant** and
|
|
51686
|
-
changes as plugins are exposed. Call \`listTools()\` at runtime.
|
|
51687
52191
|
\`\`\`js
|
|
52192
|
+
const fs = require("fs");
|
|
51688
52193
|
const { OpenMcpClient } = require("@axiom-lattice/open-mcp-client");
|
|
51689
|
-
// or require("/root/.agents/sdk/open-mcp-client/index.js") when provisioned there
|
|
51690
52194
|
|
|
51691
52195
|
async function main() {
|
|
51692
52196
|
const input = process.env.PLUGIN_INPUT_FILE
|
|
51693
|
-
? JSON.parse(
|
|
52197
|
+
? JSON.parse(fs.readFileSync(process.env.PLUGIN_INPUT_FILE, "utf8"))
|
|
51694
52198
|
: JSON.parse(process.env.PLUGIN_INPUT || "{}");
|
|
52199
|
+
const conn = JSON.parse(
|
|
52200
|
+
fs.readFileSync(process.env.PLUGIN_CONNECTION_FILE, "utf8"),
|
|
52201
|
+
).connection;
|
|
51695
52202
|
|
|
51696
|
-
const client = OpenMcpClient
|
|
52203
|
+
const client = new OpenMcpClient({
|
|
52204
|
+
url: process.env.API_GATEWAY_URL,
|
|
52205
|
+
token: conn.platformApiKey,
|
|
52206
|
+
});
|
|
51697
52207
|
const tools = await client.listTools(); // exactly what this handler may call
|
|
51698
52208
|
const kb = await client.callTool("kb_search", { collection: "docs", query: input.q });
|
|
51699
52209
|
|
|
@@ -51704,29 +52214,165 @@ main().catch((err) => {
|
|
|
51704
52214
|
});
|
|
51705
52215
|
\`\`\`
|
|
51706
52216
|
|
|
51707
|
-
|
|
51708
|
-
|
|
51709
|
-
-
|
|
51710
|
-
|
|
52217
|
+
### 3. Ask a human to configure the connection
|
|
52218
|
+
|
|
52219
|
+
- Call \`list_connections { type }\`.
|
|
52220
|
+
- If the connection or key is missing, use \`ask_user_to_clarify\`: only a human can
|
|
52221
|
+
create the platform API key and fill the connection.
|
|
52222
|
+
- Never claim PTC works until a real \`connectionKey\` test passes.
|
|
52223
|
+
|
|
52224
|
+
### 4. Test with a real connection
|
|
52225
|
+
|
|
52226
|
+
\`\`\`json
|
|
52227
|
+
{
|
|
52228
|
+
"type": "my-plugin",
|
|
52229
|
+
"target": {
|
|
52230
|
+
"kind": "tool",
|
|
52231
|
+
"name": "my_tool",
|
|
52232
|
+
"input": {},
|
|
52233
|
+
"connectionKey": "prod"
|
|
52234
|
+
}
|
|
52235
|
+
}
|
|
52236
|
+
\`\`\`
|
|
52237
|
+
|
|
52238
|
+
Use \`manage_plugin test\`. Test output redacts secret values; assert on functional
|
|
52239
|
+
output (e.g. the tool result), not on echoing the key.
|
|
52240
|
+
|
|
52241
|
+
## Checklist
|
|
52242
|
+
|
|
52243
|
+
- [ ] \`connection.fields\` declares a password field for the platform key.
|
|
52244
|
+
- [ ] handler reads \`PLUGIN_CONNECTION_FILE.connection.<field>\`.
|
|
52245
|
+
- [ ] handler constructs \`OpenMcpClient\` with \`API_GATEWAY_URL\` + that field.
|
|
52246
|
+
- [ ] \`listTools()\` is called before \`callTool()\`.
|
|
52247
|
+
- [ ] the handler never logs or writes the platform key.
|
|
52248
|
+
- [ ] the key is least-privilege and does not grant the plugin's own domain.
|
|
52249
|
+
- [ ] a probe (if needed) was used to discover tool names and args.
|
|
52250
|
+
- [ ] resident handlers do not cache the client/key.
|
|
52251
|
+
- [ ] a human configured the connection + platform key.
|
|
52252
|
+
- [ ] \`manage_plugin test\` passed with a real \`connectionKey\`.
|
|
52253
|
+
|
|
52254
|
+
## Discover, then call
|
|
52255
|
+
|
|
52256
|
+
Never hardcode the tool list: the callable set is the key's grants. Call
|
|
52257
|
+
\`listTools()\` at runtime. Tool names are \`{domain}_{action}\` (e.g. \`kb_search\`,
|
|
52258
|
+
\`task_manage_task\`); args follow the tool's \`inputSchema\`. Return the result
|
|
52259
|
+
through the normal handler envelope (\`{ ok: true, result }\`) \u2014 see
|
|
52260
|
+
\`sandbox-plugins-handlers\`.
|
|
52261
|
+
|
|
52262
|
+
## Key design
|
|
52263
|
+
|
|
52264
|
+
- Grant only the domains/actions the handler actually calls.
|
|
52265
|
+
- Do **not** grant the plugin's own domain; that enables self-recursion.
|
|
52266
|
+
- Use \`selector.connections\` when the handler must be restricted to specific
|
|
52267
|
+
connections.
|
|
52268
|
+
- Use a separate key per plugin/connection so rotate/disable and audit stay
|
|
52269
|
+
attributable.
|
|
52270
|
+
- Put the key in the connection as a password field; never log or write it.
|
|
52271
|
+
- The key's project/tenant is the project/tenant the downstream tools operate in.
|
|
52272
|
+
It may intentionally differ from the plugin's project; confirm with the human
|
|
52273
|
+
only if the plugin's semantics depend on it.
|
|
51711
52274
|
|
|
51712
52275
|
## What the handler may call
|
|
51713
|
-
|
|
51714
|
-
**
|
|
51715
|
-
|
|
51716
|
-
|
|
52276
|
+
|
|
52277
|
+
The API key carries **only its own grants**. Unlike agent \`code_eval\`, a plugin
|
|
52278
|
+
key does not automatically get the sandbox/\`kb\` defaults; grant those explicitly
|
|
52279
|
+
on the key if the handler needs them. A call outside the key's grants fails
|
|
52280
|
+
(tool-not-found or \`GRANT_DENIED\`); retrying will not help. Give the plugin a
|
|
52281
|
+
least-privilege key.
|
|
52282
|
+
|
|
52283
|
+
Resource selection is not the handler's job: Open MCP tools are already bound to
|
|
52284
|
+
their resources. A key can pin connections via \`selector.connections\` in the key
|
|
52285
|
+
editor; the handler only passes tool arguments.
|
|
52286
|
+
|
|
52287
|
+
## Multiple connections
|
|
52288
|
+
|
|
52289
|
+
- \`PLUGIN_CONNECTION_FILE\` contains \`connection\` (first selected) and
|
|
52290
|
+
\`connections\` (all selected).
|
|
52291
|
+
- If the tool schema has \`connectionKey\`, pick that entry:
|
|
52292
|
+
\`\`\`js
|
|
52293
|
+
const data = JSON.parse(fs.readFileSync(process.env.PLUGIN_CONNECTION_FILE, "utf8"));
|
|
52294
|
+
const conn = (data.connections ?? []).find((c) => c.key === input.connectionKey)?.config
|
|
52295
|
+
?? data.connection;
|
|
52296
|
+
\`\`\`
|
|
52297
|
+
- Without a \`connectionKey\` input and with multiple connections, use
|
|
52298
|
+
\`connection\` (the first) or fail with a clear message; do not silently mix
|
|
52299
|
+
credentials.
|
|
52300
|
+
- Keep the platform key consistent across the connections the handler uses.
|
|
52301
|
+
|
|
52302
|
+
## Resident deployment
|
|
52303
|
+
|
|
52304
|
+
Resident handlers run in a long-lived service, but each \`/invoke\` receives the
|
|
52305
|
+
current connection config and \`apiGatewayUrl\`. Do **not** cache
|
|
52306
|
+
\`OpenMcpClient\`, the key, or \`API_GATEWAY_URL\` at module scope; read
|
|
52307
|
+
\`PLUGIN_CONNECTION_FILE\` per invocation so rotate/disable and connection changes
|
|
52308
|
+
apply.
|
|
51717
52309
|
|
|
51718
52310
|
## Client availability
|
|
51719
|
-
|
|
51720
|
-
sandbox
|
|
51721
|
-
|
|
51722
|
-
|
|
52311
|
+
|
|
52312
|
+
The sandbox image provides \`@axiom-lattice/open-mcp-client\`; use the bare module.
|
|
52313
|
+
|
|
52314
|
+
## Error handling
|
|
52315
|
+
|
|
52316
|
+
| Symptom | Meaning | Action |
|
|
52317
|
+
|---|---|---|
|
|
52318
|
+
| \`token is required\` / \`OpenMcpConfigError\` | connection has no platform key | ask the human to configure it |
|
|
52319
|
+
| \`OpenMcpAuthError\` / 401 | key disabled, rotated, or invalid | ask the human to rotate/configure |
|
|
52320
|
+
| tool-not-found | key has no such domain/action | do not retry; fix the key grant |
|
|
52321
|
+
| \`GRANT_DENIED\` | key lacks the action | do not retry; fix the key grant |
|
|
52322
|
+
| \`CONNECTION_NOT_ALLOWED\` / \`RESOURCE_DENIED\` | \`selector.connections\` mismatch | use an allowed connection or fix the key scope |
|
|
52323
|
+
|
|
52324
|
+
## Migrating from \`OPEN_API_TOKEN\`
|
|
52325
|
+
|
|
52326
|
+
If the plugin previously called \`OpenMcpClient.fromEnv()\`:
|
|
52327
|
+
|
|
52328
|
+
1. Add a password field to \`connection.fields\` (for example \`platformApiKey\`).
|
|
52329
|
+
2. Read \`PLUGIN_CONNECTION_FILE.connection.platformApiKey\`.
|
|
52330
|
+
3. Construct \`new OpenMcpClient({ url: process.env.API_GATEWAY_URL, token: ... })\`.
|
|
52331
|
+
4. Ask the human to fill the connection key.
|
|
52332
|
+
5. Re-test with \`manage_plugin test\` + \`connectionKey\`.
|
|
52333
|
+
|
|
52334
|
+
\`fromEnv()\` still works for agent \`code_eval\`, not for plugin handlers.
|
|
51723
52335
|
|
|
51724
52336
|
## Limits
|
|
51725
|
-
|
|
51726
|
-
|
|
52337
|
+
|
|
52338
|
+
- Plugin handlers do not mint tokens; they reuse the connection key. Agent
|
|
52339
|
+
\`code_eval\` keeps the depth-limited short token path.
|
|
51727
52340
|
- Only call what \`listTools()\` returns, and handle a missing tool gracefully.
|
|
51728
52341
|
`,
|
|
51729
|
-
resources: {
|
|
52342
|
+
resources: {
|
|
52343
|
+
"templates/probe-handler.js": {
|
|
52344
|
+
content: `const fs = require("fs");
|
|
52345
|
+
const { OpenMcpClient } = require("@axiom-lattice/open-mcp-client");
|
|
52346
|
+
|
|
52347
|
+
async function main() {
|
|
52348
|
+
const conn = JSON.parse(
|
|
52349
|
+
fs.readFileSync(process.env.PLUGIN_CONNECTION_FILE, "utf8"),
|
|
52350
|
+
).connection;
|
|
52351
|
+
const client = new OpenMcpClient({
|
|
52352
|
+
url: process.env.API_GATEWAY_URL,
|
|
52353
|
+
token: conn.platformApiKey,
|
|
52354
|
+
timeoutMs: 5000,
|
|
52355
|
+
});
|
|
52356
|
+
const tools = await client.listTools();
|
|
52357
|
+
process.stdout.write(JSON.stringify({
|
|
52358
|
+
ok: true,
|
|
52359
|
+
result: tools.map((tool) => ({
|
|
52360
|
+
name: tool.name,
|
|
52361
|
+
description: tool.description,
|
|
52362
|
+
inputSchema: tool.inputSchema,
|
|
52363
|
+
})),
|
|
52364
|
+
}));
|
|
52365
|
+
}
|
|
52366
|
+
|
|
52367
|
+
main().catch((err) => {
|
|
52368
|
+
process.stdout.write(JSON.stringify({
|
|
52369
|
+
ok: false,
|
|
52370
|
+
error: String(err && err.message ? err.message : err),
|
|
52371
|
+
}));
|
|
52372
|
+
});
|
|
52373
|
+
`
|
|
52374
|
+
}
|
|
52375
|
+
}
|
|
51730
52376
|
},
|
|
51731
52377
|
"sandbox-plugins-handlers": {
|
|
51732
52378
|
version: "1.0.0",
|
|
@@ -51972,8 +52618,19 @@ Follow the authoring skill's "Decide first" steps to confirm the goal
|
|
|
51972
52618
|
(inputs/outputs). If the UI class applies, load "sandbox-plugins-ui" before
|
|
51973
52619
|
authoring it. If the tool must be callable by external MCP clients via an API key,
|
|
51974
52620
|
load "sandbox-plugins-expose" and follow it (\`expose: true\` + key grants).
|
|
51975
|
-
If
|
|
51976
|
-
"
|
|
52621
|
+
If the human asks to publish/share/pin the plugin UI, load
|
|
52622
|
+
"app-share-publishing" and use \`publish_target\`; never publish proactively.
|
|
52623
|
+
For menu mode, call \`list_menu_groups\` first and choose an existing group or
|
|
52624
|
+
confirm a new one with the human. If a tool must
|
|
52625
|
+
call the platform's own tools/agents from its handler, load
|
|
52626
|
+
"sandbox-plugins-consume-open" and follow its checklist: declare a password field
|
|
52627
|
+
in connection.fields, read it from PLUGIN_CONNECTION_FILE, construct OpenMcpClient
|
|
52628
|
+
with API_GATEWAY_URL + that field, and never use
|
|
52629
|
+
OPEN_API_TOKEN/OpenMcpClient.fromEnv() in a plugin handler. A human must
|
|
52630
|
+
configure the connection before PTC can be verified. If the key's capabilities
|
|
52631
|
+
are unknown, author a probe handler first and run manage_plugin test with a real
|
|
52632
|
+
connectionKey; use the returned listTools names/inputSchema before writing the
|
|
52633
|
+
real handler.
|
|
51977
52634
|
|
|
51978
52635
|
Design first, and iterate on it before you build \u2014 the design is a conversation, not
|
|
51979
52636
|
a one-shot. Use the \`widget\` middleware to present it (a decision surface, not a showcase):
|
|
@@ -52219,15 +52876,6 @@ function tenantIdFrom(exeConfig) {
|
|
|
52219
52876
|
const c = exeConfig;
|
|
52220
52877
|
return c?.configurable?.runConfig?.tenantId ?? "default";
|
|
52221
52878
|
}
|
|
52222
|
-
function collectSecretValues(connection, fields) {
|
|
52223
|
-
if (!connection) return [];
|
|
52224
|
-
const values = [];
|
|
52225
|
-
for (const field of fields) {
|
|
52226
|
-
const value = connection[field];
|
|
52227
|
-
if (typeof value === "string" && value.length > 0) values.push(value);
|
|
52228
|
-
}
|
|
52229
|
-
return values;
|
|
52230
|
-
}
|
|
52231
52879
|
function errorText(err) {
|
|
52232
52880
|
return err instanceof Error ? err.message : String(err);
|
|
52233
52881
|
}
|
|
@@ -52240,25 +52888,6 @@ function deploymentUnavailable(action) {
|
|
|
52240
52888
|
function deploymentsResult(payload) {
|
|
52241
52889
|
return appendUiFence(JSON.stringify(payload), SANDBOX_PLUGINS_UI_REF);
|
|
52242
52890
|
}
|
|
52243
|
-
function redactString(value, secrets) {
|
|
52244
|
-
let out = value;
|
|
52245
|
-
for (const secret of secrets) out = out.split(secret).join("[redacted]");
|
|
52246
|
-
return out;
|
|
52247
|
-
}
|
|
52248
|
-
function redactSecretValues(payload, secrets) {
|
|
52249
|
-
if (secrets.length === 0) return payload;
|
|
52250
|
-
const walk = (node) => {
|
|
52251
|
-
if (typeof node === "string") return redactString(node, secrets);
|
|
52252
|
-
if (Array.isArray(node)) return node.map(walk);
|
|
52253
|
-
if (node !== null && typeof node === "object") {
|
|
52254
|
-
const out = {};
|
|
52255
|
-
for (const [key5, value] of Object.entries(node)) out[key5] = walk(value);
|
|
52256
|
-
return out;
|
|
52257
|
-
}
|
|
52258
|
-
return node;
|
|
52259
|
-
};
|
|
52260
|
-
return walk(payload);
|
|
52261
|
-
}
|
|
52262
52891
|
var managePluginSchema = z72.object({
|
|
52263
52892
|
action: z72.enum([
|
|
52264
52893
|
"list",
|
|
@@ -52327,6 +52956,14 @@ var sandboxPluginsPlugin = {
|
|
|
52327
52956
|
enabled: true,
|
|
52328
52957
|
config: {}
|
|
52329
52958
|
},
|
|
52959
|
+
{
|
|
52960
|
+
id: "app-share",
|
|
52961
|
+
type: "app-share",
|
|
52962
|
+
name: "Publish",
|
|
52963
|
+
description: "Publish files or plugin UI tools as links or workspace menu items",
|
|
52964
|
+
enabled: true,
|
|
52965
|
+
config: {}
|
|
52966
|
+
},
|
|
52330
52967
|
{
|
|
52331
52968
|
id: "skill",
|
|
52332
52969
|
type: "skill",
|
|
@@ -52378,7 +53015,7 @@ var sandboxPluginsPlugin = {
|
|
|
52378
53015
|
]
|
|
52379
53016
|
}
|
|
52380
53017
|
},
|
|
52381
|
-
middleware: () =>
|
|
53018
|
+
middleware: () => createMiddleware28({
|
|
52382
53019
|
name: "SandboxPluginsMiddleware",
|
|
52383
53020
|
tools: [
|
|
52384
53021
|
tool65(
|
|
@@ -52539,14 +53176,9 @@ var sandboxPluginsPlugin = {
|
|
|
52539
53176
|
}
|
|
52540
53177
|
}
|
|
52541
53178
|
const executor = catalog2.getExecutor();
|
|
52542
|
-
const
|
|
52543
|
-
|
|
52544
|
-
|
|
52545
|
-
parsedManifest = JSON.parse(manifestContent);
|
|
52546
|
-
} catch {
|
|
52547
|
-
return JSON.stringify({ error: "plugin.json is not valid JSON" });
|
|
52548
|
-
}
|
|
52549
|
-
const toolDef = (parsedManifest.tools ?? []).find((t) => t.name === input.target?.name);
|
|
53179
|
+
const manifest = await catalog2.getValidatedManifest(tenantId2, input.type);
|
|
53180
|
+
if (!manifest) return `plugin "${input.type}" not found`;
|
|
53181
|
+
const toolDef = (manifest.tools ?? []).find((t) => t.name === input.target?.name);
|
|
52550
53182
|
if (!toolDef) return `tool "${input.target.name ?? ""}" not found`;
|
|
52551
53183
|
const runConfig = {
|
|
52552
53184
|
...sandboxRunConfigFrom(exeConfig),
|
|
@@ -52558,38 +53190,55 @@ var sandboxPluginsPlugin = {
|
|
|
52558
53190
|
runConfig
|
|
52559
53191
|
) : {};
|
|
52560
53192
|
const secrets = collectSecretValues(resolved.connection, connectionSecretFields(plugin));
|
|
53193
|
+
const ui = toolDef.ui;
|
|
53194
|
+
if (!ui?.resource) {
|
|
53195
|
+
try {
|
|
53196
|
+
const result = await executor.invoke({
|
|
53197
|
+
manifest,
|
|
53198
|
+
handler: toolDef.handler,
|
|
53199
|
+
input: input.target.input ?? null,
|
|
53200
|
+
connection: resolved.connection,
|
|
53201
|
+
connections: resolved.connections,
|
|
53202
|
+
context: { tenantId: tenantId2, pluginType: input.type, tool: toolDef.name },
|
|
53203
|
+
runConfig
|
|
53204
|
+
});
|
|
53205
|
+
return handlerResultText(redactSecretValues(result, secrets));
|
|
53206
|
+
} catch (err) {
|
|
53207
|
+
return JSON.stringify(redactSecretValues({ ok: false, error: errorText(err) }, secrets));
|
|
53208
|
+
}
|
|
53209
|
+
}
|
|
53210
|
+
const uiRefWithoutScope = {
|
|
53211
|
+
kind: "plugin",
|
|
53212
|
+
pluginType: input.type,
|
|
53213
|
+
resource: ui.resource,
|
|
53214
|
+
displayMode: ui.displayMode ?? "inline",
|
|
53215
|
+
toolName: toolDef.name
|
|
53216
|
+
};
|
|
52561
53217
|
try {
|
|
52562
|
-
const
|
|
52563
|
-
|
|
52564
|
-
|
|
53218
|
+
const run = await runSandboxPluginUiTool({
|
|
53219
|
+
tenantId: tenantId2,
|
|
53220
|
+
pluginType: input.type,
|
|
53221
|
+
toolName: toolDef.name,
|
|
52565
53222
|
input: input.target.input ?? null,
|
|
53223
|
+
runConfig,
|
|
52566
53224
|
connection: resolved.connection,
|
|
52567
53225
|
connections: resolved.connections,
|
|
52568
|
-
|
|
52569
|
-
|
|
53226
|
+
connectionKey: resolved.connections?.[0]?.key,
|
|
53227
|
+
catalog: catalog2,
|
|
53228
|
+
manifest,
|
|
53229
|
+
redact: (value) => redactSecretValues(value, secrets)
|
|
52570
53230
|
});
|
|
52571
|
-
|
|
52572
|
-
const ui = toolDef.ui;
|
|
52573
|
-
if (!ui?.resource) return text;
|
|
52574
|
-
const scope = result.ok && ui?.resource ? signMcpUiScope({
|
|
52575
|
-
tid: runConfig.tenantId || tenantId2,
|
|
52576
|
-
thid: runConfig.threadId,
|
|
52577
|
-
aid: runConfig.assistantId,
|
|
52578
|
-
wid: runConfig.workspaceId,
|
|
52579
|
-
pid: runConfig.projectId,
|
|
52580
|
-
plugin: input.type,
|
|
52581
|
-
resource: ui.resource,
|
|
52582
|
-
ck: resolved.connections?.[0]?.key
|
|
52583
|
-
}) : void 0;
|
|
52584
|
-
const uiRef = {
|
|
52585
|
-
kind: "plugin",
|
|
52586
|
-
pluginType: input.type,
|
|
52587
|
-
resource: ui.resource,
|
|
52588
|
-
displayMode: ui.displayMode ?? "inline",
|
|
52589
|
-
...scope ? { scope } : {}
|
|
52590
|
-
};
|
|
52591
|
-
return appendUiFence(text, uiRef);
|
|
53231
|
+
return appendUiFence(run.text, run.uiRef);
|
|
52592
53232
|
} catch (err) {
|
|
53233
|
+
if (err instanceof ToolNotFoundError) {
|
|
53234
|
+
return `tool "${input.target.name ?? ""}" not found`;
|
|
53235
|
+
}
|
|
53236
|
+
if (err instanceof PluginUiToolExecutionError) {
|
|
53237
|
+
return appendUiFence(err.text ?? "", uiRefWithoutScope);
|
|
53238
|
+
}
|
|
53239
|
+
if (err instanceof ScopeUnavailableError) {
|
|
53240
|
+
return appendUiFence(err.text ?? "", uiRefWithoutScope);
|
|
53241
|
+
}
|
|
52593
53242
|
return JSON.stringify(redactSecretValues({ ok: false, error: errorText(err) }, secrets));
|
|
52594
53243
|
}
|
|
52595
53244
|
}
|
|
@@ -52668,9 +53317,745 @@ var sandboxPluginsPlugin = {
|
|
|
52668
53317
|
})
|
|
52669
53318
|
};
|
|
52670
53319
|
|
|
52671
|
-
// src/middlewares/
|
|
52672
|
-
import {
|
|
53320
|
+
// src/middlewares/appShareMiddleware.ts
|
|
53321
|
+
import { tool as tool66 } from "langchain";
|
|
53322
|
+
|
|
53323
|
+
// src/middlewares/appShareTargets.ts
|
|
52673
53324
|
import { z as z73 } from "zod";
|
|
53325
|
+
|
|
53326
|
+
// src/middlewares/appShareUi.ts
|
|
53327
|
+
var SHARE_CARD_UI_RESOURCE = "ui://app-share/share-card";
|
|
53328
|
+
var SHARE_CARD_APP_HTML = `<!doctype html>
|
|
53329
|
+
<html lang="en">
|
|
53330
|
+
<head>
|
|
53331
|
+
<meta charset="utf-8" />
|
|
53332
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
53333
|
+
<title>Shared link</title>
|
|
53334
|
+
<style>
|
|
53335
|
+
:root {
|
|
53336
|
+
color-scheme: light dark;
|
|
53337
|
+
--card-bg: #fff;
|
|
53338
|
+
--card-border: #e5e7eb;
|
|
53339
|
+
--text: #111827;
|
|
53340
|
+
--muted: #6b7280;
|
|
53341
|
+
--accent: #4338ca;
|
|
53342
|
+
--accent-bg: #eef2ff;
|
|
53343
|
+
--warning: #b45309;
|
|
53344
|
+
--btn-bg: #fff;
|
|
53345
|
+
--btn-border: #d1d5db;
|
|
53346
|
+
--btn-text: #111827;
|
|
53347
|
+
--primary-bg: #4f46e5;
|
|
53348
|
+
--primary-border: #4f46e5;
|
|
53349
|
+
--primary-text: #fff;
|
|
53350
|
+
--shadow: 0 1px 2px rgba(0,0,0,.04);
|
|
53351
|
+
}
|
|
53352
|
+
@media (prefers-color-scheme: dark) {
|
|
53353
|
+
:root {
|
|
53354
|
+
--card-bg: #111827;
|
|
53355
|
+
--card-border: #374151;
|
|
53356
|
+
--text: #f9fafb;
|
|
53357
|
+
--muted: #9ca3af;
|
|
53358
|
+
--accent: #c7d2fe;
|
|
53359
|
+
--accent-bg: #312e81;
|
|
53360
|
+
--warning: #fbbf24;
|
|
53361
|
+
--btn-bg: #1f2937;
|
|
53362
|
+
--btn-border: #4b5563;
|
|
53363
|
+
--btn-text: #f9fafb;
|
|
53364
|
+
--primary-bg: #6366f1;
|
|
53365
|
+
--primary-border: #6366f1;
|
|
53366
|
+
--primary-text: #fff;
|
|
53367
|
+
--shadow: 0 1px 2px rgba(0,0,0,.4);
|
|
53368
|
+
}
|
|
53369
|
+
}
|
|
53370
|
+
body { margin: 0; padding: 12px 14px; font: 13px/1.45 Inter, -apple-system, "Segoe UI", sans-serif; color: var(--text); background: transparent; }
|
|
53371
|
+
.card { box-sizing: border-box; max-width: 420px; margin: 0 auto; padding: 14px 16px; border: 1px solid var(--card-border); border-radius: 14px; background: var(--card-bg); color: var(--text); box-shadow: var(--shadow); }
|
|
53372
|
+
.head { display: flex; align-items: center; gap: 8px; }
|
|
53373
|
+
.icon { width: 26px; height: 26px; border-radius: 8px; background: var(--accent-bg); color: var(--accent); display: grid; place-items: center; font-size: 14px; }
|
|
53374
|
+
.title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 600; }
|
|
53375
|
+
.kind { border-radius: 999px; font-size: 11px; padding: 1px 7px; background: var(--accent-bg); color: var(--accent); }
|
|
53376
|
+
.meta { margin: 4px 0 8px; color: var(--muted); font-size: 11px; }
|
|
53377
|
+
.link { padding: 7px 9px; border: 1px solid var(--card-border); border-radius: 8px; color: var(--text); font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
|
|
53378
|
+
.link:focus-visible { outline: 2px solid var(--primary-bg); outline-offset: 2px; }
|
|
53379
|
+
.pwd { margin-top: 6px; color: var(--muted); font-size: 12px; }
|
|
53380
|
+
.warn { margin-top: 6px; color: var(--warning); font-size: 11px; overflow-wrap: anywhere; }
|
|
53381
|
+
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
|
|
53382
|
+
button { border: 1px solid var(--btn-border); background: var(--btn-bg); color: var(--btn-text); border-radius: 8px; padding: 5px 10px; font: inherit; cursor: pointer; }
|
|
53383
|
+
button.primary { background: var(--primary-bg); border-color: var(--primary-border); color: var(--primary-text); }
|
|
53384
|
+
</style>
|
|
53385
|
+
</head>
|
|
53386
|
+
<body>
|
|
53387
|
+
<div id="root"><p>Loading\u2026</p></div>
|
|
53388
|
+
<script>
|
|
53389
|
+
(function () {
|
|
53390
|
+
var root = document.getElementById("root");
|
|
53391
|
+
function post(message) { window.parent.postMessage(message, "*"); }
|
|
53392
|
+
function notify(method, params) { post({ jsonrpc: "2.0", method: method, params: params }); }
|
|
53393
|
+
var nextId = 1;
|
|
53394
|
+
function rpc(method, params) {
|
|
53395
|
+
var id = nextId++;
|
|
53396
|
+
return new Promise(function (resolve, reject) {
|
|
53397
|
+
function onMessage(event) {
|
|
53398
|
+
var data = event.data;
|
|
53399
|
+
if (!data || data.id !== id) return;
|
|
53400
|
+
window.removeEventListener("message", onMessage);
|
|
53401
|
+
if (data.error) reject(new Error((data.error && data.error.message) || "rpc error"));
|
|
53402
|
+
else resolve(data.result);
|
|
53403
|
+
}
|
|
53404
|
+
window.addEventListener("message", onMessage);
|
|
53405
|
+
post({ jsonrpc: "2.0", id: id, method: method, params: params });
|
|
53406
|
+
});
|
|
53407
|
+
}
|
|
53408
|
+
function sendSize() {
|
|
53409
|
+
notify("ui/notifications/size-changed", {
|
|
53410
|
+
width: Math.ceil(document.documentElement.scrollWidth || document.body.scrollWidth),
|
|
53411
|
+
height: Math.ceil(document.documentElement.scrollHeight || document.body.scrollHeight),
|
|
53412
|
+
});
|
|
53413
|
+
}
|
|
53414
|
+
var ZH = (navigator.language || "").toLowerCase().indexOf("zh") === 0;
|
|
53415
|
+
var COPY = ZH
|
|
53416
|
+
? { copy: "\u590D\u5236", copyLink: "\u590D\u5236\u94FE\u63A5", open: "\u6253\u5F00", kindApp: "\u5E94\u7528", kindFile: "\u6587\u4EF6", password: "\u53E3\u4EE4\uFF1A", publicTag: "\u516C\u5F00", passwordTag: "\u53E3\u4EE4", unavailable: "\u5206\u4EAB\u6570\u636E\u4E0D\u53EF\u7528\u3002", failed: "\u521D\u59CB\u5316\u5931\u8D25\uFF1A" }
|
|
53417
|
+
: { copy: "Copy", copyLink: "Copy link", open: "Open", kindApp: "App", kindFile: "File", password: "Password: ", publicTag: "Public", passwordTag: "Password", unavailable: "Share data unavailable.", failed: "Failed to initialize: " };
|
|
53418
|
+
function esc(v) {
|
|
53419
|
+
return String(v == null ? "" : v).replace(/[&<>"']/g, function (ch) {
|
|
53420
|
+
return { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[ch];
|
|
53421
|
+
});
|
|
53422
|
+
}
|
|
53423
|
+
function readResult(params) {
|
|
53424
|
+
if (!params || typeof params !== "object") return null;
|
|
53425
|
+
if (params.structuredContent && typeof params.structuredContent === "object") return params.structuredContent;
|
|
53426
|
+
var content = params.content;
|
|
53427
|
+
var text = content && content[0] && typeof content[0].text === "string" ? content[0].text : "";
|
|
53428
|
+
if (!text) return null;
|
|
53429
|
+
try { return JSON.parse(text); } catch (err) { return null; }
|
|
53430
|
+
}
|
|
53431
|
+
function render(data) {
|
|
53432
|
+
if (!data) { root.innerHTML = "<p>" + COPY.unavailable + "</p>"; sendSize(); return; }
|
|
53433
|
+
var title = data.title || "Published link";
|
|
53434
|
+
var full = data.url || data.path;
|
|
53435
|
+
var html = '<div class="card">';
|
|
53436
|
+
html += '<div class="head"><span class="icon" aria-hidden="true">\u2197</span><span class="title" title="' + esc(title) + '">' + esc(title) + '</span><span class="kind">' + (data.kind === "file" ? COPY.kindFile : COPY.kindApp) + '</span></div>';
|
|
53437
|
+
html += '<div class="meta">' + (data.visibility === "password" ? COPY.passwordTag : COPY.publicTag) + "</div>";
|
|
53438
|
+
html += '<div class="link" role="button" tabindex="0" aria-label="' + esc(COPY.copyLink) + '" title="' + esc(full) + '">' + esc(full) + "</div>";
|
|
53439
|
+
if (data.password) html += '<div class="pwd">' + COPY.password + esc(data.password) + "</div>";
|
|
53440
|
+
if (data.warnings && data.warnings.length) {
|
|
53441
|
+
var warning = data.warnings.join(" ");
|
|
53442
|
+
html += '<div class="warn" title="' + esc(warning) + '">' + esc(warning) + "</div>";
|
|
53443
|
+
}
|
|
53444
|
+
html += '<div class="actions">';
|
|
53445
|
+
html += '<button id="copy" aria-label="' + esc(COPY.copy) + '">' + COPY.copy + "</button>";
|
|
53446
|
+
html += '<button id="open" class="primary" aria-label="' + esc(COPY.open) + '">' + COPY.open + "</button>";
|
|
53447
|
+
html += "</div></div>";
|
|
53448
|
+
root.innerHTML = html;
|
|
53449
|
+
function copyLink() {
|
|
53450
|
+
rpc("ui/copy-link", {
|
|
53451
|
+
title: data.title,
|
|
53452
|
+
url: data.url || data.path,
|
|
53453
|
+
password: data.password,
|
|
53454
|
+
passwordLabel: COPY.password
|
|
53455
|
+
}).catch(function () {});
|
|
53456
|
+
}
|
|
53457
|
+
var link = document.querySelector(".link");
|
|
53458
|
+
link.onclick = copyLink;
|
|
53459
|
+
link.onkeydown = function (event) {
|
|
53460
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
53461
|
+
event.preventDefault();
|
|
53462
|
+
copyLink();
|
|
53463
|
+
}
|
|
53464
|
+
};
|
|
53465
|
+
document.getElementById("copy").onclick = copyLink;
|
|
53466
|
+
document.getElementById("open").onclick = function () {
|
|
53467
|
+
rpc("ui/open-link", { url: data.url || data.path }).catch(function () {});
|
|
53468
|
+
};
|
|
53469
|
+
sendSize();
|
|
53470
|
+
}
|
|
53471
|
+
window.addEventListener("message", function (event) {
|
|
53472
|
+
var data = event.data;
|
|
53473
|
+
if (!data || typeof data !== "object" || typeof data.method !== "string") return;
|
|
53474
|
+
if (data.method === "ui/notifications/tool-result") render(readResult(data.params));
|
|
53475
|
+
});
|
|
53476
|
+
if (typeof ResizeObserver !== "undefined") new ResizeObserver(sendSize).observe(document.documentElement);
|
|
53477
|
+
else window.addEventListener("resize", sendSize);
|
|
53478
|
+
rpc("ui/initialize", {
|
|
53479
|
+
protocolVersion: "2025-06-18",
|
|
53480
|
+
capabilities: {},
|
|
53481
|
+
clientInfo: { name: "app-share-card", version: "1.0.0" },
|
|
53482
|
+
appCapabilities: { availableDisplayModes: ["inline"] },
|
|
53483
|
+
}).then(function () {
|
|
53484
|
+
notify("ui/notifications/initialized", {});
|
|
53485
|
+
sendSize();
|
|
53486
|
+
}).catch(function (err) {
|
|
53487
|
+
root.innerHTML = "<p>" + COPY.failed + esc((err && err.message) || err) + "</p>";
|
|
53488
|
+
sendSize();
|
|
53489
|
+
});
|
|
53490
|
+
})();
|
|
53491
|
+
</script>
|
|
53492
|
+
</body>
|
|
53493
|
+
</html>`;
|
|
53494
|
+
|
|
53495
|
+
// src/middlewares/appShareTargets.ts
|
|
53496
|
+
var fileTargetSchema = z73.object({
|
|
53497
|
+
kind: z73.literal("file"),
|
|
53498
|
+
path: z73.string().min(1)
|
|
53499
|
+
});
|
|
53500
|
+
var mcpAppTargetSchema = z73.object({
|
|
53501
|
+
kind: z73.literal("mcpApp"),
|
|
53502
|
+
pluginType: z73.string().min(1),
|
|
53503
|
+
toolName: z73.string().min(1),
|
|
53504
|
+
input: z73.record(z73.unknown()).optional(),
|
|
53505
|
+
connectionKey: z73.string().min(1).optional()
|
|
53506
|
+
});
|
|
53507
|
+
var targetSchema = z73.discriminatedUnion("kind", [
|
|
53508
|
+
fileTargetSchema,
|
|
53509
|
+
mcpAppTargetSchema
|
|
53510
|
+
]);
|
|
53511
|
+
var publishTargetSchema = z73.discriminatedUnion("mode", [
|
|
53512
|
+
z73.object({
|
|
53513
|
+
mode: z73.literal("link"),
|
|
53514
|
+
target: targetSchema,
|
|
53515
|
+
visibility: z73.enum(["public", "password"]),
|
|
53516
|
+
password: z73.string().min(1).max(1024).optional(),
|
|
53517
|
+
title: z73.string().min(1).max(256).optional(),
|
|
53518
|
+
expiresInMinutes: z73.number().int().positive().max(525600).optional(),
|
|
53519
|
+
maxAccess: z73.number().int().positive().optional()
|
|
53520
|
+
}),
|
|
53521
|
+
z73.object({
|
|
53522
|
+
mode: z73.literal("menu"),
|
|
53523
|
+
target: targetSchema,
|
|
53524
|
+
name: z73.string().min(1).max(256).optional(),
|
|
53525
|
+
group: z73.string().min(1).max(128).optional()
|
|
53526
|
+
})
|
|
53527
|
+
]).superRefine((value, ctx) => {
|
|
53528
|
+
if (value.mode !== "link") return;
|
|
53529
|
+
if (value.visibility === "password" && !value.password) {
|
|
53530
|
+
ctx.addIssue({
|
|
53531
|
+
code: z73.ZodIssueCode.custom,
|
|
53532
|
+
path: ["password"],
|
|
53533
|
+
message: "password is required when visibility is password"
|
|
53534
|
+
});
|
|
53535
|
+
}
|
|
53536
|
+
if (value.visibility === "public" && value.password) {
|
|
53537
|
+
ctx.addIssue({
|
|
53538
|
+
code: z73.ZodIssueCode.custom,
|
|
53539
|
+
path: ["password"],
|
|
53540
|
+
message: "password must not be provided when visibility is public"
|
|
53541
|
+
});
|
|
53542
|
+
}
|
|
53543
|
+
});
|
|
53544
|
+
var listMenuGroupsSchema = z73.object({});
|
|
53545
|
+
function menuRegistry() {
|
|
53546
|
+
return getStoreLattice("default", "menu").store;
|
|
53547
|
+
}
|
|
53548
|
+
async function listMenuGroupsHandler(_input, exeConfig) {
|
|
53549
|
+
const tenantId2 = sandboxRunConfigFrom(exeConfig).tenantId;
|
|
53550
|
+
if (!tenantId2) return JSON.stringify({ error: "USER_REQUIRED" });
|
|
53551
|
+
let menu;
|
|
53552
|
+
try {
|
|
53553
|
+
menu = menuRegistry();
|
|
53554
|
+
} catch {
|
|
53555
|
+
return JSON.stringify({ error: "MENU_STORE_UNAVAILABLE" });
|
|
53556
|
+
}
|
|
53557
|
+
let items;
|
|
53558
|
+
try {
|
|
53559
|
+
items = await menu.list({ tenantId: tenantId2, menuTarget: "workspace" });
|
|
53560
|
+
} catch {
|
|
53561
|
+
return JSON.stringify({ error: "MENU_LIST_FAILED" });
|
|
53562
|
+
}
|
|
53563
|
+
const counts = /* @__PURE__ */ new Map();
|
|
53564
|
+
let ungroupedCount = 0;
|
|
53565
|
+
for (const item of items) {
|
|
53566
|
+
const group = typeof item.group === "string" ? item.group.trim() : "";
|
|
53567
|
+
if (!group) {
|
|
53568
|
+
ungroupedCount += 1;
|
|
53569
|
+
continue;
|
|
53570
|
+
}
|
|
53571
|
+
counts.set(group, (counts.get(group) ?? 0) + 1);
|
|
53572
|
+
}
|
|
53573
|
+
const groups = [...counts.entries()].map(([name, itemCount]) => ({ name, itemCount })).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
53574
|
+
return JSON.stringify({ groups, ungroupedCount });
|
|
53575
|
+
}
|
|
53576
|
+
var SHARE_CARD_UI_REF = {
|
|
53577
|
+
kind: "plugin",
|
|
53578
|
+
pluginType: "app-share",
|
|
53579
|
+
resource: SHARE_CARD_UI_RESOURCE,
|
|
53580
|
+
displayMode: "inline",
|
|
53581
|
+
title: "Published link"
|
|
53582
|
+
};
|
|
53583
|
+
function runConfigOf(exeConfig) {
|
|
53584
|
+
return exeConfig?.configurable?.runConfig ?? {};
|
|
53585
|
+
}
|
|
53586
|
+
function createdByOf(raw) {
|
|
53587
|
+
return typeof raw.user_id === "string" && raw.user_id.length > 0 ? raw.user_id : typeof raw.userId === "string" && raw.userId.length > 0 ? raw.userId : "";
|
|
53588
|
+
}
|
|
53589
|
+
function basename6(path8) {
|
|
53590
|
+
return path8.replace(/\/+$/, "").split("/").pop() || path8;
|
|
53591
|
+
}
|
|
53592
|
+
function normalizeProjectPath(path8) {
|
|
53593
|
+
const withoutLeadingSlash = path8.startsWith("/") ? path8.slice(1) : path8;
|
|
53594
|
+
const segments = withoutLeadingSlash.split("/");
|
|
53595
|
+
if (segments.some((segment) => segment === "..")) return null;
|
|
53596
|
+
const cleaned = segments.filter(
|
|
53597
|
+
(segment) => segment !== "" && segment !== "."
|
|
53598
|
+
);
|
|
53599
|
+
if (cleaned[0] === "project") cleaned.shift();
|
|
53600
|
+
if (cleaned.length === 0) return null;
|
|
53601
|
+
return cleaned.join("/");
|
|
53602
|
+
}
|
|
53603
|
+
function linkResult(input) {
|
|
53604
|
+
const path8 = `/s/${input.token}`;
|
|
53605
|
+
const envBase = process.env.AXIOM_PUBLIC_BASE_URL?.replace(/\/$/, "");
|
|
53606
|
+
const result = {
|
|
53607
|
+
mode: "link",
|
|
53608
|
+
kind: input.kind,
|
|
53609
|
+
token: input.token,
|
|
53610
|
+
path: path8,
|
|
53611
|
+
...envBase ? { url: `${envBase}${path8}` } : {},
|
|
53612
|
+
title: input.title,
|
|
53613
|
+
visibility: input.visibility,
|
|
53614
|
+
...input.password ? { password: input.password } : {},
|
|
53615
|
+
...input.warnings ? { warnings: input.warnings } : {}
|
|
53616
|
+
};
|
|
53617
|
+
const text = JSON.stringify(result).replace(/`/g, "\\u0060");
|
|
53618
|
+
return appendUiFence(text, SHARE_CARD_UI_REF);
|
|
53619
|
+
}
|
|
53620
|
+
async function resolvePluginTarget(input, raw, tenantId2) {
|
|
53621
|
+
const catalog2 = getSandboxPluginCatalog();
|
|
53622
|
+
const loaded = await catalog2.ensureLoaded(tenantId2);
|
|
53623
|
+
const plugin = loaded.plugins.find((p) => p.meta.type === input.pluginType);
|
|
53624
|
+
if (!plugin) return { error: "TOOL_NOT_FOUND" };
|
|
53625
|
+
const manifest = await catalog2.getValidatedManifest(tenantId2, input.pluginType);
|
|
53626
|
+
const toolDef = manifest?.tools?.find((t) => t.name === input.toolName);
|
|
53627
|
+
if (!toolDef) return { error: "TOOL_NOT_FOUND" };
|
|
53628
|
+
if (!toolDef.ui?.resource) return { error: "TOOL_NOT_UI" };
|
|
53629
|
+
let connectionKey = input.connectionKey;
|
|
53630
|
+
if (plugin.connection || input.connectionKey) {
|
|
53631
|
+
const connections = await resolvePluginConnections(
|
|
53632
|
+
input.pluginType,
|
|
53633
|
+
input.connectionKey ? { connections: [input.connectionKey] } : { connectAll: true },
|
|
53634
|
+
{ tenantId: tenantId2 }
|
|
53635
|
+
);
|
|
53636
|
+
if (input.connectionKey && connections.length === 0) {
|
|
53637
|
+
return { error: "CONNECTION_NOT_FOUND" };
|
|
53638
|
+
}
|
|
53639
|
+
if (!input.connectionKey && plugin.connection && connections.length === 0) {
|
|
53640
|
+
return { error: "CONNECTION_REQUIRED" };
|
|
53641
|
+
}
|
|
53642
|
+
if (!input.connectionKey && plugin.connection && connections.length > 1) {
|
|
53643
|
+
return { error: "CONNECTION_AMBIGUOUS", keys: connections.map((c) => c.key) };
|
|
53644
|
+
}
|
|
53645
|
+
connectionKey = input.connectionKey ?? connections[0]?.key;
|
|
53646
|
+
}
|
|
53647
|
+
const scope = signMcpUiScope({
|
|
53648
|
+
tid: tenantId2,
|
|
53649
|
+
thid: typeof raw.thread_id === "string" ? raw.thread_id : void 0,
|
|
53650
|
+
aid: typeof raw.assistant_id === "string" ? raw.assistant_id : void 0,
|
|
53651
|
+
wid: typeof raw.workspaceId === "string" ? raw.workspaceId : void 0,
|
|
53652
|
+
pid: typeof raw.projectId === "string" ? raw.projectId : void 0,
|
|
53653
|
+
plugin: input.pluginType,
|
|
53654
|
+
resource: toolDef.ui.resource,
|
|
53655
|
+
ck: connectionKey
|
|
53656
|
+
});
|
|
53657
|
+
if (!scope) return { error: "SCOPE_UNAVAILABLE" };
|
|
53658
|
+
return {
|
|
53659
|
+
scope,
|
|
53660
|
+
resource: toolDef.ui.resource,
|
|
53661
|
+
displayMode: toolDef.ui.displayMode ?? "inline",
|
|
53662
|
+
toolName: input.toolName
|
|
53663
|
+
};
|
|
53664
|
+
}
|
|
53665
|
+
var MENU_TOOL_INPUT_MAX_BYTES = 256 * 1024;
|
|
53666
|
+
var MENU_MCP_WARNING = "menu pins are tenant-visible and reuse the selected connection";
|
|
53667
|
+
function matchesScope(cfg, workspaceId, projectId) {
|
|
53668
|
+
return String(cfg.workspaceId ?? "") === workspaceId && String(cfg.projectId ?? "") === projectId;
|
|
53669
|
+
}
|
|
53670
|
+
async function publishMenu(input, raw, ctx) {
|
|
53671
|
+
let menu;
|
|
53672
|
+
try {
|
|
53673
|
+
menu = menuRegistry();
|
|
53674
|
+
} catch {
|
|
53675
|
+
return JSON.stringify({ error: "MENU_STORE_UNAVAILABLE" });
|
|
53676
|
+
}
|
|
53677
|
+
let contentType;
|
|
53678
|
+
let contentConfig;
|
|
53679
|
+
let defaultName;
|
|
53680
|
+
if (input.target.kind === "file") {
|
|
53681
|
+
const resourcePath = normalizeProjectPath(input.target.path);
|
|
53682
|
+
if (resourcePath === null) {
|
|
53683
|
+
return JSON.stringify({ error: "INVALID_TARGET" });
|
|
53684
|
+
}
|
|
53685
|
+
contentType = "file";
|
|
53686
|
+
defaultName = basename6(resourcePath);
|
|
53687
|
+
contentConfig = {
|
|
53688
|
+
resourcePath,
|
|
53689
|
+
fileName: defaultName,
|
|
53690
|
+
tenantId: ctx.tenantId,
|
|
53691
|
+
workspaceId: ctx.workspaceId,
|
|
53692
|
+
projectId: ctx.projectId,
|
|
53693
|
+
...typeof raw.assistant_id === "string" ? { assistantId: raw.assistant_id } : {}
|
|
53694
|
+
};
|
|
53695
|
+
} else {
|
|
53696
|
+
const toolInput = input.target.input ?? {};
|
|
53697
|
+
if (Buffer.byteLength(JSON.stringify(toolInput), "utf8") > MENU_TOOL_INPUT_MAX_BYTES) {
|
|
53698
|
+
return JSON.stringify({ error: "PAYLOAD_TOO_LARGE" });
|
|
53699
|
+
}
|
|
53700
|
+
let resolved;
|
|
53701
|
+
try {
|
|
53702
|
+
const outcome = await resolvePluginTarget(input.target, raw, ctx.tenantId);
|
|
53703
|
+
if ("error" in outcome) return JSON.stringify(outcome);
|
|
53704
|
+
resolved = outcome;
|
|
53705
|
+
} catch {
|
|
53706
|
+
return JSON.stringify({ error: "MENU_PIN_FAILED" });
|
|
53707
|
+
}
|
|
53708
|
+
contentType = "mcpApp";
|
|
53709
|
+
defaultName = resolved.toolName;
|
|
53710
|
+
contentConfig = {
|
|
53711
|
+
kind: "plugin",
|
|
53712
|
+
pluginType: input.target.pluginType,
|
|
53713
|
+
resource: resolved.resource,
|
|
53714
|
+
scope: resolved.scope,
|
|
53715
|
+
displayMode: resolved.displayMode,
|
|
53716
|
+
toolName: resolved.toolName,
|
|
53717
|
+
toolInput,
|
|
53718
|
+
workspaceId: ctx.workspaceId,
|
|
53719
|
+
projectId: ctx.projectId
|
|
53720
|
+
};
|
|
53721
|
+
}
|
|
53722
|
+
let items;
|
|
53723
|
+
try {
|
|
53724
|
+
items = await menu.list({ tenantId: ctx.tenantId, menuTarget: "workspace" });
|
|
53725
|
+
} catch {
|
|
53726
|
+
return JSON.stringify({ error: "MENU_LIST_FAILED" });
|
|
53727
|
+
}
|
|
53728
|
+
const existing = items.find((item) => {
|
|
53729
|
+
if (item.contentType !== contentType) return false;
|
|
53730
|
+
if (!matchesScope(
|
|
53731
|
+
item.contentConfig,
|
|
53732
|
+
ctx.workspaceId,
|
|
53733
|
+
ctx.projectId
|
|
53734
|
+
)) {
|
|
53735
|
+
return false;
|
|
53736
|
+
}
|
|
53737
|
+
if (contentType === "file") {
|
|
53738
|
+
return item.contentConfig.resourcePath === contentConfig.resourcePath;
|
|
53739
|
+
}
|
|
53740
|
+
const cfg = item.contentConfig;
|
|
53741
|
+
const next = contentConfig;
|
|
53742
|
+
return cfg.kind === "plugin" && next.kind === "plugin" && cfg.pluginType === next.pluginType && cfg.resource === next.resource;
|
|
53743
|
+
});
|
|
53744
|
+
const name = input.name?.trim() || existing?.name || defaultName;
|
|
53745
|
+
const group = input.group?.trim() || void 0;
|
|
53746
|
+
try {
|
|
53747
|
+
if (existing) {
|
|
53748
|
+
const merged = {
|
|
53749
|
+
...existing.contentConfig,
|
|
53750
|
+
...contentConfig
|
|
53751
|
+
};
|
|
53752
|
+
if (contentType === "mcpApp") {
|
|
53753
|
+
delete merged.toolResult;
|
|
53754
|
+
delete merged.ui;
|
|
53755
|
+
}
|
|
53756
|
+
const updated = await menu.update(existing.id, {
|
|
53757
|
+
contentConfig: merged,
|
|
53758
|
+
name,
|
|
53759
|
+
...group ? { group } : {}
|
|
53760
|
+
});
|
|
53761
|
+
console.info(JSON.stringify({
|
|
53762
|
+
event: "publish.pinned",
|
|
53763
|
+
userId: ctx.createdBy,
|
|
53764
|
+
tenantId: ctx.tenantId,
|
|
53765
|
+
workspaceId: ctx.workspaceId,
|
|
53766
|
+
projectId: ctx.projectId,
|
|
53767
|
+
kind: contentType,
|
|
53768
|
+
menuItemId: updated.id,
|
|
53769
|
+
created: false
|
|
53770
|
+
}));
|
|
53771
|
+
return JSON.stringify({
|
|
53772
|
+
mode: "menu",
|
|
53773
|
+
kind: contentType,
|
|
53774
|
+
menuItemId: updated.id,
|
|
53775
|
+
name: updated.name,
|
|
53776
|
+
...updated.group ? { group: updated.group } : {},
|
|
53777
|
+
...contentType === "mcpApp" ? { warnings: [MENU_MCP_WARNING] } : {},
|
|
53778
|
+
alreadyPinned: true,
|
|
53779
|
+
refreshOnOpen: contentType === "mcpApp"
|
|
53780
|
+
});
|
|
53781
|
+
}
|
|
53782
|
+
const created = await menu.create({
|
|
53783
|
+
tenantId: ctx.tenantId,
|
|
53784
|
+
menuTarget: "workspace",
|
|
53785
|
+
contentType,
|
|
53786
|
+
contentConfig,
|
|
53787
|
+
name,
|
|
53788
|
+
...group ? { group } : {},
|
|
53789
|
+
sortOrder: 0
|
|
53790
|
+
});
|
|
53791
|
+
console.info(JSON.stringify({
|
|
53792
|
+
event: "publish.pinned",
|
|
53793
|
+
userId: ctx.createdBy,
|
|
53794
|
+
tenantId: ctx.tenantId,
|
|
53795
|
+
workspaceId: ctx.workspaceId,
|
|
53796
|
+
projectId: ctx.projectId,
|
|
53797
|
+
kind: contentType,
|
|
53798
|
+
menuItemId: created.id,
|
|
53799
|
+
created: true
|
|
53800
|
+
}));
|
|
53801
|
+
return JSON.stringify({
|
|
53802
|
+
mode: "menu",
|
|
53803
|
+
kind: contentType,
|
|
53804
|
+
menuItemId: created.id,
|
|
53805
|
+
name: created.name,
|
|
53806
|
+
...created.group ? { group: created.group } : {},
|
|
53807
|
+
...contentType === "mcpApp" ? { warnings: [MENU_MCP_WARNING] } : {},
|
|
53808
|
+
alreadyPinned: false,
|
|
53809
|
+
refreshOnOpen: contentType === "mcpApp"
|
|
53810
|
+
});
|
|
53811
|
+
} catch {
|
|
53812
|
+
return JSON.stringify({ error: "MENU_PIN_FAILED" });
|
|
53813
|
+
}
|
|
53814
|
+
}
|
|
53815
|
+
async function publishTargetHandler(input, exeConfig) {
|
|
53816
|
+
const raw = runConfigOf(exeConfig);
|
|
53817
|
+
const tenantId2 = typeof raw.tenantId === "string" ? raw.tenantId : "";
|
|
53818
|
+
const createdBy = createdByOf(raw);
|
|
53819
|
+
const workspaceId = typeof raw.workspaceId === "string" ? raw.workspaceId : "";
|
|
53820
|
+
const projectId = typeof raw.projectId === "string" ? raw.projectId : "";
|
|
53821
|
+
if (!tenantId2 || !createdBy) return JSON.stringify({ error: "USER_REQUIRED" });
|
|
53822
|
+
if (!workspaceId || !projectId) return JSON.stringify({ error: "SCOPE_REQUIRED" });
|
|
53823
|
+
if (input.mode === "link") {
|
|
53824
|
+
if (input.visibility === "password" && !input.password) {
|
|
53825
|
+
return JSON.stringify({ error: "INVALID_REQUEST" });
|
|
53826
|
+
}
|
|
53827
|
+
if (input.visibility === "public" && input.password) {
|
|
53828
|
+
return JSON.stringify({ error: "INVALID_REQUEST" });
|
|
53829
|
+
}
|
|
53830
|
+
let store2;
|
|
53831
|
+
try {
|
|
53832
|
+
store2 = getStoreLattice("default", "sharedResource").store;
|
|
53833
|
+
} catch {
|
|
53834
|
+
return JSON.stringify({ error: "SHARE_STORE_UNAVAILABLE" });
|
|
53835
|
+
}
|
|
53836
|
+
if (input.target.kind === "file") {
|
|
53837
|
+
const resourcePath = normalizeProjectPath(input.target.path);
|
|
53838
|
+
if (resourcePath === null) {
|
|
53839
|
+
return JSON.stringify({ error: "INVALID_TARGET" });
|
|
53840
|
+
}
|
|
53841
|
+
try {
|
|
53842
|
+
const payload = createSharePayload(tenantId2, workspaceId, projectId, createdBy, {
|
|
53843
|
+
resourcePath: input.target.path,
|
|
53844
|
+
assistantId: typeof raw.assistant_id === "string" ? raw.assistant_id : void 0,
|
|
53845
|
+
title: input.title ?? basename6(resourcePath),
|
|
53846
|
+
visibility: input.visibility,
|
|
53847
|
+
password: input.password,
|
|
53848
|
+
expiresAt: input.expiresInMinutes ? new Date(Date.now() + input.expiresInMinutes * 6e4).toISOString() : void 0,
|
|
53849
|
+
maxAccess: input.maxAccess
|
|
53850
|
+
});
|
|
53851
|
+
const token = generateToken();
|
|
53852
|
+
try {
|
|
53853
|
+
await store2.create({ ...payload, token });
|
|
53854
|
+
} catch {
|
|
53855
|
+
return JSON.stringify({ error: "SHARE_CREATE_FAILED" });
|
|
53856
|
+
}
|
|
53857
|
+
console.info(JSON.stringify({
|
|
53858
|
+
event: "publish.created",
|
|
53859
|
+
tenantId: tenantId2,
|
|
53860
|
+
userId: createdBy,
|
|
53861
|
+
mode: "link",
|
|
53862
|
+
kind: "file",
|
|
53863
|
+
visibility: input.visibility,
|
|
53864
|
+
tokenPrefix: token.slice(0, 8)
|
|
53865
|
+
}));
|
|
53866
|
+
return linkResult({
|
|
53867
|
+
kind: "file",
|
|
53868
|
+
token,
|
|
53869
|
+
title: payload.title ?? basename6(resourcePath),
|
|
53870
|
+
visibility: input.visibility,
|
|
53871
|
+
password: input.password,
|
|
53872
|
+
warnings: input.visibility === "public" ? [
|
|
53873
|
+
"anyone with the link can access this file; artifact app api scripts can execute"
|
|
53874
|
+
] : void 0
|
|
53875
|
+
});
|
|
53876
|
+
} catch {
|
|
53877
|
+
return JSON.stringify({ error: "INVALID_TARGET" });
|
|
53878
|
+
}
|
|
53879
|
+
} else {
|
|
53880
|
+
let resolved;
|
|
53881
|
+
try {
|
|
53882
|
+
const outcome = await resolvePluginTarget(input.target, raw, tenantId2);
|
|
53883
|
+
if ("error" in outcome) return JSON.stringify(outcome);
|
|
53884
|
+
resolved = outcome;
|
|
53885
|
+
} catch {
|
|
53886
|
+
return JSON.stringify({ error: "SHARE_CREATE_FAILED" });
|
|
53887
|
+
}
|
|
53888
|
+
try {
|
|
53889
|
+
const payload = createMcpAppSharePayload({
|
|
53890
|
+
tenantId: tenantId2,
|
|
53891
|
+
createdBy,
|
|
53892
|
+
workspaceId,
|
|
53893
|
+
projectId,
|
|
53894
|
+
app: {
|
|
53895
|
+
kind: "plugin",
|
|
53896
|
+
pluginType: input.target.pluginType,
|
|
53897
|
+
resource: resolved.resource,
|
|
53898
|
+
scope: resolved.scope,
|
|
53899
|
+
toolName: resolved.toolName,
|
|
53900
|
+
displayMode: resolved.displayMode,
|
|
53901
|
+
toolInput: input.target.input ?? {}
|
|
53902
|
+
},
|
|
53903
|
+
title: input.title,
|
|
53904
|
+
visibility: input.visibility,
|
|
53905
|
+
password: input.password,
|
|
53906
|
+
expiresAt: input.expiresInMinutes ? new Date(Date.now() + input.expiresInMinutes * 6e4) : void 0,
|
|
53907
|
+
maxAccess: input.maxAccess
|
|
53908
|
+
});
|
|
53909
|
+
try {
|
|
53910
|
+
await store2.create(payload);
|
|
53911
|
+
} catch {
|
|
53912
|
+
return JSON.stringify({ error: "SHARE_CREATE_FAILED" });
|
|
53913
|
+
}
|
|
53914
|
+
console.info(JSON.stringify({
|
|
53915
|
+
event: "publish.created",
|
|
53916
|
+
tenantId: tenantId2,
|
|
53917
|
+
userId: createdBy,
|
|
53918
|
+
mode: "link",
|
|
53919
|
+
kind: "mcpApp",
|
|
53920
|
+
visibility: input.visibility,
|
|
53921
|
+
pluginType: input.target.pluginType,
|
|
53922
|
+
toolName: input.target.toolName,
|
|
53923
|
+
tokenPrefix: payload.token.slice(0, 8)
|
|
53924
|
+
}));
|
|
53925
|
+
return linkResult({
|
|
53926
|
+
kind: "mcpApp",
|
|
53927
|
+
token: payload.token,
|
|
53928
|
+
title: payload.title ?? resolved.toolName,
|
|
53929
|
+
visibility: input.visibility,
|
|
53930
|
+
password: input.password,
|
|
53931
|
+
warnings: input.visibility === "public" ? ["public share delegates the selected plugin connection"] : void 0
|
|
53932
|
+
});
|
|
53933
|
+
} catch (error) {
|
|
53934
|
+
return JSON.stringify({
|
|
53935
|
+
error: error instanceof SharePayloadError ? error.code : "SHARE_CREATE_FAILED"
|
|
53936
|
+
});
|
|
53937
|
+
}
|
|
53938
|
+
}
|
|
53939
|
+
}
|
|
53940
|
+
return publishMenu(input, raw, { tenantId: tenantId2, workspaceId, projectId, createdBy });
|
|
53941
|
+
}
|
|
53942
|
+
|
|
53943
|
+
// src/middlewares/appShareSkill.ts
|
|
53944
|
+
var APP_SHARE_PUBLISHING_SKILL = `---
|
|
53945
|
+
name: app-share-publishing
|
|
53946
|
+
description: Use when a user explicitly asks to publish, share, or pin a project file, artifact app, or tenant plugin MCP App; covers link generation and workspace menu pinning.
|
|
53947
|
+
---
|
|
53948
|
+
|
|
53949
|
+
# Publishing files and MCP Apps
|
|
53950
|
+
|
|
53951
|
+
\`publish_target\` is the only tool that creates a share or menu pin.
|
|
53952
|
+
\`list_menu_groups\` is read-only discovery of existing workspace menu groups.
|
|
53953
|
+
Publish only when the human explicitly asks to publish, share, or pin something.
|
|
53954
|
+
|
|
53955
|
+
## Target kinds
|
|
53956
|
+
- \`{ kind: "file", path }\` \u2014 a project-relative file, directory, or artifact app
|
|
53957
|
+
directory. Artifact apps are directories containing \`index.html\`; pass the
|
|
53958
|
+
directory, not \`index.html\`. Paths are project-relative: \`..\` is rejected and
|
|
53959
|
+
the project root is not shareable.
|
|
53960
|
+
- \`{ kind: "mcpApp", pluginType, toolName, input?, connectionKey? }\` \u2014 a
|
|
53961
|
+
UI-bearing sandbox plugin tool.
|
|
53962
|
+
|
|
53963
|
+
## Modes
|
|
53964
|
+
- \`mode: "link"\` \u2014 creates \`/s/<token>\`. \`visibility\` (\`public | password\`)
|
|
53965
|
+
has no default: ask the human to choose before creating a link. Only \`password\`
|
|
53966
|
+
visibility takes a \`password\`; title, expiresInMinutes, maxAccess are optional.
|
|
53967
|
+
- \`mode: "menu"\` \u2014 pins to the menu, tenant-visible and scoped to the current
|
|
53968
|
+
project. \`name\` and \`group\` are optional; call \`list_menu_groups\` first and
|
|
53969
|
+
choose an existing group or confirm a new one with the human. Before pinning a
|
|
53970
|
+
connection-backed App, confirm with the human that the pin is tenant-visible
|
|
53971
|
+
and reuses the selected connection.
|
|
53972
|
+
|
|
53973
|
+
## What the link or pin does
|
|
53974
|
+
- File links and pins serve the current file from the project volume. They do not
|
|
53975
|
+
re-run a tool and are not a frozen snapshot. Directory and artifact-app links
|
|
53976
|
+
also expose the App's \`api/*.js\` / \`api/*.py\` scripts for execution.
|
|
53977
|
+
- MCP App links and pins re-run the tool on every open, so tools with write side
|
|
53978
|
+
effects run every time. A public MCP link delegates the selected plugin
|
|
53979
|
+
connection.
|
|
53980
|
+
- Warn the human before creating a public link: anyone with the URL can access a
|
|
53981
|
+
public file (including its artifact-app API scripts), and a public MCP link
|
|
53982
|
+
delegates the selected plugin connection.
|
|
53983
|
+
|
|
53984
|
+
## Connections
|
|
53985
|
+
Pass \`connectionKey\` when the plugin has multiple connections.
|
|
53986
|
+
\`CONNECTION_AMBIGUOUS\` means ask which key to use; \`CONNECTION_REQUIRED\` means
|
|
53987
|
+
ask the human to configure one first. Never put credentials in \`input\`.
|
|
53988
|
+
|
|
53989
|
+
## Result
|
|
53990
|
+
- Link: \`token\`, \`path\` (plus \`url\` when a public base URL is configured),
|
|
53991
|
+
title, visibility, optional \`password\`, and \`warnings\`.
|
|
53992
|
+
- Menu: \`menuItemId\`, \`name\`, optional \`group\`, \`warnings\` (MCP App pins),
|
|
53993
|
+
\`alreadyPinned\`, \`refreshOnOpen\`.
|
|
53994
|
+
|
|
53995
|
+
## Errors
|
|
53996
|
+
- \`TOOL_NOT_FOUND\` / \`TOOL_NOT_UI\`: choose an available UI-bearing plugin tool.
|
|
53997
|
+
- \`CONNECTION_NOT_FOUND\` / \`CONNECTION_REQUIRED\` / \`CONNECTION_AMBIGUOUS\`: fix
|
|
53998
|
+
the connection selection, or ask the human to configure one.
|
|
53999
|
+
- \`SCOPE_REQUIRED\` / \`SCOPE_UNAVAILABLE\`: the run lacks workspace/project scope,
|
|
54000
|
+
or the deployment cannot sign MCP UI scopes.
|
|
54001
|
+
- \`INVALID_TARGET\`: the file path escapes the project, targets the root, or the
|
|
54002
|
+
target shape is unsupported.
|
|
54003
|
+
- \`PAYLOAD_TOO_LARGE\`: reduce the stored tool input.
|
|
54004
|
+
- \`SHARE_STORE_UNAVAILABLE\` / \`MENU_STORE_UNAVAILABLE\`: the store is not
|
|
54005
|
+
configured.
|
|
54006
|
+
- \`MENU_LIST_FAILED\` / \`MENU_PIN_FAILED\`: retry, or report the menu failure.
|
|
54007
|
+
`;
|
|
54008
|
+
|
|
54009
|
+
// src/middlewares/appShareMiddleware.ts
|
|
54010
|
+
var appSharePlugin = {
|
|
54011
|
+
meta: {
|
|
54012
|
+
type: "app-share",
|
|
54013
|
+
name: "Publish",
|
|
54014
|
+
description: "Publish project files and sandbox plugin MCP Apps as links or workspace menu items.",
|
|
54015
|
+
version: "2.0.0",
|
|
54016
|
+
tools: [
|
|
54017
|
+
{
|
|
54018
|
+
name: "publish_target",
|
|
54019
|
+
description: "Publish a project file (including directories and artifact apps) or a UI-bearing sandbox plugin tool. mode=link creates a share link; mode=menu pins it to the workspace menu. Only call when the user explicitly asks to publish, share, or pin. For menu groups, call list_menu_groups first. Links re-run MCP Apps on every open; file links serve the file.",
|
|
54020
|
+
ui: { resource: SHARE_CARD_UI_RESOURCE, displayMode: "inline" }
|
|
54021
|
+
},
|
|
54022
|
+
{
|
|
54023
|
+
name: "list_menu_groups",
|
|
54024
|
+
description: "List workspace menu groups and counts before choosing a pin group. Read-only."
|
|
54025
|
+
}
|
|
54026
|
+
],
|
|
54027
|
+
uiResources: {
|
|
54028
|
+
[SHARE_CARD_UI_RESOURCE]: { html: SHARE_CARD_APP_HTML }
|
|
54029
|
+
},
|
|
54030
|
+
configSchema: { type: "object", properties: {} },
|
|
54031
|
+
defaultConfig: {}
|
|
54032
|
+
},
|
|
54033
|
+
skills: {
|
|
54034
|
+
"app-share-publishing": {
|
|
54035
|
+
version: "2.0.0",
|
|
54036
|
+
content: APP_SHARE_PUBLISHING_SKILL
|
|
54037
|
+
}
|
|
54038
|
+
},
|
|
54039
|
+
middleware: () => ({
|
|
54040
|
+
name: "appShareMiddleware",
|
|
54041
|
+
tools: [
|
|
54042
|
+
tool66(publishTargetHandler, {
|
|
54043
|
+
name: "publish_target",
|
|
54044
|
+
description: "Publish a file or MCP App as a link or workspace menu item.",
|
|
54045
|
+
schema: publishTargetSchema
|
|
54046
|
+
}),
|
|
54047
|
+
tool66(listMenuGroupsHandler, {
|
|
54048
|
+
name: "list_menu_groups",
|
|
54049
|
+
description: "List workspace menu groups and counts before choosing a pin group. Read-only.",
|
|
54050
|
+
schema: listMenuGroupsSchema
|
|
54051
|
+
})
|
|
54052
|
+
]
|
|
54053
|
+
})
|
|
54054
|
+
};
|
|
54055
|
+
|
|
54056
|
+
// src/middlewares/longTermStoreMiddleware.ts
|
|
54057
|
+
import { createMiddleware as createMiddleware29, tool as tool67 } from "langchain";
|
|
54058
|
+
import { z as z74 } from "zod";
|
|
52674
54059
|
import {
|
|
52675
54060
|
STORE_IDENTITY_SEPARATOR as STORE_IDENTITY_SEPARATOR2,
|
|
52676
54061
|
StoreValidationError
|
|
@@ -52769,34 +54154,34 @@ function store() {
|
|
|
52769
54154
|
return void 0;
|
|
52770
54155
|
}
|
|
52771
54156
|
}
|
|
52772
|
-
var namespaceSchema =
|
|
54157
|
+
var namespaceSchema = z74.array(z74.string()).optional().describe(
|
|
52773
54158
|
"Optional relative namespace segments for organization (appended to the scoped prefix)."
|
|
52774
54159
|
);
|
|
52775
|
-
var keySchema =
|
|
52776
|
-
var valueSchema =
|
|
52777
|
-
var putSchema =
|
|
54160
|
+
var keySchema = z74.string().min(1).describe("Stable item key within the resolved namespace.");
|
|
54161
|
+
var valueSchema = z74.record(z74.unknown()).describe("JSON object value to persist.");
|
|
54162
|
+
var putSchema = z74.object({
|
|
52778
54163
|
key: keySchema,
|
|
52779
54164
|
value: valueSchema,
|
|
52780
54165
|
namespace: namespaceSchema,
|
|
52781
|
-
ttlMinutes:
|
|
54166
|
+
ttlMinutes: z74.number().positive().optional().describe("Optional TTL in minutes; omit to use the plugin default.")
|
|
52782
54167
|
});
|
|
52783
|
-
var getSchema =
|
|
54168
|
+
var getSchema = z74.object({
|
|
52784
54169
|
key: keySchema,
|
|
52785
54170
|
namespace: namespaceSchema
|
|
52786
54171
|
});
|
|
52787
|
-
var searchSchema2 =
|
|
52788
|
-
query:
|
|
52789
|
-
filter:
|
|
54172
|
+
var searchSchema2 = z74.object({
|
|
54173
|
+
query: z74.string().optional().describe("Case-insensitive substring match over serialized values."),
|
|
54174
|
+
filter: z74.record(z74.unknown()).optional().describe("Deep partial-equality filter over the value object."),
|
|
52790
54175
|
namespace: namespaceSchema,
|
|
52791
|
-
limit:
|
|
54176
|
+
limit: z74.number().int().min(1).max(MAX_SEARCH_LIMIT).optional()
|
|
52792
54177
|
});
|
|
52793
|
-
var deleteSchema =
|
|
54178
|
+
var deleteSchema = z74.object({
|
|
52794
54179
|
key: keySchema,
|
|
52795
54180
|
namespace: namespaceSchema
|
|
52796
54181
|
});
|
|
52797
|
-
var namespacesSchema =
|
|
54182
|
+
var namespacesSchema = z74.object({
|
|
52798
54183
|
namespace: namespaceSchema,
|
|
52799
|
-
limit:
|
|
54184
|
+
limit: z74.number().int().min(1).max(MAX_SEARCH_LIMIT).optional()
|
|
52800
54185
|
});
|
|
52801
54186
|
var STORE_SKILL_HINT = "Load long_term_store-usage for namespace/TTL guidance.";
|
|
52802
54187
|
var STORE_DESCRIPTION = [
|
|
@@ -52915,7 +54300,7 @@ function createLongTermStoreMiddleware(config = {}) {
|
|
|
52915
54300
|
}
|
|
52916
54301
|
return resolveNamespace(config, scope, relative4);
|
|
52917
54302
|
};
|
|
52918
|
-
const putTool =
|
|
54303
|
+
const putTool = tool67(
|
|
52919
54304
|
async (input, exeConfig) => {
|
|
52920
54305
|
const resolved = resolve4(exeConfig, input.namespace);
|
|
52921
54306
|
if (!resolved.namespace) return failure3(resolved.error ?? "Invalid namespace");
|
|
@@ -52946,7 +54331,7 @@ function createLongTermStoreMiddleware(config = {}) {
|
|
|
52946
54331
|
schema: putSchema
|
|
52947
54332
|
}
|
|
52948
54333
|
);
|
|
52949
|
-
const getTool =
|
|
54334
|
+
const getTool = tool67(
|
|
52950
54335
|
async (input, exeConfig) => {
|
|
52951
54336
|
const resolved = resolve4(exeConfig, input.namespace);
|
|
52952
54337
|
if (!resolved.namespace) return failure3(resolved.error ?? "Invalid namespace");
|
|
@@ -52970,7 +54355,7 @@ function createLongTermStoreMiddleware(config = {}) {
|
|
|
52970
54355
|
schema: getSchema
|
|
52971
54356
|
}
|
|
52972
54357
|
);
|
|
52973
|
-
const searchTool =
|
|
54358
|
+
const searchTool = tool67(
|
|
52974
54359
|
async (input, exeConfig) => {
|
|
52975
54360
|
const resolved = resolve4(exeConfig, input.namespace);
|
|
52976
54361
|
if (!resolved.namespace) return failure3(resolved.error ?? "Invalid namespace");
|
|
@@ -52997,7 +54382,7 @@ function createLongTermStoreMiddleware(config = {}) {
|
|
|
52997
54382
|
schema: searchSchema2
|
|
52998
54383
|
}
|
|
52999
54384
|
);
|
|
53000
|
-
const deleteTool =
|
|
54385
|
+
const deleteTool = tool67(
|
|
53001
54386
|
async (input, exeConfig) => {
|
|
53002
54387
|
const resolved = resolve4(exeConfig, input.namespace);
|
|
53003
54388
|
if (!resolved.namespace) return failure3(resolved.error ?? "Invalid namespace");
|
|
@@ -53021,7 +54406,7 @@ function createLongTermStoreMiddleware(config = {}) {
|
|
|
53021
54406
|
schema: deleteSchema
|
|
53022
54407
|
}
|
|
53023
54408
|
);
|
|
53024
|
-
const namespacesTool =
|
|
54409
|
+
const namespacesTool = tool67(
|
|
53025
54410
|
async (input, exeConfig) => {
|
|
53026
54411
|
const resolved = resolve4(exeConfig, input.namespace);
|
|
53027
54412
|
if (!resolved.namespace) return failure3(resolved.error ?? "Invalid namespace");
|
|
@@ -53049,7 +54434,7 @@ function createLongTermStoreMiddleware(config = {}) {
|
|
|
53049
54434
|
schema: namespacesSchema
|
|
53050
54435
|
}
|
|
53051
54436
|
);
|
|
53052
|
-
return
|
|
54437
|
+
return createMiddleware29({
|
|
53053
54438
|
name: "LongTermStoreMiddleware",
|
|
53054
54439
|
tools: readOnly ? [getTool, searchTool, namespacesTool] : [putTool, getTool, searchTool, deleteTool, namespacesTool]
|
|
53055
54440
|
});
|
|
@@ -53141,6 +54526,7 @@ var BUILTIN_PLUGINS = [
|
|
|
53141
54526
|
documentParserPlugin,
|
|
53142
54527
|
projectRoomPlugin,
|
|
53143
54528
|
sandboxPluginsPlugin,
|
|
54529
|
+
appSharePlugin,
|
|
53144
54530
|
longTermStorePlugin
|
|
53145
54531
|
];
|
|
53146
54532
|
function registerBuiltinPlugins() {
|
|
@@ -53575,8 +54961,11 @@ async function runHandler(body) {
|
|
|
53575
54961
|
var needsTempDir = inputIsLarge || connectionPayload !== null;
|
|
53576
54962
|
var tempDir = null;
|
|
53577
54963
|
var env = Object.assign({}, process.env);
|
|
53578
|
-
// Handler processes must never inherit scope signing secrets
|
|
54964
|
+
// Handler processes must never inherit scope signing secrets or the
|
|
54965
|
+
// agent-only short-lived Open token.
|
|
53579
54966
|
delete env.MCP_UI_SCOPE_SECRET;
|
|
54967
|
+
delete env.OPEN_API_TOKEN;
|
|
54968
|
+
delete env.API_GATEWAY_URL;
|
|
53580
54969
|
try {
|
|
53581
54970
|
if (needsTempDir) {
|
|
53582
54971
|
tempDir = path.join(os.tmpdir(), "plugin-run-" + Date.now() + "-" + Math.random().toString(36).slice(2));
|
|
@@ -53595,6 +54984,9 @@ async function runHandler(body) {
|
|
|
53595
54984
|
env.PLUGIN_CONNECTION_FILE = connectionFile;
|
|
53596
54985
|
}
|
|
53597
54986
|
env.PLUGIN_CONTEXT = encodeInput(body.context || {});
|
|
54987
|
+
if (typeof body.apiGatewayUrl === "string" && body.apiGatewayUrl) {
|
|
54988
|
+
env.API_GATEWAY_URL = body.apiGatewayUrl;
|
|
54989
|
+
}
|
|
53598
54990
|
var handlerTimeoutMs = resolveHandlerTimeoutMs(body.timeoutMs);
|
|
53599
54991
|
var exec = await runNode(handlerPath, pluginDir, env, handlerTimeoutMs);
|
|
53600
54992
|
if (exec.error) {
|
|
@@ -54145,6 +55537,7 @@ export {
|
|
|
54145
55537
|
DelegationService,
|
|
54146
55538
|
DependencyResolver,
|
|
54147
55539
|
DuplicateProjectRoomMessageIdempotencyKeyError,
|
|
55540
|
+
DuplicateShareTokenError,
|
|
54148
55541
|
E2BInstance,
|
|
54149
55542
|
E2BProvider,
|
|
54150
55543
|
EMPTY_CONTENT_WARNING,
|
|
@@ -54180,6 +55573,8 @@ export {
|
|
|
54180
55573
|
InMemoryProjectRoomMessageStore,
|
|
54181
55574
|
InMemoryProjectRoomReadStateStore,
|
|
54182
55575
|
InMemoryProjectRoomStore,
|
|
55576
|
+
InMemoryProjectStore,
|
|
55577
|
+
InMemorySharedResourceStore,
|
|
54183
55578
|
InMemoryStore,
|
|
54184
55579
|
InMemoryTaskStore,
|
|
54185
55580
|
InMemoryTaskWorkItemStore,
|
|
@@ -54236,6 +55631,7 @@ export {
|
|
|
54236
55631
|
ProjectBotMembershipIdConflictError,
|
|
54237
55632
|
ProjectMutationMutex,
|
|
54238
55633
|
ProjectRoomMessageIdConflictError,
|
|
55634
|
+
ProjectRoomMessageNotifier,
|
|
54239
55635
|
ProjectTaskAdmissionNotifier,
|
|
54240
55636
|
ProjectTaskOwnerPolicy,
|
|
54241
55637
|
ProjectTaskOwnerPolicyError,
|
|
@@ -54252,6 +55648,8 @@ export {
|
|
|
54252
55648
|
SAFE_PATH_COMPONENT,
|
|
54253
55649
|
SANDBOX_OPEN_GATEWAY_URL_ENV,
|
|
54254
55650
|
SANDBOX_OPEN_TOKEN_ENV,
|
|
55651
|
+
SHARE_CARD_APP_HTML,
|
|
55652
|
+
SHARE_CARD_UI_RESOURCE,
|
|
54255
55653
|
STTModelLattice,
|
|
54256
55654
|
STTModelLatticeManager,
|
|
54257
55655
|
SUMMARIZATION_TRIGGER_RATIO,
|
|
@@ -54261,6 +55659,7 @@ export {
|
|
|
54261
55659
|
SandboxSkillStore,
|
|
54262
55660
|
ScheduleLatticeManager,
|
|
54263
55661
|
SemanticMetricsClient,
|
|
55662
|
+
SharePayloadError,
|
|
54264
55663
|
SharedChunkBuffer,
|
|
54265
55664
|
SimpleMemoryVectorStore,
|
|
54266
55665
|
SkillLatticeManager,
|
|
@@ -54292,6 +55691,7 @@ export {
|
|
|
54292
55691
|
abortWorkflowRun,
|
|
54293
55692
|
agentInstanceManager,
|
|
54294
55693
|
agentLatticeManager,
|
|
55694
|
+
appSharePlugin,
|
|
54295
55695
|
appendReconciliationWarning,
|
|
54296
55696
|
appendUiFence,
|
|
54297
55697
|
assertQueueSources,
|
|
@@ -54344,6 +55744,7 @@ export {
|
|
|
54344
55744
|
createListTablesSqlTool,
|
|
54345
55745
|
createLongTermStoreMiddleware,
|
|
54346
55746
|
createMapNode,
|
|
55747
|
+
createMcpAppSharePayload,
|
|
54347
55748
|
createModelSelectorMiddleware,
|
|
54348
55749
|
createNodeHandler,
|
|
54349
55750
|
createProjectRoomMiddleware,
|
|
@@ -54437,6 +55838,7 @@ export {
|
|
|
54437
55838
|
getSTTModelLattice,
|
|
54438
55839
|
getSandBoxManager,
|
|
54439
55840
|
getSandboxOpenCredential,
|
|
55841
|
+
getSandboxOpenGatewayUrl,
|
|
54440
55842
|
getSandboxPluginCatalog,
|
|
54441
55843
|
getScheduleLattice,
|
|
54442
55844
|
getStoreLattice,
|
|
@@ -54475,6 +55877,7 @@ export {
|
|
|
54475
55877
|
isValidSkillName,
|
|
54476
55878
|
jsonSchemaToZod,
|
|
54477
55879
|
listCollectionEntries,
|
|
55880
|
+
listMenuGroupsSchema,
|
|
54478
55881
|
listModelLatticesForTenant,
|
|
54479
55882
|
listSandboxProviderTypes,
|
|
54480
55883
|
listTenantPlugins,
|
|
@@ -54510,11 +55913,13 @@ export {
|
|
|
54510
55913
|
prepareTaskDispatch,
|
|
54511
55914
|
probeThreadRunOwner,
|
|
54512
55915
|
projectMutationMutex,
|
|
55916
|
+
projectRoomMessageNotifier,
|
|
54513
55917
|
projectRoomPlugin,
|
|
54514
55918
|
projectTaskAdmissionNotifier,
|
|
54515
55919
|
provisionSandboxOpenClient,
|
|
54516
55920
|
publishCollectionChanged,
|
|
54517
55921
|
publishPluginCatalogChanged,
|
|
55922
|
+
publishTargetSchema,
|
|
54518
55923
|
queueLatticeManager,
|
|
54519
55924
|
readContextWindow,
|
|
54520
55925
|
readLoopBreakerConfig,
|
|
@@ -54536,6 +55941,7 @@ export {
|
|
|
54536
55941
|
registerQueueLattice,
|
|
54537
55942
|
registerSTTModelLattice,
|
|
54538
55943
|
registerSandboxOpenCredentialProvider,
|
|
55944
|
+
registerSandboxOpenGatewayUrlProvider,
|
|
54539
55945
|
registerSandboxProviderType,
|
|
54540
55946
|
registerScheduleLattice,
|
|
54541
55947
|
registerStoreLattice,
|