aiterm-mcp 0.70.20 → 0.70.21

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.21] - 2026-11-11
11
+
12
+ - A terminal's seat MCP forward no longer goes down a few seconds after a launch. The `ssh -R` keeper ran inside the MCP process that handled the launch; BellTeam launches through a one-shot Aiterm, so the forward died when that process ended and stayed refused until another process's 60-second check (about 45 s in a lab run). A seat whose Claude was still connecting its MCP servers then, or that started in that window, lost its tools for good. The forward is now held by a detached keeper process (`aiterm-remote-terminal forward-keeper --ref R`) that lives while the forward is needed; MCP processes only start it when no live keeper holds the lock.
13
+
10
14
  ## [0.70.20] - 2026-11-11
11
15
 
12
16
  - `agent_auth` (claude-code) takes `login: "oauth_token"` with `token_file` (only `<HOME>/.bellteam-accounts/claude/<slot>/oauth-token`; any other path is `AGENT_AUTH_TOKEN_FILE_REJECTED` before anything starts). `start` always runs `claude setup-token` (under `configuration_root`, same `auth_ui` stages, binding and `respond`), and Aiterm writes the printed token to `token_file` as the seat user, 0600, through a temp file, fsync and rename; the pane's history and screen are then cleared. The token is never in a receipt, `auth_ui`, a log, env or argv. Failure or cancel writes nothing. `status` in this mode reports `authenticated` only for a non-empty 0600 regular file of the user and never reads `.credentials.json`. Receipts echo `login: "oauth_token"`, so a caller can refuse an older Aiterm that would run `claude auth login` instead.
