@vibedev-si/dsh-vibedev 0.11.4 → 0.12.0

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.
@@ -14,6 +14,14 @@
14
14
  * `billing_unit` and the declared limits (references, output formats and their
15
15
  * sample rates). An audio model that declares no kind is listed but cannot be
16
16
  * chosen for generation: neither its name nor its id decides what it makes.
17
+ * Speech billed per character (`billing_unit: "character"`) states what one
18
+ * Chinese character counts as (`han_character_weight`, 2 when undeclared).
19
+ *
20
+ * Realtime speech models (`media_type: "speech"`, or a `speech` block, such as
21
+ * `vibedev-asr` and `vibedev-tts`) serve the desktop's voice input and
22
+ * read-aloud, not the media tools: they are kept apart from the media models
23
+ * ({@link parseCatalog}), whatever their modalities say, so a name that refers
24
+ * to one can be answered with what it is.
17
25
  *
18
26
  * Image models may declare their size tiers and aspect ratios
19
27
  * (`capabilities.image_sizes`, `capabilities.image_ratios`); they are read as
@@ -95,9 +103,11 @@ export interface VideoCapabilities {
95
103
  /**
96
104
  * What a price is charged per: one generation, one second of output, one
97
105
  * second of ORIGINAL audio (speech is billed on the provider's original length,
98
- * not on what plays back after processing), or one minute of input audio.
106
+ * not on what plays back after processing), one minute of input audio, or one
107
+ * billable character of the text read aloud (a Chinese character counts as the
108
+ * model's `han_character_weight`, every other character as 1).
99
109
  */
100
- export type PriceUnit = 'generation' | 'second' | 'original_second' | 'minute';
110
+ export type PriceUnit = 'generation' | 'second' | 'original_second' | 'minute' | 'character';
101
111
  /** One price tier: video tiers are resolutions (`720p`), image tiers size buckets (`1K`). */
102
112
  export interface MediaPriceTier {
103
113
  readonly tier: string;
@@ -148,7 +158,10 @@ export type VideoPricingIssue = 'unknown-schema' | 'invalid';
148
158
  export declare const AUDIO_GENERATION_KINDS: readonly ["music", "podcast", "speech", "transcription"];
149
159
  export type AudioGenerationKind = typeof AUDIO_GENERATION_KINDS[number];
150
160
  /** How an audio model is billed (`audio.billing_unit`). */
151
- export type AudioBillingUnit = 'generation' | 'original_second' | 'minute';
161
+ export declare const AUDIO_BILLING_UNITS: readonly ["generation", "original_second", "minute", "character"];
162
+ export type AudioBillingUnit = typeof AUDIO_BILLING_UNITS[number];
163
+ /** What one Chinese character counts as under per-character billing when the model does not say (`han_character_weight`). */
164
+ export declare const DEFAULT_HAN_CHARACTER_WEIGHT = 2;
152
165
  /** The reference audio a speech model takes (a voice to imitate), as the catalog declares it. */
153
166
  export interface AudioReferenceLimits {
154
167
  readonly min: number;
@@ -188,6 +201,12 @@ export interface AudioCapabilities {
188
201
  /** The request fields the model accepts, under their wire names. */
189
202
  readonly requestFields: readonly string[];
190
203
  readonly billingUnit?: AudioBillingUnit;
204
+ /**
205
+ * Per-character billing: what one Chinese character (a CJK unified ideograph) counts as, every other character
206
+ * counting 1 (`audio.han_character_weight`, a positive number). Set to {@link DEFAULT_HAN_CHARACTER_WEIGHT} for a
207
+ * model billed per character that declares none; absent otherwise.
208
+ */
209
+ readonly hanCharacterWeight?: number;
191
210
  readonly references?: AudioReferenceLimits;
192
211
  readonly outputFormats?: readonly AudioOutputFormat[];
193
212
  readonly defaultFormat?: string;
@@ -242,6 +261,24 @@ export interface MediaModel {
242
261
  readonly video?: VideoCapabilities;
243
262
  readonly audio?: AudioCapabilities;
244
263
  }
264
+ /**
265
+ * A realtime speech model of the catalog: speech recognition for voice input (`speech.lane: "asr"`) or synthesis for
266
+ * read-aloud (`"tts"`), on its own endpoints, for the desktop rather than the agent. It is not a media model: the media
267
+ * tools never list, choose or price it; it is kept only so a name that refers to one can be told what it is.
268
+ */
269
+ export interface RealtimeSpeechModel {
270
+ readonly id: string;
271
+ readonly aliases?: readonly string[];
272
+ /** The lane its `speech` block names (`asr`, `tts`), in lower case; absent when it names none. */
273
+ readonly lane?: string;
274
+ }
275
+ /** A `/v1/models` body as the media tools read it. */
276
+ export interface ParsedCatalog {
277
+ /** The media models, in catalog order. */
278
+ readonly models: MediaModel[];
279
+ /** The realtime speech models, kept apart from the media models, in catalog order. */
280
+ readonly realtimeSpeech: RealtimeSpeechModel[];
281
+ }
245
282
  type Json = Record<string, unknown>;
246
283
  /**
247
284
  * Parse a `video` capability block (or the legacy video fields inside `capabilities`).
@@ -272,10 +309,25 @@ export declare function parseVideoPricing(value: unknown): {
272
309
  videoPricing?: VideoTokenPricing;
273
310
  videoPricingIssue?: VideoPricingIssue;
274
311
  };
312
+ /**
313
+ * Whether a catalog entry is a realtime speech model: `media_type: "speech"`, or a `speech` block (`vibedev-asr`,
314
+ * `vibedev-tts`). Such a model serves the desktop's voice input and read-aloud, never the media tools — whatever its
315
+ * modalities say: a read-aloud lane outputs audio, and would otherwise look like an audio generator.
316
+ * @param entry - one entry of `/v1/models`.
317
+ * @returns whether it is one.
318
+ */
319
+ export declare function isRealtimeSpeechEntry(entry: unknown): boolean;
275
320
  /**
276
321
  * Parse a `/v1/models` body into its media models.
277
322
  * @param body - `{data:[...]}` or a bare array.
278
323
  * @returns the media models, in catalog order.
279
324
  */
280
325
  export declare function parseMediaCatalog(body: unknown): MediaModel[];
326
+ /**
327
+ * Parse a `/v1/models` body into its media models, with the realtime speech models kept apart: they are never media
328
+ * models (see {@link isRealtimeSpeechEntry}), and are listed only so a name that refers to one can be told what it is.
329
+ * @param body - `{data:[...]}` or a bare array.
330
+ * @returns the media models and the realtime speech models, each in catalog order.
331
+ */
332
+ export declare function parseCatalog(body: unknown): ParsedCatalog;
281
333
  export {};
@@ -6,6 +6,6 @@
6
6
  * Whether an accepted request may have been charged.
7
7
  * @param method - the HTTP method.
8
8
  * @param path - the request path, without the query.
9
- * @returns true for a POST to a generation or transcription endpoint.
9
+ * @returns true for a POST to a generation, transcription or speech endpoint.
10
10
  */
11
11
  export declare function isPaidRequest(method: string, path: string): boolean;
package/lib/index.d.ts CHANGED
@@ -52,6 +52,7 @@ export { GATEWAY_FETCH_PROVIDER_ID as FETCH_PROVIDER_ID } from './fetch/wiring.j
52
52
  export { GatewayFetchProvider, NegotiatedGatewayFetchProvider, readGatewayFetchCapability } from './fetch/provider.js';
53
53
  export type { GatewayFetchCapability, GatewayFetchOptions, GatewayExtractionResult, NegotiatedGatewayFetchOptions } from './fetch/provider.js';
54
54
  export { INSUFFICIENT_BALANCE_CODE, SIGN_IN_REQUIRED_CODE, VIBEDEV_ROUTE, VIBEDEV_RELAY_ROUTE } from './llm/index.js';
55
+ export { RECOGNITION_PROVIDER_ID, SYNTHESIS_PROVIDER_ID, VIBEDEV_SIGN_IN_SERVICE, type VibeDevSignIn } from './speech/index.js';
55
56
  /** The package version, sent in the `User-Agent` the gateway attributes plugin traffic by. */
56
57
  export declare const version: string;
57
58
  export declare const name = "dsh-vibedev";
@@ -67,6 +68,12 @@ export interface Config {
67
68
  preferredModels: string[];
68
69
  /** Open the system browser when a sign-in starts (off: the page opens the link itself). */
69
70
  openBrowserOnSignIn: boolean;
71
+ /**
72
+ * A cloud host reached through the VibeDev remote entry: its public origin, such as `https://<host id>.h.vibedev.studio`.
73
+ * Set, sign-in returns to this host's `/api/dsh-vibedev/sign-in/callback` (with the remote entry's assertion) and the
74
+ * user's own browser opens the sign-in link; empty, the desktop's loopback sign-in. Only an explicit value turns it on.
75
+ */
76
+ remoteSignInBaseUrl: string;
70
77
  /**
71
78
  * Minutes between catalog reads while the app runs: the fallback that keeps the pickers current when nobody opens
72
79
  * the balance card, the account menu or Settings (each of those reads the catalog too, at most once a minute).
@@ -124,6 +131,7 @@ export declare const Config: Schema<Schemastery.ObjectS<NoInfer<{
124
131
  claudeCacheTtl: Schema<"default" | "5m" | "1h", "default" | "5m" | "1h", "volatile-defined">;
125
132
  preferredModels: Schema<string[], string[], "defined">;
126
133
  openBrowserOnSignIn: Schema<boolean, boolean, "defined">;
134
+ remoteSignInBaseUrl: Schema<string, string, "defined">;
127
135
  catalogRefreshMinutes: Schema<number, number, "defined">;
128
136
  resendWindowMs: Schema<number, number, "defined">;
129
137
  submitAttempts: Schema<number, number, "defined">;
@@ -156,6 +164,7 @@ export declare const Config: Schema<Schemastery.ObjectS<NoInfer<{
156
164
  claudeCacheTtl: Schema<"default" | "5m" | "1h", "default" | "5m" | "1h", "volatile-defined">;
157
165
  preferredModels: Schema<string[], string[], "defined">;
158
166
  openBrowserOnSignIn: Schema<boolean, boolean, "defined">;
167
+ remoteSignInBaseUrl: Schema<string, string, "defined">;
159
168
  catalogRefreshMinutes: Schema<number, number, "defined">;
160
169
  resendWindowMs: Schema<number, number, "defined">;
161
170
  submitAttempts: Schema<number, number, "defined">;