@civitai/blocks-react 0.42.0 → 0.43.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.
Files changed (38) hide show
  1. package/README.md +46 -4
  2. package/dist/hooks/useBuzzPurchase.d.ts +6 -0
  3. package/dist/hooks/useBuzzPurchase.d.ts.map +1 -1
  4. package/dist/hooks/useBuzzPurchase.js +8 -1
  5. package/dist/hooks/useBuzzPurchase.js.map +1 -1
  6. package/dist/hooks/useBuzzWorkflow.d.ts +145 -1
  7. package/dist/hooks/useBuzzWorkflow.d.ts.map +1 -1
  8. package/dist/hooks/useBuzzWorkflow.js +172 -1
  9. package/dist/hooks/useBuzzWorkflow.js.map +1 -1
  10. package/dist/hooks/useCheckpointPicker.d.ts +0 -7
  11. package/dist/hooks/useCheckpointPicker.d.ts.map +1 -1
  12. package/dist/hooks/useCheckpointPicker.js +2 -8
  13. package/dist/hooks/useCheckpointPicker.js.map +1 -1
  14. package/dist/hooks/useImageUpload.d.ts +1 -1
  15. package/dist/hooks/useImageUpload.d.ts.map +1 -1
  16. package/dist/hooks/useImageUpload.js +11 -4
  17. package/dist/hooks/useImageUpload.js.map +1 -1
  18. package/dist/hooks/usePublishGenerationOutputs.d.ts +11 -3
  19. package/dist/hooks/usePublishGenerationOutputs.d.ts.map +1 -1
  20. package/dist/hooks/usePublishGenerationOutputs.js +13 -2
  21. package/dist/hooks/usePublishGenerationOutputs.js.map +1 -1
  22. package/dist/hooks/useResourcePicker.js +2 -2
  23. package/dist/hooks/useResourcePicker.js.map +1 -1
  24. package/dist/index.d.ts +1 -1
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +1 -1
  27. package/dist/index.js.map +1 -1
  28. package/dist/internal/iframeTransport.js +1 -1
  29. package/dist/internal/iframeTransport.js.map +1 -1
  30. package/dist/internal/mockHost.d.ts +31 -0
  31. package/dist/internal/mockHost.d.ts.map +1 -1
  32. package/dist/internal/mockHost.js +31 -0
  33. package/dist/internal/mockHost.js.map +1 -1
  34. package/dist/internal/requestTimeouts.d.ts +62 -0
  35. package/dist/internal/requestTimeouts.d.ts.map +1 -0
  36. package/dist/internal/requestTimeouts.js +168 -0
  37. package/dist/internal/requestTimeouts.js.map +1 -0
  38. package/package.json +5 -5
package/README.md CHANGED
@@ -216,9 +216,24 @@ const body: WorkflowBody = {
216
216
  modelVersionId,
217
217
  params: { prompt: userPrompt },
218
218
  };
