@effect-uai/core 0.2.0 → 0.3.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-CBuPHVKA.d.mts} +1 -1
- package/dist/{AiError-CqmYjXyx.d.mts.map → AiError-CBuPHVKA.d.mts.map} +1 -1
- package/dist/Image-BZmKfIdq.d.mts +61 -0
- package/dist/Image-BZmKfIdq.d.mts.map +1 -0
- package/dist/{Items-D1C2686t.d.mts → Items-CB8Bo3FI.d.mts} +132 -80
- package/dist/Items-CB8Bo3FI.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-BWq5Hd1O.d.mts} +5 -5
- package/dist/StructuredFormat-BWq5Hd1O.d.mts.map +1 -0
- package/dist/{Tool-5wxOCuOh.d.mts → Tool-DjVufH7i.d.mts} +13 -13
- package/dist/Tool-DjVufH7i.d.mts.map +1 -0
- package/dist/{Turn-Bi83du4I.d.mts → Turn-OPaILVIB.d.mts} +5 -11
- package/dist/Turn-OPaILVIB.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 +1 -1
- package/dist/domain/AiError.mjs +1 -1
- 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/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 +15 -7
- package/dist/index.mjs +10 -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/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/streaming/JSONL.mjs +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/MockProvider.d.mts +6 -6
- package/dist/testing/MockProvider.d.mts.map +1 -1
- package/dist/testing/MockProvider.mjs.map +1 -1
- 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/package.json +29 -13
- package/src/domain/Image.ts +75 -0
- package/src/domain/Items.ts +18 -47
- package/src/domain/Media.ts +61 -0
- package/src/embedding-model/Embedding.ts +117 -0
- package/src/embedding-model/EmbeddingModel.ts +107 -0
- package/src/index.ts +9 -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/observability/Metrics.ts +1 -1
- package/src/streaming/SSE.ts +1 -1
- package/src/structured-format/StructuredFormat.ts +2 -2
- package/src/testing/MockProvider.ts +2 -2
- 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/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
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`, `value`, `next`, `stop`, `nextAfter`, `nextAfterFold`, `
|
|
13
|
+
- **Loop primitive** - `Loop` (`loop`, `loopWithState`, `value`, `next`, `stop`, `nextAfter`, `nextAfterFold`, `onTurnComplete`)
|
|
14
14
|
- **Tools** - `Tool`, `Toolkit`, `Outcome`, `ToolEvent`, `Resolvers`, `HistoryCheck`
|
|
15
15
|
- **Streaming codecs** - `SSE`, `JSONL`, `Lines`
|
|
16
16
|
- **Structured output** - `StructuredFormat`
|
|
@@ -107,4 +107,4 @@ declare class IncompleteTurn extends IncompleteTurn_base<{
|
|
|
107
107
|
type AiError = RateLimited | Unavailable | Timeout | ContentFiltered | ContextLengthExceeded | InvalidRequest | AuthFailed | Cancelled | IncompleteTurn | GenerationFailed;
|
|
108
108
|
//#endregion
|
|
109
109
|
export { Cancelled as a, GenerationFailed as c, RateLimited as d, Scope$1 as f, AuthSubtype as i, IncompleteTurn as l, Unavailable as m, AiError_d_exports as n, ContentFiltered as o, Timeout as p, AuthFailed as r, ContextLengthExceeded as s, AiError as t, InvalidRequest as u };
|
|
110
|
-
//# sourceMappingURL=AiError-
|
|
110
|
+
//# sourceMappingURL=AiError-CBuPHVKA.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiError-
|
|
1
|
+
{"version":3,"file":"AiError-CBuPHVKA.d.mts","names":[],"sources":["../src/domain/AiError.ts"],"mappings":";;;;;;;;KAEY,OAAA;AAAA,cAAqC,gBAAA;;;cAEpC,WAAA,SAAoB,gBAAA;EAC/B,QAAA;EACA,UAAA,GAAa,QAAA,CAAS,QAAA;EACtB,KAAA,GAAQ,OAAA;EACR,SAAA;EACA,GAAA;AAAA;AAAA,cACG,gBAAA;;;cAEQ,WAAA,SAAoB,gBAAA;EAC/B,QAAA;EACA,UAAA,GAAa,QAAA,CAAS,QAAA;EACtB,MAAA;EACA,SAAA;EACA,GAAA;AAAA;AAAA,cACG,YAAA;;;cAEQ,OAAA,SAAgB,YAAA;EAC3B,QAAA;EACA,SAAA;EACA,GAAA;AAAA;AAAA,cACG,oBAAA;;;cAEQ,eAAA,SAAwB,oBAAA;EACnC,QAAA;EACA,MAAA;EACA,SAAA;EACA,GAAA;AAAA;AAAA,cACG,0BAAA;;;cAEQ,qBAAA,SAA8B,0BAAA;EACzC,QAAA;EACA,UAAA;EACA,SAAA;EACA,GAAA;AAAA;AAAA,cACG,mBAAA;;;cAEQ,cAAA,SAAuB,mBAAA;EAClC,QAAA;EACA,KAAA;EACA,SAAA;EACA,GAAA;AAAA;AAAA,KAGU,WAAA;AAAA,cAAyD,eAAA;;;cAExD,UAAA,SAAmB,eAAA;EAC9B,QAAA;EACA,OAAA,EAAS,WAAA;EACT,GAAA;AAAA;AAAA,cACG,cAAA;;;cAEQ,SAAA,SAAkB,cAAA;EAC7B,QAAA;AAAA;AAAA,cACG,qBAAA;;;;;;;;;cAQQ,gBAAA,SAAyB,qBAAA;EACpC,QAAA;EACA,IAAA;EACA,OAAA;EACA,SAAA;EACA,GAAA;AAAA;AAAA,cACG,mBAAA;;;;;;;;cAOQ,cAAA,SAAuB,mBAAA;EAClC,GAAA;AAAA;AAAA,KAGU,OAAA,GACR,WAAA,GACA,WAAA,GACA,OAAA,GACA,eAAA,GACA,qBAAA,GACA,cAAA,GACA,UAAA,GACA,SAAA,GACA,cAAA,GACA,gBAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { i as MediaUrl, n as MediaBytes, r as MediaSource, t as MediaBase64 } from "./Media-D_CpcM1Z.mjs";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
|
|
4
|
+
//#region src/domain/Image.d.ts
|
|
5
|
+
declare namespace Image_d_exports {
|
|
6
|
+
export { ImageBase64Source, ImageBytesSource, ImageMimeType, ImageSource, ImageUrlSource, imageBase64, imageBytes, imageUrl, isImageBase64, isImageBytes, isImageUrl };
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Image MIME types AI providers typically accept. The first four are the
|
|
10
|
+
* universal subset (Cohere v4, Voyage multimodal, Jina v4, Google
|
|
11
|
+
* `gemini-embedding-2`); HEIC / HEIF are Google-specific. The
|
|
12
|
+
* `(string & {})` tail keeps autocomplete on the literals while still
|
|
13
|
+
* accepting any string, so a newly-supported format works without an
|
|
14
|
+
* SDK update.
|
|
15
|
+
*/
|
|
16
|
+
type ImageMimeType = "image/png" | "image/jpeg" | "image/webp" | "image/gif" | "image/heic" | "image/heif" | (string & {});
|
|
17
|
+
type ImageUrlSource = MediaUrl<ImageMimeType>;
|
|
18
|
+
type ImageBase64Source = MediaBase64<ImageMimeType>;
|
|
19
|
+
type ImageBytesSource = MediaBytes<ImageMimeType>;
|
|
20
|
+
/**
|
|
21
|
+
* Where an image lives. Provider layers normalize across these:
|
|
22
|
+
* `bytes` becomes a base64 data URI for OpenAI / Anthropic, an
|
|
23
|
+
* `inlineData` part for Gemini, and a separate field for Cohere /
|
|
24
|
+
* Voyage. URL constraints (must be HTTPS, must be public, …) are
|
|
25
|
+
* provider-specific and validated at the layer, not in the type.
|
|
26
|
+
*/
|
|
27
|
+
type ImageSource = MediaSource<ImageMimeType>;
|
|
28
|
+
declare const ImageUrlSource: Schema.TaggedStruct<"url", {
|
|
29
|
+
readonly url: Schema.String;
|
|
30
|
+
readonly mimeType: Schema.optional<Schema.Schema<ImageMimeType>>;
|
|
31
|
+
}>;
|
|
32
|
+
declare const ImageBase64Source: Schema.TaggedStruct<"base64", {
|
|
33
|
+
readonly base64: Schema.String;
|
|
34
|
+
readonly mimeType: Schema.Schema<ImageMimeType>;
|
|
35
|
+
}>;
|
|
36
|
+
declare const ImageBytesSource: Schema.TaggedStruct<"bytes", {
|
|
37
|
+
readonly bytes: Schema.Uint8Array;
|
|
38
|
+
readonly mimeType: Schema.Schema<ImageMimeType>;
|
|
39
|
+
}>;
|
|
40
|
+
declare const ImageSource: Schema.Schema<ImageSource>;
|
|
41
|
+
declare const imageUrl: (url: string, mimeType?: ImageMimeType) => ImageUrlSource;
|
|
42
|
+
declare const imageBase64: (base64: string, mimeType: ImageMimeType) => ImageBase64Source;
|
|
43
|
+
declare const imageBytes: (bytes: Uint8Array, mimeType: ImageMimeType) => ImageBytesSource;
|
|
44
|
+
declare const isImageUrl: <I>(input: I) => input is I & {
|
|
45
|
+
readonly _tag: "url";
|
|
46
|
+
readonly url: string;
|
|
47
|
+
readonly mimeType?: ImageMimeType | undefined;
|
|
48
|
+
};
|
|
49
|
+
declare const isImageBase64: <I>(input: I) => input is I & {
|
|
50
|
+
readonly _tag: "base64";
|
|
51
|
+
readonly mimeType: ImageMimeType;
|
|
52
|
+
readonly base64: string;
|
|
53
|
+
};
|
|
54
|
+
declare const isImageBytes: <I>(input: I) => input is I & {
|
|
55
|
+
readonly _tag: "bytes";
|
|
56
|
+
readonly mimeType: ImageMimeType;
|
|
57
|
+
readonly bytes: Uint8Array<ArrayBufferLike>;
|
|
58
|
+
};
|
|
59
|
+
//#endregion
|
|
60
|
+
export { ImageUrlSource as a, imageBytes as c, isImageBytes as d, isImageUrl as f, ImageSource as i, imageUrl as l, ImageBytesSource as n, Image_d_exports as o, ImageMimeType as r, imageBase64 as s, ImageBase64Source as t, isImageBase64 as u };
|
|
61
|
+
//# sourceMappingURL=Image-BZmKfIdq.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Image-BZmKfIdq.d.mts","names":[],"sources":["../src/domain/Image.ts"],"mappings":";;;;;;;;;;;;;;;KAWY,aAAA;AAAA,KAYA,cAAA,GAAiB,QAAA,CAAS,aAAA;AAAA,KAC1B,iBAAA,GAAoB,WAAA,CAAY,aAAA;AAAA,KAChC,gBAAA,GAAmB,UAAA,CAAW,aAAA;;;;;AAd1C;;;KAuBY,WAAA,GAAc,WAAA,CAAY,aAAA;AAAA,cAEzB,cAAA,EAAc,MAAA,CAAA,YAAA;EAAA;;;cAKd,iBAAA,EAAiB,MAAA,CAAA,YAAA;EAAA;;;cAKjB,gBAAA,EAAgB,MAAA,CAAA,YAAA;EAAA;;;cAKhB,WAAA,EAAa,MAAA,CAAO,MAAA,CAAO,WAAA;AAAA,cAM3B,QAAA,GAAY,GAAA,UAAa,QAAA,GAAW,aAAA,KAAgB,cAAA;AAAA,cAGpD,WAAA,GAAe,MAAA,UAAgB,QAAA,EAAU,aAAA,KAAgB,iBAAA;AAAA,cAMzD,UAAA,GAAc,KAAA,EAAO,UAAA,EAAY,QAAA,EAAU,aAAA,KAAgB,gBAAA;AAAA,cAM3D,UAAA,MAAU,KAAA,EAAA,CAAA,KAAA,KAAA,IAAA,CAAA;EAAA;;;;cACV,aAAA,MAAa,KAAA,EAAA,CAAA,KAAA,KAAA,IAAA,CAAA;EAAA;;;;cACb,YAAA,MAAY,KAAA,EAAA,CAAA,KAAA,KAAA,IAAA,CAAA;EAAA"}
|
|
@@ -1,61 +1,26 @@
|
|
|
1
|
+
import { i as ImageSource } from "./Image-BZmKfIdq.mjs";
|
|
1
2
|
import { Schema } from "effect";
|
|
2
3
|
|
|
3
4
|
//#region src/domain/Items.d.ts
|
|
4
5
|
declare namespace Items_d_exports {
|
|
5
|
-
export { Annotation, ContainerFileCitation, ContentBlock, FileCitation, FilePath, FunctionCall, FunctionCallOutput,
|
|
6
|
+
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 };
|
|
6
7
|
}
|
|
7
8
|
declare const InputText: Schema.Struct<{
|
|
8
9
|
readonly type: Schema.Literal<"input_text">;
|
|
9
10
|
readonly text: Schema.String;
|
|
10
11
|
}>;
|
|
11
12
|
type InputText = typeof InputText.Type;
|
|
12
|
-
/**
|
|
13
|
-
* Where an image lives. `url` covers HTTP(S) URLs (the model fetches
|
|
14
|
-
* them); `base64` covers inline bytes embedded in the request. Provider
|
|
15
|
-
* encoders dispatch on `_tag`. File-id / uploaded-asset references are
|
|
16
|
-
* provider-specific and stay out of this union for now.
|
|
17
|
-
*/
|
|
18
|
-
declare const ImageUrlSource: Schema.Struct<{
|
|
19
|
-
readonly _tag: Schema.Literal<"url">;
|
|
20
|
-
readonly url: Schema.String;
|
|
21
|
-
}>;
|
|
22
|
-
type ImageUrlSource = typeof ImageUrlSource.Type;
|
|
23
|
-
/**
|
|
24
|
-
* Inline image bytes. `data` is **already base64-encoded** (matches what
|
|
25
|
-
* the wire formats expect; no double-encoding needed downstream).
|
|
26
|
-
* `media_type` is the MIME type, e.g. `"image/png"`.
|
|
27
|
-
*/
|
|
28
|
-
declare const ImageBase64Source: Schema.Struct<{
|
|
29
|
-
readonly _tag: Schema.Literal<"base64">;
|
|
30
|
-
readonly media_type: Schema.String;
|
|
31
|
-
readonly data: Schema.String;
|
|
32
|
-
}>;
|
|
33
|
-
type ImageBase64Source = typeof ImageBase64Source.Type;
|
|
34
|
-
declare const ImageSource: Schema.Union<readonly [Schema.Struct<{
|
|
35
|
-
readonly _tag: Schema.Literal<"url">;
|
|
36
|
-
readonly url: Schema.String;
|
|
37
|
-
}>, Schema.Struct<{
|
|
38
|
-
readonly _tag: Schema.Literal<"base64">;
|
|
39
|
-
readonly media_type: Schema.String;
|
|
40
|
-
readonly data: Schema.String;
|
|
41
|
-
}>]>;
|
|
42
|
-
type ImageSource = typeof ImageSource.Type;
|
|
43
|
-
declare const isImageUrlSource: (s: ImageSource) => s is ImageUrlSource;
|
|
44
|
-
declare const isImageBase64Source: (s: ImageSource) => s is ImageBase64Source;
|
|
45
13
|
/**
|
|
46
14
|
* User-provided image content block. Pair with `InputText` inside a
|
|
47
15
|
* `Message.content` array to ask "what's in this image?" style questions.
|
|
16
|
+
*
|
|
17
|
+
* `source` is the cross-modality `ImageSource` from `domain/Image.ts` -
|
|
18
|
+
* url, base64, or raw bytes. Provider codecs encode bytes to whatever
|
|
19
|
+
* wire format the provider wants.
|
|
48
20
|
*/
|
|
49
21
|
declare const InputImage: Schema.Struct<{
|
|
50
22
|
readonly type: Schema.Literal<"input_image">;
|
|
51
|
-
readonly source: Schema.
|
|
52
|
-
readonly _tag: Schema.Literal<"url">;
|
|
53
|
-
readonly url: Schema.String;
|
|
54
|
-
}>, Schema.Struct<{
|
|
55
|
-
readonly _tag: Schema.Literal<"base64">;
|
|
56
|
-
readonly media_type: Schema.String;
|
|
57
|
-
readonly data: Schema.String;
|
|
58
|
-
}>]>;
|
|
23
|
+
readonly source: Schema.Schema<ImageSource>;
|
|
59
24
|
}>;
|
|
60
25
|
type InputImage = typeof InputImage.Type;
|
|
61
26
|
declare const UrlCitation: Schema.Struct<{
|
|
@@ -108,10 +73,30 @@ declare const Annotation: Schema.Union<readonly [Schema.Struct<{
|
|
|
108
73
|
readonly index: Schema.Number;
|
|
109
74
|
}>]>;
|
|
110
75
|
type Annotation = typeof Annotation.Type;
|
|
111
|
-
declare const isUrlCitation: (
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
76
|
+
declare const isUrlCitation: <I>(input: I) => input is I & {
|
|
77
|
+
readonly type: "url_citation";
|
|
78
|
+
readonly url: string;
|
|
79
|
+
readonly start_index: number;
|
|
80
|
+
readonly end_index: number;
|
|
81
|
+
readonly title: string;
|
|
82
|
+
};
|
|
83
|
+
declare const isFileCitation: <I>(input: I) => input is I & {
|
|
84
|
+
readonly type: "file_citation";
|
|
85
|
+
readonly file_id: string;
|
|
86
|
+
readonly index: number;
|
|
87
|
+
};
|
|
88
|
+
declare const isContainerFileCitation: <I>(input: I) => input is I & {
|
|
89
|
+
readonly type: "container_file_citation";
|
|
90
|
+
readonly start_index: number;
|
|
91
|
+
readonly end_index: number;
|
|
92
|
+
readonly file_id: string;
|
|
93
|
+
readonly container_id: string;
|
|
94
|
+
};
|
|
95
|
+
declare const isFilePath: <I>(input: I) => input is I & {
|
|
96
|
+
readonly type: "file_path";
|
|
97
|
+
readonly file_id: string;
|
|
98
|
+
readonly index: number;
|
|
99
|
+
};
|
|
115
100
|
declare const OutputText: Schema.Struct<{
|
|
116
101
|
readonly type: Schema.Literal<"output_text">;
|
|
117
102
|
readonly text: Schema.String;
|
|
@@ -154,14 +139,7 @@ declare const ContentBlock: Schema.Union<readonly [Schema.Struct<{
|
|
|
154
139
|
readonly text: Schema.String;
|
|
155
140
|
}>, Schema.Struct<{
|
|
156
141
|
readonly type: Schema.Literal<"input_image">;
|
|
157
|
-
readonly source: Schema.
|
|
158
|
-
readonly _tag: Schema.Literal<"url">;
|
|
159
|
-
readonly url: Schema.String;
|
|
160
|
-
}>, Schema.Struct<{
|
|
161
|
-
readonly _tag: Schema.Literal<"base64">;
|
|
162
|
-
readonly media_type: Schema.String;
|
|
163
|
-
readonly data: Schema.String;
|
|
164
|
-
}>]>;
|
|
142
|
+
readonly source: Schema.Schema<ImageSource>;
|
|
165
143
|
}>, Schema.Struct<{
|
|
166
144
|
readonly type: Schema.Literal<"output_text">;
|
|
167
145
|
readonly text: Schema.String;
|
|
@@ -201,14 +179,7 @@ declare const Message: Schema.Struct<{
|
|
|
201
179
|
readonly text: Schema.String;
|
|
202
180
|
}>, Schema.Struct<{
|
|
203
181
|
readonly type: Schema.Literal<"input_image">;
|
|
204
|
-
readonly source: Schema.
|
|
205
|
-
readonly _tag: Schema.Literal<"url">;
|
|
206
|
-
readonly url: Schema.String;
|
|
207
|
-
}>, Schema.Struct<{
|
|
208
|
-
readonly _tag: Schema.Literal<"base64">;
|
|
209
|
-
readonly media_type: Schema.String;
|
|
210
|
-
readonly data: Schema.String;
|
|
211
|
-
}>]>;
|
|
182
|
+
readonly source: Schema.Schema<ImageSource>;
|
|
212
183
|
}>, Schema.Struct<{
|
|
213
184
|
readonly type: Schema.Literal<"output_text">;
|
|
214
185
|
readonly text: Schema.String;
|
|
@@ -277,14 +248,7 @@ declare const Item: Schema.Union<readonly [Schema.Struct<{
|
|
|
277
248
|
readonly text: Schema.String;
|
|
278
249
|
}>, Schema.Struct<{
|
|
279
250
|
readonly type: Schema.Literal<"input_image">;
|
|
280
|
-
readonly source: Schema.
|
|
281
|
-
readonly _tag: Schema.Literal<"url">;
|
|
282
|
-
readonly url: Schema.String;
|
|
283
|
-
}>, Schema.Struct<{
|
|
284
|
-
readonly _tag: Schema.Literal<"base64">;
|
|
285
|
-
readonly media_type: Schema.String;
|
|
286
|
-
readonly data: Schema.String;
|
|
287
|
-
}>]>;
|
|
251
|
+
readonly source: Schema.Schema<ImageSource>;
|
|
288
252
|
}>, Schema.Struct<{
|
|
289
253
|
readonly type: Schema.Literal<"output_text">;
|
|
290
254
|
readonly text: Schema.String;
|
|
@@ -333,14 +297,102 @@ declare const Item: Schema.Union<readonly [Schema.Struct<{
|
|
|
333
297
|
readonly providerData: Schema.optional<Schema.Unknown>;
|
|
334
298
|
}>]>;
|
|
335
299
|
type Item = typeof Item.Type;
|
|
336
|
-
declare const isInputText: (
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
declare const
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
300
|
+
declare const isInputText: <I>(input: I) => input is I & {
|
|
301
|
+
readonly type: "input_text";
|
|
302
|
+
readonly text: string;
|
|
303
|
+
};
|
|
304
|
+
declare const isInputImage: <I>(input: I) => input is I & {
|
|
305
|
+
readonly type: "input_image";
|
|
306
|
+
readonly source: ImageSource;
|
|
307
|
+
};
|
|
308
|
+
declare const isOutputText: <I>(input: I) => input is I & {
|
|
309
|
+
readonly type: "output_text";
|
|
310
|
+
readonly text: string;
|
|
311
|
+
readonly annotations?: readonly ({
|
|
312
|
+
readonly type: "url_citation";
|
|
313
|
+
readonly url: string;
|
|
314
|
+
readonly start_index: number;
|
|
315
|
+
readonly end_index: number;
|
|
316
|
+
readonly title: string;
|
|
317
|
+
} | {
|
|
318
|
+
readonly type: "file_citation";
|
|
319
|
+
readonly file_id: string;
|
|
320
|
+
readonly index: number;
|
|
321
|
+
} | {
|
|
322
|
+
readonly type: "container_file_citation";
|
|
323
|
+
readonly start_index: number;
|
|
324
|
+
readonly end_index: number;
|
|
325
|
+
readonly file_id: string;
|
|
326
|
+
readonly container_id: string;
|
|
327
|
+
} | {
|
|
328
|
+
readonly type: "file_path";
|
|
329
|
+
readonly file_id: string;
|
|
330
|
+
readonly index: number;
|
|
331
|
+
})[] | undefined;
|
|
332
|
+
};
|
|
333
|
+
declare const isRefusal: <I>(input: I) => input is I & {
|
|
334
|
+
readonly type: "refusal";
|
|
335
|
+
readonly text: string;
|
|
336
|
+
};
|
|
337
|
+
declare const isMessage: <I>(input: I) => input is I & {
|
|
338
|
+
readonly type: "message";
|
|
339
|
+
readonly content: readonly ({
|
|
340
|
+
readonly type: "input_text";
|
|
341
|
+
readonly text: string;
|
|
342
|
+
} | {
|
|
343
|
+
readonly type: "input_image";
|
|
344
|
+
readonly source: ImageSource;
|
|
345
|
+
} | {
|
|
346
|
+
readonly type: "output_text";
|
|
347
|
+
readonly text: string;
|
|
348
|
+
readonly annotations?: readonly ({
|
|
349
|
+
readonly type: "url_citation";
|
|
350
|
+
readonly url: string;
|
|
351
|
+
readonly start_index: number;
|
|
352
|
+
readonly end_index: number;
|
|
353
|
+
readonly title: string;
|
|
354
|
+
} | {
|
|
355
|
+
readonly type: "file_citation";
|
|
356
|
+
readonly file_id: string;
|
|
357
|
+
readonly index: number;
|
|
358
|
+
} | {
|
|
359
|
+
readonly type: "container_file_citation";
|
|
360
|
+
readonly start_index: number;
|
|
361
|
+
readonly end_index: number;
|
|
362
|
+
readonly file_id: string;
|
|
363
|
+
readonly container_id: string;
|
|
364
|
+
} | {
|
|
365
|
+
readonly type: "file_path";
|
|
366
|
+
readonly file_id: string;
|
|
367
|
+
readonly index: number;
|
|
368
|
+
})[] | undefined;
|
|
369
|
+
} | {
|
|
370
|
+
readonly type: "refusal";
|
|
371
|
+
readonly text: string;
|
|
372
|
+
})[];
|
|
373
|
+
readonly role: "user" | "assistant" | "system";
|
|
374
|
+
readonly providerData?: unknown;
|
|
375
|
+
};
|
|
376
|
+
declare const isFunctionCall: <I>(input: I) => input is I & {
|
|
377
|
+
readonly type: "function_call";
|
|
378
|
+
readonly call_id: string;
|
|
379
|
+
readonly name: string;
|
|
380
|
+
readonly arguments: string;
|
|
381
|
+
readonly providerData?: unknown;
|
|
382
|
+
};
|
|
383
|
+
declare const isFunctionCallOutput: <I>(input: I) => input is I & {
|
|
384
|
+
readonly type: "function_call_output";
|
|
385
|
+
readonly call_id: string;
|
|
386
|
+
readonly output: string;
|
|
387
|
+
readonly providerData?: unknown;
|
|
388
|
+
};
|
|
389
|
+
declare const isReasoning: <I>(input: I) => input is I & {
|
|
390
|
+
readonly type: "reasoning";
|
|
391
|
+
readonly providerData?: unknown;
|
|
392
|
+
readonly id?: string | undefined;
|
|
393
|
+
readonly summary?: string | undefined;
|
|
394
|
+
readonly signature?: string | undefined;
|
|
395
|
+
};
|
|
344
396
|
declare const InputTokensDetails: Schema.Struct<{
|
|
345
397
|
readonly cached_tokens: Schema.optional<Schema.Number>;
|
|
346
398
|
}>;
|
|
@@ -368,5 +420,5 @@ declare const systemText: (text: string) => Message;
|
|
|
368
420
|
declare const assistantText: (text: string) => Message;
|
|
369
421
|
declare const functionCallOutput: (call_id: string, output: string) => FunctionCallOutput;
|
|
370
422
|
//#endregion
|
|
371
|
-
export {
|
|
372
|
-
//# sourceMappingURL=Items-
|
|
423
|
+
export { isInputText as A, functionCallOutput as C, isFunctionCall as D, isFilePath as E, isUrlCitation as F, systemText as I, userText as L, isOutputText as M, isReasoning as N, isFunctionCallOutput as O, isRefusal as P, assistantText as S, isFileCitation as T, Refusal as _, FilePath as a, UrlCitation as b, InputImage as c, Item as d, Items_d_exports as f, Reasoning as g, OutputTokensDetails as h, FileCitation as i, isMessage as j, isInputImage as k, InputText as l, OutputText as m, ContainerFileCitation as n, FunctionCall as o, Message as p, ContentBlock as r, FunctionCallOutput as s, Annotation as t, InputTokensDetails as u, Role as v, isContainerFileCitation as w, Usage as x, StopReason as y };
|
|
424
|
+
//# s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,KAAA,EAAA,CAAA,KAAA,KAAA,IAAA,CAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cACT,cAAA,MAAc,KAAA,EAAA,CAAA,KAAA,KAAA,IAAA,CAAA;EAAA;;;;;;cACd,oBAAA,MAAoB,KAAA,EAAA,CAAA,KAAA,KAAA,IAAA,CAAA;EAAA;;;;;cACpB,WAAA,MAAW,KAAA,EAAA,CAAA,KAAA,KAAA,IAAA,CAAA;EAAA;;;;;;cAMX,kBAAA,EAAkB,MAAA,CAAA,MAAA;EAAA;;KAGnB,kBAAA,UAA4B,kBAAA,CAAmB,IAAA;AAAA,cAE9C,mBAAA,EAAmB,MAAA,CAAA,MAAA;EAAA;;KAGpB,mBAAA,UAA6B,mBAAA,CAAoB,IAAA;AAAA,cAEhD,KAAA,EAAK,MAAA,CAAA,MAAA;EAAA;;;;;;;;;;KAON,KAAA,UAAe,KAAA,CAAM,IAAA;AAAA,cAEpB,UAAA,EAAU,MAAA,CAAA,QAAA;AAAA,KAUX,UAAA,UAAoB,UAAA,CAAW,IAAA;AAAA,cAM9B,QAAA,GAAY,IAAA,aAAe,OAAA;AAAA,cAM3B,UAAA,GAAc,IAAA,aAAe,OAAA;AAAA,cAM7B,aAAA,GAAiB,IAAA,aAAe,OAAA;AAAA,cAMhC,kBAAA,GAAsB,OAAA,UAAiB,MAAA,aAAiB,kBAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
declare namespace Media_d_exports {
|
|
2
|
+
export { MediaBase64, MediaBytes, MediaSource, MediaUrl, isMediaBase64, isMediaBytes, isMediaUrl };
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Cross-modality media reference shape.
|
|
6
|
+
*
|
|
7
|
+
* Every "media at rest" reference - image, audio, video, document - is one
|
|
8
|
+
* of three variants:
|
|
9
|
+
*
|
|
10
|
+
* - `url` : a remote address (HTTP, GCS, etc.). The model fetches it.
|
|
11
|
+
* `mimeType` is optional - servers usually set Content-Type.
|
|
12
|
+
* Some providers (Gemini `fileData`) want it explicit.
|
|
13
|
+
*
|
|
14
|
+
* - `base64` : an inline base64-encoded payload. Always carries a
|
|
15
|
+
* `mimeType` so the consumer knows how to decode.
|
|
16
|
+
*
|
|
17
|
+
* - `bytes` : raw `Uint8Array`. Provider layers normalize to base64 or
|
|
18
|
+
* multipart upload at the wire boundary - users don't need
|
|
19
|
+
* to encode themselves.
|
|
20
|
+
*
|
|
21
|
+
* Per-modality files (`Image.ts`, future `Audio.ts` / `Video.ts` /
|
|
22
|
+
* `Document.ts`) instantiate this shape with their typed MIME union to
|
|
23
|
+
* get autocomplete on common formats while keeping the structural type
|
|
24
|
+
* uniform across modalities.
|
|
25
|
+
*
|
|
26
|
+
* Streaming media (live mic feed, streaming TTS playback) is *not*
|
|
27
|
+
* modeled here. Streams carry effect parameters (`Stream<A, E, R>`) and
|
|
28
|
+
* lifecycle (Scope, cancellation) that don't apply to media at rest. The
|
|
29
|
+
* complementary type lives alongside this one as `*Stream` in each
|
|
30
|
+
* per-modality file when those modalities land.
|
|
31
|
+
*
|
|
32
|
+
* Provider-uploaded asset references (OpenAI Files `file_id`, Gemini
|
|
33
|
+
* Files API URIs, Anthropic file IDs) are also out of scope here -
|
|
34
|
+
* they're a separate union (`FileRef`) added when needed.
|
|
35
|
+
*/
|
|
36
|
+
type MediaUrl<M extends string = string> = {
|
|
37
|
+
readonly _tag: "url";
|
|
38
|
+
readonly url: string;
|
|
39
|
+
readonly mimeType?: M;
|
|
40
|
+
};
|
|
41
|
+
type MediaBase64<M extends string = string> = {
|
|
42
|
+
readonly _tag: "base64";
|
|
43
|
+
readonly base64: string;
|
|
44
|
+
readonly mimeType: M;
|
|
45
|
+
};
|
|
46
|
+
type MediaBytes<M extends string = string> = {
|
|
47
|
+
readonly _tag: "bytes";
|
|
48
|
+
readonly bytes: Uint8Array;
|
|
49
|
+
readonly mimeType: M;
|
|
50
|
+
};
|
|
51
|
+
type MediaSource<M extends string = string> = MediaUrl<M> | MediaBase64<M> | MediaBytes<M>;
|
|
52
|
+
declare const isMediaUrl: <M extends string>(s: MediaSource<M>) => s is MediaUrl<M>;
|
|
53
|
+
declare const isMediaBase64: <M extends string>(s: MediaSource<M>) => s is MediaBase64<M>;
|
|
54
|
+
declare const isMediaBytes: <M extends string>(s: MediaSource<M>) => s is MediaBytes<M>;
|
|
55
|
+
//#endregion
|
|
56
|
+
export { Media_d_exports as a, isMediaUrl as c, MediaUrl as i, MediaBytes as n, isMediaBase64 as o, MediaSource as r, isMediaBytes as s, MediaBase64 as t };
|
|
57
|
+
//# sourceMappingURL=Media-D_CpcM1Z.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Media-D_CpcM1Z.d.mts","names":[],"sources":["../src/domain/Media.ts"],"mappings":";;;;;;;;;;;;;;;AAiCA;;;;;;;;;;;AAMA;;;;;;;;;KANY,QAAA;EAAA,SACD,IAAA;EAAA,SACA,GAAA;EAAA,SACA,QAAA,GAAW,CAAA;AAAA;AAAA,KAGV,WAAA;EAAA,SACD,IAAA;EAAA,SACA,MAAA;EAAA,SACA,QAAA,EAAU,CAAA;AAAA;AAAA,KAGT,UAAA;EAAA,SACD,IAAA;EAAA,SACA,KAAA,EAAO,UAAA;EAAA,SACP,QAAA,EAAU,CAAA;AAAA;AAAA,KAGT,WAAA,8BAAyC,QAAA,CAAS,CAAA,IAAK,WAAA,CAAY,CAAA,IAAK,UAAA,CAAW,CAAA;AAAA,cAElF,UAAA,qBAAgC,CAAA,EAAG,WAAA,CAAY,CAAA,MAAK,CAAA,IAAK,QAAA,CAAS,CAAA;AAAA,cAGlE,aAAA,qBAAmC,CAAA,EAAG,WAAA,CAAY,CAAA,MAAK,CAAA,IAAK,WAAA,CAAY,CAAA;AAAA,cAGxE,YAAA,qBAAkC,CAAA,EAAG,WAAA,CAAY,CAAA,MAAK,CAAA,IAAK,UAAA,CAAW,CAAA"}
|
|
@@ -19,7 +19,7 @@ type StructuredSchema<Output = unknown> = StandardSchemaV1<unknown, Output> & St
|
|
|
19
19
|
* cross-validator schema with metadata providers need (name, description,
|
|
20
20
|
* strict-mode flag).
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
type StructuredFormat<A> = {
|
|
23
23
|
readonly name: string;
|
|
24
24
|
readonly description?: string;
|
|
25
25
|
readonly schema: StructuredSchema<A>;
|
|
@@ -28,12 +28,12 @@ interface StructuredFormat<A> {
|
|
|
28
28
|
* (constrained decoding); other providers ignore.
|
|
29
29
|
*/
|
|
30
30
|
readonly strict?: boolean;
|
|
31
|
-
}
|
|
31
|
+
};
|
|
32
32
|
/** A single path-scoped validation problem. Library-agnostic shape. */
|
|
33
|
-
|
|
33
|
+
type DecodeIssue = {
|
|
34
34
|
readonly path: ReadonlyArray<string | number>;
|
|
35
35
|
readonly message: string;
|
|
36
|
-
}
|
|
36
|
+
};
|
|
37
37
|
declare const StructuredDecodeError_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => _$effect_Cause0.YieldableError & {
|
|
38
38
|
readonly _tag: "StructuredDecodeError";
|
|
39
39
|
} & Readonly<A>;
|
|
@@ -85,4 +85,4 @@ declare const parseJson: <A>(format: StructuredFormat<A>) => (raw: string) => Ef
|
|
|
85
85
|
declare const decodeJsonLines: <A>(format: StructuredFormat<A>) => <E, R>(self: Stream.Stream<string, E, R>) => Stream.Stream<A, E | JsonParseError | StructuredDecodeError, R>;
|
|
86
86
|
//#endregion
|
|
87
87
|
export { StructuredFormat_d_exports as a, decodeJsonLines as c, StructuredFormat as i, fromEffectSchema as l, JsonParseError as n, StructuredSchema as o, StructuredDecodeError as r, decode as s, DecodeIssue as t, parseJson as u };
|
|
88
|
-
//# sourceMappingURL=StructuredFormat-
|
|
88
|
+
//# sourceMappingURL=StructuredFormat-BWq5Hd1O.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Structu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 @@
|
|
|
1
|
-
import { o as FunctionCall, s as FunctionCallOutput } from "./Items-
|
|
1
|
+
import { o as FunctionCall, s as FunctionCallOutput } from "./Items-CB8Bo3FI.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";
|
|
@@ -30,7 +30,7 @@ type ToolInputSchema<Input = unknown> = StandardSchemaV1<unknown, Input> & Stand
|
|
|
30
30
|
* can be used as a `Tool.inputSchema`.
|
|
31
31
|
*/
|
|
32
32
|
declare const fromEffectSchema: <S extends Schema.Codec<any, any, never, any>>(schema: S) => S & ToolInputSchema<S["Type"]>;
|
|
33
|
-
|
|
33
|
+
type Tool<Name extends string, Input, Output, R = never> = {
|
|
34
34
|
readonly name: Name;
|
|
35
35
|
readonly description: string;
|
|
36
36
|
readonly inputSchema: ToolInputSchema<Input>;
|
|
@@ -42,20 +42,20 @@ interface Tool<Name extends string, Input, Output, R = never> {
|
|
|
42
42
|
* compatible, the provider returns an error.
|
|
43
43
|
*/
|
|
44
44
|
readonly strict?: boolean;
|
|
45
|
-
}
|
|
45
|
+
};
|
|
46
46
|
/**
|
|
47
47
|
* Provider-agnostic tool descriptor. Each provider maps `inputSchema`
|
|
48
48
|
* to its own wire field (OpenAI → `parameters`, Anthropic →
|
|
49
49
|
* `input_schema`). Built from a `Tool` by `Toolkit.toDescriptors`.
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
type ToolDescriptor = {
|
|
52
52
|
readonly name: string;
|
|
53
53
|
readonly description: string;
|
|
54
54
|
readonly inputSchema: Record<string, unknown>;
|
|
55
55
|
readonly strict?: boolean;
|
|
56
|
-
}
|
|
56
|
+
};
|
|
57
57
|
declare const make: <Name extends string, Input, Output, R = never>(spec: Tool<Name, Input, Output, R>) => Tool<Name, Input, Output, R>;
|
|
58
|
-
|
|
58
|
+
type StreamingTool<Name extends string, Input, Event, Output, R = never> = {
|
|
59
59
|
readonly _kind: "streaming";
|
|
60
60
|
readonly name: Name;
|
|
61
61
|
readonly description: string;
|
|
@@ -63,18 +63,18 @@ interface StreamingTool<Name extends string, Input, Event, Output, R = never> {
|
|
|
63
63
|
readonly run: (input: Input) => Stream.Stream<Event, unknown, R>;
|
|
64
64
|
readonly finalize: (events: ReadonlyArray<Event>) => Output;
|
|
65
65
|
readonly strict?: boolean;
|
|
66
|
-
}
|
|
66
|
+
};
|
|
67
67
|
declare const streaming: <Name extends string, Input, Event, Output, R = never>(spec: Omit<StreamingTool<Name, Input, Event, Output, R>, "_kind">) => StreamingTool<Name, Input, Event, Output, R>;
|
|
68
|
-
type AnyStreamingTool = StreamingTool<string, any, any, any,
|
|
69
|
-
type AnyPlainTool = Tool<string, any, any,
|
|
70
|
-
type AnyKindTool = AnyStreamingTool | AnyPlainTool
|
|
71
|
-
declare const isStreamingTool: (t: AnyKindTool) => t is AnyStreamingTool
|
|
68
|
+
type AnyStreamingTool<R = any> = StreamingTool<string, any, any, any, R>;
|
|
69
|
+
type AnyPlainTool<R = any> = Tool<string, any, any, R>;
|
|
70
|
+
type AnyKindTool<R = any> = AnyStreamingTool<R> | AnyPlainTool<R>;
|
|
71
|
+
declare const isStreamingTool: <R>(t: AnyKindTool<R>) => t is AnyStreamingTool<R>;
|
|
72
72
|
/**
|
|
73
73
|
* Render any-kind tools (mixed plain and streaming) to provider-agnostic
|
|
74
74
|
* descriptors. Mirrors `Toolkit.toDescriptors` but accepts the union type
|
|
75
75
|
* so a single list can carry both kinds.
|
|
76
76
|
*/
|
|
77
|
-
declare const toDescriptors: (tools: ReadonlyArray<AnyKindTool
|
|
77
|
+
declare const toDescriptors: <R>(tools: ReadonlyArray<AnyKindTool<R>>) => ReadonlyArray<ToolDescriptor>;
|
|
78
78
|
/**
|
|
79
79
|
* Decode and validate the JSON arguments of a function_call against the
|
|
80
80
|
* tool's input schema, run the tool, and serialize the output into a
|
|
@@ -83,4 +83,4 @@ declare const toDescriptors: (tools: ReadonlyArray<AnyKindTool>) => ReadonlyArra
|
|
|
83
83
|
declare const execute: <Name extends string, Input, Output, R>(tool: Tool<Name, Input, Output, R>, call: FunctionCall) => Effect.Effect<FunctionCallOutput, ToolError, R>;
|
|
84
84
|
//#endregion
|
|
85
85
|
export { Tool as a, ToolInputSchema as c, fromEffectSchema as d, isStreamingTool as f, toDescriptors as h, StreamingTool as i, Tool_d_exports as l, streaming as m, AnyPlainTool as n, ToolDescriptor as o, make as p, AnyStreamingTool as r, ToolError as s, AnyKindTool as t, execute as u };
|
|
86
|
-
//# sourceMappingURL=Tool-
|
|
86
|
+
//# sourceMappingURL=Tool-DjVufH7i.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tool-DjVufH7i.d.mts","names":[],"sources":["../src/tool/Tool.ts"],"mappings":";;;;;;;;;cAE0E,cAAA;;;;;;cAG7D,SAAA,SAAkB,cAAA;;;;;;;;;;KAmBnB,eAAA,oBAAmC,gBAAA,UAA0B,KAAA,IACvE,oBAAA,UAA8B,KAAA;;;AAvB0C;;;cA8B7D,gBAAA,aAA8B,MAAA,CAAO,KAAA,wBAChD,MAAA,EAAQ,CAAA,KACP,CAAA,GAAI,eAAA,CAAgB,CAAA;AAAA,KAIX,IAAA;EAAA,SACD,IAAA,EAAM,IAAA;EAAA,SACN,WAAA;EAAA,SACA,WAAA,EAAa,eAAA,CAAgB,KAAA;EAAA,SAC7B,GAAA,GAAM,KAAA,EAAO,KAAA,KAAU,MAAA,CAAO,MAAA,CAAO,MAAA,WAAiB,CAAA;;;;;;;WAOtD,MAAA;AAAA;;;;;;KAQC,cAAA;EAAA,SACD,IAAA;EAAA,SACA,WAAA;EAAA,SACA,WAAA,EAAa,MAAA;EAAA,SACb,MAAA;AAAA;AAAA,cAGE,IAAA,kDACX,IAAA,EAAM,IAAA,CAAK,IAAA,EAAM,KAAA,EAAO,MAAA,EAAQ,CAAA,MAC/B,IAAA,CAA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FunctionCallOutput, x as Usage } from "./Items-CB8Bo3FI.mjs";
|
|
3
|
+
import { i as StructuredFormat, n as JsonParseError, r as StructuredDecodeError } from "./StructuredFormat-BWq5Hd1O.mjs";
|
|
3
4
|
import { Effect, Schema, Stream } from "effect";
|
|
4
5
|
import * as _$effect_Types0 from "effect/Types";
|
|
5
6
|
import * as _$effect_Cause0 from "effect/Cause";
|
|
@@ -22,14 +23,7 @@ declare const Turn: Schema.Struct<{
|
|
|
22
23
|
readonly text: Schema.String;
|
|
23
24
|
}>, Schema.Struct<{
|
|
24
25
|
readonly type: Schema.Literal<"input_image">;
|
|
25
|
-
readonly source: Schema.
|
|
26
|
-
readonly _tag: Schema.Literal<"url">;
|
|
27
|
-
readonly url: Schema.String;
|
|
28
|
-
}>, Schema.Struct<{
|
|
29
|
-
readonly _tag: Schema.Literal<"base64">;
|
|
30
|
-
readonly media_type: Schema.String;
|
|
31
|
-
readonly data: Schema.String;
|
|
32
|
-
}>]>;
|
|
26
|
+
readonly source: Schema.Schema<ImageSource>;
|
|
33
27
|
}>, Schema.Struct<{
|
|
34
28
|
readonly type: Schema.Literal<"output_text">;
|
|
35
29
|
readonly text: Schema.String;
|
|
@@ -197,4 +191,4 @@ declare class RefusalRejected extends RefusalRejected_base<{
|
|
|
197
191
|
declare const toStructured: <A>(turn: Turn, format: StructuredFormat<A>) => Effect.Effect<A, RefusalRejected | JsonParseError | StructuredDecodeError>;
|
|
198
192
|
//#endregion
|
|
199
193
|
export { Turn_d_exports as a, functionCalls as c, textDeltas as d, toStructured as f, TurnEvent as i, isTurnComplete as l, RefusalRejected as n, appendTurn as o, Turn as r, assistantMessages as s, InteractionEvent as t, reasonings as u };
|
|
200
|
-
//# sourceMappingURL=Turn-
|
|
194
|
+
//# sourceMappingURL=Turn-OPaILVIB.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Turn-OPaILVIB.d.mts","names":[],"sources":["../src/domain/Turn.ts"],"mappings":";;;;;;;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CAAA;AAAA,cAKzB,oBAAA;;;;;;;;cAWU,eAAA,SAAwB,oBAAA;EAAA,SAC1B,IAAA,EAAM,IAAA;AAAA;;;;;;;;;;;cAyBJ,YAAA,MACX,IAAA,EAAM,IAAA,EACN,MAAA,EAAQ,gBAAA,CAAkC,CAAA,MACzC,MAAA,CAAO,MAAA,CACR,CAAA,EACA,eAAA,GAAkB,cAAA,GAAkC,qBAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
//#region \0rolldown/runtime.js
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
3
4
|
var __exportAll = (all, no_symbols) => {
|
|
4
5
|
let target = {};
|
|
5
6
|
for (var name in all) __defProp(target, name, {
|
|
@@ -10,4 +11,4 @@ var __exportAll = (all, no_symbols) => {
|
|
|
10
11
|
return target;
|
|
11
12
|
};
|
|
12
13
|
//#endregion
|
|
13
|
-
export { __exportAll as t };
|
|
14
|
+
export { __exportAll as n, __commonJSMin as t };
|