integrate-sdk 0.9.10-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 +32723 -277
- package/dist/adapters/context-cookie.js +18 -0
- package/dist/adapters/index.js +32725 -279
- package/dist/adapters/nextjs-oauth-redirect.js +18 -0
- package/dist/adapters/nextjs.js +32723 -277
- package/dist/adapters/node.js +32723 -277
- package/dist/adapters/session-detector.js +18 -0
- package/dist/adapters/solid-start.js +18 -0
- package/dist/adapters/svelte-kit.js +32723 -277
- package/dist/adapters/tanstack-start.js +32725 -279
- package/dist/ai/anthropic.js +39 -12
- package/dist/ai/google.js +39 -12
- package/dist/ai/index.js +39 -12
- package/dist/ai/openai.js +39 -12
- package/dist/ai/trigger-tools.js +17 -0
- package/dist/ai/utils.js +17 -0
- package/dist/ai/vercel-ai.js +39 -12
- 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 +43 -12
- package/dist/code-mode/runtime-stub.js +19 -0
- package/dist/code-mode/tool-builder.d.ts.map +1 -1
- package/dist/code-mode/tool-builder.js +43 -12
- package/dist/code-mode/type-generator.js +19 -0
- package/dist/index.js +48 -14
- package/dist/oauth.js +43 -14
- package/dist/react.js +22 -0
- package/dist/server.js +43 -14
- 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.map +1 -1
- package/package.json +2 -2
package/dist/ai/anthropic.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, {
|
|
@@ -8,6 +24,7 @@ var __export = (target, all) => {
|
|
|
8
24
|
set: (newValue) => all[name] = () => newValue
|
|
9
25
|
});
|
|
10
26
|
};
|
|
27
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
11
28
|
|
|
12
29
|
// ../../node_modules/zod/v3/external.js
|
|
13
30
|
var exports_external = {};
|
|
@@ -4692,7 +4709,11 @@ export { callTool };
|
|
|
4692
4709
|
// ../code-mode/executor.ts
|
|
4693
4710
|
var sandboxFactoryOverride = null;
|
|
4694
4711
|
var _sandboxAvailableCache = null;
|
|
4712
|
+
var _sandboxImportError = null;
|
|
4695
4713
|
var _sandboxForcedUnavailableForTests = false;
|
|
4714
|
+
function getSandboxImportError() {
|
|
4715
|
+
return _sandboxImportError;
|
|
4716
|
+
}
|
|
4696
4717
|
async function isSandboxAvailable() {
|
|
4697
4718
|
if (_sandboxAvailableCache !== null)
|
|
4698
4719
|
return _sandboxAvailableCache;
|
|
@@ -4702,15 +4723,17 @@ async function isSandboxAvailable() {
|
|
|
4702
4723
|
}
|
|
4703
4724
|
if (sandboxFactoryOverride) {
|
|
4704
4725
|
_sandboxAvailableCache = true;
|
|
4726
|
+
_sandboxImportError = null;
|
|
4705
4727
|
return true;
|
|
4706
4728
|
}
|
|
4707
4729
|
try {
|
|
4708
|
-
|
|
4709
|
-
await dynamicImport("@" + "vercel/sandbox");
|
|
4730
|
+
await import("@vercel/sandbox");
|
|
4710
4731
|
_sandboxAvailableCache = true;
|
|
4732
|
+
_sandboxImportError = null;
|
|
4711
4733
|
return true;
|
|
4712
|
-
} catch {
|
|
4734
|
+
} catch (err) {
|
|
4713
4735
|
_sandboxAvailableCache = false;
|
|
4736
|
+
_sandboxImportError = err;
|
|
4714
4737
|
return false;
|
|
4715
4738
|
}
|
|
4716
4739
|
}
|
|
@@ -4718,12 +4741,12 @@ async function loadSandboxFactory() {
|
|
|
4718
4741
|
if (sandboxFactoryOverride)
|
|
4719
4742
|
return sandboxFactoryOverride;
|
|
4720
4743
|
try {
|
|
4721
|
-
const
|
|
4722
|
-
const pkg = "@" + "vercel/sandbox";
|
|
4723
|
-
const mod = await dynamicImport(pkg);
|
|
4744
|
+
const mod = await import("@vercel/sandbox");
|
|
4724
4745
|
return mod.Sandbox ?? mod.default?.Sandbox ?? mod;
|
|
4725
4746
|
} catch (err) {
|
|
4726
|
-
|
|
4747
|
+
_sandboxImportError = err;
|
|
4748
|
+
const detail = err instanceof Error ? `: ${err.message}` : "";
|
|
4749
|
+
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).");
|
|
4727
4750
|
}
|
|
4728
4751
|
}
|
|
4729
4752
|
var RESULT_SENTINEL = "__INTEGRATE_RESULT__";
|
|
@@ -4907,16 +4930,20 @@ async function diagnoseCodeMode(client) {
|
|
|
4907
4930
|
}
|
|
4908
4931
|
return { available: true };
|
|
4909
4932
|
}
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
}
|
|
4933
|
+
function buildFallbackMessage(reason) {
|
|
4934
|
+
if (reason === "no-public-url") {
|
|
4935
|
+
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.";
|
|
4936
|
+
}
|
|
4937
|
+
const importError = getSandboxImportError();
|
|
4938
|
+
const detail = importError instanceof Error ? ` Underlying import error: ${importError.message}` : importError ? ` Underlying import error: ${String(importError)}` : "";
|
|
4939
|
+
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;
|
|
4940
|
+
}
|
|
4914
4941
|
var warnedCodeModeReasons = new Set;
|
|
4915
4942
|
function warnCodeModeFallback(reason) {
|
|
4916
4943
|
if (warnedCodeModeReasons.has(reason))
|
|
4917
4944
|
return;
|
|
4918
4945
|
warnedCodeModeReasons.add(reason);
|
|
4919
|
-
console.warn(
|
|
4946
|
+
console.warn(buildFallbackMessage(reason));
|
|
4920
4947
|
}
|
|
4921
4948
|
function buildCodeModeTool(client, options) {
|
|
4922
4949
|
const { tools, providerTokens, context, integrationIds } = options;
|
package/dist/ai/google.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, {
|
|
@@ -8,6 +24,7 @@ var __export = (target, all) => {
|
|
|
8
24
|
set: (newValue) => all[name] = () => newValue
|
|
9
25
|
});
|
|
10
26
|
};
|
|
27
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
11
28
|
|
|
12
29
|
// ../../node_modules/zod/v3/external.js
|
|
13
30
|
var exports_external = {};
|
|
@@ -4692,7 +4709,11 @@ export { callTool };
|
|
|
4692
4709
|
// ../code-mode/executor.ts
|
|
4693
4710
|
var sandboxFactoryOverride = null;
|
|
4694
4711
|
var _sandboxAvailableCache = null;
|
|
4712
|
+
var _sandboxImportError = null;
|
|
4695
4713
|
var _sandboxForcedUnavailableForTests = false;
|
|
4714
|
+
function getSandboxImportError() {
|
|
4715
|
+
return _sandboxImportError;
|
|
4716
|
+
}
|
|
4696
4717
|
async function isSandboxAvailable() {
|
|
4697
4718
|
if (_sandboxAvailableCache !== null)
|
|
4698
4719
|
return _sandboxAvailableCache;
|
|
@@ -4702,15 +4723,17 @@ async function isSandboxAvailable() {
|
|
|
4702
4723
|
}
|
|
4703
4724
|
if (sandboxFactoryOverride) {
|
|
4704
4725
|
_sandboxAvailableCache = true;
|
|
4726
|
+
_sandboxImportError = null;
|
|
4705
4727
|
return true;
|
|
4706
4728
|
}
|
|
4707
4729
|
try {
|
|
4708
|
-
|
|
4709
|
-
await dynamicImport("@" + "vercel/sandbox");
|
|
4730
|
+
await import("@vercel/sandbox");
|
|
4710
4731
|
_sandboxAvailableCache = true;
|
|
4732
|
+
_sandboxImportError = null;
|
|
4711
4733
|
return true;
|
|
4712
|
-
} catch {
|
|
4734
|
+
} catch (err) {
|
|
4713
4735
|
_sandboxAvailableCache = false;
|
|
4736
|
+
_sandboxImportError = err;
|
|
4714
4737
|
return false;
|
|
4715
4738
|
}
|
|
4716
4739
|
}
|
|
@@ -4718,12 +4741,12 @@ async function loadSandboxFactory() {
|
|
|
4718
4741
|
if (sandboxFactoryOverride)
|
|
4719
4742
|
return sandboxFactoryOverride;
|
|
4720
4743
|
try {
|
|
4721
|
-
const
|
|
4722
|
-
const pkg = "@" + "vercel/sandbox";
|
|
4723
|
-
const mod = await dynamicImport(pkg);
|
|
4744
|
+
const mod = await import("@vercel/sandbox");
|
|
4724
4745
|
return mod.Sandbox ?? mod.default?.Sandbox ?? mod;
|
|
4725
4746
|
} catch (err) {
|
|
4726
|
-
|
|
4747
|
+
_sandboxImportError = err;
|
|
4748
|
+
const detail = err instanceof Error ? `: ${err.message}` : "";
|
|
4749
|
+
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).");
|
|
4727
4750
|
}
|
|
4728
4751
|
}
|
|
4729
4752
|
var RESULT_SENTINEL = "__INTEGRATE_RESULT__";
|
|
@@ -4907,16 +4930,20 @@ async function diagnoseCodeMode(client) {
|
|
|
4907
4930
|
}
|
|
4908
4931
|
return { available: true };
|
|
4909
4932
|
}
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
}
|
|
4933
|
+
function buildFallbackMessage(reason) {
|
|
4934
|
+
if (reason === "no-public-url") {
|
|
4935
|
+
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.";
|
|
4936
|
+
}
|
|
4937
|
+
const importError = getSandboxImportError();
|
|
4938
|
+
const detail = importError instanceof Error ? ` Underlying import error: ${importError.message}` : importError ? ` Underlying import error: ${String(importError)}` : "";
|
|
4939
|
+
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;
|
|
4940
|
+
}
|
|
4914
4941
|
var warnedCodeModeReasons = new Set;
|
|
4915
4942
|
function warnCodeModeFallback(reason) {
|
|
4916
4943
|
if (warnedCodeModeReasons.has(reason))
|
|
4917
4944
|
return;
|
|
4918
4945
|
warnedCodeModeReasons.add(reason);
|
|
4919
|
-
console.warn(
|
|
4946
|
+
console.warn(buildFallbackMessage(reason));
|
|
4920
4947
|
}
|
|
4921
4948
|
function buildCodeModeTool(client, options) {
|
|
4922
4949
|
const { tools, providerTokens, context, integrationIds } = options;
|
package/dist/ai/index.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, {
|
|
@@ -8,6 +24,7 @@ var __export = (target, all) => {
|
|
|
8
24
|
set: (newValue) => all[name] = () => newValue
|
|
9
25
|
});
|
|
10
26
|
};
|
|
27
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
11
28
|
|
|
12
29
|
// ../../node_modules/zod/v3/external.js
|
|
13
30
|
var exports_external = {};
|
|
@@ -4692,7 +4709,11 @@ export { callTool };
|
|
|
4692
4709
|
// ../code-mode/executor.ts
|
|
4693
4710
|
var sandboxFactoryOverride = null;
|
|
4694
4711
|
var _sandboxAvailableCache = null;
|
|
4712
|
+
var _sandboxImportError = null;
|
|
4695
4713
|
var _sandboxForcedUnavailableForTests = false;
|
|
4714
|
+
function getSandboxImportError() {
|
|
4715
|
+
return _sandboxImportError;
|
|
4716
|
+
}
|
|
4696
4717
|
async function isSandboxAvailable() {
|
|
4697
4718
|
if (_sandboxAvailableCache !== null)
|
|
4698
4719
|
return _sandboxAvailableCache;
|
|
@@ -4702,15 +4723,17 @@ async function isSandboxAvailable() {
|
|
|
4702
4723
|
}
|
|
4703
4724
|
if (sandboxFactoryOverride) {
|
|
4704
4725
|
_sandboxAvailableCache = true;
|
|
4726
|
+
_sandboxImportError = null;
|
|
4705
4727
|
return true;
|
|
4706
4728
|
}
|
|
4707
4729
|
try {
|
|
4708
|
-
|
|
4709
|
-
await dynamicImport("@" + "vercel/sandbox");
|
|
4730
|
+
await import("@vercel/sandbox");
|
|
4710
4731
|
_sandboxAvailableCache = true;
|
|
4732
|
+
_sandboxImportError = null;
|
|
4711
4733
|
return true;
|
|
4712
|
-
} catch {
|
|
4734
|
+
} catch (err) {
|
|
4713
4735
|
_sandboxAvailableCache = false;
|
|
4736
|
+
_sandboxImportError = err;
|
|
4714
4737
|
return false;
|
|
4715
4738
|
}
|
|
4716
4739
|
}
|
|
@@ -4718,12 +4741,12 @@ async function loadSandboxFactory() {
|
|
|
4718
4741
|
if (sandboxFactoryOverride)
|
|
4719
4742
|
return sandboxFactoryOverride;
|
|
4720
4743
|
try {
|
|
4721
|
-
const
|
|
4722
|
-
const pkg = "@" + "vercel/sandbox";
|
|
4723
|
-
const mod = await dynamicImport(pkg);
|
|
4744
|
+
const mod = await import("@vercel/sandbox");
|
|
4724
4745
|
return mod.Sandbox ?? mod.default?.Sandbox ?? mod;
|
|
4725
4746
|
} catch (err) {
|
|
4726
|
-
|
|
4747
|
+
_sandboxImportError = err;
|
|
4748
|
+
const detail = err instanceof Error ? `: ${err.message}` : "";
|
|
4749
|
+
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).");
|
|
4727
4750
|
}
|
|
4728
4751
|
}
|
|
4729
4752
|
var RESULT_SENTINEL = "__INTEGRATE_RESULT__";
|
|
@@ -4907,16 +4930,20 @@ async function diagnoseCodeMode(client) {
|
|
|
4907
4930
|
}
|
|
4908
4931
|
return { available: true };
|
|
4909
4932
|
}
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
}
|
|
4933
|
+
function buildFallbackMessage(reason) {
|
|
4934
|
+
if (reason === "no-public-url") {
|
|
4935
|
+
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.";
|
|
4936
|
+
}
|
|
4937
|
+
const importError = getSandboxImportError();
|
|
4938
|
+
const detail = importError instanceof Error ? ` Underlying import error: ${importError.message}` : importError ? ` Underlying import error: ${String(importError)}` : "";
|
|
4939
|
+
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;
|
|
4940
|
+
}
|
|
4914
4941
|
var warnedCodeModeReasons = new Set;
|
|
4915
4942
|
function warnCodeModeFallback(reason) {
|
|
4916
4943
|
if (warnedCodeModeReasons.has(reason))
|
|
4917
4944
|
return;
|
|
4918
4945
|
warnedCodeModeReasons.add(reason);
|
|
4919
|
-
console.warn(
|
|
4946
|
+
console.warn(buildFallbackMessage(reason));
|
|
4920
4947
|
}
|
|
4921
4948
|
function buildCodeModeTool(client, options) {
|
|
4922
4949
|
const { tools, providerTokens, context, integrationIds } = options;
|
package/dist/ai/openai.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, {
|
|
@@ -8,6 +24,7 @@ var __export = (target, all) => {
|
|
|
8
24
|
set: (newValue) => all[name] = () => newValue
|
|
9
25
|
});
|
|
10
26
|
};
|
|
27
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
11
28
|
|
|
12
29
|
// ../../node_modules/zod/v3/external.js
|
|
13
30
|
var exports_external = {};
|
|
@@ -4692,7 +4709,11 @@ export { callTool };
|
|
|
4692
4709
|
// ../code-mode/executor.ts
|
|
4693
4710
|
var sandboxFactoryOverride = null;
|
|
4694
4711
|
var _sandboxAvailableCache = null;
|
|
4712
|
+
var _sandboxImportError = null;
|
|
4695
4713
|
var _sandboxForcedUnavailableForTests = false;
|
|
4714
|
+
function getSandboxImportError() {
|
|
4715
|
+
return _sandboxImportError;
|
|
4716
|
+
}
|
|
4696
4717
|
async function isSandboxAvailable() {
|
|
4697
4718
|
if (_sandboxAvailableCache !== null)
|
|
4698
4719
|
return _sandboxAvailableCache;
|
|
@@ -4702,15 +4723,17 @@ async function isSandboxAvailable() {
|
|
|
4702
4723
|
}
|
|
4703
4724
|
if (sandboxFactoryOverride) {
|
|
4704
4725
|
_sandboxAvailableCache = true;
|
|
4726
|
+
_sandboxImportError = null;
|
|
4705
4727
|
return true;
|
|
4706
4728
|
}
|
|
4707
4729
|
try {
|
|
4708
|
-
|
|
4709
|
-
await dynamicImport("@" + "vercel/sandbox");
|
|
4730
|
+
await import("@vercel/sandbox");
|
|
4710
4731
|
_sandboxAvailableCache = true;
|
|
4732
|
+
_sandboxImportError = null;
|
|
4711
4733
|
return true;
|
|
4712
|
-
} catch {
|
|
4734
|
+
} catch (err) {
|
|
4713
4735
|
_sandboxAvailableCache = false;
|
|
4736
|
+
_sandboxImportError = err;
|
|
4714
4737
|
return false;
|
|
4715
4738
|
}
|
|
4716
4739
|
}
|
|
@@ -4718,12 +4741,12 @@ async function loadSandboxFactory() {
|
|
|
4718
4741
|
if (sandboxFactoryOverride)
|
|
4719
4742
|
return sandboxFactoryOverride;
|
|
4720
4743
|
try {
|
|
4721
|
-
const
|
|
4722
|
-
const pkg = "@" + "vercel/sandbox";
|
|
4723
|
-
const mod = await dynamicImport(pkg);
|
|
4744
|
+
const mod = await import("@vercel/sandbox");
|
|
4724
4745
|
return mod.Sandbox ?? mod.default?.Sandbox ?? mod;
|
|
4725
4746
|
} catch (err) {
|
|
4726
|
-
|
|
4747
|
+
_sandboxImportError = err;
|
|
4748
|
+
const detail = err instanceof Error ? `: ${err.message}` : "";
|
|
4749
|
+
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).");
|
|
4727
4750
|
}
|
|
4728
4751
|
}
|
|
4729
4752
|
var RESULT_SENTINEL = "__INTEGRATE_RESULT__";
|
|
@@ -4907,16 +4930,20 @@ async function diagnoseCodeMode(client) {
|
|
|
4907
4930
|
}
|
|
4908
4931
|
return { available: true };
|
|
4909
4932
|
}
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
}
|
|
4933
|
+
function buildFallbackMessage(reason) {
|
|
4934
|
+
if (reason === "no-public-url") {
|
|
4935
|
+
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.";
|
|
4936
|
+
}
|
|
4937
|
+
const importError = getSandboxImportError();
|
|
4938
|
+
const detail = importError instanceof Error ? ` Underlying import error: ${importError.message}` : importError ? ` Underlying import error: ${String(importError)}` : "";
|
|
4939
|
+
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;
|
|
4940
|
+
}
|
|
4914
4941
|
var warnedCodeModeReasons = new Set;
|
|
4915
4942
|
function warnCodeModeFallback(reason) {
|
|
4916
4943
|
if (warnedCodeModeReasons.has(reason))
|
|
4917
4944
|
return;
|
|
4918
4945
|
warnedCodeModeReasons.add(reason);
|
|
4919
|
-
console.warn(
|
|
4946
|
+
console.warn(buildFallbackMessage(reason));
|
|
4920
4947
|
}
|
|
4921
4948
|
function buildCodeModeTool(client, options) {
|
|
4922
4949
|
const { tools, providerTokens, context, integrationIds } = options;
|
package/dist/ai/trigger-tools.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, {
|
|
@@ -8,6 +24,7 @@ var __export = (target, all) => {
|
|
|
8
24
|
set: (newValue) => all[name] = () => newValue
|
|
9
25
|
});
|
|
10
26
|
};
|
|
27
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
11
28
|
|
|
12
29
|
// ../../node_modules/zod/v3/external.js
|
|
13
30
|
var exports_external = {};
|
package/dist/ai/utils.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, {
|
|
@@ -8,6 +24,7 @@ var __export = (target, all) => {
|
|
|
8
24
|
set: (newValue) => all[name] = () => newValue
|
|
9
25
|
});
|
|
10
26
|
};
|
|
27
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
11
28
|
|
|
12
29
|
// ../../node_modules/zod/v3/external.js
|
|
13
30
|
var exports_external = {};
|
package/dist/ai/vercel-ai.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, {
|
|
@@ -8,6 +24,7 @@ var __export = (target, all) => {
|
|
|
8
24
|
set: (newValue) => all[name] = () => newValue
|
|
9
25
|
});
|
|
10
26
|
};
|
|
27
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
11
28
|
|
|
12
29
|
// ../../node_modules/zod/v3/external.js
|
|
13
30
|
var exports_external = {};
|
|
@@ -4692,7 +4709,11 @@ export { callTool };
|
|
|
4692
4709
|
// ../code-mode/executor.ts
|
|
4693
4710
|
var sandboxFactoryOverride = null;
|
|
4694
4711
|
var _sandboxAvailableCache = null;
|
|
4712
|
+
var _sandboxImportError = null;
|
|
4695
4713
|
var _sandboxForcedUnavailableForTests = false;
|
|
4714
|
+
function getSandboxImportError() {
|
|
4715
|
+
return _sandboxImportError;
|
|
4716
|
+
}
|
|
4696
4717
|
async function isSandboxAvailable() {
|
|
4697
4718
|
if (_sandboxAvailableCache !== null)
|
|
4698
4719
|
return _sandboxAvailableCache;
|
|
@@ -4702,15 +4723,17 @@ async function isSandboxAvailable() {
|
|
|
4702
4723
|
}
|
|
4703
4724
|
if (sandboxFactoryOverride) {
|
|
4704
4725
|
_sandboxAvailableCache = true;
|
|
4726
|
+
_sandboxImportError = null;
|
|
4705
4727
|
return true;
|
|
4706
4728
|
}
|
|
4707
4729
|
try {
|
|
4708
|
-
|
|
4709
|
-
await dynamicImport("@" + "vercel/sandbox");
|
|
4730
|
+
await import("@vercel/sandbox");
|
|
4710
4731
|
_sandboxAvailableCache = true;
|
|
4732
|
+
_sandboxImportError = null;
|
|
4711
4733
|
return true;
|
|
4712
|
-
} catch {
|
|
4734
|
+
} catch (err) {
|
|
4713
4735
|
_sandboxAvailableCache = false;
|
|
4736
|
+
_sandboxImportError = err;
|
|
4714
4737
|
return false;
|
|
4715
4738
|
}
|
|
4716
4739
|
}
|
|
@@ -4718,12 +4741,12 @@ async function loadSandboxFactory() {
|
|
|
4718
4741
|
if (sandboxFactoryOverride)
|
|
4719
4742
|
return sandboxFactoryOverride;
|
|
4720
4743
|
try {
|
|
4721
|
-
const
|
|
4722
|
-
const pkg = "@" + "vercel/sandbox";
|
|
4723
|
-
const mod = await dynamicImport(pkg);
|
|
4744
|
+
const mod = await import("@vercel/sandbox");
|
|
4724
4745
|
return mod.Sandbox ?? mod.default?.Sandbox ?? mod;
|
|
4725
4746
|
} catch (err) {
|
|
4726
|
-
|
|
4747
|
+
_sandboxImportError = err;
|
|
4748
|
+
const detail = err instanceof Error ? `: ${err.message}` : "";
|
|
4749
|
+
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).");
|
|
4727
4750
|
}
|
|
4728
4751
|
}
|
|
4729
4752
|
var RESULT_SENTINEL = "__INTEGRATE_RESULT__";
|
|
@@ -4907,16 +4930,20 @@ async function diagnoseCodeMode(client) {
|
|
|
4907
4930
|
}
|
|
4908
4931
|
return { available: true };
|
|
4909
4932
|
}
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
}
|
|
4933
|
+
function buildFallbackMessage(reason) {
|
|
4934
|
+
if (reason === "no-public-url") {
|
|
4935
|
+
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.";
|
|
4936
|
+
}
|
|
4937
|
+
const importError = getSandboxImportError();
|
|
4938
|
+
const detail = importError instanceof Error ? ` Underlying import error: ${importError.message}` : importError ? ` Underlying import error: ${String(importError)}` : "";
|
|
4939
|
+
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;
|
|
4940
|
+
}
|
|
4914
4941
|
var warnedCodeModeReasons = new Set;
|
|
4915
4942
|
function warnCodeModeFallback(reason) {
|
|
4916
4943
|
if (warnedCodeModeReasons.has(reason))
|
|
4917
4944
|
return;
|
|
4918
4945
|
warnedCodeModeReasons.add(reason);
|
|
4919
|
-
console.warn(
|
|
4946
|
+
console.warn(buildFallbackMessage(reason));
|
|
4920
4947
|
}
|
|
4921
4948
|
function buildCodeModeTool(client, options) {
|
|
4922
4949
|
const { tools, providerTokens, context, integrationIds } = options;
|
|
@@ -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. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/code-mode/executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD;;;;GAIG;AACH,UAAU,WAAW;IACnB,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3E,UAAU,CACR,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,GACA,OAAO,CAAC;QACT,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;QAC1B,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;KAC3B,CAAC,CAAC;IACH,IAAI,IAAI,OAAO,CAAC,OAA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