comfyui-mcp 0.52.107 → 0.52.109

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/env-file.js CHANGED
@@ -143,6 +143,24 @@ export function isShellProvided(key) {
143
143
  export function resetEnvFileProvenanceForTests() {
144
144
  fileDerivedKeys.clear();
145
145
  }
146
+ function freshValueFromParsed(key, parsed) {
147
+ const envValue = process.env[key];
148
+ if (typeof envValue === "string" && envValue.trim() && !fileDerivedKeys.has(key)) {
149
+ return envValue;
150
+ }
151
+ if (parsed) {
152
+ const fileValue = parsed[key];
153
+ if (typeof fileValue === "string" && fileValue.trim())
154
+ return fileValue;
155
+ // A readable file without the key means a file-derived boot value is stale,
156
+ // not that the old value should be resurrected.
157
+ if (fileDerivedKeys.has(key))
158
+ return undefined;
159
+ }
160
+ if (typeof envValue === "string" && envValue.trim())
161
+ return envValue;
162
+ return undefined;
163
+ }
146
164
  /**
147
165
  * Resolve a credential NOW, in precedence order:
148
166
  * 1. a REAL environment variable (shell / spawn env) — the escape hatch wins;
@@ -171,23 +189,19 @@ export function freshSecretValue(...keys) {
171
189
  // variable still outranks the file.
172
190
  const parsed = parseEnvFile();
173
191
  for (const k of keys) {
174
- const envValue = process.env[k];
175
- if (typeof envValue === "string" && envValue.trim() && !fileDerivedKeys.has(k))
176
- return envValue;
177
- if (parsed) {
178
- const fileValue = parsed[k];
179
- if (typeof fileValue === "string" && fileValue.trim())
180
- return fileValue;
181
- // The file is readable and does not carry this alias, so a value seeded
182
- // from the file at boot is stale — it must not resurrect the credential.
183
- if (fileDerivedKeys.has(k))
184
- continue;
185
- }
186
- if (typeof envValue === "string" && envValue.trim())
187
- return envValue;
192
+ const value = freshValueFromParsed(k, parsed);
193
+ if (value !== undefined)
194
+ return value;
188
195
  }
189
196
  return undefined;
190
197
  }
198
+ /** Resolve one non-aliased environment value at access time. The same
199
+ * real-environment vs canonical-file precedence applies to configuration values
200
+ * that are not credentials, while a file-derived boot value is still superseded
201
+ * by a later readable file change. Never logs the value. */
202
+ export function freshEnvValue(key) {
203
+ return freshValueFromParsed(key, parseEnvFile());
204
+ }
191
205
  /** Whether a credential resolves to SOMETHING right now — presence only, so
192
206
  * status can be reported without a caller ever holding the value. */
193
207
  export function secretKeyPresent(...keys) {
@@ -209,24 +223,9 @@ export function freshSecretValues(keys) {
209
223
  const parsed = parseEnvFile();
210
224
  const out = {};
211
225
  for (const k of keys) {
212
- const envValue = process.env[k];
213
- if (typeof envValue === "string" && envValue.trim() && !fileDerivedKeys.has(k)) {
214
- out[k] = envValue;
215
- continue;
216
- }
217
- if (parsed) {
218
- const fileValue = parsed[k];
219
- if (typeof fileValue === "string" && fileValue.trim()) {
220
- out[k] = fileValue;
221
- continue;
222
- }
223
- // Readable file without the key: it is genuinely unset, so a stale
224
- // boot-seeded value must not resurrect it.
225
- if (fileDerivedKeys.has(k))
226
- continue;
227
- }
228
- if (typeof envValue === "string" && envValue.trim())
229
- out[k] = envValue;
226
+ const value = freshValueFromParsed(k, parsed);
227
+ if (value !== undefined)
228
+ out[k] = value;
230
229
  }
231
230
  return out;
232
231
  }
@@ -1 +1 @@
1
- {"version":3,"file":"env-file.js","sourceRoot":"","sources":["../src/env-file.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,4EAA4E;AAC5E,+EAA+E;AAC/E,EAAE;AACF,iFAAiF;AACjF,iFAAiF;AACjF,6EAA6E;AAC7E,8EAA8E;AAC9E,gFAAgF;AAChF,6EAA6E;AAC7E,2EAA2E;AAC3E,gFAAgF;AAChF,gCAAgC;AAChC,EAAE;AACF,kFAAkF;AAClF,8EAA8E;AAE9E,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;;;GAOG;AAC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,yEAAyE;IACzE,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAC9B,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACrB,MAAM,KAAK,GAAG,oBAAoB,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QAC9C,IAAI,KAAK,KAAK,SAAS;YAAE,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IAC1C,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -38,6 +38,7 @@ import { sanitizePanelUpdateNodeResult } from "../services/manager-update-error.
38
38
  import { formatQueueStatusPartialNote, getManifestPartialLeftover, } from "../services/manifest-partial.js";
39
39
  import { searchPanelNodes } from "../services/manager-node-search.js";
40
40
  import { isPanelAnsweredError } from "../services/panel-answered.js";
41
+ import { readWorkflowListReadiness, workflowListReadinessOf, } from "../services/panel-workflow-readiness.js";
41
42
  import { isPreExecutorRefusal } from "../services/panel-refusal.js";
42
43
  import { createSdkMcpServer, tool } from "@anthropic-ai/claude-agent-sdk";
43
44
  import { parse as parseYaml } from "yaml";
@@ -2645,6 +2646,32 @@ function carryPanelAnsweredMark(err, res) {
2645
2646
  });
2646
2647
  return res;
2647
2648
  }
2649
+ /** #1785 — preserve the Panel's typed workflow-list readiness refusal across the
2650
+ * bridge-to-ToolResult conversion. The refusal is an explicit answer, not a
2651
+ * silent read failure, and its distinction controls whether a concurrent
2652
+ * re-hello may be treated as successful healing. */
2653
+ const WORKFLOW_LIST_READINESS_RESULT = Symbol("panel.workflowListReadinessResult");
2654
+ function carryWorkflowListReadinessMark(err, res) {
2655
+ if (res?.isError !== true)
2656
+ return res;
2657
+ const refusal = workflowListReadinessOf(err);
2658
+ if (!refusal)
2659
+ return res;
2660
+ Object.defineProperty(res, WORKFLOW_LIST_READINESS_RESULT, {
2661
+ value: refusal,
2662
+ enumerable: false,
2663
+ configurable: true,
2664
+ });
2665
+ return res;
2666
+ }
2667
+ function workflowListReadinessResultOf(res) {
2668
+ if (res?.isError !== true)
2669
+ return null;
2670
+ const refusal = res[WORKFLOW_LIST_READINESS_RESULT];
2671
+ return refusal && typeof refusal === "object"
2672
+ ? readWorkflowListReadiness(refusal)
2673
+ : null;
2674
+ }
2648
2675
  /** True only for a ToolResult `ctx.call` produced from an error the BRIDGE minted
2649
2676
  * out of a received reply. A timeout, a routing refusal or a dead socket can never
2650
2677
  * carry this, whatever their text says — and neither can an error from a panel too
@@ -7391,6 +7418,17 @@ async function rebindWorkflowFence(ctx, opts) {
7391
7418
  const res = await ctx.call({ cmd: "workflow_list" }, 6000);
7392
7419
  syncFenceToCurrentTab();
7393
7420
  if (res?.isError) {
7421
+ const readiness = workflowListReadinessResultOf(res);
7422
+ if (readiness) {
7423
+ return {
7424
+ done: {
7425
+ status: "readiness_refused",
7426
+ before,
7427
+ detail: toolResultText(res),
7428
+ readiness,
7429
+ },
7430
+ };
7431
+ }
7394
7432
  return { done: await unreadableOrHealed(ctx, before, toolResultText(res)) };
7395
7433
  }
7396
7434
  parsed = parseToolResultJson(res);
@@ -7885,6 +7923,17 @@ panelGapNote = "") {
7885
7923
  `keeps throwing: ${RELOAD_TAB_REMEDY}` +
7886
7924
  `\n\nUNDERLYING CAUSE: ${r.detail}`,
7887
7925
  };
7926
+ case "readiness_refused":
7927
+ return {
7928
+ binding: "not_recovered",
7929
+ note: ` The panel ANSWERED the workflow_list probe with its typed reconnect-readiness ` +
7930
+ `refusal (${r.readiness.code}): the probe was not run, changed no workflow target, ` +
7931
+ `and the live workflow identity was not ready within the panel's bounded window. ` +
7932
+ `A concurrent re-hello or fence change is not a successful workflow_list proof, so ` +
7933
+ `this call did NOT restore graph binding. Retry after the panel reports readiness, or ` +
7934
+ `use panel_open_workflow(<path>) to explicitly re-establish the tab.` +
7935
+ `\n\nUNDERLYING CAUSE (quoted verbatim): ${r.detail}`,
7936
+ };
7888
7937
  case "unreadable":
7889
7938
  // ALWAYS not_recovered, with or without a prior fence (codex gate). The read
7890
7939
  // we just attempted FAILED, so nothing about this session was observed —
@@ -10838,7 +10887,7 @@ export function makePanelToolCtx(bridge, tabId, workflowTargets, onRunTicketOpen
10838
10887
  const res = await callOnce(cmd, timeoutMs, onDispatchedRid, (err) => {
10839
10888
  failure = err;
10840
10889
  });
10841
- return carryMidCommandDisconnectMark(failure, carryPanelAnsweredMark(failure, res));
10890
+ return carryWorkflowListReadinessMark(failure, carryMidCommandDisconnectMark(failure, carryPanelAnsweredMark(failure, res)));
10842
10891
  };
10843
10892
  // Human-in-the-loop confirmation for a DESTRUCTIVE op: render a yes/no card in
10844
10893
  // the panel and block on the user's pick. Returns false on decline, timeout, or