aiterm-mcp 0.63.8 → 0.63.10

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,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.63.10] - 2026-11-06
11
+
12
+ - 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.
13
+ - 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.
14
+ - 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.
15
+
16
+ ## [0.63.9] - 2026-11-06
17
+
18
+ - 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.
19
+ - Retain the existing idle-hibernation path and typed unavailable refusal for missing vendor IDs, live native sessions, or mismatched settings.
20
+ - Restart-created hibernated records carry an explicit `origin:restart` variant without fabricated old process identities. Older 0.63.8 cannot read this variant; do not downgrade an affected session as a recovery action. Keep its source/state and use 0.63.9 or later.
21
+
10
22
  ## [0.63.8] - 2026-11-06
11
23
 
12
24
  - Add optional local `agent_launch(require_existing_resume:true)` admission under the existing send lock. Missing, invalid or unsupported saved resume targets cannot fall through to fresh creation.
@@ -3041,7 +3053,9 @@ prototype (preserved under `prototype/python/` as the porting source and referen
3041
3053
  `ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
3042
3054
  provenance.
3043
3055
 
3044
- [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.8...HEAD
3056
+ [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.10...HEAD
3057
+ [0.63.10]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.9...v0.63.10
3058
+ [0.63.9]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.8...v0.63.9
3045
3059
  [0.63.8]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.7...v0.63.8
3046
3060
  [0.63.7]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.6...v0.63.7
3047
3061
  [0.63.6]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.5...v0.63.6
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.8** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
218
+ **状態:** 開発継続中 · 現行公開版 **v0.63.10** · 動作対象は 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.63.8** · 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.10** · 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
 
@@ -9,15 +9,21 @@ 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(),
16
16
  started_identity: z.string().min(1), argv_digest: z.string().regex(/^[a-f0-9]{64}$/) }).strict();
17
- export const agentLifecycleSchema = z.object({ schema: z.literal("aiterm.agent-lifecycle.v1"), launch_id: launchId,
18
- state: z.enum(["stopping", "hibernated"]), socket: z.string().min(1).optional(), at: z.iso.datetime(), anchor: z.string().min(1),
19
- native_id: z.string().regex(/^\$\d+$/), pane: identity, resume_proof_digest: z.string().regex(/^[a-f0-9]{64}$/).optional(), recipe_digest: z.string().regex(/^[a-f0-9]{64}$/),
20
- }).strict();
17
+ const lifecycleFields = {
18
+ schema: z.literal("aiterm.agent-lifecycle.v1"), launch_id: launchId,
19
+ socket: z.string().min(1).optional(), at: z.iso.datetime(), anchor: z.string().min(1),
20
+ resume_proof_digest: z.string().regex(/^[a-f0-9]{64}$/).optional(), recipe_digest: z.string().regex(/^[a-f0-9]{64}$/),
21
+ };
22
+ export const agentLifecycleSchema = z.union([
23
+ z.object({ ...lifecycleFields, state: z.enum(["stopping", "hibernated"]),
24
+ native_id: z.string().regex(/^\$\d+$/), pane: identity }).strict(),
25
+ z.object({ ...lifecycleFields, state: z.literal("hibernated"), origin: z.literal("restart") }).strict(),
26
+ ]);
21
27
  const file = (meta, suffix) => agentMetadataPath(meta.aiterm_session, meta.launch_id).replace(/\.agent\.json$/, suffix);
22
28
  const unavailable = () => new AitermError("AGENT_LIFECYCLE_UNCONFIRMED: 席の休止・復帰記録を確認できません。", 2);
23
29
  function read(meta, suffix, schema) {
@@ -155,7 +161,8 @@ export function finishAgentResumeConfiguration(meta, before, model, effort) {
155
161
  const complete = !!model && !!effort;
156
162
  const known = before.state === "confirmed" && (!model || model === before.model || effort !== null);
157
163
  writeAgentResumeTemplate(meta, { ...before, model: model ?? before.model, reasoning_effort: effort ?? before.reasoning_effort,
158
- state: complete || known ? "confirmed" : "unconfirmed" });
164
+ state: complete || known ? "confirmed" : "unconfirmed",
165
+ ...(effort ? { reasoning_effort_source: undefined } : {}) });
159
166
  }
160
167
  export function refreshAgentResumeRecipe(meta) {
161
168
  const template = readAgentResumeTemplate(meta);
@@ -164,11 +171,11 @@ export function refreshAgentResumeRecipe(meta) {
164
171
  return recipe?.model && recipe.reasoning_effort
165
172
  && (meta.kind !== "claude" || Object.hasOwn(recipe.environment, "CLAUDE_CONFIG_DIR")) ? recipe : null;
166
173
  }
167
- 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
168
175
  || template.executable !== meta.agent_executable || template.cwd !== meta.cwd || typeof meta.fast !== "boolean")
169
176
  return null;
170
177
  if (meta.kind === "claude" && (!Object.hasOwn(template.environment, "CLAUDE_CONFIG_DIR")
171
- || !["low", "medium", "high", "xhigh", "max"].includes(template.reasoning_effort)))
178
+ || !["low", "medium", "high", "xhigh", "max"].includes(template.reasoning_effort ?? "")))
172
179
  return null;
173
180
  const { state, ...settings } = template;
174
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,
@@ -6542,6 +6544,52 @@ async function completeFailedCodexResume(meta, readyTimeout) {
6542
6544
  }, complete);
6543
6545
  });
6544
6546
  }
6547
+ /** Prepare only a retained conversation whose native session is confirmed absent. */
6548
+ function prepareWorkingAgentResume(meta) {
6549
+ assertExecutionResumeSupported();
6550
+ const unavailable = () => new AgentResumeUnavailableError(meta.aiterm_session);
6551
+ const absent = () => {
6552
+ const native = observeExecutionNativeSessions();
6553
+ if (native.state !== "known" || native.sessions.some(row => row.session_id === meta.aiterm_session))
6554
+ throw unavailable();
6555
+ };
6556
+ if ((meta.kind !== "claude" && meta.kind !== "codex") || readAgentResumeAttempt(meta))
6557
+ throw unavailable();
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();
6580
+ const recipe = refreshAgentResumeRecipe(meta);
6581
+ if (!recipe)
6582
+ throw unavailable();
6583
+ const proof = meta.kind === "codex" ? captureCodexRecoveryProof(meta) : null;
6584
+ const lifecycle = { schema: "aiterm.agent-lifecycle.v1", state: "hibernated", origin: "restart",
6585
+ launch_id: meta.launch_id, socket: SOCK, at: new Date().toISOString(), anchor: `restart:${meta.launch_id}`,
6586
+ recipe_digest: agentResumeRecipeDigest(recipe), ...(proof ? { resume_proof_digest: codexResumeProofDigest(proof) } : {}) };
6587
+ confirmedAgentResumeRecipe(meta, lifecycle);
6588
+ absent();
6589
+ if (!isDeepStrictEqual(loadAgentMetadata(meta.aiterm_session), meta))
6590
+ throw unavailable();
6591
+ return lifecycle;
6592
+ }
6545
6593
  async function resumeAgentInLock(name, readyTimeout = AGENT_TUI_READY_TIMEOUT_MS) {
6546
6594
  const previous = loadAgentMetadata(name);
6547
6595
  let lifecycle = readAgentLifecycle(previous);
@@ -6613,7 +6661,7 @@ async function resumeAgentInLock(name, readyTimeout = AGENT_TUI_READY_TIMEOUT_MS
6613
6661
  const lineage = { agentRole: "subagent", parentSessionId: previous.parent_session_id,
6614
6662
  delegationDepth: previous.delegation_depth, lineage: previous.lineage, delegationAllowed: true };
6615
6663
  let native = null, published = false;
6616
- return await withNativeSessionCreation(name, receipt => {
6664
+ const resume = () => withNativeSessionCreation(name, receipt => {
6617
6665
  phase = "native_identity";
6618
6666
  const [server, pane] = processStartIdentities([receipt.server_pid, receipt.pane_pid], process.platform);
6619
6667
  if (!next || !server || !pane)
@@ -6709,7 +6757,8 @@ async function resumeAgentInLock(name, readyTimeout = AGENT_TUI_READY_TIMEOUT_MS
6709
6757
  phase = "ready_save";
6710
6758
  writeAgentResumeTemplate(resumed, { schema: "aiterm.agent-resume-template.v1", launch_id: resumed.launch_id, state: "confirmed",
6711
6759
  kind: recipe.kind, executable: recipe.executable, cwd: recipe.cwd, configuration_root: recipe.configuration_root,
6712
- 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 } : {}) });
6713
6762
  writeAgentResumeRecipe(resumed, { ...recipe, launch_id: resumed.launch_id });
6714
6763
  writeAgentResumeAttempt(previous, { ...attempt, state: "ready", at: new Date().toISOString() });
6715
6764
  return resumed;
@@ -6726,6 +6775,9 @@ async function resumeAgentInLock(name, readyTimeout = AGENT_TUI_READY_TIMEOUT_MS
6726
6775
  throw new AgentResumeError("AGENT_RESUME_FAILED", `同じ会話への復帰を確認できません。本文は送信していません。再送せず席の状態を確認してください。${error instanceof ExecutionError ? ` ${error.code}` : ""}`, name, next?.launch_id ?? previous.launch_id);
6727
6776
  }
6728
6777
  });
6778
+ return await (recipe.reasoning_effort_source === "vendor_default"
6779
+ ? keepingCodexDefaults(recipe.executable, recipe.configuration_root, ["model", "model_reasoning_effort"], resume)
6780
+ : resume());
6729
6781
  }
6730
6782
  catch (error) {
6731
6783
  recordFailure(error);
@@ -7722,10 +7774,13 @@ export async function openAgentWithInitialPrompt(kind, opts = {}) {
7722
7774
  const name = opts.session_name, saved = opts.require_existing_resume ? null : tryLoadAgentMetadata(name);
7723
7775
  if (opts.require_existing_resume || (saved && (readAgentLifecycle(saved) || agentDormantState(saved)))) {
7724
7776
  return withAgentSendLock(name, async () => {
7725
- let previous, recipe;
7777
+ let previous, recipe, preparedLifecycle = null;
7726
7778
  try {
7727
7779
  previous = loadAgentMetadata(name);
7728
- const lifecycle = readAgentLifecycle(previous);
7780
+ let lifecycle = readAgentLifecycle(previous);
7781
+ if (opts.require_existing_resume && !lifecycle && kind === previous.kind && !readAgentResumeAttempt(previous)
7782
+ && !failedCodexResumeRecipe(previous))
7783
+ lifecycle = preparedLifecycle = prepareWorkingAgentResume(previous);
7729
7784
  if ((saved && !isDeepStrictEqual(previous, saved)) || (lifecycle?.state !== "hibernated" && !failedCodexResumeRecipe(previous)) || readAgentResumeAttempt(previous))
7730
7785
  throw new AitermError("AGENT_RESUME_UNCONFIRMED: 保存した会話席の再開世代を確認できません。", 2);
7731
7786
  recipe = lifecycle ? confirmedAgentResumeRecipe(previous, lifecycle) : failedCodexResumeRecipe(previous);
@@ -7746,6 +7801,13 @@ export async function openAgentWithInitialPrompt(kind, opts = {}) {
7746
7801
  if (opts.launch_operation_id != null)
7747
7802
  requireMatchingClaudeLaunch(name, validateOperationId(opts.launch_operation_id), claudeLaunchRequestDigest({ sessionName: name, model: opts.model ?? null, effort: opts.reasoning_effort ?? null,
7748
7803
  cwd: opts.cwd ?? null, agentDone: true }));
7804
+ if (preparedLifecycle) {
7805
+ const native = observeExecutionNativeSessions();
7806
+ if (native.state !== "known" || native.sessions.some(row => row.session_id === name)
7807
+ || !isDeepStrictEqual(loadAgentMetadata(name), previous) || readAgentLifecycle(previous))
7808
+ throw new AgentResumeUnavailableError(name);
7809
+ withExecutionPreparation(name, () => writeAgentLifecycle(previous, preparedLifecycle));
7810
+ }
7749
7811
  const resumed = await resumeAgentInLock(name, opts.ready_timeout ?? undefined);
7750
7812
  return withAgentResumeTarget(resumed, async () => {
7751
7813
  const hint = `${agentLabel(kind)} を保存した同じ会話へ再開した。\n${attachHint(name)}`;
@@ -7766,7 +7828,7 @@ export async function openAgentWithInitialPrompt(kind, opts = {}) {
7766
7828
  throw new AgentLaunchPromptError(`session_id: ${name}\n復帰後の初回promptの受理を確認できません。本文を再送しないでください。\n${error instanceof Error ? error.message : String(error)}`, error instanceof AitermError ? error.code : 1, name, current.initial_prompt_delivery ?? { status: "not_sent", reason: "startup_failed", turn_started: false }, current.initial_prompt_cursor ?? null, { status: "blocked", reason: "startup_failed" });
7767
7829
  }
7768
7830
  });
7769
- });
7831
+ }, AGENT_SEND_UNSENT, !opts.require_existing_resume);
7770
7832
  }
7771
7833
  }
7772
7834
  // ファスト(ADR 0114)。設定の誤りは席を作る前に断る。fastへ出来ない訳がアカウントの都合なら、通常で起こして返りへ訳を入れる。
@@ -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)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-mcp",
3
- "version": "0.63.8",
3
+ "version": "0.63.10",
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": [