@alpacakit/agents 0.1.0-beta.26 → 0.1.0-beta.31
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/internal/controlled-process/host-controller.d.ts.map +1 -1
- package/dist/internal/controlled-process/host-controller.js +12 -3
- package/dist/internal/controlled-process/shim-runtime.js +1 -1
- package/dist/internal/controlled-process/supervisor-transport.js +10 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-controller.d.ts","sourceRoot":"","sources":["../../../src/internal/controlled-process/host-controller.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EAErB,6BAA6B,EAC9B,MAAM,kCAAkC,CAAC;AA+B1C,OAAO,KAAK,EACV,uBAAuB,EAEvB,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAoC/B,MAAM,MAAM,4BAA4B,GAAG;IACzC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC;IACzC,QAAQ,CAAC,SAAS,EAAE,qBAAqB,CAAC;CAC3C,CAAC;AAEF,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAC;IACxD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACrD,kBAAkB,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACvD;AAqED,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,4BAA4B,GAClC,OAAO,C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CA4BzC"}
|
|
@@ -39,7 +39,6 @@ export async function launchControlledProcess(input) {
|
|
|
39
39
|
void supervisorClose.promise.catch(() => undefined);
|
|
40
40
|
const control = supervisor.stdio[HOST_BOOTSTRAP_FD];
|
|
41
41
|
const identityStream = supervisor.stdio[HOST_IDENTITY_FD];
|
|
42
|
-
identityStream.on("error", consumeSupervisorPipeError);
|
|
43
42
|
const identityFrames = readFramedRecords(identityStream)[Symbol.asyncIterator]();
|
|
44
43
|
let output = null;
|
|
45
44
|
let identity = null;
|
|
@@ -719,9 +718,21 @@ function spawnSupervisor(entryPath) {
|
|
|
719
718
|
env: {},
|
|
720
719
|
stdio: ["ignore", "pipe", "pipe", "pipe", "pipe"],
|
|
721
720
|
});
|
|
721
|
+
containSupervisorStdioErrors(child);
|
|
722
722
|
child.once("error", () => { });
|
|
723
723
|
return child;
|
|
724
724
|
}
|
|
725
|
+
/**
|
|
726
|
+
* The host owns every supervisor stdio error until child close. Active framed
|
|
727
|
+
* operations keep their own listeners and remain responsible for outcomes;
|
|
728
|
+
* this owner only contains later pipe errors after those operations settle.
|
|
729
|
+
*/
|
|
730
|
+
function containSupervisorStdioErrors(supervisor) {
|
|
731
|
+
for (const stream of supervisor.stdio) {
|
|
732
|
+
stream?.on("error", consumeSupervisorStdioError);
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
function consumeSupervisorStdioError() { }
|
|
725
736
|
function observeSupervisorClose(supervisor, receiptGraceMs) {
|
|
726
737
|
let closed = false;
|
|
727
738
|
let exited = false;
|
|
@@ -781,7 +792,6 @@ function attachSupervisorOutput(supervisor) {
|
|
|
781
792
|
let streamsClosed = 0;
|
|
782
793
|
const attach = (stream, channel) => {
|
|
783
794
|
stream.setEncoding("utf8");
|
|
784
|
-
stream.on("error", consumeSupervisorPipeError);
|
|
785
795
|
stream.on("data", (text) => queue.push({ channel, text }));
|
|
786
796
|
stream.once("close", () => {
|
|
787
797
|
streamsClosed += 1;
|
|
@@ -795,7 +805,6 @@ function attachSupervisorOutput(supervisor) {
|
|
|
795
805
|
attach(stderr, OUTPUT_CHANNEL_KIND.stderr);
|
|
796
806
|
return { queue, closed };
|
|
797
807
|
}
|
|
798
|
-
function consumeSupervisorPipeError() { }
|
|
799
808
|
class ControlledProcessOutputQueue {
|
|
800
809
|
sources;
|
|
801
810
|
buffered = [];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
-
import { readFramedRecords, readRequiredFrame, writeFramedRecord, } from "./framed-transport.js";
|
|
3
2
|
import { readableFd, writableFd } from "./child-fd.js";
|
|
3
|
+
import { readFramedRecords, readRequiredFrame, writeFramedRecord, } from "./framed-transport.js";
|
|
4
4
|
import { shimAckSchema, shimBootstrapSchema } from "./supervisor-schema.js";
|
|
5
5
|
import { SHIM_FRAME_KIND } from "./supervisor-values.js";
|
|
6
6
|
const SHIM_CONTROL_FD = 3;
|
|
@@ -342,7 +342,16 @@ function observeSocketClose(socket) {
|
|
|
342
342
|
return Promise.resolve();
|
|
343
343
|
}
|
|
344
344
|
return new Promise((resolve) => {
|
|
345
|
-
|
|
345
|
+
// The framed reader owns transport failures while a request is active.
|
|
346
|
+
// Once shutdown starts, Linux may still report a peer reset before close;
|
|
347
|
+
// retain an error listener until close so that late event is joined rather
|
|
348
|
+
// than escaping as an uncaught process-level error.
|
|
349
|
+
const containClosingError = () => undefined;
|
|
350
|
+
socket.on("error", containClosingError);
|
|
351
|
+
socket.once("close", () => {
|
|
352
|
+
socket.off("error", containClosingError);
|
|
353
|
+
resolve();
|
|
354
|
+
});
|
|
346
355
|
});
|
|
347
356
|
}
|
|
348
357
|
async function assertSocketTargetAbsent(socketPath) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alpacakit/agents",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.31",
|
|
4
4
|
"description": "Run AI coding agents programmatically: execute, stream, classify failures, fail over.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"zod": "^4.3.6",
|
|
52
|
-
"@alpacakit/core": "0.1.0-beta.
|
|
52
|
+
"@alpacakit/core": "0.1.0-beta.31"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"typescript": "^5.9.3",
|