@cleocode/contracts 2026.11.18 → 2026.11.19

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.
@@ -205,6 +205,11 @@ export interface BrainSubstrateResult {
205
205
  edges: BrainEdge[];
206
206
  /** Message of the SQL error that cut the read short, when one occurred. */
207
207
  error?: string;
208
+ /**
209
+ * Node kinds whose query failed, present only when one did. An edge to an
210
+ * unloaded node of such a kind is dropped, never stubbed (T14659).
211
+ */
212
+ failedKinds?: BrainNodeKind[];
208
213
  }
209
214
 
210
215
  // ---------------------------------------------------------------------------
@@ -132,6 +132,14 @@ describe('operation envelope registry snapshots (T10615)', () => {
132
132
  "required": false,
133
133
  "type": "string",
134
134
  },
135
+ {
136
+ "cli": {
137
+ "flag": "superseded-by",
138
+ },
139
+ "name": "supersededBy",
140
+ "required": false,
141
+ "type": "string",
142
+ },
135
143
  {
136
144
  "cli": {
137
145
  "flag": "dry-run",
@@ -8780,7 +8780,7 @@ export const OPERATIONS: OperationDef[] = [
8780
8780
  description:
8781
8781
  'docs.update (mutate) — replace blob content for an existing slug while preserving the slug. ' +
8782
8782
  'New sha256 + new attachment row; the old row stays reachable by ID for history. ' +
8783
- 'NO supersession edge (use `cleo docs supersede` for that). ' +
8783
+ 'A supersession edge is written only by --status superseded with --superseded-by. ' +
8784
8784
  'Audit log entry appended to .cleo/audit/docs-versioning.jsonl (squashed within a 5-min window).',
8785
8785
  tier: 1,
8786
8786
  idempotent: false,
@@ -8844,6 +8844,15 @@ export const OPERATIONS: OperationDef[] = [
8844
8844
  'Alone (no file or content) it changes only the lifecycle status. ' +
8845
8845
  `Valid: ${DOCS_LIFECYCLE_STATUSES.join('|')}.`,
8846
8846
  },
8847
+ {
8848
+ name: 'supersededBy',
8849
+ type: 'string' as const,
8850
+ required: false,
8851
+ description:
8852
+ 'Slug of the doc that replaces this one (T14657). Use with --status superseded and no file or content: ' +
8853
+ "records the successor link (this doc's superseded_by, the successor's supersedes) that `cleo docs supersede` wrote.",
8854
+ cli: { flag: 'superseded-by' },
8855
+ },
8847
8856
  {
8848
8857
  name: 'dryRun',
8849
8858
  type: 'boolean' as const,
package/src/exit-codes.ts CHANGED
@@ -679,3 +679,15 @@ export function isRecoverableCode(code: ExitCode): boolean {
679
679
  export function getExitCodeName(code: ExitCode): string {
680
680
  return ExitCode[code] ?? 'UNKNOWN';
681
681
  }
682
+
683
+ /**
684
+ * `Symbol.for` key of the process-wide set of live worker threads that core
685
+ * `exitProcess` stops, within a deadline, before it exits (T14670).
686
+ *
687
+ * `process.exit` joins every live worker thread with no timeout, so a worker
688
+ * blocked in native code hangs the exit forever. Packages that cannot import
689
+ * core (nexus) add their workers to `globalThis[Symbol.for(key)]`, a
690
+ * `Set<Worker>`, and remove them on `exit`. It lives here, not in `jobs`,
691
+ * because every CLI path already loads this module (gate 39 module budgets).
692
+ */
693
+ export const EXIT_WORKER_REGISTRY_KEY = 'cleo.exitWorkers';
@@ -172,7 +172,7 @@ export const ADR_070_INVARIANTS: readonly RegisteredInvariant[] = Object.freeze(
172
172
  code: 'ORC-006',
173
173
  name: 'Worker scope ≤ 3 files per spawn',
174
174
  description:
175
- 'Cross-file reasoning quality degrades beyond ~3 files for a single Worker. Enforced at spawn-time by validateSpawnReadiness — V_ATOMIC_SCOPE_MISSING when task.files is empty, V_ATOMIC_SCOPE_TOO_LARGE when the counted files exceed MAX_WORKER_FILES (currently 3); a test file that pairs with a declared source file by name stem does not count; unpaired tests count (T14633). Spawn-prompt builder injects a Worker Budget Constraints section so the Worker sees the budget inline. Tier: error because the gate refuses to spawn an over-scoped Worker.',
175
+ 'Cross-file reasoning quality degrades beyond ~3 files for a single Worker. Enforced at spawn-time by validateSpawnReadiness — V_ATOMIC_SCOPE_MISSING when task.files is empty, V_ATOMIC_SCOPE_TOO_LARGE when the counted files exceed MAX_WORKER_FILES (currently 3); a test file that pairs with a declared code file by name stem in a directory it tests (a sibling, a __tests__/ tree, or a tests/ or test/ tree mirroring src/; paths normalised) does not count; unpaired tests count (T14633, T14636, T14661). Spawn-prompt builder injects a Worker Budget Constraints section so the Worker sees the budget inline. Tier: error because the gate refuses to spawn an over-scoped Worker.',
176
176
  severity: 'error',
177
177
  runtimeGate: {
178
178
  module: VALIDATE_SPAWN_MODULE,
@@ -864,8 +864,8 @@ export { DOCS_LIFECYCLE_STATUSES, type DocsLifecycleStatus } from './docs-lifecy
864
864
  * Replaces the blob content for an existing slug — the slug is transferred
865
865
  * from the old `attachments` row to a new row carrying the new sha256, and
866
866
  * the old row remains reachable by attachment-id for history. Unlike
867
- * {@link DocsSupersedeParams}-style flows, NO supersession edge is created
868
- * (callers wanting an explicit lineage edge should use `cleo docs supersede`).
867
+ * {@link DocsSupersedeParams}-style flows, NO supersession edge is created,
868
+ * except by `status: 'superseded'` with `supersededBy` (T14657).
869
869
  *
870
870
  * At most one of `file` or `content` may be provided. With neither, `status`
871
871
  * is required and the update changes only the lifecycle status, keeping the
@@ -917,6 +917,14 @@ export interface DocsUpdateParams {
917
917
  * (no `file`/`content`), it changes only the lifecycle status.
918
918
  */
919
919
  status?: DocsLifecycleStatus;
920
+ /**
921
+ * Slug (or alias) of the doc that replaces this one (T14657). Requires
922
+ * `status: 'superseded'` with no `file`/`content`: it records the successor
923
+ * link the deprecated `docs.supersede` wrote — this doc's `superseded_by`
924
+ * and the successor's `supersedes` — in one transaction. A doc that is
925
+ * already superseded takes the new successor (latest wins).
926
+ */
927
+ supersededBy?: string;
920
928
  /** Validate/preflight only; do not mutate attachment rows, blob storage, or audit logs. */
921
929
  dryRun?: boolean;
922
930
  /** Fail body-schema diagnostics instead of surfacing advisory warnings. */