aiterm-mcp 0.29.2 → 0.29.3

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/dist/core.js CHANGED
@@ -15,7 +15,7 @@ import * as rtk from "./rtk.js";
15
15
  import { AitermError, telemetryOwnedFailure, ownTelemetryFailure } from "./errors.js";
16
16
  import { isWin, SOCKDIR, tmuxCommand, loadPtyBufferChunk, pasteBufferBaseArgs, TMUX_EMPTY_CONFIG, attachCommand, normalizePaneCommand, appendMarkSentinel, settlePaneLog, paneCwdArgument, } from "./tmux-runtime.js";
17
17
  import { sleep, currentUid, runtimeStateBase, safeStatSize, readFileRange, writeJson0600, createEmpty0600, shq, LAUNCH_ID_RE, AGENT_DONE_POLL_MS, AGENT_EVENT_MAX_BYTES, assertSessionName, agentsDir, agentEventPath, agentMetadataPath, writeAgentMetadata, AGENT_EVENT_TAIL_BYTES, agentLabel, agentHarness, subagentInstruction, agentLineageFields, } from "./agent-shared.js";
18
- import { GROK_MODEL_DEFAULTS, realGrokHome, resolveAndValidateGrokAuth, assertGrokModelAvailable, grokEventsTranscript, latestGrokCompletion, grokInitializationComplete, observeGrokDone, buildGrokAgentCmd, grokLaunchNote, grokEnvTokens, grokTuiReady, GROK_COMPOSER_MARKER_RE, grokFooterHasConfiguration, grokTranscriptText, createGrokAgentMetadata, } from "./harnesses/grok.js";
18
+ import { GROK_MODEL_DEFAULTS, realGrokHome, resolveAndValidateGrokAuth, assertGrokModelAvailable, grokEventsTranscript, latestGrokCompletion, observeGrokDone, buildGrokAgentCmd, grokLaunchNote, grokEnvTokens, grokTuiReady, GROK_COMPOSER_MARKER_RE, grokFooterHasConfiguration, grokTranscriptText, createGrokAgentMetadata, } from "./harnesses/grok.js";
19
19
  import { bindCodexTranscriptSession, latestCodexCompletion, observeCodexDone, buildCodexAgentCmd, codexLaunchNote, codexTuiReady, codexLaunchBlockingDialog, CODEX_COMPOSER_MARKER_RE, codexModelChoice, codexEffortChoice, codexMoreReasoningChoice, codexTranscriptText, createCodexAgentMetadata, } from "./harnesses/codex.js";
20
20
  import { OPERATION_ID_RE, CLAUDE_RESULT_MAX_BYTES, CLAUDE_EFFORTS, agentManagedClaudeSettingsPath, agentClaudeResultPath, agentClaudeOperationPath, agentClaudeApprovalReceiptPath, agentClaudeDispatchReceiptPath, validateOperationId, readClaudeResultText, assertClaudeAuthenticationReady, buildClaudeAgentCmd, claudeLaunchNote, claudeTuiReady, CLAUDE_COMPOSER_MARKER_RE, createClaudeAgentMetadata, } from "./harnesses/claude.js";
21
21
  import { bindCursorTranscriptSession, cursorTurnBoundary, latestCursorCompletion, observeCursorDone, cursorTranscriptText, assertCursorAuthenticationReady, assertCursorModelAvailable, buildCursorAgentCmd, createCursorAgentMetadata, cursorLaunchNote, cursorEffortNavigation, cursorTuiReady, CURSOR_COMPOSER_MARKER_RE, validateCursorModelEffort, } from "./harnesses/cursor.js";
@@ -2294,12 +2294,19 @@ function isAgentTuiReady(kind, screen) {
2294
2294
  // Codex/Claude は実行中に「(esc to interrupt)」、Cursor は「Working」+
2295
2295
  // 「ctrl+c to stop」を表示する(いずれも実機採取)。startup 側の処理(MCP initialize 等)が
2296
2296
  // 走ったまま古い composer がscrollbackに残る画面は入力受付とみなさない。
2297
- // Grok/Composer は busy 表示文字列の実機根拠が未採取のため対象外(誤ブロックで起動不能にしない)。
2297
+ // Grok/Composer は実機で `Waiting for response` / `Responding…` / `[stop]` を表示する。
2298
2298
  function isAgentTuiBusy(kind, screen) {
2299
2299
  if (kind === "cursor")
2300
2300
  return /ctrl\+c to stop/i.test(screen);
2301
2301
  if (kind === "codex" || kind === "claude")
2302
2302
  return /esc to interrupt/i.test(screen);
2303
+ if (kind === "grok" || kind === "composer") {
2304
+ return screen.includes("Waiting for response")
2305
+ || screen.includes("Responding…")
2306
+ || screen.includes("Responding...")
2307
+ || screen.includes("[stop]")
2308
+ || /\[hooks:\s*\d+\/\d+\]/u.test(screen);
2309
+ }
2303
2310
  return false;
2304
2311
  }
2305
2312
  // ready gate 用: 入力欄マーカーがあっても busy 表示中は ready と数えない。
@@ -2353,11 +2360,7 @@ async function waitAgentTuiReadyImpl(kind, sample, sleepFn, opts = {}) {
2353
2360
  }
2354
2361
  }
