aiterm-steer-delivery 0.1.8 → 0.1.9

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,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.9
4
+
5
+ - `waitProcessCommandLine`を公開する(Aitermから移した)。`cursorReceiveProcess`・`channelReceiveProcess`の起動情報を、親のshellへ書ける1行にする(POSIXはsh、Windowsは既定のPowerShell)。Cursor CLIのmodelはtool結果のstructuredContentを読まないので、Cursor・Grokの親には背景で受信を起動するコマンドをtool結果の本文に書く必要がある(ラプラス氏の依頼、決裁箱のコネクタで使う)。
3
6
  ## 0.1.8
4
7
 
5
8
  - `runCursorHookMain`・`runCursorReceiveMain`・`runCursorReceive`が置き場を複数受け取れる。Cursor CLIはMCPを削った環境(XDG_RUNTIME_DIR・TMPDIR等が無い)で起動し、hookと背景processは画面側の環境で起動する。環境から置き場を決める製品(Aiterm)はMCPとhookで置き場が割れ、hookが配送記録を見つけられずに何もしていなかった(rabbit・macbookで確認)。hookは渡した置き場それぞれで結び付けと差し込みを行い、受信は配送記録のある置き場で待つ。配送記録の無い置き場には何も作らない。
package/README.md CHANGED
@@ -38,6 +38,8 @@ steer.channelDeliveryState(PROFILE, channel.channel_id, id); // queued | sending
38
38
 
39
39
  Claude Code re-arms its waiter at every `Stop`. Cursor binds the channel with `steer.channelMarker(channel)` placed in your tool result, and idle Cursor/Grok parents run `steer.channelReceiveProcess(...)` in the background; each result carries `next_wait_process` to re-arm.
40
40
 
41
+ Put both the marker and the receiver command in the **text** of your tool result, not only in `structuredContent`: the Cursor CLI model does not read structured content. `steer.waitProcessCommandLine(steer.channelReceiveProcess(script, channel.channel_id))` gives the command as one shell line (POSIX sh, or PowerShell on Windows).
42
+
41
43
  ## Product profile
42
44
 
43
45
  Everything product-specific lives in one object. The delivery mechanism is the same for every product.
@@ -5,6 +5,14 @@ export interface WaitProcess {
5
5
  }
6
6
  /** 親の背景process APIへそのまま渡す起動情報。scriptは製品のCursor受信入口の絶対path。 */
7
7
  export declare function cursorReceiveProcess(script: string, deliveryId: string, executable?: string): WaitProcess;
8
+ /**
9
+ * 背景processの起動情報を、親のshellへ書ける1行にする(Windowsの既定shellはPowerShell)。
10
+ * Cursor CLIのmodelはtool結果のstructuredContentを読まないので、起動情報は本文にこの行で書く。
11
+ */
12
+ export declare function waitProcessCommandLine(wait: {
13
+ executable: string;
14
+ args: readonly string[];
15
+ }, platform?: NodeJS.Platform): string;
8
16
  /** 受信入口の本体。結果を1行のJSONでstdoutへ出し、exit codeを返す(0=受取、3=期限切れ、1=誤り)。
9
17
  * hookRootを複数渡すと、配送記録のある置き場で待つ(runCursorHookMainと同じ理由)。どこにも無ければ先頭の置き場で誤りを返す。 */
10
18
  export declare function runCursorReceive(hookRoot: string | readonly string[], argv: string[], emit?: (value: unknown) => void, usage?: string): Promise<number>;
@@ -13,6 +13,16 @@ export function cursorReceiveProcess(script, deliveryId, executable = process.ex
13
13
  windows_start_process_argument_list: process.platform === "win32" ? windowsStartProcessArgumentList(args) : null,
14
14
  };
15
15
  }
