@civitai/app-sdk 0.56.1 β†’ 0.58.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.
@@ -114,4 +114,30 @@ export function isPageSlotContext(ctx) {
114
114
  export function isSignedIn(viewer) {
115
115
  return viewer !== null && viewer !== undefined;
116
116
  }
117
+ // ============================================================
118
+ // App Blocks TRAINING kind (`kind: 'training'`)
119
+ // ============================================================
120
+ //
121
+ // πŸ”΄ MIRRORED FROM THE HOST, NOT DESIGNED HERE. Every type in this section copies
122
+ // civitai/civitai's zod at `a32f506516` (main, after civitai/civitai#5434):
123
+ // `blockTrainingBodySchema` in `src/server/schema/blocks/workflow.schema.ts`, and
124
+ // `aiToolkitTrainingParamsSchema` in `src/server/schema/orchestrator/training.schema.ts`
125
+ // for `params`. The host's zod is the definition; this is the copy. A field the
126
+ // host adds is invisible here until this file is updated, and the host rejects a
127
+ // body that does not parse β€” so a mismatch shows up as a refused estimate, never
128
+ // as a silently different run.
129
+ /** Ceiling on what ONE confirmed `kind: 'training'` run may cost, in Buzz. Host constant `BLOCK_TRAINING_MAX_BUZZ_PER_RUN`. */
130
+ export const BLOCK_TRAINING_MAX_BUZZ_PER_RUN = 5000;
131
+ /** Max images in one prepared training dataset. Host constant `BLOCK_TRAINING_DATASET_MAX_ITEMS`. */
132
+ export const BLOCK_TRAINING_DATASET_MAX_ITEMS = 50;
133
+ /** Max characters of one dataset caption. Host constant `BLOCK_TRAINING_CAPTION_MAX_CHARS`. */
134
+ export const BLOCK_TRAINING_CAPTION_MAX_CHARS = 1000;
135
+ /** Max sample prompts on a training body. Host constant `BLOCK_TRAINING_SAMPLE_PROMPTS_MAX`. */
136
+ export const BLOCK_TRAINING_SAMPLE_PROMPTS_MAX = 6;
137
+ /** Max characters of one sample prompt. Host constant `BLOCK_TRAINING_SAMPLE_PROMPT_MAX_CHARS`. */
138
+ export const BLOCK_TRAINING_SAMPLE_PROMPT_MAX_CHARS = 1000;
139
+ /** Max characters of the trigger word. Host constant `BLOCK_TRAINING_TRIGGER_WORD_MAX_CHARS`. */
140
+ export const BLOCK_TRAINING_TRIGGER_WORD_MAX_CHARS = 64;
141
+ /** Max characters of the base-model key. Host constant `BLOCK_TRAINING_MODEL_KEY_MAX_CHARS`. */
142
+ export const BLOCK_TRAINING_MODEL_KEY_MAX_CHARS = 64;
117
143
  //# sourceMappingURL=types.js.map
package/dist/index.d.ts CHANGED
@@ -25,10 +25,16 @@
25
25
  *
26
26
  * - **`./blocks`** β€” importing it RUNS `./safe-storage` for its side effect
27
27
  * (repairing `localStorage`/`sessionStorage` at an opaque origin). Folding
28
- * 119 symbols and that side effect into the root would make every OAuth app
28
+ * 154 symbols and that side effect into the root would make every OAuth app
29
29
  * that writes `import { exchangeCode } from '@civitai/app-sdk'` pay for the
30
30
  * Civitai-Apps contract it does not use. Blocks and OAuth apps are disjoint
31
31
  * audiences; see this package's README.
32
+ * πŸ”΄ That 154 is ASSERTED, not merely quoted β€” by
33
+ * `packages/civitai-app-sdk/test/export-surface.test.ts`, which pins
34
+ * `surface.get('./blocks').size`. It said 119 here against a real 125 until
35
+ * 2026-10-04, because the existing checks pin the root as an exact union and
36
+ * each subpath's set relations, none of which can see a subpath GROW. Update
37
+ * both this line and the ledger `reason` in that file together.
32
38
  * - **`./safe-storage`** β€” the same side effect, and its whole point is being
33
39
  * imported FOR it (`import '@civitai/app-sdk/safe-storage'`). A side effect
34
40
  * on the root barrel is not something a consumer can opt out of.
package/dist/index.js CHANGED
@@ -25,10 +25,16 @@
25
25
  *
26
26
  * - **`./blocks`** β€” importing it RUNS `./safe-storage` for its side effect
27
27
  * (repairing `localStorage`/`sessionStorage` at an opaque origin). Folding
28
- * 119 symbols and that side effect into the root would make every OAuth app
28
+ * 154 symbols and that side effect into the root would make every OAuth app
29
29
  * that writes `import { exchangeCode } from '@civitai/app-sdk'` pay for the
30
30
  * Civitai-Apps contract it does not use. Blocks and OAuth apps are disjoint
31
31
  * audiences; see this package's README.
32
+ * πŸ”΄ That 154 is ASSERTED, not merely quoted β€” by
33
+ * `packages/civitai-app-sdk/test/export-surface.test.ts`, which pins
34
+ * `surface.get('./blocks').size`. It said 119 here against a real 125 until
35
+ * 2026-10-04, because the existing checks pin the root as an exact union and
36
+ * each subpath's set relations, none of which can see a subpath GROW. Update
37
+ * both this line and the ledger `reason` in that file together.
32
38
  * - **`./safe-storage`** β€” the same side effect, and its whole point is being
33
39
  * imported FOR it (`import '@civitai/app-sdk/safe-storage'`). A side effect
34
40
  * on the root barrel is not something a consumer can opt out of.
@@ -75,7 +75,12 @@ export declare const WORKFLOW_STEP_TYPES: {
75
75
  readonly imageBackgroundRemoval: "Image background removal (BiRefNet)";
76
76
  /** Vectorize a raster image with a local StarVector / OmniSVG model. */
77
77
  readonly imageToSvg: "Raster image β†’ SVG vectorization";
78
- /** LoRA / DoRA / embedding training. Long-running. */
78
+ /**
79
+ * LoRA / DoRA / embedding training. Long-running. Allowed on an App Block's
80
+ * pass-through arm, where `maxBuzz` (1–250) is its timeout in seconds only
81
+ * when the orchestrator returns no quote β€” see `WorkflowBodyPassThroughStep`
82
+ * in `@civitai/app-sdk/blocks`.
83
+ */
79
84
  readonly imageResourceTraining: "Train a LoRA / DoRA / embedding from a dataset";
80
85
  /** Pre-process an image (resize, ControlNet preprocessor, etc.). */
81
86
  readonly preprocessImage: "Image preprocessing (resize, ControlNet preprocessors, …)";
@@ -152,7 +157,8 @@ export declare const WORKFLOW_STEP_TYPES: {
152
157
  /**
153
158
  * Generic training step. Engines: `ai-toolkit`, `comfy`. Distinct from
154
159
  * {@link WORKFLOW_STEP_TYPES.imageResourceTraining}, which is the older
155
- * kohya/musubi/flux-dev-fast LoRA path.
160
+ * kohya/musubi/flux-dev-fast LoRA path. Allowed on an App Block's
161
+ * pass-through arm on the same terms as `imageResourceTraining`.
156
162
  */
157
163
  readonly training: "Model training (ai-toolkit / comfy engines)";
158
164
  /** Hash an image / video / model for dedup or lookup. */
@@ -213,6 +219,8 @@ export declare const WORKFLOW_STEP_TYPES: {
213
219
  readonly comfyNodepackSnapshot: "Snapshot a worker’s installed ComfyUI node packs (internal)";
214
220
  /** Qwen image benchmarking harness. */
215
221
  readonly qwenImageBench: "Qwen image benchmarking (internal)";
222
+ readonly liveTranscription: "Live speech-to-text from audio streamed while the user talks";
223
+ readonly merge: "Merge β€” combine fields from earlier steps' outputs into one result";
216
224
  };
217
225
  export type WorkflowStepType = keyof typeof WORKFLOW_STEP_TYPES;
218
226
  /**
@@ -77,7 +77,12 @@ export const WORKFLOW_STEP_TYPES = {
77
77
  imageBackgroundRemoval: 'Image background removal (BiRefNet)',
78
78
  /** Vectorize a raster image with a local StarVector / OmniSVG model. */
79
79
  imageToSvg: 'Raster image β†’ SVG vectorization',
80
- /** LoRA / DoRA / embedding training. Long-running. */
80
+ /**
81
+ * LoRA / DoRA / embedding training. Long-running. Allowed on an App Block's
82
+ * pass-through arm, where `maxBuzz` (1–250) is its timeout in seconds only
83
+ * when the orchestrator returns no quote β€” see `WorkflowBodyPassThroughStep`
84
+ * in `@civitai/app-sdk/blocks`.
85
+ */
81
86
  imageResourceTraining: 'Train a LoRA / DoRA / embedding from a dataset',
82
87
  /** Pre-process an image (resize, ControlNet preprocessor, etc.). */
83
88
  preprocessImage: 'Image preprocessing (resize, ControlNet preprocessors, …)',
@@ -159,7 +164,8 @@ export const WORKFLOW_STEP_TYPES = {
159
164
  /**
160
165
  * Generic training step. Engines: `ai-toolkit`, `comfy`. Distinct from
161
166
  * {@link WORKFLOW_STEP_TYPES.imageResourceTraining}, which is the older
162
- * kohya/musubi/flux-dev-fast LoRA path.
167
+ * kohya/musubi/flux-dev-fast LoRA path. Allowed on an App Block's
168
+ * pass-through arm on the same terms as `imageResourceTraining`.
163
169
  */
164
170
  training: 'Model training (ai-toolkit / comfy engines)',
165
171
  // ----- Classification / tagging / moderation ----------------------------
@@ -228,6 +234,15 @@ export const WORKFLOW_STEP_TYPES = {
228
234
  comfyNodepackSnapshot: 'Snapshot a worker’s installed ComfyUI node packs (internal)',
229
235
  /** Qwen image benchmarking harness. */
230
236
  qwenImageBench: 'Qwen image benchmarking (internal)',
237
+ // ----- Auto-added 2026-10-06 from the orchestrator spec ----------------------
238
+ // Added by scripts/sync-orchestrator-catalogs.mjs: the live spec accepts
239
+ // these and this catalog did not list them. MOVE each entry into the right
240
+ // section above, and replace any TODO(catalog) line with a real one-line
241
+ // description β€” `pnpm check:catalogs` names every placeholder that is left.
242
+ // (That check is advisory, so it will not stop this merging. It is a
243
+ // reminder, not a gate.)
244
+ liveTranscription: 'Live speech-to-text from audio streamed while the user talks',
245
+ merge: "Merge β€” combine fields from earlier steps' outputs into one result",
231
246
  };
232
247
  /**
233
248
  * Engines that the `imageGen` step accepts. Each one has its own input shape;
@@ -3,7 +3,7 @@
3
3
  * own generated client (`@civitai/client`).
4
4
  *
5
5
  * The sibling `@civitai/app-sdk/orchestrator` module gives you the *catalog*
6
- * (`WORKFLOW_STEP_TYPES` β€” 51 `$type` names and what each one does) and the
6
+ * (`WORKFLOW_STEP_TYPES` β€” 53 `$type` names and what each one does) and the
7
7
  * fetch helpers (`submitWorkflow`, `estimateWorkflow`, …), but its body
8
8
  * builders take `input: unknown`. This module is the missing half: the actual
9
9
  * per-step input shapes, tracked against the orchestrator's OpenAPI spec by
@@ -65,12 +65,20 @@
65
65
  *
66
66
  * The practical consequence: a number of the 47 step types below exist to serve
67
67
  * Civitai's own pipelines rather than third-party apps β€” `modelPickleScan`,
68
- * `xGuardModeration`, `training`, `comfyNodepackSnapshot`, `qwenImageBench`,
68
+ * `xGuardModeration`, `comfyNodepackSnapshot`, `qwenImageBench`,
69
69
  * the `model*` / `media*` hashing and classification steps. They are in the
70
70
  * consumer spec, so they are typed here. They are not an invitation.
71
71
  *
72
+ * `training` and `imageResourceTraining` are the exception: an App Block's host
73
+ * explicitly ALLOWS both on the pass-through arm (`WorkflowBodyPassThroughStep`
74
+ * in `blocks/types.ts`), with the same spend rules as any other `$type` there
75
+ * (see `WorkflowBodyPassThroughStep.maxBuzz`). The trained checkpoint is not
76
+ * part of the block contract; publishing goes through Civitai's model wizard
77
+ * (`BlockWorkflowSnapshot.trainedEpochs`). For a standalone app the
78
+ * orchestrator's own authorization still decides.
79
+ *
72
80
  * ⚠️ `WORKFLOW_STEP_TYPES` does NOT mark most of them. Counted at this commit:
73
- * of its 51 entries, exactly TWO sit under its "Platform internals" heading β€”
81
+ * of its 53 entries, exactly TWO sit under its "Platform internals" heading β€”
74
82
  * `comfyNodepackSnapshot` and `qwenImageBench`. `training`, `webScrape`,
75
83
  * `xGuardModeration`, `modelPickleScan` and the `model*` / `media*` steps are
76
84
  * ordinary documented entries under ordinary headings, and `webScrape` carries
@@ -89,10 +97,10 @@
89
97
  * (#315) without anything going red. The measured state, derived rather than
90
98
  * typed:
91
99
  *
92
- * `WORKFLOW_STEP_TYPES` documents 51 `$type`s; this map covers 47. The 4 with
100
+ * `WORKFLOW_STEP_TYPES` documents 53 `$type`s; this map covers 47. The 6 with
93
101
  * no generated template in the pinned `@civitai/client` are `imageScanning`,
94
- * `preprocessVideo`, `soniloAudioGen`, `yuE2`, and `WorkflowStepTemplateFor<…>` is a compile
95
- * error for each of them.
102
+ * `liveTranscription`, `merge`, `preprocessVideo`, `soniloAudioGen`, `yuE2`, and
103
+ * `WorkflowStepTemplateFor<…>` is a compile error for each of them.
96
104
  *
97
105
  * That gap is EXPECTED and is not a defect in either surface. The catalog
98
106
  * tracks the LIVE orchestrator spec (`pnpm check:catalogs` and the daily
@@ -300,7 +308,7 @@ interface StepTemplateMap {
300
308
  xGuardModeration: XGuardModerationStepTemplate;
301
309
  }
302
310
  /**
303
- * `$type` β†’ its step-template type, for 47 of the catalog's 51 step types.
311
+ * `$type` β†’ its step-template type, for 47 of the catalog's 53 step types.
304
312
  *
305
313
  * Keyed by the WIRE name rather than the generated type name, because the wire
306
314
  * name is what you actually have in hand and the generator does not always
@@ -3,7 +3,7 @@
3
3
  * own generated client (`@civitai/client`).
4
4
  *
5
5
  * The sibling `@civitai/app-sdk/orchestrator` module gives you the *catalog*
6
- * (`WORKFLOW_STEP_TYPES` β€” 51 `$type` names and what each one does) and the
6
+ * (`WORKFLOW_STEP_TYPES` β€” 53 `$type` names and what each one does) and the
7
7
  * fetch helpers (`submitWorkflow`, `estimateWorkflow`, …), but its body
8
8
  * builders take `input: unknown`. This module is the missing half: the actual
9
9
  * per-step input shapes, tracked against the orchestrator's OpenAPI spec by
@@ -65,12 +65,20 @@
65
65
  *
66
66
  * The practical consequence: a number of the 47 step types below exist to serve
67
67
  * Civitai's own pipelines rather than third-party apps β€” `modelPickleScan`,
68
- * `xGuardModeration`, `training`, `comfyNodepackSnapshot`, `qwenImageBench`,
68
+ * `xGuardModeration`, `comfyNodepackSnapshot`, `qwenImageBench`,
69
69
  * the `model*` / `media*` hashing and classification steps. They are in the
70
70
  * consumer spec, so they are typed here. They are not an invitation.
71
71
  *
72
+ * `training` and `imageResourceTraining` are the exception: an App Block's host
73
+ * explicitly ALLOWS both on the pass-through arm (`WorkflowBodyPassThroughStep`
74
+ * in `blocks/types.ts`), with the same spend rules as any other `$type` there
75
+ * (see `WorkflowBodyPassThroughStep.maxBuzz`). The trained checkpoint is not
76
+ * part of the block contract; publishing goes through Civitai's model wizard
77
+ * (`BlockWorkflowSnapshot.trainedEpochs`). For a standalone app the
78
+ * orchestrator's own authorization still decides.
79
+ *
72
80
  * ⚠️ `WORKFLOW_STEP_TYPES` does NOT mark most of them. Counted at this commit:
73
- * of its 51 entries, exactly TWO sit under its "Platform internals" heading β€”
81
+ * of its 53 entries, exactly TWO sit under its "Platform internals" heading β€”
74
82
  * `comfyNodepackSnapshot` and `qwenImageBench`. `training`, `webScrape`,
75
83
  * `xGuardModeration`, `modelPickleScan` and the `model*` / `media*` steps are
76
84
  * ordinary documented entries under ordinary headings, and `webScrape` carries
@@ -89,10 +97,10 @@
89
97
  * (#315) without anything going red. The measured state, derived rather than
90
98
  * typed:
91
99
  *
92
- * `WORKFLOW_STEP_TYPES` documents 51 `$type`s; this map covers 47. The 4 with
100
+ * `WORKFLOW_STEP_TYPES` documents 53 `$type`s; this map covers 47. The 6 with
93
101
  * no generated template in the pinned `@civitai/client` are `imageScanning`,
94
- * `preprocessVideo`, `soniloAudioGen`, `yuE2`, and `WorkflowStepTemplateFor<…>` is a compile
95
- * error for each of them.
102
+ * `liveTranscription`, `merge`, `preprocessVideo`, `soniloAudioGen`, `yuE2`, and
103
+ * `WorkflowStepTemplateFor<…>` is a compile error for each of them.
96
104
  *
97
105
  * That gap is EXPECTED and is not a defect in either surface. The catalog
98
106
  * tracks the LIVE orchestrator spec (`pnpm check:catalogs` and the daily
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@civitai/app-sdk",
3
- "version": "0.56.1",
3
+ "version": "0.58.0",
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",