@civitai/app-sdk 0.95.1 → 0.97.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/dist/blocks/index.d.ts +1 -1
- package/dist/blocks/types.d.ts +78 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/blocks/index.d.ts
CHANGED
|
@@ -88,7 +88,7 @@ export { isModelSlotContext, isPageSlotContext } from './types.js';
|
|
|
88
88
|
* in `types.ts` for which of the two it uses and why.
|
|
89
89
|
*/
|
|
90
90
|
export { isSignedIn } from './types.js';
|
|
91
|
-
export type { BlockContext, KnownSlotId, ModelSlotId, PageSlotContext, PageSlotId, UnknownSlotContext, BlockAnalyticsDeclaration, BlockAnalyticsEventDeclaration, BlockAnalyticsPropertyDeclaration, BlockManifest, BlockManifestGood, BlockManifestV1, BlockSettings, BlockStorageCollectionDeclaration, BlockStorageCollectionHook, BlockStorageCollectionSchema, BlockStorageDeclaration, BlockStorageImport, BlockStorageIndexes, BlockStorageIndexType, BlockStorageMigrationKeyword, BlockStorageMigrationOp, BlockStoragePrivateCollectionDeclaration, BlockStorageSchemaType, BlockStorageSharedCollectionDeclaration, BlockToken, ContentRating, ManifestBooleanField, ManifestIframe, ManifestNumberField, ManifestPage, ManifestPreview, ManifestSettingField, ManifestSettings, ManifestStringField, ManifestTarget, ModelSlotContext, SettingScope, SettingWidget, Theme, ViewerInfo, BlockCheckpointInfo, BlockResourceInfo, BlockResourcePickerType, BlockSourceImage, BlockUploadedImageInfo, BlockGenerationSourceImageInfo, BlockUploadedGenerationSource, BlockPersistGenerationSourceRequest, BlockPersistedGenerationSource, BlockImagePickerSource, BlockPickedImageInfo, BlockMediaKind, BlockMediaUploadInfo, BlockMediaUploadBatchItemResult, BlockPendingImageInfo, BlockSharedUploadImageInfo, BlockSharedPendingImageInfo, BlockImageScanResult, BlockUploadPurpose, BlockNavigateScope, BlockShareLinkMethod, BlockShareLinkRequest, BlockShareLinkResult, BlockTextToImageParams, BlockWorkflowSnapshot, BlockEstimateBatchAggregate, BlockModelSubstitution, ModelSubstitutionReason, KnownBlockWorkflowErrorCode, BlockStepToolCall, BlockTrainedEpoch, BlockPublishedModel, BuzzAccountType, ShowcaseImage, WorkflowBody, WorkflowBodyTextToImage, WorkflowBodyCustomComfy, WorkflowBodyCustomComfyRecipe, WorkflowBodyCustomComfyInline, InlineComfyNode, WorkflowBodyStep, WorkflowBodyPassThroughStep, WorkflowBodyWorkflow, WorkflowBodyWorkflowStep, WorkflowStepRef, WithWorkflowStepRefs, BlockWorkflowStepSnapshot, BlockWorkflowStepQueue, BlockWorkflowEta, KnownBlockWorkflowQueueSupport, BlockWorkflowOutput, BlockWorkflowAvailableOutput, BlockWorkflowRestrictedOutput, BlockWorkflowPendingOutput, BlockWorkflowBlockedOutput, KnownBlockWorkflowOutputRating, KnownBlockWorkflowRestrictionReason, KnownBlockOutputUnlockOutcome, BlockOutputUnlockResult, 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';
|
|
91
|
+
export type { BlockContext, KnownSlotId, ModelSlotId, PageSlotContext, PageSlotId, UnknownSlotContext, BlockAnalyticsDeclaration, BlockAnalyticsEventDeclaration, BlockAnalyticsPropertyDeclaration, BlockManifest, BlockManifestGood, BlockManifestV1, BlockSettings, BlockStorageCollectionDeclaration, BlockStorageCollectionHook, BlockStorageCollectionSchema, BlockStorageDeclaration, BlockStorageImport, BlockStorageIndexes, BlockStorageIndexType, BlockStorageMigrationKeyword, BlockStorageMigrationOp, BlockStoragePrivateCollectionDeclaration, BlockStorageSchemaType, BlockStorageSharedCollectionDeclaration, BlockToken, ContentRating, ManifestBooleanField, ManifestIframe, ManifestNumberField, ManifestPage, ManifestPreview, ManifestSettingField, ManifestSettings, ManifestStringField, ManifestTarget, ModelSlotContext, SettingScope, SettingWidget, Theme, ViewerInfo, ViewerImage, BlockCheckpointInfo, BlockResourceInfo, BlockResourcePickerType, BlockSourceImage, BlockUploadedImageInfo, BlockGenerationSourceImageInfo, BlockUploadedGenerationSource, BlockPersistGenerationSourceRequest, BlockPersistedGenerationSource, BlockImagePickerSource, BlockPickedImageInfo, BlockMediaKind, BlockMediaUploadInfo, BlockMediaUploadBatchItemResult, BlockPendingImageInfo, BlockSharedUploadImageInfo, BlockSharedPendingImageInfo, BlockImageScanResult, BlockUploadPurpose, BlockNavigateScope, BlockShareLinkMethod, BlockShareLinkRequest, BlockShareLinkResult, BlockTextToImageParams, BlockWorkflowSnapshot, RateLimitMeta, BlockEstimateBatchAggregate, BlockModelSubstitution, ModelSubstitutionReason, KnownBlockWorkflowErrorCode, BlockStepToolCall, BlockTrainedEpoch, BlockPublishedModel, BuzzAccountType, ShowcaseImage, WorkflowBody, WorkflowBodyTextToImage, WorkflowBodyCustomComfy, WorkflowBodyCustomComfyRecipe, WorkflowBodyCustomComfyInline, InlineComfyNode, WorkflowBodyStep, WorkflowBodyPassThroughStep, WorkflowBodyWorkflow, WorkflowBodyWorkflowStep, WorkflowStepRef, WithWorkflowStepRefs, BlockWorkflowStepSnapshot, BlockWorkflowStepQueue, BlockWorkflowEta, KnownBlockWorkflowQueueSupport, BlockWorkflowOutput, BlockWorkflowAvailableOutput, BlockWorkflowRestrictedOutput, BlockWorkflowPendingOutput, BlockWorkflowBlockedOutput, KnownBlockWorkflowOutputRating, KnownBlockWorkflowRestrictionReason, KnownBlockOutputUnlockOutcome, BlockOutputUnlockResult, 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';
|
|
92
92
|
/**
|
|
93
93
|
* Host bounds for an inline `customComfy` graph, mirrored from civitai/civitai —
|
|
94
94
|
* see `WorkflowBodyCustomComfyInline.workflow`.
|
package/dist/blocks/types.d.ts
CHANGED
|
@@ -831,7 +831,8 @@ export interface ViewerInfo {
|
|
|
831
831
|
* so there is no half-covered fleet.
|
|
832
832
|
* - That repo's own contract test (`__tests__/projectBlockInit.test.ts`) now
|
|
833
833
|
* pins the BLOCK_INIT viewer key set as exactly
|
|
834
|
-
* `['id', 'signedIn', 'username']
|
|
834
|
+
* `['id', 'signedIn', 'username']` — plus {@link ViewerInfo.image} when the
|
|
835
|
+
* token carries `user:read:self` — and asserts the value is literally
|
|
835
836
|
* `true` rather than a computed boolean.
|
|
836
837
|
* - It arrived with civitai/civitai#3707 (merged 2026-08-07). Earlier
|
|
837
838
|
* revisions of this doc first told authors to write `viewer !== null`
|
|
@@ -869,7 +870,39 @@ export interface ViewerInfo {
|
|
|
869
870
|
username: string | null;
|
|
870
871
|
/** @deprecated Not sent by the platform to third-party iframes (civitai #2521). */
|
|
871
872
|
status?: 'active' | 'banned' | 'muted';
|
|
873
|
+
/**
|
|
874
|
+
* The viewer's avatar — see {@link ViewerImage}. Sent only when the block token
|
|
875
|
+
* carries `user:read:self`; ABSENT otherwise, and on a host that predates the
|
|
876
|
+
* field. Computed when the token is minted and not re-sent after a later consent
|
|
877
|
+
* grant: read `useViewer()` / `blocks/me` for a fresh value.
|
|
878
|
+
*/
|
|
879
|
+
image?: ViewerImage;
|
|
872
880
|
}
|
|
881
|
+
/**
|
|
882
|
+
* The viewer's avatar as the platform lets an app see it — the same value on
|
|
883
|
+
* `BLOCK_INIT.viewer.image`, `useViewer()` (`GET_VIEWER`) and
|
|
884
|
+
* `GET /api/v1/blocks/me`. The platform judges it against the block token's
|
|
885
|
+
* maturity ceiling — the one that restricts workflow outputs — and fails closed:
|
|
886
|
+
*
|
|
887
|
+
* - `{ url, nsfwLevel }` — a ready-to-render CDN image url and the avatar's
|
|
888
|
+
* rating (the same vocabulary as a workflow output's `nsfwLevel`:
|
|
889
|
+
* {@link KnownBlockWorkflowOutputRating}, open-ended).
|
|
890
|
+
* - `{ restricted: true }` — the viewer HAS an avatar this app may not show:
|
|
891
|
+
* rated above what this app may show this viewer (e.g. an X avatar in an SFW
|
|
892
|
+
* app), or not rated (still being scanned, or never). No url, and no reason —
|
|
893
|
+
* which of the two it is would disclose the avatar's rating.
|
|
894
|
+
* - `null` — the viewer has no avatar to show.
|
|
895
|
+
*
|
|
896
|
+
* Mirrors civitai/civitai's `BlockInitViewerImage`
|
|
897
|
+
* (`src/components/AppBlocks/types.ts`) and `projectBlockViewerImage`
|
|
898
|
+
* (`src/server/services/blocks/block-viewer-image.ts`).
|
|
899
|
+
*/
|
|
900
|
+
export type ViewerImage = {
|
|
901
|
+
url: string;
|
|
902
|
+
nsfwLevel: KnownBlockWorkflowOutputRating | (string & {});
|
|
903
|
+
} | {
|
|
904
|
+
restricted: true;
|
|
905
|
+
} | null;
|
|
873
906
|
/**
|
|
874
907
|
* THE sign-in gate. Pass `useBlockContext().viewer` (or a `BlockInitPayload`'s
|
|
875
908
|
* `viewer`) and render the signed-in branch when it returns `true`.
|
|
@@ -2702,6 +2735,48 @@ export interface BlockWorkflowSnapshot {
|
|
|
2702
2735
|
* whose throttled reply is `{ workflowId, status: 'processing' }`.
|
|
2703
2736
|
*/
|
|
2704
2737
|
throttled?: true;
|
|
2738
|
+
/**
|
|
2739
|
+
* The retry metadata of the rate limit that refused this request: which limit,
|
|
2740
|
+
* when to try again and, for a limit that publishes them, its counts. The same
|
|
2741
|
+
* `rateLimit` the host attaches to every other bridge error reply.
|
|
2742
|
+
*
|
|
2743
|
+
* Set on a `failed` snapshot the host built from a rate-limited refusal (an
|
|
2744
|
+
* estimate, submit or cancel the limit turned away), and on a
|
|
2745
|
+
* {@link BlockWorkflowSnapshot.throttled} reply when a rate limit shed the poll
|
|
2746
|
+
* or cancel. Absent on every other snapshot, and on a host that predates the
|
|
2747
|
+
* field — so its absence never means "not rate-limited" on an older host.
|
|
2748
|
+
*
|
|
2749
|
+
* `@civitai/blocks-react` drops a malformed value and copies it onto the error
|
|
2750
|
+
* the workflow hook rejects with (`err.rateLimit`).
|
|
2751
|
+
*/
|
|
2752
|
+
rateLimit?: RateLimitMeta;
|
|
2753
|
+
}
|
|
2754
|
+
/**
|
|
2755
|
+
* Retry metadata the host attaches to a rate-limit refusal (Civitai's standard
|
|
2756
|
+
* `rateLimit`), so an app renders the wait instead of parsing it out of a
|
|
2757
|
+
* message. The same shape as `BridgeError.rateLimit` in `@civitai/sdk`.
|
|
2758
|
+
*/
|
|
2759
|
+
export interface RateLimitMeta {
|
|
2760
|
+
/** Whole seconds until the call may be tried again; at least 1. */
|
|
2761
|
+
retryAfterSeconds: number;
|
|
2762
|
+
/** ISO-8601 instant at which the call may be tried again. */
|
|
2763
|
+
retryAt: string;
|
|
2764
|
+
/** Stable id of the refusing limit, e.g. `apps.submit`. */
|
|
2765
|
+
id?: string;
|
|
2766
|
+
/**
|
|
2767
|
+
* `product`: an allowance the viewer may see and buy more of. `abuse`: an
|
|
2768
|
+
* anti-flood or money/safety bound. Informational: an abuse limit can carry
|
|
2769
|
+
* counts too.
|
|
2770
|
+
*/
|
|
2771
|
+
kind?: 'product' | 'abuse';
|
|
2772
|
+
/** The counts below are sent only for a limit that publishes them. */
|
|
2773
|
+
limit?: number;
|
|
2774
|
+
/** Attempts in the window; can exceed `limit`. */
|
|
2775
|
+
used?: number;
|
|
2776
|
+
remaining?: number;
|
|
2777
|
+
windowSeconds?: number;
|
|
2778
|
+
/** ISO-8601 instant at which the whole window is clear. */
|
|
2779
|
+
resetAt?: string;
|
|
2705
2780
|
}
|
|
2706
2781
|
/** One entry of {@link BlockWorkflowSnapshot.steps}. */
|
|
2707
2782
|
export interface BlockWorkflowStepSnapshot {
|
|
@@ -4079,6 +4154,8 @@ export interface BlockViewer {
|
|
|
4079
4154
|
status: 'active' | 'muted';
|
|
4080
4155
|
/** The viewer's current Buzz budget, or `null` when the token lacks the claim. */
|
|
4081
4156
|
buzzBudget: number | null;
|
|
4157
|
+
/** The viewer's avatar — see {@link ViewerImage}. Absent from a host that predates it. */
|
|
4158
|
+
image?: ViewerImage;
|
|
4082
4159
|
}
|
|
4083
4160
|
/**
|
|
4084
4161
|
* The DISCRIMINATED error enum a `WILDCARD_PACK_RESULT` carries on failure —
|
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
|
-
*
|
|
28
|
+
* 246 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
|
|
32
|
+
* 🔴 That 246 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
|
-
*
|
|
28
|
+
* 246 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
|
|
32
|
+
* 🔴 That 246 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/package.json
CHANGED