buckyos 0.7.136 → 0.7.138
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/cli/dist/cli.mjs +29 -3
- package/cli/dist/cli.mjs.map +1 -1
- package/cli/modules/ai.ts +30 -1
- package/cli/version.ts +1 -1
- package/dist/aicc_client.d.ts +428 -44
- package/dist/aicc_client.d.ts.map +1 -1
- package/dist/browser.cjs +1 -1
- package/dist/browser.mjs +42 -34
- package/dist/device_identity.d.ts +1 -1
- package/dist/device_identity.d.ts.map +1 -1
- package/dist/hybrid_sso.d.ts +1 -1
- package/dist/hybrid_sso.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +42 -34
- package/dist/ndm_proxy-67651066.js +13 -0
- package/dist/ndm_proxy-67651066.js.map +1 -0
- package/dist/{ndm_proxy-b5c95488.mjs → ndm_proxy-6b03b9ec.mjs} +319 -55
- package/dist/ndm_proxy-6b03b9ec.mjs.map +1 -0
- package/dist/node.cjs +1 -1
- package/dist/node.mjs +42 -34
- package/dist/provision.cjs +2 -2
- package/dist/provision.cjs.map +1 -1
- package/dist/provision.mjs +8 -4
- package/dist/provision.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/ndm_proxy-7cf15839.js +0 -13
- package/dist/ndm_proxy-7cf15839.js.map +0 -1
- package/dist/ndm_proxy-b5c95488.mjs.map +0 -1
|
@@ -1292,9 +1292,8 @@ const AICC_AI_METHODS = {
|
|
|
1292
1292
|
AUDIO_ASR: "audio.asr",
|
|
1293
1293
|
AUDIO_MUSIC: "audio.music",
|
|
1294
1294
|
AUDIO_ENHANCE: "audio.enhance",
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
VIDEO_VIDEO2VIDEO: "video.video2video",
|
|
1295
|
+
VIDEO_GENERATE: "video.generate",
|
|
1296
|
+
VIDEO_EDIT: "video.edit",
|
|
1298
1297
|
VIDEO_EXTEND: "video.extend",
|
|
1299
1298
|
VIDEO_UPSCALE: "video.upscale",
|
|
1300
1299
|
AGENT_COMPUTER_USE: "agent.computer_use"
|
|
@@ -1303,6 +1302,7 @@ const AICC_CORE_METHODS = {
|
|
|
1303
1302
|
ROUTE_RESOLVE: "route.resolve",
|
|
1304
1303
|
HELPER_LLM_CHAT: "helper.llm_chat",
|
|
1305
1304
|
HELPER_TEXT_TO_IMAGE: "helper.text_to_image",
|
|
1305
|
+
HELPER_VIDEO_GENERATE: "helper.video_generate",
|
|
1306
1306
|
CANCEL: "cancel"
|
|
1307
1307
|
};
|
|
1308
1308
|
const AICC_MANAGEMENT_METHODS = {
|
|
@@ -1326,7 +1326,21 @@ const AICC_MANAGEMENT_METHODS = {
|
|
|
1326
1326
|
DRIVER_METADATA_UPDATE_GET: "driver_metadata_update.get",
|
|
1327
1327
|
DRIVER_METADATA_UPDATE_SET: "driver_metadata_update.set"
|
|
1328
1328
|
};
|
|
1329
|
-
const
|
|
1329
|
+
const AICC_QUOTA_METHODS = {
|
|
1330
|
+
RULE_LIST: "quota.rule.list",
|
|
1331
|
+
RULE_GET: "quota.rule.get",
|
|
1332
|
+
RULE_PREVIEW: "quota.rule.preview",
|
|
1333
|
+
RULE_CREATE: "quota.rule.create",
|
|
1334
|
+
RULE_UPDATE: "quota.rule.update",
|
|
1335
|
+
RULE_DELETE: "quota.rule.delete",
|
|
1336
|
+
ACCOUNT_GET: "quota.account.get",
|
|
1337
|
+
ACCOUNT_RECHARGE: "quota.account.recharge",
|
|
1338
|
+
RECHARGE_GET: "quota.recharge.get",
|
|
1339
|
+
VISIBILITY_GET: "visibility.get",
|
|
1340
|
+
VISIBILITY_UPDATE: "visibility.update",
|
|
1341
|
+
VISIBILITY_PREVIEW: "visibility.preview"
|
|
1342
|
+
};
|
|
1343
|
+
const AICC_METHODS = { ...AICC_AI_METHODS, ...AICC_CORE_METHODS, ...AICC_MANAGEMENT_METHODS, ...AICC_QUOTA_METHODS };
|
|
1330
1344
|
const AICC_FEATURES = {
|
|
1331
1345
|
PLAN: "plan",
|
|
1332
1346
|
TOOL_CALL: "tool_call",
|
|
@@ -1338,6 +1352,13 @@ const AICC_FEATURES = {
|
|
|
1338
1352
|
VIDEO_UNDERSTAND: "video_understand"
|
|
1339
1353
|
};
|
|
1340
1354
|
const AICC_EXECUTION_MODES = { IMMEDIATE: "immediate", STREAM: "stream" };
|
|
1355
|
+
const AICC_POLICY_REFUSAL_CODES = ["quota_exhausted", "quota_budget_exceeded", "quota_unavailable", "resource_not_permitted", "attribution_unavailable"];
|
|
1356
|
+
function aiccRefusalOf(error) {
|
|
1357
|
+
if (!(error instanceof RPCError) || !AICC_POLICY_REFUSAL_CODES.includes(error.code))
|
|
1358
|
+
return void 0;
|
|
1359
|
+
const data = error.data;
|
|
1360
|
+
return { code: error.code, message: (data == null ? void 0 : data.message) ?? error.message, retriable: data == null ? void 0 : data.retriable, details: data == null ? void 0 : data.details };
|
|
1361
|
+
}
|
|
1341
1362
|
const AI_METHOD_SET = new Set(Object.values(AICC_AI_METHODS));
|
|
1342
1363
|
function isAiccAiMethod(method) {
|
|
1343
1364
|
return AI_METHOD_SET.has(method);
|
|
@@ -1416,19 +1437,19 @@ const schemas = {
|
|
|
1416
1437
|
[AICC_AI_METHODS.AUDIO_ASR]: [...common, "audio", "language", "timestamps", "diarization", "output_formats"],
|
|
1417
1438
|
[AICC_AI_METHODS.AUDIO_MUSIC]: [...common, "prompt", "duration_seconds", "instrumental", "lyrics", "seed", "output"],
|
|
1418
1439
|
[AICC_AI_METHODS.AUDIO_ENHANCE]: [...common, "audio", "task", "strength", "return_stems"],
|
|
1419
|
-
[AICC_AI_METHODS.
|
|
1420
|
-
[AICC_AI_METHODS.
|
|
1421
|
-
[AICC_AI_METHODS.VIDEO_VIDEO2VIDEO]: [...common, "video", "prompt", "preserve_motion", "time_range"],
|
|
1440
|
+
[AICC_AI_METHODS.VIDEO_GENERATE]: [...common, "prompt", "negative_prompt", "conditions", "output", "seed"],
|
|
1441
|
+
[AICC_AI_METHODS.VIDEO_EDIT]: [...common, "video", "prompt", "output"],
|
|
1422
1442
|
[AICC_AI_METHODS.VIDEO_EXTEND]: [...common, "video", "prompt", "continuation_handle", "duration_seconds", "resolution"],
|
|
1423
1443
|
[AICC_AI_METHODS.VIDEO_UPSCALE]: [...common, "video", "target_resolution", "denoise", "sharpen", "output"],
|
|
1424
1444
|
[AICC_AI_METHODS.AGENT_COMPUTER_USE]: [...common, "task", "environment", "allowed_actions"],
|
|
1425
1445
|
[AICC_CORE_METHODS.ROUTE_RESOLVE]: ["trace_id", "execution_mode", "request_id", "api_type", "logical_model", "requirements", "disable", "policy", "estimated_input_tokens", "estimated_output_tokens", "session_overlay", "session_id"],
|
|
1426
1446
|
[AICC_CORE_METHODS.HELPER_LLM_CHAT]: ["logical_model", "trace_id", "execution_mode", "requirements", "disable", "policy", "messages", "tools", "response_format", "temperature", "top_p", "max_output_tokens", "seed", "stop", "output", "idempotency_key", "task_options", "session_overlay", "session_id"],
|
|
1427
1447
|
[AICC_CORE_METHODS.HELPER_TEXT_TO_IMAGE]: ["logical_model", "trace_id", "execution_mode", "requirements", "disable", "policy", "prompt", "negative_prompt", "n", "aspect_ratio", "size", "quality", "style", "seed", "output", "idempotency_key", "task_options", "session_overlay", "session_id"],
|
|
1448
|
+
[AICC_CORE_METHODS.HELPER_VIDEO_GENERATE]: ["logical_model", "trace_id", "execution_mode", "requirements", "disable", "policy", "prompt", "negative_prompt", "conditions", "output", "seed", "idempotency_key", "task_options", "session_overlay", "session_id"],
|
|
1428
1449
|
[AICC_CORE_METHODS.CANCEL]: ["task_id"],
|
|
1429
1450
|
[AICC_MANAGEMENT_METHODS.SERVICE_RELOAD_SETTINGS]: [],
|
|
1430
|
-
[AICC_MANAGEMENT_METHODS.QUOTA_QUERY]: ["
|
|
1431
|
-
[AICC_MANAGEMENT_METHODS.USAGE_QUERY]: ["time_range", "filters", "group_by", "time_bucket", "output_mode", "limit", "cursor"],
|
|
1451
|
+
[AICC_MANAGEMENT_METHODS.QUOTA_QUERY]: ["app_id"],
|
|
1452
|
+
[AICC_MANAGEMENT_METHODS.USAGE_QUERY]: ["time_range", "filters", "group_by", "time_bucket", "output_mode", "limit", "cursor", "zone_wide"],
|
|
1432
1453
|
[AICC_MANAGEMENT_METHODS.TRACE_QUERY]: ["limit", "cursor", "start_time_ms", "end_time_ms", "task_ids", "request_ids", "api_types", "provider_instance_names", "selected_exact_models", "scheduler_profiles", "query", "outcome"],
|
|
1433
1454
|
[AICC_MANAGEMENT_METHODS.ROUTING_GET]: [],
|
|
1434
1455
|
[AICC_MANAGEMENT_METHODS.ROUTING_PREVIEW]: ["paths", "explain", "requirements"],
|
|
@@ -1437,12 +1458,12 @@ const schemas = {
|
|
|
1437
1458
|
[AICC_MANAGEMENT_METHODS.PROTOCOL_ADAPTER_LIST]: [],
|
|
1438
1459
|
[AICC_MANAGEMENT_METHODS.PROVIDER_VALIDATE]: ["provider_instance_name", "provider_type", "provider_profile_id", "protocol_family_id", "protocol_adapter_id", "base_url", "credentials", "region", "workspace", "account", "provider_rules_id", "auth", "discovery", "instance_rules", "timeout_ms", "auto_sync_models"],
|
|
1439
1460
|
[AICC_MANAGEMENT_METHODS.PROVIDER_ADD]: ["provider_instance_name", "provider_type", "provider_profile_id", "protocol_family_id", "protocol_adapter_id", "base_url", "credentials", "region", "workspace", "account", "provider_rules_id", "auth", "discovery", "instance_rules", "timeout_ms", "auto_sync_models"],
|
|
1440
|
-
[AICC_MANAGEMENT_METHODS.PROVIDER_LIST]: ["method"],
|
|
1461
|
+
[AICC_MANAGEMENT_METHODS.PROVIDER_LIST]: ["method", "view"],
|
|
1441
1462
|
[AICC_MANAGEMENT_METHODS.PROVIDER_HEALTH]: ["exact_model"],
|
|
1442
1463
|
[AICC_MANAGEMENT_METHODS.PROVIDER_UPDATE]: ["provider_instance_name", "settings_revision", "enabled", "base_url", "credential", "provider_profile_id", "protocol_adapter_id", "discovery", "instance_rules"],
|
|
1443
1464
|
[AICC_MANAGEMENT_METHODS.PROVIDER_DELETE]: ["provider_instance_name"],
|
|
1444
1465
|
[AICC_MANAGEMENT_METHODS.PROVIDER_REFRESH_MODELS]: ["provider_instance_name"],
|
|
1445
|
-
[AICC_MANAGEMENT_METHODS.MODELS_LIST]: [],
|
|
1466
|
+
[AICC_MANAGEMENT_METHODS.MODELS_LIST]: ["view"],
|
|
1446
1467
|
[AICC_MANAGEMENT_METHODS.DRIVER_METADATA_UPDATE_GET]: [],
|
|
1447
1468
|
[AICC_MANAGEMENT_METHODS.DRIVER_METADATA_UPDATE_SET]: ["enabled", "source_url", "interval_secs"]
|
|
1448
1469
|
};
|
|
@@ -1536,14 +1557,19 @@ class AiccClient {
|
|
|
1536
1557
|
audioEnhance(r) {
|
|
1537
1558
|
return this.inference(AICC_AI_METHODS.AUDIO_ENHANCE, r);
|
|
1538
1559
|
}
|
|
1539
|
-
|
|
1540
|
-
|
|
1560
|
+
videoGenerate(r) {
|
|
1561
|
+
validateVideoGeneration(r);
|
|
1562
|
+
return this.inference(AICC_AI_METHODS.VIDEO_GENERATE, r);
|
|
1541
1563
|
}
|
|
1542
|
-
|
|
1543
|
-
|
|
1564
|
+
helperVideoGenerate(r) {
|
|
1565
|
+
logical(r.logical_model);
|
|
1566
|
+
validateVideoGeneration(r);
|
|
1567
|
+
videoGenerationRequirement(r);
|
|
1568
|
+
return this.call(AICC_CORE_METHODS.HELPER_VIDEO_GENERATE, r);
|
|
1544
1569
|
}
|
|
1545
|
-
|
|
1546
|
-
|
|
1570
|
+
videoEdit(r) {
|
|
1571
|
+
validateVideoEdit(r);
|
|
1572
|
+
return this.inference(AICC_AI_METHODS.VIDEO_EDIT, r);
|
|
1547
1573
|
}
|
|
1548
1574
|
videoExtend(r) {
|
|
1549
1575
|
return this.inference(AICC_AI_METHODS.VIDEO_EXTEND, r);
|
|
@@ -1608,8 +1634,44 @@ class AiccClient {
|
|
|
1608
1634
|
refreshProviderModels(r) {
|
|
1609
1635
|
return this.call(AICC_MANAGEMENT_METHODS.PROVIDER_REFRESH_MODELS, r);
|
|
1610
1636
|
}
|
|
1611
|
-
listModels() {
|
|
1612
|
-
return this.call(AICC_MANAGEMENT_METHODS.MODELS_LIST,
|
|
1637
|
+
listModels(r = {}) {
|
|
1638
|
+
return this.call(AICC_MANAGEMENT_METHODS.MODELS_LIST, r);
|
|
1639
|
+
}
|
|
1640
|
+
listQuotaRules(r = {}) {
|
|
1641
|
+
return this.call(AICC_QUOTA_METHODS.RULE_LIST, r);
|
|
1642
|
+
}
|
|
1643
|
+
getQuotaRule(ruleId) {
|
|
1644
|
+
return this.call(AICC_QUOTA_METHODS.RULE_GET, { rule_id: ruleId });
|
|
1645
|
+
}
|
|
1646
|
+
previewQuotaRule(draft) {
|
|
1647
|
+
return this.call(AICC_QUOTA_METHODS.RULE_PREVIEW, { draft });
|
|
1648
|
+
}
|
|
1649
|
+
createQuotaRule(draft) {
|
|
1650
|
+
return this.call(AICC_QUOTA_METHODS.RULE_CREATE, { draft });
|
|
1651
|
+
}
|
|
1652
|
+
updateQuotaRule(r) {
|
|
1653
|
+
return this.call(AICC_QUOTA_METHODS.RULE_UPDATE, r);
|
|
1654
|
+
}
|
|
1655
|
+
deleteQuotaRule(ruleId, expectedVersion) {
|
|
1656
|
+
return this.call(AICC_QUOTA_METHODS.RULE_DELETE, { rule_id: ruleId, expected_version: expectedVersion });
|
|
1657
|
+
}
|
|
1658
|
+
getQuotaAccount(accountId) {
|
|
1659
|
+
return this.call(AICC_QUOTA_METHODS.ACCOUNT_GET, { account_id: accountId });
|
|
1660
|
+
}
|
|
1661
|
+
rechargeQuotaAccount(r) {
|
|
1662
|
+
return this.call(AICC_QUOTA_METHODS.ACCOUNT_RECHARGE, r);
|
|
1663
|
+
}
|
|
1664
|
+
getQuotaRecharge(rechargeId) {
|
|
1665
|
+
return this.call(AICC_QUOTA_METHODS.RECHARGE_GET, { recharge_id: rechargeId });
|
|
1666
|
+
}
|
|
1667
|
+
getVisibility() {
|
|
1668
|
+
return this.call(AICC_QUOTA_METHODS.VISIBILITY_GET, {});
|
|
1669
|
+
}
|
|
1670
|
+
updateVisibility(r) {
|
|
1671
|
+
return this.call(AICC_QUOTA_METHODS.VISIBILITY_UPDATE, r);
|
|
1672
|
+
}
|
|
1673
|
+
previewVisibility(r = {}) {
|
|
1674
|
+
return this.call(AICC_QUOTA_METHODS.VISIBILITY_PREVIEW, r);
|
|
1613
1675
|
}
|
|
1614
1676
|
getDriverMetadataUpdate() {
|
|
1615
1677
|
return this.call(AICC_MANAGEMENT_METHODS.DRIVER_METADATA_UPDATE_GET, {});
|
|
@@ -1744,6 +1806,200 @@ function validateDecisionAnswers(request, answers) {
|
|
|
1744
1806
|
invalid();
|
|
1745
1807
|
}
|
|
1746
1808
|
}
|
|
1809
|
+
const VIDEO_MAX_CONDITIONS = 32;
|
|
1810
|
+
const VIDEO_CONDITION_ID = /^[A-Za-z][A-Za-z0-9_-]{0,63}$/;
|
|
1811
|
+
const VIDEO_CONDITION_FIELDS = {
|
|
1812
|
+
reference_image: ["type", "id", "resource"],
|
|
1813
|
+
reference_video: ["type", "id", "resource", "time_range", "include_audio"],
|
|
1814
|
+
reference_audio: ["type", "id", "resource", "time_range"],
|
|
1815
|
+
keyframe: ["type", "id", "resource", "position"]
|
|
1816
|
+
};
|
|
1817
|
+
const KEYFRAME_POSITIONS = ["start", "end"];
|
|
1818
|
+
function parseVideoPrompt(prompt) {
|
|
1819
|
+
const segments = [];
|
|
1820
|
+
let text = "";
|
|
1821
|
+
for (let index = 0; index < prompt.length; index++) {
|
|
1822
|
+
const next = prompt[index + 1];
|
|
1823
|
+
if (prompt[index] !== "@")
|
|
1824
|
+
text += prompt[index];
|
|
1825
|
+
else if (next === "@") {
|
|
1826
|
+
text += "@";
|
|
1827
|
+
index++;
|
|
1828
|
+
} else if (next !== "{")
|
|
1829
|
+
text += "@";
|
|
1830
|
+
else {
|
|
1831
|
+
const end = prompt.indexOf("}", index + 2);
|
|
1832
|
+
if (end < 0)
|
|
1833
|
+
throw new RPCError("prompt reference `@{` is not closed");
|
|
1834
|
+
const id2 = prompt.slice(index + 2, end);
|
|
1835
|
+
if (!VIDEO_CONDITION_ID.test(id2))
|
|
1836
|
+
throw new RPCError(`prompt reference \`${id2}\` is not a valid condition id`);
|
|
1837
|
+
if (text)
|
|
1838
|
+
segments.push({ text });
|
|
1839
|
+
text = "";
|
|
1840
|
+
segments.push({ reference: id2 });
|
|
1841
|
+
index = end;
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
if (text)
|
|
1845
|
+
segments.push({ text });
|
|
1846
|
+
return segments;
|
|
1847
|
+
}
|
|
1848
|
+
function isObject(value) {
|
|
1849
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
1850
|
+
}
|
|
1851
|
+
function finiteIn(value, min, max) {
|
|
1852
|
+
return typeof value === "number" && Number.isFinite(value) && value > min && value <= max;
|
|
1853
|
+
}
|
|
1854
|
+
function aspectRatio(value) {
|
|
1855
|
+
const match = typeof value === "string" ? /^(\d{1,3}):(\d{1,3})$/.exec(value) : null;
|
|
1856
|
+
const [width, height] = match ? [Number(match[1]), Number(match[2])] : [0, 0];
|
|
1857
|
+
return width >= 1 && width <= 100 && height >= 1 && height <= 100 ? [width, height] : void 0;
|
|
1858
|
+
}
|
|
1859
|
+
function reducedRatio(width, height) {
|
|
1860
|
+
const gcd = (a, b2) => b2 === 0 ? a : gcd(b2, a % b2);
|
|
1861
|
+
const divisor = Math.max(gcd(width, height), 1);
|
|
1862
|
+
return `${width / divisor}:${height / divisor}`;
|
|
1863
|
+
}
|
|
1864
|
+
function validateResourceRef(value, field) {
|
|
1865
|
+
const fields = { url: ["kind", "url", "mime_hint"], base64: ["kind", "mime", "data_base64"], named_object: ["kind", "obj_id"] };
|
|
1866
|
+
if (!isObject(value) || typeof value.kind !== "string" || !fields[value.kind])
|
|
1867
|
+
throw new RPCError(`${field} must be a ResourceRef`);
|
|
1868
|
+
strict(value, fields[value.kind]);
|
|
1869
|
+
}
|
|
1870
|
+
function validateVideoOutput(output2, field = "output") {
|
|
1871
|
+
if (!isObject(output2))
|
|
1872
|
+
throw new RPCError(`${field} must be an object`);
|
|
1873
|
+
strict(output2, ["duration_seconds", "aspect_ratio", "size", "fps", "audio", "media_type"]);
|
|
1874
|
+
if (output2.duration_seconds !== void 0 && !finiteIn(output2.duration_seconds, 0, 600))
|
|
1875
|
+
throw new RPCError(`${field}.duration_seconds must be a number in (0, 600]`);
|
|
1876
|
+
const ratio = output2.aspect_ratio === void 0 ? void 0 : aspectRatio(output2.aspect_ratio);
|
|
1877
|
+
if (output2.aspect_ratio !== void 0 && !ratio)
|
|
1878
|
+
throw new RPCError(`${field}.aspect_ratio must be \`W:H\` with integers in 1..100`);
|
|
1879
|
+
const edge = (value, name) => {
|
|
1880
|
+
if (!Number.isInteger(value) || value < 16 || value > 8192)
|
|
1881
|
+
throw new RPCError(`${field}.size.${name} must be an integer in 16..8192`);
|
|
1882
|
+
};
|
|
1883
|
+
const size = output2.size;
|
|
1884
|
+
if (size !== void 0) {
|
|
1885
|
+
if (!isObject(size))
|
|
1886
|
+
throw new RPCError(`${field}.size must be { short_edge } or { width, height }`);
|
|
1887
|
+
if ("short_edge" in size) {
|
|
1888
|
+
strict(size, ["short_edge"]);
|
|
1889
|
+
edge(size.short_edge, "short_edge");
|
|
1890
|
+
} else {
|
|
1891
|
+
strict(size, ["width", "height"]);
|
|
1892
|
+
edge(size.width, "width");
|
|
1893
|
+
edge(size.height, "height");
|
|
1894
|
+
if (ratio && reducedRatio(size.width, size.height) !== reducedRatio(...ratio))
|
|
1895
|
+
throw new RPCError(`${field}.size conflicts with aspect_ratio`);
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
if (output2.fps !== void 0 && !finiteIn(output2.fps, 0, 240))
|
|
1899
|
+
throw new RPCError(`${field}.fps must be a number in (0, 240]`);
|
|
1900
|
+
if (output2.audio !== void 0 && !["auto", "generate", "none"].includes(output2.audio))
|
|
1901
|
+
throw new RPCError(`${field}.audio must be auto, generate or none`);
|
|
1902
|
+
if (output2.media_type !== void 0 && !(typeof output2.media_type === "string" && /^video\/[a-z0-9.+-]+$/.test(output2.media_type)))
|
|
1903
|
+
throw new RPCError(`${field}.media_type must be a lowercase video/* MIME type`);
|
|
1904
|
+
}
|
|
1905
|
+
function validateVideoGeneration(request) {
|
|
1906
|
+
const { prompt, negative_prompt: negative, seed } = request;
|
|
1907
|
+
const conditions = request.conditions ?? [];
|
|
1908
|
+
if (prompt !== void 0 && typeof prompt !== "string")
|
|
1909
|
+
throw new RPCError("prompt must be a string");
|
|
1910
|
+
if (!Array.isArray(conditions))
|
|
1911
|
+
throw new RPCError("conditions must be an array");
|
|
1912
|
+
if (!(prompt == null ? void 0 : prompt.trim()) && !conditions.length)
|
|
1913
|
+
throw new RPCError("video generation requires a non-blank prompt or at least one condition");
|
|
1914
|
+
if (negative !== void 0 && (typeof negative !== "string" || !negative.trim()))
|
|
1915
|
+
throw new RPCError("negative_prompt must not be blank when present");
|
|
1916
|
+
if (seed !== void 0 && !(Number.isSafeInteger(seed) && seed >= 0))
|
|
1917
|
+
throw new RPCError("seed must be a non-negative integer");
|
|
1918
|
+
if (conditions.length > VIDEO_MAX_CONDITIONS)
|
|
1919
|
+
throw new RPCError(`video generation accepts at most ${VIDEO_MAX_CONDITIONS} conditions`);
|
|
1920
|
+
const ids = /* @__PURE__ */ new Set();
|
|
1921
|
+
const positions = /* @__PURE__ */ new Set();
|
|
1922
|
+
conditions.forEach((condition, index) => {
|
|
1923
|
+
const field = `conditions[${index}]`;
|
|
1924
|
+
if (!isObject(condition) || !(condition.type in VIDEO_CONDITION_FIELDS))
|
|
1925
|
+
throw new RPCError(`${field}.type must be a video condition type`);
|
|
1926
|
+
strict(condition, VIDEO_CONDITION_FIELDS[condition.type]);
|
|
1927
|
+
if (typeof condition.id !== "string" || !VIDEO_CONDITION_ID.test(condition.id))
|
|
1928
|
+
throw new RPCError(`${field}.id must match ${VIDEO_CONDITION_ID}`);
|
|
1929
|
+
if (ids.has(condition.id.toLowerCase()))
|
|
1930
|
+
throw new RPCError(`${field}.id \`${condition.id}\` is not unique (compared case-insensitively)`);
|
|
1931
|
+
ids.add(condition.id.toLowerCase());
|
|
1932
|
+
validateResourceRef(condition.resource, `${field}.resource`);
|
|
1933
|
+
if (condition.type === "keyframe") {
|
|
1934
|
+
if (!KEYFRAME_POSITIONS.includes(condition.position))
|
|
1935
|
+
throw new RPCError(`${field}.position must be start or end`);
|
|
1936
|
+
if (positions.has(condition.position))
|
|
1937
|
+
throw new RPCError(`${field}: at most one keyframe is allowed per position`);
|
|
1938
|
+
positions.add(condition.position);
|
|
1939
|
+
}
|
|
1940
|
+
if (condition.include_audio !== void 0 && typeof condition.include_audio !== "boolean")
|
|
1941
|
+
throw new RPCError(`${field}.include_audio must be a boolean`);
|
|
1942
|
+
const range = condition.time_range;
|
|
1943
|
+
if (range !== void 0) {
|
|
1944
|
+
if (!isObject(range))
|
|
1945
|
+
throw new RPCError(`${field}.time_range must be an object`);
|
|
1946
|
+
strict(range, ["start_seconds", "end_seconds"]);
|
|
1947
|
+
const { start_seconds: start, end_seconds: end } = range;
|
|
1948
|
+
if (typeof start !== "number" || typeof end !== "number" || !Number.isFinite(start) || !Number.isFinite(end) || start < 0 || start >= end) {
|
|
1949
|
+
throw new RPCError(`${field}.time_range must be finite, non-negative and start before it ends`);
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
});
|
|
1953
|
+
for (const segment of prompt ? parseVideoPrompt(prompt) : []) {
|
|
1954
|
+
if ("reference" in segment && !(request.conditions ?? []).some((condition) => condition.id === segment.reference)) {
|
|
1955
|
+
throw new RPCError(`prompt references unknown condition \`${segment.reference}\``);
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
if (request.output !== void 0)
|
|
1959
|
+
validateVideoOutput(request.output);
|
|
1960
|
+
}
|
|
1961
|
+
function validateVideoEdit(request) {
|
|
1962
|
+
if (typeof request.prompt !== "string" || !request.prompt.trim())
|
|
1963
|
+
throw new RPCError("video edit requires a non-blank prompt");
|
|
1964
|
+
validateResourceRef(request.video, "video");
|
|
1965
|
+
if (request.output !== void 0)
|
|
1966
|
+
validateVideoOutput(request.output);
|
|
1967
|
+
}
|
|
1968
|
+
function videoGenerationRequirement(request) {
|
|
1969
|
+
var _a2, _b;
|
|
1970
|
+
const conditions = request.conditions ?? [];
|
|
1971
|
+
const count = (type) => conditions.filter((condition) => condition.type === type).length;
|
|
1972
|
+
const declared = ((_a2 = request.requirements) == null ? void 0 : _a2.video) ?? {};
|
|
1973
|
+
const requirement = {};
|
|
1974
|
+
const flag = (key, value) => {
|
|
1975
|
+
if (value || declared[key])
|
|
1976
|
+
requirement[key] = true;
|
|
1977
|
+
};
|
|
1978
|
+
flag("prompt", !!((_b = request.prompt) == null ? void 0 : _b.trim()));
|
|
1979
|
+
flag("negative_prompt", request.negative_prompt !== void 0);
|
|
1980
|
+
flag("seed", request.seed !== void 0);
|
|
1981
|
+
for (const [key, type] of [["reference_images", "reference_image"], ["reference_videos", "reference_video"], ["reference_audios", "reference_audio"]]) {
|
|
1982
|
+
const value = Math.max(count(type), declared[key] ?? 0);
|
|
1983
|
+
if (value)
|
|
1984
|
+
requirement[key] = value;
|
|
1985
|
+
}
|
|
1986
|
+
const keyframes = KEYFRAME_POSITIONS.filter((position) => {
|
|
1987
|
+
var _a3;
|
|
1988
|
+
return ((_a3 = declared.keyframes) == null ? void 0 : _a3.includes(position)) || conditions.some((condition) => condition.type === "keyframe" && condition.position === position);
|
|
1989
|
+
});
|
|
1990
|
+
if (keyframes.length)
|
|
1991
|
+
requirement.keyframes = keyframes;
|
|
1992
|
+
flag("reference_video_audio", conditions.some((condition) => condition.type === "reference_video" && condition.include_audio === true));
|
|
1993
|
+
flag("time_ranges", conditions.some((condition) => "time_range" in condition && condition.time_range !== void 0));
|
|
1994
|
+
const own = request.output && Object.values(request.output).some((value) => value !== void 0) ? request.output : void 0;
|
|
1995
|
+
if (own && declared.output && decisionJson(own) !== decisionJson(declared.output))
|
|
1996
|
+
throw new RPCError("requirements.video.output conflicts with the request output");
|
|
1997
|
+
if (!own && declared.output)
|
|
1998
|
+
validateVideoOutput(declared.output, "requirements.video.output");
|
|
1999
|
+
if (own ?? declared.output)
|
|
2000
|
+
requirement.output = own ?? declared.output;
|
|
2001
|
+
return requirement;
|
|
2002
|
+
}
|
|
1747
2003
|
const DEFAULT_QUEUE_CONFIG = {
|
|
1748
2004
|
max_messages: null,
|
|
1749
2005
|
retention_seconds: null,
|
|
@@ -27134,16 +27390,16 @@ class SnClient {
|
|
|
27134
27390
|
return this.call(this.bnsProxyRpc, METHOD_BNS_PUBLISH_DNS_TXT, params);
|
|
27135
27391
|
}
|
|
27136
27392
|
async publishDocument(req) {
|
|
27137
|
-
const
|
|
27393
|
+
const isObject2 = req.document !== null && typeof req.document === "object" && !Array.isArray(req.document);
|
|
27138
27394
|
const jwtParts = typeof req.document === "string" ? req.document.trim().split(".") : [];
|
|
27139
27395
|
const isJwt = jwtParts.length === 3 && jwtParts.every((part) => part.length > 0);
|
|
27140
|
-
if (!
|
|
27396
|
+
if (!isObject2 && !isJwt) {
|
|
27141
27397
|
throw new SnClientError(
|
|
27142
27398
|
"validation",
|
|
27143
27399
|
"publish_document document must be a JSON object or non-empty compact JWT string"
|
|
27144
27400
|
);
|
|
27145
27401
|
}
|
|
27146
|
-
if (req.doc_type.trim().toLowerCase() === "owner" && !
|
|
27402
|
+
if (req.doc_type.trim().toLowerCase() === "owner" && !isObject2) {
|
|
27147
27403
|
throw new SnClientError("validation", "owner document must be a JSON object");
|
|
27148
27404
|
}
|
|
27149
27405
|
const params = {
|
|
@@ -28973,7 +29229,7 @@ export {
|
|
|
28973
29229
|
WORKFLOW_EXECUTE_RPC_TASK_SCHEMA_ID as ay,
|
|
28974
29230
|
WORKFLOW_RUN_TARGET_TASK_SCHEMA_ID as az,
|
|
28975
29231
|
bns_client as b,
|
|
28976
|
-
|
|
29232
|
+
BNS_DNS_TXT_DEFAULT_TTL as b$,
|
|
28977
29233
|
TaskPhase as b0,
|
|
28978
29234
|
isTerminalTaskPhase as b1,
|
|
28979
29235
|
TaskWaitReasonKind as b2,
|
|
@@ -28984,33 +29240,33 @@ export {
|
|
|
28984
29240
|
TaskAction as b7,
|
|
28985
29241
|
TaskGrantScope as b8,
|
|
28986
29242
|
TaskDataScope as b9,
|
|
28987
|
-
|
|
28988
|
-
|
|
28989
|
-
|
|
28990
|
-
|
|
28991
|
-
|
|
28992
|
-
|
|
28993
|
-
|
|
28994
|
-
|
|
28995
|
-
|
|
28996
|
-
|
|
28997
|
-
|
|
28998
|
-
|
|
28999
|
-
|
|
29000
|
-
|
|
29001
|
-
|
|
29002
|
-
|
|
29003
|
-
|
|
29004
|
-
|
|
29005
|
-
|
|
29006
|
-
|
|
29007
|
-
|
|
29008
|
-
|
|
29009
|
-
|
|
29010
|
-
|
|
29011
|
-
|
|
29012
|
-
|
|
29013
|
-
|
|
29243
|
+
AICC_POLICY_REFUSAL_CODES as bA,
|
|
29244
|
+
aiccRefusalOf as bB,
|
|
29245
|
+
isAiccAiMethod as bC,
|
|
29246
|
+
aiccTextMessage as bD,
|
|
29247
|
+
aiccMessageTextContent as bE,
|
|
29248
|
+
aiccMessageFirstText as bF,
|
|
29249
|
+
validateAiccMessage as bG,
|
|
29250
|
+
AiccClient as bH,
|
|
29251
|
+
decisionRequirements as bI,
|
|
29252
|
+
validateDecisionRequest as bJ,
|
|
29253
|
+
validateDecisionAnswers as bK,
|
|
29254
|
+
parseVideoPrompt as bL,
|
|
29255
|
+
validateVideoOutput as bM,
|
|
29256
|
+
validateVideoGeneration as bN,
|
|
29257
|
+
validateVideoEdit as bO,
|
|
29258
|
+
videoGenerationRequirement as bP,
|
|
29259
|
+
KEventReader as bQ,
|
|
29260
|
+
KEventClient as bR,
|
|
29261
|
+
appIdFromDid as bS,
|
|
29262
|
+
parseAppId as bT,
|
|
29263
|
+
appDidFromId as bU,
|
|
29264
|
+
createAppInstanceId as bV,
|
|
29265
|
+
parseAppInstanceId as bW,
|
|
29266
|
+
BNS_EVM_DEFAULT_GAS_LIMIT as bX,
|
|
29267
|
+
BNS_EVM_DEFAULT_MAX_FEE_PER_GAS as bY,
|
|
29268
|
+
BNS_EVM_DEFAULT_MAX_PRIORITY_FEE_PER_GAS as bZ,
|
|
29269
|
+
BNS_MAX_INLINE_DOCUMENT_BYTES as b_,
|
|
29014
29270
|
StorageDomain as ba,
|
|
29015
29271
|
TaskEventType as bb,
|
|
29016
29272
|
TaskManagerClient as bc,
|
|
@@ -29033,11 +29289,19 @@ export {
|
|
|
29033
29289
|
AICC_AI_METHODS as bt,
|
|
29034
29290
|
AICC_CORE_METHODS as bu,
|
|
29035
29291
|
AICC_MANAGEMENT_METHODS as bv,
|
|
29036
|
-
|
|
29037
|
-
|
|
29038
|
-
|
|
29039
|
-
|
|
29292
|
+
AICC_QUOTA_METHODS as bw,
|
|
29293
|
+
AICC_METHODS as bx,
|
|
29294
|
+
AICC_FEATURES as by,
|
|
29295
|
+
AICC_EXECUTION_MODES as bz,
|
|
29040
29296
|
createSDKModule as c,
|
|
29297
|
+
BNS_DNS_TXT_DOC_TYPE as c0,
|
|
29298
|
+
BNS_PUBLISH_DOCUMENT_ABI as c1,
|
|
29299
|
+
BnsEvmTxError as c2,
|
|
29300
|
+
BnsEvmTxBuilder as c3,
|
|
29301
|
+
decodeBnsPublishDocumentCalldata as c4,
|
|
29302
|
+
BnsTxExecutorError as c5,
|
|
29303
|
+
walletUserHasSnAccount as c6,
|
|
29304
|
+
BnsTxExecutor as c7,
|
|
29041
29305
|
BS_SERVICE_TASK_MANAGER as d,
|
|
29042
29306
|
getActiveRuntimeType as e,
|
|
29043
29307
|
getActiveZoneGatewayOrigin as f,
|
|
@@ -29062,4 +29326,4 @@ export {
|
|
|
29062
29326
|
NOTIFY_TEXT_CONTROL_ID as y,
|
|
29063
29327
|
NOTIFY_ACTION_ANSWER as z
|
|
29064
29328
|
};
|
|
29065
|
-
//# sourceMappingURL=ndm_proxy-
|
|
29329
|
+
//# sourceMappingURL=ndm_proxy-6b03b9ec.mjs.map
|