aiterm-mcp 0.70.54 → 0.70.56

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,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.70.56] - 2026-11-14
11
+
12
+ - Claude `agent_configure` with an alias (`fable`, `opus`) selects the family's newest row on both picker layouts when the seat's catalog names the alias without a version (`Fable`). It refused on versioned rows (`Fable 5.2`) with `CLAUDE_MODEL_NOT_IN_PICKER` (Kiro 2026-11-14). An alias the catalog names with a version still means that version only.
13
+ - `aiterm.agent-configure-request-result.v1` gains `refusal: {code, kind} | null` for `not_applied` (`turn_running` / `not_offered` / `other`), so a caller can retry a turn refusal at the next boundary and surface a picker refusal. The not-ready refusal now has the code `AGENT_CONFIGURE_NOT_READY` (configure_error `_meta` too).
14
+
15
+ - A launch no longer refuses the moment a startup screen it already answered is still on screen: the frame right after the key can be the old one. It waits that screen out like an unanswered one, and answers Antigravity's `esc to dismiss` notice again (at most once a second) while it stays (Kiro rabbit-linux: agy's notice on its first start after a self-update, one Escape, `AGENT_STARTUP_BLOCKED reason=vendor_notice` 0.84 s later).
16
+
17
+ - Antigravity seats get `append_system_prompt` as an always-on rule (`.agents/rules/aiterm.md` with `trigger: always_on`) in the seat's own `--add-dir` folder, so it is in every turn from the start. The first prompt, or a promptless seat's first input, is sent as given (lab: agy 1.5.8 loads that rule; without the frontmatter it skips the file).
18
+
19
+ - Antigravity's Linux exec shape is captured (1.5.8, container): `bash -c <cmd>` as a session leader on its own pty, counted by the existing session-leader rule since 0.70.47. Fixture and ADR 0141 table only; no runtime change.
20
+
21
+ ## [0.70.55] - 2026-11-13
22
+
23
+ - Antigravity seats whose turn is over while a background task runs read idle in seat-turns, so the seat's reason is the background task, not the turn (a68, Centi train W). A spinner over `esc to cancel` still reads a running turn.
24
+
25
+ - A launch no longer closes the seat at the first frame of a startup screen Aiterm does not answer: it watches until the ready budget ends and goes on if the screen leaves by itself (Centi train W F2: agy's login screen for 3 s right after a login). Claude's first-run steps still refuse at once.
26
+
10
27
  ## [0.70.54] - 2026-11-13
11
28
 
12
29
  - Antigravity seats state their own background tasks too (a68): read from the bound conversation's transcript ("running as a background task with task id" until "Task id … finished").
@@ -3452,7 +3469,9 @@ prototype (preserved under `prototype/python/` as the porting source and referen
3452
3469
  `ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
3453
3470
  provenance.
3454
3471
 
3455
- [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.54...HEAD
3472
+ [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.56...HEAD
3473
+ [0.70.56]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.55...v0.70.56
3474
+ [0.70.55]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.54...v0.70.55
3456
3475
  [0.70.54]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.53...v0.70.54
3457
3476
  [0.70.53]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.52...v0.70.53
3458
3477
  [0.70.52]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.51...v0.70.52
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.54** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
218
+ **状態:** 開発継続中 · 現行公開版 **v0.70.56** · 動作対象は 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.54** · 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.56** · 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
 
@@ -7,7 +7,7 @@ import { OPERATION_ID_RE, agentManagedClaudeSettingsPath, agentClaudeResultPath,
7
7
  import { agentCodexCallerPromptPath, agentCodexCallerMcpPath } from "./harnesses/codex.js";
8
8
  import { resolveAndValidateGrokAuth, agentGrokCallerPromptPath, agentGrokCallerAgentPath } from "./harnesses/grok.js";
9
9
  import { agentCursorCallerPromptPath, agentCursorCallerPluginDir } from "./harnesses/cursor.js";
10
- import { agentAntigravityCallerPromptPath, agentAntigravityCallerDir } from "./harnesses/antigravity.js";
10
+ import { agentAntigravityCallerDir } from "./harnesses/antigravity.js";
11
11
  import { assertSessionName, agentsDir, readAgentGeneration, selectAgentMetadataFile, agentEventPath, agentLineageFields, LAUNCH_ID_RE, AGENT_LINEAGE_RE } from "./agent-shared.js";
12
12
  const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
13
13
  function normalizeInitialPromptState(v) {
@@ -136,7 +136,6 @@ export function loadAgentMetadata(name) {
136
136
  vendor_session_id: m.vendor_session_id ?? null, initial_prompt: normalizeInitialPromptState(m.initial_prompt),
137
137
  hook_route: "shared_antigravity_home", antigravity_home: m.antigravity_home, node_platform: process.platform,
138
138
  ...(typeof m.write_scope === "string" ? { write_scope: m.write_scope } : {}),
139
- ...(m.antigravity_caller_prompt_file === agentAntigravityCallerPromptPath(name) ? { antigravity_caller_prompt_file: m.antigravity_caller_prompt_file } : {}),
140
139
  ...(m.antigravity_caller_mcp_dir === agentAntigravityCallerDir(name) ? { antigravity_caller_mcp_dir: m.antigravity_caller_mcp_dir } : {}),
141
140
  ...deliveryFields, ...executableFields, ...fastFields, ...startupFields, ...loadAgentLineageFields(m, true) };
142
141
  }
@@ -343,9 +343,6 @@ export function parentPaneEvidence(kind, screen) {
343
343
  start--;
344
344
  }
345
345
  const current = lines.slice(Math.max(0, start)).join("\n");
346
- // Antigravity keeps the turn open while a background task runs: it reruns the model when the task ends, then sends Stop.
347
- if (kind === "antigravity" && /·\s*[1-9]\d*\s+task\(s\)/u.test(lines.slice(marker + 1).join("\n")))
348
- return "busy";
349
346
  if (kind === "grok" && grokPromptAwaitingAccept(current))
350
347
  return "unknown";
351
348
  if (kind === "cursor" && cursorPromptHooksRunning(screen))
@@ -378,5 +375,11 @@ export function parentPaneEvidence(kind, screen) {
378
375
  && /^\s*esc to cancel\b/imu.test(lines.slice(marker + 1).join("\n")))
379
376
  && !/^\s*esc to interrupt\s*$/imu.test(lines.slice(marker + 1).join("\n")))
380
377
  return "unknown";
381
- return observed.state === "busy" ? "busy" : "ready";
378
+ if (observed.state === "busy")
379
+ return "busy";
380
+ // agy holds its Stop while a background task runs (it reruns the model when the task ends): the visible turn is over and
381
+ // only the task works, which the seat's own work counts (a68).
382
+ if (kind === "antigravity" && /·\s*[1-9]\d*\s+task\(s\)/u.test(lines.slice(marker + 1).join("\n")))
383
+ return "ready_background";
384
+ return "ready";
382
385
  }
@@ -22,9 +22,19 @@ const resultSchema = z.object({ schema: z.literal("aiterm.agent-configure-result
22
22
  provider: z.enum(["claude", "codex", "grok", "cursor", "antigravity"]),
23
23
  harness: z.enum(["claude-code", "codex-cli", "grok-cli", "cursor-cli", "antigravity-cli"]),
24
24
  model: z.string().nullable(), reasoning_effort: z.string().nullable(), fast: z.boolean().nullable() }).strict();
25
+ // configure-reconcile.md `refusal`: why a not_applied request was refused, so a caller can retry at a boundary or tell the requester.
26
+ const refusalSchema = z.object({ code: z.string().min(1).max(128), kind: z.enum(["turn_running", "not_offered", "other"]) }).strict();
27
+ const TURN_RUNNING = new Set(["AGENT_CONFIGURE_NOT_READY", "AGENT_SEND_BUSY", "GOAL_CONFIGURE_TURN_END_UNCONFIRMED"]);
28
+ const NOT_OFFERED = new Set(["CLAUDE_MODEL_NOT_IN_PICKER", "CLAUDE_MODEL_NOT_SELECTABLE", "CLAUDE_MODEL_SESSION_ONLY_UNAVAILABLE",
29
+ "CLAUDE_EFFORT_NOT_SELECTABLE", "FAST_MODE_NOT_SUPPORTED", "FAST_MODE_UNAVAILABLE"]);
30
+ export function configurationRefusal(error) {
31
+ const code = error.configureRefusal?.code ?? /^([A-Z][A-Z0-9_]{2,})\b/u.exec(error.message)?.[1] ?? "UNCODED";
32
+ return { code, kind: TURN_RUNNING.has(code) ? "turn_running" : NOT_OFFERED.has(code) ? "not_offered" : "other" };
33
+ }
25
34
  const recordSchema = z.object({ schema: z.literal("aiterm.configuration-request.v1"), binding: configurationBindingSchema,
26
35
  requested: settingsSchema, terminal_at: z.iso.datetime().nullable(), native_effect: z.enum(["not_issued", "possible", "selection_excluded"]),
27
36
  outcome: z.enum(["applied", "not_applied", "outcome_unknown"]), result: resultSchema.nullable(),
37
+ refusal: refusalSchema.optional(), // absent in records saved before 0.70.56
28
38
  }).strict().refine(value => configurationRequestDigest(value.requested) === value.binding.digest
29
39
  && (value.result === null || value.result.session_id === value.binding.session_id)
30
40
  && (value.terminal_at !== null || value.result === null && value.outcome === "outcome_unknown")
@@ -32,7 +42,7 @@ const recordSchema = z.object({ schema: z.literal("aiterm.configuration-request.
32
42
  export const configurationReceiptSchema = z.object({ schema: z.literal("aiterm.agent-configure-request-result.v1"),
33
43
  binding: configurationBindingSchema, request_state: z.enum(["not_recorded", "unavailable", "pending_or_unknown", "terminal"]),
34
44
  outcome: z.enum(["applied", "not_applied", "outcome_unknown"]), later_effect: z.enum(["excluded", "unconfirmed"]),
35
- terminal_at: z.iso.datetime().nullable(), result: resultSchema.nullable(),
45
+ terminal_at: z.iso.datetime().nullable(), result: resultSchema.nullable(), refusal: refusalSchema.nullable(),
36
46
  current: z.object({ availability: z.literal("unsupported") }).strict(), observed_at: z.iso.datetime(),
37
47
  }).strict();
38
48
  const failureSchema = z.object({ schema: z.literal("aiterm.agent-configure-error.v1"), session_id: z.string(),
@@ -80,6 +90,7 @@ function receipt(binding, record, missing = "unavailable") {
80
90
  outcome: record?.outcome ?? "outcome_unknown",
81
91
  later_effect: record && record.terminal_at !== null && record.native_effect !== "possible" ? "excluded" : "unconfirmed",
82
92
  terminal_at: record?.terminal_at ?? null, result: record?.result ?? null,
93
+ refusal: record?.outcome === "not_applied" ? record.refusal ?? null : null,
83
94
  current: { availability: "unsupported" }, observed_at: new Date().toISOString() };
84
95
  }
85
96
  export function reconcileConfigurationRequest(input) {
@@ -138,6 +149,8 @@ export async function applyConfigurationRequest(input, settings, apply) {
138
149
  // UI input was issued, but the adapter read the picker closed before any selecting key (configure-reconcile.md).
139
150
  if (record.outcome === "not_applied" && record.native_effect === "possible" && failure.configureRefusal?.selection_excluded)
140
151
  record.native_effect = "selection_excluded";
152
+ if (record.outcome === "not_applied")
153
+ record.refusal = configurationRefusal(failure);
141
154
  }
142
155
  record.terminal_at = new Date().toISOString();
143
156
  try {
package/dist/core.js CHANGED
@@ -50,7 +50,7 @@ import { withExecutionInterruptEffectScope, bindExecutionNativeTarget, beforeExe
50
50
  import { ExecutionError } from "./execution-wire.js";
51
51
  import { readExecutionParentProcess } from "./execution-parent-process.js";
52
52
  import { isCursorMcpClient } from "aiterm-steer-delivery";
53
- import { antigravityBinding, antigravityAuthChoiceKey, antigravityCurrentModel, antigravityStartupAction, antigravityAgentArgv, writeAntigravityCallerFiles, checkAntigravityCallerInput, antigravityPromptWithCaller, antigravityQuotaLimit, antigravityModelChoices, antigravityAuthStatus, antigravityAuthPane, antigravityTranscriptText, bindAntigravitySession, createAntigravityAgentMetadata, mergeAntigravityHooks } from "./harnesses/antigravity.js";
53
+ import { antigravityBinding, antigravityAuthChoiceKey, antigravityCurrentModel, antigravityStartupAction, antigravityAgentArgv, writeAntigravityCallerFiles, checkAntigravityCallerInput, antigravityQuotaLimit, antigravityModelChoices, antigravityAuthStatus, antigravityAuthPane, antigravityTranscriptText, bindAntigravitySession, createAntigravityAgentMetadata, mergeAntigravityHooks } from "./harnesses/antigravity.js";
54
54
  import { paneTokenHint } from "./harnesses/pane-tokens.js";
55
55
  import { pendingChildResultsFor } from "./parent-delivery-owners.js";
56
56
  import { readLinuxProcessRegistrationIdentity, readClaudeRegistrationIdentity, readProcessEnvironment, readRuntimeProcesses, readRuntimeProcessesShared, readProcessIdentities, processSubtree, parentProcess, processIdentity, signalRuntimeProcess, backgroundProcesses, processElapsedSeconds } from "./process-runtime.js";
@@ -180,7 +180,8 @@ const AGENT_EXEC_SHELLS = {
180
180
  // shortcut: a command run with the write-to-stdin tool also gets stdin and is not counted; read the script if that matters.
181
181
  cursor: command => /builtin eval "\$1"(?: 3<&- 4>&-)? < \/dev\/null/.test(command)
182
182
  || /-NonInteractive -File \S*ps-script-[0-9a-f-]+\.ps1/i.test(command),
183
- // POSIX: no shell marker; agy runs each command in its own pty session (session-leader rule in ownExecProcesses).
183
+ // POSIX: no shell marker (`bash -c <cmd>` on Linux, `zsh -c <cmd>` or the bare command on macOS, like its `sh -c` hooks);
184
+ // agy runs each command in its own pty session (session-leader rule in ownExecProcesses).
184
185
  // Windows: pwsh -Command starting with its UTF-8 $OutputEncoding line; hooks are cmd /c "pwsh … -EncodedCommand".
185
186
  antigravity: command => command.includes(" -Command \"try { $OutputEncoding = [System.Text.UTF8Encoding]::new($false);"),
186
187
  };
@@ -4969,6 +4970,8 @@ function setInitialDelivery(meta, value, cursor) {
4969
4970
  writeAgentMetadata(meta);
4970
4971
  }
4971
4972
  const STARTUP_SELECTION_POLL_MS = 100;
4973
+ // agy's dismissible startup notice is answered again (Escape) at most this often while it stays on screen.
4974
+ const AGENT_STARTUP_NOTICE_RESEND_MS = 1_000;
4972
4975
  const STARTUP_SELECTION_MAX_SAMPLES = 30;
4973
4976
  /** 起動時の確認画面で、選択中(❯)の行が目的の選択肢へ移ったことを確かめる。 */
4974
4977
  async function waitStartupSelection(name, selected) {
@@ -4986,17 +4989,33 @@ async function prepareAgentInput(name, meta, options, acceptRunningCodex = false
4986
4989
  // A resumed Codex can consume its native queue before the composer becomes idle.
4987
4990
  const running = (screen) => acceptRunningCodex && meta.kind === "codex" && !!meta.resumed_from
4988
4991
  && codexPaneObservation(screen).state === "busy" && codexRunningTurn(meta) !== null;
4989
- const wait = () => waitAgentTuiReady(name, meta, options.ready_timeout ?? AGENT_TUI_READY_TIMEOUT_MS, { selectSteer: running });
4992
+ const budget = options.ready_timeout ?? AGENT_TUI_READY_TIMEOUT_MS, deadline = performance.now() + budget;
4993
+ const wait = (ms = budget) => waitAgentTuiReady(name, meta, ms, { selectSteer: running });
4990
4994
  let ready = await wait();
4991
- const handled = new Set();
4995
+ const answeredAt = new Map();
4992
4996
  while (!ready.ready && !ready.steer) {
4993
- const action = meta.kind === "codex" ? codexStartupAction(ready.lastScreen, options.trust_project === true)
4997
+ const found = meta.kind === "codex" ? codexStartupAction(ready.lastScreen, options.trust_project === true)
4994
4998
  : meta.kind === "claude" ? claudeStartupAction(ready.lastScreen, options.trust_project === true)
4995
4999
  : meta.kind === "grok" ? grokStartupAction(ready.lastScreen, options.trust_project === true)
4996
5000
  : meta.kind === "antigravity" ? antigravityStartupAction(ready.lastScreen, options.trust_project === true, meta.cwd) : null;
4997
- if (!action || handled.has(action.kind))
5001
+ // A screen already answered is waited out like an unanswered one: the sample right after the key can still be the old
5002
+ // frame (Kiro rabbit-linux: agy's notice, one Escape, refused 0.84 s later). agy's notice is answered again while it stays.
5003
+ const last = found ? answeredAt.get(found.kind) : undefined;
5004
+ const action = found && (last === undefined
5005
+ || (found.kind === "antigravity_notice" && performance.now() - last >= AGENT_STARTUP_NOTICE_RESEND_MS)) ? found : null;
5006
+ // A screen Aiterm does not answer can leave by itself: agy drew its login screen for 3 s right after a login, then went on
5007
+ // (Centi train W F2). Look until the ready budget ends; only a screen that stays refuses. Claude's first-run steps never
5008
+ // leave without the account owner, so they refuse at once.
5009
+ const unanswered = agentPaneObservation(meta.kind, ready.lastScreen);
5010
+ if (!action && budget > 0 && performance.now() < deadline - AGENT_TUI_READY_POLL_MS
5011
+ && unanswered.state === "blocked" && unanswered.reason !== "vendor_onboarding_required") {
5012
+ await sleep(AGENT_TUI_READY_POLL_MS);
5013
+ ready = await wait(Math.max(1, deadline - performance.now()));
5014
+ continue;
5015
+ }
5016
+ if (!action)
4998
5017
  break;
4999
- handled.add(action.kind);
5018
+ answeredAt.set(action.kind, performance.now());
5000
5019
  const keys = action.selected ? action.keys.slice(0, -1) : action.keys;
5001
5020
  for (const key of keys) {
5002
5021
  await withExecutionNativeAdmission(name, () => sendKey(name, key, { preserveAgentOperation: true }));
@@ -5052,7 +5071,7 @@ async function sendInitialAgentPromptInLock(name, text, o) {
5052
5071
  startupBlockedHint(startup.reason), 2), { startupBlocked: startup.reason });
5053
5072
  }
5054
5073
  await o.after_ready?.(name, meta);
5055
- const promptText = meta.kind === "cursor" ? cursorPromptWithLineage(meta, text) : meta.kind === "antigravity" ? antigravityPromptWithCaller(meta, text) : text;
5074
+ const promptText = meta.kind === "cursor" ? cursorPromptWithLineage(meta, text) : text;
5056
5075
  const startOffset = agentCompletionCursor(meta);
5057
5076
  const inputId = meta.kind === "claude" ? randomBytes(16).toString("hex") : undefined;
5058
5077
  try {
@@ -6541,7 +6560,7 @@ export async function pauseAgentGoalForStop(target) {
6541
6560
  return { status: result.availability === "unsupported" || result.outcome === "unsupported" ? "unsupported" : result.outcome === "outcome_unknown" ? "outcome_unknown" : "unavailable", reason: result.reason };
6542
6561
  }
6543
6562
  function agentConfigureNotReady(name) {
6544
- return new AitermError(`agent session '${name}' は入力待ちではありません。番またはgoalが継続する場合はgoalを停止または完了にしてから agent_configure してください。設定は変えていません。`, 2);
6563
+ return Object.assign(new AitermError(`agent session '${name}' は入力待ちではありません。番またはgoalが継続する場合はgoalを停止または完了にしてから agent_configure してください。設定は変えていません。`, 2), { configureRefusal: { code: "AGENT_CONFIGURE_NOT_READY", relaunch: false, selection_excluded: false } });
6545
6564
  }
6546
6565
  export async function configureAgent(name, opts, expectedLaunchId) {
6547
6566
  let mayHaveChanged = false;
@@ -7529,14 +7548,13 @@ export async function dispatchAgentTurn(name, text, o = {}) {
7529
7548
  }
7530
7549
  /**
7531
7550
  * A seat launched without a prompt has no conversation yet at its first dispatch. Cursor gets Aiterm's launch context and the
7532
- * caller text there, Antigravity the caller text (neither has an instruction channel); later dispatches go to the bound
7533
- * conversation as plain text. A new launch (restart) starts unbound again, so its own first dispatch carries them.
7551
+ * caller text there (it has no instruction channel); later dispatches go to the bound conversation as plain text. A new launch
7552
+ * (restart) starts unbound again, so its own first dispatch carries them. Antigravity has its caller text as a rule instead.
7534
7553
  */
7535
7554
  export function firstDispatchText(meta, body) {
7536
7555
  if (meta.vendor_session_id)
7537
7556
  return body;
7538
- return meta.kind === "cursor" ? `${cursorLineagePreface(meta)}\n\n${body}`
7539
- : meta.kind === "antigravity" ? antigravityPromptWithCaller(meta, body) : body;
7557
+ return meta.kind === "cursor" ? `${cursorLineagePreface(meta)}\n\n${body}` : body;
7540
7558
  }
7541
7559
  async function dispatchAgentTurnInLock(name, text, o, pendingSend) {
7542
7560
  const meta = loadAgentMetadata(name);
@@ -11,7 +11,7 @@ import { spawnAgentControlCommand } from "../agent-resolver.js";
11
11
  import { liveNodeExecutable } from "../live-node.js";
12
12
  import { powershellInvocation } from "../windows-powershell.js";
13
13
  import { agentEventPath, agentLineageFields, agentsDir, assertSessionName, createEmpty0600, writeText0600, readFileRange, safeStatSize, shq, writeAgentMetadata, writeJson0600 } from "../agent-shared.js";
14
- import { assertCallerEnv, checkCallerInput, readCallerText, resolveCallerHeader, writeCallerJson } from "./caller-mcp.js";
14
+ import { assertCallerEnv, checkCallerInput, resolveCallerHeader, writeCallerJson } from "./caller-mcp.js";
15
15
  import { authUrl } from "../agent-auth.js";
16
16
  // agy 1.4.10 exposes effort-specific IDs; overriding an ID's effort is rejected by the CLI.
17
17
  export function antigravityCatalog(stdout, selected) {
@@ -203,13 +203,9 @@ export function createAntigravityAgentMetadata(name, cwd, initial, writeScope, l
203
203
  writeAgentMetadata(meta);
204
204
  return meta;
205
205
  }
206
- // ---- Caller launch fields (launch-identity-input.md "Caller launch fields"). agy has no per-run instruction channel Aiterm could
207
- // prove (the .agents/rules route was not confirmed), so the text prefixes the first prompt; the servers are .agents/mcp_config.json
208
- // in a per-seat folder passed as --add-dir. Both live in Aiterm state (0600 files), never in ~/.gemini or the project.
209
- export function agentAntigravityCallerPromptPath(name) {
210
- assertSessionName(name);
211
- return path.join(agentsDir(), `${name}.antigravity-caller-prompt.md`);
212
- }
206
+ // ---- Caller launch fields (launch-identity-input.md "Caller launch fields"). A per-seat folder passed as --add-dir holds the
207
+ // servers (.agents/mcp_config.json) and the text as an always-on rule (.agents/rules/aiterm.md; agy skips a rule without the
208
+ // trigger frontmatter). Both live in Aiterm state (0600 files), never in ~/.gemini or the project.
213
209
  export function agentAntigravityCallerDir(name) {
214
210
  assertSessionName(name);
215
211
  return path.join(agentsDir(), `${name}.antigravity-caller`);
@@ -227,16 +223,17 @@ export function checkAntigravityCallerInput(prompt, mcp) {
227
223
  export function writeAntigravityCallerFiles(meta, prompt, mcp, valueOf) {
228
224
  const servers = checkAntigravityCallerInput(prompt, mcp);
229
225
  assertCallerEnv("ANTIGRAVITY", servers, valueOf);
226
+ if (prompt === null && mcp === null)
227
+ return;
228
+ const dir = agentAntigravityCallerDir(meta.aiterm_session);
230
229
  if (prompt !== null) {
231
- const file = agentAntigravityCallerPromptPath(meta.aiterm_session);
232
- writeText0600(file, prompt);
233
- meta.antigravity_caller_prompt_file = file;
230
+ const rule = path.join(dir, ".agents", "rules", "aiterm.md");
231
+ fs.mkdirSync(path.dirname(rule), { recursive: true, mode: 0o700 });
232
+ writeText0600(rule, `---\ntrigger: always_on\n---\n\n${prompt}`);
234
233
  }
235
- if (mcp !== null) {
236
- const dir = agentAntigravityCallerDir(meta.aiterm_session);
234
+ if (mcp !== null)
237
235
  writeCallerJson(path.join(dir, ".agents", "mcp_config.json"), antigravityCallerMcpJson(servers, valueOf));
238
- meta.antigravity_caller_mcp_dir = dir;
239
- }
236
+ meta.antigravity_caller_mcp_dir = dir;
240
237
  }
241
238
  /**
242
239
  * The limit line of a quota-stopped turn, from agy's Stop `error` (agy 1.5.5:
@@ -246,11 +243,6 @@ export function antigravityQuotaLimit(error) {
246
243
  const m = error ? /\bRESOURCE_EXHAUSTED\b[^:]*:\s*([\s\S]+)|\(code 429\):\s*([\s\S]+)/.exec(error) : null;
247
244
  return m ? (m[1] ?? m[2]).trim() : null;
248
245
  }
249
- /** The first prompt with the caller's text in front (the seat's only instruction channel here). */
250
- export function antigravityPromptWithCaller(meta, prompt) {
251
- const caller = readCallerText(meta.antigravity_caller_prompt_file);
252
- return caller === null ? prompt : `${caller}\n\n${prompt}`;
253
- }
254
246
  export function antigravityAgentArgv(bin, model, effort, prompt, meta) {
255
247
  // The seat folder and the cwd are trusted by --settings, or agy asks and then writes settings.json in ~/.gemini.
256
248
  const folder = meta?.antigravity_caller_mcp_dir;
@@ -92,7 +92,8 @@ export async function configureClaudeForSessionOnly(name, meta, model, effort, b
92
92
  const rows = [...known.values()].sort((a, b) => a.index - b.index);
93
93
  let target = claudeModelPickerRow(rows, model);
94
94
  let offered = false; // native catalogにある(起こし直せば使える見込み)
95
- if (!target || /^[a-z]+$/iu.test(model)) {
95
+ const alias = /^[a-z]+$/iu.test(model) && model.toLowerCase() !== "default";
96
+ if (!target || alias) {
96
97
  const bin = meta.agent_executable ?? resolveAgentBin("claude");
97
98
  if (!bin)
98
99
  return refuse("CLAUDE_MODEL_CATALOG_UNAVAILABLE", "Claude CodeのCLIが見つかりません");
@@ -104,11 +105,13 @@ export async function configureClaudeForSessionOnly(name, meta, model, effort, b
104
105
  return refuse("CLAUDE_MODEL_CATALOG_UNAVAILABLE", error instanceof Error ? error.message : String(error));
105
106
  }
106
107
  const native = catalog.models.find(item => item.id.toLowerCase() === model.toLowerCase());
107
- // The native alias can resolve to an older model; picker order and the picker's alias rows are not alias authority.
108
108
  const label = native?.display_name ?? native?.id ?? model;
109
109
  const shown = claudeModelDisplayName(model);
110
110
  offered = !!native || catalog.models.some(item => item.display_name?.toLowerCase() === shown);
111
- target = claudePickerRowByName(rows, label);
111
+ // An alias the CLI resolves to a named version means that version, even an older one; an alias it names without a
112
+ // version (`Fable`, both picker layouts; Kiro 2026-11-14) or not at all keeps the family's newest row.
113
+ if (!target || (alias && /\d/u.test(label)))
114
+ target = claudePickerRowByName(rows, label);
112
115
  }
113
116
  if (!target) {
114
117
  const names = rows.map((row) => row.resolved && row.resolved !== row.label && !/^default\b/iu.test(row.label)
@@ -561,15 +561,23 @@ export function claudeModelPicker(screen) {
561
561
  }
562
562
  /**
563
563
  * 指定されたmodel(catalogのID・別名・表示名)が、選ぶ画面のどの行かを決める。
564
- * `claude-opus-5-5` は「Opus 5.5」、別名の `opus` はその系統で番号が一番若い行(catalogの並びで最新)。
564
+ * `claude-opus-5-5` は「Opus 5.5」の行だけ。別名の `opus` は、その系統の行のうち版が一番新しい行(版は1列目か、別名の行の
565
+ * 2列目から読む。版つきの画面 `Opus 5.5` でも別名の画面 `Opus` → `Opus 5.5` でも同じ。同じ版なら上の行、版の読めない行は最後)。
565
566
  */
566
567
  export function claudeModelPickerRow(rows, model) {
567
568
  const want = model.trim().toLowerCase();
568
569
  const sorted = [...rows].sort((a, b) => a.index - b.index);
569
- return claudePickerRowByName(sorted, claudeModelDisplayName(want))
570
- ?? (want === "default" ? sorted.find((row) => /^default\b/iu.test(row.label)) : undefined)
571
- ?? (/^[a-z]+$/u.test(want) ? sorted.find((row) => row.label.toLowerCase().startsWith(`${want} `) && /^\S+ \d/u.test(row.label)) : undefined)
572
- ?? null;
570
+ if (want === "default")
571
+ return sorted.find((row) => /^default\b/iu.test(row.label)) ?? null;
572
+ if (!/^[a-z]+$/u.test(want))
573
+ return claudePickerRowByName(sorted, claudeModelDisplayName(want));
574
+ const names = (row) => [row.label, row.resolved].map((name) => name?.toLowerCase() ?? "");
575
+ const version = (row) => names(row).map((name) => /^\S+ (\d+(?:\.\d+)?)/u.exec(name)?.[1])
576
+ .find((v) => v !== undefined)?.split(".").map(Number) ?? [-1];
577
+ const newer = (a, b) => (a[0] - b[0]) || ((a[1] ?? 0) - (b[1] ?? 0));
578
+ return sorted.filter((row) => !/^default\b/iu.test(row.label)
579
+ && names(row).some((name) => name === want || name.startsWith(`${want} `)))
580
+ .reduce((best, row) => !best || newer(version(row), version(best)) > 0 ? row : best, null);
573
581
  }
574
582
  /** `claude-fable-5-2` → `fable 5.2`。IDの形でなければ小文字にしただけの物。 */
575
583
  export function claudeModelDisplayName(model) {
package/dist/index.js CHANGED
@@ -1634,7 +1634,7 @@ export function createAitermServer(options = {}) {
1634
1634
  launch_operation_id: z.string().regex(/^sha256:[0-9a-f]{64}$/).optional().describe("Claude Codeのpromptなしexact replay相関だけで使用"),
1635
1635
  remote: remoteInputField,
1636
1636
  terminal: terminalArgumentSchema.optional().describe(terminalArgumentDescription),
1637
- append_system_prompt: z.string().min(1).optional().describe("Launch instructions added to the system prompt; kept in Aiterm state, not in the project or home. Never put secrets here. Codex: appended to developer_instructions after Aiterm's marker; Grok: appended to --rules; at most 64 KiB for both. Cursor and Antigravity have no system-prompt channel: the text goes in front of the first prompt, or of the first input sent to a promptless seat (at most 64 KiB)"),
1637
+ append_system_prompt: z.string().min(1).optional().describe("Launch instructions added to the system prompt; kept in Aiterm state, not in the project or home. Never put secrets here. Codex: appended to developer_instructions after Aiterm's marker; Grok: appended to --rules; Antigravity: an always-on rule in the seat's own --add-dir folder; at most 64 KiB for these. Cursor has no system-prompt channel: the text goes in front of the first prompt, or of the first input sent to a promptless seat (at most 64 KiB)"),
1638
1638
  mcp_config: z.object({ mcpServers: z.record(z.string(), z.unknown()) }).strict().optional().describe("Extra MCP servers for this seat. Secret header values: write ${NAME} and list NAME in env_vars. Codex, Grok, Cursor and Antigravity take only http servers {type?: \"http\", url, headers}: a literal header, 'Authorization: Bearer ${NAME}' or a header whose whole value is ${NAME}; other shapes, and a ${NAME} with no value at launch, are refused before the seat starts. Cursor runs a server as plugin-aiterm-caller-<name> beside a same-name user server; Codex, Grok and Antigravity replace a same-name user server for this seat (Codex: a user stdio server of that name runs Aiterm's relay to the given url instead)"),
1639
1639
  fork_from: z.object({
1640
1640
  session_id: z.string().regex(/^[A-Za-z0-9_-]{1,64}$/).describe("The main Aiterm seat on the same machine (the terminal or remote when given)"),
@@ -109,8 +109,9 @@ export function observeManagedSpan(file, binding, evidence, terminal, at, positi
109
109
  return { state: "running", turn_id, started_at, event_cursor: null, interim_from, wait_process: null };
110
110
  }
111
111
  // A launch that never showed busy nor any terminal has no turn to hide: its settled ready is idle.
112
- // An idle compaction has no Stop of its own; its notice settles the span its spinner opened.
113
- if (evidence !== "ready_compacted" && (!terminal && (record?.span || record?.terminal) || record?.span && terminal === record.terminal))
112
+ // An idle compaction has no Stop of its own; its notice settles the span its spinner opened. So does agy's ready composer
113
+ // over a background-task count: its Stop waits for the task, and the rerun that follows opens a new span.
114
+ if (evidence !== "ready_compacted" && evidence !== "ready_background" && (!terminal && (record?.span || record?.terminal) || record?.span && terminal === record.terminal))
114
115
  return null;
115
116
  if (!record)
116
117
  record = { binding, span: null, terminal, ready: null };
@@ -45,6 +45,7 @@ Model, effort and fast are forbidden in reconcile. The reader does not create a
45
45
  | `terminal_at` | Saved handler/finally completion time, otherwise null |
46
46
  | `result` | Original successful configure result, otherwise null; its model/effort retain their existing requested-value semantics |
47
47
  | `later_effect` | `excluded` for saved terminal requests with no native mutation issued, or refused by the Claude model picker before its selection key with the picker read closed afterwards; otherwise `unconfirmed` |
48
+ | `refusal` | Only for `outcome: not_applied`: `{code, kind}`. `code` is the refusal's own code (`CLAUDE_MODEL_NOT_IN_PICKER`, `AGENT_SEND_BUSY`, ...; `UNCODED` when it had none). `kind`: `turn_running` (the seat was in a turn or another send: `AGENT_CONFIGURE_NOT_READY`, `AGENT_SEND_BUSY`, `GOAL_CONFIGURE_TURN_END_UNCONFIRMED`; apply again at the next boundary), `not_offered` (the harness does not offer it in this session: `CLAUDE_MODEL_NOT_IN_PICKER`, `CLAUDE_MODEL_NOT_SELECTABLE`, `CLAUDE_MODEL_SESSION_ONLY_UNAVAILABLE`, `CLAUDE_EFFORT_NOT_SELECTABLE`, `FAST_MODE_NOT_SUPPORTED`, `FAST_MODE_UNAVAILABLE`; tell the requester), `other`. Otherwise null; also null on a `not_applied` receipt saved before 0.70.56 (kind unknown) (Kiro, 2026-11-14) |
48
49
  | `current` | `{ "availability": "unsupported" }`; no UI preview is performed |
49
50
  | `observed_at` | Time this receipt was read |
50
51
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-mcp",
3
- "version": "0.70.54",
3
+ "version": "0.70.56",
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": [