Files
ComfyAssets-ComfyUI_PromptM…/web/js/workspace/local-semantics.mjs
T
Vito Sansevero e8df5c54e3 feat(inspect): local prompts resolved like the server's
A file chosen on the Inspect page now shows the prompts and resolution
the server's inspector gives the same records: buildLocalPayload takes
its roles from the local resolver instead of the interim open roles, so
the legacy fill applies exactly where it does for Images.

The resolver reads the server's own node table. The page fetches
web/js/inspection-semantics.json once through the API client as it
mounts, before any selection; the static route serves that one JSON
file by exact path (every other JSON stays forbidden). A table that
cannot be fetched answers "The inspector's node table is unavailable."
as the server does, and a later selection asks again.

The Copy settings summary deviation is numbered D117.
2026-10-22 18:15:40 -07:00

28 lines
1.5 KiB
JavaScript

// The node table local Inspect resolves with (#249 local Inspect, PR L3 Task 10): web/js/inspection-semantics.json,
// the very table the server's inspector reads, fetched once per page through the API client (the proxy-mount rule).
// The Inspect page asks for it as it mounts, before any file is chosen; it is the only static file Inspect fetches,
// and the request carries nothing about a selection. A table that cannot be fetched or used is null: the roles then
// answer as the server does when its table is unusable, and a later selection asks again.
import { compileSemantics } from './local-resolver.mjs';
export const SEMANTICS_PATH = '/prompt_manager/js/inspection-semantics.json';
let pending = null;
async function fetchSemantics() {
const client = globalThis.window?.ApiClient;
if (typeof client?.resolveUrl !== 'function' || typeof globalThis.fetch !== 'function') return null;
const response = await globalThis.fetch(client.resolveUrl(SEMANTICS_PATH), { credentials: 'same-origin' });
if (!response.ok) throw new Error(`Inspection node table request failed (${response.status})`);
return compileSemantics(await response.json());
}
/** The compiled table (one request per page), or null when it is unavailable. */
export function loadInspectionSemantics() {
if (pending !== null) return pending;
const current = pending = fetchSemantics().catch(() => null).then(table => {
if (table === null && pending === current) pending = null;
return table;
});
return current;
}