aiterm-mcp 0.63.9 → 0.63.11

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,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.63.11] - 2026-11-06
11
+
12
+ - Let any MCP client opt into existing host-controller routing with the initialize experimental capability `io.github.kitepon/aiterm-mcp/host-controller: {}`. The exact `bellteam` client name remains a backward-compatible alias; undeclared clients retain ordinary direct routing.
13
+ - Use the initialized controller name for interim/follow metadata opt-in, with a generic fallback and the existing `BellTeam` marker retained for compatibility. This is routing identity, not authentication; all generation/source/effect guards and resume-only wire contracts remain unchanged.
14
+
15
+ ## [0.63.10] - 2026-11-06
16
+
17
+ - Resume a killed working Codex conversation whose native metadata has not yet bound its vendor ID, using only its unique launch-marked, cwd-matching, non-fork, complete retained root rollout and same-turn settings.
18
+ - Preserve explicitly recorded vendor-default effort as unspecified, instead of guessing an effort or refusing all default-effort conversations. Retain the model, same-conversation proof, native absence and configuration guards. Mixed, partial or missing evidence remains unavailable.
19
+ - This extends private resume recipe/template records with an optional vendor-default origin. Use 0.63.10 or later for those records; older versions do not support them. Retained configuration reads are bounded to 16 MiB; larger roots remain unavailable.
20
+
10
21
  ## [0.63.9] - 2026-11-06
11
22
 
12
23
  - Let resume-only launch reconnect a saved working Claude/Codex conversation after confirmed native-session loss. Refresh the existing saved configuration, preserve same-conversation proof, and never replay the old input or fall through to fresh launch.
