@howells/motif-sdk 5.3.0 → 6.0.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/README.md +9 -15
- package/dist/image.js +45 -87
- package/dist/index.cjs +506 -1224
- package/dist/index.d.cts +56 -34
- package/dist/index.d.ts +56 -34
- package/dist/index.js +507 -1224
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -150,7 +150,7 @@ export declare const CREATIVE_TAXONOMY: {
|
|
|
150
150
|
readonly experimental: true;
|
|
151
151
|
readonly id: "illustration";
|
|
152
152
|
readonly label: "Editorial illustration";
|
|
153
|
-
readonly model: "
|
|
153
|
+
readonly model: "flare";
|
|
154
154
|
}];
|
|
155
155
|
readonly mood: readonly [{
|
|
156
156
|
readonly clause: "soft natural daylight from a window out of frame, gentle falloff into the corners, low contrast, even diffused light with soft, held highlights";
|
|
@@ -246,7 +246,8 @@ export declare function enrichPrompt(options: EnrichPromptOptions): CreativeProm
|
|
|
246
246
|
/** ─── Model Types ─────────────────────────────────────────────── */
|
|
247
247
|
type AspectRatio = "auto" | "8:1" | "4:1" | "21:9" | "16:9" | "3:2" | "4:3" | "5:4" | "1:1" | "4:5" | "3:4" | "2:3" | "9:16" | "1:4" | "1:8";
|
|
248
248
|
type Resolution = "0.5K" | "1K" | "2K" | "4K";
|
|
249
|
-
|
|
249
|
+
/** `gif` is an animation and `svg` a vector image, on the Models that make them. */
|
|
250
|
+
type ImageOutputFormat = "jpeg" | "png" | "webp" | "gif" | "svg";
|
|
250
251
|
interface CustomImageSize {
|
|
251
252
|
height: number;
|
|
252
253
|
width: number;
|
|
@@ -325,25 +326,31 @@ export declare const ACCOUNT_LOCKED = "ACCOUNT_LOCKED";
|
|
|
325
326
|
*/
|
|
326
327
|
export declare function isFalAccountLocked(status: number, body: string): boolean;
|
|
327
328
|
//#endregion
|
|
328
|
-
//#region src/
|
|
329
|
+
//#region src/image-benchmarks.d.ts
|
|
329
330
|
/**
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
* Rankings are data so a default change is visible in a pull request. A Task
|
|
334
|
-
* ranked from the bench's human comparisons says `rankedFrom: "bench"`; every
|
|
335
|
-
* other Task is hand-ranked from published quality numbers and fal price, and
|
|
336
|
-
* says so. Today no Task is bench-ranked: the bench holds two human ratings,
|
|
337
|
-
* both on one model, which is not an order.
|
|
338
|
-
*
|
|
339
|
-
* Model ids are the short aliases `-m` and `TaskInput.model` accept. `resolveTask` in `./resolve` is the only place a Model is
|
|
340
|
-
* chosen from these lists.
|
|
341
|
-
*
|
|
342
|
-
* A Task can have modes: a variant of the job a caller names explicitly, such
|
|
343
|
-
* as erasing text rather than an object. A ranked entry with a `mode` is only
|
|
344
|
-
* chosen when the request names that mode; an entry without one only when it
|
|
345
|
-
* names none. A Model can appear once per mode.
|
|
331
|
+
* Arena image scores captured for MOT-72 on October 29, 2026. Flare and
|
|
332
|
+
* Sunburst route to GPT Image 2.6 but keep 2.5's scores until 2.6 is
|
|
333
|
+
* benchmarked; `evaluatedModel` names what was measured.
|
|
346
334
|
*/
|
|
335
|
+
type ImageBenchmarkTask = "text-to-image" | "image-edit-single-image";
|
|
336
|
+
interface ArenaScore {
|
|
337
|
+
readonly elo: number;
|
|
338
|
+
readonly rank: number;
|
|
339
|
+
/** The reported plus-or-minus interval, in Elo points. */
|
|
340
|
+
readonly uncertainty: number;
|
|
341
|
+
/** Exact leaderboard label, including a setting where one was reported. */
|
|
342
|
+
readonly evaluatedModel: string;
|
|
343
|
+
readonly preliminary?: true;
|
|
344
|
+
readonly votes?: number;
|
|
345
|
+
}
|
|
346
|
+
/** Scores are comparable only on the same board and snapshot. */
|
|
347
|
+
interface ImageModelBenchmark extends ArenaScore {
|
|
348
|
+
readonly source: string;
|
|
349
|
+
readonly snapshotDate: string;
|
|
350
|
+
readonly task: ImageBenchmarkTask;
|
|
351
|
+
}
|
|
352
|
+
//#endregion
|
|
353
|
+
//#region src/tasks.d.ts
|
|
347
354
|
export declare const TIERS: readonly ["fast", "balanced", "quality"];
|
|
348
355
|
/** How far a Task trades cost and speed for quality. */
|
|
349
356
|
type Tier = (typeof TIERS)[number];
|
|
@@ -351,12 +358,14 @@ export declare const DEFAULT_TIER: Tier;
|
|
|
351
358
|
/** Where a Task's order came from. */
|
|
352
359
|
type RankedFrom = "bench" | "hand";
|
|
353
360
|
/** Something a request needs that not every Model can honour. */
|
|
354
|
-
type Capability = "aspect" | "count" | "image" | "mask" | "negativePrompt" | "outputFormat" | "references" | "resolution" | "rig" | "seed" | "transparency" | "video";
|
|
361
|
+
type Capability = "aspect" | "count" | "image" | "markup" | "mask" | "negativePrompt" | "outputFormat" | "references" | "resolution" | "rig" | "seed" | "transparency" | "video";
|
|
355
362
|
interface RankedModel {
|
|
356
363
|
/** A Model id, as accepted by `-m` or `TaskInput.model`. */
|
|
357
364
|
readonly model: string;
|
|
358
365
|
/** The Tier this Model is offered at. */
|
|
359
366
|
readonly tier: Tier;
|
|
367
|
+
/** Published evidence for this Task; null means this route is unscored. */
|
|
368
|
+
readonly benchmark?: ImageModelBenchmark | null;
|
|
360
369
|
/** The mode this entry serves. Absent for the Task's plain job. */
|
|
361
370
|
readonly mode?: string;
|
|
362
371
|
/** Capabilities this Model has for this Task beyond its registry profile. */
|
|
@@ -964,6 +973,8 @@ interface TaskRequest {
|
|
|
964
973
|
readonly references?: number;
|
|
965
974
|
/** A mask image is passed in. */
|
|
966
975
|
readonly mask?: boolean;
|
|
976
|
+
/** A markup image is passed in. */
|
|
977
|
+
readonly markup?: boolean;
|
|
967
978
|
/** An aspect ratio is asked for, e.g. `"3:2"`. */
|
|
968
979
|
readonly aspect?: string;
|
|
969
980
|
/** A resolution tier is asked for, e.g. `"1K"`. */
|
|
@@ -972,7 +983,8 @@ interface TaskRequest {
|
|
|
972
983
|
readonly count?: number;
|
|
973
984
|
readonly seed?: boolean;
|
|
974
985
|
readonly negativePrompt?: boolean;
|
|
975
|
-
|
|
986
|
+
/** An output format is asked for, e.g. `"gif"`. */
|
|
987
|
+
readonly outputFormat?: string;
|
|
976
988
|
/** A rigged mesh wanted. */
|
|
977
989
|
readonly rig?: boolean;
|
|
978
990
|
/** The kind of Source passed in. Absent for a text-only request. */
|
|
@@ -1018,8 +1030,6 @@ interface TaskUnresolved {
|
|
|
1018
1030
|
type TaskResolution = TaskResolved | TaskUnresolved;
|
|
1019
1031
|
interface ModelProfile {
|
|
1020
1032
|
readonly capabilities: ReadonlySet<Capability>;
|
|
1021
|
-
/** Capabilities reachable only when this key variable is set. */
|
|
1022
|
-
readonly keyedCapabilities: ReadonlyMap<Capability, string>;
|
|
1023
1033
|
/** Key variables the Model needs for any request. */
|
|
1024
1034
|
readonly keys: readonly string[];
|
|
1025
1035
|
readonly maxReferences: number;
|
|
@@ -1027,6 +1037,12 @@ interface ModelProfile {
|
|
|
1027
1037
|
readonly aspects?: readonly string[];
|
|
1028
1038
|
/** Resolutions the Model accepts. Absent means any. */
|
|
1029
1039
|
readonly resolutions?: readonly string[];
|
|
1040
|
+
/** Output formats the Model returns, for a text request and an edit.
|
|
1041
|
+
* Absent means any. */
|
|
1042
|
+
readonly outputFormats?: {
|
|
1043
|
+
readonly edit: readonly string[];
|
|
1044
|
+
readonly text: readonly string[];
|
|
1045
|
+
};
|
|
1030
1046
|
}
|
|
1031
1047
|
/** The profile for a Model id, or undefined when no registry knows it. */
|
|
1032
1048
|
export declare function modelProfile(model: string): ModelProfile | undefined;
|
|
@@ -1122,8 +1138,6 @@ export declare function sumCosts(costs: readonly (number | null)[]): {
|
|
|
1122
1138
|
interface MotifClientConfig {
|
|
1123
1139
|
/** Falls back to FAL_KEY. */
|
|
1124
1140
|
falKey?: string;
|
|
1125
|
-
/** Falls back to OPENAI_API_KEY. Used only by Models routed through OpenAI. */
|
|
1126
|
-
openAiKey?: string;
|
|
1127
1141
|
/** Models pinned per Task, as `resolveTask` takes them. */
|
|
1128
1142
|
pins?: TaskEnvironment["pins"];
|
|
1129
1143
|
/** The one network seam. Defaults to global fetch. Retries and timeouts still apply. */
|
|
@@ -1170,6 +1184,12 @@ interface TaskInput {
|
|
|
1170
1184
|
prompt?: string;
|
|
1171
1185
|
/** Mask image: https URL or data URL. */
|
|
1172
1186
|
mask?: string;
|
|
1187
|
+
/**
|
|
1188
|
+
* Markup image: https URL or data URL. A transparent PNG of annotations
|
|
1189
|
+
* (circles, arrows, notes) the size of the image being edited, guiding its
|
|
1190
|
+
* edit. generate with references and vary take it; it can't join a mask.
|
|
1191
|
+
*/
|
|
1192
|
+
markup?: string;
|
|
1173
1193
|
/** Reference images: https URLs or data URLs. restyle and try-on take exactly one. */
|
|
1174
1194
|
references?: readonly string[];
|
|
1175
1195
|
aspect?: AspectRatio;
|
|
@@ -1198,10 +1218,15 @@ interface TaskInput {
|
|
|
1198
1218
|
ephemeral?: boolean;
|
|
1199
1219
|
/**
|
|
1200
1220
|
* Called on each poll of fal's queue with its status ("queued",
|
|
1201
|
-
* "processing", "completed", "failed") and, while queued, the place in line.
|
|
1202
|
-
*
|
|
1221
|
+
* "processing", "completed", "failed") and, while queued, the place in line. When fal has
|
|
1222
|
+
* written new log lines since the last poll, they come as the third argument
|
|
1223
|
+
* (new lines only). Passing it runs a fal generation through the queue, since
|
|
1224
|
+
* only the queue reports.
|
|
1203
1225
|
*/
|
|
1204
|
-
onProgress?: (status: JobStatus["status"], queuePosition?: number
|
|
1226
|
+
onProgress?: (status: JobStatus["status"], queuePosition?: number, logs?: readonly {
|
|
1227
|
+
message: string;
|
|
1228
|
+
timestamp: string;
|
|
1229
|
+
}[]) => void;
|
|
1205
1230
|
/**
|
|
1206
1231
|
* Called once, as soon as fal's queue accepts the run, with its request id
|
|
1207
1232
|
* and before any wait. Keep it to `resume` the same job after a restart
|
|
@@ -1230,8 +1255,8 @@ interface TaskPlan {
|
|
|
1230
1255
|
queued: boolean;
|
|
1231
1256
|
/** Projected: before the call. */
|
|
1232
1257
|
cost: ResolvedCost;
|
|
1233
|
-
/** The provider carrying the request.
|
|
1234
|
-
provider: "fal"
|
|
1258
|
+
/** The provider carrying the request. */
|
|
1259
|
+
provider: "fal";
|
|
1235
1260
|
}
|
|
1236
1261
|
interface TaskOutput extends Omit<TaskPlan, "body" | "cost" | "queued"> {
|
|
1237
1262
|
files: TaskFile[];
|
|
@@ -1282,7 +1307,7 @@ interface MotifClient {
|
|
|
1282
1307
|
*/
|
|
1283
1308
|
resume: (task: TaskId, input: TaskInput, requestId: string) => Promise<Result$1<TaskOutput, MotifError>>;
|
|
1284
1309
|
}
|
|
1285
|
-
/** Create the Task client.
|
|
1310
|
+
/** Create the Task client. The key falls back to FAL_KEY. */
|
|
1286
1311
|
export declare function createMotif(config?: MotifClientConfig): MotifClient;
|
|
1287
1312
|
//#endregion
|
|
1288
1313
|
//#region src/task-plan-shared.d.ts
|
|
@@ -1328,13 +1353,10 @@ export declare function promptWarnings(prompt: string, context?: {
|
|
|
1328
1353
|
export declare const motifEnvSchema: import("@howells/envy").EnvSchema<{
|
|
1329
1354
|
readonly optional: {
|
|
1330
1355
|
FAL_KEY: z.ZodString;
|
|
1331
|
-
OPENAI_API_KEY: z.ZodString;
|
|
1332
1356
|
};
|
|
1333
1357
|
}>;
|
|
1334
1358
|
type MotifEnv = ReturnType<typeof motifEnvSchema.parse>;
|
|
1335
1359
|
export declare function parseMotifEnv(input?: Record<string, unknown>): MotifEnv;
|
|
1336
1360
|
export declare function getFalKeyFromEnv(input?: Record<string, unknown>): string | undefined;
|
|
1337
|
-
/** The OpenAI key, used by direct OpenAI routes such as gpt2 transparency. */
|
|
1338
|
-
export declare function getOpenAiKeyFromEnv(input?: Record<string, unknown>): string | undefined;
|
|
1339
1361
|
//#endregion
|
|
1340
1362
|
export { type AspectRatio, type Blocker, type Capability, type ChosenBy, type CreativeDirection, type CreativeField, type CreativeOption, type CreativeOptionErrorDetails, type CreativePromptResult, type CustomImageSize, type EnrichPromptOptions, type FalFetch, type ImageSizeBounds, type LookId, type LookOption, type ModelProfile, type MoodId, type MotifClient, type MotifClientConfig, type MotifEnv, type OutputDimensions, type PlanOptions, type PromptWarning, type PromptWarningRule, type RankedFrom, type RankedModel, type Resolution, type ResolvedCost, type Result, type ResultAsync, type TaskDefinition, type TaskEnvironment, type TaskFile, type TaskFunction, type TaskId, type TaskInput, type TaskMode, type TaskOutput, type TaskPlan, type TaskRequest, type TaskResolution, type TaskResolved, type TaskStream, type TaskStreamEvent, type TaskStreamOptions, type TaskUnresolved, type Tier, type Unblocker, err, ok };
|
package/dist/index.d.ts
CHANGED
|
@@ -150,7 +150,7 @@ export declare const CREATIVE_TAXONOMY: {
|
|
|
150
150
|
readonly experimental: true;
|
|
151
151
|
readonly id: "illustration";
|
|
152
152
|
readonly label: "Editorial illustration";
|
|
153
|
-
readonly model: "
|
|
153
|
+
readonly model: "flare";
|
|
154
154
|
}];
|
|
155
155
|
readonly mood: readonly [{
|
|
156
156
|
readonly clause: "soft natural daylight from a window out of frame, gentle falloff into the corners, low contrast, even diffused light with soft, held highlights";
|
|
@@ -246,7 +246,8 @@ export declare function enrichPrompt(options: EnrichPromptOptions): CreativeProm
|
|
|
246
246
|
/** ─── Model Types ─────────────────────────────────────────────── */
|
|
247
247
|
type AspectRatio = "auto" | "8:1" | "4:1" | "21:9" | "16:9" | "3:2" | "4:3" | "5:4" | "1:1" | "4:5" | "3:4" | "2:3" | "9:16" | "1:4" | "1:8";
|
|
248
248
|
type Resolution = "0.5K" | "1K" | "2K" | "4K";
|
|
249
|
-
|
|
249
|
+
/** `gif` is an animation and `svg` a vector image, on the Models that make them. */
|
|
250
|
+
type ImageOutputFormat = "jpeg" | "png" | "webp" | "gif" | "svg";
|
|
250
251
|
interface CustomImageSize {
|
|
251
252
|
height: number;
|
|
252
253
|
width: number;
|
|
@@ -325,25 +326,31 @@ export declare const ACCOUNT_LOCKED = "ACCOUNT_LOCKED";
|
|
|
325
326
|
*/
|
|
326
327
|
export declare function isFalAccountLocked(status: number, body: string): boolean;
|
|
327
328
|
//#endregion
|
|
328
|
-
//#region src/
|
|
329
|
+
//#region src/image-benchmarks.d.ts
|
|
329
330
|
/**
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
* Rankings are data so a default change is visible in a pull request. A Task
|
|
334
|
-
* ranked from the bench's human comparisons says `rankedFrom: "bench"`; every
|
|
335
|
-
* other Task is hand-ranked from published quality numbers and fal price, and
|
|
336
|
-
* says so. Today no Task is bench-ranked: the bench holds two human ratings,
|
|
337
|
-
* both on one model, which is not an order.
|
|
338
|
-
*
|
|
339
|
-
* Model ids are the short aliases `-m` and `TaskInput.model` accept. `resolveTask` in `./resolve` is the only place a Model is
|
|
340
|
-
* chosen from these lists.
|
|
341
|
-
*
|
|
342
|
-
* A Task can have modes: a variant of the job a caller names explicitly, such
|
|
343
|
-
* as erasing text rather than an object. A ranked entry with a `mode` is only
|
|
344
|
-
* chosen when the request names that mode; an entry without one only when it
|
|
345
|
-
* names none. A Model can appear once per mode.
|
|
331
|
+
* Arena image scores captured for MOT-72 on October 29, 2026. Flare and
|
|
332
|
+
* Sunburst route to GPT Image 2.6 but keep 2.5's scores until 2.6 is
|
|
333
|
+
* benchmarked; `evaluatedModel` names what was measured.
|
|
346
334
|
*/
|
|
335
|
+
type ImageBenchmarkTask = "text-to-image" | "image-edit-single-image";
|
|
336
|
+
interface ArenaScore {
|
|
337
|
+
readonly elo: number;
|
|
338
|
+
readonly rank: number;
|
|
339
|
+
/** The reported plus-or-minus interval, in Elo points. */
|
|
340
|
+
readonly uncertainty: number;
|
|
341
|
+
/** Exact leaderboard label, including a setting where one was reported. */
|
|
342
|
+
readonly evaluatedModel: string;
|
|
343
|
+
readonly preliminary?: true;
|
|
344
|
+
readonly votes?: number;
|
|
345
|
+
}
|
|
346
|
+
/** Scores are comparable only on the same board and snapshot. */
|
|
347
|
+
interface ImageModelBenchmark extends ArenaScore {
|
|
348
|
+
readonly source: string;
|
|
349
|
+
readonly snapshotDate: string;
|
|
350
|
+
readonly task: ImageBenchmarkTask;
|
|
351
|
+
}
|
|
352
|
+
//#endregion
|
|
353
|
+
//#region src/tasks.d.ts
|
|
347
354
|
export declare const TIERS: readonly ["fast", "balanced", "quality"];
|
|
348
355
|
/** How far a Task trades cost and speed for quality. */
|
|
349
356
|
type Tier = (typeof TIERS)[number];
|
|
@@ -351,12 +358,14 @@ export declare const DEFAULT_TIER: Tier;
|
|
|
351
358
|
/** Where a Task's order came from. */
|
|
352
359
|
type RankedFrom = "bench" | "hand";
|
|
353
360
|
/** Something a request needs that not every Model can honour. */
|
|
354
|
-
type Capability = "aspect" | "count" | "image" | "mask" | "negativePrompt" | "outputFormat" | "references" | "resolution" | "rig" | "seed" | "transparency" | "video";
|
|
361
|
+
type Capability = "aspect" | "count" | "image" | "markup" | "mask" | "negativePrompt" | "outputFormat" | "references" | "resolution" | "rig" | "seed" | "transparency" | "video";
|
|
355
362
|
interface RankedModel {
|
|
356
363
|
/** A Model id, as accepted by `-m` or `TaskInput.model`. */
|
|
357
364
|
readonly model: string;
|
|
358
365
|
/** The Tier this Model is offered at. */
|
|
359
366
|
readonly tier: Tier;
|
|
367
|
+
/** Published evidence for this Task; null means this route is unscored. */
|
|
368
|
+
readonly benchmark?: ImageModelBenchmark | null;
|
|
360
369
|
/** The mode this entry serves. Absent for the Task's plain job. */
|
|
361
370
|
readonly mode?: string;
|
|
362
371
|
/** Capabilities this Model has for this Task beyond its registry profile. */
|
|
@@ -964,6 +973,8 @@ interface TaskRequest {
|
|
|
964
973
|
readonly references?: number;
|
|
965
974
|
/** A mask image is passed in. */
|
|
966
975
|
readonly mask?: boolean;
|
|
976
|
+
/** A markup image is passed in. */
|
|
977
|
+
readonly markup?: boolean;
|
|
967
978
|
/** An aspect ratio is asked for, e.g. `"3:2"`. */
|
|
968
979
|
readonly aspect?: string;
|
|
969
980
|
/** A resolution tier is asked for, e.g. `"1K"`. */
|
|
@@ -972,7 +983,8 @@ interface TaskRequest {
|
|
|
972
983
|
readonly count?: number;
|
|
973
984
|
readonly seed?: boolean;
|
|
974
985
|
readonly negativePrompt?: boolean;
|
|
975
|
-
|
|
986
|
+
/** An output format is asked for, e.g. `"gif"`. */
|
|
987
|
+
readonly outputFormat?: string;
|
|
976
988
|
/** A rigged mesh wanted. */
|
|
977
989
|
readonly rig?: boolean;
|
|
978
990
|
/** The kind of Source passed in. Absent for a text-only request. */
|
|
@@ -1018,8 +1030,6 @@ interface TaskUnresolved {
|
|
|
1018
1030
|
type TaskResolution = TaskResolved | TaskUnresolved;
|
|
1019
1031
|
interface ModelProfile {
|
|
1020
1032
|
readonly capabilities: ReadonlySet<Capability>;
|
|
1021
|
-
/** Capabilities reachable only when this key variable is set. */
|
|
1022
|
-
readonly keyedCapabilities: ReadonlyMap<Capability, string>;
|
|
1023
1033
|
/** Key variables the Model needs for any request. */
|
|
1024
1034
|
readonly keys: readonly string[];
|
|
1025
1035
|
readonly maxReferences: number;
|
|
@@ -1027,6 +1037,12 @@ interface ModelProfile {
|
|
|
1027
1037
|
readonly aspects?: readonly string[];
|
|
1028
1038
|
/** Resolutions the Model accepts. Absent means any. */
|
|
1029
1039
|
readonly resolutions?: readonly string[];
|
|
1040
|
+
/** Output formats the Model returns, for a text request and an edit.
|
|
1041
|
+
* Absent means any. */
|
|
1042
|
+
readonly outputFormats?: {
|
|
1043
|
+
readonly edit: readonly string[];
|
|
1044
|
+
readonly text: readonly string[];
|
|
1045
|
+
};
|
|
1030
1046
|
}
|
|
1031
1047
|
/** The profile for a Model id, or undefined when no registry knows it. */
|
|
1032
1048
|
export declare function modelProfile(model: string): ModelProfile | undefined;
|
|
@@ -1122,8 +1138,6 @@ export declare function sumCosts(costs: readonly (number | null)[]): {
|
|
|
1122
1138
|
interface MotifClientConfig {
|
|
1123
1139
|
/** Falls back to FAL_KEY. */
|
|
1124
1140
|
falKey?: string;
|
|
1125
|
-
/** Falls back to OPENAI_API_KEY. Used only by Models routed through OpenAI. */
|
|
1126
|
-
openAiKey?: string;
|
|
1127
1141
|
/** Models pinned per Task, as `resolveTask` takes them. */
|
|
1128
1142
|
pins?: TaskEnvironment["pins"];
|
|
1129
1143
|
/** The one network seam. Defaults to global fetch. Retries and timeouts still apply. */
|
|
@@ -1170,6 +1184,12 @@ interface TaskInput {
|
|
|
1170
1184
|
prompt?: string;
|
|
1171
1185
|
/** Mask image: https URL or data URL. */
|
|
1172
1186
|
mask?: string;
|
|
1187
|
+
/**
|
|
1188
|
+
* Markup image: https URL or data URL. A transparent PNG of annotations
|
|
1189
|
+
* (circles, arrows, notes) the size of the image being edited, guiding its
|
|
1190
|
+
* edit. generate with references and vary take it; it can't join a mask.
|
|
1191
|
+
*/
|
|
1192
|
+
markup?: string;
|
|
1173
1193
|
/** Reference images: https URLs or data URLs. restyle and try-on take exactly one. */
|
|
1174
1194
|
references?: readonly string[];
|
|
1175
1195
|
aspect?: AspectRatio;
|
|
@@ -1198,10 +1218,15 @@ interface TaskInput {
|
|
|
1198
1218
|
ephemeral?: boolean;
|
|
1199
1219
|
/**
|
|
1200
1220
|
* Called on each poll of fal's queue with its status ("queued",
|
|
1201
|
-
* "processing", "completed", "failed") and, while queued, the place in line.
|
|
1202
|
-
*
|
|
1221
|
+
* "processing", "completed", "failed") and, while queued, the place in line. When fal has
|
|
1222
|
+
* written new log lines since the last poll, they come as the third argument
|
|
1223
|
+
* (new lines only). Passing it runs a fal generation through the queue, since
|
|
1224
|
+
* only the queue reports.
|
|
1203
1225
|
*/
|
|
1204
|
-
onProgress?: (status: JobStatus["status"], queuePosition?: number
|
|
1226
|
+
onProgress?: (status: JobStatus["status"], queuePosition?: number, logs?: readonly {
|
|
1227
|
+
message: string;
|
|
1228
|
+
timestamp: string;
|
|
1229
|
+
}[]) => void;
|
|
1205
1230
|
/**
|
|
1206
1231
|
* Called once, as soon as fal's queue accepts the run, with its request id
|
|
1207
1232
|
* and before any wait. Keep it to `resume` the same job after a restart
|
|
@@ -1230,8 +1255,8 @@ interface TaskPlan {
|
|
|
1230
1255
|
queued: boolean;
|
|
1231
1256
|
/** Projected: before the call. */
|
|
1232
1257
|
cost: ResolvedCost;
|
|
1233
|
-
/** The provider carrying the request.
|
|
1234
|
-
provider: "fal"
|
|
1258
|
+
/** The provider carrying the request. */
|
|
1259
|
+
provider: "fal";
|
|
1235
1260
|
}
|
|
1236
1261
|
interface TaskOutput extends Omit<TaskPlan, "body" | "cost" | "queued"> {
|
|
1237
1262
|
files: TaskFile[];
|
|
@@ -1282,7 +1307,7 @@ interface MotifClient {
|
|
|
1282
1307
|
*/
|
|
1283
1308
|
resume: (task: TaskId, input: TaskInput, requestId: string) => Promise<Result$1<TaskOutput, MotifError>>;
|
|
1284
1309
|
}
|
|
1285
|
-
/** Create the Task client.
|
|
1310
|
+
/** Create the Task client. The key falls back to FAL_KEY. */
|
|
1286
1311
|
export declare function createMotif(config?: MotifClientConfig): MotifClient;
|
|
1287
1312
|
//#endregion
|
|
1288
1313
|
//#region src/task-plan-shared.d.ts
|
|
@@ -1328,13 +1353,10 @@ export declare function promptWarnings(prompt: string, context?: {
|
|
|
1328
1353
|
export declare const motifEnvSchema: import("@howells/envy").EnvSchema<{
|
|
1329
1354
|
readonly optional: {
|
|
1330
1355
|
FAL_KEY: z.ZodString;
|
|
1331
|
-
OPENAI_API_KEY: z.ZodString;
|
|
1332
1356
|
};
|
|
1333
1357
|
}>;
|
|
1334
1358
|
type MotifEnv = ReturnType<typeof motifEnvSchema.parse>;
|
|
1335
1359
|
export declare function parseMotifEnv(input?: Record<string, unknown>): MotifEnv;
|
|
1336
1360
|
export declare function getFalKeyFromEnv(input?: Record<string, unknown>): string | undefined;
|
|
1337
|
-
/** The OpenAI key, used by direct OpenAI routes such as gpt2 transparency. */
|
|
1338
|
-
export declare function getOpenAiKeyFromEnv(input?: Record<string, unknown>): string | undefined;
|
|
1339
1361
|
//#endregion
|
|
1340
1362
|
export { type AspectRatio, type Blocker, type Capability, type ChosenBy, type CreativeDirection, type CreativeField, type CreativeOption, type CreativeOptionErrorDetails, type CreativePromptResult, type CustomImageSize, type EnrichPromptOptions, type FalFetch, type ImageSizeBounds, type LookId, type LookOption, type ModelProfile, type MoodId, type MotifClient, type MotifClientConfig, type MotifEnv, type OutputDimensions, type PlanOptions, type PromptWarning, type PromptWarningRule, type RankedFrom, type RankedModel, type Resolution, type ResolvedCost, type Result, type ResultAsync, type TaskDefinition, type TaskEnvironment, type TaskFile, type TaskFunction, type TaskId, type TaskInput, type TaskMode, type TaskOutput, type TaskPlan, type TaskRequest, type TaskResolution, type TaskResolved, type TaskStream, type TaskStreamEvent, type TaskStreamOptions, type TaskUnresolved, type Tier, type Unblocker, err, ok };
|