@effect-uai/core 0.6.0 → 0.8.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.
- package/README.md +1 -1
- package/dist/{Audio-BfCTGnH3.d.mts → Audio-DPlTsNdz.d.mts} +3 -2
- package/dist/Audio-DPlTsNdz.d.mts.map +1 -0
- package/dist/{Items-pXR5BAgW.d.mts → Items-7ljaVxH_.d.mts} +12 -12
- package/dist/{Items-pXR5BAgW.d.mts.map → Items-7ljaVxH_.d.mts.map} +1 -1
- package/dist/{Tool-DP-AwKOf.d.mts → Tool-BKiieFXk.d.mts} +2 -2
- package/dist/{Tool-DP-AwKOf.d.mts.map → Tool-BKiieFXk.d.mts.map} +1 -1
- package/dist/capabilities/Capabilities.d.mts +78 -0
- package/dist/capabilities/Capabilities.d.mts.map +1 -0
- package/dist/capabilities/Capabilities.mjs +65 -0
- package/dist/capabilities/Capabilities.mjs.map +1 -0
- package/dist/domain/Audio.d.mts +1 -1
- package/dist/domain/Audio.mjs.map +1 -1
- package/dist/domain/Items.d.mts +1 -1
- package/dist/domain/Music.d.mts +131 -72
- package/dist/domain/Music.d.mts.map +1 -1
- package/dist/domain/Music.mjs +36 -9
- package/dist/domain/Music.mjs.map +1 -1
- package/dist/domain/Transcript.d.mts +8 -2
- package/dist/domain/Transcript.d.mts.map +1 -1
- package/dist/domain/Transcript.mjs.map +1 -1
- package/dist/domain/Turn.d.mts +1 -1
- package/dist/embedding-model/Embedding.d.mts +12 -2
- package/dist/embedding-model/Embedding.d.mts.map +1 -1
- package/dist/embedding-model/Embedding.mjs.map +1 -1
- package/dist/embedding-model/EmbeddingModel.d.mts +36 -23
- package/dist/embedding-model/EmbeddingModel.d.mts.map +1 -1
- package/dist/embedding-model/EmbeddingModel.mjs +20 -1
- package/dist/embedding-model/EmbeddingModel.mjs.map +1 -1
- package/dist/embedding-model/EmbeddingModel.test.mjs +15 -3
- package/dist/embedding-model/EmbeddingModel.test.mjs.map +1 -1
- package/dist/index.d.mts +7 -4
- package/dist/index.mjs +5 -2
- package/dist/language-model/LanguageModel.d.mts +2 -2
- package/dist/music-generator/MusicGenerator.d.mts +48 -25
- package/dist/music-generator/MusicGenerator.d.mts.map +1 -1
- package/dist/music-generator/MusicGenerator.mjs +17 -9
- package/dist/music-generator/MusicGenerator.mjs.map +1 -1
- package/dist/music-generator/MusicGenerator.test.mjs +81 -56
- package/dist/music-generator/MusicGenerator.test.mjs.map +1 -1
- package/dist/speech-synthesizer/SpeechSynthesizer.d.mts +21 -36
- package/dist/speech-synthesizer/SpeechSynthesizer.d.mts.map +1 -1
- package/dist/speech-synthesizer/SpeechSynthesizer.mjs.map +1 -1
- package/dist/speech-synthesizer/SpeechSynthesizer.test.mjs +3 -3
- package/dist/speech-synthesizer/SpeechSynthesizer.test.mjs.map +1 -1
- package/dist/testing/MockMusicGenerator.d.mts +12 -7
- package/dist/testing/MockMusicGenerator.d.mts.map +1 -1
- package/dist/testing/MockMusicGenerator.mjs +4 -3
- package/dist/testing/MockMusicGenerator.mjs.map +1 -1
- package/dist/testing/MockProvider.d.mts +1 -1
- package/dist/testing/MockSpeechSynthesizer.d.mts +1 -1
- package/dist/tool/Approval.d.mts +1 -1
- package/dist/tool/HistoryCheck.d.mts +1 -1
- package/dist/tool/Tool.d.mts +1 -1
- package/dist/tool/ToolResult.d.mts +1 -1
- package/dist/tool/Toolkit.d.mts +2 -2
- package/dist/tool/Toolkit.mjs +1 -1
- package/dist/transcriber/Transcriber.d.mts +11 -10
- package/dist/transcriber/Transcriber.d.mts.map +1 -1
- package/dist/transcriber/Transcriber.mjs.map +1 -1
- package/dist/transcriber/Transcriber.test.mjs +3 -3
- package/dist/transcriber/Transcriber.test.mjs.map +1 -1
- package/dist/web-search/WebSearch.d.mts +119 -0
- package/dist/web-search/WebSearch.d.mts.map +1 -0
- package/dist/web-search/WebSearch.mjs +42 -0
- package/dist/web-search/WebSearch.mjs.map +1 -0
- package/dist/web-search/WebSearchTool.d.mts +58 -0
- package/dist/web-search/WebSearchTool.d.mts.map +1 -0
- package/dist/web-search/WebSearchTool.mjs +69 -0
- package/dist/web-search/WebSearchTool.mjs.map +1 -0
- package/package.json +13 -1
- package/src/capabilities/Capabilities.ts +81 -0
- package/src/domain/Audio.ts +2 -1
- package/src/domain/Music.ts +142 -68
- package/src/domain/Transcript.ts +7 -1
- package/src/embedding-model/Embedding.ts +11 -0
- package/src/embedding-model/EmbeddingModel.test.ts +15 -4
- package/src/embedding-model/EmbeddingModel.ts +48 -21
- package/src/index.ts +3 -0
- package/src/music-generator/MusicGenerator.test.ts +78 -53
- package/src/music-generator/MusicGenerator.ts +65 -24
- package/src/speech-synthesizer/SpeechSynthesizer.test.ts +3 -3
- package/src/speech-synthesizer/SpeechSynthesizer.ts +18 -33
- package/src/testing/MockMusicGenerator.ts +28 -18
- package/src/transcriber/Transcriber.test.ts +3 -3
- package/src/transcriber/Transcriber.ts +10 -7
- package/src/web-search/WebSearch.ts +150 -0
- package/src/web-search/WebSearchTool.ts +106 -0
- package/dist/Audio-BfCTGnH3.d.mts.map +0 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ This package exposes:
|
|
|
10
10
|
|
|
11
11
|
- **Domain types** - `Items`, `Turn`, `AiError`
|
|
12
12
|
- **Provider contract** - `LanguageModel`
|
|
13
|
-
- **Loop primitive** - `Loop` (`loop`, `loopWithState`, `value`, `next`, `stop`, `nextAfter`, `
|
|
13
|
+
- **Loop primitive** - `Loop` (`loop`, `loopWithState`, `value`, `next`, `stop`, `nextAfter`, `onTurnComplete`)
|
|
14
14
|
- **Tools** - `Tool`, `Toolkit`, `Outcome`, `ToolEvent`, `Resolvers`, `HistoryCheck`
|
|
15
15
|
- **Streaming codecs** - `SSE`, `JSONL`, `Lines`
|
|
16
16
|
- **Structured output** - `StructuredFormat`
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { i as MediaUrl, n as MediaBytes, t as MediaBase64 } from "./Media-D_CpcM1Z.mjs";
|
|
2
|
+
import { Duration } from "effect";
|
|
2
3
|
|
|
3
4
|
//#region src/domain/Audio.d.ts
|
|
4
5
|
declare namespace Audio_d_exports {
|
|
@@ -54,8 +55,8 @@ type AudioChunk = {
|
|
|
54
55
|
type AudioBlob = {
|
|
55
56
|
readonly format: AudioFormat;
|
|
56
57
|
readonly bytes: Uint8Array;
|
|
57
|
-
readonly
|
|
58
|
+
readonly duration?: Duration.Duration;
|
|
58
59
|
};
|
|
59
60
|
//#endregion
|
|
60
61
|
export { AudioSource as a, isAudioBytes as c, AudioMimeType as i, isAudioUrl as l, AudioChunk as n, Audio_d_exports as o, AudioFormat as r, isAudioBase64 as s, AudioBlob as t };
|
|
61
|
-
//# sourceMappingURL=Audio-
|
|
62
|
+
//# sourceMappingURL=Audio-DPlTsNdz.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Audio-DPlTsNdz.d.mts","names":[],"sources":["../src/domain/Audio.ts"],"mappings":";;;;;;;;;;;;;;;KAWY,aAAA;;;;;AAAZ;;;;;KA0BY,WAAA,GACR,QAAA,CAAS,aAAA,IACT,WAAA,CAAY,aAAA,IACZ,UAAA,CAAW,aAAA;AAAA,cAEF,UAAA,GAAc,CAAA,EAAG,WAAA,KAAc,CAAA,IAAK,QAAA,CAAS,aAAA;AAAA,cAC7C,aAAA,GAAiB,CAAA,EAAG,WAAA,KAAc,CAAA,IAAK,WAAA,CAAY,aAAA;AAAA,cAEnD,YAAA,GAAgB,CAAA,EAAG,WAAA,KAAc,CAAA,IAAK,UAAA,CAAW,aAAA;;;;;;;KAQlD,WAAA;EAAA,SACD,SAAA;EAAA,SACA,QAAA;EAAA,SAUA,UAAA,wDA1BK;EAAA,SA4BL,OAAA;EAAA,SACA,QAAA;AAAA;;AA1BX;;;;KAkCY,UAAA;EAAA,SACD,KAAA,EAAO,UAAA;AAAA;;;;;KAON,SAAA;EAAA,SACD,MAAA,EAAQ,WAAA;EAAA,SACR,KAAA,EAAO,UAAA;EAAA,SACP,QAAA,GAAW,QAAA,CAAS,QAAA;AAAA"}
|
|
@@ -74,8 +74,8 @@ declare const Annotation: Schema.Union<readonly [Schema.Struct<{
|
|
|
74
74
|
}>]>;
|
|
75
75
|
type Annotation = typeof Annotation.Type;
|
|
76
76
|
declare const isUrlCitation: <I>(input: I) => input is I & {
|
|
77
|
-
readonly url: string;
|
|
78
77
|
readonly type: "url_citation";
|
|
78
|
+
readonly url: string;
|
|
79
79
|
readonly start_index: number;
|
|
80
80
|
readonly end_index: number;
|
|
81
81
|
readonly title: string;
|
|
@@ -298,19 +298,19 @@ declare const HistoryItem: Schema.Union<readonly [Schema.Struct<{
|
|
|
298
298
|
}>]>;
|
|
299
299
|
type HistoryItem = typeof HistoryItem.Type;
|
|
300
300
|
declare const isInputText: <I>(input: I) => input is I & {
|
|
301
|
-
readonly type: "input_text";
|
|
302
301
|
readonly text: string;
|
|
302
|
+
readonly type: "input_text";
|
|
303
303
|
};
|
|
304
304
|
declare const isInputImage: <I>(input: I) => input is I & {
|
|
305
305
|
readonly type: "input_image";
|
|
306
306
|
readonly source: ImageSource;
|
|
307
307
|
};
|
|
308
308
|
declare const isOutputText: <I>(input: I) => input is I & {
|
|
309
|
-
readonly type: "output_text";
|
|
310
309
|
readonly text: string;
|
|
310
|
+
readonly type: "output_text";
|
|
311
311
|
readonly annotations?: readonly ({
|
|
312
|
-
readonly url: string;
|
|
313
312
|
readonly type: "url_citation";
|
|
313
|
+
readonly url: string;
|
|
314
314
|
readonly start_index: number;
|
|
315
315
|
readonly end_index: number;
|
|
316
316
|
readonly title: string;
|
|
@@ -331,23 +331,23 @@ declare const isOutputText: <I>(input: I) => input is I & {
|
|
|
331
331
|
})[] | undefined;
|
|
332
332
|
};
|
|
333
333
|
declare const isRefusal: <I>(input: I) => input is I & {
|
|
334
|
-
readonly type: "refusal";
|
|
335
334
|
readonly text: string;
|
|
335
|
+
readonly type: "refusal";
|
|
336
336
|
};
|
|
337
337
|
declare const isMessage: <I>(input: I) => input is I & {
|
|
338
338
|
readonly type: "message";
|
|
339
339
|
readonly content: readonly ({
|
|
340
|
-
readonly type: "input_text";
|
|
341
340
|
readonly text: string;
|
|
341
|
+
readonly type: "input_text";
|
|
342
342
|
} | {
|
|
343
343
|
readonly type: "input_image";
|
|
344
344
|
readonly source: ImageSource;
|
|
345
345
|
} | {
|
|
346
|
-
readonly type: "output_text";
|
|
347
346
|
readonly text: string;
|
|
347
|
+
readonly type: "output_text";
|
|
348
348
|
readonly annotations?: readonly ({
|
|
349
|
-
readonly url: string;
|
|
350
349
|
readonly type: "url_citation";
|
|
350
|
+
readonly url: string;
|
|
351
351
|
readonly start_index: number;
|
|
352
352
|
readonly end_index: number;
|
|
353
353
|
readonly title: string;
|
|
@@ -367,22 +367,22 @@ declare const isMessage: <I>(input: I) => input is I & {
|
|
|
367
367
|
readonly index: number;
|
|
368
368
|
})[] | undefined;
|
|
369
369
|
} | {
|
|
370
|
-
readonly type: "refusal";
|
|
371
370
|
readonly text: string;
|
|
371
|
+
readonly type: "refusal";
|
|
372
372
|
})[];
|
|
373
373
|
readonly role: "user" | "assistant" | "system";
|
|
374
374
|
readonly providerData?: unknown;
|
|
375
375
|
};
|
|
376
376
|
declare const isToolCall: <I>(input: I) => input is I & {
|
|
377
|
-
readonly type: "function_call";
|
|
378
377
|
readonly call_id: string;
|
|
379
378
|
readonly name: string;
|
|
379
|
+
readonly type: "function_call";
|
|
380
380
|
readonly arguments: string;
|
|
381
381
|
readonly providerData?: unknown;
|
|
382
382
|
};
|
|
383
383
|
declare const isToolCallOutput: <I>(input: I) => input is I & {
|
|
384
|
-
readonly type: "function_call_output";
|
|
385
384
|
readonly call_id: string;
|
|
385
|
+
readonly type: "function_call_output";
|
|
386
386
|
readonly output: string;
|
|
387
387
|
readonly providerData?: unknown;
|
|
388
388
|
};
|
|
@@ -421,4 +421,4 @@ declare const assistantText: (text: string) => Message;
|
|
|
421
421
|
declare const toolCallOutput: (call_id: string, output: string) => ToolCallOutput;
|
|
422
422
|
//#endregion
|
|
423
423
|
export { isReasoning as A, isContainerFileCitation as C, isInputText as D, isInputImage as E, systemText as F, toolCallOutput as I, userText as L, isToolCall as M, isToolCallOutput as N, isMessage as O, isUrlCitation as P, assistantText as S, isFilePath as T, StopReason as _, FilePath as a, UrlCitation as b, InputText as c, Message as d, OutputText as f, Role as g, Refusal as h, FileCitation as i, isRefusal as j, isOutputText as k, InputTokensDetails as l, Reasoning as m, ContainerFileCitation as n, HistoryItem as o, OutputTokensDetails as p, ContentBlock as r, InputImage as s, Annotation as t, Items_d_exports as u, ToolCall as v, isFileCitation as w, Usage as x, ToolCallOutput as y };
|
|
424
|
-
//# sourceMappingURL=Items-
|
|
424
|
+
//# sourceMappingURL=Items-7ljaVxH_.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Items-
|
|
1
|
+
{"version":3,"file":"Items-7ljaVxH_.d.mts","names":[],"sources":["../src/domain/Items.ts"],"mappings":";;;;;;;cAOa,SAAA,EAAS,MAAA,CAAA,MAAA;EAAA;;;KAIV,SAAA,UAAmB,SAAA,CAAU,IAAA;;;;;;;;;cAU5B,UAAA,EAAU,MAAA,CAAA,MAAA;EAAA;;;KAIX,UAAA,UAAoB,UAAA,CAAW,IAAA;AAAA,cAQ9B,WAAA,EAAW,MAAA,CAAA,MAAA;EAAA;;;;;;KAOZ,WAAA,UAAqB,WAAA,CAAY,IAAA;AAAA,cAEhC,YAAA,EAAY,MAAA,CAAA,MAAA;EAAA;;;;KAKb,YAAA,UAAsB,YAAA,CAAa,IAAA;AAAA,cAElC,qBAAA,EAAqB,MAAA,CAAA,MAAA;EAAA;;;;;;KAOtB,qBAAA,UAA+B,qBAAA,CAAsB,IAAA;AAAA,cAEpD,QAAA,EAAQ,MAAA,CAAA,MAAA;EAAA;;;;KAKT,QAAA,UAAkB,QAAA,CAAS,IAAA;AAAA,cAE1B,UAAA,EAAU,MAAA,CAAA,KAAA,WAAA,MAAA,CAAA,MAAA;EAAA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7B,aAAA,GAAiB,IAAA,aAAe,OAAA;AAAA,cAMhC,cAAA,GAAkB,OAAA,UAAiB,MAAA,aAAiB,cAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { v as ToolCall, y as ToolCallOutput } from "./Items-
|
|
1
|
+
import { v as ToolCall, y as ToolCallOutput } from "./Items-7ljaVxH_.mjs";
|
|
2
2
|
import { Effect, Schema, Stream } from "effect";
|
|
3
3
|
import * as _$effect_Cause0 from "effect/Cause";
|
|
4
4
|
import { StandardJSONSchemaV1, StandardSchemaV1 } from "@standard-schema/spec";
|
|
@@ -99,4 +99,4 @@ declare const toDescriptors: <R>(tools: ReadonlyArray<AnyTool<R>>) => ReadonlyAr
|
|
|
99
99
|
declare const execute: <Name extends string, Input, Output, R>(tool: Tool<Name, Input, Output, R>, call: ToolCall) => Effect.Effect<ToolCallOutput, ToolError, R>;
|
|
100
100
|
//#endregion
|
|
101
101
|
export { Tool as a, ToolInputSchema as c, fromEffectSchema as d, fromStandardSchema as f, toDescriptors as g, streaming as h, StreamingTool as i, Tool_d_exports as l, make as m, AnyStreamingTool as n, ToolDescriptor as o, isStreamingTool as p, AnyTool as r, ToolError as s, AnyPlainTool as t, execute as u };
|
|
102
|
-
//# sourceMappingURL=Tool-
|
|
102
|
+
//# sourceMappingURL=Tool-BKiieFXk.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tool-
|
|
1
|
+
{"version":3,"file":"Tool-BKiieFXk.d.mts","names":[],"sources":["../src/tool/Tool.ts"],"mappings":";;;;;;;;;cAEkE,cAAA;;;;;;cAGrD,SAAA,SAAkB,cAAA;;;;;;;;;;KAmBnB,eAAA,oBAAmC,gBAAA,UAA0B,KAAA,IACvE,oBAAA,UAA8B,KAAA;;;;AAvBkC;;cA8BrD,gBAAA,aAA8B,MAAA,CAAO,KAAA,wBAChD,MAAA,EAAQ,CAAA,KACP,CAAA,GAAI,eAAA,CAAgB,CAAA;;;;;;;;;;;;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C,OAAA,YAAmB,gBAAA,CAAiB,CAAA,IAAK,YAAA,CAAa,CAAA;AAAA,cAErD,eAAA,MAAsB,CAAA,EAAG,OAAA,CAAQ,CAAA,MAAK,CAAA,IAAK,gBAAA,CAAiB,CAAA;;;;;;cAQ5D,aAAA,MAAoB,KAAA,EAAO,aAAA,CAAc,OAAA,CAAQ,CAAA,OAAM,aAAA,CAAc,cAAA;;;;;;cAkBrE,OAAA,0CACX,IAAA,EAAM,IAAA,CAAK,IAAA,EAAM,KAAA,EAAO,MAAA,EAAQ,CAAA,GAChC,IAAA,EAAM,QAAA,KACL,MAAA,CAAO,MAAA,CAAO,cAAA,EAAgB,SAAA,EAAW,CAAA"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
|
|
3
|
+
//#region src/capabilities/Capabilities.d.ts
|
|
4
|
+
declare namespace Capabilities_d_exports {
|
|
5
|
+
export { CapabilityWarning, warnDropped, warnDroppedWhen };
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Structured event emitted when a provider adapter drops a Common
|
|
9
|
+
* request field because its wire API has no place to put it (bucket 2
|
|
10
|
+
* per the capabilities policy: the provider has no structured
|
|
11
|
+
* interpretation; the output is still valid, just less aligned with
|
|
12
|
+
* the caller's hint).
|
|
13
|
+
*
|
|
14
|
+
* Carried on `Effect.logWarning` today for visibility; may be
|
|
15
|
+
* promoted to a typed `AiError` variant in the future if callers need
|
|
16
|
+
* to react programmatically. The shape itself is stable.
|
|
17
|
+
*
|
|
18
|
+
* @category capabilities
|
|
19
|
+
*/
|
|
20
|
+
type CapabilityWarning = {
|
|
21
|
+
readonly _tag: "CapabilityWarning";
|
|
22
|
+
readonly provider: string; /** The capability name as it appears in docs (`"lyrics"`, `"bpm"`). */
|
|
23
|
+
readonly capability: string; /** The Common-request field name that was dropped. */
|
|
24
|
+
readonly field: string; /** The value the caller passed; included when useful for debugging. */
|
|
25
|
+
readonly value?: unknown; /** Human-readable explanation; should suggest a workaround. */
|
|
26
|
+
readonly reason: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Emit a structured `CapabilityWarning` via `Effect.logWarning`. Use
|
|
30
|
+
* when a provider adapter receives a Common-request field it has no
|
|
31
|
+
* structured wire field for, and would otherwise drop silently.
|
|
32
|
+
*
|
|
33
|
+
* Bucket-2 cases only (per the capabilities policy): the provider has
|
|
34
|
+
* no interpretation; the output is still valid, just less aligned
|
|
35
|
+
* with the caller's hint. For bucket-1 cases (structurally broken
|
|
36
|
+
* output if dropped, like wrong audio format), fail
|
|
37
|
+
* `AiError.Unsupported` instead.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* if (request.lyrics !== undefined) {
|
|
42
|
+
* yield* warnDropped({
|
|
43
|
+
* provider: "lyria",
|
|
44
|
+
* capability: "lyrics",
|
|
45
|
+
* field: "lyrics",
|
|
46
|
+
* reason: "Lyria 3 sync has no `lyrics` wire field. Embed in your prompt instead.",
|
|
47
|
+
* })
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
declare const warnDropped: (warning: Omit<CapabilityWarning, "_tag">) => Effect.Effect<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Shorthand for the most common shape: warn-and-drop when a specific
|
|
54
|
+
* field on the Common request is set. The field's value is included
|
|
55
|
+
* automatically.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* yield* Effect.all([
|
|
60
|
+
* warnDroppedWhen(request.lyrics, {
|
|
61
|
+
* provider: "lyria",
|
|
62
|
+
* capability: "lyrics",
|
|
63
|
+
* field: "lyrics",
|
|
64
|
+
* reason: "Lyria 3 sync has no `lyrics` wire field. Embed in your prompt instead.",
|
|
65
|
+
* }),
|
|
66
|
+
* warnDroppedWhen(request.duration, {
|
|
67
|
+
* provider: "lyria",
|
|
68
|
+
* capability: "duration",
|
|
69
|
+
* field: "duration",
|
|
70
|
+
* reason: "Lyria 3 clip is fixed at 30 s.",
|
|
71
|
+
* }),
|
|
72
|
+
* ], { discard: true })
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
declare const warnDroppedWhen: <T>(value: T | undefined, warning: Omit<CapabilityWarning, "_tag" | "value">) => Effect.Effect<void>;
|
|
76
|
+
//#endregion
|
|
77
|
+
export { CapabilityWarning, Capabilities_d_exports as t, warnDropped, warnDroppedWhen };
|
|
78
|
+
//# sourceMappingURL=Capabilities.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Capabilities.d.mts","names":[],"sources":["../../src/capabilities/Capabilities.ts"],"mappings":";;;;;;;;;;;;;;AAeA;;;;;KAAY,iBAAA;EAAA,SACD,IAAA;EAAA,SACA,QAAA,UAMA;EAAA,SAJA,UAAA,UAMM;EAAA,SAJN,KAAA,UA8BE;EAAA,SA5BF,KAAA;WAEA,MAAA;AAAA;;;;;;;;;;;AAoDX;;;;;;;;;;;;;cA1Ba,WAAA,GAAe,OAAA,EAAS,IAAA,CAAK,iBAAA,cAA6B,MAAA,CAAO,MAAA;;;;;;;;;;;;;;;;;;;;;;;;cA0BjE,eAAA,MACX,KAAA,EAAO,CAAA,cACP,OAAA,EAAS,IAAA,CAAK,iBAAA,wBACb,MAAA,CAAO,MAAA"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { n as __exportAll } from "../chunk-uyGKjUfl.mjs";
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
//#region src/capabilities/Capabilities.ts
|
|
4
|
+
var Capabilities_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
warnDropped: () => warnDropped,
|
|
6
|
+
warnDroppedWhen: () => warnDroppedWhen
|
|
7
|
+
});
|
|
8
|
+
/**
|
|
9
|
+
* Emit a structured `CapabilityWarning` via `Effect.logWarning`. Use
|
|
10
|
+
* when a provider adapter receives a Common-request field it has no
|
|
11
|
+
* structured wire field for, and would otherwise drop silently.
|
|
12
|
+
*
|
|
13
|
+
* Bucket-2 cases only (per the capabilities policy): the provider has
|
|
14
|
+
* no interpretation; the output is still valid, just less aligned
|
|
15
|
+
* with the caller's hint. For bucket-1 cases (structurally broken
|
|
16
|
+
* output if dropped, like wrong audio format), fail
|
|
17
|
+
* `AiError.Unsupported` instead.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* if (request.lyrics !== undefined) {
|
|
22
|
+
* yield* warnDropped({
|
|
23
|
+
* provider: "lyria",
|
|
24
|
+
* capability: "lyrics",
|
|
25
|
+
* field: "lyrics",
|
|
26
|
+
* reason: "Lyria 3 sync has no `lyrics` wire field. Embed in your prompt instead.",
|
|
27
|
+
* })
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
const warnDropped = (warning) => Effect.logWarning("Capability dropped", {
|
|
32
|
+
...warning,
|
|
33
|
+
_tag: "CapabilityWarning"
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* Shorthand for the most common shape: warn-and-drop when a specific
|
|
37
|
+
* field on the Common request is set. The field's value is included
|
|
38
|
+
* automatically.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* yield* Effect.all([
|
|
43
|
+
* warnDroppedWhen(request.lyrics, {
|
|
44
|
+
* provider: "lyria",
|
|
45
|
+
* capability: "lyrics",
|
|
46
|
+
* field: "lyrics",
|
|
47
|
+
* reason: "Lyria 3 sync has no `lyrics` wire field. Embed in your prompt instead.",
|
|
48
|
+
* }),
|
|
49
|
+
* warnDroppedWhen(request.duration, {
|
|
50
|
+
* provider: "lyria",
|
|
51
|
+
* capability: "duration",
|
|
52
|
+
* field: "duration",
|
|
53
|
+
* reason: "Lyria 3 clip is fixed at 30 s.",
|
|
54
|
+
* }),
|
|
55
|
+
* ], { discard: true })
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
const warnDroppedWhen = (value, warning) => value === void 0 ? Effect.void : warnDropped({
|
|
59
|
+
...warning,
|
|
60
|
+
value
|
|
61
|
+
});
|
|
62
|
+
//#endregion
|
|
63
|
+
export { Capabilities_exports as t, warnDropped, warnDroppedWhen };
|
|
64
|
+
|
|
65
|
+
//# sourceMappingURL=Capabilities.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Capabilities.mjs","names":[],"sources":["../../src/capabilities/Capabilities.ts"],"sourcesContent":["import { Effect } from \"effect\"\n\n/**\n * Structured event emitted when a provider adapter drops a Common\n * request field because its wire API has no place to put it (bucket 2\n * per the capabilities policy: the provider has no structured\n * interpretation; the output is still valid, just less aligned with\n * the caller's hint).\n *\n * Carried on `Effect.logWarning` today for visibility; may be\n * promoted to a typed `AiError` variant in the future if callers need\n * to react programmatically. The shape itself is stable.\n *\n * @category capabilities\n */\nexport type CapabilityWarning = {\n readonly _tag: \"CapabilityWarning\"\n readonly provider: string\n /** The capability name as it appears in docs (`\"lyrics\"`, `\"bpm\"`). */\n readonly capability: string\n /** The Common-request field name that was dropped. */\n readonly field: string\n /** The value the caller passed; included when useful for debugging. */\n readonly value?: unknown\n /** Human-readable explanation; should suggest a workaround. */\n readonly reason: string\n}\n\n/**\n * Emit a structured `CapabilityWarning` via `Effect.logWarning`. Use\n * when a provider adapter receives a Common-request field it has no\n * structured wire field for, and would otherwise drop silently.\n *\n * Bucket-2 cases only (per the capabilities policy): the provider has\n * no interpretation; the output is still valid, just less aligned\n * with the caller's hint. For bucket-1 cases (structurally broken\n * output if dropped, like wrong audio format), fail\n * `AiError.Unsupported` instead.\n *\n * @example\n * ```ts\n * if (request.lyrics !== undefined) {\n * yield* warnDropped({\n * provider: \"lyria\",\n * capability: \"lyrics\",\n * field: \"lyrics\",\n * reason: \"Lyria 3 sync has no `lyrics` wire field. Embed in your prompt instead.\",\n * })\n * }\n * ```\n */\nexport const warnDropped = (warning: Omit<CapabilityWarning, \"_tag\">): Effect.Effect<void> =>\n Effect.logWarning(\"Capability dropped\", { ...warning, _tag: \"CapabilityWarning\" })\n\n/**\n * Shorthand for the most common shape: warn-and-drop when a specific\n * field on the Common request is set. The field's value is included\n * automatically.\n *\n * @example\n * ```ts\n * yield* Effect.all([\n * warnDroppedWhen(request.lyrics, {\n * provider: \"lyria\",\n * capability: \"lyrics\",\n * field: \"lyrics\",\n * reason: \"Lyria 3 sync has no `lyrics` wire field. Embed in your prompt instead.\",\n * }),\n * warnDroppedWhen(request.duration, {\n * provider: \"lyria\",\n * capability: \"duration\",\n * field: \"duration\",\n * reason: \"Lyria 3 clip is fixed at 30 s.\",\n * }),\n * ], { discard: true })\n * ```\n */\nexport const warnDroppedWhen = <T>(\n value: T | undefined,\n warning: Omit<CapabilityWarning, \"_tag\" | \"value\">,\n): Effect.Effect<void> => (value === undefined ? Effect.void : warnDropped({ ...warning, value }))\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,MAAa,eAAe,YAC1B,OAAO,WAAW,sBAAsB;CAAE,GAAG;CAAS,MAAM;CAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;AAyBpF,MAAa,mBACX,OACA,YACyB,UAAU,KAAA,IAAY,OAAO,OAAO,YAAY;CAAE,GAAG;CAAS;CAAO,CAAC"}
|
package/dist/domain/Audio.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as AudioSource, c as isAudioBytes, i as AudioMimeType, l as isAudioUrl, n as AudioChunk, r as AudioFormat, s as isAudioBase64, t as AudioBlob } from "../Audio-
|
|
1
|
+
import { a as AudioSource, c as isAudioBytes, i as AudioMimeType, l as isAudioUrl, n as AudioChunk, r as AudioFormat, s as isAudioBase64, t as AudioBlob } from "../Audio-DPlTsNdz.mjs";
|
|
2
2
|
export { AudioBlob, AudioChunk, AudioFormat, AudioMimeType, AudioSource, isAudioBase64, isAudioBytes, isAudioUrl };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Audio.mjs","names":[],"sources":["../../src/domain/Audio.ts"],"sourcesContent":["import type { MediaBase64, MediaBytes, MediaUrl } from \"./Media.js\"\n\n/**\n * MIME types we care about across STT input and TTS output. Container-\n * level only — sample rate / encoding flavours live on `AudioFormat`.\n *\n * Per-provider request types narrow this further. The `(string & {})`\n * tail keeps autocomplete on the literals while still accepting any\n * string, so unusual formats work without an SDK update.\n */\nexport type AudioMimeType =\n | \"audio/mpeg\"\n | \"audio/wav\"\n | \"audio/x-wav\"\n | \"audio/ogg\"\n | \"audio/opus\"\n | \"audio/flac\"\n | \"audio/aac\"\n | \"audio/mp4\"\n | \"audio/webm\"\n | \"audio/L16\"\n | \"audio/pcm\"\n | \"audio/mulaw\"\n | \"audio/alaw\"\n // eslint-disable-next-line @typescript-eslint/ban-types\n | (string & {})\n\n/**\n * Audio at rest — instantiates `MediaSource` with the audio MIME union.\n * Used for sync STT input.\n *\n * URL variant is best-effort: some providers (OpenAI, Cartesia, Azure\n * short-audio) reject URL ingestion and the adapter must upload via the\n * `bytes` or `base64` variant instead. Adapter layers reject unsupported\n * shapes up front with `AiError.InvalidRequest`.\n */\nexport type AudioSource =\n | MediaUrl<AudioMimeType>\n | MediaBase64<AudioMimeType>\n | MediaBytes<AudioMimeType>\n\nexport const isAudioUrl = (s: AudioSource): s is MediaUrl<AudioMimeType> => s._tag === \"url\"\nexport const isAudioBase64 = (s: AudioSource): s is MediaBase64<AudioMimeType> =>\n s._tag === \"base64\"\nexport const isAudioBytes = (s: AudioSource): s is MediaBytes<AudioMimeType> => s._tag === \"bytes\"\n\n/**\n * Structural audio format. Used both as TTS output spec and as STT\n * streaming-input declaration. Providers that use compound slugs\n * (`mp3_44100_128`, `audio-16khz-128kbitrate-mono-mp3`,\n * `aura-2-thalia-en`) are encoded at the adapter layer.\n */\nexport type AudioFormat = {\n readonly container: \"mp3\" | \"wav\" | \"ogg\" | \"opus\" | \"flac\" | \"aac\" | \"webm\" | \"raw\"\n readonly encoding:\n | \"pcm_s16le\"\n | \"pcm_f32le\"\n | \"pcm_mulaw\"\n | \"pcm_alaw\"\n | \"mp3\"\n | \"opus\"\n | \"vorbis\"\n | \"flac\"\n | \"aac\"\n readonly sampleRate: 8000 | 16000 | 22050 | 24000 | 32000 | 44100 | 48000\n /** mp3 / opus only. */\n readonly bitRate?: number\n readonly channels?: 1 | 2\n}\n\n/**\n * Streamed audio chunk. `bytes` carries the codec-encoded payload as\n * declared on the stream's `AudioFormat`. No per-chunk timestamp here —\n * providers that emit timing do so via `TranscriptEvent.words[]`.\n */\nexport type AudioChunk = {\n readonly bytes: Uint8Array\n}\n\n/**\n * Full audio result for sync TTS. Format mirrors the request; provider\n * layers normalize.\n */\nexport type AudioBlob = {\n readonly format: AudioFormat\n readonly bytes: Uint8Array\n readonly
|
|
1
|
+
{"version":3,"file":"Audio.mjs","names":[],"sources":["../../src/domain/Audio.ts"],"sourcesContent":["import type { Duration } from \"effect\"\nimport type { MediaBase64, MediaBytes, MediaUrl } from \"./Media.js\"\n\n/**\n * MIME types we care about across STT input and TTS output. Container-\n * level only — sample rate / encoding flavours live on `AudioFormat`.\n *\n * Per-provider request types narrow this further. The `(string & {})`\n * tail keeps autocomplete on the literals while still accepting any\n * string, so unusual formats work without an SDK update.\n */\nexport type AudioMimeType =\n | \"audio/mpeg\"\n | \"audio/wav\"\n | \"audio/x-wav\"\n | \"audio/ogg\"\n | \"audio/opus\"\n | \"audio/flac\"\n | \"audio/aac\"\n | \"audio/mp4\"\n | \"audio/webm\"\n | \"audio/L16\"\n | \"audio/pcm\"\n | \"audio/mulaw\"\n | \"audio/alaw\"\n // eslint-disable-next-line @typescript-eslint/ban-types\n | (string & {})\n\n/**\n * Audio at rest — instantiates `MediaSource` with the audio MIME union.\n * Used for sync STT input.\n *\n * URL variant is best-effort: some providers (OpenAI, Cartesia, Azure\n * short-audio) reject URL ingestion and the adapter must upload via the\n * `bytes` or `base64` variant instead. Adapter layers reject unsupported\n * shapes up front with `AiError.InvalidRequest`.\n */\nexport type AudioSource =\n | MediaUrl<AudioMimeType>\n | MediaBase64<AudioMimeType>\n | MediaBytes<AudioMimeType>\n\nexport const isAudioUrl = (s: AudioSource): s is MediaUrl<AudioMimeType> => s._tag === \"url\"\nexport const isAudioBase64 = (s: AudioSource): s is MediaBase64<AudioMimeType> =>\n s._tag === \"base64\"\nexport const isAudioBytes = (s: AudioSource): s is MediaBytes<AudioMimeType> => s._tag === \"bytes\"\n\n/**\n * Structural audio format. Used both as TTS output spec and as STT\n * streaming-input declaration. Providers that use compound slugs\n * (`mp3_44100_128`, `audio-16khz-128kbitrate-mono-mp3`,\n * `aura-2-thalia-en`) are encoded at the adapter layer.\n */\nexport type AudioFormat = {\n readonly container: \"mp3\" | \"wav\" | \"ogg\" | \"opus\" | \"flac\" | \"aac\" | \"webm\" | \"raw\"\n readonly encoding:\n | \"pcm_s16le\"\n | \"pcm_f32le\"\n | \"pcm_mulaw\"\n | \"pcm_alaw\"\n | \"mp3\"\n | \"opus\"\n | \"vorbis\"\n | \"flac\"\n | \"aac\"\n readonly sampleRate: 8000 | 16000 | 22050 | 24000 | 32000 | 44100 | 48000\n /** mp3 / opus only. */\n readonly bitRate?: number\n readonly channels?: 1 | 2\n}\n\n/**\n * Streamed audio chunk. `bytes` carries the codec-encoded payload as\n * declared on the stream's `AudioFormat`. No per-chunk timestamp here —\n * providers that emit timing do so via `TranscriptEvent.words[]`.\n */\nexport type AudioChunk = {\n readonly bytes: Uint8Array\n}\n\n/**\n * Full audio result for sync TTS. Format mirrors the request; provider\n * layers normalize.\n */\nexport type AudioBlob = {\n readonly format: AudioFormat\n readonly bytes: Uint8Array\n readonly duration?: Duration.Duration\n}\n"],"mappings":";;;;;;;AA0CA,MAAa,cAAc,MAAiD,EAAE,SAAS;AACvF,MAAa,iBAAiB,MAC5B,EAAE,SAAS;AACb,MAAa,gBAAgB,MAAmD,EAAE,SAAS"}
|
package/dist/domain/Items.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as isReasoning, C as isContainerFileCitation, D as isInputText, E as isInputImage, F as systemText, I as toolCallOutput, L as userText, M as isToolCall, N as isToolCallOutput, O as isMessage, P as isUrlCitation, S as assistantText, T as isFilePath, _ as StopReason, a as FilePath, b as UrlCitation, c as InputText, d as Message, f as OutputText, g as Role, h as Refusal, i as FileCitation, j as isRefusal, k as isOutputText, l as InputTokensDetails, m as Reasoning, n as ContainerFileCitation, o as HistoryItem, p as OutputTokensDetails, r as ContentBlock, s as InputImage, t as Annotation, v as ToolCall, w as isFileCitation, x as Usage, y as ToolCallOutput } from "../Items-
|
|
1
|
+
import { A as isReasoning, C as isContainerFileCitation, D as isInputText, E as isInputImage, F as systemText, I as toolCallOutput, L as userText, M as isToolCall, N as isToolCallOutput, O as isMessage, P as isUrlCitation, S as assistantText, T as isFilePath, _ as StopReason, a as FilePath, b as UrlCitation, c as InputText, d as Message, f as OutputText, g as Role, h as Refusal, i as FileCitation, j as isRefusal, k as isOutputText, l as InputTokensDetails, m as Reasoning, n as ContainerFileCitation, o as HistoryItem, p as OutputTokensDetails, r as ContentBlock, s as InputImage, t as Annotation, v as ToolCall, w as isFileCitation, x as Usage, y as ToolCallOutput } from "../Items-7ljaVxH_.mjs";
|
|
2
2
|
export { Annotation, ContainerFileCitation, ContentBlock, FileCitation, FilePath, HistoryItem, InputImage, InputText, InputTokensDetails, Message, OutputText, OutputTokensDetails, Reasoning, Refusal, Role, StopReason, ToolCall, ToolCallOutput, UrlCitation, Usage, assistantText, isContainerFileCitation, isFileCitation, isFilePath, isInputImage, isInputText, isMessage, isOutputText, isReasoning, isRefusal, isToolCall, isToolCallOutput, isUrlCitation, systemText, toolCallOutput, userText };
|
package/dist/domain/Music.d.mts
CHANGED
|
@@ -1,116 +1,175 @@
|
|
|
1
|
-
import { r as AudioFormat, t as AudioBlob } from "../Audio-
|
|
1
|
+
import { n as AudioChunk, r as AudioFormat, t as AudioBlob } from "../Audio-DPlTsNdz.mjs";
|
|
2
|
+
import { Duration } from "effect";
|
|
2
3
|
|
|
3
4
|
//#region src/domain/Music.d.ts
|
|
4
5
|
declare namespace Music_d_exports {
|
|
5
|
-
export { CommonGenerateMusicRequest, CommonStreamGenerateMusicRequest, MusicResult, MusicSessionInput, WeightedPrompt,
|
|
6
|
+
export { CommonGenerateMusicRequest, CommonStreamGenerateMusicRequest, GenerateResult, MusicResult, MusicSection, MusicSessionControl, MusicSessionInput, MusicStreamEvent, Watermark, WeightedPrompt, audioEvent, controlInput, filteredPromptEvent, isAudioEvent, isControlInput, isFilteredPromptEvent, isPromptsInput, isWarningEvent, promptsInput, singleVariant, warningEvent };
|
|
6
7
|
}
|
|
7
8
|
/**
|
|
8
9
|
* Prompt fragment with a relative weight. Native to Lyria RealTime
|
|
9
|
-
* (`{ text, weight }` pairs blended in the model).
|
|
10
|
-
* providers (
|
|
11
|
-
*
|
|
10
|
+
* (`{ text, weight }` pairs blended in the model) and Riffusion compose.
|
|
11
|
+
* Single-prompt providers (the majority) treat a 1-element array with
|
|
12
|
+
* `weight: 1` as a plain prompt.
|
|
12
13
|
*/
|
|
13
14
|
type WeightedPrompt = {
|
|
14
15
|
readonly text: string; /** Default `1.0`. Range typically `[0, 1]`; provider-dependent. */
|
|
15
16
|
readonly weight?: number;
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
18
|
-
* Cross-provider music-generation request.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* Cross-provider music-generation request. Trimmed to fields the
|
|
20
|
+
* majority of music providers honor structurally; provider-specific
|
|
21
|
+
* extras (Lyria `bpm` / `scale`, ElevenLabs `compositionPlan` /
|
|
22
|
+
* `signWithC2pa`, Suno `style` / `personaId`, MiniMax `lyricsOptimizer`,
|
|
23
|
+
* `instrumental` on providers that ship a wire toggle) live on each
|
|
24
|
+
* provider's typed request which extends this and narrows `model`.
|
|
25
|
+
*
|
|
26
|
+
* Music providers are one-shot text-to-audio, not conversational. No
|
|
27
|
+
* `messages[]` shape applies.
|
|
22
28
|
*/
|
|
23
29
|
type CommonGenerateMusicRequest = {
|
|
24
|
-
/** Model identifier. Each provider narrows. */readonly model: string; /** Single prompt string
|
|
25
|
-
readonly
|
|
30
|
+
/** Model identifier. Each provider narrows. */readonly model: string; /** Single prompt string. Weighted blends are provider-typed extras. */
|
|
31
|
+
readonly prompt: string;
|
|
26
32
|
/**
|
|
27
|
-
* Lyrics text, optionally with section tags like `[Verse]` /
|
|
28
|
-
* `[Bridge]` / `[Outro]`.
|
|
29
|
-
*
|
|
33
|
+
* Lyrics text, optionally with section tags like `[Verse]` /
|
|
34
|
+
* `[Chorus]` / `[Bridge]` / `[Outro]`. Routed to a structured wire
|
|
35
|
+
* field on providers that have one (ElevenLabs `lines`, MiniMax
|
|
36
|
+
* `lyrics`, Mureka `lyrics`, Suno custom-mode `prompt`); embedded in
|
|
37
|
+
* the prompt with a warning on providers without one (Lyria 3,
|
|
38
|
+
* Riffusion).
|
|
30
39
|
*/
|
|
31
|
-
readonly lyrics?: string; /** Target duration
|
|
32
|
-
readonly
|
|
33
|
-
readonly bpm?: number;
|
|
40
|
+
readonly lyrics?: string; /** Target duration. Provider may treat as a hint or hard limit. */
|
|
41
|
+
readonly duration?: Duration.Duration;
|
|
34
42
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
43
|
+
* Reproducibility seed. Tuning hint (bucket 3): honored where the
|
|
44
|
+
* provider takes one (Lyria 2 Vertex, Lyria RealTime, ElevenLabs
|
|
45
|
+
* with `compositionPlan`, Stable Audio, MusicGen); silently ignored
|
|
46
|
+
* elsewhere.
|
|
37
47
|
*/
|
|
38
|
-
readonly
|
|
39
|
-
readonly instrumental?: boolean; /** Preferred output format. Provider may override. */
|
|
48
|
+
readonly seed?: number; /** Preferred output format. Provider may override. */
|
|
40
49
|
readonly outputFormat?: AudioFormat;
|
|
41
50
|
};
|
|
42
51
|
/**
|
|
43
|
-
* Streamed-output request. Same shape as the sync request
|
|
52
|
+
* Streamed-output request. Same shape as the sync request: the
|
|
44
53
|
* streaming variant only differs in how the response is delivered.
|
|
45
54
|
*/
|
|
46
55
|
type CommonStreamGenerateMusicRequest = CommonGenerateMusicRequest;
|
|
47
56
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
57
|
+
* Playback-control vocabulary that converges across interactive-media
|
|
58
|
+
* protocols (Web Audio, MIDI sequencer control, music SDK surfaces).
|
|
59
|
+
* Provider-specific control actions (Lyria's `reset_context` and any
|
|
60
|
+
* future provider's extras) live on the provider-typed session-input
|
|
61
|
+
* union.
|
|
62
|
+
*/
|
|
63
|
+
type MusicSessionControl = "play" | "pause" | "stop" | "reset";
|
|
64
|
+
/**
|
|
65
|
+
* Bidirectional-session input on the cross-provider surface. Two
|
|
66
|
+
* load-bearing actions every interactive music session needs:
|
|
67
|
+
*
|
|
68
|
+
* - `prompts` — steer the active generation with a (single or
|
|
69
|
+
* weighted) prompt blend.
|
|
70
|
+
* - `control` — play / pause / stop / reset.
|
|
71
|
+
*
|
|
72
|
+
* Provider-typed services extend this union with their own `config`
|
|
73
|
+
* variant for model-specific knobs (Lyria RealTime exposes density /
|
|
74
|
+
* brightness / mute-stems / BPM / scale / etc. via its own
|
|
75
|
+
* `LyriaRealtimeSessionInput`).
|
|
51
76
|
*/
|
|
52
77
|
type MusicSessionInput = {
|
|
53
78
|
readonly _tag: "prompts";
|
|
54
79
|
readonly prompts: ReadonlyArray<WeightedPrompt>;
|
|
55
|
-
} | {
|
|
56
|
-
readonly _tag: "config";
|
|
57
|
-
readonly config: {
|
|
58
|
-
readonly bpm?: number;
|
|
59
|
-
readonly scale?: string;
|
|
60
|
-
readonly density?: number;
|
|
61
|
-
readonly brightness?: number;
|
|
62
|
-
readonly guidance?: number;
|
|
63
|
-
readonly temperature?: number;
|
|
64
|
-
readonly topK?: number;
|
|
65
|
-
readonly seed?: number;
|
|
66
|
-
readonly muteBass?: boolean;
|
|
67
|
-
readonly muteDrums?: boolean;
|
|
68
|
-
readonly onlyBassAndDrums?: boolean;
|
|
69
|
-
};
|
|
70
80
|
} | {
|
|
71
81
|
readonly _tag: "control";
|
|
72
|
-
readonly action:
|
|
82
|
+
readonly action: MusicSessionControl;
|
|
73
83
|
};
|
|
74
84
|
declare const promptsInput: (prompts: ReadonlyArray<WeightedPrompt>) => MusicSessionInput;
|
|
75
|
-
declare const
|
|
76
|
-
_tag: "config";
|
|
77
|
-
})["config"]) => MusicSessionInput;
|
|
78
|
-
declare const controlInput: (action: (MusicSessionInput & {
|
|
79
|
-
_tag: "control";
|
|
80
|
-
})["action"]) => MusicSessionInput;
|
|
85
|
+
declare const controlInput: (action: MusicSessionControl) => MusicSessionInput;
|
|
81
86
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* - `songId` — Suno task id, ElevenLabs `song_id`, etc. Used for
|
|
86
|
-
* back-reference (re-download, stem export, follow-up edits).
|
|
87
|
-
* - `lyrics` — generated lyrics when the model returned them (Lyria
|
|
88
|
-
* text part, Mureka, Suno).
|
|
89
|
-
* - `sections` — structured section markers (Lyria optional JSON
|
|
90
|
-
* structure response).
|
|
91
|
-
* - `watermark` — presence marker (Lyria SynthID is always set).
|
|
87
|
+
* Watermark kind on the response. SynthID is mandatory on Lyria; C2PA
|
|
88
|
+
* is opt-in on ElevenLabs. No provider exposes additional metadata
|
|
89
|
+
* about the watermark itself, so a bare literal-union is enough.
|
|
92
90
|
*/
|
|
93
|
-
type
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
readonly
|
|
102
|
-
|
|
103
|
-
|
|
91
|
+
type Watermark = "synthid" | "c2pa" | (string & {});
|
|
92
|
+
/**
|
|
93
|
+
* Labelled section with absolute timing. Populated when the provider
|
|
94
|
+
* returns structured section metadata (Lyria text part, ElevenLabs
|
|
95
|
+
* `/v1/music/detailed` with `with_timestamps`).
|
|
96
|
+
*/
|
|
97
|
+
type MusicSection = {
|
|
98
|
+
readonly label: string;
|
|
99
|
+
readonly startSeconds: number;
|
|
100
|
+
readonly endSeconds: number;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Single generated track. Composes `AudioBlob` rather than extending
|
|
104
|
+
* it — `result.audio` is the raw blob, `result.songId` / `lyrics` /
|
|
105
|
+
* `sections` / `watermark` are provider-side metadata when returned.
|
|
106
|
+
*/
|
|
107
|
+
type MusicResult = {
|
|
108
|
+
readonly audio: AudioBlob;
|
|
109
|
+
/**
|
|
110
|
+
* Provider identifier, useful when routing through multiple
|
|
111
|
+
* providers in a single pipeline (`"lyria"`, `"elevenlabs-music"`,
|
|
112
|
+
* etc.).
|
|
113
|
+
*/
|
|
114
|
+
readonly provider?: string; /** Provider-side ID for back-reference (re-download, extension, stems). */
|
|
115
|
+
readonly songId?: string; /** Generated or transcribed lyrics when the provider returned them. */
|
|
116
|
+
readonly lyrics?: string; /** Structured section markers when the provider returned them. */
|
|
117
|
+
readonly sections?: ReadonlyArray<MusicSection>; /** Watermark presence indicator when the provider applied one. */
|
|
118
|
+
readonly watermark?: Watermark;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Result of a `generate` call. Suno and Mureka always return 2 tracks
|
|
122
|
+
* per request; every other provider returns 1. `primary` is the
|
|
123
|
+
* caller-friendly convenience; `variants` carries every track the
|
|
124
|
+
* provider produced (length ≥ 1; `primary === variants[0]`).
|
|
125
|
+
*/
|
|
126
|
+
type GenerateResult = {
|
|
127
|
+
readonly primary: MusicResult;
|
|
128
|
+
readonly variants: ReadonlyArray<MusicResult>;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* In-band event on the bidirectional `streamGenerationFrom` output
|
|
132
|
+
* stream. Audio chunks flow as `audio`; server-side warnings
|
|
133
|
+
* (`warning`) and prompt-filter rejections (`filteredPrompt`) flow
|
|
134
|
+
* alongside rather than going to a side-channel log.
|
|
135
|
+
*/
|
|
136
|
+
type MusicStreamEvent = {
|
|
137
|
+
readonly _tag: "audio";
|
|
138
|
+
readonly chunk: AudioChunk;
|
|
139
|
+
} | {
|
|
140
|
+
readonly _tag: "warning";
|
|
141
|
+
readonly message: string;
|
|
142
|
+
} | {
|
|
143
|
+
readonly _tag: "filteredPrompt";
|
|
144
|
+
readonly prompt: string;
|
|
145
|
+
readonly reason: string;
|
|
104
146
|
};
|
|
105
147
|
declare const isPromptsInput: (i: MusicSessionInput) => i is MusicSessionInput & {
|
|
106
148
|
_tag: "prompts";
|
|
107
149
|
};
|
|
108
|
-
declare const isConfigInput: (i: MusicSessionInput) => i is MusicSessionInput & {
|
|
109
|
-
_tag: "config";
|
|
110
|
-
};
|
|
111
150
|
declare const isControlInput: (i: MusicSessionInput) => i is MusicSessionInput & {
|
|
112
151
|
_tag: "control";
|
|
113
152
|
};
|
|
153
|
+
declare const audioEvent: (chunk: AudioChunk) => MusicStreamEvent;
|
|
154
|
+
declare const warningEvent: (message: string) => MusicStreamEvent;
|
|
155
|
+
declare const filteredPromptEvent: (prompt: string, reason: string) => MusicStreamEvent;
|
|
156
|
+
declare const isAudioEvent: (e: MusicStreamEvent) => e is MusicStreamEvent & {
|
|
157
|
+
_tag: "audio";
|
|
158
|
+
};
|
|
159
|
+
declare const isWarningEvent: (e: MusicStreamEvent) => e is MusicStreamEvent & {
|
|
160
|
+
_tag: "warning";
|
|
161
|
+
};
|
|
162
|
+
declare const isFilteredPromptEvent: (e: MusicStreamEvent) => e is MusicStreamEvent & {
|
|
163
|
+
_tag: "filteredPrompt";
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* Build a single-variant `GenerateResult` from a `MusicResult`.
|
|
167
|
+
* Convenience for providers that always return exactly one track
|
|
168
|
+
* (Lyria, ElevenLabs, MiniMax, Stable Audio, MusicGen, Riffusion,
|
|
169
|
+
* Tencent). Providers that return multiple tracks (Suno, Mureka)
|
|
170
|
+
* construct the `GenerateResult` directly.
|
|
171
|
+
*/
|
|
172
|
+
declare const singleVariant: (result: MusicResult) => GenerateResult;
|
|
114
173
|
//#endregion
|
|
115
|
-
export { CommonGenerateMusicRequest, CommonStreamGenerateMusicRequest, MusicResult, MusicSessionInput, WeightedPrompt,
|
|
174
|
+
export { CommonGenerateMusicRequest, CommonStreamGenerateMusicRequest, GenerateResult, MusicResult, MusicSection, MusicSessionControl, MusicSessionInput, MusicStreamEvent, Watermark, WeightedPrompt, audioEvent, controlInput, filteredPromptEvent, isAudioEvent, isControlInput, isFilteredPromptEvent, isPromptsInput, isWarningEvent, promptsInput, singleVariant, Music_d_exports as t, warningEvent };
|
|
116
175
|
//# sourceMappingURL=Music.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Music.d.mts","names":[],"sources":["../../src/domain/Music.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Music.d.mts","names":[],"sources":["../../src/domain/Music.ts"],"mappings":";;;;;;;;;;;;;KASY,cAAA;EAAA,SACD,IAAA;WAEA,MAAA;AAAA;;;;;;;;;;;;KAcC,0BAAA;0DAED,KAAA;WAEA,MAAA;EArBe;;;;AAiB1B;;;;EAjB0B,SA8Bf,MAAA,WATA;EAAA,SAWA,QAAA,GAAW,QAAA,CAAS,QAAA;EAApB;;;;;;EAAA,SAOA,IAAA,WAE0B;EAAA,SAA1B,YAAA,GAAe,WAAA;AAAA;;;;AAgB1B;KATY,gCAAA,GAAmC,0BAAA;;;;AAwB/C;;;;KAfY,mBAAA;;;;;;;;;;;;;AAmBZ;KAJY,iBAAA;EAAA,SACG,IAAA;EAAA,SAA0B,OAAA,EAAS,aAAA,CAAc,cAAA;AAAA;EAAA,SACjD,IAAA;EAAA,SAA0B,MAAA,EAAQ,mBAAA;AAAA;AAAA,cAEpC,YAAA,GAAgB,OAAA,EAAS,aAAA,CAAc,cAAA,MAAkB,iBAAA;AAAA,cAKzD,YAAA,GAAgB,MAAA,EAAQ,mBAAA,KAAsB,iBAAA;;;;;AAA3D;KAUY,SAAA;;;;;;KAOA,YAA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