aiterm-mcp 0.70.36 → 0.70.37

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,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.70.37] - 2026-11-12
11
+
12
+ - `agent_goal` `inspect` on a Grok seat no longer types into the seat. It used to paste `/goal status` (or click the Goal header and press `g`) under the send lock. It now reads the session's saved `goal/state.json`: no file is no goal, otherwise `goal = {kind: "grok-cli", native}` without `current_status`. No send lock, no composer or TTY dependence. With this, no harness types on `inspect` (Claude 0.70.34; Codex reads its App Server; Cursor and Antigravity are unsupported before any connection).
13
+ - `native.status` of a Grok goal is an open string, and keys Grok adds later are dropped from `native`. Grok 1.0.77 writes `budget_limited` and the keys `plan_file` / `plan_baseline_file` once a goal plan exists; the strict schema rejected both, so `inspect` on such a goal was unavailable. Measured on an isolated 1.0.77 seat: the saved status changes within about 1 s of each change; `elapsed_ms` and `tokens_used_high_water` are written only about every 30 s while a goal runs; `phase` may be stale.
14
+ - `capabilities.clear` on a Grok `inspect` is now `native.status === "user_paused"` (a candidate). The `clear` action itself still requires the fresh `/goal status` (UserPaused, Idle) and an empty composer, under the send lock, and its result carries `current_status` from that fresh read.
15
+
10
16
  ## [0.70.36] - 2026-11-12
11
17
 
12
18
  - A fresh `agent_launch` whose seat is not ready before any prompt byte no longer leaves that seat behind. When the startup check ends blocked (a first-run or onboarding screen such as Claude's "Security notes", an unknown dialog, a dialog Aiterm does not answer, a harness that exited), the launch closes the seat it created and refuses with `AGENT_STARTUP_BLOCKED: … reason=<observation reason>` and `_meta["aiterm/launch_error"]` `{code: "AGENT_STARTUP_BLOCKED", phase: "input", effect: "not_started", session_created: false, action}`. `action` says what the account holder does (for Claude's first run: start `claude` once on that computer and finish its steps). This covers the `trust_project` launch without a prompt and every launch with a prompt, on all five harnesses. If the close itself fails, the previous refusal that leaves the seat is returned. A resume and a launch without a prompt, `trust_project` or fast (startup `not_checked`) are unchanged.
