@civitai/orchestration-client 0.2.8 → 0.2.9

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.
@@ -10,20 +10,76 @@ export function createCivitaiClient(config) {
10
10
  Authorization: `Bearer ${config.auth}`,
11
11
  },
12
12
  }));
13
- client.interceptors.response.use(async (response) => {
14
- if (!response.ok) {
15
- const error = (response.status === 400
16
- ? await response
17
- .json()
18
- .catch(() => ({ status: response.status, detail: response.statusText }))
19
- : { status: response.status, detail: response.statusText });
20
- const newResponse = new Response(JSON.stringify(error), {
21
- status: response.status,
22
- statusText: response.statusText,
23
- });
24
- return newResponse;
25
- }
13
+ client.interceptors.response.use(normalizeErrorResponse);
14
+ return client;
15
+ }
16
+ /**
17
+ * Guarantees that an error response's body is a JSON object with a numeric `status`, so the
18
+ * generated client's `error` is always `ProblemDetails`-shaped.
19
+ *
20
+ * A body that already satisfies this is left untouched: the original response (headers, url and
21
+ * body) is returned as-is. Otherwise a replacement response is built that keeps the original
22
+ * headers, with `Content-Type`/`Content-Length` corrected when the body is replaced.
23
+ *
24
+ * This runs as a response interceptor rather than an error interceptor because the generated
25
+ * fetch client passes the original error to every error interceptor instead of chaining them, so
26
+ * normalization there would not reach interceptors registered by consumers.
27
+ */
28
+ async function normalizeErrorResponse(response) {
29
+ // `new Response` only accepts 200-599, and only error statuses carry a problem body.
30
+ if (response.status < 400 || response.status > 599)
26
31
  return response;
32
+ let text = '';
33
+ try {
34
+ text = await response.clone().text();
35
+ }
36
+ catch (_a) {
37
+ // An unreadable body is treated as empty.
38
+ }
39
+ const parsed = parseJson(text);
40
+ const headers = new Headers(response.headers);
41
+ let problem;
42
+ if (isObject(parsed)) {
43
+ if (typeof parsed.status === 'number')
44
+ return response;
45
+ // A JSON error body that isn't problem details (e.g. an OpenAI-style `{ error: {...} }`).
46
+ problem = { ...parsed, status: response.status };
47
+ }
48
+ else {
49
+ problem = { status: response.status, detail: describeNonJsonBody(response, text, parsed) };
50
+ headers.set('Content-Type', 'application/json');
51
+ }
52
+ headers.delete('Content-Length');
53
+ return new Response(JSON.stringify(problem), {
54
+ status: response.status,
55
+ statusText: response.statusText,
56
+ headers,
27
57
  });
28
- return client;
58
+ }
59
+ /**
60
+ * A plain-text body is a human-readable explanation, so it becomes `detail`. Markup (e.g. a
61
+ * gateway's HTML error page) and empty bodies are not, so they fall back to the reason phrase.
62
+ */
63
+ function describeNonJsonBody(response, text, parsed) {
64
+ var _a;
65
+ const mediaType = (_a = response.headers.get('Content-Type')) === null || _a === void 0 ? void 0 : _a.split(';')[0].trim().toLowerCase();
66
+ const trimmed = text.trim();
67
+ if (mediaType === 'text/plain' && trimmed)
68
+ return trimmed;
69
+ if (typeof parsed === 'string' && parsed.trim())
70
+ return parsed.trim();
71
+ return response.statusText;
72
+ }
73
+ function parseJson(text) {
74
+ if (!text)
75
+ return undefined;
76
+ try {
77
+ return JSON.parse(text);
78
+ }
79
+ catch (_a) {
80
+ return undefined;
81
+ }
82
+ }
83
+ function isObject(value) {
84
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
29
85
  }
@@ -39,6 +39,7 @@ export {
39
39
  invokeGitHubRunnerStepTemplate,
40
40
  invokeHumanoidImageMaskStepTemplate,
41
41
  invokeImageBackgroundRemovalStepTemplate,
42
+ invokeImageFaceFixStepTemplate,
42
43
  invokeImageGenStepTemplate,
43
44
  invokeImageResourceTrainingStepTemplate,
44
45
  invokeImageScanningStepTemplate,
@@ -84,6 +85,7 @@ export {
84
85
  invokeVideoInterpolationStepTemplate,
85
86
  invokeVideoMetadataStepTemplate,
86
87
  invokeVideoUpscalerStepTemplate,
88
+ invokeWasmStepTemplate,
87
89
  invokeWdTaggingStepTemplate,
88
90
  invokeWebScrapeStepTemplate,
89
91
  invokeWebSearchStepTemplate,
@@ -667,6 +669,10 @@ export {
667
669
  type ImageBackgroundRemovalStep,
668
670
  type ImageBackgroundRemovalStepTemplate,
669
671
  type ImageBlob,
672
+ type ImageFaceFixInput,
673
+ type ImageFaceFixOutput,
674
+ type ImageFaceFixStep,
675
+ type ImageFaceFixStepTemplate,
670
676
  type ImageGenInput,
671
677
  type ImageGenInputLora,
672
678
  type ImageGenInputWritable,
@@ -817,6 +823,11 @@ export {
817
823
  type InvokeImageBackgroundRemovalStepTemplateErrors,
818
824
  type InvokeImageBackgroundRemovalStepTemplateResponse,
819
825
  type InvokeImageBackgroundRemovalStepTemplateResponses,
826
+ type InvokeImageFaceFixStepTemplateData,
827
+ type InvokeImageFaceFixStepTemplateError,
828
+ type InvokeImageFaceFixStepTemplateErrors,
829
+ type InvokeImageFaceFixStepTemplateResponse,
830
+ type InvokeImageFaceFixStepTemplateResponses,
820
831
  type InvokeImageGenStepTemplateData,
821
832
  type InvokeImageGenStepTemplateError,
822
833
  type InvokeImageGenStepTemplateErrors,
@@ -1042,6 +1053,11 @@ export {
1042
1053
  type InvokeVideoUpscalerStepTemplateErrors,
1043
1054
  type InvokeVideoUpscalerStepTemplateResponse,
1044
1055
  type InvokeVideoUpscalerStepTemplateResponses,
1056
+ type InvokeWasmStepTemplateData,
1057
+ type InvokeWasmStepTemplateError,
1058
+ type InvokeWasmStepTemplateErrors,
1059
+ type InvokeWasmStepTemplateResponse,
1060
+ type InvokeWasmStepTemplateResponses,
1045
1061
  type InvokeWdTaggingStepTemplateData,
1046
1062
  type InvokeWdTaggingStepTemplateError,
1047
1063
  type InvokeWdTaggingStepTemplateErrors,
@@ -1721,6 +1737,16 @@ export {
1721
1737
  type Wan30VideoGenInput,
1722
1738
  type WanImageGenInput,
1723
1739
  type WanVideoGenInput,
1740
+ type WasmInput,
1741
+ type WasmOutput,
1742
+ type WasmStep,
1743
+ type WasmStepTemplate,
1744
+ type WasmtimeAudioFile,
1745
+ type WasmtimeFile,
1746
+ type WasmtimeImageFile,
1747
+ type WasmtimeLimits,
1748
+ type WasmtimeVideoFile,
1749
+ type WasmtimeWasmInput,
1724
1750
  type Watermark,
1725
1751
  type WatermarkTransform,
1726
1752
  type WdTaggingInput,
@@ -1,3 +1,3 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
- export { addWorkflowTag, appendStreamingBlob, createFund, deleteFund, deleteWorkflow, depositIntoFund, getBlob, getBlobArchive, getBlobContent, getBlockedContent, getConsumerBlobUploadUrl, getFreeTier, getFund, getResource, getService, getStreamingBlob, getWorkflow, getWorkflowStep, headBlob, invalidateUserCache, invalidateUserTokens, invokeAceStepAudioStepTemplate, invokeAgeClassificationStepTemplate, invokeArchiveExtractionStepTemplate, invokeAudioCaptioningStepTemplate, invokeAudioClassificationStepTemplate, invokeAudioModerationStepTemplate, invokeAudioTextModerationStepTemplate, invokeBatchOcrSafetyClassificationStepTemplate, invokeBlobArchiveStepTemplate, invokeChatCompletionStepTemplate, invokeComfyNodepackSnapshotStepTemplate, invokeComfyStepTemplate, invokeComposeMediaStepTemplate, invokeConvertImageStepTemplate, invokeCustomComfyStepTemplate, invokeEchoStepTemplate, invokeGitHubRunnerStepTemplate, invokeHumanoidImageMaskStepTemplate, invokeImageBackgroundRemovalStepTemplate, invokeImageGenStepTemplate, invokeImageResourceTrainingStepTemplate, invokeImageScanningStepTemplate, invokeImageToSvgStepTemplate, invokeImageUploadStepTemplate, invokeImageUpscalerStepTemplate, invokeLiveTextToSpeechStepTemplate, invokeLiveTranscriptionStepTemplate, invokeLyricsAlignmentStepTemplate, invokeMediaCaptioningStepTemplate, invokeMediaHashStepTemplate, invokeMediaRatingStepTemplate, invokeMergeStepTemplate, invokeMiniMaxMusic3StepTemplate, invokeModel3dPreviewStepTemplate, invokeModelAnalysisStepTemplate, invokeModelClamScanStepTemplate, invokeModelHashStepTemplate, invokeModelParseMetadataStepTemplate, invokeModelPickleScanStepTemplate, invokeMultimodalEmbeddingStepTemplate, invokeOcrStepTemplate, invokePolyGenStepTemplate, invokePrepareResourceStepTemplate, invokePreprocessImageStepTemplate, invokePreprocessVideoStepTemplate, invokePromptEnhancementStepTemplate, invokePromptModerationStepTemplate, invokeQwenImageBenchStepTemplate, invokeRepeatStepTemplate, invokeShieldstralModerationStepTemplate, invokeSoniloAudioGenStepTemplate, invokeTextToImageStepTemplate, invokeTextToSpeechStepTemplate, invokeTrainingStepTemplate, invokeTranscodeStepTemplate, invokeTranscriptionStepTemplate, invokeTryOnUStepTemplate, invokeVideoBackgroundRemovalStepTemplate, invokeVideoEnhancementStepTemplate, invokeVideoFrameExtractionStepTemplate, invokeVideoGenStepTemplate, invokeVideoInterpolationStepTemplate, invokeVideoMetadataStepTemplate, invokeVideoUpscalerStepTemplate, invokeWdTaggingStepTemplate, invokeWebScrapeStepTemplate, invokeWebSearchStepTemplate, invokeXGuardModerationStepTemplate, invokeYuE2StepTemplate, listServices, patchWorkflow, patchWorkflowStep, queryResources, queryWorkflows, refreshBlob, refundFund, removeAllWorkflowTags, removeWorkflowTag, submitWorkflow, updateFund, updateWorkflow, updateWorkflowStep, uploadConsumerBlob, } from './sdk.gen.js';
2
+ export { addWorkflowTag, appendStreamingBlob, createFund, deleteFund, deleteWorkflow, depositIntoFund, getBlob, getBlobArchive, getBlobContent, getBlockedContent, getConsumerBlobUploadUrl, getFreeTier, getFund, getResource, getService, getStreamingBlob, getWorkflow, getWorkflowStep, headBlob, invalidateUserCache, invalidateUserTokens, invokeAceStepAudioStepTemplate, invokeAgeClassificationStepTemplate, invokeArchiveExtractionStepTemplate, invokeAudioCaptioningStepTemplate, invokeAudioClassificationStepTemplate, invokeAudioModerationStepTemplate, invokeAudioTextModerationStepTemplate, invokeBatchOcrSafetyClassificationStepTemplate, invokeBlobArchiveStepTemplate, invokeChatCompletionStepTemplate, invokeComfyNodepackSnapshotStepTemplate, invokeComfyStepTemplate, invokeComposeMediaStepTemplate, invokeConvertImageStepTemplate, invokeCustomComfyStepTemplate, invokeEchoStepTemplate, invokeGitHubRunnerStepTemplate, invokeHumanoidImageMaskStepTemplate, invokeImageBackgroundRemovalStepTemplate, invokeImageFaceFixStepTemplate, invokeImageGenStepTemplate, invokeImageResourceTrainingStepTemplate, invokeImageScanningStepTemplate, invokeImageToSvgStepTemplate, invokeImageUploadStepTemplate, invokeImageUpscalerStepTemplate, invokeLiveTextToSpeechStepTemplate, invokeLiveTranscriptionStepTemplate, invokeLyricsAlignmentStepTemplate, invokeMediaCaptioningStepTemplate, invokeMediaHashStepTemplate, invokeMediaRatingStepTemplate, invokeMergeStepTemplate, invokeMiniMaxMusic3StepTemplate, invokeModel3dPreviewStepTemplate, invokeModelAnalysisStepTemplate, invokeModelClamScanStepTemplate, invokeModelHashStepTemplate, invokeModelParseMetadataStepTemplate, invokeModelPickleScanStepTemplate, invokeMultimodalEmbeddingStepTemplate, invokeOcrStepTemplate, invokePolyGenStepTemplate, invokePrepareResourceStepTemplate, invokePreprocessImageStepTemplate, invokePreprocessVideoStepTemplate, invokePromptEnhancementStepTemplate, invokePromptModerationStepTemplate, invokeQwenImageBenchStepTemplate, invokeRepeatStepTemplate, invokeShieldstralModerationStepTemplate, invokeSoniloAudioGenStepTemplate, invokeTextToImageStepTemplate, invokeTextToSpeechStepTemplate, invokeTrainingStepTemplate, invokeTranscodeStepTemplate, invokeTranscriptionStepTemplate, invokeTryOnUStepTemplate, invokeVideoBackgroundRemovalStepTemplate, invokeVideoEnhancementStepTemplate, invokeVideoFrameExtractionStepTemplate, invokeVideoGenStepTemplate, invokeVideoInterpolationStepTemplate, invokeVideoMetadataStepTemplate, invokeVideoUpscalerStepTemplate, invokeWasmStepTemplate, invokeWdTaggingStepTemplate, invokeWebScrapeStepTemplate, invokeWebSearchStepTemplate, invokeXGuardModerationStepTemplate, invokeYuE2StepTemplate, listServices, patchWorkflow, patchWorkflowStep, queryResources, queryWorkflows, refreshBlob, refundFund, removeAllWorkflowTags, removeWorkflowTag, submitWorkflow, updateFund, updateWorkflow, updateWorkflowStep, uploadConsumerBlob, } from './sdk.gen.js';
3
3
  export { AnimalPoseBboxDetector, AnimalPoseEstimator, AnylineMergeWith, ArchiveEntryMediaType, ArchiveEntryRejectionReason, ArchiveFormat, BlurRegionMode, BuzzClientAccount, CoarseMode, ComfySampler, ComfyScheduler, ContainerFormat, DensePoseColormap, DensePoseModel, DepthAnythingCheckpoint, DepthAnythingV2Checkpoint, DwPoseBboxDetector, DwPoseEstimator, EmbeddingPrecision, FileFormat, GeminiOmniModel, GeminiOmniResolution, HaiperVideoGenAspectRatio, HaiperVideoGenCameraMovement, HaiperVideoGenModel, HiDreamI1Precision, HiDreamI1Variant, HumanoidImageMaskCategory, ImageBackgroundRemovalFormat, ImageBackgroundRemovalModel, ImageGenOutputFormat, ImageResouceTrainingModerationStatus, ImageTransformer, JobSupport, KlingMode, KlingModel, KlingV3Operation, KlingVideoGenAspectRatio, KlingVideoGenDuration, LeresBoost, LightricksAspectRatio, LyricsAlignmentStatus, MediaContainer, MediaFit, MediaHashType, MediaOutputType, MergeMissingBehavior, MergeReducer, Metric3dBackbone, MiniMaxH3Model, MiniMaxVideoGenModel, ModelClamScanStatus, ModelPickleScanStatus, NsfwLevel, OutputFormat, Priority, ResourceFeeType, ResourceView, SafeMode, Scheduler, SdCppSampleMethod, SdCppSchedule, SdCppUCacheMode, SeedanceModel, SeedreamVersion, ServiceStatus, SettlementCurrency, ShadowRemoval, TraceMode, TrainingModerationStatus, TrainingTraceMode, TransactionType, UpdateWorkflowStatus, Veo3AspectRatio, Veo3GenerationMode, Veo3Version, ViduVideoGenModel, ViduVideoGenStyle, WorkflowStatus, WorkflowStepWarningCode, WorkflowTier, WorkflowUpgradeMode, WorkflowWaitUntil, XGuardPromptScope, ZoeDepthEnvironment, } from './types.gen.js';
@@ -118,6 +118,9 @@ import type {
118
118
  InvokeImageBackgroundRemovalStepTemplateData,
119
119
  InvokeImageBackgroundRemovalStepTemplateErrors,
120
120
  InvokeImageBackgroundRemovalStepTemplateResponses,
121
+ InvokeImageFaceFixStepTemplateData,
122
+ InvokeImageFaceFixStepTemplateErrors,
123
+ InvokeImageFaceFixStepTemplateResponses,
121
124
  InvokeImageGenStepTemplateData,
122
125
  InvokeImageGenStepTemplateErrors,
123
126
  InvokeImageGenStepTemplateResponses,
@@ -253,6 +256,9 @@ import type {
253
256
  InvokeVideoUpscalerStepTemplateData,
254
257
  InvokeVideoUpscalerStepTemplateErrors,
255
258
  InvokeVideoUpscalerStepTemplateResponses,
259
+ InvokeWasmStepTemplateData,
260
+ InvokeWasmStepTemplateErrors,
261
+ InvokeWasmStepTemplateResponses,
256
262
  InvokeWdTaggingStepTemplateData,
257
263
  InvokeWdTaggingStepTemplateErrors,
258
264
  InvokeWdTaggingStepTemplateResponses,
@@ -699,7 +705,7 @@ export declare const invokeEchoStepTemplate: <ThrowOnError extends boolean = fal
699
705
  /**
700
706
  * GitHubRunner
701
707
  *
702
- * Runs one GitHub Actions job on a GPU worker. Its input hands over the job and its secrets, so it is restricted to managers and must be in an ephemeral workflow.
708
+ * Runs one GitHub Actions job on a worker. Its input hands over the job and its secrets, so it is restricted to managers and the config must be encrypted for the fleet.
703
709
  */
704
710
  export declare const invokeGitHubRunnerStepTemplate: <ThrowOnError extends boolean = false>(
705
711
  options?: Options<InvokeGitHubRunnerStepTemplateData, ThrowOnError>
@@ -730,6 +736,17 @@ export declare const invokeImageBackgroundRemovalStepTemplate: <
730
736
  ThrowOnError,
731
737
  'fields'
732
738
  >;
739
+ /**
740
+ * Detects the faces in an image and regenerates them with an SD1 or SDXL-family checkpoint.
741
+ */
742
+ export declare const invokeImageFaceFixStepTemplate: <ThrowOnError extends boolean = false>(
743
+ options?: Options<InvokeImageFaceFixStepTemplateData, ThrowOnError>
744
+ ) => import('./client/types.gen.js').RequestResult<
745
+ InvokeImageFaceFixStepTemplateResponses,
746
+ InvokeImageFaceFixStepTemplateErrors,
747
+ ThrowOnError,
748
+ 'fields'
749
+ >;
733
750
  /**
734
751
  * Image Generation
735
752
  *
@@ -1278,6 +1295,17 @@ export declare const invokeVideoUpscalerStepTemplate: <ThrowOnError extends bool
1278
1295
  ThrowOnError,
1279
1296
  'fields'
1280
1297
  >;
1298
+ /**
1299
+ * Runs a WebAssembly module as a WASI command with its arguments, environment, stdin and read-only files under /input, and no network.
1300
+ */
1301
+ export declare const invokeWasmStepTemplate: <ThrowOnError extends boolean = false>(
1302
+ options?: Options<InvokeWasmStepTemplateData, ThrowOnError>
1303
+ ) => import('./client/types.gen.js').RequestResult<
1304
+ InvokeWasmStepTemplateResponses,
1305
+ InvokeWasmStepTemplateErrors,
1306
+ ThrowOnError,
1307
+ 'fields'
1308
+ >;
1281
1309
  /**
1282
1310
  * WDTagging
1283
1311
  *
@@ -404,7 +404,7 @@ export const invokeEchoStepTemplate = (options) => {
404
404
  /**
405
405
  * GitHubRunner
406
406
  *
407
- * Runs one GitHub Actions job on a GPU worker. Its input hands over the job and its secrets, so it is restricted to managers and must be in an ephemeral workflow.
407
+ * Runs one GitHub Actions job on a worker. Its input hands over the job and its secrets, so it is restricted to managers and the config must be encrypted for the fleet.
408
408
  */
409
409
  export const invokeGitHubRunnerStepTemplate = (options) => {
410
410
  var _a;
@@ -442,6 +442,20 @@ export const invokeImageBackgroundRemovalStepTemplate = (options) => {
442
442
  },
443
443
  });
444
444
  };
445
+ /**
446
+ * Detects the faces in an image and regenerates them with an SD1 or SDXL-family checkpoint.
447
+ */
448
+ export const invokeImageFaceFixStepTemplate = (options) => {
449
+ var _a;
450
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post({
451
+ url: '/v2/consumer/recipes/imageFaceFix',
452
+ ...options,
453
+ headers: {
454
+ 'Content-Type': 'application/json',
455
+ ...options === null || options === void 0 ? void 0 : options.headers,
456
+ },
457
+ });
458
+ };
445
459
  /**
446
460
  * Image Generation
447
461
  *
@@ -1119,6 +1133,20 @@ export const invokeVideoUpscalerStepTemplate = (options) => {
1119
1133
  },
1120
1134
  });
1121
1135
  };
1136
+ /**
1137
+ * Runs a WebAssembly module as a WASI command with its arguments, environment, stdin and read-only files under /input, and no network.
1138
+ */
1139
+ export const invokeWasmStepTemplate = (options) => {
1140
+ var _a;
1141
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post({
1142
+ url: '/v2/consumer/recipes/wasm',
1143
+ ...options,
1144
+ headers: {
1145
+ 'Content-Type': 'application/json',
1146
+ ...options === null || options === void 0 ? void 0 : options.headers,
1147
+ },
1148
+ });
1149
+ };
1122
1150
  /**
1123
1151
  * WDTagging
1124
1152
  *
@@ -1679,6 +1679,7 @@ export declare const services: {
1679
1679
  },
1680
1680
  ];
1681
1681
  readonly ImageBackgroundRemovalInput: readonly ['image', 'internal', 'imageBackgroundRemoval'];
1682
+ readonly ImageFaceFixInput: readonly ['image', 'internal', 'imageFaceFix'];
1682
1683
  readonly ImageScanningInput: readonly ['image', 'internal', 'imageScanning'];
1683
1684
  readonly ImageUpscalerInput: readonly ['image', 'internal', 'imageUpscaler'];
1684
1685
  readonly Imagen4ImageGenInput: readonly [
@@ -3378,6 +3379,14 @@ export declare const services: {
3378
3379
  readonly operation: 'text-to-video';
3379
3380
  },
3380
3381
  ];
3382
+ readonly WasmtimeWasmInput: readonly [
3383
+ 'utility',
3384
+ 'internal',
3385
+ 'wasm',
3386
+ {
3387
+ readonly engine: 'wasmtime';
3388
+ },
3389
+ ];
3381
3390
  readonly WebScrapeInput: readonly ['utility', 'internal', 'webScrape'];
3382
3391
  readonly WebSearchInput: readonly ['utility', 'internal', 'webSearch'];
3383
3392
  readonly XGuardProfanityModerationInput: readonly [
@@ -183,6 +183,7 @@ export const services = {
183
183
  Ideogram4AIToolkitTrainingInput: ['model', 'internal', 'training', { engine: 'ai-toolkit', ecosystem: 'ideogram4' }],
184
184
  IdolComfyPolyGenInput: ['3d', 'internal', 'polyGen', { engine: 'comfy', model: 'idol' }],
185
185
  ImageBackgroundRemovalInput: ['image', 'internal', 'imageBackgroundRemoval'],
186
+ ImageFaceFixInput: ['image', 'internal', 'imageFaceFix'],
186
187
  ImageScanningInput: ['image', 'internal', 'imageScanning'],
187
188
  ImageUpscalerInput: ['image', 'internal', 'imageUpscaler'],
188
189
  Imagen4ImageGenInput: ['image', 'partner', 'imageGen', { engine: 'google', model: 'imagen4' }],
@@ -394,6 +395,7 @@ export const services = {
394
395
  Wan27FalTextToVideoInput: ['video', 'partner', 'videoGen', { engine: 'wan', version: 'v2.7', provider: 'fal', operation: 'text-to-video' }],
395
396
  Wan30ImageToVideoInput: ['video', 'partner', 'videoGen', { engine: 'wan', version: 'v3.0', operation: 'image-to-video' }],
396
397
  Wan30TextToVideoInput: ['video', 'partner', 'videoGen', { engine: 'wan', version: 'v3.0', operation: 'text-to-video' }],
398
+ WasmtimeWasmInput: ['utility', 'internal', 'wasm', { engine: 'wasmtime' }],
397
399
  WebScrapeInput: ['utility', 'internal', 'webScrape'],
398
400
  WebSearchInput: ['utility', 'internal', 'webSearch'],
399
401
  XGuardProfanityModerationInput: ['text', 'internal', 'xGuardModeration', { mode: 'profanity' }],
@@ -4845,7 +4845,7 @@ export type GifOutputFormat = Omit<ImageOutputFormat, 'format'> & {
4845
4845
  };
4846
4846
  export type GitHubRunnerInput = {
4847
4847
  /**
4848
- * The single-use runner config from GitHub's generate-jitconfig endpoint.
4848
+ * The single-use runner config from GitHub's generate-jitconfig endpoint, as a base64 CMS envelope encrypted to the fleet certificate.
4849
4849
  */
4850
4850
  jitConfig: string;
4851
4851
  /**
@@ -5649,6 +5649,60 @@ export type ImageBlob = Omit<Blob, 'type'> & {
5649
5649
  previewUrlExpiresAt?: null | string;
5650
5650
  type: 'image';
5651
5651
  };
5652
+ export type ImageFaceFixInput = {
5653
+ /**
5654
+ * Either A URL, A DataURL or a Base64 string
5655
+ */
5656
+ image: string;
5657
+ /**
5658
+ * The SD1 or SDXL-family checkpoint that regenerates the faces, usually the one that made the image.
5659
+ */
5660
+ checkpointModel: string;
5661
+ vaeModel?: null | string;
5662
+ loras?: {
5663
+ [key: string]: number;
5664
+ };
5665
+ embeddings?: Array<string>;
5666
+ clipSkip?: null | number;
5667
+ prompt: string;
5668
+ negativePrompt?: null | string;
5669
+ sampler?: ComfySampler;
5670
+ scheduler?: ComfyScheduler;
5671
+ steps?: number;
5672
+ cfgScale?: number;
5673
+ seed?: null | number;
5674
+ /**
5675
+ * How much of each detected face is regenerated.
5676
+ */
5677
+ strength?: number;
5678
+ quantity?: number;
5679
+ outputFormat?: ImageGenOutputFormat;
5680
+ /**
5681
+ * External metadata that will be stored with the image
5682
+ */
5683
+ imageMetadata?: null | string;
5684
+ };
5685
+ export type ImageFaceFixOutput = {
5686
+ images: Array<ImageBlob>;
5687
+ };
5688
+ /**
5689
+ * Detects the faces in an image and regenerates them with an SD1 or SDXL-family checkpoint.
5690
+ */
5691
+ export type ImageFaceFixStep = Omit<WorkflowStep, '$type'> & {
5692
+ input: ImageFaceFixInput;
5693
+ output?: ImageFaceFixOutput;
5694
+ $type: 'imageFaceFix';
5695
+ };
5696
+ /**
5697
+ * Detects the faces in an image and regenerates them with an SD1 or SDXL-family checkpoint.
5698
+ */
5699
+ export type ImageFaceFixStepTemplate = Omit<WorkflowStepTemplate, '$type'> & {
5700
+ /**
5701
+ * Input for the ImageFaceFixStep step.
5702
+ */
5703
+ input: ImageFaceFixInput;
5704
+ $type: 'imageFaceFix';
5705
+ };
5652
5706
  export type ImageGenInput = {
5653
5707
  engine: string;
5654
5708
  outputFormat?: ImageGenOutputFormat;
@@ -6037,6 +6091,18 @@ export type ImageUpscalerInput = {
6037
6091
  * Number of times to repeat the upscale operation (1-3). Each repeat doubles the resolution.
6038
6092
  */
6039
6093
  numberOfRepeats?: number;
6094
+ /**
6095
+ * `comfy` runs the upscale on ComfyUI and enables `scale` and `outputFormat`.
6096
+ */
6097
+ engine?: 'sdcpp' | 'comfy';
6098
+ /**
6099
+ * Exact resize factor, replacing `numberOfRepeats`. Comfy engine only.
6100
+ */
6101
+ scale?: null | number;
6102
+ /**
6103
+ * Comfy engine only; sd.cpp always outputs jpeg.
6104
+ */
6105
+ outputFormat?: ImageGenOutputFormat;
6040
6106
  };
6041
6107
  export type ImageUpscalerOutput = {
6042
6108
  blob: ImageBlob;
@@ -6343,9 +6409,9 @@ export type KohyaTrainingInput = Omit<TrainingInput, 'engine'> & {
6343
6409
  */
6344
6410
  keepTokens: number;
6345
6411
  /**
6346
- * CLIP layer skip for SD1.5; other families use 1.
6412
+ * CLIP layer skip for SD1.5 and SDXL-family models, also applied to previews. Defaults to 1 for SD1.5 and 2 for SDXL, which conditions on the penultimate layer at the least, so 1 is treated as 2 there; flow models use 1.
6347
6413
  */
6348
- clipSkip: number;
6414
+ clipSkip?: null | number;
6349
6415
  /**
6350
6416
  * Random horizontal image flips.
6351
6417
  */
@@ -9582,9 +9648,11 @@ export type ResourceFee = {
9582
9648
  type: ResourceFeeType;
9583
9649
  settlementCurrency: SettlementCurrency;
9584
9650
  recipientModelVersionId?: null | number;
9651
+ markup?: null | number;
9585
9652
  };
9586
9653
  export declare const ResourceFeeType: {
9587
9654
  readonly PER_IMAGE_BUZZ: 'perImageBuzz';
9655
+ readonly PERCENT_OF_COMPUTE: 'percentOfCompute';
9588
9656
  };
9589
9657
  export type ResourceFeeType = (typeof ResourceFeeType)[keyof typeof ResourceFeeType];
9590
9658
  export type ResourceInfo = {
@@ -11778,6 +11846,116 @@ export type WanVideoGenInput = Omit<VideoGenInput, 'engine'> & {
11778
11846
  steps?: number;
11779
11847
  loras?: Array<VideoGenInputLora>;
11780
11848
  };
11849
+ export type WasmInput = {
11850
+ engine: string;
11851
+ /**
11852
+ * Streams stdout while the module runs, readable at `output.stdoutUrl`; the full stdout is still in the output once it exits.
11853
+ */
11854
+ stream?: boolean;
11855
+ };
11856
+ export type WasmOutput = {
11857
+ /**
11858
+ * Set once the module exits, as are Civitai.Orchestration.Grains.Workflows.Steps.Wasm.WasmOutput.Stdout and Civitai.Orchestration.Grains.Workflows.Steps.Wasm.WasmOutput.Stderr.
11859
+ */
11860
+ exitCode?: null | number;
11861
+ stdout?: null | string;
11862
+ stderr?: null | string;
11863
+ /**
11864
+ * Stdout as it is written, when the input asked to stream it.
11865
+ */
11866
+ stdoutUrl?: null | string;
11867
+ /**
11868
+ * Stdout as JSON, when it parses as JSON; later steps reach it via `$ref` paths like `output.parsed.<field>`.
11869
+ */
11870
+ parsed?: unknown;
11871
+ };
11872
+ export type WasmStep = Omit<WorkflowStep, '$type'> & {
11873
+ input: WasmInput;
11874
+ output?: WasmOutput;
11875
+ $type: 'wasm';
11876
+ };
11877
+ export type WasmStepTemplate = Omit<WorkflowStepTemplate, '$type'> & {
11878
+ /**
11879
+ * Input for the WasmStep step.
11880
+ */
11881
+ input: WasmInput;
11882
+ $type: 'wasm';
11883
+ };
11884
+ export type WasmtimeAudioFile = Omit<WasmtimeFile, 'type'> & {
11885
+ url: string;
11886
+ type: 'audio';
11887
+ };
11888
+ /**
11889
+ * One media file handed to the module, imported through the path its kind takes in every other step.
11890
+ */
11891
+ export type WasmtimeFile = {
11892
+ type: string;
11893
+ };
11894
+ /**
11895
+ * Imported and scanned as any source image is.
11896
+ */
11897
+ export type WasmtimeImageFile = Omit<WasmtimeFile, 'type'> & {
11898
+ /**
11899
+ * Either A URL, A DataURL or a Base64 string
11900
+ */
11901
+ url: string;
11902
+ type: 'image';
11903
+ };
11904
+ /**
11905
+ * What the run may use, which is also what it reserves on its worker. The timeout is named after `wasmtime run -W`.
11906
+ */
11907
+ export type WasmtimeLimits = {
11908
+ /**
11909
+ * How long the module may run before it is interrupted.
11910
+ */
11911
+ timeout?: string;
11912
+ /**
11913
+ * In MiB, how far the module's memory may grow.
11914
+ */
11915
+ maxMemoryMb?: number;
11916
+ /**
11917
+ * Cores reserved, not enforced. A module runs on one thread, so less than 1 shares a core with other runs.
11918
+ */
11919
+ cpus?: number;
11920
+ };
11921
+ export type WasmtimeVideoFile = Omit<WasmtimeFile, 'type'> & {
11922
+ url: string;
11923
+ type: 'video';
11924
+ };
11925
+ /**
11926
+ * Runs the module in Wasmtime as a WASI command, as `wasmtime run` would.
11927
+ */
11928
+ export type WasmtimeWasmInput = Omit<WasmInput, 'engine'> & {
11929
+ /**
11930
+ * The module, compiled for `wasm32-wasip1`. A URL is imported into blob storage when the step is submitted.
11931
+ */
11932
+ module: string;
11933
+ /**
11934
+ * When set, a module whose bytes don't match is refused.
11935
+ */
11936
+ sha256?: null | string;
11937
+ /**
11938
+ * The arguments after the program name.
11939
+ */
11940
+ args?: Array<string>;
11941
+ env?: {
11942
+ [key: string]: string;
11943
+ };
11944
+ stdin?: null | string;
11945
+ /**
11946
+ * Read-only directories by guest path, as `wasmtime run --dir` preopens them, each listing its media files by name.
11947
+ */
11948
+ dirs?: {
11949
+ [key: string]: {
11950
+ [key: string]: WasmtimeFile;
11951
+ };
11952
+ };
11953
+ /**
11954
+ * What the run may use, which is also what it reserves on its worker. The timeout is named after `wasmtime run -W`.
11955
+ */
11956
+ limits?: WasmtimeLimits;
11957
+ engine: 'wasmtime';
11958
+ };
11781
11959
  /**
11782
11960
  * An image repeated across the whole output, burned into every frame.
11783
11961
  */
@@ -12251,7 +12429,7 @@ export type WorkflowTemplate = {
12251
12429
  [key: string]: unknown;
12252
12430
  };
12253
12431
  /**
12254
- * Indexed for searching. At most 10 tags, each at most 200 characters.
12432
+ * Indexed for searching. At most 20 tags, each at most 200 characters.
12255
12433
  */
12256
12434
  tags?: null | Array<string>;
12257
12435
  steps: Array<WorkflowStepTemplate>;
@@ -13405,9 +13583,9 @@ export type KohyaTrainingInputWritable = Omit<TrainingInputWritable2, 'engine'>
13405
13583
  */
13406
13584
  keepTokens: number;
13407
13585
  /**
13408
- * CLIP layer skip for SD1.5; other families use 1.
13586
+ * CLIP layer skip for SD1.5 and SDXL-family models, also applied to previews. Defaults to 1 for SD1.5 and 2 for SDXL, which conditions on the penultimate layer at the least, so 1 is treated as 2 there; flow models use 1.
13409
13587
  */
13410
- clipSkip: number;
13588
+ clipSkip?: null | number;
13411
13589
  /**
13412
13590
  * Random horizontal image flips.
13413
13591
  */
@@ -15681,6 +15859,46 @@ export type InvokeImageBackgroundRemovalStepTemplateResponses = {
15681
15859
  };
15682
15860
  export type InvokeImageBackgroundRemovalStepTemplateResponse =
15683
15861
  InvokeImageBackgroundRemovalStepTemplateResponses[keyof InvokeImageBackgroundRemovalStepTemplateResponses];
15862
+ export type InvokeImageFaceFixStepTemplateData = {
15863
+ body?: ImageFaceFixInput;
15864
+ path?: never;
15865
+ query?: {
15866
+ experimental?: boolean;
15867
+ allowMatureContent?: boolean;
15868
+ whatif?: boolean;
15869
+ ephemeral?: boolean;
15870
+ /**
15871
+ * How a workflow is paid for.
15872
+ */
15873
+ tier?: WorkflowTier;
15874
+ tags?: Array<string>;
15875
+ };
15876
+ url: '/v2/consumer/recipes/imageFaceFix';
15877
+ };
15878
+ export type InvokeImageFaceFixStepTemplateErrors = {
15879
+ /**
15880
+ * Bad Request
15881
+ */
15882
+ 400: ProblemDetails;
15883
+ /**
15884
+ * Unauthorized
15885
+ */
15886
+ 401: ProblemDetails;
15887
+ /**
15888
+ * Forbidden
15889
+ */
15890
+ 403: ProblemDetails;
15891
+ };
15892
+ export type InvokeImageFaceFixStepTemplateError =
15893
+ InvokeImageFaceFixStepTemplateErrors[keyof InvokeImageFaceFixStepTemplateErrors];
15894
+ export type InvokeImageFaceFixStepTemplateResponses = {
15895
+ /**
15896
+ * OK
15897
+ */
15898
+ 200: ImageFaceFixOutput;
15899
+ };
15900
+ export type InvokeImageFaceFixStepTemplateResponse =
15901
+ InvokeImageFaceFixStepTemplateResponses[keyof InvokeImageFaceFixStepTemplateResponses];
15684
15902
  export type InvokeImageGenStepTemplateData = {
15685
15903
  body?: ImageGenInput;
15686
15904
  path?: never;
@@ -17490,6 +17708,46 @@ export type InvokeVideoUpscalerStepTemplateResponses = {
17490
17708
  };
17491
17709
  export type InvokeVideoUpscalerStepTemplateResponse =
17492
17710
  InvokeVideoUpscalerStepTemplateResponses[keyof InvokeVideoUpscalerStepTemplateResponses];
17711
+ export type InvokeWasmStepTemplateData = {
17712
+ body?: WasmInput;
17713
+ path?: never;
17714
+ query?: {
17715
+ experimental?: boolean;
17716
+ allowMatureContent?: boolean;
17717
+ whatif?: boolean;
17718
+ ephemeral?: boolean;
17719
+ /**
17720
+ * How a workflow is paid for.
17721
+ */
17722
+ tier?: WorkflowTier;
17723
+ tags?: Array<string>;
17724
+ };
17725
+ url: '/v2/consumer/recipes/wasm';
17726
+ };
17727
+ export type InvokeWasmStepTemplateErrors = {
17728
+ /**
17729
+ * Bad Request
17730
+ */
17731
+ 400: ProblemDetails;
17732
+ /**
17733
+ * Unauthorized
17734
+ */
17735
+ 401: ProblemDetails;
17736
+ /**
17737
+ * Forbidden
17738
+ */
17739
+ 403: ProblemDetails;
17740
+ };
17741
+ export type InvokeWasmStepTemplateError =
17742
+ InvokeWasmStepTemplateErrors[keyof InvokeWasmStepTemplateErrors];
17743
+ export type InvokeWasmStepTemplateResponses = {
17744
+ /**
17745
+ * OK
17746
+ */
17747
+ 200: WasmOutput;
17748
+ };
17749
+ export type InvokeWasmStepTemplateResponse =
17750
+ InvokeWasmStepTemplateResponses[keyof InvokeWasmStepTemplateResponses];
17493
17751
  export type InvokeWdTaggingStepTemplateData = {
17494
17752
  body?: WdTaggingInput;
17495
17753
  path?: never;
@@ -345,7 +345,10 @@ export const Priority = {
345
345
  LOW: 'low',
346
346
  IDLE: 'idle',
347
347
  };
348
- export const ResourceFeeType = { PER_IMAGE_BUZZ: 'perImageBuzz' };
348
+ export const ResourceFeeType = {
349
+ PER_IMAGE_BUZZ: 'perImageBuzz',
350
+ PERCENT_OF_COMPUTE: 'percentOfCompute',
351
+ };
349
352
  /**
350
353
  * A projection of the resource collection. There is no view that lists every known resource — resources
351
354
  * are addressed by AIR and only materialise once something asks for them.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@civitai/orchestration-client",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Civitai's javascript client for generating ai content",
5
5
  "packageManager": "pnpm@10.34.4",
6
6
  "main": "dist/index.js",