@civitai/app-sdk 0.91.0 → 0.93.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
@@ -28,18 +28,19 @@ pnpm add @civitai/app-sdk
28
28
  | `oauth/*` — `generatePkce`, `buildAuthorizeUrl`, `exchangeCode`, `refreshToken`, `revokeToken`, `fetchMe` | The Civitai OAuth flow (Authorization Code + PKCE S256), as a set of stateless functions you call from your server-side handlers. |
29
29
  | `scopes/*` — `TokenScope`, `TokenScopePresets`, `bitmaskFromScopes`, `scopesFromBitmask`, `hasScope`, `getScopeLabel` | Civitai scopes are stored as bitmasks. These helpers let you compose scope sets from named flags rather than magic numbers. |
30
30
  | `cookies/*` — `sealCookie`, `unsealCookie`, `buildSetCookieHeader`, `readCookie` | AES-256-GCM authenticated cookie crypto. Use to seal a session blob (refresh token, expiry, scope) into an `httpOnly` cookie with zero external session store. |
31
- | `orchestrator/*` — `createOrchestratorClient`, `estimateWorkflow`, `submitWorkflow`, `getWorkflow`, `pollWorkflow`, `buildTextToImageBody`, `buildImageGenBody`, `buildWorkflowBody`, `WORKFLOW_STEP_TYPES`, `IMAGE_GEN_ENGINES`, `isTerminal`, `extractImageUrls`, `OrchestratorError`, `WorkflowSnapshot`, `GenerateInput`, `ImageGenInput`, `WorkflowStepType`, `ImageGenEngine`, `DEFAULT_MODEL_AIR` | Orchestrator workflow glue — types, body builders, raw HTTP, and long-poll helper. Client + server safe (fetch-only). `estimateWorkflow` calls `?whatif=true` to preview Buzz cost without spending. `pollWorkflow` long-polls to terminal status. `WORKFLOW_STEP_TYPES` is the catalog of every step `$type` the orchestrator accepts. |
32
- | `orchestrator/steps` — `WorkflowStepTemplates`, `WorkflowStepTemplateFor`, `WorkflowStepInputFor`, `AnyWorkflowStepTemplate`, `TypedWorkflowTemplate` | **Type-only** subpath (0 runtime bytes) keying the orchestrator's generated workflow-step shapes from `@civitai/client` by wire `$type`, so apps compose real step bodies against types that track the spec instead of hand-maintained copies. Requires the optional peer `@civitai/client@beta`. Type surface only — it grants no submit permission; see "Typed step shapes" below. |
31
+ | `orchestrator/*` — `createOrchestratorClient`, `estimateWorkflow`, `submitWorkflow`, `getWorkflow`, `pollWorkflow`, `buildTextToImageBody`, `buildImageGenBody`, `buildWorkflowBody`, `WORKFLOW_STEP_TYPES`, `IMAGE_GEN_ENGINES`, `isTerminal`, `extractImageUrls`, `OrchestratorError`, `OrchestratorLogger`, `WorkflowSnapshot`, `GenerateInput`, `ImageGenInput`, `WorkflowStepType`, `ImageGenEngine`, `DEFAULT_MODEL_AIR` | Orchestrator workflow glue — types, body builders, raw HTTP, and long-poll helper. Client + server safe (fetch-only). `estimateWorkflow` calls `?whatif=true` to preview Buzz cost without spending. `pollWorkflow` long-polls to terminal status. `WORKFLOW_STEP_TYPES` is the catalog of every step `$type` the orchestrator accepts. |
32
+ | `orchestrator/steps` — `WorkflowStepTemplates`, `WorkflowStepTemplateFor`, `WorkflowStepInputFor`, `AnyWorkflowStepTemplate`, `TypedWorkflowTemplate` | **Type-only** subpath (0 runtime bytes) keying the orchestrator's generated workflow-step shapes from `@civitai/client` by wire `$type`, so apps compose real step bodies against generated types instead of hand-maintained copies. Requires the optional peer `@civitai/client@beta`, which is frozen (renamed upstream; see "Installing the peer"). Type surface only — it grants no submit permission; see "Typed step shapes" below. |
33
33
  | `blocks/*` — `BlockManifestError`, `BLOCK_SCOPES`, `BLOCK_SCOPE_PATTERN`, `isMessage`, types (`BlockManifestV1`, `BlockContext`, `BlockToken`, `BlockSettings`, `ViewerInfo`, `ThemeInfo`, `BlockWorkflowSnapshot`, `BlockInitPayload`, `ParentToBlockMessage`, `BlockToParentMessage`, …) | Framework-agnostic contract for [Civitai Apps](https://github.com/civitai/civitai-app-starters/blob/main/docs/build-your-first-app-block.md). Ships a byte-identical copy of the server-published canonical JSON Schema (draft 2020-12, https://civitai.com/schemas/app-block/v1.json) at the `./schemas/app-block/v1.json` subpath for offline validation; a CI drift-check keeps it in sync. Runtime-agnostic and **zero runtime dependencies** — no React, no DOM types, nothing in your install graph. Hooks and the iframe transport live in a separate package. |
34
34
  | `manifest/*` — `defineBlock`, `SCHEMA_DIVERGENCES`, `KNOWN_GAPS` (**Node only**) | Build-time manifest validation. `defineBlock(config)` compiles the vendored canonical schema with [Ajv](https://ajv.js.org) and validates a `BlockManifestV1` against it, so authoring mistakes surface in `pnpm dev` instead of at `civitai app validate`/submit. It is **derived from the schema, not a hand-written mirror of it** — that mirror is what produced [#330](https://github.com/civitai/civitai-app-starters/issues/330). Needs `node:fs` and the optional peer `ajv`, which is why it is not on the browser-facing `./blocks` surface. |
35
35
  | `vite/*` — `blockManifestPlugin` (**Node only**) | A Vite plugin wrapping `defineBlock`, firing from `configResolved` — the one hook Vite calls on both the dev-server and the build path. Every block scaffold registers it, so `pnpm dev`, `pnpm dev:harness` and `pnpm build` all fail on a bad manifest with the offending field path. On the dev server only, it also exposes the manifest's `scopes` + `storage` to `@civitai/sdk` for a dev-tunnel local preview. Optional peers: `ajv` (runtime) and `vite` (types only). |
36
36
  | `save-zip/*` — `validateSaveZip`, `verifySaveZipInflate`, `looksLikeSaveZip`, `SAVE_ZIP_MAX_BYTES`, `SAVE_ZIP_LIMITS`, `SAVE_ZIP_ALLOWED_EXTENSIONS`, the `SAVE_ZIP_*_ERROR` strings | The `.zip` validator behind `SAVE_IMAGE { bytes }` — the ONE copy: the civitai.com host runs it before it starts a download, and `@civitai/blocks-react`'s `createMockHost` imports it, so a block's tests accept and refuse the zips production does. Structure (local headers, central directory and EOCD laid end to end, cross-checked), entry names and types, declared sizes, then an inflate check (`DecompressionStream`). The rules an app author needs are in `@civitai/blocks-react`'s README under `useSaveImage()`. Dependency-free, browser and Node. |
37
+ | `save-model3d/*` — `looksLikeSaveModel3d`, `isValidSaveModel3d`, `SAVE_MODEL3D_MAX_BYTES`, `SAVE_MODEL3D_MAX_JSON_CHUNK_BYTES`, `SAVE_MODEL3D_EXTENSION`, `SaveModel3dType` | The binary glTF (`.glb`) / binary FBX (`.fbx`) check behind `SAVE_IMAGE { bytes }` — the ONE copy, shared by the civitai.com host and `createMockHost` like `save-zip`. A prefix test that picks the per-file cap (`SAVE_MODEL3D_MAX_BYTES`), then a strict structural check (a GLB's declared length and chunks fill the buffer exactly; an FBX's top-level records reach the null record with at most a footer after it). The rules an app author needs are in `@civitai/blocks-react`'s README under `useSaveImage()`. Dependency-free, browser and Node. |
37
38
 
38
39
  ## Entry points, and what the root barrel is
39
40
 
40
41
  The root — `import … from '@civitai/app-sdk'` — is **exactly the union of four subpaths**: `@civitai/app-sdk/oauth`, `/scopes`, `/cookies` and `/orchestrator`. All of each, and nothing else. Import from the root when you want the OAuth-app surface in one specifier; import a subpath when you want only that slice. The two are the same symbols either way, which is asserted in both directions by `test/export-surface.test.ts` — the root cannot quietly gain a symbol none of those four exports, or miss one they do.
41
42
 
42
- The other six subpaths are **deliberately not on the root**, each for a concrete cost it would push onto every consumer:
43
+ The other seven subpaths are **deliberately not on the root**, each for a concrete cost it would push onto every consumer:
43
44
 
44
45
  | Subpath | Why it is not on the root |
45
46
  |---|---|
@@ -49,6 +50,7 @@ The other six subpaths are **deliberately not on the root**, each for a concrete
49
50
  | `@civitai/app-sdk/manifest` | **Node only** — needs `node:fs` and the optional peer `ajv`. |
50
51
  | `@civitai/app-sdk/vite` | **Node only** — optional peers `ajv` (runtime) and `vite` (types). |
51
52
  | `@civitai/app-sdk/save-zip` | The host's `SAVE_IMAGE` zip validator, shared by the civitai.com host and `@civitai/blocks-react`'s `createMockHost`. An OAuth app never needs it. |
53
+ | `@civitai/app-sdk/save-model3d` | The host's `SAVE_IMAGE` binary glTF / FBX check, shared the same way. An OAuth app never needs it. |
52
54
 
53
55
  > One name is declared twice on purpose: `BuzzAccountType` is the full set of Civitai Buzz pools on the root and `/oauth`, and a narrower three-pool union on `/blocks` — a block can neither prefer nor read the others. Same name, two subpaths, two types; the divergence is pinned rather than merged.
54
56
 
@@ -68,7 +70,7 @@ import { defineBlock } from '@civitai/app-sdk/manifest';
68
70
  // The same gate as a Vite plugin (NODE ONLY — optional peers `ajv` + `vite`):
69
71
  import { blockManifestPlugin } from '@civitai/app-sdk/vite';
70
72
  // Type-only: the orchestrator's generated per-step shapes. Needs the optional
71
- // peer `@civitai/client@beta` — see "Typed step shapes" below:
73
+ // (frozen) peer `@civitai/client@beta` — see "Typed step shapes" below:
72
74
  import type { TypedWorkflowTemplate } from '@civitai/app-sdk/orchestrator/steps';
73
75
  // Opaque-origin storage shim — see "Web storage in a block" below:
74
76
  import '@civitai/app-sdk/safe-storage';
@@ -887,6 +889,16 @@ console.log(`Hi ${me.username}`);
887
889
  > explicit `baseUrl` to each call only when targeting a local / self-hosted
888
890
  > instance (e.g. a dev auth hub vs a dev main app).
889
891
 
892
+ > **Failed orchestrator calls are logged, and you choose where.** Before it
893
+ > throws `OrchestratorError`, `callOrchestrator` (which `estimateWorkflow`,
894
+ > `submitWorkflow`, `getWorkflow` and `pollWorkflow` all use) logs one line
895
+ > with the method, path, status text and the first 500 characters of the raw response body.
896
+ > That body can echo what you submitted, such as the user's prompt. By default
897
+ > the line goes to `console.error`. Pass `logger: { error: (...args) => … }` to
898
+ > `createOrchestratorClient` to send it to your own logger, or `logger: null`
899
+ > to keep it out of your logs entirely. The thrown error still carries `status`
900
+ > and `body` either way.
901
+
890
902
  > **`fallbackScope`, and what happens to a `scope` we cannot read.** Civitai's
891
903
  > token endpoint returns `scope` as a decimal bitmask in a JSON *string*
892
904
  > (`"scope": "114689"` — see the
@@ -982,7 +994,7 @@ Per-engine input shapes (`aspectRatio`, `resolution`, `numImages`, etc.) come fr
982
994
 
983
995
  ## Typed step shapes (`@civitai/app-sdk/orchestrator/steps`)
984
996
 
985
- `WORKFLOW_STEP_TYPES` tells you which `$type`s exist; the body builders above take `input: unknown`. This subpath is the other half: the real per-step input shapes, keyed by wire `$type` over the orchestrator's own generated client (`@civitai/client`) so they track the spec by codegen rather than by hand.
997
+ `WORKFLOW_STEP_TYPES` tells you which `$type`s exist; the body builders above take `input: unknown`. This subpath is the other half: the real per-step input shapes, keyed by wire `$type` over the orchestrator's own generated client (`@civitai/client`) so they come from codegen rather than by hand.
986
998
 
987
999
  It is **type-only** — every export is a `type`, the built `dist/orchestrator/steps.js` is an empty module, and bundling it yields 0 bytes. Nothing is added to your runtime.
988
1000
 
@@ -1027,7 +1039,7 @@ What it exports:
1027
1039
 
1028
1040
  > 🔴 **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.
1029
1041
  >
1030
- > 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.
1042
+ > The two surfaces move independently: the catalog tracks the **live** orchestrator spec (a daily job syncs it), while these types come from `@civitai/client`, which is frozen at `0.2.0-beta.98` and will receive no further releases (see "Installing the peer"). So the gap will not close through a `@civitai/client` release; it changes only if this subpath's types source does. 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.
1031
1043
 
1032
1044
  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'`.
1033
1045
 
@@ -1041,6 +1053,8 @@ In practice `WorkflowStepTemplateFor<T>` and `WorkflowStepInputFor<T>` are the b
1041
1053
  pnpm add -D @civitai/client@beta
1042
1054
  ```
1043
1055
 
1056
+ > 🔴 **`@civitai/client` is frozen, and this subpath intentionally stays on it.** The package was renamed to `@civitai/orchestration-client`; npm marks `@civitai/client` deprecated ("Moved to @civitai/orchestration-client"), and `0.2.0-beta.98` under the `beta` tag is its last release. It remains installable and works as documented here. This subpath's types import the module name `@civitai/client`, so installing only `@civitai/orchestration-client` does **not** satisfy it: the guard below reports exactly as if the peer were missing. Keep `@civitai/client@beta` installed for these types. If you want step types generated from the renamed client, `@civitai/sdk` (a separate package in this repo) types its orchestration steps from `@civitai/orchestration-client`.
1057
+
1044
1058
  > 🔴 **Use the `beta` tag, not `latest`.** `@civitai/client`'s npm `latest` dist-tag points at `0.1.1-beta.0`, roughly 97 betas behind the `beta` tag the orchestrator is actually generated against — and missing most of the step types above. A plain `pnpm add @civitai/client` installs the stale one with no error; the first symptom is `TextToImageStepTemplate` not existing.
1045
1059
 
1046
1060
  > 🔴 **If the peer's types don't resolve, these types tell you — they used to just stop checking.** The unresolved `@civitai/client` import is in the SDK's shipped `steps.d.ts`, so `skipLibCheck: true` — the default for a TypeScript app, and set by every starter in this repo — suppresses the `TS2307` along with every other declaration-file diagnostic, and the types above degrade to an error type that behaves like `any`. Measured on a consumer with the peer uninstalled, against the subpath as it stood before the guard existed: **1 diagnostic** — a planted `const x: number = 's'` — on a project that also had a deliberately wrong `$type`. The wrong `$type` reported nothing.
@@ -943,7 +943,7 @@ export type WorkflowStatus = 'idle' | 'estimating' | 'confirming' | 'submitting'
943
943
  export type BuzzAccountType = 'blue' | 'green' | 'yellow';
944
944
  /**
945
945
  * Generation parameters a block can override. All optional — the host fills
946
- * sensible defaults (sampler='Euler', steps=25, dimensions from the
946
+ * sensible defaults (the family's default sampler, steps=25, dimensions from the
947
947
  * base-model family) when omitted, so the simplest block can submit
948
948
  * `{ kind: 'textToImage', modelId, modelVersionId, params: { prompt } }`.
949
949
  *
@@ -955,7 +955,13 @@ export interface BlockTextToImageParams {
955
955
  negativePrompt?: string;
956
956
  /** Range 1–30. */
957
957
  cfgScale?: number;
958
- /** Sampler name (e.g. 'Euler', 'DPM++ 2M Karras'). Defaults to 'Euler'. */
958
+ /**
959
+ * Sampler name. Valid names depend on the model family: read them with
960
+ * `fetchGenerationSamplers` from `@civitai/app-sdk/blocks`. A name the family
961
+ * does not offer is replaced by the family's default, with no error. Omitted,
962
+ * the host uses the family's default, and sends none for a family with no
963
+ * sampler control.
964
+ */
959
965
  sampler?: string;
960
966
  /** Range 1–50. */
961
967
  steps?: number;
package/dist/index.d.ts CHANGED
@@ -17,7 +17,7 @@
17
17
  * accident rather than by decision. `./oauth` now re-exports `types.ts`, which
18
18
  * fixes it additively: the root's surface did not change.
19
19
  *
20
- * ## The six subpaths deliberately NOT in the root, and why
20
+ * ## The seven subpaths deliberately NOT in the root, and why
21
21
  *
22
22
  * "Reachable two ways" is a cost, but an absent export is a worse one, so the
23
23
  * bar for staying out is a concrete harm to the importer. Each of these clears
@@ -48,9 +48,11 @@
48
48
  * - **`./save-zip`** — the host's `SAVE_IMAGE` zip validator, the one copy the
49
49
  * civitai.com host and `@civitai/blocks-react`'s `createMockHost` share. An
50
50
  * OAuth app never saves a zip through a block host.
51
+ * - **`./save-model3d`** — the host's `SAVE_IMAGE` binary glTF / FBX check,
52
+ * shared the same way and for the same reason.
51
53
  *
52
54
  * The ledger in `test/export-surface.test.ts` carries one of these reasons per
53
- * `exports` key and fails when the key set GROWS or SHRINKS — so a seventh
55
+ * `exports` key and fails when the key set GROWS or SHRINKS — so an eighth
54
56
  * subpath cannot arrive without a stated reason to exist, and a deleted one
55
57
  * cannot leave a stale reason behind.
56
58
  *
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@
17
17
  * accident rather than by decision. `./oauth` now re-exports `types.ts`, which
18
18
  * fixes it additively: the root's surface did not change.
19
19
  *
20
- * ## The six subpaths deliberately NOT in the root, and why
20
+ * ## The seven subpaths deliberately NOT in the root, and why
21
21
  *
22
22
  * "Reachable two ways" is a cost, but an absent export is a worse one, so the
23
23
  * bar for staying out is a concrete harm to the importer. Each of these clears
@@ -48,9 +48,11 @@
48
48
  * - **`./save-zip`** — the host's `SAVE_IMAGE` zip validator, the one copy the
49
49
  * civitai.com host and `@civitai/blocks-react`'s `createMockHost` share. An
50
50
  * OAuth app never saves a zip through a block host.
51
+ * - **`./save-model3d`** — the host's `SAVE_IMAGE` binary glTF / FBX check,
52
+ * shared the same way and for the same reason.
51
53
  *
52
54
  * The ledger in `test/export-surface.test.ts` carries one of these reasons per
53
- * `exports` key and fails when the key set GROWS or SHRINKS — so a seventh
55
+ * `exports` key and fails when the key set GROWS or SHRINKS — so an eighth
54
56
  * subpath cannot arrive without a stated reason to exist, and a deleted one
55
57
  * cannot leave a stale reason behind.
56
58
  *
@@ -370,6 +370,10 @@ export interface WorkflowSnapshot {
370
370
  export interface OrchestratorClient {
371
371
  baseUrl: string;
372
372
  accessToken: string;
373
+ logger?: OrchestratorLogger | null;
374
+ }
375
+ export interface OrchestratorLogger {
376
+ error: (...args: unknown[]) => void;
373
377
  }
374
378
  export declare class OrchestratorError extends Error {
375
379
  readonly status: number;
@@ -382,6 +386,14 @@ export interface CreateOrchestratorClientOptions {
382
386
  accessToken: string;
383
387
  /** Orchestrator base URL. Defaults to Civitai's prod orchestrator. */
384
388
  baseUrl?: string;
389
+ /**
390
+ * Where {@link callOrchestrator} logs a failed response before it throws:
391
+ * method, path, status text and the first 500 characters of the raw response body, which
392
+ * can echo the submitted input (a prompt, for example). Omit it to keep
393
+ * `console.error`; pass `null` to log nothing. This covers the orchestrator
394
+ * client only, not the OAuth helpers.
395
+ */
396
+ logger?: OrchestratorLogger | null;
385
397
  }
386
398
  /**
387
399
  * Build an {@link OrchestratorClient} from a user's access token. Pass the
@@ -396,9 +408,9 @@ export interface CreateOrchestratorClientOptions {
396
408
  */
397
409
  export declare function createOrchestratorClient(opts: CreateOrchestratorClientOptions): OrchestratorClient;
398
410
  /**
399
- * Internal raw-fetch helper. Logs the failing response to console.error and
400
- * throws {@link OrchestratorError} on non-2xx. Exported so callers can build
401
- * their own orchestrator routes without duplicating this code.
411
+ * Internal raw-fetch helper. Logs the failing response to the configured logger
412
+ * and throws {@link OrchestratorError} on non-2xx. Exported so callers can
413
+ * build their own orchestrator routes without duplicating this code.
402
414
  */
403
415
  export declare function callOrchestrator(client: OrchestratorClient, path: string, init?: RequestInit): Promise<unknown>;
404
416
  export interface BuildTextToImageBodyOptions {
@@ -345,16 +345,19 @@ export class OrchestratorError extends Error {
345
345
  * const estimate = await estimateWorkflow(client, body);
346
346
  */
347
347
  export function createOrchestratorClient(opts) {
348
- return {
348
+ const client = {
349
349
  baseUrl: opts.baseUrl ?? DEFAULT_ORCHESTRATOR_BASE_URL,
350
350
  accessToken: opts.accessToken,
351
351
  };
352
+ if (opts.logger !== undefined)
353
+ client.logger = opts.logger;
354
+ return client;
352
355
  }
353
356
  // ---------- Raw HTTP --------------------------------------------------------
354
357
  /**
355
- * Internal raw-fetch helper. Logs the failing response to console.error and
356
- * throws {@link OrchestratorError} on non-2xx. Exported so callers can build
357
- * their own orchestrator routes without duplicating this code.
358
+ * Internal raw-fetch helper. Logs the failing response to the configured logger
359
+ * and throws {@link OrchestratorError} on non-2xx. Exported so callers can
360
+ * build their own orchestrator routes without duplicating this code.
358
361
  */
359
362
  export async function callOrchestrator(client, path, init = {}) {
360
363
  const { headers, ...rest } = init;
@@ -375,8 +378,22 @@ export async function callOrchestrator(client, path, init = {}) {
375
378
  body = text;
376
379
  }
377
380
  if (!res.ok) {
378
- console.error(`[orchestrator] ${init.method ?? 'GET'} ${path} -> ${res.status} ${res.statusText}\n` +
379
- ` raw body: ${text.length ? text.slice(0, 500) : '(empty)'}`);
381
+ const logger = client.logger === undefined ? console : client.logger;
382
+ // A caller-supplied logger must never change what this function throws:
383
+ // callers branch on `instanceof OrchestratorError` to pass the status on.
384
+ // So a logger that throws is swallowed, and one that returns a rejected
385
+ // promise (an async log sink that is down) is caught rather than left as
386
+ // an unhandled rejection that would crash a Node process.
387
+ try {
388
+ const logged = logger?.error(`[orchestrator] ${init.method ?? 'GET'} ${path} -> ${res.status} ${res.statusText}\n` +
389
+ ` raw body: ${text.length ? text.slice(0, 500) : '(empty)'}`);
390
+ if (logged && typeof logged.then === 'function') {
391
+ Promise.resolve(logged).catch(() => { });
392
+ }
393
+ }
394
+ catch {
395
+ // Logging is best-effort; the OrchestratorError below is the contract.
396
+ }
380
397
  throw new OrchestratorError(`HTTP ${res.status}`, res.status, body);
381
398
  }
382
399
  return body;
@@ -6,8 +6,12 @@
6
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
- * per-step input shapes, tracked against the orchestrator's OpenAPI spec by
10
- * codegen instead of by hand.
9
+ * per-step input shapes, generated from the orchestrator's OpenAPI spec by
10
+ * codegen instead of written by hand. 🔴 `@civitai/client` is FROZEN: it was
11
+ * renamed `@civitai/orchestration-client`, npm marks it deprecated, and
12
+ * `0.2.0-beta.98` is its last release. This module still imports the name
13
+ * `@civitai/client` on purpose, so the renamed package alone does not satisfy
14
+ * it (see "Why this is a separate deep entry point" below).
11
15
  *
12
16
  * What this module adds on top of `@civitai/client` is the `$type` → template
13
17
  * MAP (`WorkflowStepTemplates`) and the lookups derived from it. The generated
@@ -106,9 +110,10 @@
106
110
  *
107
111
  * That gap is EXPECTED and is not a defect in either surface. The catalog
108
112
  * tracks the LIVE orchestrator spec (`pnpm check:catalogs` and the daily
109
- * `sync-orchestrator-catalogs` automation keep it there); these types track
110
- * whatever `@civitai/client` was last published from. The catalog syncs ahead;
111
- * the client catches up later. What is NOT optional is that the gap stays
113
+ * `sync-orchestrator-catalogs` automation keep it there); these types come
114
+ * from `@civitai/client`, which is frozen and will receive no further
115
+ * releases. So the gap does not close through a client release; it changes
116
+ * only if this module's types source does. What is NOT optional is that the gap stays
112
117
  * stated: it is spelled as a `never` ledger in
113
118
  * `test/orchestrator/step-templates.test-d.ts` (which also pins the compile
114
119
  * error above, one `@ts-expect-error` per gap `$type`), and the sentence naming
@@ -133,6 +138,11 @@
133
138
  * pnpm add -D @civitai/client@beta
134
139
  * ```
135
140
  *
141
+ * That is the frozen package's last release, and it stays this module's peer:
142
+ * installing only the renamed `@civitai/orchestration-client` leaves the
143
+ * `@civitai/client` import unresolved, which the guard below reports exactly as
144
+ * a missing peer.
145
+ *
136
146
  * 🔴 **WITHOUT A GUARD, FORGETTING THE PEER IS SILENT UNDER
137
147
  * `skipLibCheck: true`, WHICH IS THE DEFAULT.** The unresolved
138
148
  * `@civitai/client` import lands in the emitted `steps.d.ts`, so `skipLibCheck`
@@ -336,10 +346,11 @@ interface StepTemplateMap {
336
346
  * catalog nor the pinned client knows about. That is the catalog's own
337
347
  * drift check's job (`pnpm check:catalogs`, which re-fetches the LIVE spec).
338
348
  *
339
- * The two can legitimately disagree for a while: the catalog tracks the live
340
- * spec, while these types track whatever `@civitai/client` was last published
341
- * from. When the catalog syncs ahead, name the not-yet-typed step types in the
342
- * test's ledger in the same PR, and clear them when the client republishes.
349
+ * The two can legitimately disagree: the catalog tracks the live spec, while
350
+ * these types come from the frozen `@civitai/client`. When the catalog syncs
351
+ * ahead, name the not-yet-typed step types in the test's ledger in the same
352
+ * PR. No client republish will clear them; only a change of this module's
353
+ * types source can.
343
354
  */
344
355
  export type WorkflowStepTemplates = {
345
356
  [K in keyof StepTemplateMap]: GuardPeer<StepTemplateMap[K]>;
@@ -6,8 +6,12 @@
6
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
- * per-step input shapes, tracked against the orchestrator's OpenAPI spec by
10
- * codegen instead of by hand.
9
+ * per-step input shapes, generated from the orchestrator's OpenAPI spec by
10
+ * codegen instead of written by hand. 🔴 `@civitai/client` is FROZEN: it was
11
+ * renamed `@civitai/orchestration-client`, npm marks it deprecated, and
12
+ * `0.2.0-beta.98` is its last release. This module still imports the name
13
+ * `@civitai/client` on purpose, so the renamed package alone does not satisfy
14
+ * it (see "Why this is a separate deep entry point" below).
11
15
  *
12
16
  * What this module adds on top of `@civitai/client` is the `$type` → template
13
17
  * MAP (`WorkflowStepTemplates`) and the lookups derived from it. The generated
@@ -106,9 +110,10 @@
106
110
  *
107
111
  * That gap is EXPECTED and is not a defect in either surface. The catalog
108
112
  * tracks the LIVE orchestrator spec (`pnpm check:catalogs` and the daily
109
- * `sync-orchestrator-catalogs` automation keep it there); these types track
110
- * whatever `@civitai/client` was last published from. The catalog syncs ahead;
111
- * the client catches up later. What is NOT optional is that the gap stays
113
+ * `sync-orchestrator-catalogs` automation keep it there); these types come
114
+ * from `@civitai/client`, which is frozen and will receive no further
115
+ * releases. So the gap does not close through a client release; it changes
116
+ * only if this module's types source does. What is NOT optional is that the gap stays
112
117
  * stated: it is spelled as a `never` ledger in
113
118
  * `test/orchestrator/step-templates.test-d.ts` (which also pins the compile
114
119
  * error above, one `@ts-expect-error` per gap `$type`), and the sentence naming
@@ -133,6 +138,11 @@
133
138
  * pnpm add -D @civitai/client@beta
134
139
  * ```
135
140
  *
141
+ * That is the frozen package's last release, and it stays this module's peer:
142
+ * installing only the renamed `@civitai/orchestration-client` leaves the
143
+ * `@civitai/client` import unresolved, which the guard below reports exactly as
144
+ * a missing peer.
145
+ *
136
146
  * 🔴 **WITHOUT A GUARD, FORGETTING THE PEER IS SILENT UNDER
137
147
  * `skipLibCheck: true`, WHICH IS THE DEFAULT.** The unresolved
138
148
  * `@civitai/client` import lands in the emitted `steps.d.ts`, so `skipLibCheck`
@@ -0,0 +1,54 @@
1
+ /**
2
+ * `@civitai/app-sdk/save-model3d` — the App Blocks `SAVE_IMAGE { bytes }` 3D model check: binary
3
+ * glTF (`.glb`) and binary FBX (`.fbx`).
4
+ *
5
+ * 🔴 THE ONE COPY, like `./save-zip`. The civitai.com host and `@civitai/blocks-react`'s
6
+ * `createMockHost` both import this module, so the mock accepts and refuses exactly the models
7
+ * production does. Change the rules here, release, and bump the host's `@civitai/app-sdk`.
8
+ *
9
+ * glTF-JSON (`.gltf`), ASCII FBX and OBJ are NOT model types here: they are text, so the host saves
10
+ * them as `.txt` (and a `.gltf` usually references sidecar files a single save could not carry).
11
+ *
12
+ * Two steps, the same split as the zip rules:
13
+ * 1. {@link looksLikeSaveModel3d} — does the buffer START like one of these? Decided on the first
14
+ * 8 (GLB) or 21 (FBX) bytes, so a caller can pick the per-file cap
15
+ * ({@link SAVE_MODEL3D_MAX_BYTES}) before decoding anything. Both prefixes contain a NUL byte,
16
+ * so no text payload can ever be a candidate: refusing a candidate that fails step 2 takes
17
+ * nothing away from a text classifier that refuses every NUL-bearing buffer.
18
+ * 2. {@link isValidSaveModel3d} — the strict structural check. A GLB must account for EVERY byte
19
+ * of the buffer in its declared chunks (nothing can ride along after it); an FBX must have a
20
+ * well-formed run of top-level node records ending in the null record, with no more than a
21
+ * footer's worth of bytes after it.
22
+ *
23
+ * Dependency-free, browser and Node.
24
+ */
25
+ /** The two 3D model types, each with the one extension (no dot) it saves under. */
26
+ export declare const SAVE_MODEL3D_EXTENSION: {
27
+ readonly 'model/gltf-binary': "glb";
28
+ readonly 'model/x-fbx': "fbx";
29
+ };
30
+ export type SaveModel3dType = keyof typeof SAVE_MODEL3D_EXTENSION;
31
+ /**
32
+ * The per-file cap on a buffer that starts like a model: 100 MiB. Generated meshes with embedded
33
+ * textures outgrow the 50 MiB cap of the other bytes types; the host also checks a model against
34
+ * its 100 MiB window budget, so a model at the cap is the only save that window admits.
35
+ */
36
+ export declare const SAVE_MODEL3D_MAX_BYTES: number;
37
+ /**
38
+ * The largest JSON chunk a GLB may carry: 8 MiB. The check decodes and parses that chunk on the
39
+ * caller's thread (the host's is the viewer's main thread), and parse cost grows with it: a 49.5 MB
40
+ * chunk measured 2.6 s and 1.8 GB on node 24, a 99 MB one 7 s and 3.4 GB. Real GLB JSON is the
41
+ * scene description only — node, mesh, accessor and material records; the geometry and textures
42
+ * live in the BIN chunk — so it runs from a few KB to a few MB even for large scenes. 8 MiB leaves
43
+ * room above that while bounding the parse to a fraction of a second. Over it, the file is refused
44
+ * like any other GLB that fails the check, before anything is decoded.
45
+ */
46
+ export declare const SAVE_MODEL3D_MAX_JSON_CHUNK_BYTES: number;
47
+ /**
48
+ * Which model type the buffer STARTS like (`glTF` + version 2, or the binary FBX magic), or `null`.
49
+ * Reads at most the first 21 bytes. Not a validation: see {@link isValidSaveModel3d}.
50
+ */
51
+ export declare function looksLikeSaveModel3d(view: Uint8Array): SaveModel3dType | null;
52
+ /** Strict structural check of a buffer that {@link looksLikeSaveModel3d} called `type`. */
53
+ export declare function isValidSaveModel3d(view: Uint8Array, type: SaveModel3dType): boolean;
54
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,216 @@
1
+ /**
2
+ * `@civitai/app-sdk/save-model3d` — the App Blocks `SAVE_IMAGE { bytes }` 3D model check: binary
3
+ * glTF (`.glb`) and binary FBX (`.fbx`).
4
+ *
5
+ * 🔴 THE ONE COPY, like `./save-zip`. The civitai.com host and `@civitai/blocks-react`'s
6
+ * `createMockHost` both import this module, so the mock accepts and refuses exactly the models
7
+ * production does. Change the rules here, release, and bump the host's `@civitai/app-sdk`.
8
+ *
9
+ * glTF-JSON (`.gltf`), ASCII FBX and OBJ are NOT model types here: they are text, so the host saves
10
+ * them as `.txt` (and a `.gltf` usually references sidecar files a single save could not carry).
11
+ *
12
+ * Two steps, the same split as the zip rules:
13
+ * 1. {@link looksLikeSaveModel3d} — does the buffer START like one of these? Decided on the first
14
+ * 8 (GLB) or 21 (FBX) bytes, so a caller can pick the per-file cap
15
+ * ({@link SAVE_MODEL3D_MAX_BYTES}) before decoding anything. Both prefixes contain a NUL byte,
16
+ * so no text payload can ever be a candidate: refusing a candidate that fails step 2 takes
17
+ * nothing away from a text classifier that refuses every NUL-bearing buffer.
18
+ * 2. {@link isValidSaveModel3d} — the strict structural check. A GLB must account for EVERY byte
19
+ * of the buffer in its declared chunks (nothing can ride along after it); an FBX must have a
20
+ * well-formed run of top-level node records ending in the null record, with no more than a
21
+ * footer's worth of bytes after it.
22
+ *
23
+ * Dependency-free, browser and Node.
24
+ */
25
+ /** The two 3D model types, each with the one extension (no dot) it saves under. */
26
+ export const SAVE_MODEL3D_EXTENSION = {
27
+ // IANA-registered.
28
+ 'model/gltf-binary': 'glb',
29
+ // FBX has no registered media type; this names it for the Blob without claiming a registration.
30
+ 'model/x-fbx': 'fbx',
31
+ };
32
+ /**
33
+ * The per-file cap on a buffer that starts like a model: 100 MiB. Generated meshes with embedded
34
+ * textures outgrow the 50 MiB cap of the other bytes types; the host also checks a model against
35
+ * its 100 MiB window budget, so a model at the cap is the only save that window admits.
36
+ */
37
+ export const SAVE_MODEL3D_MAX_BYTES = 100 * 1024 * 1024;
38
+ /**
39
+ * The largest JSON chunk a GLB may carry: 8 MiB. The check decodes and parses that chunk on the
40
+ * caller's thread (the host's is the viewer's main thread), and parse cost grows with it: a 49.5 MB
41
+ * chunk measured 2.6 s and 1.8 GB on node 24, a 99 MB one 7 s and 3.4 GB. Real GLB JSON is the
42
+ * scene description only — node, mesh, accessor and material records; the geometry and textures
43
+ * live in the BIN chunk — so it runs from a few KB to a few MB even for large scenes. 8 MiB leaves
44
+ * room above that while bounding the parse to a fraction of a second. Over it, the file is refused
45
+ * like any other GLB that fails the check, before anything is decoded.
46
+ */
47
+ export const SAVE_MODEL3D_MAX_JSON_CHUNK_BYTES = 8 * 1024 * 1024;
48
+ /** `glTF` + container version 2 (little-endian u32). */
49
+ const GLB_PREFIX = [0x67, 0x6c, 0x54, 0x46, 0x02, 0x00, 0x00, 0x00];
50
+ const GLB_HEADER_BYTES = 12;
51
+ const GLB_CHUNK_HEADER_BYTES = 8;
52
+ const GLB_CHUNK_JSON = 0x4e4f534a; // "JSON" read as a little-endian u32
53
+ const GLB_CHUNK_BIN = 0x004e4942; // "BIN\0" read as a little-endian u32
54
+ /** `Kaydara FBX Binary` + two spaces + NUL: the binary FBX magic. ASCII FBX starts with `; FBX`. */
55
+ const FBX_MAGIC = [
56
+ 0x4b, 0x61, 0x79, 0x64, 0x61, 0x72, 0x61, 0x20, 0x46, 0x42, 0x58, 0x20, 0x42, 0x69, 0x6e, 0x61,
57
+ 0x72, 0x79, 0x20, 0x20, 0x00,
58
+ ];
59
+ /** Magic, then `0x1A 0x00`, then the u32 version. */
60
+ const FBX_HEADER_BYTES = 27;
61
+ /**
62
+ * The version range accepted: from 6100 (FBX 2006, the oldest binary writers emit) to 7999. The
63
+ * newest version in use is 7700 (FBX 2020); the bound admits any later 7.x so a newer writer of the
64
+ * same record format is not refused. An 8.x would be a new format and is refused.
65
+ */
66
+ const FBX_MIN_VERSION = 6100;
67
+ const FBX_MAX_VERSION = 7999;
68
+ /** From 7500 a node record's three leading fields are u64 instead of u32. */
69
+ const FBX_WIDE_RECORD_VERSION = 7500;
70
+ /**
71
+ * The most bytes allowed after the top-level null record. The footer writers emit is 160 bytes
72
+ * plus up to 15 of alignment padding; 256 leaves room for a writer that differs, and still means
73
+ * no second file of any size can follow the node data.
74
+ */
75
+ const FBX_MAX_TAIL_BYTES = 256;
76
+ function startsWith(u8, sig) {
77
+ if (u8.length < sig.length)
78
+ return false;
79
+ for (let i = 0; i < sig.length; i++)
80
+ if (u8[i] !== sig[i])
81
+ return false;
82
+ return true;
83
+ }
84
+ /**
85
+ * Which model type the buffer STARTS like (`glTF` + version 2, or the binary FBX magic), or `null`.
86
+ * Reads at most the first 21 bytes. Not a validation: see {@link isValidSaveModel3d}.
87
+ */
88
+ export function looksLikeSaveModel3d(view) {
89
+ if (startsWith(view, GLB_PREFIX))
90
+ return 'model/gltf-binary';
91
+ if (startsWith(view, FBX_MAGIC))
92
+ return 'model/x-fbx';
93
+ return null;
94
+ }
95
+ /** Strict structural check of a buffer that {@link looksLikeSaveModel3d} called `type`. */
96
+ export function isValidSaveModel3d(view, type) {
97
+ return type === 'model/gltf-binary' ? isValidGlb(view) : isValidFbx(view);
98
+ }
99
+ /**
100
+ * glTF 2.0 binary container (spec §4.4): a 12-byte header whose declared length equals the
101
+ * buffer's, then chunks. The JSON chunk comes first and only first; a BIN chunk, if any, only
102
+ * second; chunks of any other type are allowed after the JSON chunk, because the spec says
103
+ * "Client implementations MUST ignore chunks with unknown types to enable glTF extensions to
104
+ * reference additional chunks with new types following the first two chunks." Every chunk length
105
+ * is a multiple of 4 (the spec's alignment rule), every chunk lies inside the declared length, and
106
+ * the chunks end exactly at it. The JSON chunk must be at most
107
+ * {@link SAVE_MODEL3D_MAX_JSON_CHUNK_BYTES} (checked before it is decoded) and UTF-8 that parses to
108
+ * an object carrying `asset.version`, the one property glTF requires.
109
+ */
110
+ function isValidGlb(u8) {
111
+ if (u8.length < GLB_HEADER_BYTES + GLB_CHUNK_HEADER_BYTES)
112
+ return false;
113
+ if (!startsWith(u8, GLB_PREFIX))
114
+ return false;
115
+ const view = new DataView(u8.buffer, u8.byteOffset, u8.byteLength);
116
+ const length = view.getUint32(8, true);
117
+ if (length !== u8.length || length % 4 !== 0)
118
+ return false;
119
+ let offset = GLB_HEADER_BYTES;
120
+ let index = 0;
121
+ while (offset < length) {
122
+ if (length - offset < GLB_CHUNK_HEADER_BYTES)
123
+ return false;
124
+ const chunkLength = view.getUint32(offset, true);
125
+ const chunkType = view.getUint32(offset + 4, true);
126
+ const dataStart = offset + GLB_CHUNK_HEADER_BYTES;
127
+ if (chunkLength % 4 !== 0 || chunkLength > length - dataStart)
128
+ return false;
129
+ if (index === 0) {
130
+ if (chunkType !== GLB_CHUNK_JSON || chunkLength === 0)
131
+ return false;
132
+ if (chunkLength > SAVE_MODEL3D_MAX_JSON_CHUNK_BYTES)
133
+ return false;
134
+ if (!isGltfJson(u8.subarray(dataStart, dataStart + chunkLength)))
135
+ return false;
136
+ }
137
+ else if (chunkType === GLB_CHUNK_JSON || (chunkType === GLB_CHUNK_BIN && index !== 1)) {
138
+ // A second JSON chunk, or a BIN chunk anywhere but second: out of the spec's order.
139
+ return false;
140
+ }
141
+ // Every chunk header is 8 bytes, so each pass moves forward and the walk terminates.
142
+ offset = dataStart + chunkLength;
143
+ index += 1;
144
+ }
145
+ return index >= 1 && offset === length;
146
+ }
147
+ function isGltfJson(bytes) {
148
+ let doc;
149
+ try {
150
+ doc = JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(bytes));
151
+ }
152
+ catch {
153
+ return false;
154
+ }
155
+ if (!doc || typeof doc !== 'object' || Array.isArray(doc))
156
+ return false;
157
+ const asset = doc.asset;
158
+ if (!asset || typeof asset !== 'object' || Array.isArray(asset))
159
+ return false;
160
+ return typeof asset.version === 'string';
161
+ }
162
+ /**
163
+ * Binary FBX: the magic, `0x1A 0x00`, a version from 6100 to 7999, then a walk of the TOP-LEVEL
164
+ * node records. Each record's end offset must lie at or past the end of its own header and name
165
+ * (so the walk moves strictly forward) and stay inside the buffer, its name must be printable
166
+ * ASCII, and the walk must reach the all-zero null record with at least one node before it. At most
167
+ * {@link FBX_MAX_TAIL_BYTES} may follow the null record (the footer). Nested records are not
168
+ * walked: they lie inside a top-level record's span, which the walk has already bounded.
169
+ */
170
+ function isValidFbx(u8) {
171
+ if (u8.length < FBX_HEADER_BYTES)
172
+ return false;
173
+ if (!startsWith(u8, FBX_MAGIC) || u8[21] !== 0x1a || u8[22] !== 0x00)
174
+ return false;
175
+ const view = new DataView(u8.buffer, u8.byteOffset, u8.byteLength);
176
+ const version = view.getUint32(23, true);
177
+ if (version < FBX_MIN_VERSION || version > FBX_MAX_VERSION)
178
+ return false;
179
+ const wide = version >= FBX_WIDE_RECORD_VERSION;
180
+ const fieldBytes = wide ? 8 : 4;
181
+ const recordHeaderBytes = fieldBytes * 3 + 1;
182
+ const readField = (at) => wide ? Number(view.getBigUint64(at, true)) : view.getUint32(at, true);
183
+ let offset = FBX_HEADER_BYTES;
184
+ let nodes = 0;
185
+ for (;;) {
186
+ if (u8.length - offset < recordHeaderBytes)
187
+ return false;
188
+ const endOffset = readField(offset);
189
+ const numProperties = readField(offset + fieldBytes);
190
+ const propertyListLength = readField(offset + fieldBytes * 2);
191
+ const nameLength = u8[offset + fieldBytes * 3];
192
+ if (endOffset === 0) {
193
+ // The null record: every field zero. Ends the top-level list.
194
+ if (numProperties !== 0 || propertyListLength !== 0 || nameLength !== 0)
195
+ return false;
196
+ const tail = u8.length - (offset + recordHeaderBytes);
197
+ return nodes > 0 && tail <= FBX_MAX_TAIL_BYTES;
198
+ }
199
+ const nameStart = offset + recordHeaderBytes;
200
+ const bodyStart = nameStart + nameLength;
201
+ // A node with no properties and no children ends right after its name; nameLength >= 1 keeps
202
+ // every step strictly forward, so the walk terminates.
203
+ if (nameLength === 0 || endOffset < bodyStart || endOffset > u8.length)
204
+ return false;
205
+ if (propertyListLength > endOffset - bodyStart)
206
+ return false;
207
+ for (let i = nameStart; i < bodyStart; i++) {
208
+ const c = u8[i];
209
+ if (c < 0x20 || c > 0x7e)
210
+ return false;
211
+ }
212
+ offset = endOffset;
213
+ nodes += 1;
214
+ }
215
+ }
216
+ //# sourceMappingURL=index.js.map
@@ -57,7 +57,11 @@ export declare const SAVE_ZIP_LIMITS: {
57
57
  readonly maxEntryRatio: 100;
58
58
  readonly ratioFloorBytes: number;
59
59
  };
60
- /** Entry extensions a zip may contain (lowercase, after the last `.`). Directories need none. */
60
+ /**
61
+ * Entry extensions a zip may contain (lowercase, after the last `.`). Directories need none. `glb`
62
+ * (binary glTF) and `fbx` are 3D model files, so a block can bundle a generated model with its
63
+ * renders; like every entry, only the name is checked, not the content.
64
+ */
61
65
  export declare const SAVE_ZIP_ALLOWED_EXTENSIONS: ReadonlySet<string>;
62
66
  export declare const SAVE_ZIP_NO_EOCD_ERROR = "zip end of central directory not found (archive comments are not allowed)";
63
67
  export declare const SAVE_ZIP_MULTIDISK_ERROR = "zip spans multiple disks";
@@ -57,7 +57,11 @@ export const SAVE_ZIP_LIMITS = {
57
57
  maxEntryRatio: 100,
58
58
  ratioFloorBytes: 1024 * 1024,
59
59
  };
60
- /** Entry extensions a zip may contain (lowercase, after the last `.`). Directories need none. */
60
+ /**
61
+ * Entry extensions a zip may contain (lowercase, after the last `.`). Directories need none. `glb`
62
+ * (binary glTF) and `fbx` are 3D model files, so a block can bundle a generated model with its
63
+ * renders; like every entry, only the name is checked, not the content.
64
+ */
61
65
  export const SAVE_ZIP_ALLOWED_EXTENSIONS = new Set([
62
66
  'png',
63
67
  'jpg',
@@ -66,6 +70,8 @@ export const SAVE_ZIP_ALLOWED_EXTENSIONS = new Set([
66
70
  'txt',
67
71
  'json',
68
72
  'csv',
73
+ 'glb',
74
+ 'fbx',
69
75
  ]);
70
76
  export const SAVE_ZIP_NO_EOCD_ERROR = 'zip end of central directory not found (archive comments are not allowed)';
71
77
  export const SAVE_ZIP_MULTIDISK_ERROR = 'zip spans multiple disks';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@civitai/app-sdk",
3
- "version": "0.91.0",
3
+ "version": "0.93.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",
@@ -55,6 +55,10 @@
55
55
  "types": "./dist/save-zip/index.d.ts",
56
56
  "import": "./dist/save-zip/index.js"
57
57
  },
58
+ "./save-model3d": {
59
+ "types": "./dist/save-model3d/index.d.ts",
60
+ "import": "./dist/save-model3d/index.js"
61
+ },
58
62
  "./schemas/app-block/v1.json": "./schemas/app-block/v1.json"
59
63
  },
60
64
  "comment-packaging": "`!dist/**/*.map` keeps dangling sourcemaps out of the tarball (#376). Rationale: scripts/check-shipped-sourcemaps.mjs.",
@@ -86,7 +90,13 @@
86
90
  "and MISSING MOST STEP TYPES, with no error. The range below deliberately",
87
91
  "excludes 0.1.x: verify with",
88
92
  "`semver.satisfies('0.1.1-beta.0', '^0.2.0-beta.98')` === false.",
89
- "Install with the tag: `pnpm add -D @civitai/client@beta`."
93
+ "Install with the tag: `pnpm add -D @civitai/client@beta`.",
94
+ "",
95
+ "🔴 @civitai/client IS FROZEN. It was renamed @civitai/orchestration-client;",
96
+ "npm marks it deprecated and 0.2.0-beta.98 is its last release, so the",
97
+ "catalog/type gap will not close through a @civitai/client release. The",
98
+ "peer stays @civitai/client on purpose: the renamed package alone does not",
99
+ "satisfy `./orchestrator/steps` (the README's \"Installing the peer\")."
90
100
  ],
91
101
  "comment-peerDependencies-ajv-vite": [
92
102
  "ajv and vite are OPTIONAL peers of the NODE-ONLY subpaths added when #330",