2355
2362
  async function waitAgentTuiReady(name, meta, timeoutMs = AGENT_TUI_READY_TIMEOUT_MS) {
2356
- return waitAgentTuiReadyImpl(meta.kind, () => {
2357
- if ((meta.kind === "grok" || meta.kind === "composer") && !grokInitializationComplete(meta))
2358
- return "";
2359
- return captureScreen(name, AGENT_TUI_READY_LINES);
2360
- }, sleep, { timeoutMs });
2363
+ return waitAgentTuiReadyImpl(meta.kind, () => captureScreen(name, AGENT_TUI_READY_LINES), sleep, { timeoutMs });
2361
2364
  }
2362
2365
  async function waitAgentTuiReadyByKind(name, kind, timeoutMs = AGENT_TUI_READY_TIMEOUT_MS) {
2363
2366
  return waitAgentTuiReadyImpl(kind, () => captureScreen(name, AGENT_TUI_READY_LINES), sleep, { timeoutMs });
@@ -3207,22 +3210,22 @@ export async function openAgentWithInitialPrompt(kind, opts = {}) {
3207
3210
  }
3208
3211
  // v0.16.0: launcher は常に managed(Stop hook つき)で立つ。手動運転したい場合は
3209
3212
  // pty_open で素の PTY を開き、harness CLI を自分で send する。
3210
- // 第3要素は「起動時点でturnが走っているか」の event_cursor: Grok/Composer/Cursor の argv prompt は
3211
- // event file 新規作成直後の起動=境界0、prompt なしの起動は turn なし=null。
3212
- if (!prompt || (kind !== "codex" && kind !== "claude")) {
3213
+ // prompt無しはTUIを起動するだけ。prompt有りはharnessを問わず、TUI ready確認後の
3214
+ // sendInitialAgentPromptへ一本化する。Grokの--verbatim argvはCLIが本文をqueueへ置いただけで
3215
+ // turnを開始しない版があり、event_cursor=0を「実行中」と返すと利用側へ嘘をつく。
3216
+ if (!prompt) {
3213
3217
  const [sid, hint] = openAgent(kind, {
3214
3218
  session_name: opts.session_name ?? null,
3215
3219
  model: opts.model ?? null,
3216
3220
  reasoning_effort: opts.reasoning_effort ?? null,
3217
3221
  cwd: opts.cwd ?? null,
3218
- prompt,
3222
+ prompt: null,
3219
3223
  agent_done: true,
3220
3224
  launch_operation_id: opts.launch_operation_id ?? null,
3221
3225
  write_scope: opts.write_scope,
3222
3226
  env_vars: opts.env_vars,
3223
3227
  });
3224
- // argv prompt(grok/composer/cursor)は composer を経由しないため submit 座礁観測の対象外。
3225
- return [sid, hint, prompt ? 0 : null, null];
3228
+ return [sid, hint, null, null];
3226
3229
  }
3227
3230
  const [sid, hint] = openAgent(kind, {
3228
3231
  session_name: opts.session_name ?? null,
package/dist/index.js CHANGED
@@ -563,7 +563,7 @@ function registerAgentTool(toolName, kind, desc) {
563
563
  event_cursor: z.number().int().nullable(),
564
564
  wait_command: z.string().nullable(),
565
565
  // 初回prompt dispatch後のsubmit座礁観測(additive)。true=composerに残存を確認(submit未成立の疑い)/
566
- // false=残存を観測せず(submit成立の保証ではない)/ null=promptなし・argv prompt・判定不能。
566
+ // false=残存を観測せず(submit成立の保証ではない)/ null=promptなし・判定不能。
567
567
  submit_residue: z.boolean().nullable(),
568
568
  ...writeScopeOutputSchema,
569
569
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-mcp",
3
- "version": "0.29.2",
3
+ "version": "0.29.3",
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, and Cursor Agent CLI, plus durable PTYs for SSH, containers, and REPLs.",
6
6
  "keywords": [