aiterm-steer-delivery 0.4.2 → 0.4.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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.3
4
+
5
+ Windowsで、consoleを持たないprocessから呼ぶと端末の窓が一瞬出る所を直します。APIと返りは変わりません。
6
+
7
+ - **起きていた事。** Windowsでは、consoleを持たないprocess(Nodeの`detached: true`で切り離したprocess、予定の仕事から起きたprocessなど)がconsoleの子を窓を隠さずに起こすと、端末の窓(Windows Terminal)が一瞬出る。Codexの実行ファイルを探す所(`resolveCodexExecutable`の`where codex`)に`windowsHide`が無かった。ここを通るのは、`CODEX_BIN`も`~/.local/bin/codex`も無く、製品のCodex hookが有効でない(hookの設定に実行ファイルの場所が無い)時。0.4.0から、寝ている会話を起こす見張りが切り離したprocessとして動くので、その組で窓が出た(Windowsの実物で、窓が1つ出る事と、直した後は出ない事を測った)。hookが有効な製品(実行ファイルの場所が設定にある)では通らず、見張りの本番の道は窓を出していなかった。
8
+ - **子のprocessを起こす所の全部に`windowsHide`を付けた。** `where codex`のほか、macOSの導入先の確かめ(`codesign`・`--version`・`mdfind`・`PlistBuddy`)にも付ける(Windowsでは通らない所。抜けを無くすため)。
9
+ - 抜けを見張る試験(`test/windows-hide.test.mjs`)を足した。子を起こす呼び出しで`windowsHide`の無い物があると落ちる。
10
+
3
11
  ## 0.4.2
4
12
 
5
13
  Claude Codeが起動し直して同じ会話を再開した後、channelの本文が届かなかったのを直します。今までのAPIの返りは変わりません。
@@ -74,7 +74,8 @@ export function resolveCodexExecutable() {
74
74
  const fallback = path.join(home, ".local", "bin", "codex");
75
75
  if (isUsableAgentExecutableFile(fallback))
76
76
  return resolveWindowsCodexShim(fallback);
77
- const w = spawnSync(isWin ? "where" : "which", ["codex"], { encoding: "utf8", timeout: 5000 });
77
+ // windowsHide: consoleを持たないprocess(切り離した見張り、hookから切り離した処理)から起こすと、隠さない子は窓を一瞬出す。
78
+ const w = spawnSync(isWin ? "where" : "which", ["codex"], { encoding: "utf8", timeout: 5000, windowsHide: true });
78
79
  if (w.status === 0 && (w.stdout ?? "").trim()) {
79
80
  const found = w.stdout.trim().split(/\r?\n/).filter(Boolean);
80
81
  const ordered = isWin
@@ -103,7 +104,7 @@ export function codexSpawnEnv(env = process.env, node = process.execPath, platfo
103
104
  return listed ? env : { ...env, [key]: current ? `${directory}${delimiter}${current}` : directory };
104
105
  }
105
106
  function command(executable, args) {
106
- const result = spawnSync(executable, args, { encoding: "utf8", timeout: 15_000, env: codexSpawnEnv() });
107
+ const result = spawnSync(executable, args, { encoding: "utf8", timeout: 15_000, env: codexSpawnEnv(), windowsHide: true });
107
108
  if (result.error || result.status !== 0)
108
109
  throw new SetupError("codex_steer_setup_failed", `${path.basename(executable)}を実行できません`);
109
110
  return result.stdout.trim();
@@ -121,13 +122,13 @@ export function desktopBundledCodex(app) {
121
122
  }
122
123
  /** macOSの公式Codex Desktopが同梱するCLI。署名と版を確かめる。 */
123
124
  export function findDesktopBinary() {
124
- const search = spawnSync("/usr/bin/mdfind", ["kMDItemCFBundleIdentifier == 'com.openai.codex'"], { encoding: "utf8", timeout: 10_000 });
125
+ const search = spawnSync("/usr/bin/mdfind", ["kMDItemCFBundleIdentifier == 'com.openai.codex'"], { encoding: "utf8", timeout: 10_000, windowsHide: true });
125
126
  const candidates = [...new Set(["/Applications/Codex.app", "/Applications/ChatGPT.app", ...(search.status === 0 ? search.stdout.trim().split("\n") : [])])];
126
127
  const found = candidates.flatMap(app => {
127
128
  const binary = app ? desktopBundledCodex(app) : null;
128
129
  if (!binary)
129
130
  return [];
130
- const result = spawnSync("/usr/libexec/PlistBuddy", ["-c", "Print:CFBundleIdentifier", path.join(app, "Contents", "Info.plist")], { encoding: "utf8", timeout: 5_000 });
131
+ const result = spawnSync("/usr/libexec/PlistBuddy", ["-c", "Print:CFBundleIdentifier", path.join(app, "Contents", "Info.plist")], { encoding: "utf8", timeout: 5_000, windowsHide: true });
131
132
  return result.status === 0 && result.stdout.trim() === "com.openai.codex" ? [binary] : [];
132
133
  });
133
134
  if (found.length !== 1)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-steer-delivery",
3
- "version": "0.4.2",
3
+ "version": "0.4.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",