aiterm-mcp 0.69.0 → 0.70.1
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 +13 -1
- package/README.ja.md +2 -2
- package/README.md +2 -2
- package/dist/core.js +3 -2
- package/dist/harnesses/claude.js +13 -2
- package/dist/index.js +6 -4
- package/dist/remote-path.js +49 -4
- package/dist/remote-terminal-cli.js +6 -4
- package/dist/remote-terminal.js +29 -1
- package/dist/setup.js +6 -3
- package/dist/terminal-launch-error.js +57 -0
- package/docs/DESIGN.md +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.70.1] - 2026-11-10
|
|
11
|
+
|
|
12
|
+
- Claude Code's "Updates to Consumer Terms and Policies" screen (2.1.318, grove) is classified as `blocked` / `vendor_onboarding_required` instead of `unrecognized_screen`, so a launch stops with the plain hint instead of waiting it out. Aiterm never answers it: the terms and the model-training choice belong to the account holder.
|
|
13
|
+
- The setup and runtime probe (`aiterm setup`, `aiterm-remote-terminal runtime-smoke`) starts its `aiterm-mcp` with the caller's whole environment, so it opens its terminal in the same `TMPDIR` socket directory as the caller's seats, and a failed probe keeps the tool's own error text. Without `TMPDIR` the probe used `/tmp/claude-tmux-sockets`, which another user of the same Mac may own.
|
|
14
|
+
- A Claude `auth status --json` preflight that does not finish in 5 seconds no longer refuses the launch (`CLAUDE_AUTH_STATUS_TIMEOUT`): the launch goes on, and a logged-out Claude stops at its login screen as `vendor_onboarding_required` (ADR 0020 addendum). A Mac seat failed this way 22 s after Claude Code updated itself to 2.1.322, under load average ~700, while `auth status` answered `loggedIn: true` in 0.75 s afterwards. `loggedIn: false`, malformed output and a failed exit still refuse before any session exists. The terminal needs this release.
|
|
15
|
+
## [0.70.0] - 2026-11-10
|
|
16
|
+
|
|
17
|
+
- `remote_terminal_command` takes `list_dirs` with an optional absolute `path` for a folder picker (BellTeam PR 887 S6; docs/architecture/remote-terminal.md R15). Without `path` it lists the SSH user's home. Result `{op, home, path, exists, directory, entries: [{name}] | null, truncated}`: subfolders only (a symlink to a folder counts), no names starting with `.`, ordered by name, at most 500 then `truncated: true`, read only. A missing folder or a file answers `exists`/`directory` false with `entries: null`, never an empty list; permission refusals (macOS privacy consent included) answer `FOLDER_NOT_PERMITTED` as for `path_status`. Needs this release on the terminal (`REMOTE_AITERM_TOO_OLD` otherwise).
|
|
18
|
+
- A terminal launch refused before any seat exists carries `_meta["aiterm/launch_error"]` (`aiterm.agent-launch-error.v1`, `phase: "terminal"`, `effect: "not_started"`) with its code and a fixed plain Japanese `action` for the Owner (BellTeam seatLaunch; remote-terminal.md R18). Server-side only; the terminal needs no update. A possibly started launch keeps the plain text. The terminal's Claude authentication refusal is now returned as an error with its structure instead of continuing as a launch result.
|
|
19
|
+
|
|
10
20
|
## [0.69.0] - 2026-11-10
|
|
11
21
|
|
|
12
22
|
- Terminal self-service before a seat can open (docs/architecture/remote-terminal.md R14-R17; BellTeam PR 854 S2-S5).
|
|
@@ -3153,7 +3163,9 @@ prototype (preserved under `prototype/python/` as the porting source and referen
|
|
|
3153
3163
|
`ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
|
|
3154
3164
|
provenance.
|
|
3155
3165
|
|
|
3156
|
-
[Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.
|
|
3166
|
+
[Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.1...HEAD
|
|
3167
|
+
[0.70.1]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.0...v0.70.1
|
|
3168
|
+
[0.70.0]: https://github.com/kitepon/aiterm-mcp/compare/v0.69.0...v0.70.0
|
|
3157
3169
|
[0.69.0]: https://github.com/kitepon/aiterm-mcp/compare/v0.68.1...v0.69.0
|
|
3158
3170
|
[0.68.1]: https://github.com/kitepon/aiterm-mcp/compare/v0.68.0...v0.68.1
|
|
3159
3171
|
[0.68.0]: https://github.com/kitepon/aiterm-mcp/compare/v0.67.0...v0.68.0
|
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.
|
|
218
|
+
**状態:** 開発継続中 · 現行公開版 **v0.70.1** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
|
|
219
219
|
|
|
220
220
|
### 更新と巻き戻し
|
|
221
221
|
|
|
@@ -760,7 +760,7 @@ Cursor親(`clientInfo.name`が`cursor-vscode`)も同じ完了観測と本文
|
|
|
760
760
|
Claudeをリンク経由の`cwd`から起動した場合も、実体パスに対応する会話記録を参照する。
|
|
761
761
|
|
|
762
762
|
|
|
763
|
-
Claudeの認証事前確認による起動拒否は従来のエラー文を保ち、`structuredContent`へ`schema:"aiterm.agent-launch-error.v1"`、`harness:"claude-code"`、`phase:"authentication_preflight"`、`effect:"not_issued"`、`session_created:false`を返す。`code`は`CLAUDE_AUTH_NOT_AUTHENTICATED`(公式statusが未認証)、`CLAUDE_AUTH_STATUS_UNCONFIRMED
|
|
763
|
+
Claudeの認証事前確認による起動拒否は従来のエラー文を保ち、`structuredContent`へ`schema:"aiterm.agent-launch-error.v1"`、`harness:"claude-code"`、`phase:"authentication_preflight"`、`effect:"not_issued"`、`session_created:false`を返す。`code`は`CLAUDE_AUTH_NOT_AUTHENTICATED`(公式statusが未認証)、`CLAUDE_AUTH_STATUS_UNCONFIRMED`(確認不能)を区別する。確認が5秒で終わらない時は拒否せず起動へ進み、未ログインならlogin画面で`vendor_onboarding_required`として止まる。`CLAUDE_AUTH_STATUS_TIMEOUT`は0.70.1より前の端末だけが返す。資格情報の故障原因やログイン期限切れは断定せず、公式status本文・stderrは返さない。
|
|
764
764
|
|
|
765
765
|
### 別端末のagentを1回で起動する(`remote`)
|
|
766
766
|
|
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.
|
|
230
|
+
**Status:** actively maintained · current public release **v0.70.1** · 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
|
|
|
@@ -770,7 +770,7 @@ The result (`aiterm.agent-models.v1`) is `{ harness, source, harness_version, de
|
|
|
770
770
|
|
|
771
771
|
The selected harness CLI must be installed and authenticated. Use each product owner's official installer and updater; Aiterm does not distribute alternate CLI tarballs. For Cursor Agent CLI, use `curl https://cursor.com/install -fsS | bash` on macOS/Linux/WSL or `irm 'https://cursor.com/install?win32=true' | iex` on native Windows, authenticate once with `agent login`, and update with `agent update`; Aiterm invokes the unambiguous `cursor-agent` binary. Missing binaries, invalid model/effort values, unavailable Grok catalog models, and nonexistent `cwd` fail before a session exists.
|
|
772
772
|
|
|
773
|
-
Claude authentication preflight refusals retain the existing error text and add `structuredContent` with schema `aiterm.agent-launch-error.v1`, `harness:"claude-code"`, `phase:"authentication_preflight"`, `effect:"not_issued"`, and `session_created:false`. `code` distinguishes `CLAUDE_AUTH_NOT_AUTHENTICATED
|
|
773
|
+
Claude authentication preflight refusals retain the existing error text and add `structuredContent` with schema `aiterm.agent-launch-error.v1`, `harness:"claude-code"`, `phase:"authentication_preflight"`, `effect:"not_issued"`, and `session_created:false`. `code` distinguishes `CLAUDE_AUTH_NOT_AUTHENTICATED` and `CLAUDE_AUTH_STATUS_UNCONFIRMED`. A status check that does not finish in 5 seconds no longer refuses: the launch goes on, and a logged-out Claude stops at its login screen as `vendor_onboarding_required`. `CLAUDE_AUTH_STATUS_TIMEOUT` comes only from terminals older than 0.70.1. These describe the official status check, not the cause of a credential failure or a confirmed login expiry. Native status bodies and stderr are omitted.
|
|
774
774
|
|
|
775
775
|
Set `throughline_source_session` together with a non-empty mission in `prompt` to prepend
|
|
776
776
|
Throughline's read-only handoff context. This optional route requires `throughline >= 0.9.0`,
|
package/dist/core.js
CHANGED
|
@@ -4529,8 +4529,9 @@ async function sendAgentPromptText(name, text, kind, inputMeta) {
|
|
|
4529
4529
|
// 利用者が端末で済ませるしかない起動前の状態。reasonだけでは直し方が分からないので案内を添える。
|
|
4530
4530
|
function startupBlockedHint(reason) {
|
|
4531
4531
|
if (reason === "vendor_onboarding_required") {
|
|
4532
|
-
return "\nClaude Code
|
|
4533
|
-
"
|
|
4532
|
+
return "\nClaude Codeの初回案内(テーマ・ログイン方法の選択)か、利用規約の更新への回答が済んでいません。`claude auth status` がログイン済みでも、" +
|
|
4533
|
+
"済むまでは起動のたびにこの画面で止まります。規約への回答はアカウントの持ち主が選ぶもので、Aitermは答えません。" +
|
|
4534
|
+
"対象端末で一度 `claude` を起動し、画面の案内を最後まで進めてください。";
|
|
4534
4535
|
}
|
|
4535
4536
|
return "";
|
|
4536
4537
|
}
|
package/dist/harnesses/claude.js
CHANGED
|
@@ -344,8 +344,10 @@ export function assertClaudeAuthenticationReady(bin, env = process.env) {
|
|
|
344
344
|
"通常端末で `claude doctor` を実行し、Keychain/credential storeを直してから一度だけ `claude auth login` を実行してください。" +
|
|
345
345
|
"aiterm相関付きClaude session内で /login を繰り返さないでください。");
|
|
346
346
|
}
|
|
347
|
-
|
|
348
|
-
|
|
347
|
+
// A slow check is not a refusal (ADR 0020, 2026-11-10): launch on; a logged-out Claude stops at its login screen.
|
|
348
|
+
if (result.error && result.error.code === "ETIMEDOUT")
|
|
349
|
+
return;
|
|
350
|
+
throw new AgentAuthenticationPreflightError("CLAUDE_AUTH_STATUS_UNCONFIRMED", "Claude Codeの認証状態を起動前に確認できません。sessionは作成していません。" +
|
|
349
351
|
"`claude auth status --json` と `claude doctor` が成功することを通常端末で確認してください。");
|
|
350
352
|
}
|
|
351
353
|
/**
|
|
@@ -408,6 +410,11 @@ function claudeSecurityNotes(screen) {
|
|
|
408
410
|
return lines.slice(lastMarker + 1).some(line => /^\s*Security notes:\s*$/.test(line))
|
|
409
411
|
&& /Press (?:Enter|Return) to continue/u.test(lines.slice(lastMarker + 1).join("\n"));
|
|
410
412
|
}
|
|
413
|
+
// Claude Code 2.1.318 (grove): "Updates to Consumer Terms and Policies" with "Accept terms · Help improve our AI models: ON/OFF".
|
|
414
|
+
export function claudeConsumerTermsUpdate(screen) {
|
|
415
|
+
const tail = screen.split("\n").slice(-32).join("\n");
|
|
416
|
+
return tail.includes("Updates to Consumer Terms and Policies") && /^\s*[❯>]?\s*(?:\d+\.\s*)?Accept terms\b/mu.test(tail);
|
|
417
|
+
}
|
|
411
418
|
export function claudeTuiReady(screen) {
|
|
412
419
|
if (!screen.includes("Claude Code") && !claudeComposerBox(screen))
|
|
413
420
|
return false;
|
|
@@ -483,6 +490,10 @@ export function claudePaneObservation(screen) {
|
|
|
483
490
|
return { state: "busy", reason: "turn_running" };
|
|
484
491
|
if (claudeTuiReady(screen))
|
|
485
492
|
return { state: "idle", reason: "composer_ready" };
|
|
493
|
+
// The account holder's own choice (terms and model-training data); never answered by Aiterm. After ready, so a seat
|
|
494
|
+
// that merely talks about this screen stays idle.
|
|
495
|
+
if (claudeConsumerTermsUpdate(screen))
|
|
496
|
+
return { state: "blocked", reason: "vendor_onboarding_required" };
|
|
486
497
|
if (/new MCP servers? found in this project/i.test(tail))
|
|
487
498
|
return { state: "blocked", reason: "project_mcp_consent" };
|
|
488
499
|
if (claudeStartupAction(screen, false))
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,7 @@ import { AitermError, AgentAuthenticationPreflightError, AgentResumeUnavailableE
|
|
|
18
18
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
19
19
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
20
20
|
import { readPrivateEnvLine, setPrivateEnv } from "./private-env.js";
|
|
21
|
+
import { withTerminalLaunchAction } from "./terminal-launch-error.js";
|
|
21
22
|
import { CallToolRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
22
23
|
import { z } from "zod";
|
|
23
24
|
import { agentModelsResult } from "./model-catalog.js";
|
|
@@ -1204,8 +1205,9 @@ export function createAitermServer(options = {}) {
|
|
|
1204
1205
|
? await callRemoteTool(target, "claude_agent", args, 600_000, privateEnv)
|
|
1205
1206
|
: await callRemoteTool(target, "agent_launch", { harness, ...args }, 600_000, privateEnv);
|
|
1206
1207
|
const structured = result.structuredContent;
|
|
1207
|
-
|
|
1208
|
-
|
|
1208
|
+
// The terminal's own launch refusal (e.g. Claude authentication preflight) keeps its structure and stays an error.
|
|
1209
|
+
if (!structured || result.isError && structured.schema === "aiterm.agent-launch-error.v1")
|
|
1210
|
+
return { content: [...result.content, remoteNote(target, result)], ...(structured ? { structuredContent: structured } : {}), isError: true };
|
|
1209
1211
|
try {
|
|
1210
1212
|
if (delivery && structured.event_cursor !== null)
|
|
1211
1213
|
await registerRemoteDelivery(delivery, target, structured.session_id, structured.event_cursor, null, structured.input_id);
|
|
@@ -1268,10 +1270,10 @@ export function createAitermServer(options = {}) {
|
|
|
1268
1270
|
const session = result?.structuredContent?.session_id;
|
|
1269
1271
|
if (typeof session === "string")
|
|
1270
1272
|
bindTerminalSession(session, target.trusted_ref);
|
|
1271
|
-
return result;
|
|
1273
|
+
return withTerminalLaunchAction(result);
|
|
1272
1274
|
}
|
|
1273
1275
|
catch (e) {
|
|
1274
|
-
return fail(e);
|
|
1276
|
+
return withTerminalLaunchAction(fail(e));
|
|
1275
1277
|
}
|
|
1276
1278
|
}
|
|
1277
1279
|
async function launchAgent(kind, args, extra) {
|
package/dist/remote-path.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Terminal-side fixed path operations (remote-terminal.md R15). Runs on the terminal as the SSH user.
|
|
2
2
|
import * as fs from "node:fs";
|
|
3
|
+
import * as os from "node:os";
|
|
3
4
|
import * as path from "node:path";
|
|
4
5
|
import { RemoteTerminalError } from "./remote-terminal.js";
|
|
5
6
|
const MISSING = { schema: "aiterm.remote-path.v1", exists: false, directory: false, writable: false };
|
|
@@ -35,8 +36,8 @@ function writable(dir) {
|
|
|
35
36
|
fs.rmdirSync(probe);
|
|
36
37
|
return true;
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
/** missing / file / a folder the SSH user can list; refusals throw FOLDER_NOT_PERMITTED, never read as missing. */
|
|
40
|
+
function folderState(target) {
|
|
40
41
|
let stat;
|
|
41
42
|
try {
|
|
42
43
|
stat = fs.statSync(target);
|
|
@@ -65,14 +66,58 @@ export function inspectPath(target) {
|
|
|
65
66
|
if (parent === path.dirname(parent))
|
|
66
67
|
break;
|
|
67
68
|
}
|
|
68
|
-
return
|
|
69
|
+
return "missing";
|
|
69
70
|
}
|
|
70
71
|
if (!stat.isDirectory())
|
|
71
|
-
return
|
|
72
|
+
return "file";
|
|
72
73
|
if (!listable(target))
|
|
73
74
|
throw notPermitted();
|
|
75
|
+
return "directory";
|
|
76
|
+
}
|
|
77
|
+
export function inspectPath(target) {
|
|
78
|
+
checkRemotePath(target);
|
|
79
|
+
const state = folderState(target);
|
|
80
|
+
if (state === "missing")
|
|
81
|
+
return MISSING;
|
|
82
|
+
if (state === "file")
|
|
83
|
+
return { schema: "aiterm.remote-path.v1", exists: true, directory: false, writable: false };
|
|
74
84
|
return { schema: "aiterm.remote-path.v1", exists: true, directory: true, writable: writable(target) };
|
|
75
85
|
}
|
|
86
|
+
export const LIST_DIRS_MAX = 500;
|
|
87
|
+
/** Read-only folder picker listing (R15): subfolders only, no dot names, sorted, at most LIST_DIRS_MAX. */
|
|
88
|
+
export function listDirectories(target, home = os.homedir()) {
|
|
89
|
+
const dir = target === undefined ? home : target;
|
|
90
|
+
checkRemotePath(dir);
|
|
91
|
+
const base = { schema: "aiterm.remote-dirs.v1", home, path: path.posix.resolve(dir) };
|
|
92
|
+
const state = folderState(base.path);
|
|
93
|
+
if (state !== "directory")
|
|
94
|
+
return { ...base, exists: state === "file", directory: false, entries: null, truncated: false };
|
|
95
|
+
let dirents;
|
|
96
|
+
try {
|
|
97
|
+
dirents = fs.readdirSync(base.path, { withFileTypes: true });
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
if (denied(errno(error)))
|
|
101
|
+
throw notPermitted();
|
|
102
|
+
throw new RemoteTerminalError("PATH_UNAVAILABLE", `the folder cannot be listed (${errno(error) ?? "unknown"})`);
|
|
103
|
+
}
|
|
104
|
+
const names = [];
|
|
105
|
+
for (const entry of dirents) {
|
|
106
|
+
if (entry.name.startsWith("."))
|
|
107
|
+
continue;
|
|
108
|
+
let folder = entry.isDirectory();
|
|
109
|
+
if (!folder && entry.isSymbolicLink()) {
|
|
110
|
+
try {
|
|
111
|
+
folder = fs.statSync(path.join(base.path, entry.name)).isDirectory();
|
|
112
|
+
}
|
|
113
|
+
catch { /* broken or refused link: not a folder */ }
|
|
114
|
+
}
|
|
115
|
+
if (folder)
|
|
116
|
+
names.push(entry.name);
|
|
117
|
+
}
|
|
118
|
+
names.sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));
|
|
119
|
+
return { ...base, exists: true, directory: true, entries: names.slice(0, LIST_DIRS_MAX).map(name => ({ name })), truncated: names.length > LIST_DIRS_MAX };
|
|
120
|
+
}
|
|
76
121
|
export function makeDirectory(target) {
|
|
77
122
|
checkRemotePath(target);
|
|
78
123
|
try {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// credential-load --ref R --terminal-id ID --handle UUID --revision N --purpose ssh-key (key bytes on stdin; one JSON receipt line)
|
|
6
6
|
// transcript-read --session S [--cursor-session ID --offset N] [--max-bytes N] (runs on the terminal)
|
|
7
7
|
// authorize-key --ref R (login password on stdin until EOF; R14) provision --ref R (macOS runtime; R16)
|
|
8
|
-
// path-status|make-dir --path P | --path-base64 B (on the terminal; R15) runtime-smoke --expect-version V (on the terminal)
|
|
8
|
+
// path-status|make-dir --path P | --path-base64 B, list-dirs [--path P | --path-base64 B] (on the terminal; R15) runtime-smoke --expect-version V (on the terminal)
|
|
9
9
|
import { realpathSync } from "node:fs";
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
11
|
import { createRequire } from "node:module";
|
|
@@ -15,7 +15,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
15
15
|
import { REMOTE_COMMAND_OPS, RemoteTerminalConnection, RemoteTerminalError, bindingStatus, confirmHostKey, loadCredential, registerBinding } from "./remote-terminal.js";
|
|
16
16
|
import { readCompletedTranscript } from "./transcript-read.js";
|
|
17
17
|
import { credentialHandleSchema } from "./remote-contract.js";
|
|
18
|
-
import { inspectPath, makeDirectory } from "./remote-path.js";
|
|
18
|
+
import { inspectPath, listDirectories, makeDirectory } from "./remote-path.js";
|
|
19
19
|
import { ASKPASS_SOCKET_ENV, askpass, authorizeKey, prepareAuthorization } from "./remote-authorize.js";
|
|
20
20
|
import { provision, runtimeSmoke } from "./remote-provision.js";
|
|
21
21
|
const pkg = createRequire(import.meta.url)("../package.json");
|
|
@@ -108,7 +108,7 @@ function serve() {
|
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
110
|
server.registerTool("remote_terminal_command", {
|
|
111
|
-
description: "Fixed Claude Code setup
|
|
111
|
+
description: "Fixed operation on the terminal: Claude Code setup, or a path check / mkdir / read-only folder listing",
|
|
112
112
|
inputSchema: { op: z.enum(REMOTE_COMMAND_OPS), path: z.string().optional() },
|
|
113
113
|
}, guarded(({ op, path }) => bound().command(op, path)));
|
|
114
114
|
server.registerTool("remote_terminal_close", { description: "Close the bound connection and exit", inputSchema: {} }, guarded(async () => { const result = connection ? await connection.close() : { closed: true }; setTimeout(() => process.exit(0), 100); return result; }));
|
|
@@ -154,6 +154,8 @@ export function main(args) {
|
|
|
154
154
|
return oneShot(() => inspectPath(pathArgument(rest)), "aiterm.remote-binding-error.v1");
|
|
155
155
|
if (command === "make-dir")
|
|
156
156
|
return oneShot(() => makeDirectory(pathArgument(rest)), "aiterm.remote-binding-error.v1");
|
|
157
|
+
if (command === "list-dirs")
|
|
158
|
+
return oneShot(() => listDirectories(rest.length ? pathArgument(rest) : undefined), "aiterm.remote-binding-error.v1");
|
|
157
159
|
if (command === "runtime-smoke")
|
|
158
160
|
return oneShot(() => runtimeSmoke(option(rest, "--expect-version") ?? ""), "aiterm.remote-binding-error.v1");
|
|
159
161
|
if (command === "trust-confirm")
|
|
@@ -163,7 +165,7 @@ export function main(args) {
|
|
|
163
165
|
const id = option(rest, "--cursor-session"), offset = option(rest, "--offset"), max = option(rest, "--max-bytes");
|
|
164
166
|
return readCompletedTranscript(option(rest, "--session") ?? "", id ? { claudeSessionId: id, offset: Number(offset) } : null, max ? Number(max) : undefined);
|
|
165
167
|
}, "aiterm.transcript-read-error.v1");
|
|
166
|
-
process.stderr.write("usage: aiterm-remote-terminal serve|status|register|trust-confirm|credential-load|authorize-key|provision|transcript-read|path-status|make-dir|runtime-smoke\n");
|
|
168
|
+
process.stderr.write("usage: aiterm-remote-terminal serve|status|register|trust-confirm|credential-load|authorize-key|provision|transcript-read|path-status|make-dir|list-dirs|runtime-smoke\n");
|
|
167
169
|
process.exit(64);
|
|
168
170
|
}
|
|
169
171
|
let entry = false;
|
package/dist/remote-terminal.js
CHANGED
|
@@ -266,7 +266,7 @@ export class SshStdioTransport {
|
|
|
266
266
|
async close() { this.child?.kill(); }
|
|
267
267
|
}
|
|
268
268
|
export const REMOTE_SEAT_TOOLS = new Set(["agent_launch", "pty_send", "pty_observe", "pty_read", "pty_key", "claude_turn", "agent_stop", "pty_close"]);
|
|
269
|
-
export const REMOTE_COMMAND_OPS = ["claude_version", "claude_install", "claude_update", "path_status", "make_dir"];
|
|
269
|
+
export const REMOTE_COMMAND_OPS = ["claude_version", "claude_install", "claude_update", "path_status", "make_dir", "list_dirs"];
|
|
270
270
|
const COMMANDS = {
|
|
271
271
|
claude_version: "claude --version",
|
|
272
272
|
claude_install: "curl -fsSL https://claude.ai/install.sh | bash",
|
|
@@ -299,6 +299,7 @@ export function versionAtLeast(actual, required) {
|
|
|
299
299
|
export const REMOTE_MINIMUM_VERSION = "0.65.0";
|
|
300
300
|
// The first release with the terminal's path-status / make-dir (R15).
|
|
301
301
|
export const REMOTE_PATH_OPS_VERSION = "0.69.0";
|
|
302
|
+
export const REMOTE_LIST_DIRS_VERSION = "0.70.0";
|
|
302
303
|
export class RemoteTerminalConnection extends EventEmitter {
|
|
303
304
|
b;
|
|
304
305
|
dir;
|
|
@@ -477,6 +478,8 @@ export class RemoteTerminalConnection extends EventEmitter {
|
|
|
477
478
|
async command(op, targetPath) {
|
|
478
479
|
if (op === "path_status" || op === "make_dir")
|
|
479
480
|
return this.pathCommand(op, targetPath);
|
|
481
|
+
if (op === "list_dirs")
|
|
482
|
+
return this.listDirs(targetPath);
|
|
480
483
|
if (targetPath !== undefined)
|
|
481
484
|
throw new RemoteTerminalError("COMMAND_INVALID", `${op} takes no path`);
|
|
482
485
|
if (!Object.hasOwn(COMMANDS, op))
|
|
@@ -512,6 +515,31 @@ export class RemoteTerminalConnection extends EventEmitter {
|
|
|
512
515
|
throw new RemoteTerminalError(parsed.code, parsed.message ?? "path operation failed");
|
|
513
516
|
throw new RemoteTerminalError("COMMAND_FAILED", "the path operation failed on the terminal");
|
|
514
517
|
}
|
|
518
|
+
/** R15 list-dirs: read-only folder picker listing; no path lists the SSH user's home. */
|
|
519
|
+
async listDirs(targetPath) {
|
|
520
|
+
if (targetPath !== undefined)
|
|
521
|
+
checkRemotePath(targetPath);
|
|
522
|
+
if (!versionAtLeast(this.remoteVersion, REMOTE_LIST_DIRS_VERSION))
|
|
523
|
+
throw new RemoteTerminalError("REMOTE_AITERM_TOO_OLD", `the terminal runs Aiterm ${this.remoteVersion}; ${REMOTE_LIST_DIRS_VERSION} or later is required (update or provision the terminal)`);
|
|
524
|
+
const flag = targetPath === undefined ? "" : ` --path-base64 ${Buffer.from(targetPath, "utf8").toString("base64")}`;
|
|
525
|
+
const result = await this.exec(`exec aiterm-remote-terminal list-dirs${flag}`, 60_000);
|
|
526
|
+
if (result.code === 255) {
|
|
527
|
+
const f = classifySshFailure(result.stderr);
|
|
528
|
+
throw new RemoteTerminalError(f.code, f.message, f.action);
|
|
529
|
+
}
|
|
530
|
+
let parsed = null;
|
|
531
|
+
try {
|
|
532
|
+
parsed = JSON.parse(result.stdout.trim().split("\n").pop() ?? "");
|
|
533
|
+
}
|
|
534
|
+
catch { /* classified below */ }
|
|
535
|
+
if (result.code === 0 && parsed?.schema === "aiterm.remote-dirs.v1") {
|
|
536
|
+
const { home, path: listed, exists, directory, entries, truncated } = parsed;
|
|
537
|
+
return { op: "list_dirs", home, path: listed, exists, directory, entries, truncated };
|
|
538
|
+
}
|
|
539
|
+
if (parsed?.code)
|
|
540
|
+
throw new RemoteTerminalError(parsed.code, parsed.message ?? "folder listing failed");
|
|
541
|
+
throw new RemoteTerminalError("COMMAND_FAILED", "the folder listing failed on the terminal");
|
|
542
|
+
}
|
|
515
543
|
async close() {
|
|
516
544
|
this.closing = true;
|
|
517
545
|
await this.client.close().catch(() => { });
|
package/dist/setup.js
CHANGED
|
@@ -41,13 +41,16 @@ export function globalRegistration(run = runSetupCommand, options = {}) {
|
|
|
41
41
|
}
|
|
42
42
|
export async function verifySetupRuntime(registration) {
|
|
43
43
|
const client = new Client({ name: "aiterm-setup", version: "1.0.0" });
|
|
44
|
-
|
|
44
|
+
// The SDK default passes only HOME/PATH/SHELL/TERM/USER/LOGNAME; without TMPDIR the probe would use another socket directory.
|
|
45
|
+
const transport = new StdioClientTransport({ ...registration, env: process.env, stderr: "pipe" });
|
|
45
46
|
transport.stderr?.on("data", (chunk) => process.stderr.write(chunk));
|
|
46
47
|
const name = `setup-${randomUUID().slice(0, 12)}`;
|
|
47
48
|
const call = async (tool, args) => {
|
|
48
49
|
const result = await client.request({ method: "tools/call", params: { name: tool, arguments: args } }, CallToolResultSchema, { timeout: 25_000 });
|
|
49
|
-
if (result.isError)
|
|
50
|
-
|
|
50
|
+
if (result.isError) {
|
|
51
|
+
const detail = result.content.filter((item) => item.type === "text").map((item) => item.text).join(" ").slice(0, 300);
|
|
52
|
+
throw new SetupError("runtime_probe_failed", `${tool}が失敗しました${detail ? `: ${detail}` : ""}`);
|
|
53
|
+
}
|
|
51
54
|
return result;
|
|
52
55
|
};
|
|
53
56
|
await client.connect(transport);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// remote-terminal.md R18: a terminal launch refused before any seat exists, as a code plus a fixed plain Japanese
|
|
2
|
+
// sentence the Owner reads. Only codes raised before the seat exists are listed; anything else may have started.
|
|
3
|
+
const ACTIONS = {
|
|
4
|
+
TERMINAL_INVALID: "起動の指定(端末の情報か作業フォルダ)が正しくありません。BellTeamの不具合の恐れがあります。",
|
|
5
|
+
TARGET_INVALID: "起動の指定(端末の情報)が正しくありません。BellTeamの不具合の恐れがあります。",
|
|
6
|
+
TERMINAL_HARNESS_UNSUPPORTED: "この端末で起こせるAIは、今はClaude Codeだけです。メンバーのAIをClaude Codeにしてください。",
|
|
7
|
+
REF_INVALID: "端末の登録が見つかりません。端末の登録を確かめてください。",
|
|
8
|
+
BINDING_UNKNOWN: "端末の登録が見つかりません。端末の登録を確かめてください。",
|
|
9
|
+
BINDING_STORE_UNREADABLE: "端末の登録を読めませんでした。端末の登録をやり直してください。",
|
|
10
|
+
TARGET_MISMATCH: "端末の登録内容(宛先)が変わったため止めました。端末の登録を確かめてください。",
|
|
11
|
+
HOST_TRUST_MISSING: "端末の本人確認(ホスト鍵の確認)が済んでいません。端末の画面でホスト鍵を確かめてください。",
|
|
12
|
+
KNOWN_HOSTS_UNREADABLE: "端末の本人確認の記録を読めませんでした。端末の画面でホスト鍵を確かめ直してください。",
|
|
13
|
+
HOST_KEY_MISMATCH: "端末が前と違うホスト鍵を示したため、別の機械の恐れがあり止めました。端末の画面でホスト鍵を確かめ直してください。",
|
|
14
|
+
HOST_TRUST_STALE: "端末のホスト鍵の確認が新しくなりました。新しい登録内容で起こし直すまでお待ちください。",
|
|
15
|
+
CREDENTIAL_REQUIRED: "端末へ入る鍵が登録されていません。端末の登録で鍵を設定してください。",
|
|
16
|
+
CREDENTIAL_NOT_LOADED: "端末へ入る鍵がまだ読み込まれていません。読み込み直してから起こし直します。",
|
|
17
|
+
CREDENTIAL_REVISION_STALE: "端末へ入る鍵が新しくなりました。新しい鍵で起こし直します。",
|
|
18
|
+
CREDENTIAL_UNAVAILABLE: "端末へ入る鍵を使えません。端末の登録で鍵を確かめてください。",
|
|
19
|
+
AUTH_FAILED: "端末が鍵を受け付けませんでした。端末の登録から、パスワードで鍵を許可し直してください。",
|
|
20
|
+
CONNECTION_REFUSED: "端末がSSHの接続を断りました。Macなら「リモートログイン」が入になっているか確かめてください。",
|
|
21
|
+
UNREACHABLE: "端末につながりません。電源とネットワークを確かめてください。つながれば起こし直します。",
|
|
22
|
+
CONNECTION_FAILED: "端末へのSSH接続に失敗しました。端末の電源とSSHの設定を確かめてください。",
|
|
23
|
+
REMOTE_AITERM_UNAVAILABLE: "端末にAitermが入っていません。端末の準備(Aitermの導入)をやり直してください。",
|
|
24
|
+
REMOTE_AITERM_TOO_OLD: "端末のAitermが古いため起こせません。端末のAitermを更新してください。",
|
|
25
|
+
SEAT_FORWARD_UNAVAILABLE: "端末からBellTeamへ戻る通り道がまだ用意できていません。少し待ってから起こし直してください。",
|
|
26
|
+
CWD_UNAVAILABLE: "端末に作業フォルダがありません。メンバーの作業フォルダを選び直すか、そのフォルダを作ってください。",
|
|
27
|
+
CLAUDE_AUTH_NOT_AUTHENTICATED: "端末のClaude Codeにログインしていません。端末でClaude Codeにログインしてください。",
|
|
28
|
+
CLAUDE_AUTH_STATUS_UNCONFIRMED: "端末のClaude Codeのログイン状態を確かめられませんでした。少し待ってから起こし直してください。",
|
|
29
|
+
CLAUDE_AUTH_STATUS_TIMEOUT: "端末のClaude Codeのログイン状態を時間内に確かめられませんでした。少し待ってから起こし直してください。",
|
|
30
|
+
};
|
|
31
|
+
/** The code of an Aiterm error text ("CODE: ..." or the terminal's "aiterm: CODE: ..."), or null. */
|
|
32
|
+
export function errorCode(text) {
|
|
33
|
+
return /^(?:aiterm: )?([A-Z][A-Z0-9_]{2,63}):/.exec(text)?.[1] ?? null;
|
|
34
|
+
}
|
|
35
|
+
export function terminalLaunchAction(code) {
|
|
36
|
+
return typeof code === "string" && Object.hasOwn(ACTIONS, code) ? ACTIONS[code] : null;
|
|
37
|
+
}
|
|
38
|
+
export const LAUNCH_ERROR_META = "aiterm/launch_error";
|
|
39
|
+
/** Adds R18's `_meta` to a failed terminal launch result; a result whose code is not listed is returned unchanged.
|
|
40
|
+
* `_meta`, not structuredContent: SDK clients that listed the tools validate structuredContent against the
|
|
41
|
+
* success outputSchema even on isError, and would turn this refusal into a protocol error. */
|
|
42
|
+
export function withTerminalLaunchAction(result) {
|
|
43
|
+
if (!result?.isError)
|
|
44
|
+
return result;
|
|
45
|
+
const structured = result.structuredContent;
|
|
46
|
+
const preflight = structured?.schema === "aiterm.agent-launch-error.v1";
|
|
47
|
+
if (structured && !preflight)
|
|
48
|
+
return result;
|
|
49
|
+
const code = preflight ? structured.code : errorCode(result.content?.find((item) => item.type === "text")?.text ?? "");
|
|
50
|
+
const action = terminalLaunchAction(code);
|
|
51
|
+
if (!action)
|
|
52
|
+
return result;
|
|
53
|
+
const failure = preflight
|
|
54
|
+
? { schema: structured.schema, harness: structured.harness, code, phase: structured.phase, effect: structured.effect, session_created: false, action }
|
|
55
|
+
: { schema: "aiterm.agent-launch-error.v1", harness: "claude-code", code, phase: "terminal", effect: "not_started", session_created: false, action };
|
|
56
|
+
return { ...result, _meta: { ...result._meta, [LAUNCH_ERROR_META]: failure } };
|
|
57
|
+
}
|
package/docs/DESIGN.md
CHANGED
|
@@ -366,6 +366,7 @@ hookを外す時は`aiterm-setup --remove-cursor-parent-hooks`で専用entryだ
|
|
|
366
366
|
`trust_project:true`は対象projectの既知のworkspace、hooks、MCP初期同意を起動準備として進める意図である。
|
|
367
367
|
Claude Codeの初回テーマ選択は選択済みの項目を確定し、後続の起動準備へ進める。
|
|
368
368
|
ログイン方式の選択はユーザーのアカウント設定として扱い、composerと誤認せず`vendor_onboarding_required`で止める。
|
|
369
|
+
利用規約の更新の画面(「Updates to Consumer Terms and Policies」、`Accept terms`の選択肢)も、規約への同意と学習へのデータ利用の選択はアカウントの持ち主が決めるので、Aitermは答えず`vendor_onboarding_required`で止める(Mac 2026-11-10、`unrecognized_screen`で166秒待っていた)。
|
|
369
370
|
promptなしでも入力受付とharness生存を確認して`startup.ready`を返す。指定なしのpromptなし起動は
|
|
370
371
|
従来どおり`startup.not_checked`で返す。初手receiptは未要求・未送信・送信済み未確認・開始確認を分ける。
|
|
371
372
|
入力受付の待ちは30秒。画面が起動コマンドの表示のまま(agentがまだ何も描いていない)で切れた時だけ、
|
|
@@ -538,7 +539,7 @@ Claude authentication URL receipts recognize the official claude.com/cai/oauth/a
|
|
|
538
539
|
|
|
539
540
|
### 認証画面と専用応答
|
|
540
541
|
|
|
541
|
-
Claude起動前の公式auth status拒否はharnessが`AgentAuthenticationPreflightError`として所有し、通常MCPのfailが`aiterm.agent-launch-error.v1`へ投影する。既存数値exit code
|
|
542
|
+
Claude起動前の公式auth status拒否はharnessが`AgentAuthenticationPreflightError`として所有し、通常MCPのfailが`aiterm.agent-launch-error.v1`へ投影する。既存数値exit codeと文言を維持し、未認証・確認不能の機械code(timeoutは拒否せず起動へ進み、未認証なら起動後のlogin画面判定が止める。`CLAUDE_AUTH_STATUS_TIMEOUT`は旧版の端末だけが返す。ADR 0020追補)、authentication_preflight/not_issued/session_created:falseだけを追加する。CLI status本文・stderr・資格・推定したexpiry原因は持ち出さず、この拒否は認証PTYの入力や起動後turnの終端とは分ける。
|
|
542
543
|
|
|
543
544
|
`agent-auth-ui.ts`が既v1 receiptに追加する`auth_ui`とrespondの型を所有する。Native harnessが公式URL・device code・空code欄・現在のラベル付き選択肢を識別し、Rootはキー列を作らない。不明な入力段階はunavailable。coreが既auth metadataのdev/ino/作成・更新時刻、native session/pane/server/PID開始識別を照合する。legacyのlaunch UUID欠測はnullのまま扱い、無関係なflowをadoptしない。新startは既launch_id欄を必ず設定する。
|
|
544
545
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aiterm-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.70.1",
|
|
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": [
|