@cleocode/contracts 2026.11.17 → 2026.11.18-rc.ci.735

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.
@@ -166,7 +166,8 @@ export type AgentDoctorCode =
166
166
  | 'D-008'
167
167
  | 'D-009'
168
168
  | 'D-010'
169
- | 'D-011';
169
+ | 'D-011'
170
+ | 'D-012';
170
171
 
171
172
  /**
172
173
  * Single finding produced by the agent doctor. A `fixCommand` is populated
@@ -183,6 +183,28 @@ export interface BrainGraph {
183
183
  };
184
184
  /** `true` when the response was capped by the node limit. */
185
185
  truncated: boolean;
186
+ /**
187
+ * Read errors per substrate, present only when an adapter's query failed.
188
+ *
189
+ * A substrate listed here returned partial (possibly empty) results because
190
+ * its SQL failed, so an empty substrate is never mistaken for an empty store.
191
+ */
192
+ errors?: Partial<Record<BrainSubstrate, string>>;
193
+ }
194
+
195
+ /**
196
+ * Result of one Brain substrate adapter (`getBrainSubstrate`, `getTasksSubstrate`, …).
197
+ *
198
+ * `error` is set when the adapter's read failed part-way: `nodes`/`edges` then
199
+ * hold whatever was read before the failure.
200
+ */
201
+ export interface BrainSubstrateResult {
202
+ /** Nodes read from the substrate. */
203
+ nodes: BrainNode[];
204
+ /** Edges read from the substrate. */
205
+ edges: BrainEdge[];
206
+ /** Message of the SQL error that cut the read short, when one occurred. */
207
+ error?: string;
186
208
  }
187
209
 
188
210
  // ---------------------------------------------------------------------------
@@ -8434,6 +8434,20 @@ export const OPERATIONS: OperationDef[] = [
8434
8434
  description:
8435
8435
  'Comma-separated repair classes to scope the plan (and apply) to, e.g. publication-ledger-drift (T14174)',
8436
8436
  },
8437
+ {
8438
+ name: 'publication',
8439
+ type: 'string' as const,
8440
+ required: false,
8441
+ description:
8442
+ 'With archiveInto: the docs_publications path of a gone row whose blob it alone references (T14651)',
8443
+ },
8444
+ {
8445
+ name: 'archiveInto',
8446
+ type: 'string' as const,
8447
+ required: false,
8448
+ description:
8449
+ 'Archive the only-held blob of the publication row into this adopted doc; the next run prunes the row (T14651)',
8450
+ },
8437
8451
  ],
8438
8452
  },
8439
8453
  // ── docs.triage (T13446 — Epic T13340 / Saga T13339) ──────────────────────
@@ -8553,6 +8567,20 @@ export const OPERATIONS: OperationDef[] = [
8553
8567
  description:
8554
8568
  'Comma-separated repair classes to scope the plan (and apply) to, e.g. publication-ledger-drift (T14174)',
8555
8569
  },
8570
+ {
8571
+ name: 'publication',
8572
+ type: 'string' as const,
8573
+ required: false,
8574
+ description:
8575
+ 'With archiveInto: the docs_publications path of a gone row whose blob it alone references (T14651)',
8576
+ },
8577
+ {
8578
+ name: 'archiveInto',
8579
+ type: 'string' as const,
8580
+ required: false,
8581
+ description:
8582
+ 'Archive the only-held blob of the publication row into this adopted doc; the next run prunes the row (T14651)',
8583
+ },
8556
8584
  ],
8557
8585
  },
8558
8586
  // ── docs.migrate (T13360 — Epic T13340 / Saga T13339) ─────────────────────
@@ -250,16 +250,32 @@ export interface DocsModernizeOpPrior {
250
250
  readonly publication?: DocsModernizeMovedPublication;
251
251
  }
252
252
 