16
+ /**
17
+ * 背景processの起動情報を、親のshellへ書ける1行にする(Windowsの既定shellはPowerShell)。
18
+ * Cursor CLIのmodelはtool結果のstructuredContentを読まないので、起動情報は本文にこの行で書く。
19
+ */
20
+ export function waitProcessCommandLine(wait, platform = process.platform) {
21
+ const values = [wait.executable, ...wait.args];
22
+ if (platform === "win32")
23
+ return `& ${values.map(value => `'${value.replace(/'/g, "''")}'`).join(" ")}`;
24
+ return values.map(value => `'${value.replace(/'/g, "'\\''")}'`).join(" ");
25
+ }
16
26
  /** 受信入口の本体。結果を1行のJSONでstdoutへ出し、exit codeを返す(0=受取、3=期限切れ、1=誤り)。
17
27
  * hookRootを複数渡すと、配送記録のある置き場で待つ(runCursorHookMainと同じ理由)。どこにも無ければ先頭の置き場で誤りを返す。 */
18
28
  export async function runCursorReceive(hookRoot, argv, emit = value => { process.stdout.write(JSON.stringify(value) + "\n"); }, usage = "usage: cursor-parent-receive --delivery <uuid>") {
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ export { runCodexResultHook } from "./codex-hooks.js";
11
11
  export { codexHookCommand, processCodexHome, mergeCodexParentHooks, planCodexParentHooks, writeCodexHookPlan, applyCodexHookPlan, verifyCodexHookRegistration, configureCodexSteer, type CodexHookMove, type CodexHookPlan, type CodexSteerAction, type CodexSteerResult, type CodexSteerRuntime, } from "./codex-setup.js";
12
12
  export { claudeParentSchema, prepareClaudeHookRequest, claudeParentFromRequest, verifyClaudeParent, bindClaudeParentDelivery, closeClaudeParentSession, submitClaudeParentAnswer, runClaudeResultHook, type ClaudeParent, } from "./claude-receiver.js";
13
13
  export { cursorParentSchema, isCursorMcpClient, cursorHooksFile, cursorParentHooksRegistered, verifyCursorParent, cursorParentFromRequest, prepareCursorDelivery, submitCursorParentAnswer, handleCursorHook, receiveCursorAnswer, type CursorParent, type CursorReceiveResult, } from "./cursor-receiver.js";
14
- export { cursorReceiveProcess, runCursorReceive, type WaitProcess } from "./cursor-receive.js";
14
+ export { cursorReceiveProcess, runCursorReceive, waitProcessCommandLine, type WaitProcess } from "./cursor-receive.js";
15
15
  export { claudeParentHookEntries, mergeClaudeParentHooks, removeClaudeParentHooks, cursorParentHookCommand, mergeCursorParentHooks, removeCursorParentHooks, type HookRuntime, } from "./hook-setup.js";
16
16
  export { runCodexHookMain, runClaudeHookMain, runCursorHookMain, runCursorReceiveMain, isDirectExecution } from "./hook-main.js";
17
17
  export { runChannelReceiveMain } from "./hook-main.js";
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ export { runCodexResultHook } from "./codex-hooks.js";
13
13
  export { codexHookCommand, processCodexHome, mergeCodexParentHooks, planCodexParentHooks, writeCodexHookPlan, applyCodexHookPlan, verifyCodexHookRegistration, configureCodexSteer, } from "./codex-setup.js";
14
14
  export { claudeParentSchema, prepareClaudeHookRequest, claudeParentFromRequest, verifyClaudeParent, bindClaudeParentDelivery, closeClaudeParentSession, submitClaudeParentAnswer, runClaudeResultHook, } from "./claude-receiver.js";
15
15
  export { cursorParentSchema, isCursorMcpClient, cursorHooksFile, cursorParentHooksRegistered, verifyCursorParent, cursorParentFromRequest, prepareCursorDelivery, submitCursorParentAnswer, handleCursorHook, receiveCursorAnswer, } from "./cursor-receiver.js";
16
- export { cursorReceiveProcess, runCursorReceive } from "./cursor-receive.js";
16
+ export { cursorReceiveProcess, runCursorReceive, waitProcessCommandLine } from "./cursor-receive.js";
17
17
  export { claudeParentHookEntries, mergeClaudeParentHooks, removeClaudeParentHooks, cursorParentHookCommand, mergeCursorParentHooks, removeCursorParentHooks, } from "./hook-setup.js";
18
18
  export { runCodexHookMain, runClaudeHookMain, runCursorHookMain, runCursorReceiveMain, isDirectExecution } from "./hook-main.js";
19
19
  export { runChannelReceiveMain } from "./hook-main.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-steer-delivery",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
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",