219
- await estimate(body); // status 'estimating' → 'confirming' (cost in result.cost.total)
220
- const snap = await submit(body); // status 'submitting' → 'polling'; returns a workflowId
221
- await poll(snap.workflowId); // you loop this on a backoff until terminal
219
+ // 🔴 estimate() REJECTS when the reply carries no usable price. ALWAYS catch it.
220
+ let priced = false;
221
+ try {
222
+ await estimate(body); // status 'estimating' → 'confirming' (cost in result.cost.total)
223
+ priced = true;
224
+ } catch (err) {
225
+ if (!(err instanceof WorkflowEstimateError)) throw err;
226
+ // status is now 'error'. Branch on err.code ('failed' | 'no-cost'). The
227
+ // server's reason is on err.snapshot.error — server-authored and unsanitised,
228
+ // so log it / show it in a dev-facing surface rather than as trusted copy.
229
+ // err.message is a generic summary safe to print.
230
+ logForDebugging(err.snapshot.error);
231
+ showError('This configuration cannot be priced right now.');
232
+ }
233
+ if (priced) {
234
+ const snap = await submit(body); // status 'submitting' → 'polling'; returns a workflowId
235
+ await poll(snap.workflowId); // you loop this on a backoff until terminal
236
+ }
222
237
  ```
223
238
 
224
239
  **Status semantics** (gotcha #8/#9/#10):
@@ -231,9 +246,36 @@ await poll(snap.workflowId); // you loop this on a backoff until terminal
231
246
  - The hook does **not** auto-poll. After `submit` flips status to `'polling'`,
232
247
  the **caller** runs a `useEffect` that calls `poll(workflowId)` on a backoff
233
248
  until the snapshot is terminal (`succeeded | failed | canceled | expired`).
234
- - An over-budget / rejected submit comes back as a **resolved** snapshot with
249
+ - An over-budget / rejected **submit** comes back as a **resolved** snapshot with
235
250
  `status: 'failed'` + an `error` string — the transport resolves the reply, it
236
251
  doesn't throw. Check `snap.status`, not just `try/catch`.
252
+ - **`estimate` is the exception to that rule** (`@civitai/blocks-react@0.43.0+`).
253
+ It **rejects** with a `WorkflowEstimateError` when the reply carries no usable
254
+ price, rather than resolving a snapshot with no `cost`. Two things produce
255
+ that, and `err.code` tells them apart: `'failed'` (the estimate errored
256
+ server-side) and `'no-cost'` (an otherwise-successful reply that simply has no
257
+ price).
258
+ Before that version both cases resolved, so a block that correctly gates
259
+ Confirm on `typeof cost === 'number'` rendered a dialog it could never confirm
260
+ ("Cost unavailable") and the server's reason was discarded — civitai/civitai#4159.
261
+ Note this also fires in **moderator review preview**, where the host answers
262
+ every workflow request with `'not available in review preview'`: without a
263
+ `catch`, a reviewer's first click becomes an unhandled rejection.
264
+ To exercise your `catch` locally, set the mock host's
265
+ `generation.failEstimate: 'failed' | 'no-cost'`.
266
+ - **Where to read the reason:** `err.snapshot.error` — that is the diagnostic
267
+ read, and recovering it is the whole point of the fix. It is
268
+ **server-authored and unsanitised** (raw upstream text, including database
269
+ constraint names, can reach it), so log it or show it in a developer-facing
270
+ surface; don't render it as trusted copy.
271
+ `err.message` is deliberately **generic** and names the code
272
+ (`estimate did not return a usable price (no-cost) — reason on .snapshot.error`)
273
+ because `message` is what an uncaught rejection prints and what an error
274
+ reporter ships by default. Branch on `err.code`; print `err.message`; read
275
+ `err.snapshot.error` when you are debugging.
276
+ - A cost of **`0` is a real price**, not a missing one (the orchestrator whatif
277
+ prices a cache hit at 0). `estimate` resolves it; only a non-numeric
278
+ `cost.total` rejects.
237
279
 
238
280
  > **Estimate must mirror submit** (gotcha #59): build the params for `estimate`
239
281
  > with the *exact* same logic as `submit` — same seed decision especially. The
@@ -4,6 +4,12 @@
4
4
  * balance increased; the new balance is included if the host reports it.
5
5
  * The insufficient-budget recovery path for {@link useBuzzWorkflow}.
6
6
  *
7
+ * 🔴 HUMAN-GATED: the reply comes when the viewer closes the modal, and a
8
+ * payment flow is nowhere near a ~30s round-trip — so this passes
9
+ * {@link HUMAN_INTERACTION_TIMEOUT_MS}. On the default the promise rejected
10
+ * mid-checkout, which reads to the block as "purchase failed" for a purchase
11
+ * that may well have SUCCEEDED (same defect class as civitai/civitai#4158).
12
+ *
7
13
  * @example
8
14
  * const { openPurchaseModal } = useBuzzPurchase();
9
15
  * const { purchased, newBalance } = await openPurchaseModal(suggestedAmount);
@@ -1 +1 @@
1
- {"version":3,"file":"useBuzzPurchase.d.ts","sourceRoot":"","sources":["../../src/hooks/useBuzzPurchase.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,IAAI;IACjC,iBAAiB,EAAE,CAAC,eAAe,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACvG,CAUA"}
1
+ {"version":3,"file":"useBuzzPurchase.d.ts","sourceRoot":"","sources":["../../src/hooks/useBuzzPurchase.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,IAAI;IACjC,iBAAiB,EAAE,CAAC,eAAe,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACvG,CAWA"}
@@ -1,4 +1,5 @@
1
1
  import { useCallback } from 'react';
2
+ import { HUMAN_INTERACTION_TIMEOUT_MS } from '../internal/requestTimeouts.js';
2
3
  import { getTransport } from '../internal/singleton.js';
3
4
  import { sendTypedRequest } from '../internal/transport.js';
4
5
  /**
@@ -7,6 +8,12 @@ import { sendTypedRequest } from '../internal/transport.js';
7
8
  * balance increased; the new balance is included if the host reports it.
8
9
  * The insufficient-budget recovery path for {@link useBuzzWorkflow}.
9
10
  *
11
+ * 🔴 HUMAN-GATED: the reply comes when the viewer closes the modal, and a
12
+ * payment flow is nowhere near a ~30s round-trip — so this passes
13
+ * {@link HUMAN_INTERACTION_TIMEOUT_MS}. On the default the promise rejected
14
+ * mid-checkout, which reads to the block as "purchase failed" for a purchase
15
+ * that may well have SUCCEEDED (same defect class as civitai/civitai#4158).
16
+ *
10
17
  * @example
11
18
  * const { openPurchaseModal } = useBuzzPurchase();
12
19
  * const { purchased, newBalance } = await openPurchaseModal(suggestedAmount);
@@ -14,7 +21,7 @@ import { sendTypedRequest } from '../internal/transport.js';
14
21
  */
15
22
  export function useBuzzPurchase() {
16
23
  const openPurchaseModal = useCallback(async (suggestedAmount) => {
17
- const { purchased, newBalance } = await sendTypedRequest(getTransport(), { type: 'OPEN_BUZZ_PURCHASE', payload: { suggestedAmount } }, 'BUZZ_PURCHASE_RESULT');
24
+ const { purchased, newBalance } = await sendTypedRequest(getTransport(), { type: 'OPEN_BUZZ_PURCHASE', payload: { suggestedAmount } }, 'BUZZ_PURCHASE_RESULT', { timeoutMs: HUMAN_INTERACTION_TIMEOUT_MS });
18
25
  return { purchased, newBalance };
19
26
  }, []);
20
27
  return { openPurchaseModal };
@@ -1 +1 @@
1
- {"version":3,"file":"useBuzzPurchase.js","sourceRoot":"","sources":["../../src/hooks/useBuzzPurchase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe;IAG7B,MAAM,iBAAiB,GAAG,WAAW,CAAC,KAAK,EAAE,eAAwB,EAAE,EAAE;QACvE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,MAAM,gBAAgB,CACtD,YAAY,EAAE,EACd,EAAE,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,EAAE,eAAe,EAAE,EAAE,EAC5D,sBAAsB,CACvB,CAAC;QACF,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;IACnC,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC/B,CAAC"}
1
+ {"version":3,"file":"useBuzzPurchase.js","sourceRoot":"","sources":["../../src/hooks/useBuzzPurchase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,eAAe;IAG7B,MAAM,iBAAiB,GAAG,WAAW,CAAC,KAAK,EAAE,eAAwB,EAAE,EAAE;QACvE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,MAAM,gBAAgB,CACtD,YAAY,EAAE,EACd,EAAE,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,EAAE,eAAe,EAAE,EAAE,EAC5D,sBAAsB,EACtB,EAAE,SAAS,EAAE,4BAA4B,EAAE,CAC5C,CAAC;QACF,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;IACnC,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC/B,CAAC"}
@@ -71,6 +71,116 @@ export interface WatchWorkflowOptions {
71
71
  */
72
72
  maxRetries?: number;
73
73
  }
74
+ /**
75
+ * Thrown by {@link UseBuzzWorkflowReturn.estimate} when the host's reply does not
76
+ * carry a usable price — either because the estimate ERRORED, or because it came
77
+ * back without a numeric `cost.total`.
78
+ *
79
+ * 🔴 WHY THIS EXISTS — civitai/civitai#4159. A host-side `blocks.estimateWorkflow`
80
+ * throw is not propagated to the block as a rejection; it CANNOT be, because the
81
+ * reply crosses `postMessage`. The host instead posts a well-formed
82
+ * `ESTIMATE_RESULT` carrying its `failureSnapshot(err)` —
83
+ * `{ workflowId: 'failed', status: 'failed', error: '<server message>' }`, with
84
+ * **no `cost`** (see the host's `failureSnapshot.ts`, whose own comment states
85
+ * the block is expected to read `status`/`error`).
86
+ *
87
+ * Until this guard, `estimate()` resolved that snapshot as a SUCCESS and moved
88
+ * the hook to `'confirming'`. A correctly fail-closed block — one that gates
89
+ * Confirm on `typeof snapshot.cost?.total === 'number'` — then rendered a
90
+ * confirm dialog reading "Cost unavailable" with Confirm permanently disabled,
91
+ * and the server's own explanation (already present on `snapshot.error`) was
92
+ * discarded on the floor. The control was dead AND undiagnosable: a caller
93
+ * could not tell "priced at 0" from "the estimate errored".
94
+ *
95
+ * 🔴 TWO PRODUCERS, ONE OBSERVABLE — which is why {@link WorkflowEstimateError.code}
96
+ * exists and why the guard is not keyed on `status` alone. The server's
97
+ * `snapshotFromWorkflow` omits `cost` from an otherwise-SUCCESSFUL snapshot
98
+ * whenever the whatIf reply has no numeric total, so a `{status:'pending'}` reply
99
+ * with no `error` at all produces the identical dead control. A `status`-only
100
+ * guard would be INERT for that half. The two are distinguishable only by
101
+ * `snapshot.error` / `workflowId === 'failed'` — exactly the fields the original
102
+ * incident discarded, which is why it is still unknown which producer caused it.
103
+ *
104
+ * So an unusable estimate now REJECTS, which is what every caller's existing
105
+ * `try/catch` around `estimate()` is already shaped for. The snapshot is carried
106
+ * on the error rather than dropped, so nothing that was reachable before is lost
107
+ * — a caller that wants the raw reply reads `err.snapshot`.
108
+ *
109
+ * 🔴 WHERE THE REASON IS — READ `.snapshot.error`, NOT `message`. Recovering that
110
+ * string is the entire point of this class, so getting this the wrong way round
111
+ * reproduces the bug one layer down: a caller who logs `message` expecting the
112
+ * server's words gets a constant and is exactly as stuck as before.
113
+ *
114
+ * - {@link WorkflowEstimateError.snapshot}`.error` — the server's own words,
115
+ * verbatim. **Server-authored and UNSANITISED**: civitai's `errorHandling.ts`
116
+ * documents that raw upstream text — Prisma/`pg` column and constraint names
117
+ * among it — can reach this field. Log it, or show it in a developer-facing
118
+ * error surface; do NOT render it as trusted copy.
119
+ * - {@link WorkflowEstimateError.message} — a CONSTANT template with only
120
+ * `code` interpolated. It contains no server text and nothing to sanitise, so
121
+ * it is safe to print. That is deliberate: `message` is what an uncaught
122
+ * rejection prints and what a third-party block's error reporter ships
123
+ * upstream by default, and this is a package consumed by third-party code.
124
+ * Its exact wording is NOT a contract.
125
+ * - {@link WorkflowEstimateError.code} — the only stable branch target.
126
+ *
127
+ * 🔴 DO NOT "SIMPLIFY" THIS BY PUTTING `snapshot.error` BACK ON `message`. The
128
+ * two fields are split on purpose and the split is what keeps database internals
129
+ * off a third party's default-printed surface. `test/useBuzzWorkflow.test.tsx`
130
+ * pins it with a realistic `Unique constraint failed: Key (email)=(…)` fixture.
131
+ *
132
+ * 🔴 NOT APPLIED TO `submit`, and the reason is narrower than it looks. On
133
+ * `WORKFLOW_SUBMITTED` there are likewise TWO producers, indistinguishable by
134
+ * `status`: budget/cap REJECTIONS, which are a documented outcome the block
135
+ * recovers from (open a top-up flow) and which carry a `cost`; and caught server
136
+ * exceptions posted via the SAME `failureSnapshot(err)` used above, which do not.
137
+ * The `#4159` defect is therefore live on `submit` too, discriminated by `cost`
138
+ * presence rather than by `status`. Fixing it there is a separate change with its
139
+ * own blast radius on the recovery path (a fix MUST keep the budget-rejection arm
140
+ * RESOLVING, or the top-up flow breaks) and is deliberately NOT attempted here —
141
+ * so `submit` is left resolving BOTH, and the accompanying test pins only the
142
+ * budget-rejection producer, not a claim that submit is correct.
143
+ *
144
+ * 🔴 TRACKED, NOT FORGOTTEN: civitai/civitai-app-starters#251. Read it before
145
+ * touching `submit`'s failure handling.
146
+ */
147
+ export declare class WorkflowEstimateError extends Error {
148
+ /**
149
+ * WHICH PRODUCER this was, structurally — so a caller branches on an enum
150
+ * rather than on prose. It is the ONLY stable branch target here:
151
+ * `snapshot.error` is server-authored and can change without notice, and
152
+ * {@link WorkflowEstimateError.message} is a generic summary whose exact
153
+ * wording is not a contract either.
154
+ *
155
+ * - `'failed'` — the reply's `status` is `'failed'`. USUALLY that means
156
+ * `blocks.estimateWorkflow` threw server-side and the host posted its
157
+ * `failureSnapshot(err)` (so `snapshot.error` carries the server's reason and
158
+ * there is no `cost`) — but it is NOT only that: a whatIf the orchestrator
159
+ * itself reports as failed maps to `'failed'` through the server's own
160
+ * `ORCH_STATUS_MAP`, and such a reply CAN carry a numeric `cost`. Both are
161
+ * rejected: a failed estimate is not a quote you may spend against, whether
162
+ * or not a number came back with it. Do not read this code as "the host
163
+ * threw" — read it as "the estimate did not succeed".
164
+ * - `'no-cost'` — a NON-failed reply with no numeric `cost.total`. There is
165
+ * usually no `snapshot.error` to explain it, which makes it the harder of the
166
+ * two to diagnose from the block side.
167
+ */
168
+ readonly code: 'failed' | 'no-cost';
169
+ /**
170
+ * The snapshot the host replied with, VERBATIM — including `snapshot.error`,
171
+ * the server's own words, when there are any.
172
+ *
173
+ * 🔴 `snapshot.error` IS SERVER-AUTHORED AND UNSANITISED. It is where the
174
+ * reason lives (reading it is the documented way to diagnose an estimate that
175
+ * will not price — the whole point of civitai/civitai#4159), but civitai's
176
+ * `errorHandling.ts` documents that raw upstream text — Prisma/`pg` column and
177
+ * constraint names among it — can reach that field. Log it, show it in a
178
+ * developer-facing error surface, do NOT render it as trusted copy and do not
179
+ * ship it to a third-party error tracker without thinking about it.
180
+ */
181
+ readonly snapshot: BlockWorkflowSnapshot;
182
+ constructor(snapshot: BlockWorkflowSnapshot, code: 'failed' | 'no-cost');
183
+ }
74
184
  /** Optional per-submit controls. */
