@effect-uai/core 0.2.0 → 0.4.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/{AiError-CqmYjXyx.d.mts → AiError-csR8Bhxx.d.mts} +26 -4
- package/dist/{AiError-CqmYjXyx.d.mts.map → AiError-csR8Bhxx.d.mts.map} +1 -1
- package/dist/Audio-BfCTGnH3.d.mts +61 -0
- package/dist/Audio-BfCTGnH3.d.mts.map +1 -0
- package/dist/Image-DxyXqzAM.d.mts +61 -0
- package/dist/Image-DxyXqzAM.d.mts.map +1 -0
- package/dist/{Items-D1C2686t.d.mts → Items-Hg5AsYxl.d.mts} +132 -80
- package/dist/Items-Hg5AsYxl.d.mts.map +1 -0
- package/dist/Media-D_CpcM1Z.d.mts +57 -0
- package/dist/Media-D_CpcM1Z.d.mts.map +1 -0
- package/dist/{StructuredFormat-B5ueioNr.d.mts → StructuredFormat-Cl41C56K.d.mts} +5 -5
- package/dist/StructuredFormat-Cl41C56K.d.mts.map +1 -0
- package/dist/{Tool-5wxOCuOh.d.mts → Tool-B8B5qVEy.d.mts} +13 -13
- package/dist/Tool-B8B5qVEy.d.mts.map +1 -0
- package/dist/{Turn-Bi83du4I.d.mts → Turn-7geUcKsf.d.mts} +5 -11
- package/dist/Turn-7geUcKsf.d.mts.map +1 -0
- package/dist/{chunk-CfYAbeIz.mjs → chunk-uyGKjUfl.mjs} +2 -1
- package/dist/dist-DV5ISja1.mjs +13782 -0
- package/dist/dist-DV5ISja1.mjs.map +1 -0
- package/dist/domain/AiError.d.mts +2 -2
- package/dist/domain/AiError.mjs +19 -3
- package/dist/domain/AiError.mjs.map +1 -1
- package/dist/domain/Audio.d.mts +2 -0
- package/dist/domain/Audio.mjs +14 -0
- package/dist/domain/Audio.mjs.map +1 -0
- package/dist/domain/Image.d.mts +2 -0
- package/dist/domain/Image.mjs +58 -0
- package/dist/domain/Image.mjs.map +1 -0
- package/dist/domain/Items.d.mts +2 -2
- package/dist/domain/Items.mjs +19 -42
- package/dist/domain/Items.mjs.map +1 -1
- package/dist/domain/Media.d.mts +2 -0
- package/dist/domain/Media.mjs +14 -0
- package/dist/domain/Media.mjs.map +1 -0
- package/dist/domain/Music.d.mts +116 -0
- package/dist/domain/Music.d.mts.map +1 -0
- package/dist/domain/Music.mjs +29 -0
- package/dist/domain/Music.mjs.map +1 -0
- package/dist/domain/Transcript.d.mts +95 -0
- package/dist/domain/Transcript.d.mts.map +1 -0
- package/dist/domain/Transcript.mjs +22 -0
- package/dist/domain/Transcript.mjs.map +1 -0
- package/dist/domain/Turn.d.mts +1 -1
- package/dist/domain/Turn.mjs +1 -1
- package/dist/embedding-model/Embedding.d.mts +107 -0
- package/dist/embedding-model/Embedding.d.mts.map +1 -0
- package/dist/embedding-model/Embedding.mjs +18 -0
- package/dist/embedding-model/Embedding.mjs.map +1 -0
- package/dist/embedding-model/EmbeddingModel.d.mts +97 -0
- package/dist/embedding-model/EmbeddingModel.d.mts.map +1 -0
- package/dist/embedding-model/EmbeddingModel.mjs +17 -0
- package/dist/embedding-model/EmbeddingModel.mjs.map +1 -0
- package/dist/index.d.mts +21 -7
- package/dist/index.mjs +16 -2
- package/dist/language-model/LanguageModel.d.mts +12 -20
- package/dist/language-model/LanguageModel.d.mts.map +1 -1
- package/dist/language-model/LanguageModel.mjs +3 -20
- package/dist/language-model/LanguageModel.mjs.map +1 -1
- package/dist/loop/Loop.d.mts +31 -7
- package/dist/loop/Loop.d.mts.map +1 -1
- package/dist/loop/Loop.mjs +39 -6
- package/dist/loop/Loop.mjs.map +1 -1
- package/dist/loop/Loop.test.d.mts +1 -0
- package/dist/loop/Loop.test.mjs +411 -0
- package/dist/loop/Loop.test.mjs.map +1 -0
- package/dist/magic-string.es-BgIV5Mu3.mjs +1013 -0
- package/dist/magic-string.es-BgIV5Mu3.mjs.map +1 -0
- package/dist/math/Vector.d.mts +47 -0
- package/dist/math/Vector.d.mts.map +1 -0
- package/dist/math/Vector.mjs +117 -0
- package/dist/math/Vector.mjs.map +1 -0
- package/dist/music-generator/MusicGenerator.d.mts +77 -0
- package/dist/music-generator/MusicGenerator.d.mts.map +1 -0
- package/dist/music-generator/MusicGenerator.mjs +51 -0
- package/dist/music-generator/MusicGenerator.mjs.map +1 -0
- package/dist/music-generator/MusicGenerator.test.d.mts +1 -0
- package/dist/music-generator/MusicGenerator.test.mjs +154 -0
- package/dist/music-generator/MusicGenerator.test.mjs.map +1 -0
- package/dist/observability/Metrics.d.mts +2 -2
- package/dist/observability/Metrics.d.mts.map +1 -1
- package/dist/observability/Metrics.mjs +1 -1
- package/dist/observability/Metrics.mjs.map +1 -1
- package/dist/speech-synthesizer/SpeechSynthesizer.d.mts +96 -0
- package/dist/speech-synthesizer/SpeechSynthesizer.d.mts.map +1 -0
- package/dist/speech-synthesizer/SpeechSynthesizer.mjs +48 -0
- package/dist/speech-synthesizer/SpeechSynthesizer.mjs.map +1 -0
- package/dist/speech-synthesizer/SpeechSynthesizer.test.d.mts +1 -0
- package/dist/speech-synthesizer/SpeechSynthesizer.test.mjs +112 -0
- package/dist/speech-synthesizer/SpeechSynthesizer.test.mjs.map +1 -0
- package/dist/streaming/JSONL.d.mts +10 -3
- package/dist/streaming/JSONL.d.mts.map +1 -1
- package/dist/streaming/JSONL.mjs +13 -2
- package/dist/streaming/JSONL.mjs.map +1 -1
- package/dist/streaming/JSONL.test.d.mts +1 -0
- package/dist/streaming/JSONL.test.mjs +70 -0
- package/dist/streaming/JSONL.test.mjs.map +1 -0
- package/dist/streaming/Lines.mjs +1 -1
- package/dist/streaming/SSE.d.mts +2 -2
- package/dist/streaming/SSE.d.mts.map +1 -1
- package/dist/streaming/SSE.mjs +1 -1
- package/dist/streaming/SSE.mjs.map +1 -1
- package/dist/streaming/SSE.test.d.mts +1 -0
- package/dist/streaming/SSE.test.mjs +72 -0
- package/dist/streaming/SSE.test.mjs.map +1 -0
- package/dist/structured-format/StructuredFormat.d.mts +1 -1
- package/dist/structured-format/StructuredFormat.mjs +1 -1
- package/dist/structured-format/StructuredFormat.mjs.map +1 -1
- package/dist/testing/MockMusicGenerator.d.mts +39 -0
- package/dist/testing/MockMusicGenerator.d.mts.map +1 -0
- package/dist/testing/MockMusicGenerator.mjs +96 -0
- package/dist/testing/MockMusicGenerator.mjs.map +1 -0
- package/dist/testing/MockProvider.d.mts +6 -6
- package/dist/testing/MockProvider.d.mts.map +1 -1
- package/dist/testing/MockProvider.mjs.map +1 -1
- package/dist/testing/MockSpeechSynthesizer.d.mts +37 -0
- package/dist/testing/MockSpeechSynthesizer.d.mts.map +1 -0
- package/dist/testing/MockSpeechSynthesizer.mjs +95 -0
- package/dist/testing/MockSpeechSynthesizer.mjs.map +1 -0
- package/dist/testing/MockTranscriber.d.mts +37 -0
- package/dist/testing/MockTranscriber.d.mts.map +1 -0
- package/dist/testing/MockTranscriber.mjs +77 -0
- package/dist/testing/MockTranscriber.mjs.map +1 -0
- package/dist/tool/HistoryCheck.d.mts +6 -3
- package/dist/tool/HistoryCheck.d.mts.map +1 -1
- package/dist/tool/HistoryCheck.mjs +7 -1
- package/dist/tool/HistoryCheck.mjs.map +1 -1
- package/dist/tool/Outcome.d.mts +138 -2
- package/dist/tool/Outcome.d.mts.map +1 -0
- package/dist/tool/Outcome.mjs +32 -10
- package/dist/tool/Outcome.mjs.map +1 -1
- package/dist/tool/Resolvers.d.mts +11 -8
- package/dist/tool/Resolvers.d.mts.map +1 -1
- package/dist/tool/Resolvers.mjs +10 -1
- package/dist/tool/Resolvers.mjs.map +1 -1
- package/dist/tool/Resolvers.test.d.mts +1 -0
- package/dist/tool/Resolvers.test.mjs +317 -0
- package/dist/tool/Resolvers.test.mjs.map +1 -0
- package/dist/tool/Tool.d.mts +1 -1
- package/dist/tool/Tool.mjs +1 -1
- package/dist/tool/Tool.mjs.map +1 -1
- package/dist/tool/ToolEvent.d.mts +151 -2
- package/dist/tool/ToolEvent.d.mts.map +1 -0
- package/dist/tool/ToolEvent.mjs +30 -4
- package/dist/tool/ToolEvent.mjs.map +1 -1
- package/dist/tool/Toolkit.d.mts +19 -10
- package/dist/tool/Toolkit.d.mts.map +1 -1
- package/dist/tool/Toolkit.mjs +5 -5
- package/dist/tool/Toolkit.mjs.map +1 -1
- package/dist/tool/Toolkit.test.d.mts +1 -0
- package/dist/tool/Toolkit.test.mjs +113 -0
- package/dist/tool/Toolkit.test.mjs.map +1 -0
- package/dist/transcriber/Transcriber.d.mts +101 -0
- package/dist/transcriber/Transcriber.d.mts.map +1 -0
- package/dist/transcriber/Transcriber.mjs +49 -0
- package/dist/transcriber/Transcriber.mjs.map +1 -0
- package/dist/transcriber/Transcriber.test.d.mts +1 -0
- package/dist/transcriber/Transcriber.test.mjs +130 -0
- package/dist/transcriber/Transcriber.test.mjs.map +1 -0
- package/package.json +65 -13
- package/src/domain/AiError.ts +21 -0
- package/src/domain/Audio.ts +88 -0
- package/src/domain/Image.ts +75 -0
- package/src/domain/Items.ts +18 -47
- package/src/domain/Media.ts +61 -0
- package/src/domain/Music.ts +121 -0
- package/src/domain/Transcript.ts +83 -0
- package/src/embedding-model/Embedding.ts +117 -0
- package/src/embedding-model/EmbeddingModel.ts +107 -0
- package/src/index.ts +15 -1
- package/src/language-model/LanguageModel.ts +2 -22
- package/src/loop/Loop.test.ts +114 -2
- package/src/loop/Loop.ts +69 -5
- package/src/math/Vector.ts +138 -0
- package/src/music-generator/MusicGenerator.test.ts +170 -0
- package/src/music-generator/MusicGenerator.ts +123 -0
- package/src/observability/Metrics.ts +1 -1
- package/src/speech-synthesizer/SpeechSynthesizer.test.ts +141 -0
- package/src/speech-synthesizer/SpeechSynthesizer.ts +131 -0
- package/src/streaming/JSONL.ts +12 -0
- package/src/streaming/SSE.ts +1 -1
- package/src/structured-format/StructuredFormat.ts +2 -2
- package/src/testing/MockMusicGenerator.ts +170 -0
- package/src/testing/MockProvider.ts +2 -2
- package/src/testing/MockSpeechSynthesizer.ts +165 -0
- package/src/testing/MockTranscriber.ts +139 -0
- package/src/tool/HistoryCheck.ts +2 -5
- package/src/tool/Outcome.ts +36 -36
- package/src/tool/Resolvers.test.ts +11 -35
- package/src/tool/Resolvers.ts +5 -14
- package/src/tool/Tool.ts +9 -9
- package/src/tool/ToolEvent.ts +28 -24
- package/src/tool/Toolkit.test.ts +97 -2
- package/src/tool/Toolkit.ts +57 -33
- package/src/transcriber/Transcriber.test.ts +125 -0
- package/src/transcriber/Transcriber.ts +127 -0
- package/dist/Items-D1C2686t.d.mts.map +0 -1
- package/dist/Outcome-GiaNvt7i.d.mts +0 -32
- package/dist/Outcome-GiaNvt7i.d.mts.map +0 -1
- package/dist/StructuredFormat-B5ueioNr.d.mts.map +0 -1
- package/dist/Tool-5wxOCuOh.d.mts.map +0 -1
- package/dist/ToolEvent-wTMgb2GO.d.mts +0 -29
- package/dist/ToolEvent-wTMgb2GO.d.mts.map +0 -1
- package/dist/Turn-Bi83du4I.d.mts.map +0 -1
- package/dist/match/Match.d.mts +0 -16
- package/dist/match/Match.d.mts.map +0 -1
- package/dist/match/Match.mjs +0 -15
- package/dist/match/Match.mjs.map +0 -1
- package/src/match/Match.ts +0 -9
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as Cancelled, c as GenerationFailed, d as RateLimited, f as Scope, i as AuthSubtype, l as IncompleteTurn, m as Unavailable, o as ContentFiltered, p as Timeout, r as AuthFailed, s as ContextLengthExceeded, t as AiError, u as InvalidRequest } from "../AiError-
|
|
2
|
-
export { AiError, AuthFailed, AuthSubtype, Cancelled, ContentFiltered, ContextLengthExceeded, GenerationFailed, IncompleteTurn, InvalidRequest, RateLimited, Scope, Timeout, Unavailable };
|
|
1
|
+
import { a as Cancelled, c as GenerationFailed, d as RateLimited, f as Scope, h as Unsupported, i as AuthSubtype, l as IncompleteTurn, m as Unavailable, o as ContentFiltered, p as Timeout, r as AuthFailed, s as ContextLengthExceeded, t as AiError, u as InvalidRequest } from "../AiError-csR8Bhxx.mjs";
|
|
2
|
+
export { AiError, AuthFailed, AuthSubtype, Cancelled, ContentFiltered, ContextLengthExceeded, GenerationFailed, IncompleteTurn, InvalidRequest, RateLimited, Scope, Timeout, Unavailable, Unsupported };
|
package/dist/domain/AiError.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as __exportAll } from "../chunk-uyGKjUfl.mjs";
|
|
2
2
|
import { Data } from "effect";
|
|
3
3
|
//#region src/domain/AiError.ts
|
|
4
4
|
var AiError_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -11,7 +11,8 @@ var AiError_exports = /* @__PURE__ */ __exportAll({
|
|
|
11
11
|
InvalidRequest: () => InvalidRequest,
|
|
12
12
|
RateLimited: () => RateLimited,
|
|
13
13
|
Timeout: () => Timeout,
|
|
14
|
-
Unavailable: () => Unavailable
|
|
14
|
+
Unavailable: () => Unavailable,
|
|
15
|
+
Unsupported: () => Unsupported
|
|
15
16
|
});
|
|
16
17
|
var RateLimited = class extends Data.TaggedError("RateLimited") {};
|
|
17
18
|
var Unavailable = class extends Data.TaggedError("Unavailable") {};
|
|
@@ -34,7 +35,22 @@ var GenerationFailed = class extends Data.TaggedError("GenerationFailed") {};
|
|
|
34
35
|
* Non-terminal deltas seen so far have already been emitted downstream.
|
|
35
36
|
*/
|
|
36
37
|
var IncompleteTurn = class extends Data.TaggedError("IncompleteTurn") {};
|
|
38
|
+
/**
|
|
39
|
+
* The provider does not implement the requested capability for this
|
|
40
|
+
* specific request. Distinct from `InvalidRequest` (the request shape is
|
|
41
|
+
* malformed) and `AuthFailed` (the request was rejected).
|
|
42
|
+
*
|
|
43
|
+
* Reserved for request-data-dependent gaps where the provider supports
|
|
44
|
+
* the method in general but not for these inputs — e.g. Google's
|
|
45
|
+
* `streamSynthesisFrom` works only for Chirp 3 HD voices; calling it
|
|
46
|
+
* with a Neural2 voice ID fails `Unsupported`.
|
|
47
|
+
*
|
|
48
|
+
* Blanket provider-level gaps (e.g. OpenAI has no incremental-text-in
|
|
49
|
+
* TTS at all) are gated at compile time via capability marker tags
|
|
50
|
+
* (`TtsIncrementalText`, `SttStreaming`) on the R channel instead.
|
|
51
|
+
*/
|
|
52
|
+
var Unsupported = class extends Data.TaggedError("Unsupported") {};
|
|
37
53
|
//#endregion
|
|
38
|
-
export { AuthFailed, Cancelled, ContentFiltered, ContextLengthExceeded, GenerationFailed, IncompleteTurn, InvalidRequest, RateLimited, Timeout, Unavailable, AiError_exports as t };
|
|
54
|
+
export { AuthFailed, Cancelled, ContentFiltered, ContextLengthExceeded, GenerationFailed, IncompleteTurn, InvalidRequest, RateLimited, Timeout, Unavailable, Unsupported, AiError_exports as t };
|
|
39
55
|
|
|
40
56
|
//# sourceMappingURL=AiError.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiError.mjs","names":[],"sources":["../../src/domain/AiError.ts"],"sourcesContent":["import { Data, Duration } from \"effect\"\n\nexport type Scope = \"rpm\" | \"tpm\" | \"rpd\" | \"tpd\"\n\nexport class RateLimited extends Data.TaggedError(\"RateLimited\")<{\n provider: string\n retryAfter?: Duration.Duration\n scope?: Scope\n requestId?: string\n raw: unknown\n}> {}\n\nexport class Unavailable extends Data.TaggedError(\"Unavailable\")<{\n provider: string\n retryAfter?: Duration.Duration\n status?: number\n requestId?: string\n raw: unknown\n}> {}\n\nexport class Timeout extends Data.TaggedError(\"Timeout\")<{\n provider: string\n requestId?: string\n raw: unknown\n}> {}\n\nexport class ContentFiltered extends Data.TaggedError(\"ContentFiltered\")<{\n provider: string\n reason?: string\n requestId?: string\n raw: unknown\n}> {}\n\nexport class ContextLengthExceeded extends Data.TaggedError(\"ContextLengthExceeded\")<{\n provider: string\n modelLimit?: number\n requested?: number\n raw: unknown\n}> {}\n\nexport class InvalidRequest extends Data.TaggedError(\"InvalidRequest\")<{\n provider: string\n param?: string\n requestId?: string\n raw: unknown\n}> {}\n\nexport type AuthSubtype = \"auth\" | \"permission\" | \"billing\" | \"quota\"\n\nexport class AuthFailed extends Data.TaggedError(\"AuthFailed\")<{\n provider: string\n subtype: AuthSubtype\n raw: unknown\n}> {}\n\nexport class Cancelled extends Data.TaggedError(\"Cancelled\")<{\n provider: string\n}> {}\n\n/**\n * The model errored mid-generation. Distinct from `Unavailable` (transport\n * problem before generation started) and from `IncompleteTurn` (provider\n * stream ended without a terminal event). The provider's own error message,\n * if any, is on `message`.\n */\nexport class GenerationFailed extends Data.TaggedError(\"GenerationFailed\")<{\n provider: string\n code?: string\n message?: string\n requestId?: string\n raw: unknown\n}> {}\n\n/**\n * The provider's delta stream ended without a terminal `turn_complete`.\n * Indicates a misbehaving provider or a connection that dropped mid-flight.\n * Non-terminal deltas seen so far have already been emitted downstream.\n */\nexport class IncompleteTurn extends Data.TaggedError(\"IncompleteTurn\")<{\n raw?: unknown\n}> {}\n\nexport type AiError =\n | RateLimited\n | Unavailable\n | Timeout\n | ContentFiltered\n | ContextLengthExceeded\n | InvalidRequest\n | AuthFailed\n | Cancelled\n | IncompleteTurn\n | GenerationFailed\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"AiError.mjs","names":[],"sources":["../../src/domain/AiError.ts"],"sourcesContent":["import { Data, Duration } from \"effect\"\n\nexport type Scope = \"rpm\" | \"tpm\" | \"rpd\" | \"tpd\"\n\nexport class RateLimited extends Data.TaggedError(\"RateLimited\")<{\n provider: string\n retryAfter?: Duration.Duration\n scope?: Scope\n requestId?: string\n raw: unknown\n}> {}\n\nexport class Unavailable extends Data.TaggedError(\"Unavailable\")<{\n provider: string\n retryAfter?: Duration.Duration\n status?: number\n requestId?: string\n raw: unknown\n}> {}\n\nexport class Timeout extends Data.TaggedError(\"Timeout\")<{\n provider: string\n requestId?: string\n raw: unknown\n}> {}\n\nexport class ContentFiltered extends Data.TaggedError(\"ContentFiltered\")<{\n provider: string\n reason?: string\n requestId?: string\n raw: unknown\n}> {}\n\nexport class ContextLengthExceeded extends Data.TaggedError(\"ContextLengthExceeded\")<{\n provider: string\n modelLimit?: number\n requested?: number\n raw: unknown\n}> {}\n\nexport class InvalidRequest extends Data.TaggedError(\"InvalidRequest\")<{\n provider: string\n param?: string\n requestId?: string\n raw: unknown\n}> {}\n\nexport type AuthSubtype = \"auth\" | \"permission\" | \"billing\" | \"quota\"\n\nexport class AuthFailed extends Data.TaggedError(\"AuthFailed\")<{\n provider: string\n subtype: AuthSubtype\n raw: unknown\n}> {}\n\nexport class Cancelled extends Data.TaggedError(\"Cancelled\")<{\n provider: string\n}> {}\n\n/**\n * The model errored mid-generation. Distinct from `Unavailable` (transport\n * problem before generation started) and from `IncompleteTurn` (provider\n * stream ended without a terminal event). The provider's own error message,\n * if any, is on `message`.\n */\nexport class GenerationFailed extends Data.TaggedError(\"GenerationFailed\")<{\n provider: string\n code?: string\n message?: string\n requestId?: string\n raw: unknown\n}> {}\n\n/**\n * The provider's delta stream ended without a terminal `turn_complete`.\n * Indicates a misbehaving provider or a connection that dropped mid-flight.\n * Non-terminal deltas seen so far have already been emitted downstream.\n */\nexport class IncompleteTurn extends Data.TaggedError(\"IncompleteTurn\")<{\n raw?: unknown\n}> {}\n\n/**\n * The provider does not implement the requested capability for this\n * specific request. Distinct from `InvalidRequest` (the request shape is\n * malformed) and `AuthFailed` (the request was rejected).\n *\n * Reserved for request-data-dependent gaps where the provider supports\n * the method in general but not for these inputs — e.g. Google's\n * `streamSynthesisFrom` works only for Chirp 3 HD voices; calling it\n * with a Neural2 voice ID fails `Unsupported`.\n *\n * Blanket provider-level gaps (e.g. OpenAI has no incremental-text-in\n * TTS at all) are gated at compile time via capability marker tags\n * (`TtsIncrementalText`, `SttStreaming`) on the R channel instead.\n */\nexport class Unsupported extends Data.TaggedError(\"Unsupported\")<{\n provider: string\n capability: string\n reason?: string\n}> {}\n\nexport type AiError =\n | RateLimited\n | Unavailable\n | Timeout\n | ContentFiltered\n | ContextLengthExceeded\n | InvalidRequest\n | AuthFailed\n | Cancelled\n | IncompleteTurn\n | GenerationFailed\n | Unsupported\n"],"mappings":";;;;;;;;;;;;;;;;AAIA,IAAa,cAAb,cAAiC,KAAK,YAAY,cAAc,CAM7D;AAEH,IAAa,cAAb,cAAiC,KAAK,YAAY,cAAc,CAM7D;AAEH,IAAa,UAAb,cAA6B,KAAK,YAAY,UAAU,CAIrD;AAEH,IAAa,kBAAb,cAAqC,KAAK,YAAY,kBAAkB,CAKrE;AAEH,IAAa,wBAAb,cAA2C,KAAK,YAAY,wBAAwB,CAKjF;AAEH,IAAa,iBAAb,cAAoC,KAAK,YAAY,iBAAiB,CAKnE;AAIH,IAAa,aAAb,cAAgC,KAAK,YAAY,aAAa,CAI3D;AAEH,IAAa,YAAb,cAA+B,KAAK,YAAY,YAAY,CAEzD;;;;;;;AAQH,IAAa,mBAAb,cAAsC,KAAK,YAAY,mBAAmB,CAMvE;;;;;;AAOH,IAAa,iBAAb,cAAoC,KAAK,YAAY,iBAAiB,CAEnE;;;;;;;;;;;;;;;AAgBH,IAAa,cAAb,cAAiC,KAAK,YAAY,cAAc,CAI7D"}
|
|
@@ -0,0 +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-BfCTGnH3.mjs";
|
|
2
|
+
export { AudioBlob, AudioChunk, AudioFormat, AudioMimeType, AudioSource, isAudioBase64, isAudioBytes, isAudioUrl };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { n as __exportAll } from "../chunk-uyGKjUfl.mjs";
|
|
2
|
+
//#region src/domain/Audio.ts
|
|
3
|
+
var Audio_exports = /* @__PURE__ */ __exportAll({
|
|
4
|
+
isAudioBase64: () => isAudioBase64,
|
|
5
|
+
isAudioBytes: () => isAudioBytes,
|
|
6
|
+
isAudioUrl: () => isAudioUrl
|
|
7
|
+
});
|
|
8
|
+
const isAudioUrl = (s) => s._tag === "url";
|
|
9
|
+
const isAudioBase64 = (s) => s._tag === "base64";
|
|
10
|
+
const isAudioBytes = (s) => s._tag === "bytes";
|
|
11
|
+
//#endregion
|
|
12
|
+
export { isAudioBase64, isAudioBytes, isAudioUrl, Audio_exports as t };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=Audio.mjs.map
|
|
@@ -0,0 +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 durationSeconds?: number\n}\n"],"mappings":";;;;;;;AAyCA,MAAa,cAAc,MAAiD,EAAE,SAAS;AACvF,MAAa,iBAAiB,MAC5B,EAAE,SAAS;AACb,MAAa,gBAAgB,MAAmD,EAAE,SAAS"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as ImageUrlSource, c as imageBytes, d as isImageBytes, f as isImageUrl, i as ImageSource, l as imageUrl, n as ImageBytesSource, r as ImageMimeType, s as imageBase64, t as ImageBase64Source, u as isImageBase64 } from "../Image-DxyXqzAM.mjs";
|
|
2
|
+
export { ImageBase64Source, ImageBytesSource, ImageMimeType, ImageSource, ImageUrlSource, imageBase64, imageBytes, imageUrl, isImageBase64, isImageBytes, isImageUrl };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { n as __exportAll } from "../chunk-uyGKjUfl.mjs";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
//#region src/domain/Image.ts
|
|
4
|
+
var Image_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
ImageBase64Source: () => ImageBase64Source,
|
|
6
|
+
ImageBytesSource: () => ImageBytesSource,
|
|
7
|
+
ImageSource: () => ImageSource,
|
|
8
|
+
ImageUrlSource: () => ImageUrlSource,
|
|
9
|
+
imageBase64: () => imageBase64,
|
|
10
|
+
imageBytes: () => imageBytes,
|
|
11
|
+
imageUrl: () => imageUrl,
|
|
12
|
+
isImageBase64: () => isImageBase64,
|
|
13
|
+
isImageBytes: () => isImageBytes,
|
|
14
|
+
isImageUrl: () => isImageUrl
|
|
15
|
+
});
|
|
16
|
+
const ImageMimeTypeSchema = Schema.String;
|
|
17
|
+
const ImageUrlSource = Schema.TaggedStruct("url", {
|
|
18
|
+
url: Schema.String,
|
|
19
|
+
mimeType: Schema.optional(ImageMimeTypeSchema)
|
|
20
|
+
});
|
|
21
|
+
const ImageBase64Source = Schema.TaggedStruct("base64", {
|
|
22
|
+
base64: Schema.String,
|
|
23
|
+
mimeType: ImageMimeTypeSchema
|
|
24
|
+
});
|
|
25
|
+
const ImageBytesSource = Schema.TaggedStruct("bytes", {
|
|
26
|
+
bytes: Schema.Uint8Array,
|
|
27
|
+
mimeType: ImageMimeTypeSchema
|
|
28
|
+
});
|
|
29
|
+
const ImageSource = Schema.Union([
|
|
30
|
+
ImageUrlSource,
|
|
31
|
+
ImageBase64Source,
|
|
32
|
+
ImageBytesSource
|
|
33
|
+
]);
|
|
34
|
+
const imageUrl = (url, mimeType) => mimeType !== void 0 ? {
|
|
35
|
+
_tag: "url",
|
|
36
|
+
url,
|
|
37
|
+
mimeType
|
|
38
|
+
} : {
|
|
39
|
+
_tag: "url",
|
|
40
|
+
url
|
|
41
|
+
};
|
|
42
|
+
const imageBase64 = (base64, mimeType) => ({
|
|
43
|
+
_tag: "base64",
|
|
44
|
+
base64,
|
|
45
|
+
mimeType
|
|
46
|
+
});
|
|
47
|
+
const imageBytes = (bytes, mimeType) => ({
|
|
48
|
+
_tag: "bytes",
|
|
49
|
+
bytes,
|
|
50
|
+
mimeType
|
|
51
|
+
});
|
|
52
|
+
const isImageUrl = Schema.is(ImageUrlSource);
|
|
53
|
+
const isImageBase64 = Schema.is(ImageBase64Source);
|
|
54
|
+
const isImageBytes = Schema.is(ImageBytesSource);
|
|
55
|
+
//#endregion
|
|
56
|
+
export { ImageBase64Source, ImageBytesSource, ImageSource, ImageUrlSource, imageBase64, imageBytes, imageUrl, isImageBase64, isImageBytes, isImageUrl, Image_exports as t };
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=Image.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Image.mjs","names":[],"sources":["../../src/domain/Image.ts"],"sourcesContent":["import { Schema } from \"effect\"\nimport type { MediaBase64, MediaBytes, MediaSource, MediaUrl } from \"./Media.js\"\n\n/**\n * Image MIME types AI providers typically accept. The first four are the\n * universal subset (Cohere v4, Voyage multimodal, Jina v4, Google\n * `gemini-embedding-2`); HEIC / HEIF are Google-specific. The\n * `(string & {})` tail keeps autocomplete on the literals while still\n * accepting any string, so a newly-supported format works without an\n * SDK update.\n */\nexport type ImageMimeType =\n | \"image/png\"\n | \"image/jpeg\"\n | \"image/webp\"\n | \"image/gif\"\n | \"image/heic\"\n | \"image/heif\"\n // eslint-disable-next-line @typescript-eslint/ban-types\n | (string & {})\n\nconst ImageMimeTypeSchema = Schema.String as unknown as Schema.Schema<ImageMimeType>\n\nexport type ImageUrlSource = MediaUrl<ImageMimeType>\nexport type ImageBase64Source = MediaBase64<ImageMimeType>\nexport type ImageBytesSource = MediaBytes<ImageMimeType>\n\n/**\n * Where an image lives. Provider layers normalize across these:\n * `bytes` becomes a base64 data URI for OpenAI / Anthropic, an\n * `inlineData` part for Gemini, and a separate field for Cohere /\n * Voyage. URL constraints (must be HTTPS, must be public, …) are\n * provider-specific and validated at the layer, not in the type.\n */\nexport type ImageSource = MediaSource<ImageMimeType>\n\nexport const ImageUrlSource = Schema.TaggedStruct(\"url\", {\n url: Schema.String,\n mimeType: Schema.optional(ImageMimeTypeSchema),\n})\n\nexport const ImageBase64Source = Schema.TaggedStruct(\"base64\", {\n base64: Schema.String,\n mimeType: ImageMimeTypeSchema,\n})\n\nexport const ImageBytesSource = Schema.TaggedStruct(\"bytes\", {\n bytes: Schema.Uint8Array,\n mimeType: ImageMimeTypeSchema,\n})\n\nexport const ImageSource: Schema.Schema<ImageSource> = Schema.Union([\n ImageUrlSource,\n ImageBase64Source,\n ImageBytesSource,\n]) as unknown as Schema.Schema<ImageSource>\n\nexport const imageUrl = (url: string, mimeType?: ImageMimeType): ImageUrlSource =>\n mimeType !== undefined ? { _tag: \"url\", url, mimeType } : { _tag: \"url\", url }\n\nexport const imageBase64 = (base64: string, mimeType: ImageMimeType): ImageBase64Source => ({\n _tag: \"base64\",\n base64,\n mimeType,\n})\n\nexport const imageBytes = (bytes: Uint8Array, mimeType: ImageMimeType): ImageBytesSource => ({\n _tag: \"bytes\",\n bytes,\n mimeType,\n})\n\nexport const isImageUrl = Schema.is(ImageUrlSource)\nexport const isImageBase64 = Schema.is(ImageBase64Source)\nexport const isImageBytes = Schema.is(ImageBytesSource)\n"],"mappings":";;;;;;;;;;;;;;;AAqBA,MAAM,sBAAsB,OAAO;AAenC,MAAa,iBAAiB,OAAO,aAAa,OAAO;CACvD,KAAK,OAAO;CACZ,UAAU,OAAO,SAAS,oBAAoB;CAC/C,CAAC;AAEF,MAAa,oBAAoB,OAAO,aAAa,UAAU;CAC7D,QAAQ,OAAO;CACf,UAAU;CACX,CAAC;AAEF,MAAa,mBAAmB,OAAO,aAAa,SAAS;CAC3D,OAAO,OAAO;CACd,UAAU;CACX,CAAC;AAEF,MAAa,cAA0C,OAAO,MAAM;CAClE;CACA;CACA;CACD,CAAC;AAEF,MAAa,YAAY,KAAa,aACpC,aAAa,KAAA,IAAY;CAAE,MAAM;CAAO;CAAK;CAAU,GAAG;CAAE,MAAM;CAAO;CAAK;AAEhF,MAAa,eAAe,QAAgB,cAAgD;CAC1F,MAAM;CACN;CACA;CACD;AAED,MAAa,cAAc,OAAmB,cAA+C;CAC3F,MAAM;CACN;CACA;CACD;AAED,MAAa,aAAa,OAAO,GAAG,eAAe;AACnD,MAAa,gBAAgB,OAAO,GAAG,kBAAkB;AACzD,MAAa,eAAe,OAAO,GAAG,iBAAiB"}
|
package/dist/domain/Items.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { Annotation, ContainerFileCitation, ContentBlock, FileCitation, FilePath, FunctionCall, FunctionCallOutput,
|
|
1
|
+
import { A as isInputText, C as functionCallOutput, D as isFunctionCall, E as isFilePath, F as isUrlCitation, I as systemText, L as userText, M as isOutputText, N as isReasoning, O as isFunctionCallOutput, P as isRefusal, S as assistantText, T as isFileCitation, _ as Refusal, a as FilePath, b as UrlCitation, c as InputImage, d as Item, g as Reasoning, h as OutputTokensDetails, i as FileCitation, j as isMessage, k as isInputImage, l as InputText, m as OutputText, n as ContainerFileCitation, o as FunctionCall, p as Message, r as ContentBlock, s as FunctionCallOutput, t as Annotation, u as InputTokensDetails, v as Role, w as isContainerFileCitation, x as Usage, y as StopReason } from "../Items-Hg5AsYxl.mjs";
|
|
2
|
+
export { Annotation, ContainerFileCitation, ContentBlock, FileCitation, FilePath, FunctionCall, FunctionCallOutput, InputImage, InputText, InputTokensDetails, Item, Message, OutputText, OutputTokensDetails, Reasoning, Refusal, Role, StopReason, UrlCitation, Usage, assistantText, functionCallOutput, isContainerFileCitation, isFileCitation, isFilePath, isFunctionCall, isFunctionCallOutput, isInputImage, isInputText, isMessage, isOutputText, isReasoning, isRefusal, isUrlCitation, systemText, userText };
|
package/dist/domain/Items.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as __exportAll } from "../chunk-uyGKjUfl.mjs";
|
|
2
|
+
import { ImageSource } from "./Image.mjs";
|
|
2
3
|
import { Schema } from "effect";
|
|
3
4
|
//#region src/domain/Items.ts
|
|
4
5
|
var Items_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -9,9 +10,6 @@ var Items_exports = /* @__PURE__ */ __exportAll({
|
|
|
9
10
|
FilePath: () => FilePath,
|
|
10
11
|
FunctionCall: () => FunctionCall,
|
|
11
12
|
FunctionCallOutput: () => FunctionCallOutput,
|
|
12
|
-
ImageBase64Source: () => ImageBase64Source,
|
|
13
|
-
ImageSource: () => ImageSource,
|
|
14
|
-
ImageUrlSource: () => ImageUrlSource,
|
|
15
13
|
InputImage: () => InputImage,
|
|
16
14
|
InputText: () => InputText,
|
|
17
15
|
InputTokensDetails: () => InputTokensDetails,
|
|
@@ -32,8 +30,6 @@ var Items_exports = /* @__PURE__ */ __exportAll({
|
|
|
32
30
|
isFilePath: () => isFilePath,
|
|
33
31
|
isFunctionCall: () => isFunctionCall,
|
|
34
32
|
isFunctionCallOutput: () => isFunctionCallOutput,
|
|
35
|
-
isImageBase64Source: () => isImageBase64Source,
|
|
36
|
-
isImageUrlSource: () => isImageUrlSource,
|
|
37
33
|
isInputImage: () => isInputImage,
|
|
38
34
|
isInputText: () => isInputText,
|
|
39
35
|
isMessage: () => isMessage,
|
|
@@ -49,31 +45,12 @@ const InputText = Schema.Struct({
|
|
|
49
45
|
text: Schema.String
|
|
50
46
|
});
|
|
51
47
|
/**
|
|
52
|
-
* Where an image lives. `url` covers HTTP(S) URLs (the model fetches
|
|
53
|
-
* them); `base64` covers inline bytes embedded in the request. Provider
|
|
54
|
-
* encoders dispatch on `_tag`. File-id / uploaded-asset references are
|
|
55
|
-
* provider-specific and stay out of this union for now.
|
|
56
|
-
*/
|
|
57
|
-
const ImageUrlSource = Schema.Struct({
|
|
58
|
-
_tag: Schema.Literal("url"),
|
|
59
|
-
url: Schema.String
|
|
60
|
-
});
|
|
61
|
-
/**
|
|
62
|
-
* Inline image bytes. `data` is **already base64-encoded** (matches what
|
|
63
|
-
* the wire formats expect; no double-encoding needed downstream).
|
|
64
|
-
* `media_type` is the MIME type, e.g. `"image/png"`.
|
|
65
|
-
*/
|
|
66
|
-
const ImageBase64Source = Schema.Struct({
|
|
67
|
-
_tag: Schema.Literal("base64"),
|
|
68
|
-
media_type: Schema.String,
|
|
69
|
-
data: Schema.String
|
|
70
|
-
});
|
|
71
|
-
const ImageSource = Schema.Union([ImageUrlSource, ImageBase64Source]);
|
|
72
|
-
const isImageUrlSource = (s) => s._tag === "url";
|
|
73
|
-
const isImageBase64Source = (s) => s._tag === "base64";
|
|
74
|
-
/**
|
|
75
48
|
* User-provided image content block. Pair with `InputText` inside a
|
|
76
49
|
* `Message.content` array to ask "what's in this image?" style questions.
|
|
50
|
+
*
|
|
51
|
+
* `source` is the cross-modality `ImageSource` from `domain/Image.ts` -
|
|
52
|
+
* url, base64, or raw bytes. Provider codecs encode bytes to whatever
|
|
53
|
+
* wire format the provider wants.
|
|
77
54
|
*/
|
|
78
55
|
const InputImage = Schema.Struct({
|
|
79
56
|
type: Schema.Literal("input_image"),
|
|
@@ -109,10 +86,10 @@ const Annotation = Schema.Union([
|
|
|
109
86
|
ContainerFileCitation,
|
|
110
87
|
FilePath
|
|
111
88
|
]);
|
|
112
|
-
const isUrlCitation = (
|
|
113
|
-
const isFileCitation = (
|
|
114
|
-
const isContainerFileCitation = (
|
|
115
|
-
const isFilePath = (
|
|
89
|
+
const isUrlCitation = Schema.is(UrlCitation);
|
|
90
|
+
const isFileCitation = Schema.is(FileCitation);
|
|
91
|
+
const isContainerFileCitation = Schema.is(ContainerFileCitation);
|
|
92
|
+
const isFilePath = Schema.is(FilePath);
|
|
116
93
|
const OutputText = Schema.Struct({
|
|
117
94
|
type: Schema.Literal("output_text"),
|
|
118
95
|
text: Schema.String,
|
|
@@ -178,14 +155,14 @@ const Item = Schema.Union([
|
|
|
178
155
|
FunctionCallOutput,
|
|
179
156
|
Reasoning
|
|
180
157
|
]);
|
|
181
|
-
const isInputText = (
|
|
182
|
-
const isInputImage = (
|
|
183
|
-
const isOutputText = (
|
|
184
|
-
const isRefusal = (
|
|
185
|
-
const isMessage = (
|
|
186
|
-
const isFunctionCall = (
|
|
187
|
-
const isFunctionCallOutput = (
|
|
188
|
-
const isReasoning = (
|
|
158
|
+
const isInputText = Schema.is(InputText);
|
|
159
|
+
const isInputImage = Schema.is(InputImage);
|
|
160
|
+
const isOutputText = Schema.is(OutputText);
|
|
161
|
+
const isRefusal = Schema.is(Refusal);
|
|
162
|
+
const isMessage = Schema.is(Message);
|
|
163
|
+
const isFunctionCall = Schema.is(FunctionCall);
|
|
164
|
+
const isFunctionCallOutput = Schema.is(FunctionCallOutput);
|
|
165
|
+
const isReasoning = Schema.is(Reasoning);
|
|
189
166
|
const InputTokensDetails = Schema.Struct({ cached_tokens: Schema.optional(Schema.Number) });
|
|
190
167
|
const OutputTokensDetails = Schema.Struct({ reasoning_tokens: Schema.optional(Schema.Number) });
|
|
191
168
|
const Usage = Schema.Struct({
|
|
@@ -233,6 +210,6 @@ const functionCallOutput = (call_id, output) => ({
|
|
|
233
210
|
output
|
|
234
211
|
});
|
|
235
212
|
//#endregion
|
|
236
|
-
export { Annotation, ContainerFileCitation, ContentBlock, FileCitation, FilePath, FunctionCall, FunctionCallOutput,
|
|
213
|
+
export { Annotation, ContainerFileCitation, ContentBlock, FileCitation, FilePath, FunctionCall, FunctionCallOutput, InputImage, InputText, InputTokensDetails, Item, Message, OutputText, OutputTokensDetails, Reasoning, Refusal, Role, StopReason, UrlCitation, Usage, assistantText, functionCallOutput, isContainerFileCitation, isFileCitation, isFilePath, isFunctionCall, isFunctionCallOutput, isInputImage, isInputText, isMessage, isOutputText, isReasoning, isRefusal, isUrlCitation, systemText, Items_exports as t, userText };
|
|
237
214
|
|
|
238
215
|
//# sourceMappingURL=Items.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Items.mjs","names":[],"sources":["../../src/domain/Items.ts"],"sourcesContent":["import { Schema } from \"effect\"\n\n// ---------------------------------------------------------------------------\n// Content blocks (inside Message.content)\n// ---------------------------------------------------------------------------\n\nexport const InputText = Schema.Struct({\n type: Schema.Literal(\"input_text\"),\n text: Schema.String,\n})\nexport type InputText = typeof InputText.Type\n\n/**\n * Where an image lives. `url` covers HTTP(S) URLs (the model fetches\n * them); `base64` covers inline bytes embedded in the request. Provider\n * encoders dispatch on `_tag`. File-id / uploaded-asset references are\n * provider-specific and stay out of this union for now.\n */\nexport const ImageUrlSource = Schema.Struct({\n _tag: Schema.Literal(\"url\"),\n url: Schema.String,\n})\nexport type ImageUrlSource = typeof ImageUrlSource.Type\n\n/**\n * Inline image bytes. `data` is **already base64-encoded** (matches what\n * the wire formats expect; no double-encoding needed downstream).\n * `media_type` is the MIME type, e.g. `\"image/png\"`.\n */\nexport const ImageBase64Source = Schema.Struct({\n _tag: Schema.Literal(\"base64\"),\n media_type: Schema.String,\n data: Schema.String,\n})\nexport type ImageBase64Source = typeof ImageBase64Source.Type\n\nexport const ImageSource = Schema.Union([ImageUrlSource, ImageBase64Source])\nexport type ImageSource = typeof ImageSource.Type\n\nexport const isImageUrlSource = (s: ImageSource): s is ImageUrlSource => s._tag === \"url\"\nexport const isImageBase64Source = (s: ImageSource): s is ImageBase64Source => s._tag === \"base64\"\n\n/**\n * User-provided image content block. Pair with `InputText` inside a\n * `Message.content` array to ask \"what's in this image?\" style questions.\n */\nexport const InputImage = Schema.Struct({\n type: Schema.Literal(\"input_image\"),\n source: ImageSource,\n})\nexport type InputImage = typeof InputImage.Type\n\n// ---------------------------------------------------------------------------\n// Annotations - source / citation pointers attached to `output_text` blocks.\n// Mirrors OpenAI Responses API; other providers can omit or map onto these\n// shapes.\n// ---------------------------------------------------------------------------\n\nexport const UrlCitation = Schema.Struct({\n type: Schema.Literal(\"url_citation\"),\n url: Schema.String,\n start_index: Schema.Number,\n end_index: Schema.Number,\n title: Schema.String,\n})\nexport type UrlCitation = typeof UrlCitation.Type\n\nexport const FileCitation = Schema.Struct({\n type: Schema.Literal(\"file_citation\"),\n file_id: Schema.String,\n index: Schema.Number,\n})\nexport type FileCitation = typeof FileCitation.Type\n\nexport const ContainerFileCitation = Schema.Struct({\n type: Schema.Literal(\"container_file_citation\"),\n container_id: Schema.String,\n file_id: Schema.String,\n start_index: Schema.Number,\n end_index: Schema.Number,\n})\nexport type ContainerFileCitation = typeof ContainerFileCitation.Type\n\nexport const FilePath = Schema.Struct({\n type: Schema.Literal(\"file_path\"),\n file_id: Schema.String,\n index: Schema.Number,\n})\nexport type FilePath = typeof FilePath.Type\n\nexport const Annotation = Schema.Union([UrlCitation, FileCitation, ContainerFileCitation, FilePath])\nexport type Annotation = typeof Annotation.Type\n\nexport const isUrlCitation = (a: Annotation): a is UrlCitation => a.type === \"url_citation\"\nexport const isFileCitation = (a: Annotation): a is FileCitation => a.type === \"file_citation\"\nexport const isContainerFileCitation = (a: Annotation): a is ContainerFileCitation =>\n a.type === \"container_file_citation\"\nexport const isFilePath = (a: Annotation): a is FilePath => a.type === \"file_path\"\n\nexport const OutputText = Schema.Struct({\n type: Schema.Literal(\"output_text\"),\n text: Schema.String,\n annotations: Schema.optional(Schema.Array(Annotation)),\n})\nexport type OutputText = typeof OutputText.Type\n\n/**\n * Model-emitted refusal. Distinct from `output_text`: the model declined\n * to answer rather than producing normal output. Pair with\n * `stop_reason: \"refusal\"` on the surrounding `Turn`. Streamed via the\n * `refusal_delta` `TurnEvent`.\n */\nexport const Refusal = Schema.Struct({\n type: Schema.Literal(\"refusal\"),\n text: Schema.String,\n})\nexport type Refusal = typeof Refusal.Type\n\nexport const ContentBlock = Schema.Union([InputText, InputImage, OutputText, Refusal])\nexport type ContentBlock = typeof ContentBlock.Type\n\nexport const Role = Schema.Literals([\"user\", \"assistant\", \"system\"])\nexport type Role = typeof Role.Type\n\n// ---------------------------------------------------------------------------\n// Provider passthrough - every Item type carries this opaque slot.\n// The framework never reads or interprets it; provider modules decode\n// their own data via their own typed readers (see e.g.\n// the `@effect-uai/responses` package).\n// ---------------------------------------------------------------------------\n\nconst ProviderData = Schema.optional(Schema.Unknown)\n\n// ---------------------------------------------------------------------------\n// Items\n// ---------------------------------------------------------------------------\n\nexport const Message = Schema.Struct({\n type: Schema.Literal(\"message\"),\n role: Role,\n content: Schema.Array(ContentBlock),\n providerData: ProviderData,\n})\nexport type Message = typeof Message.Type\n\nexport const FunctionCall = Schema.Struct({\n type: Schema.Literal(\"function_call\"),\n call_id: Schema.String,\n name: Schema.String,\n // JSON-encoded arguments string, mirroring OpenAI Responses API\n arguments: Schema.String,\n providerData: ProviderData,\n})\nexport type FunctionCall = typeof FunctionCall.Type\n\nexport const FunctionCallOutput = Schema.Struct({\n type: Schema.Literal(\"function_call_output\"),\n call_id: Schema.String,\n output: Schema.String,\n providerData: ProviderData,\n})\nexport type FunctionCallOutput = typeof FunctionCallOutput.Type\n\n/**\n * Reasoning item - top-level, mirrors OpenAI Responses API. Common shape\n * across providers covers `summary` (human-readable text) and `signature`\n * (opaque round-trip blob - Anthropic's signed thinking, OpenAI's\n * encrypted_content, etc.). Provider-specific fields go in `providerData`.\n */\nexport const Reasoning = Schema.Struct({\n type: Schema.Literal(\"reasoning\"),\n id: Schema.optional(Schema.String),\n summary: Schema.optional(Schema.String),\n signature: Schema.optional(Schema.String),\n providerData: ProviderData,\n})\nexport type Reasoning = typeof Reasoning.Type\n\nexport const Item = Schema.Union([Message, FunctionCall, FunctionCallOutput, Reasoning])\nexport type Item = typeof Item.Type\n\n// ---------------------------------------------------------------------------\n// Type guards\n// ---------------------------------------------------------------------------\n\nexport const isInputText = (block: ContentBlock): block is InputText => block.type === \"input_text\"\nexport const isInputImage = (block: ContentBlock): block is InputImage =>\n block.type === \"input_image\"\nexport const isOutputText = (block: ContentBlock): block is OutputText =>\n block.type === \"output_text\"\nexport const isRefusal = (block: ContentBlock): block is Refusal => block.type === \"refusal\"\n\nexport const isMessage = (item: Item): item is Message => item.type === \"message\"\nexport const isFunctionCall = (item: Item): item is FunctionCall => item.type === \"function_call\"\nexport const isFunctionCallOutput = (item: Item): item is FunctionCallOutput =>\n item.type === \"function_call_output\"\nexport const isReasoning = (item: Item): item is Reasoning => item.type === \"reasoning\"\n\n// ---------------------------------------------------------------------------\n// Usage and stop reason\n// ---------------------------------------------------------------------------\n\nexport const InputTokensDetails = Schema.Struct({\n cached_tokens: Schema.optional(Schema.Number),\n})\nexport type InputTokensDetails = typeof InputTokensDetails.Type\n\nexport const OutputTokensDetails = Schema.Struct({\n reasoning_tokens: Schema.optional(Schema.Number),\n})\nexport type OutputTokensDetails = typeof OutputTokensDetails.Type\n\nexport const Usage = Schema.Struct({\n input_tokens: Schema.optional(Schema.Number),\n output_tokens: Schema.optional(Schema.Number),\n total_tokens: Schema.optional(Schema.Number),\n input_tokens_details: Schema.optional(InputTokensDetails),\n output_tokens_details: Schema.optional(OutputTokensDetails),\n})\nexport type Usage = typeof Usage.Type\n\nexport const StopReason = Schema.Literals([\n \"stop\",\n \"tool_calls\",\n \"max_tokens\",\n \"refusal\",\n /** Provider-side safety classifier flagged the output. */\n \"content_filter\",\n /** Server-enforced cap on tool calls per turn was hit. */\n \"max_tool_calls\",\n])\nexport type StopReason = typeof StopReason.Type\n\n// ---------------------------------------------------------------------------\n// Helper constructors\n// ---------------------------------------------------------------------------\n\nexport const userText = (text: string): Message => ({\n type: \"message\",\n role: \"user\",\n content: [{ type: \"input_text\", text }],\n})\n\nexport const systemText = (text: string): Message => ({\n type: \"message\",\n role: \"system\",\n content: [{ type: \"input_text\", text }],\n})\n\nexport const assistantText = (text: string): Message => ({\n type: \"message\",\n role: \"assistant\",\n content: [{ type: \"output_text\", text }],\n})\n\nexport const functionCallOutput = (call_id: string, output: string): FunctionCallOutput => ({\n type: \"function_call_output\",\n call_id,\n output,\n})\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"Items.mjs","names":[],"sources":["../../src/domain/Items.ts"],"sourcesContent":["import { Schema } from \"effect\"\nimport { ImageSource } from \"./Image.js\"\n\n// ---------------------------------------------------------------------------\n// Content blocks (inside Message.content)\n// ---------------------------------------------------------------------------\n\nexport const InputText = Schema.Struct({\n type: Schema.Literal(\"input_text\"),\n text: Schema.String,\n})\nexport type InputText = typeof InputText.Type\n\n/**\n * User-provided image content block. Pair with `InputText` inside a\n * `Message.content` array to ask \"what's in this image?\" style questions.\n *\n * `source` is the cross-modality `ImageSource` from `domain/Image.ts` -\n * url, base64, or raw bytes. Provider codecs encode bytes to whatever\n * wire format the provider wants.\n */\nexport const InputImage = Schema.Struct({\n type: Schema.Literal(\"input_image\"),\n source: ImageSource,\n})\nexport type InputImage = typeof InputImage.Type\n\n// ---------------------------------------------------------------------------\n// Annotations - source / citation pointers attached to `output_text` blocks.\n// Mirrors OpenAI Responses API; other providers can omit or map onto these\n// shapes.\n// ---------------------------------------------------------------------------\n\nexport const UrlCitation = Schema.Struct({\n type: Schema.Literal(\"url_citation\"),\n url: Schema.String,\n start_index: Schema.Number,\n end_index: Schema.Number,\n title: Schema.String,\n})\nexport type UrlCitation = typeof UrlCitation.Type\n\nexport const FileCitation = Schema.Struct({\n type: Schema.Literal(\"file_citation\"),\n file_id: Schema.String,\n index: Schema.Number,\n})\nexport type FileCitation = typeof FileCitation.Type\n\nexport const ContainerFileCitation = Schema.Struct({\n type: Schema.Literal(\"container_file_citation\"),\n container_id: Schema.String,\n file_id: Schema.String,\n start_index: Schema.Number,\n end_index: Schema.Number,\n})\nexport type ContainerFileCitation = typeof ContainerFileCitation.Type\n\nexport const FilePath = Schema.Struct({\n type: Schema.Literal(\"file_path\"),\n file_id: Schema.String,\n index: Schema.Number,\n})\nexport type FilePath = typeof FilePath.Type\n\nexport const Annotation = Schema.Union([UrlCitation, FileCitation, ContainerFileCitation, FilePath])\nexport type Annotation = typeof Annotation.Type\n\nexport const isUrlCitation = Schema.is(UrlCitation)\nexport const isFileCitation = Schema.is(FileCitation)\nexport const isContainerFileCitation = Schema.is(ContainerFileCitation)\nexport const isFilePath = Schema.is(FilePath)\n\nexport const OutputText = Schema.Struct({\n type: Schema.Literal(\"output_text\"),\n text: Schema.String,\n annotations: Schema.optional(Schema.Array(Annotation)),\n})\nexport type OutputText = typeof OutputText.Type\n\n/**\n * Model-emitted refusal. Distinct from `output_text`: the model declined\n * to answer rather than producing normal output. Pair with\n * `stop_reason: \"refusal\"` on the surrounding `Turn`. Streamed via the\n * `refusal_delta` `TurnEvent`.\n */\nexport const Refusal = Schema.Struct({\n type: Schema.Literal(\"refusal\"),\n text: Schema.String,\n})\nexport type Refusal = typeof Refusal.Type\n\nexport const ContentBlock = Schema.Union([InputText, InputImage, OutputText, Refusal])\nexport type ContentBlock = typeof ContentBlock.Type\n\nexport const Role = Schema.Literals([\"user\", \"assistant\", \"system\"])\nexport type Role = typeof Role.Type\n\n// ---------------------------------------------------------------------------\n// Provider passthrough - every Item type carries this opaque slot.\n// The framework never reads or interprets it; provider modules decode\n// their own data via their own typed readers (see e.g.\n// the `@effect-uai/responses` package).\n// ---------------------------------------------------------------------------\n\nconst ProviderData = Schema.optional(Schema.Unknown)\n\n// ---------------------------------------------------------------------------\n// Items\n// ---------------------------------------------------------------------------\n\nexport const Message = Schema.Struct({\n type: Schema.Literal(\"message\"),\n role: Role,\n content: Schema.Array(ContentBlock),\n providerData: ProviderData,\n})\nexport type Message = typeof Message.Type\n\nexport const FunctionCall = Schema.Struct({\n type: Schema.Literal(\"function_call\"),\n call_id: Schema.String,\n name: Schema.String,\n // JSON-encoded arguments string, mirroring OpenAI Responses API\n arguments: Schema.String,\n providerData: ProviderData,\n})\nexport type FunctionCall = typeof FunctionCall.Type\n\nexport const FunctionCallOutput = Schema.Struct({\n type: Schema.Literal(\"function_call_output\"),\n call_id: Schema.String,\n output: Schema.String,\n providerData: ProviderData,\n})\nexport type FunctionCallOutput = typeof FunctionCallOutput.Type\n\n/**\n * Reasoning item - top-level, mirrors OpenAI Responses API. Common shape\n * across providers covers `summary` (human-readable text) and `signature`\n * (opaque round-trip blob - Anthropic's signed thinking, OpenAI's\n * encrypted_content, etc.). Provider-specific fields go in `providerData`.\n */\nexport const Reasoning = Schema.Struct({\n type: Schema.Literal(\"reasoning\"),\n id: Schema.optional(Schema.String),\n summary: Schema.optional(Schema.String),\n signature: Schema.optional(Schema.String),\n providerData: ProviderData,\n})\nexport type Reasoning = typeof Reasoning.Type\n\nexport const Item = Schema.Union([Message, FunctionCall, FunctionCallOutput, Reasoning])\nexport type Item = typeof Item.Type\n\n// ---------------------------------------------------------------------------\n// Type guards\n// ---------------------------------------------------------------------------\n\nexport const isInputText = Schema.is(InputText)\nexport const isInputImage = Schema.is(InputImage)\nexport const isOutputText = Schema.is(OutputText)\nexport const isRefusal = Schema.is(Refusal)\n\nexport const isMessage = Schema.is(Message)\nexport const isFunctionCall = Schema.is(FunctionCall)\nexport const isFunctionCallOutput = Schema.is(FunctionCallOutput)\nexport const isReasoning = Schema.is(Reasoning)\n\n// ---------------------------------------------------------------------------\n// Usage and stop reason\n// ---------------------------------------------------------------------------\n\nexport const InputTokensDetails = Schema.Struct({\n cached_tokens: Schema.optional(Schema.Number),\n})\nexport type InputTokensDetails = typeof InputTokensDetails.Type\n\nexport const OutputTokensDetails = Schema.Struct({\n reasoning_tokens: Schema.optional(Schema.Number),\n})\nexport type OutputTokensDetails = typeof OutputTokensDetails.Type\n\nexport const Usage = Schema.Struct({\n input_tokens: Schema.optional(Schema.Number),\n output_tokens: Schema.optional(Schema.Number),\n total_tokens: Schema.optional(Schema.Number),\n input_tokens_details: Schema.optional(InputTokensDetails),\n output_tokens_details: Schema.optional(OutputTokensDetails),\n})\nexport type Usage = typeof Usage.Type\n\nexport const StopReason = Schema.Literals([\n \"stop\",\n \"tool_calls\",\n \"max_tokens\",\n \"refusal\",\n /** Provider-side safety classifier flagged the output. */\n \"content_filter\",\n /** Server-enforced cap on tool calls per turn was hit. */\n \"max_tool_calls\",\n])\nexport type StopReason = typeof StopReason.Type\n\n// ---------------------------------------------------------------------------\n// Helper constructors\n// ---------------------------------------------------------------------------\n\nexport const userText = (text: string): Message => ({\n type: \"message\",\n role: \"user\",\n content: [{ type: \"input_text\", text }],\n})\n\nexport const systemText = (text: string): Message => ({\n type: \"message\",\n role: \"system\",\n content: [{ type: \"input_text\", text }],\n})\n\nexport const assistantText = (text: string): Message => ({\n type: \"message\",\n role: \"assistant\",\n content: [{ type: \"output_text\", text }],\n})\n\nexport const functionCallOutput = (call_id: string, output: string): FunctionCallOutput => ({\n type: \"function_call_output\",\n call_id,\n output,\n})\n"],"mappings":"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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { n as __exportAll } from "../chunk-uyGKjUfl.mjs";
|
|
2
|
+
//#region src/domain/Media.ts
|
|
3
|
+
var Media_exports = /* @__PURE__ */ __exportAll({
|
|
4
|
+
isMediaBase64: () => isMediaBase64,
|
|
5
|
+
isMediaBytes: () => isMediaBytes,
|
|
6
|
+
isMediaUrl: () => isMediaUrl
|
|
7
|
+
});
|
|
8
|
+
const isMediaUrl = (s) => s._tag === "url";
|
|
9
|
+
const isMediaBase64 = (s) => s._tag === "base64";
|
|
10
|
+
const isMediaBytes = (s) => s._tag === "bytes";
|
|
11
|
+
//#endregion
|
|
12
|
+
export { isMediaBase64, isMediaBytes, isMediaUrl, Media_exports as t };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=Media.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Media.mjs","names":[],"sources":["../../src/domain/Media.ts"],"sourcesContent":["/**\n * Cross-modality media reference shape.\n *\n * Every \"media at rest\" reference - image, audio, video, document - is one\n * of three variants:\n *\n * - `url` : a remote address (HTTP, GCS, etc.). The model fetches it.\n * `mimeType` is optional - servers usually set Content-Type.\n * Some providers (Gemini `fileData`) want it explicit.\n *\n * - `base64` : an inline base64-encoded payload. Always carries a\n * `mimeType` so the consumer knows how to decode.\n *\n * - `bytes` : raw `Uint8Array`. Provider layers normalize to base64 or\n * multipart upload at the wire boundary - users don't need\n * to encode themselves.\n *\n * Per-modality files (`Image.ts`, future `Audio.ts` / `Video.ts` /\n * `Document.ts`) instantiate this shape with their typed MIME union to\n * get autocomplete on common formats while keeping the structural type\n * uniform across modalities.\n *\n * Streaming media (live mic feed, streaming TTS playback) is *not*\n * modeled here. Streams carry effect parameters (`Stream<A, E, R>`) and\n * lifecycle (Scope, cancellation) that don't apply to media at rest. The\n * complementary type lives alongside this one as `*Stream` in each\n * per-modality file when those modalities land.\n *\n * Provider-uploaded asset references (OpenAI Files `file_id`, Gemini\n * Files API URIs, Anthropic file IDs) are also out of scope here -\n * they're a separate union (`FileRef`) added when needed.\n */\n\nexport type MediaUrl<M extends string = string> = {\n readonly _tag: \"url\"\n readonly url: string\n readonly mimeType?: M\n}\n\nexport type MediaBase64<M extends string = string> = {\n readonly _tag: \"base64\"\n readonly base64: string\n readonly mimeType: M\n}\n\nexport type MediaBytes<M extends string = string> = {\n readonly _tag: \"bytes\"\n readonly bytes: Uint8Array\n readonly mimeType: M\n}\n\nexport type MediaSource<M extends string = string> = MediaUrl<M> | MediaBase64<M> | MediaBytes<M>\n\nexport const isMediaUrl = <M extends string>(s: MediaSource<M>): s is MediaUrl<M> =>\n s._tag === \"url\"\n\nexport const isMediaBase64 = <M extends string>(s: MediaSource<M>): s is MediaBase64<M> =>\n s._tag === \"base64\"\n\nexport const isMediaBytes = <M extends string>(s: MediaSource<M>): s is MediaBytes<M> =>\n s._tag === \"bytes\"\n"],"mappings":";;;;;;;AAqDA,MAAa,cAAgC,MAC3C,EAAE,SAAS;AAEb,MAAa,iBAAmC,MAC9C,EAAE,SAAS;AAEb,MAAa,gBAAkC,MAC7C,EAAE,SAAS"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { r as AudioFormat, t as AudioBlob } from "../Audio-BfCTGnH3.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/domain/Music.d.ts
|
|
4
|
+
declare namespace Music_d_exports {
|
|
5
|
+
export { CommonGenerateMusicRequest, CommonStreamGenerateMusicRequest, MusicResult, MusicSessionInput, WeightedPrompt, configInput, controlInput, isConfigInput, isControlInput, isPromptsInput, promptsInput };
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Prompt fragment with a relative weight. Native to Lyria RealTime
|
|
9
|
+
* (`{ text, weight }` pairs blended in the model). Single-prompt
|
|
10
|
+
* providers (Suno, Mureka, MiniMax) flatten to text at the adapter
|
|
11
|
+
* layer.
|
|
12
|
+
*/
|
|
13
|
+
type WeightedPrompt = {
|
|
14
|
+
readonly text: string; /** Default `1.0`. Range typically `[0, 1]`; provider-dependent. */
|
|
15
|
+
readonly weight?: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Cross-provider music-generation request. Provider-specific extras
|
|
19
|
+
* (Lyria `mode`, ElevenLabs `composition_plan`, Suno custom-mode `title`,
|
|
20
|
+
* MiniMax `lyrics_optimizer`) live on each provider's typed request
|
|
21
|
+
* which extends this and narrows `model`.
|
|
22
|
+
*/
|
|
23
|
+
type CommonGenerateMusicRequest = {
|
|
24
|
+
/** Model identifier. Each provider narrows. */readonly model: string; /** Single prompt string or weighted-prompt list (blended where supported). */
|
|
25
|
+
readonly prompts: string | ReadonlyArray<WeightedPrompt>;
|
|
26
|
+
/**
|
|
27
|
+
* Lyrics text, optionally with section tags like `[Verse]` / `[Chorus]` /
|
|
28
|
+
* `[Bridge]` / `[Outro]`. Ignored for instrumental-only providers or
|
|
29
|
+
* when `instrumental: true`.
|
|
30
|
+
*/
|
|
31
|
+
readonly lyrics?: string; /** Target duration in seconds. Provider may treat as a hint or hard limit. */
|
|
32
|
+
readonly durationSeconds?: number; /** Beats per minute (60–200 typical). */
|
|
33
|
+
readonly bpm?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Musical key/mode hint. Provider-specific vocabulary (e.g. Lyria
|
|
36
|
+
* RealTime uses enum values like `"C_MAJOR"`, `"A_MINOR"`).
|
|
37
|
+
*/
|
|
38
|
+
readonly scale?: string; /** Skip vocals / lyrics. */
|
|
39
|
+
readonly instrumental?: boolean; /** Preferred output format. Provider may override. */
|
|
40
|
+
readonly outputFormat?: AudioFormat;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Streamed-output request. Same shape as the sync request — the
|
|
44
|
+
* streaming variant only differs in how the response is delivered.
|
|
45
|
+
*/
|
|
46
|
+
type CommonStreamGenerateMusicRequest = CommonGenerateMusicRequest;
|
|
47
|
+
/**
|
|
48
|
+
* Bidirectional-session input. The user pushes one of these per
|
|
49
|
+
* change: a new prompt blend, a config delta, or a playback control.
|
|
50
|
+
* Lyria RealTime is the only provider currently surfacing these.
|
|
51
|
+
*/
|
|
52
|
+
type MusicSessionInput = {
|
|
53
|
+
readonly _tag: "prompts";
|
|
54
|
+
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
|
+
} | {
|
|
71
|
+
readonly _tag: "control";
|
|
72
|
+
readonly action: "play" | "pause" | "stop" | "reset_context";
|
|
73
|
+
};
|
|
74
|
+
declare const promptsInput: (prompts: ReadonlyArray<WeightedPrompt>) => MusicSessionInput;
|
|
75
|
+
declare const configInput: (config: (MusicSessionInput & {
|
|
76
|
+
_tag: "config";
|
|
77
|
+
})["config"]) => MusicSessionInput;
|
|
78
|
+
declare const controlInput: (action: (MusicSessionInput & {
|
|
79
|
+
_tag: "control";
|
|
80
|
+
})["action"]) => MusicSessionInput;
|
|
81
|
+
/**
|
|
82
|
+
* Sync-generation result. Extends `AudioBlob` with provider-side
|
|
83
|
+
* metadata that's common across music providers:
|
|
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).
|
|
92
|
+
*/
|
|
93
|
+
type MusicResult = AudioBlob & {
|
|
94
|
+
readonly songId?: string;
|
|
95
|
+
readonly lyrics?: string;
|
|
96
|
+
readonly sections?: ReadonlyArray<{
|
|
97
|
+
readonly label: string;
|
|
98
|
+
readonly startSeconds: number;
|
|
99
|
+
readonly endSeconds: number;
|
|
100
|
+
}>;
|
|
101
|
+
readonly watermark?: {
|
|
102
|
+
readonly kind: string;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
declare const isPromptsInput: (i: MusicSessionInput) => i is MusicSessionInput & {
|
|
106
|
+
_tag: "prompts";
|
|
107
|
+
};
|
|
108
|
+
declare const isConfigInput: (i: MusicSessionInput) => i is MusicSessionInput & {
|
|
109
|
+
_tag: "config";
|
|
110
|
+
};
|
|
111
|
+
declare const isControlInput: (i: MusicSessionInput) => i is MusicSessionInput & {
|
|
112
|
+
_tag: "control";
|
|
113
|
+
};
|
|
114
|
+
//#endregion
|
|
115
|
+
export { CommonGenerateMusicRequest, CommonStreamGenerateMusicRequest, MusicResult, MusicSessionInput, WeightedPrompt, configInput, controlInput, isConfigInput, isControlInput, isPromptsInput, promptsInput, Music_d_exports as t };
|
|
116
|
+
//# sourceMappingURL=Music.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Music.d.mts","names":[],"sources":["../../src/domain/Music.ts"],"mappings":";;;;;;;;;;;;KAQY,cAAA;EAAA,SACD,IAAA;WAEA,MAAA;AAAA;;;;;;AAHX;KAYY,0BAAA;0DAED,KAAA,UAXM;EAAA,SAaN,OAAA,WAAkB,aAAA,CAAc,cAAA;EAJL;;;;;EAAA,SAU3B,MAAA,WAa0B;EAAA,SAX1B,eAAA,WARA;EAAA,SAUA,GAAA;EAVgC;;;;EAAA,SAehC,KAAA,WAEA;EAAA,SAAA,YAAA,YAEe;EAAA,SAAf,YAAA,GAAe,WAAA;AAAA;AAO1B;;;;AAAA,KAAY,gCAAA,GAAmC,0BAAA;AAO/C;;;;;AAAA,KAAY,iBAAA;EAAA,SACG,IAAA;EAAA,SAA0B,OAAA,EAAS,aAAA,CAAc,cAAA;AAAA;EAAA,SAEjD,IAAA;EAAA,SACA,MAAA;IAAA,SACE,GAAA;IAAA,SACA,KAAA;IAAA,SACA,OAAA;IAAA,SACA,UAAA;IAAA,SACA,QAAA;IAAA,SACA,WAAA;IAAA,SACA,IAAA;IAAA,SACA,IAAA;IAAA,SACA,QAAA;IAAA,SACA,SAAA;IAAA,SACA,gBAAA;EAAA;AAAA;EAAA,SAGF,IAAA;EAAA,SAA0B,MAAA;AAAA;AAAA,cAE5B,YAAA,GAAgB,OAAA,EAAS,aAAA,CAAc,cAAA,MAAkB,iBAAA;AAAA,cAKzD,WAAA,GACX,MAAA,GAAS,iBAAA;EAAsB,IAAA;AAAA,iBAC9B,iBAAA;AAAA,cAEU,YAAA,GACX,MAAA,GAAS,iBAAA;EAAsB,IAAA;AAAA,iBAC9B,iBAAA;;;;;;AANH;;;;;;;KAoBY,WAAA,GAAc,SAAA;EAAA,SACf,MAAA;EAAA,SACA,MAAA;EAAA,SACA,QAAA,GAAW,aAAA;IAAA,SACT,KAAA;IAAA,SACA,YAAA;IAAA,SACA,UAAA;EAAA;EAAA,SAEF,SAAA;IAAA,SAAuB,IAAA;EAAA;AAAA;AAAA,cAGrB,cAAA,GACX,CAAA,EAAG,iBAAA,KACF,CAAA,IAAK,iBAAA;EAAsB,IAAA;AAAA;AAAA,cACjB,aAAA,GAAiB,CAAA,EAAG,iBAAA,KAAoB,CAAA,IAAK,iBAAA;EAAsB,IAAA;AAAA;AAAA,cAEnE,cAAA,GACX,CAAA,EAAG,iBAAA,KACF,CAAA,IAAK,iBAAA;EAAsB,IAAA;AAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { n as __exportAll } from "../chunk-uyGKjUfl.mjs";
|
|
2
|
+
//#region src/domain/Music.ts
|
|
3
|
+
var Music_exports = /* @__PURE__ */ __exportAll({
|
|
4
|
+
configInput: () => configInput,
|
|
5
|
+
controlInput: () => controlInput,
|
|
6
|
+
isConfigInput: () => isConfigInput,
|
|
7
|
+
isControlInput: () => isControlInput,
|
|
8
|
+
isPromptsInput: () => isPromptsInput,
|
|
9
|
+
promptsInput: () => promptsInput
|
|
10
|
+
});
|
|
11
|
+
const promptsInput = (prompts) => ({
|
|
12
|
+
_tag: "prompts",
|
|
13
|
+
prompts
|
|
14
|
+
});
|
|
15
|
+
const configInput = (config) => ({
|
|
16
|
+
_tag: "config",
|
|
17
|
+
config
|
|
18
|
+
});
|
|
19
|
+
const controlInput = (action) => ({
|
|
20
|
+
_tag: "control",
|
|
21
|
+
action
|
|
22
|
+
});
|
|
23
|
+
const isPromptsInput = (i) => i._tag === "prompts";
|
|
24
|
+
const isConfigInput = (i) => i._tag === "config";
|
|
25
|
+
const isControlInput = (i) => i._tag === "control";
|
|
26
|
+
//#endregion
|
|
27
|
+
export { configInput, controlInput, isConfigInput, isControlInput, isPromptsInput, promptsInput, Music_exports as t };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=Music.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Music.mjs","names":[],"sources":["../../src/domain/Music.ts"],"sourcesContent":["import type { AudioBlob, AudioFormat } from \"./Audio.js\"\n\n/**\n * Prompt fragment with a relative weight. Native to Lyria RealTime\n * (`{ text, weight }` pairs blended in the model). Single-prompt\n * providers (Suno, Mureka, MiniMax) flatten to text at the adapter\n * layer.\n */\nexport type WeightedPrompt = {\n readonly text: string\n /** Default `1.0`. Range typically `[0, 1]`; provider-dependent. */\n readonly weight?: number\n}\n\n/**\n * Cross-provider music-generation request. Provider-specific extras\n * (Lyria `mode`, ElevenLabs `composition_plan`, Suno custom-mode `title`,\n * MiniMax `lyrics_optimizer`) live on each provider's typed request\n * which extends this and narrows `model`.\n */\nexport type CommonGenerateMusicRequest = {\n /** Model identifier. Each provider narrows. */\n readonly model: string\n /** Single prompt string or weighted-prompt list (blended where supported). */\n readonly prompts: string | ReadonlyArray<WeightedPrompt>\n /**\n * Lyrics text, optionally with section tags like `[Verse]` / `[Chorus]` /\n * `[Bridge]` / `[Outro]`. Ignored for instrumental-only providers or\n * when `instrumental: true`.\n */\n readonly lyrics?: string\n /** Target duration in seconds. Provider may treat as a hint or hard limit. */\n readonly durationSeconds?: number\n /** Beats per minute (60–200 typical). */\n readonly bpm?: number\n /**\n * Musical key/mode hint. Provider-specific vocabulary (e.g. Lyria\n * RealTime uses enum values like `\"C_MAJOR\"`, `\"A_MINOR\"`).\n */\n readonly scale?: string\n /** Skip vocals / lyrics. */\n readonly instrumental?: boolean\n /** Preferred output format. Provider may override. */\n readonly outputFormat?: AudioFormat\n}\n\n/**\n * Streamed-output request. Same shape as the sync request — the\n * streaming variant only differs in how the response is delivered.\n */\nexport type CommonStreamGenerateMusicRequest = CommonGenerateMusicRequest\n\n/**\n * Bidirectional-session input. The user pushes one of these per\n * change: a new prompt blend, a config delta, or a playback control.\n * Lyria RealTime is the only provider currently surfacing these.\n */\nexport type MusicSessionInput =\n | { readonly _tag: \"prompts\"; readonly prompts: ReadonlyArray<WeightedPrompt> }\n | {\n readonly _tag: \"config\"\n readonly config: {\n readonly bpm?: number\n readonly scale?: string\n readonly density?: number\n readonly brightness?: number\n readonly guidance?: number\n readonly temperature?: number\n readonly topK?: number\n readonly seed?: number\n readonly muteBass?: boolean\n readonly muteDrums?: boolean\n readonly onlyBassAndDrums?: boolean\n }\n }\n | { readonly _tag: \"control\"; readonly action: \"play\" | \"pause\" | \"stop\" | \"reset_context\" }\n\nexport const promptsInput = (prompts: ReadonlyArray<WeightedPrompt>): MusicSessionInput => ({\n _tag: \"prompts\",\n prompts,\n})\n\nexport const configInput = (\n config: (MusicSessionInput & { _tag: \"config\" })[\"config\"],\n): MusicSessionInput => ({ _tag: \"config\", config })\n\nexport const controlInput = (\n action: (MusicSessionInput & { _tag: \"control\" })[\"action\"],\n): MusicSessionInput => ({ _tag: \"control\", action })\n\n/**\n * Sync-generation result. Extends `AudioBlob` with provider-side\n * metadata that's common across music providers:\n *\n * - `songId` — Suno task id, ElevenLabs `song_id`, etc. Used for\n * back-reference (re-download, stem export, follow-up edits).\n * - `lyrics` — generated lyrics when the model returned them (Lyria\n * text part, Mureka, Suno).\n * - `sections` — structured section markers (Lyria optional JSON\n * structure response).\n * - `watermark` — presence marker (Lyria SynthID is always set).\n */\nexport type MusicResult = AudioBlob & {\n readonly songId?: string\n readonly lyrics?: string\n readonly sections?: ReadonlyArray<{\n readonly label: string\n readonly startSeconds: number\n readonly endSeconds: number\n }>\n readonly watermark?: { readonly kind: string }\n}\n\nexport const isPromptsInput = (\n i: MusicSessionInput,\n): i is MusicSessionInput & { _tag: \"prompts\" } => i._tag === \"prompts\"\nexport const isConfigInput = (i: MusicSessionInput): i is MusicSessionInput & { _tag: \"config\" } =>\n i._tag === \"config\"\nexport const isControlInput = (\n i: MusicSessionInput,\n): i is MusicSessionInput & { _tag: \"control\" } => i._tag === \"control\"\n"],"mappings":";;;;;;;;;;AA6EA,MAAa,gBAAgB,aAA+D;CAC1F,MAAM;CACN;CACD;AAED,MAAa,eACX,YACuB;CAAE,MAAM;CAAU;CAAQ;AAEnD,MAAa,gBACX,YACuB;CAAE,MAAM;CAAW;CAAQ;AAyBpD,MAAa,kBACX,MACiD,EAAE,SAAS;AAC9D,MAAa,iBAAiB,MAC5B,EAAE,SAAS;AACb,MAAa,kBACX,MACiD,EAAE,SAAS"}
|