aiterm-steer-delivery 0.5.2 → 0.5.4

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 CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.5.4 (2026-11-28)
2
+
3
+ - The Claude Code waiter (`runClaudeChannelWaiter`) returns 0 at once when the parent runs non-interactively (`CLAUDE_CODE_ENTRYPOINT` is `sdk-cli`, `sdk-ts` or `sdk-py`, which covers `claude -p`). In print mode the `asyncRewake` hook held the turn, and its interrupt, for up to 24 h (Tronie, fox, 11/28). The pending text stays in the channel for the product's other delivery (get_decision / the next turn). Interactive behaviour is unchanged. Public API, hook registration and storage layout do not change. Not reproduced against a live `claude -p` (auth unavailable); the held turn is the observation reported by Tronie.
4
+
5
+ ## 0.5.3 (2026-11-12)
6
+
7
+ - 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.
8
+
1
9
  ## 0.5.2 (2026-11-03)
2
10
 
3
11
  - Preserve safe OS failure details for process reads without exposing command lines or output.
package/dist/channel.d.ts CHANGED
@@ -64,6 +64,7 @@ export declare function runClaudeChannelWaiter(profile: ProductProfile, input: u
64
64
  } | null;
65
65
  owner_check_ms?: number;
66
66
  identity_recheck_ms?: number;
67
+ env?: NodeJS.ProcessEnv;
67
68
  runtime?: {
68
69
  exists: (pid: number) => boolean;
69
70
  identity: (pid: number) => string | undefined;
package/dist/channel.js CHANGED
@@ -340,10 +340,17 @@ function currentHookOwner() {
340
340
  // 待機は最長で1日続き、会話の数だけ同時に動く。5秒おきの確かめはpidの有無だけにして(processを起こさない)、
341
341
  // 開始時刻は最初とこの間隔でだけ照合する。出す先が終わった直後に同じpidが使い回された時だけ、待機の終わりが最長でこの間隔だけ遅れる。
342
342
  const WAITER_OWNER_IDENTITY_RECHECK_MS = 60_000;
343
+ /** claude -p とAgent SDKは、asyncRewakeのhookが戻るまで番(と中断)を止める。起こす先が無いので待たない。 */
344
+ function nonInteractiveClaude(env) {
345
+ return ["sdk-cli", "sdk-ts", "sdk-py"].includes(env.CLAUDE_CODE_ENTRYPOINT ?? "");
346
+ }
343
347
  export async function runClaudeChannelWaiter(profile, input, emit, options = {}) {
344
348
  const event = z.object({ session_id: z.uuid() }).loose().parse(input);
345
349
  if (!openClaudeChannels(profile, event.session_id).length)
346
350
  return 0;
351
+ // 待たずに0で終える。未取得の本文はchannelに残り、get_decisionや次の番が取る。
352
+ if (nonInteractiveClaude(options.env ?? process.env))
353
+ return 0;
347
354
  const owner = options.owner === undefined ? currentHookOwner() : options.owner;
348
355
  const index = sessionIndex(profile, event.session_id);
349
356
  const identity = acquireWaiter(index);
@@ -78,10 +78,14 @@ export async function withCodexReceiver(profile, parent, action, runtime = {}) {
78
78
  return;
79
79
  }
80
80
  const id = ++sequence;
81
- const timer = setTimeout(() => {
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-steer-delivery",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
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",