@vibedev-si/dsh-vibedev 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -1
- package/THIRD-PARTY-NOTICES.txt +1 -1
- package/client/client.account-center.js +465 -5
- package/client/client.js +533 -30
- package/lib/announcements/routes.d.ts +70 -0
- package/lib/contracts.d.ts +2 -2
- package/lib/index.d.ts +4 -0
- package/lib/index.js +346 -75
- package/lib/llm/catalog.d.ts +2 -0
- package/lib/llm/context-budget.d.ts +45 -0
- package/lib/llm/stream.d.ts +6 -0
- package/lib/runtime.d.ts +2 -0
- package/lib/tools/image.d.ts +25 -0
- package/package.json +1 -1
package/lib/llm/catalog.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export interface GatewayModel {
|
|
|
23
23
|
/** The protocol requests for this model use. */
|
|
24
24
|
readonly api: GatewayApi;
|
|
25
25
|
readonly contextWindow: number;
|
|
26
|
+
/** The provider input cap the gateway states (`max_input_tokens`), when it states one. */
|
|
27
|
+
readonly maxInputTokens?: number;
|
|
26
28
|
readonly maxTokens: number;
|
|
27
29
|
readonly input: readonly ('text' | 'image')[];
|
|
28
30
|
/**
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a catalog model's returned `contextWindow` should be.
|
|
3
|
+
*
|
|
4
|
+
* The host compacts from the window it is told: `basic-compaction` starts at
|
|
5
|
+
* `min(thresholdRatio × window, window − maxTokens − headroomTokens)` (defaults 0.8, 65,536) and
|
|
6
|
+
* measures against provider usage plus a heuristic delta. Declaring the provider's *input cap* as the
|
|
7
|
+
* window therefore compacts at 80% of that cap at best, and earlier whenever the output reserve is
|
|
8
|
+
* large — but declaring more than the cap lets a request outgrow it before compaction fires.
|
|
9
|
+
*
|
|
10
|
+
* The gateway states both numbers: `context_window` (capacity) and `max_input_tokens` (the cap its
|
|
11
|
+
* provider enforces; the value a `context_length_exceeded` error quotes). Where the two agree, the
|
|
12
|
+
* input cap is the real limit and the provider bills output outside it, so the host's total capacity
|
|
13
|
+
* is `input + maxTokens`: the reserve the host subtracts then cancels out and the trigger lands in
|
|
14
|
+
* the 80–90% band of the real input budget. Where `context_window` is larger than the input cap it
|
|
15
|
+
* is a real total, and the window never claims past it.
|
|
16
|
+
*
|
|
17
|
+
* @module dsh-vibedev/llm/context-budget
|
|
18
|
+
*/
|
|
19
|
+
/** Share of the provider's input budget compaction should start around. */
|
|
20
|
+
export declare const CONTEXT_COMPACT_TARGET = 0.88;
|
|
21
|
+
/** The host compaction default this arithmetic is written against (`thresholdRatio`). */
|
|
22
|
+
export declare const HOST_THRESHOLD_RATIO = 0.8;
|
|
23
|
+
/** The host compaction default reserve below the message budget (`headroomTokens`). */
|
|
24
|
+
export declare const HOST_HEADROOM_TOKENS = 65536;
|
|
25
|
+
/** What the catalog says about one model's capacity. */
|
|
26
|
+
export interface CatalogBudget {
|
|
27
|
+
/** Catalog capacity, when it states one. */
|
|
28
|
+
readonly contextWindow?: number;
|
|
29
|
+
/** The provider input cap the gateway states (`max_input_tokens`), when it states one. */
|
|
30
|
+
readonly maxInputTokens?: number;
|
|
31
|
+
/** Output the catalog reserves per request. */
|
|
32
|
+
readonly maxTokens: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The window to report to the host.
|
|
36
|
+
*
|
|
37
|
+
* Without a stated input cap this is the catalog capacity unchanged: nothing here may claim more
|
|
38
|
+
* capacity than the catalog gave. With one, the declared window is sized so the host's own threshold
|
|
39
|
+
* lands near {@link CONTEXT_COMPACT_TARGET} of that cap, bounded by the real total whenever the
|
|
40
|
+
* catalog states one.
|
|
41
|
+
* @param budget - the catalog's capacity, input cap and output reserve.
|
|
42
|
+
* @param fallback - window for a catalog that states no capacity at all.
|
|
43
|
+
* @returns a positive token count to declare as the model's context window.
|
|
44
|
+
*/
|
|
45
|
+
export declare function declaredContextWindow(budget: CatalogBudget, fallback: number): number;
|
package/lib/llm/stream.d.ts
CHANGED
|
@@ -20,6 +20,12 @@ import type { AssistantMessage, AssistantMessageEvent, Usage as PiUsage } from '
|
|
|
20
20
|
* when non-zero (pi-ai reports zeros, not absence).
|
|
21
21
|
*/
|
|
22
22
|
export declare function mapUsage(usage: PiUsage): TokenUsage;
|
|
23
|
+
/**
|
|
24
|
+
* Classify one pi-ai error message into the harness failure code it should carry.
|
|
25
|
+
* @param message - the flattened provider error text pi-ai hands over.
|
|
26
|
+
* @returns the harness code for this failure.
|
|
27
|
+
*/
|
|
28
|
+
export declare function classifyPiAiError(message: string): string;
|
|
23
29
|
/**
|
|
24
30
|
* Map a terminal pi-ai event to the harness finish reason.
|
|
25
31
|
* @param message - the assistant message carried by the `done` or `error` event.
|
package/lib/runtime.d.ts
CHANGED
|
@@ -39,6 +39,8 @@ export interface MediaSettings {
|
|
|
39
39
|
/** Output folder, relative to the workspace (or absolute). */
|
|
40
40
|
readonly outputDir: () => string;
|
|
41
41
|
readonly confirmSpending: () => boolean;
|
|
42
|
+
/** Send the generated images to the model; off by default, so a result is the saved paths. */
|
|
43
|
+
readonly imagesInContext: () => boolean;
|
|
42
44
|
/** A pinned model id, or `''` to let the agent choose. */
|
|
43
45
|
readonly defaultModel: (slot: ModelSlot) => string;
|
|
44
46
|
}
|
package/lib/tools/image.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* save them in the workspace and show them to the model.
|
|
4
4
|
* @module dsh-vibedev/tools/image
|
|
5
5
|
*/
|
|
6
|
+
import type { ContentBlock } from '@deepseek-ai/dsh-llm';
|
|
6
7
|
import type { ToolDefinition } from '@deepseek-ai/dsh-tools';
|
|
7
8
|
import type { MediaCall, MediaRuntime } from '../runtime.js';
|
|
8
9
|
/** One image request, as the tool and host callers make it. */
|
|
@@ -43,6 +44,30 @@ export declare function generateImages(runtime: MediaRuntime, call: MediaCall, r
|
|
|
43
44
|
estimatedCny?: string;
|
|
44
45
|
revisedPrompt?: string;
|
|
45
46
|
}>;
|
|
47
|
+
/** What a generation returns to the conversation: the saved paths, and the pictures only when they were asked for. */
|
|
48
|
+
export interface ImageResultView {
|
|
49
|
+
readonly model: string;
|
|
50
|
+
readonly images: readonly {
|
|
51
|
+
readonly path: string;
|
|
52
|
+
readonly attachment?: unknown;
|
|
53
|
+
}[];
|
|
54
|
+
readonly estimatedCny?: string;
|
|
55
|
+
readonly revisedPrompt?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Build the result blocks for one generation.
|
|
59
|
+
*
|
|
60
|
+
* A result normally names the saved files and nothing else: carrying the pictures is what rewrote a conversation's
|
|
61
|
+
* middle, made the next turn read the whole prompt again and charged for it. The model reads one back with
|
|
62
|
+
* `read_image` when it needs to look; `attach` asks for them on this call, the plugin setting on every call.
|
|
63
|
+
* @param value - the tool's structured result.
|
|
64
|
+
* @param options - `attach` from the call and the plugin setting.
|
|
65
|
+
* @returns a text block naming the files, plus an image block per picture when the pictures were asked for.
|
|
66
|
+
*/
|
|
67
|
+
export declare function imageResultBlocks(value: ImageResultView, options: {
|
|
68
|
+
attach?: boolean;
|
|
69
|
+
imagesInContext?: boolean;
|
|
70
|
+
}): ContentBlock[];
|
|
46
71
|
/**
|
|
47
72
|
* Build the tool.
|
|
48
73
|
* @param runtime - the media runtime.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibedev-si/dsh-vibedev",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
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",
|