aiterm-mcp 0.63.2 → 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.
- package/CHANGELOG.md +20 -1
- package/README.ja.md +10 -1
- package/README.md +5 -1
- package/dist/agent-lifecycle.js +54 -3
- package/dist/agent-metadata-reader.js +273 -0
- package/dist/agent-model-ui.js +7 -0
- package/dist/agent-resume-diagnostic.js +72 -0
- package/dist/agent-shared.js +1 -0
- package/dist/core.js +426 -812
- package/dist/harnesses/claude-configure.js +179 -0
- package/dist/harnesses/codex-configure.js +97 -0
- package/dist/harnesses/codex.js +48 -13
- package/dist/harnesses/idle-settings.js +104 -50
- package/dist/index.js +2 -1
- package/dist/parent-delivery-record.js +65 -0
- package/dist/parent-delivery.js +4 -58
- package/dist/process-runtime.js +8 -1
- package/dist/pty-output.js +110 -0
- package/dist/remote-contract.js +21 -0
- package/dist/remote.js +1 -21
- package/dist/resume-checkpoint-files.js +224 -0
- package/dist/resume-checkpoint.js +181 -0
- package/dist/resume-state-cli.js +89 -0
- package/dist/update-cli.js +1 -1
- package/dist/user-config.js +22 -0
- package/docs/00_overview.md +1 -0
- package/package.json +3 -2
|
@@ -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();
|
package/dist/update-cli.js
CHANGED
|
@@ -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" +
|
package/dist/user-config.js
CHANGED
|
@@ -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
|
+
}
|
package/docs/00_overview.md
CHANGED
|
@@ -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aiterm-mcp",
|
|
3
|
-
"version": "0.63.
|
|
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",
|