@openclaw/vydra-provider 2026.10.10-beta.5 → 2026.11.5-beta.1
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/.source-module-urls/ca43e6b554b0372046b2e115095f26bfd38e458e7cd5198b9a164d92f8eb752a.json +1 -0
- package/dist/capability-catalog.js +1 -2
- package/dist/defaults.js +1 -2
- package/dist/index.js +109 -8
- package/dist/shared.js +58 -74
- package/dist/speech-provider.js +36 -44
- package/package.json +4 -4
- package/dist/.source-module-urls/2c1faa35ebd46bec125b8b8bccd03226406999b1decc18943eea378aacc24dc6.json +0 -1
- package/dist/image-generation-provider.js +0 -61
- package/dist/onboard.js +0 -20
- package/dist/video-generation-provider.js +0 -58
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"entries":[{"output":"capability-catalog.js","source":"extensions/vydra/capability-catalog.ts"},{"output":"defaults.js","source":"extensions/vydra/defaults.ts"},{"output":"index.js","source":"extensions/vydra/index.ts"},{"output":"shared.js","source":"extensions/vydra/shared.ts"},{"output":"speech-provider.js","source":"extensions/vydra/speech-provider.ts"}],"chunks":[{"output":"capability-catalog.js","sha256":"c0c31bd1d174b72f836efe230fe07dd689d977ac52fdfb8ed0b8cb6aff38cc1d","facadeSource":"extensions/vydra/capability-catalog.ts","sources":["extensions/vydra/capability-catalog.ts"]},{"output":"defaults.js","sha256":"75a8fef3a463172d9403acdddbaa50913febcc4a2d325602950d84dbd2f52f81","facadeSource":"extensions/vydra/defaults.ts","sources":["extensions/vydra/defaults.ts"]},{"output":"index.js","sha256":"85528e5c1458586abd6bf678dfb222a8938728eab5a151b6e7dbfe8fe327c514","facadeSource":"extensions/vydra/index.ts","sources":["extensions/vydra/index.ts"]},{"output":"shared.js","sha256":"d101a7c39f03d7531f12c2a98af77052e979983f26958d6edd91b2b5b944b248","facadeSource":"extensions/vydra/shared.ts","sources":["extensions/vydra/shared.ts"]},{"output":"speech-provider.js","sha256":"9af002cddfd237b18317f36f7298d7702c9b36212cdfc3903313b7ae89f47aa3","facadeSource":"extensions/vydra/speech-provider.ts","sources":["extensions/vydra/speech-provider.ts"]}],"unrenderedSources":[]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { buildVydraSpeechProvider } from "./speech-provider.js";
|
|
2
|
-
|
|
2
|
+
// extensions/vydra/capability-catalog.ts
|
|
3
3
|
var capability_catalog_default = { speechProviders: [buildVydraSpeechProvider()] };
|
|
4
|
-
//#endregion
|
|
5
4
|
export { capability_catalog_default as default };
|
package/dist/defaults.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
-
|
|
2
|
+
// extensions/vydra/defaults.ts
|
|
3
3
|
const DEFAULT_VYDRA_BASE_URL = "https://www.vydra.ai/api/v1";
|
|
4
4
|
const DEFAULT_VYDRA_IMAGE_MODEL = "grok-imagine";
|
|
5
5
|
const DEFAULT_VYDRA_VIDEO_MODEL = "veo3";
|
|
@@ -13,5 +13,4 @@ function normalizeVydraBaseUrl(value) {
|
|
|
13
13
|
url.pathname = url.pathname.replace(/\/+$/u, "") || "/api/v1";
|
|
14
14
|
return url.toString().replace(/\/$/u, "");
|
|
15
15
|
}
|
|
16
|
-
//#endregion
|
|
17
16
|
export { DEFAULT_VYDRA_BASE_URL, DEFAULT_VYDRA_IMAGE_MODEL, DEFAULT_VYDRA_SPEECH_MODEL, DEFAULT_VYDRA_VIDEO_MODEL, DEFAULT_VYDRA_VOICE_ID, normalizeVydraBaseUrl };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { DEFAULT_VYDRA_IMAGE_MODEL, DEFAULT_VYDRA_VIDEO_MODEL } from "./defaults.js";
|
|
2
|
+
import { runVydraGeneration } from "./shared.js";
|
|
3
3
|
import { buildVydraSpeechProvider } from "./speech-provider.js";
|
|
4
|
-
import { buildVydraVideoGenerationProvider } from "./video-generation-provider.js";
|
|
5
4
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
5
|
+
import { isProviderApiKeyConfiguredAsync } from "openclaw/plugin-sdk/provider-auth";
|
|
6
6
|
import { createProviderApiKeyAuthMethod } from "openclaw/plugin-sdk/provider-auth-api-key";
|
|
7
|
-
|
|
7
|
+
import { applyAgentDefaultMediaModel } from "openclaw/plugin-sdk/provider-onboard";
|
|
8
|
+
// extensions/vydra/index.ts
|
|
8
9
|
const PROVIDER_ID = "vydra";
|
|
10
|
+
const VYDRA_KLING_MODEL = "kling";
|
|
11
|
+
const DEFAULT_VYDRA_VIDEO_TIMEOUT_MS = 12e4;
|
|
9
12
|
var vydra_default = definePluginEntry({
|
|
10
13
|
id: PROVIDER_ID,
|
|
11
14
|
name: "Vydra Provider",
|
|
@@ -26,7 +29,7 @@ var vydra_default = definePluginEntry({
|
|
|
26
29
|
envVar: "VYDRA_API_KEY",
|
|
27
30
|
promptMessage: "Enter Vydra API key",
|
|
28
31
|
expectedProviders: [PROVIDER_ID],
|
|
29
|
-
applyConfig: (cfg) =>
|
|
32
|
+
applyConfig: (cfg) => applyAgentDefaultMediaModel(cfg, "image", "vydra/grok-imagine"),
|
|
30
33
|
wizard: {
|
|
31
34
|
choiceId: "vydra-api-key",
|
|
32
35
|
choiceLabel: "Vydra API key",
|
|
@@ -39,9 +42,107 @@ var vydra_default = definePluginEntry({
|
|
|
39
42
|
})]
|
|
40
43
|
});
|
|
41
44
|
api.registerSpeechProvider(buildVydraSpeechProvider());
|
|
42
|
-
api.registerImageGenerationProvider(
|
|
43
|
-
|
|
45
|
+
api.registerImageGenerationProvider({
|
|
46
|
+
id: "vydra",
|
|
47
|
+
label: "Vydra",
|
|
48
|
+
defaultModel: DEFAULT_VYDRA_IMAGE_MODEL,
|
|
49
|
+
models: [DEFAULT_VYDRA_IMAGE_MODEL],
|
|
50
|
+
isConfiguredAsync: (ctx) => isProviderApiKeyConfiguredAsync({
|
|
51
|
+
provider: "vydra",
|
|
52
|
+
...ctx
|
|
53
|
+
}),
|
|
54
|
+
capabilities: {
|
|
55
|
+
generate: {
|
|
56
|
+
maxCount: 1,
|
|
57
|
+
supportsSize: false,
|
|
58
|
+
supportsAspectRatio: false,
|
|
59
|
+
supportsResolution: false
|
|
60
|
+
},
|
|
61
|
+
edit: {
|
|
62
|
+
enabled: false,
|
|
63
|
+
maxCount: 1,
|
|
64
|
+
maxInputImages: 0,
|
|
65
|
+
supportsSize: false,
|
|
66
|
+
supportsAspectRatio: false,
|
|
67
|
+
supportsResolution: false
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
async generateImage(req) {
|
|
71
|
+
if ((req.inputImages?.length ?? 0) > 0) throw new Error("Vydra image generation currently supports text-to-image only in the Vydra plugin.");
|
|
72
|
+
if ((req.count ?? 1) > 1) throw new Error("Vydra image generation supports at most one image per request.");
|
|
73
|
+
const model = req.model?.trim() || "grok-imagine";
|
|
74
|
+
const generated = await runVydraGeneration({
|
|
75
|
+
cfg: req.cfg,
|
|
76
|
+
agentDir: req.agentDir,
|
|
77
|
+
authStore: req.authStore,
|
|
78
|
+
kind: "image",
|
|
79
|
+
model,
|
|
80
|
+
body: {
|
|
81
|
+
prompt: req.prompt,
|
|
82
|
+
model: "text-to-image"
|
|
83
|
+
},
|
|
84
|
+
timeoutMs: req.timeoutMs,
|
|
85
|
+
ssrfPolicy: req.ssrfPolicy
|
|
86
|
+
});
|
|
87
|
+
return {
|
|
88
|
+
images: [generated.asset],
|
|
89
|
+
model,
|
|
90
|
+
metadata: {
|
|
91
|
+
jobId: generated.jobId,
|
|
92
|
+
imageUrl: generated.resultUrl,
|
|
93
|
+
status: generated.status
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
api.registerVideoGenerationProvider({
|
|
99
|
+
id: "vydra",
|
|
100
|
+
label: "Vydra",
|
|
101
|
+
defaultModel: DEFAULT_VYDRA_VIDEO_MODEL,
|
|
102
|
+
models: [DEFAULT_VYDRA_VIDEO_MODEL, VYDRA_KLING_MODEL],
|
|
103
|
+
isConfiguredAsync: (ctx) => isProviderApiKeyConfiguredAsync({
|
|
104
|
+
provider: "vydra",
|
|
105
|
+
...ctx
|
|
106
|
+
}),
|
|
107
|
+
capabilities: {
|
|
108
|
+
generate: { maxVideos: 1 },
|
|
109
|
+
imageToVideo: {
|
|
110
|
+
enabled: true,
|
|
111
|
+
maxVideos: 1,
|
|
112
|
+
maxInputImages: 1
|
|
113
|
+
},
|
|
114
|
+
videoToVideo: { enabled: false }
|
|
115
|
+
},
|
|
116
|
+
async generateVideo(req) {
|
|
117
|
+
if ((req.inputVideos?.length ?? 0) > 0) throw new Error("Vydra video generation does not support video reference inputs.");
|
|
118
|
+
const model = req.model?.trim() || "veo3";
|
|
119
|
+
const body = { prompt: req.prompt };
|
|
120
|
+
if (model === VYDRA_KLING_MODEL) {
|
|
121
|
+
const imageUrl = req.inputImages?.[0]?.url?.trim();
|
|
122
|
+
if (!imageUrl) throw new Error("Vydra kling currently requires a remote image URL reference.");
|
|
123
|
+
body.image_url = imageUrl;
|
|
124
|
+
body.video_url = imageUrl;
|
|
125
|
+
} else if ((req.inputImages?.length ?? 0) > 0) throw new Error(`Vydra ${model} does not support image reference inputs in the Vydra plugin.`);
|
|
126
|
+
const generated = await runVydraGeneration({
|
|
127
|
+
cfg: req.cfg,
|
|
128
|
+
agentDir: req.agentDir,
|
|
129
|
+
authStore: req.authStore,
|
|
130
|
+
kind: "video",
|
|
131
|
+
model,
|
|
132
|
+
body,
|
|
133
|
+
deadlineTimeoutMs: req.timeoutMs ?? DEFAULT_VYDRA_VIDEO_TIMEOUT_MS
|
|
134
|
+
});
|
|
135
|
+
return {
|
|
136
|
+
videos: [generated.asset],
|
|
137
|
+
model,
|
|
138
|
+
metadata: {
|
|
139
|
+
jobId: generated.jobId,
|
|
140
|
+
videoUrl: generated.resultUrl,
|
|
141
|
+
status: generated.status
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
});
|
|
44
146
|
}
|
|
45
147
|
});
|
|
46
|
-
//#endregion
|
|
47
148
|
export { vydra_default as default };
|
package/dist/shared.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { DEFAULT_VYDRA_BASE_URL, normalizeVydraBaseUrl } from "./defaults.js";
|
|
2
2
|
import { asOptionalRecord, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
-
import { resolveGeneratedMediaMaxBytes } from "openclaw/plugin-sdk/media-generation-runtime";
|
|
3
|
+
import { resolveGeneratedImageDownloadMaxBytes, resolveGeneratedMediaMaxBytes } from "openclaw/plugin-sdk/media-generation-runtime";
|
|
4
4
|
import { extensionForMime } from "openclaw/plugin-sdk/media-mime";
|
|
5
|
-
import {
|
|
6
|
-
import { assertOkOrThrowHttpError, createProviderOperationDeadline, createProviderOperationTimeoutError, createProviderOperationTimeoutResolver, fetchWithTimeoutGuarded, pollProviderOperationJson,
|
|
7
|
-
|
|
5
|
+
import { resolvePositiveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
6
|
+
import { assertOkOrThrowHttpError, createProviderOperationDeadline, createProviderOperationTimeoutError, createProviderOperationTimeoutResolver, fetchWithTimeoutGuarded, pollProviderOperationJson, postJsonResponse, readProviderBinaryResponse, resolveProviderApiKeyHttpRequestConfig, resolveProviderOperationTimeoutMs, sanitizeConfiguredModelProviderRequest } from "openclaw/plugin-sdk/provider-http";
|
|
7
|
+
// extensions/vydra/shared.ts
|
|
8
8
|
const DEFAULT_HTTP_TIMEOUT_MS = 12e4;
|
|
9
9
|
const POLL_INTERVAL_MS = 2500;
|
|
10
10
|
const MAX_POLL_ATTEMPTS = 120;
|
|
@@ -67,7 +67,7 @@ function extractVydraResultUrls(payload, kind) {
|
|
|
67
67
|
}
|
|
68
68
|
async function downloadVydraAsset(params) {
|
|
69
69
|
const requestedTimeoutMs = typeof params.timeoutMs === "function" ? params.timeoutMs() : params.timeoutMs;
|
|
70
|
-
const timeoutMs =
|
|
70
|
+
const timeoutMs = resolvePositiveTimerTimeoutMs(requestedTimeoutMs, DEFAULT_HTTP_TIMEOUT_MS);
|
|
71
71
|
const deadline = createProviderOperationDeadline({
|
|
72
72
|
timeoutMs,
|
|
73
73
|
label: `Vydra ${params.kind} download`
|
|
@@ -85,7 +85,7 @@ async function downloadVydraAsset(params) {
|
|
|
85
85
|
const result = await fetchWithTimeoutGuarded(params.url, {
|
|
86
86
|
method: "GET",
|
|
87
87
|
...headers ? { headers } : {}
|
|
88
|
-
}, resolveTimeoutMs(),
|
|
88
|
+
}, resolveTimeoutMs(), fetch, {
|
|
89
89
|
...ssrfPolicy ? { ssrfPolicy } : {},
|
|
90
90
|
...policy.dispatcherPolicy ? { dispatcherPolicy: policy.dispatcherPolicy } : {},
|
|
91
91
|
auditContext: "vydra-media-download"
|
|
@@ -117,25 +117,15 @@ async function downloadVydraAsset(params) {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
async function runVydraGeneration(params) {
|
|
120
|
-
const auth = await resolveApiKeyForProvider({
|
|
121
|
-
provider: "vydra",
|
|
122
|
-
cfg: params.cfg,
|
|
123
|
-
agentDir: params.agentDir,
|
|
124
|
-
store: params.authStore
|
|
125
|
-
});
|
|
126
|
-
if (!auth.apiKey) throw new Error("Vydra API key missing");
|
|
127
120
|
const fetchFn = fetch;
|
|
128
121
|
const providerConfig = params.cfg.models?.providers?.vydra;
|
|
129
|
-
const { baseUrl, ...http } =
|
|
122
|
+
const { baseUrl, ...http } = await resolveProviderApiKeyHttpRequestConfig({
|
|
123
|
+
req: params,
|
|
124
|
+
missingApiKeyMessage: "Vydra API key missing",
|
|
130
125
|
baseUrl: normalizeVydraBaseUrl(providerConfig?.baseUrl),
|
|
131
126
|
defaultBaseUrl: DEFAULT_VYDRA_BASE_URL,
|
|
132
|
-
defaultHeaders: {
|
|
133
|
-
Authorization: `Bearer ${auth.apiKey}`,
|
|
134
|
-
"Content-Type": "application/json"
|
|
135
|
-
},
|
|
136
127
|
provider: "vydra",
|
|
137
128
|
capability: params.kind,
|
|
138
|
-
transport: "http",
|
|
139
129
|
request: sanitizeConfiguredModelProviderRequest(providerConfig?.request)
|
|
140
130
|
});
|
|
141
131
|
const requestPolicy = {
|
|
@@ -152,7 +142,7 @@ async function runVydraGeneration(params) {
|
|
|
152
142
|
deadline,
|
|
153
143
|
defaultTimeoutMs: DEFAULT_HTTP_TIMEOUT_MS
|
|
154
144
|
}) : params.timeoutMs;
|
|
155
|
-
const
|
|
145
|
+
const submitted = await postJsonResponse({
|
|
156
146
|
url: `${baseUrl}/models/${params.model}`,
|
|
157
147
|
headers: requestPolicy.headers,
|
|
158
148
|
body: params.body,
|
|
@@ -160,63 +150,57 @@ async function runVydraGeneration(params) {
|
|
|
160
150
|
fetchFn,
|
|
161
151
|
allowPrivateNetwork: requestPolicy.allowPrivateNetwork,
|
|
162
152
|
...requestPolicy.ssrfPolicy ? { ssrfPolicy: requestPolicy.ssrfPolicy } : {},
|
|
163
|
-
dispatcherPolicy: requestPolicy.dispatcherPolicy
|
|
153
|
+
dispatcherPolicy: requestPolicy.dispatcherPolicy,
|
|
154
|
+
errorLabel: `${operationLabel} failed`,
|
|
155
|
+
responseLabel: params.kind === "image" ? "vydra.image-generation" : operationLabel
|
|
164
156
|
});
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
label: `Vydra job ${jobId}`
|
|
179
|
-
}),
|
|
180
|
-
defaultTimeoutMs: DEFAULT_HTTP_TIMEOUT_MS,
|
|
181
|
-
fetchFn,
|
|
182
|
-
maxAttempts: MAX_POLL_ATTEMPTS,
|
|
183
|
-
pollIntervalMs: POLL_INTERVAL_MS,
|
|
184
|
-
requestFailedMessage: "Vydra job status request failed",
|
|
185
|
-
timeoutMessage: `Vydra job ${jobId} did not finish in time`,
|
|
186
|
-
allowPrivateNetwork: requestPolicy.allowPrivateNetwork,
|
|
187
|
-
ssrfPolicy: requestPolicy.ssrfPolicy,
|
|
188
|
-
dispatcherPolicy: requestPolicy.dispatcherPolicy,
|
|
189
|
-
auditContext: "vydra-job-status",
|
|
190
|
-
isComplete,
|
|
191
|
-
getFailureMessage: (payload) => {
|
|
192
|
-
const status = resolveVydraResponseStatus(payload);
|
|
193
|
-
return status === "failed" || status === "error" || status === "cancelled" ? resolveVydraErrorMessage(payload) ?? `Vydra job ${jobId} failed` : void 0;
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
const resultUrl = extractVydraResultUrls(completedPayload, params.kind)[0];
|
|
198
|
-
if (!resultUrl) throw new Error(`${operationLabel} completed without a ${params.kind} URL`);
|
|
199
|
-
const asset = await downloadVydraAsset({
|
|
200
|
-
url: resultUrl,
|
|
201
|
-
kind: params.kind,
|
|
202
|
-
timeoutMs: deadline ? createProviderOperationTimeoutResolver({
|
|
203
|
-
deadline,
|
|
204
|
-
defaultTimeoutMs: DEFAULT_HTTP_TIMEOUT_MS
|
|
205
|
-
}) : params.timeoutMs,
|
|
157
|
+
const isComplete = (payload) => resolveVydraResponseStatus(payload) === "completed" || extractVydraResultUrls(payload, params.kind).length > 0;
|
|
158
|
+
let completedPayload = submitted;
|
|
159
|
+
if (!isComplete(submitted)) {
|
|
160
|
+
const jobId = resolveVydraResponseJobId(submitted);
|
|
161
|
+
if (!jobId) throw new Error(resolveVydraErrorMessage(submitted) ?? `${operationLabel} response missing job id`);
|
|
162
|
+
completedPayload = await pollProviderOperationJson({
|
|
163
|
+
url: `${baseUrl}/jobs/${jobId}`,
|
|
164
|
+
headers: requestPolicy.headers,
|
|
165
|
+
deadline: deadline ?? createProviderOperationDeadline({
|
|
166
|
+
timeoutMs: params.timeoutMs,
|
|
167
|
+
label: `Vydra job ${jobId}`
|
|
168
|
+
}),
|
|
169
|
+
defaultTimeoutMs: DEFAULT_HTTP_TIMEOUT_MS,
|
|
206
170
|
fetchFn,
|
|
207
|
-
|
|
208
|
-
|
|
171
|
+
maxAttempts: MAX_POLL_ATTEMPTS,
|
|
172
|
+
pollIntervalMs: POLL_INTERVAL_MS,
|
|
173
|
+
requestFailedMessage: "Vydra job status request failed",
|
|
174
|
+
timeoutMessage: `Vydra job ${jobId} did not finish in time`,
|
|
175
|
+
allowPrivateNetwork: requestPolicy.allowPrivateNetwork,
|
|
176
|
+
ssrfPolicy: requestPolicy.ssrfPolicy,
|
|
177
|
+
dispatcherPolicy: requestPolicy.dispatcherPolicy,
|
|
178
|
+
auditContext: "vydra-job-status",
|
|
179
|
+
isComplete,
|
|
180
|
+
getFailureMessage: (payload) => {
|
|
181
|
+
const status = resolveVydraResponseStatus(payload);
|
|
182
|
+
return status === "failed" || status === "error" || status === "cancelled" ? resolveVydraErrorMessage(payload) ?? `Vydra job ${jobId} failed` : void 0;
|
|
183
|
+
}
|
|
209
184
|
});
|
|
210
|
-
const jobId = resolveVydraResponseJobId(completedPayload) ?? resolveVydraResponseJobId(submitted);
|
|
211
|
-
return {
|
|
212
|
-
asset,
|
|
213
|
-
...jobId ? { jobId } : {},
|
|
214
|
-
resultUrl,
|
|
215
|
-
status: resolveVydraResponseStatus(completedPayload) ?? "completed"
|
|
216
|
-
};
|
|
217
|
-
} finally {
|
|
218
|
-
await release();
|
|
219
185
|
}
|
|
186
|
+
const resultUrl = extractVydraResultUrls(completedPayload, params.kind)[0];
|
|
187
|
+
if (!resultUrl) throw new Error(`${operationLabel} completed without a ${params.kind} URL`);
|
|
188
|
+
const asset = await downloadVydraAsset({
|
|
189
|
+
url: resultUrl,
|
|
190
|
+
kind: params.kind,
|
|
191
|
+
timeoutMs: deadline ? createProviderOperationTimeoutResolver({
|
|
192
|
+
deadline,
|
|
193
|
+
defaultTimeoutMs: DEFAULT_HTTP_TIMEOUT_MS
|
|
194
|
+
}) : params.timeoutMs,
|
|
195
|
+
maxBytes: params.kind === "image" ? resolveGeneratedImageDownloadMaxBytes(params.cfg) : resolveGeneratedMediaMaxBytes(params.cfg, params.kind),
|
|
196
|
+
requestPolicy
|
|
197
|
+
});
|
|
198
|
+
const jobId = resolveVydraResponseJobId(completedPayload) ?? resolveVydraResponseJobId(submitted);
|
|
199
|
+
return {
|
|
200
|
+
asset,
|
|
201
|
+
...jobId ? { jobId } : {},
|
|
202
|
+
resultUrl,
|
|
203
|
+
status: resolveVydraResponseStatus(completedPayload) ?? "completed"
|
|
204
|
+
};
|
|
220
205
|
}
|
|
221
|
-
//#endregion
|
|
222
206
|
export { downloadVydraAsset, extractVydraResultUrls, runVydraGeneration };
|
package/dist/speech-provider.js
CHANGED
|
@@ -2,31 +2,29 @@ import { DEFAULT_VYDRA_BASE_URL, DEFAULT_VYDRA_SPEECH_MODEL, DEFAULT_VYDRA_VOICE
|
|
|
2
2
|
import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
4
4
|
import { resolveSpeechProviderApiKey } from "openclaw/plugin-sdk/speech-provider";
|
|
5
|
-
|
|
5
|
+
// extensions/vydra/speech-provider.ts
|
|
6
6
|
const VYDRA_SPEECH_VOICES = [{
|
|
7
7
|
id: DEFAULT_VYDRA_VOICE_ID,
|
|
8
8
|
name: "Rachel"
|
|
9
9
|
}];
|
|
10
10
|
function normalizeVydraSpeechConfig(rawConfig) {
|
|
11
11
|
const providers = asOptionalRecord(rawConfig.providers);
|
|
12
|
-
const raw = asOptionalRecord(providers?.vydra)
|
|
12
|
+
const raw = asOptionalRecord(providers?.vydra);
|
|
13
|
+
const apiKey = normalizeResolvedSecretInputString({
|
|
14
|
+
value: raw?.apiKey,
|
|
15
|
+
path: "tts.providers.vydra.apiKey"
|
|
16
|
+
});
|
|
13
17
|
return {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
path: "tts.providers.vydra.apiKey"
|
|
17
|
-
}),
|
|
18
|
-
baseUrl: normalizeVydraBaseUrl(normalizeOptionalString(raw?.baseUrl) ?? normalizeOptionalString(process.env.VYDRA_BASE_URL)),
|
|
19
|
-
model: normalizeOptionalString(raw?.model) ?? normalizeOptionalString(process.env.VYDRA_TTS_MODEL) ?? "elevenlabs/tts",
|
|
20
|
-
voiceId: normalizeOptionalString(raw?.voiceId) ?? normalizeOptionalString(process.env.VYDRA_TTS_VOICE_ID) ?? "21m00Tcm4TlvDq8ikWAM"
|
|
18
|
+
...readVydraSpeechConfig(raw ?? {}),
|
|
19
|
+
apiKey
|
|
21
20
|
};
|
|
22
21
|
}
|
|
23
22
|
function readVydraSpeechConfig(config) {
|
|
24
|
-
const normalized = normalizeVydraSpeechConfig({});
|
|
25
23
|
return {
|
|
26
|
-
apiKey: normalizeOptionalString(config.apiKey)
|
|
27
|
-
baseUrl: normalizeVydraBaseUrl(normalizeOptionalString(config.baseUrl) ??
|
|
28
|
-
model: normalizeOptionalString(config.model) ??
|
|
29
|
-
voiceId: normalizeOptionalString(config.voiceId) ??
|
|
24
|
+
apiKey: normalizeOptionalString(config.apiKey),
|
|
25
|
+
baseUrl: normalizeVydraBaseUrl(normalizeOptionalString(config.baseUrl) ?? normalizeOptionalString(process.env.VYDRA_BASE_URL)),
|
|
26
|
+
model: normalizeOptionalString(config.model) ?? normalizeOptionalString(process.env.VYDRA_TTS_MODEL) ?? "elevenlabs/tts",
|
|
27
|
+
voiceId: normalizeOptionalString(config.voiceId) ?? normalizeOptionalString(process.env.VYDRA_TTS_VOICE_ID) ?? "21m00Tcm4TlvDq8ikWAM"
|
|
30
28
|
};
|
|
31
29
|
}
|
|
32
30
|
function buildVydraSpeechProvider() {
|
|
@@ -47,7 +45,7 @@ function buildVydraSpeechProvider() {
|
|
|
47
45
|
const apiKey = resolveSpeechProviderApiKey(config.apiKey, process.env.VYDRA_API_KEY);
|
|
48
46
|
if (!apiKey) throw new Error("Vydra API key missing");
|
|
49
47
|
const { resolveGeneratedMediaMaxBytes } = await import("openclaw/plugin-sdk/media-generation-runtime");
|
|
50
|
-
const {
|
|
48
|
+
const { postJsonResponse, resolveProviderHttpRequestConfig } = await import("openclaw/plugin-sdk/provider-http");
|
|
51
49
|
const fetchFn = fetch;
|
|
52
50
|
const { baseUrl, allowPrivateNetwork, headers, dispatcherPolicy } = resolveProviderHttpRequestConfig({
|
|
53
51
|
baseUrl: config.baseUrl,
|
|
@@ -61,7 +59,7 @@ function buildVydraSpeechProvider() {
|
|
|
61
59
|
capability: "audio",
|
|
62
60
|
transport: "http"
|
|
63
61
|
});
|
|
64
|
-
const
|
|
62
|
+
const audioUrl = extractVydraResultUrls(await postJsonResponse({
|
|
65
63
|
url: `${baseUrl}/models/${normalizeOptionalString(overrides?.model) ?? config.model}`,
|
|
66
64
|
headers,
|
|
67
65
|
body: {
|
|
@@ -71,36 +69,30 @@ function buildVydraSpeechProvider() {
|
|
|
71
69
|
timeoutMs: req.timeoutMs,
|
|
72
70
|
fetchFn,
|
|
73
71
|
allowPrivateNetwork,
|
|
74
|
-
dispatcherPolicy
|
|
72
|
+
dispatcherPolicy,
|
|
73
|
+
errorLabel: "Vydra speech synthesis failed",
|
|
74
|
+
responseLabel: "Vydra speech synthesis"
|
|
75
|
+
}), "audio")[0];
|
|
76
|
+
if (!audioUrl) throw new Error("Vydra speech synthesis response missing audio URL");
|
|
77
|
+
const audio = await downloadVydraAsset({
|
|
78
|
+
url: audioUrl,
|
|
79
|
+
kind: "audio",
|
|
80
|
+
timeoutMs: req.timeoutMs,
|
|
81
|
+
maxBytes: resolveGeneratedMediaMaxBytes(req.cfg, "audio"),
|
|
82
|
+
requestPolicy: {
|
|
83
|
+
allowPrivateNetwork,
|
|
84
|
+
dispatcherPolicy,
|
|
85
|
+
headers,
|
|
86
|
+
headerOrigin: new URL(baseUrl).origin
|
|
87
|
+
}
|
|
75
88
|
});
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
kind: "audio",
|
|
83
|
-
timeoutMs: req.timeoutMs,
|
|
84
|
-
fetchFn,
|
|
85
|
-
maxBytes: resolveGeneratedMediaMaxBytes(req.cfg, "audio"),
|
|
86
|
-
requestPolicy: {
|
|
87
|
-
allowPrivateNetwork,
|
|
88
|
-
dispatcherPolicy,
|
|
89
|
-
headers,
|
|
90
|
-
headerOrigin: new URL(baseUrl).origin
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
return {
|
|
94
|
-
audioBuffer: audio.buffer,
|
|
95
|
-
outputFormat: audio.mimeType.includes("wav") ? "wav" : "mp3",
|
|
96
|
-
fileExtension: audio.fileName.endsWith(".wav") ? ".wav" : ".mp3",
|
|
97
|
-
voiceCompatible: false
|
|
98
|
-
};
|
|
99
|
-
} finally {
|
|
100
|
-
await release();
|
|
101
|
-
}
|
|
89
|
+
return {
|
|
90
|
+
audioBuffer: audio.buffer,
|
|
91
|
+
outputFormat: audio.mimeType.includes("wav") ? "wav" : "mp3",
|
|
92
|
+
fileExtension: audio.fileName.endsWith(".wav") ? ".wav" : ".mp3",
|
|
93
|
+
voiceCompatible: false
|
|
94
|
+
};
|
|
102
95
|
}
|
|
103
96
|
};
|
|
104
97
|
}
|
|
105
|
-
//#endregion
|
|
106
98
|
export { buildVydraSpeechProvider };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/vydra-provider",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.11.5-beta.1",
|
|
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.
|
|
21
|
+
"pluginApi": ">=2026.11.5-beta.1"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.
|
|
24
|
+
"openclawVersion": "2026.11.5-beta.1",
|
|
25
25
|
"bundledDist": false
|
|
26
26
|
},
|
|
27
27
|
"release": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"assets/activity.svg"
|
|
41
41
|
],
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"openclaw": ">=2026.
|
|
43
|
+
"openclaw": ">=2026.11.5-beta.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependenciesMeta": {
|
|
46
46
|
"openclaw": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"entries":[{"output":"capability-catalog.js","source":"extensions/vydra/capability-catalog.ts"},{"output":"defaults.js","source":"extensions/vydra/defaults.ts"},{"output":"image-generation-provider.js","source":"extensions/vydra/image-generation-provider.ts"},{"output":"index.js","source":"extensions/vydra/index.ts"},{"output":"onboard.js","source":"extensions/vydra/onboard.ts"},{"output":"shared.js","source":"extensions/vydra/shared.ts"},{"output":"speech-provider.js","source":"extensions/vydra/speech-provider.ts"},{"output":"video-generation-provider.js","source":"extensions/vydra/video-generation-provider.ts"}],"chunks":[{"output":"capability-catalog.js","sha256":"0f526119b1d06457b1da019d2715dcfe38aa3669f14d49c10d3149896eefc6f2","facadeSource":"extensions/vydra/capability-catalog.ts","sources":["extensions/vydra/capability-catalog.ts"]},{"output":"defaults.js","sha256":"7bfabc9c60df0ebd7036ff8ad11019e6a703a3a04683d1f8c63d6ad0554a3f8a","facadeSource":"extensions/vydra/defaults.ts","sources":["extensions/vydra/defaults.ts"]},{"output":"image-generation-provider.js","sha256":"4a497544e4b57b97882a5c3dbbea827355fc219fa048fbb312dbd73680d1bc2f","facadeSource":"extensions/vydra/image-generation-provider.ts","sources":["extensions/vydra/image-generation-provider.ts"]},{"output":"index.js","sha256":"03aa4c04fc4869ce9919e0e4f32bec88cb42f930f5c8a343e77523d645032dd6","facadeSource":"extensions/vydra/index.ts","sources":["extensions/vydra/index.ts"]},{"output":"onboard.js","sha256":"1ad4e158d8e78f9d99c4f22a5955acef3be92cad87487f4a3596f14b7e65ff91","facadeSource":"extensions/vydra/onboard.ts","sources":["extensions/vydra/onboard.ts"]},{"output":"shared.js","sha256":"4dfc45e80d9bb7bc65692cdc5e5ab3d0f51541edaaf7e096a4f9b00be19c3147","facadeSource":"extensions/vydra/shared.ts","sources":["extensions/vydra/shared.ts"]},{"output":"speech-provider.js","sha256":"beb726f2155149d6283a38b50cbd71b8fbe5d79afd353064eb58ae1f9886c5f7","facadeSource":"extensions/vydra/speech-provider.ts","sources":["extensions/vydra/speech-provider.ts"]},{"output":"video-generation-provider.js","sha256":"307cf72078cb0b7fffbfde779a44277d8a9611db590cbfd7fd47cdd71cd06465","facadeSource":"extensions/vydra/video-generation-provider.ts","sources":["extensions/vydra/video-generation-provider.ts"]}],"unrenderedSources":[]}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_VYDRA_IMAGE_MODEL } from "./defaults.js";
|
|
2
|
-
import { runVydraGeneration } from "./shared.js";
|
|
3
|
-
import { isProviderApiKeyConfiguredAsync } from "openclaw/plugin-sdk/provider-auth";
|
|
4
|
-
//#region extensions/vydra/image-generation-provider.ts
|
|
5
|
-
function buildVydraImageGenerationProvider() {
|
|
6
|
-
return {
|
|
7
|
-
id: "vydra",
|
|
8
|
-
label: "Vydra",
|
|
9
|
-
defaultModel: DEFAULT_VYDRA_IMAGE_MODEL,
|
|
10
|
-
models: [DEFAULT_VYDRA_IMAGE_MODEL],
|
|
11
|
-
isConfiguredAsync: (ctx) => isProviderApiKeyConfiguredAsync({
|
|
12
|
-
provider: "vydra",
|
|
13
|
-
...ctx
|
|
14
|
-
}),
|
|
15
|
-
capabilities: {
|
|
16
|
-
generate: {
|
|
17
|
-
maxCount: 1,
|
|
18
|
-
supportsSize: false,
|
|
19
|
-
supportsAspectRatio: false,
|
|
20
|
-
supportsResolution: false
|
|
21
|
-
},
|
|
22
|
-
edit: {
|
|
23
|
-
enabled: false,
|
|
24
|
-
maxCount: 1,
|
|
25
|
-
maxInputImages: 0,
|
|
26
|
-
supportsSize: false,
|
|
27
|
-
supportsAspectRatio: false,
|
|
28
|
-
supportsResolution: false
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
async generateImage(req) {
|
|
32
|
-
if ((req.inputImages?.length ?? 0) > 0) throw new Error("Vydra image generation currently supports text-to-image only in the Vydra plugin.");
|
|
33
|
-
if ((req.count ?? 1) > 1) throw new Error("Vydra image generation supports at most one image per request.");
|
|
34
|
-
const model = req.model?.trim() || "grok-imagine";
|
|
35
|
-
const generated = await runVydraGeneration({
|
|
36
|
-
cfg: req.cfg,
|
|
37
|
-
agentDir: req.agentDir,
|
|
38
|
-
authStore: req.authStore,
|
|
39
|
-
kind: "image",
|
|
40
|
-
model,
|
|
41
|
-
body: {
|
|
42
|
-
prompt: req.prompt,
|
|
43
|
-
model: "text-to-image"
|
|
44
|
-
},
|
|
45
|
-
timeoutMs: req.timeoutMs,
|
|
46
|
-
ssrfPolicy: req.ssrfPolicy
|
|
47
|
-
});
|
|
48
|
-
return {
|
|
49
|
-
images: [generated.asset],
|
|
50
|
-
model,
|
|
51
|
-
metadata: {
|
|
52
|
-
jobId: generated.jobId,
|
|
53
|
-
imageUrl: generated.resultUrl,
|
|
54
|
-
status: generated.status
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
//#endregion
|
|
61
|
-
export { buildVydraImageGenerationProvider };
|
package/dist/onboard.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
//#region extensions/vydra/onboard.ts
|
|
2
|
-
const VYDRA_DEFAULT_IMAGE_MODEL_REF = "vydra/grok-imagine";
|
|
3
|
-
function applyVydraConfig(cfg) {
|
|
4
|
-
if (cfg.agents?.defaults?.mediaModels?.image) return cfg;
|
|
5
|
-
return {
|
|
6
|
-
...cfg,
|
|
7
|
-
agents: {
|
|
8
|
-
...cfg.agents,
|
|
9
|
-
defaults: {
|
|
10
|
-
...cfg.agents?.defaults,
|
|
11
|
-
mediaModels: {
|
|
12
|
-
...cfg.agents?.defaults?.mediaModels,
|
|
13
|
-
image: { primary: VYDRA_DEFAULT_IMAGE_MODEL_REF }
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
//#endregion
|
|
20
|
-
export { applyVydraConfig };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_VYDRA_VIDEO_MODEL } from "./defaults.js";
|
|
2
|
-
import { runVydraGeneration } from "./shared.js";
|
|
3
|
-
import { isProviderApiKeyConfiguredAsync } from "openclaw/plugin-sdk/provider-auth";
|
|
4
|
-
//#region extensions/vydra/video-generation-provider.ts
|
|
5
|
-
const VYDRA_KLING_MODEL = "kling";
|
|
6
|
-
const DEFAULT_VYDRA_VIDEO_TIMEOUT_MS = 12e4;
|
|
7
|
-
function buildVydraVideoGenerationProvider() {
|
|
8
|
-
return {
|
|
9
|
-
id: "vydra",
|
|
10
|
-
label: "Vydra",
|
|
11
|
-
defaultModel: DEFAULT_VYDRA_VIDEO_MODEL,
|
|
12
|
-
models: [DEFAULT_VYDRA_VIDEO_MODEL, VYDRA_KLING_MODEL],
|
|
13
|
-
isConfiguredAsync: (ctx) => isProviderApiKeyConfiguredAsync({
|
|
14
|
-
provider: "vydra",
|
|
15
|
-
...ctx
|
|
16
|
-
}),
|
|
17
|
-
capabilities: {
|
|
18
|
-
generate: { maxVideos: 1 },
|
|
19
|
-
imageToVideo: {
|
|
20
|
-
enabled: true,
|
|
21
|
-
maxVideos: 1,
|
|
22
|
-
maxInputImages: 1
|
|
23
|
-
},
|
|
24
|
-
videoToVideo: { enabled: false }
|
|
25
|
-
},
|
|
26
|
-
async generateVideo(req) {
|
|
27
|
-
if ((req.inputVideos?.length ?? 0) > 0) throw new Error("Vydra video generation does not support video reference inputs.");
|
|
28
|
-
const model = req.model?.trim() || "veo3";
|
|
29
|
-
const body = { prompt: req.prompt };
|
|
30
|
-
if (model === VYDRA_KLING_MODEL) {
|
|
31
|
-
const imageUrl = req.inputImages?.[0]?.url?.trim();
|
|
32
|
-
if (!imageUrl) throw new Error("Vydra kling currently requires a remote image URL reference.");
|
|
33
|
-
body.image_url = imageUrl;
|
|
34
|
-
body.video_url = imageUrl;
|
|
35
|
-
} else if ((req.inputImages?.length ?? 0) > 0) throw new Error(`Vydra ${model} does not support image reference inputs in the Vydra plugin.`);
|
|
36
|
-
const generated = await runVydraGeneration({
|
|
37
|
-
cfg: req.cfg,
|
|
38
|
-
agentDir: req.agentDir,
|
|
39
|
-
authStore: req.authStore,
|
|
40
|
-
kind: "video",
|
|
41
|
-
model,
|
|
42
|
-
body,
|
|
43
|
-
deadlineTimeoutMs: req.timeoutMs ?? DEFAULT_VYDRA_VIDEO_TIMEOUT_MS
|
|
44
|
-
});
|
|
45
|
-
return {
|
|
46
|
-
videos: [generated.asset],
|
|
47
|
-
model,
|
|
48
|
-
metadata: {
|
|
49
|
-
jobId: generated.jobId,
|
|
50
|
-
videoUrl: generated.resultUrl,
|
|
51
|
-
status: generated.status
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
//#endregion
|
|
58
|
-
export { buildVydraVideoGenerationProvider };
|