aiterm-mcp 0.42.0 → 0.42.1

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.42.1] - 2026-09-28
11
+
12
+ ### 修正
13
+
14
+ - Claude Codeの利用上限の知らせを、pane logの末尾16KBから探していた。上限が明けても古い知らせがlogに残るため、次のturnの最初の見回りで`wait_process`が`rate_limited`を返し、実際には動いているturnやAPIエラーで終わったturnを取り落としていた。入力欄の下に出る知らせを今の画面から探す。この知らせは次のturnが始まると消える。会話欄や依頼文に残る上限の文は数えない。
15
+
10
16
  ## [0.42.0] - 2026-09-28
11
17
 
12
18
  ### 追加
@@ -1838,7 +1844,8 @@ prototype (preserved under `prototype/python/` as the porting source and referen
1838
1844
  `ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
1839
1845
  provenance.
1840
1846
 
1841
- [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.42.0...HEAD
1847
+ [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.42.1...HEAD
1848
+ [0.42.1]: https://github.com/kitepon/aiterm-mcp/compare/v0.42.0...v0.42.1
1842
1849
  [0.42.0]: https://github.com/kitepon/aiterm-mcp/compare/v0.41.3...v0.42.0
1843
1850
  [0.41.3]: https://github.com/kitepon/aiterm-mcp/compare/v0.41.2...v0.41.3
1844
1851
  [0.41.2]: https://github.com/kitepon/aiterm-mcp/compare/v0.41.1...v0.41.2
package/README.ja.md CHANGED
@@ -203,7 +203,7 @@ runtime-error store は canonical dotagents config の `collection.enabled: true
203
203
  場合だけ収集し、既定OFF、network送信は行いません。tag起点CIのnpm provenance(OIDC Trusted
204
204
  Publishing)で公開し、GitHub Release が Official MCP Registry を再登録します。
205
205
 
206
- **状態:** 開発継続中 · 現行公開版 **v0.42.0** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
206
+ **状態:** 開発継続中 · 現行公開版 **v0.42.1** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
207
207
 
208
208
  ### 更新と巻き戻し
209
209
 
package/README.md CHANGED
@@ -217,7 +217,7 @@ collection is off by default and performs no network I/O. It ships via
217
217
  tag-triggered CI with npm provenance (OIDC Trusted Publishing); the GitHub
218
218
  Release re-registers the Official MCP Registry entry.
219
219
 
220
- **Status:** actively maintained · current public release **v0.42.0** · 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).
220
+ **Status:** actively maintained · current public release **v0.42.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).
221
221
 
222
222
  ### Update and rollback
223
223
 