@@ -3047,7 +3058,9 @@ prototype (preserved under `prototype/python/` as the porting source and referen
3047
3058
  `ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
3048
3059
  provenance.
3049
3060
 
3050
- [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.9...HEAD
3061
+ [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.11...HEAD
3062
+ [0.63.11]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.10...v0.63.11
3063
+ [0.63.10]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.9...v0.63.10
3051
3064
  [0.63.9]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.8...v0.63.9
3052
3065
  [0.63.8]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.7...v0.63.8
3053
3066
  [0.63.7]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.6...v0.63.7
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.63.9** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
218
+ **状態:** 開発継続中 · 現行公開版 **v0.63.11** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
219
219
 
220
220
  ### 更新と巻き戻し
221
221
 
@@ -889,3 +889,8 @@ Grok 1.0.70のLinux読取は公式active_sessions.jsonのPID・開始tick・cwd
889
889
  対象はLinux/Codex。明示した永続保存先 `AITERM_STATE_BASE`、同じUIDと絶対パス、元のCodex会話記録の保持が必要。呼出側は保存前に元runtimeの全書込processを停止し、再起動を防ぐ。復元は新runtimeの起動時排他を取得してから、通常の初期化やnative起動より前に行う。保存成功は全process停止の証明にはならない。
890
890
 
891
891
  初回更新で既に失われた旧tmpfsの状態と、未配送の回答は復元しない。通常の初期化後に復元入力を再使用しない。復元した保存先を旧版へそのまま戻さず、互換性のある別の保存先と会話の控えを使うか、利用者が明示して状態を初期化する。詳細は[保存・復元の契約と図](https://github.com/kitepon/aiterm-mcp/blob/v0.63.3/docs/architecture/resume-checkpoint.md)と[更新・巻き戻し条件](CHANGELOG.md)を参照する。
892
+
893
+
894
+ ### Host-controller clients
895
+
896
+ Any MCP client can opt into the existing host-orchestration routing by declaring `capabilities.experimental["io.github.kitepon/aiterm-mcp/host-controller"] = {}` during initialize. This is routing identity, not authentication; source, generation, native identity and effect guards still apply. Clients without that declaration stay on the ordinary direct path. The exact client name `bellteam` remains a backward-compatible alias. A declared controller requests interim/follow metadata with `_meta["aiterm/caller"]` equal to its initialized client name (blank/missing name: `MCP client`); the old `BellTeam` marker is also preserved for compatibility. See [function map and data flow](https://github.com/kitepon/aiterm-mcp/blob/main/docs/architecture/host-controller.md). BellTeam's own caller can adopt the capability later; that migration is separate from this release.
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.63.9** · 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.63.11** · 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
 
@@ -956,3 +956,8 @@ The Linux Grok 1.0.70 inspector binds the native current-session registry to the
956
956
  ### Offline resume checkpoint
957
957
 
958
958
  `aiterm-resume-state checkpoint --session ID --launch LAUNCH` emits a private bundle on stdout and a safe receipt on stderr. `aiterm-resume-state restore --session ID --launch LAUNCH --sha256 SHA` reads that bundle on stdin and emits its receipt on stdout. This Linux/Codex scope requires the explicit persistent `AITERM_STATE_BASE`, the same UID/absolute paths and retained vendor rollout identity. The caller must stop all source writers and prevent restart before checkpoint; restore runs under startup admission before bootstrap or native startup. It does not recover already-lost legacy tmpfs state or migrate pending deliveries. The bundle is limited to 16 MiB including LF; the safe receipt is at most 512 bytes. Success exits 0; refusal exits 2 with `aiterm: RESUME_STATE_UNCONFIRMED` plus LF (33 bytes). See the [contract and diagram](https://github.com/kitepon/aiterm-mcp/blob/v0.63.3/docs/architecture/resume-checkpoint.md).
959
+
960
+
961
+ ### Host-controller clients
962
+
963
+ Any MCP client can opt into the existing host-orchestration routing by declaring `capabilities.experimental["io.github.kitepon/aiterm-mcp/host-controller"] = {}` during initialize. This is routing identity, not authentication; source, generation, native identity and effect guards still apply. Clients without that declaration stay on the ordinary direct path. The exact client name `bellteam` remains a backward-compatible alias. A declared controller requests interim/follow metadata with `_meta["aiterm/caller"]` equal to its initialized client name (blank/missing name: `MCP client`); the old `BellTeam` marker is also preserved for compatibility. See [function map and data flow](https://github.com/kitepon/aiterm-mcp/blob/main/docs/architecture/host-controller.md). BellTeam's own caller can adopt the capability later; that migration is separate from this release.
@@ -1,3 +1,4 @@
1
+ import { isHostControllerClient } from "./host-controller.js";
1
2
  // Goal state belongs to the CLI. This module holds no goal store or loop.
2
3
  import { z } from "zod";
3
4
  import { executionLaunchSchema } from "./execution-contract.js";
@@ -19,10 +20,10 @@ export const agentGoalInputSchema = agentGoalInputObject.superRefine((value, con
19
20
  export const GOAL_HOST_META_KEY = "aiterm/goal";
20
21
  const hostOrigin = z.object({ origin: z.literal("user") }).strict();
21
22
  /** Host provenance on the existing local MCP channel, not authentication.
22
- * BellTeam must authenticate the Owner and reject seat ingress before stamping
23
+ * The controller must authenticate the user and reject seat ingress before stamping
23
24
  * this metadata. A model client's metadata never upgrades its origin. */
24
- export function goalOriginFromHost(clientName, meta) {
25
- if (clientName !== "bellteam" || !meta || typeof meta !== "object")
25
+ export function goalOriginFromHost(clientName, meta, capabilities) {
26
+ if (!isHostControllerClient(clientName, capabilities) || !meta || typeof meta !== "object")
26
27
  return "automatic";
27
28
  return hostOrigin.safeParse(meta[GOAL_HOST_META_KEY]).success ? "user" : "automatic";
28
29
  }
@@ -9,7 +9,7 @@ const absolute = z.string().min(1).refine(value => path.isAbsolute(value) && !va
9
9
  export const agentResumeRecipeSchema = z.object({
10
10
  schema: z.literal("aiterm.agent-resume.v1"), launch_id: launchId,
11
11
  kind: z.enum(["claude", "codex"]), vendor_session_id: z.string().regex(/^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/i),
12
- executable: absolute, cwd: absolute, configuration_root: absolute, model: z.string().nullable(), reasoning_effort: z.string().nullable(), fast: z.boolean(),
12
+ executable: absolute, cwd: absolute, configuration_root: absolute, model: z.string().nullable(), reasoning_effort: z.string().nullable(), reasoning_effort_source: z.literal("vendor_default").optional(), fast: z.boolean(),
13
13
  environment: z.record(z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/), z.string().refine(value => !value.includes("\0")).nullable()),
14
14
  }).strict();
15
15
  const identity = z.object({ pid: z.number().int().positive(), process_group_id: z.number().int().positive().nullable(),
@@ -161,7 +161,8 @@ export function finishAgentResumeConfiguration(meta, before, model, effort) {
161
161
  const complete = !!model && !!effort;
162
162
  const known = before.state === "confirmed" && (!model || model === before.model || effort !== null);
163
163
  writeAgentResumeTemplate(meta, { ...before, model: model ?? before.model, reasoning_effort: effort ?? before.reasoning_effort,
164
- state: complete || known ? "confirmed" : "unconfirmed" });
164
+ state: complete || known ? "confirmed" : "unconfirmed",
165
+ ...(effort ? { reasoning_effort_source: undefined } : {}) });
165
166
  }
166
167
  export function refreshAgentResumeRecipe(meta) {
167
168
  const template = readAgentResumeTemplate(meta);
@@ -170,11 +171,11 @@ export function refreshAgentResumeRecipe(meta) {
170
171
  return recipe?.model && recipe.reasoning_effort
171
172
  && (meta.kind !== "claude" || Object.hasOwn(recipe.environment, "CLAUDE_CONFIG_DIR")) ? recipe : null;
172
173
  }
173
- if (template.state !== "confirmed" || !template.model || !template.reasoning_effort || template.model !== meta.model
174
+ if (template.state !== "confirmed" || !template.model || (!template.reasoning_effort && !(meta.kind === "codex" && template.reasoning_effort === null && template.reasoning_effort_source === "vendor_default")) || template.model !== meta.model
174
175
  || template.executable !== meta.agent_executable || template.cwd !== meta.cwd || typeof meta.fast !== "boolean")
175
176
  return null;
176
177
  if (meta.kind === "claude" && (!Object.hasOwn(template.environment, "CLAUDE_CONFIG_DIR")
177
- || !["low", "medium", "high", "xhigh", "max"].includes(template.reasoning_effort)))
178
+ || !["low", "medium", "high", "xhigh", "max"].includes(template.reasoning_effort ?? "")))
178
179
  return null;
179
180
  const { state, ...settings } = template;
180
181
  const candidate = agentResumeRecipeSchema.safeParse({ ...settings, schema: "aiterm.agent-resume.v1",
package/dist/core.js CHANGED
@@ -61,7 +61,7 @@ import { FastModeError, fastModeFailure } from "./fast-mode.js";
61
61
  import { readFileOrNull, restoreJsonSetting, withUserConfigLock, restoreUserDefaults, keepingUserDefaults, USER_DEFAULT_SETTLE_MS } from "./user-config.js";
62
62
  import { isDeepStrictEqual } from "node:util";
63
63
  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";
64
- import { codexAuthPlan, codexAuthStatus, codexAuthPane, realCodexHome, readCodexConfigPins, bindCodexTranscriptSession, latestCodexCompletion, codexTurnSettled, codexCompletedTurnId, 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";
64
+ 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";
65
65
  import { claudeAuthPlan, claudeAuthStatus, claudeAuthPane, OPERATION_ID_RE, CLAUDE_RESULT_MAX_BYTES, CLAUDE_EFFORTS, agentClaudeOperationPath, agentClaudeApprovalReceiptPath, agentClaudeDispatchReceiptPath, validateOperationId, readClaudeResultText, assertClaudeAuthenticationReady, claudeModelChoices, claudeConfigDir, claudeFastIndicatorShown, claudeFastResult, buildClaudeAgentCmd, claudeAgentArgv, claudeResumeArgv, claudeLaunchNote, claudePaneObservation, CLAUDE_INTERRUPT_KEY, claudeUsageLimit, claudeLiveSelectMenu, claudeStartupAction, createClaudeAgentMetadata, claudeSessionTranscriptPath, claudeApiErrorFromLine, claudeApiErrorAfter, claudeFailureCategory, } from "./harnesses/claude.js";
66
66
  import { cursorAuthPlan, cursorAuthStatus, cursorAuthPane, bindCursorTranscriptSession, cursorTurnBoundary, latestCursorCompletion, 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";
67
67
  import { interimFromNow, readInterimWords, recordInterimBoundary } from "./interim-words.js";
@@ -6340,7 +6340,8 @@ function confirmedAgentResumeRecipe(meta, lifecycle) {
6340
6340
  || recipe.vendor_session_id !== meta.vendor_session_id || lifecycle.recipe_digest !== agentResumeRecipeDigest(recipe)
6341
6341
  || recipe.model !== meta.model || recipe.fast !== meta.fast || recipe.cwd !== meta.cwd || recipe.executable !== meta.agent_executable
6342
6342
  || recipe.configuration_root !== (meta.kind === "codex" ? meta.codex_home : meta.claude_home ?? claudeConfigDir())
6343
- || !recipe.model || !recipe.reasoning_effort || !isUsableAgentExecutableFile(recipe.executable)
6343
+ || !recipe.model || (!recipe.reasoning_effort && !(meta.kind === "codex" && recipe.reasoning_effort === null && recipe.reasoning_effort_source === "vendor_default"))
6344
+ || (recipe.reasoning_effort_source !== undefined && (meta.kind !== "codex" || recipe.reasoning_effort !== null)) || !isUsableAgentExecutableFile(recipe.executable)
6344
6345
  || !fs.statSync(recipe.cwd).isDirectory())
6345
6346
  throw unavailable();
6346
6347
  if (meta.kind === "claude" && !Object.hasOwn(recipe.environment, "CLAUDE_CONFIG_DIR"))
@@ -6510,7 +6511,8 @@ async function completeFailedCodexResume(meta, readyTimeout) {
6510
6511
  // Do not recapture startup processes: this same native may already own children.
6511
6512
  writeAgentResumeTemplate(meta, { schema: "aiterm.agent-resume-template.v1", launch_id: meta.launch_id,
6512
6513
  state: "confirmed", kind: "codex", executable: recipe.executable, cwd: recipe.cwd,
6513
- configuration_root: recipe.configuration_root, model: recipe.model, reasoning_effort: recipe.reasoning_effort, environment: recipe.environment });
6514
+ configuration_root: recipe.configuration_root, model: recipe.model, reasoning_effort: recipe.reasoning_effort, environment: recipe.environment,
6515
+ ...(recipe.reasoning_effort_source ? { reasoning_effort_source: recipe.reasoning_effort_source } : {}) });
6514
6516
  verify();
6515
6517
  writeAgentResumeResolution(meta, { schema: "aiterm.agent-resume-resolution.v1", launch_id: meta.launch_id,
6516
6518
  previous_launch_id: source.launch_id, vendor_session_id: recipe.vendor_session_id,
@@ -6551,9 +6553,30 @@ function prepareWorkingAgentResume(meta) {
6551
6553
  if (native.state !== "known" || native.sessions.some(row => row.session_id === meta.aiterm_session))
6552
6554
  throw unavailable();
6553
6555
  };
6554
- if ((meta.kind !== "claude" && meta.kind !== "codex") || !meta.vendor_session_id || readAgentResumeAttempt(meta))
6556
+ if ((meta.kind !== "claude" && meta.kind !== "codex") || readAgentResumeAttempt(meta))
6555
6557
  throw unavailable();
6556
6558
  absent();
6559
+ const template = readAgentResumeTemplate(meta);
6560
+ if (meta.kind === "codex" && (!meta.vendor_session_id || !template?.model || !template.reasoning_effort)) {
6561
+ const retained = codexWorkingResumeConfiguration(meta);
6562
+ if (!retained || !template || template.state !== "confirmed"
6563
+ || (meta.vendor_session_id && meta.vendor_session_id !== retained.session_id)
6564
+ || (meta.model && meta.model !== retained.model) || (template.model && template.model !== retained.model)
6565
+ || template.reasoning_effort !== retained.effort || template.cwd !== meta.cwd || template.executable !== meta.agent_executable
6566
+ || template.configuration_root !== meta.codex_home)
6567
+ throw unavailable();
6568
+ withExecutionPreparation(meta.aiterm_session, () => {
6569
+ bindCodexTranscriptSession(meta);
6570
+ if (meta.vendor_session_id !== retained.session_id)
6571
+ throw unavailable();
6572
+ meta.model = retained.model;
6573
+ writeAgentMetadata(meta);
6574
+ writeAgentResumeTemplate(meta, { ...template, model: retained.model,
6575
+ ...(retained.effort === null ? { reasoning_effort_source: "vendor_default" } : {}) });
6576
+ });
6577
+ }
6578
+ if (!meta.vendor_session_id)
6579
+ throw unavailable();
6557
6580
  const recipe = refreshAgentResumeRecipe(meta);
6558
6581
  if (!recipe)
6559
6582
  throw unavailable();
@@ -6638,7 +6661,7 @@ async function resumeAgentInLock(name, readyTimeout = AGENT_TUI_READY_TIMEOUT_MS
6638
6661
  const lineage = { agentRole: "subagent", parentSessionId: previous.parent_session_id,
6639
6662
  delegationDepth: previous.delegation_depth, lineage: previous.lineage, delegationAllowed: true };
6640
6663
  let native = null, published = false;
6641
- return await withNativeSessionCreation(name, receipt => {
6664
+ const resume = () => withNativeSessionCreation(name, receipt => {
6642
6665
  phase = "native_identity";
6643
6666
  const [server, pane] = processStartIdentities([receipt.server_pid, receipt.pane_pid], process.platform);
6644
6667
  if (!next || !server || !pane)
@@ -6734,7 +6757,8 @@ async function resumeAgentInLock(name, readyTimeout = AGENT_TUI_READY_TIMEOUT_MS
6734
6757
  phase = "ready_save";
6735
6758
  writeAgentResumeTemplate(resumed, { schema: "aiterm.agent-resume-template.v1", launch_id: resumed.launch_id, state: "confirmed",
6736
6759
  kind: recipe.kind, executable: recipe.executable, cwd: recipe.cwd, configuration_root: recipe.configuration_root,
6737
- model: recipe.model, reasoning_effort: recipe.reasoning_effort, environment: recipe.environment });
6760
+ model: recipe.model, reasoning_effort: recipe.reasoning_effort, environment: recipe.environment,
6761
+ ...(recipe.reasoning_effort_source ? { reasoning_effort_source: recipe.reasoning_effort_source } : {}) });
6738
6762
  writeAgentResumeRecipe(resumed, { ...recipe, launch_id: resumed.launch_id });
6739
6763
  writeAgentResumeAttempt(previous, { ...attempt, state: "ready", at: new Date().toISOString() });
6740
6764
  return resumed;
@@ -6751,6 +6775,9 @@ async function resumeAgentInLock(name, readyTimeout = AGENT_TUI_READY_TIMEOUT_MS
6751
6775
  throw new AgentResumeError("AGENT_RESUME_FAILED", `同じ会話への復帰を確認できません。本文は送信していません。再送せず席の状態を確認してください。${error instanceof ExecutionError ? ` ${error.code}` : ""}`, name, next?.launch_id ?? previous.launch_id);
6752
6776
  }
6753
6777
  });
6778
+ return await (recipe.reasoning_effort_source === "vendor_default"
6779
+ ? keepingCodexDefaults(recipe.executable, recipe.configuration_root, ["model", "model_reasoning_effort"], resume)
6780
+ : resume());
6754
6781
  }
6755
6782
  catch (error) {
6756
6783
  recordFailure(error);
@@ -1,3 +1,4 @@
1
+ import { isHostControllerClient } from "./host-controller.js";
1
2
  // Request-local adapter for the serving stdio dispatcher. No live I/O, core
2
3
  // imports or public mount at import. Uncovered ordinary/native/remote targets
3
4
  // fail before the handler; they must acquire their own generation adapter.
@@ -124,9 +125,9 @@ export function createExecutionDispatcher(bindings) {
124
125
  if (service !== bindings.service)
125
126
  throw new ExecutionError("EXECUTION_UNSUPPORTED");
126
127
  bindings.assertParticipant?.();
127
- return { sourceContext: extra => executionHostSourceFromMeta(extra._meta, bindings.initializedClientName()),
128
+ return { sourceContext: extra => executionHostSourceFromMeta(extra._meta, bindings.initializedClientName(), bindings.initializedClientCapabilities?.()),
128
129
  closeManagementRequest: (extra, session) => {
129
- if (!registeredControls || !native || bindings.initializedClientName() !== "bellteam")
130
+ if (!registeredControls || !native || !isHostControllerClient(bindings.initializedClientName(), bindings.initializedClientCapabilities?.()))
130
131
  throw new ExecutionError("EXECUTION_UNSUPPORTED");
131
132
  return executionRequestSchema.options[4].parse({ kind: "mcp", process_pid: native.pid,
132
133
  process_started_identity: native.started_identity, request_id: extra.requestId,
@@ -148,7 +149,7 @@ export function createExecutionDispatcher(bindings) {
148
149
  throw new ExecutionError("EXECUTION_UNSUPPORTED");
149
150
  // Only the same server's registered typed handlers run here. They
150
151
  // already own metadata admission/stop; no synthetic send edge/frame.
151
- executionHostSourceFromMeta(fixedExtra._meta, bindings.initializedClientName());
152
+ executionHostSourceFromMeta(fixedExtra._meta, bindings.initializedClientName(), bindings.initializedClientCapabilities?.());
152
153
  return await body(args, fixedExtra);
153
154
  }
154
155
  if (name === "agent_auth" && (args.action !== "status" || args.session_id !== undefined) && !observeAuth)
@@ -162,7 +163,9 @@ export function createExecutionDispatcher(bindings) {
162
163
  if (!route)
163
164
  return await body(args, fixedExtra);
164
165
  const client = bindings.initializedClientName();
165
- const host = executionHostSourceFromMeta(fixedExtra._meta, client);
166
+ const capabilities = bindings.initializedClientCapabilities?.();
167
+ const controller = isHostControllerClient(client, capabilities);
168
+ const host = executionHostSourceFromMeta(fixedExtra._meta, client, capabilities);
166
169
  const source = host !== undefined ? host.source : directSource;
167
170
  // Partial/mismatched stdio identity is not an independent operator.
168
171
  if (host === undefined && sourceFieldsPresent && !source)
@@ -171,22 +174,22 @@ export function createExecutionDispatcher(bindings) {
171
174
  const supplied = executionRefFromMeta(fixedExtra._meta);
172
175
  // A host's explicit session close is a management RPC with its own
173
176
  // existing process/request identity, not a delivery or resend.
174
- const hostClose = client === "bellteam" && route.tool === "pty_close" && !supplied;
175
- const hostLaunch = client === "bellteam" && route.tool === "agent_launch" && !supplied
177
+ const hostClose = controller && route.tool === "pty_close" && !supplied;
178
+ const hostLaunch = controller && route.tool === "agent_launch" && !supplied
176
179
  && args.prompt == null && args.throughline_source_session === undefined;
177
- const hostConfigure = client === "bellteam" && route.tool === "agent_configure" && !supplied;
180
+ const hostConfigure = controller && route.tool === "agent_configure" && !supplied;
178
181
  const authOperation = name === "agent_auth";
179
182
  const authInput = (route.tool === "pty_send" || route.tool === "pty_key") && !supplied
180
- && client === "bellteam" ? authGeneration(route.target) : null;
181
- const hostAuth = client === "bellteam" && !supplied && authOperation;
182
- const hostGoal = client === "bellteam" && route.tool === "agent_goal" && !supplied;
183
+ && controller ? authGeneration(route.target) : null;
184
+ const hostAuth = controller && !supplied && authOperation;
185
+ const hostGoal = controller && route.tool === "agent_goal" && !supplied;
183
186
  const hostManagement = hostClose || hostLaunch || hostConfigure || hostGoal || hostAuth || !!authInput;
184
187
  if (args.remote !== undefined && args.remote !== null)
185
188
  throw new ExecutionError("EXECUTION_UNSUPPORTED");
186
189
  let reference = supplied;
187
190
  let directRequest = null;
188
191
  let frozenParent = null;
189
- if (!reference && (client !== "bellteam" || hostManagement) && native) {
192
+ if (!reference && (!controller || hostManagement) && native) {
190
193
  directRequest = executionRequestSchema.options[4].parse({ kind: "mcp", process_pid: native.pid,
191
194
  process_started_identity: native.started_identity, request_id: fixedExtra.requestId,
192
195
  tool: route.tool, target_session_id: route.target });
@@ -207,7 +210,7 @@ export function createExecutionDispatcher(bindings) {
207
210
  // External host refs are created by the real Bridge ingress. Direct
208
211
  // model requests cannot borrow another call's reservation or choose
209
212
  // a native control label to suppress an invocation edge.
210
- if (client !== "bellteam" || reference.request.kind === "mcp"
213
+ if (!controller || reference.request.kind === "mcp"
211
214
  || (route.tool !== "agent_launch" && route.tool !== "pty_send"))
212
215
  throw new ExecutionError("EXECUTION_UNSUPPORTED");
213
216
  const record = await bindings.service.execute({ action: "status", request: reference.request });
@@ -227,7 +230,7 @@ export function createExecutionDispatcher(bindings) {
227
230
  }
228
231
  else {
229
232
  // BellTeam must retain its existing delivery/room/call reference.
230
- if ((client === "bellteam" && !hostManagement) || !directRequest)
233
+ if ((controller && !hostManagement) || !directRequest)
231
234
  throw new ExecutionError("EXECUTION_UNSUPPORTED");
232
235
  const current = await observe(route.target);
233
236
  if (authOperation && route.tool !== "agent_auth.start") {
@@ -32,7 +32,7 @@ export function createNativeDeliveryServer(dependencies = {}) {
32
32
  sendKey: dependencies.sendKey ?? core.interruptSessionNow,
33
33
  };
34
34
  const result = args.pause_goals
35
- ? await interruptKnownSessionsAndGoals(args, { ...stop, pauseGoal: dependencies.pauseGoal ?? core.pauseAgentGoalForStop }, dependencies.goalOrigin ? dependencies.goalOrigin(extra) : goalOriginFromHost(server.server.getClientVersion()?.name, extra._meta))
35
+ ? await interruptKnownSessionsAndGoals(args, { ...stop, pauseGoal: dependencies.pauseGoal ?? core.pauseAgentGoalForStop }, dependencies.goalOrigin ? dependencies.goalOrigin(extra) : goalOriginFromHost(server.server.getClientVersion()?.name, extra._meta, server.server.getClientCapabilities()))
36
36
  : interruptKnownSessions(args, stop);
37
37
  return { content: [{ type: "text", text: JSON.stringify(result) }], structuredContent: result };
38
38
  });
@@ -70,7 +70,8 @@ export function createExecutionParticipant(input) {
70
70
  const server = createAitermServer({ execution: server => {
71
71
  assertScope();
72
72
  dispatcher = createExecutionDispatcher({ service: producer.service, nativeIdentity: actor, sourceEnvironment,
73
- initializedClientName: () => server.server.getClientVersion()?.name, observeSessionGeneration, assertParticipant: assertScope, captureNativeParent,
73
+ initializedClientName: () => server.server.getClientVersion()?.name,
74
+ initializedClientCapabilities: () => server.server.getClientCapabilities(), observeSessionGeneration, assertParticipant: assertScope, captureNativeParent,
74
75
  ...(producer.startup.selectAuthSessionName ? { selectAuthSessionName: producer.startup.selectAuthSessionName } : {}),
75
76
  ...(producer.startup.observeAuthSessionGeneration ? { observeAuthSessionGeneration: producer.startup.observeAuthSessionGeneration } : {}) });
76
77
  return { dispatcher, parentExecution: producer.execution, parentDependencies, parentStateRoot: producer.scope.state_root };
@@ -1,3 +1,4 @@
1
+ import { isHostControllerClient } from "./host-controller.js";
1
2
  // Versioned Bridge/MCP contract. No dependency on core, PTY or the tool server.
2
3
  import { z } from "zod";
3
4
  import { executionLaunchSchema, executionPointSchema, executionRequestSchema, executionReservationSchema, executionRelationSchema, executionPhaseSchema, cascadeStopRequestSchema, cascadeStopResultSchema, executionNativeBindingSchema } from "./execution-contract.js";
@@ -10,12 +11,12 @@ export const executionTransportSourceSchema = z.object({
10
11
  schema: z.literal("aiterm.execution-source.v1"), source: executionPointSchema.nullable(),
11
12
  }).strict();
12
13
  /** Local host correlation, not client authentication. The product mount calls
13
- * this with the initialized client name, never a tool argument. Direct CLI
14
+ * this with initialized client identity/capabilities, never a tool argument. Direct CLI
14
15
  * callers use their fixed stdio environment; they cannot override it here.
15
16
  */
16
- export function executionHostSourceFromMeta(meta, clientName) {
17
+ export function executionHostSourceFromMeta(meta, clientName, capabilities) {
17
18
  const value = meta && typeof meta === "object" ? meta[EXECUTION_SOURCE_META_KEY] : undefined;
18
- if (clientName !== "bellteam") {
19
+ if (!isHostControllerClient(clientName, capabilities)) {
19
20
  if (value !== undefined)
20
21
  throw new ExecutionError("EXECUTION_UNSUPPORTED");
21
22
  return undefined;
@@ -620,6 +620,43 @@ function codexNativeRootRecord(meta, requireBoundary) {
620
620
  return null;
621
621
  }
622
622
  }
623
+ /** Read configuration from the unique launch-bound working root without writing it. */
624
+ export function codexWorkingResumeConfiguration(meta) {
625
+ const root = codexNativeRootRecord(meta, false);
626
+ if (!root || !root.boundary || root.end < 1 || root.end > CODEX_TRANSCRIPT_INCREMENT_MAX_BYTES)
627
+ return null;
628
+ try {
629
+ const before = fs.statSync(root.path), text = fs.readFileSync(root.path, "utf8");
630
+ if (!text.endsWith("\n"))
631
+ return null;
632
+ let settings = null;
633
+ for (const line of text.trimEnd().split("\n")) {
634
+ const record = JSON.parse(line);
635
+ if (record.type === "session_meta" && record.payload?.cwd !== meta.cwd)
636
+ return null;
637
+ if (record.type !== "turn_context" || record.payload?.turn_id !== root.boundary.turn_id)
638
+ continue;
639
+ const context = record.payload, saved = context.collaboration_mode?.settings;
640
+ const effort = saved && Object.hasOwn(saved, "reasoning_effort") ? saved.reasoning_effort
641
+ : Object.hasOwn(context, "effort") ? context.effort : undefined;
642
+ if (context.cwd !== meta.cwd || typeof context.model !== "string" || !context.model
643
+ || (saved?.model != null && saved.model !== context.model)
644
+ || (effort !== null && (typeof effort !== "string" || !["none", "minimal", "low", "medium", "high", "xhigh", "max"].includes(effort)))
645
+ || settings)
646
+ return null;
647
+ settings = { model: context.model, effort };
648
+ }
649
+ const after = fs.statSync(root.path);
650
+ if (!settings || before.dev !== root.file.device || before.ino !== root.file.inode || before.size !== root.end
651
+ || before.dev !== after.dev || before.ino !== after.ino || before.size !== after.size
652
+ || before.mtimeMs !== after.mtimeMs || before.ctimeMs !== after.ctimeMs)
653
+ return null;
654
+ return { session_id: root.session_id, ...settings };
655
+ }
656
+ catch {
657
+ return null;
658
+ }
659
+ }
623
660
  export function codexInterruptionRecord(meta) {
624
661
  const value = codexNativeRootRecord(meta, true);
625
662
  if (!value || !value.boundary || value.event_cursor === null)
@@ -0,0 +1,18 @@
1
+ /** Initialize-time routing declaration, never authentication or native-effect proof. */
2
+ export const HOST_CONTROLLER_CAPABILITY = "io.github.kitepon/aiterm-mcp/host-controller";
3
+ export const LEGACY_HOST_CONTROLLER_NAME = "bellteam";
4
+ export const LEGACY_INTERIM_CALLER = "BellTeam";
5
+ export function isHostControllerClient(name, capabilities) {
6
+ if (name === LEGACY_HOST_CONTROLLER_NAME)
7
+ return true;
8
+ if (!capabilities || typeof capabilities !== "object")
9
+ return false;
10
+ const experimental = capabilities.experimental;
11
+ if (!experimental || typeof experimental !== "object")
12
+ return false;
13
+ const role = experimental[HOST_CONTROLLER_CAPABILITY];
14
+ return role !== null && typeof role === "object" && !Array.isArray(role);
15
+ }
16
+ export function hostControllerLabel(name) {
17
+ return name?.trim() ? name : "MCP client";
18
+ }
package/dist/index.js CHANGED
@@ -475,9 +475,9 @@ export function createAitermServer(options = {}) {
475
475
  delivery = await deliveryForRequest(extra);
476
476
  // BellTeamのため(ADR 0122): 差し込みになった時、その文を取った番の終わりを待つ手がかりを返す。印の無い呼び手には何も足さない。
477
477
  const receipt = await core.sendAgentMessage(session_id, core.attachImages(text, image), { raw, before_send: delivery?.before_send, preface,
478
- follow: interimCallerFromMeta(extra._meta) });
478
+ follow: interimCallerFromMeta(extra._meta, server.server.getClientVersion()?.name, server.server.getClientCapabilities()) });
479
479
  if (receipt.schema === "aiterm.agent-steer.v1") {
480
- const follow = interimCallerFromMeta(extra._meta) ? receipt.follow ?? null : null;
480
+ const follow = interimCallerFromMeta(extra._meta, server.server.getClientVersion()?.name, server.server.getClientCapabilities()) ? receipt.follow ?? null : null;
481
481
  return {
482
482
  content: [
483
483
  {
@@ -748,10 +748,10 @@ export function createAitermServer(options = {}) {
748
748
  return fail(e);
749
749
  }
750
750
  });
751
- // BellTeamのため(ADR 0122): 要求の_metaに aiterm/caller="BellTeam" がある時だけ、結果の_metaへ席の今の番を載せる。
751
+ // Declared controller caller markers opt into current-turn metadata (ADR 0122).
752
752
  // 説明と引数には出さない(steer-follow.ts の冒頭)。それ以外の呼び手には何も足さない。
753
753
  function seatTurnsMeta(sessions, requestMeta) {
754
- if (!interimCallerFromMeta(requestMeta))
754
+ if (!interimCallerFromMeta(requestMeta, server.server.getClientVersion()?.name, server.server.getClientCapabilities()))
755
755
  return {};
756
756
  try {
757
757
  return { _meta: { [SEAT_TURNS_RESULT_META_KEY]: core.readSeatTurns(sessions.filter(session => session.harness !== null).map(session => session.session_id)) } };
@@ -795,10 +795,10 @@ export function createAitermServer(options = {}) {
795
795
  return fail(e);
796
796
  }
797
797
  });
798
- // BellTeamのため: 要求の_metaに aiterm/caller="BellTeam" がある時だけ、結果の_metaへ合間の言葉を載せる。
798
+ // Declared controller caller markers opt into interim words.
799
799
  // 説明と引数には出さない(interim-words.ts の冒頭)。それ以外の呼び手には何も足さない。
800
800
  function interimWordsMeta(sessionId, requestMeta) {
801
- const request = interimRequestFromMeta(requestMeta);
801
+ const request = interimRequestFromMeta(requestMeta, server.server.getClientVersion()?.name, server.server.getClientCapabilities());
802
802
  if (!request)
803
803
  return {};
804
804
  try {
@@ -989,7 +989,7 @@ export function createAitermServer(options = {}) {
989
989
  outputSchema: agentGoalOutputSchema,
990
990
  }, async (args, extra) => {
991
991
  try {
992
- const origin = goalOrigin ? goalOrigin(extra) : goalOriginFromHost(server.server.getClientVersion()?.name, extra._meta);
992
+ const origin = goalOrigin ? goalOrigin(extra) : goalOriginFromHost(server.server.getClientVersion()?.name, extra._meta, server.server.getClientCapabilities());
993
993
  if (origin !== "user" && origin !== "automatic")
994
994
  throw new Error("Invalid trusted goal provenance");
995
995
  const result = agentGoalWireResultSchema.parse(await core.agentGoal(agentGoalInputSchema.parse(args), origin));
@@ -1,9 +1,6 @@
1
- // 合間の言葉: agent sessionがturnの途中で書き、そのあと道具を使った言葉。
2
- // BellTeamのためにある。BellTeamは実行中のBotが何をしているかを会話画面へ出すため、
3
- // pty_observeのMCP要求の_metaに caller="BellTeam" を入れて呼び、結果の_metaでこれを受け取る。
4
- // 利用者向けのツール説明と引数には出さない(BellTeam以外のAIに指定させないため)。要らないものと見て消さないこと。
5
- //
6
- // 最後の回答と思考は含めない。APIエラーやsession limitの知らせは、記録に書かれていれば含める。
1
+ import { isHostControllerClient, hostControllerLabel, LEGACY_INTERIM_CALLER } from "./host-controller.js";
2
+ // Controller-requested interim words; final answers and thinking are excluded.
3
+ // See docs/architecture/host-controller.md for the initialize role and caller marker.
7
4
  // ハーネスごとの見分け方(2026-09-28 記録で確認):
8
5
  // Claude Code: text block で message.stop_reason="tool_use"。isApiErrorMessage の行は知らせ。
9
6
  // Codex: assistant message の phase="commentary"。task_complete の error はturnを終えた知らせ。
@@ -17,9 +14,8 @@ import { claudeSessionTranscriptPath } from "./harnesses/claude.js";
17
14
  import { codexBoundTranscript, codexRootTranscript, codexResumeCursor, codexResumeTurnId, codexTurnError, codexTurnErrorLine } from "./harnesses/codex.js";
18
15
  import { grokSessionDirectory } from "./harnesses/grok.js";
19
16
  import { cursorTranscript } from "./harnesses/cursor.js";
20
- /** BellTeamが要求の_metaへ入れる呼び手の印。値が "BellTeam" の時だけ合間の言葉を返す。 */
17
+ /** Controller caller label in request metadata; see host-controller.md. */
21
18
  export const INTERIM_CALLER_META_KEY = "aiterm/caller";
22
- export const INTERIM_CALLER = "BellTeam";
23
19
  /** 前回受け取った最後のseq。これより後の言葉だけを返す。 */
24
20
  export const INTERIM_AFTER_META_KEY = "aiterm/interim_after";
25
21
  /** 結果の_metaで返すキー。 */
@@ -46,17 +42,20 @@ export function agentInterimBoundaryPath(name, launchId) {
46
42
  throw new AitermError(`launch_id が不正です: ${launchId}`, 2);
47
43
  return path.join(agentsDir(), `${name}.${launchId}.interim.json`);
48
44
  }
49
- /** 要求の_metaがBellTeamの印を持つか。 */
50
- export function interimCallerFromMeta(meta) {
51
- return !!meta && typeof meta === "object" && meta[INTERIM_CALLER_META_KEY] === INTERIM_CALLER;
45
+ /** Controller name marker, with the historical marker retained for compatibility. */
46
+ export function interimCallerFromMeta(meta, clientName, capabilities) {
47
+ if (!meta || typeof meta !== "object")
48
+ return false;
49
+ const caller = meta[INTERIM_CALLER_META_KEY];
50
+ return caller === LEGACY_INTERIM_CALLER || (isHostControllerClient(clientName, capabilities) && caller === hostControllerLabel(clientName));
52
51
  }
53
52
  /**
54
- * 要求の_metaがBellTeamの印を持つ時だけ、前回のseqを返す。それ以外はnull(何も足さない)。
53
+ * 要求の_metaがcontrollerの印を持つ時だけ、前回のseqを返す。それ以外はnull(何も足さない)。
55
54
  * 読み始める位置(aiterm/interim_from)が付いていれば、fromに入れる。付いているのに読めない時はfromがnullでfrom_invalidがtrue
56
55
  * (最後のdispatchの言葉を黙って返すと、呼び手は別の番の言葉を出してしまう)。
57
56
  */
58
- export function interimRequestFromMeta(meta) {
59
- if (!interimCallerFromMeta(meta))
57
+ export function interimRequestFromMeta(meta, clientName, capabilities) {
58
+ if (!interimCallerFromMeta(meta, clientName, capabilities))
60
59
  return null;
61
60
  const record = meta;
62
61
  const raw = record[INTERIM_AFTER_META_KEY];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-mcp",
3
- "version": "0.63.9",
3
+ "version": "0.63.11",
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": [