@effect-uai/core 0.10.0 → 0.11.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/dist/{Image-BZmKfIdq.d.mts → Image-C4vuBmu0.d.mts} +11 -11
- package/dist/{Image-BZmKfIdq.d.mts.map → Image-C4vuBmu0.d.mts.map} +1 -1
- package/dist/{Items-BnIduEV2.d.mts → Items-BWNu6VGp.d.mts} +116 -90
- package/dist/Items-BWNu6VGp.d.mts.map +1 -0
- package/dist/{Tool-2lC_XMth.d.mts → Tool-CXFHCQrT.d.mts} +42 -9
- package/dist/Tool-CXFHCQrT.d.mts.map +1 -0
- package/dist/{ToolEvent-cWZ2BnbS.d.mts → ToolEvent-nVijCrvm.d.mts} +2 -2
- package/dist/{ToolEvent-cWZ2BnbS.d.mts.map → ToolEvent-nVijCrvm.d.mts.map} +1 -1
- package/dist/{ToolResult-CL4hK_9z.d.mts → ToolResult-CQqKkcDa.d.mts} +2 -2
- package/dist/{ToolResult-CL4hK_9z.d.mts.map → ToolResult-CQqKkcDa.d.mts.map} +1 -1
- package/dist/{Toolkit-Dr9l_hNy.d.mts → Toolkit-BYPwwu-j.d.mts} +6 -6
- package/dist/Toolkit-BYPwwu-j.d.mts.map +1 -0
- package/dist/browser/Browser.mjs +4 -4
- package/dist/browser/Browser.mjs.map +1 -1
- package/dist/browser/BrowserTool.d.mts +34 -33
- package/dist/browser/BrowserTool.d.mts.map +1 -1
- package/dist/{dist-DWgRbDN3.mjs → dist-C0m0QnUP.mjs} +71 -30
- package/dist/dist-C0m0QnUP.mjs.map +1 -0
- package/dist/{dist-B04dlFHg.mjs → dist-CcRV3-A5.mjs} +8 -8
- package/dist/{dist-B04dlFHg.mjs.map → dist-CcRV3-A5.mjs.map} +1 -1
- package/dist/domain/Citation.d.mts +60 -0
- package/dist/domain/Citation.d.mts.map +1 -0
- package/dist/domain/Citation.mjs +7 -0
- package/dist/domain/Citation.mjs.map +1 -0
- package/dist/domain/Image.d.mts +1 -1
- package/dist/domain/Items.d.mts +1 -1
- package/dist/domain/Items.mjs +13 -3
- package/dist/domain/Items.mjs.map +1 -1
- package/dist/domain/Research.d.mts +37 -0
- package/dist/domain/Research.d.mts.map +1 -0
- package/dist/domain/Research.mjs +7 -0
- package/dist/domain/Research.mjs.map +1 -0
- package/dist/domain/Turn.d.mts +91 -9
- package/dist/domain/Turn.d.mts.map +1 -1
- package/dist/domain/Turn.mjs +8 -1
- package/dist/domain/Turn.mjs.map +1 -1
- package/dist/domain/Turn.test.mjs +1 -1
- package/dist/embedding-model/Embedding.d.mts +1 -1
- package/dist/embedding-model/EmbeddingModel.mjs +2 -2
- package/dist/embedding-model/EmbeddingModel.mjs.map +1 -1
- package/dist/embedding-model/EmbeddingModel.test.mjs +1 -1
- package/dist/index.d.mts +12 -8
- package/dist/index.mjs +5 -1
- package/dist/job/Job.d.mts +80 -0
- package/dist/job/Job.d.mts.map +1 -0
- package/dist/job/Job.mjs +49 -0
- package/dist/job/Job.mjs.map +1 -0
- package/dist/language-model/LanguageModel.d.mts +2 -2
- package/dist/language-model/LanguageModel.mjs +2 -2
- package/dist/language-model/LanguageModel.mjs.map +1 -1
- package/dist/language-model/LanguageModel.test.mjs +1 -1
- package/dist/loop/Loop.test.mjs +1 -1
- package/dist/music-generator/MusicGenerator.mjs +4 -4
- package/dist/music-generator/MusicGenerator.mjs.map +1 -1
- package/dist/music-generator/MusicGenerator.test.mjs +1 -1
- package/dist/observability/Metrics.d.mts +1 -1
- package/dist/observability/Metrics.test.mjs +2 -2
- package/dist/observability/Telemetry.test.mjs +2 -2
- package/dist/research/DeepResearch.d.mts +71 -0
- package/dist/research/DeepResearch.d.mts.map +1 -0
- package/dist/research/DeepResearch.mjs +61 -0
- package/dist/research/DeepResearch.mjs.map +1 -0
- package/dist/retry/Retry.test.mjs +1 -1
- package/dist/sandbox/Sandbox.mjs +18 -18
- package/dist/sandbox/Sandbox.mjs.map +1 -1
- package/dist/speech-synthesizer/SpeechSynthesizer.mjs +8 -8
- package/dist/speech-synthesizer/SpeechSynthesizer.mjs.map +1 -1
- package/dist/speech-synthesizer/SpeechSynthesizer.test.mjs +1 -1
- package/dist/streaming/JSONL.d.mts +3 -1
- package/dist/streaming/JSONL.d.mts.map +1 -1
- package/dist/streaming/JSONL.mjs +5 -11
- package/dist/streaming/JSONL.mjs.map +1 -1
- package/dist/streaming/JSONL.test.mjs +10 -1
- package/dist/streaming/JSONL.test.mjs.map +1 -1
- package/dist/streaming/SSE.d.mts +5 -3
- package/dist/streaming/SSE.d.mts.map +1 -1
- package/dist/streaming/SSE.mjs +28 -38
- package/dist/streaming/SSE.mjs.map +1 -1
- package/dist/streaming/SSE.test.mjs +54 -4
- package/dist/streaming/SSE.test.mjs.map +1 -1
- package/dist/structured-format/StructuredFormat.test.mjs +1 -1
- package/dist/testing/MockProvider.d.mts +1 -1
- package/dist/tool/Approval.d.mts +3 -3
- package/dist/tool/Approval.test.mjs +1 -1
- package/dist/tool/HistoryCheck.d.mts +2 -2
- package/dist/tool/Tool.d.mts +2 -2
- package/dist/tool/Tool.mjs +27 -7
- package/dist/tool/Tool.mjs.map +1 -1
- package/dist/tool/Tool.test.mjs +127 -3
- package/dist/tool/Tool.test.mjs.map +1 -1
- package/dist/tool/ToolEvent.d.mts +1 -1
- package/dist/tool/ToolResult.d.mts +1 -1
- package/dist/tool/Toolkit.d.mts +1 -1
- package/dist/tool/Toolkit.mjs.map +1 -1
- package/dist/tool/Toolkit.test.mjs +46 -2
- package/dist/tool/Toolkit.test.mjs.map +1 -1
- package/dist/transcriber/Transcriber.mjs +3 -3
- package/dist/transcriber/Transcriber.mjs.map +1 -1
- package/dist/transcriber/Transcriber.test.mjs +1 -1
- package/dist/web-read/WebRead.mjs +1 -1
- package/dist/web-read/WebRead.mjs.map +1 -1
- package/dist/web-read/WebReadTool.d.mts +1 -1
- package/dist/web-search/WebSearch.mjs +1 -1
- package/dist/web-search/WebSearch.mjs.map +1 -1
- package/dist/web-search/WebSearchTool.d.mts +1 -1
- package/package.json +19 -3
- package/src/browser/Browser.ts +4 -4
- package/src/domain/Citation.ts +64 -0
- package/src/domain/Items.ts +14 -4
- package/src/domain/Research.ts +42 -0
- package/src/domain/Turn.ts +26 -0
- package/src/embedding-model/EmbeddingModel.ts +2 -2
- package/src/index.ts +4 -0
- package/src/job/Job.ts +125 -0
- package/src/language-model/LanguageModel.ts +2 -2
- package/src/music-generator/MusicGenerator.ts +4 -4
- package/src/research/DeepResearch.ts +137 -0
- package/src/sandbox/Sandbox.ts +18 -18
- package/src/speech-synthesizer/SpeechSynthesizer.ts +8 -8
- package/src/streaming/JSONL.test.ts +19 -0
- package/src/streaming/JSONL.ts +6 -38
- package/src/streaming/SSE.test.ts +86 -3
- package/src/streaming/SSE.ts +36 -80
- package/src/tool/Tool.test.ts +151 -1
- package/src/tool/Tool.ts +120 -22
- package/src/tool/Toolkit.test.ts +60 -0
- package/src/tool/Toolkit.ts +2 -2
- package/src/transcriber/Transcriber.ts +3 -3
- package/src/web-read/WebRead.ts +1 -1
- package/src/web-search/WebSearch.ts +1 -1
- package/dist/Items-BnIduEV2.d.mts.map +0 -1
- package/dist/Tool-2lC_XMth.d.mts.map +0 -1
- package/dist/Toolkit-Dr9l_hNy.d.mts.map +0 -1
- package/dist/dist-DWgRbDN3.mjs.map +0 -1
|
@@ -46,16 +46,16 @@ declare const isImageUrl: <I>(input: I) => input is I & {
|
|
|
46
46
|
readonly url: string;
|
|
47
47
|
readonly mimeType?: ImageMimeType | undefined;
|
|
48
48
|
};
|
|
49
|
-
declare const isImageBase64: <I>(input: I) => input is I & {
|
|
50
|
-
readonly _tag: "base64"
|
|
51
|
-
readonly
|
|
52
|
-
readonly
|
|
53
|
-
}
|
|
54
|
-
declare const isImageBytes: <I>(input: I) => input is I & {
|
|
55
|
-
readonly _tag: "bytes"
|
|
56
|
-
readonly
|
|
57
|
-
readonly
|
|
58
|
-
}
|
|
49
|
+
declare const isImageBase64: <I>(input: I) => input is I & Schema.Struct.ReadonlySide<{
|
|
50
|
+
readonly _tag: Schema.tag<"base64">;
|
|
51
|
+
readonly base64: Schema.String;
|
|
52
|
+
readonly mimeType: Schema.Schema<ImageMimeType>;
|
|
53
|
+
}, "Type">;
|
|
54
|
+
declare const isImageBytes: <I>(input: I) => input is I & Schema.Struct.ReadonlySide<{
|
|
55
|
+
readonly _tag: Schema.tag<"bytes">;
|
|
56
|
+
readonly bytes: Schema.Uint8Array;
|
|
57
|
+
readonly mimeType: Schema.Schema<ImageMimeType>;
|
|
58
|
+
}, "Type">;
|
|
59
59
|
//#endregion
|
|
60
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-
|
|
61
|
+
//# sourceMappingURL=Image-C4vuBmu0.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image-
|
|
1
|
+
{"version":3,"file":"Image-C4vuBmu0.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,GAAA,MAAA,CAAA,MAAA,CAAA,YAAA;EAAA;;;;cACb,YAAA,MAAY,KAAA,EAAA,CAAA,KAAA,KAAA,IAAA,CAAA,GAAA,MAAA,CAAA,MAAA,CAAA,YAAA;EAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as ImageSource } from "./Image-
|
|
1
|
+
import { i as ImageSource } from "./Image-C4vuBmu0.mjs";
|
|
2
2
|
import { Schema } from "effect";
|
|
3
3
|
|
|
4
4
|
//#region src/domain/Items.d.ts
|
|
@@ -23,12 +23,22 @@ declare const InputImage: Schema.Struct<{
|
|
|
23
23
|
readonly source: Schema.Schema<ImageSource>;
|
|
24
24
|
}>;
|
|
25
25
|
type InputImage = typeof InputImage.Type;
|
|
26
|
+
/**
|
|
27
|
+
* A cited source. `url` + `title` are the only near-universal fields; the
|
|
28
|
+
* link from a source to the answer text varies by provider, so it is optional
|
|
29
|
+
* and expressed three ways: `start_index`/`end_index` (a character span into
|
|
30
|
+
* the answer), `cited_text` (an exact quote of the source, when no offsets are
|
|
31
|
+
* given), or `marker` (a positional `[n]` reference into an ordered list). A
|
|
32
|
+
* provider populates whichever it has; a bare source list sets none.
|
|
33
|
+
*/
|
|
26
34
|
declare const UrlCitation: Schema.Struct<{
|
|
27
35
|
readonly type: Schema.Literal<"url_citation">;
|
|
28
36
|
readonly url: Schema.String;
|
|
29
|
-
readonly start_index: Schema.Number;
|
|
30
|
-
readonly end_index: Schema.Number;
|
|
31
37
|
readonly title: Schema.String;
|
|
38
|
+
readonly start_index: Schema.optional<Schema.Number>;
|
|
39
|
+
readonly end_index: Schema.optional<Schema.Number>;
|
|
40
|
+
readonly cited_text: Schema.optional<Schema.String>;
|
|
41
|
+
readonly marker: Schema.optional<Schema.Number>;
|
|
32
42
|
}>;
|
|
33
43
|
type UrlCitation = typeof UrlCitation.Type;
|
|
34
44
|
declare const FileCitation: Schema.Struct<{
|
|
@@ -54,9 +64,11 @@ type FilePath = typeof FilePath.Type;
|
|
|
54
64
|
declare const Annotation: Schema.Union<readonly [Schema.Struct<{
|
|
55
65
|
readonly type: Schema.Literal<"url_citation">;
|
|
56
66
|
readonly url: Schema.String;
|
|
57
|
-
readonly start_index: Schema.Number;
|
|
58
|
-
readonly end_index: Schema.Number;
|
|
59
67
|
readonly title: Schema.String;
|
|
68
|
+
readonly start_index: Schema.optional<Schema.Number>;
|
|
69
|
+
readonly end_index: Schema.optional<Schema.Number>;
|
|
70
|
+
readonly cited_text: Schema.optional<Schema.String>;
|
|
71
|
+
readonly marker: Schema.optional<Schema.Number>;
|
|
60
72
|
}>, Schema.Struct<{
|
|
61
73
|
readonly type: Schema.Literal<"file_citation">;
|
|
62
74
|
readonly file_id: Schema.String;
|
|
@@ -76,36 +88,40 @@ type Annotation = typeof Annotation.Type;
|
|
|
76
88
|
declare const isUrlCitation: <I>(input: I) => input is I & {
|
|
77
89
|
readonly url: string;
|
|
78
90
|
readonly type: "url_citation";
|
|
79
|
-
readonly start_index: number;
|
|
80
|
-
readonly end_index: number;
|
|
81
91
|
readonly title: string;
|
|
92
|
+
readonly start_index?: number | undefined;
|
|
93
|
+
readonly end_index?: number | undefined;
|
|
94
|
+
readonly cited_text?: string | undefined;
|
|
95
|
+
readonly marker?: number | undefined;
|
|
82
96
|
};
|
|
83
|
-
declare const isFileCitation: <I>(input: I) => input is I & {
|
|
84
|
-
readonly type: "file_citation"
|
|
85
|
-
readonly file_id:
|
|
86
|
-
readonly index:
|
|
87
|
-
}
|
|
88
|
-
declare const isContainerFileCitation: <I>(input: I) => input is I & {
|
|
89
|
-
readonly type: "container_file_citation"
|
|
90
|
-
readonly
|
|
91
|
-
readonly
|
|
92
|
-
readonly
|
|
93
|
-
readonly
|
|
94
|
-
}
|
|
95
|
-
declare const isFilePath: <I>(input: I) => input is I & {
|
|
96
|
-
readonly type: "file_path"
|
|
97
|
-
readonly file_id:
|
|
98
|
-
readonly index:
|
|
99
|
-
}
|
|
97
|
+
declare const isFileCitation: <I>(input: I) => input is I & Schema.Struct.ReadonlySide<{
|
|
98
|
+
readonly type: Schema.Literal<"file_citation">;
|
|
99
|
+
readonly file_id: Schema.String;
|
|
100
|
+
readonly index: Schema.Number;
|
|
101
|
+
}, "Type">;
|
|
102
|
+
declare const isContainerFileCitation: <I>(input: I) => input is I & Schema.Struct.ReadonlySide<{
|
|
103
|
+
readonly type: Schema.Literal<"container_file_citation">;
|
|
104
|
+
readonly container_id: Schema.String;
|
|
105
|
+
readonly file_id: Schema.String;
|
|
106
|
+
readonly start_index: Schema.Number;
|
|
107
|
+
readonly end_index: Schema.Number;
|
|
108
|
+
}, "Type">;
|
|
109
|
+
declare const isFilePath: <I>(input: I) => input is I & Schema.Struct.ReadonlySide<{
|
|
110
|
+
readonly type: Schema.Literal<"file_path">;
|
|
111
|
+
readonly file_id: Schema.String;
|
|
112
|
+
readonly index: Schema.Number;
|
|
113
|
+
}, "Type">;
|
|
100
114
|
declare const OutputText: Schema.Struct<{
|
|
101
115
|
readonly type: Schema.Literal<"output_text">;
|
|
102
116
|
readonly text: Schema.String;
|
|
103
117
|
readonly annotations: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
104
118
|
readonly type: Schema.Literal<"url_citation">;
|
|
105
119
|
readonly url: Schema.String;
|
|
106
|
-
readonly start_index: Schema.Number;
|
|
107
|
-
readonly end_index: Schema.Number;
|
|
108
120
|
readonly title: Schema.String;
|
|
121
|
+
readonly start_index: Schema.optional<Schema.Number>;
|
|
122
|
+
readonly end_index: Schema.optional<Schema.Number>;
|
|
123
|
+
readonly cited_text: Schema.optional<Schema.String>;
|
|
124
|
+
readonly marker: Schema.optional<Schema.Number>;
|
|
109
125
|
}>, Schema.Struct<{
|
|
110
126
|
readonly type: Schema.Literal<"file_citation">;
|
|
111
127
|
readonly file_id: Schema.String;
|
|
@@ -146,9 +162,11 @@ declare const ContentBlock: Schema.Union<readonly [Schema.Struct<{
|
|
|
146
162
|
readonly annotations: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
147
163
|
readonly type: Schema.Literal<"url_citation">;
|
|
148
164
|
readonly url: Schema.String;
|
|
149
|
-
readonly start_index: Schema.Number;
|
|
150
|
-
readonly end_index: Schema.Number;
|
|
151
165
|
readonly title: Schema.String;
|
|
166
|
+
readonly start_index: Schema.optional<Schema.Number>;
|
|
167
|
+
readonly end_index: Schema.optional<Schema.Number>;
|
|
168
|
+
readonly cited_text: Schema.optional<Schema.String>;
|
|
169
|
+
readonly marker: Schema.optional<Schema.Number>;
|
|
152
170
|
}>, Schema.Struct<{
|
|
153
171
|
readonly type: Schema.Literal<"file_citation">;
|
|
154
172
|
readonly file_id: Schema.String;
|
|
@@ -186,9 +204,11 @@ declare const Message: Schema.Struct<{
|
|
|
186
204
|
readonly annotations: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
187
205
|
readonly type: Schema.Literal<"url_citation">;
|
|
188
206
|
readonly url: Schema.String;
|
|
189
|
-
readonly start_index: Schema.Number;
|
|
190
|
-
readonly end_index: Schema.Number;
|
|
191
207
|
readonly title: Schema.String;
|
|
208
|
+
readonly start_index: Schema.optional<Schema.Number>;
|
|
209
|
+
readonly end_index: Schema.optional<Schema.Number>;
|
|
210
|
+
readonly cited_text: Schema.optional<Schema.String>;
|
|
211
|
+
readonly marker: Schema.optional<Schema.Number>;
|
|
192
212
|
}>, Schema.Struct<{
|
|
193
213
|
readonly type: Schema.Literal<"file_citation">;
|
|
194
214
|
readonly file_id: Schema.String;
|
|
@@ -255,9 +275,11 @@ declare const HistoryItem: Schema.Union<readonly [Schema.Struct<{
|
|
|
255
275
|
readonly annotations: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
256
276
|
readonly type: Schema.Literal<"url_citation">;
|
|
257
277
|
readonly url: Schema.String;
|
|
258
|
-
readonly start_index: Schema.Number;
|
|
259
|
-
readonly end_index: Schema.Number;
|
|
260
278
|
readonly title: Schema.String;
|
|
279
|
+
readonly start_index: Schema.optional<Schema.Number>;
|
|
280
|
+
readonly end_index: Schema.optional<Schema.Number>;
|
|
281
|
+
readonly cited_text: Schema.optional<Schema.String>;
|
|
282
|
+
readonly marker: Schema.optional<Schema.Number>;
|
|
261
283
|
}>, Schema.Struct<{
|
|
262
284
|
readonly type: Schema.Literal<"file_citation">;
|
|
263
285
|
readonly file_id: Schema.String;
|
|
@@ -297,79 +319,83 @@ declare const HistoryItem: Schema.Union<readonly [Schema.Struct<{
|
|
|
297
319
|
readonly providerData: Schema.optional<Schema.Unknown>;
|
|
298
320
|
}>]>;
|
|
299
321
|
type HistoryItem = typeof HistoryItem.Type;
|
|
300
|
-
declare const isInputText: <I>(input: I) => input is I & {
|
|
301
|
-
readonly
|
|
302
|
-
readonly
|
|
303
|
-
}
|
|
304
|
-
declare const isInputImage: <I>(input: I) => input is I & {
|
|
305
|
-
readonly type: "input_image"
|
|
306
|
-
readonly source: ImageSource
|
|
307
|
-
}
|
|
322
|
+
declare const isInputText: <I>(input: I) => input is I & Schema.Struct.ReadonlySide<{
|
|
323
|
+
readonly type: Schema.Literal<"input_text">;
|
|
324
|
+
readonly text: Schema.String;
|
|
325
|
+
}, "Type">;
|
|
326
|
+
declare const isInputImage: <I>(input: I) => input is I & Schema.Struct.ReadonlySide<{
|
|
327
|
+
readonly type: Schema.Literal<"input_image">;
|
|
328
|
+
readonly source: Schema.Schema<ImageSource>;
|
|
329
|
+
}, "Type">;
|
|
308
330
|
declare const isOutputText: <I>(input: I) => input is I & {
|
|
309
331
|
readonly text: string;
|
|
310
332
|
readonly type: "output_text";
|
|
311
333
|
readonly annotations?: readonly ({
|
|
312
334
|
readonly url: string;
|
|
313
335
|
readonly type: "url_citation";
|
|
314
|
-
readonly start_index: number;
|
|
315
|
-
readonly end_index: number;
|
|
316
336
|
readonly title: string;
|
|
317
|
-
|
|
318
|
-
readonly
|
|
319
|
-
readonly
|
|
320
|
-
readonly
|
|
321
|
-
} | {
|
|
322
|
-
readonly type: "
|
|
323
|
-
readonly
|
|
324
|
-
readonly
|
|
325
|
-
|
|
326
|
-
readonly
|
|
327
|
-
|
|
328
|
-
readonly
|
|
329
|
-
readonly
|
|
330
|
-
readonly
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
337
|
+
readonly start_index?: number | undefined;
|
|
338
|
+
readonly end_index?: number | undefined;
|
|
339
|
+
readonly cited_text?: string | undefined;
|
|
340
|
+
readonly marker?: number | undefined;
|
|
341
|
+
} | Schema.Struct.ReadonlySide<{
|
|
342
|
+
readonly type: Schema.Literal<"file_citation">;
|
|
343
|
+
readonly file_id: Schema.String;
|
|
344
|
+
readonly index: Schema.Number;
|
|
345
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
346
|
+
readonly type: Schema.Literal<"container_file_citation">;
|
|
347
|
+
readonly container_id: Schema.String;
|
|
348
|
+
readonly file_id: Schema.String;
|
|
349
|
+
readonly start_index: Schema.Number;
|
|
350
|
+
readonly end_index: Schema.Number;
|
|
351
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
352
|
+
readonly type: Schema.Literal<"file_path">;
|
|
353
|
+
readonly file_id: Schema.String;
|
|
354
|
+
readonly index: Schema.Number;
|
|
355
|
+
}, "Type">)[] | undefined;
|
|
336
356
|
};
|
|
357
|
+
declare const isRefusal: <I>(input: I) => input is I & Schema.Struct.ReadonlySide<{
|
|
358
|
+
readonly type: Schema.Literal<"refusal">;
|
|
359
|
+
readonly text: Schema.String;
|
|
360
|
+
}, "Type">;
|
|
337
361
|
declare const isMessage: <I>(input: I) => input is I & {
|
|
338
362
|
readonly type: "message";
|
|
339
|
-
readonly content: readonly ({
|
|
340
|
-
readonly
|
|
341
|
-
readonly
|
|
342
|
-
} | {
|
|
343
|
-
readonly type: "input_image"
|
|
344
|
-
readonly source: ImageSource
|
|
345
|
-
} | {
|
|
363
|
+
readonly content: readonly (Schema.Struct.ReadonlySide<{
|
|
364
|
+
readonly type: Schema.Literal<"input_text">;
|
|
365
|
+
readonly text: Schema.String;
|
|
366
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
367
|
+
readonly type: Schema.Literal<"input_image">;
|
|
368
|
+
readonly source: Schema.Schema<ImageSource>;
|
|
369
|
+
}, "Type"> | {
|
|
346
370
|
readonly text: string;
|
|
347
371
|
readonly type: "output_text";
|
|
348
372
|
readonly annotations?: readonly ({
|
|
349
373
|
readonly url: string;
|
|
350
374
|
readonly type: "url_citation";
|
|
351
|
-
readonly start_index: number;
|
|
352
|
-
readonly end_index: number;
|
|
353
375
|
readonly title: string;
|
|
354
|
-
|
|
355
|
-
readonly
|
|
356
|
-
readonly
|
|
357
|
-
readonly
|
|
358
|
-
} | {
|
|
359
|
-
readonly type: "
|
|
360
|
-
readonly
|
|
361
|
-
readonly
|
|
362
|
-
|
|
363
|
-
readonly
|
|
364
|
-
|
|
365
|
-
readonly
|
|
366
|
-
readonly
|
|
367
|
-
readonly
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
376
|
+
readonly start_index?: number | undefined;
|
|
377
|
+
readonly end_index?: number | undefined;
|
|
378
|
+
readonly cited_text?: string | undefined;
|
|
379
|
+
readonly marker?: number | undefined;
|
|
380
|
+
} | Schema.Struct.ReadonlySide<{
|
|
381
|
+
readonly type: Schema.Literal<"file_citation">;
|
|
382
|
+
readonly file_id: Schema.String;
|
|
383
|
+
readonly index: Schema.Number;
|
|
384
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
385
|
+
readonly type: Schema.Literal<"container_file_citation">;
|
|
386
|
+
readonly container_id: Schema.String;
|
|
387
|
+
readonly file_id: Schema.String;
|
|
388
|
+
readonly start_index: Schema.Number;
|
|
389
|
+
readonly end_index: Schema.Number;
|
|
390
|
+
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
391
|
+
readonly type: Schema.Literal<"file_path">;
|
|
392
|
+
readonly file_id: Schema.String;
|
|
393
|
+
readonly index: Schema.Number;
|
|
394
|
+
}, "Type">)[] | undefined;
|
|
395
|
+
} | Schema.Struct.ReadonlySide<{
|
|
396
|
+
readonly type: Schema.Literal<"refusal">;
|
|
397
|
+
readonly text: Schema.String;
|
|
398
|
+
}, "Type">)[];
|
|
373
399
|
readonly role: "user" | "assistant" | "system";
|
|
374
400
|
readonly providerData?: unknown;
|
|
375
401
|
};
|
|
@@ -421,4 +447,4 @@ declare const assistantText: (text: string) => Message;
|
|
|
421
447
|
declare const toolCallOutput: (call_id: string, output: string) => ToolCallOutput;
|
|
422
448
|
//#endregion
|
|
423
449
|
export { isReasoning as A, isContainerFileCitation as C, isInputText as D, isInputImage as E, systemText as F, toolCallOutput as I, userText as L, isToolCall as M, isToolCallOutput as N, isMessage as O, isUrlCitation as P, assistantText as S, isFilePath as T, StopReason as _, FilePath as a, UrlCitation as b, InputText as c, Message as d, OutputText as f, Role as g, Refusal as h, FileCitation as i, isRefusal as j, isOutputText as k, InputTokensDetails as l, Reasoning as m, ContainerFileCitation as n, HistoryItem as o, OutputTokensDetails as p, ContentBlock as r, InputImage as s, Annotation as t, Items_d_exports as u, ToolCall as v, isFileCitation as w, Usage as x, ToolCallOutput as y };
|
|
424
|
-
//# sourceMappingURL=Items-
|
|
450
|
+
//# sourceMappingURL=Items-BWNu6VGp.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Items-BWNu6VGp.d.mts","names":[],"sources":["../src/domain/Items.ts"],"mappings":";;;;;;;cAOa,SAAA,EAAS,MAAA,CAAA,MAAA;EAAA;;;KAIV,SAA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CAAA,YAAA;EAAA;;;cAET,SAAA,MAAS,KAAA,EAAA,CAAA,KAAA,KAAA,IAAA,CAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cACT,UAAA,MAAU,KAAA,EAAA,CAAA,KAAA,KAAA,IAAA,CAAA;EAAA;;;;;;cACV,gBAAA,MAAgB,KAAA,EAAA,CAAA,KAAA,KAAA,IAAA,CAAA;EAAA;;;;;cAChB,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,cAAA,GAAkB,OAAA,UAAiB,MAAA,aAAiB,cAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { v as ToolCall, y as ToolCallOutput } from "./Items-
|
|
1
|
+
import { v as ToolCall, y as ToolCallOutput } from "./Items-BWNu6VGp.mjs";
|
|
2
2
|
import { Effect, Schema } from "effect";
|
|
3
3
|
import * as _$effect_Cause0 from "effect/Cause";
|
|
4
4
|
import { StandardJSONSchemaV1, StandardSchemaV1 } from "@standard-schema/spec";
|
|
5
5
|
|
|
6
6
|
//#region src/tool/Tool.d.ts
|
|
7
7
|
declare namespace Tool_d_exports {
|
|
8
|
-
export { AnyLocalTool, AnyTool, DecodableTool, DecodeResult, Emit, InteractionTool, ProviderTool, SignalTool, Tool, ToolDescriptor, ToolE, ToolError, ToolFailed, ToolInputSchema, ToolR, ToolValidationError, decodeArgs, decodeCallInput, descriptorsOf, execute, fail, fromEffectSchema, fromStandardSchema, interaction, make, noInput, provider, signal, toDescriptors, withName, withRun };
|
|
8
|
+
export { AnyLocalTool, AnyTool, DecodableTool, DecodeResult, Emit, InteractionTool, ProviderTool, SignalTool, Tool, ToolDescriptor, ToolE, ToolError, ToolFailed, ToolInputSchema, ToolR, ToolValidationError, decodeArgs, decodeCallInput, descriptorsOf, execute, fail, fromEffectSchema, fromStandardSchema, interaction, isProviderTool, make, noInput, provider, providerToolsOf, signal, toDescriptors, withName, withRun };
|
|
9
9
|
}
|
|
10
10
|
declare const ToolError_base: Schema.Class<ToolError, Schema.TaggedStruct<"ToolError", {
|
|
11
11
|
readonly call_id: Schema.String;
|
|
@@ -193,25 +193,45 @@ type ToolDescriptor = {
|
|
|
193
193
|
readonly strict?: boolean;
|
|
194
194
|
};
|
|
195
195
|
/** A model-visible tool with a local `Effect` executor. */
|
|
196
|
-
declare const make:
|
|
196
|
+
declare const make: {
|
|
197
|
+
<Name extends string, S extends Schema.Codec<any, any, never, any>, Event, Output, E = never, R = never>(spec: Omit<Tool<Name, S["Type"], Event, Output, E, R>, "_tag" | "inputSchema"> & {
|
|
198
|
+
readonly inputSchema: S;
|
|
199
|
+
}): Tool<Name, S["Type"], Event, Output, E, R>;
|
|
200
|
+
<Name extends string, Input, Event, Output, E = never, R = never>(spec: Omit<Tool<Name, Input, Event, Output, E, R>, "_tag">): Tool<Name, Input, Event, Output, E, R>;
|
|
201
|
+
};
|
|
197
202
|
/**
|
|
198
203
|
* A provider-hosted tool (native web search, code execution, RAG grounding).
|
|
199
204
|
* No local executor — `provider`/`config` drive the provider adapter's
|
|
200
205
|
* rendering. The model sees it; `Toolkit.run` reports it as `non_local_tool`.
|
|
201
206
|
*/
|
|
202
|
-
declare const provider:
|
|
207
|
+
declare const provider: {
|
|
208
|
+
<Name extends string, S extends Schema.Codec<any, any, never, any>, Provider extends string, Config>(spec: Omit<ProviderTool<Name, S["Type"], Provider, Config>, "_tag" | "inputSchema"> & {
|
|
209
|
+
readonly inputSchema: S;
|
|
210
|
+
}): ProviderTool<Name, S["Type"], Provider, Config>;
|
|
211
|
+
<Name extends string, Input, Provider extends string, Config>(spec: Omit<ProviderTool<Name, Input, Provider, Config>, "_tag">): ProviderTool<Name, Input, Provider, Config>;
|
|
212
|
+
};
|
|
203
213
|
/**
|
|
204
214
|
* A typed control-flow signal to the agent loop (escalate, pause, schedule,
|
|
205
215
|
* hand off). Decode-only: the loop interprets the call rather than executing a
|
|
206
216
|
* handler, so there is no `run`.
|
|
207
217
|
*/
|
|
208
|
-
declare const signal:
|
|
218
|
+
declare const signal: {
|
|
219
|
+
<Name extends string, S extends Schema.Codec<any, any, never, any>>(spec: Omit<SignalTool<Name, S["Type"]>, "_tag" | "inputSchema"> & {
|
|
220
|
+
readonly inputSchema: S;
|
|
221
|
+
}): SignalTool<Name, S["Type"]>;
|
|
222
|
+
<Name extends string, Input>(spec: Omit<SignalTool<Name, Input>, "_tag">): SignalTool<Name, Input>;
|
|
223
|
+
};
|
|
209
224
|
/**
|
|
210
225
|
* A typed request for an external actor to respond before the loop resumes
|
|
211
226
|
* (frontend, Telegram, CLI prompt). Decode-only; the loop stops/pauses and
|
|
212
227
|
* resumes by appending the actor's `function_call_output`.
|
|
213
228
|
*/
|
|
214
|
-
declare const interaction:
|
|
229
|
+
declare const interaction: {
|
|
230
|
+
<Name extends string, S extends Schema.Codec<any, any, never, any>>(spec: Omit<InteractionTool<Name, S["Type"]>, "_tag" | "inputSchema"> & {
|
|
231
|
+
readonly inputSchema: S;
|
|
232
|
+
}): InteractionTool<Name, S["Type"]>;
|
|
233
|
+
<Name extends string, Input>(spec: Omit<InteractionTool<Name, Input>, "_tag">): InteractionTool<Name, Input>;
|
|
234
|
+
};
|
|
215
235
|
/**
|
|
216
236
|
* Return a copy of a tool under a new `name`. Useful for resolving a name
|
|
217
237
|
* clash before combining tools into one `Toolkit`. Literal-preserving, so the
|
|
@@ -232,7 +252,20 @@ declare const withName: <N extends string, T extends AnyTool>(tool: T, name: N)
|
|
|
232
252
|
* from the contract the model sees.
|
|
233
253
|
*/
|
|
234
254
|
declare const withRun: <Name extends string, Input, Event, Output, E, R, Output2, E2 = never, R2 = never>(tool: Tool<Name, Input, Event, Output, E, R>, run: (input: Input, emit: Emit<Event>) => Effect.Effect<Output2, E2, R2>) => Tool<Name, Input, Event, Output2, E2, R2>;
|
|
235
|
-
/**
|
|
255
|
+
/** True for provider-hosted tools — the kind a provider renders natively. */
|
|
256
|
+
declare const isProviderTool: (tool: AnyTool) => tool is ProviderTool<string, any, string, any>;
|
|
257
|
+
/**
|
|
258
|
+
* The `ProviderTool`s in a toolkit, for a provider adapter to render as its
|
|
259
|
+
* native hosted-tool entries (web search, code execution, grounding). The other
|
|
260
|
+
* kinds render as function declarations via `descriptorsOf`.
|
|
261
|
+
*/
|
|
262
|
+
declare const providerToolsOf: (toolkit?: Readonly<Record<string, AnyTool>>) => ReadonlyArray<ProviderTool<string, any, string, any>>;
|
|
263
|
+
/**
|
|
264
|
+
* Render tools to provider-agnostic descriptors. `ProviderTool`s are excluded:
|
|
265
|
+
* they are provider-hosted and must never leak into the function-declaration
|
|
266
|
+
* list — each adapter renders them natively via `providerToolsOf`. Every other
|
|
267
|
+
* kind is model-visible as a declaration.
|
|
268
|
+
*/
|
|
236
269
|
declare const toDescriptors: (tools: ReadonlyArray<AnyTool>) => ReadonlyArray<ToolDescriptor>;
|
|
237
270
|
/**
|
|
238
271
|
* Render a `Toolkit` (a name-indexed record of tools) to descriptors, treating
|
|
@@ -280,5 +313,5 @@ declare const decodeArgs: <Input>(tool: DecodableTool<Input>, call: ToolCall) =>
|
|
|
280
313
|
*/
|
|
281
314
|
declare const execute: <Name extends string, Input, Event, Output, E, R>(tool: Tool<Name, Input, Event, Output, E, R>, call: ToolCall) => Effect.Effect<ToolCallOutput, E | ToolError | ToolValidationError, R>;
|
|
282
315
|
//#endregion
|
|
283
|
-
export {
|
|
284
|
-
//# sourceMappingURL=Tool-
|
|
316
|
+
export { providerToolsOf as A, fromEffectSchema as C, make as D, isProviderTool as E, toDescriptors as M, withName as N, noInput as O, withRun as P, fail as S, interaction as T, Tool_d_exports as _, Emit as a, descriptorsOf as b, SignalTool as c, ToolE as d, ToolError as f, ToolValidationError as g, ToolR as h, DecodeResult as i, signal as j, provider as k, Tool as l, ToolInputSchema as m, AnyTool as n, InteractionTool as o, ToolFailed as p, DecodableTool as r, ProviderTool as s, AnyLocalTool as t, ToolDescriptor as u, decodeArgs as v, fromStandardSchema as w, execute as x, decodeCallInput as y };
|
|
317
|
+
//# sourceMappingURL=Tool-CXFHCQrT.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tool-CXFHCQrT.d.mts","names":[],"sources":["../src/tool/Tool.ts"],"mappings":";;;;;;;;;cAEkE,cAAA;;;;;;cAIrD,SAAA,SAAkB,cAAA;AAAA,cAQ3B,wBAAA;;;;;;;;;;;;;;cAkBS,mBAAA,SAA4B,wBAAA;AAAA,cAMpC,eAAA;;;;;;;;;;;;;cAWQ,UAAA,SAAmB,eAAA;AA/CkC;;;;;AAAA,cA2DrD,IAAA,GACX,OAAA,UACA,OAAA;EAAA,SAAqB,IAAA;AAAA,MACpB,MAAA,CAAO,MAAA,QAAc,UAAA;;;;;;;;;;KAcZ,eAAA,oBAAmC,gBAAA,UAA0B,KAAA,IACvE,oBAAA,UAA8B,KAAA;;;;;;cAOnB,gBAAA,aAA8B,MAAA,CAAO,KAAA,wBAChD,MAAA,EAAQ,CAAA,KACP,CAAA,GAAI,eAAA,CAAgB,CAAA;;;;;;;;;;;;;AAlFvB;;;cAoGa,kBAAA,aAAgC,gBAAA,GAAmB,oBAAA,EAC9D,MAAA,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,OAAA,GAAU,QAAA,CAAS,MAAA,SAAe,OAAA,OACjC,aAAA,CAAc,cAAA;;;;;;KAQL,YAAA;EAAA,SACG,IAAA;EAAA,SAAqB,KAAA,EAAO,KAAA;AAAA;EAAA,SAC5B,IAAA;AAAA;EAAA,SACA,IAAA;EAAA,SAA0B,MAAA,EAAQ,aAAA,CAAc,gBAAA,CAAiB,KAAA;AAAA;;;;;;cAWnE,eAAA,UACX,IAAA,EAAM,aAAA,CAAc,KAAA,GACpB,IAAA,EAAM,QAAA,KACL,MAAA,CAAO,MAAA,CAAO,YAAA,CAAa,KAAA;;;;;AA3R9B;;;;;cA4Ta,UAAA,UACX,IAAA,EAAM,aAAA,CAAc,KAAA,GACpB,IAAA,EAAM,QAAA,KACL,MAAA,CAAO,MAAA,CAAO,KAAA,EAAO,SAAA,GAAY,mBAAA;;;;;;;cA4BvB,OAAA,oDACX,IAAA,EAAM,IAAA,CAAK,IAAA,EAAM,KAAA,EAAO,KAAA,EAAO,MAAA,EAAQ,CAAA,EAAG,CAAA,GAC1C,IAAA,EAAM,QAAA,KACL,MAAA,CAAO,MAAA,CAAO,cAAA,EAAgB,CAAA,GAAI,SAAA,GAAY,mBAAA,EAAqB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ToolResult } from "./ToolResult-
|
|
1
|
+
import { t as ToolResult } from "./ToolResult-CQqKkcDa.mjs";
|
|
2
2
|
import { Data } from "effect";
|
|
3
3
|
import * as _$effect_Unify0 from "effect/Unify";
|
|
4
4
|
|
|
@@ -148,4 +148,4 @@ declare const isOutput: (u: unknown) => u is {
|
|
|
148
148
|
};
|
|
149
149
|
//#endregion
|
|
150
150
|
export { isProgress as a, isOutput as i, ToolEvent_d_exports as n, isApprovalRequested as r, ToolEvent as t };
|
|
151
|
-
//# sourceMappingURL=ToolEvent-
|
|
151
|
+
//# sourceMappingURL=ToolEvent-nVijCrvm.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolEvent-
|
|
1
|
+
{"version":3,"file":"ToolEvent-nVijCrvm.d.mts","names":[],"sources":["../src/tool/ToolEvent.ts"],"mappings":";;;;;;;;KAkBY,SAAA,GAAY,IAAA,CAAK,UAAA;EAC3B,iBAAA;IAAA,SACW,OAAA;IAAA,SACA,IAAA;IAAA,SACA,SAAA;EAAA;EAEX,QAAA;IAAA,SACW,OAAA;IAAA,SACA,IAAA;IAAA,SACA,IAAA;EAAA;EAEX,MAAA;IAAA,SACW,MAAA,EAAQ,UAAA;EAAA;AAAA;;;;;;;;cAWR,SAAA;EAAA;;;;;;;;;;;;;;qBAXQ,UAAA;EAAA;EAAA;;;;;;;;;;;;;;;;qBAAA,UAAA;EAAA;IAAA;;;;;;;;;;;;;;;;;;yBAAA,UAAA;MAAA;IAAA;;;;;;;;;;;;uBAAA,UAAA;IAAA;;;;;;;;;;;;;;;;yBAAA,UAAA;MAAA;IAAA;;;;;;;;;;;;uBAAA,UAAA;IAAA;;;cAaR,mBAAA,GAAmB,CAAA,cAAA,CAAA;EAAA;;;;;cACnB,UAAA,GAAU,CAAA,cAAA,CAAA;EAAA;;;;;cACV,QAAA,GAAQ,CAAA,cAAA,CAAA;EAAA;mBAfA,UAAA;AAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { v as ToolCall, y as ToolCallOutput } from "./Items-
|
|
1
|
+
import { v as ToolCall, y as ToolCallOutput } from "./Items-BWNu6VGp.mjs";
|
|
2
2
|
import { Data } from "effect";
|
|
3
3
|
import * as _$effect_Unify0 from "effect/Unify";
|
|
4
4
|
|
|
@@ -154,4 +154,4 @@ declare const serializeValue: (value: unknown) => string;
|
|
|
154
154
|
declare const toToolCallOutput: (r: ToolResult) => ToolCallOutput;
|
|
155
155
|
//#endregion
|
|
156
156
|
export { executionError as a, isOk as c, toToolCallOutput as d, validationError as f, denied as i, nonLocalTool as l, ToolResult_d_exports as n, failed as o, cancelled as r, isFailure as s, ToolResult as t, serializeValue as u };
|
|
157
|
-
//# sourceMappingURL=ToolResult-
|
|
157
|
+
//# sourceMappingURL=ToolResult-CQqKkcDa.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolResult-
|
|
1
|
+
{"version":3,"file":"ToolResult-CQqKkcDa.d.mts","names":[],"sources":["../src/tool/ToolResult.ts"],"mappings":";;;;;;;;KAqBY,UAAA,GAAa,IAAA,CAAK,UAAA;EAC5B,EAAA;IAAA,SACW,OAAA;IAAA,SACA,IAAA;IAAA,SACA,KAAA;EAAA;EAEX,OAAA;IAAA,SACW,OAAA;IAAA,SACA,IAAA;IAAA,SACA,IAAA;IAAA,SACA,MAAA;EAAA;AAAA;;;;;;;;;cAYA,UAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAEA,IAAA,GAAI,CAAA,cAAA,CAAA;EAAA;;;;;cACJ,SAAA,GAAS,CAAA,cAAA,CAAA;EAAA;;;;;;cAMT,MAAA,GAAU,IAAA,EAAM,QAAA,EAAU,IAAA,UAAc,MAAA,cAAkB,UAAA;;cAS1D,MAAA,GAAU,IAAA,EAAM,QAAA,EAAU,MAAA,cAAkB,UAAA;;cAI5C,SAAA,GAAa,IAAA,EAAM,QAAA,EAAU,MAAA,cAAkB,UAAA;;cAI/C,cAAA,GAAkB,IAAA,EAAM,QAAA,EAAU,MAAA,aAAiB,UAAA;;;;;;;cASnD,YAAA,GAAgB,IAAA,EAAM,QAAA,EAAU,MAAA,cAAkB,UAAA;;;;;;cAYlD,eAAA,GAAmB,IAAA,EAAM,QAAA,EAAU,MAAA,cAAkB,UAAA;;AA7ClE;;;;cAyDa,cAAA,GAAkB,KAAA;AAAA,cAOlB,gBAAA,GAAoB,CAAA,EAAG,UAAA,KAAa,cAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { o as HistoryItem, v as ToolCall } from "./Items-
|
|
2
|
-
import { a as Emit, c as SignalTool, d as ToolE, h as ToolR, l as Tool, n as AnyTool, o as InteractionTool, p as ToolFailed, s as ProviderTool, u as ToolDescriptor } from "./Tool-
|
|
1
|
+
import { o as HistoryItem, v as ToolCall } from "./Items-BWNu6VGp.mjs";
|
|
2
|
+
import { a as Emit, c as SignalTool, d as ToolE, h as ToolR, l as Tool, n as AnyTool, o as InteractionTool, p as ToolFailed, s as ProviderTool, u as ToolDescriptor } from "./Tool-CXFHCQrT.mjs";
|
|
3
3
|
import { Turn } from "./domain/Turn.mjs";
|
|
4
4
|
import { r as Step } from "./Loop-D8nWpowc.mjs";
|
|
5
|
-
import { t as ToolResult } from "./ToolResult-
|
|
6
|
-
import { t as ToolEvent } from "./ToolEvent-
|
|
5
|
+
import { t as ToolResult } from "./ToolResult-CQqKkcDa.mjs";
|
|
6
|
+
import { t as ToolEvent } from "./ToolEvent-nVijCrvm.mjs";
|
|
7
7
|
import { Cause, Effect, Stream } from "effect";
|
|
8
8
|
import * as _$effect_Types0 from "effect/Types";
|
|
9
9
|
|
|
@@ -66,7 +66,7 @@ declare class DuplicateToolName extends DuplicateToolName_base<{
|
|
|
66
66
|
readonly sources: ReadonlyArray<string>;
|
|
67
67
|
}> {}
|
|
68
68
|
type PrefixName<Prefix extends string, Name extends string> = `${Prefix}__${Name}`;
|
|
69
|
-
type PrefixTool<Prefix extends string, T extends AnyTool> = T extends Tool<infer N, infer I, infer Ev, infer O, infer R> ? Tool<PrefixName<Prefix, N>, I, Ev, O, R> : T extends ProviderTool<infer N, infer I, infer P, infer C> ? ProviderTool<PrefixName<Prefix, N>, I, P, C> : T extends SignalTool<infer N, infer I> ? SignalTool<PrefixName<Prefix, N>, I> : T extends InteractionTool<infer N, infer I> ? InteractionTool<PrefixName<Prefix, N>, I> : T;
|
|
69
|
+
type PrefixTool<Prefix extends string, T extends AnyTool> = T extends Tool<infer N, infer I, infer Ev, infer O, infer E, infer R> ? Tool<PrefixName<Prefix, N>, I, Ev, O, E, R> : T extends ProviderTool<infer N, infer I, infer P, infer C> ? ProviderTool<PrefixName<Prefix, N>, I, P, C> : T extends SignalTool<infer N, infer I> ? SignalTool<PrefixName<Prefix, N>, I> : T extends InteractionTool<infer N, infer I> ? InteractionTool<PrefixName<Prefix, N>, I> : T;
|
|
70
70
|
type Namespaced<Prefix extends string, T extends ToolMap> = { readonly [K in keyof T & string as PrefixName<Prefix, K>]: T[K] extends AnyTool ? PrefixTool<Prefix, T[K]> : never };
|
|
71
71
|
/**
|
|
72
72
|
* Prefix every tool name with `<namespace>__`, returning a new toolkit. Use it
|
|
@@ -193,4 +193,4 @@ declare const continueWithResults: {
|
|
|
193
193
|
};
|
|
194
194
|
//#endregion
|
|
195
195
|
export { wrap as S, fromArray as _, ToolMap as a, namespace as b, ToolkitR as c, appendToolResults as d, collectResults as f, descriptors as g, describeFailures as h, NoDuplicateNames as i, Toolkit_d_exports as l, continueWithResults as m, ExecuteOptions as n, Toolkit as o, compose as p, Middleware as r, ToolkitE as s, DuplicateToolName as t, UniqueTools as u, make as v, run as x, makeNamespaced as y };
|
|
196
|
-
//# sourceMappingURL=Toolkit-
|
|
196
|
+
//# sourceMappingURL=Toolkit-BYPwwu-j.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toolkit-BYPwwu-j.d.mts","names":[],"sources":["../src/tool/Toolkit.ts"],"mappings":";;;;;;;;;;;;;KAqDY,OAAA,GAAU,MAAA,SAAe,OAAA;AAAA,KAEzB,OAAA,eAAsB,OAAA,GAAU,OAAA,IAAW,KAAA;AAAA,cAgB1C,IAAA,uBAA4B,aAAA,CAAc,OAAA,MAClD,KAAA,EAAO,WAAA,CAAY,KAAA,MACrB,OAAA,SAAgB,KAAA,YAAiB,CAAA,WAAY,CAAA;;;;;;;cAQnC,SAAA,GAAa,KAAA,EAAO,aAAA,CAAc,OAAA,MAAW,OAAA;;cAG7C,WAAA,GAAe,OAAA,EAAS,OAAA,KAAU,aAAA,CAAc,cAA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,CAAO,MAAA,CAAO,IAAA,CAAU,SAAA,EAAW,CAAA,GAAI,CAAA,EAAG,CAAA;EAAA,UAE7F,MAAA,EAAQ,MAAA,CAAO,MAAA,CAAO,SAAA,EAAW,CAAA,EAAG,CAAA,GACpC,KAAA,GAAQ,OAAA,EAAS,aAAA,CAAc,UAAA,MAAgB,CAAA,GAC9C,MAAA,CAAO,MAAA,CAAO,IAAA,CAAU,SAAA,EAAW,CAAA,GAAI,CAAA,EAAG,CAAA;AAAA"}
|
package/dist/browser/Browser.mjs
CHANGED
|
@@ -15,19 +15,19 @@ var Browser = class extends Context.Service()("@betalyra/effect-uai/Browser") {}
|
|
|
15
15
|
* Provision a session bound to the caller's scope. Drop the `Scope.Scope`
|
|
16
16
|
* requirement with `Effect.scoped`.
|
|
17
17
|
*/
|
|
18
|
-
const create = (request) => Effect.flatMap(Browser
|
|
18
|
+
const create = (request) => Effect.flatMap(Browser, (s) => s.create(request));
|
|
19
19
|
/**
|
|
20
20
|
* Re-acquire an existing session by id. Same scope semantics as `create`,
|
|
21
21
|
* but the finalizer detaches rather than destroying.
|
|
22
22
|
*/
|
|
23
|
-
const attach = (id) => Effect.flatMap(Browser
|
|
23
|
+
const attach = (id) => Effect.flatMap(Browser, (s) => s.attach(id));
|
|
24
24
|
/** Enumerate sessions for the configured account / project. */
|
|
25
|
-
const list = Effect.flatMap(Browser
|
|
25
|
+
const list = Effect.flatMap(Browser, (s) => s.list);
|
|
26
26
|
/**
|
|
27
27
|
* Destroy a session from outside its owning scope. Most callers should let
|
|
28
28
|
* the scope finalizer handle this automatically.
|
|
29
29
|
*/
|
|
30
|
-
const destroy = (id) => Effect.flatMap(Browser
|
|
30
|
+
const destroy = (id) => Effect.flatMap(Browser, (s) => s.destroy(id));
|
|
31
31
|
//#endregion
|
|
32
32
|
export { Browser, BrowserSessionId, attach, create, destroy, list, Browser_exports as t };
|
|
33
33
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Browser.mjs","names":[],"sources":["../../src/browser/Browser.ts"],"sourcesContent":["import { Brand, Context, type Duration, Effect, Scope } from \"effect\"\nimport type * as BrowserError from \"./BrowserError.js\"\n\n// ---------------------------------------------------------------------------\n// Identity\n// ---------------------------------------------------------------------------\n\n/**\n * Session identifier. Branded `string` so providers don't accidentally\n * accept a raw user-supplied id, and so a session id can't be passed where\n * another service's id is expected. Each provider mints these per its own\n * scheme; core code treats them opaquely. Mint via `BrowserSessionId(...)`.\n */\nexport type BrowserSessionId = Brand.Branded<string, \"BrowserSessionId\">\nexport const BrowserSessionId = Brand.nominal<BrowserSessionId>()\n\n/** Reference returned by `list`; enough to `attach`. */\nexport type BrowserSessionRef = {\n readonly id: BrowserSessionId\n /** Current top-level URL, when the provider reports it. */\n readonly url?: string\n}\n\n/**\n * Output representation for {@link BrowserSession.content}. `markdown` is\n * the default.\n */\nexport type PageFormat = \"markdown\" | \"html\"\n\n// ---------------------------------------------------------------------------\n// Create request\n// ---------------------------------------------------------------------------\n\n/**\n * Cross-provider session-create request. Provider-specific knobs (proxy,\n * stealth, persistent profile, ...) live on each provider's narrowed\n * request type which extends this.\n */\nexport type CommonSessionRequest = {\n /**\n * Hard max lifetime of the session. Enforced locally (the handle is\n * disposed and further calls fail with `BrowserSessionExpired`) and,\n * where the provider supports it, passed through as a server-side cap so\n * a crashed client still gets the session reclaimed. The provider cap\n * must be >= the local reaper. Accepts millis, a string like\n * `\"5 minutes\"`, or a `Duration`.\n */\n readonly timeout?: Duration.Input\n /**\n * Idle teardown: dispose the session after this much inactivity, the\n * timer resetting on each operation. Opt-in; omit for no idle limit.\n */\n readonly idleTimeout?: Duration.Input\n /** Initial viewport size. Providers default differently. */\n readonly viewport?: { readonly width: number; readonly height: number }\n}\n\n// ---------------------------------------------------------------------------\n// Observation shapes\n// ---------------------------------------------------------------------------\n\nexport type BoundingBox = {\n readonly x: number\n readonly y: number\n readonly width: number\n readonly height: number\n}\n\n/**\n * One element returned by {@link BrowserSession.query}. Serializable data,\n * not a live handle (handles go stale across navigation and do not cross a\n * provider boundary cleanly).\n */\nexport type ElementInfo = {\n /**\n * Reference usable as a selector for a follow-up action. Valid until the\n * next navigation; do not cache across `goto` or a page-changing click.\n */\n readonly ref: string\n readonly tag: string\n readonly text?: string\n readonly attributes: Readonly<Record<string, string>>\n readonly box?: BoundingBox\n}\n\n/** Accessibility-tree node returned by {@link BrowserSession.snapshot}. */\nexport type AxNode = {\n readonly role: string\n readonly name?: string\n readonly value?: string\n /**\n * Reference usable as a selector for a follow-up action. Valid until the\n * next navigation; do not cache across `goto` or a page-changing click.\n */\n readonly ref?: string\n readonly children: ReadonlyArray<AxNode>\n}\n\n// ---------------------------------------------------------------------------\n// Interaction shapes\n// ---------------------------------------------------------------------------\n\nexport type ScrollDirection = \"up\" | \"down\" | \"left\" | \"right\"\n\nexport type ScrollOptions = {\n readonly direction: ScrollDirection\n /** Distance in CSS pixels. Provider default applies when omitted. */\n readonly pixels?: number\n}\n\nexport type ScreenshotOptions = {\n /** Clip to the first element matching this selector. */\n readonly selector?: string\n /** Capture the full scrollable page rather than the viewport. */\n readonly fullPage?: boolean\n}\n\nexport type Cookie = {\n readonly name: string\n readonly value: string\n readonly domain?: string\n readonly path?: string\n readonly expires?: number\n readonly httpOnly?: boolean\n readonly secure?: boolean\n readonly sameSite?: \"Strict\" | \"Lax\" | \"None\"\n}\n\n/** Read / write the session's cookie jar. Needed for authenticated flows. */\nexport type CookieApi = {\n readonly get: Effect.Effect<ReadonlyArray<Cookie>, BrowserError.BrowserError>\n readonly set: (cookies: ReadonlyArray<Cookie>) => Effect.Effect<void, BrowserError.BrowserError>\n}\n\n// ---------------------------------------------------------------------------\n// Live session handle\n// ---------------------------------------------------------------------------\n\n/**\n * Live session handle. Actions take a CSS selector string (so `#id` is\n * just `#id`). Methods are plain `Effect` values; disposal is the scope\n * finalizer, not a method here (see {@link BrowserService}). Anything not\n * covered by a verb is reachable via `evaluate`. Per-operation time budgets\n * are the provider's default; wrap any call in `Effect.timeout` for a\n * tighter bound.\n */\nexport type BrowserSession = {\n readonly id: BrowserSessionId\n\n // Navigation and waiting\n readonly goto: (url: string) => Effect.Effect<void, BrowserError.BrowserError>\n readonly waitFor: (selector: string) => Effect.Effect<void, BrowserError.BrowserError>\n\n // Interaction\n readonly click: (selector: string) => Effect.Effect<void, BrowserError.BrowserError>\n readonly dblclick: (selector: string) => Effect.Effect<void, BrowserError.BrowserError>\n readonly fill: (selector: string, text: string) => Effect.Effect<void, BrowserError.BrowserError>\n readonly type: (selector: string, text: string) => Effect.Effect<void, BrowserError.BrowserError>\n readonly press: (key: string) => Effect.Effect<void, BrowserError.BrowserError>\n readonly hover: (selector: string) => Effect.Effect<void, BrowserError.BrowserError>\n readonly focus: (selector: string) => Effect.Effect<void, BrowserError.BrowserError>\n readonly select: (\n selector: string,\n value: string,\n ) => Effect.Effect<void, BrowserError.BrowserError>\n readonly check: (selector: string) => Effect.Effect<void, BrowserError.BrowserError>\n readonly uncheck: (selector: string) => Effect.Effect<void, BrowserError.BrowserError>\n readonly scroll: (options: ScrollOptions) => Effect.Effect<void, BrowserError.BrowserError>\n readonly scrollIntoView: (selector: string) => Effect.Effect<void, BrowserError.BrowserError>\n\n // Observation\n readonly content: (format?: PageFormat) => Effect.Effect<string, BrowserError.BrowserError>\n readonly screenshot: (\n options?: ScreenshotOptions,\n ) => Effect.Effect<Uint8Array, BrowserError.BrowserError>\n readonly snapshot: Effect.Effect<AxNode, BrowserError.BrowserError>\n readonly query: (\n selector: string,\n ) => Effect.Effect<ReadonlyArray<ElementInfo>, BrowserError.BrowserError>\n\n // State and escape hatch\n readonly cookies: CookieApi\n readonly evaluate: (script: string) => Effect.Effect<unknown, BrowserError.BrowserError>\n}\n\n// ---------------------------------------------------------------------------\n// Service definition\n// ---------------------------------------------------------------------------\n\n/**\n * Cross-provider browser service.\n *\n * Lifetime: `create` and `attach` return a handle in `Scope.Scope`. The\n * scope finalizer disposes the session (close the transport, destroy or\n * detach the remote session, kill the local engine). Bind with\n * `Effect.scoped` for a single call, or hold a wider scope to keep a\n * session warm across many calls. This is why there is no `dispose()` on\n * {@link BrowserSession}; the scope is the lifecycle handle.\n */\nexport type BrowserService = {\n /**\n * Provision a new session, bound to the caller's scope. Disposed on\n * scope close.\n */\n readonly create: (\n request: CommonSessionRequest,\n ) => Effect.Effect<BrowserSession, BrowserError.BrowserError, Scope.Scope>\n\n /**\n * Re-acquire an existing session by id. Scope-bound, but the finalizer\n * detaches rather than destroying, for sessions kept warm beyond a\n * single run.\n */\n readonly attach: (\n id: BrowserSessionId,\n ) => Effect.Effect<BrowserSession, BrowserError.BrowserError, Scope.Scope>\n\n /** Enumerate sessions visible to the configured account / project. */\n readonly list: Effect.Effect<ReadonlyArray<BrowserSessionRef>, BrowserError.BrowserError>\n\n /**\n * Destroy a session from outside its owning scope. Most callers should\n * let the scope finalizer handle this.\n */\n readonly destroy: (id: BrowserSessionId) => Effect.Effect<void, BrowserError.BrowserError>\n}\n\nexport class Browser extends Context.Service<Browser, BrowserService>()(\n \"@betalyra/effect-uai/Browser\",\n) {}\n\n// ---------------------------------------------------------------------------\n// Free helpers\n// ---------------------------------------------------------------------------\n\n/**\n * Provision a session bound to the caller's scope. Drop the `Scope.Scope`\n * requirement with `Effect.scoped`.\n */\nexport const create = (\n request: CommonSessionRequest,\n): Effect.Effect<BrowserSession, BrowserError.BrowserError, Browser | Scope.Scope> =>\n Effect.flatMap(Browser.asEffect(), (s) => s.create(request))\n\n/**\n * Re-acquire an existing session by id. Same scope semantics as `create`,\n * but the finalizer detaches rather than destroying.\n */\nexport const attach = (\n id: BrowserSessionId,\n): Effect.Effect<BrowserSession, BrowserError.BrowserError, Browser | Scope.Scope> =>\n Effect.flatMap(Browser.asEffect(), (s) => s.attach(id))\n\n/** Enumerate sessions for the configured account / project. */\nexport const list: Effect.Effect<\n ReadonlyArray<BrowserSessionRef>,\n BrowserError.BrowserError,\n Browser\n> = Effect.flatMap(Browser.asEffect(), (s) => s.list)\n\n/**\n * Destroy a session from outside its owning scope. Most callers should let\n * the scope finalizer handle this automatically.\n */\nexport const destroy = (\n id: BrowserSessionId,\n): Effect.Effect<void, BrowserError.BrowserError, Browser> =>\n Effect.flatMap(Browser.asEffect(), (s) => s.destroy(id))\n"],"mappings":";;;;;;;;;;;AAcA,MAAa,mBAAmB,MAAM,SAA2B;AAqNjE,IAAa,UAAb,cAA6B,QAAQ,SAAkC,CACrE,+BACD,CAAC;;;;;AAUF,MAAa,UACX,YAEA,OAAO,QAAQ,QAAQ,UAAU,GAAG,MAAM,EAAE,OAAO,QAAQ,CAAC;;;;;AAM9D,MAAa,UACX,OAEA,OAAO,QAAQ,QAAQ,UAAU,GAAG,MAAM,EAAE,OAAO,GAAG,CAAC;;AAGzD,MAAa,OAIT,OAAO,QAAQ,QAAQ,UAAU,GAAG,MAAM,EAAE,KAAK;;;;;AAMrD,MAAa,WACX,OAEA,OAAO,QAAQ,QAAQ,UAAU,GAAG,MAAM,EAAE,QAAQ,GAAG,CAAC"}
|
|
1
|
+
{"version":3,"file":"Browser.mjs","names":[],"sources":["../../src/browser/Browser.ts"],"sourcesContent":["import { Brand, Context, type Duration, Effect, Scope } from \"effect\"\nimport type * as BrowserError from \"./BrowserError.js\"\n\n// ---------------------------------------------------------------------------\n// Identity\n// ---------------------------------------------------------------------------\n\n/**\n * Session identifier. Branded `string` so providers don't accidentally\n * accept a raw user-supplied id, and so a session id can't be passed where\n * another service's id is expected. Each provider mints these per its own\n * scheme; core code treats them opaquely. Mint via `BrowserSessionId(...)`.\n */\nexport type BrowserSessionId = Brand.Branded<string, \"BrowserSessionId\">\nexport const BrowserSessionId = Brand.nominal<BrowserSessionId>()\n\n/** Reference returned by `list`; enough to `attach`. */\nexport type BrowserSessionRef = {\n readonly id: BrowserSessionId\n /** Current top-level URL, when the provider reports it. */\n readonly url?: string\n}\n\n/**\n * Output representation for {@link BrowserSession.content}. `markdown` is\n * the default.\n */\nexport type PageFormat = \"markdown\" | \"html\"\n\n// ---------------------------------------------------------------------------\n// Create request\n// ---------------------------------------------------------------------------\n\n/**\n * Cross-provider session-create request. Provider-specific knobs (proxy,\n * stealth, persistent profile, ...) live on each provider's narrowed\n * request type which extends this.\n */\nexport type CommonSessionRequest = {\n /**\n * Hard max lifetime of the session. Enforced locally (the handle is\n * disposed and further calls fail with `BrowserSessionExpired`) and,\n * where the provider supports it, passed through as a server-side cap so\n * a crashed client still gets the session reclaimed. The provider cap\n * must be >= the local reaper. Accepts millis, a string like\n * `\"5 minutes\"`, or a `Duration`.\n */\n readonly timeout?: Duration.Input\n /**\n * Idle teardown: dispose the session after this much inactivity, the\n * timer resetting on each operation. Opt-in; omit for no idle limit.\n */\n readonly idleTimeout?: Duration.Input\n /** Initial viewport size. Providers default differently. */\n readonly viewport?: { readonly width: number; readonly height: number }\n}\n\n// ---------------------------------------------------------------------------\n// Observation shapes\n// ---------------------------------------------------------------------------\n\nexport type BoundingBox = {\n readonly x: number\n readonly y: number\n readonly width: number\n readonly height: number\n}\n\n/**\n * One element returned by {@link BrowserSession.query}. Serializable data,\n * not a live handle (handles go stale across navigation and do not cross a\n * provider boundary cleanly).\n */\nexport type ElementInfo = {\n /**\n * Reference usable as a selector for a follow-up action. Valid until the\n * next navigation; do not cache across `goto` or a page-changing click.\n */\n readonly ref: string\n readonly tag: string\n readonly text?: string\n readonly attributes: Readonly<Record<string, string>>\n readonly box?: BoundingBox\n}\n\n/** Accessibility-tree node returned by {@link BrowserSession.snapshot}. */\nexport type AxNode = {\n readonly role: string\n readonly name?: string\n readonly value?: string\n /**\n * Reference usable as a selector for a follow-up action. Valid until the\n * next navigation; do not cache across `goto` or a page-changing click.\n */\n readonly ref?: string\n readonly children: ReadonlyArray<AxNode>\n}\n\n// ---------------------------------------------------------------------------\n// Interaction shapes\n// ---------------------------------------------------------------------------\n\nexport type ScrollDirection = \"up\" | \"down\" | \"left\" | \"right\"\n\nexport type ScrollOptions = {\n readonly direction: ScrollDirection\n /** Distance in CSS pixels. Provider default applies when omitted. */\n readonly pixels?: number\n}\n\nexport type ScreenshotOptions = {\n /** Clip to the first element matching this selector. */\n readonly selector?: string\n /** Capture the full scrollable page rather than the viewport. */\n readonly fullPage?: boolean\n}\n\nexport type Cookie = {\n readonly name: string\n readonly value: string\n readonly domain?: string\n readonly path?: string\n readonly expires?: number\n readonly httpOnly?: boolean\n readonly secure?: boolean\n readonly sameSite?: \"Strict\" | \"Lax\" | \"None\"\n}\n\n/** Read / write the session's cookie jar. Needed for authenticated flows. */\nexport type CookieApi = {\n readonly get: Effect.Effect<ReadonlyArray<Cookie>, BrowserError.BrowserError>\n readonly set: (cookies: ReadonlyArray<Cookie>) => Effect.Effect<void, BrowserError.BrowserError>\n}\n\n// ---------------------------------------------------------------------------\n// Live session handle\n// ---------------------------------------------------------------------------\n\n/**\n * Live session handle. Actions take a CSS selector string (so `#id` is\n * just `#id`). Methods are plain `Effect` values; disposal is the scope\n * finalizer, not a method here (see {@link BrowserService}). Anything not\n * covered by a verb is reachable via `evaluate`. Per-operation time budgets\n * are the provider's default; wrap any call in `Effect.timeout` for a\n * tighter bound.\n */\nexport type BrowserSession = {\n readonly id: BrowserSessionId\n\n // Navigation and waiting\n readonly goto: (url: string) => Effect.Effect<void, BrowserError.BrowserError>\n readonly waitFor: (selector: string) => Effect.Effect<void, BrowserError.BrowserError>\n\n // Interaction\n readonly click: (selector: string) => Effect.Effect<void, BrowserError.BrowserError>\n readonly dblclick: (selector: string) => Effect.Effect<void, BrowserError.BrowserError>\n readonly fill: (selector: string, text: string) => Effect.Effect<void, BrowserError.BrowserError>\n readonly type: (selector: string, text: string) => Effect.Effect<void, BrowserError.BrowserError>\n readonly press: (key: string) => Effect.Effect<void, BrowserError.BrowserError>\n readonly hover: (selector: string) => Effect.Effect<void, BrowserError.BrowserError>\n readonly focus: (selector: string) => Effect.Effect<void, BrowserError.BrowserError>\n readonly select: (\n selector: string,\n value: string,\n ) => Effect.Effect<void, BrowserError.BrowserError>\n readonly check: (selector: string) => Effect.Effect<void, BrowserError.BrowserError>\n readonly uncheck: (selector: string) => Effect.Effect<void, BrowserError.BrowserError>\n readonly scroll: (options: ScrollOptions) => Effect.Effect<void, BrowserError.BrowserError>\n readonly scrollIntoView: (selector: string) => Effect.Effect<void, BrowserError.BrowserError>\n\n // Observation\n readonly content: (format?: PageFormat) => Effect.Effect<string, BrowserError.BrowserError>\n readonly screenshot: (\n options?: ScreenshotOptions,\n ) => Effect.Effect<Uint8Array, BrowserError.BrowserError>\n readonly snapshot: Effect.Effect<AxNode, BrowserError.BrowserError>\n readonly query: (\n selector: string,\n ) => Effect.Effect<ReadonlyArray<ElementInfo>, BrowserError.BrowserError>\n\n // State and escape hatch\n readonly cookies: CookieApi\n readonly evaluate: (script: string) => Effect.Effect<unknown, BrowserError.BrowserError>\n}\n\n// ---------------------------------------------------------------------------\n// Service definition\n// ---------------------------------------------------------------------------\n\n/**\n * Cross-provider browser service.\n *\n * Lifetime: `create` and `attach` return a handle in `Scope.Scope`. The\n * scope finalizer disposes the session (close the transport, destroy or\n * detach the remote session, kill the local engine). Bind with\n * `Effect.scoped` for a single call, or hold a wider scope to keep a\n * session warm across many calls. This is why there is no `dispose()` on\n * {@link BrowserSession}; the scope is the lifecycle handle.\n */\nexport type BrowserService = {\n /**\n * Provision a new session, bound to the caller's scope. Disposed on\n * scope close.\n */\n readonly create: (\n request: CommonSessionRequest,\n ) => Effect.Effect<BrowserSession, BrowserError.BrowserError, Scope.Scope>\n\n /**\n * Re-acquire an existing session by id. Scope-bound, but the finalizer\n * detaches rather than destroying, for sessions kept warm beyond a\n * single run.\n */\n readonly attach: (\n id: BrowserSessionId,\n ) => Effect.Effect<BrowserSession, BrowserError.BrowserError, Scope.Scope>\n\n /** Enumerate sessions visible to the configured account / project. */\n readonly list: Effect.Effect<ReadonlyArray<BrowserSessionRef>, BrowserError.BrowserError>\n\n /**\n * Destroy a session from outside its owning scope. Most callers should\n * let the scope finalizer handle this.\n */\n readonly destroy: (id: BrowserSessionId) => Effect.Effect<void, BrowserError.BrowserError>\n}\n\nexport class Browser extends Context.Service<Browser, BrowserService>()(\n \"@betalyra/effect-uai/Browser\",\n) {}\n\n// ---------------------------------------------------------------------------\n// Free helpers\n// ---------------------------------------------------------------------------\n\n/**\n * Provision a session bound to the caller's scope. Drop the `Scope.Scope`\n * requirement with `Effect.scoped`.\n */\nexport const create = (\n request: CommonSessionRequest,\n): Effect.Effect<BrowserSession, BrowserError.BrowserError, Browser | Scope.Scope> =>\n Effect.flatMap(Browser, (s) => s.create(request))\n\n/**\n * Re-acquire an existing session by id. Same scope semantics as `create`,\n * but the finalizer detaches rather than destroying.\n */\nexport const attach = (\n id: BrowserSessionId,\n): Effect.Effect<BrowserSession, BrowserError.BrowserError, Browser | Scope.Scope> =>\n Effect.flatMap(Browser, (s) => s.attach(id))\n\n/** Enumerate sessions for the configured account / project. */\nexport const list: Effect.Effect<\n ReadonlyArray<BrowserSessionRef>,\n BrowserError.BrowserError,\n Browser\n> = Effect.flatMap(Browser, (s) => s.list)\n\n/**\n * Destroy a session from outside its owning scope. Most callers should let\n * the scope finalizer handle this automatically.\n */\nexport const destroy = (\n id: BrowserSessionId,\n): Effect.Effect<void, BrowserError.BrowserError, Browser> =>\n Effect.flatMap(Browser, (s) => s.destroy(id))\n"],"mappings":";;;;;;;;;;;AAcA,MAAa,mBAAmB,MAAM,SAA2B;AAqNjE,IAAa,UAAb,cAA6B,QAAQ,SAAkC,CACrE,+BACD,CAAC;;;;;AAUF,MAAa,UACX,YAEA,OAAO,QAAQ,UAAU,MAAM,EAAE,OAAO,QAAQ,CAAC;;;;;AAMnD,MAAa,UACX,OAEA,OAAO,QAAQ,UAAU,MAAM,EAAE,OAAO,GAAG,CAAC;;AAG9C,MAAa,OAIT,OAAO,QAAQ,UAAU,MAAM,EAAE,KAAK;;;;;AAM1C,MAAa,WACX,OAEA,OAAO,QAAQ,UAAU,MAAM,EAAE,QAAQ,GAAG,CAAC"}
|