aiterm-mcp 0.70.32 → 0.70.33

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,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.70.33] - 2026-11-12
11
+
12
+ - `agent_launch` with `fork_from` works on a closed main seat (ADR 0140). Closing a seat used to delete its launch record, so a fork of a Bot whose seat BellTeam had idle-closed was refused with `FORK_SOURCE_UNAVAILABLE` ("no managed seat of this harness") although the conversation was saved. Closing a Claude Code or Codex seat now leaves `<seat>.fork-source.json` in Aiterm's state (0600: kind, cwd, last conversation ID, Claude root or Codex rollout). The fork reads it and never wakes the main. The file is replaced at the next close of that name and removed after 30 days. A seat closed before this version has no such file. If the saved conversation is gone, the refusal is still `FORK_SOURCE_UNAVAILABLE`.
13
+ - A local or `remote` `agent_launch` refusal now carries `_meta["aiterm/error_code"]` (for example `FORK_SOURCE_UNAVAILABLE`, `FORK_INVALID`, `READONLY_UNENFORCEABLE`), as terminal launches already did. The text is unchanged.
14
+
10
15
  ## [0.70.32] - 2026-11-12
11
16
 
12
17
  - `agent_goal` on a Claude Code seat on Windows no longer fails with `native_goal_status_input_unconfirmed` right after pasting `/goal`. On Windows, Claude draws the slash-command menu (whose first row also starts with `❯`) under the composer's bottom rule, and Aiterm took that menu row for the composer. The composer is now the lowest `❯` row framed by a rule above and below. Measured on fox with Claude Code 2.1.322.
