integrate-sdk 0.9.9-dev.0 → 0.9.13-dev.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/adapters/auto-routes.js +32750 -281
- package/dist/adapters/context-cookie.js +18 -0
- package/dist/adapters/index.js +32752 -283
- package/dist/adapters/nextjs-oauth-redirect.js +18 -0
- package/dist/adapters/nextjs.js +32750 -281
- package/dist/adapters/node.js +32750 -281
- package/dist/adapters/session-detector.js +18 -0
- package/dist/adapters/solid-start.js +18 -0
- package/dist/adapters/svelte-kit.js +32750 -281
- package/dist/adapters/tanstack-start.js +32752 -283
- package/dist/ai/anthropic.js +47 -15
- package/dist/ai/google.js +47 -15
- package/dist/ai/index.js +47 -15
- package/dist/ai/openai.js +47 -15
- package/dist/ai/trigger-tools.js +17 -0
- package/dist/ai/utils.js +17 -0
- package/dist/ai/vercel-ai.js +47 -15
- package/dist/code-mode/executor.d.ts +8 -0
- package/dist/code-mode/executor.d.ts.map +1 -1
- package/dist/code-mode/executor.js +35 -7
- package/dist/code-mode/index.js +51 -15
- package/dist/code-mode/runtime-stub.js +19 -0
- package/dist/code-mode/tool-builder.d.ts +9 -1
- package/dist/code-mode/tool-builder.d.ts.map +1 -1
- package/dist/code-mode/tool-builder.js +52 -15
- package/dist/code-mode/type-generator.js +19 -0
- package/dist/index.js +76 -19
- package/dist/oauth.js +71 -19
- package/dist/react.js +22 -0
- package/dist/server.js +71 -19
- package/dist/src/code-mode/executor.d.ts +8 -0
- package/dist/src/code-mode/executor.d.ts.map +1 -1
- package/dist/src/code-mode/tool-builder.d.ts +9 -1
- package/dist/src/code-mode/tool-builder.d.ts.map +1 -1
- package/dist/src/config/types.d.ts +2 -2
- package/dist/src/server.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
1
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
7
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
8
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
9
|
+
for (let key of __getOwnPropNames(mod))
|
|
10
|
+
if (!__hasOwnProp.call(to, key))
|
|
11
|
+
__defProp(to, key, {
|
|
12
|
+
get: () => mod[key],
|
|
13
|
+
enumerable: true
|
|
14
|
+
});
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
2
17
|
var __export = (target, all) => {
|
|
3
18
|
for (var name in all)
|
|
4
19
|
__defProp(target, name, {
|
|
@@ -9,6 +24,13 @@ var __export = (target, all) => {
|
|
|
9
24
|
});
|
|
10
25
|
};
|
|
11
26
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
27
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
28
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
29
|
+
}) : x)(function(x) {
|
|
30
|
+
if (typeof require !== "undefined")
|
|
31
|
+
return require.apply(this, arguments);
|
|
32
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
33
|
+
});
|
|
12
34
|
|
|
13
35
|
// src/protocol/jsonrpc.ts
|
|
14
36
|
function parseMessage(message) {
|
|
@@ -9015,6 +9037,7 @@ export { callTool };
|
|
|
9015
9037
|
var exports_executor = {};
|
|
9016
9038
|
__export(exports_executor, {
|
|
9017
9039
|
isSandboxAvailable: () => isSandboxAvailable,
|
|
9040
|
+
getSandboxImportError: () => getSandboxImportError,
|
|
9018
9041
|
executeSandboxCode: () => executeSandboxCode,
|
|
9019
9042
|
__setSandboxUnavailableForTests: () => __setSandboxUnavailableForTests,
|
|
9020
9043
|
__setSandboxFactoryForTests: () => __setSandboxFactoryForTests
|
|
@@ -9023,10 +9046,15 @@ function __setSandboxFactoryForTests(factory) {
|
|
|
9023
9046
|
sandboxFactoryOverride = factory;
|
|
9024
9047
|
_sandboxForcedUnavailableForTests = false;
|
|
9025
9048
|
_sandboxAvailableCache = null;
|
|
9049
|
+
_sandboxImportError = null;
|
|
9026
9050
|
}
|
|
9027
9051
|
function __setSandboxUnavailableForTests(force) {
|
|
9028
9052
|
_sandboxForcedUnavailableForTests = force;
|
|
9029
9053
|
_sandboxAvailableCache = null;
|
|
9054
|
+
_sandboxImportError = force ? new Error("Sandbox forced unavailable by test seam.") : null;
|
|
9055
|
+
}
|
|
9056
|
+
function getSandboxImportError() {
|
|
9057
|
+
return _sandboxImportError;
|
|
9030
9058
|
}
|
|
9031
9059
|
async function isSandboxAvailable() {
|
|
9032
9060
|
if (_sandboxAvailableCache !== null)
|
|
@@ -9037,15 +9065,17 @@ async function isSandboxAvailable() {
|
|
|
9037
9065
|
}
|
|
9038
9066
|
if (sandboxFactoryOverride) {
|
|
9039
9067
|
_sandboxAvailableCache = true;
|
|
9068
|
+
_sandboxImportError = null;
|
|
9040
9069
|
return true;
|
|
9041
9070
|
}
|
|
9042
9071
|
try {
|
|
9043
|
-
|
|
9044
|
-
await dynamicImport("@" + "vercel/sandbox");
|
|
9072
|
+
await import("@vercel/sandbox");
|
|
9045
9073
|
_sandboxAvailableCache = true;
|
|
9074
|
+
_sandboxImportError = null;
|
|
9046
9075
|
return true;
|
|
9047
|
-
} catch {
|
|
9076
|
+
} catch (err) {
|
|
9048
9077
|
_sandboxAvailableCache = false;
|
|
9078
|
+
_sandboxImportError = err;
|
|
9049
9079
|
return false;
|
|
9050
9080
|
}
|
|
9051
9081
|
}
|
|
@@ -9053,12 +9083,12 @@ async function loadSandboxFactory() {
|
|
|
9053
9083
|
if (sandboxFactoryOverride)
|
|
9054
9084
|
return sandboxFactoryOverride;
|
|
9055
9085
|
try {
|
|
9056
|
-
const
|
|
9057
|
-
const pkg = "@" + "vercel/sandbox";
|
|
9058
|
-
const mod = await dynamicImport(pkg);
|
|
9086
|
+
const mod = await import("@vercel/sandbox");
|
|
9059
9087
|
return mod.Sandbox ?? mod.default?.Sandbox ?? mod;
|
|
9060
9088
|
} catch (err) {
|
|
9061
|
-
|
|
9089
|
+
_sandboxImportError = err;
|
|
9090
|
+
const detail = err instanceof Error ? `: ${err.message}` : "";
|
|
9091
|
+
throw new Error("Code Mode failed to load `@vercel/sandbox`" + detail + ". Ensure the package is installed and reachable at runtime. On Next.js/Vercel, confirm it is listed in `dependencies` (not only `devDependencies`) and that the route using Code Mode runs in the Node.js runtime (not Edge).");
|
|
9062
9092
|
}
|
|
9063
9093
|
}
|
|
9064
9094
|
function wrapUserCode(code) {
|
|
@@ -9178,30 +9208,58 @@ async function executeSandboxCode(options) {
|
|
|
9178
9208
|
}
|
|
9179
9209
|
}
|
|
9180
9210
|
}
|
|
9181
|
-
var sandboxFactoryOverride = null, _sandboxAvailableCache = null, _sandboxForcedUnavailableForTests = false, RESULT_SENTINEL = "__INTEGRATE_RESULT__";
|
|
9211
|
+
var sandboxFactoryOverride = null, _sandboxAvailableCache = null, _sandboxImportError = null, _sandboxForcedUnavailableForTests = false, RESULT_SENTINEL = "__INTEGRATE_RESULT__";
|
|
9182
9212
|
var init_executor = () => {};
|
|
9183
9213
|
|
|
9184
9214
|
// src/code-mode/tool-builder.ts
|
|
9215
|
+
var exports_tool_builder = {};
|
|
9216
|
+
__export(exports_tool_builder, {
|
|
9217
|
+
warnCodeModeFallback: () => warnCodeModeFallback,
|
|
9218
|
+
resolveCodeModePublicUrl: () => resolveCodeModePublicUrl,
|
|
9219
|
+
resolveCodeModeClientConfig: () => resolveCodeModeClientConfig,
|
|
9220
|
+
diagnoseCodeMode: () => diagnoseCodeMode,
|
|
9221
|
+
canUseCodeMode: () => canUseCodeMode,
|
|
9222
|
+
buildCodeModeTool: () => buildCodeModeTool,
|
|
9223
|
+
__resetCodeModeFallbackWarnings: () => __resetCodeModeFallbackWarnings,
|
|
9224
|
+
CODE_MODE_TOOL_NAME: () => CODE_MODE_TOOL_NAME
|
|
9225
|
+
});
|
|
9185
9226
|
function resolveCodeModeClientConfig(client) {
|
|
9186
9227
|
const oauthConfig = client.__oauthConfig;
|
|
9187
9228
|
return oauthConfig?.codeMode ?? {};
|
|
9188
9229
|
}
|
|
9230
|
+
function resolveCodeModePublicUrl(serverConfig = {}) {
|
|
9231
|
+
return serverConfig.publicUrl ?? getEnv("INTEGRATE_URL");
|
|
9232
|
+
}
|
|
9189
9233
|
async function diagnoseCodeMode(client) {
|
|
9190
9234
|
if (!await isSandboxAvailable()) {
|
|
9191
9235
|
return { available: false, reason: "sandbox-missing" };
|
|
9192
9236
|
}
|
|
9193
9237
|
const serverConfig = resolveCodeModeClientConfig(client);
|
|
9194
|
-
const publicUrl = serverConfig
|
|
9238
|
+
const publicUrl = resolveCodeModePublicUrl(serverConfig);
|
|
9195
9239
|
if (!publicUrl) {
|
|
9196
9240
|
return { available: false, reason: "no-public-url" };
|
|
9197
9241
|
}
|
|
9198
9242
|
return { available: true };
|
|
9199
9243
|
}
|
|
9244
|
+
async function canUseCodeMode(client) {
|
|
9245
|
+
return (await diagnoseCodeMode(client)).available;
|
|
9246
|
+
}
|
|
9247
|
+
function buildFallbackMessage(reason) {
|
|
9248
|
+
if (reason === "no-public-url") {
|
|
9249
|
+
return "[integrate-sdk] Code Mode unavailable (reason: no-public-url) — falling back to tool mode. " + "Set `codeMode.publicUrl` on your server config or the `INTEGRATE_URL` env var.";
|
|
9250
|
+
}
|
|
9251
|
+
const importError = getSandboxImportError();
|
|
9252
|
+
const detail = importError instanceof Error ? ` Underlying import error: ${importError.message}` : importError ? ` Underlying import error: ${String(importError)}` : "";
|
|
9253
|
+
return "[integrate-sdk] Code Mode unavailable (reason: sandbox-missing) — falling back to tool mode. " + "Ensure `@vercel/sandbox` is in `dependencies` and the route runs in the Node.js runtime (not Edge)." + detail;
|
|
9254
|
+
}
|
|
9255
|
+
function __resetCodeModeFallbackWarnings() {
|
|
9256
|
+
warnedCodeModeReasons.clear();
|
|
9257
|
+
}
|
|
9200
9258
|
function warnCodeModeFallback(reason) {
|
|
9201
9259
|
if (warnedCodeModeReasons.has(reason))
|
|
9202
9260
|
return;
|
|
9203
9261
|
warnedCodeModeReasons.add(reason);
|
|
9204
|
-
console.warn(
|
|
9262
|
+
console.warn(buildFallbackMessage(reason));
|
|
9205
9263
|
}
|
|
9206
9264
|
function buildCodeModeTool(client, options) {
|
|
9207
9265
|
const { tools, providerTokens, context, integrationIds } = options;
|
|
@@ -9214,7 +9272,9 @@ function buildCodeModeTool(client, options) {
|
|
|
9214
9272
|
${generated.source}
|
|
9215
9273
|
\`\`\``;
|
|
9216
9274
|
const execute = async ({ code }) => {
|
|
9217
|
-
const publicUrl =
|
|
9275
|
+
const publicUrl = resolveCodeModePublicUrl({
|
|
9276
|
+
publicUrl: sandboxOverrides.publicUrl ?? serverCodeModeConfig.publicUrl
|
|
9277
|
+
});
|
|
9218
9278
|
const apiKey = client.__oauthConfig?.apiKey;
|
|
9219
9279
|
if (!publicUrl) {
|
|
9220
9280
|
return {
|
|
@@ -9223,7 +9283,7 @@ ${generated.source}
|
|
|
9223
9283
|
stdout: "",
|
|
9224
9284
|
stderr: "",
|
|
9225
9285
|
durationMs: 0,
|
|
9226
|
-
error: "Code Mode requires `codeMode.publicUrl` in createMCPServer config (or the
|
|
9286
|
+
error: "Code Mode requires `codeMode.publicUrl` in createMCPServer config (or the INTEGRATE_URL env var). " + "The sandbox uses it to call back into /api/integrate/mcp."
|
|
9227
9287
|
};
|
|
9228
9288
|
}
|
|
9229
9289
|
const mcpUrl = publicUrl.replace(/\/$/, "") + "/api/integrate/mcp";
|
|
@@ -9257,7 +9317,7 @@ ${generated.source}
|
|
|
9257
9317
|
execute
|
|
9258
9318
|
};
|
|
9259
9319
|
}
|
|
9260
|
-
var CODE_MODE_TOOL_NAME = "execute_code", DEFAULT_INSTRUCTIONS,
|
|
9320
|
+
var CODE_MODE_TOOL_NAME = "execute_code", DEFAULT_INSTRUCTIONS, warnedCodeModeReasons;
|
|
9261
9321
|
var init_tool_builder = __esm(() => {
|
|
9262
9322
|
init_type_generator();
|
|
9263
9323
|
init_executor();
|
|
@@ -9282,10 +9342,6 @@ var init_tool_builder = __esm(() => {
|
|
|
9282
9342
|
"API surface:"
|
|
9283
9343
|
].join(`
|
|
9284
9344
|
`);
|
|
9285
|
-
CODE_MODE_UNAVAILABLE_MESSAGES = {
|
|
9286
|
-
"sandbox-missing": "[integrate-sdk] Code Mode unavailable (reason: sandbox-missing) — falling back to tool mode. " + "Install `@vercel/sandbox` (e.g. `bun add @vercel/sandbox`) to enable Code Mode.",
|
|
9287
|
-
"no-public-url": "[integrate-sdk] Code Mode unavailable (reason: no-public-url) — falling back to tool mode. " + "Set `codeMode.publicUrl` on your server config or the `INTEGRATE_PUBLIC_URL` env var."
|
|
9288
|
-
};
|
|
9289
9345
|
warnedCodeModeReasons = new Set;
|
|
9290
9346
|
});
|
|
9291
9347
|
|
|
@@ -11779,11 +11835,12 @@ function createMCPServer(config) {
|
|
|
11779
11835
|
return Response.json({ error: "`code` is required and must be a non-empty string." }, { status: 400 });
|
|
11780
11836
|
}
|
|
11781
11837
|
const { executeSandboxCode: executeSandboxCode2 } = await Promise.resolve().then(() => (init_executor(), exports_executor));
|
|
11838
|
+
const { resolveCodeModePublicUrl: resolveCodeModePublicUrl2 } = await Promise.resolve().then(() => (init_tool_builder(), exports_tool_builder));
|
|
11782
11839
|
const codeModeConfig = config.codeMode ?? {};
|
|
11783
|
-
const publicUrl = codeModeConfig
|
|
11840
|
+
const publicUrl = resolveCodeModePublicUrl2(codeModeConfig);
|
|
11784
11841
|
if (!publicUrl) {
|
|
11785
11842
|
return Response.json({
|
|
11786
|
-
error: "Code Mode requires `codeMode.publicUrl` in createMCPServer config (or the
|
|
11843
|
+
error: "Code Mode requires `codeMode.publicUrl` in createMCPServer config (or the INTEGRATE_URL env var). Set it to the public origin where /api/integrate/mcp is reachable."
|
|
11787
11844
|
}, { status: 500 });
|
|
11788
11845
|
}
|
|
11789
11846
|
let contextOverride = body.context;
|
package/dist/oauth.js
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
1
4
|
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
2
18
|
var __export = (target, all) => {
|
|
3
19
|
for (var name in all)
|
|
4
20
|
__defProp(target, name, {
|
|
@@ -9,6 +25,7 @@ var __export = (target, all) => {
|
|
|
9
25
|
});
|
|
10
26
|
};
|
|
11
27
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
28
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
12
29
|
|
|
13
30
|
// src/utils/logger.ts
|
|
14
31
|
function shouldLog(level, context) {
|
|
@@ -8849,6 +8866,7 @@ export { callTool };
|
|
|
8849
8866
|
var exports_executor = {};
|
|
8850
8867
|
__export(exports_executor, {
|
|
8851
8868
|
isSandboxAvailable: () => isSandboxAvailable,
|
|
8869
|
+
getSandboxImportError: () => getSandboxImportError,
|
|
8852
8870
|
executeSandboxCode: () => executeSandboxCode,
|
|
8853
8871
|
__setSandboxUnavailableForTests: () => __setSandboxUnavailableForTests,
|
|
8854
8872
|
__setSandboxFactoryForTests: () => __setSandboxFactoryForTests
|
|
@@ -8857,10 +8875,15 @@ function __setSandboxFactoryForTests(factory) {
|
|
|
8857
8875
|
sandboxFactoryOverride = factory;
|
|
8858
8876
|
_sandboxForcedUnavailableForTests = false;
|
|
8859
8877
|
_sandboxAvailableCache = null;
|
|
8878
|
+
_sandboxImportError = null;
|
|
8860
8879
|
}
|
|
8861
8880
|
function __setSandboxUnavailableForTests(force) {
|
|
8862
8881
|
_sandboxForcedUnavailableForTests = force;
|
|
8863
8882
|
_sandboxAvailableCache = null;
|
|
8883
|
+
_sandboxImportError = force ? new Error("Sandbox forced unavailable by test seam.") : null;
|
|
8884
|
+
}
|
|
8885
|
+
function getSandboxImportError() {
|
|
8886
|
+
return _sandboxImportError;
|
|
8864
8887
|
}
|
|
8865
8888
|
async function isSandboxAvailable() {
|
|
8866
8889
|
if (_sandboxAvailableCache !== null)
|
|
@@ -8871,15 +8894,17 @@ async function isSandboxAvailable() {
|
|
|
8871
8894
|
}
|
|
8872
8895
|
if (sandboxFactoryOverride) {
|
|
8873
8896
|
_sandboxAvailableCache = true;
|
|
8897
|
+
_sandboxImportError = null;
|
|
8874
8898
|
return true;
|
|
8875
8899
|
}
|
|
8876
8900
|
try {
|
|
8877
|
-
|
|
8878
|
-
await dynamicImport("@" + "vercel/sandbox");
|
|
8901
|
+
await import("@vercel/sandbox");
|
|
8879
8902
|
_sandboxAvailableCache = true;
|
|
8903
|
+
_sandboxImportError = null;
|
|
8880
8904
|
return true;
|
|
8881
|
-
} catch {
|
|
8905
|
+
} catch (err) {
|
|
8882
8906
|
_sandboxAvailableCache = false;
|
|
8907
|
+
_sandboxImportError = err;
|
|
8883
8908
|
return false;
|
|
8884
8909
|
}
|
|
8885
8910
|
}
|
|
@@ -8887,12 +8912,12 @@ async function loadSandboxFactory() {
|
|
|
8887
8912
|
if (sandboxFactoryOverride)
|
|
8888
8913
|
return sandboxFactoryOverride;
|
|
8889
8914
|
try {
|
|
8890
|
-
const
|
|
8891
|
-
const pkg = "@" + "vercel/sandbox";
|
|
8892
|
-
const mod = await dynamicImport(pkg);
|
|
8915
|
+
const mod = await import("@vercel/sandbox");
|
|
8893
8916
|
return mod.Sandbox ?? mod.default?.Sandbox ?? mod;
|
|
8894
8917
|
} catch (err) {
|
|
8895
|
-
|
|
8918
|
+
_sandboxImportError = err;
|
|
8919
|
+
const detail = err instanceof Error ? `: ${err.message}` : "";
|
|
8920
|
+
throw new Error("Code Mode failed to load `@vercel/sandbox`" + detail + ". Ensure the package is installed and reachable at runtime. On Next.js/Vercel, confirm it is listed in `dependencies` (not only `devDependencies`) and that the route using Code Mode runs in the Node.js runtime (not Edge).");
|
|
8896
8921
|
}
|
|
8897
8922
|
}
|
|
8898
8923
|
function wrapUserCode(code) {
|
|
@@ -9012,30 +9037,58 @@ async function executeSandboxCode(options) {
|
|
|
9012
9037
|
}
|
|
9013
9038
|
}
|
|
9014
9039
|
}
|
|
9015
|
-
var sandboxFactoryOverride = null, _sandboxAvailableCache = null, _sandboxForcedUnavailableForTests = false, RESULT_SENTINEL = "__INTEGRATE_RESULT__";
|
|
9040
|
+
var sandboxFactoryOverride = null, _sandboxAvailableCache = null, _sandboxImportError = null, _sandboxForcedUnavailableForTests = false, RESULT_SENTINEL = "__INTEGRATE_RESULT__";
|
|
9016
9041
|
var init_executor = () => {};
|
|
9017
9042
|
|
|
9018
9043
|
// src/code-mode/tool-builder.ts
|
|
9044
|
+
var exports_tool_builder = {};
|
|
9045
|
+
__export(exports_tool_builder, {
|
|
9046
|
+
warnCodeModeFallback: () => warnCodeModeFallback,
|
|
9047
|
+
resolveCodeModePublicUrl: () => resolveCodeModePublicUrl,
|
|
9048
|
+
resolveCodeModeClientConfig: () => resolveCodeModeClientConfig,
|
|
9049
|
+
diagnoseCodeMode: () => diagnoseCodeMode,
|
|
9050
|
+
canUseCodeMode: () => canUseCodeMode,
|
|
9051
|
+
buildCodeModeTool: () => buildCodeModeTool,
|
|
9052
|
+
__resetCodeModeFallbackWarnings: () => __resetCodeModeFallbackWarnings,
|
|
9053
|
+
CODE_MODE_TOOL_NAME: () => CODE_MODE_TOOL_NAME
|
|
9054
|
+
});
|
|
9019
9055
|
function resolveCodeModeClientConfig(client) {
|
|
9020
9056
|
const oauthConfig = client.__oauthConfig;
|
|
9021
9057
|
return oauthConfig?.codeMode ?? {};
|
|
9022
9058
|
}
|
|
9059
|
+
function resolveCodeModePublicUrl(serverConfig = {}) {
|
|
9060
|
+
return serverConfig.publicUrl ?? getEnv("INTEGRATE_URL");
|
|
9061
|
+
}
|
|
9023
9062
|
async function diagnoseCodeMode(client) {
|
|
9024
9063
|
if (!await isSandboxAvailable()) {
|
|
9025
9064
|
return { available: false, reason: "sandbox-missing" };
|
|
9026
9065
|
}
|
|
9027
9066
|
const serverConfig = resolveCodeModeClientConfig(client);
|
|
9028
|
-
const publicUrl = serverConfig
|
|
9067
|
+
const publicUrl = resolveCodeModePublicUrl(serverConfig);
|
|
9029
9068
|
if (!publicUrl) {
|
|
9030
9069
|
return { available: false, reason: "no-public-url" };
|
|
9031
9070
|
}
|
|
9032
9071
|
return { available: true };
|
|
9033
9072
|
}
|
|
9073
|
+
async function canUseCodeMode(client) {
|
|
9074
|
+
return (await diagnoseCodeMode(client)).available;
|
|
9075
|
+
}
|
|
9076
|
+
function buildFallbackMessage(reason) {
|
|
9077
|
+
if (reason === "no-public-url") {
|
|
9078
|
+
return "[integrate-sdk] Code Mode unavailable (reason: no-public-url) — falling back to tool mode. " + "Set `codeMode.publicUrl` on your server config or the `INTEGRATE_URL` env var.";
|
|
9079
|
+
}
|
|
9080
|
+
const importError = getSandboxImportError();
|
|
9081
|
+
const detail = importError instanceof Error ? ` Underlying import error: ${importError.message}` : importError ? ` Underlying import error: ${String(importError)}` : "";
|
|
9082
|
+
return "[integrate-sdk] Code Mode unavailable (reason: sandbox-missing) — falling back to tool mode. " + "Ensure `@vercel/sandbox` is in `dependencies` and the route runs in the Node.js runtime (not Edge)." + detail;
|
|
9083
|
+
}
|
|
9084
|
+
function __resetCodeModeFallbackWarnings() {
|
|
9085
|
+
warnedCodeModeReasons.clear();
|
|
9086
|
+
}
|
|
9034
9087
|
function warnCodeModeFallback(reason) {
|
|
9035
9088
|
if (warnedCodeModeReasons.has(reason))
|
|
9036
9089
|
return;
|
|
9037
9090
|
warnedCodeModeReasons.add(reason);
|
|
9038
|
-
console.warn(
|
|
9091
|
+
console.warn(buildFallbackMessage(reason));
|
|
9039
9092
|
}
|
|
9040
9093
|
function buildCodeModeTool(client, options) {
|
|
9041
9094
|
const { tools, providerTokens, context, integrationIds } = options;
|
|
@@ -9048,7 +9101,9 @@ function buildCodeModeTool(client, options) {
|
|
|
9048
9101
|
${generated.source}
|
|
9049
9102
|
\`\`\``;
|
|
9050
9103
|
const execute = async ({ code }) => {
|
|
9051
|
-
const publicUrl =
|
|
9104
|
+
const publicUrl = resolveCodeModePublicUrl({
|
|
9105
|
+
publicUrl: sandboxOverrides.publicUrl ?? serverCodeModeConfig.publicUrl
|
|
9106
|
+
});
|
|
9052
9107
|
const apiKey = client.__oauthConfig?.apiKey;
|
|
9053
9108
|
if (!publicUrl) {
|
|
9054
9109
|
return {
|
|
@@ -9057,7 +9112,7 @@ ${generated.source}
|
|
|
9057
9112
|
stdout: "",
|
|
9058
9113
|
stderr: "",
|
|
9059
9114
|
durationMs: 0,
|
|
9060
|
-
error: "Code Mode requires `codeMode.publicUrl` in createMCPServer config (or the
|
|
9115
|
+
error: "Code Mode requires `codeMode.publicUrl` in createMCPServer config (or the INTEGRATE_URL env var). " + "The sandbox uses it to call back into /api/integrate/mcp."
|
|
9061
9116
|
};
|
|
9062
9117
|
}
|
|
9063
9118
|
const mcpUrl = publicUrl.replace(/\/$/, "") + "/api/integrate/mcp";
|
|
@@ -9091,7 +9146,7 @@ ${generated.source}
|
|
|
9091
9146
|
execute
|
|
9092
9147
|
};
|
|
9093
9148
|
}
|
|
9094
|
-
var CODE_MODE_TOOL_NAME = "execute_code", DEFAULT_INSTRUCTIONS,
|
|
9149
|
+
var CODE_MODE_TOOL_NAME = "execute_code", DEFAULT_INSTRUCTIONS, warnedCodeModeReasons;
|
|
9095
9150
|
var init_tool_builder = __esm(() => {
|
|
9096
9151
|
init_type_generator();
|
|
9097
9152
|
init_executor();
|
|
@@ -9116,10 +9171,6 @@ var init_tool_builder = __esm(() => {
|
|
|
9116
9171
|
"API surface:"
|
|
9117
9172
|
].join(`
|
|
9118
9173
|
`);
|
|
9119
|
-
CODE_MODE_UNAVAILABLE_MESSAGES = {
|
|
9120
|
-
"sandbox-missing": "[integrate-sdk] Code Mode unavailable (reason: sandbox-missing) — falling back to tool mode. " + "Install `@vercel/sandbox` (e.g. `bun add @vercel/sandbox`) to enable Code Mode.",
|
|
9121
|
-
"no-public-url": "[integrate-sdk] Code Mode unavailable (reason: no-public-url) — falling back to tool mode. " + "Set `codeMode.publicUrl` on your server config or the `INTEGRATE_PUBLIC_URL` env var."
|
|
9122
|
-
};
|
|
9123
9174
|
warnedCodeModeReasons = new Set;
|
|
9124
9175
|
});
|
|
9125
9176
|
|
|
@@ -11613,11 +11664,12 @@ function createMCPServer(config) {
|
|
|
11613
11664
|
return Response.json({ error: "`code` is required and must be a non-empty string." }, { status: 400 });
|
|
11614
11665
|
}
|
|
11615
11666
|
const { executeSandboxCode: executeSandboxCode2 } = await Promise.resolve().then(() => (init_executor(), exports_executor));
|
|
11667
|
+
const { resolveCodeModePublicUrl: resolveCodeModePublicUrl2 } = await Promise.resolve().then(() => (init_tool_builder(), exports_tool_builder));
|
|
11616
11668
|
const codeModeConfig = config.codeMode ?? {};
|
|
11617
|
-
const publicUrl = codeModeConfig
|
|
11669
|
+
const publicUrl = resolveCodeModePublicUrl2(codeModeConfig);
|
|
11618
11670
|
if (!publicUrl) {
|
|
11619
11671
|
return Response.json({
|
|
11620
|
-
error: "Code Mode requires `codeMode.publicUrl` in createMCPServer config (or the
|
|
11672
|
+
error: "Code Mode requires `codeMode.publicUrl` in createMCPServer config (or the INTEGRATE_URL env var). Set it to the public origin where /api/integrate/mcp is reachable."
|
|
11621
11673
|
}, { status: 500 });
|
|
11622
11674
|
}
|
|
11623
11675
|
let contextOverride = body.context;
|
package/dist/react.js
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
1
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
7
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
8
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
9
|
+
for (let key of __getOwnPropNames(mod))
|
|
10
|
+
if (!__hasOwnProp.call(to, key))
|
|
11
|
+
__defProp(to, key, {
|
|
12
|
+
get: () => mod[key],
|
|
13
|
+
enumerable: true
|
|
14
|
+
});
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
2
17
|
var __export = (target, all) => {
|
|
3
18
|
for (var name in all)
|
|
4
19
|
__defProp(target, name, {
|
|
@@ -9,6 +24,13 @@ var __export = (target, all) => {
|
|
|
9
24
|
});
|
|
10
25
|
};
|
|
11
26
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
27
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
28
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
29
|
+
}) : x)(function(x) {
|
|
30
|
+
if (typeof require !== "undefined")
|
|
31
|
+
return require.apply(this, arguments);
|
|
32
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
33
|
+
});
|
|
12
34
|
|
|
13
35
|
// src/utils/logger.ts
|
|
14
36
|
function shouldLog(level, context) {
|
package/dist/server.js
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
1
4
|
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
2
18
|
var __export = (target, all) => {
|
|
3
19
|
for (var name in all)
|
|
4
20
|
__defProp(target, name, {
|
|
@@ -9,6 +25,7 @@ var __export = (target, all) => {
|
|
|
9
25
|
});
|
|
10
26
|
};
|
|
11
27
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
28
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
12
29
|
|
|
13
30
|
// src/protocol/jsonrpc.ts
|
|
14
31
|
function parseMessage(message) {
|
|
@@ -9529,6 +9546,7 @@ export { callTool };
|
|
|
9529
9546
|
var exports_executor = {};
|
|
9530
9547
|
__export(exports_executor, {
|
|
9531
9548
|
isSandboxAvailable: () => isSandboxAvailable,
|
|
9549
|
+
getSandboxImportError: () => getSandboxImportError,
|
|
9532
9550
|
executeSandboxCode: () => executeSandboxCode,
|
|
9533
9551
|
__setSandboxUnavailableForTests: () => __setSandboxUnavailableForTests,
|
|
9534
9552
|
__setSandboxFactoryForTests: () => __setSandboxFactoryForTests
|
|
@@ -9537,10 +9555,15 @@ function __setSandboxFactoryForTests(factory) {
|
|
|
9537
9555
|
sandboxFactoryOverride = factory;
|
|
9538
9556
|
_sandboxForcedUnavailableForTests = false;
|
|
9539
9557
|
_sandboxAvailableCache = null;
|
|
9558
|
+
_sandboxImportError = null;
|
|
9540
9559
|
}
|
|
9541
9560
|
function __setSandboxUnavailableForTests(force) {
|
|
9542
9561
|
_sandboxForcedUnavailableForTests = force;
|
|
9543
9562
|
_sandboxAvailableCache = null;
|
|
9563
|
+
_sandboxImportError = force ? new Error("Sandbox forced unavailable by test seam.") : null;
|
|
9564
|
+
}
|
|
9565
|
+
function getSandboxImportError() {
|
|
9566
|
+
return _sandboxImportError;
|
|
9544
9567
|
}
|
|
9545
9568
|
async function isSandboxAvailable() {
|
|
9546
9569
|
if (_sandboxAvailableCache !== null)
|
|
@@ -9551,15 +9574,17 @@ async function isSandboxAvailable() {
|
|
|
9551
9574
|
}
|
|
9552
9575
|
if (sandboxFactoryOverride) {
|
|
9553
9576
|
_sandboxAvailableCache = true;
|
|
9577
|
+
_sandboxImportError = null;
|
|
9554
9578
|
return true;
|
|
9555
9579
|
}
|
|
9556
9580
|
try {
|
|
9557
|
-
|
|
9558
|
-
await dynamicImport("@" + "vercel/sandbox");
|
|
9581
|
+
await import("@vercel/sandbox");
|
|
9559
9582
|
_sandboxAvailableCache = true;
|
|
9583
|
+
_sandboxImportError = null;
|
|
9560
9584
|
return true;
|
|
9561
|
-
} catch {
|
|
9585
|
+
} catch (err) {
|
|
9562
9586
|
_sandboxAvailableCache = false;
|
|
9587
|
+
_sandboxImportError = err;
|
|
9563
9588
|
return false;
|
|
9564
9589
|
}
|
|
9565
9590
|
}
|
|
@@ -9567,12 +9592,12 @@ async function loadSandboxFactory() {
|
|
|
9567
9592
|
if (sandboxFactoryOverride)
|
|
9568
9593
|
return sandboxFactoryOverride;
|
|
9569
9594
|
try {
|
|
9570
|
-
const
|
|
9571
|
-
const pkg = "@" + "vercel/sandbox";
|
|
9572
|
-
const mod = await dynamicImport(pkg);
|
|
9595
|
+
const mod = await import("@vercel/sandbox");
|
|
9573
9596
|
return mod.Sandbox ?? mod.default?.Sandbox ?? mod;
|
|
9574
9597
|
} catch (err) {
|
|
9575
|
-
|
|
9598
|
+
_sandboxImportError = err;
|
|
9599
|
+
const detail = err instanceof Error ? `: ${err.message}` : "";
|
|
9600
|
+
throw new Error("Code Mode failed to load `@vercel/sandbox`" + detail + ". Ensure the package is installed and reachable at runtime. On Next.js/Vercel, confirm it is listed in `dependencies` (not only `devDependencies`) and that the route using Code Mode runs in the Node.js runtime (not Edge).");
|
|
9576
9601
|
}
|
|
9577
9602
|
}
|
|
9578
9603
|
function wrapUserCode(code) {
|
|
@@ -9692,30 +9717,58 @@ async function executeSandboxCode(options) {
|
|
|
9692
9717
|
}
|
|
9693
9718
|
}
|
|
9694
9719
|
}
|
|
9695
|
-
var sandboxFactoryOverride = null, _sandboxAvailableCache = null, _sandboxForcedUnavailableForTests = false, RESULT_SENTINEL = "__INTEGRATE_RESULT__";
|
|
9720
|
+
var sandboxFactoryOverride = null, _sandboxAvailableCache = null, _sandboxImportError = null, _sandboxForcedUnavailableForTests = false, RESULT_SENTINEL = "__INTEGRATE_RESULT__";
|
|
9696
9721
|
var init_executor = () => {};
|
|
9697
9722
|
|
|
9698
9723
|
// src/code-mode/tool-builder.ts
|
|
9724
|
+
var exports_tool_builder = {};
|
|
9725
|
+
__export(exports_tool_builder, {
|
|
9726
|
+
warnCodeModeFallback: () => warnCodeModeFallback,
|
|
9727
|
+
resolveCodeModePublicUrl: () => resolveCodeModePublicUrl,
|
|
9728
|
+
resolveCodeModeClientConfig: () => resolveCodeModeClientConfig,
|
|
9729
|
+
diagnoseCodeMode: () => diagnoseCodeMode,
|
|
9730
|
+
canUseCodeMode: () => canUseCodeMode,
|
|
9731
|
+
buildCodeModeTool: () => buildCodeModeTool,
|
|
9732
|
+
__resetCodeModeFallbackWarnings: () => __resetCodeModeFallbackWarnings,
|
|
9733
|
+
CODE_MODE_TOOL_NAME: () => CODE_MODE_TOOL_NAME
|
|
9734
|
+
});
|
|
9699
9735
|
function resolveCodeModeClientConfig(client) {
|
|
9700
9736
|
const oauthConfig = client.__oauthConfig;
|
|
9701
9737
|
return oauthConfig?.codeMode ?? {};
|
|
9702
9738
|
}
|
|
9739
|
+
function resolveCodeModePublicUrl(serverConfig = {}) {
|
|
9740
|
+
return serverConfig.publicUrl ?? getEnv("INTEGRATE_URL");
|
|
9741
|
+
}
|
|
9703
9742
|
async function diagnoseCodeMode(client) {
|
|
9704
9743
|
if (!await isSandboxAvailable()) {
|
|
9705
9744
|
return { available: false, reason: "sandbox-missing" };
|
|
9706
9745
|
}
|
|
9707
9746
|
const serverConfig = resolveCodeModeClientConfig(client);
|
|
9708
|
-
const publicUrl = serverConfig
|
|
9747
|
+
const publicUrl = resolveCodeModePublicUrl(serverConfig);
|
|
9709
9748
|
if (!publicUrl) {
|
|
9710
9749
|
return { available: false, reason: "no-public-url" };
|
|
9711
9750
|
}
|
|
9712
9751
|
return { available: true };
|
|
9713
9752
|
}
|
|
9753
|
+
async function canUseCodeMode(client) {
|
|
9754
|
+
return (await diagnoseCodeMode(client)).available;
|
|
9755
|
+
}
|
|
9756
|
+
function buildFallbackMessage(reason) {
|
|
9757
|
+
if (reason === "no-public-url") {
|
|
9758
|
+
return "[integrate-sdk] Code Mode unavailable (reason: no-public-url) — falling back to tool mode. " + "Set `codeMode.publicUrl` on your server config or the `INTEGRATE_URL` env var.";
|
|
9759
|
+
}
|
|
9760
|
+
const importError = getSandboxImportError();
|
|
9761
|
+
const detail = importError instanceof Error ? ` Underlying import error: ${importError.message}` : importError ? ` Underlying import error: ${String(importError)}` : "";
|
|
9762
|
+
return "[integrate-sdk] Code Mode unavailable (reason: sandbox-missing) — falling back to tool mode. " + "Ensure `@vercel/sandbox` is in `dependencies` and the route runs in the Node.js runtime (not Edge)." + detail;
|
|
9763
|
+
}
|
|
9764
|
+
function __resetCodeModeFallbackWarnings() {
|
|
9765
|
+
warnedCodeModeReasons.clear();
|
|
9766
|
+
}
|
|
9714
9767
|
function warnCodeModeFallback(reason) {
|
|
9715
9768
|
if (warnedCodeModeReasons.has(reason))
|
|
9716
9769
|
return;
|
|
9717
9770
|
warnedCodeModeReasons.add(reason);
|
|
9718
|
-
console.warn(
|
|
9771
|
+
console.warn(buildFallbackMessage(reason));
|
|
9719
9772
|
}
|
|
9720
9773
|
function buildCodeModeTool(client, options) {
|
|
9721
9774
|
const { tools, providerTokens, context, integrationIds } = options;
|
|
@@ -9728,7 +9781,9 @@ function buildCodeModeTool(client, options) {
|
|
|
9728
9781
|
${generated.source}
|
|
9729
9782
|
\`\`\``;
|
|
9730
9783
|
const execute = async ({ code }) => {
|
|
9731
|
-
const publicUrl =
|
|
9784
|
+
const publicUrl = resolveCodeModePublicUrl({
|
|
9785
|
+
publicUrl: sandboxOverrides.publicUrl ?? serverCodeModeConfig.publicUrl
|
|
9786
|
+
});
|
|
9732
9787
|
const apiKey = client.__oauthConfig?.apiKey;
|
|
9733
9788
|
if (!publicUrl) {
|
|
9734
9789
|
return {
|
|
@@ -9737,7 +9792,7 @@ ${generated.source}
|
|
|
9737
9792
|
stdout: "",
|
|
9738
9793
|
stderr: "",
|
|
9739
9794
|
durationMs: 0,
|
|
9740
|
-
error: "Code Mode requires `codeMode.publicUrl` in createMCPServer config (or the
|
|
9795
|
+
error: "Code Mode requires `codeMode.publicUrl` in createMCPServer config (or the INTEGRATE_URL env var). " + "The sandbox uses it to call back into /api/integrate/mcp."
|
|
9741
9796
|
};
|
|
9742
9797
|
}
|
|
9743
9798
|
const mcpUrl = publicUrl.replace(/\/$/, "") + "/api/integrate/mcp";
|
|
@@ -9771,7 +9826,7 @@ ${generated.source}
|
|
|
9771
9826
|
execute
|
|
9772
9827
|
};
|
|
9773
9828
|
}
|
|
9774
|
-
var CODE_MODE_TOOL_NAME = "execute_code", DEFAULT_INSTRUCTIONS,
|
|
9829
|
+
var CODE_MODE_TOOL_NAME = "execute_code", DEFAULT_INSTRUCTIONS, warnedCodeModeReasons;
|
|
9775
9830
|
var init_tool_builder = __esm(() => {
|
|
9776
9831
|
init_type_generator();
|
|
9777
9832
|
init_executor();
|
|
@@ -9796,10 +9851,6 @@ var init_tool_builder = __esm(() => {
|
|
|
9796
9851
|
"API surface:"
|
|
9797
9852
|
].join(`
|
|
9798
9853
|
`);
|
|
9799
|
-
CODE_MODE_UNAVAILABLE_MESSAGES = {
|
|
9800
|
-
"sandbox-missing": "[integrate-sdk] Code Mode unavailable (reason: sandbox-missing) — falling back to tool mode. " + "Install `@vercel/sandbox` (e.g. `bun add @vercel/sandbox`) to enable Code Mode.",
|
|
9801
|
-
"no-public-url": "[integrate-sdk] Code Mode unavailable (reason: no-public-url) — falling back to tool mode. " + "Set `codeMode.publicUrl` on your server config or the `INTEGRATE_PUBLIC_URL` env var."
|
|
9802
|
-
};
|
|
9803
9854
|
warnedCodeModeReasons = new Set;
|
|
9804
9855
|
});
|
|
9805
9856
|
|
|
@@ -12293,11 +12344,12 @@ function createMCPServer(config) {
|
|
|
12293
12344
|
return Response.json({ error: "`code` is required and must be a non-empty string." }, { status: 400 });
|
|
12294
12345
|
}
|
|
12295
12346
|
const { executeSandboxCode: executeSandboxCode2 } = await Promise.resolve().then(() => (init_executor(), exports_executor));
|
|
12347
|
+
const { resolveCodeModePublicUrl: resolveCodeModePublicUrl2 } = await Promise.resolve().then(() => (init_tool_builder(), exports_tool_builder));
|
|
12296
12348
|
const codeModeConfig = config.codeMode ?? {};
|
|
12297
|
-
const publicUrl = codeModeConfig
|
|
12349
|
+
const publicUrl = resolveCodeModePublicUrl2(codeModeConfig);
|
|
12298
12350
|
if (!publicUrl) {
|
|
12299
12351
|
return Response.json({
|
|
12300
|
-
error: "Code Mode requires `codeMode.publicUrl` in createMCPServer config (or the
|
|
12352
|
+
error: "Code Mode requires `codeMode.publicUrl` in createMCPServer config (or the INTEGRATE_URL env var). Set it to the public origin where /api/integrate/mcp is reachable."
|
|
12301
12353
|
}, { status: 500 });
|
|
12302
12354
|
}
|
|
12303
12355
|
let contextOverride = body.context;
|
|
@@ -45,6 +45,14 @@ interface SandboxFactory {
|
|
|
45
45
|
export declare function __setSandboxFactoryForTests(factory: SandboxFactory | null): void;
|
|
46
46
|
/** @internal — used by unit tests to simulate missing @vercel/sandbox. */
|
|
47
47
|
export declare function __setSandboxUnavailableForTests(force: boolean): void;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the most recent error observed while attempting to import
|
|
50
|
+
* `@vercel/sandbox`. Useful for surfacing the root cause when the availability
|
|
51
|
+
* check returns `false` — the warning in `tool-builder.ts` pipes this through
|
|
52
|
+
* to the user so they don't have to guess whether it's a missing package, a
|
|
53
|
+
* bundler issue, or a runtime restriction.
|
|
54
|
+
*/
|
|
55
|
+
export declare function getSandboxImportError(): unknown;
|
|
48
56
|
export declare function isSandboxAvailable(): Promise<boolean>;
|
|
49
57
|
export interface ExecuteSandboxCodeOptions {
|
|
50
58
|
/** Source code the LLM produced. Treated as an async function body. */
|