aiterm-mcp 0.64.1 → 0.64.2

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.64.2] - 2026-11-08
11
+
12
+ - Claude wait (`observeAgentDone` / `aiterm-wait`): a transcript API-error record whose CLI `error` field is `rate_limit` (for example the Fable limit record with no `apiErrorStatus`) is now `failure.category: "rate_limited"`, whatever its text. When Stop still fires, the wait looks at the turn's last assistant record up to the Stop time and returns that error instead of `done`. The hibernate exception for a rate-limited turn reads the same category.
13
+
10
14
  ## [0.64.1] - 2026-11-08
11
15
 
12
16
  - Seat turn (`readSeatTurns`, Claude/Grok/Cursor/Antigravity seats): a seat whose current launch has shown neither busy nor any completed turn now reports `{state: "idle"}` once its pane stays ready for 250 ms, instead of `turn: null` until its first turn. Once a span or a turn end was recorded, an unreadable turn end still reports null. Codex seats are unchanged.
@@ -3106,7 +3110,8 @@ prototype (preserved under `prototype/python/` as the porting source and referen
3106
3110
  `ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
3107
3111
  provenance.
3108
3112
 
3109
- [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.64.1...HEAD
3113
+ [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.64.2...HEAD
3114
+ [0.64.2]: https://github.com/kitepon/aiterm-mcp/compare/v0.64.1...v0.64.2
3110
3115
  [0.64.1]: https://github.com/kitepon/aiterm-mcp/compare/v0.64.0...v0.64.1
3111
3116
  [0.64.0]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.18...v0.64.0
3112
3117
  [0.63.18]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.17...v0.63.18
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.64.1** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
218
+ **状態:** 開発継続中 · 現行公開版 **v0.64.2** · 動作対象は 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.64.1** · 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.64.2** · 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
@@ -64,7 +64,7 @@ import { readFileOrNull, restoreJsonSetting, withUserConfigLock, restoreUserDefa
64
64
  import { isDeepStrictEqual } from "node:util";
65
65
  import { grokAuthPlan, grokAuthStatus, grokAuthPane, GROK_MODEL_DEFAULTS, realGrokHome, resolveAndValidateGrokAuth, assertGrokModelAvailable, grokModelChoices, grokModelFromFooter, grokFooterModelName, grokModelDefaultsFromBody, restoreGrokModelDefaults, grokEventsTranscript, grokSessionDirectory, latestGrokCompletion, grokTurnSettled, observeGrokDone, buildGrokAgentCmd, grokAgentArgv, grokLaunchNote, grokEnvTokens, grokEnvEntries, grokTuiReady, grokPaneObservation, GROK_INTERRUPT_KEY, grokRateLimitDialog, grokPromptAwaitingAccept, grokUnacceptedPromptRestored, grokStartupAction, grokFooterHasConfiguration, grokTranscriptText, createGrokAgentMetadata, } from "./harnesses/grok.js";
66
66
  import { codexAuthPlan, codexAuthStatus, codexAuthPane, realCodexHome, readCodexConfigPins, bindCodexTranscriptSession, latestCodexCompletion, codexTurnSettled, codexCompletedTurnId, codexWorkingResumeConfiguration, captureCodexRecoveryProof, captureCodexResumeProof, readCodexResumeProof, codexResumeProofDigest, codexRootTranscript, codexRunningTurn, codexInterruptionRecord, observeCodexDone, buildCodexAgentCmd, codexAgentArgv, codexResumeArgv, codexLaunchNote, codexPaneObservation, CODEX_INTERRUPT_KEY, codexHelperProcess, codexRateLimitModelSwitchDialog, codexApprovalDialog, codexStartupAction, codexModelChoice, codexEffortChoice, codexMoreReasoningChoice, codexTranscriptText, createCodexAgentMetadata, codexModelChoices, codexFastCommandOffered, codexFooterShowsFast, codexServiceTierNotices, restoreCodexDefaults, restoreCodexDefaultInFile, } from "./harnesses/codex.js";
67
- import { claudeAuthPlan, claudeAuthStatus, claudeAuthPane, OPERATION_ID_RE, CLAUDE_RESULT_MAX_BYTES, CLAUDE_EFFORTS, agentClaudeOperationPath, agentClaudeApprovalReceiptPath, agentClaudeDispatchReceiptPath, validateOperationId, readClaudeResultText, assertClaudeAuthenticationReady, claudeModelChoices, claudeConfigDir, claudeProjectSlug, claudeFastIndicatorShown, claudeFastResult, buildClaudeAgentCmd, claudeAgentArgv, claudeResumeArgv, claudeLaunchNote, claudePaneObservation, CLAUDE_INTERRUPT_KEY, claudeUsageLimit, claudeLiveSelectMenu, claudeStartupAction, createClaudeAgentMetadata, claudeSessionTranscriptPath, claudeApiErrorFromLine, claudeApiErrorAfter, claudeFailureCategory, } from "./harnesses/claude.js";
67
+ import { claudeAuthPlan, claudeAuthStatus, claudeAuthPane, OPERATION_ID_RE, CLAUDE_RESULT_MAX_BYTES, CLAUDE_EFFORTS, agentClaudeOperationPath, agentClaudeApprovalReceiptPath, agentClaudeDispatchReceiptPath, validateOperationId, readClaudeResultText, assertClaudeAuthenticationReady, claudeModelChoices, claudeConfigDir, claudeProjectSlug, claudeFastIndicatorShown, claudeFastResult, buildClaudeAgentCmd, claudeAgentArgv, claudeResumeArgv, claudeLaunchNote, claudePaneObservation, CLAUDE_INTERRUPT_KEY, claudeUsageLimit, claudeLiveSelectMenu, claudeStartupAction, createClaudeAgentMetadata, claudeSessionTranscriptPath, claudeApiErrorFromLine, claudeApiErrorAfter, claudeApiErrorEndingTurn, claudeFailureCategory, } from "./harnesses/claude.js";
68
68
  import { cursorAuthPlan, cursorAuthStatus, cursorAuthPane, bindCursorTranscriptSession, cursorTurnBoundary, latestCursorCompletion, cursorTranscript, cursorTranscriptSessionId, observeCursorDone, cursorTranscriptText, assertCursorAuthenticationReady, assertCursorModelAvailable, cursorModelChoices, cursorModelIsFastVariant, cursorFastParameter, cursorHeaderShowsFast, cursorPickerView, cursorEffortSelected, cursorParameterRows, cursorUserConfigPath, CURSOR_DEFAULT_MODEL_KEYS, realCursorHome, buildCursorAgentCmd, cursorAgentArgv, cursorPromptWithLineage, createCursorAgentMetadata, cursorLaunchNote, cursorEffortNavigation, cursorTuiReady, cursorPaneObservation, CURSOR_INTERRUPT_KEY, cursorPromptHooksRunning, cursorUsageLimit, CURSOR_SUBMIT_SEQUENCE, validateCursorModelEffort, } from "./harnesses/cursor.js";
69
69
  import { interimFromNow, readInterimWords, recordInterimBoundary } from "./interim-words.js";
70
70
  import { codexSeatTurn, grokSteerAcceptance, observeSteerDone, readSteerEntry, recordSteer } from "./steer-follow.js";
@@ -4243,6 +4243,10 @@ async function observeAgentDoneInternal(name, o = {}) {
4243
4243
  }
4244
4244
  if (o.input_id && !scanned.event && parts.some(line => parseAgentDoneEvent(line, meta).event !== null))
4245
4245
  throw new AitermError("AGENT_WAIT_INPUT_CHANGED: completion belongs to another or unconfirmed input", 2);
4246
+ // 利用上限ではStopも走る。その番の最後の記録がAPIエラーなら、doneでなく誤りとして返す。
4247
+ const ended = scanned.event && meta.kind === "claude" ? claudeApiErrorEndingTurn(meta, scanned.event.at) : null;
4248
+ if (ended)
4249
+ return observation("error", null, null, ended);
4246
4250
  if (scanned.event)
4247
4251
  return scanned.event.done_status === "turn_error"
4248
4252
  ? { ...observation("error", scanned.event), error: `Antigravity execution ended: ${scanned.event.reason}`, error_kind: scanned.event.reason }
@@ -683,15 +683,54 @@ export function claudeApiErrorFromLine(line) {
683
683
  session_id: typeof record.sessionId === "string" ? record.sessionId : null,
684
684
  uuid: typeof record.uuid === "string" ? record.uuid : null,
685
685
  parent_uuid: typeof record.parentUuid === "string" ? record.parentUuid : null,
686
+ kind: typeof record.error === "string" ? record.error : null,
686
687
  };
687
688
  }
688
689
  export function claudeFailureCategory(error) {
689
- if (error.status === 429 || /^You've (?:reached your [^.\r\n]{1,80} limit\.|hit your (?:[a-z0-9-]+ ){0,3}limit\b)/i.test(error.text))
690
+ if (error.status === 429 || error.kind === "rate_limit" || /^You've (?:reached your [^.\r\n]{1,80} limit\.|hit your (?:[a-z0-9-]+ ){0,3}limit\b)/i.test(error.text))
690
691
  return "rate_limited";
691
692
  if (error.status === 529)
692
693
  return "capacity";
693
694
  return error.status !== null && error.status >= 500 ? "transient" : "other";
694
695
  }
696
+ // 利用上限のAPIエラー(error:"rate_limit")ではStopも発火する(実測 2026-11-09、Fable上限で19回)。
697
+ // Stopの時点で、その番の最後のassistant記録がAPIエラーなら、その番は誤りで終わっている。
698
+ // 次の番の記録はStopより後に書かれるので、Stopの時刻までの最後の記録だけを見る。
699
+ export function claudeApiErrorEndingTurn(meta, stopAt) {
700
+ const file = claudeSessionTranscriptPath(meta);
701
+ const stop = Date.parse(stopAt);
702
+ if (!file || !Number.isFinite(stop))
703
+ return null;
704
+ let size;
705
+ try {
706
+ size = fs.statSync(file).size;
707
+ }
708
+ catch (error) {
709
+ if (error.code === "ENOENT")
710
+ return null;
711
+ throw error;
712
+ }
713
+ const lines = readFileRange(file, Math.max(0, size - AGENT_EVENT_TAIL_BYTES), size).toString("utf8").split("\n");
714
+ lines.pop();
715
+ for (const line of lines.reverse()) {
716
+ let record;
717
+ try {
718
+ record = JSON.parse(line);
719
+ }
720
+ catch {
721
+ continue;
722
+ }
723
+ if ((record?.type !== "assistant" && record?.type !== "user") || record.isSidechain === true
724
+ || (record.sessionId && record.sessionId !== meta.vendor_session_id))
725
+ continue;
726
+ const at = Date.parse(record.timestamp);
727
+ if (!Number.isFinite(at) || at > stop)
728
+ continue;
729
+ // 先にuser行(この番の入力かtool結果)が来たら、この番の最後の答えはまだ書かれていない。前の番の誤りを持ち出さない。
730
+ return record.type === "assistant" ? claudeApiErrorFromLine(line) : null;
731
+ }
732
+ return null;
733
+ }
695
734
  // Stopが発火しないエラー終了を、現在のturn開始後の会話記録だけから判定する。
696
735
  export function claudeApiErrorAfter(meta, startedAtMs) {
697
736
  const file = claudeSessionTranscriptPath(meta);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-mcp",
3
- "version": "0.64.1",
3
+ "version": "0.64.2",
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": [