aiterm-mcp 0.70.23 → 0.70.25
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 +11 -1
- package/README.ja.md +1 -1
- package/README.md +1 -1
- package/dist/agent-idle-clock.js +10 -0
- package/dist/core.js +54 -36
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.70.25] - 2026-11-11
|
|
11
|
+
|
|
12
|
+
- `pty_list` with seat turns is faster on a host with many seats. Checking whether one seat exists listed every seat with its agent metadata, and each metadata read scanned the whole agents folder, so one call grew with the number of seats squared (10-27 s for about 140 members). The check now reads only the session names, with the same tmux call, retry and failures. On the production state, reading the turns of 48 seats went from 4.6 s to 2.3 s. What `pty_list` returns is unchanged.
|
|
13
|
+
|
|
14
|
+
## [0.70.24] - 2026-11-11
|
|
15
|
+
|
|
16
|
+
- Closing a seat now also ends its idle-clock worker. `pty_close`, killing all sessions, and a fresh launch under the same name removed the clock record but left the waiting `sh`/`sleep` (PowerShell on Windows) running until its wake time, so a deleted member's `agent-idle-cli --session <name>` stayed visible on the host. Before the record is removed, the worker is ended when its PID and start time still match the record: on Linux and macOS its own process group (the shell, its sleep, and a checker that is just waking), on Windows its PowerShell. A process never ends its own clock. If the worker cannot be ended, it still exits at wake on the missing token, as before. Live seats are unchanged.
|
|
17
|
+
|
|
10
18
|
## [0.70.23] - 2026-11-11
|
|
11
19
|
|
|
12
20
|
- A Claude seat that is signed out now reports failure category `authentication`. The real signed-out API error record of Claude Code 2.1.310/2.1.319 carries `error: "authentication_failed"` and no `apiErrorStatus`; that record, a 401, or (for a record with neither) the CLI's login line is now `authentication`, and the parent-delivery record accepts the value.
|
|
@@ -3297,7 +3305,9 @@ prototype (preserved under `prototype/python/` as the porting source and referen
|
|
|
3297
3305
|
`ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
|
|
3298
3306
|
provenance.
|
|
3299
3307
|
|
|
3300
|
-
[Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.
|
|
3308
|
+
[Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.25...HEAD
|
|
3309
|
+
[0.70.25]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.24...v0.70.25
|
|
3310
|
+
[0.70.24]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.23...v0.70.24
|
|
3301
3311
|
[0.70.23]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.22...v0.70.23
|
|
3302
3312
|
[0.70.22]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.21...v0.70.22
|
|
3303
3313
|
[0.70.21]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.20...v0.70.21
|
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.
|
|
218
|
+
**状態:** 開発継続中 · 現行公開版 **v0.70.25** · 動作対象は 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.
|
|
230
|
+
**Status:** actively maintained · current public release **v0.70.25** · 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/agent-idle-clock.js
CHANGED
|
@@ -57,6 +57,16 @@ export function isAgentIdleClockOwner(clock) {
|
|
|
57
57
|
return [process.pid, process.ppid].includes(clock.owner.pid) && readProcessIdentities([clock.owner.pid])
|
|
58
58
|
.some(row => row.started_identity === clock.owner.started_identity);
|
|
59
59
|
}
|
|
60
|
+
/** A closed seat's sleep worker ends with it; the caller's own clock (its checker or that checker's sh) is left alone. */
|
|
61
|
+
export function endAgentIdleClock(clock) {
|
|
62
|
+
const { pid, started_identity } = clock.owner;
|
|
63
|
+
if ([process.pid, process.ppid].includes(pid)
|
|
64
|
+
|| !readProcessIdentities([pid]).some(row => row.started_identity === started_identity))
|
|
65
|
+
return;
|
|
66
|
+
// POSIX workers are spawned detached (setsid), so the owner leads a group holding its sleep and any waking checker.
|
|
67
|
+
const windows = process.platform === "win32";
|
|
68
|
+
signalRuntimeProcess({ pid, started_identity, process_group_id: pid, argv_digest: "" }, windows ? "SIGKILL" : "SIGTERM", !windows);
|
|
69
|
+
}
|
|
60
70
|
/** Called under the existing seat send lock; the record is not an independent admission. */
|
|
61
71
|
export async function armAgentIdleClock(meta, anchor, wakeAt, replaceToken) {
|
|
62
72
|
const previous = readAgentIdleClock(meta);
|
package/dist/core.js
CHANGED
|
@@ -38,7 +38,7 @@ import { withCodexGoal } from "./harnesses/codex-goal.js";
|
|
|
38
38
|
import { configureWithPausedGoal } from "./configure-goal.js";
|
|
39
39
|
import { initializeAgentActivity, recordAgentInput, recordAgentTurnEnd, readAgentActivity } from "./agent-activity.js";
|
|
40
40
|
import { checkIdleSeat, decideIdleSeat, idleMinutes } from "./agent-idle.js";
|
|
41
|
-
import { AGENT_IDLE_ENABLED, armAgentIdleClock, idleClockDeadline, isAgentIdleClockOwner, requestAgentIdleClock, requestAgentIdleClocks } from "./agent-idle-clock.js";
|
|
41
|
+
import { AGENT_IDLE_ENABLED, armAgentIdleClock, endAgentIdleClock, idleClockDeadline, isAgentIdleClockOwner, requestAgentIdleClock, requestAgentIdleClocks } from "./agent-idle-clock.js";
|
|
42
42
|
import { stopProcessTree } from "./process-tree-stop.js";
|
|
43
43
|
import { writeAgentResumeRecoveryOrigin, confirmedAgentResumeRecoveryOrigin, readAgentResumeResolution, writeAgentResumeResolution, agentResumeRecordDigest, captureAgentResumeTemplate, readAgentResumeTemplate, writeAgentResumeTemplate, finishAgentResumeConfiguration, refreshAgentResumeRecipe, readAgentIdleClock, retireAgentIdleClock, readAgentResumeRecipe, writeAgentResumeRecipe, agentResumeRecipeDigest, readAgentLifecycle, writeAgentLifecycle, cancelAgentStopping, readAgentResumeAttempt, writeAgentResumeAttempt, readAgentResumeNative, writeAgentResumeNative } from "./agent-lifecycle.js";
|
|
44
44
|
import { createCodexGoalObjective, editCodexGoalObjective, submitCodexGoalCommand } from "./harnesses/codex-goal-editor.js";
|
|
@@ -369,6 +369,13 @@ function cleanupAgentState(name) {
|
|
|
369
369
|
if (!f.startsWith(prefix))
|
|
370
370
|
continue;
|
|
371
371
|
const p = path.join(dir, f);
|
|
372
|
+
if (f.endsWith(".idle-clock.json"))
|
|
373
|
+
try {
|
|
374
|
+
const clock = readAgentIdleClock({ aiterm_session: name, launch_id: f.slice(prefix.length, -".idle-clock.json".length) });
|
|
375
|
+
if (clock)
|
|
376
|
+
endAgentIdleClock(clock);
|
|
377
|
+
}
|
|
378
|
+
catch { /* an unended worker still exits at wake: its token is gone with the record below */ }
|
|
372
379
|
try {
|
|
373
380
|
if (f.endsWith(".agent.json") ||
|
|
374
381
|
f.endsWith(".active-launch.json") ||
|
|
@@ -1640,7 +1647,7 @@ export function observeSession(name, cursor) {
|
|
|
1640
1647
|
result.state = "unknown";
|
|
1641
1648
|
result.reason = `agent_${state}`;
|
|
1642
1649
|
result.pane_alive = null;
|
|
1643
|
-
const native =
|
|
1650
|
+
const native = nativeSessionExists(name);
|
|
1644
1651
|
if (state !== "hibernated" || native) {
|
|
1645
1652
|
if (native && state === "hibernated")
|
|
1646
1653
|
result.reason = "resume_native_conflict";
|
|
@@ -1655,7 +1662,7 @@ export function observeSession(name, cursor) {
|
|
|
1655
1662
|
}
|
|
1656
1663
|
// Discard the old pane's cursor; hibernation proves absence, not an activity delta.
|
|
1657
1664
|
if (!isDeepStrictEqual(loadAgentMetadata(name), meta) || agentDormantState(meta) !== "hibernated"
|
|
1658
|
-
||
|
|
1665
|
+
|| nativeSessionExists(name))
|
|
1659
1666
|
return result;
|
|
1660
1667
|
result.state = "hibernated";
|
|
1661
1668
|
result.reason = "idle_timeout";
|
|
@@ -1682,10 +1689,10 @@ export function absentHarnessAlive(meta, platform = process.platform) {
|
|
|
1682
1689
|
// Input admission needs the same native ownership proof, without activity capture or child-delivery scans.
|
|
1683
1690
|
function observeSessionNative(name) {
|
|
1684
1691
|
assertSessionName(name);
|
|
1685
|
-
const listed =
|
|
1692
|
+
const listed = nativeSessionExists(name);
|
|
1686
1693
|
const result = {
|
|
1687
1694
|
schema: "aiterm.pty-observe-result.v1", session_id: name, observed_at: new Date().toISOString(),
|
|
1688
|
-
exists:
|
|
1695
|
+
exists: listed, harness: null, launch_id: null, state: "missing", reason: "session_missing",
|
|
1689
1696
|
pane_alive: false, harness_alive: null, pane_process: null, harness_process: null, process_identity: null,
|
|
1690
1697
|
token_hint: null, pending_child_deliveries: null,
|
|
1691
1698
|
activity: { cursor: null, output_changed: null, cpu_seconds: null, cpu_delta_seconds: null, cpu_delta_complete: null,
|
|
@@ -2143,7 +2150,7 @@ function observeEmptyCreatedLaunch(target, alive) {
|
|
|
2143
2150
|
export function observeExecutionParentProcess(name) {
|
|
2144
2151
|
assertSessionName(name);
|
|
2145
2152
|
return readExecutionParentProcess(name, {
|
|
2146
|
-
present: () =>
|
|
2153
|
+
present: () => nativeSessionExists(name),
|
|
2147
2154
|
metadata: () => tryLoadAgentMetadata(name),
|
|
2148
2155
|
pane: () => tmux("display-message", "-p", "-t", name, "#{pane_pid}\t#{pane_dead}"),
|
|
2149
2156
|
processes: readRuntimeProcesses,
|
|
@@ -2156,45 +2163,56 @@ export function observeExecutionParentProcess(name) {
|
|
|
2156
2163
|
const SESSION_LIST_EXITING_RETRY_MS = 500;
|
|
2157
2164
|
const SESSION_LIST_EXITING_POLL_MS = 20;
|
|
2158
2165
|
const SESSION_LIST_SERVER_EXITING_RE = /server exited unexpectedly/i;
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key))
|
|
2162
|
-
throw new AitermError("env_keysの環境変数名が不正です", 2);
|
|
2163
|
-
}
|
|
2166
|
+
/** The native session rows, unenriched. Each row is [name, command, attached, width, height]. */
|
|
2167
|
+
function listNativeSessionRows(runTmux = tmux) {
|
|
2164
2168
|
const list = () => runTmux("list-sessions", "-F", "#{session_name}\t#{pane_current_command}\t#{session_attached}\t#{window_width}\t#{window_height}");
|
|
2165
2169
|
let r = list();
|
|
2166
2170
|
for (const deadline = performance.now() + SESSION_LIST_EXITING_RETRY_MS; r.code !== 0 && SESSION_LIST_SERVER_EXITING_RE.test(r.stderr) && performance.now() < deadline;) {
|
|
2167
2171
|
pauseSync(SESSION_LIST_EXITING_POLL_MS);
|
|
2168
2172
|
r = list();
|
|
2169
2173
|
}
|
|
2170
|
-
const sessions = [];
|
|
2171
2174
|
if (r.code !== 0 && !/no server running|No such file or directory/i.test(r.stderr))
|
|
2172
2175
|
throw new AitermError("セッション一覧を取得できません: " + r.stderr.trim(), 2);
|
|
2173
|
-
if (r.code
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2176
|
+
if (r.code !== 0)
|
|
2177
|
+
return [];
|
|
2178
|
+
const rows = r.stdout.trim().split("\n").filter(Boolean).map(line => line.split("\t"));
|
|
2179
|
+
for (const [name] of rows)
|
|
2180
|
+
assertSessionName(name);
|
|
2181
|
+
return rows;
|
|
2182
|
+
}
|
|
2183
|
+
/** Same listing and failure as pty_list, without loading every seat's metadata: one seat's existence check stays one
|
|
2184
|
+
* tmux call (2026-11-11: per-seat full lists made a CurrentWork pty_list take 10-27 s for ~140 members). */
|
|
2185
|
+
function nativeSessionExists(name) {
|
|
2186
|
+
return listNativeSessionRows().some(([listed]) => listed === name);
|
|
2187
|
+
}
|
|
2188
|
+
function listNativeSessionsResult(envKeys = [], runTmux = tmux) {
|
|
2189
|
+
for (const key of envKeys) {
|
|
2190
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key))
|
|
2191
|
+
throw new AitermError("env_keysの環境変数名が不正です", 2);
|
|
2192
|
+
}
|
|
2193
|
+
const sessions = [];
|
|
2194
|
+
for (const [name, command, attached, width, height] of listNativeSessionRows(runTmux)) {
|
|
2195
|
+
const environment = {};
|
|
2196
|
+
const registered = envKeys.length ? registeredSessionEnvironment(name) : null;
|
|
2197
|
+
for (const key of envKeys) {
|
|
2198
|
+
// sessionの表には開いたprocessの環境も入っている。返すのは名指しで登録した値だけ。
|
|
2199
|
+
if (registered && !registered.includes(key)) {
|
|
2200
|
+
environment[key] = null;
|
|
2201
|
+
continue;
|
|
2191
2202
|
}
|
|
2192
|
-
const
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2203
|
+
const value = tmux("show-environment", "-t", name, key);
|
|
2204
|
+
if (value.code !== 0 && !/unknown variable|not found|not set/i.test(value.stderr))
|
|
2205
|
+
throw new AitermError("session環境変数を照会できません", 2);
|
|
2206
|
+
// psmuxは指定以外の内部キーも出すため、要求されたキーと完全一致した行だけを返す。
|
|
2207
|
+
const selected = value.stdout.split(/\r?\n/).find(entry => entry.startsWith(`${key}=`));
|
|
2208
|
+
environment[key] = selected === undefined ? null : selected.slice(key.length + 1);
|
|
2197
2209
|
}
|
|
2210
|
+
const meta = tryLoadAgentMetadata(name);
|
|
2211
|
+
sessions.push({ session_id: name, current_command: normalizePaneCommand(command), attached: Number(attached) > 0,
|
|
2212
|
+
width: Number(width), height: Number(height), harness: meta ? agentHarness(meta.kind) : null,
|
|
2213
|
+
launch_id: meta?.launch_id ?? null,
|
|
2214
|
+
vendor_session_id: meta?.vendor_session_id ?? null, environment });
|
|
2215
|
+
}
|
|
2198
2216
|
return { schema: "aiterm.pty-list-result.v1", observed_at: new Date().toISOString(), sessions };
|
|
2199
2217
|
}
|
|
2200
2218
|
export function listSessionsResult(envKeys = [], runTmux = tmux) {
|
|
@@ -4954,7 +4972,7 @@ function readExecutionAuthMetadata(name) {
|
|
|
4954
4972
|
}
|
|
4955
4973
|
/** 一覧の取得失敗を端末の消失へ丸めず、正規PTY一覧で存在を確認する。 */
|
|
4956
4974
|
function authSessionExists(name) {
|
|
4957
|
-
return
|
|
4975
|
+
return nativeSessionExists(name);
|
|
4958
4976
|
}
|
|
4959
4977
|
function authSessionEnvironment(name, keys) {
|
|
4960
4978
|
const env = { ...process.env };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aiterm-mcp",
|
|
3
|
-
"version": "0.70.
|
|
3
|
+
"version": "0.70.25",
|
|
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": [
|