@rivetkit/effect 0.0.0-06-09-refactor-rivetkit-split-workflow-context-into-workflowcontext-workflowstepcontext.e0c9540 → 0.0.0-bisect-sync-sqlite-1.910d1c7

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.
Files changed (74) hide show
  1. package/dist/Action.d.ts +1 -1
  2. package/dist/Action.js +1 -1
  3. package/dist/Actor.d.ts +28 -4
  4. package/dist/Actor.d.ts.map +1 -1
  5. package/dist/Actor.js +3 -2
  6. package/dist/Actor.js.map +1 -1
  7. package/dist/Client.d.ts.map +1 -1
  8. package/dist/Client.js +6 -4
  9. package/dist/Client.js.map +1 -1
  10. package/dist/Registry.d.ts +70 -8
  11. package/dist/Registry.d.ts.map +1 -1
  12. package/dist/Registry.js +93 -41
  13. package/dist/Registry.js.map +1 -1
  14. package/dist/RivetError.d.ts +61 -3
  15. package/dist/RivetError.d.ts.map +1 -1
  16. package/dist/RivetError.js +171 -25
  17. package/dist/RivetError.js.map +1 -1
  18. package/dist/RivetLogger.d.ts +41 -0
  19. package/dist/RivetLogger.d.ts.map +1 -0
  20. package/dist/RivetLogger.js +41 -0
  21. package/dist/RivetLogger.js.map +1 -0
  22. package/dist/State.d.ts +92 -56
  23. package/dist/State.d.ts.map +1 -1
  24. package/dist/State.js +51 -57
  25. package/dist/State.js.map +1 -1
  26. package/dist/internal/ActionDispatcher.d.ts +3 -3
  27. package/dist/internal/ActionDispatcher.d.ts.map +1 -1
  28. package/dist/internal/ActionDispatcher.js +23 -1
  29. package/dist/internal/ActionDispatcher.js.map +1 -1
  30. package/dist/internal/ActorInstanceManager.d.ts +7 -0
  31. package/dist/internal/ActorInstanceManager.d.ts.map +1 -1
  32. package/dist/internal/ActorInstanceManager.js +44 -4
  33. package/dist/internal/ActorInstanceManager.js.map +1 -1
  34. package/dist/internal/ActorStateAdapter.d.ts +1 -1
  35. package/dist/internal/ActorStateAdapter.d.ts.map +1 -1
  36. package/dist/internal/ActorStateAdapter.js +2 -7
  37. package/dist/internal/ActorStateAdapter.js.map +1 -1
  38. package/dist/internal/StateOptions.d.ts +1 -0
  39. package/dist/internal/StateOptions.d.ts.map +1 -1
  40. package/dist/internal/logging.d.ts +6 -7
  41. package/dist/internal/logging.d.ts.map +1 -1
  42. package/dist/internal/logging.js +78 -102
  43. package/dist/internal/logging.js.map +1 -1
  44. package/dist/mod.d.ts +2 -1
  45. package/dist/mod.d.ts.map +1 -1
  46. package/dist/mod.js +2 -1
  47. package/dist/mod.js.map +1 -1
  48. package/package.json +14 -7
  49. package/src/Action.ts +1 -1
  50. package/src/Actor.ts +57 -4
  51. package/src/Client.ts +6 -4
  52. package/src/Registry.ts +132 -71
  53. package/src/RivetError.ts +184 -25
  54. package/src/RivetLogger.ts +60 -0
  55. package/src/State.ts +293 -97
  56. package/src/internal/ActionDispatcher.ts +37 -9
  57. package/src/internal/ActorInstanceManager.ts +85 -37
  58. package/src/internal/ActorStateAdapter.ts +5 -11
  59. package/src/internal/StateOptions.ts +4 -0
  60. package/src/internal/logging.ts +103 -143
  61. package/src/mod.ts +2 -1
  62. package/dist/Logger.d.ts +0 -29
  63. package/dist/Logger.d.ts.map +0 -1
  64. package/dist/Logger.js +0 -31
  65. package/dist/Logger.js.map +0 -1
  66. package/src/Actor.test-d.ts +0 -603
  67. package/src/Actor.test.ts +0 -206
  68. package/src/Client.test.ts +0 -210
  69. package/src/Logger.ts +0 -43
  70. package/src/Registry.test-d.ts +0 -126
  71. package/src/Registry.test.ts +0 -411
  72. package/src/RivetError.test.ts +0 -188
  73. package/src/State.test.ts +0 -181
  74. package/src/internal/logging.test.ts +0 -288