@@ -3358,7 +3364,8 @@ prototype (preserved under `prototype/python/` as the porting source and referen
3358
3364
  `ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
3359
3365
  provenance.
3360
3366
 
3361
- [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.36...HEAD
3367
+ [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.37...HEAD
3368
+ [0.70.37]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.36...v0.70.37
3362
3369
  [0.70.36]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.35...v0.70.36
3363
3370
  [0.70.35]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.34...v0.70.35
3364
3371
  [0.70.34]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.33...v0.70.34
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.36** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
218
+ **状態:** 開発継続中 · 現行公開版 **v0.70.37** · 動作対象は 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.36** · 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.37** · 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
 
@@ -48,7 +48,9 @@ export async function manageGrokAgentGoal(input, runtime, origin = "automatic")
48
48
  if (!sameGoalTarget(runtime.resolve(), target))
49
49
  return { ...result, reason: 'generation_replaced_after_status', readback: 'failed' };
50
50
  const clearStatus = observed.current?.current_status;
51
- const ready = !!runtime.clear && observed.current?.native.status === 'user_paused' && clearStatus?.source === '/goal status' && clearStatus.status === 'UserPaused' && clearStatus.phase === 'Idle' && runtime.canClear?.(target) === true;
51
+ // inspect reads the saved state only, so clear there is a candidate; the clear action itself requires the fresh UI status.
52
+ const freshPaused = clearStatus?.source === '/goal status' && clearStatus.status === 'UserPaused' && clearStatus.phase === 'Idle' && runtime.canClear?.(target) === true;
53
+ const ready = !!runtime.clear && observed.current?.native.status === 'user_paused' && (input.action === 'inspect' || freshPaused);
52
54
  Object.assign(result, { binding: { session_id: target.session_id, launch_id: target.launch_id, thread_id: target.vendor_session_id }, availability: 'available', capabilities: { ...result.capabilities, inspect: true, clear: ready }, goal: observed.current, outcome: 'observed', readback: 'confirmed', reason: 'native_goal_observed' });
53
55
  if (input.action === 'inspect')
54
56
  return agentGoalNativeResultSchema.parse(result);
package/dist/core.js CHANGED
@@ -30,7 +30,7 @@ import { assertCallerEnv } from "./harnesses/caller-mcp.js";
30
30
  import { fileURLToPath } from "node:url";
31
31
  import * as rtk from "./rtk.js";
32
32
  import { manageClaudeAgentGoal, manageGrokAgentGoal } from "./agent-goal-native-result.js";
33
- import { grokCurrentSessionOwner, readFreshGrokGoal, clearGrokGoal, grokGoalClearReady } from './harnesses/grok-goal.js';
33
+ import { grokCurrentSessionOwner, readFreshGrokGoal, readSavedGrokGoal, clearGrokGoal, grokGoalClearReady } from './harnesses/grok-goal.js';
34
34
  import { nativeGoalClickBytes } from './agent-goal-ui.js';
35
35
  import { observeClaudeGoalRows, clearClaudeGoal, setClaudeGoalObjective, claudeCurrentSessionOwner } from "./harnesses/claude-goal.js";
36
36
  import { AgentGoalNotIssuedError, manageAgentGoal } from "./agent-goal.js";
@@ -6193,6 +6193,27 @@ async function agentGoalInContext(input, origin, expectedGoal, sendHeld = false)
6193
6193
  pause: sleep,
6194
6194
  };
6195
6195
  };
6196
+ const grokSavedState = (target) => {
6197
+ const meta = tryLoadAgentMetadata(input.session_id);
6198
+ if (!meta || meta.launch_id !== target.launch_id || meta.vendor_session_id !== target.vendor_session_id)
6199
+ throw Error('generation_replaced');
6200
+ const directory = grokSessionDirectory(meta);
6201
+ if (!directory)
6202
+ throw Error('native session directory unavailable');
6203
+ const file = path.join(directory, 'goal/state.json');
6204
+ let st;
6205
+ try {
6206
+ st = fs.lstatSync(file);
6207
+ }
6208
+ catch (error) {
6209
+ if (error.code === 'ENOENT')
6210
+ return null;
6211
+ throw error;
6212
+ }
6213
+ if (!st.isFile() || st.isSymbolicLink() || st.size > 4 * 1024 * 1024)
6214
+ throw Error('native state unavailable');
6215
+ return JSON.parse(fs.readFileSync(file, 'utf8'));
6216
+ };
6196
6217
  const grokPort = (target) => {
6197
6218
  const ui = goalUi(target);
6198
6219
  const read = (relative, optional = false) => {
@@ -6222,12 +6243,15 @@ async function agentGoalInContext(input, origin, expectedGoal, sendHeld = false)
6222
6243
  const harness = resolve()?.harness;
6223
6244
  if (sendHeld && harness !== "codex-cli")
6224
6245
  throw new ExecutionError("EXECUTION_STALE_GENERATION");
6225
- if (harness === 'grok-cli')
6226
- return withAgentSendLock(input.session_id, () => manageGrokAgentGoal(input, { resolve,
6227
- read: target => readFreshGrokGoal(target.vendor_session_id, grokPort(target)),
6246
+ if (harness === 'grok-cli') {
6247
+ // inspect reads the saved goal/state.json: no typing, no send lock. clear keeps the fresh UI status under the lock.
6248
+ const run = () => manageGrokAgentGoal(input, { resolve,
6249
+ read: async (target) => input.action === 'inspect' ? readSavedGrokGoal(grokSavedState(target)) : readFreshGrokGoal(target.vendor_session_id, grokPort(target)),
6228
6250
  canClear: target => grokGoalClearReady(grokPort(target).ui),
6229
6251
  clear: (target, before) => clearGrokGoal(target.vendor_session_id, before, grokPort(target)),
6230
- }, origin));
6252
+ }, origin);
6253
+ return input.action === 'inspect' ? run() : withAgentSendLock(input.session_id, run);
6254
+ }
6231
6255
  if (harness === "claude-code") {
6232
6256
  // Reading is the session transcript only: it writes nothing to the seat, so it needs no send lock,
6233
6257
  // composer, turn state, TTY owner or version check. Only a mutation types into the composer.
@@ -15,15 +15,16 @@ export function grokCurrentSessionOwner(record, expected) {
15
15
  return 'unavailable';
16
16
  return rows[0].session_id === expected.sessionId ? 'match' : 'mismatch';
17
17
  }
18
+ // Grok owns the status vocabulary (1.0.77 adds budget_limited, ...): kept as an open string. Keys it adds later are dropped.
18
19
  export const grokNativeGoalStateSchema = z.object({
19
- goal_id: z.string().uuid(), objective: z.string().min(1), status: z.enum(['active', 'user_paused']), phase: z.enum(['Idle', 'Planning', 'Executing']),
20
+ goal_id: z.string().uuid(), objective: z.string().min(1), status: z.string().min(1), phase: z.enum(['Idle', 'Planning', 'Executing']),
20
21
  token_budget: z.number().int().positive(), elapsed_ms: z.number().int().nonnegative(), created_at: z.string().datetime({ offset: true }),
21
22
  current_subagent_id: z.string().nullable(), current_subagent_role: z.string().nullable(),
22
23
  total_worker_rounds: z.number().int().nonnegative(), total_verify_rounds: z.number().int().nonnegative(),
23
24
  token_baseline: z.number().int().nonnegative(), tokens_used_high_water: z.number().int().nonnegative(), parent_tokens_spent: z.number().int().nonnegative(), last_session_tokens_seen: z.number().int().nonnegative(),
24
25
  history: z.array(z.object({ timestamp: z.string().datetime({ offset: true }), event: z.string(), detail: z.string().optional() }).strict()),
25
26
  evaluator_blocked_streak: z.number().int().nonnegative(), verifier_id: z.string().min(1), classifier_runs_attempted: z.number().int().nonnegative(), rounds_since_verify: z.number().int().nonnegative(), classifier_stall_count: z.number().int().nonnegative(), consecutive_not_achieved: z.number().int().nonnegative(), last_strategist_fired_at: z.number().int().nonnegative(), strategist_cap_bonus: z.number().int().nonnegative(),
26
- }).strict();
27
+ }).strip();
27
28
  const elapsedDisplay = z.string().max(64).regex(/^(?:\d+s|\d+m[0-5]\ds|\d+h[0-5]\dm)$/u);
28
29
  export const grokCurrentStatusSchema = z.discriminatedUnion('source', [z.object({
29
30
  source: z.literal('/goal status'), status: z.enum(['Active', 'UserPaused']), phase: z.enum(['Idle', 'Planning', 'Executing']),
@@ -36,7 +37,12 @@ export const grokCurrentStatusSchema = z.discriminatedUnion('source', [z.object(
36
37
  // Keep the persisted native snapshot distinct from the current worker's
37
38
  // fresh status. Resuming a worker can reset its in-memory phase without
38
39
  // rewriting that snapshot; never present the stored phase as current.
39
- export const grokCurrentGoalSchema = z.object({ kind: z.literal('grok-cli'), native: grokNativeGoalStateSchema, current_status: grokCurrentStatusSchema }).strict();
40
+ // inspect returns the saved snapshot alone; only a fresh UI read (clear) adds current_status.
41
+ export const grokCurrentGoalSchema = z.object({ kind: z.literal('grok-cli'), native: grokNativeGoalStateSchema, current_status: grokCurrentStatusSchema.optional() }).strict();
42
+ /** inspect: the session's saved goal/state.json only. Types nothing; no file is no goal. */
43
+ export function readSavedGrokGoal(state) {
44
+ return { current: state === null ? null : grokCurrentGoalSchema.parse({ kind: 'grok-cli', native: state }) };
45
+ }
40
46
  export function grokGoalFromFreshStatus(text, before, after) {
41
47
  const first = grokNativeGoalStateSchema.parse(before), native = grokNativeGoalStateSchema.parse(after);
42
48
  if (first.goal_id !== native.goal_id || first.objective !== native.objective)
@@ -231,7 +237,7 @@ export async function readFreshGrokGoal(sessionId, port) {
231
237
  export function grokGoalClearReady(ui) { return composer(ui.read()) === ''; }
232
238
  export async function clearGrokGoal(sessionId, expected, port) {
233
239
  const status = expected.current_status;
234
- if (expected.native.status !== 'user_paused' || status.source !== '/goal status' || status.status !== 'UserPaused' || status.phase !== 'Idle')
240
+ if (expected.native.status !== 'user_paused' || status?.source !== '/goal status' || status.status !== 'UserPaused' || status.phase !== 'Idle')
235
241
  throw new AgentGoalNotIssuedError('native_goal_clear_input_unconfirmed');
236
242
  let enterAttempted = false;
237
243
  const guard = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-mcp",
3
- "version": "0.70.36",
3
+ "version": "0.70.37",
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": [