@civitai/app-sdk 0.77.0 → 0.78.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.
package/README.md
CHANGED
|
@@ -666,7 +666,7 @@ The starters in `civitai/civitai-app-starters` wire this into framework-specific
|
|
|
666
666
|
|
|
667
667
|
## Choosing a workflow step type
|
|
668
668
|
|
|
669
|
-
The orchestrator is a workflow API: each request submits a list of typed steps. `WORKFLOW_STEP_TYPES` is the in-code catalog of every step `$type` it accepts, with a one-line description for each — `textToImage`, `imageGen`, `videoGen`, `comfy`, `customComfy`, `textToSpeech`, `aceStepAudio`, `transcription`, `imageUpscaler` among them (
|
|
669
|
+
The orchestrator is a workflow API: each request submits a list of typed steps. `WORKFLOW_STEP_TYPES` is the in-code catalog of every step `$type` it accepts, with a one-line description for each — `textToImage`, `imageGen`, `videoGen`, `comfy`, `customComfy`, `textToSpeech`, `aceStepAudio`, `transcription`, `imageUpscaler` among them (58 in total).
|
|
670
670
|
|
|
671
671
|
The catalog is pinned to the orchestrator's published OpenAPI spec two ways — an offline unit test against a transcribed copy of the spec's `WorkflowStepTemplate` discriminator mapping, and a CI job (`pnpm check:catalogs`) that re-fetches the live spec and diffs it. If a `$type` is listed here, the orchestrator accepts it.
|
|
672
672
|
|
|
@@ -741,15 +741,15 @@ What it exports:
|
|
|
741
741
|
|
|
742
742
|
| Export | What |
|
|
743
743
|
|---|---|
|
|
744
|
-
| `WorkflowStepTemplates` | `$type` → template type, for 47 of the catalog's
|
|
744
|
+
| `WorkflowStepTemplates` | `$type` → template type, for 47 of the catalog's 58 step types. Keyed by the WIRE name, which the generated type names don't always match (`model3DPreview` → `Model3dPreviewStepTemplate`). |
|
|
745
745
|
| `WorkflowStepTemplateFor<'videoGen'>` | One step's template. |
|
|
746
746
|
| `WorkflowStepInputFor<'videoGen'>` | One step's `input` shape, without needing the generated `*Input` name. |
|
|
747
747
|
| `AnyWorkflowStepTemplate` | Discriminated union of all 47 mapped templates — `Extract<…, { $type: 'comfy' }>` and exhaustive `switch` work. `@civitai/client`'s base `WorkflowStepTemplate` has `$type` as a bare `string`, so it narrows nothing. |
|
|
748
748
|
| `TypedWorkflowTemplate` | The submit envelope with `steps` narrowed to that union. Pass it straight to `submitWorkflow` / `estimateWorkflow`. |
|
|
749
749
|
|
|
750
|
-
> 🔴 **The map is not total over the catalog, and that is the expected state.** `WORKFLOW_STEP_TYPES` documents
|
|
750
|
+
> 🔴 **The map is not total over the catalog, and that is the expected state.** `WORKFLOW_STEP_TYPES` documents 58 `$type`s; this map covers 47. The 11 with no generated template in the pinned `@civitai/client` are `archiveExtraction`, `audioModeration`, `imageScanning`, `liveTextToSpeech`, `liveTranscription`, `merge`, `multimodalEmbedding`, `preprocessVideo`, `promptModeration`, `soniloAudioGen`, `yuE2`, and `WorkflowStepTemplateFor<…>` is a compile error for each of them.
|
|
751
751
|
>
|
|
752
|
-
> The two surfaces move independently on purpose: the catalog tracks the **live** orchestrator spec (a daily job syncs it), while these types track whatever `@civitai/client` was last published from. So the catalog runs ahead and the client catches up. The gap is never silent — `test/orchestrator/step-templates.test-d.ts` carries it as a `never` ledger plus one `@ts-expect-error` per gap `$type`, and `test/orchestrator/step-count-prose.test.ts` derives all four numbers (
|
|
752
|
+
> The two surfaces move independently on purpose: the catalog tracks the **live** orchestrator spec (a daily job syncs it), while these types track whatever `@civitai/client` was last published from. So the catalog runs ahead and the client catches up. The gap is never silent — `test/orchestrator/step-templates.test-d.ts` carries it as a `never` ledger plus one `@ts-expect-error` per gap `$type`, and `test/orchestrator/step-count-prose.test.ts` derives all four numbers (58, 47, 11, and the names) from `WORKFLOW_STEP_TYPES` and the map's own AST, then fails if this paragraph or its twin in `src/orchestrator/steps.ts` disagrees by one character.
|
|
753
753
|
|
|
754
754
|
The generated `*StepTemplate` and `*Input` types are **not** re-exported individually. Using this subpath already requires `@civitai/client` installed, so if you want one by name, import it straight from there — `import type { TextToImageStepTemplate } from '@civitai/client'`.
|
|
755
755
|
|
|
@@ -788,7 +788,7 @@ Several of the 47 exist to serve Civitai's own pipelines rather than third-party
|
|
|
788
788
|
|
|
789
789
|
`training` and `imageResourceTraining` are the exception: an App Block's host explicitly **allows** them on the pass-through arm (see `WorkflowBodyPassThroughStep` under Primitives above for the `maxBuzz` bound, and how a trained epoch is published). For a standalone app, the orchestrator's own authorization still decides.
|
|
790
790
|
|
|
791
|
-
Note that `WORKFLOW_STEP_TYPES` does **not** mark most of them: of its
|
|
791
|
+
Note that `WORKFLOW_STEP_TYPES` does **not** mark most of them: of its 58 entries exactly three — `comfyNodepackSnapshot`, `qwenImageBench` and `promptModeration` — sit under its "Platform internals" heading, and the rest are ordinary documented entries (`webScrape` even carries usage notes). The reason the platform steps are typed anyway is not that the catalog flags them as internal; it's that the catalog *documents* them, so skipping them would make `WorkflowStepTemplateFor<'training'>` a compile error for a step type the SDK documents — which is exactly what is live today for each `$type` the pinned client cannot type, and is why that gap is spelled out above rather than left to be discovered.
|
|
792
792
|
|
|
793
793
|
## Public vs. confidential clients
|
|
794
794
|
|
|
@@ -196,6 +196,14 @@ export declare const WORKFLOW_STEP_TYPES: {
|
|
|
196
196
|
readonly imageScanning: "Unified image moderation scan (NSFW level, AI/anime recognition, tagging, age detection)";
|
|
197
197
|
/** Shieldstral text/prompt safety moderation (`mode: 'prompt' | 'text'`). */
|
|
198
198
|
readonly shieldstralModeration: "Text / prompt safety moderation (Shieldstral)";
|
|
199
|
+
/**
|
|
200
|
+
* Transcribe the audio at `mediaUrl` and classify the lyrics for sexualized
|
|
201
|
+
* minors. `transcriber` is `auto`, `aceStep` or `asr`; `auto` sends speech in
|
|
202
|
+
* a supported language to ASR and everything else to ACE-Step. The output
|
|
203
|
+
* carries the `lyrics`, a `score`, `sexualizedMinors` and `blocked`, plus
|
|
204
|
+
* `hasAudio` and a `skippedReason`.
|
|
205
|
+
*/
|
|
206
|
+
readonly audioModeration: "Audio moderation — transcribe lyrics and flag sexualized minors";
|
|
199
207
|
/** ClamAV scan a model file for malware. */
|
|
200
208
|
readonly modelClamScan: "Antivirus scan a model file";
|
|
201
209
|
/** Pickle-scan a model file for unsafe pickles. */
|
|
@@ -206,6 +214,13 @@ export declare const WORKFLOW_STEP_TYPES: {
|
|
|
206
214
|
readonly chatCompletion: "LLM chat completion";
|
|
207
215
|
/** Generate a richer prompt from a short seed prompt. */
|
|
208
216
|
readonly promptEnhancement: "Prompt expansion via LLM";
|
|
217
|
+
/**
|
|
218
|
+
* Embed 1–128 `inputs` (each a unique `id` carrying `text`, an `imageUrl` or
|
|
219
|
+
* a `videoUrl` of at most 60 s / 100 MiB, audio ignored) into normalized
|
|
220
|
+
* vectors with `wemm-2b`. `dimensions` is 64–2048 in powers of two, default
|
|
221
|
+
* 256.
|
|
222
|
+
*/
|
|
223
|
+
readonly multimodalEmbedding: "Text / image / video embeddings (wemm-2b)";
|
|
209
224
|
/**
|
|
210
225
|
* Fetch one page and return its content. `url` and `formats` are both
|
|
211
226
|
* REQUIRED; `formats` selects which representations come back — the spec
|
|
@@ -226,6 +241,13 @@ export declare const WORKFLOW_STEP_TYPES: {
|
|
|
226
241
|
readonly echo: "Echo step — round-trip the input for testing";
|
|
227
242
|
/** Package multiple blobs into a zip archive. */
|
|
228
243
|
readonly blobArchive: "Zip multiple blobs into an archive";
|
|
244
|
+
/**
|
|
245
|
+
* Unpack a `.zip`, `.tar` or `.tar.gz` at `sourceUrl`. `mediaTypes` limits
|
|
246
|
+
* which kinds of entry are extracted (default all) and `maxEntries` caps the
|
|
247
|
+
* count (1–2000, default 2000); anything filtered or over the cap comes back
|
|
248
|
+
* in `rejected` rather than failing the step. `entries` are in archive order.
|
|
249
|
+
*/
|
|
250
|
+
readonly archiveExtraction: "Extract the entries of a zip / tar / tar.gz archive";
|
|
229
251
|
/** Combine fields from earlier steps' outputs into a single result. */
|
|
230
252
|
readonly merge: "Merge — combine fields from earlier steps' outputs into one result";
|
|
231
253
|
/** Snapshot the installed ComfyUI custom-node packs on a worker. */
|
|
@@ -272,6 +294,14 @@ export declare const IMAGE_GEN_ENGINES: {
|
|
|
272
294
|
* workers) — picking this engine pins the first-party vendor path.
|
|
273
295
|
*/
|
|
274
296
|
readonly krea: "Krea (Krea 2, first-party API)";
|
|
297
|
+
/**
|
|
298
|
+
* Krea 3: text-to-image, or an edit of up to six `images`. `resolution` is
|
|
299
|
+
* `1k` or `2k` (default `2k`), `thinkingMode` is `instant` / `medium` /
|
|
300
|
+
* `ultra`, and `quantity` is capped at 4. Omit `aspectRatio` to let Krea
|
|
301
|
+
* choose. Note the spec marks `images` required (no minimum length) while
|
|
302
|
+
* its own description says to omit it for text-to-image.
|
|
303
|
+
*/
|
|
304
|
+
readonly krea3: "Krea 3 (generation and editing, 1K / 2K)";
|
|
275
305
|
/** Self-hosted SDCpp (stable-diffusion.cpp) gen. */
|
|
276
306
|
readonly sdcpp: "SDCpp (self-hosted diffusion)";
|
|
277
307
|
/** fal.ai routed gen. */
|
|
@@ -204,6 +204,14 @@ export const WORKFLOW_STEP_TYPES = {
|
|
|
204
204
|
imageScanning: 'Unified image moderation scan (NSFW level, AI/anime recognition, tagging, age detection)',
|
|
205
205
|
/** Shieldstral text/prompt safety moderation (`mode: 'prompt' | 'text'`). */
|
|
206
206
|
shieldstralModeration: 'Text / prompt safety moderation (Shieldstral)',
|
|
207
|
+
/**
|
|
208
|
+
* Transcribe the audio at `mediaUrl` and classify the lyrics for sexualized
|
|
209
|
+
* minors. `transcriber` is `auto`, `aceStep` or `asr`; `auto` sends speech in
|
|
210
|
+
* a supported language to ASR and everything else to ACE-Step. The output
|
|
211
|
+
* carries the `lyrics`, a `score`, `sexualizedMinors` and `blocked`, plus
|
|
212
|
+
* `hasAudio` and a `skippedReason`.
|
|
213
|
+
*/
|
|
214
|
+
audioModeration: 'Audio moderation — transcribe lyrics and flag sexualized minors',
|
|
207
215
|
/** ClamAV scan a model file for malware. */
|
|
208
216
|
modelClamScan: 'Antivirus scan a model file',
|
|
209
217
|
/** Pickle-scan a model file for unsafe pickles. */
|
|
@@ -215,6 +223,13 @@ export const WORKFLOW_STEP_TYPES = {
|
|
|
215
223
|
chatCompletion: 'LLM chat completion',
|
|
216
224
|
/** Generate a richer prompt from a short seed prompt. */
|
|
217
225
|
promptEnhancement: 'Prompt expansion via LLM',
|
|
226
|
+
/**
|
|
227
|
+
* Embed 1–128 `inputs` (each a unique `id` carrying `text`, an `imageUrl` or
|
|
228
|
+
* a `videoUrl` of at most 60 s / 100 MiB, audio ignored) into normalized
|
|
229
|
+
* vectors with `wemm-2b`. `dimensions` is 64–2048 in powers of two, default
|
|
230
|
+
* 256.
|
|
231
|
+
*/
|
|
232
|
+
multimodalEmbedding: 'Text / image / video embeddings (wemm-2b)',
|
|
218
233
|
// ----- Web ---------------------------------------------------------------
|
|
219
234
|
/**
|
|
220
235
|
* Fetch one page and return its content. `url` and `formats` are both
|
|
@@ -237,6 +252,13 @@ export const WORKFLOW_STEP_TYPES = {
|
|
|
237
252
|
echo: 'Echo step — round-trip the input for testing',
|
|
238
253
|
/** Package multiple blobs into a zip archive. */
|
|
239
254
|
blobArchive: 'Zip multiple blobs into an archive',
|
|
255
|
+
/**
|
|
256
|
+
* Unpack a `.zip`, `.tar` or `.tar.gz` at `sourceUrl`. `mediaTypes` limits
|
|
257
|
+
* which kinds of entry are extracted (default all) and `maxEntries` caps the
|
|
258
|
+
* count (1–2000, default 2000); anything filtered or over the cap comes back
|
|
259
|
+
* in `rejected` rather than failing the step. `entries` are in archive order.
|
|
260
|
+
*/
|
|
261
|
+
archiveExtraction: 'Extract the entries of a zip / tar / tar.gz archive',
|
|
240
262
|
/** Combine fields from earlier steps' outputs into a single result. */
|
|
241
263
|
merge: "Merge — combine fields from earlier steps' outputs into one result",
|
|
242
264
|
// ----- Platform internals ------------------------------------------------
|
|
@@ -286,6 +308,14 @@ export const IMAGE_GEN_ENGINES = {
|
|
|
286
308
|
* workers) — picking this engine pins the first-party vendor path.
|
|
287
309
|
*/
|
|
288
310
|
krea: 'Krea (Krea 2, first-party API)',
|
|
311
|
+
/**
|
|
312
|
+
* Krea 3: text-to-image, or an edit of up to six `images`. `resolution` is
|
|
313
|
+
* `1k` or `2k` (default `2k`), `thinkingMode` is `instant` / `medium` /
|
|
314
|
+
* `ultra`, and `quantity` is capped at 4. Omit `aspectRatio` to let Krea
|
|
315
|
+
* choose. Note the spec marks `images` required (no minimum length) while
|
|
316
|
+
* its own description says to omit it for text-to-image.
|
|
317
|
+
*/
|
|
318
|
+
krea3: 'Krea 3 (generation and editing, 1K / 2K)',
|
|
289
319
|
/** Self-hosted SDCpp (stable-diffusion.cpp) gen. */
|
|
290
320
|
sdcpp: 'SDCpp (self-hosted diffusion)',
|
|
291
321
|
/** fal.ai routed gen. */
|
|
@@ -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` —
|
|
6
|
+
* (`WORKFLOW_STEP_TYPES` — 58 `$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
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
* orchestrator's own authorization still decides.
|
|
79
79
|
*
|
|
80
80
|
* ⚠️ `WORKFLOW_STEP_TYPES` does NOT mark most of them. Counted at this commit:
|
|
81
|
-
* of its
|
|
81
|
+
* of its 58 entries, exactly THREE sit under its "Platform internals" heading —
|
|
82
82
|
* `comfyNodepackSnapshot`, `qwenImageBench` and `promptModeration`. `training`,
|
|
83
83
|
* `webScrape`, `xGuardModeration`, `modelPickleScan` and the `model*` / `media*` steps are
|
|
84
84
|
* ordinary documented entries under ordinary headings, and `webScrape` carries
|
|
@@ -97,10 +97,11 @@
|
|
|
97
97
|
* (#315) without anything going red. The measured state, derived rather than
|
|
98
98
|
* typed:
|
|
99
99
|
*
|
|
100
|
-
* `WORKFLOW_STEP_TYPES` documents
|
|
101
|
-
* no generated template in the pinned `@civitai/client` are `
|
|
102
|
-
* `
|
|
103
|
-
* `
|
|
100
|
+
* `WORKFLOW_STEP_TYPES` documents 58 `$type`s; this map covers 47. The 11 with
|
|
101
|
+
* no generated template in the pinned `@civitai/client` are `archiveExtraction`,
|
|
102
|
+
* `audioModeration`, `imageScanning`, `liveTextToSpeech`, `liveTranscription`,
|
|
103
|
+
* `merge`, `multimodalEmbedding`, `preprocessVideo`, `promptModeration`,
|
|
104
|
+
* `soniloAudioGen`, `yuE2`, and
|
|
104
105
|
* `WorkflowStepTemplateFor<…>` is a compile error for each of them.
|
|
105
106
|
*
|
|
106
107
|
* That gap is EXPECTED and is not a defect in either surface. The catalog
|
|
@@ -309,7 +310,7 @@ interface StepTemplateMap {
|
|
|
309
310
|
xGuardModeration: XGuardModerationStepTemplate;
|
|
310
311
|
}
|
|
311
312
|
/**
|
|
312
|
-
* `$type` → its step-template type, for 47 of the catalog's
|
|
313
|
+
* `$type` → its step-template type, for 47 of the catalog's 58 step types.
|
|
313
314
|
*
|
|
314
315
|
* Keyed by the WIRE name rather than the generated type name, because the wire
|
|
315
316
|
* 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` —
|
|
6
|
+
* (`WORKFLOW_STEP_TYPES` — 58 `$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
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
* orchestrator's own authorization still decides.
|
|
79
79
|
*
|
|
80
80
|
* ⚠️ `WORKFLOW_STEP_TYPES` does NOT mark most of them. Counted at this commit:
|
|
81
|
-
* of its
|
|
81
|
+
* of its 58 entries, exactly THREE sit under its "Platform internals" heading —
|
|
82
82
|
* `comfyNodepackSnapshot`, `qwenImageBench` and `promptModeration`. `training`,
|
|
83
83
|
* `webScrape`, `xGuardModeration`, `modelPickleScan` and the `model*` / `media*` steps are
|
|
84
84
|
* ordinary documented entries under ordinary headings, and `webScrape` carries
|
|
@@ -97,10 +97,11 @@
|
|
|
97
97
|
* (#315) without anything going red. The measured state, derived rather than
|
|
98
98
|
* typed:
|
|
99
99
|
*
|
|
100
|
-
* `WORKFLOW_STEP_TYPES` documents
|
|
101
|
-
* no generated template in the pinned `@civitai/client` are `
|
|
102
|
-
* `
|
|
103
|
-
* `
|
|
100
|
+
* `WORKFLOW_STEP_TYPES` documents 58 `$type`s; this map covers 47. The 11 with
|
|
101
|
+
* no generated template in the pinned `@civitai/client` are `archiveExtraction`,
|
|
102
|
+
* `audioModeration`, `imageScanning`, `liveTextToSpeech`, `liveTranscription`,
|
|
103
|
+
* `merge`, `multimodalEmbedding`, `preprocessVideo`, `promptModeration`,
|
|
104
|
+
* `soniloAudioGen`, `yuE2`, and
|
|
104
105
|
* `WorkflowStepTemplateFor<…>` is a compile error for each of them.
|
|
105
106
|
*
|
|
106
107
|
* That gap is EXPECTED and is not a defect in either surface. The catalog
|
package/package.json
CHANGED