aiterm-mcp 0.63.1 → 0.63.3

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.
@@ -0,0 +1,181 @@
1
+ // Offline resume records only. No core, path-creating reader, or native operation.
2
+ import { createHash } from 'node:crypto';
3
+ import path from 'node:path';
4
+ import { z } from 'zod';
5
+ import { AGENT_LINEAGE_RE } from './agent-shared.js';
6
+ import { agentResumeRecipeSchema, agentLifecycleSchema, resumeAttemptSchema, resumeNativeSchema, resumeTemplateSchema, resumeResolutionSchema, recoveryOriginSchema, agentResumeRecipeDigest } from './agent-lifecycle.js';
7
+ import { codexResumeProofSchema } from './harnesses/codex.js';
8
+ import { agentResumeFailureSchema } from './agent-resume-diagnostic.js';
9
+ export const RESUME_CHECKPOINT_MAX_BYTES = 16 * 1024 * 1024;
10
+ export const RESUME_CHECKPOINT_FILE_BYTES = 4 * 1024 * 1024;
11
+ const launch = z.string().regex(/^[a-f0-9]{32}$/), digest = z.string().regex(/^[a-f0-9]{64}$/);
12
+ const session = z.string().regex(/^[A-Za-z0-9_-]{1,64}$/);
13
+ const absolute = z.string().refine(p => path.isAbsolute(p) && path.normalize(p) === p && !p.includes('\0'));
14
+ const generation = z.object({ schema: z.literal('aiterm.agent-generation.v1'), launch_id: launch, previous_launch_id: launch.nullable() }).strict();
15
+ const initialDelivery = z.object({ status: z.enum(['not_requested', 'not_sent', 'submitted_unconfirmed', 'started']), reason: z.string(), turn_started: z.boolean().nullable() }).strict();
16
+ const processShape = z.object({ identity: z.string(), parent: z.string().nullable(), argv_digest: digest }).strict();
17
+ // This first scope excludes other harness homes and Windows provenance instead of dropping them.
18
+ const metadata = z.object({ kind: z.literal('codex'), aiterm_session: session, launch_id: launch, event_file: absolute,
19
+ created_at: z.iso.datetime(), cwd: absolute, write_scope: z.string().optional(), vendor_session_id: z.string().uuid(),
20
+ resumed_from: launch.optional(), initial_prompt: z.enum(['none', 'not_sent', 'done']), initial_prompt_delivery: initialDelivery.optional(),
21
+ initial_prompt_cursor: z.number().int().safe().nonnegative().nullable().optional(), agent_executable: absolute,
22
+ launch_operation_id: z.string().nullable().optional(), launch_request_digest: digest.nullable().optional(),
23
+ hook_route: z.literal('shared_codex_home'), completion_route: z.literal('codex_transcript'),
24
+ agent_role: z.literal('subagent'), parent_session_id: session, delegation_depth: z.number().int().safe().positive(),
25
+ lineage: z.string().min(1).max(4096).regex(AGENT_LINEAGE_RE), delegation_allowed: z.literal(true), node_platform: z.literal('linux'),
26
+ codex_home: absolute, fast: z.literal(false), model: z.string().nullable().optional(), startup_processes: z.array(z.string()).optional(),
27
+ startup_process_shapes: z.array(processShape).optional(),
28
+ }).strict();
29
+ export const resumeCheckpointSuffixes = {
30
+ generation: '.active-launch.json', metadata: '.agent.json', recipe: '.resume.json', template: '.resume-template.json',
31
+ lifecycle: '.lifecycle.json', attempt: '.resume-attempt.json', native: '.resume-native.json', proof: '.codex-resume.json',
32
+ resolution: '.resume-resolution.json', recovery_origin: '.resume-recovery-origin.json', failure: '.resume-failure.json',
33
+ };
34
+ const schemas = { generation, metadata, recipe: agentResumeRecipeSchema, template: resumeTemplateSchema, lifecycle: agentLifecycleSchema,
35
+ attempt: resumeAttemptSchema, native: resumeNativeSchema, proof: codexResumeProofSchema, resolution: resumeResolutionSchema,
36
+ recovery_origin: recoveryOriginSchema, failure: agentResumeFailureSchema };
37
+ export const resumeCheckpointSchema = z.object({ schema: z.literal('aiterm.resume-checkpoint.v1'), scope: z.object({
38
+ session_id: session, launch_id: launch, uid: z.number().int().nonnegative(), node_platform: z.literal('linux'), state_base: absolute,
39
+ socket: absolute, configuration_root: absolute, vendor_session_id: z.string().uuid(),
40
+ }).strict(), records: z.array(z.object({ launch_id: launch, kind: z.enum(Object.keys(resumeCheckpointSuffixes)),
41
+ bytes_base64: z.string().max(Math.ceil(RESUME_CHECKPOINT_FILE_BYTES / 3) * 4), sha256: digest }).strict()).min(1).max(512) }).strict();
42
+ export function resumeCheckpointDigest(bytes) { return createHash('sha256').update(bytes).digest('hex'); }
43
+ function refuse() { throw new Error('RESUME_STATE_UNCONFIRMED'); }
44
+ export function resumeCheckpointRecord(launch_id, kind, bytes) {
45
+ if (bytes.length > RESUME_CHECKPOINT_FILE_BYTES)
46
+ refuse();
47
+ return { launch_id, kind, bytes_base64: bytes.toString('base64'), sha256: resumeCheckpointDigest(bytes) };
48
+ }
49
+ export function resumeCheckpointRecordPath(scope, record) {
50
+ session.parse(scope.session_id);
51
+ launch.parse(record.launch_id);
52
+ const stem = record.kind === 'generation' ? scope.session_id : `${scope.session_id}.${record.launch_id}`;
53
+ return path.join(scope.state_base, `aiterm-mcp-${scope.uid}`, 'agents', stem + resumeCheckpointSuffixes[record.kind]);
54
+ }
55
+ /** Validate every trust boundary before any caller writes a destination file. Original record bytes survive unchanged. */
56
+ export function validateResumeCheckpoint(input) {
57
+ const bundle = resumeCheckpointSchema.parse(input), scope = bundle.scope;
58
+ const values = new Map();
59
+ for (const record of bundle.records) {
60
+ const key = `${record.launch_id}/${record.kind}`, bytes = Buffer.from(record.bytes_base64, 'base64');
61
+ if (values.has(key) || bytes.length > RESUME_CHECKPOINT_FILE_BYTES || bytes.toString('base64') !== record.bytes_base64
62
+ || resumeCheckpointDigest(bytes) !== record.sha256)
63
+ refuse();
64
+ const value = schemas[record.kind].parse(JSON.parse(bytes.toString('utf8')));
65
+ if (value.launch_id !== record.launch_id)
66
+ refuse();
67
+ values.set(key, value);
68
+ }
69
+ const get = (id, kind, required = true) => {
70
+ const value = values.get(`${id}/${kind}`);
71
+ if (required && !value)
72
+ refuse();
73
+ return value;
74
+ };
75
+ const pointer = get(scope.launch_id, 'generation');
76
+ const visited = new Set();
77
+ let id = scope.launch_id;
78
+ while (id !== undefined) {
79
+ if (visited.has(id) || visited.size >= 64)
80
+ refuse();
81
+ visited.add(id);
82
+ const m = get(id, 'metadata'), recipe = get(id, 'recipe');
83
+ if (m.initial_prompt_delivery !== undefined && m.initial_prompt_cursor === undefined)
84
+ refuse();
85
+ if (m.aiterm_session !== scope.session_id || m.vendor_session_id !== scope.vendor_session_id || m.codex_home !== scope.configuration_root
86
+ || m.event_file !== resumeCheckpointRecordPath(scope, { launch_id: id, kind: 'metadata' }).replace(/\.agent\.json$/, '.events.jsonl')
87
+ || recipe.kind !== 'codex' || recipe.vendor_session_id !== scope.vendor_session_id || recipe.configuration_root !== scope.configuration_root
88
+ || recipe.fast !== false || recipe.cwd !== m.cwd || recipe.executable !== m.agent_executable || recipe.model !== (m.model ?? null))
89
+ refuse();
90
+ if (Object.keys(recipe.environment).some(key => /(?:TOKEN|KEY|SECRET|PASSWORD|PASSWD|CREDENTIALS?|AUTH)$/i.test(key)))
91
+ refuse();
92
+ const lineage = ['agent_role', 'parent_session_id', 'delegation_depth', 'lineage', 'delegation_allowed'];
93
+ if (lineage.some(k => m[k] !== undefined) && lineage.some(k => m[k] === undefined))
94
+ refuse();
95
+ const life = get(id, 'lifecycle', false), origin = get(id, 'recovery_origin', false), attempt = get(id, 'attempt', false);
96
+ if (life && origin)
97
+ refuse();
98
+ if (life) {
99
+ const proof = get(id, 'proof');
100
+ if (life.state !== 'hibernated' || life.socket !== scope.socket || life.recipe_digest !== agentResumeRecipeDigest(recipe)
101
+ || life.resume_proof_digest !== resumeCheckpointDigest(Buffer.from(JSON.stringify(proof))))
102
+ refuse();
103
+ }
104
+ if (origin) {
105
+ if (origin.socket !== scope.socket || origin.previous_launch_id !== m.resumed_from || origin.recipe_digest !== agentResumeRecipeDigest(recipe)
106
+ || origin.resume_proof_digest !== resumeCheckpointDigest(Buffer.from(JSON.stringify(get(id, 'proof'))))
107
+ || origin.previous_native_digest !== resumeCheckpointDigest(Buffer.from(JSON.stringify(get(id, 'native')))))
108
+ refuse();
109
+ const failed = get(origin.previous_launch_id, 'attempt');
110
+ if (failed.state !== 'failed' || failed.next_launch_id !== id || origin.failed_attempt_digest !== resumeCheckpointDigest(Buffer.from(JSON.stringify(failed))))
111
+ refuse();
112
+ }
113
+ if (attempt && (!life && !origin || attempt.state === 'resuming' || attempt.recipe_digest !== agentResumeRecipeDigest(recipe)))
114
+ refuse();
115
+ const native = get(id, 'native', false);
116
+ if (native && native.session_id !== scope.session_id)
117
+ refuse();
118
+ const proof = get(id, 'proof', false);
119
+ if (proof && (proof.session_id !== scope.vendor_session_id || !proof.file.startsWith(scope.configuration_root + path.sep + 'sessions' + path.sep)))
120
+ refuse();
121
+ const template = get(id, 'template', false);
122
+ if (template && (template.kind !== 'codex' || template.configuration_root !== scope.configuration_root
123
+ || Object.keys(template.environment).some(key => /(?:TOKEN|KEY|SECRET|PASSWORD|PASSWD|CREDENTIALS?|AUTH)$/i.test(key))))
124
+ refuse();
125
+ const failure = get(id, 'failure', false);
126
+ if (failure && failure.session_id !== scope.session_id)
127
+ refuse();
128
+ if (id === scope.launch_id) {
129
+ if (pointer.previous_launch_id !== (m.resumed_from ?? null) || attempt)
130
+ refuse();
131
+ if (!life) {
132
+ if (!m.resumed_from)
133
+ refuse();
134
+ const previous = get(m.resumed_from, 'attempt');
135
+ if (previous.state !== 'failed' || previous.next_launch_id !== id
136
+ || JSON.stringify({ ...get(m.resumed_from, 'recipe'), launch_id: id }) !== JSON.stringify(recipe))
137
+ refuse();
138
+ get(id, 'native');
139
+ }
140
+ }
141
+ if (m.resumed_from) {
142
+ const previous = get(m.resumed_from, 'attempt');
143
+ if (previous.next_launch_id !== id)
144
+ refuse();
145
+ const pm = get(m.resumed_from, 'metadata');
146
+ if (lineage.some(k => pm[k] !== m[k]))
147
+ refuse();
148
+ }
149
+ id = m.resumed_from;
150
+ }
151
+ for (const record of bundle.records) {
152
+ if (!visited.has(record.launch_id) || (record.kind === 'generation' && record.launch_id !== scope.launch_id))
153
+ refuse();
154
+ if (record.kind === 'attempt' && !visited.has(get(record.launch_id, 'attempt').next_launch_id))
155
+ refuse();
156
+ if (record.kind === 'resolution') {
157
+ const r = get(record.launch_id, 'resolution'), m = get(record.launch_id, 'metadata'), old = get(r.previous_launch_id, 'attempt');
158
+ const source = get(r.previous_launch_id, 'lifecycle', false) ?? get(r.previous_launch_id, 'recovery_origin', false);
159
+ if (m.resumed_from !== r.previous_launch_id || old.state !== 'failed' || old.next_launch_id !== r.launch_id || r.vendor_session_id !== scope.vendor_session_id
160
+ || !source || r.recipe_digest !== source.recipe_digest || r.resume_proof_digest !== source.resume_proof_digest
161
+ || r.attempt_digest !== resumeCheckpointDigest(Buffer.from(JSON.stringify(old)))
162
+ || r.native_digest !== resumeCheckpointDigest(Buffer.from(JSON.stringify(get(r.launch_id, 'native')))))
163
+ refuse();
164
+ }
165
+ }
166
+ return bundle;
167
+ }
168
+ export function encodeResumeCheckpoint(input) {
169
+ const bytes = Buffer.from(JSON.stringify(validateResumeCheckpoint(input)) + '\n');
170
+ if (bytes.length > RESUME_CHECKPOINT_MAX_BYTES)
171
+ refuse();
172
+ return bytes;
173
+ }
174
+ export function decodeResumeCheckpoint(bytes) {
175
+ if (bytes.length > RESUME_CHECKPOINT_MAX_BYTES || bytes.length === 0 || bytes[bytes.length - 1] !== 10)
176
+ refuse();
177
+ const bundle = validateResumeCheckpoint(JSON.parse(bytes.toString('utf8')));
178
+ if (!encodeResumeCheckpoint(bundle).equals(bytes))
179
+ refuse();
180
+ return bundle;
181
+ }
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env node
2
+ import { fileURLToPath } from 'node:url';
3
+ import { realpathSync } from 'node:fs';
4
+ import { createOfflineResumeCheckpoint, restoreOfflineResumeCheckpoint } from './resume-checkpoint-files.js';
5
+ import { RESUME_CHECKPOINT_MAX_BYTES, resumeCheckpointDigest } from './resume-checkpoint.js';
6
+ export const RESUME_STATE_ERROR = 'aiterm: RESUME_STATE_UNCONFIRMED\n';
7
+ export function parseResumeStateArgs(args) {
8
+ const [operation, ...rest] = args;
9
+ if (operation !== 'checkpoint' && operation !== 'restore')
10
+ throw Error();
11
+ const fields = {};
12
+ for (let i = 0; i < rest.length; i += 2) {
13
+ const k = rest[i], v = rest[i + 1];
14
+ if (!['--session', '--launch', ...(operation === 'restore' ? ['--sha256'] : [])].includes(k) || v === undefined || fields[k] !== undefined)
15
+ throw Error();
16
+ fields[k] = v;
17
+ }
18
+ if (!/^[A-Za-z0-9_-]{1,64}$/.test(fields['--session'] ?? '') || !/^[a-f0-9]{32}$/.test(fields['--launch'] ?? '')
19
+ || operation === 'restore' && !/^[a-f0-9]{64}$/.test(fields['--sha256'] ?? ''))
20
+ throw Error();
21
+ return { operation, session_id: fields['--session'], launch_id: fields['--launch'], ...(operation === 'restore' ? { sha256: fields['--sha256'] } : {}) };
22
+ }
23
+ async function input() {
24
+ let size = 0;
25
+ const chunks = [];
26
+ for await (const chunk of process.stdin) {
27
+ const b = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
28
+ size += b.length;
29
+ if (size > RESUME_CHECKPOINT_MAX_BYTES)
30
+ throw Error();
31
+ chunks.push(b);
32
+ }
33
+ return Buffer.concat(chunks, size);
34
+ }
35
+ function output(stream, bytes) {
36
+ return new Promise((resolve, reject) => stream.write(bytes, error => error ? reject(error) : resolve()));
37
+ }
38
+ export async function main(args = process.argv.slice(2)) {
39
+ const quiet = () => { };
40
+ process.stdout.on('error', quiet);
41
+ process.stderr.on('error', quiet);
42
+ try {
43
+ const p = parseResumeStateArgs(args);
44
+ let bytes, outcome;
45
+ if (p.operation === 'checkpoint') {
46
+ bytes = createOfflineResumeCheckpoint(p.session_id, p.launch_id);
47
+ outcome = 'saved';
48
+ }
49
+ else {
50
+ bytes = await input();
51
+ const { observeExecutionNativeSessions } = await import('./core.js');
52
+ outcome = restoreOfflineResumeCheckpoint(bytes, { session_id: p.session_id, launch_id: p.launch_id, sha256: p.sha256 }, observeExecutionNativeSessions);
53
+ }
54
+ const receipt = JSON.stringify({ schema: 'aiterm.resume-state-result.v1', operation: p.operation, session_id: p.session_id,
55
+ launch_id: p.launch_id, checkpoint_sha256: resumeCheckpointDigest(bytes), outcome }) + '\n';
56
+ if (Buffer.byteLength(receipt) > 512)
57
+ throw Error();
58
+ if (p.operation === 'checkpoint') {
59
+ await output(process.stdout, bytes);
60
+ await output(process.stderr, receipt);
61
+ }
62
+ else
63
+ await output(process.stdout, receipt);
64
+ return 0;
65
+ }
66
+ catch {
67
+ try {
68
+ await output(process.stderr, RESUME_STATE_ERROR);
69
+ }
70
+ catch { }
71
+ return 2;
72
+ }
73
+ finally {
74
+ process.stdout.removeListener('error', quiet);
75
+ process.stderr.removeListener('error', quiet);
76
+ }
77
+ }
78
+ function invokedDirectly() {
79
+ if (!process.argv[1])
80
+ return false;
81
+ try {
82
+ return realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url));
83
+ }
84
+ catch {
85
+ return false;
86
+ }
87
+ }
88
+ if (invokedDirectly())
89
+ process.exitCode = await main();
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { updateLocal, updateRemote, resolveTargetVersion, VERSION_RE, UpdateError } from "./update.js";
3
- import { remoteTargetSchema } from "./remote.js";
3
+ import { remoteTargetSchema } from "./remote-contract.js";
4
4
  const usage = "使い方: aiterm-update [--version <版|latest>] [--host <ssh接続名>]... [--no-local] [--check] [--json]\n" +
