aiterm-mcp 0.70.41 → 0.70.43
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 +17 -1
- package/README.ja.md +1 -1
- package/README.md +1 -1
- package/dist/agent-idle.js +3 -3
- package/dist/core.js +198 -6
- package/dist/execution-native-server.js +2 -1
- package/dist/index.js +23 -11
- package/dist/parent-delivery-owners.js +44 -7
- package/dist/parent-delivery.js +19 -3
- package/dist/seat-turns-worker.js +69 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.70.43] - 2026-11-13
|
|
11
|
+
|
|
12
|
+
- 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).
|
|
13
|
+
|
|
14
|
+
- `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.
|
|
15
|
+
- `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.
|
|
16
|
+
- `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.
|
|
17
|
+
- `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).
|
|
18
|
+
|
|
19
|
+
## [0.70.42] - 2026-11-13
|
|
20
|
+
|
|
21
|
+
- `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.
|
|
22
|
+
- A seat no longer waits forever for child results it does not own. `pending_child_deliveries` (and `own_work.child_results`) count an unfinished delivery for the parent seat the child names, not for whichever process adopted the dead owner's records (Kiro, 2026-11-13: a seat running the execution server read 4 adopted deliveries of another seat and could never hibernate or close). A delivery whose local child was replaced, removed, hibernated or vanished now ends after two readings 30 s apart with `AGENT_RESULT_UNAVAILABLE: PARENT_DELIVERY_CHILD_GONE: <reason>`, delivered to its parent; before, the wait never ended.
|
|
23
|
+
|
|
10
24
|
## [0.70.41] - 2026-11-13
|
|
11
25
|
|
|
12
26
|
- Antigravity CLI 1.5.7 seats start again. agy 1.5.7 draws a mode hint in the empty composer (`> Auto mode: edits & safe commands auto-approved (shift+tab to cycle)`, also Accept-edits, Plan and Best-of-N), and Aiterm accepted only a bare `>` line as the empty composer, so every `agent_launch` ended `AGENT_STARTUP_BLOCKED vendor_state_unknown` (Kiro, 2026-11-13; container agy replaced 2026-11-12 23:38 UTC). The empty composer is now the footer plus a bare `>` line or exactly such a hint line (also when it wraps at the pane edge); a typed draft still reads as not empty.
|
|
@@ -3383,7 +3397,9 @@ prototype (preserved under `prototype/python/` as the porting source and referen
|
|
|
3383
3397
|
`ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
|
|
3384
3398
|
provenance.
|
|
3385
3399
|
|
|
3386
|
-
[Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.
|
|
3400
|
+
[Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.43...HEAD
|
|
3401
|
+
[0.70.43]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.42...v0.70.43
|
|
3402
|
+
[0.70.42]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.41...v0.70.42
|
|
3387
3403
|
[0.70.41]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.40...v0.70.41
|
|
3388
3404
|
[0.70.40]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.39...v0.70.40
|
|
3389
3405
|
[0.70.39]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.38...v0.70.39
|
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.43** · 動作対象は 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.43** · 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.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
|
@@ -23,6 +23,7 @@ import { withManagedSpan, observeManagedSpan, closeManagedSpan, SPAN_HELD } from
|
|
|
23
23
|
*/
|
|
24
24
|
import { spawnSync } from "node:child_process";
|
|
25
25
|
import * as fs from "node:fs";
|
|
26
|
+
import { z } from "zod";
|
|
26
27
|
import * as path from "node:path";
|
|
27
28
|
import { createHash, randomBytes } from "node:crypto";
|
|
28
29
|
import { launchEnvValue } from "./private-env.js";
|
|
@@ -50,7 +51,7 @@ import { readExecutionParentProcess } from "./execution-parent-process.js";
|
|
|
50
51
|
import { isCursorMcpClient } from "aiterm-steer-delivery";
|
|
51
52
|
import { antigravityBinding, antigravityAuthChoiceKey, antigravityCurrentModel, antigravityStartupAction, antigravityAgentArgv, writeAntigravityCallerFiles, checkAntigravityCallerInput, antigravityPromptWithCaller, antigravityQuotaLimit, antigravityModelChoices, antigravityAuthStatus, antigravityAuthPane, antigravityTranscriptText, bindAntigravitySession, createAntigravityAgentMetadata, mergeAntigravityHooks } from "./harnesses/antigravity.js";
|
|
52
53
|
import { paneTokenHint } from "./harnesses/pane-tokens.js";
|
|
53
|
-
import {
|
|
54
|
+
import { pendingChildResultsFor } from "./parent-delivery-owners.js";
|
|
54
55
|
import { readLinuxProcessRegistrationIdentity, readClaudeRegistrationIdentity, readProcessEnvironment, readRuntimeProcesses, readRuntimeProcessesShared, readProcessIdentities, processSubtree, parentProcess, processIdentity, signalRuntimeProcess, backgroundProcesses, lazyRelayProcess, aitermProcessProbe, windowsConsoleHost, macKeepAwakeProcess, processElapsedSeconds } from "./process-runtime.js";
|
|
55
56
|
import { liveNodeExecutable } from "./live-node.js";
|
|
56
57
|
import { resolveClaudeConfigurationRoot, withClaudeConfigRoot, withClaudeSlotLogin } from "./claude-config-root.js";
|
|
@@ -1625,6 +1626,10 @@ export function startupProcessShapes(identities, rows) {
|
|
|
1625
1626
|
// 控えの物が終了していて、同じ親の下に同じargvで立ったprocessは、その立て直しとして数えない。
|
|
1626
1627
|
// 親も立て直されている時は、立て直された親の下を見る。終了した控え1つにつき、数えないのは1つまで。
|
|
1627
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) {
|
|
1628
1633
|
const byPid = new Map(rows.map(row => [row.pid, row]));
|
|
1629
1634
|
const relayChild = (row) => {
|
|
1630
1635
|
const parent = parentProcess(row, byPid);
|
|
@@ -1661,7 +1666,167 @@ export function postStartupProcessCount(kind, activityRows, rows, startup, shape
|
|
|
1661
1666
|
changed = true;
|
|
1662
1667
|
}
|
|
1663
1668
|
}
|
|
1664
|
-
return added.
|
|
1669
|
+
return [...added.values()];
|
|
1670
|
+
}
|
|
1671
|
+
// ---- own_work (a41, observation-results.md): what a seat started itself and has not finished ----
|
|
1672
|
+
const ownWorkExclusionsSchema = z.object({
|
|
1673
|
+
digest: z.string().min(1).max(128),
|
|
1674
|
+
entries: z.array(z.union([
|
|
1675
|
+
z.object({ id: z.string(), kind: z.literal("process"), exe: z.string().min(1), args: z.array(z.string()), sessions: z.array(z.string()) }),
|
|
1676
|
+
z.object({ id: z.string(), kind: z.literal("child"), harness: z.string().min(1), session: z.string().nullable(), sessions: z.array(z.string()) }),
|
|
1677
|
+
])).max(256),
|
|
1678
|
+
});
|
|
1679
|
+
/** Windows argv from one command line (CommandLineToArgvW rules: backslashes before a quote, doubled quotes). */
|
|
1680
|
+
export function windowsCommandLineArgv(line) {
|
|
1681
|
+
const argv = [];
|
|
1682
|
+
let at = 0;
|
|
1683
|
+
while (at < line.length) {
|
|
1684
|
+
while (line[at] === " " || line[at] === "\t")
|
|
1685
|
+
at++;
|
|
1686
|
+
if (at >= line.length)
|
|
1687
|
+
break;
|
|
1688
|
+
let token = "", quoted = false, first = argv.length === 0;
|
|
1689
|
+
for (; at < line.length; at++) {
|
|
1690
|
+
const char = line[at];
|
|
1691
|
+
if (!quoted && (char === " " || char === "\t"))
|
|
1692
|
+
break;
|
|
1693
|
+
if (first) {
|
|
1694
|
+
if (char === '"')
|
|
1695
|
+
quoted = !quoted;
|
|
1696
|
+
else
|
|
1697
|
+
token += char;
|
|
1698
|
+
continue;
|
|
1699
|
+
} // argv[0]: quotes only, no escapes
|
|
1700
|
+
if (char === "\\") {
|
|
1701
|
+
let slashes = 0;
|
|
1702
|
+
while (line[at] === "\\") {
|
|
1703
|
+
slashes++;
|
|
1704
|
+
at++;
|
|
1705
|
+
}
|
|
1706
|
+
if (line[at] === '"') {
|
|
1707
|
+
token += "\\".repeat(slashes >> 1);
|
|
1708
|
+
if (slashes % 2)
|
|
1709
|
+
token += '"';
|
|
1710
|
+
else {
|
|
1711
|
+
at--;
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
else {
|
|
1715
|
+
token += "\\".repeat(slashes);
|
|
1716
|
+
at--;
|
|
1717
|
+
}
|
|
1718
|
+
continue;
|
|
1719
|
+
}
|
|
1720
|
+
if (char === '"') {
|
|
1721
|
+
if (quoted && line[at + 1] === '"') {
|
|
1722
|
+
token += '"';
|
|
1723
|
+
at++;
|
|
1724
|
+
}
|
|
1725
|
+
else
|
|
1726
|
+
quoted = !quoted;
|
|
1727
|
+
continue;
|
|
1728
|
+
}
|
|
1729
|
+
token += char;
|
|
1730
|
+
}
|
|
1731
|
+
argv.push(token);
|
|
1732
|
+
}
|
|
1733
|
+
return argv;
|
|
1734
|
+
}
|
|
1735
|
+
function processArgv(row) {
|
|
1736
|
+
if (process.platform === "linux") {
|
|
1737
|
+
try {
|
|
1738
|
+
const parts = fs.readFileSync(`/proc/${row.pid}/cmdline`, "utf8").split("\0");
|
|
1739
|
+
if (parts.at(-1) === "")
|
|
1740
|
+
parts.pop();
|
|
1741
|
+
if (parts.length)
|
|
1742
|
+
return parts;
|
|
1743
|
+
}
|
|
1744
|
+
catch { /* gone or unreadable: the table's command line */ }
|
|
1745
|
+
}
|
|
1746
|
+
if (isWin)
|
|
1747
|
+
return windowsCommandLineArgv(row.command);
|
|
1748
|
+
// shortcut: macOS ps gives only the joined command line, so an argument containing a space splits; exact argv needs a native call.
|
|
1749
|
+
return row.command.trim().split(/\s+/);
|
|
1750
|
+
}
|
|
1751
|
+
/** The descriptor an exclusion entry matches (raw argv never leaves this machine). */
|
|
1752
|
+
export function processDescriptor(argv, windows = isWin) {
|
|
1753
|
+
const base = (value) => value.replace(/^["']+|["']+$/g, "").split(/[\\/]/).filter(Boolean).pop() ?? "";
|
|
1754
|
+
// Judged on the whole token before it is shortened: a URL or user@host must not survive as its last path part.
|
|
1755
|
+
const secret = (value) => /=|:\/\/|@/.test(value);
|
|
1756
|
+
const token = (value) => { const short = base(value); return secret(value) || short.length > 40 ? "…" : short; };
|
|
1757
|
+
let exe = token(argv[0] ?? "").replace(/\.(?:exe|cmd)$/i, "");
|
|
1758
|
+
if (windows)
|
|
1759
|
+
exe = exe.toLowerCase();
|
|
1760
|
+
return { exe, args: argv.slice(1).filter(arg => !arg.startsWith("-")).slice(0, 2).map(token) };
|
|
1761
|
+
}
|
|
1762
|
+
/** own_work for each local agent seat, from one shared process table (seat_turns rows of an opted-in caller). */
|
|
1763
|
+
export async function seatOwnWork(names, requested) {
|
|
1764
|
+
const parsed = ownWorkExclusionsSchema.safeParse(requested);
|
|
1765
|
+
const list = parsed.success ? parsed.data : null;
|
|
1766
|
+
const result = new Map();
|
|
1767
|
+
let rows = null;
|
|
1768
|
+
try {
|
|
1769
|
+
rows = await readRuntimeProcessesShared();
|
|
1770
|
+
}
|
|
1771
|
+
catch { /* table unreadable: processes null */ }
|
|
1772
|
+
for (const name of names) {
|
|
1773
|
+
const meta = tryLoadAgentMetadata(name);
|
|
1774
|
+
if (!meta)
|
|
1775
|
+
continue;
|
|
1776
|
+
const entries = list?.entries.filter(entry => entry.sessions.includes(name)) ?? [];
|
|
1777
|
+
const childExcluded = (child) => entries.some(entry => entry.kind === "child"
|
|
1778
|
+
&& entry.harness === child.harness && (entry.session === null || entry.session === child.session));
|
|
1779
|
+
const work = { processes: null, excluded: 0, child_results: null, exclusions_digest: list?.digest ?? null, oldest: null };
|
|
1780
|
+
result.set(name, work);
|
|
1781
|
+
try {
|
|
1782
|
+
const state = agentDormantState(meta);
|
|
1783
|
+
if (state === "hibernated") {
|
|
1784
|
+
work.processes = 0;
|
|
1785
|
+
work.child_results = 0;
|
|
1786
|
+
continue;
|
|
1787
|
+
}
|
|
1788
|
+
if (state !== null || !rows)
|
|
1789
|
+
continue;
|
|
1790
|
+
const pane = await sessionPaneAsync(name);
|
|
1791
|
+
const [pidText, dead] = pane.code === 0 ? pane.stdout.trim().split("\t") : [];
|
|
1792
|
+
const root = dead === "0" ? rows.find(row => row.pid === Number(pidText)) : undefined;
|
|
1793
|
+
if (!root)
|
|
1794
|
+
continue;
|
|
1795
|
+
const subtree = processSubtree(rows, root.pid);
|
|
1796
|
+
const candidates = selectHarnessProcesses(meta, rows, subtree);
|
|
1797
|
+
const agent = candidates.length === 1 ? candidates[0] : null;
|
|
1798
|
+
if (!agent)
|
|
1799
|
+
continue;
|
|
1800
|
+
const activityRows = subtree.some(row => row.pid === agent.pid) ? subtree : [...subtree, ...processSubtree(rows, agent.pid)];
|
|
1801
|
+
work.child_results = pendingChildResultsFor(name, activityRows, childExcluded);
|
|
1802
|
+
if (!Array.isArray(meta.startup_processes))
|
|
1803
|
+
continue;
|
|
1804
|
+
const counted = postStartupProcesses(meta.kind, activityRows, rows, new Set(meta.startup_processes), meta.startup_process_shapes, agent);
|
|
1805
|
+
const processEntries = entries.filter(entry => entry.kind === "process");
|
|
1806
|
+
const descriptors = new Map(counted.map(row => [row.pid, processDescriptor(processArgv(row))]));
|
|
1807
|
+
const byPid = new Map(rows.map(row => [row.pid, row]));
|
|
1808
|
+
const countedPids = new Set(counted.map(row => row.pid));
|
|
1809
|
+
const excluded = new Set();
|
|
1810
|
+
for (const row of counted) {
|
|
1811
|
+
const descriptor = descriptors.get(row.pid);
|
|
1812
|
+
if (!processEntries.some(entry => entry.exe === descriptor.exe && entry.args.every((arg, at) => descriptor.args[at] === arg)))
|
|
1813
|
+
continue;
|
|
1814
|
+
// The match, its descendants and its post-startup ancestors (the bash -c wrappers CLIs put around commands).
|
|
1815
|
+
for (const below of processSubtree(rows, row.pid))
|
|
1816
|
+
if (countedPids.has(below.pid))
|
|
1817
|
+
excluded.add(below.pid);
|
|
1818
|
+
for (let up = parentProcess(row, byPid); up && countedPids.has(up.pid); up = parentProcess(up, byPid))
|
|
1819
|
+
excluded.add(up.pid);
|
|
1820
|
+
}
|
|
1821
|
+
const remaining = counted.filter(row => !excluded.has(row.pid));
|
|
1822
|
+
work.processes = remaining.length;
|
|
1823
|
+
work.excluded = excluded.size;
|
|
1824
|
+
const oldest = remaining.reduce((first, row) => !first || Date.parse(row.started_identity) < Date.parse(first.started_identity) ? row : first, null);
|
|
1825
|
+
work.oldest = oldest ? { ...descriptors.get(oldest.pid), since: new Date(oldest.started_identity).toISOString() } : null;
|
|
1826
|
+
}
|
|
1827
|
+
catch { /* this seat could not be read: nulls */ }
|
|
1828
|
+
}
|
|
1829
|
+
return result;
|
|
1665
1830
|
}
|
|
1666
1831
|
function emptySessionObservation(name, exists) {
|
|
1667
1832
|
return {
|
|
@@ -1717,8 +1882,9 @@ export function observeSession(name, cursor) {
|
|
|
1717
1882
|
result.reason = "resume_native_conflict";
|
|
1718
1883
|
return result;
|
|
1719
1884
|
}
|
|
1885
|
+
const lifecycle = readAgentLifecycle(meta);
|
|
1720
1886
|
try {
|
|
1721
|
-
confirmedAgentResumeRecipe(meta,
|
|
1887
|
+
confirmedAgentResumeRecipe(meta, lifecycle);
|
|
1722
1888
|
}
|
|
1723
1889
|
catch {
|
|
1724
1890
|
result.reason = "resume_unconfirmed";
|
|
@@ -1728,8 +1894,9 @@ export function observeSession(name, cursor) {
|
|
|
1728
1894
|
if (!isDeepStrictEqual(loadAgentMetadata(name), meta) || agentDormantState(meta) !== "hibernated"
|
|
1729
1895
|
|| nativeSessionExists(name))
|
|
1730
1896
|
return result;
|
|
1897
|
+
// A seat whose native vanished (container replaced) and was adopted at send/launch is not an idle seat (Kiro, 2026-11-13).
|
|
1731
1898
|
result.state = "hibernated";
|
|
1732
|
-
result.reason = "idle_timeout";
|
|
1899
|
+
result.reason = "origin" in lifecycle && lifecycle.origin === "restart" ? "native_vanished" : "idle_timeout";
|
|
1733
1900
|
result.pane_alive = false;
|
|
1734
1901
|
result.harness_alive = false;
|
|
1735
1902
|
result.pending_child_deliveries = 0;
|
|
@@ -1848,8 +2015,8 @@ function observeNativeSession(name, cursor) {
|
|
|
1848
2015
|
const comparable = previous?.pane_identity === sample.pane_identity;
|
|
1849
2016
|
// 起動完了の控えが無いsession(通常PTY、控える前の版で起動したagent)とharnessを特定できない時は数えない。
|
|
1850
2017
|
const startup = agent && Array.isArray(meta?.startup_processes) ? new Set(meta.startup_processes) : null;
|
|
1851
|
-
// このsession
|
|
1852
|
-
result.pending_child_deliveries = agent ?
|
|
2018
|
+
// このsessionが親として待っている子の結果。子の記録が名指す親の席に数える(名指しが無ければ持ち主processで)。
|
|
2019
|
+
result.pending_child_deliveries = agent ? pendingChildResultsFor(name, activityRows) : null;
|
|
1853
2020
|
result.activity = {
|
|
1854
2021
|
cursor: Buffer.from(JSON.stringify(sample)).toString("base64url"),
|
|
1855
2022
|
output_changed: comparable ? previous.screen_digest !== sample.screen_digest : null,
|
|
@@ -2246,6 +2413,28 @@ function listNativeSessionRows(runTmux = tmux) {
|
|
|
2246
2413
|
}
|
|
2247
2414
|
/** Same listing and failure as pty_list, without loading every seat's metadata: one seat's existence check stays one
|
|
2248
2415
|
* tmux call (2026-11-11: per-seat full lists made a CurrentWork pty_list take 10-27 s for ~140 members). */
|
|
2416
|
+
/**
|
|
2417
|
+
* Why a parent delivery's local child can no longer complete its boundary (parent-delivery.md), or null while it still can
|
|
2418
|
+
* or when this cannot be told (tmux unreadable). Replaced launch, missing record, hibernated, or vanished native.
|
|
2419
|
+
*/
|
|
2420
|
+
export function deliveryChildGone(boundary) {
|
|
2421
|
+
if (boundary.remote)
|
|
2422
|
+
return null;
|
|
2423
|
+
try {
|
|
2424
|
+
const meta = tryLoadAgentMetadata(boundary.session_id);
|
|
2425
|
+
if (!meta)
|
|
2426
|
+
return "child_missing";
|
|
2427
|
+
if (meta.launch_id !== boundary.launch_id)
|
|
2428
|
+
return "child_replaced";
|
|
2429
|
+
const state = agentDormantState(meta);
|
|
2430
|
+
if (state === "hibernated")
|
|
2431
|
+
return "child_hibernated";
|
|
2432
|
+
return state === null && !nativeSessionExists(boundary.session_id) ? "child_vanished" : null;
|
|
2433
|
+
}
|
|
2434
|
+
catch {
|
|
2435
|
+
return null;
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2249
2438
|
function nativeSessionExists(name) {
|
|
2250
2439
|
return listNativeSessionRows().some(([listed]) => listed === name);
|
|
2251
2440
|
}
|
|
@@ -3213,6 +3402,7 @@ function liveSendLocks(name) {
|
|
|
3213
3402
|
}
|
|
3214
3403
|
function acquireSessionSendFileLock(name) {
|
|
3215
3404
|
const p = sendLockPath(name);
|
|
3405
|
+
fs.mkdirSync(SOCKDIR, { recursive: true });
|
|
3216
3406
|
const token = randomBytes(16).toString("hex");
|
|
3217
3407
|
const nofollow = fs.constants.O_NOFOLLOW ?? 0;
|
|
3218
3408
|
const deadline = Date.now() + SESSION_SEND_LOCK_WAIT_MS;
|
|
@@ -3292,6 +3482,8 @@ export function __testSetAgentSendLockWaitMs(value) {
|
|
|
3292
3482
|
function tryCreateOwnedLock(p) {
|
|
3293
3483
|
const nofollow = fs.constants.O_NOFOLLOW ?? 0;
|
|
3294
3484
|
let fd;
|
|
3485
|
+
// A fresh container has no SOCKDIR until the first launch; close/send/resume/delete of a kept seat lock before that (a46 lab).
|
|
3486
|
+
fs.mkdirSync(path.dirname(p), { recursive: true });
|
|
3295
3487
|
try {
|
|
3296
3488
|
fd = fs.openSync(p, fs.constants.O_CREAT | fs.constants.O_EXCL | fs.constants.O_WRONLY | nofollow, 0o600);
|
|
3297
3489
|
}
|
|
@@ -147,7 +147,8 @@ function nativeParentDependencies(provider, profile) {
|
|
|
147
147
|
else
|
|
148
148
|
await provider.verifyCodexParent(profile, parent);
|
|
149
149
|
},
|
|
150
|
-
processes: readProcessIdentities, exists: nativeProcessExists,
|
|
150
|
+
processes: readProcessIdentities, exists: nativeProcessExists, childGone: core.deliveryChildGone, childCheckMs: 30_000,
|
|
151
|
+
now: () => performance.now(), wall: () => Date.now() };
|
|
151
152
|
}
|
|
152
153
|
/** Historical injected worker; normal parent-hook CLI no longer uses it. */
|
|
153
154
|
export function createNativeExecutionWorker(input) {
|
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,19 @@ 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);
|
|
903
|
+
// a41: own_work only for a caller that sends its exclusion list (observation-results.md); terminals compute their own rows.
|
|
904
|
+
const ownWork = requestMeta && typeof requestMeta === "object" ? requestMeta["aiterm/own_work_exclusions"] : undefined;
|
|
905
|
+
if (ownWork !== undefined) {
|
|
906
|
+
const work = await core.seatOwnWork(local.seats.map(seat => seat.session_id), ownWork);
|
|
907
|
+
for (const seat of local.seats) {
|
|
908
|
+
const value = work.get(seat.session_id);
|
|
909
|
+
if (value)
|
|
910
|
+
Object.assign(seat, { own_work: value });
|
|
911
|
+
}
|
|
912
|
+
}
|
|
901
913
|
const remote = await relays;
|
|
902
914
|
return { _meta: { [SEAT_TURNS_RESULT_META_KEY]: { ...local, seats: [...local.seats, ...remote.flatMap(r => r.seats)], unread: [...local.unread, ...remote.flatMap(r => r.unread)] } } };
|
|
903
915
|
}
|
|
@@ -3,15 +3,29 @@
|
|
|
3
3
|
import * as fs from "node:fs";
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
|
-
import { ensureStateRoot } from "./agent-shared.js";
|
|
6
|
+
import { agentHarness, agentMetadataPath, agentsDir, ensureStateRoot } from "./agent-shared.js";
|
|
7
7
|
const DELIVERY_DIRECTORIES = ["parent-deliveries", "claude-parent-deliveries", "cursor-parent-deliveries"];
|
|
8
8
|
/** 持ち主の保存場所の名前の先頭。pidの使い回しと取り違えないよう、開始時刻も入れる。 */
|
|
9
9
|
export function deliveryOwnerPrefix(owner) {
|
|
10
10
|
return `${owner.pid}-${createHash("sha256").update(owner.started_identity).digest("hex").slice(0, 16)}-`;
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* The unfinished deliveries that `seat` waits for (parent-delivery.md "親の席への数え方"): a local child's metadata names its
|
|
14
|
+
* parent seat (`parent_session_id`). Only when that names no Aiterm seat here, the child is on another terminal, or its metadata
|
|
15
|
+
* cannot be read, the owner process in the seat's subtree decides, as before 0.70.42. A manager that adopted a dead owner's
|
|
16
|
+
* records is not charged for them.
|
|
17
|
+
*/
|
|
18
|
+
export function pendingChildResultsFor(seat, processes, excluded = () => false, stateRoot = ensureStateRoot()) {
|
|
14
19
|
const prefixes = processes.map(deliveryOwnerPrefix);
|
|
20
|
+
// A parent named by a child is a seat here when Aiterm holds an agent record for that name (host-root and the like are not).
|
|
21
|
+
let listing = null;
|
|
22
|
+
const isSeat = (name) => (listing ??= (() => { try {
|
|
23
|
+
return fs.readdirSync(agentsDir());
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return [];
|
|
27
|
+
} })())
|
|
28
|
+
.some(file => file.startsWith(`${name}.`) && file.endsWith(".agent.json"));
|
|
15
29
|
let count = 0;
|
|
16
30
|
for (const prefix of ["", "remote-"]) {
|
|
17
31
|
for (const directory of DELIVERY_DIRECTORIES) {
|
|
@@ -26,14 +40,37 @@ export function unfinishedDeliveriesOwnedBy(processes, stateRoot = ensureStateRo
|
|
|
26
40
|
throw error;
|
|
27
41
|
}
|
|
28
42
|
for (const owner of owners) {
|
|
29
|
-
if (!owner.isDirectory()
|
|
43
|
+
if (!owner.isDirectory())
|
|
30
44
|
continue;
|
|
45
|
+
const ownedHere = prefixes.some(candidate => owner.name.startsWith(candidate));
|
|
46
|
+
let names;
|
|
31
47
|
try {
|
|
32
|
-
|
|
48
|
+
names = fs.readdirSync(path.join(active, owner.name)).filter(name => name !== "owner.json" && name.endsWith(".json"));
|
|
33
49
|
}
|
|
34
50
|
catch (error) {
|
|
35
|
-
if (error.code
|
|
36
|
-
|
|
51
|
+
if (error.code === "ENOENT")
|
|
52
|
+
continue;
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
for (const name of names) {
|
|
56
|
+
let child = null, parent = null;
|
|
57
|
+
try {
|
|
58
|
+
const boundary = JSON.parse(fs.readFileSync(path.join(active, owner.name, name), "utf8"))?.boundary;
|
|
59
|
+
if (typeof boundary?.session_id === "string")
|
|
60
|
+
child = { session: boundary.session_id, harness: null };
|
|
61
|
+
if (child && !boundary.remote && typeof boundary.launch_id === "string") {
|
|
62
|
+
const meta = JSON.parse(fs.readFileSync(agentMetadataPath(child.session, boundary.launch_id), "utf8"));
|
|
63
|
+
child.harness = typeof meta?.kind === "string" ? agentHarness(meta.kind) : null;
|
|
64
|
+
if (typeof meta?.parent_session_id === "string" && isSeat(meta.parent_session_id))
|
|
65
|
+
parent = meta.parent_session_id;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch { /* unreadable record or child: the owner decides */ }
|
|
69
|
+
if (!(parent === null ? ownedHere : parent === seat))
|
|
70
|
+
continue;
|
|
71
|
+
if (child && excluded(child))
|
|
72
|
+
continue;
|
|
73
|
+
count++;
|
|
37
74
|
}
|
|
38
75
|
}
|
|
39
76
|
}
|
package/dist/parent-delivery.js
CHANGED
|
@@ -4,6 +4,7 @@ import * as fs from "node:fs";
|
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
+
import { deliveryChildGone } from "./core.js";
|
|
7
8
|
import { ensureStateRoot, writeJson0600 } from "./agent-shared.js";
|
|
8
9
|
import { readProcessIdentities } from "./process-runtime.js";
|
|
9
10
|
import { deliveryOwnerPrefix } from "./parent-delivery-owners.js";
|
|
@@ -118,7 +119,7 @@ export class ParentDeliveryManager {
|
|
|
118
119
|
constructor(options = {}) {
|
|
119
120
|
this.execution = options.execution;
|
|
120
121
|
this.deps = { observe: observeAnywhere, answer: answerAnywhere, submit: submitParentAnswer,
|
|
121
|
-
verify: verifyParent, processes: readProcessIdentities, exists: processExists,
|
|
122
|
+
verify: verifyParent, processes: readProcessIdentities, exists: processExists, childGone: deliveryChildGone, childCheckMs: 30_000,
|
|
122
123
|
now: () => performance.now(), wall: () => Date.now(), ...options.dependencies,
|
|
123
124
|
...(options.execution ? { submit: options.execution.submit } : {}) };
|
|
124
125
|
if (options.state_root !== undefined && !path.isAbsolute(options.state_root))
|
|
@@ -414,19 +415,34 @@ export class ParentDeliveryManager {
|
|
|
414
415
|
}
|
|
415
416
|
watch(job) {
|
|
416
417
|
const boundary = job.record.boundary;
|
|
418
|
+
// A child that can no longer complete this boundary (replaced, gone, hibernated) ends the wait: before 0.70.42 it never did.
|
|
419
|
+
const childStop = new AbortController();
|
|
420
|
+
let gone = null, seen = null;
|
|
421
|
+
const check = setInterval(() => {
|
|
422
|
+
const reason = this.deps.childGone(boundary);
|
|
423
|
+
if (reason && reason === seen) {
|
|
424
|
+
gone = reason;
|
|
425
|
+
childStop.abort();
|
|
426
|
+
}
|
|
427
|
+
seen = reason;
|
|
428
|
+
}, this.deps.childCheckMs);
|
|
429
|
+
check.unref?.();
|
|
417
430
|
job.task = (async () => {
|
|
418
431
|
try {
|
|
419
432
|
const completion = await this.deps.observe(boundary.session_id, {
|
|
420
433
|
cursor: boundary.event_cursor, operation_id: boundary.operation_id,
|
|
421
434
|
...(boundary.input_id ? { input_id: boundary.input_id } : {}),
|
|
422
|
-
timeout: Infinity, signal: job.controller.signal, ...(boundary.remote ? { remote: boundary.remote } : {}),
|
|
435
|
+
timeout: Infinity, signal: AbortSignal.any([job.controller.signal, childStop.signal]), ...(boundary.remote ? { remote: boundary.remote } : {}),
|
|
423
436
|
});
|
|
424
437
|
await this.capture(job, completion);
|
|
425
438
|
}
|
|
426
439
|
catch (error) {
|
|
427
440
|
if (job.controller.signal.aborted)
|
|
428
441
|
return;
|
|
429
|
-
await this.captureFailure(job, error);
|
|
442
|
+
await this.captureFailure(job, gone ? new AitermError(`PARENT_DELIVERY_CHILD_GONE: ${gone}`, 2) : error);
|
|
443
|
+
}
|
|
444
|
+
finally {
|
|
445
|
+
clearInterval(check);
|
|
430
446
|
}
|
|
431
447
|
})().catch((error) => this.reportServiceError(error));
|
|
432
448
|
}
|
|
@@ -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aiterm-mcp",
|
|
3
|
-
"version": "0.70.
|
|
3
|
+
"version": "0.70.43",
|
|
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": [
|