@cleocode/cleo 2026.5.134 → 2026.6.0

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
@@ -2259,8 +2259,8 @@ var init_db_inventory = __esm({
2259
2259
  role: "signaldock-project",
2260
2260
  tier: "project",
2261
2261
  filePathTemplate: "<projectRoot>/.cleo/signaldock.db",
2262
- drizzleSchemaPath: "packages/core/src/store/schema/signaldock-schema.ts",
2263
- migrationsDir: "packages/core/migrations/drizzle-signaldock/",
2262
+ drizzleSchemaPath: "packages/core/src/store/schema/agent-registry-schema.ts",
2263
+ migrationsDir: "packages/core/migrations/drizzle-agent-registry/",
2264
2264
  ownerPackage: "@cleocode/core",
2265
2265
  openedVia: "HISTORICAL \u2014 project-tier signaldock.db was migrated into conduit.db post-T310/ADR-037. No live opener; charter row retained for migration provenance and legacy backup detection.",
2266
2266
  concurrency: "single-writer",
@@ -2272,8 +2272,8 @@ var init_db_inventory = __esm({
2272
2272
  role: "signaldock-global",
2273
2273
  tier: "global",
2274
2274
  filePathTemplate: "$XDG_DATA_HOME/cleo/signaldock.db",
2275
- drizzleSchemaPath: "packages/core/src/store/schema/signaldock-schema.ts",
2276
- migrationsDir: "packages/core/migrations/drizzle-signaldock/",
2275
+ drizzleSchemaPath: "packages/core/src/store/schema/agent-registry-schema.ts",
2276
+ migrationsDir: "packages/core/migrations/drizzle-agent-registry/",
2277
2277
  ownerPackage: "@cleocode/core",
2278
2278
  openedVia: "openCleoDb('signaldock')",
2279
2279
  concurrency: "single-writer",
@@ -5378,6 +5378,50 @@ var init_operations_registry = __esm({
5378
5378
  }
5379
5379
  ]
5380
5380
  },
5381
+ {
5382
+ // T11575 — the handler (dispatch/domains/tasks.ts 'relates.add-batch') and
5383
+ // CLI command (cli/commands/relates.ts add-batch) shipped, but no
5384
+ // OperationDef existed here, so `resolve()` returned undefined and the
5385
+ // dispatcher rejected the call with E_INVALID_OPERATION before it ever
5386
+ // reached the handler. Registering the op (gateway:'mutate') closes the gap.
5387
+ gateway: "mutate",
5388
+ domain: "tasks",
5389
+ operation: "relates.add-batch",
5390
+ description: "tasks.relates.add-batch (mutate) \u2014 bulk-add advisory relation edges from a JSON payload ({relations:[...]} or {edges:[...]}); use dryRun to preview without writing.",
5391
+ tier: 1,
5392
+ idempotent: false,
5393
+ sessionRequired: false,
5394
+ // Neither `relations` nor `edges` is individually required — the handler
5395
+ // accepts either shape and validates emptiness in core — so no param is
5396
+ // declared required at the dispatch boundary.
5397
+ requiredParams: [],
5398
+ params: [
5399
+ {
5400
+ name: "relations",
5401
+ type: "array",
5402
+ required: false,
5403
+ description: "Array of relation edges ({from|taskId, to|relatedId, type, reason})"
5404
+ },
5405
+ {
5406
+ name: "edges",
5407
+ type: "array",
5408
+ required: false,
5409
+ description: "Alias for `relations` \u2014 array of relation edges"
5410
+ },
5411
+ {
5412
+ name: "dryRun",
5413
+ type: "boolean",
5414
+ required: false,
5415
+ description: "Validate and report what would be created without writing"
5416
+ },
5417
+ {
5418
+ name: "reasonWaiver",
5419
+ type: "string",
5420
+ required: false,
5421
+ description: "Explicit audit waiver text for edges without per-edge reasons"
5422
+ }
5423
+ ]
5424
+ },
5381
5425
  {
5382
5426
  gateway: "mutate",
5383
5427
  domain: "tasks",
@@ -11554,6 +11598,7 @@ var init_exit_codes = __esm({
11554
11598
  ExitCode2[ExitCode2["DECISION_VALIDATOR_FAILED"] = 106] = "DECISION_VALIDATOR_FAILED";
11555
11599
  ExitCode2[ExitCode2["LEAD_BYPASS_DETECTED"] = 107] = "LEAD_BYPASS_DETECTED";
11556
11600
  ExitCode2[ExitCode2["AC_COVERAGE_INCOMPLETE"] = 108] = "AC_COVERAGE_INCOMPLETE";
11601
+ ExitCode2[ExitCode2["CANCELLED_CHILD_NO_WAIVER"] = 109] = "CANCELLED_CHILD_NO_WAIVER";
11557
11602
  return ExitCode2;
11558
11603
  })(ExitCode || {});
11559
11604
  }
@@ -12264,6 +12309,13 @@ var init_observe = __esm({
12264
12309
  }
12265
12310
  });
12266
12311
 
12312
+ // packages/contracts/src/migration-parity.ts
12313
+ var init_migration_parity = __esm({
12314
+ "packages/contracts/src/migration-parity.ts"() {
12315
+ "use strict";
12316
+ }
12317
+ });
12318
+
12267
12319
  // packages/contracts/src/mvi.ts
12268
12320
  var init_mvi = __esm({
12269
12321
  "packages/contracts/src/mvi.ts"() {
@@ -14173,6 +14225,7 @@ var init_src2 = __esm({
14173
14225
  init_lafs();
14174
14226
  init_plugin_llm();
14175
14227
  init_observe();
14228
+ init_migration_parity();
14176
14229
  init_mvi();
14177
14230
  init_operation_envelope_validation();
14178
14231
  init_docs();
@@ -18036,10 +18089,9 @@ async function listenTopicImpl(topicName, agentId, limit, since) {
18036
18089
  apiBaseUrl: credential.apiBaseUrl
18037
18090
  });
18038
18091
  try {
18039
- const sinceUnix = since ? Math.floor(new Date(since).getTime() / 1e3) : 0;
18040
18092
  const messages = await transport.pollTopic(topicName, {
18041
18093
  limit: limit ?? 50,
18042
- since: sinceUnix
18094
+ since: since ?? ""
18043
18095
  });
18044
18096
  return {
18045
18097
  success: true,
@@ -18760,7 +18812,9 @@ Recovery command: cleo docs update {slug} --file <your-file>`;
18760
18812
  description: void 0,
18761
18813
  labels: void 0,
18762
18814
  createdAt: doc.createdAt,
18763
- refCount: 0,
18815
+ // Surface the real attachment ref_count (T11572) so `docs list` agrees
18816
+ // with the `docs add` response — both now read the same source of truth.
18817
+ refCount: doc.refCount,
18764
18818
  ...doc.slug ? { slug: doc.slug } : {},
18765
18819
  ...doc.kind ? { type: doc.kind } : {},
18766
18820
  ownerId: doc.ownerId,
@@ -18808,7 +18862,8 @@ Recovery command: cleo docs update {slug} --file <your-file>`;
18808
18862
  description: void 0,
18809
18863
  labels: void 0,
18810
18864
  createdAt: doc.createdAt,
18811
- refCount: 0,
18865
+ // Surface the real attachment ref_count (T11572) — see project-scope note.
18866
+ refCount: doc.refCount,
18812
18867
  ...doc.slug ? { slug: doc.slug } : {},
18813
18868
  ...doc.kind ? { type: doc.kind } : {}
18814
18869
  }));
@@ -22402,22 +22457,24 @@ function handleTopEntriesFromNexus(operation, params, startTime, db, limit) {
22402
22457
  let rows = [];
22403
22458
  try {
22404
22459
  const sql = kind === null ? `SELECT r.source_id,
22405
- SUM(COALESCE(r.weight, 0)) AS totalWeight,
22460
+ SUM(COALESCE(w.weight, 0)) AS totalWeight,
22406
22461
  COUNT(*) AS edgeCount,
22407
22462
  n.label,
22408
22463
  n.kind,
22409
22464
  n.file_path
22410
22465
  FROM nexus_relations r
22466
+ LEFT JOIN nexus_relation_weights w ON w.relation_id = r.id
22411
22467
  LEFT JOIN nexus_nodes n ON n.id = r.source_id
22412
22468
  GROUP BY r.source_id
22413
22469
  ORDER BY totalWeight DESC, edgeCount DESC
22414
22470
  LIMIT ?` : `SELECT r.source_id,
22415
- SUM(COALESCE(r.weight, 0)) AS totalWeight,
22471
+ SUM(COALESCE(w.weight, 0)) AS totalWeight,
22416
22472
  COUNT(*) AS edgeCount,
22417
22473
  n.label,
22418
22474
  n.kind,
22419
22475
  n.file_path
22420
22476
  FROM nexus_relations r
22477
+ LEFT JOIN nexus_relation_weights w ON w.relation_id = r.id
22421
22478
  LEFT JOIN nexus_nodes n ON n.id = r.source_id
22422
22479
  WHERE n.kind = ?
22423
22480
  GROUP BY r.source_id
@@ -22514,11 +22571,10 @@ async function handleImpact(operation, params, startTime) {
22514
22571
  let allNodes = [];
22515
22572
  try {
22516
22573
  const rawRows = db.prepare(
22517
- `SELECT id, label, kind, file_path, name, project_id
22574
+ `SELECT id, label, kind, file_path, name
22518
22575
  FROM nexus_nodes
22519
- WHERE project_id = ?
22520
- AND kind NOT IN ('community','process','file','folder')`
22521
- ).all(projectId);
22576
+ WHERE kind NOT IN ('community','process','file','folder')`
22577
+ ).all();
22522
22578
  allNodes = rawRows.map((raw) => {
22523
22579
  const r = raw;
22524
22580
  return {
@@ -22526,8 +22582,7 @@ async function handleImpact(operation, params, startTime) {
22526
22582
  label: r["label"] != null ? String(r["label"]) : null,
22527
22583
  kind: r["kind"] != null ? String(r["kind"]) : null,
22528
22584
  file_path: r["file_path"] != null ? String(r["file_path"]) : null,
22529
- name: r["name"] != null ? String(r["name"]) : null,
22530
- project_id: String(r["project_id"] ?? "")
22585
+ name: r["name"] != null ? String(r["name"]) : null
22531
22586
  };
22532
22587
  });
22533
22588
  } catch {
@@ -22572,11 +22627,11 @@ async function handleImpact(operation, params, startTime) {
22572
22627
  let allRelations = [];
22573
22628
  try {
22574
22629
  const rawRows = db.prepare(
22575
- `SELECT source_id, target_id, type, weight
22576
- FROM nexus_relations
22577
- WHERE project_id = ?
22578
- AND type IN ('calls','imports','accesses')`
22579
- ).all(projectId);
22630
+ `SELECT r.source_id AS source_id, r.target_id AS target_id, r.type AS type, w.weight AS weight
22631
+ FROM nexus_relations r
22632
+ LEFT JOIN nexus_relation_weights w ON w.relation_id = r.id
22633
+ WHERE r.type IN ('calls','imports','accesses')`
22634
+ ).all();
22580
22635
  allRelations = rawRows.map((raw) => {
22581
22636
  const r = raw;
22582
22637
  return {
@@ -28118,37 +28173,44 @@ async function acquireDb() {
28118
28173
  async function buildDefaultDispatcher() {
28119
28174
  if (__playbookRuntimeOverrides.dispatcher) return __playbookRuntimeOverrides.dispatcher;
28120
28175
  const { orchestrateSpawnExecute: orchestrateSpawnExecute2 } = await import("@cleocode/runtime/gateway");
28121
- const { getProjectRoot: getProjectRoot58 } = await import("@cleocode/core/internal");
28176
+ const { getProjectRoot: getProjectRoot58, createToolGuard, runSkillNodeOrSpawn } = await import("@cleocode/core/internal");
28122
28177
  const projectRoot = getProjectRoot58();
28178
+ const tools = createToolGuard({ allowedRoots: [projectRoot] });
28179
+ const spawn5 = async (input2) => {
28180
+ const result = await orchestrateSpawnExecute2(
28181
+ input2.taskId,
28182
+ /* adapterId */
28183
+ void 0,
28184
+ /* protocolType */
28185
+ void 0,
28186
+ projectRoot,
28187
+ /* tier */
28188
+ void 0
28189
+ );
28190
+ if (result.success) {
28191
+ return {
28192
+ status: "success",
28193
+ output: {
28194
+ [`${input2.nodeId}_spawn`]: true,
28195
+ nodeId: input2.nodeId,
28196
+ agentId: input2.agentId,
28197
+ dispatchData: result.data ?? null
28198
+ }
28199
+ };
28200
+ }
28201
+ return {
28202
+ status: "failure",
28203
+ output: {},
28204
+ error: result.error?.message ?? `spawn failed for ${input2.agentId}`
28205
+ };
28206
+ };
28123
28207
  return {
28124
28208
  async dispatch(input2) {
28125
28209
  try {
28126
- const result = await orchestrateSpawnExecute2(
28127
- input2.taskId,
28128
- /* adapterId */
28129
- void 0,
28130
- /* protocolType */
28131
- void 0,
28132
- projectRoot,
28133
- /* tier */
28134
- void 0
28210
+ return await runSkillNodeOrSpawn(
28211
+ { nodeId: input2.nodeId, agentId: input2.agentId, context: input2.context },
28212
+ { tools, cwd: projectRoot, subprocessSpawn: () => spawn5(input2) }
28135
28213
  );
28136
- if (result.success) {
28137
- return {
28138
- status: "success",
28139
- output: {
28140
- [`${input2.nodeId}_spawn`]: true,
28141
- nodeId: input2.nodeId,
28142
- agentId: input2.agentId,
28143
- dispatchData: result.data ?? null
28144
- }
28145
- };
28146
- }
28147
- return {
28148
- status: "failure",
28149
- output: {},
28150
- error: result.error?.message ?? `spawn failed for ${input2.agentId}`
28151
- };
28152
28214
  } catch (err) {
28153
28215
  return {
28154
28216
  status: "failure",
@@ -32604,7 +32666,9 @@ var init_tasks3 = __esm({
32604
32666
  acknowledgeRisk: params.acknowledgeRisk,
32605
32667
  // T10509 — AC-coverage gate waiver path
32606
32668
  waiveAc: params.waiveAc,
32607
- waiveReason: params.waiveReason
32669
+ waiveReason: params.waiveReason,
32670
+ // T10538 — cancelled-child waiver (PM-Core V2 agent-trust)
32671
+ cancelledChildWaiverReason: params.cancelledChildWaiverReason
32608
32672
  });
32609
32673
  setImmediate(async () => {
32610
32674
  try {
@@ -32784,6 +32848,10 @@ var init_tasks3 = __esm({
32784
32848
  "reparent",
32785
32849
  "reorder",
32786
32850
  "relates.add",
32851
+ // T11575 — without this entry the domain mutate() gate rejects the op with
32852
+ // E_INVALID_OPERATION even though the handler exists below. Mirrors the
32853
+ // OperationDef registered in @cleocode/contracts operations-registry.
32854
+ "relates.add-batch",
32787
32855
  "relates.remove",
32788
32856
  "start",
32789
32857
  "stop",
@@ -36902,7 +36970,7 @@ var init_agent = __esm({
36902
36970
  async run({ args }) {
36903
36971
  try {
36904
36972
  const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
36905
- await openCleoDb("tasks");
36973
+ await openCleoDb("project");
36906
36974
  const registry = new AgentRegistryAccessor(getProjectRoot24());
36907
36975
  const agentId = args.id;
36908
36976
  const displayName = args.name;
@@ -37019,7 +37087,7 @@ agent ${agentId}:
37019
37087
  async run({ args }) {
37020
37088
  try {
37021
37089
  const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
37022
- await openCleoDb("tasks");
37090
+ await openCleoDb("project");
37023
37091
  const registry = new AgentRegistryAccessor(getProjectRoot24());
37024
37092
  const credential = await registry.get(args.agentId);
37025
37093
  if (!credential) {
@@ -37106,7 +37174,7 @@ agent ${agentId}:
37106
37174
  const { createRuntime } = await import("@cleocode/runtime");
37107
37175
  const { existsSync: existsSync21, readFileSync: readFileSync22 } = await import("node:fs");
37108
37176
  const { join: join38 } = await import("node:path");
37109
- await openCleoDb("tasks");
37177
+ await openCleoDb("project");
37110
37178
  const registry = new AgentRegistryAccessor(getProjectRoot24());
37111
37179
  const credential = await registry.get(args.agentId);
37112
37180
  if (!credential) {
@@ -37224,7 +37292,7 @@ agent ${agentId}:
37224
37292
  async run({ args }) {
37225
37293
  try {
37226
37294
  const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
37227
- await openCleoDb("tasks");
37295
+ await openCleoDb("project");
37228
37296
  const registry = new AgentRegistryAccessor(getProjectRoot24());
37229
37297
  const credential = await registry.get(args.agentId);
37230
37298
  if (!credential) {
@@ -37280,7 +37348,7 @@ agent ${agentId}:
37280
37348
  async run({ args }) {
37281
37349
  try {
37282
37350
  const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
37283
- await openCleoDb("tasks");
37351
+ await openCleoDb("project");
37284
37352
  const registry = new AgentRegistryAccessor(getProjectRoot24());
37285
37353
  if (args.agentId) {
37286
37354
  const credential = await registry.get(args.agentId);
@@ -37355,7 +37423,7 @@ agent ${agentId}:
37355
37423
  async run({ args }) {
37356
37424
  try {
37357
37425
  const { AgentRegistryAccessor, createConduit } = await import("@cleocode/core/agents");
37358
- await openCleoDb("tasks");
37426
+ await openCleoDb("project");
37359
37427
  const registry = new AgentRegistryAccessor(getProjectRoot24());
37360
37428
  const active = await registry.getActive();
37361
37429
  if (!active) {
@@ -37411,7 +37479,7 @@ Assigned task ${args.taskId}. Run: cleo show ${args.taskId} && cleo start ${args
37411
37479
  async run({ args }) {
37412
37480
  try {
37413
37481
  const { AgentRegistryAccessor, createConduit } = await import("@cleocode/core/agents");
37414
- await openCleoDb("tasks");
37482
+ await openCleoDb("project");
37415
37483
  const registry = new AgentRegistryAccessor(getProjectRoot24());
37416
37484
  const active = await registry.getActive();
37417
37485
  if (!active) {
@@ -37476,7 +37544,7 @@ You are idle. Check your queue: cleo current || cleo next. Report status immedia
37476
37544
  async run({ args }) {
37477
37545
  try {
37478
37546
  const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
37479
- await openCleoDb("tasks");
37547
+ await openCleoDb("project");
37480
37548
  const registry = new AgentRegistryAccessor(getProjectRoot24());
37481
37549
  const role = args.role;
37482
37550
  const taskId = args.task;
@@ -37540,7 +37608,7 @@ You are idle. Check your queue: cleo current || cleo next. Report status immedia
37540
37608
  async run({ args }) {
37541
37609
  try {
37542
37610
  const { AgentRegistryAccessor, createConduit } = await import("@cleocode/core/agents");
37543
- await openCleoDb("tasks");
37611
+ await openCleoDb("project");
37544
37612
  const registry = new AgentRegistryAccessor(getProjectRoot24());
37545
37613
  const active = await registry.getActive();
37546
37614
  if (!active) {
@@ -37583,7 +37651,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
37583
37651
  async run() {
37584
37652
  try {
37585
37653
  const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
37586
- await openCleoDb("tasks");
37654
+ await openCleoDb("project");
37587
37655
  const registry = new AgentRegistryAccessor(getProjectRoot24());
37588
37656
  const agents = await registry.list({ active: true });
37589
37657
  let stopped = 0;
@@ -37652,7 +37720,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
37652
37720
  const { createRuntime } = await import("@cleocode/runtime");
37653
37721
  const { existsSync: existsSync21 } = await import("node:fs");
37654
37722
  const { join: join38 } = await import("node:path");
37655
- await openCleoDb("tasks");
37723
+ await openCleoDb("project");
37656
37724
  const registry = new AgentRegistryAccessor(getProjectRoot24());
37657
37725
  const credential = await registry.get(args.agentId);
37658
37726
  if (!credential) {
@@ -37754,27 +37822,24 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
37754
37822
  async run({ args }) {
37755
37823
  try {
37756
37824
  const { listAgentsForProject } = await import("@cleocode/core/agents");
37757
- await openCleoDb("tasks");
37825
+ await openCleoDb("project");
37758
37826
  const includeGlobal = args.global === true;
37759
37827
  const includeDisabled = args["include-disabled"] === true;
37760
- const agents = listAgentsForProject(getProjectRoot24(), {
37828
+ const agents = await listAgentsForProject(getProjectRoot24(), {
37761
37829
  includeGlobal,
37762
37830
  includeDisabled
37763
37831
  });
37764
37832
  const filtered = !includeGlobal && args.active ? agents.filter((a) => a.isActive) : agents;
37765
37833
  cliOutput(
37766
- {
37767
- success: true,
37768
- data: filtered.map((a) => ({
37769
- agentId: a.agentId,
37770
- name: a.displayName,
37771
- classification: a.classification ?? null,
37772
- transportType: a.transportType,
37773
- isActive: a.isActive,
37774
- lastUsedAt: a.lastUsedAt ?? null,
37775
- attachment: a.projectRef ? a.projectRef.enabled === 1 ? "[attached]" : "[disabled]" : "[global]"
37776
- }))
37777
- },
37834
+ filtered.map((a) => ({
37835
+ agentId: a.agentId,
37836
+ name: a.displayName,
37837
+ classification: a.classification ?? null,
37838
+ transportType: a.transportType,
37839
+ isActive: a.isActive,
37840
+ lastUsedAt: a.lastUsedAt ?? null,
37841
+ attachment: a.projectRef ? a.projectRef.enabled === 1 ? "[attached]" : "[disabled]" : "[global]"
37842
+ })),
37778
37843
  { command: "agent list" }
37779
37844
  );
37780
37845
  } catch (err) {
@@ -37805,9 +37870,9 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
37805
37870
  async run({ args }) {
37806
37871
  try {
37807
37872
  const { lookupAgent } = await import("@cleocode/core/agents");
37808
- await openCleoDb("tasks");
37873
+ await openCleoDb("project");
37809
37874
  const includeGlobal = args.global === true;
37810
- const agent = lookupAgent(getProjectRoot24(), args.agentId, { includeGlobal });
37875
+ const agent = await lookupAgent(getProjectRoot24(), args.agentId, { includeGlobal });
37811
37876
  if (!agent) {
37812
37877
  cliOutput(
37813
37878
  {
@@ -37871,11 +37936,11 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
37871
37936
  async run({ args }) {
37872
37937
  try {
37873
37938
  const { AgentRegistryAccessor, attachAgentToProject, lookupAgent } = await import("@cleocode/core/agents");
37874
- await openCleoDb("tasks");
37939
+ await openCleoDb("project");
37875
37940
  const projectRoot = getProjectRoot24();
37876
37941
  const _registry = new AgentRegistryAccessor(projectRoot);
37877
37942
  void _registry;
37878
- const globalAgent = lookupAgent(projectRoot, args.agentId, { includeGlobal: true });
37943
+ const globalAgent = await lookupAgent(projectRoot, args.agentId, { includeGlobal: true });
37879
37944
  if (!globalAgent) {
37880
37945
  cliOutput(
37881
37946
  {
@@ -37926,7 +37991,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
37926
37991
  async run({ args }) {
37927
37992
  try {
37928
37993
  const { AgentRegistryAccessor, detachAgentFromProject, getProjectAgentRef } = await import("@cleocode/core/agents");
37929
- await openCleoDb("tasks");
37994
+ await openCleoDb("project");
37930
37995
  const projectRoot = getProjectRoot24();
37931
37996
  const _registry = new AgentRegistryAccessor(projectRoot);
37932
37997
  void _registry;
@@ -37982,7 +38047,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
37982
38047
  async run({ args }) {
37983
38048
  try {
37984
38049
  const { AgentRegistryAccessor, detachAgentFromProject, getProjectAgentRef } = await import("@cleocode/core/agents");
37985
- await openCleoDb("tasks");
38050
+ await openCleoDb("project");
37986
38051
  const projectRoot = getProjectRoot24();
37987
38052
  if (!args.global) {
37988
38053
  const _registry = new AgentRegistryAccessor(projectRoot);
@@ -38063,7 +38128,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
38063
38128
  async run({ args }) {
38064
38129
  try {
38065
38130
  const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
38066
- await openCleoDb("tasks");
38131
+ await openCleoDb("project");
38067
38132
  const registry = new AgentRegistryAccessor(getProjectRoot24());
38068
38133
  const result = await registry.rotateKey(args.agentId);
38069
38134
  cliOutput(
@@ -38101,7 +38166,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
38101
38166
  async run({ args }) {
38102
38167
  try {
38103
38168
  const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
38104
- await openCleoDb("tasks");
38169
+ await openCleoDb("project");
38105
38170
  const registry = new AgentRegistryAccessor(getProjectRoot24());
38106
38171
  const credential = await registry.get(args.agentId);
38107
38172
  if (!credential) {
@@ -38175,7 +38240,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
38175
38240
  try {
38176
38241
  const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
38177
38242
  const { createRuntime } = await import("@cleocode/runtime");
38178
- await openCleoDb("tasks");
38243
+ await openCleoDb("project");
38179
38244
  const registry = new AgentRegistryAccessor(getProjectRoot24());
38180
38245
  const groupIds = args.group ? args.group.split(",").map((s) => s.trim()) : void 0;
38181
38246
  const handle = await createRuntime(registry, {
@@ -38257,7 +38322,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
38257
38322
  async run({ args }) {
38258
38323
  try {
38259
38324
  const { AgentRegistryAccessor, createConduit } = await import("@cleocode/core/agents");
38260
- await openCleoDb("tasks");
38325
+ await openCleoDb("project");
38261
38326
  const registry = new AgentRegistryAccessor(getProjectRoot24());
38262
38327
  const agentId = args.agent;
38263
38328
  const conduit = await createConduit(registry, agentId);
@@ -38308,7 +38373,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
38308
38373
  async run({ args }) {
38309
38374
  try {
38310
38375
  const { AgentRegistryAccessor, createConduit } = await import("@cleocode/core/agents");
38311
- await openCleoDb("tasks");
38376
+ await openCleoDb("project");
38312
38377
  const registry = new AgentRegistryAccessor(getProjectRoot24());
38313
38378
  const agentId = args.agent;
38314
38379
  const to = args.to;
@@ -38497,9 +38562,9 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
38497
38562
  const { cantPath, tempDir: resolvedTempDir } = resolved;
38498
38563
  tempDir = resolvedTempDir;
38499
38564
  const { installAgentFromCant: installAgentFromCant2, attachAgentToProject } = await import("@cleocode/core/agents");
38500
- const { openCleoDb: openCleoDb3 } = await import("@cleocode/core/store/open-cleo-db");
38501
- const { db: _sdDb } = await openCleoDb3("signaldock");
38502
- const db = _sdDb;
38565
+ const { ensureGlobalAgentRegistryDb: ensureGlobalAgentRegistryDb2, getGlobalAgentRegistryNativeDb: getGlobalAgentRegistryNativeDb2 } = await import("@cleocode/core/internal");
38566
+ await ensureGlobalAgentRegistryDb2();
38567
+ const db = getGlobalAgentRegistryNativeDb2();
38503
38568
  const isGlobal = args.global === true;
38504
38569
  const targetTier = isGlobal ? "global" : "project";
38505
38570
  const projectRoot = getProjectRoot24();
@@ -38840,7 +38905,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
38840
38905
  let registered = false;
38841
38906
  try {
38842
38907
  const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
38843
- await openCleoDb("tasks");
38908
+ await openCleoDb("project");
38844
38909
  const registry = new AgentRegistryAccessor(getProjectRoot24());
38845
38910
  const existing = await registry.get(name);
38846
38911
  if (!existing) {
@@ -38978,9 +39043,9 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
38978
39043
  async run({ args }) {
38979
39044
  try {
38980
39045
  const { buildDoctorReport, reconcileDoctor } = await import("@cleocode/core/agents");
38981
- const { openCleoDb: openCleoDb3 } = await import("@cleocode/core/store/open-cleo-db");
38982
- const { db: _sdDb2 } = await openCleoDb3("signaldock");
38983
- const db = _sdDb2;
39046
+ const { ensureGlobalAgentRegistryDb: ensureGlobalAgentRegistryDb2, getGlobalAgentRegistryNativeDb: getGlobalAgentRegistryNativeDb2 } = await import("@cleocode/core/internal");
39047
+ await ensureGlobalAgentRegistryDb2();
39048
+ const db = getGlobalAgentRegistryNativeDb2();
38984
39049
  try {
38985
39050
  const report = await buildDoctorReport(db, {});
38986
39051
  const d002 = report.findings.filter((f) => f.code === "D-002");
@@ -39044,9 +39109,9 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
39044
39109
  async run({ args }) {
39045
39110
  try {
39046
39111
  const { buildDoctorReport, reconcileDoctor } = await import("@cleocode/core/agents");
39047
- const { openCleoDb: openCleoDb3 } = await import("@cleocode/core/store/open-cleo-db");
39048
- const { db: _sdDb3 } = await openCleoDb3("signaldock");
39049
- const db = _sdDb3;
39112
+ const { ensureGlobalAgentRegistryDb: ensureGlobalAgentRegistryDb2, getGlobalAgentRegistryNativeDb: getGlobalAgentRegistryNativeDb2 } = await import("@cleocode/core/internal");
39113
+ await ensureGlobalAgentRegistryDb2();
39114
+ const db = getGlobalAgentRegistryNativeDb2();
39050
39115
  try {
39051
39116
  const report = await buildDoctorReport(db, { projectRoot: getProjectRoot24() });
39052
39117
  const repairFlag = args.repair === true;
@@ -43587,6 +43652,11 @@ var init_complete = __esm({
43587
43652
  "waive-reason": {
43588
43653
  type: "string",
43589
43654
  description: "Mandatory justification text for --waive-ac. Captured verbatim in the audit row."
43655
+ },
43656
+ // T10538 — cancelled-child waiver gate (PM-Core V2 agent-trust)
43657
+ "waive-cancelled-children": {
43658
+ type: "string",
43659
+ description: "Reason for completing a parent that has cancelled children. Cancelled work does not silently satisfy completion; the reason is audited to .cleo/audit/cancelled-child-waiver.jsonl."
43590
43660
  }
43591
43661
  },
43592
43662
  async run({ args }) {
@@ -43599,7 +43669,9 @@ var init_complete = __esm({
43599
43669
  overrideReason: args["override-reason"],
43600
43670
  // T10509 — AC-coverage gate waiver path
43601
43671
  waiveAc: args["waive-ac"],
43602
- waiveReason: args["waive-reason"]
43672
+ waiveReason: args["waive-reason"],
43673
+ // T10538 — cancelled-child waiver (PM-Core V2 agent-trust)
43674
+ cancelledChildWaiverReason: args["waive-cancelled-children"]
43603
43675
  });
43604
43676
  if (!response.success) {
43605
43677
  handleRawError(response, { command: "complete", operation: "tasks.complete" });
@@ -50624,8 +50696,12 @@ __export(migrate_agents_v2_exports, {
50624
50696
  import { createHash as createHash2 } from "node:crypto";
50625
50697
  import { appendFileSync as appendFileSync2, existsSync as existsSync14, mkdirSync as mkdirSync3, readdirSync as readdirSync2, readFileSync as readFileSync13 } from "node:fs";
50626
50698
  import { join as join23 } from "node:path";
50627
- import { getProjectRoot as getProjectRoot41, installAgentFromCant } from "@cleocode/core/internal";
50628
- import { openCleoDb as openCleoDb2 } from "@cleocode/core/store/open-cleo-db";
50699
+ import {
50700
+ ensureGlobalAgentRegistryDb,
50701
+ getGlobalAgentRegistryNativeDb,
50702
+ getProjectRoot as getProjectRoot41,
50703
+ installAgentFromCant
50704
+ } from "@cleocode/core/internal";
50629
50705
  function sha256Hex(bytes) {
50630
50706
  return createHash2("sha256").update(bytes).digest("hex");
50631
50707
  }
@@ -50689,7 +50765,7 @@ function walkAgentsDir(db, scanDir, projectRoot, summary, verbose) {
50689
50765
  summary.errors++;
50690
50766
  continue;
50691
50767
  }
50692
- const existingRow = db.prepare("SELECT cant_sha256 FROM agents WHERE agent_id = ?").get(agentName);
50768
+ const existingRow = db.prepare("SELECT cant_sha256 FROM agent_registry_agents WHERE agent_id = ?").get(agentName);
50693
50769
  if (existingRow) {
50694
50770
  const existingSha256 = existingRow.cant_sha256 ?? "";
50695
50771
  if (existingSha256 === newSha256) {
@@ -50756,8 +50832,8 @@ function walkAgentsDir(db, scanDir, projectRoot, summary, verbose) {
50756
50832
  }
50757
50833
  async function runMigrateAgentsV2(projectRoot, verbose = true) {
50758
50834
  const summary = { registered: 0, skipped: 0, conflicts: 0, errors: 0 };
50759
- const { db: _sdDb } = await openCleoDb2("signaldock");
50760
- const db = _sdDb;
50835
+ await ensureGlobalAgentRegistryDb();
50836
+ const db = getGlobalAgentRegistryNativeDb();
50761
50837
  try {
50762
50838
  const canonicalDir = join23(projectRoot, ".cleo", "cant", "agents");
50763
50839
  walkAgentsDir(db, canonicalDir, projectRoot, summary, verbose);
@@ -52828,10 +52904,40 @@ var init_format_bytes = __esm({
52828
52904
  }
52829
52905
  });
52830
52906
 
52907
+ // packages/utils/src/redact.ts
52908
+ var ANTHROPIC_KEY_RE, OPENAI_KEY_RE, GENERIC_SK_RE, SLACK_BOT_RE, JWT_RE, BEARER_RE, HEX_SECRET_RE, JSON_PASSWORD_RE, ENV_ASSIGNMENT_RE, SECRET_PATH_RE, SIMPLE_PATTERNS, ALL_PATTERNS;
52909
+ var init_redact = __esm({
52910
+ "packages/utils/src/redact.ts"() {
52911
+ "use strict";
52912
+ ANTHROPIC_KEY_RE = /\bsk-ant-[A-Za-z0-9_-]{20,}\b/g;
52913
+ OPENAI_KEY_RE = /\bsk-(?:proj|svcacct|admin)-[A-Za-z0-9_-]{20,}\b|\bsk-[A-Za-z0-9]{32,}\b/g;
52914
+ GENERIC_SK_RE = /\bsk-[A-Za-z0-9_-]{20,}\b/g;
52915
+ SLACK_BOT_RE = /\bxoxb-[A-Za-z0-9_-]+\b/g;
52916
+ JWT_RE = /\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g;
52917
+ BEARER_RE = /\bBearer\s+[A-Za-z0-9._~+/-]+=*/gi;
52918
+ HEX_SECRET_RE = /\b(?:key|token|secret|password|passwd|pwd)=([0-9a-f]{32,})\b/gi;
52919
+ JSON_PASSWORD_RE = /"(?:password|passwd|secret|token|apiKey|api_key|authToken|auth_token)"\s*:\s*"[^"]{4,}"/gi;
52920
+ ENV_ASSIGNMENT_RE = /\b(ANTHROPIC_API_KEY|OPENAI_API_KEY|GITHUB_TOKEN|NPM_TOKEN|AWS_(?:SECRET_)?ACCESS_KEY(?:_ID)?|GCP_(?:SERVICE_ACCOUNT_)?KEY|AZURE_(?:CLIENT_SECRET|ACCESS_KEY)|DATABASE_URL|REDIS_URL|SECRET(?:_KEY)?|API_(?:KEY|TOKEN|SECRET)|AUTH_(?:TOKEN|SECRET)|PRIVATE_KEY|ACCESS_(?:TOKEN|KEY)|BEARER_TOKEN|JWT_SECRET|ENCRYPTION_KEY|SIGNING_KEY|WEBHOOK_SECRET)(\s*=\s*)['"]?[^\s'"]{8,}['"]?/gi;
52921
+ SECRET_PATH_RE = /(?:(?:~|\/)[^\s'"]*\/)?(?:\.env(?:\.[A-Za-z0-9._-]+)?|id_rsa(?:_[A-Za-z0-9_-]*)?|[A-Za-z0-9_-]+\.(?:pem|key|p8|p12|pfx|jks|keystore))(?=[\s'"$]|$)/gi;
52922
+ SIMPLE_PATTERNS = [
52923
+ ANTHROPIC_KEY_RE,
52924
+ OPENAI_KEY_RE,
52925
+ GENERIC_SK_RE,
52926
+ SLACK_BOT_RE,
52927
+ JWT_RE,
52928
+ BEARER_RE,
52929
+ HEX_SECRET_RE,
52930
+ JSON_PASSWORD_RE
52931
+ ];
52932
+ ALL_PATTERNS = [...SIMPLE_PATTERNS, ENV_ASSIGNMENT_RE, SECRET_PATH_RE];
52933
+ }
52934
+ });
52935
+
52831
52936
  // packages/utils/src/index.ts
52832
52937
  var init_src4 = __esm({
52833
52938
  "packages/utils/src/index.ts"() {
52834
52939
  init_format_bytes();
52940
+ init_redact();
52835
52941
  }
52836
52942
  });
52837
52943
 
@@ -75907,6 +76013,9 @@ async function runMainWithLafsEnvelope(cmd, rawArgs, showUsage2) {
75907
76013
  const message = err instanceof Error ? err.message : String(err);
75908
76014
  cliError2(message, 1, { name: "E_CLI_UNCAUGHT" });
75909
76015
  process.exit(1);
76016
+ } finally {
76017
+ const { shutdownCliRuntime } = await import("@cleocode/core/internal");
76018
+ await shutdownCliRuntime();
75910
76019
  }
75911
76020
  });
75912
76021
  }
@@ -75947,7 +76056,7 @@ async function runStartupMaintenance() {
75947
76056
  try {
75948
76057
  const _projectRootForMigration = getProjectRoot58();
75949
76058
  if (needsSignaldockToConduitMigration(_projectRootForMigration)) {
75950
- const migrationResult = migrateSignaldockToConduit(_projectRootForMigration);
76059
+ const migrationResult = await migrateSignaldockToConduit(_projectRootForMigration);
75951
76060
  if (migrationResult.status === "failed") {
75952
76061
  _startupLog.error(
75953
76062
  { errors: migrationResult.errors, projectRoot: _projectRootForMigration },