@suknna/pixelforge 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.
- package/LICENSE +21 -0
- package/README.md +66 -0
- package/dist/adapters/fal.d.ts +11 -0
- package/dist/adapters/fal.js +56 -0
- package/dist/adapters/http.d.ts +21 -0
- package/dist/adapters/http.js +52 -0
- package/dist/adapters/index.d.ts +6 -0
- package/dist/adapters/index.js +20 -0
- package/dist/adapters/openai-images.d.ts +11 -0
- package/dist/adapters/openai-images.js +62 -0
- package/dist/adapters/replicate.d.ts +6 -0
- package/dist/adapters/replicate.js +67 -0
- package/dist/adapters/stability-ai.d.ts +11 -0
- package/dist/adapters/stability-ai.js +57 -0
- package/dist/config.d.ts +5 -0
- package/dist/config.js +103 -0
- package/dist/errors.d.ts +15 -0
- package/dist/errors.js +75 -0
- package/dist/image-input.d.ts +9 -0
- package/dist/image-input.js +28 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +42 -0
- package/dist/jobs.d.ts +28 -0
- package/dist/jobs.js +107 -0
- package/dist/notifications.d.ts +30 -0
- package/dist/notifications.js +15 -0
- package/dist/path-safety.d.ts +3 -0
- package/dist/path-safety.js +26 -0
- package/dist/runner.d.ts +16 -0
- package/dist/runner.js +88 -0
- package/dist/tools.d.ts +49 -0
- package/dist/tools.js +112 -0
- package/dist/types.d.ts +138 -0
- package/dist/types.js +1 -0
- package/package.json +46 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
export type ProviderName = "openai-images" | "fal" | "replicate" | "stability-ai";
|
|
2
|
+
export type JobKind = "text-to-image" | "image-to-image";
|
|
3
|
+
export type JobStatus = "queued" | "running" | "succeeded" | "failed";
|
|
4
|
+
export type ErrorCategory = "network" | "timeout" | "rate-limit" | "server" | "auth" | "bad-request" | "moderation" | "configuration" | "filesystem" | "provider";
|
|
5
|
+
export type ProviderError = {
|
|
6
|
+
category: ErrorCategory;
|
|
7
|
+
message: string;
|
|
8
|
+
retryable: boolean;
|
|
9
|
+
statusCode?: number;
|
|
10
|
+
provider?: ProviderName;
|
|
11
|
+
};
|
|
12
|
+
export type ImageResult = {
|
|
13
|
+
bytes: Uint8Array;
|
|
14
|
+
mimeType: string;
|
|
15
|
+
provider: ProviderName;
|
|
16
|
+
};
|
|
17
|
+
export type TextToImageRequest = {
|
|
18
|
+
prompt: string;
|
|
19
|
+
signal: AbortSignal;
|
|
20
|
+
};
|
|
21
|
+
export type ImageToImageRequest = {
|
|
22
|
+
baseImagePath: string;
|
|
23
|
+
prompt: string;
|
|
24
|
+
strength?: number;
|
|
25
|
+
signal: AbortSignal;
|
|
26
|
+
};
|
|
27
|
+
export type ImageAdapter = {
|
|
28
|
+
provider: ProviderName;
|
|
29
|
+
generateImage(request: TextToImageRequest): Promise<ImageResult>;
|
|
30
|
+
generateImageFromImage(request: ImageToImageRequest): Promise<ImageResult>;
|
|
31
|
+
};
|
|
32
|
+
export type SecretValue = string | {
|
|
33
|
+
env: string;
|
|
34
|
+
};
|
|
35
|
+
export type NotificationConfig = {
|
|
36
|
+
tui: boolean;
|
|
37
|
+
sessionMessage: boolean;
|
|
38
|
+
autoContinue: boolean;
|
|
39
|
+
};
|
|
40
|
+
export type BaseProfile = {
|
|
41
|
+
provider: ProviderName;
|
|
42
|
+
timeoutMs: number;
|
|
43
|
+
outputFormat?: "png" | "jpeg" | "webp";
|
|
44
|
+
defaultStrength?: number;
|
|
45
|
+
};
|
|
46
|
+
export type OpenAIImagesProfile = BaseProfile & {
|
|
47
|
+
provider: "openai-images";
|
|
48
|
+
apiKey: SecretValue;
|
|
49
|
+
model: string;
|
|
50
|
+
baseUrl: string;
|
|
51
|
+
size: string;
|
|
52
|
+
quality?: "low" | "medium" | "high" | "auto";
|
|
53
|
+
};
|
|
54
|
+
export type FalProfile = BaseProfile & {
|
|
55
|
+
provider: "fal";
|
|
56
|
+
apiKey: SecretValue;
|
|
57
|
+
endpoint: string;
|
|
58
|
+
imageToImageEndpoint: string;
|
|
59
|
+
imageSize?: string;
|
|
60
|
+
};
|
|
61
|
+
export type ReplicateProfile = BaseProfile & {
|
|
62
|
+
provider: "replicate";
|
|
63
|
+
apiToken: SecretValue;
|
|
64
|
+
version: string;
|
|
65
|
+
promptInputKey: string;
|
|
66
|
+
imageInputKey: string;
|
|
67
|
+
strengthInputKey?: string;
|
|
68
|
+
pollIntervalMs: number;
|
|
69
|
+
};
|
|
70
|
+
export type StabilityAIProfile = BaseProfile & {
|
|
71
|
+
provider: "stability-ai";
|
|
72
|
+
apiKey: SecretValue;
|
|
73
|
+
baseUrl: string;
|
|
74
|
+
textToImagePath: string;
|
|
75
|
+
imageToImagePath: string;
|
|
76
|
+
width?: number;
|
|
77
|
+
height?: number;
|
|
78
|
+
};
|
|
79
|
+
export type RawProfile = OpenAIImagesProfile | FalProfile | ReplicateProfile | StabilityAIProfile;
|
|
80
|
+
export type RawPixelForgeConfig = {
|
|
81
|
+
defaultProfile: string;
|
|
82
|
+
fallbackProfiles?: string[];
|
|
83
|
+
notifications?: NotificationConfig;
|
|
84
|
+
profiles: Record<string, RawProfile>;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Resolves a raw profile into its runtime form: secret references are replaced
|
|
88
|
+
* by a single resolved `credential` string and the profile name is attached.
|
|
89
|
+
*
|
|
90
|
+
* This is written as a distributive conditional type so the discriminated
|
|
91
|
+
* union over `provider` survives. A plain `Omit<RawProfile, ...>` would collapse
|
|
92
|
+
* the union into one object type and break `Extract<ResolvedProfile, { provider }>`.
|
|
93
|
+
*/
|
|
94
|
+
export type ResolvedProfile = RawProfile extends infer P ? P extends RawProfile ? Omit<P, "apiKey" | "apiToken"> & {
|
|
95
|
+
profileName: string;
|
|
96
|
+
credential: string;
|
|
97
|
+
} : never : never;
|
|
98
|
+
export type PixelForgeConfig = {
|
|
99
|
+
defaultProfile: string;
|
|
100
|
+
fallbackProfiles: string[];
|
|
101
|
+
notifications: NotificationConfig;
|
|
102
|
+
profiles: Record<string, ResolvedProfile>;
|
|
103
|
+
};
|
|
104
|
+
export type JobAttempt = {
|
|
105
|
+
provider: ProviderName;
|
|
106
|
+
startedAt: string;
|
|
107
|
+
finishedAt?: string;
|
|
108
|
+
error?: ProviderError;
|
|
109
|
+
};
|
|
110
|
+
export type ImageJob = {
|
|
111
|
+
id: string;
|
|
112
|
+
kind: JobKind;
|
|
113
|
+
status: JobStatus;
|
|
114
|
+
prompt: string;
|
|
115
|
+
outputPath: string;
|
|
116
|
+
baseImagePath?: string;
|
|
117
|
+
provider?: ProviderName;
|
|
118
|
+
mimeType?: string;
|
|
119
|
+
byteLength?: number;
|
|
120
|
+
error?: ProviderError;
|
|
121
|
+
attempts: JobAttempt[];
|
|
122
|
+
createdAt: string;
|
|
123
|
+
updatedAt: string;
|
|
124
|
+
completedAt?: string;
|
|
125
|
+
};
|
|
126
|
+
export type PublicJobStatus = {
|
|
127
|
+
jobId: string;
|
|
128
|
+
status: JobStatus;
|
|
129
|
+
outputPath: string;
|
|
130
|
+
baseImagePath?: string;
|
|
131
|
+
provider?: ProviderName;
|
|
132
|
+
mimeType?: string;
|
|
133
|
+
byteLength?: number;
|
|
134
|
+
error?: Pick<ProviderError, "category" | "message" | "retryable" | "statusCode">;
|
|
135
|
+
createdAt: string;
|
|
136
|
+
updatedAt: string;
|
|
137
|
+
completedAt?: string;
|
|
138
|
+
};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@suknna/pixelforge",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "OpenCode plugin that provides background image generation tools.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": ["dist", "README.md", "LICENSE"],
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc -p tsconfig.json",
|
|
17
|
+
"test": "vitest run",
|
|
18
|
+
"test:integration": "vitest run tests/integration",
|
|
19
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
20
|
+
"prepublishOnly": "npm run build"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@opencode-ai/plugin": "1.17.6"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "25.9.3",
|
|
27
|
+
"typescript": "6.0.3",
|
|
28
|
+
"vitest": "4.1.8"
|
|
29
|
+
},
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=20.0.0"
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/Suknna/pixelforge.git"
|
|
36
|
+
},
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/Suknna/pixelforge/issues"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/Suknna/pixelforge#readme",
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"keywords": ["opencode", "plugin", "image-generation", "pixel-forge"],
|
|
45
|
+
"license": "MIT"
|
|
46
|
+
}
|