ai 4.1.57 → 4.1.58
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/CHANGELOG.md +6 -0
- package/dist/index.js +73 -73
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +73 -73
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
@@ -6680,6 +6680,79 @@ function tool(tool2) {
|
|
6680
6680
|
return tool2;
|
6681
6681
|
}
|
6682
6682
|
|
6683
|
+
// core/tool/mcp/create-child-process.ts
|
6684
|
+
async function createChildProcess(config, signal) {
|
6685
|
+
var _a17, _b, _c;
|
6686
|
+
const runtime = detectRuntime();
|
6687
|
+
if (runtime !== "node") {
|
6688
|
+
throw new MCPClientError({
|
6689
|
+
message: "Attempted to use child_process module outside of Node.js environment"
|
6690
|
+
});
|
6691
|
+
}
|
6692
|
+
let childProcess;
|
6693
|
+
try {
|
6694
|
+
childProcess = await import("child_process");
|
6695
|
+
} catch (error) {
|
6696
|
+
try {
|
6697
|
+
childProcess = require("child_process");
|
6698
|
+
} catch (innerError) {
|
6699
|
+
throw new MCPClientError({
|
6700
|
+
message: "Failed to load child_process module dynamically",
|
6701
|
+
cause: innerError
|
6702
|
+
});
|
6703
|
+
}
|
6704
|
+
}
|
6705
|
+
const { spawn } = childProcess;
|
6706
|
+
return spawn(config.command, (_a17 = config.args) != null ? _a17 : [], {
|
6707
|
+
env: (_b = config.env) != null ? _b : getDefaultEnvironment(),
|
6708
|
+
stdio: ["pipe", "pipe", (_c = config.stderr) != null ? _c : "inherit"],
|
6709
|
+
shell: false,
|
6710
|
+
signal,
|
6711
|
+
windowsHide: globalThis.process.platform === "win32" && isElectron(),
|
6712
|
+
cwd: config.cwd
|
6713
|
+
});
|
6714
|
+
}
|
6715
|
+
function detectRuntime() {
|
6716
|
+
var _a17, _b;
|
6717
|
+
if (typeof window !== "undefined") {
|
6718
|
+
return "browser";
|
6719
|
+
}
|
6720
|
+
if (((_b = (_a17 = globalThis.process) == null ? void 0 : _a17.release) == null ? void 0 : _b.name) === "node") {
|
6721
|
+
return "node";
|
6722
|
+
}
|
6723
|
+
return null;
|
6724
|
+
}
|
6725
|
+
function getDefaultEnvironment() {
|
6726
|
+
const DEFAULT_INHERITED_ENV_VARS = globalThis.process.platform === "win32" ? [
|
6727
|
+
"APPDATA",
|
6728
|
+
"HOMEDRIVE",
|
6729
|
+
"HOMEPATH",
|
6730
|
+
"LOCALAPPDATA",
|
6731
|
+
"PATH",
|
6732
|
+
"PROCESSOR_ARCHITECTURE",
|
6733
|
+
"SYSTEMDRIVE",
|
6734
|
+
"SYSTEMROOT",
|
6735
|
+
"TEMP",
|
6736
|
+
"USERNAME",
|
6737
|
+
"USERPROFILE"
|
6738
|
+
] : ["HOME", "LOGNAME", "PATH", "SHELL", "TERM", "USER"];
|
6739
|
+
const env = {};
|
6740
|
+
for (const key of DEFAULT_INHERITED_ENV_VARS) {
|
6741
|
+
const value = globalThis.process.env[key];
|
6742
|
+
if (value === void 0) {
|
6743
|
+
continue;
|
6744
|
+
}
|
6745
|
+
if (value.startsWith("()")) {
|
6746
|
+
continue;
|
6747
|
+
}
|
6748
|
+
env[key] = value;
|
6749
|
+
}
|
6750
|
+
return env;
|
6751
|
+
}
|
6752
|
+
function isElectron() {
|
6753
|
+
return "type" in globalThis.process;
|
6754
|
+
}
|
6755
|
+
|
6683
6756
|
// core/tool/mcp/types.ts
|
6684
6757
|
var import_zod8 = require("zod");
|
6685
6758
|
var LATEST_PROTOCOL_VERSION = "2024-11-05";
|
@@ -6812,79 +6885,6 @@ var CallToolResultSchema = ResultSchema.extend({
|
|
6812
6885
|
})
|
6813
6886
|
);
|
6814
6887
|
|
6815
|
-
// core/tool/mcp/utils.ts
|
6816
|
-
function detectRuntime() {
|
6817
|
-
var _a17, _b;
|
6818
|
-
if (typeof window !== "undefined") {
|
6819
|
-
return "browser";
|
6820
|
-
}
|
6821
|
-
if (((_b = (_a17 = globalThis.process) == null ? void 0 : _a17.release) == null ? void 0 : _b.name) === "node") {
|
6822
|
-
return "node";
|
6823
|
-
}
|
6824
|
-
return null;
|
6825
|
-
}
|
6826
|
-
async function createChildProcess(config, signal) {
|
6827
|
-
var _a17, _b, _c;
|
6828
|
-
const runtime = detectRuntime();
|
6829
|
-
if (runtime !== "node") {
|
6830
|
-
throw new MCPClientError({
|
6831
|
-
message: "Attempted to use child_process module outside of Node.js environment"
|
6832
|
-
});
|
6833
|
-
}
|
6834
|
-
let childProcess;
|
6835
|
-
try {
|
6836
|
-
childProcess = await import("child_process");
|
6837
|
-
} catch (error) {
|
6838
|
-
try {
|
6839
|
-
childProcess = require("child_process");
|
6840
|
-
} catch (innerError) {
|
6841
|
-
throw new MCPClientError({
|
6842
|
-
message: "Failed to load child_process module dynamically",
|
6843
|
-
cause: innerError
|
6844
|
-
});
|
6845
|
-
}
|
6846
|
-
}
|
6847
|
-
const { spawn } = childProcess;
|
6848
|
-
return spawn(config.command, (_a17 = config.args) != null ? _a17 : [], {
|
6849
|
-
env: (_b = config.env) != null ? _b : getDefaultEnvironment(),
|
6850
|
-
stdio: ["pipe", "pipe", (_c = config.stderr) != null ? _c : "inherit"],
|
6851
|
-
shell: false,
|
6852
|
-
signal,
|
6853
|
-
windowsHide: process.platform === "win32" && isElectron(),
|
6854
|
-
cwd: config.cwd
|
6855
|
-
});
|
6856
|
-
}
|
6857
|
-
var DEFAULT_INHERITED_ENV_VARS = process.platform === "win32" ? [
|
6858
|
-
"APPDATA",
|
6859
|
-
"HOMEDRIVE",
|
6860
|
-
"HOMEPATH",
|
6861
|
-
"LOCALAPPDATA",
|
6862
|
-
"PATH",
|
6863
|
-
"PROCESSOR_ARCHITECTURE",
|
6864
|
-
"SYSTEMDRIVE",
|
6865
|
-
"SYSTEMROOT",
|
6866
|
-
"TEMP",
|
6867
|
-
"USERNAME",
|
6868
|
-
"USERPROFILE"
|
6869
|
-
] : ["HOME", "LOGNAME", "PATH", "SHELL", "TERM", "USER"];
|
6870
|
-
function getDefaultEnvironment() {
|
6871
|
-
const env = {};
|
6872
|
-
for (const key of DEFAULT_INHERITED_ENV_VARS) {
|
6873
|
-
const value = process.env[key];
|
6874
|
-
if (value === void 0) {
|
6875
|
-
continue;
|
6876
|
-
}
|
6877
|
-
if (value.startsWith("()")) {
|
6878
|
-
continue;
|
6879
|
-
}
|
6880
|
-
env[key] = value;
|
6881
|
-
}
|
6882
|
-
return env;
|
6883
|
-
}
|
6884
|
-
function isElectron() {
|
6885
|
-
return "type" in process;
|
6886
|
-
}
|
6887
|
-
|
6888
6888
|
// core/tool/mcp/mcp-stdio-transport.ts
|
6889
6889
|
var StdioClientTransport = class {
|
6890
6890
|
constructor(server) {
|