@cleocode/core 2026.11.16 → 2026.11.17-rc.ci.734

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 (57) hide show
  1. package/dist/.source-stamp.json +1 -1
  2. package/dist/agents/scaffold.js +2 -2
  3. package/dist/agents/scaffold.js.map +1 -1
  4. package/dist/build-provenance.json +2 -2
  5. package/dist/code/parser.js +2 -2
  6. package/dist/code/parser.js.map +1 -1
  7. package/dist/docs/docs-ops.d.ts +12 -3
  8. package/dist/docs/docs-ops.js +8 -6
  9. package/dist/docs/docs-ops.js.map +1 -1
  10. package/dist/docs/doctor.d.ts +7 -5
  11. package/dist/docs/doctor.js +64 -22
  12. package/dist/docs/doctor.js.map +1 -1
  13. package/dist/internal.js +1 -1
  14. package/dist/internal.js.map +1 -1
  15. package/dist/logger.d.ts +95 -8
  16. package/dist/logger.js +335 -101
  17. package/dist/logger.js.map +1 -1
  18. package/dist/memory/brain-lifecycle.d.ts +4 -0
  19. package/dist/memory/brain-lifecycle.js +4 -0
  20. package/dist/memory/brain-lifecycle.js.map +1 -1
  21. package/dist/memory/learnings.d.ts +2 -2
  22. package/dist/memory/patterns.d.ts +4 -4
  23. package/dist/memory/sleep-consolidation.d.ts +37 -0
  24. package/dist/memory/sleep-consolidation.js +130 -35
  25. package/dist/memory/sleep-consolidation.js.map +1 -1
  26. package/dist/orchestration/atomicity.d.ts +42 -0
  27. package/dist/orchestration/atomicity.js +91 -6
  28. package/dist/orchestration/atomicity.js.map +1 -1
  29. package/dist/orchestration/registry-resolver.js +8 -5
  30. package/dist/orchestration/registry-resolver.js.map +1 -1
  31. package/dist/orchestration/spawn.js +2 -0
  32. package/dist/orchestration/spawn.js.map +1 -1
  33. package/dist/orchestration/validate-spawn.d.ts +1 -1
  34. package/dist/orchestration/validate-spawn.js +7 -6
  35. package/dist/orchestration/validate-spawn.js.map +1 -1
  36. package/dist/paths.d.ts +32 -9
  37. package/dist/paths.js +34 -9
  38. package/dist/paths.js.map +1 -1
  39. package/dist/scaffold/global-scaffold.js +2 -2
  40. package/dist/scaffold/global-scaffold.js.map +1 -1
  41. package/dist/shutdown.d.ts +5 -5
  42. package/dist/shutdown.js +5 -5
  43. package/dist/store/agent-doctor.d.ts +12 -0
  44. package/dist/store/agent-doctor.js +29 -7
  45. package/dist/store/agent-doctor.js.map +1 -1
  46. package/dist/store/agent-install.d.ts +2 -2
  47. package/dist/store/agent-install.js +2 -2
  48. package/dist/store/agent-install.js.map +1 -1
  49. package/dist/store/schema/cleo-project/nexus-graph.d.ts +1 -1
  50. package/dist/store/schema/nexus-schema.d.ts +1 -1
  51. package/dist/system/dependencies.js +3 -2
  52. package/dist/system/dependencies.js.map +1 -1
  53. package/dist/system/health.js +23 -39
  54. package/dist/system/health.js.map +1 -1
  55. package/dist/system/platform-paths.js +2 -2
  56. package/dist/system/platform-paths.js.map +1 -1
  57. package/package.json +23 -24
package/dist/logger.js CHANGED
@@ -1,19 +1,24 @@
1
1
  /**
2
2
  * Centralized pino logger factory for CLEO.
3
3
  *
4
- * Singleton pattern. Uses pino-roll for automatic file rotation and retention.
4
+ * Singleton pattern. Writes in-thread through pino's own async destination
5
+ * (sonic-boom): no transport worker thread, so a CLI call pays no extra thread
6
+ * or memory for it (T14605). Rotation and retention run once at startup and
7
+ * keep pino-roll's file naming (`cleo.YYYY-MM-DD.N.log`).
5
8
  * Custom formatters for uppercase level labels and ISO timestamps.
6
9
  * Context via child loggers (getLogger('subsystem')).
7
10
  *
8
11
  * All diagnostic logging goes to files — stdout is reserved for structured
9
12
  * CLI output. Fallback stderr logger if not yet initialized.
10
13
  */
