aiterm-steer-delivery 0.4.5 → 0.4.6
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 +15 -0
- package/dist/aiterm-provider.js +4 -3
- package/dist/channel.js +2 -1
- package/dist/codex-binary.js +2 -1
- package/dist/codex-wake.js +2 -1
- package/dist/cursor-receive.js +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/setup-node.d.ts +7 -0
- package/dist/setup-node.js +18 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.6
|
|
4
|
+
|
|
5
|
+
動いている最中にNodeが更新されて前の版の場所が消えると、Nodeを起こせなくなっていたのを直します。関数の名前・引数・返りの形、置き場の作り、符号は変わりません。
|
|
6
|
+
|
|
7
|
+
- **起きていた事。** 長く動くprocess(製品のMCP process)が、止まったCodexの会話を起こす見張り(`startCodexWakeWatch`)を起こす時、
|
|
8
|
+
Aitermの命令を起こす時(`findAitermDeliveryProvider`の`node`)、待ち受けの起動先を返す時(`channelReceiveProcess`・`cursorReceiveProcess`)に、
|
|
9
|
+
自分が起きた時のNodeの場所(`process.execPath`)を使っていた。Homebrewは版ごとの場所へ入れて、更新で前の版を消す。
|
|
10
|
+
2026-10-12にMacでNodeが26.10.0_1から26.11.1へ上がり、前から動いていたprocessが、無いNodeを指したまま黙って失敗していた。
|
|
11
|
+
- **足した関数。** `liveNodeExecutable(executable?, exists?)`。Homebrewの版つきの場所なら更新でも残る`opt`の場所、
|
|
12
|
+
それ以外で実体があればそのまま、実体が消えていればPATHから探させる`node`を返す。上の3か所と、Codexへ渡すPATH(`codexSpawnEnv`)が使う。
|
|
13
|
+
- **変わる値。** Homebrewの端末で、`channelReceiveProcess`・`cursorReceiveProcess`の`executable`と`findAitermDeliveryProvider`の`node`が、
|
|
14
|
+
`…/Cellar/node/<版>/bin/node`から`…/opt/node/bin/node`になる。ほかの端末では同じ値。
|
|
15
|
+
- **取り込む側。** 製品が自分でNodeの場所を控える時は、`setupNodeExecutable`(設定へ書く時)か`liveNodeExecutable`(動いている最中に使う時)を通す。
|
|
16
|
+
`process.execPath`や、linkをたどった先の場所を控えない。
|
|
17
|
+
|
|
3
18
|
## 0.4.5
|
|
4
19
|
|
|
5
20
|
待機や受信hookが、端末の全processの一覧を取り続けて端末を重くしていたのを直します。関数の名前・引数・返り、置き場の作り、符号は変わりません。
|
package/dist/aiterm-provider.js
CHANGED
|
@@ -7,6 +7,7 @@ import * as os from "node:os";
|
|
|
7
7
|
import * as path from "node:path";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
import { CodexDeliveryError } from "./errors.js";
|
|
10
|
+
import { liveNodeExecutable } from "./setup-node.js";
|
|
10
11
|
export const AITERM_PARENT_DELIVERY_SCHEMA = "aiterm.parent-delivery.v1";
|
|
11
12
|
export const AITERM_DELIVERY_PROVIDER_SCHEMA = "aiterm.delivery-provider.v1";
|
|
12
13
|
const recordSchema = z.object({
|
|
@@ -25,7 +26,7 @@ export function findAitermDeliveryProvider(options = {}) {
|
|
|
25
26
|
const explicit = options.cli ?? env.AITERM_PARENT_DELIVERY_CLI;
|
|
26
27
|
if (explicit) {
|
|
27
28
|
// 明示した場所が使えない時に、別の場所へ黙って移らない。
|
|
28
|
-
return path.isAbsolute(explicit) && isFile(explicit) ? { node: options.node ??
|
|
29
|
+
return path.isAbsolute(explicit) && isFile(explicit) ? { node: options.node ?? liveNodeExecutable(), cli: explicit, version: null, source: "explicit" } : null;
|
|
29
30
|
}
|
|
30
31
|
const home = options.home ?? env.HOME ?? os.homedir();
|
|
31
32
|
try {
|
|
@@ -40,14 +41,14 @@ export function findAitermDeliveryProvider(options = {}) {
|
|
|
40
41
|
// npmのshim(.cmd)と同じ場所のnode_modulesに本体がある。
|
|
41
42
|
const cli = path.join(directory, "node_modules", "aiterm-mcp", "dist", "parent-delivery-cli.js");
|
|
42
43
|
if (isFile(path.join(directory, "aiterm-parent-delivery.cmd")) && isFile(cli))
|
|
43
|
-
return { node: options.node ??
|
|
44
|
+
return { node: options.node ?? liveNodeExecutable(), cli, version: null, source: "path" };
|
|
44
45
|
continue;
|
|
45
46
|
}
|
|
46
47
|
const shim = path.join(directory, "aiterm-parent-delivery");
|
|
47
48
|
if (!isFile(shim))
|
|
48
49
|
continue;
|
|
49
50
|
try {
|
|
50
|
-
return { node: options.node ??
|
|
51
|
+
return { node: options.node ?? liveNodeExecutable(), cli: fs.realpathSync(shim), version: null, source: "path" };
|
|
51
52
|
}
|
|
52
53
|
catch { /* 壊れたlinkは飛ばす */ }
|
|
53
54
|
}
|
package/dist/channel.js
CHANGED
|
@@ -15,6 +15,7 @@ import { writeJson0600 } from "./files.js";
|
|
|
15
15
|
import { hookOwnerProcess, processExists, processIsRunning, readProcessIdentities, readProcessLineage } from "./process.js";
|
|
16
16
|
import { channelRoot } from "./profile.js";
|
|
17
17
|
import { SteerDeliveryError } from "./errors.js";
|
|
18
|
+
import { liveNodeExecutable } from "./setup-node.js";
|
|
18
19
|
import { submitCodexParentAnswer } from "./codex-receiver.js";
|
|
19
20
|
import { windowsStartProcessArgumentList } from "./windows.js";
|
|
20
21
|
const uuid = z.uuid();
|
|
@@ -494,7 +495,7 @@ export async function handleCursorChannelHook(profile, event, emit) {
|
|
|
494
495
|
}
|
|
495
496
|
// ---- 背景受信(Cursorのidle時、Grok等) ----
|
|
496
497
|
/** 親の背景process APIへそのまま渡す起動情報。scriptは製品のchannel受信入口の絶対path。 */
|
|
497
|
-
export function channelReceiveProcess(script, channelId, executable =
|
|
498
|
+
export function channelReceiveProcess(script, channelId, executable = liveNodeExecutable()) {
|
|
498
499
|
const args = [script, "--channel", uuid.parse(channelId)];
|
|
499
500
|
return { executable, args, windows_start_process_argument_list: process.platform === "win32" ? windowsStartProcessArgumentList(args) : null };
|
|
500
501
|
}
|
package/dist/codex-binary.js
CHANGED
|
@@ -6,6 +6,7 @@ import * as fs from "node:fs";
|
|
|
6
6
|
import * as os from "node:os";
|
|
7
7
|
import * as path from "node:path";
|
|
8
8
|
import { CodexDeliveryError, SetupError } from "./errors.js";
|
|
9
|
+
import { liveNodeExecutable } from "./setup-node.js";
|
|
9
10
|
import { writeHookJson } from "./files.js";
|
|
10
11
|
import { codexHookDirectory } from "./profile.js";
|
|
11
12
|
import { windowsPowerShellSync } from "./windows.js";
|
|
@@ -93,7 +94,7 @@ export function resolveCodexExecutable() {
|
|
|
93
94
|
* 無いと起きない(exit 127。素のsshの環境、製品の常駐process、アプリ配下のprocessはPATHが細い事がある)。
|
|
94
95
|
* このprocessを動かしているnodeの場所を、PATHに無い時だけ頭へ足した写しを返す。既にあれば、並びも中身も変えない。
|
|
95
96
|
*/
|
|
96
|
-
export function codexSpawnEnv(env = process.env, node =
|
|
97
|
+
export function codexSpawnEnv(env = process.env, node = liveNodeExecutable(), platform = process.platform) {
|
|
97
98
|
const windows = platform === "win32";
|
|
98
99
|
// Windowsの環境変数名は大文字小文字を区別しない(`Path`で入っている事が多い)。
|
|
99
100
|
const key = Object.keys(env).find(name => windows ? name.toLowerCase() === "path" : name === "PATH") ?? "PATH";
|
package/dist/codex-wake.js
CHANGED
|
@@ -11,6 +11,7 @@ import { z } from "zod";
|
|
|
11
11
|
import { codexHookDirectory } from "./profile.js";
|
|
12
12
|
import { withCodexReceiver } from "./codex-receiver.js";
|
|
13
13
|
import { writeHookJson } from "./files.js";
|
|
14
|
+
import { liveNodeExecutable } from "./setup-node.js";
|
|
14
15
|
import { windowsPowerShellSync } from "./windows.js";
|
|
15
16
|
const TAIL_FIRST_BYTES = 256 * 1024;
|
|
16
17
|
const TAIL_MAX_BYTES = 16 * 1024 * 1024;
|
|
@@ -267,7 +268,7 @@ export function startCodexWakeWatch(profile, parent, deliveryId, options = {}) {
|
|
|
267
268
|
return false;
|
|
268
269
|
const payload = JSON.stringify({ profile: serializeWakeProfile(profile), parent, delivery_id: deliveryId,
|
|
269
270
|
...(options.delay_ms === undefined ? {} : { delay_ms: options.delay_ms }) });
|
|
270
|
-
const child = spawn(
|
|
271
|
+
const child = spawn(liveNodeExecutable(), [entry], { detached: true, stdio: "ignore", windowsHide: true, env: { ...env, [CODEX_WAKE_PAYLOAD_ENV]: payload } });
|
|
271
272
|
child.on("error", () => { });
|
|
272
273
|
child.unref();
|
|
273
274
|
return true;
|
package/dist/cursor-receive.js
CHANGED
|
@@ -5,8 +5,9 @@ import * as net from "node:net";
|
|
|
5
5
|
import * as path from "node:path";
|
|
6
6
|
import { receiveCursorAnswer } from "./cursor-receiver.js";
|
|
7
7
|
import { windowsStartProcessArgumentList } from "./windows.js";
|
|
8
|
+
import { liveNodeExecutable } from "./setup-node.js";
|
|
8
9
|
/** 親の背景process APIへそのまま渡す起動情報。scriptは製品のCursor受信入口の絶対path。 */
|
|
9
|
-
export function cursorReceiveProcess(script, deliveryId, executable =
|
|
10
|
+
export function cursorReceiveProcess(script, deliveryId, executable = liveNodeExecutable()) {
|
|
10
11
|
const args = [script, "--delivery", deliveryId];
|
|
11
12
|
return {
|
|
12
13
|
executable,
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export * from "./errors.js";
|
|
|
3
3
|
export { writeJson0600, writeHookJson, waitForFileState, withoutBom } from "./files.js";
|
|
4
4
|
export { readRuntimeProcesses, readProcessIdentities, readProcessLineage, processExists, processIsRunning, parsePosixProcessTable, hookOwnerProcess, type RuntimeProcess, type NativeProcessIdentity } from "./process.js";
|
|
5
5
|
export { resolveWindowsPowerShell7, quotePowerShell, windowsPowerShellSync, windowsStartProcessArgumentList } from "./windows.js";
|
|
6
|
-
export { setupNodeExecutable } from "./setup-node.js";
|
|
6
|
+
export { setupNodeExecutable, liveNodeExecutable } from "./setup-node.js";
|
|
7
7
|
export { realCodexHome, resolveCodexExecutable, codexSpawnEnv, desktopBundledCodex, findDesktopBinary, findWindowsCodexCache, findWindowsCodexBinary, findLinuxDesktopBinary, findCliBinary, findSteerBinary, platformDesktopFinder, currentCodexDesktopBinary, type DesktopBinaryFinder, } from "./codex-binary.js";
|
|
8
8
|
export { codexHookConfigSchema, readCodexHookConfig, codexInputDirectory, hookInputSchema, answerDigest, registerCodexHookInput, finishCodexHookSubmission, codexHookDeliveryState, ownedCodexHooks, assertCodexHooksReady, assertCodexHookParentCurrent, type CodexHookConfig, } from "./codex-hook-state.js";
|
|
9
9
|
export { codexParentFromRequest, withCodexReceiver, verifyCodexParent, submitCodexParentAnswer, type CodexParent, type CodexParentThread, type CodexReceiverRuntime, } from "./codex-receiver.js";
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ export * from "./errors.js";
|
|
|
5
5
|
export { writeJson0600, writeHookJson, waitForFileState, withoutBom } from "./files.js";
|
|
6
6
|
export { readRuntimeProcesses, readProcessIdentities, readProcessLineage, processExists, processIsRunning, parsePosixProcessTable, hookOwnerProcess } from "./process.js";
|
|
7
7
|
export { resolveWindowsPowerShell7, quotePowerShell, windowsPowerShellSync, windowsStartProcessArgumentList } from "./windows.js";
|
|
8
|
-
export { setupNodeExecutable } from "./setup-node.js";
|
|
8
|
+
export { setupNodeExecutable, liveNodeExecutable } from "./setup-node.js";
|
|
9
9
|
export { realCodexHome, resolveCodexExecutable, codexSpawnEnv, desktopBundledCodex, findDesktopBinary, findWindowsCodexCache, findWindowsCodexBinary, findLinuxDesktopBinary, findCliBinary, findSteerBinary, platformDesktopFinder, currentCodexDesktopBinary, } from "./codex-binary.js";
|
|
10
10
|
export { codexHookConfigSchema, readCodexHookConfig, codexInputDirectory, hookInputSchema, answerDigest, registerCodexHookInput, finishCodexHookSubmission, codexHookDeliveryState, ownedCodexHooks, assertCodexHooksReady, assertCodexHookParentCurrent, } from "./codex-hook-state.js";
|
|
11
11
|
export { codexParentFromRequest, withCodexReceiver, verifyCodexParent, submitCodexParentAnswer, } from "./codex-receiver.js";
|
package/dist/setup-node.d.ts
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
1
|
export declare function setupNodeExecutable(executable?: string): string;
|
|
2
|
+
/**
|
|
3
|
+
* このprocessのNodeを、後からでも起こせる場所で返す。自分でNodeを起こす時と、呼び手へ「起こす先」として渡す時に使う。
|
|
4
|
+
* `process.execPath`は起きた時の実体で、長く動くprocessでは後から消える事がある(Homebrewは版ごとの場所へ入れ、更新で前の版を消す。
|
|
5
|
+
* 2026-10-12、MacでNodeが26.10.0_1から26.11.1へ上がり、前の版から起きていたprocessが、無いNodeを起こそうとして黙って失敗していた)。
|
|
6
|
+
* Homebrewの時は同じformulaのopt(更新でも残る)を返す。実体が消えていて代わりも無い時は、PATHから探させる(`node`)。
|
|
7
|
+
*/
|
|
8
|
+
export declare function liveNodeExecutable(executable?: string, exists?: (file: string) => boolean): string;
|
package/dist/setup-node.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { accessSync, constants } from "node:fs";
|
|
1
|
+
import { accessSync, constants, existsSync } from "node:fs";
|
|
2
2
|
import { SetupError } from "./errors.js";
|
|
3
|
+
const BREW_NODE = /^(.*)\/Cellar\/(node(?:@\d+)?)\/[^/]+\/bin\/node$/;
|
|
3
4
|
// HomebrewのCellar実体は更新で消える。保存する起動先には同じformulaのoptを使う。
|
|
4
5
|
export function setupNodeExecutable(executable = process.execPath) {
|
|
5
|
-
const brew =
|
|
6
|
+
const brew = BREW_NODE.exec(executable);
|
|
6
7
|
if (!brew)
|
|
7
8
|
return executable;
|
|
8
9
|
const node = `${brew[1]}/opt/${brew[2]}/bin/node`;
|
|
@@ -14,3 +15,18 @@ export function setupNodeExecutable(executable = process.execPath) {
|
|
|
14
15
|
}
|
|
15
16
|
return node;
|
|
16
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* このprocessのNodeを、後からでも起こせる場所で返す。自分でNodeを起こす時と、呼び手へ「起こす先」として渡す時に使う。
|
|
20
|
+
* `process.execPath`は起きた時の実体で、長く動くprocessでは後から消える事がある(Homebrewは版ごとの場所へ入れ、更新で前の版を消す。
|
|
21
|
+
* 2026-10-12、MacでNodeが26.10.0_1から26.11.1へ上がり、前の版から起きていたprocessが、無いNodeを起こそうとして黙って失敗していた)。
|
|
22
|
+
* Homebrewの時は同じformulaのopt(更新でも残る)を返す。実体が消えていて代わりも無い時は、PATHから探させる(`node`)。
|
|
23
|
+
*/
|
|
24
|
+
export function liveNodeExecutable(executable = process.execPath, exists = existsSync) {
|
|
25
|
+
const brew = BREW_NODE.exec(executable);
|
|
26
|
+
if (brew) {
|
|
27
|
+
const opt = `${brew[1]}/opt/${brew[2]}/bin/node`;
|
|
28
|
+
if (exists(opt))
|
|
29
|
+
return opt;
|
|
30
|
+
}
|
|
31
|
+
return exists(executable) ? executable : "node";
|
|
32
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aiterm-steer-delivery",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
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",
|