253
- /** A `docs_publications` row a tree move re-pointed at its file's new path (T14610). */
253
+ /**
254
+ * A `docs_publications` row a tree run re-pointed at its file's new path
255
+ * (T14610), or removed because its mirror was merged or deleted (T14631).
256
+ */
254
257
  export interface DocsModernizeMovedPublication {
255
258
  /** Attachment name the row publishes. */
256
259
  readonly blobName: string;
257
260
  /** `published_path` before the move, as recorded. */
258
261
  readonly fromPath: string;
259
- /** `published_path` after the move. */
260
- readonly toPath: string;
262
+ /** `published_path` after the move; null when the row was removed with its mirror (T14631). */
263
+ readonly toPath: string | null;
261
264
  /** The row's `last_blob_sha`, carried unchanged. */
262
265
  readonly lastBlobSha: string;
266
+ /** The row's `published_at`, carried unchanged so a rollback restores it exactly (T14631). */
267
+ readonly publishedAt?: string;
268
+ /**
269
+ * A row already sat at `toPath` before the move: it was kept as it was, and a
270
+ * rollback leaves it there (T14631). Absent on receipts written before T14631.
271
+ */
272
+ readonly targetExisted?: boolean;
273
+ /**
274
+ * The row was the last reference to its blob, so the blob was imported as a
275
+ * prior version of this doc before the row went (T14631). A rollback keeps
276
+ * that version: the import is additive and the restored row holds the blob too.
277
+ */
278
+ readonly archivedInto?: string;
263
279
  }
264
280
 
265
281
  /**
@@ -277,7 +293,8 @@ export interface DocsModernizeMovedPublication {
277
293
  * - `reslug` — `slug` was renamed to `target`; `slug` stays an alias (T14118).
278
294
  * - `link-task` — the row `attachmentId` gained a ref to task `ownerId` (T14118).
279
295
  * - `move-publication` — the `docs_publications` row of `ownerId` for the file `path` moved
280
- * with it to `target`; `prior.publication` holds both keys (T14610).
296
+ * with it to `target`; `prior.publication` holds both keys (T14610). A merged or deleted
297
+ * mirror's row is removed instead (`target` and `toPath` null, T14631).
281
298
  */
282
299
  export interface DocsModernizeReceiptOp {
283
300
  /** Step kind. */
@@ -458,8 +475,11 @@ const receiptOpSchema = z.object({
458
475
  .object({
459
476
  blobName: z.string(),
460
477
  fromPath: z.string(),
461
- toPath: z.string(),
478
+ toPath: z.string().nullable(),
462
479
  lastBlobSha: z.string(),
480
+ publishedAt: z.string().optional(),
481
+ targetExisted: z.boolean().optional(),
482
+ archivedInto: z.string().optional(),
463
483
  })
464
484
  .optional(),
465
485
  })
package/src/index.ts CHANGED
@@ -181,6 +181,7 @@ export type {
181
181
  BrainQueryOptions,
182
182
  BrainStreamEvent,
183
183
  BrainSubstrate,
184
+ BrainSubstrateResult,
184
185
  } from './brain-graph.js';
185
186
  export type {
186
187
  AbsolutePathRules,
@@ -1170,6 +1170,18 @@ export interface DocsDoctorParams {
1170
1170
  * `apply`, written. Diagnostics still cover every class.
1171
1171
  */
1172
1172
  only?: string;
1173
+ /**
1174
+ * The ledger path whose only-held blob {@link archiveInto} names a doc for
1175
+ * (T14651), exactly as `cleo docs status` lists it. Given together with
1176
+ * `archiveInto`.
1177
+ */
1178
+ publication?: string;
1179
+ /**
1180
+ * Archive the only-held blob of the gone row at {@link publication} into this
1181
+ * adopted doc (T14651): the route for a merged or deleted mirror, which has no
1182
+ * in-sync sibling row to find its doc by. The next run prunes the row.
1183
+ */
1184
+ archiveInto?: string;
1173
1185
  }
1174
1186
 
1175
1187
  /**