@openclaw/vydra-provider 2026.8.1-beta.2 → 2026.8.1-beta.3
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/image-generation-provider.js +15 -53
- package/dist/index.js +1 -2
- package/dist/onboard.js +1 -1
- package/dist/shared.js +66 -2
- package/dist/video-generation-provider.js +15 -62
- package/package.json +4 -4
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { DEFAULT_VYDRA_IMAGE_MODEL,
|
|
2
|
-
import { resolveGeneratedMediaMaxBytes } from "openclaw/plugin-sdk/media-generation-runtime";
|
|
1
|
+
import { DEFAULT_VYDRA_IMAGE_MODEL, runVydraGeneration } from "./shared.js";
|
|
3
2
|
import { isProviderApiKeyConfigured } from "openclaw/plugin-sdk/provider-auth";
|
|
4
|
-
import { assertOkOrThrowHttpError, postJsonRequest, readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";
|
|
5
3
|
//#region extensions/vydra/image-generation-provider.ts
|
|
6
4
|
function buildVydraImageGenerationProvider() {
|
|
7
5
|
return {
|
|
@@ -32,65 +30,29 @@ function buildVydraImageGenerationProvider() {
|
|
|
32
30
|
async generateImage(req) {
|
|
33
31
|
if ((req.inputImages?.length ?? 0) > 0) throw new Error("Vydra image generation currently supports text-to-image only in the Vydra plugin.");
|
|
34
32
|
if ((req.count ?? 1) > 1) throw new Error("Vydra image generation supports at most one image per request.");
|
|
35
|
-
const
|
|
33
|
+
const model = req.model?.trim() || "grok-imagine";
|
|
34
|
+
const generated = await runVydraGeneration({
|
|
36
35
|
cfg: req.cfg,
|
|
37
36
|
agentDir: req.agentDir,
|
|
38
37
|
authStore: req.authStore,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
42
|
-
const model = req.model?.trim() || "grok-imagine";
|
|
43
|
-
const { response, release } = await postJsonRequest({
|
|
44
|
-
url: `${baseUrl}/models/${model}`,
|
|
45
|
-
headers: requestPolicy.headers,
|
|
38
|
+
kind: "image",
|
|
39
|
+
model,
|
|
46
40
|
body: {
|
|
47
41
|
prompt: req.prompt,
|
|
48
42
|
model: "text-to-image"
|
|
49
43
|
},
|
|
50
44
|
timeoutMs: req.timeoutMs,
|
|
51
|
-
|
|
52
|
-
allowPrivateNetwork: requestPolicy.allowPrivateNetwork,
|
|
53
|
-
ssrfPolicy: requestPolicy.ssrfPolicy,
|
|
54
|
-
dispatcherPolicy: requestPolicy.dispatcherPolicy
|
|
45
|
+
ssrfPolicy: req.ssrfPolicy
|
|
55
46
|
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
missingJobIdMessage: "Vydra image generation response missing job id",
|
|
66
|
-
requestPolicy
|
|
67
|
-
});
|
|
68
|
-
const imageUrl = extractVydraResultUrls(completedPayload, "image")[0];
|
|
69
|
-
if (!imageUrl) throw new Error("Vydra image generation completed without an image URL");
|
|
70
|
-
const image = await downloadVydraAsset({
|
|
71
|
-
url: imageUrl,
|
|
72
|
-
kind: "image",
|
|
73
|
-
timeoutMs: req.timeoutMs,
|
|
74
|
-
fetchFn,
|
|
75
|
-
maxBytes: resolveGeneratedMediaMaxBytes(req.cfg, "image"),
|
|
76
|
-
requestPolicy
|
|
77
|
-
});
|
|
78
|
-
return {
|
|
79
|
-
images: [{
|
|
80
|
-
buffer: image.buffer,
|
|
81
|
-
mimeType: image.mimeType,
|
|
82
|
-
fileName: image.fileName
|
|
83
|
-
}],
|
|
84
|
-
model,
|
|
85
|
-
metadata: {
|
|
86
|
-
jobId: resolveVydraResponseJobId(completedPayload) ?? resolveVydraResponseJobId(submitted),
|
|
87
|
-
imageUrl,
|
|
88
|
-
status: resolveVydraResponseStatus(completedPayload) ?? "completed"
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
} finally {
|
|
92
|
-
await release();
|
|
93
|
-
}
|
|
47
|
+
return {
|
|
48
|
+
images: [generated.asset],
|
|
49
|
+
model,
|
|
50
|
+
metadata: {
|
|
51
|
+
jobId: generated.jobId,
|
|
52
|
+
imageUrl: generated.resultUrl,
|
|
53
|
+
status: generated.status
|
|
54
|
+
}
|
|
55
|
+
};
|
|
94
56
|
}
|
|
95
57
|
};
|
|
96
58
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { buildVydraImageGenerationProvider } from "./image-generation-provider.js";
|
|
2
|
-
import {
|
|
2
|
+
import { applyVydraConfig } from "./onboard.js";
|
|
3
3
|
import { buildVydraSpeechProvider } from "./speech-provider.js";
|
|
4
4
|
import { buildVydraVideoGenerationProvider } from "./video-generation-provider.js";
|
|
5
5
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
@@ -25,7 +25,6 @@ var vydra_default = definePluginEntry({
|
|
|
25
25
|
flagName: "--vydra-api-key",
|
|
26
26
|
envVar: "VYDRA_API_KEY",
|
|
27
27
|
promptMessage: "Enter Vydra API key",
|
|
28
|
-
defaultModel: VYDRA_DEFAULT_IMAGE_MODEL_REF,
|
|
29
28
|
expectedProviders: [PROVIDER_ID],
|
|
30
29
|
applyConfig: (cfg) => applyVydraConfig(cfg),
|
|
31
30
|
wizard: {
|
package/dist/onboard.js
CHANGED
package/dist/shared.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolveGeneratedMediaMaxBytes } from "openclaw/plugin-sdk/media-generation-runtime";
|
|
2
2
|
import { extensionForMime } from "openclaw/plugin-sdk/media-mime";
|
|
3
3
|
import { resolveApiKeyForProvider } from "openclaw/plugin-sdk/provider-auth-runtime";
|
|
4
|
+
import { assertOkOrThrowHttpError, createProviderOperationDeadline, createProviderOperationTimeoutResolver, fetchWithTimeoutGuarded, pollProviderOperationJson, postJsonRequest, readProviderJsonResponse, resolveProviderHttpRequestConfig, resolveProviderOperationTimeoutMs, sanitizeConfiguredModelProviderRequest } from "openclaw/plugin-sdk/provider-http";
|
|
4
5
|
import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
|
|
5
6
|
import { asOptionalRecord, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
7
|
//#region extensions/vydra/shared.ts
|
|
@@ -231,5 +232,68 @@ async function resolveCompletedVydraPayload(params) {
|
|
|
231
232
|
requestPolicy: params.requestPolicy
|
|
232
233
|
});
|
|
233
234
|
}
|
|
235
|
+
async function runVydraGeneration(params) {
|
|
236
|
+
const { fetchFn, baseUrl, requestPolicy } = await resolveVydraRequestContext({
|
|
237
|
+
cfg: params.cfg,
|
|
238
|
+
agentDir: params.agentDir,
|
|
239
|
+
authStore: params.authStore,
|
|
240
|
+
capability: params.kind,
|
|
241
|
+
...params.ssrfPolicy ? { ssrfPolicy: params.ssrfPolicy } : {}
|
|
242
|
+
});
|
|
243
|
+
const operationLabel = `Vydra ${params.kind} generation`;
|
|
244
|
+
const deadline = params.deadlineTimeoutMs === void 0 ? void 0 : createProviderOperationDeadline({
|
|
245
|
+
timeoutMs: params.deadlineTimeoutMs,
|
|
246
|
+
label: operationLabel
|
|
247
|
+
});
|
|
248
|
+
const timeoutMs = deadline ? resolveProviderOperationTimeoutMs({
|
|
249
|
+
deadline,
|
|
250
|
+
defaultTimeoutMs: DEFAULT_HTTP_TIMEOUT_MS
|
|
251
|
+
}) : params.timeoutMs;
|
|
252
|
+
const { response, release } = await postJsonRequest({
|
|
253
|
+
url: `${baseUrl}/models/${params.model}`,
|
|
254
|
+
headers: requestPolicy.headers,
|
|
255
|
+
body: params.body,
|
|
256
|
+
timeoutMs,
|
|
257
|
+
fetchFn,
|
|
258
|
+
allowPrivateNetwork: requestPolicy.allowPrivateNetwork,
|
|
259
|
+
...requestPolicy.ssrfPolicy ? { ssrfPolicy: requestPolicy.ssrfPolicy } : {},
|
|
260
|
+
dispatcherPolicy: requestPolicy.dispatcherPolicy
|
|
261
|
+
});
|
|
262
|
+
try {
|
|
263
|
+
await assertOkOrThrowHttpError(response, `${operationLabel} failed`);
|
|
264
|
+
const submitted = await readProviderJsonResponse(response, params.kind === "image" ? "vydra.image-generation" : operationLabel);
|
|
265
|
+
const completedPayload = await resolveCompletedVydraPayload({
|
|
266
|
+
submitted,
|
|
267
|
+
baseUrl,
|
|
268
|
+
...deadline ? { deadline } : { timeoutMs: params.timeoutMs },
|
|
269
|
+
fetchFn,
|
|
270
|
+
kind: params.kind,
|
|
271
|
+
missingJobIdMessage: `${operationLabel} response missing job id`,
|
|
272
|
+
requestPolicy
|
|
273
|
+
});
|
|
274
|
+
const resultUrl = extractVydraResultUrls(completedPayload, params.kind)[0];
|
|
275
|
+
if (!resultUrl) throw new Error(`${operationLabel} completed without a ${params.kind} URL`);
|
|
276
|
+
const asset = await downloadVydraAsset({
|
|
277
|
+
url: resultUrl,
|
|
278
|
+
kind: params.kind,
|
|
279
|
+
timeoutMs: deadline ? createProviderOperationTimeoutResolver({
|
|
280
|
+
deadline,
|
|
281
|
+
defaultTimeoutMs: DEFAULT_HTTP_TIMEOUT_MS
|
|
282
|
+
}) : params.timeoutMs,
|
|
283
|
+
fetchFn,
|
|
284
|
+
maxBytes: resolveGeneratedMediaMaxBytes(params.cfg, params.kind),
|
|
285
|
+
requestPolicy
|
|
286
|
+
});
|
|
287
|
+
const jobId = resolveVydraResponseJobId(completedPayload) ?? resolveVydraResponseJobId(submitted);
|
|
288
|
+
return {
|
|
289
|
+
asset,
|
|
290
|
+
...jobId ? { jobId } : {},
|
|
291
|
+
resultUrl,
|
|
292
|
+
status: resolveVydraResponseStatus(completedPayload) ?? "completed"
|
|
293
|
+
};
|
|
294
|
+
} finally {
|
|
295
|
+
await release();
|
|
296
|
+
}
|
|
297
|
+
}
|
|
234
298
|
//#endregion
|
|
235
|
-
export { DEFAULT_VYDRA_BASE_URL, DEFAULT_VYDRA_IMAGE_MODEL, DEFAULT_VYDRA_SPEECH_MODEL, DEFAULT_VYDRA_VIDEO_MODEL, DEFAULT_VYDRA_VOICE_ID, downloadVydraAsset, extractVydraResultUrls, normalizeVydraBaseUrl,
|
|
299
|
+
export { DEFAULT_VYDRA_BASE_URL, DEFAULT_VYDRA_IMAGE_MODEL, DEFAULT_VYDRA_SPEECH_MODEL, DEFAULT_VYDRA_VIDEO_MODEL, DEFAULT_VYDRA_VOICE_ID, downloadVydraAsset, extractVydraResultUrls, normalizeVydraBaseUrl, runVydraGeneration };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { DEFAULT_VYDRA_VIDEO_MODEL,
|
|
2
|
-
import { resolveGeneratedMediaMaxBytes } from "openclaw/plugin-sdk/media-generation-runtime";
|
|
1
|
+
import { DEFAULT_VYDRA_VIDEO_MODEL, runVydraGeneration } from "./shared.js";
|
|
3
2
|
import { isProviderApiKeyConfigured } from "openclaw/plugin-sdk/provider-auth";
|
|
4
|
-
import { assertOkOrThrowHttpError, createProviderOperationDeadline, createProviderOperationTimeoutResolver, postJsonRequest, readProviderJsonResponse, resolveProviderOperationTimeoutMs } from "openclaw/plugin-sdk/provider-http";
|
|
5
3
|
//#region extensions/vydra/video-generation-provider.ts
|
|
6
4
|
const VYDRA_KLING_MODEL = "kling";
|
|
7
5
|
const DEFAULT_VYDRA_VIDEO_TIMEOUT_MS = 12e4;
|
|
@@ -46,70 +44,25 @@ function buildVydraVideoGenerationProvider() {
|
|
|
46
44
|
},
|
|
47
45
|
async generateVideo(req) {
|
|
48
46
|
if ((req.inputVideos?.length ?? 0) > 0) throw new Error("Vydra video generation does not support video reference inputs.");
|
|
49
|
-
const {
|
|
47
|
+
const { model, body } = resolveVydraVideoRequestBody(req);
|
|
48
|
+
const generated = await runVydraGeneration({
|
|
50
49
|
cfg: req.cfg,
|
|
51
50
|
agentDir: req.agentDir,
|
|
52
51
|
authStore: req.authStore,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const deadline = createProviderOperationDeadline({
|
|
56
|
-
timeoutMs: req.timeoutMs ?? DEFAULT_VYDRA_VIDEO_TIMEOUT_MS,
|
|
57
|
-
label: "Vydra video generation"
|
|
58
|
-
});
|
|
59
|
-
const { model, body } = resolveVydraVideoRequestBody(req);
|
|
60
|
-
const { response, release } = await postJsonRequest({
|
|
61
|
-
url: `${baseUrl}/models/${model}`,
|
|
62
|
-
headers: requestPolicy.headers,
|
|
52
|
+
kind: "video",
|
|
53
|
+
model,
|
|
63
54
|
body,
|
|
64
|
-
|
|
65
|
-
deadline,
|
|
66
|
-
defaultTimeoutMs: DEFAULT_VYDRA_VIDEO_TIMEOUT_MS
|
|
67
|
-
}),
|
|
68
|
-
fetchFn,
|
|
69
|
-
allowPrivateNetwork: requestPolicy.allowPrivateNetwork,
|
|
70
|
-
dispatcherPolicy: requestPolicy.dispatcherPolicy
|
|
55
|
+
deadlineTimeoutMs: req.timeoutMs ?? DEFAULT_VYDRA_VIDEO_TIMEOUT_MS
|
|
71
56
|
});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
missingJobIdMessage: "Vydra video generation response missing job id",
|
|
82
|
-
requestPolicy
|
|
83
|
-
});
|
|
84
|
-
const videoUrl = extractVydraResultUrls(completedPayload, "video")[0];
|
|
85
|
-
if (!videoUrl) throw new Error("Vydra video generation completed without a video URL");
|
|
86
|
-
const video = await downloadVydraAsset({
|
|
87
|
-
url: videoUrl,
|
|
88
|
-
kind: "video",
|
|
89
|
-
timeoutMs: createProviderOperationTimeoutResolver({
|
|
90
|
-
deadline,
|
|
91
|
-
defaultTimeoutMs: DEFAULT_VYDRA_VIDEO_TIMEOUT_MS
|
|
92
|
-
}),
|
|
93
|
-
fetchFn,
|
|
94
|
-
maxBytes: resolveGeneratedMediaMaxBytes(req.cfg, "video"),
|
|
95
|
-
requestPolicy
|
|
96
|
-
});
|
|
97
|
-
return {
|
|
98
|
-
videos: [{
|
|
99
|
-
buffer: video.buffer,
|
|
100
|
-
mimeType: video.mimeType,
|
|
101
|
-
fileName: video.fileName
|
|
102
|
-
}],
|
|
103
|
-
model,
|
|
104
|
-
metadata: {
|
|
105
|
-
jobId: resolveVydraResponseJobId(completedPayload) ?? resolveVydraResponseJobId(submitted),
|
|
106
|
-
videoUrl,
|
|
107
|
-
status: resolveVydraResponseStatus(completedPayload) ?? "completed"
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
} finally {
|
|
111
|
-
await release();
|
|
112
|
-
}
|
|
57
|
+
return {
|
|
58
|
+
videos: [generated.asset],
|
|
59
|
+
model,
|
|
60
|
+
metadata: {
|
|
61
|
+
jobId: generated.jobId,
|
|
62
|
+
videoUrl: generated.resultUrl,
|
|
63
|
+
status: generated.status
|
|
64
|
+
}
|
|
65
|
+
};
|
|
113
66
|
}
|
|
114
67
|
};
|
|
115
68
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/vydra-provider",
|
|
3
|
-
"version": "2026.8.1-beta.
|
|
3
|
+
"version": "2026.8.1-beta.3",
|
|
4
4
|
"description": "OpenClaw Vydra media provider plugin.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"minHostVersion": ">=2026.7.2"
|
|
19
19
|
},
|
|
20
20
|
"compat": {
|
|
21
|
-
"pluginApi": ">=2026.8.1-beta.
|
|
21
|
+
"pluginApi": ">=2026.8.1-beta.3"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.8.1-beta.
|
|
24
|
+
"openclawVersion": "2026.8.1-beta.3",
|
|
25
25
|
"bundledDist": false
|
|
26
26
|
},
|
|
27
27
|
"release": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"README.md"
|
|
39
39
|
],
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"openclaw": ">=2026.8.1-beta.
|
|
41
|
+
"openclaw": ">=2026.8.1-beta.3"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"openclaw": {
|