@teamflojo/floimg-stability 0.1.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.
@@ -0,0 +1,77 @@
1
+ import type { ImageGenerator, GeneratorSchema } from "@teamflojo/floimg";
2
+ /**
3
+ * Supported SDXL resolutions (width x height)
4
+ */
5
+ declare const SDXL_RESOLUTIONS: readonly ["1024x1024", "1152x896", "896x1152", "1216x832", "832x1216", "1344x768", "768x1344", "1536x640", "640x1536"];
6
+ /**
7
+ * Available style presets
8
+ */
9
+ declare const STYLE_PRESETS: readonly ["3d-model", "analog-film", "anime", "cinematic", "comic-book", "digital-art", "enhance", "fantasy-art", "isometric", "line-art", "low-poly", "modeling-compound", "neon-punk", "origami", "photographic", "pixel-art", "tile-texture"];
10
+ /**
11
+ * Schema for the Stability AI generator
12
+ */
13
+ export declare const stabilitySchema: GeneratorSchema;
14
+ /**
15
+ * Configuration for the Stability AI generator
16
+ */
17
+ export interface StabilityConfig {
18
+ /** API key for Stability AI */
19
+ apiKey?: string;
20
+ /** Default model to use */
21
+ model?: "sdxl-1.0" | "sd3" | "sd3-turbo";
22
+ /** Default style preset */
23
+ stylePreset?: (typeof STYLE_PRESETS)[number];
24
+ /** Default CFG scale */
25
+ cfgScale?: number;
26
+ /** Default number of steps */
27
+ steps?: number;
28
+ }
29
+ /**
30
+ * Parameters for image generation
31
+ */
32
+ export interface StabilityParams extends Record<string, unknown> {
33
+ /** Text prompt describing the desired image */
34
+ prompt?: string;
35
+ /** Text describing what to avoid in the image */
36
+ negativePrompt?: string;
37
+ /** Model to use */
38
+ model?: "sdxl-1.0" | "sd3" | "sd3-turbo";
39
+ /** Image dimensions (e.g., "1024x1024") */
40
+ size?: (typeof SDXL_RESOLUTIONS)[number];
41
+ /** Visual style preset */
42
+ stylePreset?: (typeof STYLE_PRESETS)[number];
43
+ /** Guidance scale (how closely to follow prompt) */
44
+ cfgScale?: number;
45
+ /** Number of diffusion steps */
46
+ steps?: number;
47
+ /** Random seed for reproducibility */
48
+ seed?: number;
49
+ }
50
+ /**
51
+ * Create a Stability AI image generator instance
52
+ *
53
+ * Generates images using Stability AI's Stable Diffusion models (SDXL, SD3).
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * import createClient from '@teamflojo/floimg';
58
+ * import stability from '@teamflojo/floimg-stability';
59
+ *
60
+ * const floimg = createClient();
61
+ * floimg.registerGenerator(stability({ apiKey: process.env.STABILITY_API_KEY }));
62
+ *
63
+ * const image = await floimg.generate({
64
+ * generator: 'stability',
65
+ * params: {
66
+ * prompt: 'A serene mountain landscape at sunset',
67
+ * model: 'sdxl-1.0',
68
+ * stylePreset: 'photographic',
69
+ * size: '1024x1024',
70
+ * }
71
+ * });
72
+ * ```
73
+ */
74
+ export default function stability(config?: StabilityConfig): ImageGenerator;
75
+ export { stability };
76
+ export { stabilityTransform, removeBackgroundSchema, upscaleSchema, searchAndReplaceSchema, outpaintSchema, type StabilityTransformConfig, } from "./transforms.js";
77
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAa,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAqBpF;;GAEG;AACH,QAAA,MAAM,gBAAgB,wHAUZ,CAAC;AAEX;;GAEG;AACH,QAAA,MAAM,aAAa,kPAkBT,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,eA8D7B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,+BAA+B;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,UAAU,GAAG,KAAK,GAAG,WAAW,CAAC;IACzC,2BAA2B;IAC3B,WAAW,CAAC,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;IAC7C,wBAAwB;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC9D,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB;IACnB,KAAK,CAAC,EAAE,UAAU,GAAG,KAAK,GAAG,WAAW,CAAC;IACzC,2CAA2C;IAC3C,IAAI,CAAC,EAAE,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;IACzC,0BAA0B;IAC1B,WAAW,CAAC,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;IAC7C,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAiBD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,MAAM,GAAE,eAAoB,GAAG,cAAc,CAsH9E;AAGD,OAAO,EAAE,SAAS,EAAE,CAAC;AAGrB,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,EACb,sBAAsB,EACtB,cAAc,EACd,KAAK,wBAAwB,GAC9B,MAAM,iBAAiB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,228 @@
1
+ /**
2
+ * Supported SDXL resolutions (width x height)
3
+ */
4
+ const SDXL_RESOLUTIONS = [
5
+ "1024x1024",
6
+ "1152x896",
7
+ "896x1152",
8
+ "1216x832",
9
+ "832x1216",
10
+ "1344x768",
11
+ "768x1344",
12
+ "1536x640",
13
+ "640x1536",
14
+ ];
15
+ /**
16
+ * Available style presets
17
+ */
18
+ const STYLE_PRESETS = [
19
+ "3d-model",
20
+ "analog-film",
21
+ "anime",
22
+ "cinematic",
23
+ "comic-book",
24
+ "digital-art",
25
+ "enhance",
26
+ "fantasy-art",
27
+ "isometric",
28
+ "line-art",
29
+ "low-poly",
30
+ "modeling-compound",
31
+ "neon-punk",
32
+ "origami",
33
+ "photographic",
34
+ "pixel-art",
35
+ "tile-texture",
36
+ ];
37
+ /**
38
+ * Schema for the Stability AI generator
39
+ */
40
+ export const stabilitySchema = {
41
+ name: "stability",
42
+ description: "Generate images using Stability AI's SDXL and SD3 models",
43
+ category: "AI",
44
+ parameters: {
45
+ prompt: {
46
+ type: "string",
47
+ title: "Prompt",
48
+ description: "Describe the image you want to generate",
49
+ },
50
+ negativePrompt: {
51
+ type: "string",
52
+ title: "Negative Prompt",
53
+ description: "Describe what you don't want in the image",
54
+ },
55
+ model: {
56
+ type: "string",
57
+ title: "Model",
58
+ description: "Stability AI model to use",
59
+ enum: ["sdxl-1.0", "sd3", "sd3-turbo"],
60
+ default: "sdxl-1.0",
61
+ },
62
+ size: {
63
+ type: "string",
64
+ title: "Size",
65
+ description: "Image dimensions",
66
+ enum: [...SDXL_RESOLUTIONS],
67
+ default: "1024x1024",
68
+ },
69
+ stylePreset: {
70
+ type: "string",
71
+ title: "Style",
72
+ description: "Visual style preset",
73
+ enum: [...STYLE_PRESETS],
74
+ },
75
+ cfgScale: {
76
+ type: "number",
77
+ title: "CFG Scale",
78
+ description: "How closely to follow the prompt (5-15 recommended)",
79
+ default: 7,
80
+ minimum: 0,
81
+ maximum: 35,
82
+ },
83
+ steps: {
84
+ type: "number",
85
+ title: "Steps",
86
+ description: "Number of diffusion steps (more = higher quality, slower)",
87
+ default: 30,
88
+ minimum: 10,
89
+ maximum: 50,
90
+ },
91
+ seed: {
92
+ type: "number",
93
+ title: "Seed",
94
+ description: "Random seed for reproducibility",
95
+ },
96
+ },
97
+ requiredParameters: ["prompt"],
98
+ // AI metadata
99
+ isAI: true,
100
+ requiresApiKey: true,
101
+ apiKeyEnvVar: "STABILITY_API_KEY",
102
+ };
103
+ /**
104
+ * Get the engine ID for a model
105
+ */
106
+ function getEngineId(model) {
107
+ switch (model) {
108
+ case "sd3":
109
+ return "stable-diffusion-v3";
110
+ case "sd3-turbo":
111
+ return "stable-diffusion-v3-turbo";
112
+ case "sdxl-1.0":
113
+ default:
114
+ return "stable-diffusion-xl-1024-v1-0";
115
+ }
116
+ }
117
+ /**
118
+ * Create a Stability AI image generator instance
119
+ *
120
+ * Generates images using Stability AI's Stable Diffusion models (SDXL, SD3).
121
+ *
122
+ * @example
123
+ * ```typescript
124
+ * import createClient from '@teamflojo/floimg';
125
+ * import stability from '@teamflojo/floimg-stability';
126
+ *
127
+ * const floimg = createClient();
128
+ * floimg.registerGenerator(stability({ apiKey: process.env.STABILITY_API_KEY }));
129
+ *
130
+ * const image = await floimg.generate({
131
+ * generator: 'stability',
132
+ * params: {
133
+ * prompt: 'A serene mountain landscape at sunset',
134
+ * model: 'sdxl-1.0',
135
+ * stylePreset: 'photographic',
136
+ * size: '1024x1024',
137
+ * }
138
+ * });
139
+ * ```
140
+ */
141
+ export default function stability(config = {}) {
142
+ const { apiKey = process.env.STABILITY_API_KEY, model: defaultModel = "sdxl-1.0", stylePreset: defaultStylePreset, cfgScale: defaultCfgScale = 7, steps: defaultSteps = 30, } = config;
143
+ if (!apiKey) {
144
+ throw new Error("Stability API key is required. Set STABILITY_API_KEY environment variable or pass apiKey in config.");
145
+ }
146
+ return {
147
+ name: "stability",
148
+ schema: stabilitySchema,
149
+ async generate(params) {
150
+ const { prompt, negativePrompt, model = defaultModel, size = "1024x1024", stylePreset = defaultStylePreset, cfgScale = defaultCfgScale, steps = defaultSteps, seed, } = params;
151
+ if (!prompt) {
152
+ throw new Error("prompt is required for Stability AI image generation");
153
+ }
154
+ // Parse dimensions
155
+ const [width, height] = size.split("x").map(Number);
156
+ // Build request body
157
+ const textPrompts = [
158
+ { text: prompt, weight: 1 },
159
+ ...(negativePrompt ? [{ text: negativePrompt, weight: -1 }] : []),
160
+ ];
161
+ const body = {
162
+ text_prompts: textPrompts,
163
+ cfg_scale: cfgScale,
164
+ width,
165
+ height,
166
+ steps,
167
+ samples: 1,
168
+ };
169
+ if (stylePreset) {
170
+ body.style_preset = stylePreset;
171
+ }
172
+ if (seed !== undefined) {
173
+ body.seed = seed;
174
+ }
175
+ // Get engine ID
176
+ const engineId = getEngineId(model);
177
+ const url = `https://api.stability.ai/v1/generation/${engineId}/text-to-image`;
178
+ // Make API request
179
+ const response = await fetch(url, {
180
+ method: "POST",
181
+ headers: {
182
+ "Content-Type": "application/json",
183
+ Accept: "application/json",
184
+ Authorization: `Bearer ${apiKey}`,
185
+ },
186
+ body: JSON.stringify(body),
187
+ });
188
+ if (!response.ok) {
189
+ const error = (await response.json());
190
+ throw new Error(`Stability AI error: ${error.message || response.statusText}`);
191
+ }
192
+ const data = (await response.json());
193
+ if (!data.artifacts || data.artifacts.length === 0) {
194
+ throw new Error("No image data returned from Stability AI");
195
+ }
196
+ const artifact = data.artifacts[0];
197
+ if (artifact.finishReason === "CONTENT_FILTERED") {
198
+ throw new Error("Image was filtered due to content policy violation");
199
+ }
200
+ if (artifact.finishReason === "ERROR") {
201
+ throw new Error("An error occurred during image generation");
202
+ }
203
+ // Convert base64 to Buffer
204
+ const bytes = Buffer.from(artifact.base64, "base64");
205
+ return {
206
+ bytes,
207
+ mime: "image/png",
208
+ width,
209
+ height,
210
+ source: `ai:stability:${model}`,
211
+ metadata: {
212
+ prompt,
213
+ negativePrompt,
214
+ model,
215
+ stylePreset,
216
+ cfgScale,
217
+ steps,
218
+ seed: artifact.seed,
219
+ },
220
+ };
221
+ },
222
+ };
223
+ }
224
+ // Named export for convenience
225
+ export { stability };
226
+ // Export transform provider
227
+ export { stabilityTransform, removeBackgroundSchema, upscaleSchema, searchAndReplaceSchema, outpaintSchema, } from "./transforms.js";
228
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js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AI,EAAE,WAAW;gBACjB,KAAK;gBACL,MAAM;gBACN,MAAM,EAAE,gBAAgB,KAAK,EAAE;gBAC/B,QAAQ,EAAE;oBACR,MAAM;oBACN,cAAc;oBACd,KAAK;oBACL,WAAW;oBACX,QAAQ;oBACR,KAAK;oBACL,IAAI,EAAE,QAAQ,CAAC,IAAI;iBACpB;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAED,+BAA+B;AAC/B,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB,4BAA4B;AAC5B,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,EACb,sBAAsB,EACtB,cAAc,GAEf,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,54 @@
1
+ import type { TransformProvider, TransformOperationSchema } from "@teamflojo/floimg";
2
+ /**
3
+ * Schema for the remove background operation
4
+ */
5
+ declare const removeBackgroundSchema: TransformOperationSchema;
6
+ /**
7
+ * Schema for the AI upscale operation
8
+ */
9
+ declare const upscaleSchema: TransformOperationSchema;
10
+ /**
11
+ * Schema for the search and replace operation
12
+ */
13
+ declare const searchAndReplaceSchema: TransformOperationSchema;
14
+ /**
15
+ * Schema for the outpaint operation
16
+ */
17
+ declare const outpaintSchema: TransformOperationSchema;
18
+ /**
19
+ * Configuration for the Stability AI transform provider
20
+ */
21
+ export interface StabilityTransformConfig {
22
+ /** API key for Stability AI */
23
+ apiKey?: string;
24
+ }
25
+ /**
26
+ * Create a Stability AI transform provider instance
27
+ *
28
+ * Provides AI-powered image transformations:
29
+ * - removeBackground: Remove image background
30
+ * - upscale: AI-powered upscaling (Creative Upscale)
31
+ * - searchAndReplace: Find and replace objects in images
32
+ * - outpaint: Extend image boundaries
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * import createClient from '@teamflojo/floimg';
37
+ * import { stabilityTransform } from '@teamflojo/floimg-stability';
38
+ *
39
+ * const floimg = createClient();
40
+ * floimg.registerTransformProvider(stabilityTransform({
41
+ * apiKey: process.env.STABILITY_API_KEY
42
+ * }));
43
+ *
44
+ * // Remove background from an image
45
+ * const result = await floimg.transform({
46
+ * blob: inputImage,
47
+ * op: 'removeBackground',
48
+ * provider: 'stability-transform'
49
+ * });
50
+ * ```
51
+ */
52
+ export declare function stabilityTransform(config?: StabilityTransformConfig): TransformProvider;
53
+ export { removeBackgroundSchema, upscaleSchema, searchAndReplaceSchema, outpaintSchema };
54
+ //# sourceMappingURL=transforms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transforms.d.ts","sourceRoot":"","sources":["../src/transforms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,wBAAwB,EAAa,MAAM,mBAAmB,CAAC;AAiBhG;;GAEG;AACH,QAAA,MAAM,sBAAsB,EAAE,wBAW7B,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,aAAa,EAAE,wBAyBpB,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,sBAAsB,EAAE,wBAsB7B,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,cAAc,EAAE,wBAqDrB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,+BAA+B;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,GAAE,wBAA6B,GAAG,iBAAiB,CAgR3F;AAGD,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,sBAAsB,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,342 @@
1
+ /**
2
+ * Schema for the remove background operation
3
+ */
4
+ const removeBackgroundSchema = {
5
+ name: "removeBackground",
6
+ description: "Remove the background from an image using AI",
7
+ category: "AI",
8
+ parameters: {},
9
+ requiredParameters: [],
10
+ inputType: "image",
11
+ outputType: "image",
12
+ isAI: true,
13
+ requiresApiKey: true,
14
+ apiKeyEnvVar: "STABILITY_API_KEY",
15
+ };
16
+ /**
17
+ * Schema for the AI upscale operation
18
+ */
19
+ const upscaleSchema = {
20
+ name: "upscale",
21
+ description: "Upscale an image using AI (Creative Upscale)",
22
+ category: "AI",
23
+ parameters: {
24
+ prompt: {
25
+ type: "string",
26
+ title: "Prompt",
27
+ description: "Optional prompt to guide the upscaling",
28
+ },
29
+ creativity: {
30
+ type: "number",
31
+ title: "Creativity",
32
+ description: "How creative the upscale should be (0-0.35)",
33
+ default: 0.3,
34
+ minimum: 0,
35
+ maximum: 0.35,
36
+ },
37
+ },
38
+ requiredParameters: [],
39
+ inputType: "image",
40
+ outputType: "image",
41
+ isAI: true,
42
+ requiresApiKey: true,
43
+ apiKeyEnvVar: "STABILITY_API_KEY",
44
+ };
45
+ /**
46
+ * Schema for the search and replace operation
47
+ */
48
+ const searchAndReplaceSchema = {
49
+ name: "searchAndReplace",
50
+ description: "Find and replace objects in an image using AI",
51
+ category: "AI",
52
+ parameters: {
53
+ prompt: {
54
+ type: "string",
55
+ title: "Prompt",
56
+ description: "Describe what you want to add/change",
57
+ },
58
+ searchPrompt: {
59
+ type: "string",
60
+ title: "Search Prompt",
61
+ description: "Describe what to search for and replace",
62
+ },
63
+ },
64
+ requiredParameters: ["prompt", "searchPrompt"],
65
+ inputType: "image",
66
+ outputType: "image",
67
+ isAI: true,
68
+ requiresApiKey: true,
69
+ apiKeyEnvVar: "STABILITY_API_KEY",
70
+ };
71
+ /**
72
+ * Schema for the outpaint operation
73
+ */
74
+ const outpaintSchema = {
75
+ name: "outpaint",
76
+ description: "Extend image boundaries using AI",
77
+ category: "AI",
78
+ parameters: {
79
+ prompt: {
80
+ type: "string",
81
+ title: "Prompt",
82
+ description: "Describe what to generate in the extended areas",
83
+ },
84
+ left: {
85
+ type: "number",
86
+ title: "Left",
87
+ description: "Pixels to extend on the left",
88
+ default: 0,
89
+ minimum: 0,
90
+ },
91
+ right: {
92
+ type: "number",
93
+ title: "Right",
94
+ description: "Pixels to extend on the right",
95
+ default: 0,
96
+ minimum: 0,
97
+ },
98
+ up: {
99
+ type: "number",
100
+ title: "Up",
101
+ description: "Pixels to extend upward",
102
+ default: 0,
103
+ minimum: 0,
104
+ },
105
+ down: {
106
+ type: "number",
107
+ title: "Down",
108
+ description: "Pixels to extend downward",
109
+ default: 0,
110
+ minimum: 0,
111
+ },
112
+ creativity: {
113
+ type: "number",
114
+ title: "Creativity",
115
+ description: "How creative the outpaint should be (0-1)",
116
+ default: 0.5,
117
+ minimum: 0,
118
+ maximum: 1,
119
+ },
120
+ },
121
+ requiredParameters: ["prompt"],
122
+ inputType: "image",
123
+ outputType: "image",
124
+ isAI: true,
125
+ requiresApiKey: true,
126
+ apiKeyEnvVar: "STABILITY_API_KEY",
127
+ };
128
+ /**
129
+ * Create a Stability AI transform provider instance
130
+ *
131
+ * Provides AI-powered image transformations:
132
+ * - removeBackground: Remove image background
133
+ * - upscale: AI-powered upscaling (Creative Upscale)
134
+ * - searchAndReplace: Find and replace objects in images
135
+ * - outpaint: Extend image boundaries
136
+ *
137
+ * @example
138
+ * ```typescript
139
+ * import createClient from '@teamflojo/floimg';
140
+ * import { stabilityTransform } from '@teamflojo/floimg-stability';
141
+ *
142
+ * const floimg = createClient();
143
+ * floimg.registerTransformProvider(stabilityTransform({
144
+ * apiKey: process.env.STABILITY_API_KEY
145
+ * }));
146
+ *
147
+ * // Remove background from an image
148
+ * const result = await floimg.transform({
149
+ * blob: inputImage,
150
+ * op: 'removeBackground',
151
+ * provider: 'stability-transform'
152
+ * });
153
+ * ```
154
+ */
155
+ export function stabilityTransform(config = {}) {
156
+ const apiKey = config.apiKey || process.env.STABILITY_API_KEY;
157
+ if (!apiKey) {
158
+ throw new Error("Stability API key is required. Set STABILITY_API_KEY environment variable or pass apiKey in config.");
159
+ }
160
+ const operationSchemas = {
161
+ removeBackground: removeBackgroundSchema,
162
+ upscale: upscaleSchema,
163
+ searchAndReplace: searchAndReplaceSchema,
164
+ outpaint: outpaintSchema,
165
+ };
166
+ /**
167
+ * Helper to make multipart/form-data requests to Stability API
168
+ */
169
+ async function makeEditRequest(endpoint, formData) {
170
+ const response = await fetch(endpoint, {
171
+ method: "POST",
172
+ headers: {
173
+ Authorization: `Bearer ${apiKey}`,
174
+ Accept: "application/json",
175
+ },
176
+ body: formData,
177
+ });
178
+ if (!response.ok) {
179
+ const error = (await response.json());
180
+ throw new Error(`Stability AI error: ${error.message || response.statusText}`);
181
+ }
182
+ return (await response.json());
183
+ }
184
+ /**
185
+ * Remove background from an image
186
+ */
187
+ async function removeBackground(input) {
188
+ const formData = new FormData();
189
+ formData.append("image", new Blob([input.bytes], { type: input.mime }));
190
+ formData.append("output_format", "png");
191
+ const result = await makeEditRequest("https://api.stability.ai/v2beta/stable-image/edit/remove-background", formData);
192
+ if (result.finish_reason === "CONTENT_FILTERED") {
193
+ throw new Error("Image was filtered due to content policy violation");
194
+ }
195
+ const bytes = Buffer.from(result.image, "base64");
196
+ return {
197
+ bytes,
198
+ mime: "image/png",
199
+ width: input.width,
200
+ height: input.height,
201
+ source: "ai:stability:removeBackground",
202
+ metadata: {
203
+ operation: "removeBackground",
204
+ seed: result.seed,
205
+ },
206
+ };
207
+ }
208
+ /**
209
+ * AI-powered upscaling using Creative Upscale
210
+ */
211
+ async function upscale(input, params) {
212
+ const { prompt = "", creativity = 0.3 } = params;
213
+ const formData = new FormData();
214
+ formData.append("image", new Blob([input.bytes], { type: input.mime }));
215
+ formData.append("output_format", "png");
216
+ if (prompt) {
217
+ formData.append("prompt", prompt);
218
+ }
219
+ formData.append("creativity", String(creativity));
220
+ const result = await makeEditRequest("https://api.stability.ai/v2beta/stable-image/upscale/creative", formData);
221
+ if (result.finish_reason === "CONTENT_FILTERED") {
222
+ throw new Error("Image was filtered due to content policy violation");
223
+ }
224
+ const bytes = Buffer.from(result.image, "base64");
225
+ // Creative Upscale produces 4x resolution
226
+ const newWidth = input.width ? input.width * 4 : undefined;
227
+ const newHeight = input.height ? input.height * 4 : undefined;
228
+ return {
229
+ bytes,
230
+ mime: "image/png",
231
+ width: newWidth,
232
+ height: newHeight,
233
+ source: "ai:stability:upscale",
234
+ metadata: {
235
+ operation: "upscale",
236
+ prompt,
237
+ creativity,
238
+ seed: result.seed,
239
+ },
240
+ };
241
+ }
242
+ /**
243
+ * Find and replace objects in an image
244
+ */
245
+ async function searchAndReplace(input, params) {
246
+ const { prompt, searchPrompt } = params;
247
+ if (!prompt || !searchPrompt) {
248
+ throw new Error("Both prompt and searchPrompt are required for search and replace");
249
+ }
250
+ const formData = new FormData();
251
+ formData.append("image", new Blob([input.bytes], { type: input.mime }));
252
+ formData.append("prompt", prompt);
253
+ formData.append("search_prompt", searchPrompt);
254
+ formData.append("output_format", "png");
255
+ const result = await makeEditRequest("https://api.stability.ai/v2beta/stable-image/edit/search-and-replace", formData);
256
+ if (result.finish_reason === "CONTENT_FILTERED") {
257
+ throw new Error("Image was filtered due to content policy violation");
258
+ }
259
+ const bytes = Buffer.from(result.image, "base64");
260
+ return {
261
+ bytes,
262
+ mime: "image/png",
263
+ width: input.width,
264
+ height: input.height,
265
+ source: "ai:stability:searchAndReplace",
266
+ metadata: {
267
+ operation: "searchAndReplace",
268
+ prompt,
269
+ searchPrompt,
270
+ seed: result.seed,
271
+ },
272
+ };
273
+ }
274
+ /**
275
+ * Extend image boundaries
276
+ */
277
+ async function outpaint(input, params) {
278
+ const { prompt, left = 0, right = 0, up = 0, down = 0, creativity = 0.5, } = params;
279
+ if (!prompt) {
280
+ throw new Error("prompt is required for outpaint");
281
+ }
282
+ const formData = new FormData();
283
+ formData.append("image", new Blob([input.bytes], { type: input.mime }));
284
+ formData.append("prompt", prompt);
285
+ formData.append("left", String(left));
286
+ formData.append("right", String(right));
287
+ formData.append("up", String(up));
288
+ formData.append("down", String(down));
289
+ formData.append("creativity", String(creativity));
290
+ formData.append("output_format", "png");
291
+ const result = await makeEditRequest("https://api.stability.ai/v2beta/stable-image/edit/outpaint", formData);
292
+ if (result.finish_reason === "CONTENT_FILTERED") {
293
+ throw new Error("Image was filtered due to content policy violation");
294
+ }
295
+ const bytes = Buffer.from(result.image, "base64");
296
+ // Calculate new dimensions
297
+ const newWidth = input.width ? input.width + left + right : undefined;
298
+ const newHeight = input.height ? input.height + up + down : undefined;
299
+ return {
300
+ bytes,
301
+ mime: "image/png",
302
+ width: newWidth,
303
+ height: newHeight,
304
+ source: "ai:stability:outpaint",
305
+ metadata: {
306
+ operation: "outpaint",
307
+ prompt,
308
+ left,
309
+ right,
310
+ up,
311
+ down,
312
+ creativity,
313
+ seed: result.seed,
314
+ },
315
+ };
316
+ }
317
+ // Operation dispatch map
318
+ const operations = {
319
+ removeBackground: (input) => removeBackground(input),
320
+ upscale: (input, params) => upscale(input, params),
321
+ searchAndReplace: (input, params) => searchAndReplace(input, params),
322
+ outpaint: (input, params) => outpaint(input, params),
323
+ };
324
+ return {
325
+ name: "stability-transform",
326
+ operationSchemas,
327
+ async transform(input, op, params) {
328
+ const operation = operations[op];
329
+ if (!operation) {
330
+ throw new Error(`Unknown operation: ${op}. Supported: ${Object.keys(operations).join(", ")}`);
331
+ }
332
+ return operation(input, params);
333
+ },
334
+ // Required by interface but we don't support format conversion
335
+ async convert() {
336
+ throw new Error("Stability AI transform provider does not support format conversion. Use the sharp provider instead.");
337
+ },
338
+ };
339
+ }
340
+ // Export schemas for capability discovery
341
+ export { removeBackgroundSchema, upscaleSchema, searchAndReplaceSchema, outpaintSchema };
342
+ //# sourceMappingURL=transforms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transforms.js","sourceRoot":"","sources":["../src/transforms.ts"],"names":[],"mappings":"AAiBA;;GAEG;AACH,MAAM,sBAAsB,GAA6B;IACvD,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,8CAA8C;IAC3D,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,EAAE;IACd,kBAAkB,EAAE,EAAE;IACtB,SAAS,EAAE,OAAO;IAClB,UAAU,EAAE,OAAO;IACnB,IAAI,EAAE,IAAI;IACV,cAAc,EAAE,IAAI;IACpB,Y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F,CAAC;IACJ,CAAC;IAED,yBAAyB;IACzB,MAAM,UAAU,GAGZ;QACF,gBAAgB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC;QACpD,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC;QAClD,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC;QACpE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;KACrD,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,qBAAqB;QAC3B,gBAAgB;QAEhB,KAAK,CAAC,SAAS,CACb,KAAgB,EAChB,EAAU,EACV,MAA+B;YAE/B,MAAM,SAAS,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC;YACjC,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CACb,sBAAsB,EAAE,gBAAgB,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC7E,CAAC;YACJ,CAAC;YACD,OAAO,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAClC,CAAC;QAED,+DAA+D;QAC/D,KAAK,CAAC,OAAO;YACX,MAAM,IAAI,KAAK,CACb,qGAAqG,CACtG,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAED,0CAA0C;AAC1C,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,sBAAsB,EAAE,cAAc,EAAE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@teamflojo/floimg-stability",
3
+ "version": "0.1.0",
4
+ "description": "Stability AI image generation plugin for floimg (SDXL, SD3)",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md",
17
+ "LICENSE"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "dev": "tsc --watch",
22
+ "typecheck": "tsc --noEmit",
23
+ "clean": "rm -rf dist",
24
+ "prepublishOnly": "npm run build",
25
+ "test": "vitest --run"
26
+ },
27
+ "keywords": [
28
+ "floimg",
29
+ "stability-ai",
30
+ "stable-diffusion",
31
+ "sdxl",
32
+ "sd3",
33
+ "image-generation",
34
+ "ai"
35
+ ],
36
+ "author": "Brett Cooke",
37
+ "license": "MIT",
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "https://github.com/TeamFlojo/floimg.git",
41
+ "directory": "packages/floimg-stability"
42
+ },
43
+ "peerDependencies": {
44
+ "@teamflojo/floimg": "^0.2.0"
45
+ },
46
+ "devDependencies": {
47
+ "@types/node": "^22.10.2",
48
+ "@teamflojo/floimg": "workspace:*",
49
+ "typescript": "^5.7.2",
50
+ "vitest": "^2.1.8"
51
+ },
52
+ "engines": {
53
+ "node": ">=18.0.0"
54
+ }
55
+ }