| ... | ... | @@ -220,38 +220,6 @@ lifecycleLayer("CodexAdapterLive lifecycle", (it) => { |
| 220 | 220 | assert.equal(firstEvent.value.turnId, "turn-1"); |
| 221 | 221 | }), |
| 222 | 222 | ); |
| 223 | | |
| 224 | | it.effect("emits canonical events on stream and supports consumer interruption", () => |
| 225 | | Effect.gen(function* () { |
| 226 | | const adapter = yield* CodexAdapter; |
| 227 | | const onEvent = vi.fn(() => undefined); |
| 228 | | const consumer = yield* Stream.runForEach(adapter.streamEvents, () => |
| 229 | | Effect.sync(() => { |
| 230 | | onEvent(); |
| 231 | | }), |
| 232 | | ).pipe(Effect.forkChild); |
| 233 | | |
| 234 | | const event: ProviderEvent = { |
| 235 | | id: asEventId("evt-1"), |
| 236 | | kind: "notification", |
| 237 | | provider: "codex", |
| 238 | | sessionId: asSessionId("sess-1"), |
| 239 | | createdAt: new Date().toISOString(), |
| 240 | | method: "turn/started", |
| 241 | | turnId: asTurnId("turn-1"), |
| 242 | | }; |
| 243 | | |
| 244 | | lifecycleManager.emit("event", event); |
| 245 | | yield* Effect.promise(() => new Promise<void>((resolve) => setTimeout(resolve, 0))); |
| 246 | | assert.equal(onEvent.mock.calls.length, 1); |
| 247 | | |
| 248 | | yield* Fiber.interrupt(consumer); |
| 249 | | lifecycleManager.emit("event", event); |
| 250 | | yield* Effect.promise(() => new Promise<void>((resolve) => setTimeout(resolve, 0))); |
| 251 | | assert.equal(onEvent.mock.calls.length, 1); |
| 252 | | assert.equal(lifecycleManager.stopAllImpl.mock.calls.length, 0); |
| 253 | | }), |
| 254 | | ); |
| 255 | 223 | }); |
| 256 | 224 | |
| 257 | 225 | afterAll(() => { |