comfyui-mcp 0.52.168 → 0.52.170

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.
@@ -0,0 +1,25 @@
1
+ /** The prompt-id spelling shared by journal correlation and Panel map keys. */
2
+ export function canonicalPromptId(promptId) {
3
+ if (typeof promptId !== "string")
4
+ return undefined;
5
+ const canonical = promptId.trim();
6
+ return canonical || undefined;
7
+ }
8
+ export function buildCompletionReceipt(promptId, completionKey, accepted) {
9
+ const canonicalId = canonicalPromptId(promptId);
10
+ if (canonicalId === undefined ||
11
+ typeof completionKey !== "string" ||
12
+ completionKey.length === 0 ||
13
+ completionKey.length > 512) {
14
+ return undefined;
15
+ }
16
+ return {
17
+ type: "ack",
18
+ ok: accepted,
19
+ kind: "completion",
20
+ prompt_id: canonicalId,
21
+ completion_key: completionKey,
22
+ ...(accepted ? {} : { reason: "uncorrelated" }),
23
+ };
24
+ }
25
+ //# sourceMappingURL=completion-receipt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"completion-receipt.js","sourceRoot":"","sources":["../../src/orchestrator/completion-receipt.ts"],"names":[],"mappings":"AAkBA,+EAA+E;AAC/E,MAAM,UAAU,iBAAiB,CAAC,QAAiB;IACjD,IAAI,OAAO,QAAQ,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IACnD,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;IAClC,OAAO,SAAS,IAAI,SAAS,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,QAAiB,EACjB,aAAsB,EACtB,QAAiB;IAEjB,MAAM,WAAW,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAChD,IACE,WAAW,KAAK,SAAS;QACzB,OAAO,aAAa,KAAK,QAAQ;QACjC,aAAa,CAAC,MAAM,KAAK,CAAC;QAC1B,aAAa,CAAC,MAAM,GAAG,GAAG,EAC1B,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO;QACL,IAAI,EAAE,KAAK;QACX,EAAE,EAAE,QAAQ;QACZ,IAAI,EAAE,YAAY;QAClB,SAAS,EAAE,WAAW;QACtB,cAAc,EAAE,aAAa;QAC7B,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,cAAuB,EAAE,CAAC;KACzD,CAAC;AACJ,CAAC"}
@@ -136,6 +136,7 @@ import { QueueMonitor } from "../services/queue-monitor.js";
136
136
  import { formatQueueNote } from "./queue-note.js";
137
137
  import { liveStallSecondsValue, setLiveStallSeconds, stallThresholdMs, } from "../services/stall-threshold.js";
138
138
  import { RunCompletions, describe as describeCorrelation, } from "./run-completion-journal.js";
139
+ import { buildCompletionReceipt, canonicalPromptId } from "./completion-receipt.js";
139
140
  import { RunCompletionIdempotencyFence, scheduleRunCompletion, } from "./run-completion-idempotency.js";
140
141
  import { createRunCompletionWatchdog, resolveHistoryCompletion, resolveHistoryCompletionStatus, } from "./run-completion-watchdog.js";
141
142
  import { AskAnswers, preview as previewQuestion } from "./ask-answer-journal.js";
@@ -5039,16 +5040,30 @@ export async function runPanelOrchestrator() {
5039
5040
  ev.completion_key.length <= 512
5040
5041
  ? ev.completion_key
5041
5042
  : null;
5043
+ const promptId = canonicalPromptId(ev.prompt_id);
5044
+ // Correlation and Panel removal both use the trimmed spelling. Keep the
5045
+ // journal payload on that same representation so a lost-ack replay can
5046
+ // hit the duplicate fence instead of creating a second agent turn.
5047
+ const completionPayload = promptId !== undefined
5048
+ ? ev.prompt_id === promptId
5049
+ ? evForTab
5050
+ : { ...evForTab, prompt_id: promptId }
5051
+ : typeof ev.prompt_id === "string"
5052
+ ? (() => {
5053
+ const { prompt_id: _whitespaceOnlyPromptId, ...withoutPromptId } = evForTab;
5054
+ return withoutPromptId;
5055
+ })()
5056
+ : evForTab;
5042
5057
  const alreadyKnown = completionKey !== null &&
5043
- typeof ev.prompt_id === "string" &&
5058
+ promptId !== undefined &&
5044
5059
  RunCompletions.hasCompletionReceipt(completionKey, {
5045
- promptId: ev.prompt_id,
5060
+ promptId,
5046
5061
  key: event.tab_id,
5047
5062
  conversation: agentKeyFor(event.tab_id),
5048
5063
  });
5049
5064
  const entry = alreadyKnown
5050
5065
  ? null
5051
- : RunCompletions.record(event.tab_id, evForTab, {
5066
+ : RunCompletions.record(event.tab_id, blindStrippedCompletion(completionPayload), {
5052
5067
  conversation: agentKeyFor(event.tab_id),
5053
5068
  });
5054
5069
  // #2591 — `completion_key` is unavailable on older/replayed panel
@@ -5061,17 +5076,15 @@ export async function runPanelOrchestrator() {
5061
5076
  RunCompletions.suppressAlreadyDelivered(entry.token);
5062
5077
  }
5063
5078
  const receiptAccepted = completionKey !== null &&
5064
- typeof ev.prompt_id === "string" &&
5065
- ev.prompt_id.length > 0 &&
5066
- RunCompletions.acceptsCompletionReceipt(completionKey, ev.prompt_id, event.tab_id, agentKeyFor(event.tab_id));
5067
- if (receiptAccepted) {
5068
- bridge.push({
5069
- type: "ack",
5070
- ok: true,
5071
- kind: "completion",
5072
- prompt_id: ev.prompt_id,
5073
- completion_key: completionKey,
5074
- }, event.tab_id);
5079
+ promptId !== undefined &&
5080
+ RunCompletions.acceptsCompletionReceipt(completionKey, promptId, event.tab_id, agentKeyFor(event.tab_id));
5081
+ // #2700 / Panel #925 recurrence — the frame has reached the journal
5082
+ // even when the ownership gate refuses its receipt. Tell the panel
5083
+ // that explicitly so it retires the transport retry instead of
5084
+ // spending its bounded replay budget on a frame we already hold.
5085
+ const completionReceipt = buildCompletionReceipt(promptId, completionKey, receiptAccepted);
5086
+ if (completionReceipt) {
5087
+ bridge.push(completionReceipt, event.tab_id);
5075
5088
  }
5076
5089
  logger.info(entry
5077
5090
  ? `[panel-orchestrator] tab ${event.tab_id.slice(0, 8)} run completion for ${describeCorrelation(entry.correlation)}${entry.alreadyDelivered ? " (suppressed as already delivered)" : entry.possibleRepeat ? " (flagged as a possible repeat)" : ""}`