comfyui-mcp 0.52.37 → 0.52.38
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/orchestrator/panel-tools.js +2 -142
- package/dist/orchestrator/panel-tools.js.map +1 -1
- package/dist/services/node-management.js +75 -1
- package/dist/services/node-management.js.map +1 -1
- package/dist/services/panel-graph-cmd-tools.js +183 -0
- package/dist/services/panel-graph-cmd-tools.js.map +1 -0
- package/dist/services/ui-bridge.js +31 -6
- package/dist/services/ui-bridge.js.map +1 -1
- package/dist/services/workspace-env.js +144 -1
- package/dist/services/workspace-env.js.map +1 -1
- package/package.json +1 -1
|
@@ -148,6 +148,8 @@ function journalConversationFor(ctx) {
|
|
|
148
148
|
return conversationOfScopeAddress(ctx.tabId);
|
|
149
149
|
}
|
|
150
150
|
import { BRIDGE_DEFAULT_TIMEOUT_MS, BRIDGE_READ_DEFAULT_TIMEOUT_MS, dispatchOutcomeOf, GRAPH_CMD_EFFECT, isCapabilityRefusal, isPanelCmdUnsupportedError, isMidCommandDisconnectTagged, isReplyTimeoutTagged, isRoutingAmbiguity, requiresWorkflowStampEnforcement, } from "../services/ui-bridge.js";
|
|
151
|
+
import { PANEL_TOOL_BY_GRAPH_CMD, QUEUE_BUSY_READ_TOOLS, RETRY_TOKEN_CMD_BY_TOOL, panelToolForGraphCmd, } from "../services/panel-graph-cmd-tools.js";
|
|
152
|
+
export { PANEL_TOOL_BY_GRAPH_CMD, QUEUE_BUSY_READ_TOOLS, RETRY_TOKEN_CMD_BY_TOOL, panelToolForGraphCmd, };
|
|
151
153
|
import { withWorkflowTarget, } from "../services/workflow-target-store.js";
|
|
152
154
|
import { addUserMcpServer, readUserMcpServers, removeUserMcpServer, setUserMcpServerSecret, } from "../services/user-mcp-config.js";
|
|
153
155
|
import { setComfyuiSecret, setAgentSecret, isAllowedAgentSecretKey, receiptDisclosures, shadowedNote, storeDamageNote, } from "../services/panel-secrets.js";
|
|
@@ -812,33 +814,6 @@ function queueBusySnapshotNote() {
|
|
|
812
814
|
function graphCmdIsInertUnderQueueBusy(name) {
|
|
813
815
|
return GRAPH_CMD_EFFECT[name] === "inert";
|
|
814
816
|
}
|
|
815
|
-
/**
|
|
816
|
-
* #1933 — the READ TOOLS this refusal advertises, by their REGISTERED tool name.
|
|
817
|
-
*
|
|
818
|
-
* They must be tool names, not the `graph_outline` / `graph_query` /
|
|
819
|
-
* `graph_get_errors` bridge commands they dispatch: this string is the whole
|
|
820
|
-
* recovery contract for a fenced write, and an agent that follows it calls what
|
|
821
|
-
* it is told to call. A bridge command is not callable, so the advice returned
|
|
822
|
-
* "unknown tool" — a hard failure mid-degraded-state that the agent cannot
|
|
823
|
-
* diagnose, and from which it can only conclude that reads are unavailable
|
|
824
|
-
* during a render, which is precisely the state panel#1489 fixed and this
|
|
825
|
-
* sentence exists to advertise (reported from the field in
|
|
826
|
-
* artokun/comfyui-mcp-panel#1549).
|
|
827
|
-
*
|
|
828
|
-
* The mapping is NOT the `panel_` prefix mechanically applied — `graph_query`'s
|
|
829
|
-
* tool is `panel_query_graph`, not `panel_graph_query`. So these are written
|
|
830
|
-
* out, and `graph-read-during-render.test.ts` asserts every one of them is in
|
|
831
|
-
* `buildPanelToolDefs()` — the registry the caller actually dispatches against.
|
|
832
|
-
* That test is what stops this list from drifting again: the old literal was
|
|
833
|
-
* green for the whole of its life with all three names wrong, because the
|
|
834
|
-
* assertion matched `/graph_outline/`, which a wrong name and a right one both
|
|
835
|
-
* satisfy.
|
|
836
|
-
*/
|
|
837
|
-
export const QUEUE_BUSY_READ_TOOLS = [
|
|
838
|
-
"panel_graph_outline",
|
|
839
|
-
"panel_query_graph",
|
|
840
|
-
"panel_get_errors",
|
|
841
|
-
];
|
|
842
817
|
function graphCmdBlockedByRunningPrompt(cmd) {
|
|
843
818
|
const name = typeof cmd.cmd === "string" ? cmd.cmd : "";
|
|
844
819
|
if (!name.startsWith("graph_") || name === "graph_run")
|
|
@@ -9828,126 +9803,11 @@ const RETRY_OF_ARG = {
|
|
|
9828
9803
|
.optional()
|
|
9829
9804
|
.describe("Retry token (#694): pass the retry_of rid from a previous outcome-unknown failure of this identical call to retry that exact mutation; omit otherwise."),
|
|
9830
9805
|
};
|
|
9831
|
-
/**
|
|
9832
|
-
* #694 — the MUTATING panel tools that accept retry_of, keyed to the bridge
|
|
9833
|
-
* command each dispatches. Covers every command the bridge fences to a workflow
|
|
9834
|
-
* (GRAPH_CMD_EFFECT "targeted" — see requiresWorkflowStampEnforcement) plus the
|
|
9835
|
-
* four workflow mutators (workflow_save / workflow_save_as / workflow_rename /
|
|
9836
|
-
* workflow_close). Navigation/creation (workflow_open / workflow_new) and the
|
|
9837
|
-
* tools whose descriptions declare them view/read-only (panel_find_nodes,
|
|
9838
|
-
* panel_canvas, panel_screenshot, panel_list_subgraphs) are excluded: a read must
|
|
9839
|
-
* never mint or carry a retry token — its retry could be answered from the ledger
|
|
9840
|
-
* with a STALE outcome (codex gate).
|
|
9841
|
-
*
|
|
9842
|
-
* Four UI-STATE commands are admitted on purpose (graph_select_nodes,
|
|
9843
|
-
* graph_enter/exit_subgraph, graph_copy_nodes): they change selection, subgraph
|
|
9844
|
-
* scope or clipboard idempotently, so a deduped retry is a no-op. THIS MAP — not
|
|
9845
|
-
* the workflow fence — is what decides whether a token is minted and whether a
|
|
9846
|
-
* caller-supplied one reaches the wire, so those four keep behaving exactly as
|
|
9847
|
-
* they did before #778 reclassified them as `inert` for the fence. The two
|
|
9848
|
-
* questions are related but not the same, and answering one with the other is
|
|
9849
|
-
* the defect #778 is about.
|
|
9850
|
-
*
|
|
9851
|
-
* EXPLICIT MAP, mirroring the RETRY_SAFE_CMDS / MUTATING_GRAPH_EDIT_CMDS
|
|
9852
|
-
* maintenance model — keep in sync when mutating tools are added. Exported for
|
|
9853
|
-
* the #694 surface-integrity test.
|
|
9854
|
-
*/
|
|
9855
|
-
export const RETRY_TOKEN_CMD_BY_TOOL = {
|
|
9856
|
-
panel_add_node: "graph_add_node",
|
|
9857
|
-
panel_edit_node: "graph_edit_node",
|
|
9858
|
-
panel_remove_node: "graph_remove_node",
|
|
9859
|
-
panel_clear: "graph_clear",
|
|
9860
|
-
panel_flatten_workflow: "graph_load",
|
|
9861
|
-
panel_load_workflow: "graph_load",
|
|
9862
|
-
panel_connect: "graph_connect",
|
|
9863
|
-
panel_disconnect: "graph_disconnect",
|
|
9864
|
-
// Idempotent: inputs/outputs/default_mode are absolute values, so a deduped
|
|
9865
|
-
// retry writes the same metadata again rather than doubling anything.
|
|
9866
|
-
panel_configure_app_mode: "graph_configure_app_mode",
|
|
9867
|
-
panel_set_widget: "graph_set_widget",
|
|
9868
|
-
panel_remove_widget: "graph_remove_widget",
|
|
9869
|
-
panel_set_property: "graph_set_node_property",
|
|
9870
|
-
panel_move_node: "graph_move_node",
|
|
9871
|
-
panel_resize_node: "graph_resize_node",
|
|
9872
|
-
panel_auto_layout: "graph_auto_layout",
|
|
9873
|
-
panel_run: "graph_run",
|
|
9874
|
-
panel_save_workflow: "workflow_save", // workflow_save_as when `name` is given
|
|
9875
|
-
panel_rename_workflow: "workflow_rename",
|
|
9876
|
-
panel_close_workflow: "workflow_close",
|
|
9877
|
-
panel_select_nodes: "graph_select_nodes",
|
|
9878
|
-
panel_create_subgraph: "graph_create_subgraph",
|
|
9879
|
-
panel_subgraph_group: "graph_subgraph_group",
|
|
9880
|
-
panel_copy_nodes: "graph_copy_nodes",
|
|
9881
|
-
panel_paste_nodes: "graph_paste_nodes",
|
|
9882
|
-
panel_save_subgraph: "graph_save_subgraph",
|
|
9883
|
-
panel_add_subgraph: "graph_add_subgraph",
|
|
9884
|
-
panel_create_group: "graph_create_group",
|
|
9885
|
-
panel_move_group: "graph_move_group",
|
|
9886
|
-
panel_edit_group: "graph_edit_group",
|
|
9887
|
-
panel_remove_group: "graph_remove_group",
|
|
9888
|
-
panel_set_node_title: "graph_set_title",
|
|
9889
|
-
panel_set_node_collapsed: "graph_set_node_collapsed",
|
|
9890
|
-
panel_set_node_mode: "graph_set_node_mode",
|
|
9891
|
-
panel_set_node_color: "graph_set_node_color",
|
|
9892
|
-
panel_enter_subgraph: "graph_enter_subgraph",
|
|
9893
|
-
panel_exit_subgraph: "graph_exit_subgraph",
|
|
9894
|
-
panel_move_rail: "graph_move_rail",
|
|
9895
|
-
panel_promote_widget: "graph_promote_widget",
|
|
9896
|
-
panel_expose_subgraph_output: "graph_expose_subgraph_output",
|
|
9897
|
-
panel_expose_subgraph_input: "graph_expose_subgraph_input",
|
|
9898
|
-
panel_unexpose_subgraph_output: "graph_unexpose_subgraph_output",
|
|
9899
|
-
panel_unexpose_subgraph_input: "graph_unexpose_subgraph_input",
|
|
9900
|
-
panel_unpack_subgraph: "graph_unpack_subgraph",
|
|
9901
|
-
panel_update_node: "graph_update_node",
|
|
9902
|
-
};
|
|
9903
9806
|
/** #694 — the bridge commands the retry map admits, for the mint gate: a
|
|
9904
9807
|
* dispatched timeout/drop only mints a retry token when the command is in
|
|
9905
9808
|
* this set (bridge classification alone would include read/view-only
|
|
9906
9809
|
* commands that sit outside BRIDGE_READONLY_CMDS). */
|
|
9907
9810
|
export const RETRY_TOKEN_CMDS = new Set(Object.values(RETRY_TOKEN_CMD_BY_TOOL).concat(["workflow_save_as"]));
|
|
9908
|
-
/**
|
|
9909
|
-
* #1933 — the reverse of RETRY_TOKEN_CMD_BY_TOOL: which TOOL does a caller reach
|
|
9910
|
-
* this bridge command through?
|
|
9911
|
-
*
|
|
9912
|
-
* An agent-facing message written below the tool layer can only see `cmd.cmd`;
|
|
9913
|
-
* `PanelToolCtx.call` takes a command object and no tool identity, so by the
|
|
9914
|
-
* time a pre-dispatch refusal is worded the tool name is genuinely gone. This
|
|
9915
|
-
* recovers it from the map that already maintains the correspondence, rather
|
|
9916
|
-
* than adding a second hand-written list that can drift out of step with the
|
|
9917
|
-
* first.
|
|
9918
|
-
*
|
|
9919
|
-
* IT REFUSES TO GUESS. The forward map is not injective — `graph_load` is
|
|
9920
|
-
* dispatched by both `panel_load_workflow` and `panel_flatten_workflow` — and
|
|
9921
|
-
* naming one of two possible tools is a confidently wrong answer, which is worse
|
|
9922
|
-
* than declining to name one. Ambiguous commands are therefore OMITTED, and
|
|
9923
|
-
* callers must handle `undefined`.
|
|
9924
|
-
*
|
|
9925
|
-
* Coverage is not assumed either: every `targeted` GRAPH_CMD_EFFECT command
|
|
9926
|
-
* except `graph_run` is a value of the forward map, so the queue-busy fence
|
|
9927
|
-
* resolves a tool for everything it can refuse except `graph_load`.
|
|
9928
|
-
* `graph-read-during-render.test.ts` pins both halves — the resolution and the
|
|
9929
|
-
* refusal to guess.
|
|
9930
|
-
*/
|
|
9931
|
-
export const PANEL_TOOL_BY_GRAPH_CMD = (() => {
|
|
9932
|
-
const claims = new Map();
|
|
9933
|
-
for (const [tool, cmd] of Object.entries(RETRY_TOKEN_CMD_BY_TOOL)) {
|
|
9934
|
-
const prior = claims.get(cmd);
|
|
9935
|
-
if (prior)
|
|
9936
|
-
prior.push(tool);
|
|
9937
|
-
else
|
|
9938
|
-
claims.set(cmd, [tool]);
|
|
9939
|
-
}
|
|
9940
|
-
const unique = new Map();
|
|
9941
|
-
for (const [cmd, tools] of claims)
|
|
9942
|
-
if (tools.length === 1)
|
|
9943
|
-
unique.set(cmd, tools[0]);
|
|
9944
|
-
return unique;
|
|
9945
|
-
})();
|
|
9946
|
-
/** #1933 — the registered tool a bridge command is reached through, or
|
|
9947
|
-
* `undefined` when no tool, or more than one tool, claims it. */
|
|
9948
|
-
export function panelToolForGraphCmd(cmd) {
|
|
9949
|
-
return PANEL_TOOL_BY_GRAPH_CMD.get(cmd);
|
|
9950
|
-
}
|
|
9951
9811
|
/** #694 — augment one MUTATING tool def: accept retry_of and attach it, UNTOUCHED,
|
|
9952
9812
|
* to every mutating command the handler dispatches (per-command gated so a read
|
|
9953
9813
|
* probe inside the same handler — e.g. panel_flatten_workflow's live-canvas
|