11
- import { existsSync } from 'node:fs';
12
- import { dirname, join } from 'node:path';
14
+ import { closeSync, existsSync, mkdirSync, openSync, readdirSync, readFileSync, statSync, unlinkSync, } from 'node:fs';
15
+ import { basename, dirname, extname, join } from 'node:path';
16
+ import { getCleoHome } from '@cleocode/paths';
13
17
  import pino from 'pino';
14
18
  let rootLogger = null;
15
19
  let currentLogDir = null;
16
- let currentTransport = null;
20
+ let currentDestination = null;
21
+ let removeSignalFlush = null;
17
22
  let quietMode = false;
18
23
  /**
19
24
  * Enable or disable quiet mode for the logger subsystem.
@@ -42,24 +47,103 @@ export function setLoggerQuiet(quiet) {
42
47
  export function isLoggerQuiet() {
43
48
  return quietMode;
44
49
  }
50
+ /** Local calendar date as `YYYY-MM-DD` (pino-roll's `dateFormat`). */
51
+ function formatLogDate(now) {
52
+ const month = String(now.getMonth() + 1).padStart(2, '0');
53
+ const day = String(now.getDate()).padStart(2, '0');
54
+ return `${now.getFullYear()}-${month}-${day}`;
55
+ }
56
+ /** Escape a literal for use inside a RegExp. */
57
+ function escapeRegExp(text) {
58
+ return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
59
+ }
60
+ /** Rotated files of one configured log path, oldest first. */
61
+ function listRotatedLogs(dir, stem, ext) {
62
+ const pattern = new RegExp(`^${escapeRegExp(stem)}\\.(\\d{4}-\\d{2}-\\d{2})\\.(\\d+)${escapeRegExp(ext)}$`);
63
+ let names;
64
+ try {
65
+ names = readdirSync(dir);
66
+ }
67
+ catch {
68
+ return [];
69
+ }
70
+ const files = [];
71
+ for (const name of names) {
72
+ const match = pattern.exec(name);
73
+ if (match)
74
+ files.push({ name, date: match[1] ?? '', number: Number(match[2]) });
75
+ }
76
+ return files.sort((a, b) => a.date.localeCompare(b.date) || a.number - b.number);
77
+ }
78
+ /** Size of a file in bytes, or 0 when it does not exist. */
79
+ function fileSize(path) {
80
+ try {
81
+ return statSync(path).size;
82
+ }
83
+ catch {
84
+ return 0;
85
+ }
86
+ }
87
+ /**
88
+ * Pick the file this process appends to and prune old ones (T14605).
89
+ *
90
+ * Keeps pino-roll's naming, which `observability/log-reader.ts` reads: the
91
+ * configured `logs/cleo.log` is written as `logs/cleo.<date>.<N>.log`. Today's
92
+ * newest file is reused until it reaches `maxFileSize`, then the next number
93
+ * starts; a new day starts at 1. Rotation happens here, once per process, so
94
+ * a long-running process keeps its file. Like pino-roll's `limit.count`, it
95
+ * keeps `maxFiles` older files besides the active one and deletes the rest,
96
+ * but always keeps at least one: the newest older file may still be another
97
+ * process's active file, so `maxFiles: 0` keeps it too.
98
+ *
99
+ * @param logPath - Absolute configured log path (e.g. `.cleo/logs/cleo.log`).
100
+ * @param maxFileSize - Bytes after which a new file is started.
101
+ * @param maxFiles - Older rotated files to keep besides the active one.
102
+ * @param now - Clock for the date part of the name.
103
+ * @returns Absolute path of the file to append to.
104
+ */
105
+ export function rotateLogAtStartup(logPath, maxFileSize, maxFiles, now = new Date()) {
106
+ const dir = dirname(logPath);
107
+ const ext = extname(logPath);
108
+ const stem = basename(logPath, ext);
109
+ const today = formatLogDate(now);
110
+ const existing = listRotatedLogs(dir, stem, ext);
111
+ const latestToday = existing.filter((f) => f.date === today).at(-1);
112
+ let number = latestToday?.number ?? 1;
113
+ if (latestToday && fileSize(join(dir, latestToday.name)) >= maxFileSize)
114
+ number += 1;
115
+ const activeName = `${stem}.${today}.${number}${ext}`;
116
+ const older = existing.filter((f) => f.name !== activeName);
117
+ const keep = Math.max(1, maxFiles);
118
+ for (const file of older.slice(0, Math.max(0, older.length - keep))) {
119
+ try {
120
+ unlinkSync(join(dir, file.name));
121
+ }
122
+ catch {
123
+ // Retention is best-effort: a file another process removed is fine.
124
+ }
125
+ }
126
+ return join(dir, activeName);
127
+ }
45
128
  /**
46
- * Convert bytes to a human-readable size string for pino-roll.
47
- * pino-roll accepts '10m', '1g', '500k', etc.
129
+ * The newest dated file the logger has written for a configured log path
130
+ * (T14641), e.g. `logs/cleo.2026-11-25.1.log` for `logs/cleo.log`. The
131
+ * configured path itself is never written (see {@link rotateLogAtStartup}).
132
+ *
133
+ * @param logPath - Absolute configured log path (e.g. `.cleo/logs/cleo.log`).
134
+ * @returns Absolute path of the newest rotated file, or `null` when none exists.
48
135
  */
