aiterm-mcp 0.70.30 → 0.70.31

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 CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.70.31] - 2026-11-12
11
+
12
+ - `agent_goal` on a Claude Code seat running on macOS or Windows no longer answers `goal_native_session_unavailable` every time. The goal check binds to Claude's own `sessions/<pid>.json`, and Aiterm could compute that record's process birth only on Linux. Measured on 2.1.322: macOS writes `procStart` as `LC_ALL=C TZ=UTC ps -o lstart=` with `pidDomain` `darwin`; Windows writes the process creation FILETIME with `pidDomain` `win32:<lower-case hostname>`. Aiterm now computes both. The exact birth is read once per goal operation, because every check already re-proves the same process. Windows has no terminal foreground group, so for Claude the pane's single harness process is the input owner there; the macOS and Linux terminal checks are unchanged.
13
+
10
14
  ## [0.70.30] - 2026-11-12
11
15
 
12
16
  - `agent_goal` on an idle Claude Code seat no longer refuses with `goal_input_not_empty_or_ready` when the composer shows Claude's own dim ghost text. After a second turn Claude Code 2.1.322 shows a prompt suggestion there (for example `run the doctests`), and a new session shows a `Try "…"` example. Any single composer row whose visible cells are all dim or inverse, with at least one dim, now counts as empty, whatever its words; text the user typed is not dim and still blocks. Inspect, create, edit and clear all use this check. Measured on 2.1.322: a bracketed paste of `/goal` over a shown suggestion leaves exactly `/goal`, which the existing check before Enter confirms.
