unity-open-mcp 1.4.0 → 1.5.0
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/dist/compressible-router.d.ts +4 -1
- package/dist/compressible-router.js +27 -11
- package/dist/compressible-router.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/live-client.d.ts +7 -60
- package/dist/live-client.js +26 -84
- package/dist/live-client.js.map +1 -1
- package/dist/offline/api.d.ts +2 -0
- package/dist/offline/api.js +4 -2
- package/dist/offline/api.js.map +1 -1
- package/dist/offline/model.js +1 -1
- package/dist/offline/model.js.map +1 -1
- package/dist/offline/parse.d.ts +1 -1
- package/dist/offline/parse.js +20 -8
- package/dist/offline/parse.js.map +1 -1
- package/dist/skill/SKILL.md +2 -0
- package/dist/skill/references/yaml-and-offline-work.md +1 -1
- package/dist/tool-router.js +14 -5
- package/dist/tool-router.js.map +1 -1
- package/package.json +1 -1
|
@@ -13,7 +13,10 @@ export declare class AssetModelCache {
|
|
|
13
13
|
* re-parses.
|
|
14
14
|
*/
|
|
15
15
|
get(key: string, mtimeMs: number | null): AssetModel | null;
|
|
16
|
-
|
|
16
|
+
/** Re-resolve referenced GUIDs so moved, deleted, and restored dependencies
|
|
17
|
+
* cannot leave a cached model stale while the asset itself is unchanged. */
|
|
18
|
+
getFresh(key: string, mtimeMs: number | null, projectRoot: string, assetPath: string): Promise<AssetModel | null>;
|
|
19
|
+
set(key: string, model: AssetModel, mtimeMs: number | null, dependencies?: Array<[string, string | null]>): void;
|
|
17
20
|
clear(): void;
|
|
18
21
|
get size(): number;
|
|
19
22
|
}
|
|
@@ -23,6 +23,7 @@ import { readAssetOffline, isOfflineAsset } from "./offline.js";
|
|
|
23
23
|
import { searchAssetsOffline } from "./offline.js";
|
|
24
24
|
import { makeErrorResult } from "./results.js";
|
|
25
25
|
import { readProfileAndDetail, applyPaging, attachPagination, isOutputProfile, } from "./output-profile.js";
|
|
26
|
+
import { buildGUIDIndex, safeReadMetaGUID } from "./offline/index-builders.js";
|
|
26
27
|
import { normalizeAssetPath } from "./offline/paths.js";
|
|
27
28
|
import { stat } from "node:fs/promises";
|
|
28
29
|
import { join } from "node:path";
|
|
@@ -59,10 +60,28 @@ export class AssetModelCache {
|
|
|
59
60
|
this.entries.set(key, entry);
|
|
60
61
|
return entry.model;
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
+
/** Re-resolve referenced GUIDs so moved, deleted, and restored dependencies
|
|
64
|
+
* cannot leave a cached model stale while the asset itself is unchanged. */
|
|
65
|
+
async getFresh(key, mtimeMs, projectRoot, assetPath) {
|
|
66
|
+
const model = this.get(key, mtimeMs);
|
|
67
|
+
const entry = this.entries.get(key);
|
|
68
|
+
if (!model || !entry || entry.dependencies === undefined)
|
|
69
|
+
return model;
|
|
70
|
+
const wanted = new Set(entry.dependencies.map(([guid]) => guid));
|
|
71
|
+
const [index, guid] = await Promise.all([
|
|
72
|
+
buildGUIDIndex(projectRoot, wanted),
|
|
73
|
+
safeReadMetaGUID(join(projectRoot, assetPath) + ".meta"),
|
|
74
|
+
]);
|
|
75
|
+
if ((model.guid ?? "") !== guid || entry.dependencies.some(([id, path]) => (index.get(id) ?? null) !== path)) {
|
|
76
|
+
this.entries.delete(key);
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
return model;
|
|
80
|
+
}
|
|
81
|
+
set(key, model, mtimeMs, dependencies) {
|
|
63
82
|
if (this.entries.has(key))
|
|
64
83
|
this.entries.delete(key);
|
|
65
|
-
this.entries.set(key, { model, mtimeMs });
|
|
84
|
+
this.entries.set(key, { model, mtimeMs, dependencies });
|
|
66
85
|
while (this.entries.size > CACHE_LIMIT) {
|
|
67
86
|
const oldest = this.entries.keys().next().value;
|
|
68
87
|
if (oldest === undefined)
|
|
@@ -143,11 +162,8 @@ async function routeReadAsset(args, live, cache, projectPath) {
|
|
|
143
162
|
}
|
|
144
163
|
const fieldLimit = typeof args.field_limit === "number" ? args.field_limit : 0;
|
|
145
164
|
const depth = typeof args.depth === "number" ? args.depth : -1;
|
|
146
|
-
//
|
|
147
|
-
//
|
|
148
|
-
// normalized form is what the cache key is built from; the ORIGINAL
|
|
149
|
-
// `assetPath` is still passed to the offline parser / live bridge so
|
|
150
|
-
// downstream behavior is byte-identical (only the cache key changes).
|
|
165
|
+
// Use the same normalized path for stat, cache, offline parsing and live
|
|
166
|
+
// fallback so backslash paths work on a cold cache on every platform.
|
|
151
167
|
const normalizedPath = normalizeAssetPath(assetPath);
|
|
152
168
|
// mtime invalidation: stat the absolute file once up-front. A failure
|
|
153
169
|
// (binary-only asset, missing file, permission) yields `null` and the
|
|
@@ -156,17 +172,17 @@ async function routeReadAsset(args, live, cache, projectPath) {
|
|
|
156
172
|
// now re-parse instead of serving stale until LRU eviction.
|
|
157
173
|
const mtimeMs = await measureMtimeMs(projectPath, normalizedPath);
|
|
158
174
|
const cacheKey = `${normalizedPath}|${fieldLimit}|${depth}`;
|
|
159
|
-
let model = cache.
|
|
175
|
+
let model = await cache.getFresh(cacheKey, mtimeMs, projectPath, normalizedPath);
|
|
160
176
|
let cacheHit = true;
|
|
161
177
|
let source = "offline";
|
|
162
178
|
if (!model) {
|
|
163
179
|
cacheHit = false;
|
|
164
180
|
if (isOfflineAsset(assetPath)) {
|
|
165
181
|
try {
|
|
166
|
-
const result = await readAssetOffline(
|
|
182
|
+
const result = await readAssetOffline(normalizedPath, { fieldLimit, projectRoot: projectPath });
|
|
167
183
|
model = result.model;
|
|
168
184
|
source = "offline";
|
|
169
|
-
cache.set(cacheKey, model, mtimeMs);
|
|
185
|
+
cache.set(cacheKey, model, mtimeMs, result.dependencies);
|
|
170
186
|
}
|
|
171
187
|
catch {
|
|
172
188
|
// Offline parse failed — fall through to live bridge.
|
|
@@ -189,7 +205,7 @@ async function routeReadAsset(args, live, cache, projectPath) {
|
|
|
189
205
|
source: "offline",
|
|
190
206
|
});
|
|
191
207
|
}
|
|
192
|
-
const raw = await live.route("unity_open_mcp_read_asset", args);
|
|
208
|
+
const raw = await live.route("unity_open_mcp_read_asset", { ...args, asset_path: normalizedPath });
|
|
193
209
|
const parsed = parseContentJson(raw);
|
|
194
210
|
if (parsed === null) {
|
|
195
211
|
return raw.isError
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compressible-router.js","sourceRoot":"","sources":["../src/compressible-router.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,EAAE;AACF,qEAAqE;AACrE,+EAA+E;AAC/E,uEAAuE;AACvE,2DAA2D;AAC3D,EAAE;AACF,2EAA2E;AAC3E,4EAA4E;AAC5E,gFAAgF;AAChF,gFAAgF;AAChF,mCAAmC;AACnC,EAAE;AACF,sEAAsE;AACtE,8EAA8E;AAC9E,8DAA8D;AAC9D,6EAA6E;AAC7E,4EAA4E;AAC5E,8EAA8E;AAC9E,gEAAgE;AAKhE,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GAEpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,gBAAgB,EAChB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,2BAA2B;IAC3B,8BAA8B;CAC/B,CAAC,CAAC;AAEH,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,OAAO,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,WAAW,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CAAC,KAAK,CAAC,IAAI,CAA4B,CAAC;IAC3D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -94,7 +94,7 @@ export declare const COMPILE_STATE_HEADER = "X-Unity-Open-MCP-Compile-State";
|
|
|
94
94
|
* verify packages. Mirrors the C# `BridgeConstants.NpmPackage`. Kept in
|
|
95
95
|
* sync by `scripts/sync-version.mjs`.
|
|
96
96
|
*/
|
|
97
|
-
export declare const NPM_PACKAGE = "unity-open-mcp@1.
|
|
97
|
+
export declare const NPM_PACKAGE = "unity-open-mcp@1.5.0";
|
|
98
98
|
/**
|
|
99
99
|
* Build the bridge base URL for a given port. Centralizes the loopback +
|
|
100
100
|
* scheme so every caller produces the same string.
|
package/dist/constants.js
CHANGED
|
@@ -105,7 +105,7 @@ export const COMPILE_STATE_HEADER = "X-Unity-Open-MCP-Compile-State";
|
|
|
105
105
|
* verify packages. Mirrors the C# `BridgeConstants.NpmPackage`. Kept in
|
|
106
106
|
* sync by `scripts/sync-version.mjs`.
|
|
107
107
|
*/
|
|
108
|
-
export const NPM_PACKAGE = "unity-open-mcp@1.
|
|
108
|
+
export const NPM_PACKAGE = "unity-open-mcp@1.5.0";
|
|
109
109
|
/**
|
|
110
110
|
* Build the bridge base URL for a given port. Centralizes the loopback +
|
|
111
111
|
* scheme so every caller produces the same string.
|
package/dist/live-client.d.ts
CHANGED
|
@@ -3,36 +3,11 @@ import type { Router } from "./router.js";
|
|
|
3
3
|
import { PingCache, type PingSnapshot } from "./ping-cache.js";
|
|
4
4
|
import type { BridgeToolsInventory } from "./bridge-tools-cache.js";
|
|
5
5
|
import { type PollAndDismissOptions } from "./dialog-dismiss.js";
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* isolation (driving a real response-timeout through postTool takes 40s because
|
|
10
|
-
* the fetch timeout is floored at BRIDGE_DEFAULT_TIMEOUT_MS + slack).
|
|
11
|
-
*
|
|
12
|
-
* undici (Node's fetch) throws a DISTINGUISHABLE error class for the two
|
|
13
|
-
* failure modes that reach this catch:
|
|
14
|
-
* - `TypeError` ("fetch failed") → CONNECTION failure: the socket never
|
|
15
|
-
* connected, was reset before the request body flushed, or the listen port
|
|
16
|
-
* is dead (ECONNREFUSED). No bytes reached the server → no Work was queued
|
|
17
|
-
* → no side effect is possible. Re-POSTing is ALWAYS safe, even on an
|
|
18
|
-
* unchanged endpoint (the same live bridge never received the first POST).
|
|
19
|
-
* - `AbortError` (AbortController timer) → RESPONSE timeout: the request
|
|
20
|
-
* connected and the server is still processing it. A side effect may have
|
|
21
|
-
* happened or be queued. Re-POSTing is only safe when the endpoint CHANGED
|
|
22
|
-
* during recovery (a restart → new bridge that never saw the original POST);
|
|
23
|
-
* on an unchanged endpoint the original call may still complete there, so
|
|
24
|
-
* re-POSTing would risk running the mutation a second time.
|
|
25
|
-
*
|
|
26
|
-
* This distinction matters because a burst of parallel /tools/* calls can leave
|
|
27
|
-
* a dead/reset connection in the pool: the next POST throws a TypeError on
|
|
28
|
-
* connect, and the old "unchanged endpoint → no retry" guard wedged the whole
|
|
29
|
-
* typed-editor surface even though the bridge was healthy and idle
|
|
30
|
-
* (specs/feedback.md entry 2026-07-02-b). The bug was that the guard conflated
|
|
31
|
-
* "endpoint unchanged" with "request in flight," which is only true when the
|
|
32
|
-
* fetch actually connected (AbortError), not when it failed to connect
|
|
33
|
-
* (TypeError).
|
|
6
|
+
/** Retry only when the transport proves the POST could not reach a listener.
|
|
7
|
+
* A socket reset, response timeout, or a changed endpoint cannot rule out an
|
|
8
|
+
* already committed mutation. Aggregate connect failures must all be safe.
|
|
34
9
|
*/
|
|
35
|
-
export declare function shouldRetryPostAfterFailure(err: unknown
|
|
10
|
+
export declare function shouldRetryPostAfterFailure(err: unknown): boolean;
|
|
36
11
|
/** `/project-command-jobs` answered without a job snapshot; `status` is its non-OK HTTP status. */
|
|
37
12
|
export declare class ProjectJobHttpError extends Error {
|
|
38
13
|
readonly status: number;
|
|
@@ -175,15 +150,8 @@ export declare class LiveClient implements Router {
|
|
|
175
150
|
* recovers (re-syncing the endpoint, waiting out a reload, or surfacing
|
|
176
151
|
* the structured offline/dead-bridge error) and re-POSTs only when safe.
|
|
177
152
|
*
|
|
178
|
-
* The
|
|
179
|
-
*
|
|
180
|
-
* counts the POST tries so the postTool → handlePostFailure → postTool loop
|
|
181
|
-
* cannot run forever. `shouldRetryPostAfterFailure` returns true for every
|
|
182
|
-
* `TypeError`, so if POSTs keep failing at the socket level while `/ping`
|
|
183
|
-
* answers during recovery, the previous code re-POSTed the mutation each pass
|
|
184
|
-
* with no depth limit. The bound is `this.retry.transientRetryAttempts + 1`
|
|
185
|
-
* (1 initial attempt + N retries), matching the documented RETRY_CONFIG
|
|
186
|
-
* semantics; once exhausted the offline error is surfaced instead of recursing.
|
|
153
|
+
* The attempt counter caps safe connection retries at one initial POST
|
|
154
|
+
* plus this.retry.transientRetryAttempts. Ambiguous failures never replay.
|
|
187
155
|
*/
|
|
188
156
|
private postTool;
|
|
189
157
|
/**
|
|
@@ -206,28 +174,7 @@ export declare class LiveClient implements Router {
|
|
|
206
174
|
* - unparsable body (bridge_response_unparsable corruption error).
|
|
207
175
|
*/
|
|
208
176
|
private shapeToolResult;
|
|
209
|
-
/**
|
|
210
|
-
* Step 3 of {@link postTool}: classify + recover from a transient POST
|
|
211
|
-
* failure (ECONNREFUSED / timeout during a domain reload). Re-syncs the cached
|
|
212
|
-
* endpoint from the lock first (so a Unity restart self-heals), waits out a
|
|
213
|
-
* reload, and re-POSTs ONLY when safe (endpoint changed during recovery, or a
|
|
214
|
-
* genuine connection failure where no bytes reached the server).
|
|
215
|
-
*
|
|
216
|
-
* Re-POST discipline (specs/feedback.md entry 4A — duplicate side-effects):
|
|
217
|
-
* when the endpoint is unchanged the same live bridge is still processing —
|
|
218
|
-
* or has queued — the original POST's Work; re-POSTing would run the mutation
|
|
219
|
-
* a second time. In that case surface the timeout instead of retrying.
|
|
220
|
-
*
|
|
221
|
-
* M10 (round-2 review) — `attempt` is the 1-based POST attempt counter. When
|
|
222
|
-
* it exceeds the configured retry budget (`this.retry.transientRetryAttempts`
|
|
223
|
-
* retries beyond the initial attempt) the offline error is surfaced instead
|
|
224
|
-
* of recursing. Without this bound `shouldRetryPostAfterFailure` returning
|
|
225
|
-
* true for every `TypeError` made the loop unbounded: POSTs failing at the
|
|
226
|
-
* socket level while `/ping` answers during recovery re-POSTed the mutation
|
|
227
|
-
* each pass forever. The recovery probe inside `handleTransientOffline` is
|
|
228
|
-
* itself bounded (`transientRetryAttempts` iterations of `/ping`); this outer
|
|
229
|
-
* bound caps how many times we re-enter that recovery + re-POST cycle.
|
|
230
|
-
*/
|
|
177
|
+
/** Recover connectivity, but replay only proven pre-connection failures. */
|
|
231
178
|
private handlePostFailure;
|
|
232
179
|
private ensureReady;
|
|
233
180
|
/**
|
package/dist/live-client.js
CHANGED
|
@@ -127,44 +127,21 @@ const COMPILE_REPOST_SENTINEL = { __compileRepost: 0 };
|
|
|
127
127
|
function isCompileRepostSentinel(v) {
|
|
128
128
|
return typeof v === "object" && v !== null && "__compileRepost" in v;
|
|
129
129
|
}
|
|
130
|
-
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* isolation (driving a real response-timeout through postTool takes 40s because
|
|
134
|
-
* the fetch timeout is floored at BRIDGE_DEFAULT_TIMEOUT_MS + slack).
|
|
135
|
-
*
|
|
136
|
-
* undici (Node's fetch) throws a DISTINGUISHABLE error class for the two
|
|
137
|
-
* failure modes that reach this catch:
|
|
138
|
-
* - `TypeError` ("fetch failed") → CONNECTION failure: the socket never
|
|
139
|
-
* connected, was reset before the request body flushed, or the listen port
|
|
140
|
-
* is dead (ECONNREFUSED). No bytes reached the server → no Work was queued
|
|
141
|
-
* → no side effect is possible. Re-POSTing is ALWAYS safe, even on an
|
|
142
|
-
* unchanged endpoint (the same live bridge never received the first POST).
|
|
143
|
-
* - `AbortError` (AbortController timer) → RESPONSE timeout: the request
|
|
144
|
-
* connected and the server is still processing it. A side effect may have
|
|
145
|
-
* happened or be queued. Re-POSTing is only safe when the endpoint CHANGED
|
|
146
|
-
* during recovery (a restart → new bridge that never saw the original POST);
|
|
147
|
-
* on an unchanged endpoint the original call may still complete there, so
|
|
148
|
-
* re-POSTing would risk running the mutation a second time.
|
|
149
|
-
*
|
|
150
|
-
* This distinction matters because a burst of parallel /tools/* calls can leave
|
|
151
|
-
* a dead/reset connection in the pool: the next POST throws a TypeError on
|
|
152
|
-
* connect, and the old "unchanged endpoint → no retry" guard wedged the whole
|
|
153
|
-
* typed-editor surface even though the bridge was healthy and idle
|
|
154
|
-
* (specs/feedback.md entry 2026-07-02-b). The bug was that the guard conflated
|
|
155
|
-
* "endpoint unchanged" with "request in flight," which is only true when the
|
|
156
|
-
* fetch actually connected (AbortError), not when it failed to connect
|
|
157
|
-
* (TypeError).
|
|
130
|
+
/** Retry only when the transport proves the POST could not reach a listener.
|
|
131
|
+
* A socket reset, response timeout, or a changed endpoint cannot rule out an
|
|
132
|
+
* already committed mutation. Aggregate connect failures must all be safe.
|
|
158
133
|
*/
|
|
159
|
-
export function shouldRetryPostAfterFailure(err
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
134
|
+
export function shouldRetryPostAfterFailure(err) {
|
|
135
|
+
if (!(err instanceof TypeError))
|
|
136
|
+
return false;
|
|
137
|
+
const isConnectFailure = (cause) => {
|
|
138
|
+
if (cause instanceof AggregateError)
|
|
139
|
+
return cause.errors.length > 0 && cause.errors.every(isConnectFailure);
|
|
140
|
+
if (!cause || typeof cause !== "object" || !("code" in cause))
|
|
141
|
+
return false;
|
|
142
|
+
return ["ECONNREFUSED", "ENOTFOUND", "EAI_AGAIN", "UND_ERR_CONNECT_TIMEOUT"].includes(String(cause.code));
|
|
143
|
+
};
|
|
144
|
+
return isConnectFailure(err.cause);
|
|
168
145
|
}
|
|
169
146
|
const OFFLINE_HINT = "Ensure the Unity Editor is open with the Agent Bridge running. " +
|
|
170
147
|
"The bridge port is per-project (20000 + sha256(projectPath) % 10000), not " +
|
|
@@ -781,15 +758,8 @@ export class LiveClient {
|
|
|
781
758
|
* recovers (re-syncing the endpoint, waiting out a reload, or surfacing
|
|
782
759
|
* the structured offline/dead-bridge error) and re-POSTs only when safe.
|
|
783
760
|
*
|
|
784
|
-
* The
|
|
785
|
-
*
|
|
786
|
-
* counts the POST tries so the postTool → handlePostFailure → postTool loop
|
|
787
|
-
* cannot run forever. `shouldRetryPostAfterFailure` returns true for every
|
|
788
|
-
* `TypeError`, so if POSTs keep failing at the socket level while `/ping`
|
|
789
|
-
* answers during recovery, the previous code re-POSTed the mutation each pass
|
|
790
|
-
* with no depth limit. The bound is `this.retry.transientRetryAttempts + 1`
|
|
791
|
-
* (1 initial attempt + N retries), matching the documented RETRY_CONFIG
|
|
792
|
-
* semantics; once exhausted the offline error is surfaced instead of recursing.
|
|
761
|
+
* The attempt counter caps safe connection retries at one initial POST
|
|
762
|
+
* plus this.retry.transientRetryAttempts. Ambiguous failures never replay.
|
|
793
763
|
*/
|
|
794
764
|
async postTool(toolName, args, retryOn503, attempt = 1, commandLifecycle) {
|
|
795
765
|
try {
|
|
@@ -1163,61 +1133,33 @@ export class LiveClient {
|
|
|
1163
1133
|
isError: parsed.error != null,
|
|
1164
1134
|
};
|
|
1165
1135
|
}
|
|
1166
|
-
/**
|
|
1167
|
-
* Step 3 of {@link postTool}: classify + recover from a transient POST
|
|
1168
|
-
* failure (ECONNREFUSED / timeout during a domain reload). Re-syncs the cached
|
|
1169
|
-
* endpoint from the lock first (so a Unity restart self-heals), waits out a
|
|
1170
|
-
* reload, and re-POSTs ONLY when safe (endpoint changed during recovery, or a
|
|
1171
|
-
* genuine connection failure where no bytes reached the server).
|
|
1172
|
-
*
|
|
1173
|
-
* Re-POST discipline (specs/feedback.md entry 4A — duplicate side-effects):
|
|
1174
|
-
* when the endpoint is unchanged the same live bridge is still processing —
|
|
1175
|
-
* or has queued — the original POST's Work; re-POSTing would run the mutation
|
|
1176
|
-
* a second time. In that case surface the timeout instead of retrying.
|
|
1177
|
-
*
|
|
1178
|
-
* M10 (round-2 review) — `attempt` is the 1-based POST attempt counter. When
|
|
1179
|
-
* it exceeds the configured retry budget (`this.retry.transientRetryAttempts`
|
|
1180
|
-
* retries beyond the initial attempt) the offline error is surfaced instead
|
|
1181
|
-
* of recursing. Without this bound `shouldRetryPostAfterFailure` returning
|
|
1182
|
-
* true for every `TypeError` made the loop unbounded: POSTs failing at the
|
|
1183
|
-
* socket level while `/ping` answers during recovery re-POSTed the mutation
|
|
1184
|
-
* each pass forever. The recovery probe inside `handleTransientOffline` is
|
|
1185
|
-
* itself bounded (`transientRetryAttempts` iterations of `/ping`); this outer
|
|
1186
|
-
* bound caps how many times we re-enter that recovery + re-POST cycle.
|
|
1187
|
-
*/
|
|
1136
|
+
/** Recover connectivity, but replay only proven pre-connection failures. */
|
|
1188
1137
|
async handlePostFailure(toolName, args, err, retryOn503, attempt, commandLifecycle) {
|
|
1189
|
-
const endpointBefore = this.baseUrl;
|
|
1190
1138
|
const recovered = await this.handleTransientOffline("post");
|
|
1191
1139
|
if (recovered !== null)
|
|
1192
1140
|
return recovered;
|
|
1193
|
-
const endpointChanged = this.baseUrl !== endpointBefore;
|
|
1194
1141
|
// M10 — bound the postTool → handlePostFailure → postTool recursion. The
|
|
1195
1142
|
// budget is the initial attempt plus the configured transient retry count.
|
|
1196
1143
|
const maxAttempts = 1 + this.retry.transientRetryAttempts;
|
|
1197
1144
|
const attemptsExhausted = attempt >= maxAttempts;
|
|
1198
1145
|
if (toolName !== "unity_open_mcp_project_commands" &&
|
|
1199
1146
|
!attemptsExhausted &&
|
|
1200
|
-
shouldRetryPostAfterFailure(err
|
|
1147
|
+
shouldRetryPostAfterFailure(err)) {
|
|
1201
1148
|
return this.postTool(toolName, args, retryOn503, attempt + 1, commandLifecycle);
|
|
1202
1149
|
}
|
|
1203
1150
|
const exhaustedNote = attemptsExhausted
|
|
1204
1151
|
? ` The POST retry budget (${maxAttempts} attempt${maxAttempts === 1 ? "" : "s"}) was exhausted after ${attempt} attempt${attempt === 1 ? "" : "s"}; the bridge is reachable by /ping but POSTs keep failing.`
|
|
1205
1152
|
: "";
|
|
1153
|
+
const ambiguity = shouldRetryPostAfterFailure(err)
|
|
1154
|
+
? `The connection was refused before the request reached the bridge, so it was not applied.`
|
|
1155
|
+
: `A socket failure, timeout, or endpoint change does not prove the original ` +
|
|
1156
|
+
`operation was not applied; verify its effect before retrying.`;
|
|
1157
|
+
const message = `Tool '${toolName}' did not return a confirmed result. No further POST was sent. ` +
|
|
1158
|
+
`${ambiguity} Endpoint: ${this.baseUrl}.${exhaustedNote}`;
|
|
1206
1159
|
return makeErrorResult({
|
|
1207
1160
|
code: "bridge_offline",
|
|
1208
|
-
message
|
|
1209
|
-
|
|
1210
|
-
`the failure was a response timeout (not a connection failure), so ` +
|
|
1211
|
-
`the request was NOT retried — re-POSTing would risk running the ` +
|
|
1212
|
-
`mutation twice on the same bridge. If the editor was briefly slow ` +
|
|
1213
|
-
`(unfocused, GC, a long main-thread op), the original call may still ` +
|
|
1214
|
-
`complete there; verify the effect before retrying. Endpoint: ${this.baseUrl}.${exhaustedNote}`,
|
|
1215
|
-
detail: {
|
|
1216
|
-
error: {
|
|
1217
|
-
code: "bridge_offline",
|
|
1218
|
-
message: `Client timeout against unchanged endpoint ${this.baseUrl}; not retried to avoid duplicate side-effects.`,
|
|
1219
|
-
},
|
|
1220
|
-
},
|
|
1161
|
+
message,
|
|
1162
|
+
detail: { error: { code: "bridge_offline", message } },
|
|
1221
1163
|
});
|
|
1222
1164
|
}
|
|
1223
1165
|
async ensureReady() {
|