49
- function bytesToSizeString(bytes) {
50
- if (bytes >= 1024 * 1024 * 1024)
51
- return `${Math.floor(bytes / (1024 * 1024 * 1024))}g`;
52
- if (bytes >= 1024 * 1024)
53
- return `${Math.floor(bytes / (1024 * 1024))}m`;
54
- if (bytes >= 1024)
55
- return `${Math.floor(bytes / 1024)}k`;
56
- return `${bytes}`;
136
+ export function findActiveLogFile(logPath) {
137
+ const dir = dirname(logPath);
138
+ const ext = extname(logPath);
139
+ const newest = listRotatedLogs(dir, basename(logPath, ext), ext).at(-1);
140
+ return newest ? join(dir, newest.name) : null;
57
141
  }
58
142
  /**
59
143
  * Initialize the root logger. Call once at startup.
60
144
  *
61
- * Uses pino-roll for automatic size+daily rotation with built-in retention.
62
- * No custom rotation code needed.
145
+ * Rotates with {@link rotateLogAtStartup}, then writes in-thread through
146
+ * `pino.destination` (no worker thread).
63
147
  *
64
148
  * @param cleoDir - Absolute path to .cleo directory
65
149
  * @param config - Logging configuration from CleoConfig.logging
@@ -70,55 +154,219 @@ function bytesToSizeString(bytes) {
70
154
  export function initLogger(cleoDir, config, projectHash) {
71
155
  const dest = join(cleoDir, config.filePath);
72
156
  currentLogDir = dirname(dest);
73
- // Log directory should already exist via ensureCleoStructure() which
74
- // creates all REQUIRED_CLEO_SUBDIRS including 'logs'. The pino-roll
75
- // transport has mkdir: true as a safety net for edge cases where the
76
- // logger is initialized before scaffold (e.g. early startup fallback).
77
- if (!existsSync(currentLogDir)) {
78
- // Emit to stderr — stdout is reserved for structured output
79
- process.stderr.write(`[cleo:logger] Log directory missing: ${currentLogDir} — pino-roll will create it\n`);
80
- }
81
- // Use pino-roll transport for automatic rotation and retention.
82
- // pino.transport() runs in a worker thread; sync: true ensures
83
- // no log loss on process exit (critical for CLI tools).
84
- const transport = pino.transport({
85
- target: 'pino-roll',
86
- options: {
87
- file: dest,
88
- size: bytesToSizeString(config.maxFileSize),
89
- frequency: 'daily',
90
- dateFormat: 'yyyy-MM-dd',
91
- mkdir: true,
92
- limit: {
93
- count: config.maxFiles,
94
- removeOtherLogFiles: true,
157
+ // An unknown level makes pino throw; fall back before anything is opened.
158
+ let level = config.level;
159
+ if (!isLogLevel(level)) {
160
+ process.stderr.write(`[cleo:logger] Unknown logging.level "${level}"; using "${LOGGER_CONFIG_DEFAULTS.level}"\n`);
161
+ level = LOGGER_CONFIG_DEFAULTS.level;
162
+ }
163
+ // Rotate once, then append in-thread. The fd is opened synchronously so the
164
+ // destination is ready at once: pino's exit hook (registered for every
165
+ // `sync: false` destination) flushes pending lines on a normal exit, which
166
+ // needs an open fd.
167
+ mkdirSync(currentLogDir, { recursive: true });
168
+ const activeFile = rotateLogAtStartup(dest, config.maxFileSize, config.maxFiles);
169
+ const fd = openSync(activeFile, 'a');
170
+ let destination;
171
+ let logger;
172
+ try {
173
+ destination = pino.destination({ dest: fd, sync: false });
174
+ // Build base object: projectHash and platform info appear in every log entry.
175
+ // Pino merges base with pid/hostname by default; we add our fields alongside.
176
+ const base = {
177
+ platform: process.platform,
178
+ arch: process.arch,
179
+ nodeVersion: process.version,
180
+ };
181
+ if (projectHash) {
182
+ base.projectHash = projectHash;
183
+ }
184
+ logger = pino({
185
+ level,
186
+ base,
187
+ formatters: {
188
+ level: (label) => ({ level: label.toUpperCase() }),
95
189
  },
96
- },
97
- });
98
- // Build base object: projectHash and platform info appear in every log entry.
99
- // Pino merges base with pid/hostname by default; we add our fields alongside.
100
- const base = {
101
- platform: process.platform,
102
- arch: process.arch,
103
- nodeVersion: process.version,
104
- };
105
- if (projectHash) {
106
- base.projectHash = projectHash;
107
- }
108
- currentTransport = transport;
109
- rootLogger = pino({
110
- level: config.level,
111
- base,
112
- formatters: {
113
- level: (label) => ({ level: label.toUpperCase() }),
114
- },
115
- timestamp: pino.stdTimeFunctions.isoTime,
116
- }, transport);
190
+ timestamp: pino.stdTimeFunctions.isoTime,
191
+ }, destination);
192
+ }
193
+ catch (error) {
194
+ closeSync(fd);
195
+ throw error;
196
+ }
197
+ currentDestination = destination;
198
+ rootLogger = logger;
199
+ removeSignalFlush?.();
200
+ removeSignalFlush = flushOnTerminatingSignals(destination);
117
201
  // Warn after logger is initialized so the message goes to the log file
118
202
  if (!projectHash) {
119
203
  getLogger('engine').warn('projectHash not provided to initLogger; audit correlation will be incomplete');
120
204
  }
121
- return rootLogger;
205
+ return logger;
206
+ }
207
+ /** Whether `level` names a pino level (`silent` included). */
208
+ function isLogLevel(level) {
209
+ return level === 'silent' || Object.hasOwn(pino.levels.values, level);
210
+ }
211
+ /** Signals whose default action ends the process before pino's exit hook runs. */
212
+ const TERMINATING_SIGNALS = ['SIGINT', 'SIGTERM'];
213
+ /**
214
+ * Flush buffered log lines when SIGINT or SIGTERM arrives (T14605). Node runs
215
+ * no `exit` handlers on a signal's default action, so pino's exit hook never
216
+ * fires and buffered lines would be lost. The handler flushes, removes itself
217
+ * and, when no other listener handles the signal, re-raises it so the process
218
+ * still dies by that signal with the usual exit status.
219
+ *
220
+ * @param destination - The destination to flush.
221
+ * @returns A function that removes the handlers.
222
+ */
223
+ function flushOnTerminatingSignals(destination) {
224
+ const handlers = TERMINATING_SIGNALS.map((signal) => {
225
+ const handler = () => {
226
+ try {
227
+ destination.flushSync();
228
+ }
229
+ catch {
230
+ // Nothing to flush, or the fd is gone: the signal still proceeds.
231
+ }
232
+ process.removeListener(signal, handler);
233
+ if (process.listenerCount(signal) === 0)
234
+ process.kill(process.pid, signal);
235
+ };
236
+ process.on(signal, handler);
237
+ return { signal, handler };
238
+ });
239
+ return () => {
240
+ for (const { signal, handler } of handlers)
241
+ process.removeListener(signal, handler);
242
+ };
243
+ }
244
+ /**
245
+ * Default pino logging settings. They equal the logger fields of
246
+ * `DEFAULTS.logging` in `config.ts` (pinned by `logger.test.ts`); config.ts
247
+ * does not import them because many tests mock this module.
248
+ */
249
+ export const LOGGER_CONFIG_DEFAULTS = {
250
+ level: 'info',
251
+ filePath: 'logs/cleo.log',
252
+ maxFileSize: 10 * 1024 * 1024, // 10MB
253
+ maxFiles: 5,
254
+ };
255
+ /** Narrow an unknown JSON value to a plain object, else `{}`. */
256
+ function asRecord(value) {
257
+ return value !== null && typeof value === 'object' && !Array.isArray(value)
258
+ ? value
259
+ : {};
260
+ }
261
+ /** The well-typed logger fields of one config section. */
262
+ function pickLoggerFields(section) {
263
+ const picked = {};
264
+ if (typeof section.level === 'string')
265
+ picked.level = section.level;
266
+ if (typeof section.filePath === 'string')
267
+ picked.filePath = section.filePath;
268
+ if (typeof section.maxFileSize === 'number')
269
+ picked.maxFileSize = section.maxFileSize;
270
+ if (typeof section.maxFiles === 'number')
271
+ picked.maxFiles = section.maxFiles;
272
+ return picked;
273
+ }
274
+ /** Parse a config.json file; a missing or malformed file reads as `{}`. */
275
+ function readConfigFile(path) {
276
+ try {
277
+ return asRecord(JSON.parse(readFileSync(path, 'utf-8')));
278
+ }
279
+ catch {
280
+ return {};
281
+ }
282
+ }
283
+ /**
284
+ * Resolve the logger settings the way `loadConfig()` resolves `logging`:
285
+ * defaults, then the global `config.json`, then the project's (its legacy
286
+ * `pinoLogging` section first, `logging` over it), then `CLEO_LOG_LEVEL` and
287
+ * `CLEO_LOG_FILE`. Reads only the two JSON files, so CLI startup pays no
288
+ * extra modules for it (T14605).
289
+ *
290
+ * @param cleoDir - Absolute path to the project's `.cleo` directory.
291
+ * @returns The merged logger configuration.
292
+ */
293
+ export function resolveLoggerConfig(cleoDir) {
294
+ const globalConfig = readConfigFile(join(getCleoHome(), 'config.json'));
295
+ const projectConfig = readConfigFile(join(cleoDir, 'config.json'));
296
+ const config = {
297
+ ...LOGGER_CONFIG_DEFAULTS,
298
+ ...pickLoggerFields(asRecord(globalConfig.logging)),
299
+ ...pickLoggerFields(asRecord(projectConfig.pinoLogging)),
300
+ ...pickLoggerFields(asRecord(projectConfig.logging)),
301
+ };
302
+ const envLevel = process.env['CLEO_LOG_LEVEL'];
303
+ if (envLevel)
304
+ config.level = envLevel;
305
+ const envFile = process.env['CLEO_LOG_FILE'];
306
+ if (envFile)
307
+ config.filePath = envFile;
308
+ return config;
309
+ }
310
+ /**
311
+ * Start the file logger for a CLI process unless one is already running
312
+ * (T14605). Reads the settings with {@link resolveLoggerConfig} and calls
313
+ * {@link initLogger}; until this runs, {@link getLogger} returns the stderr
314
+ * warn fallback and info/debug lines are dropped.
315
+ *
316
+ * @param cleoDir - Absolute path to the project's `.cleo` directory.
317
+ * @param projectHash - Project identity bound to every entry, when known.
318
+ * @returns `true` when this call started the logger, `false` when one was
319
+ * already running.
320
+ */
321
+ export function startFileLogger(cleoDir, projectHash) {
322
+ if (rootLogger)
323
+ return false;
324
+ initLogger(cleoDir, resolveLoggerConfig(cleoDir), projectHash);
325
+ return true;
326
+ }
327
+ /**
328
+ * Start the file logger for the current project: the CLI startup path
329
+ * (T14605). Resolves the project root and its `.cleo` directory, reads
330
+ * `projectHash`, and calls {@link startFileLogger}. Outside a project it
331
+ * starts nothing. Any other failure is written to stderr once, as one
332
+ * `[cleo] File logger not started: …` line, and returned, so a broken path
333
+ * or config cannot silently disable logging. Never throws.
334
+ *
335
+ * The modules it needs are imported lazily: they are already loaded on every
336
+ * command path, and importing them statically would make every
337
+ * `getLogger()` caller load them.
338
+ *
339
+ * @returns What happened.
340
+ */
341
+ export async function startProjectFileLogger() {
342
+ if (rootLogger)
343
+ return { status: 'running' };
344
+ try {
345
+ const [{ getProjectRoot, isMissingProjectError }, { getCleoDirAbsolute }, { getProjectInfoSync },] = await Promise.all([
346
+ import('./project-scope.js'),
347
+ import('./paths.js'),
348
+ import('./project-info.js'),
349
+ ]);
350
+ let projectRoot;
351
+ try {
352
+ projectRoot = getProjectRoot();
353
+ }
354
+ catch (error) {
355
+ if (isMissingProjectError(error))
356
+ return { status: 'no-project' };
357
+ throw error;
358
+ }
359
+ const cleoDir = getCleoDirAbsolute(projectRoot);
360
+ if (!existsSync(cleoDir))
361
+ return { status: 'no-project' };
362
+ startFileLogger(cleoDir, getProjectInfoSync(projectRoot)?.projectHash);
363
+ return { status: 'started', cleoDir };
364
+ }
365
+ catch (error) {
366
+ const message = error instanceof Error ? error.message : String(error);
367
+ process.stderr.write(`[cleo] File logger not started: ${message}\n`);
368
+ return { status: 'failed', error: message };
369
+ }
122
370
  }
123
371
  /**
124
372
  * Get a child logger bound to a subsystem name.
@@ -150,54 +398,40 @@ export function getLogDir() {
150
398
  /**
151
399
  * Flush and close the logger. Call during graceful shutdown.
152
400
  *
153
- * Returns a Promise that resolves once the pino transport worker thread
154
- * has processed all pending writes. Callers that cannot await (e.g. sync
155
- * shutdown handlers) may fire-and-forget safely — the underlying flush
156
- * will still occur before the process exits.
401
+ * Buffered lines are written synchronously before this returns its
402
+ * Promise, which resolves once the log file is closed. Callers that cannot
403
+ * await may fire-and-forget: the flush has already happened, and pino's exit
404
+ * hook flushes any line logged later on a normal exit.
157
405
  */
158
406
  export function closeLogger() {
159
407
  return new Promise((resolve) => {
160
- if (!rootLogger) {
408
+ const destination = currentDestination;
409
+ removeSignalFlush?.();
410
+ removeSignalFlush = null;
411
+ rootLogger = null;
412
+ currentLogDir = null;
413
+ currentDestination = null;
414
+ if (!destination) {
161
415
  resolve();
162
416
  return;
163
417
  }
164
- const logger = rootLogger;
165
- const transport = currentTransport;
166
- // Flush pending writes through the pino-roll worker, then terminate the
167
- // worker's writable stream. Without `.end()` the worker keeps its
168
- // rotation timer alive and can try to open the next rotation file
169
- // (e.g. `.1.log`) after the containing tmpdir has been rm'd, producing
170
- // an ENOENT uncaught exception that Vitest surfaces even when every
171
- // test passed. The end-callback is not guaranteed to fire (pino's
172
- // transport worker may exit before acknowledging), so a short timeout
173
- // fallback ensures closeLogger() always resolves promptly.
174
- let resolved = false;
175
- const done = () => {
176
- if (resolved)
177
- return;
178
- resolved = true;
179
- rootLogger = null;
180
- currentLogDir = null;
181
- currentTransport = null;
418
+ // Write every buffered line synchronously, then close the fd once any
419
+ // in-flight async write lands ('close'). The unref'd fallback keeps a
420
+ // missing 'close' from stalling shutdown.
421
+ destination.once('close', () => resolve());
422
+ setTimeout(resolve, 100).unref();
423
+ try {
424
+ destination.flushSync();
425
+ }
426
+ catch {
427
+ // Nothing to flush, or the fd is already gone: closing still applies.
428
+ }
429
+ try {
430
+ destination.end();
431
+ }
432
+ catch {
182
433
  resolve();
183
- };
184
- logger.flush(() => {
185
- if (transport && typeof transport.end === 'function') {
186
- try {
187
- transport.end(done);
188
- }
189
- catch {
190
- done();
191
- }
192
- // Fallback: resolve after a short delay if the end-callback
193
- // never fires. 100ms is enough for the worker thread to
194
- // finish flushing + terminate in the normal path.
195
- setTimeout(done, 100);
196
- }
197
- else {
198
- done();
199
- }
200
- });
434
+ }
201
435
  });
202
436
  }
203
437
  //# sourceMappingURL=logger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,IAAI,MAAM,MAAM,CAAC;AAmBxB,IAAI,UAAU,GAAuB,IAAI,CAAC;AAC1C,IAAI,aAAa,GAAkB,IAAI,CAAC;AACxC,IAAI,gBAAgB,GAA2B,IAAI,CAAC;AACpD,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,SAAS,GAAG,KAAK,CAAC;IAClB,IAAI,KAAK,IAAI,UAAU,EAAE,CAAC;QACxB,UAAU,CAAC,KAAK,GAAG,QAAQ,CAAC;IAC9B,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;GAGG;AACH,SAAS,iBAAiB,CAAC,KAAa;IACtC,IAAI,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC;IACvF,IAAI,KAAK,I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,EAAE,CAAC,EAAE;SAC3E,EACD,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CACpB,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,UAAU,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;AACzC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS;IACvB,OAAO,aAAa,CAAC;AACvB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QACnC,MAAM,WAAW,GAAG,kBAAkB,CAAC;QACvC,iBAAiB,EAAE,EAAE,CAAC;QACtB,iBAAiB,GAAG,IAAI,CAAC;QACzB,UAAU,GAAG,IAAI,CAAC;QAClB,aAAa,GAAG,IAAI,CAAC;QACrB,kBAAkB,GAAG,IAAI,CAAC;QAC1B,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,OAAO,EAAE,CAAC;YACV,OAAO;QACT,CAAC;QACD,sEAAsE;QACtE,sEAAsE;QACtE,0CAA0C;QAC1C,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3C,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;QACjC,IAAI,CAAC;YACH,WAAW,CAAC,SAAS,EAAE,CAAC;QAC1B,CAAC;QAAC,MAAM,CAAC;YACP,sEAAsE;QACxE,CAAC;QACD,IAAI,CAAC;YACH,WAAW,CAAC,GAAG,EAAE,CAAC;QACpB,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -258,6 +258,10 @@ export interface RunConsolidationResult {
258
258
  sleepConsolidation?: {
259
259
  ran: boolean;
260
260
  merged: number;
261
+ /** Near-duplicate pair merges rolled back on failure (T14639). */
262
+ mergeFailed: number;
263
+ /** Why the merge step failed, or its first rolled-back pair (T14639). */
264
+ mergeError?: string;
261
265
  pruned: number;
262
266
  patternsGenerated: number;
263
267
  insightsStored: number;
@@ -922,6 +922,10 @@ export async function runConsolidation(projectRoot, sessionId, trigger = 'sessio
922
922
  result.sleepConsolidation = {
923
923
  ran: sleepResult.ran,
924
924
  merged: sleepResult.mergeDuplicates.merged,
925
+ mergeFailed: sleepResult.mergeDuplicates.failed ?? 0,
926
+ ...(sleepResult.mergeDuplicates.error !== undefined
927
+ ? { mergeError: sleepResult.mergeDuplicates.error }
928
+ : {}),
925
929
  pruned: sleepResult.pruneStale.pruned,
926
930
  patternsGenerated: sleepResult.strengthenPatterns.patternsGenerated,
927
931
  insightsStored: sleepResult.generateInsights.insightsStored,