aiterm-steer-delivery 0.5.1 → 0.5.3
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 +8 -0
- package/README.md +4 -0
- package/dist/codex-receiver.js +6 -2
- package/dist/process.js +16 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## 0.5.3 (2026-11-12)
|
|
2
|
+
|
|
3
|
+
- A Codex App Server request no longer times out while an answer is already waiting in the pipe. When the calling process's event loop was blocked past the deadline (15 s by default), the timer fired before the answer was read and the request failed with `CODEX_RECEIVER_TIMEOUT`. The timer now waits one turn of the loop and rejects only if the request is still pending. Reported by Kiro: a host Aiterm blocked for ~16 s by goal reads made Codex goal reads unavailable.
|
|
4
|
+
|
|
5
|
+
## 0.5.2 (2026-11-03)
|
|
6
|
+
|
|
7
|
+
- Preserve safe OS failure details for process reads without exposing command lines or output.
|
|
8
|
+
|
|
1
9
|
# Changelog
|
|
2
10
|
|
|
3
11
|
## Unreleased
|
package/README.md
CHANGED
|
@@ -264,3 +264,7 @@ CI runs the tests on Ubuntu, macOS, and Windows. Pushing a `v<version>` tag publ
|
|
|
264
264
|
## License
|
|
265
265
|
|
|
266
266
|
[MIT](LICENSE)
|
|
267
|
+
|
|
268
|
+
## Architecture
|
|
269
|
+
|
|
270
|
+
[Product boundaries and source index](https://github.com/kitepon/aiterm-steer-delivery/blob/fix/process-probe-details-20261103/docs/architecture/README.md).
|
package/dist/codex-receiver.js
CHANGED
|
@@ -78,10 +78,14 @@ export async function withCodexReceiver(profile, parent, action, runtime = {}) {
|
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
80
|
const id = ++sequence;
|
|
81
|
-
|
|
81
|
+
// A loop blocked past the deadline fires this timer before reading an answer already in the pipe.
|
|
82
|
+
// setImmediate runs after this turn's poll phase, so that answer settles the request first.
|
|
83
|
+
const timer = setTimeout(() => setImmediate(() => {
|
|
84
|
+
if (!pending.has(id))
|
|
85
|
+
return;
|
|
82
86
|
pending.delete(id);
|
|
83
87
|
reject(new CodexDeliveryError("CODEX_RECEIVER_TIMEOUT", `${method}の応答を確認できません`, method === "thread/queue/add"));
|
|
84
|
-
}, runtime.timeout_ms ?? 15_000);
|
|
88
|
+
}), runtime.timeout_ms ?? 15_000);
|
|
85
89
|
pending.set(id, { resolve, reject, timer, method });
|
|
86
90
|
child.stdin.write(JSON.stringify({ id, method, params }) + "\n");
|
|
87
91
|
});
|
package/dist/process.js
CHANGED
|
@@ -6,6 +6,15 @@ const isWin = process.platform === "win32";
|
|
|
6
6
|
class ProcessTableError extends Error {
|
|
7
7
|
code = 2;
|
|
8
8
|
}
|
|
9
|
+
function processReadError(probe, failure, result) {
|
|
10
|
+
const code = result.error?.code;
|
|
11
|
+
// Native messages and output can contain argv and credentials.
|
|
12
|
+
const detail = { component: "aiterm-steer-delivery", probe, code: result.error
|
|
13
|
+
? (code && ["ETIMEDOUT", "ENOBUFS", "EAGAIN", "ENOENT", "EACCES", "ENOMEM", "EMFILE", "ENFILE", "E2BIG", "EPERM"].includes(code) ? code : "UNKNOWN") : null,
|
|
14
|
+
status: result.status ?? null, signal: result.signal ?? null,
|
|
15
|
+
stdout_bytes: Buffer.byteLength(result.stdout ?? ""), stderr_bytes: Buffer.byteLength(result.stderr ?? "") };
|
|
16
|
+
return new ProcessTableError(`${failure} ${JSON.stringify(detail)}`);
|
|
17
|
+
}
|
|
9
18
|
export function processIdentity(process) {
|
|
10
19
|
return {
|
|
11
20
|
pid: process.pid, process_group_id: process.process_group_id,
|
|
@@ -63,13 +72,13 @@ export function processExists(pid) {
|
|
|
63
72
|
return error.code === "EPERM";
|
|
64
73
|
}
|
|
65
74
|
}
|
|
66
|
-
function windowsJson(script, failure) {
|
|
75
|
+
function windowsJson(script, failure, probe) {
|
|
67
76
|
const source = ["$ErrorActionPreference='Stop'", "[Console]::OutputEncoding=[Text.UTF8Encoding]::new($false)", script].join("\n");
|
|
68
77
|
const result = spawnSync(resolveWindowsPowerShell7(), ["-NoLogo", "-NoProfile", "-NonInteractive", "-EncodedCommand", Buffer.from(source, "utf16le").toString("base64")], {
|
|
69
78
|
encoding: "utf8", timeout: 15000, maxBuffer: 16 * 1024 * 1024, windowsHide: true,
|
|
70
79
|
});
|
|
71
80
|
if (result.error || result.status !== 0)
|
|
72
|
-
throw
|
|
81
|
+
throw processReadError(probe, failure, result);
|
|
73
82
|
try {
|
|
74
83
|
return JSON.parse(result.stdout);
|
|
75
84
|
}
|
|
@@ -111,7 +120,7 @@ export function readProcessIdentities(pids) {
|
|
|
111
120
|
});
|
|
112
121
|
// 該当するprocessが一つも無い時、psは何も出さずstatus 1で終わる。
|
|
113
122
|
if (result.error || (result.status !== 0 && !(result.status === 1 && !result.stdout.trim()))) {
|
|
114
|
-
throw
|
|
123
|
+
throw processReadError("identity", "OSのprocess一覧を取得できません", result);
|
|
115
124
|
}
|
|
116
125
|
return result.stdout.split("\n").filter(line => line.trim()).map(line => {
|
|
117
126
|
const match = /^\s*(\d+)\s+(\S+\s+\S+\s+\d+\s+\S+\s+\d+)\s*$/.exec(line);
|
|
@@ -130,7 +139,7 @@ export function readProcessIdentities(pids) {
|
|
|
130
139
|
" $rows += [ordered]@{ pid=[int]$id; started_identity=$started }",
|
|
131
140
|
"}",
|
|
132
141
|
"ConvertTo-Json -Compress -InputObject $rows",
|
|
133
|
-
].join("\n"), "Windowsのprocessの開始時刻を取得できません");
|
|
142
|
+
].join("\n"), "Windowsのprocessの開始時刻を取得できません", "identity");
|
|
134
143
|
if (!Array.isArray(rows))
|
|
135
144
|
throw new ProcessTableError("Windows processの読みが配列ではありません");
|
|
136
145
|
return rows.map(row => {
|
|
@@ -174,7 +183,7 @@ export function readProcessLineage(pid, depth = 8) {
|
|
|
174
183
|
" $child=$started; $id=$parent",
|
|
175
184
|
"}",
|
|
176
185
|
"ConvertTo-Json -Compress -InputObject $rows",
|
|
177
|
-
].join("\n"), "Windowsのprocessの先祖を取得できません");
|
|
186
|
+
].join("\n"), "Windowsのprocessの先祖を取得できません", "lineage");
|
|
178
187
|
}
|
|
179
188
|
catch {
|
|
180
189
|
return readRuntimeProcesses();
|
|
@@ -224,7 +233,7 @@ export function readRuntimeProcesses() {
|
|
|
224
233
|
encoding: "utf8", env: { ...process.env, LC_ALL: "C" }, timeout: 10000, maxBuffer: 16 * 1024 * 1024,
|
|
225
234
|
});
|
|
226
235
|
if (result.error || result.status !== 0)
|
|
227
|
-
throw
|
|
236
|
+
throw processReadError("table", "OSのprocess一覧を取得できません", result);
|
|
228
237
|
return parsePosixProcessTable(result.stdout);
|
|
229
238
|
}
|
|
230
239
|
const script = [
|
|
@@ -238,7 +247,7 @@ export function readRuntimeProcesses() {
|
|
|
238
247
|
encoding: "utf8", timeout: 15000, maxBuffer: 16 * 1024 * 1024, windowsHide: true,
|
|
239
248
|
});
|
|
240
249
|
if (result.error || result.status !== 0)
|
|
241
|
-
throw
|
|
250
|
+
throw processReadError("table", "Windowsのnative process一覧を取得できません", result);
|
|
242
251
|
let rows;
|
|
243
252
|
try {
|
|
244
253
|
rows = JSON.parse(result.stdout);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aiterm-steer-delivery",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Aiterm's steer delivery as a library: deliver text to the parent AI session that called your MCP tool — steered into the running turn when it is busy, delivered normally when it is idle. Codex (official queue + sync hooks), Claude Code (asyncRewake hooks), Cursor (hooks + background receiver).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|