@cleocode/cleo 2026.4.125 → 2026.4.126

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.
package/dist/cli/index.js CHANGED
@@ -744,13 +744,6 @@ var init_operations = __esm({
744
744
  }
745
745
  });
746
746
 
747
- // packages/contracts/src/orchestration-hierarchy.ts
748
- var init_orchestration_hierarchy = __esm({
749
- "packages/contracts/src/orchestration-hierarchy.ts"() {
750
- "use strict";
751
- }
752
- });
753
-
754
747
  // packages/contracts/src/peer.ts
755
748
  var init_peer = __esm({
756
749
  "packages/contracts/src/peer.ts"() {
@@ -867,7 +860,6 @@ var init_src = __esm({
867
860
  init_lafs();
868
861
  init_operations();
869
862
  init_params();
870
- init_orchestration_hierarchy();
871
863
  init_peer();
872
864
  init_session2();
873
865
  init_status_registry();
@@ -4644,6 +4636,25 @@ var init_registry = __esm({
4644
4636
  requiredParams: [],
4645
4637
  params: []
4646
4638
  },
4639
+ // T1262 — memory-doctor read-only noise detector (E1-parallel per council verdict)
4640
+ {
4641
+ gateway: "query",
4642
+ domain: "memory",
4643
+ operation: "doctor",
4644
+ description: "memory.doctor (query) \u2014 read-only brain noise scan: detects duplicate-content, missing-type, missing-provenance, orphan-edge, low-confidence, stale-unverified patterns. Used as M7 assert-clean gate for Sentient v1 activation.",
4645
+ tier: 0,
4646
+ idempotent: true,
4647
+ sessionRequired: false,
4648
+ requiredParams: [],
4649
+ params: [
4650
+ {
4651
+ name: "assert-clean",
4652
+ type: "boolean",
4653
+ required: false,
4654
+ description: "If true, exit non-zero when any noise patterns are detected (M7 gate for Sentient v1)."
4655
+ }
4656
+ ]
4657
+ },
4647
4658
  // T791 — LLM extraction backend status
4648
4659
  {
4649
4660
  gateway: "query",
@@ -4840,12 +4851,13 @@ var init_registry = __esm({
4840
4851
  { name: "agent", type: "string", required: false, description: "Agent provenance" }
4841
4852
  ]
4842
4853
  },
4843
- // T792 — promote entry to verified=true (owner/cleo-prime only)
4854
+ // T792 — promote entry to verified=true (project-orchestrator or owner only)
4855
+ // T1258 E1 migration shim: 'cleo-prime' accepted as legacy alias for 'project-orchestrator'
4844
4856
  {
4845
4857
  gateway: "mutate",
4846
4858
  domain: "memory",
4847
4859
  operation: "verify",
4848
- description: "memory.verify (mutate) \u2014 flip verified=1 on a brain entry; requires cleo-prime or owner identity",
4860
+ description: "memory.verify (mutate) \u2014 flip verified=1 on a brain entry; requires project-orchestrator or owner identity",
4849
4861
  tier: 1,
4850
4862
  idempotent: true,
4851
4863
  sessionRequired: false,
@@ -4856,7 +4868,7 @@ var init_registry = __esm({
4856
4868
  name: "agent",
4857
4869
  type: "string",
4858
4870
  required: false,
4859
- description: "Caller identity ('cleo-prime' or 'owner'). Omit for terminal invocation."
4871
+ description: "Caller identity ('project-orchestrator' or 'owner'). Legacy alias 'cleo-prime' accepted per T1258 E1 migration shim. Omit for terminal invocation."
4860
4872
  }
4861
4873
  ]
4862
4874
  },
@@ -18430,6 +18442,23 @@ var init_memory2 = __esm({
18430
18442
  startTime
18431
18443
  );
18432
18444
  }
18445
+ // T1262 — brain noise detector (read-only, E1-parallel per council verdict)
18446
+ case "doctor": {
18447
+ const { scanBrainNoise } = await import("@cleocode/core/memory/brain-doctor.js");
18448
+ const result = await scanBrainNoise(projectRoot);
18449
+ const assertClean = params?.["assert-clean"];
18450
+ if (assertClean && !result.isClean) {
18451
+ return errorResult(
18452
+ "query",
18453
+ "memory",
18454
+ operation,
18455
+ "E_BRAIN_NOISE_DETECTED",
18456
+ `Brain noise detected: ${result.findings.length} pattern(s) across ${result.totalScanned} entries. ` + result.findings.map((f) => `${f.pattern}(${f.count})`).join(", ") + ". Run `cleo memory doctor` for details. Fix noise before enabling Sentient v1 (M7 gate).",
18457
+ startTime
18458
+ );
18459
+ }
18460
+ return wrapResult(result, "query", "memory", operation, startTime);
18461
+ }
18433
18462
  // T791 — LLM extraction backend status
18434
18463
  case "llm-status": {
18435
18464
  const resolvedSource = resolveAnthropicApiKeySource();
@@ -19264,14 +19293,20 @@ var init_memory2 = __esm({
19264
19293
  startTime
19265
19294
  );
19266
19295
  }
19296
+ const VERIFY_PERMITTED_IDENTITIES = /* @__PURE__ */ new Set([
19297
+ "owner",
19298
+ "project-orchestrator",
19299
+ "cleo-prime"
19300
+ // legacy alias — see migration shim note above
19301
+ ]);
19267
19302
  const callerAgent = params?.agent;
19268
- if (callerAgent && callerAgent !== "cleo-prime" && callerAgent !== "owner") {
19303
+ if (callerAgent && !VERIFY_PERMITTED_IDENTITIES.has(callerAgent)) {
19269
19304
  return errorResult(
19270
19305
  "mutate",
19271
19306
  "memory",
19272
19307
  operation,
19273
19308
  "E_FORBIDDEN",
19274
- `verify requires agent identity 'cleo-prime' or 'owner'; got '${callerAgent}'`,
19309
+ `verify requires agent identity 'project-orchestrator' or 'owner'; got '${callerAgent}'`,
19275
19310
  startTime
19276
19311
  );
19277
19312
  }
@@ -19522,6 +19557,8 @@ var init_memory2 = __esm({
19522
19557
  "code.links",
19523
19558
  "code.memories-for-code",
19524
19559
  "code.for-memory",
19560
+ // T1262 — brain noise detector (E1-parallel, read-only)
19561
+ "doctor",
19525
19562
  // T791 — LLM extraction backend status
19526
19563
  "llm-status",
19527
19564
  // T792 — pending verification queue
@@ -45267,6 +45304,31 @@ var importCommand3 = defineCommand({
45267
45304
  if (stats.errors > 0) process.exit(1);
45268
45305
  }
45269
45306
  });
45307
+ var doctorCommand3 = defineCommand({
45308
+ meta: {
45309
+ name: "doctor",
45310
+ description: "Read-only brain noise scan: detects duplicate-content, missing-type, missing-provenance, orphan-edge, low-confidence, and stale-unverified patterns. Use --assert-clean as the M7 entry gate before enabling Sentient v1 (`cleo sentient propose enable`)."
45311
+ },
45312
+ args: {
45313
+ "assert-clean": {
45314
+ type: "boolean",
45315
+ description: "Exit non-zero when any noise patterns are detected (M7 gate for Sentient v1)"
45316
+ },
45317
+ json: {
45318
+ type: "boolean",
45319
+ description: "Output as JSON"
45320
+ }
45321
+ },
45322
+ async run({ args }) {
45323
+ await dispatchFromCli(
45324
+ "query",
45325
+ "memory",
45326
+ "doctor",
45327
+ { "assert-clean": args["assert-clean"] },
45328
+ { command: "memory-doctor", operation: "memory.doctor" }
45329
+ );
45330
+ }
45331
+ });
45270
45332
  var llmStatusCommand = defineCommand({
45271
45333
  meta: {
45272
45334
  name: "llm-status",
@@ -46125,6 +46187,7 @@ var memoryCommand = defineCommand({
46125
46187
  reflect: reflectCommand,
46126
46188
  "dedup-scan": dedupScanCommand,
46127
46189
  import: importCommand3,
46190
+ doctor: doctorCommand3,
46128
46191
  "llm-status": llmStatusCommand,
46129
46192
  verify: verifyCommand,
46130
46193
  "pending-verify": pendingVerifyCommand,