@civitai/app-sdk 0.98.1 → 0.99.1

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/README.md CHANGED
@@ -363,6 +363,16 @@ flag `app-blocks-confirmed-step` (off by default), and refused for development,
363
363
  review tokens — so it is exercised against the mock host, not `dev:live`. Use it through
364
364
  `@civitai/blocks-react`'s `useRunConfirmedStep()`.
365
365
 
366
+ **Over budget: `overBudget` and `budget`.** A pass-through `step` or `kind: 'workflow'` estimate
367
+ whose submit is certain to be refused for budget (`insufficient buzz budget`) carries
368
+ `snapshot.overBudget: true` and `snapshot.budget`, the limit it was judged against (the
369
+ per-call budget for a step, the whole-workflow ceiling for a workflow). It is still a priced
370
+ estimate; show it beside the price and do not offer to spend. The fields are omitted when the job
371
+ fits, when a `stepQuote` applies, and on hosts that predate civitai/civitai#10971. A page app's
372
+ per-call budget comes from its manifest's `page.buzzBudgetPerGen`, clamped to the platform cap
373
+ (5,000): declare it well above the largest single job the app submits. A step above that cap, or a
374
+ `kind: 'workflow'` above its per-call limit, cannot run from an app whatever the manifest declares.
375
+
366
376
  **3D outputs.** A step that produces 3D models (`polyGen`) still lists every model url in
367
377
  `snapshot.imageUrls`; `snapshot.model3dOutputs` (and the same field on an `AppWorkflow` row)
368
378
  labels them. Omitted when there are none.
@@ -1555,8 +1555,10 @@ export type WorkflowBodyStep = {
1555
1555
  * - **`repeat` is refused on this arm**, outright: a `repeat` may only
1556
1556
  * iterate an array in a body's own `arguments`, and this arm has none. Use
1557
1557
  * a `kind: 'workflow'` body ({@link WorkflowBodyWorkflow}) to repeat a step.
1558
- * - `maxBuzz` is the app's spend knob, and the host's quote can raise the
1559
- * reservation above it — see its own note below.
1558
+ * - `maxBuzz` is NOT a spend ceiling: it is the least the host reserves,
1559
+ * and the host's quote can raise the reservation, and the charge, above it.
1560
+ * The limit is the token's per-call budget (`page.buzzBudgetPerGen`), which
1561
+ * an estimate's `overBudget` reports — see `maxBuzz`'s own note below.
1560
1562
  *
1561
1563
  * @example A pass-through body for an orchestrator step the registry does not
1562
1564
  * carry. Note there is no `step` key.
@@ -2628,6 +2630,39 @@ export interface BlockWorkflowSnapshot {
2628
2630
  * it the run is refused and you estimate again. A quote is single-use.
2629
2631
  */
2630
2632
  stepQuote?: BlockStepQuote;
2633
+ /**
2634
+ * `true` on an ESTIMATE whose submit is certain to be refused for budget:
2635
+ * `cost.total` is above {@link BlockWorkflowSnapshot.budget}, the limit the
2636
+ * submit compares it with (or the token has no budget at all), and no
2637
+ * {@link BlockWorkflowSnapshot.stepQuote} applies. The estimate is still a
2638
+ * priced snapshot that resolves; show this beside the price and do not offer
2639
+ * to spend — the submit would refuse the job with `insufficient buzz budget`.
2640
+ *
2641
+ * Set by the pass-through `step` estimate ({@link WorkflowBodyPassThroughStep})
2642
+ * and the `kind: 'workflow'` estimate ({@link WorkflowBodyWorkflow}). OMITTED
2643
+ * when the job fits, on every other kind, and on hosts that predate
2644
+ * civitai/civitai#10971 — so absent means "not known to be over", never a
2645
+ * guarantee the submit passes.
2646
+ *
2647
+ * A batch-estimate cell never carries a `stepQuote`, so a cell can say
2648
+ * `overBudget` for a fixed-price job that a single estimate would return as a
2649
+ * viewer-confirmable `stepQuote` instead.
2650
+ *
2651
+ * A page app's per-call budget comes from its manifest's
2652
+ * `page.buzzBudgetPerGen`, clamped to the platform cap (5,000): declare it
2653
+ * well above the largest single job the app submits. A step above that cap,
2654
+ * or a `kind: 'workflow'` above its per-call limit, cannot run from an app
2655
+ * whatever the manifest declares.
2656
+ */
2657
+ overBudget?: true;
2658
+ /**
2659
+ * The limit {@link BlockWorkflowSnapshot.overBudget} was judged against, as
2660
+ * the submit's gate computes it: the token's per-call budget for a
2661
+ * pass-through `step`, and the whole-workflow ceiling (per-call budget ×
2662
+ * steps, bounded) for `kind: 'workflow'`. `0` when the token has no budget.
2663
+ * Present only with `overBudget`.
2664
+ */
2665
+ budget?: number;
2631
2666
  /**
2632
2667
  * What each 3D model in {@link BlockWorkflowSnapshot.imageUrls} IS — one label
2633
2668
  * per model a pass-through step produced (e.g. `polyGen`).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@civitai/app-sdk",
3
- "version": "0.98.1",
3
+ "version": "0.99.1",
4
4
  "description": "OAuth + PKCE, encrypted-cookie sessions, scopes, and orchestrator helpers for building third-party Civitai apps.",
5
5
  "license": "MIT",
6
6
  "type": "module",