@@ -3337,7 +3342,8 @@ prototype (preserved under `prototype/python/` as the porting source and referen
3337
3342
  `ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
3338
3343
  provenance.
3339
3344
 
3340
- [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.32...HEAD
3345
+ [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.33...HEAD
3346
+ [0.70.33]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.32...v0.70.33
3341
3347
  [0.70.32]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.31...v0.70.32
3342
3348
  [0.70.31]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.30...v0.70.31
3343
3349
  [0.70.30]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.29...v0.70.30
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.32** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
218
+ **状態:** 開発継続中 · 現行公開版 **v0.70.33** · 動作対象は 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.32** · 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.33** · 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
 
package/dist/core.js CHANGED
@@ -357,12 +357,56 @@ export function windowsLaunchTyped(name, launchId, full) {
357
357
  writeText0600(file, full);
358
358
  return windowsLaunchIndirection(file);
359
359
  }
360
+ const FORK_SOURCE_DAYS = 30; // Claude's own transcript retention default (cleanupPeriodDays)
361
+ function forkSourcePath(dir, name) { return path.join(dir, `${name}.fork-source.json`); }
362
+ /** ADR 0140: a closed main's last conversation, so a fork never needs the main woken. Never a resume or send authority. */
363
+ function saveForkSource(dir, name) {
364
+ const meta = tryLoadAgentMetadata(name);
365
+ if (!meta || (meta.kind !== "claude" && meta.kind !== "codex") || !meta.cwd)
366
+ return;
367
+ let rollout = null;
368
+ try {
369
+ rollout = meta.kind === "codex" ? codexRootTranscript(meta) : null;
370
+ }
371
+ catch {
372
+ rollout = null;
373
+ }
374
+ const vendor = meta.kind === "codex" ? (rollout ? codexRolloutSessionId(meta, rollout) : null) : meta.vendor_session_id;
375
+ if (!vendor || (meta.kind === "claude" && !meta.claude_home))
376
+ return;
377
+ const source = { kind: meta.kind, cwd: meta.cwd, vendor_session_id: vendor,
378
+ ...(meta.kind === "claude" ? { claude_home: meta.claude_home } : { rollout: rollout }) };
379
+ writeText0600(forkSourcePath(dir, name), JSON.stringify(source));
380
+ const stale = Date.now() - FORK_SOURCE_DAYS * 86_400_000;
381
+ for (const f of fs.readdirSync(dir))
382
+ if (f.endsWith(".fork-source.json"))
383
+ try {
384
+ if (fs.statSync(path.join(dir, f)).mtimeMs < stale)
385
+ fs.unlinkSync(path.join(dir, f));
386
+ }
387
+ catch { /* another close removed it */ }
388
+ }
389
+ function readForkSource(name) {
390
+ const dir = existingAgentsDir();
391
+ try {
392
+ const v = dir ? JSON.parse(fs.readFileSync(forkSourcePath(dir, name), "utf8")) : null;
393
+ return v && (v.kind === "claude" || v.kind === "codex") && typeof v.cwd === "string" && typeof v.vendor_session_id === "string"
394
+ && (v.kind === "claude" ? typeof v.claude_home === "string" : typeof v.rollout === "string") ? v : null;
395
+ }
396
+ catch {
397
+ return null;
398
+ }
399
+ }
360
400
  function cleanupAgentState(name) {
361
401
  assertSessionName(name);
362
402
  agentMetadataNegativeCache.delete(name);
363
403
  const dir = existingAgentsDir();
364
404
  if (!dir)
365
405
  return;
406
+ try {
407
+ saveForkSource(dir, name);
408
+ }
409
+ catch { /* best-effort like the cleanup below: a missing copy only refuses a later fork */ }
366
410
  const prefix = `${name}.`;
367
411
  try {
368
412
  for (const f of fs.readdirSync(dir)) {
@@ -8233,21 +8277,26 @@ export function resolveForkSource(kind, from, opts, probe = probeWriteBan) {
8233
8277
  throw new AitermError(`FORK_INVALID: session_name ${opts.session_name} already names a seat`, 2);
8234
8278
  assertSessionName(from.session_id);
8235
8279
  const unavailable = (why) => new AitermError(`FORK_SOURCE_UNAVAILABLE: ${from.session_id}: ${why}`, 2);
8236
- const main = tryLoadAgentMetadata(from.session_id);
8280
+ const live = tryLoadAgentMetadata(from.session_id);
8281
+ // A closed main is read from the copy its close left; it is not woken (ADR 0140).
8282
+ const main = live ?? readForkSource(from.session_id);
8237
8283
  if (!main || main.kind !== kind || !main.cwd)
8238
- throw unavailable("no managed seat of this harness");
8284
+ throw unavailable("no managed seat of this harness and no saved conversation from its close");
8239
8285
  // Codex binds its conversation lazily and may switch it (/new): read the current one without writing the main's record.
8240
8286
  let rollout = null;
8241
- try {
8242
- rollout = main.kind === "codex" ? codexRootTranscript(main) : null;
8243
- }
8244
- catch {
8245
- rollout = null;
8246
- }
8247
- const mainVendorId = main.kind === "codex" ? (rollout ? codexRolloutSessionId(main, rollout) : null) : main.vendor_session_id;
8287
+ if (live)
8288
+ try {
8289
+ rollout = live.kind === "codex" ? codexRootTranscript(live) : null;
8290
+ }
8291
+ catch {
8292
+ rollout = null;
8293
+ }
8294
+ else
8295
+ rollout = main.rollout ?? null;
8296
+ const mainVendorId = !live ? main.vendor_session_id : live.kind === "codex" ? (rollout ? codexRolloutSessionId(live, rollout) : null) : live.vendor_session_id;
8248
8297
  if (!mainVendorId || (main.kind === "claude" ? !main.claude_home
8249
- || !fs.existsSync(path.join(main.claude_home, "projects", claudeProjectSlug(main.cwd), `${mainVendorId}.jsonl`)) : !rollout))
8250
- throw unavailable("the saved conversation file does not exist yet");
8298
+ || !fs.existsSync(path.join(main.claude_home, "projects", claudeProjectSlug(main.cwd), `${mainVendorId}.jsonl`)) : !rollout || !fs.existsSync(rollout)))
8299
+ throw unavailable(live ? "the saved conversation file does not exist yet" : "the closed seat's saved conversation file no longer exists");
8251
8300
  if (opts.cwd != null && (!fs.existsSync(opts.cwd) || fs.realpathSync(opts.cwd) !== fs.realpathSync(main.cwd)))
8252
8301
  throw new AitermError("FORK_INVALID: a fork runs in its main seat's cwd; omit cwd", 2);
8253
8302
  // The main's cwd is the project folder the Owner forbade writing (ADR 0140).
package/dist/index.js CHANGED
@@ -1473,7 +1473,7 @@ export function createAitermServer(options = {}) {
1473
1473
  },
1474
1474
  };
1475
1475
  }
1476
- return fail(e);
1476
+ return withErrorCode(fail(e));
1477
1477
  }
1478
1478
  }
1479
1479
  function registerAgentTool(toolName, kind, desc) {
@@ -1618,10 +1618,10 @@ export function createAitermServer(options = {}) {
1618
1618
  if (!remote)
1619
1619
  return launchAgent(kindForHarness(harness), args, extra);
1620
1620
  try {
1621
- return await launchRemoteAgent(acceptRemote(remote), harness, args, extra);
1621
+ return withErrorCode(await launchRemoteAgent(acceptRemote(remote), harness, args, extra));
1622
1622
  }
1623
1623
  catch (e) {
1624
- return fail(e);
1624
+ return withErrorCode(fail(e));
1625
1625
  }
1626
1626
  });
1627
1627
  registerAgentTool("claude_agent", "claude", "【旧互換alias。新規連携は agent_launch(harness=claude-code)】Claude Codeの対話エージェントTUIを永続端末に起動する。`claude -p`ではなく、" +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-mcp",
3
- "version": "0.70.32",
3
+ "version": "0.70.33",
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": [