aiterm-mcp 0.70.35 → 0.70.37
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 +14 -1
- package/README.ja.md +1 -1
- package/README.md +1 -1
- package/dist/agent-goal-native-result.js +3 -1
- package/dist/core.js +53 -10
- package/dist/errors.js +6 -0
- package/dist/harnesses/claude.js +2 -1
- package/dist/harnesses/grok-goal.js +10 -4
- package/dist/index.js +1 -1
- package/dist/terminal-launch-error.js +3 -2
- package/package.json +1 -1
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.70.37] - 2026-11-12
|
|
11
|
+
|
|
12
|
+
- `agent_goal` `inspect` on a Grok seat no longer types into the seat. It used to paste `/goal status` (or click the Goal header and press `g`) under the send lock. It now reads the session's saved `goal/state.json`: no file is no goal, otherwise `goal = {kind: "grok-cli", native}` without `current_status`. No send lock, no composer or TTY dependence. With this, no harness types on `inspect` (Claude 0.70.34; Codex reads its App Server; Cursor and Antigravity are unsupported before any connection).
|
|
13
|
+
- `native.status` of a Grok goal is an open string, and keys Grok adds later are dropped from `native`. Grok 1.0.77 writes `budget_limited` and the keys `plan_file` / `plan_baseline_file` once a goal plan exists; the strict schema rejected both, so `inspect` on such a goal was unavailable. Measured on an isolated 1.0.77 seat: the saved status changes within about 1 s of each change; `elapsed_ms` and `tokens_used_high_water` are written only about every 30 s while a goal runs; `phase` may be stale.
|
|
14
|
+
- `capabilities.clear` on a Grok `inspect` is now `native.status === "user_paused"` (a candidate). The `clear` action itself still requires the fresh `/goal status` (UserPaused, Idle) and an empty composer, under the send lock, and its result carries `current_status` from that fresh read.
|
|
15
|
+
|
|
16
|
+
## [0.70.36] - 2026-11-12
|
|
17
|
+
|
|
18
|
+
- A fresh `agent_launch` whose seat is not ready before any prompt byte no longer leaves that seat behind. When the startup check ends blocked (a first-run or onboarding screen such as Claude's "Security notes", an unknown dialog, a dialog Aiterm does not answer, a harness that exited), the launch closes the seat it created and refuses with `AGENT_STARTUP_BLOCKED: … reason=<observation reason>` and `_meta["aiterm/launch_error"]` `{code: "AGENT_STARTUP_BLOCKED", phase: "input", effect: "not_started", session_created: false, action}`. `action` says what the account holder does (for Claude's first run: start `claude` once on that computer and finish its steps). This covers the `trust_project` launch without a prompt and every launch with a prompt, on all five harnesses. If the close itself fails, the previous refusal that leaves the seat is returned. A resume and a launch without a prompt, `trust_project` or fast (startup `not_checked`) are unchanged.
|
|
19
|
+
- Claude's Bypass Permissions warning (2.1.322 draws "No, exit" / "Yes, I accept" without numbers) is no longer read as an idle composer when "Yes, I accept" is selected. That misread could report a launch `startup.ready` on the warning screen, and the prompt was never typed (Centi, BellTeam lab 2026-11-12).
|
|
20
|
+
|
|
10
21
|
## [0.70.35] - 2026-11-12
|
|
11
22
|
|
|
12
23
|
- Writes that one Aiterm process forwards to the same terminal seat now leave it one at a time: `pty_send`, `agent_configure` and `agent_goal` other than `inspect`, keyed by terminal and session. The next one starts when the previous forward has returned, success or failure. A local seat already had this inside one process (`withAgentSendLock`); a terminal seat did not, because each forward runs its own `aiterm-mcp` on the terminal. Reads are not queued, other seats are not queued, and a `pty_send` holds the order only for its forward, not for the steer `wait_process` relay that may follow. Two Aiterm processes forwarding to one seat are still not ordered by Aiterm (0.63.12).
|
|
@@ -3353,7 +3364,9 @@ prototype (preserved under `prototype/python/` as the porting source and referen
|
|
|
3353
3364
|
`ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
|
|
3354
3365
|
provenance.
|
|
3355
3366
|
|
|
3356
|
-
[Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.
|
|
3367
|
+
[Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.37...HEAD
|
|
3368
|
+
[0.70.37]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.36...v0.70.37
|
|
3369
|
+
[0.70.36]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.35...v0.70.36
|
|
3357
3370
|
[0.70.35]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.34...v0.70.35
|
|
3358
3371
|
[0.70.34]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.33...v0.70.34
|
|
3359
3372
|
[0.70.33]: https://github.com/kitepon/aiterm-mcp/compare/v0.70.32...v0.70.33
|
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.70.
|
|
218
|
+
**状態:** 開発継続中 · 現行公開版 **v0.70.37** · 動作対象は 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.70.
|
|
230
|
+
**Status:** actively maintained · current public release **v0.70.37** · 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
|
|
|
@@ -48,7 +48,9 @@ export async function manageGrokAgentGoal(input, runtime, origin = "automatic")
|
|
|
48
48
|
if (!sameGoalTarget(runtime.resolve(), target))
|
|
49
49
|
return { ...result, reason: 'generation_replaced_after_status', readback: 'failed' };
|
|
50
50
|
const clearStatus = observed.current?.current_status;
|
|
51
|
-
|
|
51
|
+
// inspect reads the saved state only, so clear there is a candidate; the clear action itself requires the fresh UI status.
|
|
52
|
+
const freshPaused = clearStatus?.source === '/goal status' && clearStatus.status === 'UserPaused' && clearStatus.phase === 'Idle' && runtime.canClear?.(target) === true;
|
|
53
|
+
const ready = !!runtime.clear && observed.current?.native.status === 'user_paused' && (input.action === 'inspect' || freshPaused);
|
|
52
54
|
Object.assign(result, { binding: { session_id: target.session_id, launch_id: target.launch_id, thread_id: target.vendor_session_id }, availability: 'available', capabilities: { ...result.capabilities, inspect: true, clear: ready }, goal: observed.current, outcome: 'observed', readback: 'confirmed', reason: 'native_goal_observed' });
|
|
53
55
|
if (input.action === 'inspect')
|
|
54
56
|
return agentGoalNativeResultSchema.parse(result);
|
package/dist/core.js
CHANGED
|
@@ -30,7 +30,7 @@ import { assertCallerEnv } from "./harnesses/caller-mcp.js";
|
|
|
30
30
|
import { fileURLToPath } from "node:url";
|
|
31
31
|
import * as rtk from "./rtk.js";
|
|
32
32
|
import { manageClaudeAgentGoal, manageGrokAgentGoal } from "./agent-goal-native-result.js";
|
|
33
|
-
import { grokCurrentSessionOwner, readFreshGrokGoal, clearGrokGoal, grokGoalClearReady } from './harnesses/grok-goal.js';
|
|
33
|
+
import { grokCurrentSessionOwner, readFreshGrokGoal, readSavedGrokGoal, clearGrokGoal, grokGoalClearReady } from './harnesses/grok-goal.js';
|
|
34
34
|
import { nativeGoalClickBytes } from './agent-goal-ui.js';
|
|
35
35
|
import { observeClaudeGoalRows, clearClaudeGoal, setClaudeGoalObjective, claudeCurrentSessionOwner } from "./harnesses/claude-goal.js";
|
|
36
36
|
import { AgentGoalNotIssuedError, manageAgentGoal } from "./agent-goal.js";
|
|
@@ -55,7 +55,7 @@ import { readLinuxProcessRegistrationIdentity, readClaudeRegistrationIdentity, r
|
|
|
55
55
|
import { liveNodeExecutable } from "./live-node.js";
|
|
56
56
|
import { resolveClaudeConfigurationRoot, withClaudeConfigRoot, withClaudeSlotLogin } from "./claude-config-root.js";
|
|
57
57
|
import { probeWriteBan, writeBanPrefix, windowsWriteBanArgv } from "./write-ban.js";
|
|
58
|
-
import { AitermError, launchAuthRequired, launchInputRefusal, AgentResumeUnavailableError, AgentResumeError, telemetryOwnedFailure, ownTelemetryFailure } from "./errors.js";
|
|
58
|
+
import { AitermError, launchAuthRequired, launchInputRefusal, launchStartupBlocked, AgentResumeUnavailableError, AgentResumeError, telemetryOwnedFailure, ownTelemetryFailure } from "./errors.js";
|
|
59
59
|
import { isWin, SOCKDIR, SOCK, tmuxCommand, readOnlyTmuxList, PtyDiagnosticError, tmuxCommandWithInput, sendPsmuxPayload, loadPtyBufferChunk, pasteBufferBaseArgs, tmuxNewSession, withNativeSessionCreation, withNativeSessionTarget, hasVerifiedNativeSessionTarget, withNativeSessionSetupRollback, hasNativeSessionSetupRollback, registeredSessionEnvironment, registerSessionEnvironment, attachCommand, normalizePaneCommand, atomicShellMultiline, appendMarkSentinel, paneShellForSubmission, adaptShellSubmission, settlePaneLog, paneCwdArgument, sessionEnvironmentLaunch, paneCommandArgs, rememberPaneShell, } from "./tmux-runtime.js";
|
|
60
60
|
import { AGENT_DEFAULT_PREFACE, sleep, currentUid, runtimeStateBase, safeStatSize, readFileRange, writeJson0600, writeText0600, 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, } from "./agent-shared.js";
|
|
61
61
|
import { AuthResponseError, authUi, authPromptDigest, authBindingSchema, authResponseSchema } from "./agent-auth-ui.js";
|
|
@@ -4724,12 +4724,24 @@ async function sendAgentPromptText(name, text, kind, inputMeta) {
|
|
|
4724
4724
|
// 利用者が端末で済ませるしかない起動前の状態。reasonだけでは直し方が分からないので案内を添える。
|
|
4725
4725
|
function startupBlockedHint(reason) {
|
|
4726
4726
|
if (reason === "vendor_onboarding_required") {
|
|
4727
|
-
return "\nClaude Code
|
|
4727
|
+
return "\nClaude Codeの初回案内(テーマ・ログイン方法の選択・セキュリティの注意)か、利用規約の更新への回答が済んでいません。`claude auth status` がログイン済みでも、" +
|
|
4728
4728
|
"済むまでは起動のたびにこの画面で止まります。規約への回答はアカウントの持ち主が選ぶもので、Aitermは答えません。" +
|
|
4729
4729
|
"対象端末で一度 `claude` を起動し、画面の案内を最後まで進めてください。";
|
|
4730
4730
|
}
|
|
4731
4731
|
return "";
|
|
4732
4732
|
}
|
|
4733
|
+
/** A fresh launch blocked before any prompt byte closes the seat it created and refuses (launch-identity-input.md).
|
|
4734
|
+
* If the close fails, null: the caller keeps its refusal that leaves the seat. */
|
|
4735
|
+
function startupBlockedRefusal(name, kind, reason) {
|
|
4736
|
+
try {
|
|
4737
|
+
closeSessionInternal(name, true);
|
|
4738
|
+
}
|
|
4739
|
+
catch {
|
|
4740
|
+
return null;
|
|
4741
|
+
}
|
|
4742
|
+
return launchStartupBlocked(agentHarness(kind), reason, startupBlockedHint(reason).trim()
|
|
4743
|
+
|| `起動の途中の画面(${reason})で止まりました。端末でそのAIを一度起動して画面を進めてから、起こし直してください。`);
|
|
4744
|
+
}
|
|
4733
4745
|
function setInitialDelivery(meta, value, cursor) {
|
|
4734
4746
|
meta.initial_prompt_delivery = value;
|
|
4735
4747
|
meta.initial_prompt_cursor = cursor;
|
|
@@ -4821,9 +4833,9 @@ async function sendInitialAgentPromptInLock(name, text, o) {
|
|
|
4821
4833
|
const startup = await prepareAgentInput(name, meta, o);
|
|
4822
4834
|
if (startup.status !== "ready") {
|
|
4823
4835
|
setInitialDelivery(meta, { status: "not_sent", reason: startup.reason, turn_started: false }, null);
|
|
4824
|
-
throw new AitermError(`initial_prompt=not_sent vendor=${meta.kind} ready=false harness=${agentHarness(meta.kind)}\n` +
|
|
4836
|
+
throw Object.assign(new AitermError(`initial_prompt=not_sent vendor=${meta.kind} ready=false harness=${agentHarness(meta.kind)}\n` +
|
|
4825
4837
|
`agent session '${name}' の起動準備が完了していないため、promptは送信していません。reason=${startup.reason}` +
|
|
4826
|
-
startupBlockedHint(startup.reason), 2);
|
|
4838
|
+
startupBlockedHint(startup.reason), 2), { startupBlocked: startup.reason });
|
|
4827
4839
|
}
|
|
4828
4840
|
await o.after_ready?.(name, meta);
|
|
4829
4841
|
const promptText = meta.kind === "cursor" ? cursorPromptWithLineage(meta, text) : meta.kind === "antigravity" ? antigravityPromptWithCaller(meta, text) : text;
|
|
@@ -6181,6 +6193,27 @@ async function agentGoalInContext(input, origin, expectedGoal, sendHeld = false)
|
|
|
6181
6193
|
pause: sleep,
|
|
6182
6194
|
};
|
|
6183
6195
|
};
|
|
6196
|
+
const grokSavedState = (target) => {
|
|
6197
|
+
const meta = tryLoadAgentMetadata(input.session_id);
|
|
6198
|
+
if (!meta || meta.launch_id !== target.launch_id || meta.vendor_session_id !== target.vendor_session_id)
|
|
6199
|
+
throw Error('generation_replaced');
|
|
6200
|
+
const directory = grokSessionDirectory(meta);
|
|
6201
|
+
if (!directory)
|
|
6202
|
+
throw Error('native session directory unavailable');
|
|
6203
|
+
const file = path.join(directory, 'goal/state.json');
|
|
6204
|
+
let st;
|
|
6205
|
+
try {
|
|
6206
|
+
st = fs.lstatSync(file);
|
|
6207
|
+
}
|
|
6208
|
+
catch (error) {
|
|
6209
|
+
if (error.code === 'ENOENT')
|
|
6210
|
+
return null;
|
|
6211
|
+
throw error;
|
|
6212
|
+
}
|
|
6213
|
+
if (!st.isFile() || st.isSymbolicLink() || st.size > 4 * 1024 * 1024)
|
|
6214
|
+
throw Error('native state unavailable');
|
|
6215
|
+
return JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
6216
|
+
};
|
|
6184
6217
|
const grokPort = (target) => {
|
|
6185
6218
|
const ui = goalUi(target);
|
|
6186
6219
|
const read = (relative, optional = false) => {
|
|
@@ -6210,12 +6243,15 @@ async function agentGoalInContext(input, origin, expectedGoal, sendHeld = false)
|
|
|
6210
6243
|
const harness = resolve()?.harness;
|
|
6211
6244
|
if (sendHeld && harness !== "codex-cli")
|
|
6212
6245
|
throw new ExecutionError("EXECUTION_STALE_GENERATION");
|
|
6213
|
-
if (harness === 'grok-cli')
|
|
6214
|
-
|
|
6215
|
-
|
|
6246
|
+
if (harness === 'grok-cli') {
|
|
6247
|
+
// inspect reads the saved goal/state.json: no typing, no send lock. clear keeps the fresh UI status under the lock.
|
|
6248
|
+
const run = () => manageGrokAgentGoal(input, { resolve,
|
|
6249
|
+
read: async (target) => input.action === 'inspect' ? readSavedGrokGoal(grokSavedState(target)) : readFreshGrokGoal(target.vendor_session_id, grokPort(target)),
|
|
6216
6250
|
canClear: target => grokGoalClearReady(grokPort(target).ui),
|
|
6217
6251
|
clear: (target, before) => clearGrokGoal(target.vendor_session_id, before, grokPort(target)),
|
|
6218
|
-
}, origin)
|
|
6252
|
+
}, origin);
|
|
6253
|
+
return input.action === 'inspect' ? run() : withAgentSendLock(input.session_id, run);
|
|
6254
|
+
}
|
|
6219
6255
|
if (harness === "claude-code") {
|
|
6220
6256
|
// Reading is the session transcript only: it writes nothing to the seat, so it needs no send lock,
|
|
6221
6257
|
// composer, turn state, TTY owner or version check. Only a mutation types into the composer.
|
|
@@ -8535,7 +8571,7 @@ export async function openAgentWithInitialPrompt(kind, opts = {}) {
|
|
|
8535
8571
|
throw new AgentLaunchPromptError(`session_id: ${sid}\n起動準備中に失敗しました。${error instanceof Error ? error.message : String(error)}`, error instanceof AitermError ? error.code : 1, sid, delivery, null, { status: "blocked", reason: "startup_failed" });
|
|
8536
8572
|
}
|
|
8537
8573
|
if (startup.status !== "ready")
|
|
8538
|
-
throw new AgentLaunchPromptError(`session_id: ${sid}\n起動準備を完了できませんでした。reason=${startup.reason}${startupBlockedHint(startup.reason)}`, 2, sid, delivery, null, startup);
|
|
8574
|
+
throw startupBlockedRefusal(sid, kind, startup.reason) ?? new AgentLaunchPromptError(`session_id: ${sid}\n起動準備を完了できませんでした。reason=${startup.reason}${startupBlockedHint(startup.reason)}`, 2, sid, delivery, null, startup);
|
|
8539
8575
|
await switchAfterReady(sid, loadAgentMetadata(sid));
|
|
8540
8576
|
}
|
|
8541
8577
|
return [sid, hint, null, null, delivery, startup, fastResult];
|
|
@@ -8555,6 +8591,13 @@ export async function openAgentWithInitialPrompt(kind, opts = {}) {
|
|
|
8555
8591
|
const code = e instanceof AitermError ? e.code : 1;
|
|
8556
8592
|
const message = e instanceof Error ? e.message : String(e);
|
|
8557
8593
|
const meta = loadAgentMetadata(sid);
|
|
8594
|
+
// Blocked before any prompt byte: nothing of the caller's reached the seat, so the seat is closed and the launch refused.
|
|
8595
|
+
const blocked = e.startupBlocked;
|
|
8596
|
+
if (blocked && meta.initial_prompt_delivery?.status === "not_sent") {
|
|
8597
|
+
const refusal = startupBlockedRefusal(sid, kind, blocked);
|
|
8598
|
+
if (refusal)
|
|
8599
|
+
throw refusal;
|
|
8600
|
+
}
|
|
8558
8601
|
throw new AgentLaunchPromptError(`session_id: ${sid}\n` +
|
|
8559
8602
|
`起動後の初回 prompt 処理で失敗しました。session は調査/復旧用に残しています。\n${message}`, code, sid, meta.initial_prompt_delivery ?? { status: "not_sent", reason: "startup_failed", turn_started: false }, meta.initial_prompt_cursor ?? null, { status: meta.initial_prompt_delivery?.status === "submitted_unconfirmed" ? "ready" : "blocked",
|
|
8560
8603
|
reason: meta.initial_prompt_delivery?.reason ?? "startup_failed" });
|
package/dist/errors.js
CHANGED
|
@@ -21,6 +21,12 @@ export function launchInputRefusal(harness, reason) {
|
|
|
21
21
|
error.launchNotStarted = { harness, phase: "input" };
|
|
22
22
|
return error;
|
|
23
23
|
}
|
|
24
|
+
/** The launch stopped on a startup screen Aiterm does not answer and closed the seat it created (R18, AGENT_STARTUP_BLOCKED). */
|
|
25
|
+
export function launchStartupBlocked(harness, reason, action) {
|
|
26
|
+
const error = new AitermError(`AGENT_STARTUP_BLOCKED: 起動の途中の画面で止まったため、作った席を閉じました。席は残っていません。reason=${reason}\n${action}`, 2);
|
|
27
|
+
error.launchNotStarted = { harness, phase: "input", code: "AGENT_STARTUP_BLOCKED", action };
|
|
28
|
+
return error;
|
|
29
|
+
}
|
|
24
30
|
/** The harness CLI is not logged in; the launch is refused before any session exists (remote-terminal.md R18, code AGENT_AUTH_REQUIRED). */
|
|
25
31
|
export function launchAuthRequired(harness, reason) {
|
|
26
32
|
const error = new AitermError(`AGENT_LAUNCH_NOT_STARTED: AGENT_AUTH_REQUIRED: ${reason}`, 2);
|
package/dist/harnesses/claude.js
CHANGED
|
@@ -395,7 +395,8 @@ export function claudeTuiReady(screen) {
|
|
|
395
395
|
// Claude Code 2.1.251 のworkspace trust UIも選択カーソルに❯を使う。
|
|
396
396
|
// 最後のmarker行だけを見ることで、古いtrust表示がscrollbackに残っていても
|
|
397
397
|
// その下に描画された現在のcomposerを優先する。
|
|
398
|
-
|
|
398
|
+
// A dialog draws its choices with the same ❯ (the Bypass Permissions warning's "❯ Yes, I accept" has no index).
|
|
399
|
+
return !/^❯\s*(?:\d+\.|\[|Enable selected\b|No,\s*exit\b|Yes,\s*I trust this folder\b|Yes,\s*I accept\b)/iu.test(lastMarker);
|
|
399
400
|
}
|
|
400
401
|
// Claude Codeは動いている間、入力欄の上へ進行行を出し続ける(2.1.291の実画面 2026-10-06)。
|
|
401
402
|
// ✻ Swirling… (running UserPromptSubmit hook · 0s)
|
|
@@ -15,15 +15,16 @@ export function grokCurrentSessionOwner(record, expected) {
|
|
|
15
15
|
return 'unavailable';
|
|
16
16
|
return rows[0].session_id === expected.sessionId ? 'match' : 'mismatch';
|
|
17
17
|
}
|
|
18
|
+
// Grok owns the status vocabulary (1.0.77 adds budget_limited, ...): kept as an open string. Keys it adds later are dropped.
|
|
18
19
|
export const grokNativeGoalStateSchema = z.object({
|
|
19
|
-
goal_id: z.string().uuid(), objective: z.string().min(1), status: z.
|
|
20
|
+
goal_id: z.string().uuid(), objective: z.string().min(1), status: z.string().min(1), phase: z.enum(['Idle', 'Planning', 'Executing']),
|
|
20
21
|
token_budget: z.number().int().positive(), elapsed_ms: z.number().int().nonnegative(), created_at: z.string().datetime({ offset: true }),
|
|
21
22
|
current_subagent_id: z.string().nullable(), current_subagent_role: z.string().nullable(),
|
|
22
23
|
total_worker_rounds: z.number().int().nonnegative(), total_verify_rounds: z.number().int().nonnegative(),
|
|
23
24
|
token_baseline: z.number().int().nonnegative(), tokens_used_high_water: z.number().int().nonnegative(), parent_tokens_spent: z.number().int().nonnegative(), last_session_tokens_seen: z.number().int().nonnegative(),
|
|
24
25
|
history: z.array(z.object({ timestamp: z.string().datetime({ offset: true }), event: z.string(), detail: z.string().optional() }).strict()),
|
|
25
26
|
evaluator_blocked_streak: z.number().int().nonnegative(), verifier_id: z.string().min(1), classifier_runs_attempted: z.number().int().nonnegative(), rounds_since_verify: z.number().int().nonnegative(), classifier_stall_count: z.number().int().nonnegative(), consecutive_not_achieved: z.number().int().nonnegative(), last_strategist_fired_at: z.number().int().nonnegative(), strategist_cap_bonus: z.number().int().nonnegative(),
|
|
26
|
-
}).
|
|
27
|
+
}).strip();
|
|
27
28
|
const elapsedDisplay = z.string().max(64).regex(/^(?:\d+s|\d+m[0-5]\ds|\d+h[0-5]\dm)$/u);
|
|
28
29
|
export const grokCurrentStatusSchema = z.discriminatedUnion('source', [z.object({
|
|
29
30
|
source: z.literal('/goal status'), status: z.enum(['Active', 'UserPaused']), phase: z.enum(['Idle', 'Planning', 'Executing']),
|
|
@@ -36,7 +37,12 @@ export const grokCurrentStatusSchema = z.discriminatedUnion('source', [z.object(
|
|
|
36
37
|
// Keep the persisted native snapshot distinct from the current worker's
|
|
37
38
|
// fresh status. Resuming a worker can reset its in-memory phase without
|
|
38
39
|
// rewriting that snapshot; never present the stored phase as current.
|
|
39
|
-
|
|
40
|
+
// inspect returns the saved snapshot alone; only a fresh UI read (clear) adds current_status.
|
|
41
|
+
export const grokCurrentGoalSchema = z.object({ kind: z.literal('grok-cli'), native: grokNativeGoalStateSchema, current_status: grokCurrentStatusSchema.optional() }).strict();
|
|
42
|
+
/** inspect: the session's saved goal/state.json only. Types nothing; no file is no goal. */
|
|
43
|
+
export function readSavedGrokGoal(state) {
|
|
44
|
+
return { current: state === null ? null : grokCurrentGoalSchema.parse({ kind: 'grok-cli', native: state }) };
|
|
45
|
+
}
|
|
40
46
|
export function grokGoalFromFreshStatus(text, before, after) {
|
|
41
47
|
const first = grokNativeGoalStateSchema.parse(before), native = grokNativeGoalStateSchema.parse(after);
|
|
42
48
|
if (first.goal_id !== native.goal_id || first.objective !== native.objective)
|
|
@@ -231,7 +237,7 @@ export async function readFreshGrokGoal(sessionId, port) {
|
|
|
231
237
|
export function grokGoalClearReady(ui) { return composer(ui.read()) === ''; }
|
|
232
238
|
export async function clearGrokGoal(sessionId, expected, port) {
|
|
233
239
|
const status = expected.current_status;
|
|
234
|
-
if (expected.native.status !== 'user_paused' || status
|
|
240
|
+
if (expected.native.status !== 'user_paused' || status?.source !== '/goal status' || status.status !== 'UserPaused' || status.phase !== 'Idle')
|
|
235
241
|
throw new AgentGoalNotIssuedError('native_goal_clear_input_unconfirmed');
|
|
236
242
|
let enterAttempted = false;
|
|
237
243
|
const guard = () => {
|
package/dist/index.js
CHANGED
|
@@ -257,7 +257,7 @@ export function createAitermServer(options = {}) {
|
|
|
257
257
|
};
|
|
258
258
|
if (e instanceof AitermError && e.launchNotStarted)
|
|
259
259
|
return { content: [{ type: "text", text: "aiterm: " + msg }], isError: true,
|
|
260
|
-
_meta: launchNotStartedMeta(e.launchNotStarted.harness, e.launchNotStarted.phase, e.launchNotStarted.code) };
|
|
260
|
+
_meta: launchNotStartedMeta(e.launchNotStarted.harness, e.launchNotStarted.phase, e.launchNotStarted.code, e.launchNotStarted.action) };
|
|
261
261
|
return { content: [{ type: "text", text: "aiterm: " + msg }], isError: true };
|
|
262
262
|
}
|
|
263
263
|
/**
|
|
@@ -27,6 +27,7 @@ const ACTIONS = {
|
|
|
27
27
|
REMOTE_AITERM_TOO_OLD: "端末のAitermが古いため起こせません。端末のAitermを更新してください。",
|
|
28
28
|
SEAT_FORWARD_UNAVAILABLE: "端末からBellTeamへ戻る通り道がまだ用意できていません。少し待ってから起こし直してください。",
|
|
29
29
|
CWD_UNAVAILABLE: "端末に作業フォルダがありません。メンバーの作業フォルダを選び直すか、そのフォルダを作ってください。",
|
|
30
|
+
AGENT_STARTUP_BLOCKED: "AIの起動の途中の画面(初回の案内や確認)で止まったため、席を閉じました。端末でそのAIを一度起動して画面を最後まで進めてから、起こし直してください。",
|
|
30
31
|
AGENT_LAUNCH_NOT_STARTED: "席を作る途中で失敗しました。席は残っていません。もう一度起こし直します。",
|
|
31
32
|
CLAUDE_AUTH_STATUS_UNCONFIRMED: "端末のClaude Codeのログイン状態を確かめられませんでした。少し待ってから起こし直してください。",
|
|
32
33
|
CLAUDE_AUTH_STATUS_TIMEOUT: "端末のClaude Codeのログイン状態を時間内に確かめられませんでした。少し待ってから起こし直してください。",
|
|
@@ -41,9 +42,9 @@ export function terminalLaunchAction(code) {
|
|
|
41
42
|
export const LAUNCH_ERROR_META = "aiterm/launch_error";
|
|
42
43
|
export const ERROR_CODE_META = "aiterm/error_code";
|
|
43
44
|
/** R18 for a local launch: the fresh native creation left no seat (core.freshLaunchFailure). */
|
|
44
|
-
export function launchNotStartedMeta(harness, phase = "native_create", code = "AGENT_LAUNCH_NOT_STARTED") {
|
|
45
|
+
export function launchNotStartedMeta(harness, phase = "native_create", code = "AGENT_LAUNCH_NOT_STARTED", action) {
|
|
45
46
|
return { [LAUNCH_ERROR_META]: { schema: "aiterm.agent-launch-error.v1", harness, code, phase,
|
|
46
|
-
effect: "not_started", session_created: false, action: code
|
|
47
|
+
effect: "not_started", session_created: false, action: action ?? (code !== "AGENT_LAUNCH_NOT_STARTED" || phase !== "input" ? ACTIONS[code] : INPUT_ACTION) } };
|
|
47
48
|
}
|
|
48
49
|
// phase "input": refused from the arguments alone; nothing was started, so launching again unchanged fails the same way.
|
|
49
50
|
const INPUT_ACTION = "起動の指定(追加の指示かMCPの設定)をこのAIでは使えません。席は作られていません。指定を見直してください。";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aiterm-mcp",
|
|
3
|
-
"version": "0.70.
|
|
3
|
+
"version": "0.70.37",
|
|
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": [
|