ai 4.1.57 → 4.1.59
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 +12 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +74 -83
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +74 -73
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/rsc/dist/rsc-server.mjs.map +1 -1
- package/rsc/dist/rsc-shared.mjs +1 -3
- package/rsc/dist/rsc-shared.mjs.map +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# ai
|
2
2
|
|
3
|
+
## 4.1.59
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- dd18049: fix (ai/core): suppress next.js warnings for node.js specific code path
|
8
|
+
|
9
|
+
## 4.1.58
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- e9897eb: fix (ai/core): move process access into functions and use globalThis
|
14
|
+
|
3
15
|
## 4.1.57
|
4
16
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
@@ -2552,8 +2552,8 @@ It can be either an assistant message or a tool message.
|
|
2552
2552
|
*/
|
2553
2553
|
type ResponseMessage = (CoreAssistantMessage | CoreToolMessage) & {
|
2554
2554
|
/**
|
2555
|
-
Message ID generated by the AI SDK.
|
2556
|
-
|
2555
|
+
Message ID generated by the AI SDK.
|
2556
|
+
*/
|
2557
2557
|
id: string;
|
2558
2558
|
};
|
2559
2559
|
/**
|
package/dist/index.d.ts
CHANGED
@@ -2552,8 +2552,8 @@ It can be either an assistant message or a tool message.
|
|
2552
2552
|
*/
|
2553
2553
|
type ResponseMessage = (CoreAssistantMessage | CoreToolMessage) & {
|
2554
2554
|
/**
|
2555
|
-
Message ID generated by the AI SDK.
|
2556
|
-
|
2555
|
+
Message ID generated by the AI SDK.
|
2556
|
+
*/
|
2557
2557
|
id: string;
|
2558
2558
|
};
|
2559
2559
|
/**
|
package/dist/index.js
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __create = Object.create;
|
3
2
|
var __defProp = Object.defineProperty;
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
6
|
var __export = (target, all) => {
|
9
7
|
for (var name17 in all)
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
15
|
}
|
18
16
|
return to;
|
19
17
|
};
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
-
mod
|
27
|
-
));
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
19
|
|
30
20
|
// streams/index.ts
|
@@ -6680,6 +6670,80 @@ function tool(tool2) {
|
|
6680
6670
|
return tool2;
|
6681
6671
|
}
|
6682
6672
|
|
6673
|
+
// core/tool/mcp/create-child-process.ts
|
6674
|
+
async function createChildProcess(config, signal) {
|
6675
|
+
var _a17, _b, _c;
|
6676
|
+
const runtime = detectRuntime();
|
6677
|
+
if (runtime !== "node") {
|
6678
|
+
throw new MCPClientError({
|
6679
|
+
message: "Attempted to use child_process module outside of Node.js environment"
|
6680
|
+
});
|
6681
|
+
}
|
6682
|
+
let childProcess;
|
6683
|
+
const nodePrefix = "node:";
|
6684
|
+
try {
|
6685
|
+
childProcess = await import(`${nodePrefix}child_process`);
|
6686
|
+
} catch (error) {
|
6687
|
+
try {
|
6688
|
+
childProcess = require(`${nodePrefix}child_process`);
|
6689
|
+
} catch (innerError) {
|
6690
|
+
throw new MCPClientError({
|
6691
|
+
message: "Failed to load child_process module dynamically",
|
6692
|
+
cause: innerError
|
6693
|
+
});
|
6694
|
+
}
|
6695
|
+
}
|
6696
|
+
const { spawn } = childProcess;
|
6697
|
+
return spawn(config.command, (_a17 = config.args) != null ? _a17 : [], {
|
6698
|
+
env: (_b = config.env) != null ? _b : getDefaultEnvironment(),
|
6699
|
+
stdio: ["pipe", "pipe", (_c = config.stderr) != null ? _c : "inherit"],
|
6700
|
+
shell: false,
|
6701
|
+
signal,
|
6702
|
+
windowsHide: globalThis.process.platform === "win32" && isElectron(),
|
6703
|
+
cwd: config.cwd
|
6704
|
+
});
|
6705
|
+
}
|
6706
|
+
function detectRuntime() {
|
6707
|
+
var _a17, _b;
|
6708
|
+
if (typeof window !== "undefined") {
|
6709
|
+
return "browser";
|
6710
|
+
}
|
6711
|
+
if (((_b = (_a17 = globalThis.process) == null ? void 0 : _a17.release) == null ? void 0 : _b.name) === "node") {
|
6712
|
+
return "node";
|
6713
|
+
}
|
6714
|
+
return null;
|
6715
|
+
}
|
6716
|
+
function getDefaultEnvironment() {
|
6717
|
+
const DEFAULT_INHERITED_ENV_VARS = globalThis.process.platform === "win32" ? [
|
6718
|
+
"APPDATA",
|
6719
|
+
"HOMEDRIVE",
|
6720
|
+
"HOMEPATH",
|
6721
|
+
"LOCALAPPDATA",
|
6722
|
+
"PATH",
|
6723
|
+
"PROCESSOR_ARCHITECTURE",
|
6724
|
+
"SYSTEMDRIVE",
|
6725
|
+
"SYSTEMROOT",
|
6726
|
+
"TEMP",
|
6727
|
+
"USERNAME",
|
6728
|
+
"USERPROFILE"
|
6729
|
+
] : ["HOME", "LOGNAME", "PATH", "SHELL", "TERM", "USER"];
|
6730
|
+
const env = {};
|
6731
|
+
for (const key of DEFAULT_INHERITED_ENV_VARS) {
|
6732
|
+
const value = globalThis.process.env[key];
|
6733
|
+
if (value === void 0) {
|
6734
|
+
continue;
|
6735
|
+
}
|
6736
|
+
if (value.startsWith("()")) {
|
6737
|
+
continue;
|
6738
|
+
}
|
6739
|
+
env[key] = value;
|
6740
|
+
}
|
6741
|
+
return env;
|
6742
|
+
}
|
6743
|
+
function isElectron() {
|
6744
|
+
return "type" in globalThis.process;
|
6745
|
+
}
|
6746
|
+
|
6683
6747
|
// core/tool/mcp/types.ts
|
6684
6748
|
var import_zod8 = require("zod");
|
6685
6749
|
var LATEST_PROTOCOL_VERSION = "2024-11-05";
|
@@ -6812,79 +6876,6 @@ var CallToolResultSchema = ResultSchema.extend({
|
|
6812
6876
|
})
|
6813
6877
|
);
|
6814
6878
|
|
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
6879
|
// core/tool/mcp/mcp-stdio-transport.ts
|
6889
6880
|
var StdioClientTransport = class {
|
6890
6881
|
constructor(server) {
|