aiterm-mcp 0.61.4 → 0.61.5
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 +10 -1
- package/README.ja.md +3 -1
- package/README.md +3 -1
- package/dist/core.js +30 -28
- package/dist/execution-dispatch.js +5 -2
- package/dist/execution-effect.js +33 -2
- package/dist/execution-service.js +25 -2
- package/dist/execution-store.js +44 -1
- package/dist/execution-tools.js +1 -1
- package/docs/DESIGN.md +7 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.61.5] - 2026-10-22
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- In the opt-in POSIX native entry, an ordinary incoming send to a verified caller no longer invalidates that caller's outgoing send between paste and Enter. The incoming slot remains owned by its original request; unknown input, management operations, stops and generation changes remain blockers. Reciprocal sends do not wait on each other.
|
|
15
|
+
- Agent paste/submit segments asynchronously acquire the existing metadata mutex before running their synchronous native gates. Routine graph-writer contention no longer poisons an already pasted input. Each effect still rechecks generations and stop state, and issuance is durable before input; no native command is replayed.
|
|
16
|
+
- BellTeam's explicit promptless management `agent_launch` now uses the serving process/request identity after `pty_close`. Unreferenced prompt delivery, portable forks and automatic names remain refused.
|
|
17
|
+
|
|
10
18
|
## [0.61.4] - 2026-10-22
|
|
11
19
|
|
|
12
20
|
### 修正
|
|
@@ -2728,7 +2736,8 @@ prototype (preserved under `prototype/python/` as the porting source and referen
|
|
|
2728
2736
|
`ubuntu-latest` for Node 18/20/22, publishing to npm on `v*` tags with
|
|
2729
2737
|
provenance.
|
|
2730
2738
|
|
|
2731
|
-
[Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.61.
|
|
2739
|
+
[Unreleased]: https://github.com/kitepon/aiterm-mcp/compare/v0.61.5...HEAD
|
|
2740
|
+
[0.61.5]: https://github.com/kitepon/aiterm-mcp/compare/v0.61.4...v0.61.5
|
|
2732
2741
|
[0.61.4]: https://github.com/kitepon/aiterm-mcp/compare/v0.61.3...v0.61.4
|
|
2733
2742
|
[0.61.3]: https://github.com/kitepon/aiterm-mcp/compare/v0.61.2...v0.61.3
|
|
2734
2743
|
[0.61.2]: https://github.com/kitepon/aiterm-mcp/compare/v0.61.1...v0.61.2
|
package/README.ja.md
CHANGED
|
@@ -209,7 +209,7 @@ runtime-error store は canonical dotagents config の `collection.enabled: true
|
|
|
209
209
|
場合だけ収集し、既定OFF、network送信は行いません。tag起点CIのnpm provenance(OIDC Trusted
|
|
210
210
|
Publishing)で公開し、GitHub Release が Official MCP Registry を再登録します。
|
|
211
211
|
|
|
212
|
-
**状態:** 開発継続中 · 現行公開版 **v0.61.
|
|
212
|
+
**状態:** 開発継続中 · 現行公開版 **v0.61.5** · 動作対象は Linux · WSL2 · macOS · Windows ネイティブ · MIT · [変更履歴](CHANGELOG.md)。
|
|
213
213
|
|
|
214
214
|
### 更新と巻き戻し
|
|
215
215
|
|
|
@@ -735,6 +735,8 @@ agent_launch({ "harness": "codex-cli", "remote": { "host": "rabbit" }, "cwd": "/
|
|
|
735
735
|
|
|
736
736
|
## 人が覗く
|
|
737
737
|
|
|
738
|
+
POSIXの明示native実行構成では、検証済みcallerへ通常メッセージが届く間も、そのcallerから別席への送信を継続できる。callerの世代や各requestのslotは書き換えない。agentの貼付け・Enterはmetadata mutexの競合を入力前に待ち、不明な操作・世代交代・停止では入力を止める。BellTeamは閉じた席をpromptなしの明示管理`agent_launch`で再作成できる。promptを送る呼出しには元の実行参照が必要である。
|
|
739
|
+
|
|
738
740
|
セッションは共有tmux socket(Windows nativeはpsmux namespace)上にある。`pty_open`/`agent_launch`の戻り値に表示されるattachコマンドで、人間がClaude/Codex/Grok/Cursor harnessの同じ端末へ入り、途中でキーボードを引き取れる。
|
|
739
741
|
POSIXでは、tmuxのソケットがまだ無くても最初の`agent_launch`でserverを起動できる。Aitermは作成したsessionとserverを実際のreceiptから照合して受付を確定し、不明な結果を入力の再送で補わない。
|
|
740
742
|
|
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.61.
|
|
230
|
+
**Status:** actively maintained · current public release **v0.61.5** · 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
|
|
|
@@ -793,6 +793,8 @@ Each `pty_send` accepts at most 64 KiB of UTF-8 text. Sends to the same session
|
|
|
793
793
|
|
|
794
794
|
## A human can watch
|
|
795
795
|
|
|
796
|
+
In the opt-in POSIX native execution entry, an ordinary message arriving at a verified caller can overlap that caller's outgoing send. It does not replace the caller's generation or clear either request's slot. Agent paste/submit segments wait for metadata mutex contention before input; uncertain operations, generation changes and stops still prevent input. BellTeam may explicitly recreate a closed session with a promptless management `agent_launch`; sending a prompt still requires its original execution reference.
|
|
797
|
+
|
|
796
798
|
Sessions live on a shared tmux socket on POSIX or a shared psmux namespace on native Windows. The attach line printed by `pty_open` and `agent_launch` lets a human attach to the same terminal and intervene, including a Claude/Codex/Grok/Cursor harness session: `tmux -S … attach -t <id>` on POSIX, or `psmux -L <namespace> attach -t <id>` on native Windows.
|
|
797
799
|
On POSIX, the first `agent_launch` can create the tmux server when its socket does not yet exist. Aiterm verifies the exact created session and server before accepting that launch; an uncertain result is reported without retrying the input.
|
|
798
800
|
|
package/dist/core.js
CHANGED
|
@@ -16,7 +16,7 @@ import { fileURLToPath } from "node:url";
|
|
|
16
16
|
import * as rtk from "./rtk.js";
|
|
17
17
|
import { closeExpectedExecution, parseExecutionNativeSessions, executionNativeBindingSchema } from "./execution-close.js";
|
|
18
18
|
import { executionPointSchema } from "./execution-contract.js";
|
|
19
|
-
import { withExecutionInterruptEffectScope, bindExecutionNativeTarget, beforeExecutionEffect, bindExecutionCreatedLaunch, executionCreatedNativeBinding, hasExecutionCreationScope, assertExecutionContext, withExecutionPreparation, captureExecutionSendBoundary, readExecutionSendBoundary, executionManagementCloseTarget } from "./execution-effect.js";
|
|
19
|
+
import { withExecutionInterruptEffectScope, bindExecutionNativeTarget, beforeExecutionEffect, bindExecutionCreatedLaunch, executionCreatedNativeBinding, hasExecutionCreationScope, assertExecutionContext, withExecutionPreparation, captureExecutionSendBoundary, readExecutionSendBoundary, executionManagementCloseTarget, withExecutionNativeAdmission } from "./execution-effect.js";
|
|
20
20
|
import { ExecutionError } from "./execution-wire.js";
|
|
21
21
|
import { readExecutionParentProcess } from "./execution-parent-process.js";
|
|
22
22
|
import { isCursorMcpClient } from "aiterm-steer-delivery";
|
|
@@ -5792,29 +5792,31 @@ async function dispatchAgentTurnInLock(name, text, o) {
|
|
|
5792
5792
|
prepareSendText(dispatchText, { raw: o.raw });
|
|
5793
5793
|
await o.before_send?.({ session_id: name, launch_id: meta.launch_id, vendor: meta.kind,
|
|
5794
5794
|
harness: agentHarness(meta.kind), event_cursor: startOffset, operation_id: operationId });
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5795
|
+
await withExecutionNativeAdmission(name, () => {
|
|
5796
|
+
captureExecutionSendBoundary({ launch: { session_id: name, launch_id: meta.launch_id }, boundary: {
|
|
5797
|
+
event_cursor: startOffset, operation_id: operationId, turn_id: null, steer_id: null
|
|
5798
|
+
} });
|
|
5799
|
+
recordInterimBoundary(meta, startOffset, operationId);
|
|
5800
|
+
if (meta.kind === "claude") {
|
|
5801
|
+
// durable/anonymousを分岐する前に同じsend preflightを通す。拒否されるpromptの
|
|
5802
|
+
// receipt/active markerだけを残して、来ないStopを待つ状態を作らない。
|
|
5803
|
+
prepareSendText(text, { raw: o.raw });
|
|
5804
|
+
if (operationId) {
|
|
5805
|
+
reserveClaudeOperation(meta, operationId);
|
|
5806
|
+
}
|
|
5807
|
+
else
|
|
5808
|
+
reserveAnonymousClaudeTurn(meta);
|
|
5805
5809
|
}
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
bracketedPaste: true,
|
|
5817
|
-
typedPreface: prefaced.typedPreface,
|
|
5810
|
+
send(name, dispatchText, {
|
|
5811
|
+
enter: false,
|
|
5812
|
+
force: o.force,
|
|
5813
|
+
raw: o.raw,
|
|
5814
|
+
mark: false,
|
|
5815
|
+
rtk: false,
|
|
5816
|
+
preserveAgentOperation: meta.kind === "claude",
|
|
5817
|
+
bracketedPaste: true,
|
|
5818
|
+
typedPreface: prefaced.typedPreface,
|
|
5819
|
+
});
|
|
5818
5820
|
});
|
|
5819
5821
|
// Cursorの冷間起動ではbracketed pasteの反映が250msを超えることがある。本文がcomposerへ
|
|
5820
5822
|
// 現れた実測をsubmit条件にし、未反映のままEnterだけを失う競合を作らない。
|
|
@@ -5829,7 +5831,7 @@ async function dispatchAgentTurnInLock(name, text, o) {
|
|
|
5829
5831
|
// Codex TUI は literal text 投入直後の Enter を取り落とすことがある。agent 経路だけ submit を分離する。
|
|
5830
5832
|
await sleep(AGENT_SUBMIT_DELAY_MS);
|
|
5831
5833
|
}
|
|
5832
|
-
sendKey(name, "Enter", { preserveAgentOperation: meta.kind === "claude" });
|
|
5834
|
+
await withExecutionNativeAdmission(name, () => sendKey(name, "Enter", { preserveAgentOperation: meta.kind === "claude" }));
|
|
5833
5835
|
let residue = await detectAgentSubmitResidue(name, meta.kind, dispatchText);
|
|
5834
5836
|
// Cursorはcomposerへの貼付反映後でも最初のEnterを取り落とすことがある。本文残留を
|
|
5835
5837
|
// 陽性観測した場合だけ同じEnterを一度再送し、再検査後も残る時は失敗として返す。
|
|
@@ -6029,7 +6031,7 @@ async function steerRunningTurn(name, meta, text, o) {
|
|
|
6029
6031
|
};
|
|
6030
6032
|
// Claudeのoperation相関は変えない。差し込みは実行中turnの一部であり、新しいturnを予約しない。
|
|
6031
6033
|
const preserveAgentOperation = meta.kind === "claude";
|
|
6032
|
-
send(name, text, {
|
|
6034
|
+
await withExecutionNativeAdmission(name, () => send(name, text, {
|
|
6033
6035
|
enter: false,
|
|
6034
6036
|
force: true,
|
|
6035
6037
|
raw: o.raw,
|
|
@@ -6038,7 +6040,7 @@ async function steerRunningTurn(name, meta, text, o) {
|
|
|
6038
6040
|
preserveAgentOperation,
|
|
6039
6041
|
bracketedPaste: true,
|
|
6040
6042
|
typedPreface: prefaced.typedPreface,
|
|
6041
|
-
});
|
|
6043
|
+
}));
|
|
6042
6044
|
if (meta.kind === "cursor") {
|
|
6043
6045
|
const visible = await waitCursorPromptVisible(name, text);
|
|
6044
6046
|
if (!visible.visible) {
|
|
@@ -6048,7 +6050,7 @@ async function steerRunningTurn(name, meta, text, o) {
|
|
|
6048
6050
|
else {
|
|
6049
6051
|
await sleep(AGENT_SUBMIT_DELAY_MS);
|
|
6050
6052
|
}
|
|
6051
|
-
sendKey(name, "Enter", { preserveAgentOperation });
|
|
6053
|
+
await withExecutionNativeAdmission(name, () => sendKey(name, "Enter", { preserveAgentOperation }));
|
|
6052
6054
|
// GrokとCursorは実行中の送信を待ち行列へ入れる。そのままだと現在turnの完了後に別turnとして動き、
|
|
6053
6055
|
// 完了通知が差し込み前の回答で届いてしまう。待ち行列へ入ったことを確かめ、標準の「今すぐ送る」で現在turnへ移す。
|
|
6054
6056
|
const queued = meta.kind === "grok" ? grokSteerQueued
|
|
@@ -6064,7 +6066,7 @@ async function steerRunningTurn(name, meta, text, o) {
|
|
|
6064
6066
|
`差し込む文が${label}の待ち行列へ入ったことを確認できません。子のturnが送る直前に終わっていた時は、` +
|
|
6065
6067
|
`文は新しいturnとして始まっており、その完了は通知されません。再送する前にpty_read(screen:true)で確かめてください。`, 2);
|
|
6066
6068
|
}
|
|
6067
|
-
sendKey(name, "Enter");
|
|
6069
|
+
await withExecutionNativeAdmission(name, () => sendKey(name, "Enter"));
|
|
6068
6070
|
if (!await waitSteerScreen(name, screen => !queued(screen), stillRunning)) {
|
|
6069
6071
|
throw new AitermError(`STEER_STILL_QUEUED vendor=${meta.kind} session=${name}\n` +
|
|
6070
6072
|
`差し込む文が${label}の待ち行列に残っています。現在のturnが終わると別turnとして実行されます。`, 2);
|
|
@@ -143,12 +143,15 @@ export function createExecutionDispatcher(bindings) {
|
|
|
143
143
|
// A host's explicit session close is a management RPC with its own
|
|
144
144
|
// existing process/request identity, not a delivery or resend.
|
|
145
145
|
const hostClose = client === "bellteam" && route.tool === "pty_close" && !supplied;
|
|
146
|
+
const hostLaunch = client === "bellteam" && route.tool === "agent_launch" && !supplied
|
|
147
|
+
&& args.prompt == null && args.throughline_source_session === undefined;
|
|
148
|
+
const hostManagement = hostClose || hostLaunch;
|
|
146
149
|
if (args.remote !== undefined && args.remote !== null)
|
|
147
150
|
throw new ExecutionError("EXECUTION_UNSUPPORTED");
|
|
148
151
|
let reference = supplied;
|
|
149
152
|
let directRequest = null;
|
|
150
153
|
let frozenParent = null;
|
|
151
|
-
if (!reference && (client !== "bellteam" ||
|
|
154
|
+
if (!reference && (client !== "bellteam" || hostManagement) && native) {
|
|
152
155
|
directRequest = executionRequestSchema.options[4].parse({ kind: "mcp", process_pid: native.pid,
|
|
153
156
|
process_started_identity: native.started_identity, request_id: fixedExtra.requestId,
|
|
154
157
|
tool: route.tool, target_session_id: route.target });
|
|
@@ -189,7 +192,7 @@ export function createExecutionDispatcher(bindings) {
|
|
|
189
192
|
}
|
|
190
193
|
else {
|
|
191
194
|
// BellTeam must retain its existing delivery/room/call reference.
|
|
192
|
-
if ((client === "bellteam" && !
|
|
195
|
+
if ((client === "bellteam" && !hostManagement) || !directRequest)
|
|
193
196
|
throw new ExecutionError("EXECUTION_UNSUPPORTED");
|
|
194
197
|
const current = await observe(route.target);
|
|
195
198
|
if (route.stage === "send" && !current.point)
|
package/dist/execution-effect.js
CHANGED
|
@@ -106,15 +106,46 @@ function prepareInScope(scope, body) {
|
|
|
106
106
|
throw scope.failure;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
export function withExecutionEffectScope(session, issue, body, creation, prepare) {
|
|
109
|
+
export function withExecutionEffectScope(session, issue, body, creation, prepare, admitNative) {
|
|
110
110
|
const enclosing = scopes.getStore();
|
|
111
111
|
if (enclosing?.interrupt)
|
|
112
112
|
refuse(enclosing, "EXECUTION_UNSUPPORTED");
|
|
113
113
|
const target = executionLaunchSchema.shape.session_id.parse(session);
|
|
114
|
-
const scope = { session: target, issue, prepare, nativeTargets: new Set(), didIssue: false,
|
|
114
|
+
const scope = { session: target, issue, prepare, admitNative, nativeTargets: new Set(), didIssue: false,
|
|
115
115
|
...(creation ? { creation: { ...creation } } : {}) };
|
|
116
116
|
return runEffectScope(scope, body);
|
|
117
117
|
}
|
|
118
|
+
/** Resume one synchronous native segment after asynchronous readiness/waits.
|
|
119
|
+
* Waits for the existing metadata mutex, never replays the native body. The
|
|
120
|
+
* normal gates inside body still check source/target/stop and persist issuance.
|
|
121
|
+
*/
|
|
122
|
+
export async function withExecutionNativeAdmission(session, body) {
|
|
123
|
+
const scope = scopes.getStore();
|
|
124
|
+
if (!scope) {
|
|
125
|
+
if (required)
|
|
126
|
+
throw new ExecutionError("EXECUTION_UNSUPPORTED");
|
|
127
|
+
return body();
|
|
128
|
+
}
|
|
129
|
+
if (scope.session !== session)
|
|
130
|
+
refuse(scope, "EXECUTION_CONFLICT");
|
|
131
|
+
if (scope.failure)
|
|
132
|
+
throw scope.failure;
|
|
133
|
+
if (!scope.admitNative)
|
|
134
|
+
return body(); // explicit legacy/fake frame
|
|
135
|
+
try {
|
|
136
|
+
return await scope.admitNative(() => {
|
|
137
|
+
if (scope.failure)
|
|
138
|
+
throw scope.failure;
|
|
139
|
+
assertExecutionContext(session);
|
|
140
|
+
return body();
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
scope.failure ??= error instanceof ExecutionError ? new ExecutionError(error.code, scope.didIssue ? "possible" : error.effect)
|
|
145
|
+
: new ExecutionError("EXECUTION_UNCONFIRMED", scope.didIssue ? "possible" : "not_started");
|
|
146
|
+
throw scope.failure;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
118
149
|
/** Private stop-owned synchronous frame over the existing native gate. It
|
|
119
150
|
* creates no invocation/edge/request. The ordinary stop path supplies only
|
|
120
151
|
* its target check, without a durable journal or completion/fence prerequisite.
|
|
@@ -70,11 +70,29 @@ function view(state, record) {
|
|
|
70
70
|
stopping: record.stopping || stopped(state, record.relation.source?.launch) || stopped(state, record.relation.target?.launch)
|
|
71
71
|
|| interruptionBlocksRequest(state, record.reservation.request) });
|
|
72
72
|
}
|
|
73
|
+
/** An admitted ordinary input to the caller does not replace its generation
|
|
74
|
+
* or revoke its outstanding outgoing RPC. Blocking that input's issued slot
|
|
75
|
+
* would make reciprocal sends poison each other between paste and Enter.
|
|
76
|
+
* Unknown operations and management/creation slots are never exempted.
|
|
77
|
+
*/
|
|
78
|
+
function blocksSource(state, source, seatHint, own) {
|
|
79
|
+
return state.slots.some(slot => {
|
|
80
|
+
if (slot === own || slot.session_id !== (source?.session_id ?? seatHint))
|
|
81
|
+
return false;
|
|
82
|
+
if (!source || slot.stage !== "send" || slot.state !== "issued" || slot.expected_launch_id !== source.launch_id || !slot.request
|
|
83
|
+
|| slot.request.kind === "mcp" && !["pty_send", "claude_turn.issue"].includes(slot.request.tool))
|
|
84
|
+
return true;
|
|
85
|
+
const incoming = state.records.find(value => same(value.reservation.request, slot.request));
|
|
86
|
+
return incoming?.operations.send !== "issued" || ["issued", "unknown"].includes(incoming.operations.launch)
|
|
87
|
+
|| incoming.relation.phase !== "submitted_unknown" || incoming.relation.completion !== "open"
|
|
88
|
+
|| incoming.relation.lifecycle !== "tracking" || !same(incoming.relation.target?.launch, source);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
73
91
|
function sourceAdmission(state, point, seatHint) {
|
|
74
92
|
assertInterruptionSource(state, point, seatHint);
|
|
75
93
|
if (stopped(state, point?.launch))
|
|
76
94
|
throw new ExecutionError("EXECUTION_STOPPING");
|
|
77
|
-
if (state
|
|
95
|
+
if (blocksSource(state, point?.launch ?? null, seatHint))
|
|
78
96
|
throw new ExecutionError("EXECUTION_UNCONFIRMED");
|
|
79
97
|
if (!point && seatHint && state.stopping.some(value => value.session_id === seatHint))
|
|
80
98
|
throw new ExecutionError("EXECUTION_UNCONFIRMED");
|
|
@@ -528,6 +546,11 @@ export class ExecutionService {
|
|
|
528
546
|
return this.store.transaction(state => view(state, find(state, args.request)), { readOnly: true });
|
|
529
547
|
return this.finish(args);
|
|
530
548
|
}
|
|
549
|
+
async admitNative(body) {
|
|
550
|
+
if (!this.store.admitNative)
|
|
551
|
+
throw new ExecutionError("EXECUTION_UNSUPPORTED");
|
|
552
|
+
return this.store.admitNative(body);
|
|
553
|
+
}
|
|
531
554
|
/** Read-only root selection, not a stop or a reservation. Generations come
|
|
532
555
|
* only from current observation or persisted unfinished relations/slots. A
|
|
533
556
|
* completed/retired contact never becomes a root just because its name matches.
|
|
@@ -748,7 +771,7 @@ export class ExecutionService {
|
|
|
748
771
|
throw new ExecutionError("EXECUTION_STOPPING");
|
|
749
772
|
if (!relation.source && record.source_session_id && state.stopping.some(value => value.session_id === record.source_session_id))
|
|
750
773
|
throw new ExecutionError("EXECUTION_UNCONFIRMED");
|
|
751
|
-
if (state
|
|
774
|
+
if (blocksSource(state, relation.source?.launch ?? null, record.source_session_id, slot))
|
|
752
775
|
throw new ExecutionError("EXECUTION_UNCONFIRMED");
|
|
753
776
|
if (relation.source) {
|
|
754
777
|
const source = this.runtime.observeSync(relation.source.launch.session_id);
|
package/dist/execution-store.js
CHANGED
|
@@ -81,6 +81,7 @@ export class FileExecutionStore {
|
|
|
81
81
|
directory;
|
|
82
82
|
lockTimeoutMs;
|
|
83
83
|
lockActor;
|
|
84
|
+
nativeAdmission = false;
|
|
84
85
|
constructor(directory, lockTimeoutMs = 2000, lockActor) {
|
|
85
86
|
this.directory = directory;
|
|
86
87
|
this.lockTimeoutMs = lockTimeoutMs;
|
|
@@ -151,7 +152,8 @@ export class FileExecutionStore {
|
|
|
151
152
|
fs.mkdirSync(this.directory, { recursive: true, mode: 0o700 });
|
|
152
153
|
let lock;
|
|
153
154
|
try {
|
|
154
|
-
|
|
155
|
+
if (!this.nativeAdmission)
|
|
156
|
+
lock = acquireExecutionLock(this.directory, this.lockActor);
|
|
155
157
|
}
|
|
156
158
|
catch (error) {
|
|
157
159
|
if (error instanceof ExecutionError)
|
|
@@ -169,10 +171,51 @@ export class FileExecutionStore {
|
|
|
169
171
|
return structuredClone(result);
|
|
170
172
|
}
|
|
171
173
|
finally {
|
|
174
|
+
if (lock)
|
|
175
|
+
releaseExecutionLock(lock);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
async admitNative(body) {
|
|
179
|
+
// The marker exists only on a synchronous stack, never across an await.
|
|
180
|
+
// Re-entry shares the physical mutex but not a mutable state snapshot.
|
|
181
|
+
if (this.nativeAdmission)
|
|
182
|
+
return this.nativeBody(body);
|
|
183
|
+
fs.mkdirSync(this.directory, { recursive: true, mode: 0o700 });
|
|
184
|
+
const deadline = performance.now() + this.lockTimeoutMs;
|
|
185
|
+
let lock;
|
|
186
|
+
for (;;) {
|
|
187
|
+
try {
|
|
188
|
+
lock = acquireExecutionLock(this.directory, this.lockActor);
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
if (error.code !== "EEXIST" && !(error instanceof ExecutionError && error.code === "EXECUTION_BUSY"))
|
|
193
|
+
throw new ExecutionError("EXECUTION_STATE_UNAVAILABLE", "not_started");
|
|
194
|
+
if (performance.now() >= deadline)
|
|
195
|
+
throw new ExecutionError("EXECUTION_BUSY", "not_started");
|
|
196
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
this.nativeAdmission = true;
|
|
200
|
+
try {
|
|
201
|
+
return this.nativeBody(body);
|
|
202
|
+
}
|
|
203
|
+
finally {
|
|
204
|
+
this.nativeAdmission = false;
|
|
172
205
|
releaseExecutionLock(lock);
|
|
173
206
|
}
|
|
174
207
|
}
|
|
208
|
+
nativeBody(body) {
|
|
209
|
+
const result = body();
|
|
210
|
+
if (result && typeof result.then === "function") {
|
|
211
|
+
void Promise.resolve(result).catch(() => undefined);
|
|
212
|
+
throw new ExecutionError("EXECUTION_UNSUPPORTED");
|
|
213
|
+
}
|
|
214
|
+
return result;
|
|
215
|
+
}
|
|
175
216
|
async transaction(body, options = {}) {
|
|
217
|
+
if (this.nativeAdmission)
|
|
218
|
+
throw new ExecutionError("EXECUTION_UNSUPPORTED");
|
|
176
219
|
fs.mkdirSync(this.directory, { recursive: true, mode: 0o700 });
|
|
177
220
|
let lock;
|
|
178
221
|
const deadline = performance.now() + this.lockTimeoutMs;
|
package/dist/execution-tools.js
CHANGED
|
@@ -134,7 +134,7 @@ async function runExecutionReceipt(service, meta, stage, body, targetSessionId,
|
|
|
134
134
|
return service.captureCreatedNative(ref, session, nativeId, expectedServer, serverPid);
|
|
135
135
|
},
|
|
136
136
|
launch: launch => service.bindCreatedLaunch(ref, launch),
|
|
137
|
-
} : undefined, prepare);
|
|
137
|
+
} : undefined, prepare, body => service.admitNative(body));
|
|
138
138
|
// A swallowed native refusal poisons the frame. Only a cleanly returned
|
|
139
139
|
// frame has a genuine successful action receipt to preserve on binding.
|
|
140
140
|
observed = action.value;
|
package/docs/DESIGN.md
CHANGED
|
@@ -28,6 +28,13 @@ native emit直前に照合したhook参照は既存deliveryへ保存する。Cod
|
|
|
28
28
|
POSIXのraw tty回復もnative作用であり、tmux打鍵と同じ受付を通す。ttyは正確なsession selectorで読み、
|
|
29
29
|
実stty直前にも同じdeviceを確認する。停止や世代/tty交代後に古いdeviceへ回復を発行しない。
|
|
30
30
|
一つのRPCが複数のnative作用を発行するときも、各回に同じissued slotとsource/target世代・停止を再確認する。
|
|
31
|
+
agentの貼付け・Enterの同期区間は、既存metadata mutexを非同期に取得してから実行する。
|
|
32
|
+
mutexをawait中へ持ち越さず、同じ同期stack内の各gateが発行記録を永続化してからnative作用へ進む。
|
|
33
|
+
検証済みsourceと同世代への通常sendがissuedである間も、そのsourceの送信先が別ならoutgoing RPCは継続できる。
|
|
34
|
+
incomingのslotを解放・書換・成功扱いせず、unknown・管理操作・世代不一致は従来どおり拒否する。
|
|
35
|
+
incomingの完了待ちをoutgoingへ課して相互送信を循環待ちにしない(ADR 0127)。
|
|
36
|
+
BellTeamのpromptなし明示管理launchは、管理close同様にserving process/request identityへ結合する。
|
|
37
|
+
promptやThroughline読出しを含む未登録送信、auto-name、remoteはこの管理例外へ含めない。
|
|
31
38
|
新launchは、既存POSIX serverのnative owner、またはserver未作成の完全な空観測を受付時と発行直前に確認する。
|
|
32
39
|
冷間時は最初のnew-session自身でserverを作り、その実receiptのnative IDとserver PIDを、作成後の安定したnative一覧とprocess開始識別子で照合する。
|
|
33
40
|
既存server時も冷間時も、作成したsessionのnative ID・server owner・core内部のlaunch世代を同じ要求slotへ段階結合する。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aiterm-mcp",
|
|
3
|
-
"version": "0.61.
|
|
3
|
+
"version": "0.61.5",
|
|
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, and Cursor Agent CLI, plus durable PTYs for SSH, containers, and REPLs.",
|
|
6
6
|
"keywords": [
|