integrate-sdk 0.9.27-dev.0 → 0.9.27-dev.1
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/index.js +32 -0
- package/dist/adapters/solid-start.js +32 -0
- package/dist/adapters/svelte-kit.js +32 -0
- package/dist/ai/anthropic.js +27 -1
- package/dist/ai/google.js +27 -1
- package/dist/ai/index.js +27 -1
- package/dist/ai/openai.js +27 -1
- package/dist/ai/vercel-ai.js +27 -1
- package/dist/code-mode/executor.js +27 -1
- package/dist/code-mode/index.js +27 -1
- package/dist/code-mode/runtime-stub.d.ts +1 -1
- package/dist/code-mode/runtime-stub.d.ts.map +1 -1
- package/dist/code-mode/runtime-stub.js +27 -1
- package/dist/code-mode/tool-builder.js +27 -1
- package/dist/index.js +32 -0
- package/dist/server.js +59 -1
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/code-mode/runtime-stub.d.ts +1 -1
- package/dist/src/code-mode/runtime-stub.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/adapters/index.js
CHANGED
|
@@ -2737,6 +2737,34 @@ class OAuthManager {
|
|
|
2737
2737
|
|
|
2738
2738
|
// ../client.ts
|
|
2739
2739
|
var CLIENT_LOG_CONTEXT = "client";
|
|
2740
|
+
var NON_TOOL_PROXY_PROPERTIES = new Set([
|
|
2741
|
+
"then",
|
|
2742
|
+
"catch",
|
|
2743
|
+
"finally",
|
|
2744
|
+
"constructor",
|
|
2745
|
+
"prototype",
|
|
2746
|
+
"toString",
|
|
2747
|
+
"valueOf",
|
|
2748
|
+
"toJSON",
|
|
2749
|
+
"inspect",
|
|
2750
|
+
"hasOwnProperty",
|
|
2751
|
+
"isPrototypeOf",
|
|
2752
|
+
"propertyIsEnumerable",
|
|
2753
|
+
"__proto__",
|
|
2754
|
+
"__defineGetter__",
|
|
2755
|
+
"__defineSetter__",
|
|
2756
|
+
"__lookupGetter__",
|
|
2757
|
+
"__lookupSetter__",
|
|
2758
|
+
"__esModule",
|
|
2759
|
+
Symbol.toStringTag,
|
|
2760
|
+
Symbol.toPrimitive,
|
|
2761
|
+
Symbol.iterator,
|
|
2762
|
+
Symbol.asyncIterator,
|
|
2763
|
+
Symbol.for("nodejs.util.inspect.custom")
|
|
2764
|
+
]);
|
|
2765
|
+
function isToolProxyProperty(property) {
|
|
2766
|
+
return typeof property === "string" && !NON_TOOL_PROXY_PROPERTIES.has(property);
|
|
2767
|
+
}
|
|
2740
2768
|
|
|
2741
2769
|
class SimpleEventEmitter {
|
|
2742
2770
|
handlers = new Map;
|
|
@@ -2959,6 +2987,8 @@ class MCPClientBase {
|
|
|
2959
2987
|
}
|
|
2960
2988
|
return new Proxy({}, {
|
|
2961
2989
|
get: (_target, methodName) => {
|
|
2990
|
+
if (!isToolProxyProperty(methodName))
|
|
2991
|
+
return;
|
|
2962
2992
|
return async (args, options) => {
|
|
2963
2993
|
const toolName = methodToToolName(methodName, integrationId);
|
|
2964
2994
|
return await this.callToolWithRetry(toolName, args, 0, options);
|
|
@@ -2972,6 +3002,8 @@ class MCPClientBase {
|
|
|
2972
3002
|
createServerProxy() {
|
|
2973
3003
|
return new Proxy({}, {
|
|
2974
3004
|
get: (_target, methodName) => {
|
|
3005
|
+
if (!isToolProxyProperty(methodName))
|
|
3006
|
+
return;
|
|
2975
3007
|
if (methodName === "listConfiguredIntegrations") {
|
|
2976
3008
|
return async (options) => {
|
|
2977
3009
|
const transportHeaders = this.transport.headers || {};
|
|
@@ -2737,6 +2737,34 @@ class OAuthManager {
|
|
|
2737
2737
|
|
|
2738
2738
|
// ../client.ts
|
|
2739
2739
|
var CLIENT_LOG_CONTEXT = "client";
|
|
2740
|
+
var NON_TOOL_PROXY_PROPERTIES = new Set([
|
|
2741
|
+
"then",
|
|
2742
|
+
"catch",
|
|
2743
|
+
"finally",
|
|
2744
|
+
"constructor",
|
|
2745
|
+
"prototype",
|
|
2746
|
+
"toString",
|
|
2747
|
+
"valueOf",
|
|
2748
|
+
"toJSON",
|
|
2749
|
+
"inspect",
|
|
2750
|
+
"hasOwnProperty",
|
|
2751
|
+
"isPrototypeOf",
|
|
2752
|
+
"propertyIsEnumerable",
|
|
2753
|
+
"__proto__",
|
|
2754
|
+
"__defineGetter__",
|
|
2755
|
+
"__defineSetter__",
|
|
2756
|
+
"__lookupGetter__",
|
|
2757
|
+
"__lookupSetter__",
|
|
2758
|
+
"__esModule",
|
|
2759
|
+
Symbol.toStringTag,
|
|
2760
|
+
Symbol.toPrimitive,
|
|
2761
|
+
Symbol.iterator,
|
|
2762
|
+
Symbol.asyncIterator,
|
|
2763
|
+
Symbol.for("nodejs.util.inspect.custom")
|
|
2764
|
+
]);
|
|
2765
|
+
function isToolProxyProperty(property) {
|
|
2766
|
+
return typeof property === "string" && !NON_TOOL_PROXY_PROPERTIES.has(property);
|
|
2767
|
+
}
|
|
2740
2768
|
|
|
2741
2769
|
class SimpleEventEmitter {
|
|
2742
2770
|
handlers = new Map;
|
|
@@ -2959,6 +2987,8 @@ class MCPClientBase {
|
|
|
2959
2987
|
}
|
|
2960
2988
|
return new Proxy({}, {
|
|
2961
2989
|
get: (_target, methodName) => {
|
|
2990
|
+
if (!isToolProxyProperty(methodName))
|
|
2991
|
+
return;
|
|
2962
2992
|
return async (args, options) => {
|
|
2963
2993
|
const toolName = methodToToolName(methodName, integrationId);
|
|
2964
2994
|
return await this.callToolWithRetry(toolName, args, 0, options);
|
|
@@ -2972,6 +3002,8 @@ class MCPClientBase {
|
|
|
2972
3002
|
createServerProxy() {
|
|
2973
3003
|
return new Proxy({}, {
|
|
2974
3004
|
get: (_target, methodName) => {
|
|
3005
|
+
if (!isToolProxyProperty(methodName))
|
|
3006
|
+
return;
|
|
2975
3007
|
if (methodName === "listConfiguredIntegrations") {
|
|
2976
3008
|
return async (options) => {
|
|
2977
3009
|
const transportHeaders = this.transport.headers || {};
|
|
@@ -2737,6 +2737,34 @@ class OAuthManager {
|
|
|
2737
2737
|
|
|
2738
2738
|
// ../client.ts
|
|
2739
2739
|
var CLIENT_LOG_CONTEXT = "client";
|
|
2740
|
+
var NON_TOOL_PROXY_PROPERTIES = new Set([
|
|
2741
|
+
"then",
|
|
2742
|
+
"catch",
|
|
2743
|
+
"finally",
|
|
2744
|
+
"constructor",
|
|
2745
|
+
"prototype",
|
|
2746
|
+
"toString",
|
|
2747
|
+
"valueOf",
|
|
2748
|
+
"toJSON",
|
|
2749
|
+
"inspect",
|
|
2750
|
+
"hasOwnProperty",
|
|
2751
|
+
"isPrototypeOf",
|
|
2752
|
+
"propertyIsEnumerable",
|
|
2753
|
+
"__proto__",
|
|
2754
|
+
"__defineGetter__",
|
|
2755
|
+
"__defineSetter__",
|
|
2756
|
+
"__lookupGetter__",
|
|
2757
|
+
"__lookupSetter__",
|
|
2758
|
+
"__esModule",
|
|
2759
|
+
Symbol.toStringTag,
|
|
2760
|
+
Symbol.toPrimitive,
|
|
2761
|
+
Symbol.iterator,
|
|
2762
|
+
Symbol.asyncIterator,
|
|
2763
|
+
Symbol.for("nodejs.util.inspect.custom")
|
|
2764
|
+
]);
|
|
2765
|
+
function isToolProxyProperty(property) {
|
|
2766
|
+
return typeof property === "string" && !NON_TOOL_PROXY_PROPERTIES.has(property);
|
|
2767
|
+
}
|
|
2740
2768
|
|
|
2741
2769
|
class SimpleEventEmitter {
|
|
2742
2770
|
handlers = new Map;
|
|
@@ -2959,6 +2987,8 @@ class MCPClientBase {
|
|
|
2959
2987
|
}
|
|
2960
2988
|
return new Proxy({}, {
|
|
2961
2989
|
get: (_target, methodName) => {
|
|
2990
|
+
if (!isToolProxyProperty(methodName))
|
|
2991
|
+
return;
|
|
2962
2992
|
return async (args, options) => {
|
|
2963
2993
|
const toolName = methodToToolName(methodName, integrationId);
|
|
2964
2994
|
return await this.callToolWithRetry(toolName, args, 0, options);
|
|
@@ -2972,6 +3002,8 @@ class MCPClientBase {
|
|
|
2972
3002
|
createServerProxy() {
|
|
2973
3003
|
return new Proxy({}, {
|
|
2974
3004
|
get: (_target, methodName) => {
|
|
3005
|
+
if (!isToolProxyProperty(methodName))
|
|
3006
|
+
return;
|
|
2975
3007
|
if (methodName === "listConfiguredIntegrations") {
|
|
2976
3008
|
return async (options) => {
|
|
2977
3009
|
const transportHeaders = this.transport.headers || {};
|
package/dist/ai/anthropic.js
CHANGED
|
@@ -4681,6 +4681,32 @@ function camelToSnake(str) {
|
|
|
4681
4681
|
return str.replace(/[A-Z]/g, (letter) => '_' + letter.toLowerCase());
|
|
4682
4682
|
}
|
|
4683
4683
|
|
|
4684
|
+
const NON_TOOL_PROPERTIES = new Set([
|
|
4685
|
+
// Promise assimilation and object inspection should not become MCP calls.
|
|
4686
|
+
'then',
|
|
4687
|
+
'catch',
|
|
4688
|
+
'finally',
|
|
4689
|
+
'constructor',
|
|
4690
|
+
'prototype',
|
|
4691
|
+
'toString',
|
|
4692
|
+
'valueOf',
|
|
4693
|
+
'toJSON',
|
|
4694
|
+
'inspect',
|
|
4695
|
+
'hasOwnProperty',
|
|
4696
|
+
'isPrototypeOf',
|
|
4697
|
+
'propertyIsEnumerable',
|
|
4698
|
+
'__proto__',
|
|
4699
|
+
'__defineGetter__',
|
|
4700
|
+
'__defineSetter__',
|
|
4701
|
+
'__lookupGetter__',
|
|
4702
|
+
'__lookupSetter__',
|
|
4703
|
+
'__esModule',
|
|
4704
|
+
]);
|
|
4705
|
+
|
|
4706
|
+
function isToolProperty(property) {
|
|
4707
|
+
return typeof property === 'string' && !NON_TOOL_PROPERTIES.has(property);
|
|
4708
|
+
}
|
|
4709
|
+
|
|
4684
4710
|
async function callTool(toolName, args) {
|
|
4685
4711
|
const headers = {
|
|
4686
4712
|
'Content-Type': 'application/json',
|
|
@@ -4728,7 +4754,7 @@ async function callTool(toolName, args) {
|
|
|
4728
4754
|
function createIntegrationProxy(integrationId) {
|
|
4729
4755
|
return new Proxy({}, {
|
|
4730
4756
|
get(_target, methodName) {
|
|
4731
|
-
if (
|
|
4757
|
+
if (!isToolProperty(methodName)) return undefined;
|
|
4732
4758
|
return (args) => {
|
|
4733
4759
|
const alreadyFull = methodName.startsWith(integrationId + '_') || methodName.startsWith('___');
|
|
4734
4760
|
const toolName = alreadyFull ? methodName : integrationId + '_' + camelToSnake(methodName);
|
package/dist/ai/google.js
CHANGED
|
@@ -4681,6 +4681,32 @@ function camelToSnake(str) {
|
|
|
4681
4681
|
return str.replace(/[A-Z]/g, (letter) => '_' + letter.toLowerCase());
|
|
4682
4682
|
}
|
|
4683
4683
|
|
|
4684
|
+
const NON_TOOL_PROPERTIES = new Set([
|
|
4685
|
+
// Promise assimilation and object inspection should not become MCP calls.
|
|
4686
|
+
'then',
|
|
4687
|
+
'catch',
|
|
4688
|
+
'finally',
|
|
4689
|
+
'constructor',
|
|
4690
|
+
'prototype',
|
|
4691
|
+
'toString',
|
|
4692
|
+
'valueOf',
|
|
4693
|
+
'toJSON',
|
|
4694
|
+
'inspect',
|
|
4695
|
+
'hasOwnProperty',
|
|
4696
|
+
'isPrototypeOf',
|
|
4697
|
+
'propertyIsEnumerable',
|
|
4698
|
+
'__proto__',
|
|
4699
|
+
'__defineGetter__',
|
|
4700
|
+
'__defineSetter__',
|
|
4701
|
+
'__lookupGetter__',
|
|
4702
|
+
'__lookupSetter__',
|
|
4703
|
+
'__esModule',
|
|
4704
|
+
]);
|
|
4705
|
+
|
|
4706
|
+
function isToolProperty(property) {
|
|
4707
|
+
return typeof property === 'string' && !NON_TOOL_PROPERTIES.has(property);
|
|
4708
|
+
}
|
|
4709
|
+
|
|
4684
4710
|
async function callTool(toolName, args) {
|
|
4685
4711
|
const headers = {
|
|
4686
4712
|
'Content-Type': 'application/json',
|
|
@@ -4728,7 +4754,7 @@ async function callTool(toolName, args) {
|
|
|
4728
4754
|
function createIntegrationProxy(integrationId) {
|
|
4729
4755
|
return new Proxy({}, {
|
|
4730
4756
|
get(_target, methodName) {
|
|
4731
|
-
if (
|
|
4757
|
+
if (!isToolProperty(methodName)) return undefined;
|
|
4732
4758
|
return (args) => {
|
|
4733
4759
|
const alreadyFull = methodName.startsWith(integrationId + '_') || methodName.startsWith('___');
|
|
4734
4760
|
const toolName = alreadyFull ? methodName : integrationId + '_' + camelToSnake(methodName);
|
package/dist/ai/index.js
CHANGED
|
@@ -4681,6 +4681,32 @@ function camelToSnake(str) {
|
|
|
4681
4681
|
return str.replace(/[A-Z]/g, (letter) => '_' + letter.toLowerCase());
|
|
4682
4682
|
}
|
|
4683
4683
|
|
|
4684
|
+
const NON_TOOL_PROPERTIES = new Set([
|
|
4685
|
+
// Promise assimilation and object inspection should not become MCP calls.
|
|
4686
|
+
'then',
|
|
4687
|
+
'catch',
|
|
4688
|
+
'finally',
|
|
4689
|
+
'constructor',
|
|
4690
|
+
'prototype',
|
|
4691
|
+
'toString',
|
|
4692
|
+
'valueOf',
|
|
4693
|
+
'toJSON',
|
|
4694
|
+
'inspect',
|
|
4695
|
+
'hasOwnProperty',
|
|
4696
|
+
'isPrototypeOf',
|
|
4697
|
+
'propertyIsEnumerable',
|
|
4698
|
+
'__proto__',
|
|
4699
|
+
'__defineGetter__',
|
|
4700
|
+
'__defineSetter__',
|
|
4701
|
+
'__lookupGetter__',
|
|
4702
|
+
'__lookupSetter__',
|
|
4703
|
+
'__esModule',
|
|
4704
|
+
]);
|
|
4705
|
+
|
|
4706
|
+
function isToolProperty(property) {
|
|
4707
|
+
return typeof property === 'string' && !NON_TOOL_PROPERTIES.has(property);
|
|
4708
|
+
}
|
|
4709
|
+
|
|
4684
4710
|
async function callTool(toolName, args) {
|
|
4685
4711
|
const headers = {
|
|
4686
4712
|
'Content-Type': 'application/json',
|
|
@@ -4728,7 +4754,7 @@ async function callTool(toolName, args) {
|
|
|
4728
4754
|
function createIntegrationProxy(integrationId) {
|
|
4729
4755
|
return new Proxy({}, {
|
|
4730
4756
|
get(_target, methodName) {
|
|
4731
|
-
if (
|
|
4757
|
+
if (!isToolProperty(methodName)) return undefined;
|
|
4732
4758
|
return (args) => {
|
|
4733
4759
|
const alreadyFull = methodName.startsWith(integrationId + '_') || methodName.startsWith('___');
|
|
4734
4760
|
const toolName = alreadyFull ? methodName : integrationId + '_' + camelToSnake(methodName);
|
package/dist/ai/openai.js
CHANGED
|
@@ -4681,6 +4681,32 @@ function camelToSnake(str) {
|
|
|
4681
4681
|
return str.replace(/[A-Z]/g, (letter) => '_' + letter.toLowerCase());
|
|
4682
4682
|
}
|
|
4683
4683
|
|
|
4684
|
+
const NON_TOOL_PROPERTIES = new Set([
|
|
4685
|
+
// Promise assimilation and object inspection should not become MCP calls.
|
|
4686
|
+
'then',
|
|
4687
|
+
'catch',
|
|
4688
|
+
'finally',
|
|
4689
|
+
'constructor',
|
|
4690
|
+
'prototype',
|
|
4691
|
+
'toString',
|
|
4692
|
+
'valueOf',
|
|
4693
|
+
'toJSON',
|
|
4694
|
+
'inspect',
|
|
4695
|
+
'hasOwnProperty',
|
|
4696
|
+
'isPrototypeOf',
|
|
4697
|
+
'propertyIsEnumerable',
|
|
4698
|
+
'__proto__',
|
|
4699
|
+
'__defineGetter__',
|
|
4700
|
+
'__defineSetter__',
|
|
4701
|
+
'__lookupGetter__',
|
|
4702
|
+
'__lookupSetter__',
|
|
4703
|
+
'__esModule',
|
|
4704
|
+
]);
|
|
4705
|
+
|
|
4706
|
+
function isToolProperty(property) {
|
|
4707
|
+
return typeof property === 'string' && !NON_TOOL_PROPERTIES.has(property);
|
|
4708
|
+
}
|
|
4709
|
+
|
|
4684
4710
|
async function callTool(toolName, args) {
|
|
4685
4711
|
const headers = {
|
|
4686
4712
|
'Content-Type': 'application/json',
|
|
@@ -4728,7 +4754,7 @@ async function callTool(toolName, args) {
|
|
|
4728
4754
|
function createIntegrationProxy(integrationId) {
|
|
4729
4755
|
return new Proxy({}, {
|
|
4730
4756
|
get(_target, methodName) {
|
|
4731
|
-
if (
|
|
4757
|
+
if (!isToolProperty(methodName)) return undefined;
|
|
4732
4758
|
return (args) => {
|
|
4733
4759
|
const alreadyFull = methodName.startsWith(integrationId + '_') || methodName.startsWith('___');
|
|
4734
4760
|
const toolName = alreadyFull ? methodName : integrationId + '_' + camelToSnake(methodName);
|
package/dist/ai/vercel-ai.js
CHANGED
|
@@ -4681,6 +4681,32 @@ function camelToSnake(str) {
|
|
|
4681
4681
|
return str.replace(/[A-Z]/g, (letter) => '_' + letter.toLowerCase());
|
|
4682
4682
|
}
|
|
4683
4683
|
|
|
4684
|
+
const NON_TOOL_PROPERTIES = new Set([
|
|
4685
|
+
// Promise assimilation and object inspection should not become MCP calls.
|
|
4686
|
+
'then',
|
|
4687
|
+
'catch',
|
|
4688
|
+
'finally',
|
|
4689
|
+
'constructor',
|
|
4690
|
+
'prototype',
|
|
4691
|
+
'toString',
|
|
4692
|
+
'valueOf',
|
|
4693
|
+
'toJSON',
|
|
4694
|
+
'inspect',
|
|
4695
|
+
'hasOwnProperty',
|
|
4696
|
+
'isPrototypeOf',
|
|
4697
|
+
'propertyIsEnumerable',
|
|
4698
|
+
'__proto__',
|
|
4699
|
+
'__defineGetter__',
|
|
4700
|
+
'__defineSetter__',
|
|
4701
|
+
'__lookupGetter__',
|
|
4702
|
+
'__lookupSetter__',
|
|
4703
|
+
'__esModule',
|
|
4704
|
+
]);
|
|
4705
|
+
|
|
4706
|
+
function isToolProperty(property) {
|
|
4707
|
+
return typeof property === 'string' && !NON_TOOL_PROPERTIES.has(property);
|
|
4708
|
+
}
|
|
4709
|
+
|
|
4684
4710
|
async function callTool(toolName, args) {
|
|
4685
4711
|
const headers = {
|
|
4686
4712
|
'Content-Type': 'application/json',
|
|
@@ -4728,7 +4754,7 @@ async function callTool(toolName, args) {
|
|
|
4728
4754
|
function createIntegrationProxy(integrationId) {
|
|
4729
4755
|
return new Proxy({}, {
|
|
4730
4756
|
get(_target, methodName) {
|
|
4731
|
-
if (
|
|
4757
|
+
if (!isToolProperty(methodName)) return undefined;
|
|
4732
4758
|
return (args) => {
|
|
4733
4759
|
const alreadyFull = methodName.startsWith(integrationId + '_') || methodName.startsWith('___');
|
|
4734
4760
|
const toolName = alreadyFull ? methodName : integrationId + '_' + camelToSnake(methodName);
|
|
@@ -34,6 +34,32 @@ function camelToSnake(str) {
|
|
|
34
34
|
return str.replace(/[A-Z]/g, (letter) => '_' + letter.toLowerCase());
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
const NON_TOOL_PROPERTIES = new Set([
|
|
38
|
+
// Promise assimilation and object inspection should not become MCP calls.
|
|
39
|
+
'then',
|
|
40
|
+
'catch',
|
|
41
|
+
'finally',
|
|
42
|
+
'constructor',
|
|
43
|
+
'prototype',
|
|
44
|
+
'toString',
|
|
45
|
+
'valueOf',
|
|
46
|
+
'toJSON',
|
|
47
|
+
'inspect',
|
|
48
|
+
'hasOwnProperty',
|
|
49
|
+
'isPrototypeOf',
|
|
50
|
+
'propertyIsEnumerable',
|
|
51
|
+
'__proto__',
|
|
52
|
+
'__defineGetter__',
|
|
53
|
+
'__defineSetter__',
|
|
54
|
+
'__lookupGetter__',
|
|
55
|
+
'__lookupSetter__',
|
|
56
|
+
'__esModule',
|
|
57
|
+
]);
|
|
58
|
+
|
|
59
|
+
function isToolProperty(property) {
|
|
60
|
+
return typeof property === 'string' && !NON_TOOL_PROPERTIES.has(property);
|
|
61
|
+
}
|
|
62
|
+
|
|
37
63
|
async function callTool(toolName, args) {
|
|
38
64
|
const headers = {
|
|
39
65
|
'Content-Type': 'application/json',
|
|
@@ -81,7 +107,7 @@ async function callTool(toolName, args) {
|
|
|
81
107
|
function createIntegrationProxy(integrationId) {
|
|
82
108
|
return new Proxy({}, {
|
|
83
109
|
get(_target, methodName) {
|
|
84
|
-
if (
|
|
110
|
+
if (!isToolProperty(methodName)) return undefined;
|
|
85
111
|
return (args) => {
|
|
86
112
|
const alreadyFull = methodName.startsWith(integrationId + '_') || methodName.startsWith('___');
|
|
87
113
|
const toolName = alreadyFull ? methodName : integrationId + '_' + camelToSnake(methodName);
|
package/dist/code-mode/index.js
CHANGED
|
@@ -279,6 +279,32 @@ function camelToSnake(str) {
|
|
|
279
279
|
return str.replace(/[A-Z]/g, (letter) => '_' + letter.toLowerCase());
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
+
const NON_TOOL_PROPERTIES = new Set([
|
|
283
|
+
// Promise assimilation and object inspection should not become MCP calls.
|
|
284
|
+
'then',
|
|
285
|
+
'catch',
|
|
286
|
+
'finally',
|
|
287
|
+
'constructor',
|
|
288
|
+
'prototype',
|
|
289
|
+
'toString',
|
|
290
|
+
'valueOf',
|
|
291
|
+
'toJSON',
|
|
292
|
+
'inspect',
|
|
293
|
+
'hasOwnProperty',
|
|
294
|
+
'isPrototypeOf',
|
|
295
|
+
'propertyIsEnumerable',
|
|
296
|
+
'__proto__',
|
|
297
|
+
'__defineGetter__',
|
|
298
|
+
'__defineSetter__',
|
|
299
|
+
'__lookupGetter__',
|
|
300
|
+
'__lookupSetter__',
|
|
301
|
+
'__esModule',
|
|
302
|
+
]);
|
|
303
|
+
|
|
304
|
+
function isToolProperty(property) {
|
|
305
|
+
return typeof property === 'string' && !NON_TOOL_PROPERTIES.has(property);
|
|
306
|
+
}
|
|
307
|
+
|
|
282
308
|
async function callTool(toolName, args) {
|
|
283
309
|
const headers = {
|
|
284
310
|
'Content-Type': 'application/json',
|
|
@@ -326,7 +352,7 @@ async function callTool(toolName, args) {
|
|
|
326
352
|
function createIntegrationProxy(integrationId) {
|
|
327
353
|
return new Proxy({}, {
|
|
328
354
|
get(_target, methodName) {
|
|
329
|
-
if (
|
|
355
|
+
if (!isToolProperty(methodName)) return undefined;
|
|
330
356
|
return (args) => {
|
|
331
357
|
const alreadyFull = methodName.startsWith(integrationId + '_') || methodName.startsWith('___');
|
|
332
358
|
const toolName = alreadyFull ? methodName : integrationId + '_' + camelToSnake(methodName);
|
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
* dependencies. It is NOT imported by the host SDK — it only ships as a
|
|
13
13
|
* literal payload to the sandbox.
|
|
14
14
|
*/
|
|
15
|
-
export declare const RUNTIME_STUB_SOURCE = "// runtime.mjs \u2014 generated by integrate-sdk code mode\nconst MCP_URL = process.env.INTEGRATE_MCP_URL;\nconst SESSION_TOKEN = process.env.INTEGRATE_SESSION_TOKEN;\nconst API_KEY = process.env.INTEGRATE_API_KEY || '';\nconst PROVIDER_TOKENS = process.env.INTEGRATE_PROVIDER_TOKENS || '';\nconst INTEGRATIONS_HEADER = process.env.INTEGRATE_INTEGRATIONS || '';\nconst CONTEXT_JSON = process.env.INTEGRATE_CONTEXT || '';\n\nif (!MCP_URL) {\n throw new Error('INTEGRATE_MCP_URL is not set \u2014 the sandbox cannot reach the MCP route.');\n}\n\nfunction camelToSnake(str) {\n return str.replace(/[A-Z]/g, (letter) => '_' + letter.toLowerCase());\n}\n\nasync function callTool(toolName, args) {\n const headers = {\n 'Content-Type': 'application/json',\n 'x-integrate-code-mode': '1',\n };\n if (SESSION_TOKEN) headers['Authorization'] = 'Bearer ' + SESSION_TOKEN;\n if (API_KEY) headers['x-integrate-api-key'] = API_KEY;\n if (PROVIDER_TOKENS) headers['x-integrate-tokens'] = PROVIDER_TOKENS;\n if (INTEGRATIONS_HEADER) headers['x-integrations'] = INTEGRATIONS_HEADER;\n if (CONTEXT_JSON) headers['x-integrate-context'] = CONTEXT_JSON;\n\n const res = await fetch(MCP_URL, {\n method: 'POST',\n headers,\n body: JSON.stringify({ name: toolName, arguments: args || {} }),\n });\n\n const text = await res.text();\n\n let payload;\n try {\n payload = text ? JSON.parse(text) : null;\n } catch {\n payload = { content: [{ type: 'text', text }] };\n }\n\n if (!res.ok) {\n let message = (payload && (payload.error || payload.message)) || 'Tool call failed: HTTP ' + res.status;\n if ((res.status === 401 || res.status === 403) && typeof text === 'string' && text.indexOf('Authorization header') !== -1) {\n message =\n 'Code Mode callback was rejected by the MCP server (HTTP ' + res.status + '). ' +\n 'The SDK route could not synthesize an Authorization header. Check the host-side ' +\n 'createMCPServer config (apiKey, getProviderToken) or pass providerTokens to the ' +\n 'AI helper. Original upstream message: ' + text;\n }\n const err = new Error(message);\n err.status = res.status;\n err.toolName = toolName;\n throw err;\n }\n\n return payload;\n}\n\nfunction createIntegrationProxy(integrationId) {\n return new Proxy({}, {\n get(_target, methodName) {\n if (
|
|
15
|
+
export declare const RUNTIME_STUB_SOURCE = "// runtime.mjs \u2014 generated by integrate-sdk code mode\nconst MCP_URL = process.env.INTEGRATE_MCP_URL;\nconst SESSION_TOKEN = process.env.INTEGRATE_SESSION_TOKEN;\nconst API_KEY = process.env.INTEGRATE_API_KEY || '';\nconst PROVIDER_TOKENS = process.env.INTEGRATE_PROVIDER_TOKENS || '';\nconst INTEGRATIONS_HEADER = process.env.INTEGRATE_INTEGRATIONS || '';\nconst CONTEXT_JSON = process.env.INTEGRATE_CONTEXT || '';\n\nif (!MCP_URL) {\n throw new Error('INTEGRATE_MCP_URL is not set \u2014 the sandbox cannot reach the MCP route.');\n}\n\nfunction camelToSnake(str) {\n return str.replace(/[A-Z]/g, (letter) => '_' + letter.toLowerCase());\n}\n\nconst NON_TOOL_PROPERTIES = new Set([\n // Promise assimilation and object inspection should not become MCP calls.\n 'then',\n 'catch',\n 'finally',\n 'constructor',\n 'prototype',\n 'toString',\n 'valueOf',\n 'toJSON',\n 'inspect',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n '__proto__',\n '__defineGetter__',\n '__defineSetter__',\n '__lookupGetter__',\n '__lookupSetter__',\n '__esModule',\n]);\n\nfunction isToolProperty(property) {\n return typeof property === 'string' && !NON_TOOL_PROPERTIES.has(property);\n}\n\nasync function callTool(toolName, args) {\n const headers = {\n 'Content-Type': 'application/json',\n 'x-integrate-code-mode': '1',\n };\n if (SESSION_TOKEN) headers['Authorization'] = 'Bearer ' + SESSION_TOKEN;\n if (API_KEY) headers['x-integrate-api-key'] = API_KEY;\n if (PROVIDER_TOKENS) headers['x-integrate-tokens'] = PROVIDER_TOKENS;\n if (INTEGRATIONS_HEADER) headers['x-integrations'] = INTEGRATIONS_HEADER;\n if (CONTEXT_JSON) headers['x-integrate-context'] = CONTEXT_JSON;\n\n const res = await fetch(MCP_URL, {\n method: 'POST',\n headers,\n body: JSON.stringify({ name: toolName, arguments: args || {} }),\n });\n\n const text = await res.text();\n\n let payload;\n try {\n payload = text ? JSON.parse(text) : null;\n } catch {\n payload = { content: [{ type: 'text', text }] };\n }\n\n if (!res.ok) {\n let message = (payload && (payload.error || payload.message)) || 'Tool call failed: HTTP ' + res.status;\n if ((res.status === 401 || res.status === 403) && typeof text === 'string' && text.indexOf('Authorization header') !== -1) {\n message =\n 'Code Mode callback was rejected by the MCP server (HTTP ' + res.status + '). ' +\n 'The SDK route could not synthesize an Authorization header. Check the host-side ' +\n 'createMCPServer config (apiKey, getProviderToken) or pass providerTokens to the ' +\n 'AI helper. Original upstream message: ' + text;\n }\n const err = new Error(message);\n err.status = res.status;\n err.toolName = toolName;\n throw err;\n }\n\n return payload;\n}\n\nfunction createIntegrationProxy(integrationId) {\n return new Proxy({}, {\n get(_target, methodName) {\n if (!isToolProperty(methodName)) return undefined;\n return (args) => {\n const alreadyFull = methodName.startsWith(integrationId + '_') || methodName.startsWith('___');\n const toolName = alreadyFull ? methodName : integrationId + '_' + camelToSnake(methodName);\n return callTool(toolName, args);\n };\n },\n });\n}\n\nexport const client = new Proxy({}, {\n get(_target, integrationId) {\n if (typeof integrationId !== 'string') return undefined;\n return createIntegrationProxy(integrationId);\n },\n});\n\nexport { callTool };\n";
|
|
16
16
|
//# sourceMappingURL=runtime-stub.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-stub.d.ts","sourceRoot":"","sources":["../../../src/code-mode/runtime-stub.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"runtime-stub.d.ts","sourceRoot":"","sources":["../../../src/code-mode/runtime-stub.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,mBAAmB,q7GA2G/B,CAAC"}
|
|
@@ -34,6 +34,32 @@ function camelToSnake(str) {
|
|
|
34
34
|
return str.replace(/[A-Z]/g, (letter) => '_' + letter.toLowerCase());
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
const NON_TOOL_PROPERTIES = new Set([
|
|
38
|
+
// Promise assimilation and object inspection should not become MCP calls.
|
|
39
|
+
'then',
|
|
40
|
+
'catch',
|
|
41
|
+
'finally',
|
|
42
|
+
'constructor',
|
|
43
|
+
'prototype',
|
|
44
|
+
'toString',
|
|
45
|
+
'valueOf',
|
|
46
|
+
'toJSON',
|
|
47
|
+
'inspect',
|
|
48
|
+
'hasOwnProperty',
|
|
49
|
+
'isPrototypeOf',
|
|
50
|
+
'propertyIsEnumerable',
|
|
51
|
+
'__proto__',
|
|
52
|
+
'__defineGetter__',
|
|
53
|
+
'__defineSetter__',
|
|
54
|
+
'__lookupGetter__',
|
|
55
|
+
'__lookupSetter__',
|
|
56
|
+
'__esModule',
|
|
57
|
+
]);
|
|
58
|
+
|
|
59
|
+
function isToolProperty(property) {
|
|
60
|
+
return typeof property === 'string' && !NON_TOOL_PROPERTIES.has(property);
|
|
61
|
+
}
|
|
62
|
+
|
|
37
63
|
async function callTool(toolName, args) {
|
|
38
64
|
const headers = {
|
|
39
65
|
'Content-Type': 'application/json',
|
|
@@ -81,7 +107,7 @@ async function callTool(toolName, args) {
|
|
|
81
107
|
function createIntegrationProxy(integrationId) {
|
|
82
108
|
return new Proxy({}, {
|
|
83
109
|
get(_target, methodName) {
|
|
84
|
-
if (
|
|
110
|
+
if (!isToolProperty(methodName)) return undefined;
|
|
85
111
|
return (args) => {
|
|
86
112
|
const alreadyFull = methodName.startsWith(integrationId + '_') || methodName.startsWith('___');
|
|
87
113
|
const toolName = alreadyFull ? methodName : integrationId + '_' + camelToSnake(methodName);
|
|
@@ -279,6 +279,32 @@ function camelToSnake(str) {
|
|
|
279
279
|
return str.replace(/[A-Z]/g, (letter) => '_' + letter.toLowerCase());
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
+
const NON_TOOL_PROPERTIES = new Set([
|
|
283
|
+
// Promise assimilation and object inspection should not become MCP calls.
|
|
284
|
+
'then',
|
|
285
|
+
'catch',
|
|
286
|
+
'finally',
|
|
287
|
+
'constructor',
|
|
288
|
+
'prototype',
|
|
289
|
+
'toString',
|
|
290
|
+
'valueOf',
|
|
291
|
+
'toJSON',
|
|
292
|
+
'inspect',
|
|
293
|
+
'hasOwnProperty',
|
|
294
|
+
'isPrototypeOf',
|
|
295
|
+
'propertyIsEnumerable',
|
|
296
|
+
'__proto__',
|
|
297
|
+
'__defineGetter__',
|
|
298
|
+
'__defineSetter__',
|
|
299
|
+
'__lookupGetter__',
|
|
300
|
+
'__lookupSetter__',
|
|
301
|
+
'__esModule',
|
|
302
|
+
]);
|
|
303
|
+
|
|
304
|
+
function isToolProperty(property) {
|
|
305
|
+
return typeof property === 'string' && !NON_TOOL_PROPERTIES.has(property);
|
|
306
|
+
}
|
|
307
|
+
|
|
282
308
|
async function callTool(toolName, args) {
|
|
283
309
|
const headers = {
|
|
284
310
|
'Content-Type': 'application/json',
|
|
@@ -326,7 +352,7 @@ async function callTool(toolName, args) {
|
|
|
326
352
|
function createIntegrationProxy(integrationId) {
|
|
327
353
|
return new Proxy({}, {
|
|
328
354
|
get(_target, methodName) {
|
|
329
|
-
if (
|
|
355
|
+
if (!isToolProperty(methodName)) return undefined;
|
|
330
356
|
return (args) => {
|
|
331
357
|
const alreadyFull = methodName.startsWith(integrationId + '_') || methodName.startsWith('___');
|
|
332
358
|
const toolName = alreadyFull ? methodName : integrationId + '_' + camelToSnake(methodName);
|
package/dist/index.js
CHANGED
|
@@ -1962,6 +1962,34 @@ class OAuthManager {
|
|
|
1962
1962
|
|
|
1963
1963
|
// src/client.ts
|
|
1964
1964
|
var CLIENT_LOG_CONTEXT = "client";
|
|
1965
|
+
var NON_TOOL_PROXY_PROPERTIES = new Set([
|
|
1966
|
+
"then",
|
|
1967
|
+
"catch",
|
|
1968
|
+
"finally",
|
|
1969
|
+
"constructor",
|
|
1970
|
+
"prototype",
|
|
1971
|
+
"toString",
|
|
1972
|
+
"valueOf",
|
|
1973
|
+
"toJSON",
|
|
1974
|
+
"inspect",
|
|
1975
|
+
"hasOwnProperty",
|
|
1976
|
+
"isPrototypeOf",
|
|
1977
|
+
"propertyIsEnumerable",
|
|
1978
|
+
"__proto__",
|
|
1979
|
+
"__defineGetter__",
|
|
1980
|
+
"__defineSetter__",
|
|
1981
|
+
"__lookupGetter__",
|
|
1982
|
+
"__lookupSetter__",
|
|
1983
|
+
"__esModule",
|
|
1984
|
+
Symbol.toStringTag,
|
|
1985
|
+
Symbol.toPrimitive,
|
|
1986
|
+
Symbol.iterator,
|
|
1987
|
+
Symbol.asyncIterator,
|
|
1988
|
+
Symbol.for("nodejs.util.inspect.custom")
|
|
1989
|
+
]);
|
|
1990
|
+
function isToolProxyProperty(property) {
|
|
1991
|
+
return typeof property === "string" && !NON_TOOL_PROXY_PROPERTIES.has(property);
|
|
1992
|
+
}
|
|
1965
1993
|
|
|
1966
1994
|
class SimpleEventEmitter {
|
|
1967
1995
|
handlers = new Map;
|
|
@@ -2186,6 +2214,8 @@ class MCPClientBase {
|
|
|
2186
2214
|
}
|
|
2187
2215
|
return new Proxy({}, {
|
|
2188
2216
|
get: (_target, methodName) => {
|
|
2217
|
+
if (!isToolProxyProperty(methodName))
|
|
2218
|
+
return;
|
|
2189
2219
|
return async (args, options) => {
|
|
2190
2220
|
const toolName = methodToToolName(methodName, integrationId);
|
|
2191
2221
|
return await this.callToolWithRetry(toolName, args, 0, options);
|
|
@@ -2199,6 +2229,8 @@ class MCPClientBase {
|
|
|
2199
2229
|
createServerProxy() {
|
|
2200
2230
|
return new Proxy({}, {
|
|
2201
2231
|
get: (_target, methodName) => {
|
|
2232
|
+
if (!isToolProxyProperty(methodName))
|
|
2233
|
+
return;
|
|
2202
2234
|
if (methodName === "listConfiguredIntegrations") {
|
|
2203
2235
|
return async (options) => {
|
|
2204
2236
|
const transportHeaders = this.transport.headers || {};
|
package/dist/server.js
CHANGED
|
@@ -1552,6 +1552,32 @@ function camelToSnake(str) {
|
|
|
1552
1552
|
return str.replace(/[A-Z]/g, (letter) => '_' + letter.toLowerCase());
|
|
1553
1553
|
}
|
|
1554
1554
|
|
|
1555
|
+
const NON_TOOL_PROPERTIES = new Set([
|
|
1556
|
+
// Promise assimilation and object inspection should not become MCP calls.
|
|
1557
|
+
'then',
|
|
1558
|
+
'catch',
|
|
1559
|
+
'finally',
|
|
1560
|
+
'constructor',
|
|
1561
|
+
'prototype',
|
|
1562
|
+
'toString',
|
|
1563
|
+
'valueOf',
|
|
1564
|
+
'toJSON',
|
|
1565
|
+
'inspect',
|
|
1566
|
+
'hasOwnProperty',
|
|
1567
|
+
'isPrototypeOf',
|
|
1568
|
+
'propertyIsEnumerable',
|
|
1569
|
+
'__proto__',
|
|
1570
|
+
'__defineGetter__',
|
|
1571
|
+
'__defineSetter__',
|
|
1572
|
+
'__lookupGetter__',
|
|
1573
|
+
'__lookupSetter__',
|
|
1574
|
+
'__esModule',
|
|
1575
|
+
]);
|
|
1576
|
+
|
|
1577
|
+
function isToolProperty(property) {
|
|
1578
|
+
return typeof property === 'string' && !NON_TOOL_PROPERTIES.has(property);
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1555
1581
|
async function callTool(toolName, args) {
|
|
1556
1582
|
const headers = {
|
|
1557
1583
|
'Content-Type': 'application/json',
|
|
@@ -1599,7 +1625,7 @@ async function callTool(toolName, args) {
|
|
|
1599
1625
|
function createIntegrationProxy(integrationId) {
|
|
1600
1626
|
return new Proxy({}, {
|
|
1601
1627
|
get(_target, methodName) {
|
|
1602
|
-
if (
|
|
1628
|
+
if (!isToolProperty(methodName)) return undefined;
|
|
1603
1629
|
return (args) => {
|
|
1604
1630
|
const alreadyFull = methodName.startsWith(integrationId + '_') || methodName.startsWith('___');
|
|
1605
1631
|
const toolName = alreadyFull ? methodName : integrationId + '_' + camelToSnake(methodName);
|
|
@@ -3432,6 +3458,34 @@ class OAuthManager {
|
|
|
3432
3458
|
|
|
3433
3459
|
// src/client.ts
|
|
3434
3460
|
var CLIENT_LOG_CONTEXT = "client";
|
|
3461
|
+
var NON_TOOL_PROXY_PROPERTIES = new Set([
|
|
3462
|
+
"then",
|
|
3463
|
+
"catch",
|
|
3464
|
+
"finally",
|
|
3465
|
+
"constructor",
|
|
3466
|
+
"prototype",
|
|
3467
|
+
"toString",
|
|
3468
|
+
"valueOf",
|
|
3469
|
+
"toJSON",
|
|
3470
|
+
"inspect",
|
|
3471
|
+
"hasOwnProperty",
|
|
3472
|
+
"isPrototypeOf",
|
|
3473
|
+
"propertyIsEnumerable",
|
|
3474
|
+
"__proto__",
|
|
3475
|
+
"__defineGetter__",
|
|
3476
|
+
"__defineSetter__",
|
|
3477
|
+
"__lookupGetter__",
|
|
3478
|
+
"__lookupSetter__",
|
|
3479
|
+
"__esModule",
|
|
3480
|
+
Symbol.toStringTag,
|
|
3481
|
+
Symbol.toPrimitive,
|
|
3482
|
+
Symbol.iterator,
|
|
3483
|
+
Symbol.asyncIterator,
|
|
3484
|
+
Symbol.for("nodejs.util.inspect.custom")
|
|
3485
|
+
]);
|
|
3486
|
+
function isToolProxyProperty(property) {
|
|
3487
|
+
return typeof property === "string" && !NON_TOOL_PROXY_PROPERTIES.has(property);
|
|
3488
|
+
}
|
|
3435
3489
|
|
|
3436
3490
|
class SimpleEventEmitter {
|
|
3437
3491
|
handlers = new Map;
|
|
@@ -3654,6 +3708,8 @@ class MCPClientBase {
|
|
|
3654
3708
|
}
|
|
3655
3709
|
return new Proxy({}, {
|
|
3656
3710
|
get: (_target, methodName) => {
|
|
3711
|
+
if (!isToolProxyProperty(methodName))
|
|
3712
|
+
return;
|
|
3657
3713
|
return async (args, options) => {
|
|
3658
3714
|
const toolName = methodToToolName(methodName, integrationId);
|
|
3659
3715
|
return await this.callToolWithRetry(toolName, args, 0, options);
|
|
@@ -3667,6 +3723,8 @@ class MCPClientBase {
|
|
|
3667
3723
|
createServerProxy() {
|
|
3668
3724
|
return new Proxy({}, {
|
|
3669
3725
|
get: (_target, methodName) => {
|
|
3726
|
+
if (!isToolProxyProperty(methodName))
|
|
3727
|
+
return;
|
|
3670
3728
|
if (methodName === "listConfiguredIntegrations") {
|
|
3671
3729
|
return async (options) => {
|
|
3672
3730
|
const transportHeaders = this.transport.headers || {};
|
package/dist/src/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACV,OAAO,EAEP,mBAAmB,EAGpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAiB,eAAe,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACrG,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,aAAa,CAAC;AAQrB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAA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AIjJ;;;;;;;;;OASG;IACG,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,kBAAkB,EAAE,iBAAiB,GAAG,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAa7J;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAW9C;;;OAGG;IACG,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CA2BzD;AAmED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,eAAe,CAAC,aAAa,SAAS,SAAS,cAAc,EAAE,EAC7E,MAAM,EAAE,eAAe,CAAC,aAAa,CAAC,GACrC,SAAS,CAAC,aAAa,CAAC,CAsE1B;AAkFD;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAetD"}
|
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
* dependencies. It is NOT imported by the host SDK — it only ships as a
|
|
13
13
|
* literal payload to the sandbox.
|
|
14
14
|
*/
|
|
15
|
-
export declare const RUNTIME_STUB_SOURCE = "// runtime.mjs \u2014 generated by integrate-sdk code mode\nconst MCP_URL = process.env.INTEGRATE_MCP_URL;\nconst SESSION_TOKEN = process.env.INTEGRATE_SESSION_TOKEN;\nconst API_KEY = process.env.INTEGRATE_API_KEY || '';\nconst PROVIDER_TOKENS = process.env.INTEGRATE_PROVIDER_TOKENS || '';\nconst INTEGRATIONS_HEADER = process.env.INTEGRATE_INTEGRATIONS || '';\nconst CONTEXT_JSON = process.env.INTEGRATE_CONTEXT || '';\n\nif (!MCP_URL) {\n throw new Error('INTEGRATE_MCP_URL is not set \u2014 the sandbox cannot reach the MCP route.');\n}\n\nfunction camelToSnake(str) {\n return str.replace(/[A-Z]/g, (letter) => '_' + letter.toLowerCase());\n}\n\nasync function callTool(toolName, args) {\n const headers = {\n 'Content-Type': 'application/json',\n 'x-integrate-code-mode': '1',\n };\n if (SESSION_TOKEN) headers['Authorization'] = 'Bearer ' + SESSION_TOKEN;\n if (API_KEY) headers['x-integrate-api-key'] = API_KEY;\n if (PROVIDER_TOKENS) headers['x-integrate-tokens'] = PROVIDER_TOKENS;\n if (INTEGRATIONS_HEADER) headers['x-integrations'] = INTEGRATIONS_HEADER;\n if (CONTEXT_JSON) headers['x-integrate-context'] = CONTEXT_JSON;\n\n const res = await fetch(MCP_URL, {\n method: 'POST',\n headers,\n body: JSON.stringify({ name: toolName, arguments: args || {} }),\n });\n\n const text = await res.text();\n\n let payload;\n try {\n payload = text ? JSON.parse(text) : null;\n } catch {\n payload = { content: [{ type: 'text', text }] };\n }\n\n if (!res.ok) {\n let message = (payload && (payload.error || payload.message)) || 'Tool call failed: HTTP ' + res.status;\n if ((res.status === 401 || res.status === 403) && typeof text === 'string' && text.indexOf('Authorization header') !== -1) {\n message =\n 'Code Mode callback was rejected by the MCP server (HTTP ' + res.status + '). ' +\n 'The SDK route could not synthesize an Authorization header. Check the host-side ' +\n 'createMCPServer config (apiKey, getProviderToken) or pass providerTokens to the ' +\n 'AI helper. Original upstream message: ' + text;\n }\n const err = new Error(message);\n err.status = res.status;\n err.toolName = toolName;\n throw err;\n }\n\n return payload;\n}\n\nfunction createIntegrationProxy(integrationId) {\n return new Proxy({}, {\n get(_target, methodName) {\n if (
|
|
15
|
+
export declare const RUNTIME_STUB_SOURCE = "// runtime.mjs \u2014 generated by integrate-sdk code mode\nconst MCP_URL = process.env.INTEGRATE_MCP_URL;\nconst SESSION_TOKEN = process.env.INTEGRATE_SESSION_TOKEN;\nconst API_KEY = process.env.INTEGRATE_API_KEY || '';\nconst PROVIDER_TOKENS = process.env.INTEGRATE_PROVIDER_TOKENS || '';\nconst INTEGRATIONS_HEADER = process.env.INTEGRATE_INTEGRATIONS || '';\nconst CONTEXT_JSON = process.env.INTEGRATE_CONTEXT || '';\n\nif (!MCP_URL) {\n throw new Error('INTEGRATE_MCP_URL is not set \u2014 the sandbox cannot reach the MCP route.');\n}\n\nfunction camelToSnake(str) {\n return str.replace(/[A-Z]/g, (letter) => '_' + letter.toLowerCase());\n}\n\nconst NON_TOOL_PROPERTIES = new Set([\n // Promise assimilation and object inspection should not become MCP calls.\n 'then',\n 'catch',\n 'finally',\n 'constructor',\n 'prototype',\n 'toString',\n 'valueOf',\n 'toJSON',\n 'inspect',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n '__proto__',\n '__defineGetter__',\n '__defineSetter__',\n '__lookupGetter__',\n '__lookupSetter__',\n '__esModule',\n]);\n\nfunction isToolProperty(property) {\n return typeof property === 'string' && !NON_TOOL_PROPERTIES.has(property);\n}\n\nasync function callTool(toolName, args) {\n const headers = {\n 'Content-Type': 'application/json',\n 'x-integrate-code-mode': '1',\n };\n if (SESSION_TOKEN) headers['Authorization'] = 'Bearer ' + SESSION_TOKEN;\n if (API_KEY) headers['x-integrate-api-key'] = API_KEY;\n if (PROVIDER_TOKENS) headers['x-integrate-tokens'] = PROVIDER_TOKENS;\n if (INTEGRATIONS_HEADER) headers['x-integrations'] = INTEGRATIONS_HEADER;\n if (CONTEXT_JSON) headers['x-integrate-context'] = CONTEXT_JSON;\n\n const res = await fetch(MCP_URL, {\n method: 'POST',\n headers,\n body: JSON.stringify({ name: toolName, arguments: args || {} }),\n });\n\n const text = await res.text();\n\n let payload;\n try {\n payload = text ? JSON.parse(text) : null;\n } catch {\n payload = { content: [{ type: 'text', text }] };\n }\n\n if (!res.ok) {\n let message = (payload && (payload.error || payload.message)) || 'Tool call failed: HTTP ' + res.status;\n if ((res.status === 401 || res.status === 403) && typeof text === 'string' && text.indexOf('Authorization header') !== -1) {\n message =\n 'Code Mode callback was rejected by the MCP server (HTTP ' + res.status + '). ' +\n 'The SDK route could not synthesize an Authorization header. Check the host-side ' +\n 'createMCPServer config (apiKey, getProviderToken) or pass providerTokens to the ' +\n 'AI helper. Original upstream message: ' + text;\n }\n const err = new Error(message);\n err.status = res.status;\n err.toolName = toolName;\n throw err;\n }\n\n return payload;\n}\n\nfunction createIntegrationProxy(integrationId) {\n return new Proxy({}, {\n get(_target, methodName) {\n if (!isToolProperty(methodName)) return undefined;\n return (args) => {\n const alreadyFull = methodName.startsWith(integrationId + '_') || methodName.startsWith('___');\n const toolName = alreadyFull ? methodName : integrationId + '_' + camelToSnake(methodName);\n return callTool(toolName, args);\n };\n },\n });\n}\n\nexport const client = new Proxy({}, {\n get(_target, integrationId) {\n if (typeof integrationId !== 'string') return undefined;\n return createIntegrationProxy(integrationId);\n },\n});\n\nexport { callTool };\n";
|
|
16
16
|
//# sourceMappingURL=runtime-stub.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-stub.d.ts","sourceRoot":"","sources":["../../../src/code-mode/runtime-stub.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"runtime-stub.d.ts","sourceRoot":"","sources":["../../../src/code-mode/runtime-stub.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,mBAAmB,q7GA2G/B,CAAC"}
|