@epoch-agent/core 0.10.0 → 0.10.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/index.js +29 -9
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1755,12 +1755,20 @@ async function runCode(input) {
|
|
|
1755
1755
|
resourceLimits: { maxOldGenerationSizeMb: limits.maxMemoryMb }
|
|
1756
1756
|
});
|
|
1757
1757
|
let printed = "";
|
|
1758
|
-
const
|
|
1759
|
-
if (printed.length >= limits.maxPrintChars) return;
|
|
1760
|
-
printed = (printed +
|
|
1758
|
+
const take = (text) => {
|
|
1759
|
+
if (!text || printed.length >= limits.maxPrintChars) return;
|
|
1760
|
+
printed = (printed + text).slice(0, limits.maxPrintChars);
|
|
1761
1761
|
};
|
|
1762
|
-
|
|
1763
|
-
|
|
1762
|
+
const attach = (stream) => {
|
|
1763
|
+
let decoder = null;
|
|
1764
|
+
stream.on("data", (chunk) => {
|
|
1765
|
+
decoder ??= createStreamDecoder();
|
|
1766
|
+
take(decoder.write(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk)));
|
|
1767
|
+
});
|
|
1768
|
+
stream.on("end", () => take(decoder?.end() ?? ""));
|
|
1769
|
+
};
|
|
1770
|
+
attach(worker.stdout);
|
|
1771
|
+
attach(worker.stderr);
|
|
1764
1772
|
const drained = Promise.all([streamEnd(worker.stdout), streamEnd(worker.stderr)]);
|
|
1765
1773
|
let toolCalls = 0;
|
|
1766
1774
|
let capped2 = false;
|
|
@@ -19748,16 +19756,22 @@ function runCommandHook(config, event, workDir) {
|
|
|
19748
19756
|
});
|
|
19749
19757
|
}
|
|
19750
19758
|
}, timeout);
|
|
19759
|
+
let outDecoder = null;
|
|
19760
|
+
let errDecoder = null;
|
|
19751
19761
|
child.stdout?.on("data", (data) => {
|
|
19752
|
-
|
|
19762
|
+
outDecoder ??= createStreamDecoder();
|
|
19763
|
+
stdout += outDecoder.write(data);
|
|
19753
19764
|
});
|
|
19754
19765
|
child.stderr?.on("data", (data) => {
|
|
19755
|
-
|
|
19766
|
+
errDecoder ??= createStreamDecoder();
|
|
19767
|
+
stderr += errDecoder.write(data);
|
|
19756
19768
|
});
|
|
19757
19769
|
child.on("close", (code) => {
|
|
19758
19770
|
clearTimeout(timer);
|
|
19759
19771
|
if (settled) return;
|
|
19760
19772
|
settled = true;
|
|
19773
|
+
stdout += outDecoder?.end() ?? "";
|
|
19774
|
+
stderr += errDecoder?.end() ?? "";
|
|
19761
19775
|
const exitCode = code ?? -1;
|
|
19762
19776
|
const blocked = exitCode === 2;
|
|
19763
19777
|
const rejectReason = blocked ? stderr.trim() || t("hook_load.rejected_this") : void 0;
|
|
@@ -22529,9 +22543,12 @@ var CodeSandbox = class {
|
|
|
22529
22543
|
let stdout = "";
|
|
22530
22544
|
let stderr = "";
|
|
22531
22545
|
let killedForOutput = false;
|
|
22546
|
+
let outDecoder = null;
|
|
22547
|
+
let errDecoder = null;
|
|
22532
22548
|
child.stdout?.on("data", (c) => {
|
|
22533
22549
|
if (killedForOutput) return;
|
|
22534
|
-
|
|
22550
|
+
outDecoder ??= createStreamDecoder();
|
|
22551
|
+
stdout += outDecoder.write(c);
|
|
22535
22552
|
if (stdout.length >= MAX_OUTPUT) {
|
|
22536
22553
|
killedForOutput = true;
|
|
22537
22554
|
stdout = stdout.slice(0, MAX_OUTPUT);
|
|
@@ -22540,7 +22557,8 @@ var CodeSandbox = class {
|
|
|
22540
22557
|
});
|
|
22541
22558
|
child.stderr?.on("data", (c) => {
|
|
22542
22559
|
if (stderr.length >= MAX_OUTPUT) return;
|
|
22543
|
-
|
|
22560
|
+
errDecoder ??= createStreamDecoder();
|
|
22561
|
+
stderr += errDecoder.write(c);
|
|
22544
22562
|
});
|
|
22545
22563
|
const onAbort = () => child.kill("SIGKILL");
|
|
22546
22564
|
opts.signal?.addEventListener("abort", onAbort, { once: true });
|
|
@@ -22566,6 +22584,8 @@ var CodeSandbox = class {
|
|
|
22566
22584
|
});
|
|
22567
22585
|
child.on("close", (code, sig) => {
|
|
22568
22586
|
opts.signal?.removeEventListener("abort", onAbort);
|
|
22587
|
+
if (!killedForOutput) stdout += outDecoder?.end() ?? "";
|
|
22588
|
+
if (stderr.length < MAX_OUTPUT) stderr += errDecoder?.end() ?? "";
|
|
22569
22589
|
const duration = Date.now() - start;
|
|
22570
22590
|
if (killedForOutput) {
|
|
22571
22591
|
resolve15({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epoch-agent/core",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "epoch-agent 核心引擎:ReAct 循环、Provider 路由、工具调度、记忆管理",
|
|
6
6
|
"repository": {
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"gpt-tokenizer": "^3.4.0",
|
|
28
28
|
"js-yaml": "^5.2.3",
|
|
29
29
|
"zod": "^4.4.3",
|
|
30
|
-
"@epoch-agent/infra": "0.10.
|
|
31
|
-
"@epoch-agent/protocol": "0.10.
|
|
30
|
+
"@epoch-agent/infra": "0.10.1",
|
|
31
|
+
"@epoch-agent/protocol": "0.10.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@ai-sdk/amazon-bedrock": "^5.0.40",
|