@crewhaus/tool-image-generation 0.5.7 → 0.6.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/dist/index.d.ts +8 -0
- package/dist/index.js +15 -2
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -46,4 +46,12 @@ export declare class ImageGenerationError extends CrewhausError {
|
|
|
46
46
|
* env-driven defaults work without re-registering.
|
|
47
47
|
*/
|
|
48
48
|
export declare function registerImageGenerationConfig(config: ImageGenerationConfig): void;
|
|
49
|
+
/**
|
|
50
|
+
* 0.6.0 §4.4 — the config ONE call runs under: the serving candidate's
|
|
51
|
+
* `tool_config.imageGenerate` block when its profile declares one
|
|
52
|
+
* (`ToolExecuteContext.toolConfig`, REPLACING the registered block for this
|
|
53
|
+
* call exactly as `registerImageGenerationConfig` replaces it at boot), else
|
|
54
|
+
* the process-global registration (else `{}` — env-driven defaults).
|
|
55
|
+
*/
|
|
56
|
+
export declare function resolveImageGenerationConfig(override: unknown): ImageGenerationConfig;
|
|
49
57
|
export declare const imageGenerate: RegisteredTool;
|
package/dist/index.js
CHANGED
|
@@ -56,6 +56,19 @@ let registeredConfig;
|
|
|
56
56
|
export function registerImageGenerationConfig(config) {
|
|
57
57
|
registeredConfig = config;
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* 0.6.0 §4.4 — the config ONE call runs under: the serving candidate's
|
|
61
|
+
* `tool_config.imageGenerate` block when its profile declares one
|
|
62
|
+
* (`ToolExecuteContext.toolConfig`, REPLACING the registered block for this
|
|
63
|
+
* call exactly as `registerImageGenerationConfig` replaces it at boot), else
|
|
64
|
+
* the process-global registration (else `{}` — env-driven defaults).
|
|
65
|
+
*/
|
|
66
|
+
export function resolveImageGenerationConfig(override) {
|
|
67
|
+
if (typeof override === "object" && override !== null && !Array.isArray(override)) {
|
|
68
|
+
return override;
|
|
69
|
+
}
|
|
70
|
+
return registeredConfig ?? {};
|
|
71
|
+
}
|
|
59
72
|
export const imageGenerate = buildTool({
|
|
60
73
|
name: "ImageGenerate",
|
|
61
74
|
description: "Generate an image from a text prompt via a remote API. Returns a URL or base64 data URI. Use for: visual concepts, mockups, illustrations, social posts. Don't use for: 'edit this existing photo' (different tool needed).",
|
|
@@ -67,8 +80,8 @@ export const imageGenerate = buildTool({
|
|
|
67
80
|
scope: "external",
|
|
68
81
|
// FR-002 — declare the io-capability fact (remote image-gen API call).
|
|
69
82
|
ioCapability: "network",
|
|
70
|
-
execute: async (input) => {
|
|
71
|
-
const cfg =
|
|
83
|
+
execute: async (input, ctx) => {
|
|
84
|
+
const cfg = resolveImageGenerationConfig(ctx?.toolConfig);
|
|
72
85
|
const provider = cfg.provider ?? defaultProvider(process.env);
|
|
73
86
|
const responseFormat = input.responseFormat ?? "url";
|
|
74
87
|
if (provider === "openai") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crewhaus/tool-image-generation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "M4.1 — image-generation tool (DALL-E 3, Replicate, future Flux/SD). Calls remote API; no host writes; non-destructive.",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"test": "bun test src"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@crewhaus/errors": "0.
|
|
19
|
-
"@crewhaus/tool-builder": "0.
|
|
20
|
-
"@crewhaus/tool-catalog": "0.
|
|
18
|
+
"@crewhaus/errors": "0.6.0",
|
|
19
|
+
"@crewhaus/tool-builder": "0.6.0",
|
|
20
|
+
"@crewhaus/tool-catalog": "0.6.0",
|
|
21
21
|
"zod": "^3.23.8"
|
|
22
22
|
},
|
|
23
23
|
"license": "Apache-2.0",
|