@picsart/ai-sdk 6.11.0 → 6.11.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/index.d.ts +37 -30
- package/index.js +16 -3
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1888,6 +1888,33 @@ type ModelInput<M extends TypedModelId> = ModelInputById[M];
|
|
|
1888
1888
|
type TextModelId = "claude-fable-5" | "claude-fable-5-1" | "claude-haiku-4-5" | "claude-opus-4-8" | "claude-opus-5" | "claude-sonnet-4-5" | "claude-sonnet-4-6" | "claude-sonnet-5" | "gemini-2.5-flash" | "gemini-3-pro" | "gemini-3.5-flash-lite" | "gemini-3.6-flash" | "gemini-3.7-flash" | "gemini-3.8-flash" | "gpt-4.1-mini" | "gpt-4.1-nano" | "gpt-4o" | "gpt-4o-mini" | "gpt-5" | "gpt-5-mini" | "gpt-5.1" | "gpt-5.2" | "gpt-5.5" | "gpt-5.6-luna" | "gpt-5.6-sol" | "gpt-5.6-terra" | "gpt-6-astra";
|
|
1889
1889
|
type TextModelInputById = Pick<ModelInputById, TextModelId>;
|
|
1890
1890
|
|
|
1891
|
+
/**
|
|
1892
|
+
* Per-item vendor metadata promoted from the response. Every key is
|
|
1893
|
+
* best-effort: present when the vendor reports it, absent otherwise.
|
|
1894
|
+
*/
|
|
1895
|
+
interface GenerateResultItemMetadata {
|
|
1896
|
+
/** Explore image id (recraft explore models) — pass back as `sourceImageId`
|
|
1897
|
+
* to iterate on this image. */
|
|
1898
|
+
exploreImageId?: string;
|
|
1899
|
+
/** Voice preview id (ElevenLabs voice design/remix) — pass to the vendor's
|
|
1900
|
+
* create-voice-from-preview step to persist the voice. */
|
|
1901
|
+
generatedVoiceId?: string;
|
|
1902
|
+
/** URL of the generated video's last frame, when the model was asked for it
|
|
1903
|
+
* (`returnLastFrame`, seedance) — the seed for frame-chaining flows. */
|
|
1904
|
+
lastFrameUrl?: string;
|
|
1905
|
+
/** The draft a Seedance 2.5 Draft generation produced — pass it back
|
|
1906
|
+
* unchanged as `draftTask` to the matching `-draft-final` model to render
|
|
1907
|
+
* the final 1080p video (valid 7 days). Wire field names on purpose: the
|
|
1908
|
+
* worker signs it, so any change is rejected. */
|
|
1909
|
+
draftTask?: SeedanceDraftTask;
|
|
1910
|
+
}
|
|
1911
|
+
/** A Seedance 2.5 draft reference, as the worker issues it. */
|
|
1912
|
+
interface SeedanceDraftTask {
|
|
1913
|
+
id: string;
|
|
1914
|
+
video_input: boolean;
|
|
1915
|
+
signature: string;
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1891
1918
|
/**
|
|
1892
1919
|
* Drive client — manages folders and file saving in Picsart Drive.
|
|
1893
1920
|
*
|
|
@@ -1937,7 +1964,14 @@ interface DriveAttributes {
|
|
|
1937
1964
|
appId?: string;
|
|
1938
1965
|
appType?: AppType;
|
|
1939
1966
|
}
|
|
1940
|
-
|
|
1967
|
+
/** A saved Seedance 2.5 draft — pass `draftTask` unchanged as the final's
|
|
1968
|
+
* `draftTask` param until `draftExpiresAt`. */
|
|
1969
|
+
interface DriveDraftInfo {
|
|
1970
|
+
draftTask?: SeedanceDraftTask;
|
|
1971
|
+
/** ISO timestamp after which the vendor no longer renders a final from it. */
|
|
1972
|
+
draftExpiresAt?: string;
|
|
1973
|
+
}
|
|
1974
|
+
interface GenerationFile extends DriveDraftInfo {
|
|
1941
1975
|
appId?: string;
|
|
1942
1976
|
appType?: AppType;
|
|
1943
1977
|
model?: string;
|
|
@@ -1952,7 +1986,7 @@ interface DriveMediaItem {
|
|
|
1952
1986
|
previewUrl?: string;
|
|
1953
1987
|
timestamp: number;
|
|
1954
1988
|
}
|
|
1955
|
-
interface DriveFileDetails extends DriveMediaItem {
|
|
1989
|
+
interface DriveFileDetails extends DriveMediaItem, DriveDraftInfo {
|
|
1956
1990
|
createdAt?: string;
|
|
1957
1991
|
model?: string;
|
|
1958
1992
|
prompt?: string;
|
|
@@ -2709,33 +2743,6 @@ interface CatalogsOptions {
|
|
|
2709
2743
|
preload?: boolean;
|
|
2710
2744
|
}
|
|
2711
2745
|
|
|
2712
|
-
/**
|
|
2713
|
-
* Per-item vendor metadata promoted from the response. Every key is
|
|
2714
|
-
* best-effort: present when the vendor reports it, absent otherwise.
|
|
2715
|
-
*/
|
|
2716
|
-
interface GenerateResultItemMetadata {
|
|
2717
|
-
/** Explore image id (recraft explore models) — pass back as `sourceImageId`
|
|
2718
|
-
* to iterate on this image. */
|
|
2719
|
-
exploreImageId?: string;
|
|
2720
|
-
/** Voice preview id (ElevenLabs voice design/remix) — pass to the vendor's
|
|
2721
|
-
* create-voice-from-preview step to persist the voice. */
|
|
2722
|
-
generatedVoiceId?: string;
|
|
2723
|
-
/** URL of the generated video's last frame, when the model was asked for it
|
|
2724
|
-
* (`returnLastFrame`, seedance) — the seed for frame-chaining flows. */
|
|
2725
|
-
lastFrameUrl?: string;
|
|
2726
|
-
/** The draft a Seedance 2.5 Draft generation produced — pass it back
|
|
2727
|
-
* unchanged as `draftTask` to the matching `-draft-final` model to render
|
|
2728
|
-
* the final 1080p video (valid 7 days). Wire field names on purpose: the
|
|
2729
|
-
* worker signs it, so any change is rejected. */
|
|
2730
|
-
draftTask?: SeedanceDraftTask;
|
|
2731
|
-
}
|
|
2732
|
-
/** A Seedance 2.5 draft reference, as the worker issues it. */
|
|
2733
|
-
interface SeedanceDraftTask {
|
|
2734
|
-
id: string;
|
|
2735
|
-
video_input: boolean;
|
|
2736
|
-
signature: string;
|
|
2737
|
-
}
|
|
2738
|
-
|
|
2739
2746
|
/**
|
|
2740
2747
|
* Failure codes the SDK synthesizes when the platform supplies no `reason`.
|
|
2741
2748
|
* An API-supplied `reason` passes through unchanged, so the open `string`
|
|
@@ -3443,4 +3450,4 @@ declare const getModel: (id: string) => ModelDefinition | undefined;
|
|
|
3443
3450
|
*/
|
|
3444
3451
|
declare const findModel: (ref: string) => ModelDefinition | undefined;
|
|
3445
3452
|
|
|
3446
|
-
export { ALL_MODELS, type AiClient, ApiError, type ApiErrorCode, type ApiErrorInit, type ApiResponse, type ApiRunOptions, type ApiSchemas, type ApisClient, type AppIdentity, type AppType, type AuthenticatedFetch, type AvatarOption, type BooleanDescriptor, type BooleanEntry, type CatalogDescriptor, type CatalogEntry, type CatalogItem, type CatalogPage, type CatalogPageOptions, type CatalogPreview, type CatalogQuery, type CatalogResult, type CatalogSource, type CatalogsClient, type CatalogsOptions, type ClientConfig, type CreditRange, type CreditRangeContext, type CreditTier, type CreditUsage, DEFAULT_VISIBLE_RELEASES, type DeepLinkResult, type DriveAttributes, type DriveClient, type DriveConfig, type DriveFile, type DriveFileDetails, type DriveFolder, type DriveMediaItem, type DriveSaveResult, type EntryMeta, type EnumDescriptor, type EnumEntry, type EnumOption, type FileDescriptor, type FileEntry, type FlatParamEntry, type GenerateOptions, type GenerateResult, type GenerateResultItem, type GenerateResultItemMetadata, type GenerateTextResult, type GenerationContext, type GenerationEvent, GenerationEventType, type GenerationFile, type GenerationMode, type GenerationOptions, type GenerationProgress, type ListOptions, type MediaModelId, type MediaTypeFilter, Model, type ModelDefinition, type ModelDescriptor, type ModelFilter, type ModelInput, type ModelInputById, type ModelMeta, type ModelParams, type ModelParamsAccessor, Models, type ObjectDescriptor, type ObjectEntry, type ParamDescriptor, type ParamEntry, type ParamOption, type PayloadDriveFolderOptions, type PayloadDriveOptions, type PayloadInputsTransformationOptions, type PricingOptions, type ProviderInfo, type RangeDescriptor, type RangeEntry, type ReleaseTag, type SaveParams, type SdkPayload, type SdkTransport, type SeedanceDraftTask, type TextDescriptor, type TextEntry, type TextModelId, type TextModelInputById, type ToolUsage, type TransportPollOptions, type TransportResult, type TypedModelId, type UserReaction, type ValidationResult, type VoiceOption, type WorkflowJobHandle, type WorkflowSubmitRequest, buildFilename, buildGenerationAttributes, catalog, createClient, decodeDeepLinkPayload, encodeDeepLinkPayload, findModel, getModel, getModelsByMode, getVoiceById, inferResourceType, isVisibleForReleases, parseGeneration, releaseOf, toAvatarOption, toVoiceOption };
|
|
3453
|
+
export { ALL_MODELS, type AiClient, ApiError, type ApiErrorCode, type ApiErrorInit, type ApiResponse, type ApiRunOptions, type ApiSchemas, type ApisClient, type AppIdentity, type AppType, type AuthenticatedFetch, type AvatarOption, type BooleanDescriptor, type BooleanEntry, type CatalogDescriptor, type CatalogEntry, type CatalogItem, type CatalogPage, type CatalogPageOptions, type CatalogPreview, type CatalogQuery, type CatalogResult, type CatalogSource, type CatalogsClient, type CatalogsOptions, type ClientConfig, type CreditRange, type CreditRangeContext, type CreditTier, type CreditUsage, DEFAULT_VISIBLE_RELEASES, type DeepLinkResult, type DriveAttributes, type DriveClient, type DriveConfig, type DriveDraftInfo, type DriveFile, type DriveFileDetails, type DriveFolder, type DriveMediaItem, type DriveSaveResult, type EntryMeta, type EnumDescriptor, type EnumEntry, type EnumOption, type FileDescriptor, type FileEntry, type FlatParamEntry, type GenerateOptions, type GenerateResult, type GenerateResultItem, type GenerateResultItemMetadata, type GenerateTextResult, type GenerationContext, type GenerationEvent, GenerationEventType, type GenerationFile, type GenerationMode, type GenerationOptions, type GenerationProgress, type ListOptions, type MediaModelId, type MediaTypeFilter, Model, type ModelDefinition, type ModelDescriptor, type ModelFilter, type ModelInput, type ModelInputById, type ModelMeta, type ModelParams, type ModelParamsAccessor, Models, type ObjectDescriptor, type ObjectEntry, type ParamDescriptor, type ParamEntry, type ParamOption, type PayloadDriveFolderOptions, type PayloadDriveOptions, type PayloadInputsTransformationOptions, type PricingOptions, type ProviderInfo, type RangeDescriptor, type RangeEntry, type ReleaseTag, type SaveParams, type SdkPayload, type SdkTransport, type SeedanceDraftTask, type TextDescriptor, type TextEntry, type TextModelId, type TextModelInputById, type ToolUsage, type TransportPollOptions, type TransportResult, type TypedModelId, type UserReaction, type ValidationResult, type VoiceOption, type WorkflowJobHandle, type WorkflowSubmitRequest, buildFilename, buildGenerationAttributes, catalog, createClient, decodeDeepLinkPayload, encodeDeepLinkPayload, findModel, getModel, getModelsByMode, getVoiceById, inferResourceType, isVisibleForReleases, parseGeneration, releaseOf, toAvatarOption, toVoiceOption };
|
package/index.js
CHANGED
|
@@ -11588,6 +11588,8 @@ var MAX_DRIVE_PROMPT_LENGTH = 18e3;
|
|
|
11588
11588
|
|
|
11589
11589
|
// src/client/drive.ts
|
|
11590
11590
|
var USER_REACTION_ATTR = "userReaction";
|
|
11591
|
+
var DRAFT_TASK_ATTR = "draft_task";
|
|
11592
|
+
var DRAFT_EXPIRES_AT_ATTR = "draft_expires_at";
|
|
11591
11593
|
function inferResourceType(mode) {
|
|
11592
11594
|
if (mode === "video") return "VIDEO";
|
|
11593
11595
|
if (mode === "audio") return "AUDIO";
|
|
@@ -11634,6 +11636,14 @@ function parseAttributes(raw) {
|
|
|
11634
11636
|
}
|
|
11635
11637
|
return map;
|
|
11636
11638
|
}
|
|
11639
|
+
function parseDraftInfo(attrs) {
|
|
11640
|
+
const draftTask = parseJsonAttr(attrs[DRAFT_TASK_ATTR]);
|
|
11641
|
+
if (!isSeedanceDraftTask(draftTask)) return {};
|
|
11642
|
+
return {
|
|
11643
|
+
draftTask: { id: draftTask.id, video_input: draftTask.video_input, signature: draftTask.signature },
|
|
11644
|
+
...attrs[DRAFT_EXPIRES_AT_ATTR] ? { draftExpiresAt: attrs[DRAFT_EXPIRES_AT_ATTR] } : {}
|
|
11645
|
+
};
|
|
11646
|
+
}
|
|
11637
11647
|
function parseReaction(value) {
|
|
11638
11648
|
return value === "like" || value === "dislike" ? value : void 0;
|
|
11639
11649
|
}
|
|
@@ -11706,7 +11716,8 @@ function toDetailedItem(file) {
|
|
|
11706
11716
|
referenceAudioUrl: extras.referenceAudioUrl,
|
|
11707
11717
|
aspectRatio: extras.aspectRatio,
|
|
11708
11718
|
resolution: extras.resolution,
|
|
11709
|
-
quality: extras.quality
|
|
11719
|
+
quality: extras.quality,
|
|
11720
|
+
...parseDraftInfo(attrs)
|
|
11710
11721
|
};
|
|
11711
11722
|
}
|
|
11712
11723
|
var LEGACY_TOOL_APP = {
|
|
@@ -11751,7 +11762,8 @@ function adaptLegacyGeneration(attrs) {
|
|
|
11751
11762
|
appType: app?.appType,
|
|
11752
11763
|
model: attrs.model || void 0,
|
|
11753
11764
|
aiSDKPayload,
|
|
11754
|
-
userReaction: parseReaction(attrs[USER_REACTION_ATTR])
|
|
11765
|
+
userReaction: parseReaction(attrs[USER_REACTION_ATTR]),
|
|
11766
|
+
...parseDraftInfo(attrs)
|
|
11755
11767
|
};
|
|
11756
11768
|
}
|
|
11757
11769
|
function parseGeneration(file) {
|
|
@@ -11764,7 +11776,8 @@ function parseGeneration(file) {
|
|
|
11764
11776
|
appType: attrs.appType === "native" || attrs.appType === "miniapp" ? attrs.appType : void 0,
|
|
11765
11777
|
model: attrs.model || void 0,
|
|
11766
11778
|
aiSDKPayload: parseJsonAttr(attrs.aiSDKPayload),
|
|
11767
|
-
userReaction: parseReaction(attrs[USER_REACTION_ATTR])
|
|
11779
|
+
userReaction: parseReaction(attrs[USER_REACTION_ATTR]),
|
|
11780
|
+
...parseDraftInfo(attrs)
|
|
11768
11781
|
};
|
|
11769
11782
|
}
|
|
11770
11783
|
function createDriveClient(f, apiUrl, rootFolderName) {
|