@@ -3283,7 +3287,8 @@ prototype (preserved under `prototype/python/` as the porting source and referen
3283
3287
  `ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
3284
3288
  provenance.
3285
3289
 
3286
- [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.20...HEAD
3290
+ [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.21...HEAD
3291
+ [0.70.21]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.20...v0.70.21
3287
3292
  [0.70.20]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.19...v0.70.20
3288
3293
  [0.70.19]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.18...v0.70.19
3289
3294
  [0.70.18]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.17...v0.70.18
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.20** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
218
+ **状態:** 開発継続中 · 現行公開版 **v0.70.21** · 動作対象は 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.20** · 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.21** · 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
 
@@ -12,7 +12,7 @@ import { createRequire } from "node:module";
12
12
  import { z } from "zod";
13
13
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
14
14
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
15
- import { REMOTE_COMMAND_OPS, RemoteTerminalConnection, RemoteTerminalError, bindingStatus, confirmHostKey, loadCredential, registerBinding } from "./remote-terminal.js";
15
+ import { REMOTE_COMMAND_OPS, RemoteTerminalConnection, RemoteTerminalError, bindingStatus, confirmHostKey, loadCredential, registerBinding, runForwardKeeper } from "./remote-terminal.js";
16
16
  import { readCompletedTranscript } from "./transcript-read.js";
17
17
  import { credentialHandleSchema, terminalOsSchema } from "./remote-contract.js";
18
18
  import { inspectPath, listDirectories, makeDirectory } from "./remote-path.js";
@@ -118,6 +118,9 @@ export function main(args) {
118
118
  const [command, ...rest] = args;
119
119
  if (command === "serve")
120
120
  return serve();
121
+ // Started detached by Aiterm itself (remote-terminal.md forward keeper); not an operator command.
122
+ if (command === "forward-keeper")
123
+ return runForwardKeeper(option(rest, "--ref") ?? "");
121
124
  if (command === "status")
122
125
  return oneShot(() => bindingStatus(option(rest, "--ref") ?? ""), "aiterm.remote-binding-error.v1");
123
126
  if (command === "register")
@@ -7,12 +7,14 @@ import * as os from "node:os";
7
7
  import * as path from "node:path";
8
8
  import { createHash, randomUUID } from "node:crypto";
9
9
  import { createRequire } from "node:module";
10
+ import { fileURLToPath } from "node:url";
10
11
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
11
12
  import { ReadBuffer, serializeMessage } from "@modelcontextprotocol/sdk/shared/stdio.js";
12
13
  import { ensureStateRoot, writeJson0600 } from "./agent-shared.js";
13
14
  import { powershellForShell, remotePlatform, remoteShell, terminalCommand, terminalProgram } from "./remote.js";
14
15
  import { PRIVATE_ENV_SCHEMA } from "./private-env.js";
15
16
  import { checkRemotePath } from "./remote-path.js";
17
+ import { liveNodeExecutable } from "./live-node.js";
16
18
  const pkg = createRequire(import.meta.url)("../package.json");
17
19
  export class RemoteTerminalError extends Error {
18
20
  code;
@@ -927,7 +929,50 @@ function storedIngress(ref) {
927
929
  return undefined;
928
930
  }
929
931
  }
932
+ // Only the detached keeper process (`forward-keeper --ref R`) holds the ssh. BellTeam launches through a one-shot Aiterm,
933
+ // and a forward held there died with it right after the launch (lab 2026-11-11: ~45 s refused until a 60 s check).
934
+ let keeperProcess = false;
935
+ const startedKeepers = new Map();
936
+ const KEEPER_CLI = new URL("./remote-terminal-cli.js", import.meta.url);
937
+ function startForwardKeeper(ref) {
938
+ if (!forwardNeeded(ref)) {
939
+ releaseIdleCredential(ref);
940
+ return;
941
+ }
942
+ const owner = lockOwner(ref);
943
+ if (owner && ownerAlive(owner))
944
+ return;
945
+ const started = startedKeepers.get(ref); // one keeper per process at a time, while it takes the lock
946
+ if (started && started.exitCode === null && started.signalCode === null)
947
+ return;
948
+ const child = spawn(liveNodeExecutable(), [fileURLToPath(KEEPER_CLI), "forward-keeper", "--ref", ref], { detached: true, stdio: "ignore", env: process.env, windowsHide: true });
949
+ child.on("error", () => { /* exitCode stays null: clear it so the next check starts another */ startedKeepers.delete(ref); });
950
+ child.unref();
951
+ startedKeepers.set(ref, child);
952
+ }
953
+ /** `aiterm-remote-terminal forward-keeper --ref R`: hold R's forward while it is needed; exit when this process has nothing to hold. */
954
+ export function runForwardKeeper(ref) {
955
+ binding(ref);
956
+ keeperProcess = true;
957
+ keeperHold = setInterval(() => { keep(ref); settleKeeper(ref); }, 5_000);
958
+ keep(ref);
959
+ settleKeeper(ref);
960
+ }
961
+ let keeperHold = null;
962
+ /** The keeper process ends (its loop stops, nothing else holds it) once it has no forward, timer, probe or lock. */
963
+ function settleKeeper(ref) {
964
+ const keeper = keepers.get(ref);
965
+ if (!keeperHold || (keeper && (keeper.child || keeper.timer || keeper.starting || Number(lockOwner(ref)?.pid) === process.pid)))
966
+ return;
967
+ clearInterval(keeperHold);
968
+ keeperHold = null;
969
+ keepers.delete(ref);
970
+ }
930
971
  function keep(ref) {
972
+ if (!keeperProcess) {
973
+ startForwardKeeper(ref);
974
+ return;
975
+ }
931
976
  const keeper = keepers.get(ref) ?? { child: null, ingress: 0, refusals: 0, timer: null };
932
977
  keepers.set(ref, keeper);
933
978
  if (keeper.child) {
@@ -1022,6 +1067,7 @@ function keep(ref) {
1022
1067
  again();
1023
1068
  else
1024
1069
  keep(ref);
1070
+ settleKeeper(ref);
1025
1071
  });
1026
1072
  }, () => { keeper.starting = false; again(); });
1027
1073
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-mcp",
3
- "version": "0.70.20",
3
+ "version": "0.70.21",
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": [