@civitai/app-sdk 0.77.0 → 0.79.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 (55 in total).
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 55 step types. Keyed by the WIRE name, which the generated type names don't always match (`model3DPreview` → `Model3dPreviewStepTemplate`). |
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 55 `$type`s; this map covers 47. The 8 with no generated template in the pinned `@civitai/client` are `imageScanning`, `liveTextToSpeech`, `liveTranscription`, `merge`, `preprocessVideo`, `promptModeration`, `soniloAudioGen`, `yuE2`, and `WorkflowStepTemplateFor<…>` is a compile error for each of them.
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 (55, 47, 8, 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.
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 55 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.
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
 
@@ -116,7 +116,7 @@ export { isModelSlotContext, isPageSlotContext } from './types.js';
116
116
  * in `types.ts` for which of the two it uses and why.
117
117
  */
118
118
  export { isSignedIn } from './types.js';
119
- export type { BlockContext, KnownSlotId, ModelSlotId, PageSlotContext, PageSlotId, UnknownSlotContext, BlockAnalyticsDeclaration, BlockAnalyticsEventDeclaration, BlockAnalyticsPropertyDeclaration, BlockManifest, BlockManifestGood, BlockManifestV1, BlockSettings, BlockStorageCollectionDeclaration, BlockStorageDeclaration, BlockStorageIndexes, BlockStorageIndexType, BlockStoragePrivateCollectionDeclaration, BlockStorageSharedCollectionDeclaration, BlockToken, ContentRating, ManifestBooleanField, ManifestIframe, ManifestNumberField, ManifestPage, ManifestPreview, ManifestSettingField, ManifestSettings, ManifestStringField, ManifestTarget, ModelSlotContext, SettingScope, SettingWidget, Theme, ViewerInfo, BlockCheckpointInfo, BlockResourceInfo, BlockResourcePickerType, BlockSourceImage, BlockUploadedImageInfo, BlockGenerationSourceImageInfo, BlockImagePickerSource, BlockPickedImageInfo, BlockMediaKind, BlockMediaUploadInfo, BlockPendingImageInfo, BlockImageScanResult, BlockUploadPurpose, BlockNavigateScope, BlockTextToImageParams, BlockWorkflowSnapshot, BlockEstimateBatchAggregate, BlockModelSubstitution, ModelSubstitutionReason, KnownBlockWorkflowErrorCode, BlockStepToolCall, BlockTrainedEpoch, BlockPublishedModel, BuzzAccountType, ShowcaseImage, WorkflowBody, WorkflowBodyTextToImage, WorkflowBodyCustomComfy, WorkflowBodyCustomComfyRecipe, WorkflowBodyCustomComfyInline, InlineComfyNode, WorkflowBodyStep, WorkflowBodyPassThroughStep, WorkflowBodyWorkflow, WorkflowBodyWorkflowStep, WorkflowStepRef, WithWorkflowStepRefs, BlockWorkflowStepSnapshot, WorkflowStatus, BlockBuzzTransaction, BlockBuzzAccount, BlockDailyCompensationResource, BlockViewer, BlockWildcardPack, BlockWildcardPackErrorCode, AppWorkflow, AppWorkflowImage, BlockGatedImage, BlockCollectionFollowErrorCode, BlockCollectionFollowResult, BlockPostSource, BlockCreatePostRequest, BlockCreatePostResult, BlockCreatePostHostError, WorkflowBodyTraining, AiToolkitTrainingParams, AiToolkitTrainingParamsBase, AiToolkitPlainEcosystem, AiToolkitLrScheduler, AiToolkitOptimizerType, BlockTrainingQuote, BlockTrainingDatasetItem, BlockTrainingDataImage, BlockTrainingDataUploadResult, BlockRunTrainingHostError, BlockStepQuote, BlockModel3dOutput, BlockRunConfirmedStepHostError, } from './types.js';
119
+ export type { BlockContext, KnownSlotId, ModelSlotId, PageSlotContext, PageSlotId, UnknownSlotContext, BlockAnalyticsDeclaration, BlockAnalyticsEventDeclaration, BlockAnalyticsPropertyDeclaration, BlockManifest, BlockManifestGood, BlockManifestV1, BlockSettings, BlockStorageCollectionDeclaration, BlockStorageDeclaration, BlockStorageIndexes, BlockStorageIndexType, BlockStoragePrivateCollectionDeclaration, BlockStorageSharedCollectionDeclaration, BlockToken, ContentRating, ManifestBooleanField, ManifestIframe, ManifestNumberField, ManifestPage, ManifestPreview, ManifestSettingField, ManifestSettings, ManifestStringField, ManifestTarget, ModelSlotContext, SettingScope, SettingWidget, Theme, ViewerInfo, BlockCheckpointInfo, BlockResourceInfo, BlockResourcePickerType, BlockSourceImage, BlockUploadedImageInfo, BlockGenerationSourceImageInfo, BlockImagePickerSource, BlockPickedImageInfo, BlockMediaKind, BlockMediaUploadInfo, BlockPendingImageInfo, BlockImageScanResult, BlockUploadPurpose, BlockNavigateScope, BlockTextToImageParams, BlockWorkflowSnapshot, BlockEstimateBatchAggregate, BlockModelSubstitution, ModelSubstitutionReason, KnownBlockWorkflowErrorCode, BlockStepToolCall, BlockTrainedEpoch, BlockPublishedModel, BuzzAccountType, ShowcaseImage, WorkflowBody, WorkflowBodyTextToImage, WorkflowBodyCustomComfy, WorkflowBodyCustomComfyRecipe, WorkflowBodyCustomComfyInline, InlineComfyNode, WorkflowBodyStep, WorkflowBodyPassThroughStep, WorkflowBodyWorkflow, WorkflowBodyWorkflowStep, WorkflowStepRef, WithWorkflowStepRefs, BlockWorkflowStepSnapshot, WorkflowStatus, BlockBuzzTransaction, BlockBuzzAccount, BlockDailyCompensationResource, BlockViewer, BlockWildcardPack, BlockWildcardPackErrorCode, BlockResourceFile, BlockResourceFileEntry, BlockResourceFileEntryFormat, BlockResourceFileErrorCode, BlockResourceFileMeta, AppWorkflow, AppWorkflowImage, BlockGatedImage, BlockCollectionFollowErrorCode, BlockCollectionFollowResult, BlockPostSource, BlockCreatePostRequest, BlockCreatePostResult, BlockCreatePostHostError, WorkflowBodyTraining, AiToolkitTrainingParams, AiToolkitTrainingParamsBase, AiToolkitPlainEcosystem, AiToolkitLrScheduler, AiToolkitOptimizerType, BlockTrainingQuote, BlockTrainingDatasetItem, BlockTrainingDataImage, BlockTrainingDataUploadResult, BlockRunTrainingHostError, BlockStepQuote, BlockModel3dOutput, BlockRunConfirmedStepHostError, } from './types.js';
120
120
  /** Host bound for the App Blocks `kind: 'workflow'` body — see `WorkflowBodyWorkflow`. */
121
121
  export { BLOCK_WORKFLOW_MAX_STEPS, BLOCK_WORKFLOW_REPEAT_MAX_ITERATIONS } from './types.js';
122
122
  /**
@@ -8,7 +8,7 @@
8
8
  * Wire format: `window.postMessage({ type, payload }, targetOrigin)`.
9
9
  */
10
10
  import type { ColorDomain } from './browsingLevel.js';
11
- import type { BlockCheckpointInfo, BlockResourceInfo, BlockResourcePickerType, BlockUploadedImageInfo, BlockGenerationSourceImageInfo, BlockImagePickerSource, BlockPickedImageInfo, BlockMediaKind, BlockMediaUploadInfo, BlockPendingImageInfo, BlockImageScanResult, BlockUploadPurpose, BlockNavigateScope, BlockContext, BlockSettings, Theme, ViewerInfo, WorkflowBody, BlockWorkflowSnapshot, BlockEstimateBatchAggregate, BlockBuzzTransaction, BlockBuzzAccount, BlockDailyCompensationResource, BlockViewer, BlockWildcardPack, BlockWildcardPackErrorCode, AppWorkflow, BlockGatedImage, BlockCollectionFollowErrorCode, BlockCollectionFollowResult, BlockPostSource, BlockCreatePostResult, BlockTrainingDataUploadResult, WorkflowBodyTraining, WorkflowBodyPassThroughStep } from './types.js';
11
+ import type { BlockCheckpointInfo, BlockResourceInfo, BlockResourcePickerType, BlockUploadedImageInfo, BlockGenerationSourceImageInfo, BlockImagePickerSource, BlockPickedImageInfo, BlockMediaKind, BlockMediaUploadInfo, BlockPendingImageInfo, BlockImageScanResult, BlockUploadPurpose, BlockNavigateScope, BlockContext, BlockSettings, Theme, ViewerInfo, WorkflowBody, BlockWorkflowSnapshot, BlockEstimateBatchAggregate, BlockBuzzTransaction, BlockBuzzAccount, BlockDailyCompensationResource, BlockViewer, BlockWildcardPack, BlockWildcardPackErrorCode, BlockResourceFile, BlockResourceFileErrorCode, AppWorkflow, BlockGatedImage, BlockCollectionFollowErrorCode, BlockCollectionFollowResult, BlockPostSource, BlockCreatePostResult, BlockTrainingDataUploadResult, WorkflowBodyTraining, WorkflowBodyPassThroughStep } from './types.js';
12
12
  import type { BlockAppReaction, BlockEntityReactionErrorCode, BlockEntityReactionResult, BlockEntityReactionsResult, BlockReactionEntityType } from './reactions.js';
13
13
  /**
14
14
  * Filter params for `GET_BUZZ_TRANSACTIONS`. All optional; the host validates
@@ -484,6 +484,13 @@ export type ParentToBlockMessage = {
484
484
  pack?: BlockWildcardPack;
485
485
  error?: BlockWildcardPackErrorCode;
486
486
  };
487
+ } | {
488
+ type: 'RESOURCE_FILE_RESULT';
489
+ payload: {
490
+ requestId: string;
491
+ file?: BlockResourceFile;
492
+ error?: BlockResourceFileErrorCode;
493
+ };
487
494
  } | {
488
495
  type: 'APP_WORKFLOWS_RESULT';
489
496
  payload: {
@@ -854,6 +861,13 @@ export type BlockToParentMessage = {
854
861
  requestId: string;
855
862
  modelVersionId: number;
856
863
  };
864
+ } | {
865
+ type: 'GET_RESOURCE_FILE';
866
+ payload: {
867
+ requestId: string;
868
+ modelVersionId: number;
869
+ fileId?: number;
870
+ };
857
871
  } | {
858
872
  type: 'QUERY_APP_WORKFLOWS';
859
873
  payload: {
@@ -1216,7 +1230,7 @@ export type BlockToParentMessageType = BlockToParentMessage['type'];
1216
1230
  * it is a measurement, not an invariant, and civitai's own compile-time gate
1217
1231
  * (published SDK union ⊆ `keyof INVENTORY`) is what holds one direction of it.
1218
1232
  */
1219
- export declare const BLOCK_TO_PARENT_MESSAGE_TYPES: readonly ["BLOCK_HELLO", "BLOCK_READY", "BLOCK_ERROR", "BLOCK_MESSAGE_REJECTED", "REQUEST_TOKEN", "RESIZE_IFRAME", "SUBMIT_WORKFLOW", "ESTIMATE_WORKFLOW", "ESTIMATE_WORKFLOW_BATCH", "POLL_WORKFLOW", "CANCEL_WORKFLOW", "OPEN_BUZZ_PURCHASE", "GET_BUZZ_BALANCE", "GET_VIEWER", "GET_BUZZ_TRANSACTIONS", "GET_BUZZ_ACCOUNTS", "GET_DAILY_COMPENSATION", "GET_WILDCARD_PACK", "QUERY_APP_WORKFLOWS", "PUBLISH_GENERATION_OUTPUTS", "CREATE_POST_FROM_APP", "RUN_TRAINING", "RUN_CONFIRMED_STEP", "GET_IMAGES_BY_IDS", "CANCEL_APP_WORKFLOW", "OPEN_CHECKPOINT_PICKER", "OPEN_RESOURCE_PICKER", "OPEN_IMAGE_UPLOAD", "OPEN_IMAGE_PICKER", "OPEN_MEDIA_UPLOAD", "SET_USER_CHECKPOINT", "NAVIGATE", "REQUEST_SIGN_IN", "REQUEST_CONSENT", "TRACK_EVENT", "APP_STORAGE_GET", "APP_STORAGE_SET", "APP_STORAGE_DELETE", "APP_STORAGE_LIST", "APP_STORAGE_QUOTA", "SHARED_LIST", "SHARED_GET_COUNT", "SHARED_GET_COUNTS", "SHARED_APPEND", "SHARED_VOTE", "SHARED_UNVOTE", "SHARED_WITHDRAW", "SHARED_UPDATE", "SHARED_GET", "SHARED_REPORT", "SAVE_IMAGE", "SET_COLLECTION_FOLLOW", "SET_ENTITY_REACTION", "GET_ENTITY_REACTIONS"];
1233
+ export declare const BLOCK_TO_PARENT_MESSAGE_TYPES: readonly ["BLOCK_HELLO", "BLOCK_READY", "BLOCK_ERROR", "BLOCK_MESSAGE_REJECTED", "REQUEST_TOKEN", "RESIZE_IFRAME", "SUBMIT_WORKFLOW", "ESTIMATE_WORKFLOW", "ESTIMATE_WORKFLOW_BATCH", "POLL_WORKFLOW", "CANCEL_WORKFLOW", "OPEN_BUZZ_PURCHASE", "GET_BUZZ_BALANCE", "GET_VIEWER", "GET_BUZZ_TRANSACTIONS", "GET_BUZZ_ACCOUNTS", "GET_DAILY_COMPENSATION", "GET_WILDCARD_PACK", "GET_RESOURCE_FILE", "QUERY_APP_WORKFLOWS", "PUBLISH_GENERATION_OUTPUTS", "CREATE_POST_FROM_APP", "RUN_TRAINING", "RUN_CONFIRMED_STEP", "GET_IMAGES_BY_IDS", "CANCEL_APP_WORKFLOW", "OPEN_CHECKPOINT_PICKER", "OPEN_RESOURCE_PICKER", "OPEN_IMAGE_UPLOAD", "OPEN_IMAGE_PICKER", "OPEN_MEDIA_UPLOAD", "SET_USER_CHECKPOINT", "NAVIGATE", "REQUEST_SIGN_IN", "REQUEST_CONSENT", "TRACK_EVENT", "APP_STORAGE_GET", "APP_STORAGE_SET", "APP_STORAGE_DELETE", "APP_STORAGE_LIST", "APP_STORAGE_QUOTA", "SHARED_LIST", "SHARED_GET_COUNT", "SHARED_GET_COUNTS", "SHARED_APPEND", "SHARED_VOTE", "SHARED_UNVOTE", "SHARED_WITHDRAW", "SHARED_UPDATE", "SHARED_GET", "SHARED_REPORT", "SAVE_IMAGE", "SET_COLLECTION_FOLLOW", "SET_ENTITY_REACTION", "GET_ENTITY_REACTIONS"];
1220
1234
  /**
1221
1235
  * The bucket a message type falls into when the protocol does not declare it.
1222
1236
  *
@@ -67,6 +67,7 @@ export const BLOCK_TO_PARENT_MESSAGE_TYPES = [
67
67
  'GET_BUZZ_ACCOUNTS',
68
68
  'GET_DAILY_COMPENSATION',
69
69
  'GET_WILDCARD_PACK',
70
+ 'GET_RESOURCE_FILE',
70
71
  'QUERY_APP_WORKFLOWS',
71
72
  'PUBLISH_GENERATION_OUTPUTS',
72
73
  'CREATE_POST_FROM_APP',
@@ -3214,6 +3214,78 @@ export interface BlockWildcardPack {
3214
3214
  sfwOnly: boolean;
3215
3215
  };
3216
3216
  }
3217
+ /**
3218
+ * The CLOSED error set a `RESOURCE_FILE_RESULT` carries on failure
3219
+ * (civitai/civitai-app-starters#664). Like {@link BlockWildcardPackErrorCode} it
3220
+ * is a discriminated code, never free text. What each code covers is the host's
3221
+ * behaviour in civitai/civitai#6818 (`resource-file.service.ts`,
3222
+ * `resourceFileParse.ts`, `resourceFileHost.ts`):
3223
+ *
3224
+ * - `not-found` — every refusal of the resolve step except maturity: no such
3225
+ * version; not a `Workflows`/`ComfyWorkflows` version; no such file, or (for a
3226
+ * non-owner) the file is not `Public`; the site's download gate, evaluated
3227
+ * WITHOUT moderator rights, refuses it; an unpublished draft (the owner's own
3228
+ * included); an early-access or paid version for anyone but its owner (buyers
3229
+ * included); downloads disabled for anyone but the owner; and, for anyone but
3230
+ * the owner (moderators included), a POI model or a model or version whose
3231
+ * availability is not open (`Public` or `Unsearchable`), e.g. `Private`.
3232
+ * - `forbidden` — the version passes every gate above but is above the viewer's
3233
+ * maturity ceiling on this site (checked AFTER the download gate, so a version
3234
+ * the viewer cannot download never reveals its rating); or the app is running
3235
+ * in review preview, which refuses before resolving anything.
3236
+ * - `unauthorized` — the viewer is signed out.
3237
+ * - `too-large` — the file's advertised size, its `Content-Length` or the body
3238
+ * as it streams is over 32 MB; or no entry could be returned and at least one
3239
+ * was dropped by a size cap (4 MB per entry, 16 MB inflated in total) — so a
3240
+ * single `.json` over 4 MB is `too-large`.
3241
+ * - `parse-failed` — not a `.json` or `.zip`, a corrupt zip, or no JSON entry
3242
+ * that could be read and parsed. ALSO the host's catch-all: a network error, a
3243
+ * non-OK fetch, no answer within the host's 110 s deadline, a transient storage
3244
+ * failure in the resolve step, or any other server error. So it can be
3245
+ * transient, and one retry is reasonable. It is also the `dev:live` reply,
3246
+ * which cannot serve this bridge.
3247
+ * - `busy` — the tab already has 3 resource-file requests in flight; retry.
3248
+ * - `rate-limited` — the viewer's 30-a-minute budget is spent; retry later.
3249
+ */
3250
+ export type BlockResourceFileErrorCode = 'not-found' | 'forbidden' | 'unauthorized' | 'too-large' | 'parse-failed' | 'busy' | 'rate-limited';
3251
+ /**
3252
+ * How the host classified one parsed JSON entry: `api` when every top-level
3253
+ * value has `class_type` and `inputs` (the ComfyUI API format), `ui` when it has
3254
+ * a `nodes` array (the ComfyUI UI/editor format), otherwise `unknown`.
3255
+ */
3256
+ export type BlockResourceFileEntryFormat = 'ui' | 'api' | 'unknown';
3257
+ /** Which file the host served, and what it belongs to. */
3258
+ export interface BlockResourceFileMeta {
3259
+ modelId: number;
3260
+ modelVersionId: number;
3261
+ /** The file the host picked (or the `fileId` the request named). */
3262
+ fileId: number;
3263
+ fileName: string;
3264
+ modelName: string;
3265
+ versionName: string;
3266
+ creatorUsername: string | null;
3267
+ }
3268
+ /** One parsed JSON document out of the file. */
3269
+ export interface BlockResourceFileEntry {
3270
+ /** The entry's path inside the archive, or the file name for a plain `.json`. */
3271
+ path: string;
3272
+ format: BlockResourceFileEntryFormat;
3273
+ /** The parsed JSON, as-is. Check `format` before reading it as a graph. */
3274
+ graph: unknown;
3275
+ }
3276
+ /**
3277
+ * A resource file the host resolved, fetched, unzipped and parsed AS THE VIEWER
3278
+ * and returned on `RESOURCE_FILE_RESULT`. A plain `.json` file gives one entry;
3279
+ * a `.zip` gives one per `.json` entry (other entries, `__MACOSX/` and dot-files
3280
+ * are skipped and do not count), at most 20. `truncated` is true when a JSON
3281
+ * entry was dropped: past the 20, over the 4 MB per-entry or 16 MB total inflate
3282
+ * cap, unreadable, or not valid JSON.
3283
+ */
3284
+ export interface BlockResourceFile {
3285
+ meta: BlockResourceFileMeta;
3286
+ entries: BlockResourceFileEntry[];
3287
+ truncated: boolean;
3288
+ }
3217
3289
  /**
3218
3290
  * One result image on an {@link AppWorkflow}. Mirrors civitai/civitai's
3219
3291
  * `AppWorkflowImage` projection (`src/server/services/blocks/workflow.service.ts`,
package/dist/index.d.ts CHANGED
@@ -25,11 +25,11 @@
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
- * 197 symbols and that side effect into the root would make every OAuth app
28
+ * 202 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 197 is ASSERTED, not merely quoted — by
32
+ * 🔴 That 202 is ASSERTED, not merely quoted — by
33
33
  * `packages/civitai-app-sdk/test/export-surface.test.ts`, which pins
34
34
  * `surface.get('./blocks').size`. It said 119 here against a real 125 until
35
35
  * 2026-10-04, because the existing checks pin the root as an exact union and
package/dist/index.js CHANGED
@@ -25,11 +25,11 @@
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
- * 197 symbols and that side effect into the root would make every OAuth app
28
+ * 202 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 197 is ASSERTED, not merely quoted — by
32
+ * 🔴 That 202 is ASSERTED, not merely quoted — by
33
33
  * `packages/civitai-app-sdk/test/export-surface.test.ts`, which pins
34
34
  * `surface.get('./blocks').size`. It said 119 here against a real 125 until
35
35
  * 2026-10-04, because the existing checks pin the root as an exact union and
@@ -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` — 55 `$type` names and what each one does) and the
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 55 entries, exactly THREE sit under its "Platform internals" heading —
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 55 `$type`s; this map covers 47. The 8 with
101
- * no generated template in the pinned `@civitai/client` are `imageScanning`,
102
- * `liveTextToSpeech`, `liveTranscription`, `merge`, `preprocessVideo`,
103
- * `promptModeration`, `soniloAudioGen`, `yuE2`, and
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 55 step types.
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` — 55 `$type` names and what each one does) and the
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 55 entries, exactly THREE sit under its "Platform internals" heading —
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 55 `$type`s; this map covers 47. The 8 with
101
- * no generated template in the pinned `@civitai/client` are `imageScanning`,
102
- * `liveTextToSpeech`, `liveTranscription`, `merge`, `preprocessVideo`,
103
- * `promptModeration`, `soniloAudioGen`, `yuE2`, and
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@civitai/app-sdk",
3
- "version": "0.77.0",
3
+ "version": "0.79.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",