75
185
  export interface SubmitWorkflowOptions {
76
186
  /**
@@ -83,6 +193,28 @@ export interface SubmitWorkflowOptions {
83
193
  idempotencyKey?: string;
84
194
  }
85
195
  interface UseBuzzWorkflowReturn {
196
+ /**
197
+ * Price a workflow without queueing it. Resolves ONLY with a snapshot that
198
+ * carries a numeric `cost.total`.
199
+ *
200
+ * 🔴 REJECTS with {@link WorkflowEstimateError} when the reply is unusable —
201
+ * the estimate errored server-side, or it came back with no numeric cost.
202
+ * Wrap every call in `try/catch`; see that class for why resolving such a
203
+ * reply was civitai/civitai#4159.
204
+ *
205
+ * 🔴 THIS INCLUDES MODERATOR REVIEW PREVIEW, a behaviour change worth knowing
206
+ * before you ship. While an app is under review the host short-circuits every
207
+ * workflow request with `failureSnapshot('not available in review preview')`,
208
+ * so `estimate()` now rejects there where it used to resolve. That is the
209
+ * correct reading — no estimate happened — and it is why the catch is not
210
+ * optional: a block without one turns the reviewer's first click into an
211
+ * unhandled rejection, at exactly the moment it is meant to look healthy. A
212
+ * block that catches shows the reviewer the reason instead.
213
+ *
214
+ * `result` is updated to the returned snapshot BEFORE any rejection, so a
215
+ * failed estimate can never leave a previous, differently-configured
216
+ * estimate's price sitting in `result` for a Confirm gate to read.
217
+ */
86
218
  estimate: (body: WorkflowBody) => Promise<BlockWorkflowSnapshot>;
87
219
  submit: (body: WorkflowBody, options?: SubmitWorkflowOptions) => Promise<BlockWorkflowSnapshot>;
88
220
  /**
@@ -178,7 +310,19 @@ interface UseBuzzWorkflowReturn {
178
310
  * modelVersionId,
179
311
  * params: { prompt: 'a cat' },
180
312
  * };
181
- * await estimate(body); // status 'estimating' → 'confirming' (cost in result.cost.total)
313
+ * // 🔴 estimate() REJECTS when the reply carries no usable price — an errored
314
+ * // estimate, or one that came back with no numeric cost. ALWAYS catch it.
315
+ * try {
316
+ * await estimate(body); // status 'estimating' → 'confirming' (cost in result.cost.total)
317
+ * } catch (err) {
318
+ * // status is now 'error'; `result` holds the unusable snapshot, never a
319
+ * // STALE priced one. Branch on err.code ('failed' | 'no-cost'); the server's
320
+ * // reason is on err.snapshot.error (unsanitised — log it, don't render it as
321
+ * // trusted copy). See WorkflowEstimateError.
322
+ * if (!(err instanceof WorkflowEstimateError)) throw err;
323
+ * logForDebugging(err.snapshot.error);
324
+ * showError('This configuration cannot be priced right now.');
325
+ * }
182
326
  * const snap = await submit(body); // status 'submitting' → 'polling'; returns a workflowId
183
327
  * const done = await watch(snap.workflowId, { onUpdate: render }); // → terminal
184
328
  */
@@ -1 +1 @@
1
- {"version":3,"file":"useBuzzWorkflow.d.ts","sourceRoot":"","sources":["../../src/hooks/useBuzzWorkflow.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AA8BnG;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAW7C,iEAAiE;AACjE,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACrD;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAyBD,oCAAoC;AACpC,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACjE,MAAM,EAAE,CACN,IAAI,EAAE,YAAY,EAClB,OAAO,CAAC,EAAE,qBAAqB,KAC5B,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACpC;;;OAGG;IACH,IAAI,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC7D;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,KAAK,EAAE,CACL,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAA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by {@link UseBuzzWorkflowReturn.estimate} when the host's reply does not
77
+ * carry a usable price — either because the estimate ERRORED, or because it came
78
+ * back without a numeric `cost.total`.
79
+ *
80
+ * 🔴 WHY THIS EXISTS — civitai/civitai#4159. A host-side `blocks.estimateWorkflow`
81
+ * throw is not propagated to the block as a rejection; it CANNOT be, because the
82
+ * reply crosses `postMessage`. The host instead posts a well-formed
83
+ * `ESTIMATE_RESULT` carrying its `failureSnapshot(err)` —
84
+ * `{ workflowId: 'failed', status: 'failed', error: '<server message>' }`, with
85
+ * **no `cost`** (see the host's `failureSnapshot.ts`, whose own comment states
86
+ * the block is expected to read `status`/`error`).
87
+ *
88
+ * Until this guard, `estimate()` resolved that snapshot as a SUCCESS and moved
89
+ * the hook to `'confirming'`. A correctly fail-closed block — one that gates
90
+ * Confirm on `typeof snapshot.cost?.total === 'number'` — then rendered a
91
+ * confirm dialog reading "Cost unavailable" with Confirm permanently disabled,
92
+ * and the server's own explanation (already present on `snapshot.error`) was
93
+ * discarded on the floor. The control was dead AND undiagnosable: a caller
94
+ * could not tell "priced at 0" from "the estimate errored".
95
+ *
96
+ * 🔴 TWO PRODUCERS, ONE OBSERVABLE — which is why {@link WorkflowEstimateError.code}
97
+ * exists and why the guard is not keyed on `status` alone. The server's
98
+ * `snapshotFromWorkflow` omits `cost` from an otherwise-SUCCESSFUL snapshot
99
+ * whenever the whatIf reply has no numeric total, so a `{status:'pending'}` reply
100
+ * with no `error` at all produces the identical dead control. A `status`-only
101
+ * guard would be INERT for that half. The two are distinguishable only by
102
+ * `snapshot.error` / `workflowId === 'failed'` — exactly the fields the original
103
+ * incident discarded, which is why it is still unknown which producer caused it.
104
+ *
105
+ * So an unusable estimate now REJECTS, which is what every caller's existing
106
+ * `try/catch` around `estimate()` is already shaped for. The snapshot is carried
107
+ * on the error rather than dropped, so nothing that was reachable before is lost
108
+ * — a caller that wants the raw reply reads `err.snapshot`.
109
+ *
110
+ * 🔴 WHERE THE REASON IS — READ `.snapshot.error`, NOT `message`. Recovering that
111
+ * string is the entire point of this class, so getting this the wrong way round
112
+ * reproduces the bug one layer down: a caller who logs `message` expecting the
113
+ * server's words gets a constant and is exactly as stuck as before.
114
+ *
115
+ * - {@link WorkflowEstimateError.snapshot}`.error` — the server's own words,
116
+ * verbatim. **Server-authored and UNSANITISED**: civitai's `errorHandling.ts`
117
+ * documents that raw upstream text — Prisma/`pg` column and constraint names
118
+ * among it — can reach this field. Log it, or show it in a developer-facing
119
+ * error surface; do NOT render it as trusted copy.
120
+ * - {@link WorkflowEstimateError.message} — a CONSTANT template with only
121
+ * `code` interpolated. It contains no server text and nothing to sanitise, so
122
+ * it is safe to print. That is deliberate: `message` is what an uncaught
123
+ * rejection prints and what a third-party block's error reporter ships
124
+ * upstream by default, and this is a package consumed by third-party code.
125
+ * Its exact wording is NOT a contract.
126
+ * - {@link WorkflowEstimateError.code} — the only stable branch target.
127
+ *
128
+ * 🔴 DO NOT "SIMPLIFY" THIS BY PUTTING `snapshot.error` BACK ON `message`. The
129
+ * two fields are split on purpose and the split is what keeps database internals
130
+ * off a third party's default-printed surface. `test/useBuzzWorkflow.test.tsx`
131
+ * pins it with a realistic `Unique constraint failed: Key (email)=(…)` fixture.
132
+ *
133
+ * 🔴 NOT APPLIED TO `submit`, and the reason is narrower than it looks. On
134
+ * `WORKFLOW_SUBMITTED` there are likewise TWO producers, indistinguishable by
135
+ * `status`: budget/cap REJECTIONS, which are a documented outcome the block
136
+ * recovers from (open a top-up flow) and which carry a `cost`; and caught server
137
+ * exceptions posted via the SAME `failureSnapshot(err)` used above, which do not.
138
+ * The `#4159` defect is therefore live on `submit` too, discriminated by `cost`
139
+ * presence rather than by `status`. Fixing it there is a separate change with its
140
+ * own blast radius on the recovery path (a fix MUST keep the budget-rejection arm
141
+ * RESOLVING, or the top-up flow breaks) and is deliberately NOT attempted here —
142
+ * so `submit` is left resolving BOTH, and the accompanying test pins only the
143
+ * budget-rejection producer, not a claim that submit is correct.
144
+ *
145
+ * 🔴 TRACKED, NOT FORGOTTEN: civitai/civitai-app-starters#251. Read it before
146
+ * touching `submit`'s failure handling.
147
+ */
148
+ export class WorkflowEstimateError extends Error {
149
+ /**
150
+ * WHICH PRODUCER this was, structurally — so a caller branches on an enum
151
+ * rather than on prose. It is the ONLY stable branch target here:
152
+ * `snapshot.error` is server-authored and can change without notice, and
153
+ * {@link WorkflowEstimateError.message} is a generic summary whose exact
154
+ * wording is not a contract either.
155
+ *
156
+ * - `'failed'` — the reply's `status` is `'failed'`. USUALLY that means
157
+ * `blocks.estimateWorkflow` threw server-side and the host posted its
158
+ * `failureSnapshot(err)` (so `snapshot.error` carries the server's reason and
159
+ * there is no `cost`) — but it is NOT only that: a whatIf the orchestrator
160
+ * itself reports as failed maps to `'failed'` through the server's own
161
+ * `ORCH_STATUS_MAP`, and such a reply CAN carry a numeric `cost`. Both are
162
+ * rejected: a failed estimate is not a quote you may spend against, whether
163
+ * or not a number came back with it. Do not read this code as "the host
164
+ * threw" — read it as "the estimate did not succeed".
165
+ * - `'no-cost'` — a NON-failed reply with no numeric `cost.total`. There is
166
+ * usually no `snapshot.error` to explain it, which makes it the harder of the
167
+ * two to diagnose from the block side.
168
+ */
169
+ code;
170
+ /**
171
+ * The snapshot the host replied with, VERBATIM — including `snapshot.error`,
172
+ * the server's own words, when there are any.
173
+ *
174
+ * 🔴 `snapshot.error` IS SERVER-AUTHORED AND UNSANITISED. It is where the
175
+ * reason lives (reading it is the documented way to diagnose an estimate that
176
+ * will not price — the whole point of civitai/civitai#4159), but civitai's
177
+ * `errorHandling.ts` documents that raw upstream text — Prisma/`pg` column and
178
+ * constraint names among it — can reach that field. Log it, show it in a
179
+ * developer-facing error surface, do NOT render it as trusted copy and do not
180
+ * ship it to a third-party error tracker without thinking about it.
181
+ */
182
+ snapshot;
183
+ constructor(snapshot, code) {
184
+ // 🔴 GENERIC, AND DELIBERATELY NOT `snapshot.error`. `message` is the field an
185
+ // uncaught rejection PRINTS and the field a third-party block's error
186
+ // reporter ships upstream by default — so putting the raw server string here
187
+ // would put database internals (constraint names, `Key (email)=(…) already
188
+ // exists.`) on the default-printed surface of somebody else's code. Exposure
189
+ // to the block is identical either way (`snapshot.error` was always on the
190
+ // wire), so routing the raw text to `.snapshot.error` alone costs a
191
+ // deliberate debugger nothing and changes only the DISPOSITION. `code` is
192
+ // carried IN the message so an uncaught rejection is still self-describing.
193
+ super(`estimate did not return a usable price (${code}) — reason on .snapshot.error`);
194
+ this.name = 'WorkflowEstimateError';
195
+ this.code = code;
196
+ this.snapshot = snapshot;
197
+ }
198
+ }
75
199
  /**
76
200
  * Orchestrates the estimate → confirm → submit → poll dance through the
77
201
  * host-mediated `postMessage` path.
@@ -122,7 +246,19 @@ function sleep(ms, signal) {
122
246
  * modelVersionId,
123
247
  * params: { prompt: 'a cat' },
124
248
  * };
125
- * await estimate(body); // status 'estimating' → 'confirming' (cost in result.cost.total)
249
+ * // 🔴 estimate() REJECTS when the reply carries no usable price — an errored
250
+ * // estimate, or one that came back with no numeric cost. ALWAYS catch it.
251
+ * try {
252
+ * await estimate(body); // status 'estimating' → 'confirming' (cost in result.cost.total)
253
+ * } catch (err) {
254
+ * // status is now 'error'; `result` holds the unusable snapshot, never a
255
+ * // STALE priced one. Branch on err.code ('failed' | 'no-cost'); the server's
256
+ * // reason is on err.snapshot.error (unsanitised — log it, don't render it as
257
+ * // trusted copy). See WorkflowEstimateError.
258
+ * if (!(err instanceof WorkflowEstimateError)) throw err;
259
+ * logForDebugging(err.snapshot.error);
260
+ * showError('This configuration cannot be priced right now.');
261
+ * }
126
262
  * const snap = await submit(body); // status 'submitting' → 'polling'; returns a workflowId
127
263
  * const done = await watch(snap.workflowId, { onUpdate: render }); // → terminal
128
264
  */
@@ -135,7 +271,42 @@ export function useBuzzWorkflow() {
135
271
  setStatus('estimating');
136
272
  try {
137
273
  const { snapshot } = await sendTypedRequest(getTransport(), { type: 'ESTIMATE_WORKFLOW', payload: { body } }, 'ESTIMATE_RESULT', { timeoutMs: WORKFLOW_REQUEST_TIMEOUT_MS });
274
+ // 🔴 PUBLISH THE SNAPSHOT BEFORE ANY REJECTION BELOW. `result` is what the
275
+ // README documents as where the cost lives, so a block may gate its Confirm
276
+ // on `typeof result.cost?.total === 'number'` rather than on the returned
277
+ // value. If the throw jumped over this line, a FAILED estimate would leave
278
+ // the PREVIOUS estimate's snapshot in place and that gate would read the
279
+ // OLD config's price — a live control quoting the wrong number on a money
280
+ // path, which is strictly worse than the dead control this PR exists to
281
+ // fix. Assigning first preserves the pre-fix fail-CLOSED property (the
282
+ // cost-less snapshot overwrites the priced one) and merely adds the
283
+ // rejection on top.
138
284
  setResult(snapshot);
285
+ // 🔴 AN UNUSABLE ESTIMATE MUST REJECT — and there are TWO producers of the
286
+ // identical observable "resolved, but no `cost.total`", distinguishable
287
+ // only by fields the incident in civitai/civitai#4159 discarded:
288
+ //
289
+ // (a) status:'failed' — `blocks.estimateWorkflow` threw server-side. The
290
+ // host cannot reject across postMessage, so it posts
291
+ // `failureSnapshot(err)`: a VALID snapshot with `status:'failed'`,
292
+ // an `error` string, and no `cost`.
293
+ // (b) no numeric cost on an otherwise-successful snapshot — the server's
294
+ // `snapshotFromWorkflow` OMITS `cost` entirely when the whatIf reply
295
+ // has no numeric total (`...(typeof total === 'number' ? … : {})`),
296
+ // which yields e.g. `{status:'pending'}` with no `error` at all.
297
+ //
298
+ // Keying on `status` ALONE would leave (b) resolving — the same dead
299
+ // "Cost unavailable" control, still undiagnosable. So the rule is the one
300
+ // the caller actually needs: an estimate that did not yield a usable price
301
+ // does not resolve. `canceled`/`expired` are covered by the same clause
302
+ // (they carry no cost), which is why they need no arm of their own.
303
+ const usableCost = typeof snapshot.cost?.total === 'number';
304
+ if (snapshot.status === 'failed') {
305
+ throw new WorkflowEstimateError(snapshot, 'failed');
306
+ }
307
+ if (!usableCost) {
308
+ throw new WorkflowEstimateError(snapshot, 'no-cost');
309
+ }
139
310
  setStatus('confirming');
140
311
  return snapshot;
141
312
  }
@@ -1 +1 @@
1
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MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAC1E,CAAC"}
@@ -1,11 +1,4 @@
1
1
  import type { BlockCheckpointInfo } from '@civitai/app-sdk/blocks';
2
- /**
3
- * A resource picker is HUMAN-interactive — the user browses the catalog and may
4
- * take a while to choose. The default request timeout (~30s) is for fast
5
- * protocol round-trips and would reject a slow browse mid-pick. Use a generous
6
- * bound instead; the host still resolves earlier on pick/dismiss/close.
7
- */
8
- export declare const PICKER_REQUEST_TIMEOUT_MS: number;
9
2
  /**
10
3
  * Drives the platform-side Checkpoint picker and the persist-override flow.
11
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"useCheckpointPicker.d.ts","sourceRoot":"","sources":["../../src/hooks/useCheckpointPicker.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAKnE;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,QAAc,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,mBAAmB,IAAI;IACrC,IAAI,EAAE,CAAC,IAAI,EAAE;QACX;;;;;WAKG;QACH,cAAc,EAAE,MAAM,CAAC;QACvB,uEAAuE;QACvE,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,KAAK,OAAO,CAAC;QAAE,QAAQ,CAAC,EAAE,mBAAmB,CAAA;KAAE,CAAC,CAAC;IAClD,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACtD,CAkCA"}
1
+ {"version":3,"file":"useCheckpointPicker.d.ts","sourceRoot":"","sources":["../../src/hooks/useCheckpointPicker.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAMnE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,mBAAmB,IAAI;IACrC,IAAI,EAAE,CAAC,IAAI,EAAE;QACX;;;;;WAKG;QACH,cAAc,EAAE,MAAM,CAAC;QACvB,uEAAuE;QACvE,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,KAAK,OAAO,CAAC;QAAE,QAAQ,CAAC,EAAE,mBAAmB,CAAA;KAAE,CAAC,CAAC;IAClD,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACtD,CAkCA"}
@@ -1,13 +1,7 @@
1
1
  import { useCallback } from 'react';
2
+ import { HUMAN_INTERACTION_TIMEOUT_MS } from '../internal/requestTimeouts.js';
2
3
  import { getTransport } from '../internal/singleton.js';
3
4
  import { sendTypedRequest } from '../internal/transport.js';
4
- /**
5
- * A resource picker is HUMAN-interactive — the user browses the catalog and may
6
- * take a while to choose. The default request timeout (~30s) is for fast
7
- * protocol round-trips and would reject a slow browse mid-pick. Use a generous
8
- * bound instead; the host still resolves earlier on pick/dismiss/close.
9
- */
10
- export const PICKER_REQUEST_TIMEOUT_MS = 10 * 60_000;
11
5
  /**
12
6
  * Drives the platform-side Checkpoint picker and the persist-override flow.
13
7
  *
@@ -39,7 +33,7 @@ export function useCheckpointPicker() {
39
33
  ? { currentVersionId: opts.currentVersionId }
40
34
  : {}),
41
35
  },
42
- }, 'CHECKPOINT_PICKER_RESULT', { timeoutMs: PICKER_REQUEST_TIMEOUT_MS });
36
+ }, 'CHECKPOINT_PICKER_RESULT', { timeoutMs: HUMAN_INTERACTION_TIMEOUT_MS });
43
37
  return { selected };
44
38
  }, []);
45
39
  const persist = useCallback(async (versionId) => {
@@ -1 +1 @@
1
- {"version":3,"file":"useCheckpointPicker.js","sourceRoot":"","sources":["../../src/hooks/useCheckpointPicker.ts"],"names":[],"mappings":"AA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K,IAAI,8BAA8B,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC3B,CAAC"}
@@ -42,7 +42,7 @@ export interface UseImageUploadOptions {
42
42
  * the orchestrator scans it at gen time), or `null` on dismiss. Feed it
43
43
  * straight into a `WorkflowBody.sourceImage` for an img2img graph.
44
44
  *
45
- * Human-interactive, so it uses the same generous {@link PICKER_REQUEST_TIMEOUT_MS}
45
+ * Human-interactive, so it uses the same generous {@link HUMAN_INTERACTION_TIMEOUT_MS}
46
46
  * as the pickers (the host still resolves earlier on upload/dismiss/close).
47
47
  * Host-mediated, same trust model as `useResourcePicker` / `useBuzzWorkflow`.
48
48
  *
@@ -1 +1 @@
1
- {"version":3,"file":"useImageUpload.d.ts","sourceRoot":"","sources":["../../src/hooks/useImageUpload.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,8BAA8B,EAC9B,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAejC,0CAA0C;AAC1C,MAAM,WAAW,qBAAqB;IACpC;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AA+BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE;IAAE,OAAO,EAAE,kBAAkB,CAAA;CAAE,GAAG;IACxE,IAAI,EAAE,MAAM,OAAO,CAAC,8BAA8B,GAAG,IAAI,CAAC,CAAC;CAC5D,CAAC;AACF,wBAAgB,cAAc,CAAC,OAAO,EAAE;IAAE,OAAO,CAAC,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,IAAI,CAAA;CAAE,GAAG;IACjF,qFAAqF;IACrF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