aiterm-mcp 0.63.7 → 0.63.8

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,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.63.8] - 2026-11-06
11
+
12
+ - 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.
13
+ - Return typed resume-unavailable metadata without changing ordinary launch success receipts; capability-aware callers can avoid automatic fresh fallback.
14
+
10
15
  ## [0.63.7] - 2026-11-03
11
16
 
12
17
  - Preserve capacity, usage-limit and transient failure classifications through wait, steer and parent delivery without treating an error as permission to replay input. Claude dispatches retain an input ID and the pre-submit transcript boundary so failures written before the waiter starts are observed. Bound waiters reject another input's completion; legacy outcomes and exit codes are unchanged.
@@ -3036,7 +3041,8 @@ prototype (preserved under `prototype/python/` as the porting source and referen
3036
3041
  `ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
3037
3042
  provenance.
3038
3043
 
3039
- [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.7...HEAD
3044
+ [Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.8...HEAD
3045
+ [0.63.8]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.7...v0.63.8
3040
3046
  [0.63.7]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.6...v0.63.7
3041
3047
  [0.63.6]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.5...v0.63.6
3042
3048
  [0.63.5]: https://github.com/kitepon/aiterm-mcp/compare/v0.63.3...v0.63.5
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.7** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
218
+ **状態:** 開発継続中 · 現行公開版 **v0.63.8** · 動作対象は 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.7** · 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.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).
231
231
 
232
232
  ### Update and rollback
233
233
 
package/dist/core.js CHANGED
@@ -50,7 +50,7 @@ import { paneTokenHint } from "./harnesses/pane-tokens.js";
50
50
  import { unfinishedDeliveriesOwnedBy } from "./parent-delivery-owners.js";
51
51
  import { readLinuxProcessRegistrationIdentity, readRuntimeProcesses, readProcessIdentities, processSubtree, parentProcess, processIdentity, signalRuntimeProcess, backgroundProcesses, lazyRelayProcess, aitermProcessProbe, windowsConsoleHost, macKeepAwakeProcess, processElapsedSeconds } from "./process-runtime.js";
52
52
  import { liveNodeExecutable } from "./live-node.js";
53
- import { AitermError, AgentResumeError, telemetryOwnedFailure, ownTelemetryFailure } from "./errors.js";
53
+ import { AitermError, AgentResumeUnavailableError, AgentResumeError, telemetryOwnedFailure, ownTelemetryFailure } from "./errors.js";
54
54
  import { isWin, SOCKDIR, SOCK, tmuxCommand, readOnlyTmuxList, PtyDiagnosticError, tmuxCommandWithInput, sendPsmuxPayload, loadPtyBufferChunk, pasteBufferBaseArgs, tmuxNewSession, withNativeSessionCreation, withNativeSessionTarget, hasVerifiedNativeSessionTarget, registeredSessionEnvironment, registerSessionEnvironment, attachCommand, normalizePaneCommand, atomicShellMultiline, appendMarkSentinel, paneShellForSubmission, adaptShellSubmission, settlePaneLog, paneCwdArgument, sessionEnvironmentLaunch, paneCommandArgs, } from "./tmux-runtime.js";
55
55
  import { AGENT_DEFAULT_PREFACE, sleep, currentUid, runtimeStateBase, safeStatSize, readFileRange, writeJson0600, createEmpty0600, shq, LAUNCH_ID_RE, AGENT_LINEAGE_RE, AGENT_DONE_POLL_MS, AGENT_RATE_LIMIT_POLL_MS, pollGate, AGENT_EVENT_MAX_BYTES, assertSessionName, agentsDir, readAgentGeneration, selectAgentMetadataFile, publishAgentGeneration, agentMetadataPath, writeAgentMetadata, AGENT_EVENT_TAIL_BYTES, agentLabel, agentHarness, subagentInstruction, } from "./agent-shared.js";
56
56
  import { AuthResponseError, authUi, authPromptDigest, authBindingSchema, authResponseSchema } from "./agent-auth-ui.js";
@@ -7690,6 +7690,9 @@ export async function openAgentWithInitialPrompt(kind, opts = {}) {
7690
7690
  await withExecutionNativeAdmission(opts.session_name, () => assertExecutionContext(opts.session_name));
7691
7691
  else
7692
7692
  assertExecutionContext(opts.session_name);
7693
+ if (opts.require_existing_resume && (!opts.session_name || opts.prompt != null || opts.throughline_source_session != null
7694
+ || opts.throughline_supplement_file != null))
7695
+ throw new AitermError("require_existing_resume requires session_name and no prompt or Throughline fork", 2);
7693
7696
  const mission = opts.prompt ?? null;
7694
7697
  const sourceSessionId = opts.throughline_source_session ?? null;
7695
7698
  const supplementFile = opts.throughline_supplement_file ?? null;
@@ -7716,13 +7719,22 @@ export async function openAgentWithInitialPrompt(kind, opts = {}) {
7716
7719
  }
7717
7720
  if (opts.session_name) {
7718
7721
  assertSessionName(opts.session_name);
7719
- const name = opts.session_name, saved = tryLoadAgentMetadata(name);
7720
- if (saved && (readAgentLifecycle(saved) || agentDormantState(saved))) {
7722
+ const name = opts.session_name, saved = opts.require_existing_resume ? null : tryLoadAgentMetadata(name);
7723
+ if (opts.require_existing_resume || (saved && (readAgentLifecycle(saved) || agentDormantState(saved)))) {
7721
7724
  return withAgentSendLock(name, async () => {
7722
- const previous = loadAgentMetadata(name), lifecycle = readAgentLifecycle(previous);
7723
- if (!isDeepStrictEqual(previous, saved) || (lifecycle?.state !== "hibernated" && !failedCodexResumeRecipe(previous)) || readAgentResumeAttempt(previous))
7724
- throw new AitermError("AGENT_RESUME_UNCONFIRMED: 保存した会話席の再開世代を確認できません。", 2);
7725
- const recipe = lifecycle ? confirmedAgentResumeRecipe(previous, lifecycle) : failedCodexResumeRecipe(previous);
7725
+ let previous, recipe;
7726
+ try {
7727
+ previous = loadAgentMetadata(name);
7728
+ const lifecycle = readAgentLifecycle(previous);
7729
+ if ((saved && !isDeepStrictEqual(previous, saved)) || (lifecycle?.state !== "hibernated" && !failedCodexResumeRecipe(previous)) || readAgentResumeAttempt(previous))
7730
+ throw new AitermError("AGENT_RESUME_UNCONFIRMED: 保存した会話席の再開世代を確認できません。", 2);
7731
+ recipe = lifecycle ? confirmedAgentResumeRecipe(previous, lifecycle) : failedCodexResumeRecipe(previous);
7732
+ }
7733
+ catch (error) {
7734
+ if (opts.require_existing_resume)
7735
+ throw new AgentResumeUnavailableError(name);
7736
+ throw error;
7737
+ }
7726
7738
  if (kind !== previous.kind || sourceSessionId !== null
7727
7739
  || (opts.model != null && opts.model.trim() !== recipe.model)
7728
7740
  || (opts.reasoning_effort != null && opts.reasoning_effort.trim() !== recipe.reasoning_effort)
@@ -7730,7 +7742,7 @@ export async function openAgentWithInitialPrompt(kind, opts = {}) {
7730
7742
  || (opts.cwd != null && path.resolve(opts.cwd) !== recipe.cwd)
7731
7743
  || (opts.write_scope !== undefined && opts.write_scope !== previous.write_scope)
7732
7744
  || (opts.env_vars !== undefined && !isDeepStrictEqual([...new Set(opts.env_vars)].sort(), Object.keys(recipe.environment).sort())))
7733
- throw new AitermError("AGENT_RESUME_CONFLICT: 同名の休止席は保存したharness・設定・project・明示envで再開します。変更は再開後に行ってください。", 2);
7745
+ throw opts.require_existing_resume ? new AgentResumeUnavailableError(name) : new AitermError("AGENT_RESUME_CONFLICT: 同名の休止席は保存したharness・設定・project・明示envで再開します。変更は再開後に行ってください。", 2);
7734
7746
  if (opts.launch_operation_id != null)
7735
7747
  requireMatchingClaudeLaunch(name, validateOperationId(opts.launch_operation_id), claudeLaunchRequestDigest({ sessionName: name, model: opts.model ?? null, effort: opts.reasoning_effort ?? null,
7736
7748
  cwd: opts.cwd ?? null, agentDone: true }));
package/dist/errors.js CHANGED
@@ -19,6 +19,16 @@ export class AgentAuthenticationPreflightError extends AitermError {
19
19
  this.name = "AgentAuthenticationPreflightError";
20
20
  }
21
21
  }
22
+ /** Admission refusal before the requested resume starts. */
23
+ export class AgentResumeUnavailableError extends AitermError {
24
+ resumeUnavailable;
25
+ constructor(sessionId) {
26
+ super("AGENT_RESUME_UNAVAILABLE: 保存した再開対象を確認できません。新規起動も本文送信もしていません。", 2);
27
+ this.resumeUnavailable = { schema: "aiterm.agent-resume-unavailable.v1",
28
+ code: "AGENT_RESUME_UNAVAILABLE", session_id: sessionId,
29
+ outcome: "unavailable", effect: "not_started", input: "not_sent" };
30
+ }
31
+ }
22
32
  /** Resume failures occur before the caller's body reaches the input path. */
23
33
  export class AgentResumeError extends AitermError {
24
34
  resumeFailure;
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { remoteInputDescription, remoteInputSchema } from "./remote-contract.js";
3
3
  import { AuthResponseError, authUiSchema, authBindingSchema, authResponseSchema } from "./agent-auth-ui.js";
4
4
  import { configurationRequestSchema, configurationToolOutputSchema, applyConfigurationRequest, reconcileConfigurationRequest } from "./configure-request.js";
5
- import { AitermError, AgentAuthenticationPreflightError, AgentResumeError } from "./errors.js";
5
+ import { AitermError, AgentAuthenticationPreflightError, AgentResumeUnavailableError, AgentResumeError } from "./errors.js";
6
6
  /**
7
7
  * aiterm-mcp — AI が握るローカル永続端末を stdio MCP サーバとして公開する(Node/TS 版)。
8
8
  *
@@ -180,6 +180,9 @@ export function createAitermServer(options = {}) {
180
180
  }
181
181
  function fail(e) {
182
182
  const msg = e instanceof Error ? e.message : String(e);
183
+ if (e instanceof AgentResumeUnavailableError)
184
+ return { content: [{ type: "text", text: "aiterm: " + msg }], isError: true,
185
+ _meta: { "aiterm/resume_unavailable": { ...e.resumeUnavailable } } };
183
186
  if (e instanceof AgentResumeError)
184
187
  return { content: [{ type: "text", text: "aiterm: " + msg }], isError: true,
185
188
  structuredContent: { ...e.resumeFailure } };
@@ -1146,13 +1149,16 @@ export function createAitermServer(options = {}) {
1146
1149
  }
1147
1150
  async function launchAgent(kind, args, extra) {
1148
1151
  const supportsWriteScope = kind !== "claude";
1149
- const { prompt, image, throughline_source_session, throughline_supplement_file, model, reasoning_effort, fast, env_vars, cwd, session_name, launch_operation_id, write_scope, trust_project } = args;
1152
+ const { prompt, image, throughline_source_session, throughline_supplement_file, model, reasoning_effort, fast, env_vars, cwd, session_name, launch_operation_id, write_scope, trust_project, require_existing_resume } = args;
1150
1153
  let delivery = null;
1151
1154
  try {
1152
1155
  if (!supportsWriteScope && write_scope !== undefined) {
1153
1156
  throw new core.AitermError("claude-code harnessはwrite_scopeに対応していません。指定を外してください", 2);
1154
1157
  }
1155
- await core.maintainAgentIdleClocks();
1158
+ if (require_existing_resume && ((image?.length ?? 0) > 0 || prompt != null || throughline_source_session != null || throughline_supplement_file != null))
1159
+ throw new core.AitermError("require_existing_resume is promptless", 2);
1160
+ if (!require_existing_resume)
1161
+ await core.maintainAgentIdleClocks();
1156
1162
  const initialPrompt = image && image.length > 0 ? core.attachImages(prompt ?? "", image) : prompt ?? undefined;
1157
1163
  if (initialPrompt || throughline_source_session)
1158
1164
  delivery = await deliveryForRequest(extra);
@@ -1169,6 +1175,7 @@ export function createAitermServer(options = {}) {
1169
1175
  before_send: async (boundary) => { inputId = boundary.input_id; await delivery?.before_send(boundary); },
1170
1176
  cwd: cwd ?? undefined,
1171
1177
  session_name: session_name ?? undefined,
1178
+ require_existing_resume,
1172
1179
  launch_operation_id: launch_operation_id ?? undefined,
1173
1180
  ...(supportsWriteScope ? { write_scope } : {}),
1174
1181
  });
@@ -1301,6 +1308,7 @@ export function createAitermServer(options = {}) {
1301
1308
  "remoteを付けると、SSHで入った別端末のAitermで同じ起動を行い、完了は同じ形で親へ届く。" +
1302
1309
  agentEnvironmentDesc + agentCompletionDesc,
1303
1310
  inputSchema: {
1311
+ require_existing_resume: z.boolean().optional().describe("Resume an existing saved conversation only; missing or unsupported target never creates a new session. Requires session_name and no prompt; local-only."),
1304
1312
  harness: z.enum(["claude-code", "codex-cli", "grok-cli", "cursor-cli", "antigravity-cli"]).describe("agent loop・session・hook・transcript・認証を所有する実行基盤"),
1305
1313
  prompt: z.string().nullish().describe("起動時に渡す初手プロンプト(任意)。送信後は待たずに即返る"),
1306
1314
  image: z.array(z.string()).optional().describe("初手プロンプトへ添付する画像ファイルの絶対パス(png/jpg/jpeg/gif/webp)"),
@@ -1339,6 +1347,10 @@ export function createAitermServer(options = {}) {
1339
1347
  write_scope_enforcement: z.enum(["enforced_read_only", "declaration_only_unsupported"]).optional(),
1340
1348
  },
1341
1349
  }, async ({ harness, remote, ...args }, extra) => {
1350
+ if (remote && args.require_existing_resume)
1351
+ return fail(typeof args.session_name === "string" && /^[A-Za-z0-9_-]{1,64}$/.test(args.session_name)
1352
+ ? new AgentResumeUnavailableError(args.session_name)
1353
+ : new AitermError("require_existing_resume requires session_name", 2));
1342
1354
  if (!remote)
1343
1355
  return launchAgent(kindForHarness(harness), args, extra);
1344
1356
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-mcp",
3
- "version": "0.63.7",
3
+ "version": "0.63.8",
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": [