5
5
  "この端末と、指定したSSH接続先のAitermを同じ版へ更新し、各端末でaiterm-setupを実行し直します。\n" +
6
6
  "--hostは~/.ssh/configの接続名かホスト名です。接続先は保存しません。--checkは入れ替えずに現在の版と更新先だけを確かめます。\n" +
@@ -136,3 +136,25 @@ export function restoreJsonSetting(file, before, key) {
136
136
  writeInPlace(file, `${JSON.stringify(edited, null, 2)}\n`);
137
137
  return true;
138
138
  }
139
+ export const USER_DEFAULT_SETTLE_MS = 400;
140
+ const USER_DEFAULT_RESTORE_PASSES = 3;
141
+ export async function restoreUserDefaults(restore) {
142
+ for (let pass = 0; pass < USER_DEFAULT_RESTORE_PASSES; pass++) {
143
+ await sleep(USER_DEFAULT_SETTLE_MS);
144
+ try {
145
+ restore();
146
+ }
147
+ catch { /* 戻せなくても、切り替えの結果は返す */ }
148
+ }
149
+ }
150
+ export async function keepingUserDefaults(configPath, restore, action) {
151
+ return withUserConfigLock(configPath, async () => {
152
+ const before = readFileOrNull(configPath);
153
+ try {
154
+ return await action();
155
+ }
156
+ finally {
157
+ await restoreUserDefaults(() => restore(before));
158
+ }
159
+ });
160
+ }
@@ -5,6 +5,7 @@ dotagentsは任意の工場統合を担うが、Aitermの製品正典や実行
5
5
 
