@effect-uai/core 0.8.0 → 0.9.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/{AiError-CAX_48RU.d.mts → AiError-CrdR1EQi.d.mts} +2 -2
- package/dist/{AiError-CAX_48RU.d.mts.map → AiError-CrdR1EQi.d.mts.map} +1 -1
- package/dist/{Audio-DPlTsNdz.d.mts → Audio-DDSKCkSe.d.mts} +2 -2
- package/dist/{Audio-DPlTsNdz.d.mts.map → Audio-DDSKCkSe.d.mts.map} +1 -1
- package/dist/{Image-HNmMpMTh.d.mts → Image-C_Zjpwhc.d.mts} +2 -2
- package/dist/{Image-HNmMpMTh.d.mts.map → Image-C_Zjpwhc.d.mts.map} +1 -1
- package/dist/{Items-7ljaVxH_.d.mts → Items-CgKD6Npw.d.mts} +13 -13
- package/dist/{Items-7ljaVxH_.d.mts.map → Items-CgKD6Npw.d.mts.map} +1 -1
- package/dist/Loop-B5_cqumi.d.mts +173 -0
- package/dist/Loop-B5_cqumi.d.mts.map +1 -0
- package/dist/{Media-D_CpcM1Z.d.mts → Media-DOLyaygI.d.mts} +1 -1
- package/dist/{Media-D_CpcM1Z.d.mts.map → Media-DOLyaygI.d.mts.map} +1 -1
- package/dist/{SandboxError-BvKypkJm.d.mts → SandboxError-CIrVDOMV.d.mts} +2 -2
- package/dist/{SandboxError-BvKypkJm.d.mts.map → SandboxError-CIrVDOMV.d.mts.map} +1 -1
- package/dist/{StructuredFormat-BbN4dosH.d.mts → StructuredFormat-CMJFD3sn.d.mts} +2 -2
- package/dist/{StructuredFormat-BbN4dosH.d.mts.map → StructuredFormat-CMJFD3sn.d.mts.map} +1 -1
- package/dist/Tool-0XUIT2A2.d.mts +232 -0
- package/dist/Tool-0XUIT2A2.d.mts.map +1 -0
- package/dist/ToolEvent-DYrAUJGs.d.mts +151 -0
- package/dist/ToolEvent-DYrAUJGs.d.mts.map +1 -0
- package/dist/ToolResult-BZd-cEWW.d.mts +151 -0
- package/dist/ToolResult-BZd-cEWW.d.mts.map +1 -0
- package/dist/Toolkit-BKC8b8Xo.d.mts +155 -0
- package/dist/Toolkit-BKC8b8Xo.d.mts.map +1 -0
- package/dist/{dist-DV5ISja1.mjs → dist-B04dlFHg.mjs} +3 -3
- package/dist/{dist-DV5ISja1.mjs.map → dist-B04dlFHg.mjs.map} +1 -1
- package/dist/dist-DWgRbDN3.mjs +140 -0
- package/dist/dist-DWgRbDN3.mjs.map +1 -0
- package/dist/domain/AiError.d.mts +1 -1
- package/dist/domain/Audio.d.mts +1 -1
- package/dist/domain/Image.d.mts +1 -1
- package/dist/domain/Items.d.mts +1 -1
- package/dist/domain/Media.d.mts +1 -1
- package/dist/domain/Music.d.mts +1 -1
- package/dist/domain/Turn.d.mts +4 -4
- package/dist/domain/Turn.test.mjs +1 -1
- package/dist/embedding-model/Embedding.d.mts +1 -1
- package/dist/embedding-model/EmbeddingModel.d.mts +1 -1
- package/dist/embedding-model/EmbeddingModel.test.mjs +1 -1
- package/dist/embedding-model/EmbeddingModel.test.mjs.map +1 -1
- package/dist/index.d.mts +14 -13
- package/dist/index.mjs +2 -1
- package/dist/language-model/LanguageModel.d.mts +10 -5
- package/dist/language-model/LanguageModel.d.mts.map +1 -1
- package/dist/language-model/LanguageModel.mjs.map +1 -1
- package/dist/language-model/LanguageModel.test.mjs +1 -1
- package/dist/loop/Loop.d.mts +2 -141
- package/dist/loop/Loop.mjs +16 -20
- package/dist/loop/Loop.mjs.map +1 -1
- package/dist/loop/Loop.test.mjs +18 -1
- package/dist/loop/Loop.test.mjs.map +1 -1
- package/dist/{magic-string.es-BgIV5Mu3.mjs → magic-string.es-Dk-MMA0F.mjs} +1 -1
- package/dist/{magic-string.es-BgIV5Mu3.mjs.map → magic-string.es-Dk-MMA0F.mjs.map} +1 -1
- package/dist/music-generator/MusicGenerator.d.mts +2 -2
- package/dist/music-generator/MusicGenerator.test.mjs +1 -1
- package/dist/observability/Metrics.d.mts +116 -28
- package/dist/observability/Metrics.d.mts.map +1 -1
- package/dist/observability/Metrics.mjs +250 -38
- package/dist/observability/Metrics.mjs.map +1 -1
- package/dist/observability/Metrics.test.d.mts +1 -0
- package/dist/observability/Metrics.test.mjs +187 -0
- package/dist/observability/Metrics.test.mjs.map +1 -0
- package/dist/observability/Telemetry.d.mts +37 -0
- package/dist/observability/Telemetry.d.mts.map +1 -0
- package/dist/observability/Telemetry.mjs +57 -0
- package/dist/observability/Telemetry.mjs.map +1 -0
- package/dist/observability/Telemetry.test.d.mts +1 -0
- package/dist/observability/Telemetry.test.mjs +92 -0
- package/dist/observability/Telemetry.test.mjs.map +1 -0
- package/dist/retry/Retry.d.mts +2 -2
- package/dist/retry/Retry.test.mjs +1 -1
- package/dist/sandbox/Sandbox.d.mts +1 -1
- package/dist/sandbox/SandboxError.d.mts +1 -1
- package/dist/speech-synthesizer/SpeechSynthesizer.d.mts +2 -2
- package/dist/speech-synthesizer/SpeechSynthesizer.test.mjs +1 -1
- package/dist/streaming/JSONL.d.mts +1 -1
- package/dist/streaming/JSONL.test.mjs +1 -1
- package/dist/streaming/SSE.test.mjs +1 -1
- package/dist/structured-format/StructuredFormat.d.mts +1 -1
- package/dist/structured-format/StructuredFormat.mjs.map +1 -1
- package/dist/structured-format/StructuredFormat.test.mjs +1 -1
- package/dist/testing/MockMusicGenerator.d.mts +1 -1
- package/dist/testing/MockProvider.d.mts +1 -1
- package/dist/testing/MockSpeechSynthesizer.d.mts +1 -1
- package/dist/tool/Approval.d.mts +3 -3
- package/dist/tool/Approval.test.mjs +35 -34
- package/dist/tool/Approval.test.mjs.map +1 -1
- package/dist/tool/HistoryCheck.d.mts +2 -2
- package/dist/tool/Tool.d.mts +2 -2
- package/dist/tool/Tool.mjs +112 -22
- package/dist/tool/Tool.mjs.map +1 -1
- package/dist/tool/Tool.test.mjs +41 -3
- package/dist/tool/Tool.test.mjs.map +1 -1
- package/dist/tool/ToolEvent.d.mts +2 -151
- package/dist/tool/ToolResult.d.mts +2 -138
- package/dist/tool/ToolResult.mjs +18 -3
- package/dist/tool/ToolResult.mjs.map +1 -1
- package/dist/tool/Toolkit.d.mts +2 -73
- package/dist/tool/Toolkit.mjs +106 -28
- package/dist/tool/Toolkit.mjs.map +1 -1
- package/dist/tool/Toolkit.test.mjs +113 -7
- package/dist/tool/Toolkit.test.mjs.map +1 -1
- package/dist/transcriber/Transcriber.d.mts +2 -2
- package/dist/transcriber/Transcriber.test.mjs +1 -1
- package/dist/web-search/WebSearch.d.mts +1 -1
- package/dist/web-search/WebSearchTool.d.mts +2 -2
- package/dist/web-search/WebSearchTool.d.mts.map +1 -1
- package/dist/web-search/WebSearchTool.mjs.map +1 -1
- package/package.json +1 -1
- package/src/embedding-model/EmbeddingModel.test.ts +4 -0
- package/src/index.ts +1 -0
- package/src/language-model/LanguageModel.ts +7 -2
- package/src/loop/Loop.test.ts +22 -0
- package/src/loop/Loop.ts +27 -4
- package/src/observability/Metrics.test.ts +266 -0
- package/src/observability/Metrics.ts +505 -65
- package/src/observability/Telemetry.test.ts +123 -0
- package/src/observability/Telemetry.ts +96 -0
- package/src/structured-format/StructuredFormat.ts +4 -0
- package/src/tool/Approval.test.ts +22 -21
- package/src/tool/Tool.test.ts +55 -2
- package/src/tool/Tool.ts +221 -55
- package/src/tool/ToolResult.ts +22 -1
- package/src/tool/Toolkit.test.ts +168 -7
- package/src/tool/Toolkit.ts +336 -99
- package/src/web-search/WebSearchTool.ts +1 -1
- package/dist/Tool-BKiieFXk.d.mts +0 -102
- package/dist/Tool-BKiieFXk.d.mts.map +0 -1
- package/dist/loop/Loop.d.mts.map +0 -1
- package/dist/tool/ToolEvent.d.mts.map +0 -1
- package/dist/tool/ToolResult.d.mts.map +0 -1
- package/dist/tool/Toolkit.d.mts.map +0 -1
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { v as ToolCall, y as ToolCallOutput } from "./Items-CgKD6Npw.mjs";
|
|
2
|
+
import { Effect, Schema } from "effect";
|
|
3
|
+
import * as _$effect_Cause0 from "effect/Cause";
|
|
4
|
+
import { StandardJSONSchemaV1, StandardSchemaV1 } from "@standard-schema/spec";
|
|
5
|
+
|
|
6
|
+
//#region src/tool/Tool.d.ts
|
|
7
|
+
declare namespace Tool_d_exports {
|
|
8
|
+
export { AnyLocalTool, AnyTool, DecodableTool, Emit, InteractionTool, ProviderTool, SignalTool, Tool, ToolDescriptor, ToolError, ToolInputSchema, ToolR, ToolValidationError, decodeArgs, descriptorsOf, execute, fromEffectSchema, fromStandardSchema, interaction, make, provider, signal, toDescriptors, withName, withRun };
|
|
9
|
+
}
|
|
10
|
+
declare const ToolError_base: Schema.Class<ToolError, Schema.TaggedStruct<"ToolError", {
|
|
11
|
+
readonly call_id: Schema.String;
|
|
12
|
+
readonly tool: Schema.String;
|
|
13
|
+
readonly message: Schema.String;
|
|
14
|
+
readonly cause: Schema.optional<Schema.Unknown>;
|
|
15
|
+
}>, _$effect_Cause0.YieldableError>;
|
|
16
|
+
declare class ToolError extends ToolError_base {}
|
|
17
|
+
declare const ToolValidationError_base: Schema.Class<ToolValidationError, Schema.TaggedStruct<"ToolValidationError", {
|
|
18
|
+
readonly call_id: Schema.String;
|
|
19
|
+
readonly tool: Schema.String;
|
|
20
|
+
readonly issues: Schema.$Array<Schema.Struct<{
|
|
21
|
+
readonly message: Schema.String;
|
|
22
|
+
readonly path: Schema.optional<Schema.$Array<Schema.Unknown>>;
|
|
23
|
+
}>>;
|
|
24
|
+
}>, _$effect_Cause0.YieldableError>;
|
|
25
|
+
/**
|
|
26
|
+
* The model's `arguments` for a call failed the tool's `inputSchema`. Distinct
|
|
27
|
+
* from `ToolError` (malformed JSON, runtime crash) so callers can tell a
|
|
28
|
+
* contract violation apart from a parse or execution failure, and so the
|
|
29
|
+
* structured `issues` survive instead of being flattened into a message string.
|
|
30
|
+
*/
|
|
31
|
+
declare class ToolValidationError extends ToolValidationError_base {}
|
|
32
|
+
/**
|
|
33
|
+
* Schemas accepted on `Tool.inputSchema`. Must implement both Standard
|
|
34
|
+
* Schema validation and JSON Schema conversion (for rendering tool
|
|
35
|
+
* descriptors to provider request bodies).
|
|
36
|
+
*
|
|
37
|
+
* Any Standard-Schema-compliant library that exposes both interfaces
|
|
38
|
+
* works directly: Zod 4+, Valibot, ArkType, Effect Schema (after
|
|
39
|
+
* `fromEffectSchema`), etc.
|
|
40
|
+
*/
|
|
41
|
+
type ToolInputSchema<Input = unknown> = StandardSchemaV1<unknown, Input> & StandardJSONSchemaV1<unknown, Input>;
|
|
42
|
+
/**
|
|
43
|
+
* Convenience wrapper for Effect Schema users - adds both the
|
|
44
|
+
* `validate` and `jsonSchema` extensions to a plain Effect Schema so it
|
|
45
|
+
* can be used as a `Tool.inputSchema`.
|
|
46
|
+
*/
|
|
47
|
+
declare const fromEffectSchema: <S extends Schema.Codec<any, any, never, any>>(schema: S) => S & ToolInputSchema<S["Type"]>;
|
|
48
|
+
/**
|
|
49
|
+
* Use any schema library that implements both Standard Schema (validation)
|
|
50
|
+
* and Standard JSON Schema (JSON Schema generation) as a `Tool.inputSchema`.
|
|
51
|
+
* Covers Zod 4.2+, Valibot 1.2+, and ArkType 2.1.28+ in one helper.
|
|
52
|
+
*
|
|
53
|
+
* Effect Schema doesn't implement Standard JSON Schema natively — use
|
|
54
|
+
* `fromEffectSchema` for those.
|
|
55
|
+
*
|
|
56
|
+
* The intersection constraint catches missing interfaces at compile time:
|
|
57
|
+
* a Zod v3 schema (no Standard JSON Schema) produces a precise type error
|
|
58
|
+
* pointing at the missing interface rather than a runtime surprise. The
|
|
59
|
+
* helper itself is a thin type-narrowing identity — schemas that satisfy
|
|
60
|
+
* both standards already structurally satisfy `ToolInputSchema`; the
|
|
61
|
+
* helper makes the input type inference explicit at the call site.
|
|
62
|
+
*/
|
|
63
|
+
declare const fromStandardSchema: <S extends StandardSchemaV1 & StandardJSONSchemaV1>(schema: S) => S & ToolInputSchema<StandardSchemaV1.InferOutput<S>>;
|
|
64
|
+
/**
|
|
65
|
+
* Emit one intermediate `Event` from inside a tool's `run`. Backed by the
|
|
66
|
+
* executor's per-call queue, so it returns an `Effect` (backpressure) and
|
|
67
|
+
* composes with `Stream.runForEach(emit)`.
|
|
68
|
+
*/
|
|
69
|
+
type Emit<Event> = (event: Event) => Effect.Effect<void>;
|
|
70
|
+
/**
|
|
71
|
+
* A model-visible tool with a local `Effect` executor. `run` computes the
|
|
72
|
+
* model-facing `Output`; emitting progress is a side channel via `emit`. A
|
|
73
|
+
* plain tool never calls `emit` (its `Event` is irrelevant); a streaming tool
|
|
74
|
+
* emits intermediate `Event`s that flow to the consumer as
|
|
75
|
+
* `ToolEvent.Progress` in real time.
|
|
76
|
+
*
|
|
77
|
+
* This is one of four tool *kinds*, discriminated by `_tag`. The other three
|
|
78
|
+
* (`ProviderTool`, `SignalTool`, `InteractionTool`) are model-visible but have
|
|
79
|
+
* no local executor — see their constructors below. `Tool` keeps its name (and
|
|
80
|
+
* the `Tool.make` constructor) because the local kind is by far the common one.
|
|
81
|
+
*/
|
|
82
|
+
type Tool<Name extends string, Input, Event, Output, R = never> = {
|
|
83
|
+
readonly _tag: "LocalTool";
|
|
84
|
+
readonly name: Name;
|
|
85
|
+
readonly description: string;
|
|
86
|
+
readonly inputSchema: ToolInputSchema<Input>;
|
|
87
|
+
readonly run: (input: Input, emit: Emit<Event>) => Effect.Effect<Output, unknown, R>;
|
|
88
|
+
/**
|
|
89
|
+
* Bound on this tool's emit queue. Unbounded when omitted. Per-tool because
|
|
90
|
+
* backpressure depends on how a given tool emits, unlike `concurrency`
|
|
91
|
+
* (cross-tool, on `Toolkit.run`'s options).
|
|
92
|
+
*/
|
|
93
|
+
readonly emitBufferSize?: number;
|
|
94
|
+
/**
|
|
95
|
+
* Whether the provider should render this tool with its strict-mode
|
|
96
|
+
* flag (OpenAI's `strict: true`, etc). Default: true. The framework
|
|
97
|
+
* never rewrites the schema; if the rendered JSON Schema isn't
|
|
98
|
+
* compatible, the provider returns an error.
|
|
99
|
+
*/
|
|
100
|
+
readonly strict?: boolean;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* A provider-hosted tool: visible to the model and executed by the *provider*
|
|
104
|
+
* (native web search, code execution, RAG grounding), never by this process.
|
|
105
|
+
* It has no local `run`; `provider`/`config` tell the provider adapter how to
|
|
106
|
+
* render it. Passing it to `Toolkit.run` yields a `non_local_tool` result.
|
|
107
|
+
*/
|
|
108
|
+
type ProviderTool<Name extends string, Input, Provider extends string, Config> = {
|
|
109
|
+
readonly _tag: "ProviderTool";
|
|
110
|
+
readonly name: Name;
|
|
111
|
+
readonly description: string;
|
|
112
|
+
readonly inputSchema: ToolInputSchema<Input>;
|
|
113
|
+
readonly provider: Provider;
|
|
114
|
+
readonly config: Config;
|
|
115
|
+
readonly strict?: boolean;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* A typed request for the agent loop to change control flow (escalate, pause,
|
|
119
|
+
* schedule, hand off). Model-visible and decodable (`decodeArgs`) but never
|
|
120
|
+
* locally executed — the loop intercepts the call in `onTurnComplete` and acts
|
|
121
|
+
* on it, so there is no fake `run`. `Toolkit.run` reports it as `non_local_tool`.
|
|
122
|
+
*/
|
|
123
|
+
type SignalTool<Name extends string, Input> = {
|
|
124
|
+
readonly _tag: "SignalTool";
|
|
125
|
+
readonly name: Name;
|
|
126
|
+
readonly description: string;
|
|
127
|
+
readonly inputSchema: ToolInputSchema<Input>;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* A typed request for an external actor (user, channel, frontend) to respond
|
|
131
|
+
* before the loop resumes. Like `SignalTool` it is decode-only, but its
|
|
132
|
+
* lifecycle differs: the loop usually stops/pauses and resumes later by
|
|
133
|
+
* appending a `function_call_output` once the actor replies.
|
|
134
|
+
*/
|
|
135
|
+
type InteractionTool<Name extends string, Input> = {
|
|
136
|
+
readonly _tag: "InteractionTool";
|
|
137
|
+
readonly name: Name;
|
|
138
|
+
readonly description: string;
|
|
139
|
+
readonly inputSchema: ToolInputSchema<Input>;
|
|
140
|
+
};
|
|
141
|
+
/** A local (executable) tool of any shape. Readability alias. */
|
|
142
|
+
type AnyLocalTool<R = any> = Tool<string, any, any, any, R>;
|
|
143
|
+
/** Any of the four model-visible tool kinds. */
|
|
144
|
+
type AnyTool<R = any> = Tool<string, any, any, any, R> | ProviderTool<string, any, string, any> | SignalTool<string, any> | InteractionTool<string, any>;
|
|
145
|
+
/** A model-visible tool that carries a decodable input schema (every kind). */
|
|
146
|
+
type DecodableTool<Input> = {
|
|
147
|
+
readonly name: string;
|
|
148
|
+
readonly inputSchema: ToolInputSchema<Input>;
|
|
149
|
+
};
|
|
150
|
+
/** Extract the `R` of a local tool; non-local kinds contribute `never`. */
|
|
151
|
+
type ToolR<T> = T extends Tool<string, any, any, any, infer R> ? R : never;
|
|
152
|
+
/**
|
|
153
|
+
* Provider-agnostic tool descriptor. Each provider maps `inputSchema`
|
|
154
|
+
* to its own wire field (OpenAI → `parameters`, Anthropic →
|
|
155
|
+
* `input_schema`). Built from a `Tool` by `Tool.toDescriptors`.
|
|
156
|
+
*/
|
|
157
|
+
type ToolDescriptor = {
|
|
158
|
+
readonly name: string;
|
|
159
|
+
readonly description: string;
|
|
160
|
+
readonly inputSchema: Record<string, unknown>;
|
|
161
|
+
readonly strict?: boolean;
|
|
162
|
+
};
|
|
163
|
+
/** A model-visible tool with a local `Effect` executor. */
|
|
164
|
+
declare const make: <Name extends string, Input, Event, Output, R = never>(spec: Omit<Tool<Name, Input, Event, Output, R>, "_tag">) => Tool<Name, Input, Event, Output, R>;
|
|
165
|
+
/**
|
|
166
|
+
* A provider-hosted tool (native web search, code execution, RAG grounding).
|
|
167
|
+
* No local executor — `provider`/`config` drive the provider adapter's
|
|
168
|
+
* rendering. The model sees it; `Toolkit.run` reports it as `non_local_tool`.
|
|
169
|
+
*/
|
|
170
|
+
declare const provider: <Name extends string, Input, Provider extends string, Config>(spec: Omit<ProviderTool<Name, Input, Provider, Config>, "_tag">) => ProviderTool<Name, Input, Provider, Config>;
|
|
171
|
+
/**
|
|
172
|
+
* A typed control-flow signal to the agent loop (escalate, pause, schedule,
|
|
173
|
+
* hand off). Decode-only: the loop interprets the call rather than executing a
|
|
174
|
+
* handler, so there is no `run`.
|
|
175
|
+
*/
|
|
176
|
+
declare const signal: <Name extends string, Input>(spec: Omit<SignalTool<Name, Input>, "_tag">) => SignalTool<Name, Input>;
|
|
177
|
+
/**
|
|
178
|
+
* A typed request for an external actor to respond before the loop resumes
|
|
179
|
+
* (frontend, Telegram, CLI prompt). Decode-only; the loop stops/pauses and
|
|
180
|
+
* resumes by appending the actor's `function_call_output`.
|
|
181
|
+
*/
|
|
182
|
+
declare const interaction: <Name extends string, Input>(spec: Omit<InteractionTool<Name, Input>, "_tag">) => InteractionTool<Name, Input>;
|
|
183
|
+
/**
|
|
184
|
+
* Return a copy of a tool under a new `name`. Useful for resolving a name
|
|
185
|
+
* clash before combining tools into one `Toolkit`. Literal-preserving, so the
|
|
186
|
+
* renamed tool keys the toolkit record under the new name statically.
|
|
187
|
+
*/
|
|
188
|
+
declare const withName: <N extends string, T extends AnyTool>(tool: T, name: N) => Omit<T, "name"> & {
|
|
189
|
+
readonly name: N;
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Replace a local tool's `run`, keeping its model-facing definition (name,
|
|
193
|
+
* description, schema, `_tag`) identical. The new `run`'s `input` is typed from
|
|
194
|
+
* the original tool, so override/mock need no annotation:
|
|
195
|
+
*
|
|
196
|
+
* const safe = { ...toolkit, send_email: Tool.withRun(toolkit.send_email,
|
|
197
|
+
* ({ to }) => Effect.succeed({ status: "dry-run", to })) }
|
|
198
|
+
*
|
|
199
|
+
* Descriptors stay identical to production, so a mocked toolkit can't drift
|
|
200
|
+
* from the contract the model sees.
|
|
201
|
+
*/
|
|
202
|
+
declare const withRun: <Name extends string, Input, Event, Output, R, Output2, R2 = never>(tool: Tool<Name, Input, Event, Output, R>, run: (input: Input, emit: Emit<Event>) => Effect.Effect<Output2, unknown, R2>) => Tool<Name, Input, Event, Output2, R2>;
|
|
203
|
+
/** Render tools to provider-agnostic descriptors. Every kind is model-visible. */
|
|
204
|
+
declare const toDescriptors: (tools: ReadonlyArray<AnyTool>) => ReadonlyArray<ToolDescriptor>;
|
|
205
|
+
/**
|
|
206
|
+
* Render a `Toolkit` (a name-indexed record of tools) to descriptors, treating
|
|
207
|
+
* an absent toolkit as no tools. The normalization point the `LanguageModel`
|
|
208
|
+
* boundary uses so a request can carry the toolkit itself instead of a
|
|
209
|
+
* pre-rendered descriptor array. Lives here (not on `Toolkit`) to keep providers
|
|
210
|
+
* free of a dependency on the toolkit module — it only needs the tool values.
|
|
211
|
+
*/
|
|
212
|
+
declare const descriptorsOf: (toolkit?: Readonly<Record<string, AnyTool>>) => ReadonlyArray<ToolDescriptor>;
|
|
213
|
+
/**
|
|
214
|
+
* Decode and validate a function_call's JSON `arguments` against the tool's
|
|
215
|
+
* own `inputSchema`, yielding the typed input. The decode-only half of
|
|
216
|
+
* `execute` - reach for it when you intercept a call to translate it into a
|
|
217
|
+
* control-flow decision rather than running the tool's `run`.
|
|
218
|
+
*
|
|
219
|
+
* Malformed JSON fails with `ToolError`; a parsed body that violates
|
|
220
|
+
* `inputSchema` fails with `ToolValidationError` carrying the issues.
|
|
221
|
+
*/
|
|
222
|
+
declare const decodeArgs: <Input>(tool: DecodableTool<Input>, call: ToolCall) => Effect.Effect<Input, ToolError | ToolValidationError>;
|
|
223
|
+
/**
|
|
224
|
+
* Decode and validate the JSON arguments of a function_call against the
|
|
225
|
+
* tool's input schema, run the tool, and serialize the output into a
|
|
226
|
+
* function_call_output item. Single-shot: intermediate events emitted by
|
|
227
|
+
* `run` are discarded (use `Toolkit.run` to stream them).
|
|
228
|
+
*/
|
|
229
|
+
declare const execute: <Name extends string, Input, Event, Output, R>(tool: Tool<Name, Input, Event, Output, R>, call: ToolCall) => Effect.Effect<ToolCallOutput, ToolError | ToolValidationError, R>;
|
|
230
|
+
//#endregion
|
|
231
|
+
export { signal as C, withRun as E, provider as S, withName as T, execute as _, InteractionTool as a, interaction as b, Tool as c, ToolInputSchema as d, ToolR as f, descriptorsOf as g, decodeArgs as h, Emit as i, ToolDescriptor as l, Tool_d_exports as m, AnyTool as n, ProviderTool as o, ToolValidationError as p, DecodableTool as r, SignalTool as s, AnyLocalTool as t, ToolError as u, fromEffectSchema as v, toDescriptors as w, make as x, fromStandardSchema as y };
|
|
232
|
+
//# sourceMappingURL=Tool-0XUIT2A2.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tool-0XUIT2A2.d.mts","names":[],"sources":["../src/tool/Tool.ts"],"mappings":"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"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { t as ToolResult } from "./ToolResult-BZd-cEWW.mjs";
|
|
2
|
+
import { Data } from "effect";
|
|
3
|
+
import * as _$effect_Unify0 from "effect/Unify";
|
|
4
|
+
|
|
5
|
+
//#region src/tool/ToolEvent.d.ts
|
|
6
|
+
declare namespace ToolEvent_d_exports {
|
|
7
|
+
export { ToolEvent, isApprovalRequested, isOutput, isProgress };
|
|
8
|
+
}
|
|
9
|
+
type ToolEvent = Data.TaggedEnum<{
|
|
10
|
+
ApprovalRequested: {
|
|
11
|
+
readonly call_id: string;
|
|
12
|
+
readonly tool: string;
|
|
13
|
+
readonly arguments: string;
|
|
14
|
+
};
|
|
15
|
+
Progress: {
|
|
16
|
+
readonly call_id: string;
|
|
17
|
+
readonly tool: string;
|
|
18
|
+
readonly data: unknown;
|
|
19
|
+
};
|
|
20
|
+
Output: {
|
|
21
|
+
readonly result: ToolResult;
|
|
22
|
+
};
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* Namespace of constructors, type guards, and matchers for `ToolEvent`,
|
|
26
|
+
* provided by `Data.taggedEnum`. Use `ToolEvent.Output({ result })` to build
|
|
27
|
+
* an event, `ToolEvent.$is("Output")` for type narrowing,
|
|
28
|
+
* `ToolEvent.$match({ ApprovalRequested, Progress, Output })` for
|
|
29
|
+
* exhaustive pattern matching.
|
|
30
|
+
*/
|
|
31
|
+
declare const ToolEvent: {
|
|
32
|
+
readonly ApprovalRequested: Data.TaggedEnum.ConstructorFrom<{
|
|
33
|
+
readonly _tag: "ApprovalRequested";
|
|
34
|
+
readonly call_id: string;
|
|
35
|
+
readonly tool: string;
|
|
36
|
+
readonly arguments: string;
|
|
37
|
+
}, "_tag">;
|
|
38
|
+
readonly Progress: Data.TaggedEnum.ConstructorFrom<{
|
|
39
|
+
readonly _tag: "Progress";
|
|
40
|
+
readonly call_id: string;
|
|
41
|
+
readonly tool: string;
|
|
42
|
+
readonly data: unknown;
|
|
43
|
+
}, "_tag">;
|
|
44
|
+
readonly Output: Data.TaggedEnum.ConstructorFrom<{
|
|
45
|
+
readonly _tag: "Output";
|
|
46
|
+
readonly result: ToolResult;
|
|
47
|
+
}, "_tag">;
|
|
48
|
+
readonly $is: <Tag extends "ApprovalRequested" | "Progress" | "Output">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
49
|
+
readonly _tag: "ApprovalRequested";
|
|
50
|
+
readonly call_id: string;
|
|
51
|
+
readonly tool: string;
|
|
52
|
+
readonly arguments: string;
|
|
53
|
+
}, {
|
|
54
|
+
readonly _tag: Tag;
|
|
55
|
+
}> | Extract<{
|
|
56
|
+
readonly _tag: "Progress";
|
|
57
|
+
readonly call_id: string;
|
|
58
|
+
readonly tool: string;
|
|
59
|
+
readonly data: unknown;
|
|
60
|
+
}, {
|
|
61
|
+
readonly _tag: Tag;
|
|
62
|
+
}> | Extract<{
|
|
63
|
+
readonly _tag: "Output";
|
|
64
|
+
readonly result: ToolResult;
|
|
65
|
+
}, {
|
|
66
|
+
readonly _tag: Tag;
|
|
67
|
+
}>;
|
|
68
|
+
readonly $match: {
|
|
69
|
+
<Cases extends {
|
|
70
|
+
readonly ApprovalRequested: (args: {
|
|
71
|
+
readonly _tag: "ApprovalRequested";
|
|
72
|
+
readonly call_id: string;
|
|
73
|
+
readonly tool: string;
|
|
74
|
+
readonly arguments: string;
|
|
75
|
+
}) => any;
|
|
76
|
+
readonly Progress: (args: {
|
|
77
|
+
readonly _tag: "Progress";
|
|
78
|
+
readonly call_id: string;
|
|
79
|
+
readonly tool: string;
|
|
80
|
+
readonly data: unknown;
|
|
81
|
+
}) => any;
|
|
82
|
+
readonly Output: (args: {
|
|
83
|
+
readonly _tag: "Output";
|
|
84
|
+
readonly result: ToolResult;
|
|
85
|
+
}) => any;
|
|
86
|
+
}>(cases: Cases): (value: {
|
|
87
|
+
readonly _tag: "ApprovalRequested";
|
|
88
|
+
readonly call_id: string;
|
|
89
|
+
readonly tool: string;
|
|
90
|
+
readonly arguments: string;
|
|
91
|
+
} | {
|
|
92
|
+
readonly _tag: "Progress";
|
|
93
|
+
readonly call_id: string;
|
|
94
|
+
readonly tool: string;
|
|
95
|
+
readonly data: unknown;
|
|
96
|
+
} | {
|
|
97
|
+
readonly _tag: "Output";
|
|
98
|
+
readonly result: ToolResult;
|
|
99
|
+
}) => _$effect_Unify0.Unify<ReturnType<Cases["ApprovalRequested" | "Progress" | "Output"]>>;
|
|
100
|
+
<Cases extends {
|
|
101
|
+
readonly ApprovalRequested: (args: {
|
|
102
|
+
readonly _tag: "ApprovalRequested";
|
|
103
|
+
readonly call_id: string;
|
|
104
|
+
readonly tool: string;
|
|
105
|
+
readonly arguments: string;
|
|
106
|
+
}) => any;
|
|
107
|
+
readonly Progress: (args: {
|
|
108
|
+
readonly _tag: "Progress";
|
|
109
|
+
readonly call_id: string;
|
|
110
|
+
readonly tool: string;
|
|
111
|
+
readonly data: unknown;
|
|
112
|
+
}) => any;
|
|
113
|
+
readonly Output: (args: {
|
|
114
|
+
readonly _tag: "Output";
|
|
115
|
+
readonly result: ToolResult;
|
|
116
|
+
}) => any;
|
|
117
|
+
}>(value: {
|
|
118
|
+
readonly _tag: "ApprovalRequested";
|
|
119
|
+
readonly call_id: string;
|
|
120
|
+
readonly tool: string;
|
|
121
|
+
readonly arguments: string;
|
|
122
|
+
} | {
|
|
123
|
+
readonly _tag: "Progress";
|
|
124
|
+
readonly call_id: string;
|
|
125
|
+
readonly tool: string;
|
|
126
|
+
readonly data: unknown;
|
|
127
|
+
} | {
|
|
128
|
+
readonly _tag: "Output";
|
|
129
|
+
readonly result: ToolResult;
|
|
130
|
+
}, cases: Cases): _$effect_Unify0.Unify<ReturnType<Cases["ApprovalRequested" | "Progress" | "Output"]>>;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
declare const isApprovalRequested: (u: unknown) => u is {
|
|
134
|
+
readonly _tag: "ApprovalRequested";
|
|
135
|
+
readonly call_id: string;
|
|
136
|
+
readonly tool: string;
|
|
137
|
+
readonly arguments: string;
|
|
138
|
+
};
|
|
139
|
+
declare const isProgress: (u: unknown) => u is {
|
|
140
|
+
readonly _tag: "Progress";
|
|
141
|
+
readonly call_id: string;
|
|
142
|
+
readonly tool: string;
|
|
143
|
+
readonly data: unknown;
|
|
144
|
+
};
|
|
145
|
+
declare const isOutput: (u: unknown) => u is {
|
|
146
|
+
readonly _tag: "Output";
|
|
147
|
+
readonly result: ToolResult;
|
|
148
|
+
};
|
|
149
|
+
//#endregion
|
|
150
|
+
export { isProgress as a, isOutput as i, ToolEvent_d_exports as n, isApprovalRequested as r, ToolEvent as t };
|
|
151
|
+
//# sourceMappingURL=ToolEvent-DYrAUJGs.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolEvent-DYrAUJGs.d.mts","names":[],"sources":["../src/tool/ToolEvent.ts"],"mappings":";;;;;;;;KAaY,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;;;;;AAWrB;;;cAAa,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"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { v as ToolCall, y as ToolCallOutput } from "./Items-CgKD6Npw.mjs";
|
|
2
|
+
import { Data } from "effect";
|
|
3
|
+
import * as _$effect_Unify0 from "effect/Unify";
|
|
4
|
+
|
|
5
|
+
//#region src/tool/ToolResult.d.ts
|
|
6
|
+
declare namespace ToolResult_d_exports {
|
|
7
|
+
export { ToolResult, cancelled, denied, executionError, failed, isFailure, isOk, nonLocalTool, toToolCallOutput, validationError };
|
|
8
|
+
}
|
|
9
|
+
type ToolResult = Data.TaggedEnum<{
|
|
10
|
+
Ok: {
|
|
11
|
+
readonly call_id: string;
|
|
12
|
+
readonly tool: string;
|
|
13
|
+
readonly value: unknown;
|
|
14
|
+
};
|
|
15
|
+
Failure: {
|
|
16
|
+
readonly call_id: string;
|
|
17
|
+
readonly tool: string;
|
|
18
|
+
readonly kind: string;
|
|
19
|
+
readonly reason?: string;
|
|
20
|
+
};
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Namespace of constructors, type guards, and matchers for `ToolResult`,
|
|
24
|
+
* provided by `Data.taggedEnum`. Use `ToolResult.$is("Ok")` for type
|
|
25
|
+
* narrowing and `ToolResult.$match({ Ok, Failure })` for exhaustive
|
|
26
|
+
* pattern matching. Synthetic-result helpers (`denied`, `cancelled`,
|
|
27
|
+
* `executionError`, `failed`) below are kinder constructors than the
|
|
28
|
+
* raw `ToolResult.Failure(...)`.
|
|
29
|
+
*/
|
|
30
|
+
declare const ToolResult: {
|
|
31
|
+
readonly Ok: Data.TaggedEnum.ConstructorFrom<{
|
|
32
|
+
readonly _tag: "Ok";
|
|
33
|
+
readonly call_id: string;
|
|
34
|
+
readonly tool: string;
|
|
35
|
+
readonly value: unknown;
|
|
36
|
+
}, "_tag">;
|
|
37
|
+
readonly Failure: Data.TaggedEnum.ConstructorFrom<{
|
|
38
|
+
readonly _tag: "Failure";
|
|
39
|
+
readonly call_id: string;
|
|
40
|
+
readonly tool: string;
|
|
41
|
+
readonly kind: string;
|
|
42
|
+
readonly reason?: string;
|
|
43
|
+
}, "_tag">;
|
|
44
|
+
readonly $is: <Tag extends "Ok" | "Failure">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
45
|
+
readonly _tag: "Ok";
|
|
46
|
+
readonly call_id: string;
|
|
47
|
+
readonly tool: string;
|
|
48
|
+
readonly value: unknown;
|
|
49
|
+
}, {
|
|
50
|
+
readonly _tag: Tag;
|
|
51
|
+
}> | Extract<{
|
|
52
|
+
readonly _tag: "Failure";
|
|
53
|
+
readonly call_id: string;
|
|
54
|
+
readonly tool: string;
|
|
55
|
+
readonly kind: string;
|
|
56
|
+
readonly reason?: string;
|
|
57
|
+
}, {
|
|
58
|
+
readonly _tag: Tag;
|
|
59
|
+
}>;
|
|
60
|
+
readonly $match: {
|
|
61
|
+
<Cases extends {
|
|
62
|
+
readonly Ok: (args: {
|
|
63
|
+
readonly _tag: "Ok";
|
|
64
|
+
readonly call_id: string;
|
|
65
|
+
readonly tool: string;
|
|
66
|
+
readonly value: unknown;
|
|
67
|
+
}) => any;
|
|
68
|
+
readonly Failure: (args: {
|
|
69
|
+
readonly _tag: "Failure";
|
|
70
|
+
readonly call_id: string;
|
|
71
|
+
readonly tool: string;
|
|
72
|
+
readonly kind: string;
|
|
73
|
+
readonly reason?: string;
|
|
74
|
+
}) => any;
|
|
75
|
+
}>(cases: Cases): (value: {
|
|
76
|
+
readonly _tag: "Ok";
|
|
77
|
+
readonly call_id: string;
|
|
78
|
+
readonly tool: string;
|
|
79
|
+
readonly value: unknown;
|
|
80
|
+
} | {
|
|
81
|
+
readonly _tag: "Failure";
|
|
82
|
+
readonly call_id: string;
|
|
83
|
+
readonly tool: string;
|
|
84
|
+
readonly kind: string;
|
|
85
|
+
readonly reason?: string;
|
|
86
|
+
}) => _$effect_Unify0.Unify<ReturnType<Cases["Ok" | "Failure"]>>;
|
|
87
|
+
<Cases extends {
|
|
88
|
+
readonly Ok: (args: {
|
|
89
|
+
readonly _tag: "Ok";
|
|
90
|
+
readonly call_id: string;
|
|
91
|
+
readonly tool: string;
|
|
92
|
+
readonly value: unknown;
|
|
93
|
+
}) => any;
|
|
94
|
+
readonly Failure: (args: {
|
|
95
|
+
readonly _tag: "Failure";
|
|
96
|
+
readonly call_id: string;
|
|
97
|
+
readonly tool: string;
|
|
98
|
+
readonly kind: string;
|
|
99
|
+
readonly reason?: string;
|
|
100
|
+
}) => any;
|
|
101
|
+
}>(value: {
|
|
102
|
+
readonly _tag: "Ok";
|
|
103
|
+
readonly call_id: string;
|
|
104
|
+
readonly tool: string;
|
|
105
|
+
readonly value: unknown;
|
|
106
|
+
} | {
|
|
107
|
+
readonly _tag: "Failure";
|
|
108
|
+
readonly call_id: string;
|
|
109
|
+
readonly tool: string;
|
|
110
|
+
readonly kind: string;
|
|
111
|
+
readonly reason?: string;
|
|
112
|
+
}, cases: Cases): _$effect_Unify0.Unify<ReturnType<Cases["Ok" | "Failure"]>>;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
declare const isOk: (u: unknown) => u is {
|
|
116
|
+
readonly _tag: "Ok";
|
|
117
|
+
readonly call_id: string;
|
|
118
|
+
readonly tool: string;
|
|
119
|
+
readonly value: unknown;
|
|
120
|
+
};
|
|
121
|
+
declare const isFailure: (u: unknown) => u is {
|
|
122
|
+
readonly _tag: "Failure";
|
|
123
|
+
readonly call_id: string;
|
|
124
|
+
readonly tool: string;
|
|
125
|
+
readonly kind: string;
|
|
126
|
+
readonly reason?: string;
|
|
127
|
+
};
|
|
128
|
+
declare const failed: (call: ToolCall, kind: string, reason?: string) => ToolResult;
|
|
129
|
+
/** Explicit user/policy rejection. */
|
|
130
|
+
declare const denied: (call: ToolCall, reason?: string) => ToolResult;
|
|
131
|
+
/** Implicit non-answer (follow-up, inactivity, abort). */
|
|
132
|
+
declare const cancelled: (call: ToolCall, reason?: string) => ToolResult;
|
|
133
|
+
/** Tool's own execution failed (JSON parse error, runtime crash). */
|
|
134
|
+
declare const executionError: (call: ToolCall, reason: string) => ToolResult;
|
|
135
|
+
/**
|
|
136
|
+
* The model called a tool that is visible to it but has no local executor — a
|
|
137
|
+
* provider-hosted, signal, or interaction tool routed through `Toolkit.run`.
|
|
138
|
+
* Distinct from `unknown_tool` (no such tool at all): the loop is expected to
|
|
139
|
+
* intercept these kinds before execution, so this kind flags a missing handler.
|
|
140
|
+
*/
|
|
141
|
+
declare const nonLocalTool: (call: ToolCall, reason?: string) => ToolResult;
|
|
142
|
+
/**
|
|
143
|
+
* The model's `arguments` failed the tool's input schema. Distinct kind from
|
|
144
|
+
* `execution_error` so recipes can tell a contract violation apart from a
|
|
145
|
+
* runtime crash.
|
|
146
|
+
*/
|
|
147
|
+
declare const validationError: (call: ToolCall, reason?: string) => ToolResult;
|
|
148
|
+
declare const toToolCallOutput: (r: ToolResult) => ToolCallOutput;
|
|
149
|
+
//#endregion
|
|
150
|
+
export { executionError as a, isOk as c, validationError as d, denied as i, nonLocalTool as l, ToolResult_d_exports as n, failed as o, cancelled as r, isFailure as s, ToolResult as t, toToolCallOutput as u };
|
|
151
|
+
//# sourceMappingURL=ToolResult-BZd-cEWW.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolResult-BZd-cEWW.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;;;;;;;;AAYb;cAAa,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;AAAA,cAOrD,gBAAA,GAAoB,CAAA,EAAG,UAAA,KAAa,cAAA"}
|