@effect-uai/core 0.18.0 → 0.19.0-dev-20261110065930
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/Content-D_Qfn8Ja.d.mts +48 -0
- package/dist/Content-D_Qfn8Ja.d.mts.map +1 -0
- package/dist/File-B923KvZ9.d.mts +46 -0
- package/dist/File-B923KvZ9.d.mts.map +1 -0
- package/dist/{Image-Cv6iBLTy.d.mts → Image-Bzc1H_UK.d.mts} +19 -8
- package/dist/Image-Bzc1H_UK.d.mts.map +1 -0
- package/dist/{Items-C7MyrYPX.d.mts → Items-Bvx8s9QH.d.mts} +109 -16
- package/dist/Items-Bvx8s9QH.d.mts.map +1 -0
- package/dist/{Loop-ChpaO-ya.d.mts → Loop-CeA0AelN.d.mts} +7 -6
- package/dist/Loop-CeA0AelN.d.mts.map +1 -0
- package/dist/Tool-Bkryw6-h.d.mts +206 -0
- package/dist/Tool-Bkryw6-h.d.mts.map +1 -0
- package/dist/ToolEvent-9inLx5cI.d.mts +22 -0
- package/dist/ToolEvent-9inLx5cI.d.mts.map +1 -0
- package/dist/ToolOutput-BNTIQgGB.d.mts +151 -0
- package/dist/ToolOutput-BNTIQgGB.d.mts.map +1 -0
- package/dist/Toolkit-D2VGeD5R.d.mts +212 -0
- package/dist/Toolkit-D2VGeD5R.d.mts.map +1 -0
- package/dist/browser/BrowserTool.d.mts +84 -22
- package/dist/browser/BrowserTool.d.mts.map +1 -1
- package/dist/browser/BrowserTool.mjs +5 -0
- package/dist/browser/BrowserTool.mjs.map +1 -1
- package/dist/capabilities/Capabilities.d.mts +1 -1
- package/dist/decision-model/Decision.test.mjs +1 -1
- package/dist/{dist-C8RmtoR8.mjs → dist-B5K-y4Be.mjs} +51 -32
- package/dist/dist-B5K-y4Be.mjs.map +1 -0
- package/dist/domain/File.d.mts +2 -0
- package/dist/domain/File.mjs +51 -0
- package/dist/domain/File.mjs.map +1 -0
- package/dist/domain/Image.d.mts +2 -2
- package/dist/domain/Image.mjs +12 -2
- package/dist/domain/Image.mjs.map +1 -1
- package/dist/domain/Items.d.mts +2 -2
- package/dist/domain/Items.mjs +65 -4
- package/dist/domain/Items.mjs.map +1 -1
- package/dist/domain/Realtime.d.mts +72 -490
- package/dist/domain/Realtime.d.mts.map +1 -1
- package/dist/domain/Research.d.mts +1 -1
- package/dist/domain/Transcript.test.mjs +1 -1
- package/dist/domain/Turn.d.mts +57 -262
- package/dist/domain/Turn.d.mts.map +1 -1
- package/dist/domain/Turn.mjs +1 -1
- package/dist/embedding-model/Embedding.d.mts +1 -1
- package/dist/image-generator/ImageGenerator.d.mts +10 -66
- package/dist/image-generator/ImageGenerator.d.mts.map +1 -1
- package/dist/index.d.mts +10 -9
- package/dist/index.mjs +7 -6
- package/dist/language-model/LanguageModel.d.mts +2 -2
- package/dist/loop/Loop.d.mts +1 -1
- package/dist/loop/Loop.mjs.map +1 -1
- package/dist/messenger/Messenger.d.mts +43 -289
- package/dist/messenger/Messenger.d.mts.map +1 -1
- package/dist/messenger/MessengerAdapter.test.mjs +1 -1
- package/dist/observability/Metrics.d.mts +1 -1
- package/dist/observability/Metrics.test.mjs +1 -1
- package/dist/observability/Telemetry.test.mjs +1 -1
- package/dist/realtime/RealtimeSession.d.mts +1 -1
- package/dist/realtime/RealtimeSession.test.mjs +1 -1
- package/dist/sandbox/Sandbox.d.mts +32 -237
- package/dist/sandbox/Sandbox.d.mts.map +1 -1
- package/dist/streaming/Multipart.mjs +2 -1
- package/dist/streaming/Multipart.mjs.map +1 -1
- package/dist/streaming/Multipart.test.mjs +28 -0
- package/dist/streaming/Multipart.test.mjs.map +1 -0
- package/dist/streaming/Settle.test.mjs +1 -1
- package/dist/streaming/WebSocketSession.test.mjs +1 -1
- package/dist/testing/MockMessenger.d.mts +19 -134
- package/dist/testing/MockMessenger.d.mts.map +1 -1
- package/dist/testing/MockProvider.d.mts +1 -1
- package/dist/testing/MockSandbox.d.mts +65 -446
- package/dist/testing/MockSandbox.d.mts.map +1 -1
- package/dist/tool/Content.d.mts +2 -0
- package/dist/tool/Content.mjs +46 -0
- package/dist/tool/Content.mjs.map +1 -0
- package/dist/tool/Content.test.d.mts +1 -0
- package/dist/tool/Content.test.mjs +48 -0
- package/dist/tool/Content.test.mjs.map +1 -0
- package/dist/tool/HistoryCheck.d.mts +6 -15
- package/dist/tool/HistoryCheck.d.mts.map +1 -1
- package/dist/tool/HistoryCheck.mjs +10 -24
- package/dist/tool/HistoryCheck.mjs.map +1 -1
- package/dist/tool/Tool.d.mts +2 -2
- package/dist/tool/Tool.mjs +55 -130
- package/dist/tool/Tool.mjs.map +1 -1
- package/dist/tool/Tool.test.mjs +220 -176
- package/dist/tool/Tool.test.mjs.map +1 -1
- package/dist/tool/ToolDecision.d.mts +164 -0
- package/dist/tool/ToolDecision.d.mts.map +1 -0
- package/dist/tool/ToolDecision.mjs +146 -0
- package/dist/tool/ToolDecision.mjs.map +1 -0
- package/dist/tool/ToolDecision.test.d.mts +1 -0
- package/dist/tool/ToolDecision.test.mjs +330 -0
- package/dist/tool/ToolDecision.test.mjs.map +1 -0
- package/dist/tool/ToolEvent.d.mts +2 -2
- package/dist/tool/ToolEvent.mjs +2 -34
- package/dist/tool/ToolEvent.mjs.map +1 -1
- package/dist/tool/ToolOutput.d.mts +2 -0
- package/dist/tool/ToolOutput.mjs +128 -0
- package/dist/tool/ToolOutput.mjs.map +1 -0
- package/dist/tool/ToolOutput.test.d.mts +1 -0
- package/dist/tool/ToolOutput.test.mjs +153 -0
- package/dist/tool/ToolOutput.test.mjs.map +1 -0
- package/dist/tool/Toolkit.d.mts +2 -2
- package/dist/tool/Toolkit.mjs +230 -165
- package/dist/tool/Toolkit.mjs.map +1 -1
- package/dist/tool/Toolkit.test.mjs +431 -389
- package/dist/tool/Toolkit.test.mjs.map +1 -1
- package/dist/web-read/WebReadTool.d.mts +2 -2
- package/dist/web-read/WebReadTool.mjs +1 -0
- package/dist/web-read/WebReadTool.mjs.map +1 -1
- package/dist/web-search/WebSearchTool.d.mts +2 -2
- package/dist/web-search/WebSearchTool.mjs +1 -0
- package/dist/web-search/WebSearchTool.mjs.map +1 -1
- package/package.json +17 -9
- package/src/browser/BrowserTool.ts +5 -0
- package/src/domain/File.ts +79 -0
- package/src/domain/Image.ts +14 -4
- package/src/domain/Items.ts +39 -3
- package/src/index.ts +3 -2
- package/src/loop/Loop.ts +24 -13
- package/src/streaming/Multipart.test.ts +26 -0
- package/src/streaming/Multipart.ts +5 -4
- package/src/tool/Content.test.ts +40 -0
- package/src/tool/Content.ts +38 -0
- package/src/tool/HistoryCheck.ts +21 -26
- package/src/tool/Tool.test.ts +240 -241
- package/src/tool/Tool.ts +203 -308
- package/src/tool/ToolDecision.test.ts +301 -0
- package/src/tool/ToolDecision.ts +360 -0
- package/src/tool/ToolEvent.ts +21 -41
- package/src/tool/ToolOutput.test.ts +132 -0
- package/src/tool/ToolOutput.ts +198 -0
- package/src/tool/Toolkit.test.ts +594 -454
- package/src/tool/Toolkit.ts +631 -356
- package/src/web-read/WebReadTool.ts +2 -1
- package/src/web-search/WebSearchTool.ts +2 -1
- package/dist/Image-Cv6iBLTy.d.mts.map +0 -1
- package/dist/Items-C7MyrYPX.d.mts.map +0 -1
- package/dist/Loop-ChpaO-ya.d.mts.map +0 -1
- package/dist/Tool-BF78QWtn.d.mts +0 -314
- package/dist/Tool-BF78QWtn.d.mts.map +0 -1
- package/dist/ToolEvent-Di4a723B.d.mts +0 -144
- package/dist/ToolEvent-Di4a723B.d.mts.map +0 -1
- package/dist/ToolResult-BsYQRjmW.d.mts +0 -152
- package/dist/ToolResult-BsYQRjmW.d.mts.map +0 -1
- package/dist/Toolkit-tlL0F2YR.d.mts +0 -193
- package/dist/Toolkit-tlL0F2YR.d.mts.map +0 -1
- package/dist/dist-C8RmtoR8.mjs.map +0 -1
- package/dist/tool/Approval.d.mts +0 -113
- package/dist/tool/Approval.d.mts.map +0 -1
- package/dist/tool/Approval.mjs +0 -80
- package/dist/tool/Approval.mjs.map +0 -1
- package/dist/tool/Approval.test.mjs +0 -371
- package/dist/tool/Approval.test.mjs.map +0 -1
- package/dist/tool/ToolResult.d.mts +0 -2
- package/dist/tool/ToolResult.mjs +0 -85
- package/dist/tool/ToolResult.mjs.map +0 -1
- package/src/tool/Approval.test.ts +0 -400
- package/src/tool/Approval.ts +0 -181
- package/src/tool/ToolResult.ts +0 -114
- /package/dist/{tool/Approval.test.d.mts → streaming/Multipart.test.d.mts} +0 -0
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { b as ToolCallOutput, y as ToolCall } from "./Items-C7MyrYPX.mjs";
|
|
2
|
-
import { Data } from "effect";
|
|
3
|
-
declare namespace ToolResult_d_exports {
|
|
4
|
-
export { ToolResult, cancelled, denied, executionError, failed, isFailure, isOk, nonLocalTool, serializeValue, toToolCallOutput, validationError };
|
|
5
|
-
}
|
|
6
|
-
type ToolResult = Data.TaggedEnum<{
|
|
7
|
-
Ok: {
|
|
8
|
-
readonly call_id: string;
|
|
9
|
-
readonly tool: string;
|
|
10
|
-
readonly value: unknown;
|
|
11
|
-
};
|
|
12
|
-
Failure: {
|
|
13
|
-
readonly call_id: string;
|
|
14
|
-
readonly tool: string;
|
|
15
|
-
readonly kind: string;
|
|
16
|
-
readonly reason?: string;
|
|
17
|
-
};
|
|
18
|
-
}>;
|
|
19
|
-
/**
|
|
20
|
-
* Namespace of constructors, type guards, and matchers for `ToolResult`,
|
|
21
|
-
* provided by `Data.taggedEnum`. Use `ToolResult.$is("Ok")` for type
|
|
22
|
-
* narrowing and `ToolResult.$match({ Ok, Failure })` for exhaustive
|
|
23
|
-
* pattern matching. Synthetic-result helpers (`denied`, `cancelled`,
|
|
24
|
-
* `executionError`, `failed`) below are kinder constructors than the
|
|
25
|
-
* raw `ToolResult.Failure(...)`.
|
|
26
|
-
*/
|
|
27
|
-
declare const ToolResult: {
|
|
28
|
-
readonly $is: <Tag extends "Failure" | "Ok">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
29
|
-
readonly _tag: "Failure";
|
|
30
|
-
readonly call_id: string;
|
|
31
|
-
readonly tool: string;
|
|
32
|
-
readonly kind: string;
|
|
33
|
-
readonly reason?: string;
|
|
34
|
-
}, {
|
|
35
|
-
readonly _tag: Tag;
|
|
36
|
-
}> | Extract<{
|
|
37
|
-
readonly _tag: "Ok";
|
|
38
|
-
readonly call_id: string;
|
|
39
|
-
readonly tool: string;
|
|
40
|
-
readonly value: unknown;
|
|
41
|
-
}, {
|
|
42
|
-
readonly _tag: Tag;
|
|
43
|
-
}>;
|
|
44
|
-
readonly $match: {
|
|
45
|
-
<Cases extends { readonly [Tag in "Failure" | "Ok"]: (args: Extract<{
|
|
46
|
-
readonly _tag: "Failure";
|
|
47
|
-
readonly call_id: string;
|
|
48
|
-
readonly tool: string;
|
|
49
|
-
readonly kind: string;
|
|
50
|
-
readonly reason?: string;
|
|
51
|
-
} | {
|
|
52
|
-
readonly _tag: "Ok";
|
|
53
|
-
readonly call_id: string;
|
|
54
|
-
readonly tool: string;
|
|
55
|
-
readonly value: unknown;
|
|
56
|
-
}, {
|
|
57
|
-
readonly _tag: Tag;
|
|
58
|
-
}>) => any; }>(cases: Cases): (value: {
|
|
59
|
-
readonly _tag: "Failure";
|
|
60
|
-
readonly call_id: string;
|
|
61
|
-
readonly tool: string;
|
|
62
|
-
readonly kind: string;
|
|
63
|
-
readonly reason?: string;
|
|
64
|
-
} | {
|
|
65
|
-
readonly _tag: "Ok";
|
|
66
|
-
readonly call_id: string;
|
|
67
|
-
readonly tool: string;
|
|
68
|
-
readonly value: unknown;
|
|
69
|
-
}) => import("effect/Unify").Unify<ReturnType<Cases["Failure" | "Ok"]>>;
|
|
70
|
-
<Cases extends { readonly [Tag in "Failure" | "Ok"]: (args: Extract<{
|
|
71
|
-
readonly _tag: "Failure";
|
|
72
|
-
readonly call_id: string;
|
|
73
|
-
readonly tool: string;
|
|
74
|
-
readonly kind: string;
|
|
75
|
-
readonly reason?: string;
|
|
76
|
-
} | {
|
|
77
|
-
readonly _tag: "Ok";
|
|
78
|
-
readonly call_id: string;
|
|
79
|
-
readonly tool: string;
|
|
80
|
-
readonly value: unknown;
|
|
81
|
-
}, {
|
|
82
|
-
readonly _tag: Tag;
|
|
83
|
-
}>) => any; }>(value: {
|
|
84
|
-
readonly _tag: "Failure";
|
|
85
|
-
readonly call_id: string;
|
|
86
|
-
readonly tool: string;
|
|
87
|
-
readonly kind: string;
|
|
88
|
-
readonly reason?: string;
|
|
89
|
-
} | {
|
|
90
|
-
readonly _tag: "Ok";
|
|
91
|
-
readonly call_id: string;
|
|
92
|
-
readonly tool: string;
|
|
93
|
-
readonly value: unknown;
|
|
94
|
-
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Failure" | "Ok"]>>;
|
|
95
|
-
};
|
|
96
|
-
readonly Failure: Data.TaggedEnum.ConstructorFrom<{
|
|
97
|
-
readonly _tag: "Failure";
|
|
98
|
-
readonly call_id: string;
|
|
99
|
-
readonly tool: string;
|
|
100
|
-
readonly kind: string;
|
|
101
|
-
readonly reason?: string;
|
|
102
|
-
}, "_tag">;
|
|
103
|
-
readonly Ok: Data.TaggedEnum.ConstructorFrom<{
|
|
104
|
-
readonly _tag: "Ok";
|
|
105
|
-
readonly call_id: string;
|
|
106
|
-
readonly tool: string;
|
|
107
|
-
readonly value: unknown;
|
|
108
|
-
}, "_tag">;
|
|
109
|
-
};
|
|
110
|
-
declare const isOk: (u: unknown) => u is {
|
|
111
|
-
readonly _tag: "Ok";
|
|
112
|
-
readonly call_id: string;
|
|
113
|
-
readonly tool: string;
|
|
114
|
-
readonly value: unknown;
|
|
115
|
-
};
|
|
116
|
-
declare const isFailure: (u: unknown) => u is {
|
|
117
|
-
readonly _tag: "Failure";
|
|
118
|
-
readonly call_id: string;
|
|
119
|
-
readonly tool: string;
|
|
120
|
-
readonly kind: string;
|
|
121
|
-
readonly reason?: string;
|
|
122
|
-
};
|
|
123
|
-
declare const failed: (call: ToolCall, kind: string, reason?: string) => ToolResult;
|
|
124
|
-
/** Explicit user/policy rejection. */
|
|
125
|
-
declare const denied: (call: ToolCall, reason?: string) => ToolResult;
|
|
126
|
-
/** Implicit non-answer (follow-up, inactivity, abort). */
|
|
127
|
-
declare const cancelled: (call: ToolCall, reason?: string) => ToolResult;
|
|
128
|
-
/** Tool's own execution failed (JSON parse error, runtime crash). */
|
|
129
|
-
declare const executionError: (call: ToolCall, reason: string) => ToolResult;
|
|
130
|
-
/**
|
|
131
|
-
* The model called a tool that is visible to it but has no local executor — a
|
|
132
|
-
* provider-hosted, signal, or interaction tool routed through `Toolkit.run`.
|
|
133
|
-
* Distinct from `unknown_tool` (no such tool at all): the loop is expected to
|
|
134
|
-
* intercept these kinds before execution, so this kind flags a missing handler.
|
|
135
|
-
*/
|
|
136
|
-
declare const nonLocalTool: (call: ToolCall, reason?: string) => ToolResult;
|
|
137
|
-
/**
|
|
138
|
-
* The model's `arguments` failed the tool's input schema. Distinct kind from
|
|
139
|
-
* `execution_error` so recipes can tell a contract violation apart from a
|
|
140
|
-
* runtime crash.
|
|
141
|
-
*/
|
|
142
|
-
declare const validationError: (call: ToolCall, reason?: string) => ToolResult;
|
|
143
|
-
/**
|
|
144
|
-
* Serialize a success value for the wire. A `string` passes through raw
|
|
145
|
-
* (models read plain text best; JSON.stringify would quote and escape it);
|
|
146
|
-
* `undefined` becomes `"null"`; anything else is JSON.
|
|
147
|
-
*/
|
|
148
|
-
declare const serializeValue: (value: unknown) => string;
|
|
149
|
-
declare const toToolCallOutput: (r: ToolResult) => ToolCallOutput;
|
|
150
|
-
//#endregion
|
|
151
|
-
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 };
|
|
152
|
-
//# sourceMappingURL=ToolResult-BsYQRjmW.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ToolResult-BsYQRjmW.d.mts","names":[],"sources":["../src/tool/ToolResult.ts"],"mappings":";;;;;KAqBY,aAAa,KAAK;EAC5B;aACW;aACA;aACA;;EAEX;aACW;aACA;aACA;aACA;;;;;;;;;;;cAYA;;;aAfS;aACH;aACA;aACG;;;;;aARA;aACH;aACC;;;;;;;eAGE;eACH;eACA;eACG;;;eARA;eACH;eACC;;;;;;;;;;;;;;;;;eAGE;eACH;eACA;eACG;;;eARA;eACH;eACC;;;;;;;;;;;;;;;;;;aAGE;aACH;aACA;aACG;;;;aARA;aACH;aACC;;;cAoBP,OAAI,eAAA;;WAtBK;WACH;WACC;;cAqBP,YAAS,eAAA;;WAlBA;WACH;WACA;WACG;;cAqBT,SAAM,MAAU,UAAQ,cAAc,oBAAoB;;cAS1D,SAAM,MAAU,UAAQ,oBAAoB;;cAI5C,YAAS,MAAU,UAAQ,oBAAoB;;cAI/C,iBAAc,MAAU,UAAQ,mBAAmB;;;;;;;cASnD,eAAY,MAAU,UAAQ,oBAAoB;;;;;;cAYlD,kBAAe,MAAU,UAAQ,oBAAoB;;;;;;cAYrD,iBAAc;cAOd,mBAAgB,GAAO,eAAa"}
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import { o as HistoryItem, y as ToolCall } from "./Items-C7MyrYPX.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-BF78QWtn.mjs";
|
|
3
|
-
import { Turn } from "./domain/Turn.mjs";
|
|
4
|
-
import { r as Step } from "./Loop-ChpaO-ya.mjs";
|
|
5
|
-
import { t as ToolResult } from "./ToolResult-BsYQRjmW.mjs";
|
|
6
|
-
import { t as ToolEvent } from "./ToolEvent-Di4a723B.mjs";
|
|
7
|
-
import { Cause, Effect, Stream } from "effect";
|
|
8
|
-
declare namespace Toolkit_d_exports {
|
|
9
|
-
export { DuplicateToolName, ExecuteOptions, Middleware, NoDuplicateNames, ToolMap, Toolkit, ToolkitE, ToolkitR, UniqueTools, appendToolResults, collectResults, compose, continueWithResults, describeFailures, descriptors, fromArray, make, makeNamespaced, namespace, run, wrap };
|
|
10
|
-
}
|
|
11
|
-
type ToolMap = Record<string, AnyTool>;
|
|
12
|
-
type Toolkit<Tools extends ToolMap = ToolMap> = Tools;
|
|
13
|
-
declare const make: <const Tools extends ReadonlyArray<AnyTool>>(...tools: UniqueTools<Tools>) => Toolkit<{ [T in Tools[number] as T["name"]]: T; }>;
|
|
14
|
-
/**
|
|
15
|
-
* Build a toolkit from a dynamically-sourced array (MCP server, plugin). Names
|
|
16
|
-
* are not validated (MCP legitimately uses dots / >64 chars — sanitize at the
|
|
17
|
-
* provider adapter); same-named tools resolve last-wins. Cross-source clashes
|
|
18
|
-
* are caught by `compose`.
|
|
19
|
-
*/
|
|
20
|
-
declare const fromArray: (tools: ReadonlyArray<AnyTool>) => Toolkit;
|
|
21
|
-
/** Render the provider-facing descriptors for a toolkit on demand. */
|
|
22
|
-
declare const descriptors: (toolkit: Toolkit) => ReadonlyArray<ToolDescriptor>;
|
|
23
|
-
/**
|
|
24
|
-
* Union of every tool's `R` requirements in a toolkit. Surfaced by `run` so the
|
|
25
|
-
* loop's stream type carries the services tools need through to `Effect.provide`.
|
|
26
|
-
*
|
|
27
|
-
* The `ToolMap extends T` guard yields `never` for the wide `Toolkit` type (a
|
|
28
|
-
* toolkit passed through an untyped boundary, where the requirements aren't
|
|
29
|
-
* statically known) instead of `any`, which would otherwise poison the
|
|
30
|
-
* resulting stream's `R`. Concrete toolkits from `make` keep their precise R.
|
|
31
|
-
*/
|
|
32
|
-
type ToolkitR<T extends Toolkit> = ToolMap extends T ? never : ToolR<T[keyof T]>;
|
|
33
|
-
/**
|
|
34
|
-
* Union of every tool's `E` error type in a toolkit. `Toolkit.run` reports
|
|
35
|
-
* `Exclude<ToolkitE<T>, string | ToolFailed>` on its stream: the sentinel
|
|
36
|
-
* failures are absorbed into results, everything else propagates typed. The
|
|
37
|
-
* same `ToolMap extends T` guard as `ToolkitR` keeps a wide toolkit at
|
|
38
|
-
* `never` rather than `any`.
|
|
39
|
-
*/
|
|
40
|
-
type ToolkitE<T extends Toolkit> = ToolMap extends T ? never : ToolE<T[keyof T]>;
|
|
41
|
-
type DuplicateName<Tools extends ReadonlyArray<AnyTool>, Seen extends string = never> = Tools extends readonly [infer Head extends AnyTool, ...infer Tail extends ReadonlyArray<AnyTool>] ? Head["name"] extends Seen ? Head["name"] : DuplicateName<Tail, Seen | Head["name"]> : never;
|
|
42
|
-
type DuplicateNameError<Name extends string> = {
|
|
43
|
-
readonly __error: `Duplicate tool name: ${Name}`;
|
|
44
|
-
};
|
|
45
|
-
type NoDuplicateNames<Tools extends ReadonlyArray<AnyTool>> = [DuplicateName<Tools>] extends [never] ? unknown : DuplicateNameError<DuplicateName<Tools>>;
|
|
46
|
-
/** `Tools` constrained so a repeated literal name is a compile error in `make`. */
|
|
47
|
-
type UniqueTools<Tools extends ReadonlyArray<AnyTool>> = Tools & NoDuplicateNames<Tools>;
|
|
48
|
-
type ComposeDuplicateKey<Kits extends ReadonlyArray<Toolkit>, Seen extends string = never> = Kits extends readonly [infer Head extends Toolkit, ...infer Tail extends ReadonlyArray<Toolkit>] ? string extends keyof Head ? ComposeDuplicateKey<Tail, Seen> : Extract<keyof Head & string, Seen> extends never ? ComposeDuplicateKey<Tail, Seen | (keyof Head & string)> : Extract<keyof Head & string, Seen> : never;
|
|
49
|
-
type NoDuplicateComposedKeys<Kits extends ReadonlyArray<Toolkit>> = [ComposeDuplicateKey<Kits>] extends [never] ? unknown : DuplicateNameError<ComposeDuplicateKey<Kits>>;
|
|
50
|
-
type UnionToIntersection<U> = (U extends unknown ? (x: U) => void : never) extends ((x: infer I) => void) ? I : never;
|
|
51
|
-
type Composed<Kits extends ReadonlyArray<Toolkit>> = UnionToIntersection<Kits[number]> extends (infer M) ? (M extends ToolMap ? M : ToolMap) : ToolMap;
|
|
52
|
-
declare const DuplicateToolName_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Cause.YieldableError & {
|
|
53
|
-
readonly _tag: "DuplicateToolName";
|
|
54
|
-
} & Readonly<A>;
|
|
55
|
-
/**
|
|
56
|
-
* Two composed toolkits resolved to the same final name. Carries the colliding
|
|
57
|
-
* `sources` (the positions of the clashing toolkits) so the error says *which*
|
|
58
|
-
* inputs collided. Raised at runtime by `compose` for dynamic sources; static
|
|
59
|
-
* collisions are caught earlier at compile time.
|
|
60
|
-
*/
|
|
61
|
-
declare class DuplicateToolName extends DuplicateToolName_base<{
|
|
62
|
-
readonly name: string;
|
|
63
|
-
readonly sources: ReadonlyArray<string>;
|
|
64
|
-
}> {}
|
|
65
|
-
type PrefixName<Prefix extends string, Name extends string> = `${Prefix}__${Name}`;
|
|
66
|
-
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;
|
|
67
|
-
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; };
|
|
68
|
-
/**
|
|
69
|
-
* Prefix every tool name with `<namespace>__`, returning a new toolkit. Use it
|
|
70
|
-
* to keep generic names (`search`) from two sources distinct before `compose`.
|
|
71
|
-
* If two namespaces collide at the `__` separator, the duplicate final name
|
|
72
|
-
* surfaces from `compose` as a `DuplicateToolName`.
|
|
73
|
-
*/
|
|
74
|
-
declare const namespace: <const Prefix extends string, const T extends ToolMap>(prefix: Prefix, toolkit: Toolkit<T>) => Toolkit<Namespaced<Prefix, T>>;
|
|
75
|
-
/** `namespace(prefix, make(...tools))` in one step, for static namespaced tools. */
|
|
76
|
-
declare const makeNamespaced: <const Prefix extends string, const Tools extends ReadonlyArray<AnyTool>>(prefix: Prefix, ...tools: UniqueTools<Tools>) => Toolkit<Namespaced<Prefix, { [T in Tools[number] as T["name"]]: T; }>>;
|
|
77
|
-
/**
|
|
78
|
-
* Combine independently-built toolkits into one. This is where names from
|
|
79
|
-
* separate sources can collide, so it is the one effectful constructor: a
|
|
80
|
-
* duplicate final name fails with `DuplicateToolName` (naming the colliding
|
|
81
|
-
* input positions) instead of silently overwriting or 400-ing later at the
|
|
82
|
-
* provider. Statically-known collisions are additionally a compile error.
|
|
83
|
-
*/
|
|
84
|
-
declare const compose: <const Kits extends ReadonlyArray<Toolkit>>(...toolkits: Kits & NoDuplicateComposedKeys<Kits>) => Effect.Effect<Toolkit<Composed<Kits>>, DuplicateToolName>;
|
|
85
|
-
type Handler<Input, Event, Output, E, R> = (input: Input, emit: Emit<Event>) => Effect.Effect<Output, E, R>;
|
|
86
|
-
/**
|
|
87
|
-
* A `run` transform, tracking an added requirement `R2` and optional added
|
|
88
|
-
* error `E2`. The tool's own `E` is preserved; `describeFailures` is the
|
|
89
|
-
* combinator that *replaces* it (mapping every error to `string`).
|
|
90
|
-
*/
|
|
91
|
-
type Middleware<R2 = never, E2 = never> = <Input, Event, Output, E, R>(run: Handler<Input, Event, Output, E, R>, name: string) => Handler<Input, Event, Output, E | E2, R | R2>;
|
|
92
|
-
type WrapTool<T extends AnyTool, R2, E2> = T extends Tool<infer N, infer I, infer Ev, infer O, infer E, infer R> ? Tool<N, I, Ev, O, E | E2, R | R2> : T;
|
|
93
|
-
type WrapToolkit<T extends ToolMap, R2, E2> = { readonly [K in keyof T]: T[K] extends AnyTool ? WrapTool<T[K], R2, E2> : T[K]; };
|
|
94
|
-
/**
|
|
95
|
-
* Wrap every local tool's `run` with a middleware, preserving each tool's
|
|
96
|
-
* `Input`/`Output` and unioning the middleware's requirement `R2` into the
|
|
97
|
-
* toolkit's `ToolkitR`. Non-local kinds pass through unchanged. Stack with
|
|
98
|
-
* `pipe` - inner-first, so the last `wrap` applied is the outermost and runs
|
|
99
|
-
* first:
|
|
100
|
-
*
|
|
101
|
-
* const observed = pipe(toolkit, Toolkit.wrap(logging), Toolkit.wrap(authz))
|
|
102
|
-
* Toolkit.run(observed, calls) // authz runs, then logging, then the tool
|
|
103
|
-
*
|
|
104
|
-
* A middleware that fails with `string` / `ToolFailed` is absorbed by the
|
|
105
|
-
* executor into a `ToolResult.Failure`; any other error propagates typed. Use
|
|
106
|
-
* `describeFailures` for the total "everything to the model" case, or the
|
|
107
|
-
* `Approval` flow for a distinct "denied" verdict.
|
|
108
|
-
*/
|
|
109
|
-
declare const wrap: {
|
|
110
|
-
<R2, E2>(middleware: Middleware<R2, E2>): <T extends Toolkit>(toolkit: T) => WrapToolkit<T, R2, E2>;
|
|
111
|
-
<T extends Toolkit, R2, E2>(toolkit: T, middleware: Middleware<R2, E2>): WrapToolkit<T, R2, E2>;
|
|
112
|
-
};
|
|
113
|
-
type DescribeTool<T extends AnyTool> = T extends Tool<infer N, infer I, infer Ev, infer O, any, infer R> ? Tool<N, I, Ev, O, string, R> : T;
|
|
114
|
-
type DescribeToolkit<T extends ToolMap> = { readonly [K in keyof T]: T[K] extends AnyTool ? DescribeTool<T[K]> : T[K]; };
|
|
115
|
-
/**
|
|
116
|
-
* Map every local tool's error to a `string`, so `Toolkit.run` absorbs those
|
|
117
|
-
* failures into `ToolResult.Failure` the model reads and adapts to. Pairs
|
|
118
|
-
* with the domain `describe` helpers (`AiError.describe`,
|
|
119
|
-
* `BrowserError.describe`). Non-local kinds pass through.
|
|
120
|
-
*
|
|
121
|
-
* const kit = yield* Toolkit.compose(
|
|
122
|
-
* Toolkit.describeFailures(searchKit, AiError.describe),
|
|
123
|
-
* browserToolkit(session), // failures stay typed
|
|
124
|
-
* )
|
|
125
|
-
*/
|
|
126
|
-
declare const describeFailures: {
|
|
127
|
-
<E>(describe: (e: E) => string): <T extends Toolkit>(toolkit: T) => DescribeToolkit<T>;
|
|
128
|
-
<T extends Toolkit>(toolkit: T, describe: (e: ToolkitE<T>) => string): DescribeToolkit<T>;
|
|
129
|
-
};
|
|
130
|
-
type ExecuteOptions = {
|
|
131
|
-
readonly concurrency?: number | "unbounded";
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
* Execute every provided call. Approval/rejection policy belongs upstream.
|
|
135
|
-
*
|
|
136
|
-
* String and `ToolFailed` failures are absorbed into `ToolResult.Failure`
|
|
137
|
-
* (the model reads and adapts to them); every other tool error propagates
|
|
138
|
-
* typed on the stream, so `Exclude<ToolkitE<T>, string | ToolFailed>` is
|
|
139
|
-
* what a caller catches or lets end the run. If one call in a concurrent
|
|
140
|
-
* batch fails the stream, siblings may go unanswered: a loop that catches
|
|
141
|
-
* and continues must reconcile history first (`HistoryCheck.cancelAllPending`).
|
|
142
|
-
*/
|
|
143
|
-
declare const run: <T extends Toolkit>(toolkit: T, calls: ReadonlyArray<ToolCall>, options?: ExecuteOptions) => Stream.Stream<ToolEvent, Exclude<ToolkitE<T>, string | ToolFailed>, ToolkitR<T>>;
|
|
144
|
-
/**
|
|
145
|
-
* Append a completed turn plus tool results to a state's history, converting
|
|
146
|
-
* the results to wire-format `ToolCallOutput`s. Curried so it slots directly
|
|
147
|
-
* into `continueWithResults`:
|
|
148
|
-
*
|
|
149
|
-
* Toolkit.run(toolkit, calls).pipe(
|
|
150
|
-
* Toolkit.continueWithResults(Toolkit.appendToolResults(state, turn)),
|
|
151
|
-
* )
|
|
152
|
-
*
|
|
153
|
-
* Equivalent to `appendToHistory(state, turn, results.map(toToolCallOutput))`
|
|
154
|
-
* — the helper just hides the wire-conversion step.
|
|
155
|
-
*/
|
|
156
|
-
declare const appendToolResults: <S extends {
|
|
157
|
-
readonly history: ReadonlyArray<HistoryItem>;
|
|
158
|
-
}>(state: S, turn: Turn) => (results: ReadonlyArray<ToolResult>) => S;
|
|
159
|
-
/**
|
|
160
|
-
* Drain a `Stream<ToolEvent>` and return the accumulated `ToolResult`s
|
|
161
|
-
* from every `Output` event. One-shot — the type is `Effect<results>`,
|
|
162
|
-
* not a one-element stream — so it composes naturally with `Effect.map`
|
|
163
|
-
* to build state.
|
|
164
|
-
*
|
|
165
|
-
* Counterpart to `continueWithResults`: `continueWithResults` bundles
|
|
166
|
-
* drain + emit Next into one bridge; this one is the right arm of a
|
|
167
|
-
* broadcast/fork-and-merge for callers that want to vary the left arm
|
|
168
|
-
* (e.g., filter/tap ToolEvents before forwarding).
|
|
169
|
-
*/
|
|
170
|
-
declare const collectResults: <E, R>(stream: Stream.Stream<ToolEvent, E, R>) => Effect.Effect<ReadonlyArray<ToolResult>, E, R>;
|
|
171
|
-
/**
|
|
172
|
-
* Bridge from a `Stream<ToolEvent>` to the loop's emit shape. Forwards
|
|
173
|
-
* every ToolEvent downstream as a `Loop.value` and at end-of-stream emits
|
|
174
|
-
* one `Loop.next(build(results))` carrying the accumulated `ToolResult`s
|
|
175
|
-
* from terminal `Output` events.
|
|
176
|
-
*
|
|
177
|
-
* Conceptually a broadcast fork (one arm passes events through, the other
|
|
178
|
-
* drains them into a state). Implemented as a single-pass Ref tap + concat
|
|
179
|
-
* for zero buffering — the broadcast version is observationally equivalent
|
|
180
|
-
* but holds events in a PubSub until both arms drain. The public primitives
|
|
181
|
-
* (`Loop.value`, `collectResults`, `Loop.next`) compose the same pattern
|
|
182
|
-
* when you need to vary an arm.
|
|
183
|
-
*
|
|
184
|
-
* Dual: data-first `continueWithResults(stream, build)` and data-last
|
|
185
|
-
* `stream.pipe(continueWithResults(build))` both work.
|
|
186
|
-
*/
|
|
187
|
-
declare const continueWithResults: {
|
|
188
|
-
<S>(build: (results: ReadonlyArray<ToolResult>) => S): <E, R>(stream: Stream.Stream<ToolEvent, E, R>) => Stream.Stream<Step<ToolEvent, S>, E, R>;
|
|
189
|
-
<S, E, R>(stream: Stream.Stream<ToolEvent, E, R>, build: (results: ReadonlyArray<ToolResult>) => S): Stream.Stream<Step<ToolEvent, S>, E, R>;
|
|
190
|
-
};
|
|
191
|
-
//#endregion
|
|
192
|
-
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 };
|
|
193
|
-
//# sourceMappingURL=Toolkit-tlL0F2YR.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Toolkit-tlL0F2YR.d.mts","names":[],"sources":["../src/tool/Toolkit.ts"],"mappings":";;;;;;;;;;KAqDY,UAAU,eAAe;KAEzB,QAAQ,cAAc,UAAU,WAAW;cAgB1C,aAAc,cAAc,cAAc,aAAQ,OACnD,YAAY,WACrB,WAAW,KAAK,iBAAiB,YAAY;;;;;;;cAQnC,YAAS,OAAW,cAAc,aAAW;;cAG7C,cAAW,SAAa,YAAU,cAAc;;;;;;;;;;KAYjD,SAAS,UAAU,WAAW,gBAAgB,YAAY,MAAM,QAAQ;;;;;;;;KASxE,SAAS,UAAU,WAAW,gBAAgB,YAAY,MAAM,QAAQ;KAY/E,cACH,cAAc,cAAc,UAC5B,+BACE,8BACI,aAAa,kBACV,aAAa,cAAc,YAElC,qBAAqB,OACnB,eACA,cAAc,MAAM,OAAO;KAG5B,mBAAmB;WACb,iCAAiC;;KAGhC,iBAAiB,cAAc,cAAc,aACvD,cAAc,oCAGZ,mBAAmB,cAAc;;KAGzB,YAAY,cAAc,cAAc,YAAY,QAAQ,iBAAiB;KAIpF,oBACH,aAAa,cAAc,UAC3B,+BACE,6BAA6B,aAAa,kBAAkB,aAAa,cAAc,iCAClE,OACnB,oBAAoB,MAAM,QAC1B,cAAc,eAAe,sBAC3B,oBAAoB,MAAM,c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GACC,QAAQ,SAAS,cAAc,gBAAgB,KAC7C,GAAG,GAAG,QAAQ,OAAO,OAAO,WAAW,GAAG,OAAO,OAAO,OAAO,KAAU,WAAW,IAAI,GAAG;GAC9F,GAAG,GAAG,GACL,QAAQ,OAAO,OAAO,WAAW,GAAG,IACpC,QAAQ,SAAS,cAAc,gBAAgB,IAC9C,OAAO,OAAO,KAAU,WAAW,IAAI,GAAG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dist-C8RmtoR8.mjs","names":["V.describe","it","V.it","internal.it"],"sources":["../../../node_modules/.pnpm/@effect+vitest@4.0.1_effect@4.0.1_vitest@5.0.3_@types+node@26.2.0_vite@7.3.2_@types+nod_65816e3353e20bfeb9b2e1494bdddeef/node_modules/@effect/vitest/dist/internal/internal.js","../../../node_modules/.pnpm/@effect+vitest@4.0.1_effect@4.0.1_vitest@5.0.3_@types+node@26.2.0_vite@7.3.2_@types+nod_65816e3353e20bfeb9b2e1494bdddeef/node_modules/@effect/vitest/dist/index.js"],"sourcesContent":["/**\n * @since 4.0.0\n */\nimport * as Arbitrary from \"effect/Arbitrary\";\nimport * as Cause from \"effect/Cause\";\nimport * as Duration from \"effect/Duration\";\nimport * as Effect from \"effect/Effect\";\nimport * as Exit from \"effect/Exit\";\nimport { constVoid, flow, pipe } from \"effect/Function\";\nimport * as Layer from \"effect/Layer\";\nimport * as Schedule from \"effect/Schedule\";\nimport * as Scope from \"effect/Scope\";\nimport * as TestClock from \"effect/testing/TestClock\";\nimport * as TestConsole from \"effect/testing/TestConsole\";\nimport * as V from \"vitest\";\nconst getCurrentSuite = V.TestRunner.getCurrentSuite;\nconst runPromise = /*#__PURE__*/Effect.fnUntraced(function* (effect, _ctx) {\n const exit = yield* Effect.exit(effect);\n if (Exit.isFailure(exit)) {\n const errors = Cause.prettyErrors(exit.cause);\n for (let i = 0; i < errors.length; i++) {\n yield* Effect.logError(errors[i]);\n }\n }\n return yield* exit;\n}, (effect, _, ctx) => Effect.runPromise(effect, {\n signal: ctx?.signal\n}));\n/** @internal */\nconst runTest = ctx => effect => {\n const promise = runPromise(effect, ctx);\n if (ctx) {\n // Vitest stops awaiting the test promise once the signal aborts (timeout or\n // cancellation), so only then add a hook that waits for the finalizers.\n // Registering it unconditionally would change the teardown of every test.\n const onAbort = () => ctx.onTestFinished(() => promise.then(constVoid, constVoid));\n ctx.signal.addEventListener(\"abort\", onAbort, {\n once: true\n });\n const cleanup = () => ctx.signal.removeEventListener(\"abort\", onAbort);\n promise.then(cleanup, cleanup);\n // A retry after a timed-out attempt reuses the aborted signal, so no event fires.\n if (ctx.signal.aborted) onAbort();\n }\n return promise;\n};\nconst TestEnv = /*#__PURE__*/Layer.mergeAll(TestConsole.layer, /*#__PURE__*/TestClock.layer());\n/** @internal */\nexport const addEqualityTesters = () => {\n V.expect.addEqualityTesters([]);\n};\n/** @internal */\nconst testOptions = timeout => typeof timeout === \"number\" ? {\n timeout\n} : timeout ?? {};\nconst hookTimeout = timeout => timeout === undefined ? undefined : Duration.toMillis(Duration.fromInputUnsafe(timeout));\nconst propertyTestOptions = timeout => typeof timeout === \"number\" ? undefined : timeout;\nconst checkOptions = timeout => propertyTestOptions(timeout)?.arbitrary;\nconst compileArbitraryInput = input => Arbitrary.isArbitrary(input) ? input : Arbitrary.schema(input);\nconst makeArbitrary = arbitraries => Arbitrary.all(Array.isArray(arbitraries) ? arbitraries.map(compileArbitraryInput) : Object.fromEntries(Object.entries(arbitraries).map(([key, input]) => [key, compileArbitraryInput(input)])));\nconst normalizeProperty = (property, value) => Effect.catchCause(Effect.suspend(() => {\n const output = property(value);\n return Effect.isEffect(output) ? output : Effect.succeed(output);\n}), cause => Cause.hasInterrupts(cause) ? Effect.failCause(cause) : Effect.fail(cause));\nconst runCheck = (ctx, arbitrary, property, options) => runTest(ctx)(Effect.flatMapEager(Arbitrary.checkEffect(arbitrary, value => normalizeProperty(property, value), options), result => {\n const failure = Arbitrary.formatCheckFailure(result);\n return failure === undefined ? Effect.void : Effect.die(new Error(failure));\n}));\n// Vitest decides which fixtures to set up by parsing the source of a test\n// function's context parameter, and there is no public API to supply the names\n// for a wrapper, so wrappers expose the source of the function they call.\nconst withFixturesOf = (source, f) => Object.defineProperty(f, \"toString\", {\n value: () => source.toString()\n});\nconst makeItProxy = (it, overrides) => new Proxy(it, {\n apply(target, thisArg, argArray) {\n return Reflect.apply(target, thisArg, argArray);\n },\n get(target, property, receiver) {\n if (Object.hasOwn(overrides, property)) {\n return Reflect.get(overrides, property);\n }\n // do not bind: binding would strip vitest's static helpers (e.g. `describe.each`)\n return Reflect.get(target, property, receiver);\n }\n});\nconst collectTasks = (tasks, acc = []) => {\n for (let i = 0; i < tasks.length; i++) {\n const task = tasks[i];\n if (task.type === \"test\" && task.mode !== \"skip\" && task.mode !== \"todo\") {\n acc.push(task);\n } else if (task.tasks !== undefined) {\n collectTasks(task.tasks, acc);\n }\n }\n return acc;\n};\nconst registerProp = (it, name, arbitraries, property, timeout) => {\n const arbitrary = makeArbitrary(arbitraries);\n // Property callbacks receive only the base context; the empty source requests no fixtures.\n it(name, testOptions(timeout), withFixturesOf(() => {}, ctx => runCheck(ctx, arbitrary, values => property(values, ctx), checkOptions(timeout))));\n};\nconst makeTester = (mapEffect, it) => {\n const run = (ctx, args, self) => pipe(Effect.suspend(() => self(...args)), mapEffect, runTest(ctx));\n const register = test => (name, self, timeout) => test(name, testOptions(timeout), withFixturesOf(self, ctx => run(ctx, [ctx], self)));\n const each = cases => (name, self, timeout) => it.for(cases)(name, testOptions(timeout), withFixturesOf(self, (args, ctx) => run(ctx, [args, ctx], self).then(constVoid)));\n const prop = (name, arbitraries, self, timeout) => registerProp(it, name, arbitraries, (values, ctx) => Effect.mapEager(mapEffect(Effect.suspend(() => self(values, ctx))), value => value !== false), timeout);\n return Object.assign(register(it), {\n skip: register(it.skip),\n skipIf: condition => register(it.skipIf(condition)),\n runIf: condition => register(it.runIf(condition)),\n only: register(it.only),\n each,\n fails: register(it.fails),\n prop\n });\n};\nconst makeProp = it => (name, arbitraries, self, timeout) => registerProp(it, name, arbitraries, (values, ctx) => self(values, ctx) !== false, timeout);\nconst makeLayer = it => (layer_, options) => (...args) => {\n const excludeTestServices = options?.excludeTestServices ?? false;\n const withTestEnv = excludeTestServices ? layer_ : Layer.provideMerge(layer_, TestEnv);\n const memoMap = options?.memoMap ?? Effect.runSync(Layer.makeMemoMap);\n const scope = Effect.runSync(Scope.make());\n const contextEffect = Layer.buildWithMemoMap(withTestEnv, memoMap, scope).pipe(Effect.orDie, Effect.cached, Effect.runSync);\n let closed = false;\n const closeScope = () => {\n if (closed) {\n return Promise.resolve();\n }\n closed = true;\n // Layer cleanup must outlive the last test's already-aborted signal.\n return runPromise(Scope.close(scope, Exit.void));\n };\n const methods = makeItProxy(it, {\n effect: makeTester(effect => Effect.flatMap(contextEffect, context => effect.pipe(Effect.scoped, Effect.provide(context))), it),\n prop: makeProp(it),\n flakyTest,\n layer(nestedLayer, options) {\n return makeLayer(it)(Layer.provideMerge(nestedLayer, withTestEnv), {\n ...options,\n memoMap: Layer.forkMemoMapUnsafe(memoMap),\n excludeTestServices\n });\n }\n });\n if (args.length === 1) {\n const currentSuite = getCurrentSuite();\n const previousTasks = new Set(currentSuite.tasks);\n args[0](methods);\n const blockTasks = collectTasks(currentSuite.tasks.filter(task => !previousTasks.has(task)));\n if (blockTasks.length === 0) {\n V.afterAll(() => closeScope(), hookTimeout(options?.timeout));\n return;\n }\n const blockTaskSet = new Set(blockTasks);\n let remaining = blockTasks.length;\n V.beforeEach(\n // Destructured so Vitest can parse the hook once the suite defines fixtures.\n ({\n onTestFinished,\n signal,\n task\n }) => {\n if (!blockTaskSet.has(task)) {\n return;\n }\n onTestFinished(() => {\n remaining--;\n if (remaining === 0) {\n return closeScope();\n }\n });\n return runPromise(Effect.asVoid(contextEffect), {\n signal\n });\n }, hookTimeout(options?.timeout));\n V.afterAll(() => closeScope(), hookTimeout(options?.timeout));\n return;\n }\n const suiteOptions = options?.concurrent === undefined ? {} : {\n concurrent: options.concurrent\n };\n return V.describe(args[0], suiteOptions, () => {\n V.beforeAll(() => runPromise(Effect.asVoid(contextEffect)), hookTimeout(options?.timeout));\n V.afterAll(() => closeScope(), hookTimeout(options?.timeout));\n return args[1](methods);\n });\n};\n/** @internal */\nexport const flakyTest = (self, timeout = Duration.seconds(30)) => pipe(self, Effect.scoped, Effect.sandbox, Effect.retry(pipe(Schedule.recurs(10), Schedule.while(_ => Effect.succeed(Duration.isLessThanOrEqualTo(Duration.fromInputUnsafe(_.elapsed), Duration.fromInputUnsafe(timeout)))))), Effect.orDie);\n/** @internal */\nexport const makeMethods = it => makeItProxy(it, {\n effect: makeTester(flow(Effect.scoped, Effect.provide(TestEnv)), it),\n live: makeTester(Effect.scoped, it),\n flakyTest,\n layer: makeLayer(it),\n prop: makeProp(it)\n});\n/** @internal */\nexport const it = /*#__PURE__*/makeMethods(V.it);\n/** @internal */\nexport const {\n /** @internal */\n effect,\n /** @internal */\n layer,\n /** @internal */\n live,\n /** @internal */\n prop\n} = it;\n/** @internal */\nexport const describeWrapped = (name, f) => V.describe(name, () => f(it));\n//# sourceMappingURL=internal.js.map","import * as internal from \"./internal/internal.js\";\n/**\n * Re-exports the `vitest` API unchanged.\n *\n * @stability unstable\n * @since 4.0.0\n */\nexport * from \"vitest\";\n/**\n * @since 4.0.0\n */\nexport const addEqualityTesters = internal.addEqualityTesters;\n/**\n * @since 4.0.0\n */\nexport const effect = internal.effect;\n/**\n * @since 4.0.0\n */\nexport const live = internal.live;\n/**\n * Share a `Layer` between multiple tests, optionally wrapping\n * the tests in a `describe` block if a name is provided.\n *\n * Named layers accept `concurrent` to override inherited suite concurrency.\n * Anonymous layers always inherit the enclosing suite's concurrency.\n * Use `ctx.expect` in concurrent tests for test-local snapshots and assertion counts.\n *\n * @since 4.0.0\n *\n * ```ts\n * import { assert, layer } from \"@effect/vitest\"\n * import { Effect, Layer, Context } from \"effect\"\n *\n * class Foo extends Context.Service<Foo, \"foo\">()(\"Foo\") {\n * static layer = Layer.succeed(Foo, \"foo\")\n * }\n *\n * class Bar extends Context.Service<Bar, \"bar\">()(\"Bar\") {\n * static layer = Layer.effect(\n * Bar,\n * Effect.map(Foo, () => \"bar\" as const)\n * )\n * }\n *\n * layer(Foo.layer)(\"layer\", (it) => {\n * it.effect(\"adds context\", () =>\n * Effect.gen(function*() {\n * const foo = yield* Foo\n * assert.strictEqual(foo, \"foo\")\n * }))\n *\n * it.layer(Bar.layer)(\"nested\", (it) => {\n * it.effect(\"adds context\", () =>\n * Effect.gen(function*() {\n * const foo = yield* Foo\n * const bar = yield* Bar\n * assert.strictEqual(foo, \"foo\")\n * assert.strictEqual(bar, \"bar\")\n * }))\n * })\n * })\n * ```\n */\nexport const layer = internal.layer;\n/**\n * @since 4.0.0\n */\nexport const flakyTest = internal.flakyTest;\n/**\n * @since 4.0.0\n */\nexport const prop = internal.prop;\n/**\n * @since 4.0.0\n */\n/**\n * @since 4.0.0\n */\nexport const it = internal.it;\n/**\n * Creates the Effect test helpers for a Vitest test API, such as one extended with fixtures.\n *\n * **Details**\n *\n * Tests receive the fixtures they destructure from their context. Vitest sets them up before the test and tears\n * them down after the test's scope closes, as it does for its own tests. `it.effect.each` passes the context\n * after the test case, and named and anonymous `it.layer` blocks keep the fixtures.\n *\n * **Gotchas**\n *\n * Vitest reads the destructured names to decide which fixtures to set up. Once any fixture is defined, a test that\n * takes the whole context as a plain parameter, such as `(ctx) =>`, fails with a `FixtureParseError`. Property\n * tests receive only the base test context and cannot request fixtures; auto fixtures still run.\n *\n * **Example** (Using a Vitest fixture in an Effect test)\n *\n * ```ts\n * import { assert, makeMethods, test } from \"@effect/vitest\"\n * import { Effect } from \"effect\"\n *\n * const it = makeMethods(\n * test.extend(\"config\", { scope: \"file\" }, () => ({ port: 3000 }))\n * )\n *\n * it.effect(\"reads the config fixture\", ({ config }) =>\n * Effect.sync(() => {\n * assert.strictEqual(config.port, 3000)\n * }))\n * ```\n *\n * @since 4.0.0\n */\nexport const makeMethods = internal.makeMethods;\n/**\n * @since 4.0.0\n */\nexport const describeWrapped = internal.describeWrapped;\n//# sourceMappingURL=index.js.map"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;;;;;;;;;;AAeA,MAAM,kBAAA,WAA+B;AACrC,MAAM,aAA0B,qBAAO,WAAW,WAAW,QAAQ,MAAM;CACzE,MAAM,OAAO,OAAO,OAAO,KAAK,MAAM;CACtC,IAAI,KAAK,UAAU,IAAI,GAAG;EACxB,MAAM,SAAS,MAAM,aAAa,KAAK,KAAK;EAC5C,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,KACjC,OAAO,OAAO,SAAS,OAAO,EAAE;CAEpC;CACA,OAAO,OAAO;AAChB,IAAI,QAAQ,GAAG,QAAQ,OAAO,WAAW,QAAQ,EAC/C,QAAQ,KAAK,OACf,CAAC,CAAC;;AAEF,MAAM,WAAU,SAAO,WAAU;CAC/B,MAAM,UAAU,WAAW,QAAQ,GAAG;CACtC,IAAI,KAAK;EAIP,MAAM,gBAAgB,IAAI,qBAAqB,QAAQ,KAAK,WAAW,SAAS,CAAC;EACjF,IAAI,OAAO,iBAAiB,SAAS,SAAS,EAC5C,MAAM,KACR,CAAC;EACD,MAAM,gBAAgB,IAAI,OAAO,oBAAoB,SAAS,OAAO;EACrE,QAAQ,KAAK,SAAS,OAAO;EAE7B,IAAI,IAAI,OAAO,SAAS,QAAQ;CAClC;CACA,OAAO;AACT;AACA,MAAM,UAAuB,oBAAM,SAAS,YAAY,OAAoB,wBAAU,MAAM,CAAC;;AAM7F,MAAM,eAAc,YAAW,OAAO,YAAY,WAAW,EAC3D,QACF,IAAI,WAAW,CAAC;AAChB,MAAM,eAAc,YAAW,YAAY,KAAA,IAAY,KAAA,IAAY,SAAS,SAAS,SAAS,gBAAgB,OAAO,CAAC;AACtH,MAAM,uBAAsB,YAAW,OAAO,YAAY,WAAW,KAAA,IAAY;AACjF,MAAM,gBAAe,YAAW,oBAAoB,OAAO,CAAC,EA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AW,KAAK,OAAO,QAAQ,OAAO,QAAQ,OAAO,CAAC,GAAG,EAAE;CACnE,MAAM,WAAW,OAAO,QAAQ,EAAE;CAClC;CACA,OAAO,UAAU,EAAE;CACnB,MAAM,SAAS,EAAE;AACnB,CAAC;;AAED,MAAaC,OAAkB,0BAAYC,IAAI;;AAE/C,MAAa,EAEX,QAEA,OAEA,MAEA,SACED;;;;;;;;;ACnIJ,MAAa,KAAKE"}
|
package/dist/tool/Approval.d.mts
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { y as ToolCall } from "../Items-C7MyrYPX.mjs";
|
|
2
|
-
import { t as ToolResult } from "../ToolResult-BsYQRjmW.mjs";
|
|
3
|
-
import { t as ToolEvent } from "../ToolEvent-Di4a723B.mjs";
|
|
4
|
-
import { Data, Duration, Effect, Queue, Scope, Stream } from "effect";
|
|
5
|
-
declare namespace Approval_d_exports {
|
|
6
|
-
export { ApprovalDecision, ApprovalMapEntry, FromQueueOptions, ToolCallPlan, Verdict, approvalRequested, approve, fromMap, fromQueue, reject, splitApprovalDecisions };
|
|
7
|
-
}
|
|
8
|
-
type ToolCallPlan = {
|
|
9
|
-
readonly approved: ReadonlyArray<ToolCall>;
|
|
10
|
-
readonly rejected: ReadonlyArray<ToolResult>;
|
|
11
|
-
};
|
|
12
|
-
type ApprovalDecision = Data.TaggedEnum<{
|
|
13
|
-
Approved: {
|
|
14
|
-
readonly call: ToolCall;
|
|
15
|
-
};
|
|
16
|
-
Rejected: {
|
|
17
|
-
readonly result: ToolResult;
|
|
18
|
-
};
|
|
19
|
-
}>;
|
|
20
|
-
declare const ApprovalDecision: {
|
|
21
|
-
readonly $is: <Tag extends "Approved" | "Rejected">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
22
|
-
readonly _tag: "Approved";
|
|
23
|
-
readonly call: ToolCall;
|
|
24
|
-
}, {
|
|
25
|
-
readonly _tag: Tag;
|
|
26
|
-
}> | Extract<{
|
|
27
|
-
readonly _tag: "Rejected";
|
|
28
|
-
readonly result: ToolResult;
|
|
29
|
-
}, {
|
|
30
|
-
readonly _tag: Tag;
|
|
31
|
-
}>;
|
|
32
|
-
readonly $match: {
|
|
33
|
-
<Cases extends { readonly [Tag in "Approved" | "Rejected"]: (args: Extract<{
|
|
34
|
-
readonly _tag: "Approved";
|
|
35
|
-
readonly call: ToolCall;
|
|
36
|
-
} | {
|
|
37
|
-
readonly _tag: "Rejected";
|
|
38
|
-
readonly result: ToolResult;
|
|
39
|
-
}, {
|
|
40
|
-
readonly _tag: Tag;
|
|
41
|
-
}>) => any; }>(cases: Cases): (value: {
|
|
42
|
-
readonly _tag: "Approved";
|
|
43
|
-
readonly call: ToolCall;
|
|
44
|
-
} | {
|
|
45
|
-
readonly _tag: "Rejected";
|
|
46
|
-
readonly result: ToolResult;
|
|
47
|
-
}) => import("effect/Unify").Unify<ReturnType<Cases["Approved" | "Rejected"]>>;
|
|
48
|
-
<Cases extends { readonly [Tag in "Approved" | "Rejected"]: (args: Extract<{
|
|
49
|
-
readonly _tag: "Approved";
|
|
50
|
-
readonly call: ToolCall;
|
|
51
|
-
} | {
|
|
52
|
-
readonly _tag: "Rejected";
|
|
53
|
-
readonly result: ToolResult;
|
|
54
|
-
}, {
|
|
55
|
-
readonly _tag: Tag;
|
|
56
|
-
}>) => any; }>(value: {
|
|
57
|
-
readonly _tag: "Approved";
|
|
58
|
-
readonly call: ToolCall;
|
|
59
|
-
} | {
|
|
60
|
-
readonly _tag: "Rejected";
|
|
61
|
-
readonly result: ToolResult;
|
|
62
|
-
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Approved" | "Rejected"]>>;
|
|
63
|
-
};
|
|
64
|
-
readonly Approved: Data.TaggedEnum.ConstructorFrom<{
|
|
65
|
-
readonly _tag: "Approved";
|
|
66
|
-
readonly call: ToolCall;
|
|
67
|
-
}, "_tag">;
|
|
68
|
-
readonly Rejected: Data.TaggedEnum.ConstructorFrom<{
|
|
69
|
-
readonly _tag: "Rejected";
|
|
70
|
-
readonly result: ToolResult;
|
|
71
|
-
}, "_tag">;
|
|
72
|
-
};
|
|
73
|
-
declare const approve: (call: ToolCall) => ApprovalDecision;
|
|
74
|
-
declare const reject: (result: ToolResult) => ApprovalDecision;
|
|
75
|
-
declare const splitApprovalDecisions: (decisions: ReadonlyArray<ApprovalDecision>) => ToolCallPlan;
|
|
76
|
-
declare const approvalRequested: (call: ToolCall) => ToolEvent;
|
|
77
|
-
type Verdict = {
|
|
78
|
-
readonly call_id: string;
|
|
79
|
-
readonly decision: "approve" | "deny";
|
|
80
|
-
readonly reason?: string;
|
|
81
|
-
};
|
|
82
|
-
type FromQueueOptions = {
|
|
83
|
-
/**
|
|
84
|
-
* Resolve any still-pending gated call as `cancelled` once this elapses,
|
|
85
|
-
* so a lost or never-sent verdict cannot hang the decisions stream
|
|
86
|
-
* forever. Omit to wait indefinitely.
|
|
87
|
-
*/
|
|
88
|
-
readonly timeout?: Duration.Input;
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* Queue-backed approval planner. Safe calls are returned immediately in
|
|
92
|
-
* `approved`; gated calls emit `ApprovalRequested` events and later produce
|
|
93
|
-
* one `ApprovalDecision` when their matching verdict arrives.
|
|
94
|
-
*
|
|
95
|
-
* The verdict queue is a single-consumer transport: run one approval round
|
|
96
|
-
* at a time (the router retires once every gated call of the round is
|
|
97
|
-
* resolved). For overlapping rounds, use one queue per round.
|
|
98
|
-
*/
|
|
99
|
-
declare const fromQueue: (predicate: (call: ToolCall) => boolean, verdicts: Queue.Dequeue<Verdict>, options?: FromQueueOptions) => (calls: ReadonlyArray<ToolCall>) => Effect.Effect<{
|
|
100
|
-
readonly approved: ReadonlyArray<ToolCall>;
|
|
101
|
-
readonly decisions: Stream.Stream<ApprovalDecision>;
|
|
102
|
-
readonly approvalRequests: Stream.Stream<ToolEvent>;
|
|
103
|
-
}, never, Scope.Scope>;
|
|
104
|
-
type ApprovalMapEntry = {
|
|
105
|
-
readonly decision: "approve";
|
|
106
|
-
} | {
|
|
107
|
-
readonly decision: "deny";
|
|
108
|
-
readonly reason?: string;
|
|
109
|
-
};
|
|
110
|
-
declare const fromMap: (predicate: (call: ToolCall) => boolean, approvals: ReadonlyMap<string, ApprovalMapEntry>) => (calls: ReadonlyArray<ToolCall>) => ToolCallPlan;
|
|
111
|
-
//#endregion
|
|
112
|
-
export { ApprovalDecision, ApprovalMapEntry, FromQueueOptions, ToolCallPlan, Verdict, approvalRequested, approve, fromMap, fromQueue, reject, splitApprovalDecisions, Approval_d_exports as t };
|
|
113
|
-
//# sourceMappingURL=Approval.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Approval.d.mts","names":[],"sources":["../../src/tool/Approval.ts"],"mappings":";;;;;;;KAYY;WACD,UAAU,cAAc;WACxB,UAAU,cAAc;;KAGvB,mBAAmB,KAAK;EAClC;aAAqB,MAAM;;EAC3B;aAAqB,QAAQ;;;cAGlB;;;aAJgB,MAAA;;;;;aACE,QAAA;;;;;;;eADF,MAAA;;;eACE,QAAA;;;;;;;;;;;;eADF,MAAA;;;eACE,QAAA;;;;;;;;;;;;;aADF,MAAA;;;;aACE,QAAA;;;cAKlB,UAAO,MAAU,aAAW;cAE5B,SAAM,QAAY,eAAa;cAG/B,yBAAsB,WAAe,cAAc,sBAAoB;cASvE,oBAAiB,MAAU,aAAW;KAWvC;WACD;WACA;WACA;;KAGC;;;;;;WAMD,UAAU,SAAS;;;;;;;;;;;cAYjB,YAAS,YAEN,MAAM,sBAAoB,UAC5B,MAAM,QAAQ,UAAQ,UACtB,sBAAgB,OAGnB,cAAc,cACpB,OAAO;WAEG,UAAU,cAAc;WACxB,WAAW,OAAO,OAAO;WACzB,kBAAkB,OAAO,OAAO;UAG3C,MAAM;KA8EE;WACG;;WACA;WAA2B;;cAE7B,UAAO,YACL,MAAM,sBAAoB,WAAa,oBAAoB,uBAAiB,OACjF,cAAc,cAAY"}
|
package/dist/tool/Approval.mjs
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { n as __exportAll } from "../rolldown-runtime-EAsCxrDo.mjs";
|
|
2
|
-
import { cancelled, denied } from "./ToolResult.mjs";
|
|
3
|
-
import { ToolEvent } from "./ToolEvent.mjs";
|
|
4
|
-
import { Data, Deferred, Effect, Queue, Ref, Stream } from "effect";
|
|
5
|
-
//#region src/tool/Approval.ts
|
|
6
|
-
/**
|
|
7
|
-
* Approval helpers for the two transport flavors.
|
|
8
|
-
*
|
|
9
|
-
* These helpers only decide which calls are approved and which synthetic
|
|
10
|
-
* results must be returned to the model. Tool execution stays explicit at
|
|
11
|
-
* the recipe boundary via `Toolkit.run`.
|
|
12
|
-
*/
|
|
13
|
-
var Approval_exports = /* @__PURE__ */ __exportAll({
|
|
14
|
-
ApprovalDecision: () => ApprovalDecision,
|
|
15
|
-
approvalRequested: () => approvalRequested,
|
|
16
|
-
approve: () => approve,
|
|
17
|
-
fromMap: () => fromMap,
|
|
18
|
-
fromQueue: () => fromQueue,
|
|
19
|
-
reject: () => reject,
|
|
20
|
-
splitApprovalDecisions: () => splitApprovalDecisions
|
|
21
|
-
});
|
|
22
|
-
const ApprovalDecision = Data.taggedEnum();
|
|
23
|
-
const approve = (call) => ApprovalDecision.Approved({ call });
|
|
24
|
-
const reject = (result) => ApprovalDecision.Rejected({ result });
|
|
25
|
-
const splitApprovalDecisions = (decisions) => decisions.reduce((acc, decision) => decision._tag === "Approved" ? {
|
|
26
|
-
...acc,
|
|
27
|
-
approved: [...acc.approved, decision.call]
|
|
28
|
-
} : {
|
|
29
|
-
...acc,
|
|
30
|
-
rejected: [...acc.rejected, decision.result]
|
|
31
|
-
}, {
|
|
32
|
-
approved: [],
|
|
33
|
-
rejected: []
|
|
34
|
-
});
|
|
35
|
-
const approvalRequested = (call) => ToolEvent.ApprovalRequested({
|
|
36
|
-
call_id: call.call_id,
|
|
37
|
-
tool: call.name,
|
|
38
|
-
arguments: call.arguments
|
|
39
|
-
});
|
|
40
|
-
/**
|
|
41
|
-
* Queue-backed approval planner. Safe calls are returned immediately in
|
|
42
|
-
* `approved`; gated calls emit `ApprovalRequested` events and later produce
|
|
43
|
-
* one `ApprovalDecision` when their matching verdict arrives.
|
|
44
|
-
*
|
|
45
|
-
* The verdict queue is a single-consumer transport: run one approval round
|
|
46
|
-
* at a time (the router retires once every gated call of the round is
|
|
47
|
-
* resolved). For overlapping rounds, use one queue per round.
|
|
48
|
-
*/
|
|
49
|
-
const fromQueue = (predicate, verdicts, options) => (calls) => Effect.gen(function* () {
|
|
50
|
-
const gated = calls.filter(predicate);
|
|
51
|
-
const approved = calls.filter((call) => !predicate(call));
|
|
52
|
-
const entries = yield* Effect.forEach(gated, (call) => Deferred.make().pipe(Effect.map((d) => [call.call_id, d])));
|
|
53
|
-
const deferreds = new Map(entries);
|
|
54
|
-
const callById = new Map(gated.map((c) => [c.call_id, c]));
|
|
55
|
-
const outstanding = yield* Ref.make(gated.length);
|
|
56
|
-
const resolve = (call, decision) => Deferred.succeed(deferreds.get(call.call_id), decision).pipe(Effect.flatMap((won) => won ? Ref.update(outstanding, (n) => n - 1) : Effect.void));
|
|
57
|
-
const route = Effect.suspend(() => Ref.get(outstanding).pipe(Effect.flatMap((n) => n <= 0 ? Effect.void : Queue.take(verdicts).pipe(Effect.flatMap((v) => {
|
|
58
|
-
const call = callById.get(v.call_id);
|
|
59
|
-
return (call === void 0 ? Effect.void : resolve(call, v.decision === "approve" ? approve(call) : reject(denied(call, v.reason)))).pipe(Effect.andThen(route));
|
|
60
|
-
})))));
|
|
61
|
-
if (gated.length > 0) {
|
|
62
|
-
yield* Effect.forkScoped(route);
|
|
63
|
-
if (options?.timeout !== void 0) yield* Effect.forkScoped(Effect.sleep(options.timeout).pipe(Effect.andThen(Effect.forEach(gated, (call) => resolve(call, reject(cancelled(call, "approval timed out")))))));
|
|
64
|
-
}
|
|
65
|
-
return {
|
|
66
|
-
approved,
|
|
67
|
-
decisions: Stream.fromIterable(gated).pipe(Stream.flatMap((call) => Stream.fromEffect(Deferred.await(deferreds.get(call.call_id))), { concurrency: "unbounded" })),
|
|
68
|
-
approvalRequests: Stream.fromIterable(gated.map(approvalRequested))
|
|
69
|
-
};
|
|
70
|
-
});
|
|
71
|
-
const fromMap = (predicate, approvals) => (calls) => splitApprovalDecisions(calls.map((call) => {
|
|
72
|
-
if (!predicate(call)) return approve(call);
|
|
73
|
-
const v = approvals.get(call.call_id);
|
|
74
|
-
if (v === void 0) return reject(cancelled(call));
|
|
75
|
-
return v.decision === "approve" ? approve(call) : reject(denied(call, v.reason));
|
|
76
|
-
}));
|
|
77
|
-
//#endregion
|
|
78
|
-
export { ApprovalDecision, approvalRequested, approve, fromMap, fromQueue, reject, splitApprovalDecisions, Approval_exports as t };
|
|
79
|
-
|
|
80
|
-
//# sourceMappingURL=Approval.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Approval.mjs","names":[],"sources":["../../src/tool/Approval.ts"],"sourcesContent":["/**\n * Approval helpers for the two transport flavors.\n *\n * These helpers only decide which calls are approved and which synthetic\n * results must be returned to the model. Tool execution stays explicit at\n * the recipe boundary via `Toolkit.run`.\n */\nimport { Data, Deferred, type Duration, Effect, Queue, Ref, Scope, Stream } from \"effect\"\nimport type { ToolCall } from \"../domain/Items.js\"\nimport { type ToolResult, cancelled, denied } from \"./ToolResult.js\"\nimport { ToolEvent } from \"./ToolEvent.js\"\n\nexport type ToolCallPlan = {\n readonly approved: ReadonlyArray<ToolCall>\n readonly rejected: ReadonlyArray<ToolResult>\n}\n\nexport type ApprovalDecision = Data.TaggedEnum<{\n Approved: { readonly call: ToolCall }\n Rejected: { readonly result: ToolResult }\n}>\n\nexport const ApprovalDecision = Data.taggedEnum<ApprovalDecision>()\n\nexport const approve = (call: ToolCall): ApprovalDecision => ApprovalDecision.Approved({ call })\n\nexport const reject = (result: ToolResult): ApprovalDecision =>\n ApprovalDecision.Rejected({ result })\n\nexport const splitApprovalDecisions = (decisions: ReadonlyArray<ApprovalDecision>): ToolCallPlan =>\n decisions.reduce<ToolCallPlan>(\n (acc, decision) =>\n decision._tag === \"Approved\"\n ? { ...acc, approved: [...acc.approved, decision.call] }\n : { ...acc, rejected: [...acc.rejected, decision.result] },\n { approved: [], rejected: [] },\n )\n\nexport const approvalRequested = (call: ToolCall): ToolEvent =>\n ToolEvent.ApprovalRequested({\n call_id: call.call_id,\n tool: call.name,\n arguments: call.arguments,\n })\n\n// ---------------------------------------------------------------------------\n// Verdict queue (WebSocket-style transport).\n// ---------------------------------------------------------------------------\n\nexport type Verdict = {\n readonly call_id: string\n readonly decision: \"approve\" | \"deny\"\n readonly reason?: string\n}\n\nexport type FromQueueOptions = {\n /**\n * Resolve any still-pending gated call as `cancelled` once this elapses,\n * so a lost or never-sent verdict cannot hang the decisions stream\n * forever. Omit to wait indefinitely.\n */\n readonly timeout?: Duration.Input\n}\n\n/**\n * Queue-backed approval planner. Safe calls are returned immediately in\n * `approved`; gated calls emit `ApprovalRequested` events and later produce\n * one `ApprovalDecision` when their matching verdict arrives.\n *\n * The verdict queue is a single-consumer transport: run one approval round\n * at a time (the router retires once every gated call of the round is\n * resolved). For overlapping rounds, use one queue per round.\n */\nexport const fromQueue =\n (\n predicate: (call: ToolCall) => boolean,\n verdicts: Queue.Dequeue<Verdict>,\n options?: FromQueueOptions,\n ) =>\n (\n calls: ReadonlyArray<ToolCall>,\n ): Effect.Effect<\n {\n readonly approved: ReadonlyArray<ToolCall>\n readonly decisions: Stream.Stream<ApprovalDecision>\n readonly approvalRequests: Stream.Stream<ToolEvent>\n },\n never,\n Scope.Scope\n > =>\n Effect.gen(function* () {\n const gated = calls.filter(predicate)\n const approved = calls.filter((call) => !predicate(call))\n\n const entries = yield* Effect.forEach(gated, (call) =>\n Deferred.make<ApprovalDecision>().pipe(Effect.map((d) => [call.call_id, d] as const)),\n )\n const deferreds: ReadonlyMap<string, Deferred.Deferred<ApprovalDecision>> = new Map(entries)\n const callById: ReadonlyMap<string, ToolCall> = new Map(gated.map((c) => [c.call_id, c]))\n const outstanding = yield* Ref.make(gated.length)\n\n // Complete a deferred once; decrement only on the winning transition so\n // a late verdict for an already-resolved call is a no-op.\n const resolve = (call: ToolCall, decision: ApprovalDecision) =>\n Deferred.succeed(deferreds.get(call.call_id)!, decision).pipe(\n Effect.flatMap((won) => (won ? Ref.update(outstanding, (n) => n - 1) : Effect.void)),\n )\n\n // Router retires once every gated call is resolved (by verdict or\n // timeout), so sequential rounds over one queue do not accumulate\n // racing routers. Recursive + suspended: stack-safe, no imperative loop.\n const route: Effect.Effect<void> = Effect.suspend(() =>\n Ref.get(outstanding).pipe(\n Effect.flatMap((n) =>\n n <= 0\n ? Effect.void\n : Queue.take(verdicts).pipe(\n Effect.flatMap((v) => {\n const call = callById.get(v.call_id)\n return (\n call === undefined\n ? Effect.void\n : resolve(\n call,\n v.decision === \"approve\"\n ? approve(call)\n : reject(denied(call, v.reason)),\n )\n ).pipe(Effect.andThen(route))\n }),\n ),\n ),\n ),\n )\n\n if (gated.length > 0) {\n yield* Effect.forkScoped(route)\n if (options?.timeout !== undefined) {\n yield* Effect.forkScoped(\n Effect.sleep(options.timeout).pipe(\n Effect.andThen(\n Effect.forEach(gated, (call) =>\n resolve(call, reject(cancelled(call, \"approval timed out\"))),\n ),\n ),\n ),\n )\n }\n }\n\n const decisions = Stream.fromIterable(gated).pipe(\n Stream.flatMap((call) => Stream.fromEffect(Deferred.await(deferreds.get(call.call_id)!)), {\n concurrency: \"unbounded\",\n }),\n )\n\n const approvalRequests = Stream.fromIterable<ToolEvent>(gated.map(approvalRequested))\n\n return { approved, decisions, approvalRequests }\n })\n\n// ---------------------------------------------------------------------------\n// Approval map (HTTP-style transport). Verdicts arrive synchronously\n// bundled in the request payload. Missing entries → cancelled.\n// ---------------------------------------------------------------------------\n\nexport type ApprovalMapEntry =\n | { readonly decision: \"approve\" }\n | { readonly decision: \"deny\"; readonly reason?: string }\n\nexport const fromMap =\n (predicate: (call: ToolCall) => boolean, approvals: ReadonlyMap<string, ApprovalMapEntry>) =>\n (calls: ReadonlyArray<ToolCall>): ToolCallPlan =>\n splitApprovalDecisions(\n calls.map((call) => {\n if (!predicate(call)) return approve(call)\n const v = approvals.get(call.call_id)\n if (v === undefined) return reject(cancelled(call))\n return v.decision === \"approve\" ? approve(call) : reject(denied(call, v.reason))\n }),\n )\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,mBAAmB,KAAK,WAA6B;AAElE,MAAa,WAAW,SAAqC,iBAAiB,SAAS,EAAE,KAAK,CAAC;AAE/F,MAAa,UAAU,WACrB,iBAAiB,SAAS,EAAE,OAAO,CAAC;AAEtC,MAAa,0BAA0B,cACrC,UAAU,QACP,KAAK,aACJ,SAAS,SAAS,aACd;CAAE,GAAG;CAAK,UAAU,CAAC,GAAG,IAAI,UAAU,SAAS,IAAI;AAAE,IACrD;CAAE,GAAG;CAAK,UAAU,CAAC,GAAG,IAAI,UAAU,SAAS,MAAM;AAAE,GAC7D;CAAE,UAAU,CAAC;CAAG,UAAU,CAAC;AAAE,CAC/B;AAEF,MAAa,qBAAqB,SAChC,UAAU,kBAAkB;CAC1B,SAAS,KAAK;CACd,MAAM,KAAK;CACX,WAAW,KAAK;AAClB,CAAC;;;;;;;;;;AA8BH,MAAa,aAET,WACA,UACA,aAGA,UAUA,OAAO,IAAI,aAAa;CACtB,MAAM,QAAQ,MAAM,OAAO,SAAS;CACpC,MAAM,WAAW,MAAM,QAAQ,SAAS,CAAC,UAAU,IAAI,CAAC;CAExD,MAAM,UAAU,OAAO,OAAO,QAAQ,QAAQ,SAC5C,SAAS,KAAuB,CAAC,CAAC,KAAK,OAAO,KAAK,MAAM,CAAC,KAAK,SAAS,CAAC,CAAU,CAAC,CACtF;CACA,MAAM,YAAsE,IAAI,IAAI,OAAO;CAC3F,MAAM,WAA0C,IAAI,IAAI,MAAM,KAAK,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;CACxF,MAAM,cAAc,OAAO,IAAI,KAAK,MAAM,MAAM;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