@effect-uai/core 0.17.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 +5 -5
- 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 +4 -4
- package/dist/dist-B5K-y4Be.mjs +191 -0
- package/dist/dist-B5K-y4Be.mjs.map +1 -0
- package/dist/dist-CorQTQL-.mjs +1533 -0
- package/dist/dist-CorQTQL-.mjs.map +1 -0
- package/dist/dist-DNeuh84d.mjs +7 -0
- package/dist/dist-DNeuh84d.mjs.map +1 -0
- package/dist/dist-DzeSyeYF.mjs +10253 -0
- package/dist/dist-DzeSyeYF.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 +3 -3
- 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/domain/Turn.test.mjs +2 -2
- package/dist/embedding-model/Embedding.d.mts +1 -1
- package/dist/embedding-model/EmbeddingModel.test.mjs +2 -2
- package/dist/embedding-model/EmbeddingModel.test.mjs.map +1 -1
- package/dist/image-generator/ImageGenerator.d.mts +10 -66
- package/dist/image-generator/ImageGenerator.d.mts.map +1 -1
- package/dist/index.C4tKZ0yW-LuFnBtmu.mjs +7042 -0
- package/dist/index.C4tKZ0yW-LuFnBtmu.mjs.map +1 -0
- package/dist/index.d.mts +10 -9
- package/dist/index.mjs +7 -6
- package/dist/language-model/LanguageModel.d.mts +2 -2
- package/dist/language-model/LanguageModel.test.mjs +2 -2
- package/dist/loop/Loop.d.mts +1 -1
- package/dist/loop/Loop.mjs.map +1 -1
- package/dist/loop/Loop.test.mjs +3 -3
- package/dist/math/Probability.test.mjs +2 -2
- package/dist/messenger/Messenger.d.mts +43 -289
- package/dist/messenger/Messenger.d.mts.map +1 -1
- package/dist/messenger/MessengerAdapter.test.mjs +3 -3
- package/dist/music-generator/MusicGenerator.test.mjs +3 -3
- package/dist/observability/Metrics.d.mts +1 -1
- package/dist/observability/Metrics.test.mjs +3 -3
- package/dist/observability/Telemetry.d.mts +1 -1
- package/dist/observability/Telemetry.mjs +1 -1
- package/dist/observability/Telemetry.mjs.map +1 -1
- package/dist/observability/Telemetry.test.mjs +4 -4
- package/dist/observability/Telemetry.test.mjs.map +1 -1
- package/dist/realtime/RealtimeSession.d.mts +1 -1
- package/dist/realtime/RealtimeSession.test.mjs +4 -4
- package/dist/retry/Retry.test.mjs +2 -2
- package/dist/sandbox/Sandbox.d.mts +32 -237
- package/dist/sandbox/Sandbox.d.mts.map +1 -1
- package/dist/speech-synthesizer/SpeechSynthesizer.test.mjs +3 -3
- package/dist/streaming/JSONL.test.mjs +2 -2
- package/dist/streaming/Multipart.d.mts +1 -1
- package/dist/streaming/Multipart.mjs +3 -2
- 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/SSE.d.mts +1 -1
- package/dist/streaming/SSE.mjs +2 -2
- package/dist/streaming/SSE.mjs.map +1 -1
- package/dist/streaming/SSE.test.mjs +2 -2
- package/dist/streaming/Settle.test.mjs +3 -3
- package/dist/streaming/WebSocketSession.d.mts +5 -3
- package/dist/streaming/WebSocketSession.d.mts.map +1 -1
- package/dist/streaming/WebSocketSession.mjs +22 -10
- package/dist/streaming/WebSocketSession.mjs.map +1 -1
- package/dist/streaming/WebSocketSession.test.mjs +41 -5
- package/dist/streaming/WebSocketSession.test.mjs.map +1 -1
- package/dist/structured-format/StructuredFormat.mjs.map +1 -1
- package/dist/structured-format/StructuredFormat.test.mjs +2 -2
- package/dist/testing/FakeWebSocket.d.mts +5 -1
- package/dist/testing/FakeWebSocket.d.mts.map +1 -1
- package/dist/testing/FakeWebSocket.mjs +12 -6
- package/dist/testing/FakeWebSocket.mjs.map +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 +222 -178
- 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 +433 -391
- package/dist/tool/Toolkit.test.mjs.map +1 -1
- package/dist/transcriber/Transcriber.test.mjs +3 -3
- 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 +18 -10
- 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/embedding-model/EmbeddingModel.test.ts +2 -2
- package/src/index.ts +3 -2
- package/src/loop/Loop.ts +25 -14
- package/src/observability/Telemetry.test.ts +1 -1
- package/src/observability/Telemetry.ts +2 -2
- package/src/streaming/Multipart.test.ts +26 -0
- package/src/streaming/Multipart.ts +6 -5
- package/src/streaming/SSE.ts +2 -2
- package/src/streaming/WebSocketSession.test.ts +54 -2
- package/src/streaming/WebSocketSession.ts +27 -6
- package/src/structured-format/StructuredFormat.ts +1 -1
- package/src/testing/FakeWebSocket.ts +21 -6
- 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 +204 -309
- 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-BaenoU1A.mjs +0 -145
- package/dist/dist-BaenoU1A.mjs.map +0 -1
- package/dist/dist-nohcnkD6.mjs +0 -182
- package/dist/dist-nohcnkD6.mjs.map +0 -1
- package/dist/magic-string.es-CB2hOw9v.mjs +0 -1014
- package/dist/magic-string.es-CB2hOw9v.mjs.map +0 -1
- package/dist/test.DNmyFkvJ-YPzDR0Co.mjs +0 -10254
- package/dist/test.DNmyFkvJ-YPzDR0Co.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/dist/utils-CiH_DjFW.mjs +0 -3918
- package/dist/utils-CiH_DjFW.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
|
@@ -65,7 +65,7 @@ export type WebReadToolOptions = {
|
|
|
65
65
|
*/
|
|
66
66
|
export const webReadTool = (
|
|
67
67
|
options?: WebReadToolOptions,
|
|
68
|
-
): Tool.Tool<string, WebReadToolArgs,
|
|
68
|
+
): Tool.Tool<string, WebReadToolArgs, string, never, AiError.AiError, WebRead> => {
|
|
69
69
|
const name = options?.name ?? "web_read"
|
|
70
70
|
const format = options?.format ?? "markdown"
|
|
71
71
|
const maxChars = options?.maxChars ?? 20_000
|
|
@@ -75,6 +75,7 @@ export const webReadTool = (
|
|
|
75
75
|
description:
|
|
76
76
|
"Read a web page and return its content as clean text. Use it to read a promising URL in full (e.g. one found via search).",
|
|
77
77
|
inputSchema: Tool.fromEffectSchema(WebReadToolArgs),
|
|
78
|
+
outputSchema: Schema.String,
|
|
78
79
|
// The call is wrapped in a tracing span so agent traces show the tool
|
|
79
80
|
// invocation (url, format, content length) nested under the model turn.
|
|
80
81
|
// `withSpan` is a no-op until a Tracer is installed, so this is free by
|
|
@@ -72,7 +72,7 @@ export type WebSearchToolOptions = {
|
|
|
72
72
|
*/
|
|
73
73
|
export const webSearchTool = (
|
|
74
74
|
options?: WebSearchToolOptions,
|
|
75
|
-
): Tool.Tool<string, WebSearchToolArgs,
|
|
75
|
+
): Tool.Tool<string, WebSearchToolArgs, string, never, AiError.AiError, WebSearch> => {
|
|
76
76
|
const name = options?.name ?? "web_search"
|
|
77
77
|
const render = options?.render ?? defaultRender
|
|
78
78
|
const maxResults = options?.maxResults ?? 5
|
|
@@ -83,6 +83,7 @@ export const webSearchTool = (
|
|
|
83
83
|
description:
|
|
84
84
|
"Search the web for current information. Returns ranked results with titles, URLs, and snippets.",
|
|
85
85
|
inputSchema: Tool.fromEffectSchema(WebSearchToolArgs),
|
|
86
|
+
outputSchema: Schema.String,
|
|
86
87
|
// The call is wrapped in a tracing span so agent traces show the tool
|
|
87
88
|
// invocation (query, filters, result count) nested under the model turn.
|
|
88
89
|
// `withSpan` is a no-op until a Tracer is installed, so this is free by
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Image-Cv6iBLTy.d.mts","names":[],"sources":["../src/domain/Image.ts"],"mappings":";;;;;;;;;;;;;KAoBY;KAYA,iBAAiB,SAAS;KAC1B,oBAAoB,YAAY;KAChC,mBAAmB,WAAW;;;;;;;;KAS9B,cAAc,YAAY;cAEzB,gBAAc,OAAA;;;;cAKd,mBAAiB,OAAA;;;;cAKjB,kBAA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AAG,IAAI,GAAG;;;;;;;;;;cAW5E;GACV,GAAG,GAAG,GAAG,GAAG,MAAM,SAAS,GAAG,GAAG,GAAG,MAAM,SAAS,MAAM,OAAO,OAAO,GAAG,GAAG;GAC7E,GAAG,GAAG,GAAG,GAAG,SAAS,GAAG,MAAM,SAAS,GAAG,GAAG,GAAG,KAAK,OAAO,OAAO,GAAG,GAAG;;KA2FvE,aAAa,GAAG,GAAG,GAAG,GAAG,MAC5B,OAAO,GACP,OAAO,MACJ,OAAO,OAAO,KAAK,GAAG,IAAI,GAAG,KAAK,OAAO,OAAO,OAAO,OAAO,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;cAyB5E;GACV,GAAG,GAAG,GAAG,GAAG,GACX,SAAS,GACT,MAAM,aAAa,GAAG,GAAG,GAAG,GAAG,MAC7B,IAAI,IAAI,OAAO,OAAO,OAAO,GAAG,IAAI,QAAQ,OAAO,OAAO,GAAG,IAAI,IAAI,IAAI;GAC5E,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,IAClB,OAAO,OAAO,OAAO,GAAG,IAAI,KAC5B,SAAS,GACT,MAAM,aAAa,GAAG,GAAG,GAAG,GAAG,KAC9B,OAAO,OAAO,GAAG,IAAI,IAAI,IAAI;;;;;;;;;;;;;;;;;;;;;;cAmErB,gBAAiB,GAAG,GAAG,GAAG,GAAC,SAC7B,GAAC,MACJ,SAAS,GAAG,GAAG,GAAG,OACvB,OAAO;WACC,QAAQ,OAAO,OAAO,GAAG,GAAG;WAC5B,OAAO,gBAAgB,gBAAgB"}
|
package/dist/Tool-BF78QWtn.d.mts
DELETED
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
import { b as ToolCallOutput, y as ToolCall } from "./Items-C7MyrYPX.mjs";
|
|
2
|
-
import { Effect, Schema } from "effect";
|
|
3
|
-
import { StandardJSONSchemaV1, StandardSchemaV1 } from "@standard-schema/spec";
|
|
4
|
-
declare namespace Tool_d_exports {
|
|
5
|
-
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 };
|
|
6
|
-
}
|
|
7
|
-
declare const ToolError_base: Schema.Class<ToolError, Schema.TaggedStruct<"ToolError", {
|
|
8
|
-
readonly call_id: Schema.String;
|
|
9
|
-
readonly tool: Schema.String;
|
|
10
|
-
readonly message: Schema.String;
|
|
11
|
-
readonly cause: Schema.optional<Schema.Unknown>;
|
|
12
|
-
}>, import("effect/Cause").YieldableError>;
|
|
13
|
-
declare class ToolError extends ToolError_base {}
|
|
14
|
-
declare const ToolValidationError_base: Schema.Class<ToolValidationError, Schema.TaggedStruct<"ToolValidationError", {
|
|
15
|
-
readonly call_id: Schema.String;
|
|
16
|
-
readonly tool: Schema.String;
|
|
17
|
-
readonly issues: Schema.$Array<Schema.Struct<{
|
|
18
|
-
readonly message: Schema.String;
|
|
19
|
-
readonly path: Schema.optional<Schema.$Array<Schema.Unknown>>;
|
|
20
|
-
}>>;
|
|
21
|
-
}>, import("effect/Cause").YieldableError>;
|
|
22
|
-
/**
|
|
23
|
-
* The model's `arguments` for a call failed the tool's `inputSchema`. Distinct
|
|
24
|
-
* from `ToolError` (malformed JSON, runtime crash) so callers can tell a
|
|
25
|
-
* contract violation apart from a parse or execution failure, and so the
|
|
26
|
-
* structured `issues` survive instead of being flattened into a message string.
|
|
27
|
-
*/
|
|
28
|
-
declare class ToolValidationError extends ToolValidationError_base {}
|
|
29
|
-
declare const ToolFailed_base: Schema.Class<ToolFailed, Schema.TaggedStruct<"ToolFailed", {
|
|
30
|
-
readonly message: Schema.String;
|
|
31
|
-
readonly kind: Schema.optional<Schema.String>;
|
|
32
|
-
}>, import("effect/Cause").YieldableError>;
|
|
33
|
-
/**
|
|
34
|
-
* The deliberate "speak to the model" failure sentinel. A tool's `run` that
|
|
35
|
-
* fails with a `ToolFailed` (or a bare `string`, its sugar) is absorbed by
|
|
36
|
-
* `Toolkit.run` into a `ToolResult.Failure` the model reads and adapts to,
|
|
37
|
-
* instead of ending the run. Every other error type propagates typed on the
|
|
38
|
-
* executor's stream. `kind` overrides the synthesized `Failure.kind`
|
|
39
|
-
* (default `"tool_failed"`) so a tool can hand the model a distinguishable
|
|
40
|
-
* category (`"not_found"`, `"rate_limited"`) without a new result variant.
|
|
41
|
-
*/
|
|
42
|
-
declare class ToolFailed extends ToolFailed_base {}
|
|
43
|
-
/**
|
|
44
|
-
* Fail a tool's `run` with a model-visible message (optionally a `kind`).
|
|
45
|
-
* `yield* Tool.fail("page not found", { kind: "not_found" })` inside a
|
|
46
|
-
* `run`'s `Effect.gen`; the executor absorbs it as `ToolResult.Failure`.
|
|
47
|
-
*/
|
|
48
|
-
declare const fail: (message: string, options?: {
|
|
49
|
-
readonly kind?: string;
|
|
50
|
-
}) => Effect.Effect<never, ToolFailed>;
|
|
51
|
-
/**
|
|
52
|
-
* Schemas accepted on `Tool.inputSchema`. Must implement both Standard
|
|
53
|
-
* Schema validation and JSON Schema conversion (for rendering tool
|
|
54
|
-
* descriptors to provider request bodies).
|
|
55
|
-
*
|
|
56
|
-
* Any Standard-Schema-compliant library that exposes both interfaces
|
|
57
|
-
* works directly: Zod 4+, Valibot, ArkType, Effect Schema (after
|
|
58
|
-
* `fromEffectSchema`), etc.
|
|
59
|
-
*/
|
|
60
|
-
type ToolInputSchema<Input = unknown> = StandardSchemaV1<unknown, Input> & StandardJSONSchemaV1<unknown, Input>;
|
|
61
|
-
/**
|
|
62
|
-
* Convenience wrapper for Effect Schema users - adds both the
|
|
63
|
-
* `validate` and `jsonSchema` extensions to a plain Effect Schema so it
|
|
64
|
-
* can be used as a `Tool.inputSchema`.
|
|
65
|
-
*/
|
|
66
|
-
declare const fromEffectSchema: <S extends Schema.Codec<any, any, never, any>>(schema: S) => S & ToolInputSchema<S["Type"]>;
|
|
67
|
-
/**
|
|
68
|
-
* Use any schema library that implements both Standard Schema (validation)
|
|
69
|
-
* and Standard JSON Schema (JSON Schema generation) as a `Tool.inputSchema`.
|
|
70
|
-
* Covers Zod 4.2+, Valibot 1.2+, and ArkType 2.1.28+ in one helper.
|
|
71
|
-
*
|
|
72
|
-
* Effect Schema doesn't implement Standard JSON Schema natively — use
|
|
73
|
-
* `fromEffectSchema` for those.
|
|
74
|
-
*
|
|
75
|
-
* The intersection constraint catches missing interfaces at compile time:
|
|
76
|
-
* a Zod v3 schema (no Standard JSON Schema) produces a precise type error
|
|
77
|
-
* pointing at the missing interface rather than a runtime surprise. The
|
|
78
|
-
* helper itself is a thin type-narrowing identity — schemas that satisfy
|
|
79
|
-
* both standards already structurally satisfy `ToolInputSchema`; the
|
|
80
|
-
* helper makes the input type inference explicit at the call site.
|
|
81
|
-
*/
|
|
82
|
-
declare const fromStandardSchema: <S extends StandardSchemaV1 & StandardJSONSchemaV1>(schema: S) => S & ToolInputSchema<StandardSchemaV1.InferOutput<S>>;
|
|
83
|
-
/**
|
|
84
|
-
* Input schema for a tool that takes no arguments. Renders a clean
|
|
85
|
-
* `{ type: "object", properties: {} }`; validation accepts anything and
|
|
86
|
-
* yields `{}`. Use it instead of `fromEffectSchema(Schema.Struct({}))`,
|
|
87
|
-
* which renders a degenerate `anyOf` (object-or-array) that strict
|
|
88
|
-
* providers like Gemini reject.
|
|
89
|
-
*/
|
|
90
|
-
declare const noInput: ToolInputSchema<Record<string, never>>;
|
|
91
|
-
/**
|
|
92
|
-
* Emit one intermediate `Event` from inside a tool's `run`. Backed by the
|
|
93
|
-
* executor's per-call queue, so it returns an `Effect` (backpressure) and
|
|
94
|
-
* composes with `Stream.runForEach(emit)`.
|
|
95
|
-
*/
|
|
96
|
-
type Emit<Event> = (event: Event) => Effect.Effect<void>;
|
|
97
|
-
/**
|
|
98
|
-
* A model-visible tool with a local `Effect` executor. `run` computes the
|
|
99
|
-
* model-facing `Output`; emitting progress is a side channel via `emit`. A
|
|
100
|
-
* plain tool never calls `emit` (its `Event` is irrelevant); a streaming tool
|
|
101
|
-
* emits intermediate `Event`s that flow to the consumer as
|
|
102
|
-
* `ToolEvent.Progress` in real time.
|
|
103
|
-
*
|
|
104
|
-
* This is one of four tool *kinds*, discriminated by `_tag`. The other three
|
|
105
|
-
* (`ProviderTool`, `SignalTool`, `InteractionTool`) are model-visible but have
|
|
106
|
-
* no local executor — see their constructors below. `Tool` keeps its name (and
|
|
107
|
-
* the `Tool.make` constructor) because the local kind is by far the common one.
|
|
108
|
-
*/
|
|
109
|
-
type Tool<Name extends string, Input, Event, Output, E = unknown, R = never> = {
|
|
110
|
-
readonly _tag: "LocalTool";
|
|
111
|
-
readonly name: Name;
|
|
112
|
-
readonly description: string;
|
|
113
|
-
readonly inputSchema: ToolInputSchema<Input>;
|
|
114
|
-
readonly run: (input: Input, emit: Emit<Event>) => Effect.Effect<Output, E, R>;
|
|
115
|
-
/**
|
|
116
|
-
* Bound on this tool's emit queue. Unbounded when omitted. Per-tool because
|
|
117
|
-
* backpressure depends on how a given tool emits, unlike `concurrency`
|
|
118
|
-
* (cross-tool, on `Toolkit.run`'s options).
|
|
119
|
-
*/
|
|
120
|
-
readonly emitBufferSize?: number;
|
|
121
|
-
/**
|
|
122
|
-
* Whether the provider should render this tool with its strict-mode
|
|
123
|
-
* flag (OpenAI's `strict: true`, etc). Default: true. The framework
|
|
124
|
-
* never rewrites the schema; if the rendered JSON Schema isn't
|
|
125
|
-
* compatible, the provider returns an error.
|
|
126
|
-
*/
|
|
127
|
-
readonly strict?: boolean;
|
|
128
|
-
};
|
|
129
|
-
/**
|
|
130
|
-
* A provider-hosted tool: visible to the model and executed by the *provider*
|
|
131
|
-
* (native web search, code execution, RAG grounding), never by this process.
|
|
132
|
-
* It has no local `run`; `provider`/`config` tell the provider adapter how to
|
|
133
|
-
* render it. Passing it to `Toolkit.run` yields a `non_local_tool` result.
|
|
134
|
-
*/
|
|
135
|
-
type ProviderTool<Name extends string, Input, Provider extends string, Config> = {
|
|
136
|
-
readonly _tag: "ProviderTool";
|
|
137
|
-
readonly name: Name;
|
|
138
|
-
readonly description: string;
|
|
139
|
-
readonly inputSchema: ToolInputSchema<Input>;
|
|
140
|
-
readonly provider: Provider;
|
|
141
|
-
readonly config: Config;
|
|
142
|
-
readonly strict?: boolean;
|
|
143
|
-
};
|
|
144
|
-
/**
|
|
145
|
-
* A typed request for the agent loop to change control flow (escalate, pause,
|
|
146
|
-
* schedule, hand off). Model-visible and decodable (`decodeArgs`) but never
|
|
147
|
-
* locally executed — the loop intercepts the call in `onTurnComplete` and acts
|
|
148
|
-
* on it, so there is no fake `run`. `Toolkit.run` reports it as `non_local_tool`.
|
|
149
|
-
*/
|
|
150
|
-
type SignalTool<Name extends string, Input> = {
|
|
151
|
-
readonly _tag: "SignalTool";
|
|
152
|
-
readonly name: Name;
|
|
153
|
-
readonly description: string;
|
|
154
|
-
readonly inputSchema: ToolInputSchema<Input>;
|
|
155
|
-
};
|
|
156
|
-
/**
|
|
157
|
-
* A typed request for an external actor (user, channel, frontend) to respond
|
|
158
|
-
* before the loop resumes. Like `SignalTool` it is decode-only, but its
|
|
159
|
-
* lifecycle differs: the loop usually stops/pauses and resumes later by
|
|
160
|
-
* appending a `function_call_output` once the actor replies.
|
|
161
|
-
*/
|
|
162
|
-
type InteractionTool<Name extends string, Input> = {
|
|
163
|
-
readonly _tag: "InteractionTool";
|
|
164
|
-
readonly name: Name;
|
|
165
|
-
readonly description: string;
|
|
166
|
-
readonly inputSchema: ToolInputSchema<Input>;
|
|
167
|
-
};
|
|
168
|
-
/** A local (executable) tool of any shape. Readability alias. */
|
|
169
|
-
type AnyLocalTool<E = any, R = any> = Tool<string, any, any, any, E, R>;
|
|
170
|
-
/** Any of the four model-visible tool kinds. */
|
|
171
|
-
type AnyTool<E = any, R = any> = Tool<string, any, any, any, E, R> | ProviderTool<string, any, string, any> | SignalTool<string, any> | InteractionTool<string, any>;
|
|
172
|
-
/** A model-visible tool that carries a decodable input schema (every kind). */
|
|
173
|
-
type DecodableTool<Input> = {
|
|
174
|
-
readonly name: string;
|
|
175
|
-
readonly inputSchema: ToolInputSchema<Input>;
|
|
176
|
-
};
|
|
177
|
-
/** Extract the `R` of a local tool; non-local kinds contribute `never`. */
|
|
178
|
-
type ToolR<T> = T extends Tool<string, any, any, any, any, infer R> ? R : never;
|
|
179
|
-
/** Extract the `E` of a local tool; non-local kinds contribute `never`. */
|
|
180
|
-
type ToolE<T> = T extends Tool<string, any, any, any, infer E, any> ? E : never;
|
|
181
|
-
/**
|
|
182
|
-
* Provider-agnostic tool descriptor. Each provider maps `inputSchema`
|
|
183
|
-
* to its own wire field (OpenAI → `parameters`, Anthropic →
|
|
184
|
-
* `input_schema`). Built from a `Tool` by `Tool.toDescriptors`.
|
|
185
|
-
*/
|
|
186
|
-
type ToolDescriptor = {
|
|
187
|
-
readonly name: string;
|
|
188
|
-
readonly description: string;
|
|
189
|
-
readonly inputSchema: Record<string, unknown>;
|
|
190
|
-
readonly strict?: boolean;
|
|
191
|
-
};
|
|
192
|
-
/** A model-visible tool with a local `Effect` executor. */
|
|
193
|
-
declare const make: {
|
|
194
|
-
<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"> & {
|
|
195
|
-
readonly inputSchema: S;
|
|
196
|
-
}): Tool<Name, S["Type"], Event, Output, E, R>;
|
|
197
|
-
<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>;
|
|
198
|
-
};
|
|
199
|
-
/**
|
|
200
|
-
* A provider-hosted tool (native web search, code execution, RAG grounding).
|
|
201
|
-
* No local executor — `provider`/`config` drive the provider adapter's
|
|
202
|
-
* rendering. The model sees it; `Toolkit.run` reports it as `non_local_tool`.
|
|
203
|
-
*/
|
|
204
|
-
declare const provider: {
|
|
205
|
-
<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"> & {
|
|
206
|
-
readonly inputSchema: S;
|
|
207
|
-
}): ProviderTool<Name, S["Type"], Provider, Config>;
|
|
208
|
-
<Name extends string, Input, Provider extends string, Config>(spec: Omit<ProviderTool<Name, Input, Provider, Config>, "_tag">): ProviderTool<Name, Input, Provider, Config>;
|
|
209
|
-
};
|
|
210
|
-
/**
|
|
211
|
-
* A typed control-flow signal to the agent loop (escalate, pause, schedule,
|
|
212
|
-
* hand off). Decode-only: the loop interprets the call rather than executing a
|
|
213
|
-
* handler, so there is no `run`.
|
|
214
|
-
*/
|
|
215
|
-
declare const signal: {
|
|
216
|
-
<Name extends string, S extends Schema.Codec<any, any, never, any>>(spec: Omit<SignalTool<Name, S["Type"]>, "_tag" | "inputSchema"> & {
|
|
217
|
-
readonly inputSchema: S;
|
|
218
|
-
}): SignalTool<Name, S["Type"]>;
|
|
219
|
-
<Name extends string, Input>(spec: Omit<SignalTool<Name, Input>, "_tag">): SignalTool<Name, Input>;
|
|
220
|
-
};
|
|
221
|
-
/**
|
|
222
|
-
* A typed request for an external actor to respond before the loop resumes
|
|
223
|
-
* (frontend, Telegram, CLI prompt). Decode-only; the loop stops/pauses and
|
|
224
|
-
* resumes by appending the actor's `function_call_output`.
|
|
225
|
-
*/
|
|
226
|
-
declare const interaction: {
|
|
227
|
-
<Name extends string, S extends Schema.Codec<any, any, never, any>>(spec: Omit<InteractionTool<Name, S["Type"]>, "_tag" | "inputSchema"> & {
|
|
228
|
-
readonly inputSchema: S;
|
|
229
|
-
}): InteractionTool<Name, S["Type"]>;
|
|
230
|
-
<Name extends string, Input>(spec: Omit<InteractionTool<Name, Input>, "_tag">): InteractionTool<Name, Input>;
|
|
231
|
-
};
|
|
232
|
-
/**
|
|
233
|
-
* Return a copy of a tool under a new `name`. Useful for resolving a name
|
|
234
|
-
* clash before combining tools into one `Toolkit`. Literal-preserving, so the
|
|
235
|
-
* renamed tool keys the toolkit record under the new name statically.
|
|
236
|
-
*/
|
|
237
|
-
declare const withName: <N extends string, T extends AnyTool>(tool: T, name: N) => Omit<T, "name"> & {
|
|
238
|
-
readonly name: N;
|
|
239
|
-
};
|
|
240
|
-
/**
|
|
241
|
-
* Replace a local tool's `run`, keeping its model-facing definition (name,
|
|
242
|
-
* description, schema, `_tag`) identical. The new `run`'s `input` is typed from
|
|
243
|
-
* the original tool, so override/mock need no annotation:
|
|
244
|
-
*
|
|
245
|
-
* const safe = { ...toolkit, send_email: Tool.withRun(toolkit.send_email,
|
|
246
|
-
* ({ to }) => Effect.succeed({ status: "dry-run", to })) }
|
|
247
|
-
*
|
|
248
|
-
* Descriptors stay identical to production, so a mocked toolkit can't drift
|
|
249
|
-
* from the contract the model sees.
|
|
250
|
-
*/
|
|
251
|
-
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>;
|
|
252
|
-
/** True for provider-hosted tools — the kind a provider renders natively. */
|
|
253
|
-
declare const isProviderTool: (tool: AnyTool) => tool is ProviderTool<string, any, string, any>;
|
|
254
|
-
/**
|
|
255
|
-
* The `ProviderTool`s in a toolkit, for a provider adapter to render as its
|
|
256
|
-
* native hosted-tool entries (web search, code execution, grounding). The other
|
|
257
|
-
* kinds render as function declarations via `descriptorsOf`.
|
|
258
|
-
*/
|
|
259
|
-
declare const providerToolsOf: (toolkit?: Readonly<Record<string, AnyTool>>) => ReadonlyArray<ProviderTool<string, any, string, any>>;
|
|
260
|
-
/**
|
|
261
|
-
* Render tools to provider-agnostic descriptors. `ProviderTool`s are excluded:
|
|
262
|
-
* they are provider-hosted and must never leak into the function-declaration
|
|
263
|
-
* list — each adapter renders them natively via `providerToolsOf`. Every other
|
|
264
|
-
* kind is model-visible as a declaration.
|
|
265
|
-
*/
|
|
266
|
-
declare const toDescriptors: (tools: ReadonlyArray<AnyTool>) => ReadonlyArray<ToolDescriptor>;
|
|
267
|
-
/**
|
|
268
|
-
* Render a `Toolkit` (a name-indexed record of tools) to descriptors, treating
|
|
269
|
-
* an absent toolkit as no tools. The normalization point the `LanguageModel`
|
|
270
|
-
* boundary uses so a request can carry the toolkit itself instead of a
|
|
271
|
-
* pre-rendered descriptor array. Lives here (not on `Toolkit`) to keep providers
|
|
272
|
-
* free of a dependency on the toolkit module — it only needs the tool values.
|
|
273
|
-
*/
|
|
274
|
-
declare const descriptorsOf: (toolkit?: Readonly<Record<string, AnyTool>>) => ReadonlyArray<ToolDescriptor>;
|
|
275
|
-
/**
|
|
276
|
-
* Outcome of decoding a call's `arguments` against a tool's `inputSchema`,
|
|
277
|
-
* as data so both the typed (`decodeArgs`) and result-synthesizing
|
|
278
|
-
* (`Toolkit.run`) callers can translate it their own way.
|
|
279
|
-
*/
|
|
280
|
-
type DecodeResult<Input> = {
|
|
281
|
-
readonly _tag: "ok";
|
|
282
|
-
readonly input: Input;
|
|
283
|
-
} | {
|
|
284
|
-
readonly _tag: "parseError";
|
|
285
|
-
} | {
|
|
286
|
-
readonly _tag: "invalid";
|
|
287
|
-
readonly issues: ReadonlyArray<StandardSchemaV1.Issue>;
|
|
288
|
-
};
|
|
289
|
-
/**
|
|
290
|
-
* Parse and validate a call's `arguments`. Empty arguments normalize to
|
|
291
|
-
* `{}` (some models emit `""` for zero-arg tools); a throwing validator is
|
|
292
|
-
* captured, not propagated. Never fails.
|
|
293
|
-
*/
|
|
294
|
-
declare const decodeCallInput: <Input>(tool: DecodableTool<Input>, call: ToolCall) => Effect.Effect<DecodeResult<Input>>;
|
|
295
|
-
/**
|
|
296
|
-
* Decode and validate a function_call's JSON `arguments` against the tool's
|
|
297
|
-
* own `inputSchema`, yielding the typed input. The decode-only half of
|
|
298
|
-
* `execute` - reach for it when you intercept a call to translate it into a
|
|
299
|
-
* control-flow decision rather than running the tool's `run`.
|
|
300
|
-
*
|
|
301
|
-
* Malformed JSON fails with `ToolError`; a parsed body that violates
|
|
302
|
-
* `inputSchema` fails with `ToolValidationError` carrying the issues.
|
|
303
|
-
*/
|
|
304
|
-
declare const decodeArgs: <Input>(tool: DecodableTool<Input>, call: ToolCall) => Effect.Effect<Input, ToolError | ToolValidationError>;
|
|
305
|
-
/**
|
|
306
|
-
* Decode and validate the JSON arguments of a function_call against the
|
|
307
|
-
* tool's input schema, run the tool, and serialize the output into a
|
|
308
|
-
* function_call_output item. Single-shot: intermediate events emitted by
|
|
309
|
-
* `run` are discarded (use `Toolkit.run` to stream them).
|
|
310
|
-
*/
|
|
311
|
-
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>;
|
|
312
|
-
//#endregion
|
|
313
|
-
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 };
|
|
314
|
-
//# sourceMappingURL=Tool-BF78QWtn.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Tool-BF78QWtn.d.mts","names":[],"sources":["../src/tool/Tool.ts"],"mappings":";;;;;;;;;;;;cAMa,kBAAkB;;;;;;;;;;;;;;;cA0BlB,4BAA4B;;;;;;;;;;;;;;cAiB5B,mBAAmB;;;;;;cAanB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AAO;;WAC5B;;WACA;WAA0B,QAAQ,cAAc,iBAAiB;;;;;;;cAWnE,kBAAmB,OAAK,MAC7B,cAAc,QAAM,MACpB,aACL,OAAO,OAAO,aAAa;;;;;;;;;;cAgCjB,aAAc,OAAK,MACxB,cAAc,QAAM,MACpB,aACL,OAAO,OAAO,OAAO,YAAY;;;;;;;cA4BvB,UAAW,qBAAqB,OAAO,OAAO,QAAQ,GAAG,GAAC,MAC/D,KAAK,MAAM,OAAO,OAAO,QAAQ,GAAG,IAAE,MACtC,aACL,OAAO,OAAO,gBAAgB,IAAI,YAAY,qBAAqB"}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { t as ToolResult } from "./ToolResult-BsYQRjmW.mjs";
|
|
2
|
-
import { Data } from "effect";
|
|
3
|
-
declare namespace ToolEvent_d_exports {
|
|
4
|
-
export { ToolEvent, isApprovalRequested, isOutput, isProgress };
|
|
5
|
-
}
|
|
6
|
-
type ToolEvent = Data.TaggedEnum<{
|
|
7
|
-
ApprovalRequested: {
|
|
8
|
-
readonly call_id: string;
|
|
9
|
-
readonly tool: string;
|
|
10
|
-
readonly arguments: string;
|
|
11
|
-
};
|
|
12
|
-
Progress: {
|
|
13
|
-
readonly call_id: string;
|
|
14
|
-
readonly tool: string;
|
|
15
|
-
readonly data: unknown;
|
|
16
|
-
};
|
|
17
|
-
Output: {
|
|
18
|
-
readonly result: ToolResult;
|
|
19
|
-
};
|
|
20
|
-
}>;
|
|
21
|
-
/**
|
|
22
|
-
* Namespace of constructors, type guards, and matchers for `ToolEvent`,
|
|
23
|
-
* provided by `Data.taggedEnum`. Use `ToolEvent.Output({ result })` to build
|
|
24
|
-
* an event, `ToolEvent.$is("Output")` for type narrowing,
|
|
25
|
-
* `ToolEvent.$match({ ApprovalRequested, Progress, Output })` for
|
|
26
|
-
* exhaustive pattern matching.
|
|
27
|
-
*/
|
|
28
|
-
declare const ToolEvent: {
|
|
29
|
-
readonly $is: <Tag extends "ApprovalRequested" | "Output" | "Progress">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
30
|
-
readonly _tag: "ApprovalRequested";
|
|
31
|
-
readonly call_id: string;
|
|
32
|
-
readonly tool: string;
|
|
33
|
-
readonly arguments: string;
|
|
34
|
-
}, {
|
|
35
|
-
readonly _tag: Tag;
|
|
36
|
-
}> | Extract<{
|
|
37
|
-
readonly _tag: "Output";
|
|
38
|
-
readonly result: ToolResult;
|
|
39
|
-
}, {
|
|
40
|
-
readonly _tag: Tag;
|
|
41
|
-
}> | Extract<{
|
|
42
|
-
readonly _tag: "Progress";
|
|
43
|
-
readonly call_id: string;
|
|
44
|
-
readonly tool: string;
|
|
45
|
-
readonly data: unknown;
|
|
46
|
-
}, {
|
|
47
|
-
readonly _tag: Tag;
|
|
48
|
-
}>;
|
|
49
|
-
readonly $match: {
|
|
50
|
-
<Cases extends { readonly [Tag in "ApprovalRequested" | "Output" | "Progress"]: (args: Extract<{
|
|
51
|
-
readonly _tag: "ApprovalRequested";
|
|
52
|
-
readonly call_id: string;
|
|
53
|
-
readonly tool: string;
|
|
54
|
-
readonly arguments: string;
|
|
55
|
-
} | {
|
|
56
|
-
readonly _tag: "Output";
|
|
57
|
-
readonly result: ToolResult;
|
|
58
|
-
} | {
|
|
59
|
-
readonly _tag: "Progress";
|
|
60
|
-
readonly call_id: string;
|
|
61
|
-
readonly tool: string;
|
|
62
|
-
readonly data: unknown;
|
|
63
|
-
}, {
|
|
64
|
-
readonly _tag: Tag;
|
|
65
|
-
}>) => any; }>(cases: Cases): (value: {
|
|
66
|
-
readonly _tag: "ApprovalRequested";
|
|
67
|
-
readonly call_id: string;
|
|
68
|
-
readonly tool: string;
|
|
69
|
-
readonly arguments: string;
|
|
70
|
-
} | {
|
|
71
|
-
readonly _tag: "Output";
|
|
72
|
-
readonly result: ToolResult;
|
|
73
|
-
} | {
|
|
74
|
-
readonly _tag: "Progress";
|
|
75
|
-
readonly call_id: string;
|
|
76
|
-
readonly tool: string;
|
|
77
|
-
readonly data: unknown;
|
|
78
|
-
}) => import("effect/Unify").Unify<ReturnType<Cases["ApprovalRequested" | "Output" | "Progress"]>>;
|
|
79
|
-
<Cases extends { readonly [Tag in "ApprovalRequested" | "Output" | "Progress"]: (args: Extract<{
|
|
80
|
-
readonly _tag: "ApprovalRequested";
|
|
81
|
-
readonly call_id: string;
|
|
82
|
-
readonly tool: string;
|
|
83
|
-
readonly arguments: string;
|
|
84
|
-
} | {
|
|
85
|
-
readonly _tag: "Output";
|
|
86
|
-
readonly result: ToolResult;
|
|
87
|
-
} | {
|
|
88
|
-
readonly _tag: "Progress";
|
|
89
|
-
readonly call_id: string;
|
|
90
|
-
readonly tool: string;
|
|
91
|
-
readonly data: unknown;
|
|
92
|
-
}, {
|
|
93
|
-
readonly _tag: Tag;
|
|
94
|
-
}>) => any; }>(value: {
|
|
95
|
-
readonly _tag: "ApprovalRequested";
|
|
96
|
-
readonly call_id: string;
|
|
97
|
-
readonly tool: string;
|
|
98
|
-
readonly arguments: string;
|
|
99
|
-
} | {
|
|
100
|
-
readonly _tag: "Output";
|
|
101
|
-
readonly result: ToolResult;
|
|
102
|
-
} | {
|
|
103
|
-
readonly _tag: "Progress";
|
|
104
|
-
readonly call_id: string;
|
|
105
|
-
readonly tool: string;
|
|
106
|
-
readonly data: unknown;
|
|
107
|
-
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["ApprovalRequested" | "Output" | "Progress"]>>;
|
|
108
|
-
};
|
|
109
|
-
readonly ApprovalRequested: Data.TaggedEnum.ConstructorFrom<{
|
|
110
|
-
readonly _tag: "ApprovalRequested";
|
|
111
|
-
readonly call_id: string;
|
|
112
|
-
readonly tool: string;
|
|
113
|
-
readonly arguments: string;
|
|
114
|
-
}, "_tag">;
|
|
115
|
-
readonly Output: Data.TaggedEnum.ConstructorFrom<{
|
|
116
|
-
readonly _tag: "Output";
|
|
117
|
-
readonly result: ToolResult;
|
|
118
|
-
}, "_tag">;
|
|
119
|
-
readonly Progress: Data.TaggedEnum.ConstructorFrom<{
|
|
120
|
-
readonly _tag: "Progress";
|
|
121
|
-
readonly call_id: string;
|
|
122
|
-
readonly tool: string;
|
|
123
|
-
readonly data: unknown;
|
|
124
|
-
}, "_tag">;
|
|
125
|
-
};
|
|
126
|
-
declare const isApprovalRequested: (u: unknown) => u is {
|
|
127
|
-
readonly _tag: "ApprovalRequested";
|
|
128
|
-
readonly call_id: string;
|
|
129
|
-
readonly tool: string;
|
|
130
|
-
readonly arguments: string;
|
|
131
|
-
};
|
|
132
|
-
declare const isProgress: (u: unknown) => u is {
|
|
133
|
-
readonly _tag: "Progress";
|
|
134
|
-
readonly call_id: string;
|
|
135
|
-
readonly tool: string;
|
|
136
|
-
readonly data: unknown;
|
|
137
|
-
};
|
|
138
|
-
declare const isOutput: (u: unknown) => u is {
|
|
139
|
-
readonly _tag: "Output";
|
|
140
|
-
readonly result: ToolResult;
|
|
141
|
-
};
|
|
142
|
-
//#endregion
|
|
143
|
-
export { isProgress as a, isOutput as i, ToolEvent_d_exports as n, isApprovalRequested as r, ToolEvent as t };
|
|
144
|
-
//# sourceMappingURL=ToolEvent-Di4a723B.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ToolEvent-Di4a723B.d.mts","names":[],"sources":["../src/tool/ToolEvent.ts"],"mappings":";;;;;KAkBY,YAAY,KAAK;EAC3B;aACW;aACA;aACA;;EAEX;aACW;aACA;aACA;;EAEX;aACW,QAAQ;;;;;;;;;;cAWR;;;aArBS;aACH;aACK;;;;;aAQH,QAAA;;;;;aALC;aACH;aACA;;;;;;;eAPG;eACH;eACK;;;eAQH,QAAA;;;eALC;eACH;eACA;;;;;;;;;;;;;;;;;;;eAPG;eACH;eACK;;;eAQH,QAAA;;;eALC;eACH;eACA;;;;;;;;;;;;;;;;;;;;aAPG;aACH;aACK;;;;aAQH,QAAA;;;;aALC;aACH;aACA;;;cAgBN,sBAAmB,eAAA;;WAvBV;WACH;WACK;;cAsBX,aAAU,eAAA;;WAnBD;WACH;WACA;;cAkBN,WAAQ,eAAA;;WAfA,QAAA"}
|