@effect-agent/testing 0.1.0-beta.9 → 0.1.0-beta.90
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/Certification.d.mts +106 -0
- package/dist/Certification.mjs +633 -0
- package/dist/Certification.mjs.map +1 -0
- package/dist/Chaos.d.mts +126 -0
- package/dist/Chaos.mjs +755 -0
- package/dist/Chaos.mjs.map +1 -0
- package/dist/CodeExecutorConformance.d.mts +33 -0
- package/dist/CodeExecutorConformance.mjs +231 -0
- package/dist/CodeExecutorConformance.mjs.map +1 -0
- package/dist/CodeExecutorSubstitute.d.mts +21 -0
- package/dist/CodeExecutorSubstitute.mjs +368 -0
- package/dist/CodeExecutorSubstitute.mjs.map +1 -0
- package/dist/DocsResearcher.d.mts +276 -0
- package/dist/DocsResearcher.mjs +490 -0
- package/dist/DocsResearcher.mjs.map +1 -0
- package/dist/ScriptedModel-DAvxIiud.d.mts +220 -0
- package/dist/ScriptedModel.d.mts +2 -0
- package/dist/ScriptedModel.mjs +155 -0
- package/dist/ScriptedModel.mjs.map +1 -0
- package/dist/TravelPlanner.d.mts +1680 -0
- package/dist/TravelPlanner.mjs +1963 -0
- package/dist/TravelPlanner.mjs.map +1 -0
- package/dist/deterministic-layers-D5owIoke.mjs +358 -0
- package/dist/deterministic-layers-D5owIoke.mjs.map +1 -0
- package/dist/index.d.mts +2 -3408
- package/dist/index.mjs +2 -4771
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/package.json +1 -48
- package/src/{certification.ts → Certification.ts} +366 -171
- package/src/{chaos.ts → Chaos.ts} +241 -127
- package/src/{code-executor-conformance.ts → CodeExecutorConformance.ts} +30 -7
- package/src/{code-executor-substitute.ts → CodeExecutorSubstitute.ts} +113 -46
- package/src/{fixtures/docs-researcher/index.ts → DocsResearcher.ts} +68 -5
- package/src/{scripted-model.ts → ScriptedModel.ts} +25 -29
- package/src/TravelPlanner.ts +232 -0
- package/src/fixtures/docs-researcher/definition.ts +20 -11
- package/src/fixtures/docs-researcher/harness.ts +41 -34
- package/src/fixtures/docs-researcher/mcp.ts +49 -3
- package/src/fixtures/travel-planner/definition.ts +15 -2
- package/src/fixtures/travel-planner/deterministic-layers.ts +47 -4
- package/src/fixtures/travel-planner/phase2.ts +4 -3
- package/src/fixtures/travel-planner/phase3.ts +19 -42
- package/src/fixtures/travel-planner/phase4.ts +24 -37
- package/src/fixtures/travel-planner/phase5.ts +35 -42
- package/src/fixtures/travel-planner/phase6.ts +191 -88
- package/src/fixtures/travel-planner/phase7.ts +4 -102
- package/src/fixtures/travel-planner/scenarios.ts +3 -4
- package/src/fixtures/travel-planner/subagents-durable.ts +35 -61
- package/src/fixtures/travel-planner/subagents.ts +36 -14
- package/src/index.ts +1 -11
- package/src/internal/certification-report.ts +25 -0
- package/dist/index.mjs.map +0 -1
- package/src/code-executor-conformance.d.ts +0 -30
- package/src/fixtures/travel-planner/index.ts +0 -11
- package/src/fixtures/warehouse/index.ts +0 -412
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
import { Context, Deferred, Effect, Layer, Option, Ref, Schema } from "effect";
|
|
2
|
+
import { Tool, Toolkit } from "effect/unstable/ai";
|
|
3
|
+
import * as Agent from "effect-agent/agent";
|
|
4
|
+
import { AgentPolicy } from "effect-agent/agent-policy";
|
|
5
|
+
import { IdGenerator } from "effect-agent/id-generator";
|
|
6
|
+
import { RunId, ThreadId, TurnId } from "effect-agent/identifiers";
|
|
7
|
+
import { RunContextPreparationPassthrough } from "effect-agent/run-options";
|
|
8
|
+
import { ThreadHistory } from "effect-agent/thread-history";
|
|
9
|
+
//#region src/fixtures/travel-planner/definition.ts
|
|
10
|
+
const AirportCode = Schema.NonEmptyString.pipe(Schema.brand("@effect-agent/testing/travel-planner/AirportCode"));
|
|
11
|
+
const QuoteId = Schema.NonEmptyString.pipe(Schema.brand("@effect-agent/testing/travel-planner/QuoteId"));
|
|
12
|
+
var TripRequest = class extends Schema.Class("TripRequest")({
|
|
13
|
+
request: Schema.NonEmptyString,
|
|
14
|
+
origin: AirportCode,
|
|
15
|
+
destination: AirportCode,
|
|
16
|
+
departOn: Schema.String,
|
|
17
|
+
nights: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
18
|
+
travelers: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
19
|
+
budgetCents: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
20
|
+
currency: Schema.Literal("USD")
|
|
21
|
+
}) {};
|
|
22
|
+
var FlightQuery = class extends Schema.Class("FlightQuery")({
|
|
23
|
+
origin: AirportCode,
|
|
24
|
+
destination: AirportCode,
|
|
25
|
+
departOn: Schema.String,
|
|
26
|
+
travelers: Schema.Int.check(Schema.isGreaterThan(0))
|
|
27
|
+
}) {};
|
|
28
|
+
var LodgingQuery = class extends Schema.Class("LodgingQuery")({
|
|
29
|
+
destination: AirportCode,
|
|
30
|
+
departOn: Schema.String,
|
|
31
|
+
nights: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
32
|
+
travelers: Schema.Int.check(Schema.isGreaterThan(0))
|
|
33
|
+
}) {};
|
|
34
|
+
var ActivityQuery = class extends Schema.Class("ActivityQuery")({
|
|
35
|
+
destination: AirportCode,
|
|
36
|
+
departOn: Schema.String,
|
|
37
|
+
nights: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
38
|
+
travelers: Schema.Int.check(Schema.isGreaterThan(0))
|
|
39
|
+
}) {};
|
|
40
|
+
var FlightOption = class extends Schema.Class("FlightOption")({
|
|
41
|
+
quoteId: QuoteId,
|
|
42
|
+
flight: Schema.String,
|
|
43
|
+
estimatedCents: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
44
|
+
currency: Schema.Literal("USD")
|
|
45
|
+
}) {};
|
|
46
|
+
var LodgingOption = class extends Schema.Class("LodgingOption")({
|
|
47
|
+
lodging: Schema.String,
|
|
48
|
+
estimatedCents: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
49
|
+
currency: Schema.Literal("USD")
|
|
50
|
+
}) {};
|
|
51
|
+
/** A successful empty activity search is distinct from supplier unavailability. */
|
|
52
|
+
var ActivitySearchResult = class extends Schema.Class("ActivitySearchResult")({ activities: Schema.Array(Schema.String) }) {};
|
|
53
|
+
var Itinerary = class extends Schema.Class("Itinerary")({
|
|
54
|
+
title: Schema.String,
|
|
55
|
+
route: Schema.String,
|
|
56
|
+
dates: Schema.String,
|
|
57
|
+
flight: Schema.String,
|
|
58
|
+
lodging: Schema.String,
|
|
59
|
+
activities: Schema.Array(Schema.String),
|
|
60
|
+
estimatedTotalCents: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
61
|
+
currency: Schema.Literal("USD"),
|
|
62
|
+
quoteId: QuoteId,
|
|
63
|
+
assumptions: Schema.Array(Schema.String),
|
|
64
|
+
unresolvedConstraints: Schema.Array(Schema.String),
|
|
65
|
+
nextAction: Schema.Literal("review")
|
|
66
|
+
}) {};
|
|
67
|
+
var TravelPlan = class extends Schema.Class("TravelPlan")({ itineraries: Schema.Array(Itinerary) }) {};
|
|
68
|
+
const unavailableFields = {
|
|
69
|
+
query: Schema.String,
|
|
70
|
+
message: Schema.String
|
|
71
|
+
};
|
|
72
|
+
var FlightUnavailable = class extends Schema.TaggedError()("FlightUnavailable", unavailableFields) {};
|
|
73
|
+
var LodgingUnavailable = class extends Schema.TaggedError()("LodgingUnavailable", unavailableFields) {};
|
|
74
|
+
var ActivityUnavailable = class extends Schema.TaggedError()("ActivityUnavailable", unavailableFields) {};
|
|
75
|
+
var GuidanceFailure = class extends Schema.TaggedError()("GuidanceFailure", { message: Schema.String }) {};
|
|
76
|
+
var FlightCatalog = class extends Context.Service()("@effect-agent/testing/travel-planner/FlightCatalog") {};
|
|
77
|
+
var LodgingCatalog = class extends Context.Service()("@effect-agent/testing/travel-planner/LodgingCatalog") {};
|
|
78
|
+
var ActivityCatalog = class extends Context.Service()("@effect-agent/testing/travel-planner/ActivityCatalog") {};
|
|
79
|
+
var TravelGuidance = class extends Context.Service()("@effect-agent/testing/travel-planner/TravelGuidance") {};
|
|
80
|
+
const SearchFlights = Tool.make("search_flights", {
|
|
81
|
+
parameters: FlightQuery,
|
|
82
|
+
success: FlightOption,
|
|
83
|
+
failure: FlightUnavailable,
|
|
84
|
+
failureMode: "error",
|
|
85
|
+
dependencies: [FlightCatalog]
|
|
86
|
+
});
|
|
87
|
+
const SearchLodging = Tool.make("search_lodging", {
|
|
88
|
+
parameters: LodgingQuery,
|
|
89
|
+
success: LodgingOption,
|
|
90
|
+
failure: LodgingUnavailable,
|
|
91
|
+
failureMode: "error",
|
|
92
|
+
dependencies: [LodgingCatalog]
|
|
93
|
+
});
|
|
94
|
+
const SearchActivities = Tool.make("search_activities", {
|
|
95
|
+
parameters: ActivityQuery,
|
|
96
|
+
success: ActivitySearchResult,
|
|
97
|
+
failure: ActivityUnavailable,
|
|
98
|
+
failureMode: "error",
|
|
99
|
+
dependencies: [ActivityCatalog]
|
|
100
|
+
});
|
|
101
|
+
const TravelPlannerToolkit = Toolkit.make(SearchFlights, SearchLodging, SearchActivities);
|
|
102
|
+
const TravelPlannerToolkitLayer = TravelPlannerToolkit.toLayer({
|
|
103
|
+
search_flights: (query) => Effect.flatMap(FlightCatalog, (catalog) => catalog.search(query)),
|
|
104
|
+
search_lodging: (query) => Effect.flatMap(LodgingCatalog, (catalog) => catalog.search(query)),
|
|
105
|
+
search_activities: (query) => Effect.flatMap(ActivityCatalog, (catalog) => catalog.search(query))
|
|
106
|
+
});
|
|
107
|
+
const TravelPlanner = Agent.make("travel-planner", {
|
|
108
|
+
input: TripRequest,
|
|
109
|
+
output: TravelPlan,
|
|
110
|
+
instructions: (input) => Effect.flatMap(TravelGuidance, (guidance) => guidance.instructions(input)),
|
|
111
|
+
toolkit: TravelPlannerToolkit,
|
|
112
|
+
policy: AgentPolicy.make({
|
|
113
|
+
maxTurns: 2,
|
|
114
|
+
maxToolCalls: 3,
|
|
115
|
+
maxDuration: "30 seconds",
|
|
116
|
+
toolConcurrency: 3
|
|
117
|
+
}),
|
|
118
|
+
description: "Build one review-only itinerary from bounded parallel deterministic searches.",
|
|
119
|
+
metadata: {
|
|
120
|
+
deploymentClass: "E",
|
|
121
|
+
phase: "P1"
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/fixtures/travel-planner/deterministic-layers.ts
|
|
126
|
+
var CatalogLifecycleCounts = class extends Schema.Class("CatalogLifecycleCounts")({
|
|
127
|
+
acquired: Schema.Natural,
|
|
128
|
+
finalized: Schema.Natural
|
|
129
|
+
}) {};
|
|
130
|
+
var CatalogLifecycle = class CatalogLifecycle extends Context.Service()("@effect-agent/testing/travel-planner/CatalogLifecycle") {
|
|
131
|
+
static layerNoDeps = Layer.effect(this, Effect.gen(function* () {
|
|
132
|
+
const acquired = yield* Ref.make(0);
|
|
133
|
+
const finalized = yield* Ref.make(0);
|
|
134
|
+
return CatalogLifecycle.of({
|
|
135
|
+
markAcquired: Ref.update(acquired, (n) => n + 1),
|
|
136
|
+
markFinalized: Ref.update(finalized, (n) => n + 1),
|
|
137
|
+
counts: Effect.all({
|
|
138
|
+
acquired: Ref.get(acquired),
|
|
139
|
+
finalized: Ref.get(finalized)
|
|
140
|
+
}).pipe(Effect.map((counts) => CatalogLifecycleCounts.make(counts)))
|
|
141
|
+
});
|
|
142
|
+
}));
|
|
143
|
+
};
|
|
144
|
+
const flight = FlightOption.make({
|
|
145
|
+
quoteId: Schema.decodeSync(QuoteId)("quote-sfo-lhr-001"),
|
|
146
|
+
flight: "EA 218 · nonstop · SFO 18:40 → LHR 13:05+1",
|
|
147
|
+
estimatedCents: 18e4,
|
|
148
|
+
currency: "USD"
|
|
149
|
+
});
|
|
150
|
+
const lodging = LodgingOption.make({
|
|
151
|
+
lodging: "Bloomsbury House · refundable studio · 4 nights",
|
|
152
|
+
estimatedCents: 104e3,
|
|
153
|
+
currency: "USD"
|
|
154
|
+
});
|
|
155
|
+
const activities = ActivitySearchResult.make({ activities: ["British Museum timed entry", "Thames evening walk"] });
|
|
156
|
+
const ReverseCompletionToolkitLayer = Effect.gen(function* () {
|
|
157
|
+
const flightStarted = yield* Deferred.make();
|
|
158
|
+
const lodgingStarted = yield* Deferred.make();
|
|
159
|
+
const activityStarted = yield* Deferred.make();
|
|
160
|
+
const releaseFlight = yield* Deferred.make();
|
|
161
|
+
const releaseLodging = yield* Deferred.make();
|
|
162
|
+
const releaseActivity = yield* Deferred.make();
|
|
163
|
+
const awaitRelease = (started, release, value) => Deferred.succeed(started, void 0).pipe(Effect.andThen(Deferred.await(release)), Effect.as(value));
|
|
164
|
+
return {
|
|
165
|
+
controls: {
|
|
166
|
+
flightStarted: Deferred.await(flightStarted),
|
|
167
|
+
lodgingStarted: Deferred.await(lodgingStarted),
|
|
168
|
+
activityStarted: Deferred.await(activityStarted),
|
|
169
|
+
releaseFlight: Deferred.succeed(releaseFlight, void 0).pipe(Effect.asVoid),
|
|
170
|
+
releaseLodging: Deferred.succeed(releaseLodging, void 0).pipe(Effect.asVoid),
|
|
171
|
+
releaseActivity: Deferred.succeed(releaseActivity, void 0).pipe(Effect.asVoid)
|
|
172
|
+
},
|
|
173
|
+
layer: TravelPlannerToolkit.toLayer({
|
|
174
|
+
search_flights: () => awaitRelease(flightStarted, releaseFlight, flight),
|
|
175
|
+
search_lodging: () => awaitRelease(lodgingStarted, releaseLodging, lodging),
|
|
176
|
+
search_activities: () => awaitRelease(activityStarted, releaseActivity, activities)
|
|
177
|
+
})
|
|
178
|
+
};
|
|
179
|
+
});
|
|
180
|
+
const FlightCatalogLayer = Layer.effect(FlightCatalog, Effect.gen(function* () {
|
|
181
|
+
const lifecycle = yield* CatalogLifecycle;
|
|
182
|
+
yield* Effect.acquireRelease(lifecycle.markAcquired, () => lifecycle.markFinalized);
|
|
183
|
+
return FlightCatalog.of({ search: (query) => query.origin === query.destination ? Effect.fail(FlightUnavailable.make({
|
|
184
|
+
query: `${query.origin}-${query.destination}`,
|
|
185
|
+
message: "Origin and destination must differ."
|
|
186
|
+
})) : Effect.succeed(flight) });
|
|
187
|
+
}));
|
|
188
|
+
const LodgingCatalogLayer = Layer.effect(LodgingCatalog, Effect.gen(function* () {
|
|
189
|
+
const lifecycle = yield* CatalogLifecycle;
|
|
190
|
+
yield* Effect.acquireRelease(lifecycle.markAcquired, () => lifecycle.markFinalized);
|
|
191
|
+
return LodgingCatalog.of({ search: (query) => query.nights < 1 ? Effect.fail(LodgingUnavailable.make({
|
|
192
|
+
query: query.destination,
|
|
193
|
+
message: "At least one night is required."
|
|
194
|
+
})) : Effect.succeed(lodging) });
|
|
195
|
+
}));
|
|
196
|
+
const ActivityCatalogLayer = Layer.effect(ActivityCatalog, Effect.gen(function* () {
|
|
197
|
+
const lifecycle = yield* CatalogLifecycle;
|
|
198
|
+
yield* Effect.acquireRelease(lifecycle.markAcquired, () => lifecycle.markFinalized);
|
|
199
|
+
return ActivityCatalog.of({ search: (query) => query.destination === "" ? Effect.fail(ActivityUnavailable.make({
|
|
200
|
+
query: query.destination,
|
|
201
|
+
message: "Destination is required."
|
|
202
|
+
})) : Effect.succeed(activities) });
|
|
203
|
+
}));
|
|
204
|
+
/** Stable supplier-side booking identity, minted deterministically from the idempotency key. */
|
|
205
|
+
const BookingRef = Schema.NonEmptyString.pipe(Schema.brand("@effect-agent/testing/travel-planner/BookingRef"));
|
|
206
|
+
/** The supplier desk operations the P5 booking Tools and Steps invoke. */
|
|
207
|
+
const SupplierOperation = Schema.Literals([
|
|
208
|
+
"book-flight",
|
|
209
|
+
"cancel-booking",
|
|
210
|
+
"reserve-flight",
|
|
211
|
+
"reserve-lodging",
|
|
212
|
+
"issue-confirmation"
|
|
213
|
+
]);
|
|
214
|
+
/**
|
|
215
|
+
* One row of external supplier truth. The desk deduplicates by `idempotencyKey` — replaying a
|
|
216
|
+
* call with the same key returns this exact record without creating a second booking — which is
|
|
217
|
+
* precisely the honesty model of DUR-010: the framework never makes an external call
|
|
218
|
+
* exactly-once; the supplier's idempotency key does.
|
|
219
|
+
*/
|
|
220
|
+
var SupplierBookingRecord = class extends Schema.Class("@effect-agent/testing/travel-planner/SupplierBookingRecord")({
|
|
221
|
+
bookingRef: BookingRef,
|
|
222
|
+
idempotencyKey: Schema.NonEmptyString,
|
|
223
|
+
operation: SupplierOperation,
|
|
224
|
+
detail: Schema.NonEmptyString,
|
|
225
|
+
status: Schema.Literals(["confirmed", "cancelled"])
|
|
226
|
+
}) {};
|
|
227
|
+
var SupplierUnavailable = class extends Schema.TaggedError()("SupplierUnavailable", { message: Schema.String }) {};
|
|
228
|
+
/** The desk-internal idempotency key of one cancellation: cancel is idempotent by bookingRef. */
|
|
229
|
+
const cancelBookingIdempotencyKey = (bookingRef) => `cancel-booking:${bookingRef}`;
|
|
230
|
+
/** The deterministic bookingRef the desk mints for one idempotency key. */
|
|
231
|
+
const supplierBookingRefFor = (idempotencyKey) => Schema.decodeSync(BookingRef)(`ref:${idempotencyKey}`);
|
|
232
|
+
/**
|
|
233
|
+
* The deterministic in-memory supplier: an idempotency-keyed booking store with per-key call
|
|
234
|
+
* counters and injectable crash windows.
|
|
235
|
+
*
|
|
236
|
+
* - `book`/`cancel` always count the call (at-least-once execution stays observable), then
|
|
237
|
+
* dedupe the external effect by idempotency key — the supplier-side contract the P5 Tools and
|
|
238
|
+
* Steps rely on.
|
|
239
|
+
* - `holdAfterWrite` arms a one-shot crash window: the next call with that key performs its
|
|
240
|
+
* supplier write, signals `held`, and never returns. Interrupting the Attempt at that point
|
|
241
|
+
* models "the external effect happened but no outcome was recorded" without any wall clock.
|
|
242
|
+
* - `bookings`/`lookup` expose external truth for the reconciler and for never-fabricate
|
|
243
|
+
* assertions.
|
|
244
|
+
*/
|
|
245
|
+
var SupplierBookingDesk = class SupplierBookingDesk extends Context.Service()("@effect-agent/testing/travel-planner/SupplierBookingDesk") {
|
|
246
|
+
static layer = Layer.effect(this, Effect.gen(function* () {
|
|
247
|
+
const state = yield* Ref.make({
|
|
248
|
+
bookings: /* @__PURE__ */ new Map(),
|
|
249
|
+
counts: /* @__PURE__ */ new Map(),
|
|
250
|
+
holds: /* @__PURE__ */ new Map()
|
|
251
|
+
});
|
|
252
|
+
const enterHold = (hold) => Option.isSome(hold) ? Deferred.succeed(hold.value.held, void 0).pipe(Effect.andThen(Deferred.await(hold.value.release))) : Effect.void;
|
|
253
|
+
const book = (request) => Ref.modify(state, (current) => {
|
|
254
|
+
const counts = new Map(current.counts).set(request.idempotencyKey, (current.counts.get(request.idempotencyKey) ?? 0) + 1);
|
|
255
|
+
const existing = current.bookings.get(request.idempotencyKey);
|
|
256
|
+
const record = existing ?? SupplierBookingRecord.make({
|
|
257
|
+
bookingRef: supplierBookingRefFor(request.idempotencyKey),
|
|
258
|
+
idempotencyKey: request.idempotencyKey,
|
|
259
|
+
operation: request.operation,
|
|
260
|
+
detail: request.detail,
|
|
261
|
+
status: "confirmed"
|
|
262
|
+
});
|
|
263
|
+
const bookings = existing === void 0 ? new Map(current.bookings).set(request.idempotencyKey, record) : current.bookings;
|
|
264
|
+
const hold = Option.fromNullishOr(current.holds.get(request.idempotencyKey));
|
|
265
|
+
const holds = Option.isSome(hold) ? (() => {
|
|
266
|
+
const next = new Map(current.holds);
|
|
267
|
+
next.delete(request.idempotencyKey);
|
|
268
|
+
return next;
|
|
269
|
+
})() : current.holds;
|
|
270
|
+
return [{
|
|
271
|
+
record,
|
|
272
|
+
hold
|
|
273
|
+
}, {
|
|
274
|
+
bookings,
|
|
275
|
+
counts,
|
|
276
|
+
holds
|
|
277
|
+
}];
|
|
278
|
+
}).pipe(Effect.flatMap(({ hold, record }) => enterHold(hold).pipe(Effect.as(record))));
|
|
279
|
+
const cancel = (bookingRef) => Ref.modify(state, (current) => {
|
|
280
|
+
const key = cancelBookingIdempotencyKey(bookingRef);
|
|
281
|
+
const counts = new Map(current.counts).set(key, (current.counts.get(key) ?? 0) + 1);
|
|
282
|
+
const existingEntry = [...current.bookings.entries()].find(([, record]) => record.bookingRef === bookingRef);
|
|
283
|
+
if (existingEntry === void 0) return [{
|
|
284
|
+
record: Option.none(),
|
|
285
|
+
hold: Option.none()
|
|
286
|
+
}, {
|
|
287
|
+
...current,
|
|
288
|
+
counts
|
|
289
|
+
}];
|
|
290
|
+
const [storeKey, existing] = existingEntry;
|
|
291
|
+
const cancelled = existing.status === "cancelled" ? existing : SupplierBookingRecord.make({
|
|
292
|
+
...existing,
|
|
293
|
+
status: "cancelled"
|
|
294
|
+
});
|
|
295
|
+
const bookings = new Map(current.bookings).set(storeKey, cancelled);
|
|
296
|
+
const hold = Option.fromNullishOr(current.holds.get(key));
|
|
297
|
+
const holds = Option.isSome(hold) ? (() => {
|
|
298
|
+
const next = new Map(current.holds);
|
|
299
|
+
next.delete(key);
|
|
300
|
+
return next;
|
|
301
|
+
})() : current.holds;
|
|
302
|
+
return [{
|
|
303
|
+
record: Option.some(cancelled),
|
|
304
|
+
hold
|
|
305
|
+
}, {
|
|
306
|
+
bookings,
|
|
307
|
+
counts,
|
|
308
|
+
holds
|
|
309
|
+
}];
|
|
310
|
+
}).pipe(Effect.flatMap(({ hold, record }) => Option.isNone(record) ? Effect.fail(SupplierUnavailable.make({ message: `The supplier desk has no booking under ${bookingRef}.` })) : enterHold(hold).pipe(Effect.as(record.value))));
|
|
311
|
+
return SupplierBookingDesk.of({
|
|
312
|
+
book,
|
|
313
|
+
cancel,
|
|
314
|
+
lookup: (idempotencyKey) => Ref.get(state).pipe(Effect.map((current) => Option.fromNullishOr(current.bookings.get(idempotencyKey)))),
|
|
315
|
+
bookings: Ref.get(state).pipe(Effect.map((current) => [...current.bookings.values()])),
|
|
316
|
+
callCount: (idempotencyKey) => Ref.get(state).pipe(Effect.map((current) => current.counts.get(idempotencyKey) ?? 0)),
|
|
317
|
+
holdAfterWrite: (idempotencyKey) => Effect.gen(function* () {
|
|
318
|
+
const held = yield* Deferred.make();
|
|
319
|
+
const release = yield* Deferred.make();
|
|
320
|
+
yield* Ref.update(state, (current) => ({
|
|
321
|
+
...current,
|
|
322
|
+
holds: new Map(current.holds).set(idempotencyKey, {
|
|
323
|
+
held,
|
|
324
|
+
release
|
|
325
|
+
})
|
|
326
|
+
}));
|
|
327
|
+
return {
|
|
328
|
+
held: Deferred.await(held),
|
|
329
|
+
release: Deferred.succeed(release, void 0).pipe(Effect.asVoid)
|
|
330
|
+
};
|
|
331
|
+
})
|
|
332
|
+
});
|
|
333
|
+
}));
|
|
334
|
+
};
|
|
335
|
+
const TravelGuidanceLayer = Layer.succeed(TravelGuidance, TravelGuidance.of({ instructions: (input) => Effect.succeed([
|
|
336
|
+
"You are the Effect Agent Travel Planner P1 interpreter fixture.",
|
|
337
|
+
`The user asked: ${input.request}`,
|
|
338
|
+
"Call search_flights, search_lodging, and search_activities exactly once in one Tool batch.",
|
|
339
|
+
"Then return only a JSON object of exactly this shape, no prose:",
|
|
340
|
+
"{\"itineraries\": [{\"title\": \"<short itinerary name>\", \"route\": \"<origin-destination>\", \"dates\": \"<date range>\", \"flight\": \"<flight description from the Tool result>\", \"lodging\": \"<lodging description from the Tool result>\", \"activities\": [\"<activity>\", \"...\"], \"estimatedTotalCents\": <positive integer total in cents>, \"currency\": \"USD\", \"quoteId\": \"<quoteId from the flight Tool result>\", \"assumptions\": [\"<assumption>\", \"...\"], \"unresolvedConstraints\": [], \"nextAction\": \"review\"}]}",
|
|
341
|
+
"Use the Tool results verbatim; activity results may legitimately be an empty array.",
|
|
342
|
+
"This is read-only planning. Require review before any mutation."
|
|
343
|
+
].join("\n")) }));
|
|
344
|
+
const DeterministicIdGeneratorLayer = Layer.effect(IdGenerator, Effect.gen(function* () {
|
|
345
|
+
const thread = yield* Ref.make(0);
|
|
346
|
+
const run = yield* Ref.make(0);
|
|
347
|
+
const turn = yield* Ref.make(0);
|
|
348
|
+
return IdGenerator.of({
|
|
349
|
+
nextThreadId: Ref.updateAndGet(thread, (n) => n + 1).pipe(Effect.map((n) => Schema.decodeSync(ThreadId)(`thread-${n}`))),
|
|
350
|
+
nextRunId: Ref.updateAndGet(run, (n) => n + 1).pipe(Effect.map((n) => Schema.decodeSync(RunId)(`run-${n}`))),
|
|
351
|
+
nextTurnId: Ref.updateAndGet(turn, (n) => n + 1).pipe(Effect.map((n) => Schema.decodeSync(TurnId)(`turn-${n}`)))
|
|
352
|
+
});
|
|
353
|
+
}));
|
|
354
|
+
const TravelPlannerRuntimeLayer = Layer.mergeAll(RunContextPreparationPassthrough, ThreadHistory.layer, TravelPlannerToolkitLayer, FlightCatalogLayer, LodgingCatalogLayer, ActivityCatalogLayer, TravelGuidanceLayer, DeterministicIdGeneratorLayer).pipe(Layer.provide(CatalogLifecycle.layerNoDeps));
|
|
355
|
+
//#endregion
|
|
356
|
+
export { LodgingQuery as A, TravelPlannerToolkitLayer as B, FlightOption as C, Itinerary as D, GuidanceFailure as E, SearchLodging as F, TravelGuidance as I, TravelPlan as L, QuoteId as M, SearchActivities as N, LodgingCatalog as O, SearchFlights as P, TravelPlanner as R, FlightCatalog as S, FlightUnavailable as T, TripRequest as V, ActivityCatalog as _, DeterministicIdGeneratorLayer as a, ActivityUnavailable as b, ReverseCompletionToolkitLayer as c, SupplierOperation as d, SupplierUnavailable as f, supplierBookingRefFor as g, cancelBookingIdempotencyKey as h, CatalogLifecycleCounts as i, LodgingUnavailable as j, LodgingOption as k, SupplierBookingDesk as l, TravelPlannerRuntimeLayer as m, BookingRef as n, FlightCatalogLayer as o, TravelGuidanceLayer as p, CatalogLifecycle as r, LodgingCatalogLayer as s, ActivityCatalogLayer as t, SupplierBookingRecord as u, ActivityQuery as v, FlightQuery as w, AirportCode as x, ActivitySearchResult as y, TravelPlannerToolkit as z };
|
|
357
|
+
|
|
358
|
+
//# sourceMappingURL=deterministic-layers-D5owIoke.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deterministic-layers-D5owIoke.mjs","names":[],"sources":["../src/fixtures/travel-planner/definition.ts","../src/fixtures/travel-planner/deterministic-layers.ts"],"sourcesContent":["import { Context, Effect, Schema } from \"effect\";\nimport * as Agent from \"effect-agent/agent\";\nimport { AgentPolicy } from \"effect-agent/agent-policy\";\nimport { Tool, Toolkit } from \"effect/unstable/ai\";\n\nexport const AirportCode = Schema.NonEmptyString.pipe(\n Schema.brand(\"@effect-agent/testing/travel-planner/AirportCode\"),\n);\n\nexport type AirportCode = typeof AirportCode.Type;\n\nexport const QuoteId = Schema.NonEmptyString.pipe(\n Schema.brand(\"@effect-agent/testing/travel-planner/QuoteId\"),\n);\n\nexport type QuoteId = typeof QuoteId.Type;\n\nexport class TripRequest extends Schema.Class<TripRequest>(\"TripRequest\")({\n request: Schema.NonEmptyString,\n origin: AirportCode,\n destination: AirportCode,\n departOn: Schema.String,\n nights: Schema.Int.check(Schema.isGreaterThan(0)),\n travelers: Schema.Int.check(Schema.isGreaterThan(0)),\n budgetCents: Schema.Int.check(Schema.isGreaterThan(0)),\n currency: Schema.Literal(\"USD\"),\n}) {}\n\nexport class FlightQuery extends Schema.Class<FlightQuery>(\"FlightQuery\")({\n origin: AirportCode,\n destination: AirportCode,\n departOn: Schema.String,\n travelers: Schema.Int.check(Schema.isGreaterThan(0)),\n}) {}\n\nexport class LodgingQuery extends Schema.Class<LodgingQuery>(\"LodgingQuery\")({\n destination: AirportCode,\n departOn: Schema.String,\n nights: Schema.Int.check(Schema.isGreaterThan(0)),\n travelers: Schema.Int.check(Schema.isGreaterThan(0)),\n}) {}\n\nexport class ActivityQuery extends Schema.Class<ActivityQuery>(\"ActivityQuery\")({\n destination: AirportCode,\n departOn: Schema.String,\n nights: Schema.Int.check(Schema.isGreaterThan(0)),\n travelers: Schema.Int.check(Schema.isGreaterThan(0)),\n}) {}\n\nexport class FlightOption extends Schema.Class<FlightOption>(\"FlightOption\")({\n quoteId: QuoteId,\n flight: Schema.String,\n estimatedCents: Schema.Int.check(Schema.isGreaterThan(0)),\n currency: Schema.Literal(\"USD\"),\n}) {}\n\nexport class LodgingOption extends Schema.Class<LodgingOption>(\"LodgingOption\")({\n lodging: Schema.String,\n estimatedCents: Schema.Int.check(Schema.isGreaterThan(0)),\n currency: Schema.Literal(\"USD\"),\n}) {}\n\n/** A successful empty activity search is distinct from supplier unavailability. */\nexport class ActivitySearchResult extends Schema.Class<ActivitySearchResult>(\n \"ActivitySearchResult\",\n)({\n activities: Schema.Array(Schema.String),\n}) {}\n\nexport class Itinerary extends Schema.Class<Itinerary>(\"Itinerary\")({\n title: Schema.String,\n route: Schema.String,\n dates: Schema.String,\n flight: Schema.String,\n lodging: Schema.String,\n activities: Schema.Array(Schema.String),\n estimatedTotalCents: Schema.Int.check(Schema.isGreaterThan(0)),\n currency: Schema.Literal(\"USD\"),\n quoteId: QuoteId,\n assumptions: Schema.Array(Schema.String),\n unresolvedConstraints: Schema.Array(Schema.String),\n nextAction: Schema.Literal(\"review\"),\n}) {}\n\nexport class TravelPlan extends Schema.Class<TravelPlan>(\"TravelPlan\")({\n itineraries: Schema.Array(Itinerary),\n}) {}\n\nconst unavailableFields = { query: Schema.String, message: Schema.String };\n\nexport class FlightUnavailable extends Schema.TaggedError<FlightUnavailable>()(\n \"FlightUnavailable\",\n unavailableFields,\n) {}\n\nexport class LodgingUnavailable extends Schema.TaggedError<LodgingUnavailable>()(\n \"LodgingUnavailable\",\n unavailableFields,\n) {}\n\nexport class ActivityUnavailable extends Schema.TaggedError<ActivityUnavailable>()(\n \"ActivityUnavailable\",\n unavailableFields,\n) {}\n\nexport class GuidanceFailure extends Schema.TaggedError<GuidanceFailure>()(\"GuidanceFailure\", {\n message: Schema.String,\n}) {}\n\nexport class FlightCatalog extends Context.Service<\n FlightCatalog,\n { readonly search: (query: FlightQuery) => Effect.Effect<FlightOption, FlightUnavailable> }\n>()(\"@effect-agent/testing/travel-planner/FlightCatalog\") {}\n\nexport class LodgingCatalog extends Context.Service<\n LodgingCatalog,\n { readonly search: (query: LodgingQuery) => Effect.Effect<LodgingOption, LodgingUnavailable> }\n>()(\"@effect-agent/testing/travel-planner/LodgingCatalog\") {}\n\nexport class ActivityCatalog extends Context.Service<\n ActivityCatalog,\n {\n readonly search: (\n query: ActivityQuery,\n ) => Effect.Effect<ActivitySearchResult, ActivityUnavailable>;\n }\n>()(\"@effect-agent/testing/travel-planner/ActivityCatalog\") {}\n\nexport class TravelGuidance extends Context.Service<\n TravelGuidance,\n { readonly instructions: (input: TripRequest) => Effect.Effect<string, GuidanceFailure> }\n>()(\"@effect-agent/testing/travel-planner/TravelGuidance\") {}\n\nexport const SearchFlights = Tool.make(\"search_flights\", {\n parameters: FlightQuery,\n success: FlightOption,\n failure: FlightUnavailable,\n failureMode: \"error\",\n dependencies: [FlightCatalog],\n});\n\nexport const SearchLodging = Tool.make(\"search_lodging\", {\n parameters: LodgingQuery,\n success: LodgingOption,\n failure: LodgingUnavailable,\n failureMode: \"error\",\n dependencies: [LodgingCatalog],\n});\n\nexport const SearchActivities = Tool.make(\"search_activities\", {\n parameters: ActivityQuery,\n success: ActivitySearchResult,\n failure: ActivityUnavailable,\n failureMode: \"error\",\n dependencies: [ActivityCatalog],\n});\n\nexport const TravelPlannerToolkit = Toolkit.make(SearchFlights, SearchLodging, SearchActivities);\n\nexport const TravelPlannerToolkitLayer = TravelPlannerToolkit.toLayer({\n search_flights: (query) => Effect.flatMap(FlightCatalog, (catalog) => catalog.search(query)),\n search_lodging: (query) => Effect.flatMap(LodgingCatalog, (catalog) => catalog.search(query)),\n search_activities: (query) => Effect.flatMap(ActivityCatalog, (catalog) => catalog.search(query)),\n});\n\nexport const TravelPlanner = Agent.make(\"travel-planner\", {\n input: TripRequest,\n output: TravelPlan,\n instructions: (input) =>\n Effect.flatMap(TravelGuidance, (guidance) => guidance.instructions(input)),\n toolkit: TravelPlannerToolkit,\n policy: AgentPolicy.make({\n maxTurns: 2,\n maxToolCalls: 3,\n maxDuration: \"30 seconds\",\n toolConcurrency: 3,\n }),\n description: \"Build one review-only itinerary from bounded parallel deterministic searches.\",\n metadata: { deploymentClass: \"E\", phase: \"P1\" },\n});\n","import { Context, Deferred, Effect, Layer, Option, Ref, Schema } from \"effect\";\nimport { IdGenerator } from \"effect-agent/id-generator\";\nimport { ThreadId, RunId, TurnId } from \"effect-agent/identifiers\";\nimport { RunContextPreparationPassthrough } from \"effect-agent/run-options\";\nimport { ThreadHistory } from \"effect-agent/thread-history\";\n\nimport {\n ActivityCatalog,\n ActivitySearchResult,\n ActivityUnavailable,\n FlightCatalog,\n FlightOption,\n FlightUnavailable,\n LodgingCatalog,\n LodgingOption,\n LodgingUnavailable,\n QuoteId,\n TravelGuidance,\n TravelPlannerToolkit,\n TravelPlannerToolkitLayer,\n} from \"./definition.ts\";\n\nexport class CatalogLifecycleCounts extends Schema.Class<CatalogLifecycleCounts>(\n \"CatalogLifecycleCounts\",\n)({\n acquired: Schema.Natural,\n finalized: Schema.Natural,\n}) {}\n\nexport class CatalogLifecycle extends Context.Service<\n CatalogLifecycle,\n {\n readonly markAcquired: Effect.Effect<void>;\n readonly markFinalized: Effect.Effect<void>;\n readonly counts: Effect.Effect<CatalogLifecycleCounts>;\n }\n>()(\"@effect-agent/testing/travel-planner/CatalogLifecycle\") {\n static readonly layerNoDeps = Layer.effect(\n this,\n Effect.gen(function* () {\n const acquired = yield* Ref.make(0);\n const finalized = yield* Ref.make(0);\n\n return CatalogLifecycle.of({\n markAcquired: Ref.update(acquired, (n) => n + 1),\n markFinalized: Ref.update(finalized, (n) => n + 1),\n counts: Effect.all({ acquired: Ref.get(acquired), finalized: Ref.get(finalized) }).pipe(\n Effect.map((counts) => CatalogLifecycleCounts.make(counts)),\n ),\n });\n }),\n );\n}\n\nconst flight = FlightOption.make({\n quoteId: Schema.decodeSync(QuoteId)(\"quote-sfo-lhr-001\"),\n flight: \"EA 218 · nonstop · SFO 18:40 → LHR 13:05+1\",\n estimatedCents: 180_000,\n currency: \"USD\",\n});\n\nconst lodging = LodgingOption.make({\n lodging: \"Bloomsbury House · refundable studio · 4 nights\",\n estimatedCents: 104_000,\n currency: \"USD\",\n});\n\nconst activities = ActivitySearchResult.make({\n activities: [\"British Museum timed entry\", \"Thames evening walk\"],\n});\n\n/**\n * Deterministic controls for a Tool batch whose completions are released in a\n * caller-selected order. This is intentionally a test fixture: it uses no\n * clock or sleep and lets engine scheduler tests prove parallel starts and\n * declaration-order prompt materialization.\n */\nexport interface TravelPlannerCompletionControls {\n readonly flightStarted: Effect.Effect<void>;\n readonly lodgingStarted: Effect.Effect<void>;\n readonly activityStarted: Effect.Effect<void>;\n readonly releaseFlight: Effect.Effect<void>;\n readonly releaseLodging: Effect.Effect<void>;\n readonly releaseActivity: Effect.Effect<void>;\n}\n\nexport const ReverseCompletionToolkitLayer = Effect.gen(function* () {\n const flightStarted = yield* Deferred.make<void>();\n const lodgingStarted = yield* Deferred.make<void>();\n const activityStarted = yield* Deferred.make<void>();\n const releaseFlight = yield* Deferred.make<void>();\n const releaseLodging = yield* Deferred.make<void>();\n const releaseActivity = yield* Deferred.make<void>();\n\n const awaitRelease = <A>(\n started: Deferred.Deferred<void>,\n release: Deferred.Deferred<void>,\n value: A,\n ) =>\n Deferred.succeed(started, undefined).pipe(\n Effect.andThen(Deferred.await(release)),\n Effect.as(value),\n );\n\n return {\n controls: {\n flightStarted: Deferred.await(flightStarted),\n lodgingStarted: Deferred.await(lodgingStarted),\n activityStarted: Deferred.await(activityStarted),\n releaseFlight: Deferred.succeed(releaseFlight, undefined).pipe(Effect.asVoid),\n releaseLodging: Deferred.succeed(releaseLodging, undefined).pipe(Effect.asVoid),\n releaseActivity: Deferred.succeed(releaseActivity, undefined).pipe(Effect.asVoid),\n },\n layer: TravelPlannerToolkit.toLayer({\n search_flights: () => awaitRelease(flightStarted, releaseFlight, flight),\n search_lodging: () => awaitRelease(lodgingStarted, releaseLodging, lodging),\n search_activities: () => awaitRelease(activityStarted, releaseActivity, activities),\n }),\n };\n});\n\nexport const FlightCatalogLayer = Layer.effect(\n FlightCatalog,\n Effect.gen(function* () {\n const lifecycle = yield* CatalogLifecycle;\n\n yield* Effect.acquireRelease(lifecycle.markAcquired, () => lifecycle.markFinalized);\n\n return FlightCatalog.of({\n search: (query) =>\n query.origin === query.destination\n ? Effect.fail(\n FlightUnavailable.make({\n query: `${query.origin}-${query.destination}`,\n message: \"Origin and destination must differ.\",\n }),\n )\n : Effect.succeed(flight),\n });\n }),\n);\n\nexport const LodgingCatalogLayer = Layer.effect(\n LodgingCatalog,\n Effect.gen(function* () {\n const lifecycle = yield* CatalogLifecycle;\n\n yield* Effect.acquireRelease(lifecycle.markAcquired, () => lifecycle.markFinalized);\n\n return LodgingCatalog.of({\n search: (query) =>\n query.nights < 1\n ? Effect.fail(\n LodgingUnavailable.make({\n query: query.destination,\n message: \"At least one night is required.\",\n }),\n )\n : Effect.succeed(lodging),\n });\n }),\n);\n\nexport const ActivityCatalogLayer = Layer.effect(\n ActivityCatalog,\n Effect.gen(function* () {\n const lifecycle = yield* CatalogLifecycle;\n\n yield* Effect.acquireRelease(lifecycle.markAcquired, () => lifecycle.markFinalized);\n\n return ActivityCatalog.of({\n search: (query) =>\n query.destination === \"\"\n ? Effect.fail(\n ActivityUnavailable.make({\n query: query.destination,\n message: \"Destination is required.\",\n }),\n )\n : Effect.succeed(activities),\n });\n }),\n);\n\n/** Stable supplier-side booking identity, minted deterministically from the idempotency key. */\nexport const BookingRef = Schema.NonEmptyString.pipe(\n Schema.brand(\"@effect-agent/testing/travel-planner/BookingRef\"),\n);\n\nexport type BookingRef = typeof BookingRef.Type;\n\n/** The supplier desk operations the P5 booking Tools and Steps invoke. */\nexport const SupplierOperation = Schema.Literals([\n \"book-flight\",\n \"cancel-booking\",\n \"reserve-flight\",\n \"reserve-lodging\",\n \"issue-confirmation\",\n]);\n\nexport type SupplierOperation = typeof SupplierOperation.Type;\n\n/**\n * One row of external supplier truth. The desk deduplicates by `idempotencyKey` — replaying a\n * call with the same key returns this exact record without creating a second booking — which is\n * precisely the honesty model of DUR-010: the framework never makes an external call\n * exactly-once; the supplier's idempotency key does.\n */\nexport class SupplierBookingRecord extends Schema.Class<SupplierBookingRecord>(\n \"@effect-agent/testing/travel-planner/SupplierBookingRecord\",\n)({\n bookingRef: BookingRef,\n idempotencyKey: Schema.NonEmptyString,\n operation: SupplierOperation,\n detail: Schema.NonEmptyString,\n status: Schema.Literals([\"confirmed\", \"cancelled\"]),\n}) {}\n\nexport class SupplierUnavailable extends Schema.TaggedError<SupplierUnavailable>()(\n \"SupplierUnavailable\",\n { message: Schema.String },\n) {}\n\nexport interface SupplierBookRequest {\n readonly operation: SupplierOperation;\n readonly idempotencyKey: string;\n readonly detail: string;\n}\n\n/** Controls returned by an armed crash window (`holdAfterWrite`). */\nexport interface SupplierHoldControls {\n /** Resolves once the armed call has performed its supplier write and is blocked. */\n readonly held: Effect.Effect<void>;\n /** Releases the blocked call (tests that interrupt the Attempt never call this). */\n readonly release: Effect.Effect<void>;\n}\n\n/** The desk-internal idempotency key of one cancellation: cancel is idempotent by bookingRef. */\nexport const cancelBookingIdempotencyKey = (bookingRef: string): string =>\n `cancel-booking:${bookingRef}`;\n\n/** The deterministic bookingRef the desk mints for one idempotency key. */\nexport const supplierBookingRefFor = (idempotencyKey: string): BookingRef =>\n Schema.decodeSync(BookingRef)(`ref:${idempotencyKey}`);\n\ninterface SupplierHoldWindow {\n readonly held: Deferred.Deferred<void>;\n readonly release: Deferred.Deferred<void>;\n}\n\ninterface SupplierDeskState {\n readonly bookings: ReadonlyMap<string, SupplierBookingRecord>;\n readonly counts: ReadonlyMap<string, number>;\n readonly holds: ReadonlyMap<string, SupplierHoldWindow>;\n}\n\n/**\n * The deterministic in-memory supplier: an idempotency-keyed booking store with per-key call\n * counters and injectable crash windows.\n *\n * - `book`/`cancel` always count the call (at-least-once execution stays observable), then\n * dedupe the external effect by idempotency key — the supplier-side contract the P5 Tools and\n * Steps rely on.\n * - `holdAfterWrite` arms a one-shot crash window: the next call with that key performs its\n * supplier write, signals `held`, and never returns. Interrupting the Attempt at that point\n * models \"the external effect happened but no outcome was recorded\" without any wall clock.\n * - `bookings`/`lookup` expose external truth for the reconciler and for never-fabricate\n * assertions.\n */\nexport class SupplierBookingDesk extends Context.Service<\n SupplierBookingDesk,\n {\n readonly book: (\n request: SupplierBookRequest,\n ) => Effect.Effect<SupplierBookingRecord, SupplierUnavailable>;\n readonly cancel: (\n bookingRef: BookingRef,\n ) => Effect.Effect<SupplierBookingRecord, SupplierUnavailable>;\n readonly lookup: (\n idempotencyKey: string,\n ) => Effect.Effect<Option.Option<SupplierBookingRecord>>;\n readonly bookings: Effect.Effect<ReadonlyArray<SupplierBookingRecord>>;\n readonly callCount: (idempotencyKey: string) => Effect.Effect<number>;\n readonly holdAfterWrite: (idempotencyKey: string) => Effect.Effect<SupplierHoldControls>;\n }\n>()(\"@effect-agent/testing/travel-planner/SupplierBookingDesk\") {\n static readonly layer: Layer.Layer<SupplierBookingDesk> = Layer.effect(\n this,\n Effect.gen(function* () {\n const state = yield* Ref.make<SupplierDeskState>({\n bookings: new Map(),\n counts: new Map(),\n holds: new Map(),\n });\n\n const enterHold = (hold: Option.Option<SupplierHoldWindow>) =>\n Option.isSome(hold)\n ? Deferred.succeed(hold.value.held, undefined).pipe(\n Effect.andThen(Deferred.await(hold.value.release)),\n )\n : Effect.void;\n\n const book = (request: SupplierBookRequest) =>\n Ref.modify(state, (current) => {\n const counts = new Map(current.counts).set(\n request.idempotencyKey,\n (current.counts.get(request.idempotencyKey) ?? 0) + 1,\n );\n\n const existing = current.bookings.get(request.idempotencyKey);\n\n const record =\n existing ??\n SupplierBookingRecord.make({\n bookingRef: supplierBookingRefFor(request.idempotencyKey),\n idempotencyKey: request.idempotencyKey,\n operation: request.operation,\n detail: request.detail,\n status: \"confirmed\",\n });\n\n const bookings =\n existing === undefined\n ? new Map(current.bookings).set(request.idempotencyKey, record)\n : current.bookings;\n\n const hold = Option.fromNullishOr(current.holds.get(request.idempotencyKey));\n\n const holds = Option.isSome(hold)\n ? (() => {\n const next = new Map(current.holds);\n\n next.delete(request.idempotencyKey);\n\n return next;\n })()\n : current.holds;\n\n return [\n { record, hold },\n { bookings, counts, holds },\n ] as const;\n }).pipe(Effect.flatMap(({ hold, record }) => enterHold(hold).pipe(Effect.as(record))));\n\n const cancel = (bookingRef: BookingRef) =>\n Ref.modify(state, (current) => {\n const key = cancelBookingIdempotencyKey(bookingRef);\n const counts = new Map(current.counts).set(key, (current.counts.get(key) ?? 0) + 1);\n\n const existingEntry = [...current.bookings.entries()].find(\n ([, record]) => record.bookingRef === bookingRef,\n );\n\n if (existingEntry === undefined) {\n return [\n { record: Option.none<SupplierBookingRecord>(), hold: Option.none() },\n { ...current, counts },\n ] as const;\n }\n const [storeKey, existing] = existingEntry;\n\n const cancelled =\n existing.status === \"cancelled\"\n ? existing\n : SupplierBookingRecord.make({ ...existing, status: \"cancelled\" });\n\n const bookings = new Map(current.bookings).set(storeKey, cancelled);\n const hold = Option.fromNullishOr(current.holds.get(key));\n\n const holds = Option.isSome(hold)\n ? (() => {\n const next = new Map(current.holds);\n\n next.delete(key);\n\n return next;\n })()\n : current.holds;\n\n return [\n { record: Option.some(cancelled), hold },\n { bookings, counts, holds },\n ] as const;\n }).pipe(\n Effect.flatMap(({ hold, record }) =>\n Option.isNone(record)\n ? Effect.fail(\n SupplierUnavailable.make({\n message: `The supplier desk has no booking under ${bookingRef}.`,\n }),\n )\n : enterHold(hold).pipe(Effect.as(record.value)),\n ),\n );\n\n return SupplierBookingDesk.of({\n book,\n cancel,\n lookup: (idempotencyKey) =>\n Ref.get(state).pipe(\n Effect.map((current) => Option.fromNullishOr(current.bookings.get(idempotencyKey))),\n ),\n bookings: Ref.get(state).pipe(Effect.map((current) => [...current.bookings.values()])),\n callCount: (idempotencyKey) =>\n Ref.get(state).pipe(Effect.map((current) => current.counts.get(idempotencyKey) ?? 0)),\n holdAfterWrite: (idempotencyKey) =>\n Effect.gen(function* () {\n const held = yield* Deferred.make<void>();\n const release = yield* Deferred.make<void>();\n\n yield* Ref.update(state, (current) => ({\n ...current,\n holds: new Map(current.holds).set(idempotencyKey, { held, release }),\n }));\n\n return {\n held: Deferred.await(held),\n release: Deferred.succeed(release, undefined).pipe(Effect.asVoid),\n };\n }),\n });\n }),\n );\n}\n\nexport const TravelGuidanceLayer = Layer.succeed(\n TravelGuidance,\n TravelGuidance.of({\n instructions: (input) =>\n Effect.succeed(\n [\n \"You are the Effect Agent Travel Planner P1 interpreter fixture.\",\n `The user asked: ${input.request}`,\n \"Call search_flights, search_lodging, and search_activities exactly once in one Tool batch.\",\n \"Then return only a JSON object of exactly this shape, no prose:\",\n '{\"itineraries\": [{\"title\": \"<short itinerary name>\", \"route\": \"<origin-destination>\", \"dates\": \"<date range>\", \"flight\": \"<flight description from the Tool result>\", \"lodging\": \"<lodging description from the Tool result>\", \"activities\": [\"<activity>\", \"...\"], \"estimatedTotalCents\": <positive integer total in cents>, \"currency\": \"USD\", \"quoteId\": \"<quoteId from the flight Tool result>\", \"assumptions\": [\"<assumption>\", \"...\"], \"unresolvedConstraints\": [], \"nextAction\": \"review\"}]}',\n \"Use the Tool results verbatim; activity results may legitimately be an empty array.\",\n \"This is read-only planning. Require review before any mutation.\",\n ].join(\"\\n\"),\n ),\n }),\n);\n\nexport const DeterministicIdGeneratorLayer = Layer.effect(\n IdGenerator,\n Effect.gen(function* () {\n const thread = yield* Ref.make(0);\n const run = yield* Ref.make(0);\n const turn = yield* Ref.make(0);\n\n return IdGenerator.of({\n nextThreadId: Ref.updateAndGet(thread, (n) => n + 1).pipe(\n Effect.map((n) => Schema.decodeSync(ThreadId)(`thread-${n}`)),\n ),\n nextRunId: Ref.updateAndGet(run, (n) => n + 1).pipe(\n Effect.map((n) => Schema.decodeSync(RunId)(`run-${n}`)),\n ),\n nextTurnId: Ref.updateAndGet(turn, (n) => n + 1).pipe(\n Effect.map((n) => Schema.decodeSync(TurnId)(`turn-${n}`)),\n ),\n });\n }),\n);\n\nexport const TravelPlannerRuntimeLayer = Layer.mergeAll(\n RunContextPreparationPassthrough,\n ThreadHistory.layer,\n TravelPlannerToolkitLayer,\n FlightCatalogLayer,\n LodgingCatalogLayer,\n ActivityCatalogLayer,\n TravelGuidanceLayer,\n Determinist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