Open History to see the last commit
1// @effect-diagnostics nodeBuiltinImport:off
2/**
3 * Best-effort provider event logging with one shared writer per thread.
4 *
5 * Native and canonical views share batching, rotation, and retention state so
6 * they cannot race while appending to the same thread-scoped file.
7 */
8import * as NodeFS from "node:fs";
9import * as NodePath from "node:path";
10
11import type { ThreadId } from "@t3tools/contracts";
12import { RotatingFileSink } from "@t3tools/shared/logging";
13import { errorTag } from "@t3tools/shared/observability";
14import * as Clock from "effect/Clock";
15import * as DateTime from "effect/DateTime";
16import * as Effect from "effect/Effect";
17import * as Exit from "effect/Exit";
18import * as Schema from "effect/Schema";
19import * as Scope from "effect/Scope";
20import * as SynchronizedRef from "effect/SynchronizedRef";
21
22import { toSafeThreadAttachmentSegment } from "../../attachmentStore.ts";
23import type { ResourceAttribution } from "../../resourceTelemetry/ResourceAttribution.ts";
24
25const MEBIBYTE = 1024 * 1024;
26const DAY_MS = 24 * 60 * 60 * 1_000;
27const DEFAULT_MAX_BYTES = 10 * MEBIBYTE;
28const DEFAULT_MAX_FILES = 10;
29const DEFAULT_BATCH_WINDOW_MS = 1_000;
30const DEFAULT_MAX_TOTAL_BYTES = 512 * MEBIBYTE;
31const DEFAULT_MAX_AGE_MS = 14 * DAY_MS;
32const DEFAULT_RETENTION_CHECK_INTERVAL_MS = 5 * 60 * 1_000;
33const DEFAULT_MAX_BUFFERED_BYTES = MEBIBYTE;
34const DEFAULT_MAX_BUFFERED_RECORDS = 512;
35const GLOBAL_THREAD_SEGMENT = "_global";
36const LOG_SCOPE = "provider-observability";
37const encodeUnknownJsonString = Schema.encodeUnknownEffect(Schema.fromJsonString(Schema.Unknown));
38
39const transientCanonicalEventTypes = new Set([
40 "content.delta",
41 "hook.progress",
42 "item.updated",
43 "task.progress",
44 "thread.realtime.audio.delta",
45 "tool.progress",
46 "turn.proposed.delta",
47]);
48const transientNativeMethods = new Set([
49 "item/agentMessage/delta",
50 "item/commandExecution/outputDelta",
51 "item/fileChange/outputDelta",
52 "item/plan/delta",
53 "item/reasoning/summaryTextDelta",
54 "item/reasoning/textDelta",
55 "thread/realtime/outputAudio/delta",
56 "thread/realtime/transcript/delta",
57]);
58const transientAcpUpdates = new Set(["agent_message_chunk", "agent_thought_chunk"]);
59
60export type EventNdjsonStream = "native" | "canonical" | "orchestration";
61
62export interface EventNdjsonLogger {
63 readonly filePath: string;
64 readonly write: (event: unknown, threadId: ThreadId | null) => Effect.Effect<void>;
65 readonly close: () => Effect.Effect<void>;
66}
67
68export interface EventNdjsonLogStore {
69 readonly filePath: string;
70 readonly logger: (stream: EventNdjsonStream) => EventNdjsonLogger;
71 readonly close: () => Effect.Effect<void>;
72}
73
74export interface EventNdjsonLogStoreOptions {
75 readonly maxBytes?: number;
76 readonly maxFiles?: number;
77 readonly batchWindowMs?: number;
78 readonly maxTotalBytes?: number;
79 readonly maxAgeMs?: number;
80 readonly retentionCheckIntervalMs?: number;
81 readonly maxBufferedBytes?: number;
82 readonly maxBufferedRecords?: number;
83 readonly attribution?: ResourceAttribution["Service"];
84}
85
86export interface EventNdjsonLoggerOptions extends EventNdjsonLogStoreOptions {
87 readonly stream: EventNdjsonStream;
88}
89
90export class EventNdjsonLogConfigurationError extends Schema.TaggedErrorClass<EventNdjsonLogConfigurationError>()(
91 "EventNdjsonLogConfigurationError",
92 {
93 filePath: Schema.String,
94 option: Schema.String,
95 value: Schema.Number,
96 minimum: Schema.Number,
97 },
98) {
99 override get message(): string {
100 return `Provider event log option '${this.option}' must be an integer >= ${this.minimum}; received ${this.value} for '${this.filePath}'`;
101 }
102}
103
104export class EventNdjsonLogDirectoryError extends Schema.TaggedErrorClass<EventNdjsonLogDirectoryError>()(
105 "EventNdjsonLogDirectoryError",
106 {
107 directory: Schema.String,
108 cause: Schema.Defect(),
109 },
110) {
111 override get message(): string {
112 return `Failed to create provider event log directory '${this.directory}'`;
113 }
114}
115
116export type EventNdjsonLogStoreError =
117 | EventNdjsonLogConfigurationError
118 | EventNdjsonLogDirectoryError;
119
120interface ResolvedOptions {
121 readonly maxBytes: number;
122 readonly maxFiles: number;
123 readonly batchWindowMs: number;
124 readonly maxTotalBytes: number;
125 readonly maxAgeMs: number;
126 readonly retentionCheckIntervalMs: number;
127 readonly maxBufferedBytes: number;
128 readonly maxBufferedRecords: number;
129 readonly attribution: ResourceAttribution["Service"] | undefined;
130}
131
132export interface PendingRecord {
133 readonly stream: EventNdjsonStream;
134 readonly threadSegment: string;
135 readonly line: string;
136 readonly bytes: number;
137}
138
139interface StoreState {
140 readonly pending: Array<PendingRecord>;
141 readonly pendingBytes: number;
142 readonly sinks: ReadonlyMap<string, RotatingFileSink>;
143 readonly flushScheduled: boolean;
144 readonly closed: boolean;
145 readonly lastRetentionAt: number;
146}
147
148interface AttributionSummary {
149 readonly stream: EventNdjsonStream;
150 readonly count: number;
151 readonly logicalWriteBytes: number;
152}
153
154interface FileOperationFailure {
155 readonly filePath: string;
156 readonly cause: unknown;
157}
158
159interface RetentionResult {
160 readonly failures: ReadonlyArray<FileOperationFailure>;
161}
162
163interface DrainResult {
164 readonly attributions: ReadonlyArray<AttributionSummary>;
165 readonly failures: ReadonlyArray<FileOperationFailure>;
166}
167
168function logWarning(message: string, context: Record<string, unknown>): Effect.Effect<void> {
169 return Effect.logWarning(message, context).pipe(Effect.annotateLogs({ scope: LOG_SCOPE }));
170}
171
172function resolveThreadSegment(raw: string | null | undefined): string {
173 const normalized = typeof raw === "string" ? toSafeThreadAttachmentSegment(raw) : null;
174 return normalized ?? GLOBAL_THREAD_SEGMENT;
175}
176
177function resolveStreamLabel(stream: EventNdjsonStream): string {
178 return stream === "native" ? "NTIVE" : stream === "orchestration" ? "ORCH" : "CANON";
179}
180
181function providerLogPrefix(filePath: string): string {
182 const basename = NodePath.basename(filePath);
183 const extension = NodePath.extname(basename);
184 return `${extension.length > 0 ? basename.slice(0, -extension.length) : basename}.`;
185}
186
187function providerLogPath(directory: string, prefix: string, threadSegment: string): string {
188 return NodePath.join(directory, `${prefix}${threadSegment}.log`);
189}
190
191function shouldPersist(stream: EventNdjsonStream, event: unknown): boolean {
192 if (stream === "orchestration" || typeof event !== "object" || event === null) {
193 return true;
194 }
195 try {
196 const type = Reflect.get(event, "type");
197 if (typeof type === "string" && transientCanonicalEventTypes.has(type)) {
198 return false;
199 }
200 if (stream !== "native") return true;
201
202 const nested = Reflect.get(event, "event");
203 const nativeEvent = typeof nested === "object" && nested !== null ? nested : event;
204 const method = Reflect.get(nativeEvent, "method");
205 if (
206 typeof method === "string" &&
207 (transientNativeMethods.has(method) ||
208 method.startsWith("claude/stream_event/content_block_delta/"))
209 ) {
210 return false;
211 }
212
213 const nativeType = Reflect.get(nativeEvent, "type");
214 if (nativeType === "message.part.delta") return false;
215
216 const payload = Reflect.get(nativeEvent, "payload");
217 if (typeof payload !== "object" || payload === null) return true;
218
219 if (method === "session/update") {
220 const update = Reflect.get(payload, "update");
221 if (typeof update !== "object" || update === null) return true;
222 const updateType = Reflect.get(update, "sessionUpdate");
223 return typeof updateType !== "string" || !transientAcpUpdates.has(updateType);
224 }
225
226 if (nativeType === "message.part.updated") {
227 const properties = Reflect.get(payload, "properties");
228 if (typeof properties !== "object" || properties === null) return true;
229 const part = Reflect.get(properties, "part");
230 if (typeof part !== "object" || part === null) return true;
231 const partType = Reflect.get(part, "type");
232 if (partType === "text" || partType === "reasoning") return false;
233 if (partType === "tool") {
234 // Running snapshots repeat growing output. Pending and terminal states stay in the log.
235 const state = Reflect.get(part, "state");
236 if (typeof state === "object" && state !== null) {
237 return Reflect.get(state, "status") !== "running";
238 }
239 }
240 return true;
241 }
242
243 return true;
244 } catch {
245 return true;
246 }
247}
248
249export function writeBatchedMessages(
250 sink: Pick<RotatingFileSink, "write">,
251 records: ReadonlyArray<PendingRecord>,
252 maxBytes: number,
253 onWritten: (records: ReadonlyArray<PendingRecord>) => void,
254): void {
255 let pendingRecords: Array<PendingRecord> = [];
256 let pendingBytes = 0;
257
258 const flush = () => {
259 if (pendingRecords.length === 0) return;
260 const writtenRecords = pendingRecords;
261 sink.write(writtenRecords.map((record) => record.line).join(""));
262 onWritten(writtenRecords);
263 pendingRecords = [];
264 pendingBytes = 0;
265 };
266
267 for (const record of records) {
268 if (pendingBytes > 0 && pendingBytes + record.bytes > maxBytes) {
269 flush();
270 }
271 pendingRecords.push(record);
272 pendingBytes += record.bytes;
273 if (pendingBytes >= maxBytes) {
274 flush();
275 }
276 }
277 flush();
278}
279
280function isProviderLogFile(filePath: string, fileName: string, filePrefix: string): boolean {
281 if (!/\.log(?:\.\d+)?$/u.test(fileName)) return false;
282 if (fileName.startsWith(filePrefix)) return true;
283
284 const descriptor = NodeFS.openSync(filePath, "r");
285 try {
286 const header = Buffer.alloc(256);
287 const bytesRead = NodeFS.readSync(descriptor, header, 0, header.byteLength, 0);
288 return /^\[[^\]\r\n]+\] (?:NTIVE|CANON|ORCH): /u.test(header.toString("utf8", 0, bytesRead));
289 } finally {
290 NodeFS.closeSync(descriptor);
291 }
292}
293
294function enforceRetention(input: {
295 readonly directory: string;
296 readonly maxTotalBytes: number;
297 readonly maxAgeMs: number;
298 readonly activeFilePaths: ReadonlySet<string>;
299 readonly filePrefix: string;
300 readonly now: number;
301}): RetentionResult {
302 const failures: Array<FileOperationFailure> = [];
303 const files: Array<{ filePath: string; mtimeMs: number; size: number }> = [];
304
305 let entries: ReadonlyArray<NodeFS.Dirent>;
306 try {
307 entries = NodeFS.readdirSync(input.directory, { withFileTypes: true });
308 } catch (cause) {
309 return { failures: [{ filePath: input.directory, cause }] };
310 }
311
312 for (const entry of entries) {
313 if (!entry.isFile()) continue;
314 const filePath = NodePath.join(input.directory, entry.name);
315 try {
316 if (!isProviderLogFile(filePath, entry.name, input.filePrefix)) continue;
317 const stat = NodeFS.statSync(filePath);
318 files.push({ filePath, mtimeMs: stat.mtimeMs, size: stat.size });
319 } catch (cause) {
320 failures.push({ filePath, cause });
321 }
322 }
323
324 let totalBytes = files.reduce((total, file) => total + file.size, 0);
325 const remove = (file: (typeof files)[number]) => {
326 if (input.activeFilePaths.has(file.filePath)) return false;
327 try {
328 NodeFS.rmSync(file.filePath, { force: true });
329 totalBytes -= file.size;
330 return true;
331 } catch (cause) {
332 failures.push({ filePath: file.filePath, cause });
333 return false;
334 }
335 };
336
337 const retained = files.filter((file) => {
338 if (input.now - file.mtimeMs <= input.maxAgeMs) return true;
339 return !remove(file);
340 });
341
342 for (const file of retained.toSorted(
343 (left, right) => left.mtimeMs - right.mtimeMs || left.filePath.localeCompare(right.filePath),
344 )) {
345 if (totalBytes <= input.maxTotalBytes) break;
346 remove(file);
347 }
348
349 return { failures };
350}
351
352function validateOption(input: {
353 readonly filePath: string;
354 readonly option: string;
355 readonly value: number;
356 readonly minimum: number;
357}): EventNdjsonLogConfigurationError | undefined {
358 if (Number.isInteger(input.value) && input.value >= input.minimum) return undefined;
359 return new EventNdjsonLogConfigurationError(input);
360}
361
362function resolveOptions(
363 filePath: string,
364 options: EventNdjsonLogStoreOptions,
365): Effect.Effect<ResolvedOptions, EventNdjsonLogConfigurationError> {
366 const resolved = {
367 maxBytes: options.maxBytes ?? DEFAULT_MAX_BYTES,
368 maxFiles: options.maxFiles ?? DEFAULT_MAX_FILES,
369 batchWindowMs: options.batchWindowMs ?? DEFAULT_BATCH_WINDOW_MS,
370 maxTotalBytes: options.maxTotalBytes ?? DEFAULT_MAX_TOTAL_BYTES,
371 maxAgeMs: options.maxAgeMs ?? DEFAULT_MAX_AGE_MS,
372 retentionCheckIntervalMs:
373 options.retentionCheckIntervalMs ?? DEFAULT_RETENTION_CHECK_INTERVAL_MS,
374 maxBufferedBytes: options.maxBufferedBytes ?? DEFAULT_MAX_BUFFERED_BYTES,
375 maxBufferedRecords: options.maxBufferedRecords ?? DEFAULT_MAX_BUFFERED_RECORDS,
376 attribution: options.attribution,
377 } satisfies ResolvedOptions;
378
379 const validations = [
380 ["maxBytes", resolved.maxBytes, 1],
381 ["maxFiles", resolved.maxFiles, 1],
382 ["batchWindowMs", resolved.batchWindowMs, 0],
383 ["maxTotalBytes", resolved.maxTotalBytes, 1],
384 ["maxAgeMs", resolved.maxAgeMs, 1],
385 ["retentionCheckIntervalMs", resolved.retentionCheckIntervalMs, 1],
386 ["maxBufferedBytes", resolved.maxBufferedBytes, 1],
387 ["maxBufferedRecords", resolved.maxBufferedRecords, 1],
388 ] as const;
389
390 for (const [option, value, minimum] of validations) {
391 const error = validateOption({ filePath, option, value, minimum });
392 if (error) return Effect.fail(error);
393 }
394 return Effect.succeed(resolved);
395}
396
397function drainPending(input: {
398 readonly directory: string;
399 readonly options: ResolvedOptions;
400 readonly state: StoreState;
401 readonly filePrefix: string;
402 readonly now: number;
403 readonly timerFired: boolean;
404 readonly close: boolean;
405}): readonly [DrainResult, StoreState] {
406 if (input.state.closed) {
407 return [{ attributions: [], failures: [] }, input.state];
408 }
409
410 const sinks = new Map(input.state.sinks);
411 const failures: Array<FileOperationFailure> = [];
412 const attributionByStream = new Map<
413 EventNdjsonStream,
414 { count: number; logicalWriteBytes: number }
415 >();
416 const recordsBySegment = new Map<string, Array<PendingRecord>>();
417
418 for (const record of input.state.pending) {
419 const records = recordsBySegment.get(record.threadSegment) ?? [];
420 records.push(record);
421 recordsBySegment.set(record.threadSegment, records);
422 }
423
424 for (const [threadSegment, records] of recordsBySegment) {
425 const filePath = providerLogPath(input.directory, input.filePrefix, threadSegment);
426 let sink = sinks.get(threadSegment);
427 if (!sink) {
428 try {
429 sink = new RotatingFileSink({
430 filePath,
431 maxBytes: input.options.maxBytes,
432 maxFiles: input.options.maxFiles,
433 throwOnError: true,
434 });
435 sinks.set(threadSegment, sink);
436 } catch (cause) {
437 failures.push({ filePath, cause });
438 continue;
439 }
440 }
441
442 try {
443 writeBatchedMessages(sink, records, input.options.maxBytes, (writtenRecords) => {
444 for (const record of writtenRecords) {
445 const current = attributionByStream.get(record.stream) ?? {
446 count: 0,
447 logicalWriteBytes: 0,
448 };
449 attributionByStream.set(record.stream, {
450 count: current.count + 1,
451 logicalWriteBytes: current.logicalWriteBytes + record.bytes,
452 });
453 }
454 });
455 } catch (cause) {
456 sinks.delete(threadSegment);
457 failures.push({ filePath, cause });
458 }
459 }
460
461 const retentionDue =
462 input.now - input.state.lastRetentionAt >= input.options.retentionCheckIntervalMs;
463 const retention = retentionDue
464 ? enforceRetention({
465 directory: input.directory,
466 maxTotalBytes: input.options.maxTotalBytes,
467 maxAgeMs: input.options.maxAgeMs,
468 activeFilePaths: new Set(
469 Array.from(sinks.keys(), (threadSegment) =>
470 providerLogPath(input.directory, input.filePrefix, threadSegment),
471 ),
472 ),
473 filePrefix: input.filePrefix,
474 now: input.now,
475 })
476 : { failures: [] };
477
478 return [
479 {
480 attributions: Array.from(attributionByStream, ([stream, value]) => ({
481 stream,
482 ...value,
483 })),
484 failures: [...failures, ...retention.failures],
485 },
486 {
487 pending: [],
488 pendingBytes: 0,
489 sinks,
490 flushScheduled: input.timerFired ? false : input.state.flushScheduled,
491 closed: input.close,
492 lastRetentionAt: retentionDue ? input.now : input.state.lastRetentionAt,
493 },
494 ];
495}
496
497const serializeEvent = Effect.fnUntraced(function* (event: unknown) {
498 return yield* encodeUnknownJsonString(event).pipe(
499 Effect.catch((error) =>
500 logWarning("failed to serialize provider event log record", {
501 errorTag: errorTag(error),
502 }).pipe(Effect.as(undefined)),
503 ),
504 );
505});
506
507export const makeEventNdjsonLogStore = Effect.fnUntraced(function* (
508 filePath: string,
509 options: EventNdjsonLogStoreOptions = {},
510): Effect.fn.Return<EventNdjsonLogStore, EventNdjsonLogStoreError> {
511 const resolved = yield* resolveOptions(filePath, options);
512 const directory = NodePath.dirname(filePath);
513 const filePrefix = providerLogPrefix(filePath);
514
515 yield* Effect.try({
516 try: () => NodeFS.mkdirSync(directory, { recursive: true }),
517 catch: (cause) => new EventNdjsonLogDirectoryError({ directory, cause }),
518 });
519
520 const initializedAt = yield* Clock.currentTimeMillis;
521 const initialRetention = yield* Effect.sync(() =>
522 enforceRetention({
523 directory,
524 maxTotalBytes: resolved.maxTotalBytes,
525 maxAgeMs: resolved.maxAgeMs,
526 activeFilePaths: new Set(),
527 filePrefix,
528 now: initializedAt,
529 }),
530 );
531 for (const failure of initialRetention.failures) {
532 yield* logWarning("provider event log retention failed", {
533 filePath: failure.filePath,
534 errorTag: errorTag(failure.cause),
535 });
536 }
537
538 const stateRef = yield* SynchronizedRef.make<StoreState>({
539 pending: [],
540 pendingBytes: 0,
541 sinks: new Map(),
542 flushScheduled: false,
543 closed: false,
544 lastRetentionAt: initializedAt,
545 });
546 const timerScope = yield* Scope.make();
547
548 const flush = Effect.fnUntraced(function* (timerFired: boolean, close: boolean) {
549 const startedAt = yield* Clock.currentTimeMillis;
550 const result = yield* SynchronizedRef.modifyEffect(stateRef, (state) =>
551 Effect.sync(() =>
552 drainPending({
553 directory,
554 options: resolved,
555 state,
556 filePrefix,
557 now: startedAt,
558 timerFired,
559 close,
560 }),
561 ),
562 );
563
564 for (const failure of result.failures) {
565 yield* logWarning("provider event log write or retention failed", {
566 filePath: failure.filePath,
567 errorTag: errorTag(failure.cause),
568 });
569 }
570
571 if (resolved.attribution && result.attributions.length > 0) {
572 const completedAt = yield* Clock.currentTimeMillis;
573 const durationMs = Math.max(0, completedAt - startedAt);
574 const totalBytes = result.attributions.reduce(
575 (total, entry) => total + entry.logicalWriteBytes,
576 0,
577 );
578 yield* Effect.forEach(
579 result.attributions,
580 (entry) =>
581 resolved.attribution?.record({
582 component: "provider-event-log",
583 operation: `${entry.stream}.append`,
584 logicalWriteBytes: entry.logicalWriteBytes,
585 count: entry.count,
586 durationMs:
587 totalBytes === 0
588 ? 0
589 : Math.round(durationMs * (entry.logicalWriteBytes / totalBytes)),
590 }) ?? Effect.void,
591 { discard: true },
592 );
593 }
594 });
595
596 const scheduleFlush = Effect.fnUntraced(function* () {
597 yield* Effect.forkIn(
598 Effect.sleep(resolved.batchWindowMs).pipe(Effect.andThen(flush(true, false))),
599 timerScope,
600 { startImmediately: true },
601 );
602 });
603
604 const close = Effect.fnUntraced(function* () {
605 yield* flush(false, true);
606 yield* Scope.close(timerScope, Exit.void);
607 });
608
609 const loggerViews = new Map<EventNdjsonStream, EventNdjsonLogger>();
610 const logger = (stream: EventNdjsonStream): EventNdjsonLogger => {
611 const existing = loggerViews.get(stream);
612 if (existing) return existing;
613
614 const write = Effect.fnUntraced(function* (event: unknown, threadId: ThreadId | null) {
615 if (!shouldPersist(stream, event)) return;
616 const payload = yield* serializeEvent(event);
617 if (payload === undefined) return;
618
619 const observedAt = yield* DateTime.now.pipe(Effect.map(DateTime.formatIso));
620 const line = `[${observedAt}] ${resolveStreamLabel(stream)}: ${payload}\n`;
621 const bytes = Buffer.byteLength(line);
622 const action = yield* SynchronizedRef.modifyEffect(stateRef, (state) => {
623 if (state.closed) {
624 return Effect.succeed([{ flush: false }, state] as const);
625 }
626 const pending = state.pending;
627 pending.push({ stream, threadSegment: resolveThreadSegment(threadId), line, bytes });
628 const pendingBytes = state.pendingBytes + bytes;
629 const flush =
630 resolved.batchWindowMs === 0 ||
631 pending.length >= resolved.maxBufferedRecords ||
632 pendingBytes >= resolved.maxBufferedBytes;
633 const schedule = !flush && !state.flushScheduled;
634 const nextState = {
635 ...state,
636 pending,
637 pendingBytes,
638 flushScheduled: state.flushScheduled || schedule,
639 };
640 return (schedule ? scheduleFlush() : Effect.void).pipe(
641 Effect.as([{ flush }, nextState] as const),
642 );
643 }).pipe(Effect.uninterruptible);
644
645 if (action.flush) {
646 yield* flush(false, false);
647 }
648 });
649
650 const view = { filePath, write, close: () => Effect.void } satisfies EventNdjsonLogger;
651 loggerViews.set(stream, view);
652 return view;
653 };
654
655 return { filePath, logger, close } satisfies EventNdjsonLogStore;
656});
657
658export const makeEventNdjsonLogger = Effect.fnUntraced(function* (
659 filePath: string,
660 options: EventNdjsonLoggerOptions,
661): Effect.fn.Return<EventNdjsonLogger | undefined> {
662 const store = yield* makeEventNdjsonLogStore(filePath, options).pipe(
663 Effect.catch((error) =>
664 logWarning(error.message, { error }).pipe(
665 Effect.as<EventNdjsonLogStore | undefined>(undefined),
666 ),
667 ),
668 );
669 if (!store) return undefined;
670 return { ...store.logger(options.stream), close: store.close };
671});