aiterm-steer-delivery 0.5.4 → 0.5.5

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,6 +1,6 @@
1
- ## 0.5.4 (2026-11-28)
1
+ ## 0.5.5 (2026-11-28)
2
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.
3
+ - Narrows 0.5.4, which stopped delivering answers to non-interactive Claude parents altogether. When `CLAUDE_CODE_ENTRYPOINT` is `sdk-cli`, `sdk-ts` or `sdk-py` (`claude -p`, Agent SDK, Aiterm/BellTeam stream-json seats), `runClaudeChannelWaiter` no longer waits: it claims the text already pending once, emits it and returns 2, or returns 0 when nothing is pending. The hook therefore never holds a turn or an interrupt, and answers arrive at the next PostToolUse / Stop / SessionStart hook. Interactive behaviour is unchanged. 0.5.4 is superseded; do not use it.
4
4
 
5
5
  ## 0.5.3 (2026-11-12)
6
6
 
package/dist/channel.js CHANGED
@@ -340,7 +340,7 @@ 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が戻るまで番(と中断)を止める。起こす先が無いので待たない。 */
343
+ /** claude -p とAgent SDK(Aiterm/BellTeamの席を含む)は、asyncRewakeのhookが戻るまで番(と中断)を止める。待たず、今ある本文だけ出す。 */
344
344
  function nonInteractiveClaude(env) {
345
345
  return ["sdk-cli", "sdk-ts", "sdk-py"].includes(env.CLAUDE_CODE_ENTRYPOINT ?? "");
346
346
  }
@@ -348,9 +348,15 @@ export async function runClaudeChannelWaiter(profile, input, emit, options = {})
348
348
  const event = z.object({ session_id: z.uuid() }).loose().parse(input);
349
349
  if (!openClaudeChannels(profile, event.session_id).length)
350
350
  return 0;
351
- // 待たずに0で終える。未取得の本文はchannelに残り、get_decisionや次の番が取る。
352
- if (nonInteractiveClaude(options.env ?? process.env))
353
- return 0;
351
+ if (nonInteractiveClaude(options.env ?? process.env)) {
352
+ // 待たずに1回だけ取る。無ければ0。本文は次のPostToolUse/Stop/SessionStartのhookで届く。
353
+ const claimed = openClaudeChannels(profile, event.session_id).flatMap(channel => claimPending(profile, channel.channel_id, "claude_hook"))
354
+ .sort((left, right) => left.item.at < right.item.at ? -1 : left.item.at > right.item.at ? 1 : 0);
355
+ if (!claimed.length)
356
+ return 0;
357
+ await emitClaimed(claimed, "claude_hook", texts => emit(texts.join("\n\n")));
358
+ return 2;
359
+ }
354
360
  const owner = options.owner === undefined ? currentHookOwner() : options.owner;
355
361
  const index = sessionIndex(profile, event.session_id);
356
362
  const identity = acquireWaiter(index);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-steer-delivery",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
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",