package/src/Actor.ts CHANGED
@@ -3,6 +3,7 @@ import {
3
3
  Effect,
4
4
  identity,
5
5
  Layer,
6
+ type Option,
6
7
  Predicate,
7
8
  type Record,
8
9
  type Schema,
@@ -48,6 +49,7 @@ export type Options<
48
49
  State extends StateOptions.Any,
49
50
  Database extends RivetkitDb.AnyDatabaseProvider = undefined,
50
51
  > = Readonly<RivetkitActorOptions> & {
52
+ /** @deprecated Actor state was deprecated in 3.0 and will be removed in a future version. Store durable data in SQLite (`c.db`) and in-memory data in `c.vars`. See https://rivet.dev/actors/docs/deprecated/state */
51
53
  readonly state?: State;
52
54
  readonly db?: Database;
53
55
  };
@@ -63,6 +65,7 @@ type StatefulOptions<
63
65
  State extends StateOptions.Any,
64
66
  Database extends RivetkitDb.AnyDatabaseProvider = undefined,
65
67
  > = Readonly<RivetkitActorOptions> & {
68
+ /** @deprecated Actor state was deprecated in 3.0 and will be removed in a future version. Store durable data in SQLite (`c.db`) and in-memory data in `c.vars`. See https://rivet.dev/actors/docs/deprecated/state */
66
69
  readonly state: State;
67
70
  readonly db?: Database;
68
71
  };
@@ -106,6 +109,27 @@ export class Sleep extends Context.Service<Sleep, Effect.Effect<void>>()(
106
109
  "@rivetkit/effect/Actor/Sleep",
107
110
  ) {}
108
111
 
112
+ /**
113
+ * The connection that made an action call. The server sets these values, so a
114
+ * client cannot forge them.
115
+ *
116
+ * The id is an address, not an identity. Clients can read their own id, so do
117
+ * not use it for authorization.
118
+ *
119
+ * Takes only `id` from RivetKit's `Conn`, because clients supply `params`.
120
+ */
121
+ export type ActionConnection = Readonly<Pick<Rivetkit.AnyConn, "id">> & {
122
+ /**
123
+ * Closes when the connection disconnects or the actor sleeps or is
124
+ * destroyed. Bind per-connection resources to it. If the connection has
125
+ * already closed, finalizers added to this scope run immediately.
126
+ *
127
+ * Stateless calls, including calls from `Actor.client`, use a connection
128
+ * that closes as soon as the action returns.
129
+ */
130
+ readonly scope: Scope.Scope;
131
+ };
132
+
109
133
  export type ActionRequest<A extends Action.Any> =
110
134
  A extends Action.Action<
111
135
  infer Tag,
@@ -117,6 +141,8 @@ export type ActionRequest<A extends Action.Any> =
117
141
  readonly _tag: Tag;
118
142
  readonly action: A;
119
143
  readonly payload: Payload["Type"];
144
+ /** `None` when the action was started by the actor's schedule. */
145
+ readonly connection: Option.Option<ActionConnection>;
120
146
  }
121
147
  : never;
122
148
 
@@ -173,9 +199,11 @@ type WakeOptionsFor<
173
199
  } & ([StateDefinition] extends [never]
174
200
  ? unknown
175
201
  : {
202
+ /** @deprecated Actor state was deprecated in 3.0 and will be removed in a future version. Store durable data in SQLite (`c.db`) and in-memory data in `c.vars`. See https://rivet.dev/actors/docs/deprecated/state */
176
203
  readonly state: State.State<
177
204
  StateOptions.Decoded<StateDefinition>,
178
- Schema.SchemaError
205
+ Schema.SchemaError,
206
+ StateOptions.Services<StateDefinition>
179
207
  >;
180
208
  });
181
209
 
@@ -232,6 +260,7 @@ type ToLayerRequirements<
232
260
  | ExcludeBuiltInWakeServices<R, State>
233
261
  | ExcludeBuiltInWakeServices<RX, State>
234
262
  | UnknownToNever<ActionHandlerServices<ActionHandlers>>
263
+ | UnknownToNever<StateOptions.Services<State>>
235
264
  | UnknownToNever<Action.ServicesServer<Actions>>
236
265
  | UnknownToNever<Action.ServicesClient<Actions>>
237
266
  | Registry.Registry;
