@openclaw/byteplus-provider 2026.9.6 → 2026.9.8
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/assets/icon.png +0 -0
- package/dist/.setup/{models-648u0ZzV.mjs → models-B35FIrA-.mjs} +0 -7
- package/dist/api.js +1 -1
- package/dist/index.js +1 -4
- package/dist/models.js +1 -1
- package/dist/provider-discovery.js +1 -4
- package/dist/video-generation-provider.js +38 -82
- package/package.json +4 -4
package/assets/icon.png
CHANGED
|
Binary file
|
|
@@ -166,9 +166,6 @@ var openclaw_plugin_default = {
|
|
|
166
166
|
};
|
|
167
167
|
//#endregion
|
|
168
168
|
//#region extensions/byteplus/models.ts
|
|
169
|
-
/**
|
|
170
|
-
* BytePlus model catalog helpers derived from the plugin manifest.
|
|
171
|
-
*/
|
|
172
169
|
const BYTEPLUS_PROVIDER_CATALOG = buildManifestProviderCatalogFamily({ surfaces: [{
|
|
173
170
|
id: "byteplus",
|
|
174
171
|
label: "BytePlus",
|
|
@@ -180,13 +177,9 @@ const BYTEPLUS_PROVIDER_CATALOG = buildManifestProviderCatalogFamily({ surfaces:
|
|
|
180
177
|
}] });
|
|
181
178
|
const BYTEPLUS_PROVIDER = BYTEPLUS_PROVIDER_CATALOG.entries[0];
|
|
182
179
|
const BYTEPLUS_CODING_PROVIDER = BYTEPLUS_PROVIDER_CATALOG.entries[1];
|
|
183
|
-
/** Base URL for BytePlus chat/model APIs from the manifest catalog. */
|
|
184
180
|
const BYTEPLUS_BASE_URL = BYTEPLUS_PROVIDER.baseUrl;
|
|
185
|
-
/** Base URL for BytePlus Plan coding APIs from the manifest catalog. */
|
|
186
181
|
const BYTEPLUS_CODING_BASE_URL = BYTEPLUS_CODING_PROVIDER.baseUrl;
|
|
187
|
-
/** BytePlus general model catalog entries. */
|
|
188
182
|
const BYTEPLUS_MODEL_CATALOG = BYTEPLUS_PROVIDER.models;
|
|
189
|
-
/** BytePlus coding/planning model catalog entries. */
|
|
190
183
|
const BYTEPLUS_CODING_MODEL_CATALOG = BYTEPLUS_CODING_PROVIDER.models;
|
|
191
184
|
//#endregion
|
|
192
185
|
export { BYTEPLUS_PROVIDER_CATALOG as a, BYTEPLUS_MODEL_CATALOG as i, BYTEPLUS_CODING_BASE_URL as n, openclaw_plugin_default as o, BYTEPLUS_CODING_MODEL_CATALOG as r, BYTEPLUS_BASE_URL as t };
|
package/dist/api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as BYTEPLUS_MODEL_CATALOG, n as BYTEPLUS_CODING_BASE_URL, r as BYTEPLUS_CODING_MODEL_CATALOG, t as BYTEPLUS_BASE_URL } from "./.setup/models-
|
|
1
|
+
import { i as BYTEPLUS_MODEL_CATALOG, n as BYTEPLUS_CODING_BASE_URL, r as BYTEPLUS_CODING_MODEL_CATALOG, t as BYTEPLUS_BASE_URL } from "./.setup/models-B35FIrA-.mjs";
|
|
2
2
|
export { BYTEPLUS_BASE_URL, BYTEPLUS_CODING_BASE_URL, BYTEPLUS_CODING_MODEL_CATALOG, BYTEPLUS_MODEL_CATALOG };
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { a as BYTEPLUS_PROVIDER_CATALOG, o as openclaw_plugin_default } from "./.setup/models-
|
|
1
|
+
import { a as BYTEPLUS_PROVIDER_CATALOG, o as openclaw_plugin_default } from "./.setup/models-B35FIrA-.mjs";
|
|
2
2
|
import { buildBytePlusVideoGenerationProvider } from "./video-generation-provider.js";
|
|
3
3
|
import { buildOpenAICompatibleProviderFamilyCatalog } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
|
|
4
4
|
import { readManifestProviderDefaultModelRef } from "openclaw/plugin-sdk/provider-catalog-shared";
|
|
5
5
|
import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";
|
|
6
6
|
import { ensureModelAllowlistEntry } from "openclaw/plugin-sdk/provider-onboard";
|
|
7
7
|
//#region extensions/byteplus/index.ts
|
|
8
|
-
/**
|
|
9
|
-
* BytePlus provider plugin entrypoint for model and video generation providers.
|
|
10
|
-
*/
|
|
11
8
|
const PROVIDER_ID = "byteplus";
|
|
12
9
|
const BYTEPLUS_DEFAULT_MODEL_REF = readManifestProviderDefaultModelRef(openclaw_plugin_default, "byteplus-plan");
|
|
13
10
|
var byteplus_default = defineSingleProviderPluginEntry({
|
package/dist/models.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as BYTEPLUS_PROVIDER_CATALOG, i as BYTEPLUS_MODEL_CATALOG, n as BYTEPLUS_CODING_BASE_URL, r as BYTEPLUS_CODING_MODEL_CATALOG, t as BYTEPLUS_BASE_URL } from "./.setup/models-
|
|
1
|
+
import { a as BYTEPLUS_PROVIDER_CATALOG, i as BYTEPLUS_MODEL_CATALOG, n as BYTEPLUS_CODING_BASE_URL, r as BYTEPLUS_CODING_MODEL_CATALOG, t as BYTEPLUS_BASE_URL } from "./.setup/models-B35FIrA-.mjs";
|
|
2
2
|
export { BYTEPLUS_BASE_URL, BYTEPLUS_CODING_BASE_URL, BYTEPLUS_CODING_MODEL_CATALOG, BYTEPLUS_MODEL_CATALOG, BYTEPLUS_PROVIDER_CATALOG };
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { a as BYTEPLUS_PROVIDER_CATALOG } from "./.setup/models-
|
|
1
|
+
import { a as BYTEPLUS_PROVIDER_CATALOG } from "./.setup/models-B35FIrA-.mjs";
|
|
2
2
|
//#region extensions/byteplus/provider-discovery.ts
|
|
3
|
-
/**
|
|
4
|
-
* Static provider discovery entries for BytePlus manifest-backed catalogs.
|
|
5
|
-
*/
|
|
6
3
|
var provider_discovery_default = BYTEPLUS_PROVIDER_CATALOG.staticDiscovery;
|
|
7
4
|
//#endregion
|
|
8
5
|
export { provider_discovery_default as default };
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { t as BYTEPLUS_BASE_URL } from "./.setup/models-
|
|
1
|
+
import { t as BYTEPLUS_BASE_URL } from "./.setup/models-B35FIrA-.mjs";
|
|
2
2
|
import { toImageDataUrl } from "openclaw/plugin-sdk/image-generation";
|
|
3
3
|
import { downloadGeneratedVideoAsset, resolveGeneratedMediaMaxBytes } from "openclaw/plugin-sdk/media-generation-runtime";
|
|
4
4
|
import { isProviderApiKeyConfigured } from "openclaw/plugin-sdk/provider-auth";
|
|
5
5
|
import { resolveApiKeyForProvider } from "openclaw/plugin-sdk/provider-auth-runtime";
|
|
6
|
-
import { assertOkOrThrowHttpError, createProviderOperationDeadline, createProviderOperationTimeoutResolver,
|
|
6
|
+
import { assertOkOrThrowHttpError, createProviderOperationDeadline, createProviderOperationTimeoutResolver, pollProviderOperationJson, postJsonRequest, readProviderJsonObjectResponse, resolveProviderHttpRequestConfig, resolveProviderOperationTimeoutMs } from "openclaw/plugin-sdk/provider-http";
|
|
7
7
|
import { asSafeIntegerInRange, isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
8
|
//#region extensions/byteplus/video-generation-provider.ts
|
|
9
|
-
/**
|
|
10
|
-
* BytePlus Seedance video generation provider implementation.
|
|
11
|
-
*/
|
|
12
9
|
const DEFAULT_BYTEPLUS_VIDEO_MODEL = "seedance-1-0-pro-250528";
|
|
13
10
|
const DEFAULT_TIMEOUT_MS = 12e4;
|
|
14
11
|
const POLL_INTERVAL_MS = 5e3;
|
|
@@ -16,11 +13,6 @@ const MAX_POLL_ATTEMPTS = 120;
|
|
|
16
13
|
const BYTEPLUS_SEED_MAX = 2147483647;
|
|
17
14
|
const BYTEPLUS_MIN_DURATION_SECONDS = 2;
|
|
18
15
|
const BYTEPLUS_MAX_DURATION_SECONDS = 12;
|
|
19
|
-
async function readBytePlusJsonResponse(response, label) {
|
|
20
|
-
const payload = await readProviderJsonResponse(response, label);
|
|
21
|
-
if (!isRecord(payload)) throw new Error(`${label}: malformed JSON response`);
|
|
22
|
-
return payload;
|
|
23
|
-
}
|
|
24
16
|
function readBytePlusTaskStatus(payload) {
|
|
25
17
|
const status = normalizeOptionalString(payload.status);
|
|
26
18
|
switch (status) {
|
|
@@ -43,9 +35,6 @@ function readBytePlusVideoUrl(payload) {
|
|
|
43
35
|
if (!videoUrl) throw new Error("BytePlus video generation completed without a video URL");
|
|
44
36
|
return videoUrl;
|
|
45
37
|
}
|
|
46
|
-
function resolveBytePlusVideoBaseUrl(req) {
|
|
47
|
-
return normalizeOptionalString(req.cfg?.models?.providers?.byteplus?.baseUrl) ?? BYTEPLUS_BASE_URL;
|
|
48
|
-
}
|
|
49
38
|
function resolveBytePlusImageUrl(req) {
|
|
50
39
|
const input = req.inputImages?.[0];
|
|
51
40
|
if (!input) return;
|
|
@@ -58,12 +47,6 @@ function resolveBytePlusImageUrl(req) {
|
|
|
58
47
|
defaultMimeType: "image/png"
|
|
59
48
|
});
|
|
60
49
|
}
|
|
61
|
-
function resolveBytePlusSeed(value) {
|
|
62
|
-
return asSafeIntegerInRange(value, {
|
|
63
|
-
min: -1,
|
|
64
|
-
max: BYTEPLUS_SEED_MAX
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
50
|
function resolveBytePlusDurationSeconds(value) {
|
|
68
51
|
if (typeof value !== "number" || !Number.isFinite(value)) return;
|
|
69
52
|
return asSafeIntegerInRange(Math.round(value), {
|
|
@@ -71,56 +54,6 @@ function resolveBytePlusDurationSeconds(value) {
|
|
|
71
54
|
max: BYTEPLUS_MAX_DURATION_SECONDS
|
|
72
55
|
});
|
|
73
56
|
}
|
|
74
|
-
function readBytePlusDurationSeconds(value) {
|
|
75
|
-
return asSafeIntegerInRange(value, {
|
|
76
|
-
min: BYTEPLUS_MIN_DURATION_SECONDS,
|
|
77
|
-
max: BYTEPLUS_MAX_DURATION_SECONDS
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
async function pollBytePlusTask(params) {
|
|
81
|
-
const deadline = createProviderOperationDeadline({
|
|
82
|
-
timeoutMs: params.timeoutMs,
|
|
83
|
-
label: `BytePlus video generation task ${params.taskId}`
|
|
84
|
-
});
|
|
85
|
-
return await pollProviderOperationJson({
|
|
86
|
-
url: `${params.baseUrl}/contents/generations/tasks/${params.taskId}`,
|
|
87
|
-
headers: params.headers,
|
|
88
|
-
deadline,
|
|
89
|
-
defaultTimeoutMs: DEFAULT_TIMEOUT_MS,
|
|
90
|
-
fetchFn: params.fetchFn,
|
|
91
|
-
maxAttempts: MAX_POLL_ATTEMPTS,
|
|
92
|
-
pollIntervalMs: POLL_INTERVAL_MS,
|
|
93
|
-
requestFailedMessage: "BytePlus video status request failed",
|
|
94
|
-
timeoutMessage: `BytePlus video generation task ${params.taskId} did not finish in time`,
|
|
95
|
-
isComplete: (payload) => readBytePlusTaskStatus(payload) === "succeeded",
|
|
96
|
-
getFailureMessage: (payload) => {
|
|
97
|
-
const status = readBytePlusTaskStatus(payload);
|
|
98
|
-
return status === "failed" || status === "cancelled" ? readBytePlusErrorMessage(payload.error) || "BytePlus video generation failed" : void 0;
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
async function downloadBytePlusVideo(params) {
|
|
103
|
-
return await downloadGeneratedVideoAsset({
|
|
104
|
-
url: params.url,
|
|
105
|
-
timeoutMs: params.timeoutMs ?? DEFAULT_TIMEOUT_MS,
|
|
106
|
-
defaultTimeoutMs: DEFAULT_TIMEOUT_MS,
|
|
107
|
-
fetchFn: params.fetchFn,
|
|
108
|
-
provider: "byteplus",
|
|
109
|
-
label: "BytePlus generated video download",
|
|
110
|
-
requestFailedMessage: "BytePlus generated video download failed",
|
|
111
|
-
maxBytes: params.maxBytes,
|
|
112
|
-
validateBinaryResponse: true,
|
|
113
|
-
fetchResponse: async ({ deadline }) => ({ response: await fetchProviderDownloadResponse({
|
|
114
|
-
url: params.url,
|
|
115
|
-
init: { method: "GET" },
|
|
116
|
-
deadline,
|
|
117
|
-
fetchFn: params.fetchFn,
|
|
118
|
-
provider: "byteplus",
|
|
119
|
-
requestFailedMessage: "BytePlus generated video download failed"
|
|
120
|
-
}) })
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
/** Builds the BytePlus video generation provider registered by the plugin. */
|
|
124
57
|
function buildBytePlusVideoGenerationProvider() {
|
|
125
58
|
return {
|
|
126
59
|
id: "byteplus",
|
|
@@ -172,7 +105,7 @@ function buildBytePlusVideoGenerationProvider() {
|
|
|
172
105
|
label: "BytePlus video generation"
|
|
173
106
|
});
|
|
174
107
|
const { baseUrl, allowPrivateNetwork, headers, dispatcherPolicy } = resolveProviderHttpRequestConfig({
|
|
175
|
-
baseUrl:
|
|
108
|
+
baseUrl: normalizeOptionalString(req.cfg?.models?.providers?.byteplus?.baseUrl) ?? BYTEPLUS_BASE_URL,
|
|
176
109
|
defaultBaseUrl: BYTEPLUS_BASE_URL,
|
|
177
110
|
allowPrivateNetwork: false,
|
|
178
111
|
defaultHeaders: {
|
|
@@ -207,7 +140,10 @@ function buildBytePlusVideoGenerationProvider() {
|
|
|
207
140
|
if (typeof req.audio === "boolean") body.generate_audio = req.audio;
|
|
208
141
|
if (typeof req.watermark === "boolean") body.watermark = req.watermark;
|
|
209
142
|
const opts = req.providerOptions ?? {};
|
|
210
|
-
const seed =
|
|
143
|
+
const seed = asSafeIntegerInRange(opts.seed, {
|
|
144
|
+
min: -1,
|
|
145
|
+
max: BYTEPLUS_SEED_MAX
|
|
146
|
+
});
|
|
211
147
|
const draft = opts.draft === true;
|
|
212
148
|
const cameraFixed = typeof opts.camera_fixed === "boolean" ? opts.camera_fixed : void 0;
|
|
213
149
|
if (seed != null) body.seed = seed;
|
|
@@ -227,29 +163,46 @@ function buildBytePlusVideoGenerationProvider() {
|
|
|
227
163
|
});
|
|
228
164
|
try {
|
|
229
165
|
await assertOkOrThrowHttpError(response, "BytePlus video generation failed");
|
|
230
|
-
const submitted = await
|
|
166
|
+
const submitted = await readProviderJsonObjectResponse(response, "BytePlus video generation failed");
|
|
231
167
|
const taskId = normalizeOptionalString(submitted.id);
|
|
232
168
|
if (!taskId) throw new Error("BytePlus video generation response missing task id");
|
|
233
|
-
const completed = await
|
|
234
|
-
taskId
|
|
169
|
+
const completed = await pollProviderOperationJson({
|
|
170
|
+
url: `${baseUrl}/contents/generations/tasks/${taskId}`,
|
|
235
171
|
headers,
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
172
|
+
deadline: createProviderOperationDeadline({
|
|
173
|
+
timeoutMs: resolveProviderOperationTimeoutMs({
|
|
174
|
+
deadline,
|
|
175
|
+
defaultTimeoutMs: DEFAULT_TIMEOUT_MS
|
|
176
|
+
}),
|
|
177
|
+
label: `BytePlus video generation task ${taskId}`
|
|
239
178
|
}),
|
|
240
|
-
|
|
241
|
-
fetchFn
|
|
179
|
+
defaultTimeoutMs: DEFAULT_TIMEOUT_MS,
|
|
180
|
+
fetchFn,
|
|
181
|
+
maxAttempts: MAX_POLL_ATTEMPTS,
|
|
182
|
+
pollIntervalMs: POLL_INTERVAL_MS,
|
|
183
|
+
requestFailedMessage: "BytePlus video status request failed",
|
|
184
|
+
timeoutMessage: `BytePlus video generation task ${taskId} did not finish in time`,
|
|
185
|
+
isComplete: (payload) => readBytePlusTaskStatus(payload) === "succeeded",
|
|
186
|
+
getFailureMessage: (payload) => {
|
|
187
|
+
const status = readBytePlusTaskStatus(payload);
|
|
188
|
+
return status === "failed" || status === "cancelled" ? readBytePlusErrorMessage(payload.error) || "BytePlus video generation failed" : void 0;
|
|
189
|
+
}
|
|
242
190
|
});
|
|
243
191
|
const videoUrl = readBytePlusVideoUrl(completed);
|
|
244
192
|
return {
|
|
245
|
-
videos: [await
|
|
193
|
+
videos: [await downloadGeneratedVideoAsset({
|
|
246
194
|
url: videoUrl,
|
|
247
195
|
timeoutMs: createProviderOperationTimeoutResolver({
|
|
248
196
|
deadline,
|
|
249
197
|
defaultTimeoutMs: DEFAULT_TIMEOUT_MS
|
|
250
198
|
}),
|
|
199
|
+
defaultTimeoutMs: DEFAULT_TIMEOUT_MS,
|
|
251
200
|
fetchFn,
|
|
252
|
-
|
|
201
|
+
provider: "byteplus",
|
|
202
|
+
label: "BytePlus generated video download",
|
|
203
|
+
requestFailedMessage: "BytePlus generated video download failed",
|
|
204
|
+
maxBytes: resolveGeneratedMediaMaxBytes(req.cfg, "video"),
|
|
205
|
+
validateBinaryResponse: true
|
|
253
206
|
})],
|
|
254
207
|
model: normalizeOptionalString(completed.model) ?? resolvedModel,
|
|
255
208
|
metadata: {
|
|
@@ -258,7 +211,10 @@ function buildBytePlusVideoGenerationProvider() {
|
|
|
258
211
|
videoUrl,
|
|
259
212
|
ratio: normalizeOptionalString(completed.ratio),
|
|
260
213
|
resolution: normalizeOptionalString(completed.resolution),
|
|
261
|
-
duration:
|
|
214
|
+
duration: asSafeIntegerInRange(completed.duration, {
|
|
215
|
+
min: BYTEPLUS_MIN_DURATION_SECONDS,
|
|
216
|
+
max: BYTEPLUS_MAX_DURATION_SECONDS
|
|
217
|
+
})
|
|
262
218
|
}
|
|
263
219
|
};
|
|
264
220
|
} finally {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/byteplus-provider",
|
|
3
|
-
"version": "2026.9.
|
|
3
|
+
"version": "2026.9.8",
|
|
4
4
|
"description": "OpenClaw BytePlus 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.9.
|
|
21
|
+
"pluginApi": ">=2026.9.8"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.9.
|
|
24
|
+
"openclawVersion": "2026.9.8",
|
|
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.9.
|
|
43
|
+
"openclaw": ">=2026.9.8"
|
|
44
44
|
},
|
|
45
45
|
"peerDependenciesMeta": {
|
|
46
46
|
"openclaw": {
|