package/dist/core.js CHANGED
@@ -20,7 +20,7 @@ import { isWin, SOCKDIR, tmuxCommand, sendPsmuxPayload, loadPtyBufferChunk, past
20
20
  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";
21
21
  import { realGrokHome, resolveAndValidateGrokAuth, assertGrokModelAvailable, grokEventsTranscript, latestGrokCompletion, observeGrokDone, buildGrokAgentCmd, grokLaunchNote, grokEnvTokens, grokTuiReady, grokTuiBusy, grokPaneObservation, grokRateLimitDialog, grokStartupAction, grokLaunchBlockingDialog, assertGrokSandboxNotRejected, GROK_COMPOSER_MARKER_RE, grokFooterHasConfiguration, grokTranscriptText, createGrokAgentMetadata, } from "./harnesses/grok.js";
22
22
  import { bindCodexTranscriptSession, latestCodexCompletion, observeCodexDone, buildCodexAgentCmd, codexLaunchNote, codexTuiReady, codexPaneObservation, codexRateLimitModelSwitchDialog, codexApprovalDialog, codexStartupAction, CODEX_COMPOSER_MARKER_RE, codexModelChoice, codexEffortChoice, codexMoreReasoningChoice, codexTranscriptText, createCodexAgentMetadata, } from "./harnesses/codex.js";
23
- import { OPERATION_ID_RE, CLAUDE_RESULT_MAX_BYTES, CLAUDE_EFFORTS, agentManagedClaudeSettingsPath, agentClaudeResultPath, agentClaudeOperationPath, agentClaudeApprovalReceiptPath, agentClaudeDispatchReceiptPath, validateOperationId, readClaudeResultText, assertClaudeAuthenticationReady, buildClaudeAgentCmd, claudeLaunchNote, claudeTuiReady, claudePaneObservation, claudeStartupAction, claudeLoginMethodMenu, CLAUDE_COMPOSER_MARKER_RE, createClaudeAgentMetadata, claudeSessionTranscriptPath, claudeApiErrorFromLine, claudeApiErrorAfter, } from "./harnesses/claude.js";
23
+ import { OPERATION_ID_RE, CLAUDE_RESULT_MAX_BYTES, CLAUDE_EFFORTS, agentManagedClaudeSettingsPath, agentClaudeResultPath, agentClaudeOperationPath, agentClaudeApprovalReceiptPath, agentClaudeDispatchReceiptPath, validateOperationId, readClaudeResultText, assertClaudeAuthenticationReady, buildClaudeAgentCmd, claudeLaunchNote, claudeTuiReady, claudePaneObservation, claudeUsageLimit, claudeStartupAction, claudeLoginMethodMenu, CLAUDE_COMPOSER_MARKER_RE, createClaudeAgentMetadata, claudeSessionTranscriptPath, claudeApiErrorFromLine, claudeApiErrorAfter, } from "./harnesses/claude.js";
24
24
  import { bindCursorTranscriptSession, cursorTurnBoundary, latestCursorCompletion, observeCursorDone, cursorTranscriptText, assertCursorAuthenticationReady, assertCursorModelAvailable, buildCursorAgentCmd, cursorAgentArgv, cursorPwshLaunchLine, cursorPromptWithLineage, createCursorAgentMetadata, cursorLaunchNote, cursorEffortNavigation, cursorTuiReady, cursorPaneObservation, cursorPromptHooksRunning, cursorUsageLimit, CURSOR_SUBMIT_SEQUENCE, CURSOR_COMPOSER_CONTENT_MARKER_RE, validateCursorModelEffort, } from "./harnesses/cursor.js";
25
25
  import { readInterimWords, recordInterimBoundary } from "./interim-words.js";
26
26
  import { resolveAgentBin, resolveThroughlineBin, runThroughlineHandoffContext, isWindowsNativeExecutable, agentBinForPaneShell, resolveWinPaneShell } from "./agent-resolver.js";
@@ -2641,14 +2641,13 @@ export function agentWaitGuide(session) {
2641
2641
  const cmd = `aiterm-wait --session ${session ?? "<session_id>"} --cursor 0`;
2642
2642
  return `完了通知は ${agentWaitLaunchForm(cmd)} で受ける(親はここで待たない・polling 不要)。receipt の outcome=done を確認してから再取得する。`;
2643
2643
  }
2644
- // harness別の利用上限観測。Grokは現在の質問カード、Cursorは現在の画面、他harnessは既存logを使う。
2644
+ // harness別の利用上限観測。Grokは現在の質問カード、CursorとClaudeは現在の画面、Codexは既存logを使う。
2645
2645
  // 出典(2026-08-22): grok は live 実バナーで検証、codex/claude はインストール済み実バイナリの
2646
2646
  // 埋込文字列から抽出(codex: "You've hit your usage limit for" / claude: "Usage limit reached ·
2647
2647
  // continuing automatically when it resets"。Claude Code はリセット時に自動継続する設計なので、
2648
2648
  // この報告は「今は上限で止まっている」の観測であり恒久停止を意味しない)。
2649
2649
  const AGENT_RATE_LIMIT_PATTERNS = {
2650
2650
  codex: [/You'?ve hit your usage limit/i],
2651
- claude: [/Usage limit reached/i],
2652
2651
  };
2653
2652
  const AGENT_RATE_LIMIT_SCAN_BYTES = 16 * 1024;
2654
2653
  // pane log の末尾から上限バナーを探す。読めない・無い・対象 harness でないは全て null(誤検知より取りこぼし側へ倒す)。
@@ -2658,6 +2657,10 @@ export function detectAgentRateLimit(kind, aitermSession) {
2658
2657
  }
2659
2658
  if (kind === "cursor")
2660
2659
  return cursorUsageLimit(captureScreen(aitermSession, 0))?.message ?? null;
2660
+ // Claudeの知らせはpane logに上限が明けた後も残り、次のturnの最初の見回りで誤って拾っていた(2026-09-28)。
2661
+ // 足元の知らせは次のturnで消えるので、今の画面だけを見る。
2662
+ if (kind === "claude")
2663
+ return claudeUsageLimit(captureScreen(aitermSession, 0))?.message ?? null;
2661
2664
  const patterns = AGENT_RATE_LIMIT_PATTERNS[kind];
2662
2665
  if (!patterns)
2663
2666
  return null;
@@ -206,6 +206,30 @@ export function claudePaneObservation(screen) {
206
206
  return { state: "blocked", reason: "startup_dialog" };
207
207
  return { state: "unknown", reason: "unrecognized_screen" };
208
208
  }
209
+ // 利用上限で止まっているClaude Codeは、入力欄の下の枠線と権限表示の間へ知らせを出す(BellTeamコンテナの実画面 2026-09-28)。
210
+ // ❯
211
+ // ────────
212
+ // ⚠ Usage limit reached · continuing automatically at 4:10pm · esc to cancel
213
+ // ⏵⏵ bypass permissions on (shift+tab to cycle)
214
+ // 次のturnが始まると足元は描き直されて知らせは消える。会話欄の「● Usage limit reached」や依頼文の引用は
215
+ // 上限が明けても画面やpane logに残るので、今の状態として数えない。
216
+ export function claudeUsageLimit(screen) {
217
+ const lines = screen.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, "").split("\n");
218
+ let composer = lines.length - 1;
219
+ while (composer >= 0 && !CLAUDE_COMPOSER_MARKER_RE.test(lines[composer]))
220
+ composer--;
221
+ if (composer < 0)
222
+ return null;
223
+ const rule = lines.findIndex((line, i) => i > composer && /^\s*─{8,}\s*$/u.test(line));
224
+ if (rule < 0)
225
+ return null;
226
+ for (const line of lines.slice(rule + 1)) {
227
+ const hit = /^\s*(?:⚠\s*)?(Usage limit reached\b.*?)\s*(?:·\s*esc to cancel\s*)?$/iu.exec(line);
228
+ if (hit)
229
+ return { message: hit[1] };
230
+ }
231
+ return null;
232
+ }
209
233
  // Claude Code 2.1.282 は選択肢へ「1.」などの番号を付ける。番号の有無のどちらも受ける。
210
234
  export function claudeLoginMethodMenu(screen) {
211
235
  const tail = screen.split("\n").slice(-32).join("\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-mcp",
3
- "version": "0.42.0",
3
+ "version": "0.42.1",
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": [