@@ -3329,7 +3333,8 @@ prototype (preserved under `prototype/python/` as the porting source and referen
3329
3333
  `ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
3330
3334
  provenance.
3331
3335
 
3332
- [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.30...HEAD
3336
+ [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.31...HEAD
3337
+ [0.70.31]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.30...v0.70.31
3333
3338
  [0.70.30]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.29...v0.70.30
3334
3339
  [0.70.29]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.28...v0.70.29
3335
3340
  [0.70.28]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.27...v0.70.28
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.30** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
218
+ **状態:** 開発継続中 · 現行公開版 **v0.70.31** · 動作対象は 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.30** · 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).
230
+ **Status:** actively maintained · current public release **v0.70.31** · 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/core.js CHANGED
@@ -51,7 +51,7 @@ import { isCursorMcpClient } from "aiterm-steer-delivery";
51
51
  import { antigravityBinding, antigravityAuthChoiceKey, antigravityCurrentModel, antigravityStartupAction, antigravityAgentArgv, writeAntigravityCallerFiles, checkAntigravityCallerInput, antigravityPromptWithCaller, antigravityQuotaLimit, antigravityModelChoices, antigravityAuthStatus, antigravityAuthPane, antigravityTranscriptText, bindAntigravitySession, createAntigravityAgentMetadata, mergeAntigravityHooks } from "./harnesses/antigravity.js";
52
52
  import { paneTokenHint } from "./harnesses/pane-tokens.js";
53
53
  import { unfinishedDeliveriesOwnedBy } from "./parent-delivery-owners.js";
54
- import { readLinuxProcessRegistrationIdentity, readProcessEnvironment, readRuntimeProcesses, readProcessIdentities, processSubtree, parentProcess, processIdentity, signalRuntimeProcess, backgroundProcesses, lazyRelayProcess, aitermProcessProbe, windowsConsoleHost, macKeepAwakeProcess, processElapsedSeconds } from "./process-runtime.js";
54
+ import { readLinuxProcessRegistrationIdentity, readClaudeRegistrationIdentity, readProcessEnvironment, readRuntimeProcesses, readProcessIdentities, processSubtree, parentProcess, processIdentity, signalRuntimeProcess, backgroundProcesses, lazyRelayProcess, aitermProcessProbe, windowsConsoleHost, macKeepAwakeProcess, processElapsedSeconds } from "./process-runtime.js";
55
55
  import { liveNodeExecutable } from "./live-node.js";
56
56
  import { resolveClaudeConfigurationRoot, withClaudeConfigRoot, withClaudeSlotLogin } from "./claude-config-root.js";
57
57
  import { probeWriteBan, writeBanPrefix, windowsWriteBanArgv } from "./write-ban.js";
@@ -6015,6 +6015,8 @@ async function agentGoalInContext(input, origin, expectedGoal, sendHeld = false)
6015
6015
  const goalUi = (target) => {
6016
6016
  let inputStarted = false;
6017
6017
  let pinnedTty = null;
6018
+ // The exact birth is read once; every check below re-proves the same pid, birth and argv through resolve().
6019
+ let claudeGeneration = null;
6018
6020
  const check = () => {
6019
6021
  const current = resolve();
6020
6022
  if (!current || current.vendor_session_id !== target.vendor_session_id
@@ -6028,7 +6030,7 @@ async function agentGoalInContext(input, origin, expectedGoal, sendHeld = false)
6028
6030
  throw new Error("Goal input owner changed after input began");
6029
6031
  };
6030
6032
  if (target.harness === "claude-code") {
6031
- const generation = owner ? readLinuxProcessRegistrationIdentity(owner.pid) : null;
6033
+ const generation = owner ? (claudeGeneration ??= readClaudeRegistrationIdentity(owner.pid)) : null;
6032
6034
  let registration;
6033
6035
  try {
6034
6036
  const file = path.join(target.claude_home ?? claudeConfigDir(), "sessions", `${owner?.pid}.json`);
@@ -6064,6 +6066,12 @@ async function agentGoalInContext(input, origin, expectedGoal, sendHeld = false)
6064
6066
  if (ownership !== 'match')
6065
6067
  rejectOwner(ownership === 'mismatch' ? 'goal_native_session_mismatch' : 'goal_native_session_unavailable');
6066
6068
  }
6069
+ // shortcut: Windows consoles have no tty foreground group; the owner is the pane's harness process proven by resolve(). Upgrade if a console-input owner probe appears.
6070
+ if (isWin && target.harness === "claude-code") {
6071
+ if (!owner)
6072
+ rejectOwner();
6073
+ return;
6074
+ }
6067
6075
  if (!tty || !owner?.process_group_id || pinnedTty !== null && pinnedTty !== tty)
6068
6076
  rejectOwner();
6069
6077
  const ps = spawnSync("/bin/ps", ["-t", tty.replace(/^\/dev\//u, ""), "-o", "pid=,pgid=,stat=,command="], { encoding: "utf8", env: { ...process.env, LC_ALL: "C" }, timeout: 5000 });
@@ -7,7 +7,7 @@ export function claudeGoalVersionSupported(version) {
7
7
  const patch = typeof version === "string" ? /^2\.1\.(\d+)$/u.exec(version)?.[1] : undefined;
8
8
  return patch !== undefined && Number(patch) >= 310;
9
9
  }
10
- const currentSessionSchema = z.object({ pid: z.number().int().positive(), sessionId: z.string().uuid(), procStart: z.string().regex(/^\d+$/u), pidDomain: z.string(), version: z.string(), kind: z.literal("interactive") });
10
+ const currentSessionSchema = z.object({ pid: z.number().int().positive(), sessionId: z.string().uuid(), procStart: z.string().min(1), pidDomain: z.string(), version: z.string(), kind: z.literal("interactive") });
11
11
  export function claudeCurrentSessionOwner(record, expected) {
12
12
  const parsed = currentSessionSchema.safeParse(record);
13
13
  if (!parsed.success || parsed.data.pid !== expected.pid || parsed.data.procStart !== expected.procStart || parsed.data.pidDomain !== expected.pidDomain)
@@ -1,4 +1,5 @@
1
1
  import * as fs from "node:fs";
2
+ import os from "node:os";
2
3
  import { processStartIdentity } from "./process-start.js";
3
4
  // OSのprocess表とnative PIDの所有者。argvは相関にだけ使い、公開identityにはdigestだけを載せる。
4
5
  import { spawnSync } from "node:child_process";
@@ -415,6 +416,34 @@ export function readLinuxProcessRegistrationIdentity(pid) {
415
416
  return null;
416
417
  }
417
418
  }
419
+ /** Claude Code's sessions/<pid>.json birth and pid domain, measured on 2.1.322.
420
+ * linux: the Linux registry identity above. darwin: `LC_ALL=C TZ=UTC ps -o lstart=` trimmed, domain "darwin".
421
+ * win32: process creation FILETIME (UTC, 100 ns since 1601) as decimal, domain "win32:" + lower-case hostname. */
422
+ export function claudeRegistrationIdentity(platform, start, hostname) {
423
+ if (!start)
424
+ return null;
425
+ if (platform === "darwin")
426
+ return { procStart: start, pidDomain: "darwin" };
427
+ // processStartIdentity("win32") gives .NET UTC ticks (since 0001); FILETIME = ticks - ticks(1601-01-01).
428
+ const ticks = /^win32:(\d+)$/u.exec(start)?.[1];
429
+ if (platform === "win32" && ticks && hostname) {
430
+ const filetime = BigInt(ticks) - 504911232000000000n;
431
+ return filetime > 0n ? { procStart: filetime.toString(), pidDomain: `win32:${hostname.toLowerCase()}` } : null;
432
+ }
433
+ return null;
434
+ }
435
+ export function readClaudeRegistrationIdentity(pid) {
436
+ if (process.platform === "linux")
437
+ return readLinuxProcessRegistrationIdentity(pid);
438
+ if (process.platform === "win32")
439
+ return claudeRegistrationIdentity("win32", processStartIdentity(pid, "win32"), os.hostname());
440
+ if (process.platform !== "darwin" || !Number.isInteger(pid) || pid < 1)
441
+ return null;
442
+ const result = spawnSync("ps", ["-o", "lstart=", "-p", String(pid)], {
443
+ encoding: "utf8", timeout: 1000, maxBuffer: 4096, env: { ...process.env, LC_ALL: "C", TZ: "UTC" }
444
+ });
445
+ return claudeRegistrationIdentity("darwin", result.status === 0 ? (result.stdout ?? "").trim() : null, os.hostname());
446
+ }
418
447
  /** A detached seat clock sleeps in the native shell; exit 75 retries admission without keeping Node resident. */
419
448
  export function idleClockCommand(delayMs, executable, args, windows = isWin) {
420
449
  if (!Number.isFinite(delayMs) || !executable || [executable, ...args].some(value => value.includes("\0")))
package/docs/DESIGN.md CHANGED
@@ -584,7 +584,7 @@ Claude clear uses the same host provenance and original binding comparison as Co
584
584
  Claude objective changes reuse the native /goal setter after checking the current goal and trusted host origin. They do not emulate Codex pause/resume or numeric accounting. Representation checks bound the objective to a completely visible composer/dialog and reject reserved clear and ambiguous whitespace before submission. The shared native cell decoder preserves dim/inverse styling, letting each harness distinguish its own placeholders; Claude input interpretation and native state remain harness-owned. Claude's native ghost text (queued-input hint, startup example, post-turn prompt suggestion) is one composer row whose visible cells are all dim or inverse with at least one dim; that row is empty whatever its text. Typed text of the same words is not dim and stays a draft, so emptiness is never decided by text.
585
585
 
586
586
 
587
- Native Claude goal input also verifies the official per-PID current-session registration, including native session ID, process birth ticks and PID namespace before each input boundary. A switched conversation is refused before goal input; ownership loss after input remains unknown. No conversation is switched back automatically. This registration birth format is currently verified on Linux; unverified OS/registry data remains unavailable.
587
+ Native Claude goal input also verifies the official per-PID current-session registration, including native session ID, process birth ticks and PID namespace before each input boundary. A switched conversation is refused before goal input; ownership loss after input remains unknown. No conversation is switched back automatically. The registration birth format is measured per OS (Claude Code 2.1.322): Linux boot ticks and PID namespace; macOS `LC_ALL=C TZ=UTC ps -o lstart=` with domain `darwin`; Windows creation FILETIME with domain `win32:<lower-case hostname>`. Other OSes remain unavailable. The exact birth is read once per goal operation; each check re-proves the same pid, birth and argv through resolve(). Windows has no tty foreground group, so for Claude the pane's single harness process proven by resolve() is the input owner and the tty/termios check is skipped.
588
588
 
589
589
  Grok 1.0.70 inspection verifies active_sessions.json against the original TUI PID, Linux birth ticks, cwd and vendor session. A fresh local /goal status update on that same session establishes null only with an absent state file, or an existing goal whose ID and exact objective remain stable across the query. The native persisted snapshot remains in goal.native; goal.current_status carries the separately parsed current status, phase, safe integer token count and original elapsed display. Resuming can leave persisted phase different from the live worker. Neither an old reply nor the snapshot supplies current values. A busy TUI queues the local slash command. The adapter does not send it on busy minimal views. An already fullscreen root view with a known Goal header and empty boxed composer instead permits native Goal-detail inspection. Core validates pane coordinates and the harness-provided current viewport predicate immediately before the bounded SGR pointer press/release, under the existing generation, PID-birth, current-session, TTY foreground/raw and native-admission checks. The harness uses string-width 7.2.0 display cells, requires the exact untruncated objective and stable native goal ID across the observation, then closes only its recognized modal with a current-row-checked key and confirms the empty composer. It neither switches modes nor stops a turn. The UI has rounded budget text and a phase label rather than an exact native phase/counter: the goal-detail current_status variant preserves those display strings while phase and tokens_used are null. Unknown views, existing drafts, moved hit targets and unavailable native ownership never trigger another input or a query through another leader. No leader, worker or conversation is created or resumed by product inspection.
590
590
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-mcp",
3
- "version": "0.70.30",
3
+ "version": "0.70.31",
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": [