@civitai/sdk 0.18.0 → 0.19.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/core/transports/host-replies.generated.d.ts +1 -1
- package/dist/core/transports/host-replies.generated.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/dist/workflows/types.generated.d.ts +49 -18
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ export interface HostReply {
|
|
|
7
7
|
readonly keys: readonly string[] | null;
|
|
8
8
|
}
|
|
9
9
|
/** The civitai commit this ledger was read from. A request the host added after it is refused too. */
|
|
10
|
-
export declare const HOST_SNAPSHOT = "
|
|
10
|
+
export declare const HOST_SNAPSHOT = "05f1d1fa8f";
|
|
11
11
|
/**
|
|
12
12
|
* Every request the host answered at {@link HOST_SNAPSHOT}. A type absent here is refused.
|
|
13
13
|
* Reply names and framing are fixed at publish time: if the host renames a reply or moves a
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Generated by scripts/gen-host-replies.mjs from snapshots/host-messages.json
|
|
2
|
-
// (civitai/civitai
|
|
2
|
+
// (civitai/civitai 05f1d1fa8f, 2026-10-20). Do not edit.
|
|
3
3
|
/** The civitai commit this ledger was read from. A request the host added after it is refused too. */
|
|
4
|
-
export const HOST_SNAPSHOT = "
|
|
4
|
+
export const HOST_SNAPSHOT = "05f1d1fa8f";
|
|
5
5
|
/**
|
|
6
6
|
* Every request the host answered at {@link HOST_SNAPSHOT}. A type absent here is refused.
|
|
7
7
|
* Reply names and framing are fixed at publish time: if the host renames a reply or moves a
|
|
@@ -33,7 +33,7 @@ export const HOST_REPLIES = {
|
|
|
33
33
|
"OPEN_MEDIA_UPLOAD": { "reply": "MEDIA_UPLOAD_RESULT", "framing": "legacy", "keys": ["selected"] },
|
|
34
34
|
"OPEN_RESOURCE_PICKER": { "reply": "RESOURCE_PICKER_RESULT", "framing": "legacy", "keys": ["selected", "selectedResources"] },
|
|
35
35
|
"POLL_WORKFLOW": { "reply": "WORKFLOW_STATUS", "framing": "legacy", "keys": ["snapshot"] },
|
|
36
|
-
"PREPARE_TRAINING_DATASET": { "reply": "TRAINING_DATASET_RESULT", "framing": "legacy", "keys": [
|
|
36
|
+
"PREPARE_TRAINING_DATASET": { "reply": "TRAINING_DATASET_RESULT", "framing": "legacy", "keys": [] },
|
|
37
37
|
"PUBLISH_GENERATION_OUTPUTS": { "reply": "PUBLISH_RESULT", "framing": "legacy", "keys": ["result"] },
|
|
38
38
|
"QUERY_APP_WORKFLOWS": { "reply": "APP_WORKFLOWS_RESULT", "framing": "legacy", "keys": ["result"] },
|
|
39
39
|
"REQUEST_TOKEN": { "reply": "TOKEN_REFRESH_RESPONSE", "framing": "legacy", "keys": ["token"] },
|
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export { StorageError } from './doc-store/index.js';
|
|
|
17
17
|
export type { DocumentAuthor, DocumentCallOptions, DocumentListQuery, DocumentPage, DocumentStorage, DocumentWhereValue, StorageCollection, StorageCollectionInfo, StorageDocument, StorageErrorCode, StorageIndexType, StorageInfo, StorageLimits, StorageUsage, WriteOptions, } from './doc-store/index.js';
|
|
18
18
|
export { SubmissionUnconfirmedError } from './workflows/index.js';
|
|
19
19
|
export type { WorkflowCallOptions, WorkflowGetOptions, WorkflowListQuery, WorkflowListResult, WorkflowSubmitOptions, WorkflowWatchOptions, WorkflowsClient, } from './workflows/index.js';
|
|
20
|
-
export type { AiToolkitLrScheduler, AiToolkitOptimizerType, AiToolkitPlainEcosystem, AiToolkitTrainingParams, AiToolkitTrainingParamsBase, AppWorkflow, AppWorkflowImage, BlockModel3dOutput, BlockModelSubstitution, BlockPublishedModel, BlockSourceImage, BlockStepQuote, BlockStepToolCall, BlockTextToImageParams, BlockTrainedEpoch, BlockTrainingQuote, BlockWorkflowSnapshot, BlockWorkflowStepSnapshot, BuzzAccountType, InlineComfyNode, KnownBlockWorkflowErrorCode, ModelSubstitutionReason, WithWorkflowStepRefs, WorkflowBody, WorkflowBodyCustomComfy, WorkflowBodyCustomComfyInline, WorkflowBodyCustomComfyRecipe, WorkflowBodyPassThroughStep, WorkflowBodyStep, WorkflowBodyTextToImage, WorkflowBodyTraining, WorkflowBodyWorkflow, WorkflowBodyWorkflowStep, WorkflowStepRef, } from './workflows/types.generated.js';
|
|
20
|
+
export type { AiToolkitLrScheduler, AiToolkitOptimizerType, AiToolkitPlainEcosystem, AiToolkitTrainingParams, AiToolkitTrainingParamsBase, AppWorkflow, AppWorkflowImage, BlockModel3dOutput, BlockModelSubstitution, BlockPublishedModel, BlockSourceImage, BlockStepQuote, BlockStepToolCall, BlockTextToImageParams, BlockTrainedEpoch, BlockTrainingDatasetItem, BlockTrainingQuote, BlockWorkflowSnapshot, BlockWorkflowStepSnapshot, BuzzAccountType, InlineComfyNode, KnownBlockWorkflowErrorCode, ModelSubstitutionReason, WithWorkflowStepRefs, WorkflowBody, WorkflowBodyCustomComfy, WorkflowBodyCustomComfyInline, WorkflowBodyCustomComfyRecipe, WorkflowBodyPassThroughStep, WorkflowBodyStep, WorkflowBodyTextToImage, WorkflowBodyTraining, WorkflowBodyWorkflow, WorkflowBodyWorkflowStep, WorkflowStepRef, } from './workflows/types.generated.js';
|
|
21
21
|
export { isTerminal, isTerminalStatus } from './orchestration/index.js';
|
|
22
22
|
export type { OrchestrationClient, Step, StepTemplate, WaitOptions, Workflow, WorkflowPage, WorkflowQuery, WorkflowStatus, WorkflowTemplate, } from './orchestration/index.js';
|
|
23
23
|
export { createHost } from './host/index.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** This package's version, reported to the host as `sdkVersion` in `BLOCK_READY`. */
|
|
2
|
-
export declare const VERSION = "0.
|
|
2
|
+
export declare const VERSION = "0.19.0";
|
|
@@ -938,16 +938,16 @@ export type AiToolkitTrainingParams = AiToolkitTrainingParamsBase & ({
|
|
|
938
938
|
modelVariant: 'base' | 'sft';
|
|
939
939
|
});
|
|
940
940
|
/**
|
|
941
|
-
* Train a LoRA with the ai-toolkit engine on
|
|
942
|
-
*
|
|
941
|
+
* Train a LoRA with the ai-toolkit engine on images the VIEWER uploaded through
|
|
942
|
+
* the host — the App Blocks `kind: 'training'` workflow body.
|
|
943
943
|
*
|
|
944
944
|
* ## Availability — read before building on it
|
|
945
945
|
*
|
|
946
946
|
* - 🔴 Behind the host flag **`app-blocks-training-kind`**, which ships OFF and is
|
|
947
947
|
* evaluated per viewer. Where it is off, every training call is refused
|
|
948
948
|
* (`training from apps is not enabled`).
|
|
949
|
-
* - **Page apps only** (`/apps/run/<slug>`). The model slot answers
|
|
950
|
-
*
|
|
949
|
+
* - **Page apps only** (`/apps/run/<slug>`). The model slot answers
|
|
950
|
+
* `RUN_TRAINING` with an error, and the server refuses a non-page token.
|
|
951
951
|
* - The manifest must declare **`ai:write:budgeted`** and the viewer must have
|
|
952
952
|
* granted it; the viewer must be signed in.
|
|
953
953
|
* - **Not from a development or review session**: dev tokens (`dev:live`, dev
|
|
@@ -956,17 +956,22 @@ export type AiToolkitTrainingParams = AiToolkitTrainingParamsBase & ({
|
|
|
956
956
|
*
|
|
957
957
|
* ## The flow
|
|
958
958
|
*
|
|
959
|
-
* 1. **
|
|
960
|
-
*
|
|
961
|
-
*
|
|
962
|
-
*
|
|
959
|
+
* 1. **Upload** — `useImageUpload({ purpose: 'trainingData' }).open()`
|
|
960
|
+
* (`OPEN_IMAGE_UPLOAD { purpose: 'trainingData' }`). The viewer picks up to
|
|
961
|
+
* {@link BLOCK_TRAINING_DATASET_MAX_ITEMS} images in a host modal; you get
|
|
962
|
+
* `[{ url, air }]` ({@link BlockTrainingDataImage}), or `null` on cancel.
|
|
963
|
+
* Pair each `air` with your caption to build {@link WorkflowBodyTraining.items}.
|
|
963
964
|
* 2. **Quote** — `useBuzzWorkflow().estimate(body)` with this body, `quoteId`
|
|
964
965
|
* ABSENT. The reply's {@link BlockWorkflowSnapshot.trainingQuote} is the
|
|
965
966
|
* orchestrator's own price for exactly this run, stored server-side.
|
|
966
967
|
* 3. **Run** — `useRunTraining().runTraining({ ...body, quoteId })`
|
|
967
968
|
* (`RUN_TRAINING`). Civitai shows the viewer a consent dialog in ITS chrome —
|
|
968
969
|
* price, base model, length, dataset size, all read back from the server,
|
|
969
|
-
* never from your body
|
|
970
|
+
* never from your body, with the host's own copies of the uploads as
|
|
971
|
+
* thumbnails — and submits only on their click. A quote naming an image this
|
|
972
|
+
* host did not upload for the block is refused with no dialog
|
|
973
|
+
* (`training data not uploaded here`) — upload in the same page session as the
|
|
974
|
+
* run; a reload forgets the uploads.
|
|
970
975
|
* 4. **Follow** — `useBuzzWorkflow().watch(snapshot.workflowId)`.
|
|
971
976
|
*
|
|
972
977
|
* 🔴 `useBuzzWorkflow().submit()` REFUSES THIS BODY before sending it. The server
|
|
@@ -982,8 +987,12 @@ export type AiToolkitTrainingParams = AiToolkitTrainingParamsBase & ({
|
|
|
982
987
|
*/
|
|
983
988
|
export interface WorkflowBodyTraining {
|
|
984
989
|
kind: 'training';
|
|
985
|
-
/**
|
|
986
|
-
|
|
990
|
+
/**
|
|
991
|
+
* The dataset: 1…{@link BLOCK_TRAINING_DATASET_MAX_ITEMS} images this host
|
|
992
|
+
* uploaded for the viewer, each with its caption — see
|
|
993
|
+
* {@link BlockTrainingDatasetItem}. One blob may appear once.
|
|
994
|
+
*/
|
|
995
|
+
items: BlockTrainingDatasetItem[];
|
|
987
996
|
/** The only engine accepted. */
|
|
988
997
|
engine: 'ai-toolkit';
|
|
989
998
|
/**
|
|
@@ -992,12 +1001,17 @@ export interface WorkflowBodyTraining {
|
|
|
992
1001
|
*/
|
|
993
1002
|
model: string;
|
|
994
1003
|
params: AiToolkitTrainingParams;
|
|
995
|
-
/**
|
|
1004
|
+
/**
|
|
1005
|
+
* At most {@link BLOCK_TRAINING_TRIGGER_WORD_MAX_CHARS} characters. The host runs
|
|
1006
|
+
* it through the same trigger-word check Civitai's trainer and Training Studio
|
|
1007
|
+
* use, at the estimate and again at the submit, before anything is reserved; a
|
|
1008
|
+
* refused trigger word fails the estimate.
|
|
1009
|
+
*/
|
|
996
1010
|
triggerWord: string;
|
|
997
1011
|
/**
|
|
998
1012
|
* At most {@link BLOCK_TRAINING_SAMPLE_PROMPTS_MAX} prompts of at most
|
|
999
|
-
* {@link BLOCK_TRAINING_SAMPLE_PROMPT_MAX_CHARS} characters each.
|
|
1000
|
-
*
|
|
1013
|
+
* {@link BLOCK_TRAINING_SAMPLE_PROMPT_MAX_CHARS} characters each. Checked for
|
|
1014
|
+
* those bounds only, as in the Training Studio.
|
|
1001
1015
|
*/
|
|
1002
1016
|
samplePrompts: string[];
|
|
1003
1017
|
/**
|
|
@@ -1027,7 +1041,7 @@ export interface WorkflowBodyTraining {
|
|
|
1027
1041
|
* unmodified. Bounded by a platform-internal denylist and by `maxBuzz`, not
|
|
1028
1042
|
* by a registry.
|
|
1029
1043
|
* - {@link WorkflowBodyTraining} (`kind: 'training'`) — an ai-toolkit LoRA run
|
|
1030
|
-
* on
|
|
1044
|
+
* on images the viewer uploaded through the host. ESTIMATE ONLY
|
|
1031
1045
|
* through `useBuzzWorkflow`; it runs through `useRunTraining()`, whose
|
|
1032
1046
|
* host-chrome consent dialog is the only way to confirm its quote.
|
|
1033
1047
|
* - {@link WorkflowBodyWorkflow} (`kind: 'workflow'`) — up to
|
|
@@ -1395,8 +1409,8 @@ export interface BlockWorkflowSnapshot {
|
|
|
1395
1409
|
*
|
|
1396
1410
|
* `cost.total` on the same snapshot equals `trainingQuote.total`.
|
|
1397
1411
|
* `expiresAt` is an ISO-8601 timestamp: after it the run is refused and you
|
|
1398
|
-
* estimate again. `imageCount` is the
|
|
1399
|
-
*
|
|
1412
|
+
* estimate again. `imageCount` is the size of the dataset the server quoted
|
|
1413
|
+
* (`items.length`).
|
|
1400
1414
|
*
|
|
1401
1415
|
* Present ONLY on the reply to a `kind: 'training'` estimate. Absent on hosts
|
|
1402
1416
|
* that predate civitai/civitai#5434.
|
|
@@ -1529,7 +1543,7 @@ export interface BlockTrainingQuote {
|
|
|
1529
1543
|
quoteId: string;
|
|
1530
1544
|
/** The quoted price, in Buzz. */
|
|
1531
1545
|
total: number;
|
|
1532
|
-
/** How many images the
|
|
1546
|
+
/** How many images the quoted dataset holds. */
|
|
1533
1547
|
imageCount: number;
|
|
1534
1548
|
/** ISO-8601. The quote cannot be run after this. */
|
|
1535
1549
|
expiresAt: string;
|
|
@@ -1710,3 +1724,20 @@ export interface AppWorkflow {
|
|
|
1710
1724
|
*/
|
|
1711
1725
|
model3dOutputs?: BlockModel3dOutput[];
|
|
1712
1726
|
}
|
|
1727
|
+
/**
|
|
1728
|
+
* One image of a training dataset ({@link WorkflowBodyTraining.items}) — a blob
|
|
1729
|
+
* this host uploaded for the viewer, and the caption to train it with. The
|
|
1730
|
+
* Training Studio's own `{ air, caption }` shape.
|
|
1731
|
+
*
|
|
1732
|
+
* Host bounds (`blockTrainingDatasetItemsSchema`, civitai/civitai#6461): `air`
|
|
1733
|
+
* is the blob's key ({@link BlockTrainingDataImage.air}) or its Civitai-hosted
|
|
1734
|
+
* blob url — the server keeps only the key; `caption` at most
|
|
1735
|
+
* {@link BLOCK_TRAINING_CAPTION_MAX_CHARS} characters; no other keys;
|
|
1736
|
+
* 1…{@link BLOCK_TRAINING_DATASET_MAX_ITEMS} items per body, and one blob at
|
|
1737
|
+
* most once (keys compare case-insensitively). A body outside them is refused at
|
|
1738
|
+
* the estimate.
|
|
1739
|
+
*/
|
|
1740
|
+
export interface BlockTrainingDatasetItem {
|
|
1741
|
+
air: string;
|
|
1742
|
+
caption: string;
|
|
1743
|
+
}
|
package/package.json
CHANGED