6
6
  ## 現行正典
7
7
 
8
+ - [機能図と実装対応](https://github.com/kitepon/aiterm-mcp/blob/main/docs/architecture/README.md): 全体図、機能別詳細、全sourceの責務・関数索引、リファクタリング候補の検証範囲。
8
9
  - [README](../README.md)/[日本語README](../README.ja.md): 公開API、`aiterm-setup`による依存準備とAI登録、利用、復旧。
9
10
  - [AGENTS](https://github.com/kitepon/aiterm-mcp/blob/main/AGENTS.md): AI作業者向けの製品境界と変更規律。
10
11
  - [DESIGN](DESIGN.md): 現行アーキテクチャと不変条件。
package/docs/DESIGN.md CHANGED
@@ -190,6 +190,8 @@ Codex v1のactive goalは設定替えの間だけ一時停止する。`configure
190
190
 
191
191
  休止判定の部品はagent-idle.ts、木の停止はprocess-tree-stop.tsに置く。前者はruntimeが供給する既存の席admissionで世代/入力/保護条件を再確認し、未確定を成功にしない。後者は本人性を照合したpane木へTERM→5秒→KILLと退出確認を行い、POSIXの別sessionを除外する。OSごとのsignalはprocess-runtime.tsが所有する。本体adapterは既存送信queue/file lockで期待launchと元のnative ID/pane本人性を固定する。最新native完了の保存とprivate resume recipeの一致を確認し、durable stoppingの後も最初のsignal前は保護条件全体を再確認する。効果前だけ準備を取消し、効果後の不明はstoppingに残す。木の退出後に元native IDを閉じ、同世代だけをhibernatedへ進める。時計はper-launchのdetached shell/sleep(WindowsはPowerShell 7)で待ち、起床時だけNodeで同じC判定を行う。owner/tokenを同じ送信排他で記録し、busy等は60秒後の後続確認を持つ。list/launch/Stop/waiterから起動口を通し、元のnative作成proofが無い旧席には時計を登録しない。新規起動templateと設定替えの更新は接続し、既定値欠測や途中設定失敗は休止を許可しない。各世代のmetadataは保持し、active-launch.jsonの原子的切替で現在のlaunchを選ぶ。Codexの停止前には一意な起動marker付きroot/完了境界を検証し、file本人性・prefix hash・旧cursor/turn IDのproofをlifecycleへ束縛する。resumed_fromを持つ読取りは旧metadata/lifecycle/recipe/proofを照合し、保存cursor以前と最後の旧turnの遅れた記録を除外する。通常waiter・番境界・差し込み・合間の言葉と次回停止が同じ相関を使い、復帰後の/newは新markerだけで認める。物理再開候補は同じ送信排他で旧stateを残し、新世代の公式resume→ready/fast確認→本文投入を進める。private resume-attemptの失敗は追加CLIと本文を止め、Claudeの設定rootもper-launchで保持する。通常POSIXのmanaged Claude/Codex初回起動も、実create receiptをその場で取得し、送信/休止と同じfile lockを取ってから旧記録を掃除する。同名置換・休止競合ではCLIを入れず古い記録を残し、自動採番も論理席名を避ける。実create receipt由来のnative IDとserver/paneの開始本人性をprivateに保存し、同じ送信排他でCLI/ready/fast/本文と後続操作を固定する。tmux受信側のnative format条件も同じqueueで確かめ、server再起動によるID再利用を拒否する。既存effect guardを迂回せず、正規resume transitionの無いmounted graphは停止・再開対象外にする。Windowsはqualified paneと固定server認証・native本人性を用いる。既存psmux registry保護を開始本人性取得の前へ置き、server/paneの開始時刻は保存精度を保って一括取得する。Windows closeは元server終了の確認後に記録を片付ける。受信側命令の引用はpsmuxのparserに合わせる。Windowsのnative clockはconsoleを継がないProcessStartInfoとnull標準handleで起こし、一時receiptのPID/開始時刻を保存して起動helperを終了する。同名agent_launchも保存設定を照合して同会話へ戻し、既存の初手/tupleを使う。公開list/observe/seat_turns/closeは論理席を扱い、内部の物理観測と分離する。native読取り/キー/承認は休止・復帰途中・失敗を拒否し、復帰先の実receiptへ固定する。中断は確定休止ならidleで返し、途中や不整合を拒否する。キーと承認応答は送信file lockを共有し、停止ボタンの即時性と既存のキー制限は維持する。登録env名も再現し、復帰中から公開一覧の本人性を保つ。native手動設定とClaude/Codex各3OSの実会話復帰、公開論理席とconsumerを受入済み。元作成証拠を持たない旧席・未受入harnessは対象へ登録しない(ADR 0138)。
192
192
 
193
+ Codexの通常速度の復帰は、保存会話proofのcursor後の新しいtask_startedと固定nativeの生存が揃うbusyも受理する。既存のsteer判定へ戻し、idle待ちのtimeoutで正常なnative番をfailedへ固定しない。利用者の子をstartup baselineへ分類せず、この場合のbaselineと自動休止可否は未知のまま保持する。fast復元はidleで行い、failed attemptは自動解除しない。復帰失敗は型付きaiterm.agent-resume-error.v1で今回本文の未送信と席確認の必要を返し、他の入力やnative起動の結果と混同しない(ADR 0138)。
194
+
193
195
  agent turnは常に非ブロックdispatchであり、receiptの`event_cursor`がturn境界になる。
194
196
  Codex親にはAitermのMCP processが完了を観測し、選択設定に応じて公式Steerまたはqueueへ本文を自動配送する。
195
197
  Claude Code親は公式の非同期hookで本文を受け取り、待機中も新しいturnへ進める。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiterm-mcp",
3
- "version": "0.63.1",
3
+ "version": "0.63.3",
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": [
@@ -47,7 +47,8 @@
47
47
  "aiterm-delivery-wake": "dist/delivery-wake-cli.js",
48
48
  "aiterm-parent-delivery": "dist/parent-delivery-cli.js",
49
49
  "aiterm-update": "dist/update-cli.js",
50
- "aiterm-idle-check": "dist/agent-idle-cli.js"
50
+ "aiterm-idle-check": "dist/agent-idle-cli.js",
51
+ "aiterm-resume-state": "dist/resume-state-cli.js"
51
52
  },
52
53
  "files": [
53
54
  "dist/*.js",