@effect-uai/core 0.18.0 → 0.19.0-dev-20261109183959
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 +4 -4
- package/dist/Content-D_Qfn8Ja.d.mts +48 -0
- package/dist/Content-D_Qfn8Ja.d.mts.map +1 -0
- package/dist/File-B923KvZ9.d.mts +46 -0
- package/dist/File-B923KvZ9.d.mts.map +1 -0
- package/dist/{Image-Cv6iBLTy.d.mts → Image-Bzc1H_UK.d.mts} +19 -8
- package/dist/Image-Bzc1H_UK.d.mts.map +1 -0
- package/dist/{Items-C7MyrYPX.d.mts → Items-Bvx8s9QH.d.mts} +109 -16
- package/dist/Items-Bvx8s9QH.d.mts.map +1 -0
- package/dist/{Loop-ChpaO-ya.d.mts → Loop-CeA0AelN.d.mts} +7 -6
- package/dist/Loop-CeA0AelN.d.mts.map +1 -0
- package/dist/Tool-Bkryw6-h.d.mts +206 -0
- package/dist/Tool-Bkryw6-h.d.mts.map +1 -0
- package/dist/ToolEvent-9inLx5cI.d.mts +22 -0
- package/dist/ToolEvent-9inLx5cI.d.mts.map +1 -0
- package/dist/ToolOutput-BNTIQgGB.d.mts +151 -0
- package/dist/ToolOutput-BNTIQgGB.d.mts.map +1 -0
- package/dist/Toolkit-D2VGeD5R.d.mts +212 -0
- package/dist/Toolkit-D2VGeD5R.d.mts.map +1 -0
- package/dist/browser/BrowserTool.d.mts +84 -22
- package/dist/browser/BrowserTool.d.mts.map +1 -1
- package/dist/browser/BrowserTool.mjs +5 -0
- package/dist/browser/BrowserTool.mjs.map +1 -1
- package/dist/capabilities/Capabilities.d.mts +1 -1
- package/dist/decision-model/Decision.test.mjs +1 -1
- package/dist/{dist-C8RmtoR8.mjs → dist-B5K-y4Be.mjs} +51 -32
- package/dist/dist-B5K-y4Be.mjs.map +1 -0
- package/dist/domain/File.d.mts +2 -0
- package/dist/domain/File.mjs +51 -0
- package/dist/domain/File.mjs.map +1 -0
- package/dist/domain/Image.d.mts +2 -2
- package/dist/domain/Image.mjs +12 -2
- package/dist/domain/Image.mjs.map +1 -1
- package/dist/domain/Items.d.mts +2 -2
- package/dist/domain/Items.mjs +65 -4
- package/dist/domain/Items.mjs.map +1 -1
- package/dist/domain/Realtime.d.mts +72 -490
- package/dist/domain/Realtime.d.mts.map +1 -1
- package/dist/domain/Research.d.mts +1 -1
- package/dist/domain/Transcript.test.mjs +1 -1
- package/dist/domain/Turn.d.mts +57 -262
- package/dist/domain/Turn.d.mts.map +1 -1
- package/dist/domain/Turn.mjs +1 -1
- package/dist/embedding-model/Embedding.d.mts +1 -1
- package/dist/image-generator/ImageGenerator.d.mts +10 -66
- package/dist/image-generator/ImageGenerator.d.mts.map +1 -1
- package/dist/index.d.mts +10 -9
- package/dist/index.mjs +7 -6
- package/dist/language-model/LanguageModel.d.mts +2 -2
- package/dist/loop/Loop.d.mts +1 -1
- package/dist/loop/Loop.mjs.map +1 -1
- package/dist/messenger/Messenger.d.mts +43 -289
- package/dist/messenger/Messenger.d.mts.map +1 -1
- package/dist/messenger/MessengerAdapter.test.mjs +1 -1
- package/dist/observability/Metrics.d.mts +1 -1
- package/dist/observability/Metrics.test.mjs +1 -1
- package/dist/observability/Telemetry.test.mjs +1 -1
- package/dist/realtime/RealtimeSession.d.mts +1 -1
- package/dist/realtime/RealtimeSession.test.mjs +1 -1
- package/dist/sandbox/Sandbox.d.mts +32 -237
- package/dist/sandbox/Sandbox.d.mts.map +1 -1
- package/dist/streaming/Multipart.mjs +2 -1
- package/dist/streaming/Multipart.mjs.map +1 -1
- package/dist/streaming/Multipart.test.mjs +28 -0
- package/dist/streaming/Multipart.test.mjs.map +1 -0
- package/dist/streaming/Settle.test.mjs +1 -1
- package/dist/streaming/WebSocketSession.test.mjs +1 -1
- package/dist/testing/MockMessenger.d.mts +19 -134
- package/dist/testing/MockMessenger.d.mts.map +1 -1
- package/dist/testing/MockProvider.d.mts +1 -1
- package/dist/testing/MockSandbox.d.mts +65 -446
- package/dist/testing/MockSandbox.d.mts.map +1 -1
- package/dist/tool/Content.d.mts +2 -0
- package/dist/tool/Content.mjs +46 -0
- package/dist/tool/Content.mjs.map +1 -0
- package/dist/tool/Content.test.d.mts +1 -0
- package/dist/tool/Content.test.mjs +48 -0
- package/dist/tool/Content.test.mjs.map +1 -0
- package/dist/tool/HistoryCheck.d.mts +6 -15
- package/dist/tool/HistoryCheck.d.mts.map +1 -1
- package/dist/tool/HistoryCheck.mjs +10 -24
- package/dist/tool/HistoryCheck.mjs.map +1 -1
- package/dist/tool/Tool.d.mts +2 -2
- package/dist/tool/Tool.mjs +55 -130
- package/dist/tool/Tool.mjs.map +1 -1
- package/dist/tool/Tool.test.mjs +220 -176
- package/dist/tool/Tool.test.mjs.map +1 -1
- package/dist/tool/ToolDecision.d.mts +164 -0
- package/dist/tool/ToolDecision.d.mts.map +1 -0
- package/dist/tool/ToolDecision.mjs +146 -0
- package/dist/tool/ToolDecision.mjs.map +1 -0
- package/dist/tool/ToolDecision.test.d.mts +1 -0
- package/dist/tool/ToolDecision.test.mjs +330 -0
- package/dist/tool/ToolDecision.test.mjs.map +1 -0
- package/dist/tool/ToolEvent.d.mts +2 -2
- package/dist/tool/ToolEvent.mjs +2 -34
- package/dist/tool/ToolEvent.mjs.map +1 -1
- package/dist/tool/ToolOutput.d.mts +2 -0
- package/dist/tool/ToolOutput.mjs +128 -0
- package/dist/tool/ToolOutput.mjs.map +1 -0
- package/dist/tool/ToolOutput.test.d.mts +1 -0
- package/dist/tool/ToolOutput.test.mjs +153 -0
- package/dist/tool/ToolOutput.test.mjs.map +1 -0
- package/dist/tool/Toolkit.d.mts +2 -2
- package/dist/tool/Toolkit.mjs +230 -165
- package/dist/tool/Toolkit.mjs.map +1 -1
- package/dist/tool/Toolkit.test.mjs +431 -389
- package/dist/tool/Toolkit.test.mjs.map +1 -1
- package/dist/web-read/WebReadTool.d.mts +2 -2
- package/dist/web-read/WebReadTool.mjs +1 -0
- package/dist/web-read/WebReadTool.mjs.map +1 -1
- package/dist/web-search/WebSearchTool.d.mts +2 -2
- package/dist/web-search/WebSearchTool.mjs +1 -0
- package/dist/web-search/WebSearchTool.mjs.map +1 -1
- package/package.json +17 -9
- package/src/browser/BrowserTool.ts +5 -0
- package/src/domain/File.ts +79 -0
- package/src/domain/Image.ts +14 -4
- package/src/domain/Items.ts +39 -3
- package/src/index.ts +3 -2
- package/src/loop/Loop.ts +24 -13
- package/src/streaming/Multipart.test.ts +26 -0
- package/src/streaming/Multipart.ts +5 -4
- package/src/tool/Content.test.ts +40 -0
- package/src/tool/Content.ts +38 -0
- package/src/tool/HistoryCheck.ts +21 -26
- package/src/tool/Tool.test.ts +240 -241
- package/src/tool/Tool.ts +203 -308
- package/src/tool/ToolDecision.test.ts +301 -0
- package/src/tool/ToolDecision.ts +360 -0
- package/src/tool/ToolEvent.ts +21 -41
- package/src/tool/ToolOutput.test.ts +132 -0
- package/src/tool/ToolOutput.ts +198 -0
- package/src/tool/Toolkit.test.ts +594 -454
- package/src/tool/Toolkit.ts +631 -356
- package/src/web-read/WebReadTool.ts +2 -1
- package/src/web-search/WebSearchTool.ts +2 -1
- package/dist/Image-Cv6iBLTy.d.mts.map +0 -1
- package/dist/Items-C7MyrYPX.d.mts.map +0 -1
- package/dist/Loop-ChpaO-ya.d.mts.map +0 -1
- package/dist/Tool-BF78QWtn.d.mts +0 -314
- package/dist/Tool-BF78QWtn.d.mts.map +0 -1
- package/dist/ToolEvent-Di4a723B.d.mts +0 -144
- package/dist/ToolEvent-Di4a723B.d.mts.map +0 -1
- package/dist/ToolResult-BsYQRjmW.d.mts +0 -152
- package/dist/ToolResult-BsYQRjmW.d.mts.map +0 -1
- package/dist/Toolkit-tlL0F2YR.d.mts +0 -193
- package/dist/Toolkit-tlL0F2YR.d.mts.map +0 -1
- package/dist/dist-C8RmtoR8.mjs.map +0 -1
- package/dist/tool/Approval.d.mts +0 -113
- package/dist/tool/Approval.d.mts.map +0 -1
- package/dist/tool/Approval.mjs +0 -80
- package/dist/tool/Approval.mjs.map +0 -1
- package/dist/tool/Approval.test.mjs +0 -371
- package/dist/tool/Approval.test.mjs.map +0 -1
- package/dist/tool/ToolResult.d.mts +0 -2
- package/dist/tool/ToolResult.mjs +0 -85
- package/dist/tool/ToolResult.mjs.map +0 -1
- package/src/tool/Approval.test.ts +0 -400
- package/src/tool/Approval.ts +0 -181
- package/src/tool/ToolResult.ts +0 -114
- /package/dist/{tool/Approval.test.d.mts → streaming/Multipart.test.d.mts} +0 -0
package/dist/domain/Items.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { Annotation, ContainerFileCitation, ContentBlock, FileCitation, FilePath, HistoryItem, InputImage, InputText, InputTokensDetails, Message, OutputImage, OutputText, OutputTokensDetails, Reasoning, Refusal, Role, StopReason, ToolCall, ToolCallOutput, UrlCitation, Usage, assistantText, isContainerFileCitation, isFileCitation, isFilePath, isInputImage, isInputText, isMessage, isOutputImage, isOutputText, isReasoning, isRefusal, isToolCall, isToolCallOutput, isUrlCitation, systemText, toolCallOutput, userText };
|
|
1
|
+
import { A as isFileCitation, B as isRefusal, C as ToolOutputContent, D as file, E as assistantText, F as isInputText, G as systemText, H as isToolCallOutput, I as isMessage, J as userText, K as text, L as isOutputImage, M as isInputFile, N as isInputImage, O as image, P as isInputJson, R as isOutputText, S as ToolCallOutput, T as Usage, U as isUrlCitation, V as isToolCall, W as json, _ as Reasoning, a as FilePath, b as StopReason, c as InputImage, d as InputTokensDetails, g as OutputTokensDetails, h as OutputText, i as FileCitation, j as isFilePath, k as isContainerFileCitation, l as InputJson, m as OutputImage, n as ContainerFileCitation, o as HistoryItem, p as Message, q as toolCallOutput, r as ContentBlock, s as InputFile, t as Annotation, u as InputText, v as Refusal, w as UrlCitation, x as ToolCall, y as Role, z as isReasoning } from "../Items-Bvx8s9QH.mjs";
|
|
2
|
+
export { Annotation, ContainerFileCitation, ContentBlock, FileCitation, FilePath, HistoryItem, InputFile, InputImage, InputJson, InputText, InputTokensDetails, Message, OutputImage, OutputText, OutputTokensDetails, Reasoning, Refusal, Role, StopReason, ToolCall, ToolCallOutput, ToolOutputContent, UrlCitation, Usage, assistantText, file, image, isContainerFileCitation, isFileCitation, isFilePath, isInputFile, isInputImage, isInputJson, isInputText, isMessage, isOutputImage, isOutputText, isReasoning, isRefusal, isToolCall, isToolCallOutput, isUrlCitation, json, systemText, text, toolCallOutput, userText };
|
package/dist/domain/Items.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { n as __exportAll } from "../rolldown-runtime-EAsCxrDo.mjs";
|
|
2
|
+
import { FileSource } from "./File.mjs";
|
|
2
3
|
import { ImageSource } from "./Image.mjs";
|
|
3
4
|
import { Schema } from "effect";
|
|
4
5
|
//#region src/domain/Items.ts
|
|
@@ -9,7 +10,9 @@ var Items_exports = /* @__PURE__ */ __exportAll({
|
|
|
9
10
|
FileCitation: () => FileCitation,
|
|
10
11
|
FilePath: () => FilePath,
|
|
11
12
|
HistoryItem: () => HistoryItem,
|
|
13
|
+
InputFile: () => InputFile,
|
|
12
14
|
InputImage: () => InputImage,
|
|
15
|
+
InputJson: () => InputJson,
|
|
13
16
|
InputText: () => InputText,
|
|
14
17
|
InputTokensDetails: () => InputTokensDetails,
|
|
15
18
|
Message: () => Message,
|
|
@@ -22,13 +25,18 @@ var Items_exports = /* @__PURE__ */ __exportAll({
|
|
|
22
25
|
StopReason: () => StopReason,
|
|
23
26
|
ToolCall: () => ToolCall,
|
|
24
27
|
ToolCallOutput: () => ToolCallOutput,
|
|
28
|
+
ToolOutputContent: () => ToolOutputContent,
|
|
25
29
|
UrlCitation: () => UrlCitation,
|
|
26
30
|
Usage: () => Usage,
|
|
27
31
|
assistantText: () => assistantText,
|
|
32
|
+
file: () => file,
|
|
33
|
+
image: () => image,
|
|
28
34
|
isContainerFileCitation: () => isContainerFileCitation,
|
|
29
35
|
isFileCitation: () => isFileCitation,
|
|
30
36
|
isFilePath: () => isFilePath,
|
|
37
|
+
isInputFile: () => isInputFile,
|
|
31
38
|
isInputImage: () => isInputImage,
|
|
39
|
+
isInputJson: () => isInputJson,
|
|
32
40
|
isInputText: () => isInputText,
|
|
33
41
|
isMessage: () => isMessage,
|
|
34
42
|
isOutputImage: () => isOutputImage,
|
|
@@ -38,7 +46,9 @@ var Items_exports = /* @__PURE__ */ __exportAll({
|
|
|
38
46
|
isToolCall: () => isToolCall,
|
|
39
47
|
isToolCallOutput: () => isToolCallOutput,
|
|
40
48
|
isUrlCitation: () => isUrlCitation,
|
|
49
|
+
json: () => json,
|
|
41
50
|
systemText: () => systemText,
|
|
51
|
+
text: () => text,
|
|
42
52
|
toolCallOutput: () => toolCallOutput,
|
|
43
53
|
userText: () => userText
|
|
44
54
|
});
|
|
@@ -59,6 +69,18 @@ const InputImage = Schema.Struct({
|
|
|
59
69
|
source: ImageSource
|
|
60
70
|
});
|
|
61
71
|
/**
|
|
72
|
+
* User-provided file: a document (PDF, text, docx), audio or video. The
|
|
73
|
+
* `source` MIME type says which; provider codecs map it to their own file
|
|
74
|
+
* part, and a provider that cannot read a type rejects the request.
|
|
75
|
+
*
|
|
76
|
+
* Not in `ContentBlock` yet: it joins once every provider codec encodes it.
|
|
77
|
+
*/
|
|
78
|
+
const InputFile = Schema.Struct({
|
|
79
|
+
type: Schema.Literal("input_file"),
|
|
80
|
+
source: FileSource,
|
|
81
|
+
filename: Schema.optionalKey(Schema.String)
|
|
82
|
+
});
|
|
83
|
+
/**
|
|
62
84
|
* A cited source. `url` + `title` are the only near-universal fields; the
|
|
63
85
|
* link from a source to the answer text varies by provider, so it is optional
|
|
64
86
|
* and expressed three ways: `start_index`/`end_index` (a character span into
|
|
@@ -157,10 +179,23 @@ const ToolCall = Schema.Struct({
|
|
|
157
179
|
arguments: Schema.String,
|
|
158
180
|
providerData: ProviderData
|
|
159
181
|
});
|
|
182
|
+
/** A JSON value in a tool output. Kept as a value; provider codecs serialize it. */
|
|
183
|
+
const InputJson = Schema.Struct({
|
|
184
|
+
type: Schema.Literal("input_json"),
|
|
185
|
+
value: Schema.Json
|
|
186
|
+
});
|
|
187
|
+
const ToolOutputContent = Schema.Union([
|
|
188
|
+
InputText,
|
|
189
|
+
InputJson,
|
|
190
|
+
InputImage,
|
|
191
|
+
InputFile
|
|
192
|
+
]);
|
|
160
193
|
const ToolCallOutput = Schema.Struct({
|
|
161
194
|
type: Schema.Literal("function_call_output"),
|
|
162
195
|
call_id: Schema.String,
|
|
163
|
-
output: Schema.
|
|
196
|
+
output: Schema.Array(ToolOutputContent),
|
|
197
|
+
/** The call failed. Native on some providers; others only see the content. */
|
|
198
|
+
isError: Schema.optionalKey(Schema.Boolean),
|
|
164
199
|
providerData: ProviderData
|
|
165
200
|
});
|
|
166
201
|
/**
|
|
@@ -184,6 +219,8 @@ const HistoryItem = Schema.Union([
|
|
|
184
219
|
]);
|
|
185
220
|
const isInputText = Schema.is(InputText);
|
|
186
221
|
const isInputImage = Schema.is(InputImage);
|
|
222
|
+
const isInputFile = Schema.is(InputFile);
|
|
223
|
+
const isInputJson = Schema.is(InputJson);
|
|
187
224
|
const isOutputText = Schema.is(OutputText);
|
|
188
225
|
const isOutputImage = Schema.is(OutputImage);
|
|
189
226
|
const isRefusal = Schema.is(Refusal);
|
|
@@ -246,12 +283,36 @@ const assistantText = (text) => ({
|
|
|
246
283
|
text
|
|
247
284
|
}]
|
|
248
285
|
});
|
|
249
|
-
|
|
286
|
+
/** A tool output with one text part. */
|
|
287
|
+
const toolCallOutput = (call_id, text) => ({
|
|
250
288
|
type: "function_call_output",
|
|
251
289
|
call_id,
|
|
252
|
-
output
|
|
290
|
+
output: [{
|
|
291
|
+
type: "input_text",
|
|
292
|
+
text
|
|
293
|
+
}]
|
|
294
|
+
});
|
|
295
|
+
const text = (text) => ({
|
|
296
|
+
type: "input_text",
|
|
297
|
+
text
|
|
298
|
+
});
|
|
299
|
+
const json = (value) => ({
|
|
300
|
+
type: "input_json",
|
|
301
|
+
value
|
|
302
|
+
});
|
|
303
|
+
const image = (source) => ({
|
|
304
|
+
type: "input_image",
|
|
305
|
+
source
|
|
253
306
|
});
|
|
307
|
+
const file = (source, filename) => filename === void 0 ? {
|
|
308
|
+
type: "input_file",
|
|
309
|
+
source
|
|
310
|
+
} : {
|
|
311
|
+
type: "input_file",
|
|
312
|
+
source,
|
|
313
|
+
filename
|
|
314
|
+
};
|
|
254
315
|
//#endregion
|
|
255
|
-
export { Annotation, ContainerFileCitation, ContentBlock, FileCitation, FilePath, HistoryItem, InputImage, InputText, InputTokensDetails, Message, OutputImage, OutputText, OutputTokensDetails, Reasoning, Refusal, Role, StopReason, ToolCall, ToolCallOutput, UrlCitation, Usage, assistantText, isContainerFileCitation, isFileCitation, isFilePath, isInputImage, isInputText, isMessage, isOutputImage, isOutputText, isReasoning, isRefusal, isToolCall, isToolCallOutput, isUrlCitation, systemText, Items_exports as t, toolCallOutput, userText };
|
|
316
|
+
export { Annotation, ContainerFileCitation, ContentBlock, FileCitation, FilePath, HistoryItem, InputFile, InputImage, InputJson, InputText, InputTokensDetails, Message, OutputImage, OutputText, OutputTokensDetails, Reasoning, Refusal, Role, StopReason, ToolCall, ToolCallOutput, ToolOutputContent, UrlCitation, Usage, assistantText, file, image, isContainerFileCitation, isFileCitation, isFilePath, isInputFile, isInputImage, isInputJson, isInputText, isMessage, isOutputImage, isOutputText, isReasoning, isRefusal, isToolCall, isToolCallOutput, isUrlCitation, json, systemText, Items_exports as t, text, toolCallOutput, userText };
|
|
256
317
|
|
|
257
318
|
//# sourceMappingURL=Items.mjs.map
|
|
@@ -1 +1 @@
|
|
|
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// Provider-agnostic: each provider populates the fields it has (character\n// span, quote, or positional marker) and omits the rest.\n// ---------------------------------------------------------------------------\n\n/**\n * A cited source. `url` + `title` are the only near-universal fields; the\n * link from a source to the answer text varies by provider, so it is optional\n * and expressed three ways: `start_index`/`end_index` (a character span into\n * the answer), `cited_text` (an exact quote of the source, when no offsets are\n * given), or `marker` (a positional `[n]` reference into an ordered list). A\n * provider populates whichever it has; a bare source list sets none.\n */\nexport const UrlCitation = Schema.Struct({\n type: Schema.Literal(\"url_citation\"),\n url: Schema.String,\n title: Schema.String,\n start_index: Schema.optional(Schema.Number),\n end_index: Schema.optional(Schema.Number),\n cited_text: Schema.optional(Schema.String),\n marker: Schema.optional(Schema.Number),\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 image. The counterpart to {@link InputImage}: same\n * `ImageSource`, so an image the model drew goes straight back into the\n * next turn with no conversion.\n *\n * How the pixels were produced is not modelled here. A provider may draw\n * them itself, as an image part of the turn, or reach a hosted tool that\n * draws them; either way the fact is the same, and enabling it is\n * provider-specific.\n */\nexport const OutputImage = Schema.Struct({\n type: Schema.Literal(\"output_image\"),\n source: ImageSource,\n})\nexport type OutputImage = typeof OutputImage.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 * `RefusalDelta` `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, OutputImage, 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// The slot is shared, so a provider keys its data under its own name\n// (`{ responses: ... }`, `{ gemini: ... }`) and reads only that key. One item\n// can pass through several providers - falling back from one to another\n// leaves both keys on it - and a provider that finds no key of its own must\n// encode the item normally rather than assume the slot is its own.\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 ToolCall = 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 ToolCall = typeof ToolCall.Type\n\nexport const ToolCallOutput = Schema.Struct({\n type: Schema.Literal(\"function_call_output\"),\n call_id: Schema.String,\n output: Schema.String,\n providerData: ProviderData,\n})\nexport type ToolCallOutput = typeof ToolCallOutput.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 HistoryItem = Schema.Union([Message, ToolCall, ToolCallOutput, Reasoning])\nexport type HistoryItem = typeof HistoryItem.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 isOutputImage = Schema.is(OutputImage)\nexport const isRefusal = Schema.is(Refusal)\n\nexport const isMessage = Schema.is(Message)\nexport const isToolCall = Schema.is(ToolCall)\nexport const isToolCallOutput = Schema.is(ToolCallOutput)\nexport const isReasoning = Schema.is(Reasoning)\n\n// ---------------------------------------------------------------------------\n// Usage and stop reason\n// ---------------------------------------------------------------------------\n\n/**\n * Prompt-cache token breakdown. `cached_tokens` is cache reads;\n * `cache_write_tokens` is tokens written to the cache this turn (billed at a\n * premium). Field names mirror the OpenAI Responses usage shape.\n *\n * Whether these are a subset of `input_tokens` or a separate bucket is\n * provider-specific: OpenAI counts cache reads inside `input_tokens`, while\n * Anthropic reports `input_tokens` as post-breakpoint tokens only, with reads\n * and writes as separate additive buckets. Read a provider's usage in its own\n * terms; do not assume one relationship holds everywhere.\n */\nexport const InputTokensDetails = Schema.Struct({\n cached_tokens: Schema.optional(Schema.Number),\n cache_write_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 toolCallOutput = (call_id: string, output: string): ToolCallOutput => ({\n type: \"function_call_output\",\n call_id,\n output,\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;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O,GAAG,OAAO;AAC1C,MAAa,aAAa,OAAO,GAAG,QAAQ;AAC5C,MAAa,mBAAmB,OAAO,GAAG,cAAc;AACxD,MAAa,cAAc,OAAO,GAAG,SAAS;;;;;;;;;;;;AAiB9C,MAAa,qBAAqB,OAAO,OAAO;CAC9C,eAAe,OAAO,SAAS,OAAO,MAAM;CAC5C,oBAAoB,OAAO,SAAS,OAAO,MAAM;AACnD,CAAC;AAGD,MAAa,sBAAsB,OAAO,OAAO,EAC/C,kBAAkB,OAAO,SAAS,OAAO,MAAM,EACjD,CAAC;AAGD,MAAa,QAAQ,OAAO,OAAO;CACjC,cAAc,OAAO,SAAS,OAAO,MAAM;CAC3C,eAAe,OAAO,SAAS,OAAO,MAAM;CAC5C,cAAc,OAAO,SAAS,OAAO,MAAM;CAC3C,sBAAsB,OAAO,SAAS,kBAAkB;CACxD,uBAAuB,OAAO,SAAS,mBAAmB;AAC5D,CAAC;AAGD,MAAa,aAAa,OAAO,SAAS;CACxC;CACA;CACA;CACA;CAEA;CAEA;AACF,CAAC;AAOD,MAAa,YAAY,UAA2B;CAClD,MAAM;CACN,MAAM;CACN,SAAS,CAAC;EAAE,MAAM;EAAc;CAAK,CAAC;AACxC;AAEA,MAAa,cAAc,UAA2B;CACpD,MAAM;CACN,MAAM;CACN,SAAS,CAAC;EAAE,MAAM;EAAc;CAAK,CAAC;AACxC;AAEA,MAAa,iBAAiB,UAA2B;CACvD,MAAM;CACN,MAAM;CACN,SAAS,CAAC;EAAE,MAAM;EAAe;CAAK,CAAC;AACzC;AAEA,MAAa,kBAAkB,SAAiB,YAAoC;CAClF,MAAM;CACN;CACA;AACF"}
|
|
1
|
+
{"version":3,"file":"Items.mjs","names":[],"sources":["../../src/domain/Items.ts"],"sourcesContent":["import { Schema } from \"effect\"\nimport { FileSource } from \"./File.js\"\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 * User-provided file: a document (PDF, text, docx), audio or video. The\n * `source` MIME type says which; provider codecs map it to their own file\n * part, and a provider that cannot read a type rejects the request.\n *\n * Not in `ContentBlock` yet: it joins once every provider codec encodes it.\n */\nexport const InputFile = Schema.Struct({\n type: Schema.Literal(\"input_file\"),\n source: FileSource,\n filename: Schema.optionalKey(Schema.String),\n})\nexport type InputFile = typeof InputFile.Type\n\n// ---------------------------------------------------------------------------\n// Annotations - source / citation pointers attached to `output_text` blocks.\n// Provider-agnostic: each provider populates the fields it has (character\n// span, quote, or positional marker) and omits the rest.\n// ---------------------------------------------------------------------------\n\n/**\n * A cited source. `url` + `title` are the only near-universal fields; the\n * link from a source to the answer text varies by provider, so it is optional\n * and expressed three ways: `start_index`/`end_index` (a character span into\n * the answer), `cited_text` (an exact quote of the source, when no offsets are\n * given), or `marker` (a positional `[n]` reference into an ordered list). A\n * provider populates whichever it has; a bare source list sets none.\n */\nexport const UrlCitation = Schema.Struct({\n type: Schema.Literal(\"url_citation\"),\n url: Schema.String,\n title: Schema.String,\n start_index: Schema.optional(Schema.Number),\n end_index: Schema.optional(Schema.Number),\n cited_text: Schema.optional(Schema.String),\n marker: Schema.optional(Schema.Number),\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 image. The counterpart to {@link InputImage}: same\n * `ImageSource`, so an image the model drew goes straight back into the\n * next turn with no conversion.\n *\n * How the pixels were produced is not modelled here. A provider may draw\n * them itself, as an image part of the turn, or reach a hosted tool that\n * draws them; either way the fact is the same, and enabling it is\n * provider-specific.\n */\nexport const OutputImage = Schema.Struct({\n type: Schema.Literal(\"output_image\"),\n source: ImageSource,\n})\nexport type OutputImage = typeof OutputImage.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 * `RefusalDelta` `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, OutputImage, 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// The slot is shared, so a provider keys its data under its own name\n// (`{ responses: ... }`, `{ gemini: ... }`) and reads only that key. One item\n// can pass through several providers - falling back from one to another\n// leaves both keys on it - and a provider that finds no key of its own must\n// encode the item normally rather than assume the slot is its own.\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 ToolCall = 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 ToolCall = typeof ToolCall.Type\n\n/** A JSON value in a tool output. Kept as a value; provider codecs serialize it. */\nexport const InputJson = Schema.Struct({\n type: Schema.Literal(\"input_json\"),\n value: Schema.Json,\n})\nexport type InputJson = typeof InputJson.Type\n\nexport const ToolOutputContent = Schema.Union([InputText, InputJson, InputImage, InputFile])\nexport type ToolOutputContent = typeof ToolOutputContent.Type\n\nexport const ToolCallOutput = Schema.Struct({\n type: Schema.Literal(\"function_call_output\"),\n call_id: Schema.String,\n output: Schema.Array(ToolOutputContent),\n /** The call failed. Native on some providers; others only see the content. */\n isError: Schema.optionalKey(Schema.Boolean),\n providerData: ProviderData,\n})\nexport type ToolCallOutput = typeof ToolCallOutput.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 HistoryItem = Schema.Union([Message, ToolCall, ToolCallOutput, Reasoning])\nexport type HistoryItem = typeof HistoryItem.Type\n\n// ---------------------------------------------------------------------------\n// Type guards\n// ---------------------------------------------------------------------------\n\nexport const isInputText = Schema.is(InputText)\nexport const isInputImage = Schema.is(InputImage)\nexport const isInputFile = Schema.is(InputFile)\nexport const isInputJson = Schema.is(InputJson)\nexport const isOutputText = Schema.is(OutputText)\nexport const isOutputImage = Schema.is(OutputImage)\nexport const isRefusal = Schema.is(Refusal)\n\nexport const isMessage = Schema.is(Message)\nexport const isToolCall = Schema.is(ToolCall)\nexport const isToolCallOutput = Schema.is(ToolCallOutput)\nexport const isReasoning = Schema.is(Reasoning)\n\n// ---------------------------------------------------------------------------\n// Usage and stop reason\n// ---------------------------------------------------------------------------\n\n/**\n * Prompt-cache token breakdown. `cached_tokens` is cache reads;\n * `cache_write_tokens` is tokens written to the cache this turn (billed at a\n * premium). Field names mirror the OpenAI Responses usage shape.\n *\n * Whether these are a subset of `input_tokens` or a separate bucket is\n * provider-specific: OpenAI counts cache reads inside `input_tokens`, while\n * Anthropic reports `input_tokens` as post-breakpoint tokens only, with reads\n * and writes as separate additive buckets. Read a provider's usage in its own\n * terms; do not assume one relationship holds everywhere.\n */\nexport const InputTokensDetails = Schema.Struct({\n cached_tokens: Schema.optional(Schema.Number),\n cache_write_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\n/** A tool output with one text part. */\nexport const toolCallOutput = (call_id: string, text: string): ToolCallOutput => ({\n type: \"function_call_output\",\n call_id,\n output: [{ type: \"input_text\", text }],\n})\n\nexport const text = (text: string): InputText => ({ type: \"input_text\", text })\nexport const json = (value: Schema.Json): InputJson => ({ type: \"input_json\", value })\nexport const image = (source: ImageSource): InputImage => ({ type: \"input_image\", source })\nexport const file = (source: FileSource, filename?: string): InputFile =>\n filename === undefined ? { type: \"input_file\", source } : { type: \"input_file\", source, filename }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAa,YAAY,OAAO,OAAO;CACrC,MAAM,OAAO,QAAQ,YAAY;CACjC,MAAM,OAAO;AACf,CAAC;;;;;;;;;AAWD,MAAa,aAAa,OAAO,OAAO;CACtC,MAAM,OAAO,QAAQ,aAAa;CAClC,QAAQ;AACV,CAAC;;;;;;;;AAUD,MAAa,YAAY,OAAO,OAAO;CACrC,MAAM,OAAO,QAAQ,YAAY;CACjC,QAAQ;CACR,UAAU,OAAO,YAAY,OAAO,MAAM;AAC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