@vibedev-si/dsh-vibedev 0.11.2 → 0.11.4
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/README.md +54 -1
- package/THIRD-PARTY-NOTICES.txt +1 -1
- package/client/client.account-center.js +1341 -9
- package/client/client.js +175 -2
- package/lib/account/center-contract.d.ts +2 -0
- package/lib/account/voice-profile-routes.d.ts +33 -0
- package/lib/audio/request.d.ts +53 -3
- package/lib/audio/voice-profiles.d.ts +207 -0
- package/lib/contracts.d.ts +2 -2
- package/lib/gateway/catalog.d.ts +5 -0
- package/lib/gateway/paid-path.d.ts +11 -0
- package/lib/index.js +1333 -237
- package/lib/tools/voice-profiles.d.ts +30 -0
- package/package.json +1 -1
package/client/client.js
CHANGED
|
@@ -224,7 +224,8 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
|
|
|
224
224
|
redeem: "/redeem",
|
|
225
225
|
affiliate: "/affiliate",
|
|
226
226
|
profile: "/profile",
|
|
227
|
-
messages: "/dashboard"
|
|
227
|
+
messages: "/dashboard",
|
|
228
|
+
voice_profiles: "/dashboard"
|
|
228
229
|
};
|
|
229
230
|
function centerWebUrl(origin, page) {
|
|
230
231
|
return `${new URL(origin).origin}${ACCOUNT_CENTER_WEB_PATHS[page]}`;
|
|
@@ -261,7 +262,8 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
|
|
|
261
262
|
"redeem",
|
|
262
263
|
"affiliate",
|
|
263
264
|
"profile",
|
|
264
|
-
"messages"
|
|
265
|
+
"messages",
|
|
266
|
+
"voice_profiles"
|
|
265
267
|
]);
|
|
266
268
|
function normalizeAccountPage(page) {
|
|
267
269
|
return page === "available_channels" ? "model_prices" : page;
|
|
@@ -2415,6 +2417,175 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
|
|
|
2415
2417
|
msgUnreadCount: "{count} unread notifications"
|
|
2416
2418
|
};
|
|
2417
2419
|
//#endregion
|
|
2420
|
+
//#region src/client/AccountCenter/voice-profile-locales.ts
|
|
2421
|
+
/** The 「我的音色」 page's words (voice profiles for Suno voice covers). Every key has both languages. */
|
|
2422
|
+
const voiceProfileZh = {
|
|
2423
|
+
centerVoiceProfiles: "我的音色",
|
|
2424
|
+
centerVoiceProfilesIntro: "用你自己的人声创建音色,用于 Suno 音色翻唱。创建音色免费,不会生成歌曲。",
|
|
2425
|
+
voiceNewTitle: "新建音色",
|
|
2426
|
+
voiceFile: "人声音频",
|
|
2427
|
+
voiceChooseFile: "选择音频文件",
|
|
2428
|
+
voiceFileHint: "6–60 秒(建议 10–60 秒)、不超过 10 MB,支持 mp3、wav、m4a、aac、flac、ogg;尽量是干净的人声,不带伴奏。",
|
|
2429
|
+
voiceName: "音色名称",
|
|
2430
|
+
voiceNamePlaceholder: "例如:我的主唱音色",
|
|
2431
|
+
voiceCreate: "创建音色",
|
|
2432
|
+
voiceCreateAnother: "再建一个",
|
|
2433
|
+
voiceFileChosen: "{name} · {size}",
|
|
2434
|
+
voiceFileSeconds: "时长 {seconds} 秒",
|
|
2435
|
+
voiceFileSecondsUnknown: "浏览器量不到这段音频的时长,上传后由服务端测量;量不到会提示你换成标准 WAV 或 MP3。",
|
|
2436
|
+
voiceFileShortHint: "不到 10 秒也能创建,但音色还原度通常更好的是 10–60 秒。",
|
|
2437
|
+
voiceStepCheck: "本地检查",
|
|
2438
|
+
voiceStepUpload: "上传并提交",
|
|
2439
|
+
voiceStepProcess: "网关处理中",
|
|
2440
|
+
voiceStepReady: "可以使用",
|
|
2441
|
+
voiceChecking: "正在检查音频格式、大小和时长…",
|
|
2442
|
+
voiceUploading: "正在上传音频并提交,请不要关闭页面…",
|
|
2443
|
+
voiceProcessing: "音色正在创建,已等待 {seconds} 秒。通常需要几十秒,完成后会自动更新。",
|
|
2444
|
+
voiceProcessingSlow: "还在处理中(已等待 {seconds} 秒)。可以先离开,稍后回来刷新查看。",
|
|
2445
|
+
voiceReadyNotice: "音色「{title}」已可用,可在音乐生成里作为音色翻唱使用。",
|
|
2446
|
+
voiceFailedNotice: "音色创建失败:{reason}",
|
|
2447
|
+
voiceFailedUnknown: "网关没有给出原因",
|
|
2448
|
+
voiceList: "我的音色列表",
|
|
2449
|
+
voiceColName: "名称",
|
|
2450
|
+
voiceColStatus: "状态",
|
|
2451
|
+
voiceColDuration: "时长",
|
|
2452
|
+
voiceColCreated: "创建时间",
|
|
2453
|
+
voiceColActions: "操作",
|
|
2454
|
+
voiceStatusProcessing: "创建中",
|
|
2455
|
+
voiceStatusReady: "可用",
|
|
2456
|
+
voiceStatusFailed: "失败",
|
|
2457
|
+
voiceUntitled: "未命名音色",
|
|
2458
|
+
voiceSeconds: "{seconds} 秒",
|
|
2459
|
+
voiceEmpty: "还没有音色",
|
|
2460
|
+
voiceEmptyHint: "上传一段 10–60 秒的干净人声,就能创建你的第一个音色。",
|
|
2461
|
+
voiceLoading: "正在读取音色…",
|
|
2462
|
+
voiceUnsupported: "当前网关尚未开放音色管理。",
|
|
2463
|
+
voiceRefresh: "刷新",
|
|
2464
|
+
voiceDelete: "删除",
|
|
2465
|
+
voiceDeleteTitle: "删除音色「{title}」?",
|
|
2466
|
+
voiceDeleteBody: "删除后该音色将永久关闭、不可恢复,不能再用于新的音色翻唱;已生成的歌曲不受影响。",
|
|
2467
|
+
voiceDeleteConfirm: "永久删除",
|
|
2468
|
+
voiceDeleteCancel: "取消",
|
|
2469
|
+
voiceDeleting: "正在删除…",
|
|
2470
|
+
voiceDeleted: "音色已删除。",
|
|
2471
|
+
voiceFree: "创建音色免费",
|
|
2472
|
+
voiceKeepNote: "音色由网关保存,不保证永久保留;请保留好你的原始录音。",
|
|
2473
|
+
voiceErrFormat: "文件格式不支持:请选择 mp3、wav、m4a、aac、flac 或 ogg 音频。",
|
|
2474
|
+
voiceErrEmpty: "这个文件是空的。",
|
|
2475
|
+
voiceErrTooLarge: "文件超过 10 MB,请压缩或剪短后再试。",
|
|
2476
|
+
voiceErrTooShort: "音频太短:至少需要 6 秒(建议 10–60 秒)。",
|
|
2477
|
+
voiceErrTooLong: "音频太长:最多 60 秒,请剪到 10–60 秒的干净人声。",
|
|
2478
|
+
voiceErrDurationUnknown: "量不到这段音频的时长,请导出为标准 WAV 或 MP3 后重试。",
|
|
2479
|
+
voiceErrUpload: "音频上传失败,音色没有创建,请稍后重试。",
|
|
2480
|
+
voiceErrTitle: "请填写 1–80 个字的音色名称。",
|
|
2481
|
+
voiceErrRead: "读取本地文件失败,请重新选择。",
|
|
2482
|
+
voiceErrAccountChanged: "账号已切换,请刷新页面后再操作。",
|
|
2483
|
+
voiceErrorCode: "错误码 {code}",
|
|
2484
|
+
voiceRejectSimilar: "这段样本和已有录音太像,请换一段干净、独特的人声。",
|
|
2485
|
+
voiceRejectNotClean: "这不是干净的人声:请换一段只有一个人声、不带伴奏和杂音的录音。",
|
|
2486
|
+
voiceRejectOriginal: "原始原因:{reason}",
|
|
2487
|
+
voiceDropTitle: "点击或拖入音频文件",
|
|
2488
|
+
voiceFileAdvice: "建议 10–60 秒、只有一个人声的干净录音,不带伴奏和杂音。",
|
|
2489
|
+
voiceDropActive: "松开即可添加",
|
|
2490
|
+
voiceDropFormats: "mp3 · wav · m4a · aac · flac · ogg,6–60 秒,不超过 10 MB",
|
|
2491
|
+
voiceChangeFile: "重新选择",
|
|
2492
|
+
voiceMeasuring: "正在测量时长…",
|
|
2493
|
+
voicePickFile: "选择音频文件",
|
|
2494
|
+
voiceNameHint: "最多 {max} 个字,只用来在列表里区分音色。",
|
|
2495
|
+
voiceNeedFile: "请先选择一个音频文件",
|
|
2496
|
+
voiceNeedName: "请填写音色名称",
|
|
2497
|
+
voiceListCount: "共 {count} 个",
|
|
2498
|
+
voiceLoadFailed: "音色列表没有读到",
|
|
2499
|
+
voiceUnsupportedTitle: "暂未开放音色管理",
|
|
2500
|
+
voiceRetry: "重试",
|
|
2501
|
+
voiceWaitingGateway: "网关处理中,已等待 {seconds} 秒。较长的样本可能需要 1–3 分钟,请不要关闭页面。",
|
|
2502
|
+
voiceConfirming: "网关没有及时回复,音色可能已经创建,正在确认(已等待 {seconds} 秒)…",
|
|
2503
|
+
voiceUnconfirmed: "网关处理超时。可能已在网关侧创建,请稍后刷新列表确认;若列表没有,再重试。"
|
|
2504
|
+
};
|
|
2505
|
+
const voiceProfileEn = {
|
|
2506
|
+
centerVoiceProfiles: "My voices",
|
|
2507
|
+
centerVoiceProfilesIntro: "Create voice profiles from your own singing voice for Suno voice covers. Creating one is free and makes no song.",
|
|
2508
|
+
voiceNewTitle: "New voice",
|
|
2509
|
+
voiceFile: "Vocal recording",
|
|
2510
|
+
voiceChooseFile: "Choose an audio file",
|
|
2511
|
+
voiceFileHint: "6–60 seconds (10–60 s recommended), up to 10 MB, mp3, wav, m4a, aac, flac or ogg; clean solo vocals without accompaniment work best.",
|
|
2512
|
+
voiceName: "Voice name",
|
|
2513
|
+
voiceNamePlaceholder: "For example: My lead vocal",
|
|
2514
|
+
voiceCreate: "Create voice",
|
|
2515
|
+
voiceCreateAnother: "Create another",
|
|
2516
|
+
voiceFileChosen: "{name} · {size}",
|
|
2517
|
+
voiceFileSeconds: "{seconds} seconds long",
|
|
2518
|
+
voiceFileSecondsUnknown: "The browser could not measure this recording; it will be measured after the upload, and you will be told if it cannot be.",
|
|
2519
|
+
voiceFileShortHint: "Under 10 seconds works, but 10–60 seconds usually captures the voice better.",
|
|
2520
|
+
voiceStepCheck: "Check",
|
|
2521
|
+
voiceStepUpload: "Upload and submit",
|
|
2522
|
+
voiceStepProcess: "Processing",
|
|
2523
|
+
voiceStepReady: "Ready",
|
|
2524
|
+
voiceChecking: "Checking the format, size and length…",
|
|
2525
|
+
voiceUploading: "Uploading and submitting. Keep this page open…",
|
|
2526
|
+
voiceProcessing: "Creating the voice, {seconds} s so far. This usually takes under a minute and updates on its own.",
|
|
2527
|
+
voiceProcessingSlow: "Still processing ({seconds} s so far). You can leave and refresh later.",
|
|
2528
|
+
voiceReadyNotice: "The voice “{title}” is ready for voice covers in music generation.",
|
|
2529
|
+
voiceFailedNotice: "The voice could not be created: {reason}",
|
|
2530
|
+
voiceFailedUnknown: "the gateway gave no reason",
|
|
2531
|
+
voiceList: "My voices",
|
|
2532
|
+
voiceColName: "Name",
|
|
2533
|
+
voiceColStatus: "Status",
|
|
2534
|
+
voiceColDuration: "Length",
|
|
2535
|
+
voiceColCreated: "Created",
|
|
2536
|
+
voiceColActions: "Actions",
|
|
2537
|
+
voiceStatusProcessing: "Creating",
|
|
2538
|
+
voiceStatusReady: "Ready",
|
|
2539
|
+
voiceStatusFailed: "Failed",
|
|
2540
|
+
voiceUntitled: "Untitled voice",
|
|
2541
|
+
voiceSeconds: "{seconds} s",
|
|
2542
|
+
voiceEmpty: "No voices yet",
|
|
2543
|
+
voiceEmptyHint: "Upload 10–60 seconds of clean vocals to create your first voice.",
|
|
2544
|
+
voiceLoading: "Reading voices…",
|
|
2545
|
+
voiceUnsupported: "This gateway does not offer voice profiles yet.",
|
|
2546
|
+
voiceRefresh: "Refresh",
|
|
2547
|
+
voiceDelete: "Delete",
|
|
2548
|
+
voiceDeleteTitle: "Delete the voice “{title}”?",
|
|
2549
|
+
voiceDeleteBody: "The voice will be closed for good and cannot be restored or used for new voice covers. Songs already made with it are not affected.",
|
|
2550
|
+
voiceDeleteConfirm: "Delete permanently",
|
|
2551
|
+
voiceDeleteCancel: "Cancel",
|
|
2552
|
+
voiceDeleting: "Deleting…",
|
|
2553
|
+
voiceDeleted: "The voice was deleted.",
|
|
2554
|
+
voiceFree: "Creating a voice is free",
|
|
2555
|
+
voiceKeepNote: "Voices are kept by the gateway and are not guaranteed forever; keep your original recording.",
|
|
2556
|
+
voiceErrFormat: "Unsupported file: choose an mp3, wav, m4a, aac, flac or ogg recording.",
|
|
2557
|
+
voiceErrEmpty: "This file is empty.",
|
|
2558
|
+
voiceErrTooLarge: "The file is over 10 MB. Compress or shorten it and try again.",
|
|
2559
|
+
voiceErrTooShort: "Too short: at least 6 seconds are needed (10–60 s recommended).",
|
|
2560
|
+
voiceErrTooLong: "Too long: at most 60 seconds. Trim it to 10–60 s of clean vocals.",
|
|
2561
|
+
voiceErrDurationUnknown: "The length of this recording could not be measured. Export it as a standard WAV or MP3 and try again.",
|
|
2562
|
+
voiceErrUpload: "The upload failed and no voice was created. Try again later.",
|
|
2563
|
+
voiceErrTitle: "Enter a voice name of 1–80 characters.",
|
|
2564
|
+
voiceErrRead: "The file could not be read. Choose it again.",
|
|
2565
|
+
voiceErrAccountChanged: "The account changed. Refresh the page and try again.",
|
|
2566
|
+
voiceErrorCode: "Error code {code}",
|
|
2567
|
+
voiceRejectSimilar: "This sample is too similar to an existing recording. Use a different clean, original vocal.",
|
|
2568
|
+
voiceRejectNotClean: "This is not a clean solo vocal. Use a recording of one voice without accompaniment or background noise.",
|
|
2569
|
+
voiceRejectOriginal: "Original reason: {reason}",
|
|
2570
|
+
voiceDropTitle: "Click or drop an audio file here",
|
|
2571
|
+
voiceFileAdvice: "A clean recording of one voice, 10–60 s, without accompaniment or background noise, works best.",
|
|
2572
|
+
voiceDropActive: "Release to add it",
|
|
2573
|
+
voiceDropFormats: "mp3 · wav · m4a · aac · flac · ogg, 6–60 s, up to 10 MB",
|
|
2574
|
+
voiceChangeFile: "Choose another",
|
|
2575
|
+
voiceMeasuring: "Measuring length…",
|
|
2576
|
+
voicePickFile: "Choose an audio file",
|
|
2577
|
+
voiceNameHint: "Up to {max} characters, only to tell your voices apart.",
|
|
2578
|
+
voiceNeedFile: "Choose an audio file first",
|
|
2579
|
+
voiceNeedName: "Enter a name for the voice",
|
|
2580
|
+
voiceListCount: "{count} in total",
|
|
2581
|
+
voiceLoadFailed: "The voice list could not be read",
|
|
2582
|
+
voiceUnsupportedTitle: "Voice profiles are not available yet",
|
|
2583
|
+
voiceRetry: "Try again",
|
|
2584
|
+
voiceWaitingGateway: "The gateway is processing, {seconds} s so far. A longer sample can take 1–3 minutes; keep this page open.",
|
|
2585
|
+
voiceConfirming: "The gateway did not answer in time. The voice may already exist; checking ({seconds} s so far)…",
|
|
2586
|
+
voiceUnconfirmed: "The gateway timed out. The voice may have been created there: refresh the list in a little while to check, and try again only if it is not there."
|
|
2587
|
+
};
|
|
2588
|
+
//#endregion
|
|
2418
2589
|
//#region src/client/AccountCenter/center-locales.ts
|
|
2419
2590
|
const centerZh = {
|
|
2420
2591
|
centerUsagePromo: "限时特惠 −{discount}(原价 {total})",
|
|
@@ -2423,6 +2594,7 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
|
|
|
2423
2594
|
...memberZh,
|
|
2424
2595
|
...businessZh,
|
|
2425
2596
|
...announcementZh,
|
|
2597
|
+
...voiceProfileZh,
|
|
2426
2598
|
centerRechargeIntro: "选择充值金额或订阅,确认费用后完成支付。",
|
|
2427
2599
|
centerOrdersIntro: "查看自己的订单、支付进度和退款申请。",
|
|
2428
2600
|
centerRedeemIntro: "兑换余额或订阅权益,查看兑换记录。",
|
|
@@ -2571,6 +2743,7 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
|
|
|
2571
2743
|
...memberEn,
|
|
2572
2744
|
...businessEn,
|
|
2573
2745
|
...announcementEn,
|
|
2746
|
+
...voiceProfileEn,
|
|
2574
2747
|
centerRechargeIntro: "Choose balance credit or a subscription, review the cost and complete payment.",
|
|
2575
2748
|
centerOrdersIntro: "View your orders, payment progress and refund requests.",
|
|
2576
2749
|
centerRedeemIntro: "Redeem balance or subscription benefits and view history.",
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** An endpoint a usage or error row may show. */
|
|
2
|
+
export declare function safeEndpoint(value: string): boolean;
|
|
1
3
|
export declare const CENTER_READ_PATHS: readonly ["auth/me", "usage", "usage/dashboard/stats", "usage/dashboard/trend", "usage/dashboard/models", "subscriptions/summary", "entitlements", "usage/stats", "usage/details", "usage/errors", "usage/errors/detail", "usage/dashboard/snapshot-v2", "groups/available", "user/platform-quotas", "subscriptions", "subscriptions/progress", "model-plaza", "channel-monitor-v2/dimensions", "channel-monitor-v2/snapshot", "channel-monitor-v2/models", "channel-monitor-v2/matrix", "channel-monitor-v2/errors", "channel-monitors/status", "channel-monitors/detail", "payment/config", "payment/checkout-info", "payment/plans", "payment/limits", "payment/orders/my", "payment/orders/detail", "payment/orders/refund-eligible-providers", "redeem/history", "affiliate", "affiliate/program", "affiliate/consumption-rules", "affiliate/consumption", "profile", "actions/status"];
|
|
2
4
|
export type CenterReadPath = typeof CENTER_READ_PATHS[number];
|
|
3
5
|
export declare function positiveCenterId(value: string): boolean;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The account center's 「我的音色」 routes (answers are never cached; credentials and provider ids never leave):
|
|
3
|
+
*
|
|
4
|
+
* - `GET /api/dsh-vibedev/voice-profiles` — `{ code: 0, data: { items, limits } }`, or `{ unsupported: true }` when
|
|
5
|
+
* the gateway has no voice profiles;
|
|
6
|
+
* - `POST /api/dsh-vibedev/voice-profiles` — `{ title, filename, data (base64), expected_user_id }`: checked, uploaded
|
|
7
|
+
* and created; answers the profile, usually still `processing` (the page then reads the list until it settles);
|
|
8
|
+
* - `POST /api/dsh-vibedev/voice-profiles/delete` — `{ id, expected_user_id }`: closes a `vp_…` profile for good.
|
|
9
|
+
*
|
|
10
|
+
* Every call is held to the account the page shows (`X-VibeDev-Expected-User` or `expected_user_id`): a different
|
|
11
|
+
* signed-in account answers 409 `ACCOUNT_CHANGED` and nothing is sent.
|
|
12
|
+
* @module dsh-vibedev/account/voice-profile-routes
|
|
13
|
+
*/
|
|
14
|
+
import type { ConnectionFetchRoute } from '@deepseek-ai/dsh-client-connection';
|
|
15
|
+
import type { AccountService } from './index.js';
|
|
16
|
+
import type { VoiceProfiles } from '../audio/voice-profiles.js';
|
|
17
|
+
export declare const VOICE_PROFILE_ROUTE = "/api/dsh-vibedev/voice-profiles";
|
|
18
|
+
export declare const VOICE_PROFILE_DELETE_ROUTE = "/api/dsh-vibedev/voice-profiles/delete";
|
|
19
|
+
/** The limits the page checks before it uploads. */
|
|
20
|
+
export declare const VOICE_PAGE_LIMITS: {
|
|
21
|
+
maxBytes: number;
|
|
22
|
+
minSeconds: 6;
|
|
23
|
+
maxSeconds: 60;
|
|
24
|
+
recommendedMinSeconds: 10;
|
|
25
|
+
extensions: readonly string[];
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* The routes.
|
|
29
|
+
* @param voices - the voice-profile service.
|
|
30
|
+
* @param account - the signed-in account, for the account guard.
|
|
31
|
+
* @returns routes for the client connection.
|
|
32
|
+
*/
|
|
33
|
+
export declare function voiceProfileRoutes(voices: VoiceProfiles, account: Pick<AccountService, 'identity'>): ConnectionFetchRoute[];
|
package/lib/audio/request.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* | kind | wire fields |
|
|
9
9
|
* | ------- | --------------------------------------------------------------- |
|
|
10
|
-
* | music | model, prompt, lyrics, genre, mood, gender
|
|
10
|
+
* | music | model, prompt, lyrics, genre, mood, gender; as declared: style, title, instrumental, voice_id, source_audio_url, audio_weight, mode |
|
|
11
11
|
* | podcast | model, prompt, source_url |
|
|
12
12
|
* | speech | as declared; Seed: model, text_prompt, references, audio_config, watermark |
|
|
13
13
|
*
|
|
@@ -54,6 +54,27 @@ export interface AudioRequest {
|
|
|
54
54
|
readonly sampleRate?: number;
|
|
55
55
|
/** Speech: whether the provider adds its watermark, when the model takes the field. */
|
|
56
56
|
readonly watermark?: boolean;
|
|
57
|
+
/** Music: a style description, when the model declares `style`. */
|
|
58
|
+
readonly style?: string;
|
|
59
|
+
/** Music: the song's title, when the model declares `title`. */
|
|
60
|
+
readonly title?: string;
|
|
61
|
+
/** Music: make it without vocals, when the model declares `instrumental`. */
|
|
62
|
+
readonly instrumental?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Music (音色翻唱): a voice profile (`vp_…`, see `audio/voice-profiles`) sent as `voice_id` to a model that declares
|
|
65
|
+
* it. No other voice id is accepted.
|
|
66
|
+
*/
|
|
67
|
+
readonly voiceId?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Music (上传翻唱): the song to cover — a workspace path, a `chat:` attachment (`chat:1` audio, `chat:video:1`) or an
|
|
70
|
+
* https link. It is uploaded to the media library and its public HTTPS link goes in `source_audio_url`.
|
|
71
|
+
*/
|
|
72
|
+
readonly sourceAudio?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Music covers only (`cover` or `voice_cover`, see {@link MusicMode}): how closely the result follows the reference
|
|
75
|
+
* audio, 0–1 inclusive, sent as `audio_weight` to a model that declares it.
|
|
76
|
+
*/
|
|
77
|
+
readonly audioWeight?: number;
|
|
57
78
|
/** Not an audio-generation parameter; refused for music and podcasts, and for speech unless declared. */
|
|
58
79
|
readonly duration?: number;
|
|
59
80
|
/**
|
|
@@ -63,6 +84,28 @@ export interface AudioRequest {
|
|
|
63
84
|
*/
|
|
64
85
|
readonly operationId?: string;
|
|
65
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* How a music request is made, derived from its inputs and never chosen by the caller:
|
|
89
|
+
*
|
|
90
|
+
* | voiceId | sourceAudio | mode |
|
|
91
|
+
* | ------- | ----------- | ------------- |
|
|
92
|
+
* | yes | either | `voice_cover` |
|
|
93
|
+
* | no | yes | `cover` |
|
|
94
|
+
* | no | no | `generate` |
|
|
95
|
+
*
|
|
96
|
+
* Sent as `mode` to a model that declares the field.
|
|
97
|
+
*/
|
|
98
|
+
export type MusicMode = 'generate' | 'cover' | 'voice_cover';
|
|
99
|
+
/**
|
|
100
|
+
* The mode a music request derives (see {@link MusicMode}).
|
|
101
|
+
* @param request - the request.
|
|
102
|
+
* @returns the mode.
|
|
103
|
+
*/
|
|
104
|
+
export declare function musicModeOf(request: Pick<AudioRequest, 'voiceId' | 'sourceAudio'>): MusicMode;
|
|
105
|
+
/** The song to cover: audio, or a video whose sound is used. */
|
|
106
|
+
export declare const SOURCE_AUDIO_MIMES: readonly string[];
|
|
107
|
+
/** The largest song to cover: the provider recommends 8–10 MB, so 10 MiB is held here before anything is uploaded. */
|
|
108
|
+
export declare const SOURCE_AUDIO_MAX_BYTES: number;
|
|
66
109
|
/**
|
|
67
110
|
* What an audio model makes, from its declaration only.
|
|
68
111
|
* @param model - the model.
|
|
@@ -87,11 +130,18 @@ export declare function audioConfigOf(model: MediaModel, format: string | undefi
|
|
|
87
130
|
* @throws {@link MediaError} for a field the model does not take, a missing text, or a value outside the declared choices.
|
|
88
131
|
*/
|
|
89
132
|
export declare function audioRequestBody(model: MediaModel, request: AudioRequest): Record<string, unknown>;
|
|
133
|
+
/** Whether a model sings in a voice profile, as the catalog declares it (`audio.supports_voice_cover`). */
|
|
134
|
+
export declare function supportsVoiceCover(model: MediaModel): boolean;
|
|
90
135
|
/**
|
|
91
136
|
* Choose the model for a request: the one named (an id or an alias), else the
|
|
92
137
|
* pinned or first model of the kind. A named model must make the kind asked for.
|
|
138
|
+
*
|
|
139
|
+
* Music without a named model: a voice cover (`voice_cover`) takes the first model that declares
|
|
140
|
+
* `supports_voice_cover: true` (see {@link chooseVoiceCoverModel}); a cover or a plain song follows `musicModel` as
|
|
141
|
+
* before, preferring a model that declares the fields the request uses and not a voice-cover model unless
|
|
142
|
+
* `musicModel` itself names it.
|
|
93
143
|
*/
|
|
94
|
-
export declare function chooseAudioModel(runtime: MediaRuntime, request: Pick<AudioRequest, 'kind' | 'model'>, signal?: AbortSignal): Promise<MediaModel>;
|
|
144
|
+
export declare function chooseAudioModel(runtime: MediaRuntime, request: Pick<AudioRequest, 'kind' | 'model'> & Partial<AudioRequest>, signal?: AbortSignal): Promise<MediaModel>;
|
|
95
145
|
/** A checked, priced audio task ready to submit. */
|
|
96
146
|
export interface PreparedAudio {
|
|
97
147
|
readonly model: MediaModel;
|
|
@@ -116,7 +166,7 @@ export declare function prepareAudioTask(runtime: MediaRuntime, call: MediaCall,
|
|
|
116
166
|
/** One field of an audio form, for interfaces that build their form from the catalog. */
|
|
117
167
|
export interface AudioFormField {
|
|
118
168
|
/** The {@link AudioRequest} key. */
|
|
119
|
-
readonly key: 'prompt' | 'lyrics' | 'genre' | 'mood' | 'gender' | 'sourceUrl' | 'references' | 'format' | 'sampleRate' | 'watermark';
|
|
169
|
+
readonly key: 'prompt' | 'lyrics' | 'style' | 'title' | 'instrumental' | 'genre' | 'mood' | 'gender' | 'sourceUrl' | 'voiceId' | 'sourceAudio' | 'audioWeight' | 'references' | 'format' | 'sampleRate' | 'watermark';
|
|
120
170
|
/** The wire field it is sent as. */
|
|
121
171
|
readonly wire: string;
|
|
122
172
|
readonly required: boolean;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Voice profiles (音色): a user's own singing voice, kept by the gateway under a
|
|
3
|
+
* `vp_…` id that `audio_generate` passes as `voice_id` to a model declaring it
|
|
4
|
+
* (Suno V6 音色翻唱). The gateway's OpenAI-style endpoints:
|
|
5
|
+
*
|
|
6
|
+
* | call | what |
|
|
7
|
+
* | -------------------------------------- | -------------------------------------- |
|
|
8
|
+
* | `POST /v1/audio/voice-profiles` | `{ model, file_url, title }` → profile |
|
|
9
|
+
* | `GET /v1/audio/voice-profiles` | the account's profiles |
|
|
10
|
+
* | `DELETE /v1/audio/voice-profiles/{id}` | close one for good |
|
|
11
|
+
*
|
|
12
|
+
* Creating a profile is free and makes no song. The audio is checked here first
|
|
13
|
+
* (type, ≤ 10 MiB, 6–60 s), uploaded to the media library under the
|
|
14
|
+
* `audio_reference` purpose like speech references, and its public HTTPS link
|
|
15
|
+
* goes in `file_url`. A profile is usable only once its status is `ready`.
|
|
16
|
+
*
|
|
17
|
+
* Only `vp_…` ids ever cross this module: a provider's own voice id is never
|
|
18
|
+
* read out of an answer, never accepted as input, and is scrubbed from the
|
|
19
|
+
* failure reasons shown to the user.
|
|
20
|
+
* @module dsh-vibedev/audio/voice-profiles
|
|
21
|
+
*/
|
|
22
|
+
import type { UploadedAsset } from '../gateway/assets.js';
|
|
23
|
+
import type { GatewayHttp } from '../gateway/http.js';
|
|
24
|
+
import type { LoadedMedia } from '../media/sources.js';
|
|
25
|
+
/** The gateway endpoint. */
|
|
26
|
+
export declare const VOICE_PROFILES_PATH = "/v1/audio/voice-profiles";
|
|
27
|
+
/** The model a profile is created for. */
|
|
28
|
+
export declare const VOICE_PROFILE_MODEL = "suno-v6-vibedev";
|
|
29
|
+
/** The only id form accepted or shown. */
|
|
30
|
+
export declare const VOICE_PROFILE_ID: RegExp;
|
|
31
|
+
/** The media-library purpose the voice sample is uploaded under. */
|
|
32
|
+
export declare const VOICE_PROFILE_PURPOSE = "audio_reference";
|
|
33
|
+
/** What the gateway takes as a voice sample. */
|
|
34
|
+
export declare const VOICE_SAMPLE_LIMITS: {
|
|
35
|
+
readonly maxBytes: number;
|
|
36
|
+
readonly minSeconds: 6;
|
|
37
|
+
readonly maxSeconds: 60;
|
|
38
|
+
/** Below this the voice is usually less faithful; the interfaces recommend it. */
|
|
39
|
+
readonly recommendedMinSeconds: 10;
|
|
40
|
+
readonly extensions: readonly string[];
|
|
41
|
+
readonly mimes: readonly string[];
|
|
42
|
+
};
|
|
43
|
+
/** Longest profile title. */
|
|
44
|
+
export declare const VOICE_TITLE_MAX = 80;
|
|
45
|
+
/** How long the creation request may take: Suno can need well over a minute for a longer sample. */
|
|
46
|
+
export declare const VOICE_CREATE_TIMEOUT_MS = 180000;
|
|
47
|
+
/** How long the list is read for a profile whose creation ended without an answer. */
|
|
48
|
+
export declare const VOICE_CONFIRM_TIMEOUT_MS = 180000;
|
|
49
|
+
/**
|
|
50
|
+
* The creation's `Idempotency-Key`: the same sample under the same title always sends the same key, so a retry is the
|
|
51
|
+
* same operation to a gateway that deduplicates by it; a different title is a different profile.
|
|
52
|
+
* @param data - the sample's bytes.
|
|
53
|
+
* @param title - the checked title.
|
|
54
|
+
* @returns `vp-` and 32 hex digits.
|
|
55
|
+
*/
|
|
56
|
+
export declare function voiceIdempotencyKey(data: Uint8Array, title: string): string;
|
|
57
|
+
/** A creation whose outcome the client cannot know: no answer in time, no connection, or the gateway's 504. */
|
|
58
|
+
export declare function voiceOutcomeUnknown(error: unknown): boolean;
|
|
59
|
+
/** A profile's state: being made, usable, refused, or closed. */
|
|
60
|
+
export type VoiceProfileStatus = 'processing' | 'ready' | 'failed' | 'deleted';
|
|
61
|
+
/** Why a provider refused a voice sample, in words a person understands. */
|
|
62
|
+
export type VoiceRejection = 'similar_recording' | 'too_short' | 'too_long' | 'format' | 'not_clean_vocal';
|
|
63
|
+
/**
|
|
64
|
+
* Provider refusals and what they mean, checked in order against the reason and the code (Suno refuses a sample that
|
|
65
|
+
* "matches an existing recording", for one). A reason none of them matches is shown as it came, scrubbed.
|
|
66
|
+
*/
|
|
67
|
+
export declare const VOICE_REJECTIONS: ReadonlyArray<{
|
|
68
|
+
readonly kind: VoiceRejection;
|
|
69
|
+
readonly pattern: RegExp;
|
|
70
|
+
readonly en: string;
|
|
71
|
+
readonly zh: string;
|
|
72
|
+
}>;
|
|
73
|
+
/**
|
|
74
|
+
* The plain meaning of a provider refusal.
|
|
75
|
+
* @param reason - the provider's reason, and/or its code.
|
|
76
|
+
* @returns the rejection, or undefined when none matches.
|
|
77
|
+
*/
|
|
78
|
+
export declare function voiceRejectionOf(...texts: ReadonlyArray<string | undefined>): (typeof VOICE_REJECTIONS)[number] | undefined;
|
|
79
|
+
/** One profile, as this plugin shows it: an allow-listed projection of the gateway's answer. */
|
|
80
|
+
export interface VoiceProfile {
|
|
81
|
+
readonly id: string;
|
|
82
|
+
readonly title?: string;
|
|
83
|
+
readonly status: VoiceProfileStatus;
|
|
84
|
+
/** The gateway's own status word, for diagnostics (`pending`, `ready`, …). */
|
|
85
|
+
readonly rawStatus?: string;
|
|
86
|
+
/** Why it failed, scrubbed of links, tokens and provider ids. */
|
|
87
|
+
readonly failureReason?: string;
|
|
88
|
+
/** What a recognised refusal means ({@link VOICE_REJECTIONS}); the interfaces word it themselves. */
|
|
89
|
+
readonly failureKind?: VoiceRejection;
|
|
90
|
+
readonly failureCode?: string;
|
|
91
|
+
readonly durationSeconds?: number;
|
|
92
|
+
/** ISO 8601. */
|
|
93
|
+
readonly createdAt?: string;
|
|
94
|
+
readonly model?: string;
|
|
95
|
+
}
|
|
96
|
+
/** Map the gateway's status word; anything not settled counts as still being made. */
|
|
97
|
+
export declare function voiceStatusOf(raw: string | undefined): VoiceProfileStatus;
|
|
98
|
+
/**
|
|
99
|
+
* A failure reason safe to show: no links, bearer tokens or long opaque ids (a provider's voice id would be one),
|
|
100
|
+
* at most 300 characters. `vp_…` ids stay.
|
|
101
|
+
*/
|
|
102
|
+
export declare function scrubReason(value: string): string;
|
|
103
|
+
/**
|
|
104
|
+
* Read one profile from a gateway answer. Only the allow-listed fields are kept, and an entry whose id is not a
|
|
105
|
+
* `vp_…` id is dropped whole, so a provider id can never reach a caller.
|
|
106
|
+
* @param value - one entry, or `{ data: entry }`.
|
|
107
|
+
* @returns the profile, or undefined.
|
|
108
|
+
*/
|
|
109
|
+
export declare function parseVoiceProfile(value: unknown): VoiceProfile | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* Read a list answer: `{ data: [...] }`, `{ items: [...] }`, `{ data: { items: [...] } }` or a bare array.
|
|
112
|
+
* @param value - the answer.
|
|
113
|
+
* @returns the profiles, newest first when the gateway dates them.
|
|
114
|
+
*/
|
|
115
|
+
export declare function parseVoiceProfiles(value: unknown): VoiceProfile[];
|
|
116
|
+
/**
|
|
117
|
+
* Check a profile id before it is sent: only `vp_…` ids.
|
|
118
|
+
* @param id - what the caller passed.
|
|
119
|
+
* @returns the trimmed id.
|
|
120
|
+
* @throws {@link MediaError} `VOICE_PROFILE_ID_INVALID` for anything else (a provider's own id included).
|
|
121
|
+
*/
|
|
122
|
+
export declare function checkVoiceProfileId(id: unknown, field?: string): string;
|
|
123
|
+
/** Check a title: required, trimmed, at most {@link VOICE_TITLE_MAX} characters, no control characters. */
|
|
124
|
+
export declare function checkVoiceTitle(title: unknown): string;
|
|
125
|
+
/**
|
|
126
|
+
* The length of a PCM WAV or a FLAC file from its header, when it can be read without decoding.
|
|
127
|
+
* Other formats are measured by the media library after the upload.
|
|
128
|
+
* @param data - the file bytes.
|
|
129
|
+
* @returns seconds, or undefined.
|
|
130
|
+
*/
|
|
131
|
+
export declare function headerSeconds(data: Uint8Array): number | undefined;
|
|
132
|
+
/** One local check failure: which rule, for interfaces that word it themselves. */
|
|
133
|
+
export type VoiceSampleRule = 'format' | 'too_large' | 'empty' | 'too_short' | 'too_long';
|
|
134
|
+
/**
|
|
135
|
+
* Check a voice sample before anything is uploaded: type (extension or sniffed MIME on the allow-list), size, and —
|
|
136
|
+
* when its header tells — its length.
|
|
137
|
+
* @param media - the loaded file.
|
|
138
|
+
* @returns the length read from the header, when there was one.
|
|
139
|
+
* @throws {@link MediaError} with `rule` naming the broken limit.
|
|
140
|
+
*/
|
|
141
|
+
export declare function checkVoiceSample(media: Pick<LoadedMedia, 'name' | 'mime' | 'data' | 'source'>): {
|
|
142
|
+
seconds?: number;
|
|
143
|
+
};
|
|
144
|
+
/** Check a measured length against 6–60 s. */
|
|
145
|
+
export declare function checkVoiceSeconds(seconds: number, source: string): void;
|
|
146
|
+
/** What the service needs. */
|
|
147
|
+
export interface VoiceProfilesOptions {
|
|
148
|
+
readonly http: GatewayHttp;
|
|
149
|
+
/** The media library's upload (deduplicated, refreshed when its link is about to expire). */
|
|
150
|
+
readonly upload: (media: LoadedMedia, purpose: string, signal?: AbortSignal) => Promise<UploadedAsset>;
|
|
151
|
+
/** Waits between status reads; a test seam. */
|
|
152
|
+
readonly sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
153
|
+
readonly now?: () => number;
|
|
154
|
+
/** How long a creation without an answer is confirmed from the list; {@link VOICE_CONFIRM_TIMEOUT_MS} by default. */
|
|
155
|
+
readonly confirmTimeoutMs?: number;
|
|
156
|
+
}
|
|
157
|
+
/** Per-request options: cancellation, and the account guard of the account center. */
|
|
158
|
+
export interface VoiceRequestOptions {
|
|
159
|
+
readonly signal?: AbortSignal;
|
|
160
|
+
readonly isCurrentAccount?: () => Promise<boolean>;
|
|
161
|
+
}
|
|
162
|
+
/** How {@link VoiceProfiles.waitUntilSettled} reports progress. */
|
|
163
|
+
export interface VoiceWaitOptions extends VoiceRequestOptions {
|
|
164
|
+
/** Give up waiting after this long (the profile goes on being made). Default 3 minutes. */
|
|
165
|
+
readonly timeoutMs?: number;
|
|
166
|
+
readonly onProgress?: (profile: VoiceProfile, elapsedMs: number) => void;
|
|
167
|
+
}
|
|
168
|
+
/** The voice-profile endpoints, with the local checks and the upload in front of a creation. */
|
|
169
|
+
export declare class VoiceProfiles {
|
|
170
|
+
private readonly options;
|
|
171
|
+
private readonly sleep;
|
|
172
|
+
private readonly now;
|
|
173
|
+
constructor(options: VoiceProfilesOptions);
|
|
174
|
+
private request;
|
|
175
|
+
/** The account's profiles (closed ones left out). */
|
|
176
|
+
list(options?: VoiceRequestOptions): Promise<VoiceProfile[]>;
|
|
177
|
+
/** One profile, read from the list (the gateway offers no single read). */
|
|
178
|
+
get(id: string, options?: VoiceRequestOptions): Promise<VoiceProfile | undefined>;
|
|
179
|
+
/**
|
|
180
|
+
* Check, upload and create one profile. Nothing is created when a check fails, the upload fails, the media library
|
|
181
|
+
* hands back no public HTTPS link, or the measured length is outside 6–60 s.
|
|
182
|
+
* @param media - the loaded voice sample.
|
|
183
|
+
* @param title - the profile's name.
|
|
184
|
+
* @param options - cancellation and the account guard.
|
|
185
|
+
* @returns the profile as the gateway answered (often still being made).
|
|
186
|
+
*/
|
|
187
|
+
create(media: LoadedMedia, title: string, options?: VoiceRequestOptions): Promise<VoiceProfile>;
|
|
188
|
+
/**
|
|
189
|
+
* Find the profile a creation without an answer made: read the list (after 3 s, 5 s, then every 10 s, for up to
|
|
190
|
+
* three minutes) for an id that was not there before, the one under the same title first. Without the earlier list,
|
|
191
|
+
* only a profile under the same title counts.
|
|
192
|
+
* @throws {@link MediaError} `VOICE_PROFILE_UNCONFIRMED` (retryable, outcome unknown, nothing charged) when none appears.
|
|
193
|
+
*/
|
|
194
|
+
private confirmCreated;
|
|
195
|
+
/**
|
|
196
|
+
* Close one profile for good. Songs already made with it are not affected.
|
|
197
|
+
* @param id - a `vp_…` id.
|
|
198
|
+
*/
|
|
199
|
+
remove(id: string, options?: VoiceRequestOptions): Promise<void>;
|
|
200
|
+
/**
|
|
201
|
+
* Read the profile until it is ready or failed, or the wait runs out: 2 s, then 3 s, 5 s and every 8 s.
|
|
202
|
+
* @param id - the profile.
|
|
203
|
+
* @param options - cancellation, the time limit and a progress callback.
|
|
204
|
+
* @returns the last state read; `processing` when the wait ran out.
|
|
205
|
+
*/
|
|
206
|
+
waitUntilSettled(id: string, options?: VoiceWaitOptions): Promise<VoiceProfile>;
|
|
207
|
+
}
|
package/lib/contracts.d.ts
CHANGED
|
@@ -8,9 +8,9 @@ export interface BillingSource {
|
|
|
8
8
|
readonly kind: 'balance' | 'subscription';
|
|
9
9
|
readonly subscriptionId?: string | null;
|
|
10
10
|
}
|
|
11
|
-
export declare const ACCOUNT_PAGES: readonly ["dashboard", "usage", "subscriptions", "available_channels", "channel_status", "model_prices", "recharge", "orders", "redeem", "affiliate", "profile", "messages"];
|
|
11
|
+
export declare const ACCOUNT_PAGES: readonly ["dashboard", "usage", "subscriptions", "available_channels", "channel_status", "model_prices", "recharge", "orders", "redeem", "affiliate", "profile", "messages", "voice_profiles"];
|
|
12
12
|
export type AccountCenterPage = typeof ACCOUNT_PAGES[number];
|
|
13
|
-
export declare const NATIVE_ACCOUNT_PAGES: Set<"dashboard" | "usage" | "subscriptions" | "available_channels" | "channel_status" | "model_prices" | "recharge" | "orders" | "redeem" | "affiliate" | "profile" | "messages">;
|
|
13
|
+
export declare const NATIVE_ACCOUNT_PAGES: Set<"dashboard" | "usage" | "subscriptions" | "available_channels" | "channel_status" | "model_prices" | "recharge" | "orders" | "redeem" | "affiliate" | "profile" | "messages" | "voice_profiles">;
|
|
14
14
|
export declare function normalizeAccountPage(page: AccountCenterPage): AccountCenterPage;
|
|
15
15
|
export interface MediaAccountContext {
|
|
16
16
|
readonly gatewayOrigin: string;
|
package/lib/gateway/catalog.d.ts
CHANGED
|
@@ -199,6 +199,11 @@ export interface AudioCapabilities {
|
|
|
199
199
|
* that way (Seed's `watermark_fields`); absent, the watermark is a boolean.
|
|
200
200
|
*/
|
|
201
201
|
readonly watermarkFields?: readonly string[];
|
|
202
|
+
/**
|
|
203
|
+
* The model sings in a voice profile (`audio.supports_voice_cover: true`): only such a model takes a `voice_cover`
|
|
204
|
+
* request. Absent (or false), a `voice_id` would be ignored, so the model is never used for one.
|
|
205
|
+
*/
|
|
206
|
+
readonly supportsVoiceCover?: true;
|
|
202
207
|
/** Transcription input limits. */
|
|
203
208
|
readonly maxInputBytes?: number;
|
|
204
209
|
readonly maxInputSeconds?: number;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which accepted gateway requests may have spent money, so the balance is read again after them.
|
|
3
|
+
* @module dsh-vibedev/gateway/paid-path
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Whether an accepted request may have been charged.
|
|
7
|
+
* @param method - the HTTP method.
|
|
8
|
+
* @param path - the request path, without the query.
|
|
9
|
+
* @returns true for a POST to a generation or transcription endpoint.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isPaidRequest(method: string, path: string): boolean;
|