@cerebriline/core 4.100.271 → 4.100.273

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.
@@ -9,7 +9,7 @@
9
9
  * Three kinds of server answer these routes, and they say different amounts:
10
10
  * - **opencoti** names what is loaded in `features` on `/props`
11
11
  * (`images_generate_v1`, `images_edit_v1`, `audio_transcriptions_v1`,
12
- * `audio_speech_v1`, `videos_generate_v1`), and its `/v1/models` rows carry
12
+ * `audio_speech_v1`, `videos_generate_v1`, `audio_generations_v1`), and its `/v1/models` rows carry
13
13
  * `capabilities`. One process can serve the LLM and every media kind.
14
14
  * - **xOllama** answers `/api/xollama`, and its `/v1/models` rows carry
15
15
  * `input_modalities` / `output_modalities` for models with media.
@@ -33,7 +33,7 @@
33
33
  * audio/speech`, so the whole route gets pasted. Nothing is lost by taking it
34
34
  * back off: a route under a route is never what anyone meant.
35
35
  */
36
- export type MediaKind = "image_generation" | "image_edit" | "transcription" | "speech" | "video";
36
+ export type MediaKind = "image_generation" | "image_edit" | "transcription" | "speech" | "video" | "sound_effects";
37
37
  export declare const MEDIA_KINDS: readonly MediaKind[];
38
38
  export type MediaServer = "opencoti" | "xollama" | "openai";
39
39
  export interface MediaEndpoint {
@@ -79,7 +79,8 @@ export declare function mediaServerOrigin(baseUrl: string): string;
79
79
  *
80
80
  * Capabilities are exact and win. Modalities are xOllama's listing and need
81
81
  * reading: an edit model takes an image and returns one, a transcription model
82
- * takes audio and returns text.
82
+ * takes audio and returns text. Sound effects are never read from them: speech
83
+ * returns audio too, and only the capability tells the two apart.
83
84
  */
84
85
  export declare function mediaKindsOfModelRow(row: unknown): MediaKind[] | undefined;
85
86
  export interface MediaProbeOptions {
@@ -137,13 +138,21 @@ export type ResolvedMediaEndpoint = {
137
138
  export declare function resolveMediaEndpoint(input: ResolveMediaEndpointInput): Promise<ResolvedMediaEndpoint>;
138
139
  /** `Retry-After` in milliseconds: seconds or a date, bounded, 5 s by default. */
139
140
  export declare function retryAfterMs(header: string | null, now?: number): number;
141
+ /**
142
+ * How long xOllama may hold a request before it starts or answers `503`: its
143
+ * `mediaQueueWait`. The wait happens inside one attempt, so a tool's limit is
144
+ * this plus the time the work itself may take. Without it a queued request is
145
+ * abandoned, and reported as stopped, before the server has answered at all.
146
+ */
147
+ export declare const MEDIA_QUEUE_WAIT_MS: number;
140
148
  export interface MediaRequestOptions {
141
149
  fetchImpl?: typeof fetch;
142
150
  /** The caller's cancellation. The only thing that ends the waiting. */
143
151
  signal?: AbortSignal;
144
152
  /**
145
- * Milliseconds one attempt may take. Waiting on a busy engine is not
146
- * counted: the limit is on the work, not on the queue in front of it.
153
+ * Milliseconds one attempt may take. Waiting between attempts on a busy
154
+ * engine is not counted, but a server's own queue is: see
155
+ * `MEDIA_QUEUE_WAIT_MS`.
147
156
  */
148
157
  attemptTimeoutMs?: number;
149
158
  /**
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * The media tools as one set, built from one configuration.
3
3
  *
4
- * Five tools -- `generate_image`, `edit_image`, `transcribe_audio`,
5
- * `synthesize_speech`, `generate_video` -- share one rule for where a request
4
+ * Six tools -- `generate_image`, `edit_image`, `transcribe_audio`,
5
+ * `synthesize_speech`, `generate_sound_effect`, `generate_video` -- share one rule for where a request
6
6
  * goes (see `media-endpoint.ts`), and two hosts offer them: the extension from
7
7
  * its settings tabs and the CLI from a file. If each host wrote its own
8
8
  * "which tools, pointed where", the two would drift the first time one of them
@@ -14,7 +14,7 @@
14
14
  * soon as it names somewhere to go, whether or not that server answers now.
15
15
  */
16
16
  import type { AgentTool } from "@cerebriline/shared";
17
- import { type SpeechEndpoint, type TranscriptionEndpoint } from "./audio-tools";
17
+ import { type SoundEffectEndpoint, type SpeechEndpoint, type TranscriptionEndpoint } from "./audio-tools";
18
18
  import { type ImageGenerationEndpoint } from "./image-generation";
19
19
  import { type MediaEndpointProbe, type MediaSessionProvider, type ResolvedMediaEndpoint } from "./media-endpoint";
20
20
  import type { RenderDriver } from "./render-image";
@@ -49,6 +49,10 @@ export interface MediaToolsConfig {
49
49
  voice?: string;
50
50
  format?: string;
51
51
  };
52
+ /** `generate_sound_effect`. */
53
+ soundEffects?: MediaSectionSettings & {
54
+ format?: string;
55
+ };
52
56
  /** `generate_video`. */
53
57
  video?: MediaSectionSettings & {
54
58
  size?: string;
@@ -56,13 +60,14 @@ export interface MediaToolsConfig {
56
60
  format?: string;
57
61
  };
58
62
  }
59
- export declare const MEDIA_TOOL_NAMES: readonly ["generate_image", "edit_image", "transcribe_audio", "synthesize_speech", "generate_video"];
63
+ export declare const MEDIA_TOOL_NAMES: readonly ["generate_image", "edit_image", "transcribe_audio", "synthesize_speech", "generate_sound_effect", "generate_video"];
60
64
  export type MediaToolName = (typeof MEDIA_TOOL_NAMES)[number];
61
65
  interface MediaToolEndpoints {
62
66
  generate_image: ImageGenerationEndpoint;
63
67
  edit_image: ImageGenerationEndpoint;
64
68
  transcribe_audio: TranscriptionEndpoint;
65
69
  synthesize_speech: SpeechEndpoint;
70
+ generate_sound_effect: SoundEffectEndpoint;
66
71
  generate_video: VideoGenerationEndpoint;
67
72
  }
68
73
  export type ResolvedMediaTool<T extends MediaToolName = MediaToolName> = (Omit<Exclude<ResolvedMediaEndpoint, {
@@ -131,6 +136,7 @@ export declare function createMediaTools(options: CreateMediaToolsOptions): Prom
131
136
  * "image": { "model": "flux2-klein", "size": "1024x1024" },
132
137
  * "transcription": true,
133
138
  * "speech": { "voice": "alloy" },
139
+ * "soundEffects": { "model": "mannix/stable-audio:3-small-sfx-q8_0" },
134
140
  * "video": { "baseUrl": "http://other:8090", "model": "wan2.1" }
135
141
  * }
136
142
  * ```