@vibedev-si/dsh-vibedev 0.11.1 → 0.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -3
- package/THIRD-PARTY-NOTICES.txt +3 -3
- package/client/client.account-center.js +1029 -9
- package/client/client.js +141 -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 +184 -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 +1786 -333
- package/lib/llm/adapter.d.ts +29 -2
- package/lib/llm/catalog.d.ts +7 -0
- package/lib/llm/context.d.ts +8 -1
- package/lib/llm/native-files.d.ts +132 -0
- package/lib/tools/voice-profiles.d.ts +30 -0
- package/package.json +1 -1
package/lib/llm/adapter.d.ts
CHANGED
|
@@ -26,8 +26,9 @@
|
|
|
26
26
|
*/
|
|
27
27
|
import { LlmAdapter } from '@deepseek-ai/dsh-llm';
|
|
28
28
|
import type { GenerateOptions, ImageAttachmentAccess, LlmModelInfo, LlmProviderInfo, LlmResolvedModelInfo, PreparedAdapterCall, ResolvedRetryPolicy, StreamChunk } from '@deepseek-ai/dsh-llm';
|
|
29
|
-
import type { AttachmentStore, ImageAttachmentRef } from '@deepseek-ai/dsh-attachment';
|
|
29
|
+
import type { AttachmentStore, FileAttachmentRef, ImageAttachmentRef } from '@deepseek-ai/dsh-attachment';
|
|
30
30
|
import type { GatewayModel } from './catalog.js';
|
|
31
|
+
import type { FileRequestTarget } from './native-files.js';
|
|
31
32
|
import { type ActivePromotion } from './promotions.js';
|
|
32
33
|
import { type ClaudeCacheTtl } from './cache-ttl.js';
|
|
33
34
|
/** The credential for one request. */
|
|
@@ -98,6 +99,16 @@ export interface GatewayAdapterOptions {
|
|
|
98
99
|
model: string;
|
|
99
100
|
reason: string;
|
|
100
101
|
}) => void;
|
|
102
|
+
/**
|
|
103
|
+
* One audio/video file request assembly kept for native delivery goes as its handle text alone (no attachment
|
|
104
|
+
* service, a failed read, a ceiling). Default: `console.warn`. Never fails the request.
|
|
105
|
+
*/
|
|
106
|
+
readonly onNativeFileDegrade?: (detail: {
|
|
107
|
+
provider: string;
|
|
108
|
+
model: string;
|
|
109
|
+
file: string;
|
|
110
|
+
reason: string;
|
|
111
|
+
}) => void;
|
|
101
112
|
/** A request reached the gateway and ended, however it ended: it may have been charged. */
|
|
102
113
|
readonly onRequestEnded?: () => void;
|
|
103
114
|
/**
|
|
@@ -132,6 +143,20 @@ export declare class GatewayAdapter extends LlmAdapter {
|
|
|
132
143
|
* screenshot again afterwards and put the model's coordinates out of step with the tool's.
|
|
133
144
|
*/
|
|
134
145
|
imageRequestTarget(_provider: string, _model: string, image: ImageAttachmentRef): import("./context.js").CompatImageRequestTarget;
|
|
146
|
+
/**
|
|
147
|
+
* The raw-byte target under which this route delivers one audio/video file natively (the VibeDev fork's
|
|
148
|
+
* `LlmAdapter.fileRequestTarget`; hosts without it never ask). Chat Completions models that declare audio or video
|
|
149
|
+
* get the host's per-file ceiling and the media types they take inline (`GEMINI_INLINE_MEDIA_TYPES`; hosts that
|
|
150
|
+
* predate `mediaTypes` ignore it, and the plugin checks it again after the read); every other model — Claude over
|
|
151
|
+
* Messages, GPT over Responses, a model that declares neither — gets none, so request assembly sends those files as
|
|
152
|
+
* handle text. Synchronous and I/O-free; request assembly also checks the file's kind against the model's
|
|
153
|
+
* `inputModalities`.
|
|
154
|
+
*
|
|
155
|
+
* Not marked `override`: the Harness types this plugin builds against do not declare the hook yet.
|
|
156
|
+
*/
|
|
157
|
+
fileRequestTarget(provider: string, model: string, _file: FileAttachmentRef): FileRequestTarget | undefined;
|
|
158
|
+
/** {@link fileRequestTarget} on one snapshot, so a request reads its files under the catalog it began with. */
|
|
159
|
+
private fileTargetIn;
|
|
135
160
|
providerInfo(provider: string): LlmProviderInfo;
|
|
136
161
|
providerRetryPolicy(provider: string): ResolvedRetryPolicy | undefined;
|
|
137
162
|
listModels(provider: string): Promise<readonly GatewayListedModel[]>;
|
|
@@ -146,7 +171,9 @@ export declare class GatewayAdapter extends LlmAdapter {
|
|
|
146
171
|
/**
|
|
147
172
|
* Fit pi-ai's payload to the gateway: Chat Completions gets the session's cache key (pi-ai sends it
|
|
148
173
|
* only to api.openai.com), "off" is spelled out where the catalog offers `none`, and Responses
|
|
149
|
-
* drops `temperature` while reasoning, which reasoning models refuse.
|
|
174
|
+
* drops `temperature` while reasoning, which reasoning models refuse. Chat Completions also gets
|
|
175
|
+
* its native audio/video files: each marker the conversion left becomes a `file` part, in place in
|
|
176
|
+
* a user message and in a user message after the tool messages for a tool result.
|
|
150
177
|
*/
|
|
151
178
|
private shapePayload;
|
|
152
179
|
/**
|
package/lib/llm/catalog.d.ts
CHANGED
|
@@ -32,6 +32,13 @@ export interface GatewayModel {
|
|
|
32
32
|
readonly maxInputTokens?: number;
|
|
33
33
|
readonly maxTokens: number;
|
|
34
34
|
readonly input: readonly ('text' | 'image')[];
|
|
35
|
+
/**
|
|
36
|
+
* The media files this model takes natively (`input_modalities` lists `audio`/`video`), in that order. Only Chat
|
|
37
|
+
* Completions models carry it: that is the only protocol the plugin sends files on, as a `file` content part the
|
|
38
|
+
* gateway turns into the provider's own form (Claude over Messages would refuse one). Absent when there are none. pi-ai's descriptor
|
|
39
|
+
* keeps `input` (text/image); the host reads these through `inputModalities`.
|
|
40
|
+
*/
|
|
41
|
+
readonly nativeMedia?: readonly ('audio' | 'video')[];
|
|
35
42
|
/**
|
|
36
43
|
* Levels the user may pick, in escalation order; `undefined` when the catalog
|
|
37
44
|
* states none (no level control), `[]` when the model thinks with no levels.
|
package/lib/llm/context.d.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* so the gateway adapter can choose a wire protocol per model. Keep it in step with upstream.
|
|
6
6
|
*
|
|
7
7
|
* Kept in step with 0.2.3 for what changes at run time: the request-image target (see `requestImageTarget`) and the text of a
|
|
8
|
-
* system message (see `systemText`).
|
|
8
|
+
* system message (see `systemText`). Native audio/video files (`files`, see ./native-files.ts) follow the VibeDev fork
|
|
9
|
+
* (vibedev 5be6bcec).
|
|
9
10
|
*
|
|
10
11
|
* Harness request-history conversion into pi-ai's Context vocabulary.
|
|
11
12
|
*
|
|
@@ -14,6 +15,7 @@
|
|
|
14
15
|
import type { GenerateOptions, ImageAttachmentAccessResolver } from '@deepseek-ai/dsh-llm';
|
|
15
16
|
import type { AttachmentStore, ImageAttachmentRef } from '@deepseek-ai/dsh-attachment';
|
|
16
17
|
import type { Context as PiContext } from '@earendil-works/pi-ai';
|
|
18
|
+
import type { PiFileRequestContext } from './native-files.js';
|
|
17
19
|
/** Inputs that bind deterministic request images to one current tool execution world. */
|
|
18
20
|
export interface PiImageRequestContext {
|
|
19
21
|
/** Durable provider that resolves request-image bytes and provider-owned host objects. */
|
|
@@ -24,6 +26,11 @@ export interface PiImageRequestContext {
|
|
|
24
26
|
maxRequestImageBytes?: number;
|
|
25
27
|
/** Route pixel and raw encoded-byte budgets. */
|
|
26
28
|
requestImagePolicy?: PiImageRequestBudget;
|
|
29
|
+
/**
|
|
30
|
+
* Native delivery of the file blocks request assembly kept; omission drops them, leaving their handle text.
|
|
31
|
+
* Only Chat Completions models supply it.
|
|
32
|
+
*/
|
|
33
|
+
files?: PiFileRequestContext;
|
|
27
34
|
}
|
|
28
35
|
/** Per-route budgets from which each request image's target is derived. */
|
|
29
36
|
export interface PiImageRequestBudget {
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native audio/video delivery for the gateway's Chat Completions models.
|
|
3
|
+
*
|
|
4
|
+
* Adapted from the VibeDev fork of DeepSeek Harness `@deepseek-ai/dsh-llm-pi-ai` (src/native-files.ts, vibedev
|
|
5
|
+
* 5be6bcec; MIT, Copyright (c) 2026 DeepSeek — see THIRD-PARTY-NOTICES.txt). Keep it in step with upstream.
|
|
6
|
+
*
|
|
7
|
+
* Request assembly (the host's LLM runtime) decides which audio/video occurrences a request carries natively: the
|
|
8
|
+
* current turn's user messages and tool results (DSH 0.2.3-era VibeDev hosts: only the latest user message that
|
|
9
|
+
* carries files), only kinds the model declares, within 14 MiB per file and 20 MiB of base64 per request, and never
|
|
10
|
+
* for an auxiliary call. It leaves each kept `{type:'file'}` block right after the file's handle text. This module
|
|
11
|
+
* reads the kept files' bytes and serializes them; it decides nothing beyond a defensive re-check of the same size
|
|
12
|
+
* ceilings and of the media types the gateway's models take ({@link GEMINI_INLINE_MEDIA_TYPES}).
|
|
13
|
+
*
|
|
14
|
+
* pi-ai's Context has no file content, so conversion leaves one marker text part where each delivered file belongs
|
|
15
|
+
* and the payload hook swaps every marker for an OpenAI-compatible `file` content part carrying the bytes as a data
|
|
16
|
+
* URL: `{"type":"file","file":{"file_data":"data:<mediaType>;base64,<…>"}}`. The gateway turns it into the
|
|
17
|
+
* provider's own form (Gemini `inlineData`, say). A Chat Completions `tool` message carries text only, so a file in a
|
|
18
|
+
* tool result moves to a `user` message right after that run of tool messages, the way pi-ai sends tool-result
|
|
19
|
+
* images (see {@link injectNativeFiles}).
|
|
20
|
+
*
|
|
21
|
+
* Nothing here can fail a request: a file without a target, a host without `readFileRequest`, a read that fails or
|
|
22
|
+
* a file over a ceiling all fall back to the handle text that is already in the message, with a warning. Only
|
|
23
|
+
* cancellation propagates.
|
|
24
|
+
*
|
|
25
|
+
* Hosts whose `@deepseek-ai/dsh-llm` and `@deepseek-ai/dsh-attachment` predate native files (DSH 0.2.2-rc.5,
|
|
26
|
+
* upstream 0.2.3) never keep a file block, so none of this runs there; the types the newer packages declare are
|
|
27
|
+
* restated structurally below so the plugin builds and loads against either.
|
|
28
|
+
*
|
|
29
|
+
* @module dsh-vibedev/llm/native-files
|
|
30
|
+
*/
|
|
31
|
+
import type { RequestMessage } from '@deepseek-ai/dsh-llm';
|
|
32
|
+
import type { AttachmentId, AttachmentStore, FileAttachmentRef } from '@deepseek-ai/dsh-attachment';
|
|
33
|
+
/** Raw-byte ceiling for one natively delivered file: the host's `NATIVE_FILE_MAX_BYTES`, 14 MiB where it has none. */
|
|
34
|
+
export declare const NATIVE_FILE_MAX_BYTES: number;
|
|
35
|
+
/** Ceiling on the base64 total of a request's native files: the host's own, 20 MiB where it has none. */
|
|
36
|
+
export declare const NATIVE_FILE_MAX_REQUEST_BASE64_BYTES: number;
|
|
37
|
+
/**
|
|
38
|
+
* Media types the gateway's Chat Completions models take inline: the containers Gemini documents for inline
|
|
39
|
+
* audio/video, spelled as the host's `sniffFileMediaType` spells them. Anything else (Matroska, M4A, Opus, AMR,
|
|
40
|
+
* WMA, …) keeps its handle text only: one type the provider refuses would fail the whole request.
|
|
41
|
+
*/
|
|
42
|
+
export declare const GEMINI_INLINE_MEDIA_TYPES: readonly string[];
|
|
43
|
+
/** Text that opens the user message carrying tool-result media. */
|
|
44
|
+
export declare const TOOL_RESULT_MEDIA_TEXT = "Attached media from tool result:";
|
|
45
|
+
/** `FileRequestTarget` of `@deepseek-ai/dsh-attachment` (VibeDev fork): the route's limits for one file. */
|
|
46
|
+
export interface FileRequestTarget {
|
|
47
|
+
/** Hard raw-byte limit before base64 expansion; a larger file is refused before any byte is read. */
|
|
48
|
+
maxBytes: number;
|
|
49
|
+
/**
|
|
50
|
+
* Media types the route accepts; a host whose attachment provider knows the field refuses any other sniffed type
|
|
51
|
+
* with `ATTACHMENT_PROJECTION_UNSUPPORTED`. Older hosts ignore it, so {@link readNativeFiles} checks it again.
|
|
52
|
+
* Absent means {@link GEMINI_INLINE_MEDIA_TYPES}.
|
|
53
|
+
*/
|
|
54
|
+
mediaTypes?: readonly string[];
|
|
55
|
+
}
|
|
56
|
+
/** `RequestFileAttachment` of `@deepseek-ai/dsh-attachment` (VibeDev fork): one file read whole for one request. */
|
|
57
|
+
export interface RequestFileAttachment {
|
|
58
|
+
attachment: FileAttachmentRef;
|
|
59
|
+
/** Exact stored bytes. */
|
|
60
|
+
data: Uint8Array;
|
|
61
|
+
/** Media type sniffed from the leading bytes, falling back to the name's extension. */
|
|
62
|
+
mediaType: string;
|
|
63
|
+
/** Exact byte length of `data`. */
|
|
64
|
+
bytes: number;
|
|
65
|
+
}
|
|
66
|
+
/** Inputs that let request conversion deliver the runtime-selected files natively. */
|
|
67
|
+
export interface PiFileRequestContext {
|
|
68
|
+
/** Route raw-byte target for one file; undefined drops the occurrence, leaving its handle text. */
|
|
69
|
+
target: (ref: FileAttachmentRef) => FileRequestTarget | undefined;
|
|
70
|
+
/** Observe one occurrence that falls back to its handle text. */
|
|
71
|
+
onDegrade?: (ref: FileAttachmentRef, reason: string) => void;
|
|
72
|
+
/**
|
|
73
|
+
* Receives each delivered occurrence's wire part in marker order; the converted context carries
|
|
74
|
+
* {@link nativeFileMarker} of the same index.
|
|
75
|
+
*/
|
|
76
|
+
delivered: NativeFilePart[];
|
|
77
|
+
}
|
|
78
|
+
/** OpenAI-compatible Chat Completions file content part. */
|
|
79
|
+
export interface NativeFilePart {
|
|
80
|
+
type: 'file';
|
|
81
|
+
file: {
|
|
82
|
+
file_data: string;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Text part that holds one delivered file's place until the payload hook replaces it. Deterministic, so identical
|
|
87
|
+
* histories convert identically, and NUL-delimited, so no user-authored text block equals it.
|
|
88
|
+
* @param index - position in {@link PiFileRequestContext.delivered}.
|
|
89
|
+
* @returns the marker text.
|
|
90
|
+
*/
|
|
91
|
+
export declare function nativeFileMarker(index: number): string;
|
|
92
|
+
/**
|
|
93
|
+
* Read every file the request delivers natively, once per attachment. A file whose target is gone, whose read fails
|
|
94
|
+
* (the host's `ATTACHMENT_PROJECTION_UNSUPPORTED` for a media type outside the target's list included), whose sniffed
|
|
95
|
+
* media type the target does not accept, or that breaks a ceiling is left out, so its occurrences keep only their
|
|
96
|
+
* handle text; cancellation still propagates. When the base64 total of the occurrences read exceeds
|
|
97
|
+
* {@link NATIVE_FILE_MAX_REQUEST_BASE64_BYTES} (a host that did not budget them), the earliest files are left out
|
|
98
|
+
* first, as request assembly would.
|
|
99
|
+
* @param messages - converted history; user- and tool-role file blocks are read.
|
|
100
|
+
* @param attachments - durable provider of the verbatim bytes.
|
|
101
|
+
* @param files - route target and degrade observer.
|
|
102
|
+
* @param signal - request cancellation.
|
|
103
|
+
* @returns request bytes by attachment id.
|
|
104
|
+
*/
|
|
105
|
+
export declare function readNativeFiles(messages: readonly RequestMessage[], attachments: AttachmentStore, files: PiFileRequestContext, signal?: AbortSignal): Promise<ReadonlyMap<AttachmentId, RequestFileAttachment>>;
|
|
106
|
+
/**
|
|
107
|
+
* The Chat Completions content part for one delivered file.
|
|
108
|
+
* @param file - bytes and sniffed media type.
|
|
109
|
+
* @returns the part the gateway accepts.
|
|
110
|
+
*/
|
|
111
|
+
export declare function nativeFilePart(file: RequestFileAttachment): NativeFilePart;
|
|
112
|
+
/** How {@link injectNativeFiles} places tool-result media. */
|
|
113
|
+
export interface NativeFileInjectionOptions {
|
|
114
|
+
/**
|
|
115
|
+
* The model's `compat.requiresAssistantAfterToolResult`: a new media message after tool results is preceded by
|
|
116
|
+
* pi-ai's own bridging assistant message, exactly as pi-ai does for tool-result images.
|
|
117
|
+
*/
|
|
118
|
+
readonly assistantAfterToolResult?: boolean;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Put every delivered file part into a Chat Completions payload. A marker part in a user message becomes the file
|
|
122
|
+
* part in place. A Chat Completions `tool` message holds text only, so markers in a run of consecutive `tool`
|
|
123
|
+
* messages leave the tool text (the handle text stays) and their parts, in tool-result then block order, go to the
|
|
124
|
+
* user message right after the run: appended to pi-ai's "Attached image(s) from tool result:" message when pi-ai
|
|
125
|
+
* added one, otherwise in a new `{role:'user',content:[{type:'text',text:'Attached media from tool result:'},…]}`,
|
|
126
|
+
* preceded by pi-ai's bridging assistant message when the model requires one.
|
|
127
|
+
* @param payload - the request body pi-ai built.
|
|
128
|
+
* @param delivered - file parts by marker index.
|
|
129
|
+
* @param options - the model's tool-result ordering rule.
|
|
130
|
+
* @returns a shallow-copied payload, or undefined to keep it when no marker is present.
|
|
131
|
+
*/
|
|
132
|
+
export declare function injectNativeFiles(payload: unknown, delivered: readonly NativeFilePart[], options?: NativeFileInjectionOptions): unknown;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `voice_profile_create`, `voice_profile_list`, `voice_profile_delete`: the user's voice profiles (音色) for Suno
|
|
3
|
+
* voice covers. Creating one is free and makes no song; only `vp_…` ids are shown or accepted.
|
|
4
|
+
* @module dsh-vibedev/tools/voice-profiles
|
|
5
|
+
*/
|
|
6
|
+
import type { ToolDefinition } from '@deepseek-ai/dsh-tools';
|
|
7
|
+
import type { MediaRuntime } from '../runtime.js';
|
|
8
|
+
import type { VoiceProfile, VoiceProfiles } from '../audio/voice-profiles.js';
|
|
9
|
+
/** One line per profile, for messages. */
|
|
10
|
+
export declare function describeVoiceProfile(profile: VoiceProfile): string;
|
|
11
|
+
/**
|
|
12
|
+
* `voice_profile_create`.
|
|
13
|
+
* @param runtime - loads the sample (workspace paths, links, chat attachments).
|
|
14
|
+
* @param profiles - the voice-profile service.
|
|
15
|
+
* @returns the tool.
|
|
16
|
+
*/
|
|
17
|
+
export declare function voiceProfileCreateTool(runtime: MediaRuntime, profiles: VoiceProfiles): ToolDefinition;
|
|
18
|
+
/**
|
|
19
|
+
* `voice_profile_list`.
|
|
20
|
+
* @param profiles - the voice-profile service.
|
|
21
|
+
* @returns the tool.
|
|
22
|
+
*/
|
|
23
|
+
export declare function voiceProfileListTool(profiles: VoiceProfiles): ToolDefinition;
|
|
24
|
+
/**
|
|
25
|
+
* `voice_profile_delete`.
|
|
26
|
+
* @param runtime - for the user's confirmation, when the host can ask.
|
|
27
|
+
* @param profiles - the voice-profile service.
|
|
28
|
+
* @returns the tool.
|
|
29
|
+
*/
|
|
30
|
+
export declare function voiceProfileDeleteTool(runtime: MediaRuntime, profiles: VoiceProfiles): ToolDefinition;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibedev-si/dsh-vibedev",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.3",
|
|
4
4
|
"description": "VibeDev 账号与模型:在 DeepSeek Harness 里登录 VibeDev,与 DeepSeek 账号并存,使用 VibeDev 网关的模型(Claude、GPT 等),并生成图片、视频、音乐和播客 · VibeDev account and models for DeepSeek Harness: sign in to VibeDev next to the DeepSeek account and use the VibeDev gateway's models (Claude, GPT and more), plus image, video, music and podcast generation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|