@alfe.ai/openclaw 0.3.1 → 0.3.2
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/plugin2.cjs +19 -46
- package/dist/plugin2.js +19 -46
- package/package.json +2 -2
package/dist/plugin2.cjs
CHANGED
|
@@ -3090,13 +3090,6 @@ async function registerWithDaemon(client, log, pluginName = "@alfe.ai/openclaw")
|
|
|
3090
3090
|
const pkg = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href)("../package.json");
|
|
3091
3091
|
const DEFAULT_SOCKET_PATH = (0, node_path.join)((0, node_os.homedir)(), ".alfe", "gateway.sock");
|
|
3092
3092
|
let ipcClient = null;
|
|
3093
|
-
/**
|
|
3094
|
-
* The local AI proxy (packages/ai-proxy-local) runs alongside the daemon on a
|
|
3095
|
-
* fixed loopback port in every runtime mode (managed VM / docker / self-hosted),
|
|
3096
|
-
* injects the agent's Alfe key, and forwards arbitrary paths to the cloud AI
|
|
3097
|
-
* proxy. openclaw-chat hardcodes the same host for /__alfe/set-identity.
|
|
3098
|
-
*/
|
|
3099
|
-
const LOCAL_AI_PROXY_URL = process.env.ALFE_AI_PROXY_URL ?? "http://127.0.0.1:18193";
|
|
3100
3093
|
/** Max avatar upload size — mirrors the server-side finalize check. */
|
|
3101
3094
|
const MAX_AVATAR_BYTES = 5 * 1024 * 1024;
|
|
3102
3095
|
/** Image types the avatar presign/finalize flow accepts, keyed by file extension. */
|
|
@@ -3120,10 +3113,17 @@ function ok(result) {
|
|
|
3120
3113
|
}] };
|
|
3121
3114
|
}
|
|
3122
3115
|
function errResult(message) {
|
|
3123
|
-
return {
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3116
|
+
return {
|
|
3117
|
+
content: [{
|
|
3118
|
+
type: "text",
|
|
3119
|
+
text: JSON.stringify({ error: message })
|
|
3120
|
+
}],
|
|
3121
|
+
isError: true,
|
|
3122
|
+
details: {
|
|
3123
|
+
status: "error",
|
|
3124
|
+
error: message
|
|
3125
|
+
}
|
|
3126
|
+
};
|
|
3127
3127
|
}
|
|
3128
3128
|
function defineTool(def) {
|
|
3129
3129
|
return {
|
|
@@ -3283,49 +3283,22 @@ function buildVoiceTools(client) {
|
|
|
3283
3283
|
}),
|
|
3284
3284
|
defineTool({
|
|
3285
3285
|
name: "generate_image",
|
|
3286
|
-
description: "Generate an image from a text prompt. Returns a URL to the generated PNG. To show the image to the user, embed it in your reply as markdown: . Optional `model` picks the image model (default gpt-image-1).",
|
|
3286
|
+
description: "Generate an image from a text prompt. Returns a URL to the generated PNG. To show the image to the user, embed it in your reply as markdown: . Optional `model` picks the image model (default gpt-image-1). Generation is synchronous and may take up to ~30s; if it times out, retry or use a standard size.",
|
|
3287
3287
|
parameters: Type.Object({
|
|
3288
3288
|
prompt: Type.String({ description: "Text description of the image to generate." }),
|
|
3289
3289
|
model: Type.Optional(Type.String({ description: "Image model id (default \"gpt-image-1\"). Others may be available, e.g. dall-e-3." })),
|
|
3290
|
-
size: Type.Optional(Type.String({ description: "Image size
|
|
3290
|
+
size: Type.Optional(Type.String({ description: "Image size. For the default gpt-image-1 use one of \"1024x1024\" (square), \"1536x1024\" (landscape), \"1024x1536\" (portrait), or \"auto\" — NOT \"512x512\". Other models accept their own sizes. Omit to use the provider default." })),
|
|
3291
3291
|
quality: Type.Optional(Type.String({ description: "Image quality hint (provider-dependent)." }))
|
|
3292
3292
|
}),
|
|
3293
3293
|
handler: async (params) => {
|
|
3294
|
-
const
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
method: "POST",
|
|
3300
|
-
headers: { "Content-Type": "application/json" },
|
|
3301
|
-
body: JSON.stringify({
|
|
3302
|
-
model,
|
|
3303
|
-
prompt,
|
|
3304
|
-
...size ? { size } : {},
|
|
3305
|
-
...quality ? { quality } : {}
|
|
3306
|
-
})
|
|
3307
|
-
});
|
|
3308
|
-
const genJson = await genRes.json().catch(() => ({}));
|
|
3309
|
-
if (!genRes.ok) throw new Error(`image generation failed (${String(genRes.status)}): ${genJson.message ?? genJson.error ?? "unknown error"}`);
|
|
3310
|
-
const b64 = genJson.data?.[0]?.b64_json;
|
|
3311
|
-
if (!b64) throw new Error("image generation returned no image data");
|
|
3312
|
-
const buffer = Buffer.from(b64, "base64");
|
|
3313
|
-
const filename = `generated-image-${String(Date.now())}.png`;
|
|
3314
|
-
const { attachments } = await client.presignAttachments([{
|
|
3315
|
-
filename,
|
|
3316
|
-
mimeType: "image/png",
|
|
3317
|
-
size: buffer.length
|
|
3318
|
-
}]);
|
|
3319
|
-
if (attachments.length === 0) throw new Error("failed to presign upload for the generated image");
|
|
3320
|
-
const att = attachments[0];
|
|
3321
|
-
const putRes = await fetch(att.uploadUrl, {
|
|
3322
|
-
method: "PUT",
|
|
3323
|
-
headers: { "Content-Type": "image/png" },
|
|
3324
|
-
body: buffer
|
|
3294
|
+
const { imageUrl, model } = await client.generateImage({
|
|
3295
|
+
prompt: params.prompt,
|
|
3296
|
+
model: params.model,
|
|
3297
|
+
size: params.size,
|
|
3298
|
+
quality: params.quality
|
|
3325
3299
|
});
|
|
3326
|
-
if (!putRes.ok) throw new Error(`failed to upload the generated image (${String(putRes.status)})`);
|
|
3327
3300
|
return {
|
|
3328
|
-
imageUrl
|
|
3301
|
+
imageUrl,
|
|
3329
3302
|
model,
|
|
3330
3303
|
instruction: "Show this image to the user by including it in your reply as markdown: ."
|
|
3331
3304
|
};
|
package/dist/plugin2.js
CHANGED
|
@@ -3091,13 +3091,6 @@ async function registerWithDaemon(client, log, pluginName = "@alfe.ai/openclaw")
|
|
|
3091
3091
|
const pkg = createRequire(import.meta.url)("../package.json");
|
|
3092
3092
|
const DEFAULT_SOCKET_PATH = join(homedir(), ".alfe", "gateway.sock");
|
|
3093
3093
|
let ipcClient = null;
|
|
3094
|
-
/**
|
|
3095
|
-
* The local AI proxy (packages/ai-proxy-local) runs alongside the daemon on a
|
|
3096
|
-
* fixed loopback port in every runtime mode (managed VM / docker / self-hosted),
|
|
3097
|
-
* injects the agent's Alfe key, and forwards arbitrary paths to the cloud AI
|
|
3098
|
-
* proxy. openclaw-chat hardcodes the same host for /__alfe/set-identity.
|
|
3099
|
-
*/
|
|
3100
|
-
const LOCAL_AI_PROXY_URL = process.env.ALFE_AI_PROXY_URL ?? "http://127.0.0.1:18193";
|
|
3101
3094
|
/** Max avatar upload size — mirrors the server-side finalize check. */
|
|
3102
3095
|
const MAX_AVATAR_BYTES = 5 * 1024 * 1024;
|
|
3103
3096
|
/** Image types the avatar presign/finalize flow accepts, keyed by file extension. */
|
|
@@ -3121,10 +3114,17 @@ function ok(result) {
|
|
|
3121
3114
|
}] };
|
|
3122
3115
|
}
|
|
3123
3116
|
function errResult(message) {
|
|
3124
|
-
return {
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3117
|
+
return {
|
|
3118
|
+
content: [{
|
|
3119
|
+
type: "text",
|
|
3120
|
+
text: JSON.stringify({ error: message })
|
|
3121
|
+
}],
|
|
3122
|
+
isError: true,
|
|
3123
|
+
details: {
|
|
3124
|
+
status: "error",
|
|
3125
|
+
error: message
|
|
3126
|
+
}
|
|
3127
|
+
};
|
|
3128
3128
|
}
|
|
3129
3129
|
function defineTool(def) {
|
|
3130
3130
|
return {
|
|
@@ -3284,49 +3284,22 @@ function buildVoiceTools(client) {
|
|
|
3284
3284
|
}),
|
|
3285
3285
|
defineTool({
|
|
3286
3286
|
name: "generate_image",
|
|
3287
|
-
description: "Generate an image from a text prompt. Returns a URL to the generated PNG. To show the image to the user, embed it in your reply as markdown: . Optional `model` picks the image model (default gpt-image-1).",
|
|
3287
|
+
description: "Generate an image from a text prompt. Returns a URL to the generated PNG. To show the image to the user, embed it in your reply as markdown: . Optional `model` picks the image model (default gpt-image-1). Generation is synchronous and may take up to ~30s; if it times out, retry or use a standard size.",
|
|
3288
3288
|
parameters: Type.Object({
|
|
3289
3289
|
prompt: Type.String({ description: "Text description of the image to generate." }),
|
|
3290
3290
|
model: Type.Optional(Type.String({ description: "Image model id (default \"gpt-image-1\"). Others may be available, e.g. dall-e-3." })),
|
|
3291
|
-
size: Type.Optional(Type.String({ description: "Image size
|
|
3291
|
+
size: Type.Optional(Type.String({ description: "Image size. For the default gpt-image-1 use one of \"1024x1024\" (square), \"1536x1024\" (landscape), \"1024x1536\" (portrait), or \"auto\" — NOT \"512x512\". Other models accept their own sizes. Omit to use the provider default." })),
|
|
3292
3292
|
quality: Type.Optional(Type.String({ description: "Image quality hint (provider-dependent)." }))
|
|
3293
3293
|
}),
|
|
3294
3294
|
handler: async (params) => {
|
|
3295
|
-
const
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
method: "POST",
|
|
3301
|
-
headers: { "Content-Type": "application/json" },
|
|
3302
|
-
body: JSON.stringify({
|
|
3303
|
-
model,
|
|
3304
|
-
prompt,
|
|
3305
|
-
...size ? { size } : {},
|
|
3306
|
-
...quality ? { quality } : {}
|
|
3307
|
-
})
|
|
3308
|
-
});
|
|
3309
|
-
const genJson = await genRes.json().catch(() => ({}));
|
|
3310
|
-
if (!genRes.ok) throw new Error(`image generation failed (${String(genRes.status)}): ${genJson.message ?? genJson.error ?? "unknown error"}`);
|
|
3311
|
-
const b64 = genJson.data?.[0]?.b64_json;
|
|
3312
|
-
if (!b64) throw new Error("image generation returned no image data");
|
|
3313
|
-
const buffer = Buffer.from(b64, "base64");
|
|
3314
|
-
const filename = `generated-image-${String(Date.now())}.png`;
|
|
3315
|
-
const { attachments } = await client.presignAttachments([{
|
|
3316
|
-
filename,
|
|
3317
|
-
mimeType: "image/png",
|
|
3318
|
-
size: buffer.length
|
|
3319
|
-
}]);
|
|
3320
|
-
if (attachments.length === 0) throw new Error("failed to presign upload for the generated image");
|
|
3321
|
-
const att = attachments[0];
|
|
3322
|
-
const putRes = await fetch(att.uploadUrl, {
|
|
3323
|
-
method: "PUT",
|
|
3324
|
-
headers: { "Content-Type": "image/png" },
|
|
3325
|
-
body: buffer
|
|
3295
|
+
const { imageUrl, model } = await client.generateImage({
|
|
3296
|
+
prompt: params.prompt,
|
|
3297
|
+
model: params.model,
|
|
3298
|
+
size: params.size,
|
|
3299
|
+
quality: params.quality
|
|
3326
3300
|
});
|
|
3327
|
-
if (!putRes.ok) throw new Error(`failed to upload the generated image (${String(putRes.status)})`);
|
|
3328
3301
|
return {
|
|
3329
|
-
imageUrl
|
|
3302
|
+
imageUrl,
|
|
3330
3303
|
model,
|
|
3331
3304
|
instruction: "Show this image to the user by including it in your reply as markdown: ."
|
|
3332
3305
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfe.ai/openclaw",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "OpenClaw plugin for Alfe — connects to local gateway daemon via IPC for integration management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@auriclabs/logger": "^0.1.1",
|
|
27
27
|
"@sinclair/typebox": "^0.34.48",
|
|
28
28
|
"zod": "^4.1.5",
|
|
29
|
-
"@alfe.ai/agent-api-client": "^0.
|
|
29
|
+
"@alfe.ai/agent-api-client": "^0.5.0",
|
|
30
30
|
"@alfe.ai/config": "^0.3.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|