@civitai/app-sdk 0.83.0 → 0.84.1
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 +50 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/manifest/defineBlock.js +5 -3
- package/dist/manifest/index.d.ts +1 -1
- package/package.json +1 -1
- package/schemas/app-block/v1.json +30 -0
package/dist/blocks/index.d.ts
CHANGED
|
@@ -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, 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, 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';
|
|
119
|
+
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, 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
|
/**
|
|
121
121
|
* Host bounds for an inline `customComfy` graph, mirrored from civitai/civitai —
|
|
122
122
|
* see `WorkflowBodyCustomComfyInline.workflow`.
|
package/dist/blocks/types.d.ts
CHANGED
|
@@ -2454,7 +2454,13 @@ export type ModelSubstitutionReason = 'wrong-workflow' | 'unrecognized' | 'gated
|
|
|
2454
2454
|
* and the SDK's inbound validator accepts any string. Handle an unrecognised
|
|
2455
2455
|
* code as a generic failure.
|
|
2456
2456
|
*/
|
|
2457
|
-
export type KnownBlockWorkflowErrorCode = 'training-quote-rejected' | 'training-quote-unavailable' | 'training-quote-unpriced' | 'daily-limit-exceeded' | 'workflow_step_denied' | 'workflow_ref_invalid' | 'workflow_too_many_steps' | 'workflow_repeat_unbounded' | 'workflow_quote_rejected' | 'workflow_quote_unavailable' | 'workflow_quote_unpriced' | 'step_quote_rejected' | 'step_quote_unavailable' | 'step_quote_unpriced'
|
|
2457
|
+
export type KnownBlockWorkflowErrorCode = 'training-quote-rejected' | 'training-quote-unavailable' | 'training-quote-unpriced' | 'daily-limit-exceeded' | 'workflow_step_denied' | 'workflow_ref_invalid' | 'workflow_too_many_steps' | 'workflow_repeat_unbounded' | 'workflow_quote_rejected' | 'workflow_quote_unavailable' | 'workflow_quote_unpriced' | 'step_quote_rejected' | 'step_quote_unavailable' | 'step_quote_unpriced'
|
|
2458
|
+
/**
|
|
2459
|
+
* A generation input names an image the viewer uploaded whose scan has not
|
|
2460
|
+
* finished. Retry once the upload's scan verdict is `scanned` (with
|
|
2461
|
+
* `asyncScan`, wait for it before submitting).
|
|
2462
|
+
*/
|
|
2463
|
+
| 'source-scan-pending';
|
|
2458
2464
|
/** One entry of {@link BlockWorkflowSnapshot.modelSubstitutions}. */
|
|
2459
2465
|
export interface BlockModelSubstitution {
|
|
2460
2466
|
/** The checkpoint version id the block asked for. */
|
|
@@ -2793,6 +2799,39 @@ export type BlockStorageMigrationOp = {
|
|
|
2793
2799
|
path: string;
|
|
2794
2800
|
keyword: BlockStorageMigrationKeyword;
|
|
2795
2801
|
};
|
|
2802
|
+
/**
|
|
2803
|
+
* RESERVED — civitai.com refuses this field until permission hooks are enabled,
|
|
2804
|
+
* so do not declare it yet. A collection's permission hook: one ES module of the
|
|
2805
|
+
* bundle whose default export decides, for every write to the collection,
|
|
2806
|
+
* whether the write is allowed. It runs after the collection `schema` check,
|
|
2807
|
+
* never instead of it. Mirrors the canonical schema's
|
|
2808
|
+
* `$defs.storageCollectionHook`; this package adds no hook behaviour.
|
|
2809
|
+
*
|
|
2810
|
+
* Checked by the server, not by the schema: whether `file` is inside
|
|
2811
|
+
* `outputDir`, whether it exists in the bundle with this `sha256`, its size (one
|
|
2812
|
+
* self-contained module with no imports, at most 65536 bytes of UTF-8 text),
|
|
2813
|
+
* and two collections pinning one file with different digests.
|
|
2814
|
+
*/
|
|
2815
|
+
export interface BlockStorageCollectionHook {
|
|
2816
|
+
/**
|
|
2817
|
+
* The hook's relative path in the submitted bundle, shipped verbatim (a
|
|
2818
|
+
* committed source file, not a build output): `/`-separated segments, each
|
|
2819
|
+
* starting with a letter, digit, `_` or `-` and then letters, digits, `_`, `.`
|
|
2820
|
+
* or `-` (so no `.` or `..` segment, no hidden file, no leading `/`), ending
|
|
2821
|
+
* `.js` or `.mjs`, at most 200 characters, with no `node_modules` segment.
|
|
2822
|
+
* Pattern `^([A-Za-z0-9_-][A-Za-z0-9_.-]*\/)*[A-Za-z0-9_-][A-Za-z0-9_.-]*\.m?js$`.
|
|
2823
|
+
*/
|
|
2824
|
+
file: string;
|
|
2825
|
+
/**
|
|
2826
|
+
* The SHA-256 of the file's bytes as 64 lowercase hex characters
|
|
2827
|
+
* (`^[0-9a-f]{64}$`). Submit, the git-push path and approve each refuse a
|
|
2828
|
+
* version whose file is missing or does not match it. One file used by several
|
|
2829
|
+
* collections must be pinned with the same digest in each.
|
|
2830
|
+
*/
|
|
2831
|
+
sha256: string;
|
|
2832
|
+
/** The most milliseconds one call may take: an integer from 1 to 500. Omitted means 50. */
|
|
2833
|
+
timeoutMs?: number;
|
|
2834
|
+
}
|
|
2796
2835
|
/**
|
|
2797
2836
|
* A PRIVATE collection — a separate key space per viewer, read and written
|
|
2798
2837
|
* only by that viewer. Carries none of the shared-only fields (`write`,
|
|
@@ -2818,6 +2857,8 @@ export interface BlockStoragePrivateCollectionDeclaration {
|
|
|
2818
2857
|
schema?: BlockStorageCollectionSchema;
|
|
2819
2858
|
/** See {@link BlockStorageSharedCollectionDeclaration.migrations}. */
|
|
2820
2859
|
migrations?: BlockStorageMigrationOp[];
|
|
2860
|
+
/** RESERVED — see {@link BlockStorageSharedCollectionDeclaration.hook}. */
|
|
2861
|
+
hook?: BlockStorageCollectionHook;
|
|
2821
2862
|
}
|
|
2822
2863
|
/**
|
|
2823
2864
|
* A SHARED collection — one key space for the whole app, read by every viewer
|
|
@@ -2939,6 +2980,14 @@ export interface BlockStorageSharedCollectionDeclaration {
|
|
|
2939
2980
|
* {@link BlockStorageMigrationOp}. Not allowed with `write` `'none'`.
|
|
2940
2981
|
*/
|
|
2941
2982
|
migrations?: BlockStorageMigrationOp[];
|
|
2983
|
+
/**
|
|
2984
|
+
* RESERVED — civitai.com refuses this field until permission hooks are
|
|
2985
|
+
* enabled, so do not declare it yet. A permission hook that decides, for every
|
|
2986
|
+
* write to this collection, whether it is allowed — see
|
|
2987
|
+
* {@link BlockStorageCollectionHook}. Allowed on every collection kind,
|
|
2988
|
+
* private and shared alike.
|
|
2989
|
+
*/
|
|
2990
|
+
hook?: BlockStorageCollectionHook;
|
|
2942
2991
|
}
|
|
2943
2992
|
/**
|
|
2944
2993
|
* One collection declaration — see {@link BlockManifestV1.storage}.
|
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
|
+
* 214 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 214 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
|
+
* 214 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 214 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
|
|
@@ -149,9 +149,11 @@ export const KNOWN_GAPS = {
|
|
|
149
149
|
'`apps:storage:import` (and `apps:storage`), requesting any of these scopes with nothing for ' +
|
|
150
150
|
'it to reach is rejected, an import never names this app itself and names each source at ' +
|
|
151
151
|
'most once, a counter may not share a name with a mark, and the ' +
|
|
152
|
-
'RESERVED features (`kind` "log", `ttlSeconds`, `dailyWritesPerAuthor`, `registry`, `
|
|
153
|
-
'"anyone" / "owner") validate offline and are refused at submit.
|
|
154
|
-
'
|
|
152
|
+
'RESERVED features (`kind` "log", `ttlSeconds`, `dailyWritesPerAuthor`, `registry`, `hook`, ' +
|
|
153
|
+
'`write` "anyone" / "owner") validate offline and are refused at submit. A `hook`\'s `file` ' +
|
|
154
|
+
'being outside `outputDir`, present in the bundle with its `sha256`, its size, and one file ' +
|
|
155
|
+
'pinned with one digest across collections are checked by the server too. Ajv enforces the ' +
|
|
156
|
+
'structural rules exactly; these are server-side.',
|
|
155
157
|
'storage-collection-schema-server-only-rules': 'A collection `schema` (civitai/civitai#7491): the canonical encodes the keyword subset, each ' +
|
|
156
158
|
'keyword\'s shape, the 256-character `pattern` bound, "a pattern needs a maxLength of at most ' +
|
|
157
159
|
'1000" and "no schema on write none", and Ajv enforces those exactly. It states in prose only ' +
|
package/dist/manifest/index.d.ts
CHANGED
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
export { defineBlock, SCHEMA_DIVERGENCES, KNOWN_GAPS, loadCanonicalSchema } from './defineBlock.js';
|
|
16
16
|
export type { DefineBlockConfig } from './defineBlock.js';
|
|
17
17
|
export { BlockManifestError } from '../blocks/manifestError.js';
|
|
18
|
-
export type { BlockAnalyticsDeclaration, BlockAnalyticsEventDeclaration, BlockAnalyticsPropertyDeclaration, BlockManifest, BlockManifestGood, BlockManifestV1, BlockStorageCollectionDeclaration, BlockStorageCollectionSchema, BlockStorageDeclaration, BlockStorageImport, BlockStorageIndexes, BlockStorageIndexType, BlockStorageMigrationKeyword, BlockStorageMigrationOp, BlockStoragePrivateCollectionDeclaration, BlockStorageSchemaType, BlockStorageSharedCollectionDeclaration, } from '../blocks/types.js';
|
|
18
|
+
export type { BlockAnalyticsDeclaration, BlockAnalyticsEventDeclaration, BlockAnalyticsPropertyDeclaration, BlockManifest, BlockManifestGood, BlockManifestV1, BlockStorageCollectionDeclaration, BlockStorageCollectionHook, BlockStorageCollectionSchema, BlockStorageDeclaration, BlockStorageImport, BlockStorageIndexes, BlockStorageIndexType, BlockStorageMigrationKeyword, BlockStorageMigrationOp, BlockStoragePrivateCollectionDeclaration, BlockStorageSchemaType, BlockStorageSharedCollectionDeclaration, } from '../blocks/types.js';
|
|
19
19
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -528,6 +528,10 @@
|
|
|
528
528
|
"minItems": 1,
|
|
529
529
|
"maxItems": 32,
|
|
530
530
|
"items": { "$ref": "#/$defs/storageMigrationOp" }
|
|
531
|
+
},
|
|
532
|
+
"hook": {
|
|
533
|
+
"description": "RESERVED — civitai.com refuses this field until permission hooks are enabled, so do not declare it yet. Optional. A permission hook: one ES module of the bundle whose default export decides, for every write to this collection, whether the write is allowed. It runs after the collection `schema` check, never instead of it. `file` is the hook's path in the submitted bundle, shipped verbatim — a committed source file, not a build output, so it must not be inside `outputDir` or `node_modules`; one self-contained module with no imports, at most 65536 bytes of UTF-8 text. `sha256` is the SHA-256 of that file's bytes as 64 lowercase hex characters: submit, the git-push path and approve each refuse a version whose file is missing or does not match it. `timeoutMs` is the most time one call may take, from 1 to 500 (omitted means 50). One file used by several collections must be pinned with the same sha256 in each.",
|
|
534
|
+
"$ref": "#/$defs/storageCollectionHook"
|
|
531
535
|
}
|
|
532
536
|
},
|
|
533
537
|
"allOf": [
|
|
@@ -733,6 +737,32 @@
|
|
|
733
737
|
},
|
|
734
738
|
"storageCollectionSchemaType": {
|
|
735
739
|
"enum": ["object", "array", "string", "number", "integer", "boolean", "null"]
|
|
740
|
+
},
|
|
741
|
+
"storageCollectionHook": {
|
|
742
|
+
"type": "object",
|
|
743
|
+
"description": "A collection's permission hook (see `storage.collections.<name>.hook`). Whether `file` is inside `outputDir`, whether it exists in the bundle with this sha256, its size, and two collections pinning one file with different digests are checked by the server, not by this schema.",
|
|
744
|
+
"additionalProperties": false,
|
|
745
|
+
"required": ["file", "sha256"],
|
|
746
|
+
"properties": {
|
|
747
|
+
"file": {
|
|
748
|
+
"type": "string",
|
|
749
|
+
"description": "The hook's relative path in the bundle: \"/\"-separated segments, each starting with a letter, digit, _ or - and then letters, digits, _, . or - (so no \".\" or \"..\" segment, no hidden file, no leading \"/\"), ending .js or .mjs, at most 200 characters, with no node_modules segment.",
|
|
750
|
+
"maxLength": 200,
|
|
751
|
+
"pattern": "^([A-Za-z0-9_-][A-Za-z0-9_.-]*/)*[A-Za-z0-9_-][A-Za-z0-9_.-]*\\.m?js$",
|
|
752
|
+
"not": { "pattern": "(^|/)node_modules(/|$)" }
|
|
753
|
+
},
|
|
754
|
+
"sha256": {
|
|
755
|
+
"type": "string",
|
|
756
|
+
"description": "The SHA-256 of the file's bytes, as 64 lowercase hex characters.",
|
|
757
|
+
"pattern": "^[0-9a-f]{64}$"
|
|
758
|
+
},
|
|
759
|
+
"timeoutMs": {
|
|
760
|
+
"type": "integer",
|
|
761
|
+
"description": "The most milliseconds one call of the hook may take, from 1 to 500. Omitted means 50.",
|
|
762
|
+
"minimum": 1,
|
|
763
|
+
"maximum": 500
|
|
764
|
+
}
|
|
765
|
+
}
|
|
736
766
|
}
|
|
737
767
|
},
|
|
738
768
|
"allOf": [
|