aiterm-mcp 0.70.65 → 0.70.66

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
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.70.66] - 2026-11-15
11
+
12
+ - A Claude seat on plan mode no longer waits for a person at the ExitPlanMode dialog "Ready to code?" (a141, Kiro's request). Every Claude seat's own settings now carry a `PermissionRequest` hook for `ExitPlanMode` only. The hook answers as option 1 ("Yes, and switch to BYPASS PERMISSIONS"): it allows the call with the call's own input and sets the session mode to `bypassPermissions`, which the seat already ran in. Claude Code 2.1.325 ignores an allow without the input for this tool, so the input is part of the answer. Any other tool, any other dialog (AskUserQuestion included), an unreadable input and a process outside an Aiterm seat get no decision and keep their screen. A seat already running keeps its old settings until it is resumed or relaunched; an Aiterm below 0.70.66 behaves as before (harness-contracts.md "ExitPlanModeの承認").
13
+
10
14
  ## [0.70.65] - 2026-11-15
11
15
 
12
16
  - A seat no longer stays unreachable after an idle stop that took effect but whose Aiterm process ended before it wrote `hibernated`. Anchor's seat bot-632c5d04 stayed in `stopping` from 05:11Z on 2026-11-15, so every send, `pty_close {hibernate:true}` and `pty_close` refused it, also across a body restart. Now the next send, dispatch, idle check, hibernate or close checks the stuck record. When the recorded pane process (pid and start identity) is gone and the native session is confirmed absent, Aiterm records it `hibernated`, as the interrupted stop would have, and the operation continues: a send resumes the same conversation, a close closes. A `stopping` record whose pane is still alive is left alone (lifecycle-state-ownership.md).
@@ -3510,7 +3514,8 @@ prototype (preserved under `prototype/python/` as the porting source and referen
3510
3514
  `ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
3511
3515
  provenance.
3512
3516
 
3513
- [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.65...HEAD
3517
+ [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.66...HEAD
3518
+ [0.70.66]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.65...v0.70.66
3514
3519
  [0.70.65]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.64...v0.70.65
3515
3520
  [0.70.64]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.63...v0.70.64
3516
3521
  [0.70.63]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.62...v0.70.63
package/README.ja.md CHANGED
@@ -215,7 +215,7 @@ runtime-error store は canonical dotagents config の `collection.enabled: true
215
215
  場合だけ収集し、既定OFF、network送信は行いません。tag起点CIのnpm provenance(OIDC Trusted
216
216
  Publishing)で公開し、GitHub Release が Official MCP Registry を再登録します。
217
217
 
218
- **状態:** 開発継続中 · 現行公開版 **v0.70.65** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
218
+ **状態:** 開発継続中 · 現行公開版 **v0.70.66** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
219
219
 
220
220
  ### 更新と巻き戻し
221
221
 
package/README.md CHANGED
@@ -227,7 +227,7 @@ collection is off by default and performs no network I/O. It ships via
227
227
  tag-triggered CI with npm provenance (OIDC Trusted Publishing); the GitHub
228
228
  Release re-registers the Official MCP Registry entry.
229
229
 
230
- **Status:** actively maintained · current public release **v0.70.65** · runs on Linux · WSL2 · macOS · native Windows (tmux on POSIX, the tmux-CLI-compatible [psmux](https://github.com/psmux/psmux) on native Windows — no WSL required) · MIT · see the [CHANGELOG](CHANGELOG.md).
230
+ **Status:** actively maintained · current public release **v0.70.66** · runs on Linux · WSL2 · macOS · native Windows (tmux on POSIX, the tmux-CLI-compatible [psmux](https://github.com/psmux/psmux) on native Windows — no WSL required) · MIT · see the [CHANGELOG](CHANGELOG.md).
231
231
 
232
232
  ### Update and rollback
233
233
 
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+ // Claude PermissionRequest hook for ExitPlanMode only (harness-contracts.md "ExitPlanModeの承認").
3
+ // The dialog "Ready to code?" would hold the seat's turn until a person picks 1: this answers it as option 1, the seat's own
4
+ // bypass mode. Anything that does not match exactly prints nothing and exits 0, so Claude Code keeps asking as before.
5
+ const MAX_STDIN_BYTES = 8 * 1024 * 1024;
6
+ const AITERM_ENV = ["AITERM_AGENT_KIND", "AITERM_SESSION_ID", "AITERM_AGENT_SESSION_ID", "AITERM_AGENT_LAUNCH_ID"];
7
+ async function readStdin() {
8
+ const chunks = [];
9
+ let total = 0;
10
+ for await (const chunk of process.stdin) {
11
+ const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk));
12
+ total += bytes.length;
13
+ if (total > MAX_STDIN_BYTES)
14
+ return "";
15
+ chunks.push(bytes);
16
+ }
17
+ return Buffer.concat(chunks).toString("utf8");
18
+ }
19
+ export function planApproval(payload, env = process.env) {
20
+ const input = payload;
21
+ // Claude Code 2.1.325 ignores a bare "allow" for ExitPlanMode (a tool that needs the user's own answer): the decision
22
+ // must carry updatedInput, the call's own input unchanged (verified on a real seat, a141).
23
+ if (!input || typeof input !== "object" || input.hook_event_name !== "PermissionRequest" || input.tool_name !== "ExitPlanMode"
24
+ || typeof input.tool_input?.plan !== "string" || !AITERM_ENV.some(name => env[name]))
25
+ return null;
26
+ return { hookSpecificOutput: { hookEventName: "PermissionRequest", decision: { behavior: "allow", updatedInput: input.tool_input,
27
+ updatedPermissions: [{ type: "setMode", mode: "bypassPermissions", destination: "session" }] } } };
28
+ }
29
+ async function main() {
30
+ let payload = null;
31
+ try {
32
+ payload = JSON.parse(await readStdin());
33
+ }
34
+ catch { /* not JSON: no decision */ }
35
+ const decision = planApproval(payload);
36
+ if (decision)
37
+ process.stdout.write(JSON.stringify(decision) + "\n");
38
+ }
39
+ // Run only as the hook entry; importing it (tests) has no effect.
40
+ if (process.argv[1] && /claude-plan-approve-hook\.js$/.test(process.argv[1]))
41
+ await main();
@@ -76,6 +76,9 @@ export function agentClaudeDispatchReceiptPath(name, launchId, operationId) {
76
76
  const validated = validateOperationId(operationId);
77
77
  return path.join(agentsDir(), `${name}.${launchId}.${validated.slice("sha256:".length)}.claude-dispatch`);
78
78
  }
79
+ function claudePlanApproveScriptPath() {
80
+ return path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "claude-plan-approve-hook.js");
81
+ }
79
82
  function claudeHookScriptPath() {
80
83
  // この module は dist/harnesses/ に置かれるが、stop hook 実体は dist/ 直下に build される。
81
84
  return path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "claude-stop-hook.js");
@@ -98,6 +101,10 @@ export function createClaudeCorrelationSettings(name, launchId, model, effort) {
98
101
  if (!fs.existsSync(hookScript)) {
99
102
  throw new AitermError(`Claude Stop hook wrapper が見つかりません。npm run build を実行してください: ${hookScript}`, 2);
100
103
  }
104
+ const planScript = claudePlanApproveScriptPath();
105
+ if (!fs.existsSync(planScript)) {
106
+ throw new AitermError(`Claude plan approve hook が見つかりません。npm run build を実行してください: ${planScript}`, 2);
107
+ }
101
108
  const settings = agentManagedClaudeSettingsPath(name, launchId);
102
109
  writeJson0600(settings, {
103
110
  ...(model ? { model } : {}),
@@ -117,6 +124,10 @@ export function createClaudeCorrelationSettings(name, launchId, model, effort) {
117
124
  ],
118
125
  },
119
126
  ],
127
+ // The ExitPlanMode dialog ("Ready to code?") holds a seat's turn for a person; answer it as option 1 (harness-contracts.md).
128
+ PermissionRequest: [
129
+ { matcher: "ExitPlanMode", hooks: [{ type: "command", command: nodeHookCommand(planScript), timeout: 10 }] },
130
+ ],
120
131
  },
121
132
  });
122
133
  return settings;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-mcp",
3
- "version": "0.70.65",
3
+ "version": "0.70.66",
4
4
  "mcpName": "io.github.kitepon/aiterm-mcp",
5
5
  "description": "Persistent terminal MCP with one harness-based launcher for Claude Code, Codex CLI, Grok CLI, Cursor Agent CLI, and Antigravity CLI, plus durable PTYs for SSH, containers, and REPLs.",
6
6
  "keywords": [