aiterm-mcp 0.51.3 → 0.52.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 +30 -1
- package/README.ja.md +6 -2
- package/README.md +6 -2
- package/dist/core.js +215 -36
- package/dist/index.js +11 -2
- package/docs/DESIGN.md +15 -0
- package/docs/RELEASE.md +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.52.1] - 2026-10-05
|
|
11
|
+
|
|
12
|
+
### 修正
|
|
13
|
+
|
|
14
|
+
- 同じagent sessionへの`pty_send`が重なると、後の1通が断られる事があった(ADR 0088)。Aitermは送る時点の子の状態を見て
|
|
15
|
+
差し込みか新しいturnかを決めるが、見てから送り終えるまでの間に起動直後の入力受付待ち(最長30秒)が挟まり、
|
|
16
|
+
その区間を守るものが無かった。Claude Codeでは2通ともturnの印が無いと読み、後の1通が
|
|
17
|
+
「operation_idなしのClaude turn が未解決です」で断られた(文は打たれない)。Codex・Grok・Cursorでは断りにならず、
|
|
18
|
+
同じ入力欄へ2通が続けて貼られ、1行につながって届いた。同じsessionへの送信(`pty_send`、`claude_turn issue`、起動時prompt)を
|
|
19
|
+
1本ずつ通し、後の1通は前の1通が終わってから振り分け直す。順に送った時と同じ結果になり、Claude Codeへ重なった後の1通は
|
|
20
|
+
`mode=agent_steer`で返る。前の1通を待つ分だけ返りが遅れる。待つ上限(POSIX 60秒、Windows 180秒)を越えたら、
|
|
21
|
+
打鍵前に`AGENT_SEND_BUSY`と「文字列は送信していません」を返す。送信の途中で終了したprocessのlockは、次の送信が片付ける。
|
|
22
|
+
公開toolの返却形式とstate schemaは変えていない。旧版へ戻す時の手当ては要らない。
|
|
23
|
+
|
|
24
|
+
## [0.52.0] - 2026-10-04
|
|
25
|
+
|
|
26
|
+
### 修正
|
|
27
|
+
|
|
28
|
+
- 席の中で起動した試験が`AITERM_STATE_BASE`を本番から引き継ぎ、`killAll`で他のsocketのagent登録まで
|
|
29
|
+
削除していた(ADR 0087)。BellTeamで複数席の送信が通常PTYの`mode=sent`となり、完了待ちと回答の表示が
|
|
30
|
+
失敗した。`killAll`は現在のsocketのsessionと控えに属する登録だけを消し、他のsocketの待機lockも保持する。
|
|
31
|
+
試験入口は本番の保存場所・系譜・tmux環境を外して一時領域を指定する。既に失った登録は対象sessionを
|
|
32
|
+
閉じて同じIDで起動し直して復旧する。登録の形式と公開toolの返却形式は変えていない。
|
|
33
|
+
- `pty_send`に`require_agent:true`を追加した。agent登録が無いsessionには打鍵せず、
|
|
34
|
+
`AGENT_SESSION_REQUIRED`と「文字列は送信していません」を返す。連携元は、登録消失後の二重送信を避けて復旧できる。
|
|
35
|
+
省略時は従来の通常PTY送信を維持する。`force:true`との併用は未送信で拒否する。
|
|
36
|
+
|
|
10
37
|
## [0.51.3] - 2026-10-04
|
|
11
38
|
|
|
12
39
|
### 修正
|
|
@@ -2090,7 +2117,9 @@ prototype (preserved under `prototype/python/` as the porting source and referen
|
|
|
2090
2117
|
`ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
|
|
2091
2118
|
provenance.
|
|
2092
2119
|
|
|
2093
|
-
[Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.
|
|
2120
|
+
[Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.52.1...HEAD
|
|
2121
|
+
[0.52.1]: https://github.com/kitepon/aiterm-mcp/compare/v0.52.0...v0.52.1
|
|
2122
|
+
[0.52.0]: https://github.com/kitepon/aiterm-mcp/compare/v0.51.3...v0.52.0
|
|
2094
2123
|
[0.51.3]: https://github.com/kitepon/aiterm-mcp/compare/v0.51.2...v0.51.3
|
|
2095
2124
|
[0.51.2]: https://github.com/kitepon/aiterm-mcp/compare/v0.51.1...v0.51.2
|
|
2096
2125
|
[0.51.1]: https://github.com/kitepon/aiterm-mcp/compare/v0.51.0...v0.51.1
|
package/README.ja.md
CHANGED
|
@@ -209,7 +209,7 @@ runtime-error store は canonical dotagents config の `collection.enabled: true
|
|
|
209
209
|
場合だけ収集し、既定OFF、network送信は行いません。tag起点CIのnpm provenance(OIDC Trusted
|
|
210
210
|
Publishing)で公開し、GitHub Release が Official MCP Registry を再登録します。
|
|
211
211
|
|
|
212
|
-
**状態:** 開発継続中 · 現行公開版 **v0.
|
|
212
|
+
**状態:** 開発継続中 · 現行公開版 **v0.52.1** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
|
|
213
213
|
|
|
214
214
|
### 更新と巻き戻し
|
|
215
215
|
|
|
@@ -259,6 +259,10 @@ pty_read(id, { wait: true }) → 削減済みの出力を読む(完了
|
|
|
259
259
|
|
|
260
260
|
ClaudeがAPIエラーや安全判定の拒否で終了した時は、Stop hookが発火しなくても次の`pty_send`を新しいturnとして扱う。現在のturn開始後のエラー記録だけを確認し、過去のエラーで実行中のturnを解除しない。上流の拒否はエラーのまま返す。
|
|
261
261
|
|
|
262
|
+
agent配送だけを期待する連携では、`pty_send`に`require_agent:true`を指定する。agent登録が無ければ、打鍵前に`AGENT_SESSION_REQUIRED`と「文字列は送信していません」を返す。省略時は通常PTY送信を維持する。`force:true`との併用は未送信で拒否する。
|
|
263
|
+
|
|
264
|
+
同じagent sessionへの`pty_send`が重なった時は、1本ずつ通す。後の1通は、前の1通を送り終えてから振り分け直すので、順に送った時と同じ結果になる(起動直後のClaude Codeへ重なった後の1通は`mode=agent_steer`で返る)。前の1通が起動直後の入力受付待ちなら、その分だけ返りが遅れる。待つ上限(POSIX 60秒、Windows 180秒)を越えた時は、打鍵前に`AGENT_SEND_BUSY`と「文字列は送信していません」を返す。送信の途中で終了したprocessのlockは、次の送信が片付けて進む。
|
|
265
|
+
|
|
262
266
|
`agent_launch`・`pty_send`(agent session宛て)は任意の`image`(画像ファイルの絶対パスの配列。png/jpg/jpeg/gif/webp)を受ける。aitermが本文末尾へ添付行を付け、どのharnessも自分のfile読取toolでそのpathを画像として開く。呼出し側はharness別の添付手順を覚えない。不正なpathは送信前に拒否する。
|
|
263
267
|
|
|
264
268
|
`agent_launch`は任意の`write_scope`も受ける。Codex/Grokのread-onlyは`--sandbox read-only`、Cursorは公式`--mode ask`で実効化する。path説明は同等CLI引数がないためdeclaration-only。
|
|
@@ -550,7 +554,7 @@ Claudeの相関済み承認は既存の`claude_approval`を使う。
|
|
|
550
554
|
| ツール | 役割 | 主な引数 |
|
|
551
555
|
| --- | --- | --- |
|
|
552
556
|
| `pty_open` | 端末を1個開き`session_id`を返す | `name?`, `shell?`, `env_vars?` |
|
|
553
|
-
| `pty_send` | テキストを送る。agent sessionでは子のturnが実行中なら現在のturnへ差し込み(`agent_steer`)、それ以外は非ブロックdispatchとして`event_cursor`を返す(`agent_dispatch`)。差し込みでGrokが待ち行列へ入れない時とCursorの入力欄に残った時は失敗する | `session_id`, `text`, `enter=true`, `mark`, `force`, `rtk`, `raw` |
|
|
557
|
+
| `pty_send` | テキストを送る。agent sessionでは子のturnが実行中なら現在のturnへ差し込み(`agent_steer`)、それ以外は非ブロックdispatchとして`event_cursor`を返す(`agent_dispatch`)。差し込みでGrokが待ち行列へ入れない時とCursorの入力欄に残った時は失敗する | `session_id`, `text`, `enter=true`, `mark`, `force`, `require_agent=false`, `rtk`, `raw` |
|
|
554
558
|
| `pty_read` | 出力を削減して読む(既定は増分) | `session_id`, `wait`, `until`, `until_regex`, `timeout`, `screen`, `full`, `lines`, `line_range`, `raw`, `rtk`, `agent_transcript`, `operation_id` |
|
|
555
559
|
| `pty_key` | 制御キーを送る | `session_id`, `key`(`C-c`/`Enter`/`Up`…) |
|
|
556
560
|
| `pty_close` | 冪等に閉じ、`closed` / `already_closed`を返す | `session_id` |
|
package/README.md
CHANGED
|
@@ -223,7 +223,7 @@ collection is off by default and performs no network I/O. It ships via
|
|
|
223
223
|
tag-triggered CI with npm provenance (OIDC Trusted Publishing); the GitHub
|
|
224
224
|
Release re-registers the Official MCP Registry entry.
|
|
225
225
|
|
|
226
|
-
**Status:** actively maintained · current public release **v0.
|
|
226
|
+
**Status:** actively maintained · current public release **v0.52.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).
|
|
227
227
|
|
|
228
228
|
### Update and rollback
|
|
229
229
|
|
|
@@ -280,6 +280,10 @@ The same primitive hosts another agent's TUI. `agent_launch` starts a selected e
|
|
|
280
280
|
|
|
281
281
|
起動結果には正規`harness`を含む`aiterm.agent-launch-result.v1`が付き、旧`provider`は互換fieldとして残る。同じ`harness`はagent dispatch、`aiterm-wait`、`agent_configure`、`pty_list`にも載る。Codexは通常rollout、Grokは通常session event、Claudeはlaunch固有Stop hook、Cursorは通常agent transcriptの`turn_ended`を完了正本に使う。agentへの送信は`pty_send`だけで行い、Aitermが送る時点で子の状態を見て振り分ける。Claudeは画面の実行中表示ではなくStopまで残るturnの印で判定する。実行中のturnへは差し込み(`mode=agent_steer`、新しい`event_cursor`と配送は作らない)、それ以外は非ブロックdispatch(`mode=agent_dispatch`)で、harnessごとの完了境界を表す整数`event_cursor`を返す。Codex親は選択に応じて公式Steerまたはqueue、Claude Code親は公式非同期hookで本文を自動受信する。他の親は[`aiterm-wait`](#completion-push-for-parent-agents-aiterm-wait)を使う。CursorのsubmitはadapterがCLIのextended keyboard protocolへ変換し、送信本文がcomposerへ残る場合は明示errorにする。
|
|
282
282
|
|
|
283
|
+
Set `require_agent:true` on `pty_send` when the integration requires agent delivery. If the agent registration is missing, Aiterm refuses before sending any text and returns `AGENT_SESSION_REQUIRED` with an explicit unsent message. The default preserves ordinary PTY sends; combining it with `force:true` is rejected before sending.
|
|
284
|
+
|
|
285
|
+
Overlapping `pty_send` calls to the same agent session are handled one at a time. A later call picks its route only after the earlier one has been sent, so the result matches calls made in sequence (a call that overlaps the first send to a freshly started Claude Code session returns `mode=agent_steer`). It returns later by however long the earlier call waits for the session to accept input. If its turn does not come within the limit (60 seconds on POSIX, 180 seconds on Windows), Aiterm refuses before sending any text and returns `AGENT_SEND_BUSY` with an explicit unsent message. A lock left by a process that exited mid-send is cleared by the next send.
|
|
286
|
+
|
|
283
287
|
`agent_launch` and `pty_send` (to an agent session) accept an optional `image`: an array of absolute paths to image files (png/jpg/jpeg/gif/webp). Aiterm appends an attachment block to the prompt, and every harness opens the path with its own file-reading tool and sees the image; the caller never learns harness-specific attachment tricks. Invalid paths are rejected before anything is sent.
|
|
284
288
|
|
|
285
289
|
`agent_launch` accepts an optional `write_scope`: either `"read-only"` or a human-readable description of writable paths. Codex/Grok use `--sandbox read-only`; Cursor uses its official read-only `--mode ask`. A path description remains declaration-only because these CLI launch surfaces provide no equivalent path allowlist flag.
|
|
@@ -587,7 +591,7 @@ continue to use `claude_approval`.
|
|
|
587
591
|
| Tool | Role | Key args |
|
|
588
592
|
| --- | --- | --- |
|
|
589
593
|
| `pty_open` | Open one terminal and return a `session_id` | `name?`, `shell?`, `env_vars?` |
|
|
590
|
-
| `pty_send` | Send text. On an agent session Aiterm picks the route when it sends: if the child's turn is running, it steers the text into that turn (`agent_steer`); otherwise it is a non-blocking **dispatch** returning an `event_cursor` (`agent_dispatch`). Steering fails when Grok does not queue the text or Cursor leaves it in the composer | `session_id`, `text`, `enter=true`, `mark`, `force`, `rtk`, `raw` |
|
|
594
|
+
| `pty_send` | Send text. On an agent session Aiterm picks the route when it sends: if the child's turn is running, it steers the text into that turn (`agent_steer`); otherwise it is a non-blocking **dispatch** returning an `event_cursor` (`agent_dispatch`). Steering fails when Grok does not queue the text or Cursor leaves it in the composer | `session_id`, `text`, `enter=true`, `mark`, `force`, `require_agent=false`, `rtk`, `raw` |
|
|
591
595
|
| `pty_read` | Read output, token-reduced (incremental by default) | `session_id`, `wait`, `until`, `until_regex`, `timeout`, `screen`, `full`, `lines`, `line_range`, `raw`, `rtk`, `agent_transcript`, `operation_id` |
|
|
592
596
|
| `pty_key` | Send a control key | `session_id`, `key` (`C-c`/`Enter`/`Up`…) |
|
|
593
597
|
| `pty_close` | Close idempotently; return `closed` / `already_closed` | `session_id` |
|
package/dist/core.js
CHANGED
|
@@ -86,6 +86,10 @@ const PTY_PASTE_CHUNK_PAUSE_MS = 10;
|
|
|
86
86
|
const PTY_PASTE_PAUSE_BUFFER = new Int32Array(new SharedArrayBuffer(4));
|
|
87
87
|
const SESSION_SEND_LOCK_WAIT_MS = isWin ? 130_000 : 10_000;
|
|
88
88
|
const SESSION_SEND_LOCK_POLL_MS = 25;
|
|
89
|
+
// 同じagent sessionへの送信が重なった時に、前の1通を待つ上限(ADR 0088)。
|
|
90
|
+
// 起動から最初の描画を待つ上限と、貼り付けの上限の和。前の1通が正常に進んでいる間は待ち切れる長さにする。
|
|
91
|
+
const AGENT_SEND_LOCK_WAIT_MS = AGENT_TUI_FIRST_DRAW_TIMEOUT_MS + SESSION_SEND_LOCK_WAIT_MS;
|
|
92
|
+
const AGENT_SEND_LOCK_POLL_MS = 50;
|
|
89
93
|
// CSI/OSC/ESC エスケープ・制御文字
|
|
90
94
|
// CSI / OSC(BEL or ST 終端) / DCS・PM・APC・SOS(ESC P/^/_/X … BEL or ST 終端。ペイロード本文ごと除去=B10) / 残る2文字エスケープ
|
|
91
95
|
const ANSI_RE = /\x1b\[[0-9;?]*[ -\/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[P^_X][\s\S]*?(?:\x07|\x1b\\)|\x1b[@-_]/g;
|
|
@@ -349,6 +353,15 @@ function sendLockPath(name) {
|
|
|
349
353
|
assertSessionName(name);
|
|
350
354
|
return path.join(SOCKDIR, name + ".send.lock");
|
|
351
355
|
}
|
|
356
|
+
// agent sessionへの送信1本(振り分け〜Enterの確認)を守るlock。貼り付け1回ぶんの`.send.lock`とは別に持つ。
|
|
357
|
+
function agentSendLockPath(name) {
|
|
358
|
+
assertSessionName(name);
|
|
359
|
+
return path.join(SOCKDIR, name + ".agent-send.lock");
|
|
360
|
+
}
|
|
361
|
+
// 持ち主が終了した`.agent-send.lock`を片付ける役の印。
|
|
362
|
+
function agentSendReapPath(name) {
|
|
363
|
+
return agentSendLockPath(name) + ".reap";
|
|
364
|
+
}
|
|
352
365
|
function readOffset(name) {
|
|
353
366
|
try {
|
|
354
367
|
const n = parseInt(fs.readFileSync(offsetpath(name), "utf8").trim(), 10);
|
|
@@ -1345,6 +1358,7 @@ function closeSessionInternal(name, observeDependency = true) {
|
|
|
1345
1358
|
/* noop */
|
|
1346
1359
|
}
|
|
1347
1360
|
}
|
|
1361
|
+
cleanupAgentSendLock(name);
|
|
1348
1362
|
cleanupAgentState(name);
|
|
1349
1363
|
agentLaunchLines.delete(name);
|
|
1350
1364
|
return `closed ${name}`;
|
|
@@ -1370,9 +1384,33 @@ export function closeSessionResult(name) {
|
|
|
1370
1384
|
};
|
|
1371
1385
|
}
|
|
1372
1386
|
export function killAll() {
|
|
1387
|
+
// agentsはAITERM_STATE_BASEを共有する別socketの席も含み得る。終了対象はこのsocketから確定する。
|
|
1388
|
+
const sessions = new Set();
|
|
1389
|
+
const listed = tmux("list-sessions", "-F", "#{session_name}");
|
|
1390
|
+
if (listed.code !== 0 && !/no server running|No such file or directory|failed to connect/i.test(listed.stderr)) {
|
|
1391
|
+
throw new AitermError("killAllの対象sessionを取得できません: " + listed.stderr.trim(), 2);
|
|
1392
|
+
}
|
|
1393
|
+
if (listed.code === 0)
|
|
1394
|
+
for (const name of listed.stdout.trim().split(/\r?\n/).filter(Boolean)) {
|
|
1395
|
+
assertSessionName(name);
|
|
1396
|
+
sessions.add(name);
|
|
1397
|
+
}
|
|
1398
|
+
// serverが外から終了した時の控えも、このsocketの中に残る名前だけ片付ける。
|
|
1399
|
+
let socketFiles = [];
|
|
1400
|
+
try {
|
|
1401
|
+
socketFiles = fs.readdirSync(SOCKDIR);
|
|
1402
|
+
}
|
|
1403
|
+
catch {
|
|
1404
|
+
/* socketの置き場が無い */
|
|
1405
|
+
}
|
|
1406
|
+
for (const file of socketFiles) {
|
|
1407
|
+
const name = file.replace(/\.(?:log|offset|lastcmd|mark|send\.lock|agent-send\.lock(?:\.reap)?)$/, "");
|
|
1408
|
+
if (name !== file && /^[A-Za-z0-9_-]{1,64}$/.test(name))
|
|
1409
|
+
sessions.add(name);
|
|
1410
|
+
}
|
|
1373
1411
|
{
|
|
1374
1412
|
// 別プロセスの待機(file lock が生きているもの)も巻き添えにしない
|
|
1375
|
-
const foreign = liveWaitLocks(null);
|
|
1413
|
+
const foreign = liveWaitLocks(null).filter((lock) => sessions.has(lock.session));
|
|
1376
1414
|
if (foreign.length > 0) {
|
|
1377
1415
|
const list = foreign.map((d) => `${d.session}${d.pid != null ? `(pid ${d.pid})` : ""}`).join(",");
|
|
1378
1416
|
throw new AitermError(`agent_done 待機中の session があるため killAll できません: ${list}`, 2);
|
|
@@ -1385,11 +1423,14 @@ export function killAll() {
|
|
|
1385
1423
|
throw new AitermError(`送信中の session があるため killAll できません: ${list}`, 2);
|
|
1386
1424
|
}
|
|
1387
1425
|
}
|
|
1388
|
-
tmux("kill-server");
|
|
1389
|
-
|
|
1426
|
+
const killed = tmux("kill-server");
|
|
1427
|
+
if (killed.code !== 0 && !/no server running|No such file or directory|failed to connect/i.test(killed.stderr)) {
|
|
1428
|
+
throw new AitermError("このsocketのserverを終了できません: " + killed.stderr.trim(), 2);
|
|
1429
|
+
}
|
|
1430
|
+
// B9: SOCKDIR 内の .log/.offset/.lastcmd/.mark/.send.lock/.agent-send.lock 残骸も掃除する。
|
|
1390
1431
|
try {
|
|
1391
1432
|
for (const f of fs.readdirSync(SOCKDIR)) {
|
|
1392
|
-
if (/\.(log|offset|lastcmd|mark)$/.test(f) || f.endsWith(".send.lock")) {
|
|
1433
|
+
if (/\.(log|offset|lastcmd|mark)$/.test(f) || f.endsWith(".send.lock") || /\.agent-send\.lock(?:\.reap)?$/.test(f)) {
|
|
1393
1434
|
try {
|
|
1394
1435
|
fs.unlinkSync(path.join(SOCKDIR, f));
|
|
1395
1436
|
}
|
|
@@ -1402,37 +1443,8 @@ export function killAll() {
|
|
|
1402
1443
|
catch {
|
|
1403
1444
|
/* SOCKDIR 不在等は無視 */
|
|
1404
1445
|
}
|
|
1405
|
-
const
|
|
1406
|
-
|
|
1407
|
-
try {
|
|
1408
|
-
for (const f of fs.readdirSync(adir)) {
|
|
1409
|
-
if (f.endsWith(".agent.json") ||
|
|
1410
|
-
f.endsWith(".events.jsonl") ||
|
|
1411
|
-
f.endsWith(".wait.lock") ||
|
|
1412
|
-
f.endsWith(".claude-settings.json") ||
|
|
1413
|
-
f.endsWith(".claude-mcp.json") ||
|
|
1414
|
-
f.endsWith(".claude-result.json") ||
|
|
1415
|
-
f.endsWith(".claude-operation.json") ||
|
|
1416
|
-
f.endsWith(".claude-dispatch") ||
|
|
1417
|
-
f.endsWith(".interim.json") ||
|
|
1418
|
-
f.endsWith(".auth.json") ||
|
|
1419
|
-
f.endsWith(".codex-home") ||
|
|
1420
|
-
f.endsWith(".grok-home") ||
|
|
1421
|
-
f.endsWith(".home")) {
|
|
1422
|
-
try {
|
|
1423
|
-
fs.rmSync(path.join(adir, f), { recursive: true, force: true });
|
|
1424
|
-
}
|
|
1425
|
-
catch {
|
|
1426
|
-
/* noop */
|
|
1427
|
-
}
|
|
1428
|
-
}
|
|
1429
|
-
}
|
|
1430
|
-
}
|
|
1431
|
-
catch {
|
|
1432
|
-
/* agent state dir 不在等は無視 */
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1435
|
-
agentMetadataNegativeCache.clear();
|
|
1446
|
+
for (const name of sessions)
|
|
1447
|
+
cleanupAgentState(name);
|
|
1436
1448
|
return "killed all sessions on this socket";
|
|
1437
1449
|
}
|
|
1438
1450
|
function readAgentLineageSeed() {
|
|
@@ -1967,6 +1979,159 @@ function acquireSessionSendFileLock(name) {
|
|
|
1967
1979
|
}
|
|
1968
1980
|
};
|
|
1969
1981
|
}
|
|
1982
|
+
// ── 同じagent sessionへの送信を1本ずつ通す(ADR 0088) ────
|
|
1983
|
+
// 振り分け(差し込みか新しいturnか)から送り終えるまでの間に、入力受付待ちなどの待ちが挟まる。
|
|
1984
|
+
// その間に次の1通が同じ状態を読むと、Claudeはturnの印の取り合いで後の1通が断られ、他のharnessは同じ入力欄へ2回貼る。
|
|
1985
|
+
// 同じprocessの中は着いた順の待ち行列、別のprocessの間はfileで排他し、後の1通は前の1通が終わってから振り分け直す。
|
|
1986
|
+
const agentSendQueues = new Map();
|
|
1987
|
+
const agentSendHeld = new Set();
|
|
1988
|
+
let agentSendLockWaitMs = AGENT_SEND_LOCK_WAIT_MS;
|
|
1989
|
+
export function __testSetAgentSendLockWaitMs(value) {
|
|
1990
|
+
if (value !== null && (!Number.isSafeInteger(value) || value < 0))
|
|
1991
|
+
throw new Error("wait must be a non-negative integer");
|
|
1992
|
+
agentSendLockWaitMs = value ?? AGENT_SEND_LOCK_WAIT_MS;
|
|
1993
|
+
}
|
|
1994
|
+
// `O_EXCL`で作れた時だけ持ち主になる。既に在れば null。
|
|
1995
|
+
function tryCreateOwnedLock(p) {
|
|
1996
|
+
const nofollow = fs.constants.O_NOFOLLOW ?? 0;
|
|
1997
|
+
let fd;
|
|
1998
|
+
try {
|
|
1999
|
+
fd = fs.openSync(p, fs.constants.O_CREAT | fs.constants.O_EXCL | fs.constants.O_WRONLY | nofollow, 0o600);
|
|
2000
|
+
}
|
|
2001
|
+
catch (e) {
|
|
2002
|
+
const code = e.code;
|
|
2003
|
+
// Windowsは、消している途中のfile(他のprocessがまだ開いている)と同じ名前を作るとEPERM/EACCESになる。
|
|
2004
|
+
if (code === "EEXIST" || (isWin && (code === "EPERM" || code === "EACCES")))
|
|
2005
|
+
return null;
|
|
2006
|
+
throw e;
|
|
2007
|
+
}
|
|
2008
|
+
const token = randomBytes(16).toString("hex");
|
|
2009
|
+
try {
|
|
2010
|
+
// 書けなかったlockは中身が読めないまま残り、鮮度猶予の後に持ち主なしとして片付く。
|
|
2011
|
+
fs.writeFileSync(fd, JSON.stringify({ pid: process.pid, at: new Date().toISOString(), token }) + "\n", "utf8");
|
|
2012
|
+
}
|
|
2013
|
+
finally {
|
|
2014
|
+
fs.closeSync(fd);
|
|
2015
|
+
}
|
|
2016
|
+
return token;
|
|
2017
|
+
}
|
|
2018
|
+
function releaseOwnedLock(p, token) {
|
|
2019
|
+
try {
|
|
2020
|
+
const st = fs.lstatSync(p);
|
|
2021
|
+
if (!st.isFile() || st.isSymbolicLink())
|
|
2022
|
+
return;
|
|
2023
|
+
const current = JSON.parse(fs.readFileSync(p, "utf8").split("\n", 1)[0]);
|
|
2024
|
+
if (current.token === token)
|
|
2025
|
+
fs.unlinkSync(p);
|
|
2026
|
+
}
|
|
2027
|
+
catch {
|
|
2028
|
+
/* 別の持ち主のlockや置換済みpathは消さない */
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
// 同じprocessの送信は待ち行列で1本になっているので、自分のpidのlockは外し損ねた残骸と読める(probeWaitLock)。
|
|
2032
|
+
// このprocessが持っている最中のlockだけは、その読みから外す。
|
|
2033
|
+
function probeAgentSendLock(name) {
|
|
2034
|
+
const probe = probeWaitLock(agentSendLockPath(name));
|
|
2035
|
+
return probe.pid === process.pid && agentSendHeld.has(name) ? { ...probe, live: true } : probe;
|
|
2036
|
+
}
|
|
2037
|
+
// 持ち主が終了したlockを片付ける。確かめてから消すまでの間に別のprocessが新しいlockを作ると生きたlockを消すので、
|
|
2038
|
+
// 消す役を`.reap`の`O_EXCL`で1つに絞り、その中でもう一度確かめてから消す。lockが在る間は誰も新しいlockを作れない。
|
|
2039
|
+
// done=片付けた(または片付ける物が無かった)/busy=別のprocessが片付け中/stuck=片付けの印が持ち主なしで残っている
|
|
2040
|
+
function reapDeadAgentSendLock(name) {
|
|
2041
|
+
const guard = agentSendReapPath(name);
|
|
2042
|
+
const token = tryCreateOwnedLock(guard);
|
|
2043
|
+
if (token === null)
|
|
2044
|
+
return probeWaitLock(guard).live ? "busy" : "stuck";
|
|
2045
|
+
try {
|
|
2046
|
+
if (!probeAgentSendLock(name).live) {
|
|
2047
|
+
try {
|
|
2048
|
+
fs.unlinkSync(agentSendLockPath(name));
|
|
2049
|
+
}
|
|
2050
|
+
catch {
|
|
2051
|
+
/* 既に無い */
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
finally {
|
|
2056
|
+
releaseOwnedLock(guard, token);
|
|
2057
|
+
}
|
|
2058
|
+
return "done";
|
|
2059
|
+
}
|
|
2060
|
+
function agentSendBusyError(name, pid, waitMs) {
|
|
2061
|
+
return new AitermError(`AGENT_SEND_BUSY: agent session '${name}' は${pid != null ? `別プロセス(pid ${pid})` : "先に受け付けた送信"}の処理中です。` +
|
|
2062
|
+
`${waitMs}ms待っても順番が来ませんでした。文字列は送信していません。少し後で再度 pty_send してください。`, 2);
|
|
2063
|
+
}
|
|
2064
|
+
async function acquireAgentSendFileLock(name, deadline, waitMs) {
|
|
2065
|
+
const p = agentSendLockPath(name);
|
|
2066
|
+
for (;;) {
|
|
2067
|
+
const token = tryCreateOwnedLock(p);
|
|
2068
|
+
if (token !== null)
|
|
2069
|
+
return () => releaseOwnedLock(p, token);
|
|
2070
|
+
const probe = probeAgentSendLock(name);
|
|
2071
|
+
if (!probe.live && reapDeadAgentSendLock(name) === "stuck") {
|
|
2072
|
+
throw new AitermError(`agent session '${name}' に、終了した送信のlockを片付ける途中で残った印があります。` +
|
|
2073
|
+
`自動回収は並行送信の混線を招くため行いません。文字列は送信していません。` +
|
|
2074
|
+
`pty_listで対象を確認し、pty_closeでsessionを閉じてから同じIDで再作成してください`, 2);
|
|
2075
|
+
}
|
|
2076
|
+
if (performance.now() >= deadline)
|
|
2077
|
+
throw agentSendBusyError(name, probe.live ? probe.pid : null, waitMs);
|
|
2078
|
+
await sleep(AGENT_SEND_LOCK_POLL_MS);
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
async function withAgentSendLock(name, run) {
|
|
2082
|
+
const waitMs = agentSendLockWaitMs;
|
|
2083
|
+
const deadline = performance.now() + waitMs;
|
|
2084
|
+
const previous = agentSendQueues.get(name) ?? Promise.resolve();
|
|
2085
|
+
let leave;
|
|
2086
|
+
const mine = new Promise((resolve) => {
|
|
2087
|
+
leave = resolve;
|
|
2088
|
+
});
|
|
2089
|
+
// 待ち切れずに抜けた送信の後ろも、前の送信が終わるまで待つ。行列の控えは、ここまでの送信が全部終わってから消す。
|
|
2090
|
+
const tail = previous.then(() => mine);
|
|
2091
|
+
agentSendQueues.set(name, tail);
|
|
2092
|
+
void tail.then(() => {
|
|
2093
|
+
if (agentSendQueues.get(name) === tail)
|
|
2094
|
+
agentSendQueues.delete(name);
|
|
2095
|
+
});
|
|
2096
|
+
let timer;
|
|
2097
|
+
try {
|
|
2098
|
+
const myTurn = await Promise.race([
|
|
2099
|
+
previous.then(() => true),
|
|
2100
|
+
new Promise((resolve) => {
|
|
2101
|
+
timer = setTimeout(() => resolve(false), waitMs);
|
|
2102
|
+
}),
|
|
2103
|
+
]);
|
|
2104
|
+
clearTimeout(timer);
|
|
2105
|
+
if (!myTurn)
|
|
2106
|
+
throw agentSendBusyError(name, null, waitMs);
|
|
2107
|
+
const release = await acquireAgentSendFileLock(name, deadline, waitMs);
|
|
2108
|
+
agentSendHeld.add(name);
|
|
2109
|
+
try {
|
|
2110
|
+
return await run();
|
|
2111
|
+
}
|
|
2112
|
+
finally {
|
|
2113
|
+
agentSendHeld.delete(name);
|
|
2114
|
+
release();
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
finally {
|
|
2118
|
+
clearTimeout(timer);
|
|
2119
|
+
leave();
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
// pty_closeの掃除。生きた持ち主のlockは残す(その送信はsessionが無くなった所で失敗し、自分のlockを外す)。
|
|
2123
|
+
function cleanupAgentSendLock(name) {
|
|
2124
|
+
const guard = agentSendReapPath(name);
|
|
2125
|
+
try {
|
|
2126
|
+
if (fs.existsSync(guard) && !probeWaitLock(guard).live)
|
|
2127
|
+
fs.unlinkSync(guard);
|
|
2128
|
+
if (fs.existsSync(agentSendLockPath(name)))
|
|
2129
|
+
reapDeadAgentSendLock(name);
|
|
2130
|
+
}
|
|
2131
|
+
catch {
|
|
2132
|
+
/* 掃除の失敗で閉じる処理を止めない */
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
1970
2135
|
// close/killAll 用: 生きた別プロセス待機の wait lock を列挙する(stale 残骸は数えない)。
|
|
1971
2136
|
function liveWaitLocks(name) {
|
|
1972
2137
|
const dir = existingAgentsDir();
|
|
@@ -3293,6 +3458,11 @@ async function prepareAgentInput(name, meta, options) {
|
|
|
3293
3458
|
}
|
|
3294
3459
|
export async function sendInitialAgentPrompt(name, text, o = {}) {
|
|
3295
3460
|
assertSessionName(name);
|
|
3461
|
+
loadAgentMetadata(name);
|
|
3462
|
+
// 起動時promptの準備中に届いたpty_sendは、起動時promptを送り終えてから振り分ける(ADR 0088)。
|
|
3463
|
+
return withAgentSendLock(name, () => sendInitialAgentPromptInLock(name, text, o));
|
|
3464
|
+
}
|
|
3465
|
+
async function sendInitialAgentPromptInLock(name, text, o) {
|
|
3296
3466
|
const meta = loadAgentMetadata(name);
|
|
3297
3467
|
if (meta.initial_prompt === "done") {
|
|
3298
3468
|
throw new AitermError(`agent session '${name}' の起動時 prompt は既に完了しています`, 2);
|
|
@@ -3895,6 +4065,10 @@ async function assertCursorPromptNotHookBlocked(name) {
|
|
|
3895
4065
|
}
|
|
3896
4066
|
export async function dispatchAgentTurn(name, text, o = {}) {
|
|
3897
4067
|
assertSessionName(name);
|
|
4068
|
+
loadAgentMetadata(name);
|
|
4069
|
+
return withAgentSendLock(name, () => dispatchAgentTurnInLock(name, text, o));
|
|
4070
|
+
}
|
|
4071
|
+
async function dispatchAgentTurnInLock(name, text, o) {
|
|
3898
4072
|
const meta = loadAgentMetadata(name);
|
|
3899
4073
|
const operationId = o.operation_id == null ? null : validateOperationId(o.operation_id);
|
|
3900
4074
|
if (operationId && meta.kind !== "claude") {
|
|
@@ -4042,9 +4216,14 @@ export function __testSteerQueued(kind, screen) {
|
|
|
4042
4216
|
* agent sessionへの唯一の送信口。呼び出し側は子の状態を知らないまま呼び、Aitermがこの時点の画面で振り分ける。
|
|
4043
4217
|
* 実行中なら現在のturnへ差し込み(steer)、そうでなければ新しいturnとしてdispatchする。
|
|
4044
4218
|
* 振り分けを呼び出し側へ任せると、状態を見てから呼ぶまでの間に子のturnが変わり、選んだ入口が外れる。
|
|
4219
|
+
* 同じsessionへの送信は1本ずつ通し、重なった後の1通は前の1通が終わってから振り分け直す(ADR 0088)。
|
|
4045
4220
|
*/
|
|
4046
4221
|
export async function sendAgentMessage(name, text, o = {}) {
|
|
4047
4222
|
assertSessionName(name);
|
|
4223
|
+
loadAgentMetadata(name);
|
|
4224
|
+
return withAgentSendLock(name, () => sendAgentMessageInLock(name, text, o));
|
|
4225
|
+
}
|
|
4226
|
+
async function sendAgentMessageInLock(name, text, o) {
|
|
4048
4227
|
const meta = loadAgentMetadata(name);
|
|
4049
4228
|
// 前面回復は busy 判定より先(bash 前面のままだと画面の実行中マーカーを読んでも打鍵が届かない)。
|
|
4050
4229
|
const paneInputRecovery = await ensureAgentOwnsPaneInput(name, meta.kind);
|
|
@@ -4064,7 +4243,7 @@ export async function sendAgentMessage(name, text, o = {}) {
|
|
|
4064
4243
|
if (running) {
|
|
4065
4244
|
return steerRunningTurn(name, meta, text, { raw: o.raw, pane_input_recovery: paneInputRecovery });
|
|
4066
4245
|
}
|
|
4067
|
-
return
|
|
4246
|
+
return dispatchAgentTurnInLock(name, text, { raw: o.raw, before_send: o.before_send, pane_input_recovery: paneInputRecovery });
|
|
4068
4247
|
}
|
|
4069
4248
|
/**
|
|
4070
4249
|
* 実行中turnへ追加の指示を渡す。各harnessの標準操作だけを使い、完了境界は1つに保つ。
|
package/dist/index.js
CHANGED
|
@@ -273,6 +273,7 @@ registerRemoteAwareTool("pty_send", {
|
|
|
273
273
|
"receipt の event_cursor を返す。" +
|
|
274
274
|
NON_BLOCKING_RULE +
|
|
275
275
|
"自動配送以外の結果回収は pty_read(agent_transcript:true)、Claude の durable turn は claude_turn を使う。" +
|
|
276
|
+
"require_agent:true はagent登録が無いsessionへ打鍵せず、AGENT_SESSION_REQUIREDで未送信を返す。" +
|
|
276
277
|
"force:true は非Claude agent sessionへの手動介入用の素送信。aiterm相関付きClaudeの承認UIはclaude_approvalを使う。",
|
|
277
278
|
inputSchema: {
|
|
278
279
|
session_id: z.string(),
|
|
@@ -291,6 +292,7 @@ registerRemoteAwareTool("pty_send", {
|
|
|
291
292
|
.boolean()
|
|
292
293
|
.default(false)
|
|
293
294
|
.describe("非Claude agent sessionでは自動dispatchせず素送信する。aiterm相関付きClaudeのactive turnには使えない"),
|
|
295
|
+
require_agent: z.boolean().default(false).describe("agent登録が無いsessionは打鍵前に拒否する。force:trueとは併用できない"),
|
|
294
296
|
rtk: z.boolean().default(false).describe("既知コマンドを rtk 形へ委譲して送る(rtk 不在なら素通し)"),
|
|
295
297
|
raw: z.boolean().default(false).describe("送信前サニタイズを無効化"),
|
|
296
298
|
image: z
|
|
@@ -315,10 +317,17 @@ registerRemoteAwareTool("pty_send", {
|
|
|
315
317
|
// dispatch前に行った pane 入力の回復("fg" / "fg_stopped" / "stty_raw")。通常送信では省略(additive)。
|
|
316
318
|
pane_input_recovery: z.array(z.string()).optional(),
|
|
317
319
|
},
|
|
318
|
-
}, async ({ session_id, text, enter, mark, force, rtk, raw, image }, extra) => {
|
|
320
|
+
}, async ({ session_id, text, enter, mark, force, require_agent, rtk, raw, image }, extra) => {
|
|
319
321
|
let delivery = null;
|
|
320
322
|
try {
|
|
321
|
-
if (
|
|
323
|
+
if (require_agent && force) {
|
|
324
|
+
throw new Error("require_agent:true は force:true と併用できません。文字列は送信していません。");
|
|
325
|
+
}
|
|
326
|
+
const agentSession = !force && core.isAgentSession(session_id);
|
|
327
|
+
if (require_agent && !agentSession) {
|
|
328
|
+
throw new Error(`AGENT_SESSION_REQUIRED: session '${session_id}' のagent登録がありません。文字列は送信していません。`);
|
|
329
|
+
}
|
|
330
|
+
if (agentSession) {
|
|
322
331
|
if (enter === false)
|
|
323
332
|
throw new Error("agent session への dispatch は enter:false と併用できません(手動介入は force:true)");
|
|
324
333
|
if (mark)
|
package/docs/DESIGN.md
CHANGED
|
@@ -47,6 +47,16 @@ psmuxが出力した余分な環境値を返さない。通常PTYとagentへ`AIT
|
|
|
47
47
|
sessionの表には環境が丸ごと入るので、名指しで登録した名前をsessionのoption `@aiterm_env_keys`に控え、
|
|
48
48
|
`env_keys`はその名前だけを返す。psmuxは元から端末ごとに呼び出し元の環境を継ぐ。
|
|
49
49
|
|
|
50
|
+
内部の`killAll`は終了するsocketのsession一覧と、そのsocketのログ等に残るsession名だけを対象にする。
|
|
51
|
+
別socketが同じ`AITERM_STATE_BASE`を使っていても、他のsessionの登録・完了記録・待機lockを削除しない。
|
|
52
|
+
対象の一覧取得やserver終了が失敗した場合は登録を削除しない(ADR 0087)。
|
|
53
|
+
試験の正規入口(`npm test`とCI)は`test/seat-env.mjs`を前処理として読み、席の保存場所・系譜・tmux環境を外し、
|
|
54
|
+
試験processごとの一時領域を指定する。個別試験が指定する`TMPDIR`と`XDG_RUNTIME_DIR`もそのまま利用できる。
|
|
55
|
+
|
|
56
|
+
agent配送だけを期待する連携元は`pty_send(require_agent:true)`を指定する。agent登録が無ければ、通常PTYへ送る前に
|
|
57
|
+
`AGENT_SESSION_REQUIRED`と「文字列は送信していません」を返す。未送信を確定してから対象sessionを復旧できる。
|
|
58
|
+
省略時の通常PTY送信は維持し、`force:true`との併用は打鍵前に拒否する。
|
|
59
|
+
|
|
50
60
|
`pty_observe`は存在、pane/harnessの生存、画面状態と理由、native process identityを分ける。
|
|
51
61
|
PIDは開始識別子・argv digestと組にし、paneとharnessを同一視しない。特定できないidentityはnull。
|
|
52
62
|
同じlaunchに属するnpm shimとnative本体は、中間の非候補processも含めた祖先関係から一つの起動として扱う。
|
|
@@ -85,6 +95,9 @@ agent sessionへの送信口は`pty_send`だけとする。子の状態は呼び
|
|
|
85
95
|
実行中なら現在のturnへ追加textを差し込み、新しい完了境界と配送は作らない。完了境界は差し込み後も1つに保つ。
|
|
86
96
|
Claude Codeはtool処理中に画面の実行中表示が消え、Stop hookの実行中には表示が残る。turnの印を実行中判定の正本とする。Stopが発火しないAPIエラー終了では、次の送信時に印の作成後の会話記録にある`isApiErrorMessage`を確認し、終了したturnの印だけを解除する。過去のエラーで新しい印を解除しない。waiterは印を変更せず、読取専用のままエラーを返す。
|
|
87
97
|
それ以外は新しいturnとしてdispatchする。
|
|
98
|
+
振り分けから送り終えるまでの間には、起動直後の入力受付待ちなどの待ちが挟まる。同じsessionへの送信(`pty_send`、`claude_turn issue`、起動時prompt)は1本ずつ通し、
|
|
99
|
+
重なった後の1通は前の1通が終わってから振り分け直す。同じprocessの中は着いた順の待ち行列、別のprocessの間はsocketの置き場の`<name>.agent-send.lock`で排他する。
|
|
100
|
+
待つ上限は、起動から最初の描画を待つ上限と貼り付けの上限の和で、越えたら`AGENT_SEND_BUSY`で未送信を返す。判断の記録はADR 0088(`docs/adr/0088-one-agent-send-per-session.md`)。
|
|
88
101
|
CodexとClaude Codeは次のtool境界で同じturnへ取り込む。Cursorは「follow-ups」枠へ入った文を「enter steer」で現在turnへ移し、`turn_ended`は最後に1回書く。
|
|
89
102
|
待ち行列の表示は5秒待ち、子のturnが続いている間だけ30秒まで延ばす(表示が遅い端末がある。turnが終わっていれば、文は新しいturnとして始まっている)。
|
|
90
103
|
Grokは待ち行列へ入れた後に「send now」を押す。旧turnは`cancelled`(`cancellation_context.trigger=send_now`)で閉じ、
|
|
@@ -299,6 +312,8 @@ ADR 0074(repositoryの`docs/adr/0074-agent-model-catalog.md`)。
|
|
|
299
312
|
境界失敗は明示errorにする。retry、別model、別harness、別backendへ自動fallbackしない。
|
|
300
313
|
stale send lockは並行processとのABAを避けるため自動削除せず、公開APIでは対象sessionを`pty_close`して
|
|
301
314
|
同じIDで再作成する。全session一括停止は公開しない。
|
|
315
|
+
agent sessionへの送信1本を守る`<name>.agent-send.lock`は持つ時間が長いので、持ち主が終了した残骸を次の送信が片付ける。消す役を`<name>.agent-send.lock.reap`の排他作成で1つに絞り、
|
|
316
|
+
その中でもう一度確かめてから消すので、確かめた後で別のlockに入れ替わらない。消す役の印そのものが残った時だけは自動で消さず、`pty_close`を案内する。
|
|
302
317
|
|
|
303
318
|
Grokのread-only sandbox起動拒否は、`src/harnesses/grok.ts`の
|
|
304
319
|
`assertGrokSandboxNotRejected`がCLIのエラー表示から検出する。`src/core.ts`の共通入力受付待機は
|
package/docs/RELEASE.md
CHANGED
|
@@ -17,6 +17,7 @@ Aitermのreleaseはこのrepositoryが所有する。`.github/workflows/product-
|
|
|
17
17
|
## Release手順
|
|
18
18
|
|
|
19
19
|
1. 変更に直結するfocused testを手元で通す。full regressionは手元で回さず、CIに任せる。
|
|
20
|
+
個別試験も`node --import ./test/seat-env.mjs --test ...`で起動する。稼働中の席の保存場所を試験へ継承しない。
|
|
20
21
|
2. `CHANGELOG.md`の`## [Unreleased]`へ内容を書き、mainへcommitしてpushする。
|
|
21
22
|
3. 一回で公開する。
|
|
22
23
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aiterm-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.52.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, and Cursor Agent CLI, plus durable PTYs for SSH, containers, and REPLs.",
|
|
6
6
|
"keywords": [
|
|
@@ -64,10 +64,10 @@
|
|
|
64
64
|
"mcpb:build": "npm run build && node scripts/build-mcpb.mjs && npm ci --omit=dev --ignore-scripts --no-audit --no-fund --prefix dist/mcpb-stage/server && npx --yes @anthropic-ai/mcpb@2.1.2 validate dist/mcpb-stage/manifest.json && npx --yes @anthropic-ai/mcpb@2.1.2 pack dist/mcpb-stage dist/aiterm-mcp.mcpb",
|
|
65
65
|
"verify:release-commit": "node scripts/verify-release-commit.mjs",
|
|
66
66
|
"release": "node scripts/release.mjs",
|
|
67
|
-
"test:docs": "node --test test/repository-contract.test.mjs",
|
|
67
|
+
"test:docs": "node --import ./test/seat-env.mjs --test test/repository-contract.test.mjs",
|
|
68
68
|
"prepublishOnly": "npm run verify:release-commit && npm run build",
|
|
69
69
|
"start": "node dist/index.js",
|
|
70
|
-
"test": "npm run build && node --test scripts/verify-release-commit.test.mjs test/*.test.mjs"
|
|
70
|
+
"test": "npm run build && node --import ./test/seat-env.mjs --test scripts/verify-release-commit.test.mjs test/*.test.mjs"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
73
|
"@modelcontextprotocol/sdk": "^1.29.0",
|