@@ -334,9 +363,9 @@ const Proto: Omit<Actor<any, any>, "name" | "actions"> = {
334
363
  >(wake),
335
364
  options,
336
365
  }).pipe(
337
- Effect.flatMap((rivetKitActor) =>
366
+ Effect.tap((rivetKitActor) =>
338
367
  Registry.Registry.pipe(
339
- Effect.flatMap((registry) =>
368
+ Effect.tap((registry) =>
340
369
  Effect.sync(() =>
341
370
  registry.rivetkitActors.set(
342
371
  this.name,
@@ -375,6 +404,29 @@ export const make = <
375
404
  return self;
376
405
  };
377
406
 
407
+ /**
408
+ * Normalizes any supported actor wake declaration into a wake function.
409
+ *
410
+ * @remarks
411
+ * {@link Actor.toLayer|`Actor.toLayer()`} accepts several equivalent shapes so actor
412
+ * implementations can choose the amount of initialization they need:
413
+ *
414
+ * - a plain action-handler object
415
+ * - an `Effect` that builds an action-handler object
416
+ * - a wake function that receives `wakeOptions` and returns handlers
417
+ * - a wake function that returns an `Effect` of handlers
418
+ * - an `Effect` that builds one of those wake functions
419
+ *
420
+ * This helper resolves those forms lazily for each actor wake and returns a
421
+ * single `(wakeOptions) => Effect<handlers>` representation. It does not run a
422
+ * wake function until the returned function is invoked, so per-wake resources,
423
+ * services, and state are scoped to the specific actor instance that is waking.
424
+ *
425
+ * @param wake - A supported wake declaration shape.
426
+ * @returns A function that resolves action handlers for one actor wake.
427
+ *
428
+ * @internal
429
+ */
378
430
  export function toWakeHandler<
379
431
  ActionHandlers extends object,
380
432
  R,
@@ -443,7 +495,7 @@ export function toWakeHandler<
443
495
 
444
496
  return wakeEffect.pipe(
445
497
  Effect.flatMap((resolvedWake) => {
446
- if (typeof resolvedWake === "function") {
498
+ if (Predicate.isFunction(resolvedWake)) {
447
499
  const actionHandlers = resolvedWake(wakeOptions);
448
500
  return Effect.isEffect(actionHandlers)
449
501
  ? actionHandlers
@@ -544,6 +596,7 @@ const makeRivetkitActor = Effect.fnUntraced(function* <
544
596
  ...(instanceManager.onStateChange
545
597
  ? { onStateChange: instanceManager.onStateChange }
546
598
  : {}),
599
+ onDisconnect: instanceManager.onDisconnect,
547
600
  onSleep: instanceManager.onTeardown,
548
601
  onDestroy: instanceManager.onTeardown,
549
602
  });
package/src/Client.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { Context, Effect, Layer, Record, Result, Schema } from "effect";
2
2
  import * as RivetkitClient from "rivetkit/client";
3
3
  import * as RivetkitErrors from "rivetkit/errors";
4
- import { configureBaseLogger } from "rivetkit/log";
4
+ import * as RivetkitLog from "rivetkit/log";
5
5
  import type * as Action from "./Action.ts";
6
6
  import type * as Actor from "./Actor.ts";
7
7
  import * as ActionErrorEnvelope from "./internal/ActionErrorEnvelope.ts";
8
8
  import { getOrCreateBaseLogger } from "./internal/logging.ts";
9
9
  import { rpcSystem, type TraceMeta } from "./internal/tracing.ts";
10
- import * as Logger from "./Logger.ts";
10
+ import * as RivetLogger from "./RivetLogger.ts";
11
11
  import * as RivetError from "./RivetError.ts";
12
12
 
13
13
  const TypeId = "~@rivetkit/effect/Client";
@@ -49,7 +49,9 @@ export const make = Effect.fnUntraced(function* (options: Options = {}) {
49
49
  const baseLogger = yield* getOrCreateBaseLogger;
50
50
  const rivetkitClient = yield* Effect.acquireRelease(
51
51
  Effect.sync(() => {
52
- configureBaseLogger(baseLogger);
52
+ // Raw RivetKit clients do not accept a logger in their config,
53
+ // so install the Effect-selected logger before construction.
54
+ RivetkitLog.configureBaseLogger(baseLogger);
53
55
  return RivetkitClient.createClient(options);
54
56
  }),
55
57
  (c) => Effect.promise(() => c.dispose()),
@@ -146,7 +148,7 @@ export const layer = (options: Options = {}): Layer.Layer<Client> =>
146
148
  Layer.unwrap(
147
149
  Effect.map(getOrCreateBaseLogger, (baseLogger) =>
148
150
  Layer.effect(Client, make(options)).pipe(
149
- Layer.provideMerge(Logger.layerPino(baseLogger)),
151
+ Layer.provideMerge(RivetLogger.layerFromPino(baseLogger)),
150
152
  ),
151
153
  ),
152
154
  );
package/src/Registry.ts CHANGED
@@ -5,15 +5,12 @@ import {
5
5
  type HttpServerError,
6
6
  type HttpServerRequest,
7
7
  type HttpServerResponse,
8
- } from "effect/unstable/http";
8
+ } from "effect/http";
9
9
  import * as Rivetkit from "rivetkit";
10
- import {
11
- configureBaseLogger,
12
- type Logger as PinoLogger,
13
- } from "rivetkit/log";
10
+ import type * as RivetkitLog from "rivetkit/log";
14
11
  import * as Client from "./Client.ts";
15
12
  import { BaseLogger, getOrCreateBaseLogger } from "./internal/logging.ts";
16
- import * as Logger from "./Logger.ts";
13
+ import * as RivetLogger from "./RivetLogger.ts";
17
14
 
18
15
  const TypeId = "~@rivetkit/effect/Registry";
19
16
  type ServerlessOptions = NonNullable<
@@ -22,7 +19,7 @@ type ServerlessOptions = NonNullable<
22
19
 
23
20
  export type Options = Pick<
24
21
  Rivetkit.RegistryConfigInput<Rivetkit.RegistryActors>,
25
- "endpoint" | "token" | "namespace" | "noWelcome"
22
+ "endpoint" | "token" | "namespace" | "noWelcome" | "sqlite"
26
23
  >;
27
24
 
28
25
  export interface Registry {
@@ -30,7 +27,7 @@ export interface Registry {
30
27
 
31
28
  readonly options: Options;
32
29
 
33
- readonly baseLogger: PinoLogger;
30
+ readonly baseLogger: RivetkitLog.Logger;
34
31
 
35
32
  readonly rivetkitActors: Map<string, Rivetkit.AnyActorDefinition>;
36
33
  }
@@ -38,20 +35,49 @@ export interface Registry {
38
35
  export const Registry: Context.Service<Registry, Registry> =
39
36
  Context.Service<Registry>("@rivetkit/effect/Registry");
40
37
 
41
- const make = (options: Options, baseLogger: PinoLogger): Registry => {
42
- return Registry.of({
43
- [TypeId]: TypeId,
44
- options,
45
- baseLogger,
46
- rivetkitActors: new Map(),
47
- });
48
- };
49
-
38
+ /**
39
+ * Creates the shared registry that actor layers register into.
40
+ *
41
+ * @remarks
42
+ * Actor layers created with {@link Actor.Actor.toLayer|`Actor.toLayer()`}
43
+ * register into this service. Registry entrypoints such as
44
+ * {@link serve|`Registry.serve()`}, {@link toWebHandler|`Registry.toWebHandler()`},
45
+ * and {@link toHttpEffect|`Registry.toHttpEffect()`} later use the collected
46
+ * actors to create the underlying RivetKit runtime.
47
+ *
48
+ * @param options - RivetKit runtime options shared by the registered actors.
49
+ *
50
+ * @returns A layer that provides the {@link Registry|`Registry.Registry`}
51
+ * service.
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * import { Registry } from "@rivetkit/effect"
56
+ * import { Layer } from "effect"
57
+ *
58
+ * const ActorsLayer = Layer.mergeAll(ChatRoomLive, ModeratorLive)
59
+ *
60
+ * const MainLayer = Registry.serve(ActorsLayer).pipe(
61
+ * Layer.provide(Registry.layer({ endpoint: "http://127.0.0.1:6420" }))
62
+ * )
63
+ * ```
64
+ *
65
+ * @see {@link serve|`Registry.serve()`} for starting a long-running actor
66
+ * server.
67
+ * @see {@link toWebHandler|`Registry.toWebHandler()`} for Fetch-compatible
68
+ * serverless handlers.
69
+ * @see {@link toHttpEffect|`Registry.toHttpEffect()`} for Effect HTTP handlers.
70
+ */
50
71
  export const layer = (options: Options = {}): Layer.Layer<Registry> =>
51
72
  Layer.effect(
52
73
  Registry,
53
74
  Effect.map(getOrCreateBaseLogger, (baseLogger) =>
54
- make(options, baseLogger),
75
+ Registry.of({
76
+ [TypeId]: TypeId,
77
+ options,
78
+ baseLogger,
79
+ rivetkitActors: new Map(),
80
+ }),
55
81
  ),
56
82
  );
57
83
 
@@ -60,40 +86,70 @@ const setupRivetkitRegistry = (
60
86
  options?: {
61
87
  readonly serverless?: ServerlessOptions | undefined;
62
88
  },
63
- ) => {
64
- configureBaseLogger(registry.baseLogger);
65
- return Rivetkit.setup({
66
- use: Object.fromEntries(registry.rivetkitActors),
67
- ...registry.options,
68
- logging: { baseLogger: registry.baseLogger },
69
- ...(options?.serverless === undefined
70
- ? {}
71
- : { serverless: options.serverless }),
72
- });
73
- };
89
+ ) =>
90
+ Effect.sync(() =>
91
+ Rivetkit.setup({
92
+ use: Object.fromEntries(registry.rivetkitActors),
93
+ ...registry.options,
94
+ logging: { baseLogger: registry.baseLogger },
95
+ ...(options?.serverless === undefined
96
+ ? {}
97
+ : { serverless: options.serverless }),
98
+ }),
99
+ );
74
100
 
75
101
  /**
76
- * Runs an actor registration layer against the configured engine.
102
+ * Serves the actors registered by `actorsLayer`.
103
+ *
104
+ * @remarks
105
+ * Provide this with {@link layer|`Registry.layer()`} at the application root.
106
+ * Building the returned layer evaluates the actor layer, collects its registered
107
+ * actors, and starts the underlying RivetKit runtime using the options from
108
+ * {@link layer|`Registry.layer()`}. Launch the resulting layer with
109
+ * {@link Layer.launch|`Layer.launch()`} to keep the server process alive.
110
+ *
111
+ * @param actorsLayer - A layer containing one or more
112
+ * {@link Actor.Actor.toLayer|`Actor.toLayer()`} registrations.
113
+ *
114
+ * @returns A side-effecting startup layer that requires the
115
+ * {@link Registry|`Registry.Registry`} service and the services required by
116
+ * `actorsLayer`.
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * import { Registry } from "@rivetkit/effect"
121
+ * import { Layer } from "effect"
122
+ *
123
+ * const ActorsLayer = Layer.mergeAll(ChatRoomLive, ModeratorLive)
124
+ *
125
+ * const MainLayer = Registry.serve(ActorsLayer).pipe(
126
+ * Layer.provide(Registry.layer({ endpoint: "http://127.0.0.1:6420" }))
127
+ * )
128
+ *
129
+ * Layer.launch(MainLayer).pipe(NodeRuntime.runMain);
130
+ * ```
131
+ *
132
+ * @see {@link toWebHandler|`Registry.toWebHandler()`} for Fetch-compatible
133
+ * serverless handlers.
134
+ * @see {@link toHttpEffect|`Registry.toHttpEffect()`} for Effect HTTP handlers.
77
135
  *
78
- * The actor layer is built in the server layer scope. Registered Rivet Actors
79
- * are collected from `Registry`, materialized into a single underlying RivetKit
80
- * registry, and started.
81
136
  */
82
137
  export const serve = <E, R>(
83
138
  actorsLayer: Layer.Layer<never, E, R>,
84
- ): Layer.Layer<never, E, R | Registry> =>
85
- Layer.effectDiscard(
86
- Effect.gen(function* () {
87
- const registry = yield* Registry;
88
- const baseLogger = registry.baseLogger;
89
- yield* Layer.build(
90
- actorsLayer.pipe(
91
- Layer.provideMerge(Logger.layerPino(baseLogger)),
139
+ ): Layer.Layer<never, E, R | Registry> =>
140
+ Layer.effectDiscard(
141
+ Effect.gen(function* () {
142
+ const registry = yield* Registry;
143
+ yield* Layer.build(
144
+ actorsLayer.pipe(
145
+ Layer.provideMerge(
146
+ RivetLogger.layerFromPino(registry.baseLogger),
92
147
  ),
93
- );
94
- const rivetkitRegistry = setupRivetkitRegistry(registry);
95
- yield* Effect.sync(() => rivetkitRegistry.start());
96
- }),
148
+ ),
149
+ );
150
+ const rivetkitRegistry = yield* setupRivetkitRegistry(registry);
151
+ yield* Effect.sync(() => rivetkitRegistry.start());
152
+ }),
97
153
  );
98
154
 
99
155
  /**
@@ -110,7 +166,7 @@ export const test: Layer.Layer<Client.Client, never, Registry> = Layer.effect(
110
166
  Client.Client,
111
167
  Effect.gen(function* () {
112
168
  const registry = yield* Registry;
113
- const rivetkitRegistry = setupRivetkitRegistry(registry);
169
+ const rivetkitRegistry = yield* setupRivetkitRegistry(registry);
114
170
  rivetkitRegistry.config.test = {
115
171
  ...rivetkitRegistry.config.test,
116
172
  enabled: true,
@@ -137,30 +193,32 @@ export const test: Layer.Layer<Client.Client, never, Registry> = Layer.effect(
137
193
  // to its (warning-emitting) default.
138
194
  const resolvedEndpoint = rivetkitRegistry.parseConfig().endpoint;
139
195
 
140
- return yield* Client.make({
141
- ...registry.options,
142
- endpoint: registry.options.endpoint ?? resolvedEndpoint,
143
- }).pipe(
144
- Effect.provideService(BaseLogger, registry.baseLogger),
145
- );
146
- }),
147
- );
196
+ return yield* Client.make({
197
+ ...registry.options,
198
+ endpoint: registry.options.endpoint ?? resolvedEndpoint,
199
+ }).pipe(Effect.provideService(BaseLogger, registry.baseLogger));
200
+ }),
201
+ );
148
202
 
149
203
  const makeHttpEffect = (
150
204
  registry: Registry,
151
205
  options?: ToHttpEffectOptions,
152
206
  ): Effect.Effect<
153
- HttpServerResponse.HttpServerResponse,
154
- HttpServerError.HttpServerError,
155
- HttpServerRequest.HttpServerRequest
156
- > => {
157
- const rivetkitRegistry = setupRivetkitRegistry(registry, {
158
- serverless: options,
159
- });
160
- return HttpEffect.fromWebHandler((request) =>
161
- rivetkitRegistry.handler(request),
207
+ Effect.Effect<
208
+ HttpServerResponse.HttpServerResponse,
209
+ HttpServerError.HttpServerError,
210
+ HttpServerRequest.HttpServerRequest
211
+ >
212
+ > =>
213
+ Effect.map(
214
+ setupRivetkitRegistry(registry, {
215
+ serverless: options,
216
+ }),
217
+ (rivetkitRegistry) =>
218
+ HttpEffect.fromWebHandler((request) =>
219
+ rivetkitRegistry.handler(request),
220
+ ),
162
221
  );
163
- };
164
222
 
165
223
  export type ToHttpEffectOptions = ServerlessOptions;
166
224
 
@@ -184,12 +242,14 @@ export const toHttpEffect = Effect.fnUntraced(function* <E>(
184
242
  Scope.Scope
185
243
  > {
186
244
  const context = yield* Layer.build(
187
- registryLayer.pipe(Layer.provideMerge(Logger.layer)),
245
+ registryLayer.pipe(Layer.provideMerge(RivetLogger.defaultLayer)),
188
246
  );
189
- // @effect-diagnostics-next-line returnEffectInGen:off
190
- return makeHttpEffect(Context.get(context, Registry), options).pipe(
191
- Effect.provide(context),
247
+ const httpEffect = yield* makeHttpEffect(
248
+ Context.get(context, Registry),
249
+ options,
192
250
  );
251
+ // @effect-diagnostics-next-line returnEffectInGen:off
252
+ return httpEffect.pipe(Effect.provide(context));
193
253
  });
194
254
 
195
255
  export type ToWebHandlerOptions = ServerlessOptions & {
@@ -226,16 +286,17 @@ export const toWebHandler = <E>(
226
286
  }
227
287
 
228
288
  const registryLayerWithLogging = registryLayer.pipe(
229
- Layer.provideMerge(Logger.layer),
289
+ Layer.provideMerge(RivetLogger.defaultLayer),
230
290
  );
231
291
 
232
292
  return HttpEffect.toWebHandlerLayerWith(registryLayerWithLogging, {
233
293
  toHandler: (context) =>
234
- Effect.succeed(
294
+ Effect.map(
235
295
  makeHttpEffect(
236
296
  Context.get(context, Registry),
237
297
  serverlessOptions,
238
- ).pipe(Effect.provide(context)),
298
+ ),
299
+ (httpEffect) => httpEffect.pipe(Effect.provide(context)),
239
300
  ),
240
301
  middleware,
241
302
  memoMap,