aiterm-mcp 0.70.42 → 0.70.44
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 +16 -1
- package/README.ja.md +1 -1
- package/README.md +6 -9
- package/dist/agent-idle.js +3 -3
- package/dist/core.js +67 -77
- package/dist/index.js +13 -11
- package/dist/process-runtime.js +1 -34
- package/dist/seat-turns-worker.js +69 -0
- package/docs/DESIGN.md +2 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.70.44] - 2026-11-13
|
|
11
|
+
|
|
12
|
+
- A seat's own work (`pty_observe` `activity.post_startup_process_count` and seat-turns `own_work.processes`) now counts only what runs under the harness's own command-execution shell: Claude's Bash (incl. `run_in_background`), Codex exec, and the Grok and Cursor tool shells, recognised per OS by their wrapper shapes (ADR 0141). MCP servers, hooks, relays, helpers and Aiterm's own process-table reads are never counted, so an idle seat with a waiting hook or a restarted MCP server reads 0 and can hibernate. No startup snapshot is used any more, so seats launched by older versions are counted too (0 instead of null). Antigravity commands are not counted yet (exec shape not captured).
|
|
13
|
+
|
|
14
|
+
## [0.70.43] - 2026-11-13
|
|
15
|
+
|
|
16
|
+
- A kept (hibernated) seat can be closed, sent to, resumed or deleted on a fresh container before any launch: the send locks create the socket directory (`claude-tmux-sockets`) when it is missing, as a launch does. Before, the first `pty_close` / `pty_send` failed with `ENOENT ... <name>.agent-send.lock` until some other seat had been launched (a46 lab, 2026-11-13).
|
|
17
|
+
|
|
18
|
+
- `pty_list` with the seat-turns caller marker no longer stops the server: `readSeatTurns` runs on one persistent worker thread per server (created on the first marked call, unref'd, same environment), with unchanged results (Kiro a37/a44, 2026-11-13: on production 82 rows held the whole server for 2.4 s every 5 s poll, so BellTeam's goal list took 1.6-4.9 s). A lost worker answers with the synchronous read and the next call starts a new one.
|
|
19
|
+
- `pty_close {hibernate:true}` no longer needs the on-screen settings check: an explicit hibernate resumes with the saved settings (launch model/effort/fast; a model changed inside the seat is not kept), as the rate-limited case already did. Before, every Claude seat whose recipe names a model alias (`opus`, as BellTeam launches) failed with `AGENT_HIBERNATE_UNAVAILABLE: native_configuration_unconfirmed` (t29, Centi's lab 2026-11-13). The idle clock keeps the check.
|
|
20
|
+
- `pty_observe` on a hibernated seat says `reason: "native_vanished"` when the hibernation is a restart adoption (its native session vanished, e.g. a container replacement, and a send or launch adopted it), and `idle_timeout` only for the idle clock and an explicit hibernate.
|
|
21
|
+
- `AGENT_RESUME_SECRETS_REQUIRED` / `AGENT_RESUME_SECRET_MISSING` refusals carry their payload in `_meta["aiterm/resume_secrets"]` (`aiterm.agent-resume-secrets.v1`) plus `_meta["aiterm/error_code"]`, no longer in `structuredContent`. Likewise `aiterm.agent-resume-error.v1` moves to `_meta["aiterm/resume_error"]` and `aiterm.agent-send-error.v1` to `_meta["aiterm/send_error"]`, each with `aiterm/error_code` taken from the payload's code: an `isError` result never carries `structuredContent` outside the tool's declared `outputSchema` (`agent_configure`'s declared error variant stays). An MCP SDK client that has listed the tools validates `structuredContent` against the tool's success schema even on `isError`, so a `pty_send` to a hibernated seat whose recipe names a secret (every BellTeam Claude seat after a body swap) came back as `-32602 Structured content does not match the tool's output schema` with no code (Kiro, production 2026-11-13).
|
|
22
|
+
|
|
10
23
|
## [0.70.42] - 2026-11-13
|
|
11
24
|
|
|
12
25
|
- `pty_list` `aiterm/seat_turns` rows carry `own_work` when the caller sends `_meta["aiterm/own_work_exclusions"]` (a41; Kiro, Owner-approved design 2026-11-13): `{processes, excluded, child_results, exclusions_digest, oldest}` beside `turn`. `processes` are the processes the seat's CLI started after startup and still runs (the same set as `post_startup_process_count`), minus those a process entry of the caller's list names for this seat (exe + leading args, with the match's descendants and post-startup ancestors); `oldest` is the oldest one's descriptor and start time. Descriptors are built where the process runs and never carry raw argv: program basename, first two non-flag arguments as basenames, and any token over 40 characters or containing `=`, `://` or `@` becomes `…` (on macOS arguments are split on whitespace). One process-table read per call; terminals compute their own rows inside the relayed read.
|
|
@@ -3388,7 +3401,9 @@ prototype (preserved under `prototype/python/` as the porting source and referen
|
|
|
3388
3401
|
`ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
|
|
3389
3402
|
provenance.
|
|
3390
3403
|
|
|
3391
|
-
[Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.
|
|
3404
|
+
[Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.44...HEAD
|
|
3405
|
+
[0.70.44]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.43...v0.70.44
|
|
3406
|
+
[0.70.43]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.42...v0.70.43
|
|
3392
3407
|
[0.70.42]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.41...v0.70.42
|
|
3393
3408
|
[0.70.41]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.40...v0.70.41
|
|
3394
3409
|
[0.70.40]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.39...v0.70.40
|
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.44** · 動作対象は 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.44** · 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
|
|
|
@@ -592,15 +592,12 @@ A confirmed hibernation keeps the same logical session in `pty_list`, with the s
|
|
|
592
592
|
Codex can start a native queued turn during resume. At standard speed, Aiterm accepts that busy state only with the saved conversation proof, a new `task_started` after the hibernation cursor and the same live native launch. A busy screen alone is insufficient. This path does not capture user work as startup scaffolding: its post-startup process count remains unknown and automatic hibernation stays disabled for that launch. Fast restoration still requires an idle composer. Failed attempts remain blocked. Resume failures return `isError: true` and `structuredContent` with schema `aiterm.agent-resume-error.v1`, code `AGENT_RESUME_UNCONFIRMED` or `AGENT_RESUME_FAILED`, `session_id`, `launch_id`, `input: "not_sent"` and `recovery: "inspect_session"`. The input status describes only this request's body; it does not prove that the CLI was never started or that other native input was not processed. Inspect the seat; do not automatically resend or restart it.
|
|
593
593
|
|
|
594
594
|
Two fields tell a caller what closing an agent session would lose. `activity.post_startup_process_count` is the number of
|
|
595
|
-
processes
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
process that has exited, such as a reconnected MCP server) is not counted either, and neither are the processes Aiterm itself
|
|
600
|
-
starts to read the process table (`ps`, or PowerShell and its console host on Windows). `pending_child_deliveries`
|
|
595
|
+
processes running under the harness's own command-execution shell: the shell the CLI starts to run a command for the model
|
|
596
|
+
(Claude's Bash tool, including `run_in_background`; Codex exec; the Grok, Cursor and Antigravity tool shells), and everything
|
|
597
|
+
below it. MCP servers, hooks, relays, helpers and Aiterm's own process-table reads are not counted, however long they run
|
|
598
|
+
(ADR 0141, 0.70.44; the name is kept from the older startup-snapshot rule). `pending_child_deliveries`
|
|
601
599
|
is the number of sub-agent results this session is still waiting for as a parent, whoever the caller is. Both are null when
|
|
602
|
-
Aiterm cannot tell (ordinary terminals,
|
|
603
|
-
process), and may be absent when a remote host runs an older Aiterm. Treat null or absent as unknown, not as zero.
|
|
600
|
+
Aiterm cannot tell (ordinary terminals, an unresolved harness process, or an unreadable process table), and may be absent when a remote host runs an older Aiterm. Treat null or absent as unknown, not as zero.
|
|
604
601
|
|
|
605
602
|
Another product that needs to deliver an answer to a Codex parent can ask Aiterm with `aiterm-parent-delivery` instead of registering its own hooks.
|
|
606
603
|
Aiterm's registered hooks and the official queue deliver it. `codex verify --thread <uuid>` checks the parent and reports configuration in `steer`
|
package/dist/agent-idle.js
CHANGED
|
@@ -7,7 +7,7 @@ export function idleMinutes(value = process.env.AITERM_IDLE_MINUTES) {
|
|
|
7
7
|
return minutes;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* `immediate` is an explicit hibernate request: no deadline and no
|
|
10
|
+
* `immediate` is an explicit hibernate request: no deadline, no attachment refusal and no screen settings check. A Claude turn that ended on a
|
|
11
11
|
* rate limit (no Stop event; the CLI then waits in its limit footer or menu) counts as ended at that error.
|
|
12
12
|
*/
|
|
13
13
|
export function decideIdleSeat(seat, now, minutes = 30, expectedAnchor, immediate = false) {
|
|
@@ -44,8 +44,8 @@ export function decideIdleSeat(seat, now, minutes = 30, expectedAnchor, immediat
|
|
|
44
44
|
return result;
|
|
45
45
|
if (expectedAnchor !== undefined && expectedAnchor !== anchor)
|
|
46
46
|
return { ...result, reason: "superseded_timer", anchor, due_at: due };
|
|
47
|
-
//
|
|
48
|
-
if (now >= due && !
|
|
47
|
+
// An explicit hibernate resumes with the saved recipe (no screen settings check; a model changed inside the seat is not kept).
|
|
48
|
+
if (now >= due && !immediate && !seat.native_configuration_confirmed)
|
|
49
49
|
return { ...result, reason: "native_configuration_unconfirmed", anchor, due_at: due };
|
|
50
50
|
return { ...result, outcome: now < due ? "not_due" : "ready", reason: now < due ? "before_deadline" : "idle_timeout", anchor, due_at: due };
|
|
51
51
|
}
|
package/dist/core.js
CHANGED
|
@@ -52,7 +52,7 @@ import { isCursorMcpClient } from "aiterm-steer-delivery";
|
|
|
52
52
|
import { antigravityBinding, antigravityAuthChoiceKey, antigravityCurrentModel, antigravityStartupAction, antigravityAgentArgv, writeAntigravityCallerFiles, checkAntigravityCallerInput, antigravityPromptWithCaller, antigravityQuotaLimit, antigravityModelChoices, antigravityAuthStatus, antigravityAuthPane, antigravityTranscriptText, bindAntigravitySession, createAntigravityAgentMetadata, mergeAntigravityHooks } from "./harnesses/antigravity.js";
|
|
53
53
|
import { paneTokenHint } from "./harnesses/pane-tokens.js";
|
|
54
54
|
import { pendingChildResultsFor } from "./parent-delivery-owners.js";
|
|
55
|
-
import { readLinuxProcessRegistrationIdentity, readClaudeRegistrationIdentity, readProcessEnvironment, readRuntimeProcesses, readRuntimeProcessesShared, readProcessIdentities, processSubtree, parentProcess, processIdentity, signalRuntimeProcess, backgroundProcesses,
|
|
55
|
+
import { readLinuxProcessRegistrationIdentity, readClaudeRegistrationIdentity, readProcessEnvironment, readRuntimeProcesses, readRuntimeProcessesShared, readProcessIdentities, processSubtree, parentProcess, processIdentity, signalRuntimeProcess, backgroundProcesses, processElapsedSeconds } from "./process-runtime.js";
|
|
56
56
|
import { liveNodeExecutable } from "./live-node.js";
|
|
57
57
|
import { resolveClaudeConfigurationRoot, withClaudeConfigRoot, withClaudeSlotLogin } from "./claude-config-root.js";
|
|
58
58
|
import { probeWriteBan, writeBanPrefix, windowsWriteBanArgv } from "./write-ban.js";
|
|
@@ -150,6 +150,36 @@ const AGENT_COMMAND_PATTERNS = {
|
|
|
150
150
|
grok: /(^|[\s/])grok(-[^\s/]+)?([\s]|$)/,
|
|
151
151
|
cursor: /(^|[\s/])(cursor-agent|agent)([\s]|$)/,
|
|
152
152
|
};
|
|
153
|
+
// The shell each harness starts to run a model's command (ADR 0141; fixtures in test/own-exec-processes.test.mjs).
|
|
154
|
+
// Hooks, MCP servers and helpers are started another way, so they never match. Matched on the table's command line.
|
|
155
|
+
const AGENT_EXEC_SHELLS = {
|
|
156
|
+
// Bash tool and run_in_background (bash/zsh; Git Bash on Windows): the command ends by writing its cwd to claude-<hex>-cwd.
|
|
157
|
+
// Hooks are `sh -c <hook>`, Git Bash or pwsh without that file.
|
|
158
|
+
claude: command => /claude-[0-9a-f]+-cwd\b/.test(command),
|
|
159
|
+
// exec / unified exec: POSIX [shell, -c|-lc, command]; Windows pwsh -Command starting with its UTF-8 console line.
|
|
160
|
+
// Hooks and MCP servers are spawned with their own argv (Windows hooks: pwsh -NoProfile -Command "& ...").
|
|
161
|
+
codex: command => /^\s*\S+\s+-l?c\s/.test(command)
|
|
162
|
+
|| command.includes(" -Command \"try { [Console]::OutputEncoding=[System.Text.Encoding]::UTF8 } catch {}"),
|
|
163
|
+
// POSIX: the fd-5 wrapper. Windows: pwsh -ExecutionPolicy Bypass -Command <command>; hooks carry the $__grokExitCode tail.
|
|
164
|
+
grok: command => command.includes("__grok_user_cmd") || (/ -ExecutionPolicy Bypass -Command /.test(command) && !command.includes("__grokExitCode")),
|
|
165
|
+
// Cursor runs hooks through the same wrapper but passes them stdin (pipeStdin); a model's command gets none:
|
|
166
|
+
// bash/zsh `builtin eval "$1"[ 3<&- 4>&-] < /dev/null`, Windows pwsh `-NonInteractive -File …ps-script-<uuid>.ps1`.
|
|
167
|
+
// shortcut: a command run with the write-to-stdin tool also gets stdin and is not counted; read the script if that matters.
|
|
168
|
+
cursor: command => /builtin eval "\$1"(?: 3<&- 4>&-)? < \/dev\/null/.test(command)
|
|
169
|
+
|| /-NonInteractive -File \S*ps-script-[0-9a-f-]+\.ps1/i.test(command),
|
|
170
|
+
// shortcut: Antigravity's exec shape is not captured yet (quota), so its commands are not counted; add it from a real run.
|
|
171
|
+
antigravity: () => false,
|
|
172
|
+
};
|
|
173
|
+
const EXEC_SHELL_NAMES = new Set([...SHELLS, "pwsh", "powershell", "cmd"]);
|
|
174
|
+
// Sandboxes a harness puts between itself and its exec shell.
|
|
175
|
+
const SANDBOX_WRAPPERS = new Set(["codex-linux-sandbox", "sandbox-exec"]);
|
|
176
|
+
// Hosts that exist only to run the model's tools: each child is own work.
|
|
177
|
+
const toolHost = (kind, command) => kind === "codex"
|
|
178
|
+
&& (codexHelperProcess(command) || /^codex-command-runner(?:-[\d.]+)?$/.test(commandExecutable(command)));
|
|
179
|
+
function commandExecutable(command) {
|
|
180
|
+
const first = /^(?:"([^"]+)"|(\S+))/.exec(command);
|
|
181
|
+
return path.posix.basename((first?.[1] ?? first?.[2] ?? "").replace(/\\/g, "/")).replace(/\.exe$/i, "").replace(/^-/, "").toLowerCase();
|
|
182
|
+
}
|
|
153
183
|
/**
|
|
154
184
|
* `ps -t <tty> -o stat=,command=` の出力を分類する(純粋関数)。
|
|
155
185
|
* ログイン shell は command が `-zsh` のように先頭 `-` 付きで出るので剥がして判定する。
|
|
@@ -1576,9 +1606,7 @@ function decodeActivityCursor(cursor, name) {
|
|
|
1576
1606
|
}
|
|
1577
1607
|
export function selectHarnessProcesses(meta, rows, subtree) {
|
|
1578
1608
|
const matches = (row) => {
|
|
1579
|
-
const
|
|
1580
|
-
const executable = path.posix.basename((first?.[1] ?? first?.[2] ?? "").replace(/\\/g, "/"))
|
|
1581
|
-
.replace(/\.exe$/i, "").replace(/^-/, "").toLowerCase();
|
|
1609
|
+
const executable = commandExecutable(row.command);
|
|
1582
1610
|
const command = row.command.replace(/\\/g, "/").replace(/\.exe(?=["\s]|$)/gi, "").replace(/"/g, "");
|
|
1583
1611
|
const tokens = row.command.match(/"[^"]*"|'[^']*'|\S+/g) ?? [];
|
|
1584
1612
|
// native本体の先頭tokenと、sh/cmd経由で2番目以降に来るlauncherの両方を照合する。
|
|
@@ -1607,66 +1635,35 @@ export function selectHarnessProcesses(meta, rows, subtree) {
|
|
|
1607
1635
|
});
|
|
1608
1636
|
return roots;
|
|
1609
1637
|
}
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1638
|
+
/** Own work (ADR 0141): each exec shell the harness started for a model's command, with everything below it. */
|
|
1639
|
+
export function ownExecProcesses(meta, agent, rows) {
|
|
1640
|
+
const kind = meta.kind;
|
|
1613
1641
|
const byPid = new Map(rows.map(row => [row.pid, row]));
|
|
1614
|
-
const
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
// 起動完了の控えに無いprocessの数。harness・中継・Aitermが自分のために立てるprocessは、利用者の作業ではないので数えない。
|
|
1624
|
-
// その下で動くprocessは数える。
|
|
1625
|
-
// harnessは起動の足場(MCP、language server)を自分で立て直す。控えた後に立て直されると、控えに無いprocessとして残る。
|
|
1626
|
-
// 控えの物が終了していて、同じ親の下に同じargvで立ったprocessは、その立て直しとして数えない。
|
|
1627
|
-
// 親も立て直されている時は、立て直された親の下を見る。終了した控え1つにつき、数えないのは1つまで。
|
|
1628
|
-
export function postStartupProcessCount(kind, activityRows, rows, startup, shapes = [], harness) {
|
|
1629
|
-
return postStartupProcesses(kind, activityRows, rows, startup, shapes, harness).length;
|
|
1630
|
-
}
|
|
1631
|
-
/** The processes postStartupProcessCount counts (own_work, a41). */
|
|
1632
|
-
export function postStartupProcesses(kind, activityRows, rows, startup, shapes = [], harness) {
|
|
1633
|
-
const byPid = new Map(rows.map(row => [row.pid, row]));
|
|
1634
|
-
const relayChild = (row) => {
|
|
1635
|
-
const parent = parentProcess(row, byPid);
|
|
1636
|
-
return parent !== undefined && lazyRelayProcess(parent.command);
|
|
1637
|
-
};
|
|
1638
|
-
// 席の中のAitermも、配送の持ち主の生存確認でprocess表を引く。その問い合わせと、付いて立つconsole hostは数えない。
|
|
1639
|
-
// 親の問い合わせが先に終わって残ったconsole hostも同じ扱いにする(console hostは最後のconsole processと一緒に消える)。
|
|
1640
|
-
const ownProbe = (row) => {
|
|
1641
|
-
if (aitermProcessProbe(row.command))
|
|
1642
|
-
return true;
|
|
1643
|
-
const parent = parentProcess(row, byPid);
|
|
1644
|
-
return windowsConsoleHost(row) && (parent === undefined || aitermProcessProbe(parent.command));
|
|
1645
|
-
};
|
|
1646
|
-
const present = new Set(activityRows.map(processKey));
|
|
1647
|
-
const added = new Map(activityRows
|
|
1648
|
-
.filter(row => !startup.has(processKey(row)) && !(kind === "codex" && codexHelperProcess(row.command))
|
|
1649
|
-
&& !(kind === "claude" && macKeepAwakeProcess(row, harness)) && !relayChild(row) && !ownProbe(row))
|
|
1650
|
-
.map(row => [processKey(row), row]));
|
|
1651
|
-
const gone = shapes.filter(shape => startup.has(shape.identity) && !present.has(shape.identity));
|
|
1652
|
-
const replacedBy = new Map();
|
|
1653
|
-
for (let changed = gone.length > 0; changed;) {
|
|
1654
|
-
changed = false;
|
|
1655
|
-
for (const [key, row] of added) {
|
|
1656
|
-
const parent = parentProcess(row, byPid);
|
|
1657
|
-
if (!parent)
|
|
1658
|
-
continue;
|
|
1659
|
-
const parentKey = processKey(parent);
|
|
1660
|
-
const original = gone.find(shape => !replacedBy.has(shape.identity) && shape.argv_digest === row.argv_digest
|
|
1661
|
-
&& shape.parent !== null && (shape.parent === parentKey || replacedBy.get(shape.parent) === parentKey));
|
|
1662
|
-
if (!original)
|
|
1642
|
+
const children = new Map();
|
|
1643
|
+
for (const row of rows)
|
|
1644
|
+
if (parentProcess(row, byPid))
|
|
1645
|
+
children.set(row.parent_pid, [...children.get(row.parent_pid) ?? [], row]);
|
|
1646
|
+
const roots = [];
|
|
1647
|
+
const seen = new Set();
|
|
1648
|
+
const walk = (parent, hosted) => {
|
|
1649
|
+
for (const child of children.get(parent.pid) ?? []) {
|
|
1650
|
+
if (seen.has(child.pid))
|
|
1663
1651
|
continue;
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1652
|
+
seen.add(child.pid);
|
|
1653
|
+
const executable = commandExecutable(child.command);
|
|
1654
|
+
if (hosted || (EXEC_SHELL_NAMES.has(executable) && AGENT_EXEC_SHELLS[kind](child.command)))
|
|
1655
|
+
roots.push(child);
|
|
1656
|
+
else if (toolHost(kind, child.command))
|
|
1657
|
+
walk(child, true);
|
|
1658
|
+
// The harness itself again (e.g. Codex's native binary under its npm shim): its executable name, or the launch's own
|
|
1659
|
+
// arguments passed on (selectHarnessProcesses correlates the same way). A hook or server that merely names the harness is not.
|
|
1660
|
+
else if (SANDBOX_WRAPPERS.has(executable) || AGENT_COMMAND_PATTERNS[kind].test(executable)
|
|
1661
|
+
|| (!EXEC_SHELL_NAMES.has(executable) && child.command.includes(meta.launch_id)))
|
|
1662
|
+
walk(child, false);
|
|
1667
1663
|
}
|
|
1668
|
-
}
|
|
1669
|
-
|
|
1664
|
+
};
|
|
1665
|
+
walk(agent, false);
|
|
1666
|
+
return roots.flatMap(root => processSubtree(rows, root.pid));
|
|
1670
1667
|
}
|
|
1671
1668
|
// ---- own_work (a41, observation-results.md): what a seat started itself and has not finished ----
|
|
1672
1669
|
const ownWorkExclusionsSchema = z.object({
|
|
@@ -1799,9 +1796,7 @@ export async function seatOwnWork(names, requested) {
|
|
|
1799
1796
|
continue;
|
|
1800
1797
|
const activityRows = subtree.some(row => row.pid === agent.pid) ? subtree : [...subtree, ...processSubtree(rows, agent.pid)];
|
|
1801
1798
|
work.child_results = pendingChildResultsFor(name, activityRows, childExcluded);
|
|
1802
|
-
|
|
1803
|
-
continue;
|
|
1804
|
-
const counted = postStartupProcesses(meta.kind, activityRows, rows, new Set(meta.startup_processes), meta.startup_process_shapes, agent);
|
|
1799
|
+
const counted = ownExecProcesses(meta, agent, rows);
|
|
1805
1800
|
const processEntries = entries.filter(entry => entry.kind === "process");
|
|
1806
1801
|
const descriptors = new Map(counted.map(row => [row.pid, processDescriptor(processArgv(row))]));
|
|
1807
1802
|
const byPid = new Map(rows.map(row => [row.pid, row]));
|
|
@@ -1882,8 +1877,9 @@ export function observeSession(name, cursor) {
|
|
|
1882
1877
|
result.reason = "resume_native_conflict";
|
|
1883
1878
|
return result;
|
|
1884
1879
|
}
|
|
1880
|
+
const lifecycle = readAgentLifecycle(meta);
|
|
1885
1881
|
try {
|
|
1886
|
-
confirmedAgentResumeRecipe(meta,
|
|
1882
|
+
confirmedAgentResumeRecipe(meta, lifecycle);
|
|
1887
1883
|
}
|
|
1888
1884
|
catch {
|
|
1889
1885
|
result.reason = "resume_unconfirmed";
|
|
@@ -1893,8 +1889,9 @@ export function observeSession(name, cursor) {
|
|
|
1893
1889
|
if (!isDeepStrictEqual(loadAgentMetadata(name), meta) || agentDormantState(meta) !== "hibernated"
|
|
1894
1890
|
|| nativeSessionExists(name))
|
|
1895
1891
|
return result;
|
|
1892
|
+
// A seat whose native vanished (container replaced) and was adopted at send/launch is not an idle seat (Kiro, 2026-11-13).
|
|
1896
1893
|
result.state = "hibernated";
|
|
1897
|
-
result.reason = "idle_timeout";
|
|
1894
|
+
result.reason = "origin" in lifecycle && lifecycle.origin === "restart" ? "native_vanished" : "idle_timeout";
|
|
1898
1895
|
result.pane_alive = false;
|
|
1899
1896
|
result.harness_alive = false;
|
|
1900
1897
|
result.pending_child_deliveries = 0;
|
|
@@ -2011,8 +2008,6 @@ function observeNativeSession(name, cursor) {
|
|
|
2011
2008
|
screen_digest: createHash("sha256").update(screen).digest("hex"), processes, background_processes: backgroundCpu,
|
|
2012
2009
|
};
|
|
2013
2010
|
const comparable = previous?.pane_identity === sample.pane_identity;
|
|
2014
|
-
// 起動完了の控えが無いsession(通常PTY、控える前の版で起動したagent)とharnessを特定できない時は数えない。
|
|
2015
|
-
const startup = agent && Array.isArray(meta?.startup_processes) ? new Set(meta.startup_processes) : null;
|
|
2016
2011
|
// このsessionが親として待っている子の結果。子の記録が名指す親の席に数える(名指しが無ければ持ち主processで)。
|
|
2017
2012
|
result.pending_child_deliveries = agent ? pendingChildResultsFor(name, activityRows) : null;
|
|
2018
2013
|
result.activity = {
|
|
@@ -2024,8 +2019,7 @@ function observeNativeSession(name, cursor) {
|
|
|
2024
2019
|
background_cpu_seconds: Object.values(backgroundCpu).reduce((sum, cpu) => sum + cpu, 0),
|
|
2025
2020
|
background_cpu_delta_seconds: comparable ? Object.entries(backgroundCpu).reduce((sum, [identity, cpu]) => sum + cpu - (previous.background_processes[identity] ?? 0), 0) : null,
|
|
2026
2021
|
background_cpu_delta_complete: comparable ? Object.keys(previous.background_processes).every(identity => identity in backgroundCpu) : null,
|
|
2027
|
-
post_startup_process_count:
|
|
2028
|
-
? postStartupProcessCount(meta.kind, activityRows, rows, startup, meta.startup_process_shapes, agent) : null,
|
|
2022
|
+
post_startup_process_count: meta && agent ? ownExecProcesses(meta, agent, rows).length : null,
|
|
2029
2023
|
};
|
|
2030
2024
|
return result;
|
|
2031
2025
|
}
|
|
@@ -3400,6 +3394,7 @@ function liveSendLocks(name) {
|
|
|
3400
3394
|
}
|
|
3401
3395
|
function acquireSessionSendFileLock(name) {
|
|
3402
3396
|
const p = sendLockPath(name);
|
|
3397
|
+
fs.mkdirSync(SOCKDIR, { recursive: true });
|
|
3403
3398
|
const token = randomBytes(16).toString("hex");
|
|
3404
3399
|
const nofollow = fs.constants.O_NOFOLLOW ?? 0;
|
|
3405
3400
|
const deadline = Date.now() + SESSION_SEND_LOCK_WAIT_MS;
|
|
@@ -3479,6 +3474,8 @@ export function __testSetAgentSendLockWaitMs(value) {
|
|
|
3479
3474
|
function tryCreateOwnedLock(p) {
|
|
3480
3475
|
const nofollow = fs.constants.O_NOFOLLOW ?? 0;
|
|
3481
3476
|
let fd;
|
|
3477
|
+
// A fresh container has no SOCKDIR until the first launch; close/send/resume/delete of a kept seat lock before that (a46 lab).
|
|
3478
|
+
fs.mkdirSync(path.dirname(p), { recursive: true });
|
|
3482
3479
|
try {
|
|
3483
3480
|
fd = fs.openSync(p, fs.constants.O_CREAT | fs.constants.O_EXCL | fs.constants.O_WRONLY | nofollow, 0o600);
|
|
3484
3481
|
}
|
|
@@ -4991,13 +4988,6 @@ async function prepareAgentInput(name, meta, options, acceptRunningCodex = false
|
|
|
4991
4988
|
if (live.harness_alive !== true || live.harness_process === null
|
|
4992
4989
|
|| (live.state !== "idle" && !(ready.steer && live.state === "busy" && codexRunningTurn(meta) !== null)))
|
|
4993
4990
|
return { status: "blocked", reason: live.reason };
|
|
4994
|
-
// ここまでに居るprocessは起動時の足場(harness・MCP・起動時hook)。初手を送る前に控える。
|
|
4995
|
-
// shortcut: a native queued turn can already own children, so leave its startup baseline unknown until a future lifecycle can distinguish them.
|
|
4996
|
-
if (live.activity.cursor !== null && !ready.steer) {
|
|
4997
|
-
meta.startup_processes = Object.keys(decodeActivityCursor(live.activity.cursor, name).processes);
|
|
4998
|
-
meta.startup_process_shapes = startupProcessShapes(meta.startup_processes, readRuntimeProcesses());
|
|
4999
|
-
writeAgentMetadata(meta);
|
|
5000
|
-
}
|
|
5001
4991
|
return { status: "ready", reason: "composer_ready" };
|
|
5002
4992
|
}
|
|
5003
4993
|
export async function sendInitialAgentPrompt(name, text, o = {}) {
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,8 @@ import { AitermError, AgentResumeUnavailableError, AgentResumeError, AgentResume
|
|
|
20
20
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
21
21
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
22
22
|
import { readPrivateEnvLine, setPrivateEnv, privateEnvValue } from "./private-env.js";
|
|
23
|
-
import { withTerminalLaunchAction, withErrorCode, launchNotStartedMeta } from "./terminal-launch-error.js";
|
|
23
|
+
import { withTerminalLaunchAction, withErrorCode, launchNotStartedMeta, ERROR_CODE_META } from "./terminal-launch-error.js";
|
|
24
|
+
import { readSeatTurnsOffLoop } from "./seat-turns-worker.js";
|
|
24
25
|
import { codexMcpOverrides } from "./harnesses/codex.js";
|
|
25
26
|
import { CallToolRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
26
27
|
import { z } from "zod";
|
|
@@ -241,17 +242,18 @@ export function createAitermServer(options = {}) {
|
|
|
241
242
|
if (e instanceof AgentResumeUnavailableError)
|
|
242
243
|
return { content: [{ type: "text", text: "aiterm: " + msg }], isError: true,
|
|
243
244
|
_meta: { "aiterm/resume_unavailable": { ...e.resumeUnavailable } } };
|
|
245
|
+
// Typed failures outside a tool's declared outputSchema go in _meta, never structuredContent: a client that listed the
|
|
246
|
+
// tools validates structuredContent against the success outputSchema even on isError -> -32602, code lost (Kiro, 2026-11-13).
|
|
247
|
+
const typed = (key, payload) => ({ content: [{ type: "text", text: "aiterm: " + msg }], isError: true,
|
|
248
|
+
_meta: { [key]: payload, [ERROR_CODE_META]: { schema: "aiterm.error-code.v1", code: payload.code } } });
|
|
244
249
|
if (e instanceof AgentResumeSecretsError)
|
|
245
|
-
return
|
|
246
|
-
structuredContent: { ...e.resumeSecrets } };
|
|
250
|
+
return typed("aiterm/resume_secrets", { ...e.resumeSecrets });
|
|
247
251
|
if (e instanceof AgentResumeError)
|
|
248
|
-
return
|
|
249
|
-
structuredContent: { ...e.resumeFailure } };
|
|
252
|
+
return typed("aiterm/resume_error", { ...e.resumeFailure });
|
|
250
253
|
const sendFailure = e instanceof AitermError ? e.sendFailure : undefined;
|
|
251
254
|
if (sendFailure)
|
|
252
|
-
return
|
|
253
|
-
|
|
254
|
-
? core.agentWaitProcess(sendFailure.session_id, sendFailure.event_cursor, { launchId: sendFailure.launch_id }, sendFailure.steer_id) : null } };
|
|
255
|
+
return typed("aiterm/send_error", { ...sendFailure, wait_process: sendFailure.event_cursor !== null && sendFailure.steer_id
|
|
256
|
+
? core.agentWaitProcess(sendFailure.session_id, sendFailure.event_cursor, { launchId: sendFailure.launch_id }, sendFailure.steer_id) : null });
|
|
255
257
|
const configurationFailure = e instanceof Error ? e.configurationFailure : undefined;
|
|
256
258
|
if (configurationFailure)
|
|
257
259
|
return {
|
|
@@ -798,7 +800,7 @@ export function createAitermServer(options = {}) {
|
|
|
798
800
|
description: "セッションを閉じ、ログ/読取位置を破棄する。同じsession_idへの再試行は安全で、" +
|
|
799
801
|
"closed/already_closedのstructured receiptを返す。" +
|
|
800
802
|
"hibernate:trueはClaude・Codexのagent席を今すぐ休止し(idle時計と同じ手順)、会話と再開情報を残してhibernatedを返す。" +
|
|
801
|
-
"次のagent_launch(session_name
|
|
803
|
+
"次のagent_launch(session_name)が同じ会話へ、保存した設定(起動時のmodel等。席の中で替えた物は持ち越さない)で再開する。turn・子process・子への配送が動いている間はAGENT_BUSYで断る(終わってから呼び直す)。" +
|
|
802
804
|
"Claudeの席が利用上限でturnを終えている時(最後の入力の後の会話記録がrate_limited)は、上限の待ち画面のままでも休止できる。" +
|
|
803
805
|
"他の理由で休止できない時はAGENT_HIBERNATE_UNAVAILABLE、席は触らない。",
|
|
804
806
|
inputSchema: {
|
|
@@ -895,9 +897,9 @@ export function createAitermServer(options = {}) {
|
|
|
895
897
|
loopDeadline(4_000, { seats: [], unread: bound }),
|
|
896
898
|
]);
|
|
897
899
|
}));
|
|
898
|
-
// callRemoteTool spawns its ssh only after an await: let the relays start before
|
|
900
|
+
// callRemoteTool spawns its ssh only after an await: let the relays start before the local read.
|
|
899
901
|
await new Promise(resolve => setImmediate(resolve));
|
|
900
|
-
const local =
|
|
902
|
+
const local = await readSeatTurnsOffLoop(sessions.filter(session => session.harness !== null).map(session => session.session_id), core.readSeatTurns);
|
|
901
903
|
// a41: own_work only for a caller that sends its exclusion list (observation-results.md); terminals compute their own rows.
|
|
902
904
|
const ownWork = requestMeta && typeof requestMeta === "object" ? requestMeta["aiterm/own_work_exclusions"] : undefined;
|
|
903
905
|
if (ownWork !== undefined) {
|
package/dist/process-runtime.js
CHANGED
|
@@ -5,9 +5,7 @@ import { processStartIdentity } from "./process-start.js";
|
|
|
5
5
|
import { spawnSync } from "node:child_process";
|
|
6
6
|
import { freshShared, spawnCollect } from "./spawn-collect.js";
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
8
|
-
import path from "node:path";
|
|
9
8
|
import { AitermError } from "./errors.js";
|
|
10
|
-
import { lazyRelayExecutable } from "./lazy-relay.js";
|
|
11
9
|
import { isWin } from "./tmux-runtime.js";
|
|
12
10
|
import { resolveWindowsPowerShell7 } from "./windows-powershell.js";
|
|
13
11
|
/**
|
|
@@ -37,12 +35,6 @@ export function readProcessEnvironment(pid, names, platform = process.platform,
|
|
|
37
35
|
// shortcut: ps joins entries with spaces, so a value with a space is cut there; Aiterm's values (token, root path) have none.
|
|
38
36
|
return Object.fromEntries(names.map(name => [name, [...psOutput.trimEnd().matchAll(new RegExp(`(?:^| )${name}=(\\S*)`, "gu"))].at(-1)?.[1] ?? null]));
|
|
39
37
|
}
|
|
40
|
-
/** Claude's native macOS keep-awake helper does no user work of its own. */
|
|
41
|
-
export function macKeepAwakeProcess(row, harness, platform = process.platform) {
|
|
42
|
-
const started = Date.parse(row.started_identity), parentStarted = Date.parse(harness?.started_identity ?? "");
|
|
43
|
-
return platform === "darwin" && !!harness && row.parent_pid === harness.pid && Number.isFinite(started)
|
|
44
|
-
&& Number.isFinite(parentStarted) && started >= parentStarted && /^(?:\/usr\/bin\/)?caffeinate -i -t 300$/.test(row.command.trim());
|
|
45
|
-
}
|
|
46
38
|
export function processIdentity(process) {
|
|
47
39
|
return {
|
|
48
40
|
pid: process.pid, process_group_id: process.process_group_id,
|
|
@@ -93,7 +85,7 @@ export function parsePosixProcessTable(text, includeSession = false, platform =
|
|
|
93
85
|
}
|
|
94
86
|
return rows;
|
|
95
87
|
}
|
|
96
|
-
// AitermがOSのprocess
|
|
88
|
+
// AitermがOSのprocess表を引く時のコマンドの形。
|
|
97
89
|
const POSIX_PS = "/bin/ps";
|
|
98
90
|
const POSIX_TABLE_ARGS = ["-axww", "-o", "pid=,ppid=,pgid=,stat=,lstart=,time=,command="];
|
|
99
91
|
const POSIX_SESSION_TABLE_ARGS = ["-axww", "-o", "pid=,ppid=,pgid=,sess=,stat=,lstart=,time=,command="];
|
|
@@ -101,25 +93,6 @@ const POSIX_IDENTITY_ARGS = ["-o", "pid=,lstart=", "-p"];
|
|
|
101
93
|
const POSIX_ELAPSED_ARGS = ["-o", "etime=", "-p"];
|
|
102
94
|
const WINDOWS_PROBE_HEADER = ["$ErrorActionPreference='Stop'", "[Console]::OutputEncoding=[Text.UTF8Encoding]::new($false)"];
|
|
103
95
|
const WINDOWS_PROBE_ARGS = ["-NoLogo", "-NoProfile", "-NonInteractive", "-EncodedCommand"];
|
|
104
|
-
// 先頭2行だけのbase64。3 byteの区切りで切り、後ろの行に左右されない前方一致にする。
|
|
105
|
-
const WINDOWS_PROBE_PREFIX = (() => {
|
|
106
|
-
const bytes = Buffer.from(WINDOWS_PROBE_HEADER.join("\n") + "\n", "utf16le");
|
|
107
|
-
return bytes.subarray(0, bytes.length - bytes.length % 3).toString("base64");
|
|
108
|
-
})();
|
|
109
|
-
/** Aitermがprocess表を引くために起こしたprocessか。引く側のAitermは、数えられる席の中のMCP processでもある。 */
|
|
110
|
-
export function aitermProcessProbe(command) {
|
|
111
|
-
if (command.includes(` ${WINDOWS_PROBE_ARGS.join(" ")} ${WINDOWS_PROBE_PREFIX}`))
|
|
112
|
-
return true;
|
|
113
|
-
return command === `${POSIX_PS} ${POSIX_TABLE_ARGS.join(" ")}` || command.startsWith(`${POSIX_PS} ${POSIX_IDENTITY_ARGS.join(" ")} `)
|
|
114
|
-
|| command === `${POSIX_PS} ${POSIX_SESSION_TABLE_ARGS.join(" ")}`
|
|
115
|
-
|| command.startsWith(`${POSIX_PS} ${POSIX_ELAPSED_ARGS.join(" ")} `);
|
|
116
|
-
}
|
|
117
|
-
/** Windowsのconsole host。console processの起動に付いて立ち、最後のconsole processが終わると消える。 */
|
|
118
|
-
export function windowsConsoleHost(row) {
|
|
119
|
-
const first = /^(?:"([^"]+)"|(\S+))/.exec(row.command);
|
|
120
|
-
const name = (row.executable || first?.[1] || first?.[2] || "").replace(/\\/g, "/");
|
|
121
|
-
return path.posix.basename(name).toLowerCase() === "conhost.exe";
|
|
122
|
-
}
|
|
123
96
|
export class ProcessProbeError extends AitermError {
|
|
124
97
|
processFailure;
|
|
125
98
|
constructor(message, processFailure) {
|
|
@@ -391,12 +364,6 @@ export function processSubtree(rows, rootPid) {
|
|
|
391
364
|
}
|
|
392
365
|
return rows.filter(row => selected.has(row.pid));
|
|
393
366
|
}
|
|
394
|
-
// 中継(mcp-lazy)は、登録されたMCPの本体と先行起動の判定を、自分の直接の子として起こす。
|
|
395
|
-
// 見分けるのは起動した実行ファイルの名前(argvの先頭のbasenameが`mcp-lazy`で始まる)。取り決めはmcp-lazyのREADMEにある。
|
|
396
|
-
export function lazyRelayProcess(command) {
|
|
397
|
-
const first = /^(?:"([^"]+)"|(\S+))/.exec(command);
|
|
398
|
-
return lazyRelayExecutable(first?.[1] ?? first?.[2] ?? "");
|
|
399
|
-
}
|
|
400
367
|
export function backgroundProcesses(rows, root) {
|
|
401
368
|
// 起動時の足場processを除く既存契約。pane開始から60秒以上後に生成された子孫だけを集計する。
|
|
402
369
|
const rootStart = Date.parse(root.started_identity);
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// core.readSeatTurns on one persistent worker thread, so the server keeps answering other calls meanwhile
|
|
2
|
+
// (observation-results.md readSeatTurns, 0.70.43; before, ~2.4 s of production seats blocked the whole server per poll).
|
|
3
|
+
import { Worker, isMainThread, parentPort, workerData, SHARE_ENV } from "node:worker_threads";
|
|
4
|
+
const ROLE = "aiterm-seat-turns";
|
|
5
|
+
if (!isMainThread && workerData === ROLE && parentPort) {
|
|
6
|
+
const port = parentPort;
|
|
7
|
+
// Messages wait in the port until this listener is attached.
|
|
8
|
+
void import("./core.js").then(core => port.on("message", ({ id, ids }) => {
|
|
9
|
+
let reply;
|
|
10
|
+
try {
|
|
11
|
+
reply = { id, result: core.readSeatTurns(ids) };
|
|
12
|
+
}
|
|
13
|
+
catch (e) {
|
|
14
|
+
reply = { id, error: e instanceof Error ? e.message : String(e) };
|
|
15
|
+
}
|
|
16
|
+
port.postMessage(reply);
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
let current = null;
|
|
20
|
+
let nextId = 0;
|
|
21
|
+
/** Reads in call order on the worker. A worker that dies answers its pending reads with `fallback` (the synchronous read). */
|
|
22
|
+
export function readSeatTurnsOffLoop(ids, fallback) {
|
|
23
|
+
if (!current) {
|
|
24
|
+
let worker;
|
|
25
|
+
// execArgv []: a parent's --import preload (e.g. one that re-roots HOME/TMPDIR) must not run again on the shared env.
|
|
26
|
+
try {
|
|
27
|
+
worker = new Worker(new URL(import.meta.url), { workerData: ROLE, env: SHARE_ENV, execArgv: [] });
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return Promise.resolve().then(() => fallback(ids));
|
|
31
|
+
}
|
|
32
|
+
worker.unref();
|
|
33
|
+
const slot = { worker, pending: new Map() };
|
|
34
|
+
worker.on("message", (reply) => {
|
|
35
|
+
const call = slot.pending.get(reply.id);
|
|
36
|
+
if (!call)
|
|
37
|
+
return;
|
|
38
|
+
slot.pending.delete(reply.id);
|
|
39
|
+
if (!slot.pending.size)
|
|
40
|
+
worker.unref();
|
|
41
|
+
if (reply.error !== undefined)
|
|
42
|
+
call.reject(new Error(reply.error));
|
|
43
|
+
else
|
|
44
|
+
call.resolve(reply.result);
|
|
45
|
+
});
|
|
46
|
+
const lost = () => {
|
|
47
|
+
if (current === slot)
|
|
48
|
+
current = null;
|
|
49
|
+
for (const call of slot.pending.values()) {
|
|
50
|
+
try {
|
|
51
|
+
call.resolve(fallback(call.ids));
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
call.reject(e);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
slot.pending.clear();
|
|
58
|
+
};
|
|
59
|
+
worker.on("error", lost);
|
|
60
|
+
worker.on("exit", lost);
|
|
61
|
+
current = slot;
|
|
62
|
+
}
|
|
63
|
+
const slot = current, id = nextId++;
|
|
64
|
+
return new Promise((resolve, reject) => {
|
|
65
|
+
slot.pending.set(id, { ids, resolve, reject });
|
|
66
|
+
slot.worker.ref(); // an awaited read keeps the process alive; an idle worker does not
|
|
67
|
+
slot.worker.postMessage({ id, ids });
|
|
68
|
+
});
|
|
69
|
+
}
|
package/docs/DESIGN.md
CHANGED
|
@@ -151,11 +151,9 @@ PIDは開始識別子・argv digestと組にし、paneとharnessを同一視し
|
|
|
151
151
|
同じlaunchに属するnpm shimとnative本体は、中間の非候補processも含めた祖先関係から一つの起動として扱う。
|
|
152
152
|
祖先を共有しない候補は別々に残し、複数候補を一つと推測しない。
|
|
153
153
|
POSIXの停止状態はOSのprocess表から取得し、SIGSTOP中は残画面より優先して`blocked/harness_stopped`を返す。
|
|
154
|
-
sessionを閉じると失うものは数で返す(ADR 0080)。`activity.post_startup_process_count
|
|
154
|
+
sessionを閉じると失うものは数で返す(ADR 0080)。`activity.post_startup_process_count`は、harnessが命令を走らせるために立てたshell(ClaudeのBash、Codexのexec、Grok・Cursor・Antigravityの道具のshell)の下で動くprocessの数、
|
|
155
155
|
`pending_child_deliveries`はそのsessionが親として待つ未配送の数。数えられない時はnullで、0と区別する。
|
|
156
|
-
|
|
157
|
-
harnessが同じ親の下に同じargvで立て直した起動時のprocessも数えない(ADR 0083)。
|
|
158
|
-
Aitermがprocess表を引くために起こしたprocess(`ps`、WindowsのPowerShellと付いて立つconsole host)も数えない(ADR 0084)。
|
|
156
|
+
MCP、hook、中継、補助process、Aiterm自身のprocess表の問い合わせは、その道を通らないので数えない(ADR 0141。起動完了の控えとADR 0082〜0084の除外を置き換えた)。
|
|
159
157
|
中継の後ろで眠っている本体を配送の引き取りのために起こすかは、`aiterm-delivery-wake`が返す(ADR 0082)。
|
|
160
158
|
ほかの製品がCodexの親へ回答を届ける時は、製品のhookを登録せず、`aiterm-parent-delivery`でAitermの親配送へ頼む(ADR 0098)。
|
|
161
159
|
Aitermの登録済みhookと公式キューで届け、設定(`steer`)・受付(`queued_submission_id`)・実際に届いた事(`hook:"emitted"`と`turn_id`)を分けて返す。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aiterm-mcp",
|
|
3
|
-
"version": "0.70.
|
|
3
|
+
"version": "0.70.44",
|
|
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": [
|