@cleocode/cleo 2026.5.96 → 2026.5.98

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
@@ -1591,6 +1591,13 @@ var init_credentials = __esm({
1591
1591
  }
1592
1592
  });
1593
1593
 
1594
+ // packages/contracts/src/dispatch/identity.ts
1595
+ var init_identity = __esm({
1596
+ "packages/contracts/src/dispatch/identity.ts"() {
1597
+ "use strict";
1598
+ }
1599
+ });
1600
+
1594
1601
  // packages/contracts/src/docs-taxonomy.ts
1595
1602
  import { readFileSync } from "node:fs";
1596
1603
  import { join } from "node:path";
@@ -1982,6 +1989,13 @@ var init_engine_result = __esm({
1982
1989
  }
1983
1990
  });
1984
1991
 
1992
+ // packages/contracts/src/enums.ts
1993
+ var init_enums = __esm({
1994
+ "packages/contracts/src/enums.ts"() {
1995
+ "use strict";
1996
+ }
1997
+ });
1998
+
1985
1999
  // packages/contracts/src/exit-codes.ts
1986
2000
  var ExitCode;
1987
2001
  var init_exit_codes = __esm({
@@ -2198,6 +2212,13 @@ var init_plugin_llm = __esm({
2198
2212
  }
2199
2213
  });
2200
2214
 
2215
+ // packages/contracts/src/memory/observe.ts
2216
+ var init_observe = __esm({
2217
+ "packages/contracts/src/memory/observe.ts"() {
2218
+ "use strict";
2219
+ }
2220
+ });
2221
+
2201
2222
  // packages/contracts/src/operations/admin.ts
2202
2223
  var init_admin = __esm({
2203
2224
  "packages/contracts/src/operations/admin.ts"() {
@@ -2234,6 +2255,13 @@ var init_docs = __esm({
2234
2255
  }
2235
2256
  });
2236
2257
 
2258
+ // packages/contracts/src/operations/focus.ts
2259
+ var init_focus = __esm({
2260
+ "packages/contracts/src/operations/focus.ts"() {
2261
+ "use strict";
2262
+ }
2263
+ });
2264
+
2237
2265
  // packages/contracts/src/operations/intelligence.ts
2238
2266
  var init_intelligence = __esm({
2239
2267
  "packages/contracts/src/operations/intelligence.ts"() {
@@ -2424,6 +2452,7 @@ var init_operations = __esm({
2424
2452
  init_conduit();
2425
2453
  init_dialectic();
2426
2454
  init_docs();
2455
+ init_focus();
2427
2456
  init_intelligence();
2428
2457
  init_issues();
2429
2458
  init_lifecycle();
@@ -3387,8 +3416,10 @@ var init_src2 = __esm({
3387
3416
  init_changesets();
3388
3417
  init_cli_category();
3389
3418
  init_credentials();
3419
+ init_identity();
3390
3420
  init_docs_taxonomy();
3391
3421
  init_engine_result();
3422
+ init_enums();
3392
3423
  init_errors();
3393
3424
  init_evidence_record_schema();
3394
3425
  init_exit_codes();
@@ -3396,6 +3427,7 @@ var init_src2 = __esm({
3396
3427
  init_graph();
3397
3428
  init_lafs();
3398
3429
  init_plugin_llm();
3430
+ init_observe();
3399
3431
  init_operations();
3400
3432
  init_nexus_scope_map();
3401
3433
  init_params();
@@ -8682,6 +8714,25 @@ var init_registry = __esm({
8682
8714
  requiredParams: [],
8683
8715
  params: []
8684
8716
  },
8717
+ // T9975 — per-agent session isolation: adopt rebinds env to a specific session.
8718
+ {
8719
+ gateway: "mutate",
8720
+ domain: "session",
8721
+ operation: "adopt",
8722
+ description: "session.adopt \u2014 rebind env to a specific session for multi-agent isolation (T9975)",
8723
+ tier: 0,
8724
+ idempotent: true,
8725
+ sessionRequired: false,
8726
+ requiredParams: [],
8727
+ params: [
8728
+ {
8729
+ name: "sessionId",
8730
+ type: "string",
8731
+ required: true,
8732
+ description: "Session ID to adopt"
8733
+ }
8734
+ ]
8735
+ },
8685
8736
  // session.context.inject moved to admin.context.inject (T5615)
8686
8737
  {
8687
8738
  gateway: "mutate",
@@ -13628,6 +13679,102 @@ var init_registry = __esm({
13628
13679
  description: "Task ID whose worktree (branch task/T<id>) to unlock"
13629
13680
  }
13630
13681
  ]
13682
+ },
13683
+ // T9804 — Claude Code Agent isolation:worktree bridge (adopt)
13684
+ {
13685
+ gateway: "mutate",
13686
+ domain: "worktree",
13687
+ operation: "adopt",
13688
+ description: "worktree.adopt (mutate) \u2014 register an externally-created worktree (e.g. Claude Code Agent isolation:worktree) in the CLEO SSoT. Writes to .cleo/worktrees.json sentinel index and appends audit entry (T9804).",
13689
+ tier: 1,
13690
+ idempotent: true,
13691
+ sessionRequired: false,
13692
+ requiredParams: ["worktreePath"],
13693
+ params: [
13694
+ {
13695
+ name: "worktreePath",
13696
+ type: "string",
13697
+ required: true,
13698
+ description: "Absolute or relative path to the worktree directory to adopt"
13699
+ },
13700
+ {
13701
+ name: "source",
13702
+ type: "string",
13703
+ required: false,
13704
+ description: "Source classification (claude-agent | manual | adopted). Inferred from path when omitted."
13705
+ },
13706
+ {
13707
+ name: "taskId",
13708
+ type: "string",
13709
+ required: false,
13710
+ description: "Task ID to associate with this worktree. Extracted from branch name when omitted."
13711
+ },
13712
+ {
13713
+ name: "actor",
13714
+ type: "string",
13715
+ required: false,
13716
+ description: "Override actor name written to the audit log."
13717
+ }
13718
+ ]
13719
+ },
13720
+ // T9805 — Explicit single-worktree destruction with sentinel + audit update
13721
+ {
13722
+ gateway: "mutate",
13723
+ domain: "worktree",
13724
+ operation: "destroy",
13725
+ description: "worktree.destroy (mutate) \u2014 explicitly destroy the XDG worktree for a task, remove its sentinel index entry, and append an audit-log row to .cleo/audit/worktree-lifecycle.jsonl (T9805 AC1).",
13726
+ tier: 1,
13727
+ idempotent: true,
13728
+ sessionRequired: false,
13729
+ requiredParams: ["taskId"],
13730
+ params: [
13731
+ {
13732
+ name: "taskId",
13733
+ type: "string",
13734
+ required: true,
13735
+ description: "Task ID whose XDG worktree should be destroyed (e.g. T9805).",
13736
+ cli: { positional: true }
13737
+ },
13738
+ {
13739
+ name: "force",
13740
+ type: "boolean",
13741
+ required: false,
13742
+ description: "Force removal even when the worktree has uncommitted changes. Default: false."
13743
+ },
13744
+ {
13745
+ name: "deleteBranch",
13746
+ type: "boolean",
13747
+ required: false,
13748
+ description: "Delete the task branch (task/T<id>) after removing the worktree. Default: true."
13749
+ },
13750
+ {
13751
+ name: "reason",
13752
+ type: "string",
13753
+ required: false,
13754
+ description: "Free-form reason recorded in the audit log (e.g. pr-merged, manual, idle-timeout). Default: manual."
13755
+ }
13756
+ ]
13757
+ },
13758
+ // ---------------------------------------------------------------------------
13759
+ // T9973 — focus domain: single-envelope task orientation (8 calls → 1)
13760
+ // ---------------------------------------------------------------------------
13761
+ {
13762
+ gateway: "query",
13763
+ domain: "focus",
13764
+ operation: "show",
13765
+ description: "focus.show (query) \u2014 single-envelope orientation for a task, epic, or saga. Aggregates identity + scope + members + blockers + readyWave + attachedDocs + recentActivity + brainContext into \u2264 1 500 tokens.",
13766
+ tier: 0,
13767
+ idempotent: true,
13768
+ sessionRequired: false,
13769
+ requiredParams: ["id"],
13770
+ params: [
13771
+ {
13772
+ name: "id",
13773
+ type: "string",
13774
+ required: true,
13775
+ description: "Task, Epic, or Saga ID to orient on (e.g. T9973, T9831)"
13776
+ }
13777
+ ]
13631
13778
  }
13632
13779
  ];
13633
13780
  counts = getCounts();
@@ -13989,6 +14136,7 @@ __export(engine_exports, {
13989
14136
  releaseRollbackFull: () => releaseRollbackFull,
13990
14137
  releaseShow: () => releaseShow,
13991
14138
  releaseTag: () => releaseTag,
14139
+ sessionAdopt: () => sessionAdopt,
13992
14140
  sessionArchive: () => sessionArchive,
13993
14141
  sessionBriefing: () => sessionBriefing,
13994
14142
  sessionChainShow: () => sessionChainShow,
@@ -14214,6 +14362,7 @@ import {
14214
14362
  releaseRollbackFull,
14215
14363
  releaseShow,
14216
14364
  releaseTag,
14365
+ sessionAdopt,
14217
14366
  sessionArchive,
14218
14367
  sessionBriefing,
14219
14368
  sessionChainShow,
@@ -17620,6 +17769,7 @@ import {
17620
17769
  generateDocsLlmsTxt,
17621
17770
  getCleoDirAbsolute,
17622
17771
  getProjectRoot as getProjectRoot5,
17772
+ memoryObserve as memoryObserve2,
17623
17773
  resolveAttachmentBackend,
17624
17774
  SlugCollisionError
17625
17775
  } from "@cleocode/core/internal";
@@ -17716,6 +17866,23 @@ function compareByOrderBy(orderBy) {
17716
17866
  }
17717
17867
  return (a, b) => b.createdAt.localeCompare(a.createdAt);
17718
17868
  }
17869
+ function docObservationTitle(slug, attachmentId) {
17870
+ return `Doc attached: ${slug ?? attachmentId}`;
17871
+ }
17872
+ function emitDocAttachmentObservation(payload, projectRoot) {
17873
+ const title = docObservationTitle(payload.slug, payload.attachmentId);
17874
+ const narrative = JSON.stringify(payload);
17875
+ memoryObserve2(
17876
+ {
17877
+ text: narrative,
17878
+ title,
17879
+ type: "feature",
17880
+ sourceType: "manual"
17881
+ },
17882
+ projectRoot
17883
+ ).catch(() => {
17884
+ });
17885
+ }
17719
17886
  function docsEnvelopeToResponse(envelope, gateway, operation, startTime) {
17720
17887
  if (!envelope.success) {
17721
17888
  return {
@@ -18187,6 +18354,15 @@ var init_docs2 = __esm({
18187
18354
  )
18188
18355
  ).catch(() => {
18189
18356
  });
18357
+ const filePayload = {
18358
+ kind: "doc-attachment",
18359
+ attachmentId: meta.id,
18360
+ ownerId,
18361
+ addedAt: (/* @__PURE__ */ new Date()).toISOString(),
18362
+ ...slug !== void 0 ? { slug } : {},
18363
+ ...type2 !== void 0 ? { type: type2 } : {}
18364
+ };
18365
+ emitDocAttachmentObservation(filePayload, getProjectRoot5());
18190
18366
  return lafsSuccess(
18191
18367
  {
18192
18368
  attachmentId: meta.id,
@@ -18240,6 +18416,15 @@ var init_docs2 = __esm({
18240
18416
  ).catch(() => {
18241
18417
  });
18242
18418
  const backend = "legacy";
18419
+ const urlPayload = {
18420
+ kind: "doc-attachment",
18421
+ attachmentId: meta.id,
18422
+ ownerId,
18423
+ addedAt: (/* @__PURE__ */ new Date()).toISOString(),
18424
+ ...slug !== void 0 ? { slug } : {},
18425
+ ...type2 !== void 0 ? { type: type2 } : {}
18426
+ };
18427
+ emitDocAttachmentObservation(urlPayload, getProjectRoot5());
18243
18428
  return lafsSuccess(
18244
18429
  {
18245
18430
  attachmentId: meta.id,
@@ -18379,8 +18564,272 @@ var init_docs2 = __esm({
18379
18564
  }
18380
18565
  });
18381
18566
 
18567
+ // packages/cleo/src/dispatch/domains/focus.ts
18568
+ import { execSync as execSync2 } from "node:child_process";
18569
+ import { getProjectRoot as getProjectRoot6 } from "@cleocode/core";
18570
+ import {
18571
+ createAttachmentStore as createAttachmentStore2,
18572
+ memoryFind as memoryFind2,
18573
+ orchestrateReady as orchestrateReady2,
18574
+ taskRelates as taskRelates2,
18575
+ taskShow as taskShow2
18576
+ } from "@cleocode/core/internal";
18577
+ function roughTokenCount(value) {
18578
+ try {
18579
+ return Math.ceil(JSON.stringify(value).length / 4);
18580
+ } catch {
18581
+ return 0;
18582
+ }
18583
+ }
18584
+ function fetchRecentActivity(taskId, projectRoot) {
18585
+ try {
18586
+ const raw = execSync2(`git log --grep="${taskId}" --pretty=format:"%H %s %aI" -n 5`, {
18587
+ encoding: "utf8",
18588
+ stdio: ["pipe", "pipe", "pipe"],
18589
+ cwd: projectRoot
18590
+ });
18591
+ return raw.trim().split("\n").filter(Boolean).map((line) => {
18592
+ const parts = line.split(" ");
18593
+ return {
18594
+ commitSha: parts[0] ?? "",
18595
+ message: parts[1] ?? "",
18596
+ date: parts[2] ?? ""
18597
+ };
18598
+ }).filter((c) => c.commitSha !== "");
18599
+ } catch {
18600
+ return [];
18601
+ }
18602
+ }
18603
+ async function fetchAttachedDocs(projectRoot, taskId) {
18604
+ try {
18605
+ const store = createAttachmentStore2();
18606
+ const metas = await store.listByOwner("task", taskId, projectRoot);
18607
+ const entries = [];
18608
+ for (const meta of metas) {
18609
+ const extras = await store.getExtras(meta.id, projectRoot);
18610
+ entries.push({
18611
+ attachmentId: meta.id,
18612
+ kind: meta.attachment.kind,
18613
+ ...extras?.slug != null ? { slug: extras.slug } : {},
18614
+ ...extras?.type != null ? { type: extras.type } : {}
18615
+ });
18616
+ }
18617
+ return entries;
18618
+ } catch {
18619
+ return [];
18620
+ }
18621
+ }
18622
+ async function fetchBrainContext(taskId) {
18623
+ try {
18624
+ const [obsResult, decResult, lrnResult] = await Promise.allSettled([
18625
+ memoryFind2({ query: taskId, limit: 3, tables: ["observations"] }),
18626
+ memoryFind2({ query: taskId, limit: 3, tables: ["decisions"] }),
18627
+ memoryFind2({ query: taskId, limit: 3, tables: ["learnings"] })
18628
+ ]);
18629
+ const toHits = (r) => {
18630
+ if (r.status !== "fulfilled" || !r.value.success) return [];
18631
+ const data = r.value.data;
18632
+ return (data?.results ?? []).slice(0, 3);
18633
+ };
18634
+ return {
18635
+ observations: toHits(obsResult),
18636
+ learnings: toHits(lrnResult),
18637
+ decisions: toHits(decResult)
18638
+ };
18639
+ } catch {
18640
+ return void 0;
18641
+ }
18642
+ }
18643
+ async function fetchSagaMembersWithTitles(projectRoot, sagaId) {
18644
+ try {
18645
+ const relResult = await taskRelates2(projectRoot, sagaId);
18646
+ if (!relResult.success) return [];
18647
+ const memberIds = (relResult.data?.relations ?? []).filter((r) => r.type === "groups").map((r) => r.taskId);
18648
+ if (memberIds.length === 0) return [];
18649
+ const showResults = await Promise.allSettled(
18650
+ memberIds.map((epicId) => taskShow2(projectRoot, epicId))
18651
+ );
18652
+ return showResults.map((r, i) => {
18653
+ const epicId = memberIds[i] ?? "";
18654
+ if (r.status !== "fulfilled" || !r.value.success) {
18655
+ return { epicId, title: epicId, status: "unknown" };
18656
+ }
18657
+ const t = r.value.data.task;
18658
+ return { epicId: t.id, title: t.title, status: t.status };
18659
+ }).filter((m) => m.epicId !== "");
18660
+ } catch {
18661
+ return [];
18662
+ }
18663
+ }
18664
+ async function buildFocusEnvelope(id, projectRoot) {
18665
+ const showResult = await taskShow2(projectRoot, id);
18666
+ if (!showResult.success) {
18667
+ return {
18668
+ error: {
18669
+ code: showResult.error?.code?.toString() ?? "E_NOT_FOUND",
18670
+ message: showResult.error?.message ?? `Task not found: ${id}`
18671
+ }
18672
+ };
18673
+ }
18674
+ const task = showResult.data.task;
18675
+ const labels = Array.isArray(task.labels) ? task.labels : [];
18676
+ const isSaga = labels.includes("saga");
18677
+ const isEpic = task.type === "epic" && !isSaga;
18678
+ const entityType = isSaga ? "saga" : isEpic ? "epic" : "task";
18679
+ const identity = {
18680
+ id: task.id,
18681
+ title: task.title,
18682
+ type: entityType,
18683
+ status: task.status,
18684
+ ...task.parentId != null ? { parentId: task.parentId } : {}
18685
+ };
18686
+ const scope = {};
18687
+ if (entityType === "task") {
18688
+ scope.taskId = task.id;
18689
+ if (task.parentId) scope.epicId = task.parentId;
18690
+ } else if (entityType === "epic") {
18691
+ scope.epicId = task.id;
18692
+ } else {
18693
+ scope.sagaId = task.id;
18694
+ }
18695
+ const blockers = [];
18696
+ const explicitBlockers = Array.isArray(task.blockedBy) ? task.blockedBy : [];
18697
+ const unresolvedDepends = [];
18698
+ if (explicitBlockers.length === 0 && Array.isArray(task.depends)) {
18699
+ for (const depId of task.depends) {
18700
+ const dRes = await taskShow2(projectRoot, depId).catch(() => null);
18701
+ if (dRes?.success && dRes.data) {
18702
+ const s = dRes.data.task.status;
18703
+ if (s !== "done" && s !== "cancelled") {
18704
+ unresolvedDepends.push(depId);
18705
+ blockers.push({
18706
+ id: depId,
18707
+ title: dRes.data.task.title,
18708
+ reason: `dependency not resolved (status: ${s})`
18709
+ });
18710
+ }
18711
+ }
18712
+ }
18713
+ }
18714
+ if (explicitBlockers.length > 0) {
18715
+ await Promise.allSettled(
18716
+ explicitBlockers.map(async (bid) => {
18717
+ const bRes = await taskShow2(projectRoot, bid).catch(() => null);
18718
+ blockers.push({
18719
+ id: bid,
18720
+ title: bRes?.success ? bRes.data?.task.title ?? bid : bid,
18721
+ reason: bRes?.success ? bRes.data?.task.status ?? "unknown" : "unknown"
18722
+ });
18723
+ })
18724
+ );
18725
+ }
18726
+ const epicIdForReady = entityType === "epic" ? task.id : entityType === "task" && task.parentId ? task.parentId : void 0;
18727
+ const [sagaMembersResult, readyResult, docsResult, brainResult] = await Promise.allSettled([
18728
+ isSaga ? fetchSagaMembersWithTitles(projectRoot, id) : Promise.resolve(void 0),
18729
+ epicIdForReady && TASK_ID_RE2.test(epicIdForReady) ? orchestrateReady2(epicIdForReady, projectRoot) : Promise.resolve(null),
18730
+ fetchAttachedDocs(projectRoot, id),
18731
+ fetchBrainContext(id)
18732
+ ]);
18733
+ const recentActivity = fetchRecentActivity(id, projectRoot);
18734
+ const members = sagaMembersResult.status === "fulfilled" && sagaMembersResult.value != null ? sagaMembersResult.value : void 0;
18735
+ let readyWave;
18736
+ if (readyResult.status === "fulfilled" && readyResult.value?.success) {
18737
+ const rData = readyResult.value.data;
18738
+ const rTasks = rData?.readyTasks ?? [];
18739
+ if (rTasks.length > 0) {
18740
+ readyWave = rTasks.map((t) => ({
18741
+ id: t.id,
18742
+ title: t.title,
18743
+ priority: t.priority,
18744
+ depends: t.depends
18745
+ }));
18746
+ }
18747
+ }
18748
+ const attachedDocs = docsResult.status === "fulfilled" && docsResult.value.length > 0 ? docsResult.value : void 0;
18749
+ const brainContext = brainResult.status === "fulfilled" ? brainResult.value : void 0;
18750
+ const envelope = {
18751
+ identity,
18752
+ scope,
18753
+ ...members != null ? { members } : {},
18754
+ blockers,
18755
+ ...readyWave != null ? { readyWave } : {},
18756
+ ...attachedDocs != null ? { attachedDocs } : {},
18757
+ ...recentActivity.length > 0 ? { recentActivity } : {},
18758
+ ...brainContext != null ? { brainContext } : {},
18759
+ tokensEstimated: 0
18760
+ };
18761
+ envelope.tokensEstimated = roughTokenCount(envelope);
18762
+ return envelope;
18763
+ }
18764
+ var TASK_ID_RE2, QUERY_OPS4, FocusHandler;
18765
+ var init_focus2 = __esm({
18766
+ "packages/cleo/src/dispatch/domains/focus.ts"() {
18767
+ "use strict";
18768
+ init_typed();
18769
+ init_base();
18770
+ init_meta2();
18771
+ TASK_ID_RE2 = /^T\d+$/i;
18772
+ QUERY_OPS4 = /* @__PURE__ */ new Set(["show"]);
18773
+ FocusHandler = class {
18774
+ /**
18775
+ * Execute a read-only focus query operation.
18776
+ *
18777
+ * @param operation - Operation name (`'show'`).
18778
+ * @param params - Raw params (must contain `id: string`).
18779
+ */
18780
+ async query(operation, params) {
18781
+ const startTime = Date.now();
18782
+ if (!QUERY_OPS4.has(operation)) {
18783
+ return unsupportedOp("query", "focus", operation, startTime);
18784
+ }
18785
+ try {
18786
+ const id = typeof params?.["id"] === "string" ? params["id"].trim() : "";
18787
+ if (!id) {
18788
+ return {
18789
+ meta: dispatchMeta("query", "focus", operation, startTime),
18790
+ success: false,
18791
+ error: { code: "E_INVALID_INPUT", message: "id is required (e.g. cleo focus T9973)" }
18792
+ };
18793
+ }
18794
+ const projectRoot = getProjectRoot6();
18795
+ const result = await buildFocusEnvelope(id, projectRoot);
18796
+ if ("error" in result) {
18797
+ return {
18798
+ meta: dispatchMeta("query", "focus", operation, startTime),
18799
+ success: false,
18800
+ error: result.error
18801
+ };
18802
+ }
18803
+ const wrapped = lafsSuccess(result, "focus.show");
18804
+ return {
18805
+ meta: dispatchMeta("query", "focus", operation, startTime),
18806
+ success: true,
18807
+ data: wrapped.data
18808
+ };
18809
+ } catch (error) {
18810
+ return handleErrorResult("query", "focus", operation, error, startTime);
18811
+ }
18812
+ }
18813
+ /**
18814
+ * The focus domain has no mutate operations.
18815
+ *
18816
+ * @param operation - Always unsupported.
18817
+ * @param _params - Unused.
18818
+ */
18819
+ async mutate(operation, _params) {
18820
+ const startTime = Date.now();
18821
+ return unsupportedOp("mutate", "focus", operation, startTime);
18822
+ }
18823
+ /** Declared operations for introspection. */
18824
+ getSupportedOperations() {
18825
+ return { query: ["show"], mutate: [] };
18826
+ }
18827
+ };
18828
+ }
18829
+ });
18830
+
18382
18831
  // packages/cleo/src/dispatch/domains/intelligence.ts
18383
- import { getLogger as getLogger5, getProjectRoot as getProjectRoot6, getTaskAccessor as getTaskAccessor2 } from "@cleocode/core";
18832
+ import { getLogger as getLogger5, getProjectRoot as getProjectRoot7, getTaskAccessor as getTaskAccessor2 } from "@cleocode/core";
18384
18833
  import {
18385
18834
  calculateTaskRisk,
18386
18835
  extractPatternsFromHistory,
@@ -18400,7 +18849,7 @@ var init_intelligence2 = __esm({
18400
18849
  // Query
18401
18850
  // -----------------------------------------------------------------------
18402
18851
  async query(operation, params) {
18403
- const projectRoot = getProjectRoot6();
18852
+ const projectRoot = getProjectRoot7();
18404
18853
  const startTime = Date.now();
18405
18854
  try {
18406
18855
  switch (operation) {
@@ -18619,7 +19068,7 @@ async function wrap(op, params, label) {
18619
19068
  return lafsError("E_INTERNAL", err instanceof Error ? err.message : String(err), label);
18620
19069
  }
18621
19070
  }
18622
- var coreOps, _llmTypedHandler, QUERY_OPS4, MUTATE_OPS4, LlmHandler;
19071
+ var coreOps, _llmTypedHandler, QUERY_OPS5, MUTATE_OPS4, LlmHandler;
18623
19072
  var init_llm2 = __esm({
18624
19073
  "packages/cleo/src/dispatch/domains/llm/index.ts"() {
18625
19074
  "use strict";
@@ -18651,7 +19100,7 @@ var init_llm2 = __esm({
18651
19100
  use: async (params) => wrap(coreOps["use"], params, "use"),
18652
19101
  profile: async (params) => wrap(coreOps["profile"], params, "profile")
18653
19102
  });
18654
- QUERY_OPS4 = /* @__PURE__ */ new Set(["list", "test", "whoami", "auxiliary-status"]);
19103
+ QUERY_OPS5 = /* @__PURE__ */ new Set(["list", "test", "whoami", "auxiliary-status"]);
18655
19104
  MUTATE_OPS4 = /* @__PURE__ */ new Set(["add", "remove", "use", "profile"]);
18656
19105
  LlmHandler = class {
18657
19106
  /** Declared operations for introspection and validation. */
@@ -18666,7 +19115,7 @@ var init_llm2 = __esm({
18666
19115
  */
18667
19116
  async query(operation, params) {
18668
19117
  const startTime = Date.now();
18669
- if (!QUERY_OPS4.has(operation)) {
19118
+ if (!QUERY_OPS5.has(operation)) {
18670
19119
  return unsupportedOp("query", "llm", operation, startTime);
18671
19120
  }
18672
19121
  try {
@@ -18704,8 +19153,9 @@ var init_llm2 = __esm({
18704
19153
  });
18705
19154
 
18706
19155
  // packages/cleo/src/dispatch/domains/memory.ts
18707
- import { getLogger as getLogger6, getProjectRoot as getProjectRoot7 } from "@cleocode/core";
19156
+ import { getLogger as getLogger6, getProjectRoot as getProjectRoot8 } from "@cleocode/core";
18708
19157
  import {
19158
+ createAttachmentStore as createAttachmentStore3,
18709
19159
  generateMemoryBridgeContent,
18710
19160
  getBrainDb,
18711
19161
  getBrainNativeDb,
@@ -18732,7 +19182,7 @@ var init_memory2 = __esm({
18732
19182
  // Query
18733
19183
  // -----------------------------------------------------------------------
18734
19184
  async query(operation, params) {
18735
- const projectRoot = getProjectRoot7();
19185
+ const projectRoot = getProjectRoot8();
18736
19186
  const startTime = Date.now();
18737
19187
  try {
18738
19188
  switch (operation) {
@@ -19839,7 +20289,7 @@ var init_memory2 = __esm({
19839
20289
  // Mutate
19840
20290
  // -----------------------------------------------------------------------
19841
20291
  async mutate(operation, params) {
19842
- const projectRoot = getProjectRoot7();
20292
+ const projectRoot = getProjectRoot8();
19843
20293
  const startTime = Date.now();
19844
20294
  try {
19845
20295
  switch (operation) {
@@ -20098,15 +20548,16 @@ var init_memory2 = __esm({
20098
20548
  let found = false;
20099
20549
  let foundTable = "";
20100
20550
  let alreadyVerified = false;
20551
+ let foundNarrative = null;
20101
20552
  for (const tbl of tables) {
20102
20553
  try {
20103
- const row = nativeDb.prepare(
20104
- `SELECT id, verified FROM ${tbl} WHERE id = ? AND invalid_at IS NULL LIMIT 1`
20105
- ).get(entryId);
20554
+ const selectSql = tbl === "brain_observations" ? `SELECT id, verified, narrative FROM ${tbl} WHERE id = ? AND invalid_at IS NULL LIMIT 1` : `SELECT id, verified FROM ${tbl} WHERE id = ? AND invalid_at IS NULL LIMIT 1`;
20555
+ const row = nativeDb.prepare(selectSql).get(entryId);
20106
20556
  if (row) {
20107
20557
  found = true;
20108
20558
  foundTable = tbl;
20109
20559
  alreadyVerified = row.verified === 1;
20560
+ foundNarrative = row.narrative ?? null;
20110
20561
  if (!alreadyVerified) {
20111
20562
  if (tbl === "brain_observations") {
20112
20563
  try {
@@ -20135,6 +20586,22 @@ var init_memory2 = __esm({
20135
20586
  startTime
20136
20587
  );
20137
20588
  }
20589
+ let attachmentMissing;
20590
+ let attachmentId;
20591
+ if (foundTable === "brain_observations" && foundNarrative) {
20592
+ try {
20593
+ const payload = JSON.parse(
20594
+ foundNarrative
20595
+ );
20596
+ if (payload.kind === "doc-attachment" && typeof payload.attachmentId === "string") {
20597
+ attachmentId = payload.attachmentId;
20598
+ const store = createAttachmentStore3();
20599
+ const meta = await store.getMetadata(payload.attachmentId);
20600
+ attachmentMissing = meta === null;
20601
+ }
20602
+ } catch {
20603
+ }
20604
+ }
20138
20605
  return wrapResult(
20139
20606
  {
20140
20607
  success: true,
@@ -20143,7 +20610,13 @@ var init_memory2 = __esm({
20143
20610
  table: foundTable.replace("brain_", ""),
20144
20611
  verified: true,
20145
20612
  alreadyVerified,
20146
- verifiedAt: alreadyVerified ? null : now
20613
+ verifiedAt: alreadyVerified ? null : now,
20614
+ // T9976 — doc-attachment round-trip fields (only present when applicable).
20615
+ ...attachmentId !== void 0 ? { attachmentId } : {},
20616
+ ...attachmentMissing !== void 0 ? { attachmentMissing } : {},
20617
+ ...attachmentMissing === true ? {
20618
+ warning: `Attachment '${attachmentId}' referenced by this observation no longer exists in the docs store. The doc may have been removed.`
20619
+ } : {}
20147
20620
  }
20148
20621
  },
20149
20622
  "mutate",
@@ -20299,6 +20772,92 @@ var init_memory2 = __esm({
20299
20772
  // which already handles all sweep sub-commands via a unified case block.
20300
20773
  case "sweep":
20301
20774
  return this.query(operation, params);
20775
+ // T9976 — backfill: emit memory observations for existing doc attachments
20776
+ // that do not yet have a corresponding brain observation.
20777
+ case "backfill-docs": {
20778
+ try {
20779
+ const store = createAttachmentStore3();
20780
+ const allAttachments = await store.listAllInProject();
20781
+ await getBrainDb(projectRoot);
20782
+ const nativeDb = getBrainNativeDb();
20783
+ const existingAttachmentIds = /* @__PURE__ */ new Set();
20784
+ if (nativeDb) {
20785
+ try {
20786
+ const existing = nativeDb.prepare(
20787
+ `SELECT narrative FROM brain_observations
20788
+ WHERE narrative LIKE '%"kind":"doc-attachment"%'
20789
+ AND invalid_at IS NULL`
20790
+ ).all();
20791
+ for (const row of existing) {
20792
+ if (!row.narrative) continue;
20793
+ try {
20794
+ const p = JSON.parse(row.narrative);
20795
+ if (p.kind === "doc-attachment" && typeof p.attachmentId === "string") {
20796
+ existingAttachmentIds.add(p.attachmentId);
20797
+ }
20798
+ } catch {
20799
+ }
20800
+ }
20801
+ } catch {
20802
+ }
20803
+ }
20804
+ let emitted = 0;
20805
+ let skipped = 0;
20806
+ const emittedIds = [];
20807
+ for (const item of allAttachments) {
20808
+ const attId = item.metadata.id;
20809
+ if (existingAttachmentIds.has(attId)) {
20810
+ skipped++;
20811
+ continue;
20812
+ }
20813
+ const extras = await store.getExtras(attId);
20814
+ const slug = extras?.slug ?? void 0;
20815
+ const type2 = extras?.type ?? void 0;
20816
+ const payload = {
20817
+ kind: "doc-attachment",
20818
+ attachmentId: attId,
20819
+ ownerId: item.ownerId,
20820
+ addedAt: item.metadata.createdAt,
20821
+ ...slug !== void 0 ? { slug } : {},
20822
+ ...type2 !== void 0 ? { type: type2 } : {}
20823
+ };
20824
+ const { memoryObserve: brainObserve } = await import("@cleocode/core/internal");
20825
+ await brainObserve(
20826
+ {
20827
+ text: JSON.stringify(payload),
20828
+ title: `Doc attached: ${slug ?? attId}`,
20829
+ type: "feature",
20830
+ // sourceType: 'manual' avoids the mental-model queue (5s flush interval).
20831
+ // The mental-model queue is only entered when `agent` is set + type is in
20832
+ // MENTAL_MODEL_TYPES. Using 'manual' bypasses this path entirely.
20833
+ sourceType: "manual"
20834
+ },
20835
+ projectRoot
20836
+ ).catch(() => {
20837
+ });
20838
+ emittedIds.push(attId);
20839
+ emitted++;
20840
+ }
20841
+ return wrapResult(
20842
+ {
20843
+ success: true,
20844
+ data: {
20845
+ total: allAttachments.length,
20846
+ emitted,
20847
+ skipped,
20848
+ emittedAttachmentIds: emittedIds,
20849
+ hint: emitted === 0 ? "All existing attachments already have memory observations \u2014 nothing to backfill." : `Emitted ${emitted} new doc-attachment observations. Use 'cleo memory find <slug>' to verify.`
20850
+ }
20851
+ },
20852
+ "mutate",
20853
+ "memory",
20854
+ operation,
20855
+ startTime
20856
+ );
20857
+ } catch (backfillErr) {
20858
+ return handleErrorResult("mutate", "memory", operation, backfillErr, startTime);
20859
+ }
20860
+ }
20302
20861
  default:
20303
20862
  return unsupportedOp("mutate", "memory", operation, startTime);
20304
20863
  }
@@ -20380,7 +20939,9 @@ var init_memory2 = __esm({
20380
20939
  // T1003 — staged backfill operations
20381
20940
  "backfill.run",
20382
20941
  "backfill.approve",
20383
- "backfill.rollback"
20942
+ "backfill.rollback",
20943
+ // T9976 — emit memory observations for existing doc attachments
20944
+ "backfill-docs"
20384
20945
  ]
20385
20946
  };
20386
20947
  }
@@ -20488,7 +21049,7 @@ import {
20488
21049
  getBrainNativeDb as getBrainNativeDb2,
20489
21050
  getLogger as getLogger7,
20490
21051
  getNexusNativeDb,
20491
- getProjectRoot as getProjectRoot8,
21052
+ getProjectRoot as getProjectRoot9,
20492
21053
  nexusAugment,
20493
21054
  nexusBlockers,
20494
21055
  nexusBrainAnchors,
@@ -20760,7 +21321,7 @@ async function handleImpact(operation, params, startTime) {
20760
21321
  5
20761
21322
  );
20762
21323
  const projectIdParam = params?.projectId;
20763
- const projectId = projectIdParam ?? Buffer.from(getProjectRoot8()).toString("base64url").slice(0, 32);
21324
+ const projectId = projectIdParam ?? Buffer.from(getProjectRoot9()).toString("base64url").slice(0, 32);
20764
21325
  try {
20765
21326
  const { getNexusDb } = await import("@cleocode/core/store/nexus-sqlite");
20766
21327
  await getNexusDb();
@@ -20937,7 +21498,7 @@ async function handleImpact(operation, params, startTime) {
20937
21498
  return handleErrorResult("query", "nexus", operation, dbErr, startTime);
20938
21499
  }
20939
21500
  }
20940
- var _nexusTypedHandler, QUERY_OPS5, MUTATE_OPS5, NexusHandler, IMPACT_REVERSE_TYPES;
21501
+ var _nexusTypedHandler, QUERY_OPS6, MUTATE_OPS5, NexusHandler, IMPACT_REVERSE_TYPES;
20941
21502
  var init_nexus3 = __esm({
20942
21503
  "packages/cleo/src/dispatch/domains/nexus.ts"() {
20943
21504
  "use strict";
@@ -21021,7 +21582,7 @@ var init_nexus3 = __esm({
21021
21582
  return wrapCoreResult(await nexusAugment(params.pattern, params.limit ?? 5), "augment");
21022
21583
  },
21023
21584
  "share.status": async (_params) => {
21024
- const projectRoot = getProjectRoot8();
21585
+ const projectRoot = getProjectRoot9();
21025
21586
  return wrapCoreResult(await nexusShareStatus(projectRoot), "share.status");
21026
21587
  },
21027
21588
  "transfer.preview": async (params) => {
@@ -21057,39 +21618,39 @@ var init_nexus3 = __esm({
21057
21618
  },
21058
21619
  "full-context": async (params) => {
21059
21620
  if (!params.symbol) return lafsError("E_INVALID_INPUT", "symbol is required", "full-context");
21060
- const projectRoot = getProjectRoot8();
21621
+ const projectRoot = getProjectRoot9();
21061
21622
  return wrapCoreResult(await nexusFullContext(params.symbol, projectRoot), "full-context");
21062
21623
  },
21063
21624
  "task-footprint": async (params) => {
21064
21625
  if (!params.taskId) return lafsError("E_INVALID_INPUT", "taskId is required", "task-footprint");
21065
- const projectRoot = getProjectRoot8();
21626
+ const projectRoot = getProjectRoot9();
21066
21627
  return wrapCoreResult(await nexusTaskFootprint(params.taskId, projectRoot), "task-footprint");
21067
21628
  },
21068
21629
  "brain-anchors": async (params) => {
21069
21630
  if (!params.entryId)
21070
21631
  return lafsError("E_INVALID_INPUT", "entryId is required", "brain-anchors");
21071
- const projectRoot = getProjectRoot8();
21632
+ const projectRoot = getProjectRoot9();
21072
21633
  return wrapCoreResult(await nexusBrainAnchors(params.entryId, projectRoot), "brain-anchors");
21073
21634
  },
21074
21635
  why: async (params) => {
21075
21636
  if (!params.symbol) return lafsError("E_INVALID_INPUT", "symbol is required", "why");
21076
- const projectRoot = getProjectRoot8();
21637
+ const projectRoot = getProjectRoot9();
21077
21638
  return wrapCoreResult(await nexusWhy(params.symbol, projectRoot), "why");
21078
21639
  },
21079
21640
  "impact-full": async (params) => {
21080
21641
  if (!params.symbol) return lafsError("E_INVALID_INPUT", "symbol is required", "impact-full");
21081
- const projectRoot = getProjectRoot8();
21642
+ const projectRoot = getProjectRoot9();
21082
21643
  return wrapCoreResult(await nexusImpactFull(params.symbol, projectRoot), "impact-full");
21083
21644
  },
21084
21645
  "route-map": async (params) => {
21085
- const projectRoot = getProjectRoot8();
21646
+ const projectRoot = getProjectRoot9();
21086
21647
  const projectId = params.projectId ?? Buffer.from(projectRoot).toString("base64url").slice(0, 32);
21087
21648
  return wrapCoreResult(await nexusRouteMap(projectId, projectRoot), "route-map");
21088
21649
  },
21089
21650
  "shape-check": async (params) => {
21090
21651
  if (!params.routeSymbol)
21091
21652
  return lafsError("E_INVALID_INPUT", "routeSymbol is required", "shape-check");
21092
- const projectRoot = getProjectRoot8();
21653
+ const projectRoot = getProjectRoot9();
21093
21654
  const projectId = params.projectId ?? Buffer.from(projectRoot).toString("base64url").slice(0, 32);
21094
21655
  return wrapCoreResult(
21095
21656
  await nexusShapeCheck(params.routeSymbol, projectId, projectRoot),
@@ -21101,7 +21662,7 @@ var init_nexus3 = __esm({
21101
21662
  return wrapCoreResult(await nexusSearchCode(params.pattern, params.limit ?? 10), "search-code");
21102
21663
  },
21103
21664
  wiki: async (params) => {
21104
- const projectRoot = getProjectRoot8();
21665
+ const projectRoot = getProjectRoot9();
21105
21666
  const outputDir = params.outputDir ?? `${projectRoot}/.cleo/wiki`;
21106
21667
  return wrapCoreResult(
21107
21668
  await nexusWiki(outputDir, projectRoot, {
@@ -21114,7 +21675,7 @@ var init_nexus3 = __esm({
21114
21675
  "contracts-show": async (params) => {
21115
21676
  if (!params.projectA || !params.projectB)
21116
21677
  return lafsError("E_INVALID_INPUT", "projectA and projectB are required", "contracts-show");
21117
- const projectRoot = getProjectRoot8();
21678
+ const projectRoot = getProjectRoot9();
21118
21679
  return wrapCoreResult(
21119
21680
  await nexusContractsShow(params.projectA, params.projectB, projectRoot),
21120
21681
  "contracts-show"
@@ -21122,7 +21683,7 @@ var init_nexus3 = __esm({
21122
21683
  },
21123
21684
  "task-symbols": async (params) => {
21124
21685
  if (!params.taskId) return lafsError("E_INVALID_INPUT", "taskId is required", "task-symbols");
21125
- const projectRoot = getProjectRoot8();
21686
+ const projectRoot = getProjectRoot9();
21126
21687
  return wrapCoreResult(await nexusTaskSymbols(params.taskId, projectRoot), "task-symbols");
21127
21688
  },
21128
21689
  "profile.view": async (params) => wrapCoreResult(
@@ -21137,20 +21698,20 @@ var init_nexus3 = __esm({
21137
21698
  "sigil.list": async (params) => wrapCoreResult(await nexusSigilList(params.role), "sigil.list"),
21138
21699
  // T1510 — Phase 2 query ops
21139
21700
  clusters: async (params) => {
21140
- const projectRoot = getProjectRoot8();
21701
+ const projectRoot = getProjectRoot9();
21141
21702
  const repoPath = params.repoPath ?? projectRoot;
21142
21703
  const projectId = params.projectId ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
21143
21704
  return wrapCoreResult(await nexusClusters(projectId, repoPath), "clusters");
21144
21705
  },
21145
21706
  flows: async (params) => {
21146
- const projectRoot = getProjectRoot8();
21707
+ const projectRoot = getProjectRoot9();
21147
21708
  const repoPath = params.repoPath ?? projectRoot;
21148
21709
  const projectId = params.projectId ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
21149
21710
  return wrapCoreResult(await nexusFlows(projectId, repoPath), "flows");
21150
21711
  },
21151
21712
  context: async (params) => {
21152
21713
  if (!params.symbol) return lafsError("E_INVALID_INPUT", "symbol is required", "context");
21153
- const projectRoot = getProjectRoot8();
21714
+ const projectRoot = getProjectRoot9();
21154
21715
  const projectId = params.projectId ?? Buffer.from(projectRoot).toString("base64url").slice(0, 32);
21155
21716
  const limit = typeof params.limit === "number" ? params.limit : 20;
21156
21717
  const showContent = params.content === true;
@@ -21199,13 +21760,13 @@ var init_nexus3 = __esm({
21199
21760
  "projects.clean"
21200
21761
  ),
21201
21762
  "refresh-bridge": async (params) => {
21202
- const projectRoot = getProjectRoot8();
21763
+ const projectRoot = getProjectRoot9();
21203
21764
  const repoPath = params.repoPath ?? projectRoot;
21204
21765
  const projectId = params.projectId;
21205
21766
  return wrapCoreResult(await nexusRefreshBridge(repoPath, projectId), "refresh-bridge");
21206
21767
  },
21207
21768
  diff: async (params) => {
21208
- const projectRoot = getProjectRoot8();
21769
+ const projectRoot = getProjectRoot9();
21209
21770
  const repoPath = params.repoPath ?? projectRoot;
21210
21771
  return wrapCoreResult(
21211
21772
  await nexusDiff(
@@ -21225,17 +21786,17 @@ var init_nexus3 = __esm({
21225
21786
  );
21226
21787
  },
21227
21788
  "hot-paths": async (params) => {
21228
- const projectRoot = getProjectRoot8();
21789
+ const projectRoot = getProjectRoot9();
21229
21790
  const limit = typeof params.limit === "number" ? params.limit : 20;
21230
21791
  return wrapCoreResult(await nexusHotPaths(projectRoot, limit), "hot-paths");
21231
21792
  },
21232
21793
  "hot-nodes": async (params) => {
21233
- const projectRoot = getProjectRoot8();
21794
+ const projectRoot = getProjectRoot9();
21234
21795
  const limit = typeof params.limit === "number" ? params.limit : 20;
21235
21796
  return wrapCoreResult(await nexusHotNodes(projectRoot, limit), "hot-nodes");
21236
21797
  },
21237
21798
  "cold-symbols": async (params) => {
21238
- const projectRoot = getProjectRoot8();
21799
+ const projectRoot = getProjectRoot9();
21239
21800
  const days = typeof params.days === "number" ? params.days : 30;
21240
21801
  return wrapCoreResult(await nexusColdSymbols(projectRoot, days), "cold-symbols");
21241
21802
  },
@@ -21271,11 +21832,11 @@ var init_nexus3 = __esm({
21271
21832
  );
21272
21833
  },
21273
21834
  reconcile: async (params) => wrapCoreResult(
21274
- await nexusReconcileProject(params.projectRoot ?? getProjectRoot8()),
21835
+ await nexusReconcileProject(params.projectRoot ?? getProjectRoot9()),
21275
21836
  "reconcile"
21276
21837
  ),
21277
21838
  "share.snapshot.export": async (params) => {
21278
- const projectRoot = getProjectRoot8();
21839
+ const projectRoot = getProjectRoot9();
21279
21840
  return wrapCoreResult(
21280
21841
  await nexusShareSnapshotExport(projectRoot, params.outputPath),
21281
21842
  "share.snapshot.export"
@@ -21284,7 +21845,7 @@ var init_nexus3 = __esm({
21284
21845
  "share.snapshot.import": async (params) => {
21285
21846
  if (!params.inputPath)
21286
21847
  return lafsError("E_INVALID_INPUT", "inputPath is required", "share.snapshot.import");
21287
- const projectRoot = getProjectRoot8();
21848
+ const projectRoot = getProjectRoot9();
21288
21849
  return wrapCoreResult(
21289
21850
  await nexusShareSnapshotImport(projectRoot, params.inputPath),
21290
21851
  "share.snapshot.import"
@@ -21312,13 +21873,13 @@ var init_nexus3 = __esm({
21312
21873
  );
21313
21874
  },
21314
21875
  "contracts-sync": async (params) => {
21315
- const projectRoot = getProjectRoot8();
21876
+ const projectRoot = getProjectRoot9();
21316
21877
  const repoPath = params.repoPath ?? projectRoot;
21317
21878
  const projectId = params.projectId ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
21318
21879
  return wrapCoreResult(await nexusContractsSync(projectId, repoPath), "contracts-sync");
21319
21880
  },
21320
21881
  "contracts-link-tasks": async (params) => {
21321
- const projectRoot = getProjectRoot8();
21882
+ const projectRoot = getProjectRoot9();
21322
21883
  const repoPath = params.repoPath ?? projectRoot;
21323
21884
  const projectId = params.projectId ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
21324
21885
  return wrapCoreResult(
@@ -21327,7 +21888,7 @@ var init_nexus3 = __esm({
21327
21888
  );
21328
21889
  },
21329
21890
  "conduit-scan": async (_params) => {
21330
- const projectRoot = getProjectRoot8();
21891
+ const projectRoot = getProjectRoot9();
21331
21892
  return wrapCoreResult(await nexusConduitScan(projectRoot), "conduit-scan");
21332
21893
  },
21333
21894
  "profile.import": async (params) => wrapCoreResult(await nexusProfileImport(params.path), "profile.import"),
@@ -21360,7 +21921,7 @@ var init_nexus3 = __esm({
21360
21921
  },
21361
21922
  "sigil.sync": async (_params) => wrapCoreResult(await nexusSigilSync(), "sigil.sync")
21362
21923
  });
21363
- QUERY_OPS5 = /* @__PURE__ */ new Set([
21924
+ QUERY_OPS6 = /* @__PURE__ */ new Set([
21364
21925
  "share.status",
21365
21926
  "status",
21366
21927
  "list",
@@ -21437,7 +21998,7 @@ var init_nexus3 = __esm({
21437
21998
  */
21438
21999
  async query(operation, params) {
21439
22000
  const startTime = Date.now();
21440
- if (!QUERY_OPS5.has(operation)) {
22001
+ if (!QUERY_OPS6.has(operation)) {
21441
22002
  return unsupportedOp("query", "nexus", operation, startTime);
21442
22003
  }
21443
22004
  if (operation === "top-entries") {
@@ -21494,7 +22055,7 @@ var init_nexus3 = __esm({
21494
22055
  /** Declared operations for introspection and validation. */
21495
22056
  getSupportedOperations() {
21496
22057
  return {
21497
- query: Array.from(QUERY_OPS5),
22058
+ query: Array.from(QUERY_OPS6),
21498
22059
  mutate: Array.from(MUTATE_OPS5)
21499
22060
  };
21500
22061
  }
@@ -21531,7 +22092,7 @@ import {
21531
22092
  extractTypedGates,
21532
22093
  getIvtrState,
21533
22094
  getLogger as getLogger8,
21534
- getProjectRoot as getProjectRoot9,
22095
+ getProjectRoot as getProjectRoot10,
21535
22096
  getTask,
21536
22097
  loopBackIvtr,
21537
22098
  releaseIvtr,
@@ -21547,7 +22108,7 @@ function extractEvidenceFromRaw(raw) {
21547
22108
  return [];
21548
22109
  }
21549
22110
  async function ivtrStatusOp(params) {
21550
- const cwd = getProjectRoot9();
22111
+ const cwd = getProjectRoot10();
21551
22112
  const state = await getIvtrState(params.taskId, { cwd });
21552
22113
  if (!state) {
21553
22114
  return engineSuccess2({
@@ -21577,7 +22138,7 @@ async function ivtrStatusOp(params) {
21577
22138
  });
21578
22139
  }
21579
22140
  async function ivtrStartOp(params) {
21580
- const cwd = getProjectRoot9();
22141
+ const cwd = getProjectRoot10();
21581
22142
  const task = await getTask(params.taskId, cwd);
21582
22143
  if (!task) {
21583
22144
  return engineError2("E_NOT_FOUND", `Task ${params.taskId} not found`);
@@ -21598,7 +22159,7 @@ async function ivtrStartOp(params) {
21598
22159
  });
21599
22160
  }
21600
22161
  async function ivtrNextOp(params) {
21601
- const cwd = getProjectRoot9();
22162
+ const cwd = getProjectRoot10();
21602
22163
  const task = await getTask(params.taskId, cwd);
21603
22164
  if (!task) {
21604
22165
  return engineError2("E_NOT_FOUND", `Task ${params.taskId} not found`);
@@ -21649,7 +22210,7 @@ async function ivtrNextOp(params) {
21649
22210
  });
21650
22211
  }
21651
22212
  async function ivtrReleaseOp(params) {
21652
- const cwd = getProjectRoot9();
22213
+ const cwd = getProjectRoot10();
21653
22214
  const result = await releaseIvtr(params.taskId, { cwd });
21654
22215
  if (!result.released) {
21655
22216
  return {
@@ -21686,7 +22247,7 @@ async function ivtrReleaseOp(params) {
21686
22247
  };
21687
22248
  }
21688
22249
  async function ivtrLoopBackOp(params) {
21689
- const cwd = getProjectRoot9();
22250
+ const cwd = getProjectRoot10();
21690
22251
  if (!isLoopBackTarget(params.phase)) {
21691
22252
  return {
21692
22253
  success: false,
@@ -26252,8 +26813,8 @@ async function loadPlaybookByName(name) {
26252
26813
  return null;
26253
26814
  }
26254
26815
  try {
26255
- const { getProjectRoot: getProjectRoot43 } = await import("@cleocode/core/internal");
26256
- const projectRoot = __playbookRuntimeOverrides.projectRoot ?? getProjectRoot43();
26816
+ const { getProjectRoot: getProjectRoot44 } = await import("@cleocode/core/internal");
26817
+ const projectRoot = __playbookRuntimeOverrides.projectRoot ?? getProjectRoot44();
26257
26818
  const resolved = resolvePlaybook(name, {
26258
26819
  projectRoot,
26259
26820
  globalPlaybooksDir: __playbookRuntimeOverrides.globalPlaybooksDir,
@@ -26297,8 +26858,8 @@ async function acquireDb() {
26297
26858
  async function buildDefaultDispatcher() {
26298
26859
  if (__playbookRuntimeOverrides.dispatcher) return __playbookRuntimeOverrides.dispatcher;
26299
26860
  const { orchestrateSpawnExecute: orchestrateSpawnExecute2 } = await Promise.resolve().then(() => (init_engine(), engine_exports));
26300
- const { getProjectRoot: getProjectRoot43 } = await import("@cleocode/core/internal");
26301
- const projectRoot = getProjectRoot43();
26861
+ const { getProjectRoot: getProjectRoot44 } = await import("@cleocode/core/internal");
26862
+ const projectRoot = getProjectRoot44();
26302
26863
  return {
26303
26864
  async dispatch(input2) {
26304
26865
  try {
@@ -26364,7 +26925,7 @@ async function lookupApprovalByTokenForDispatch(token) {
26364
26925
  const db = await acquireDb();
26365
26926
  return getPlaybookApprovalByToken(db, token);
26366
26927
  }
26367
- var __playbookRuntimeOverrides, _playbookTypedHandler, QUERY_OPS6, MUTATE_OPS6, PlaybookHandler;
26928
+ var __playbookRuntimeOverrides, _playbookTypedHandler, QUERY_OPS7, MUTATE_OPS6, PlaybookHandler;
26368
26929
  var init_playbook2 = __esm({
26369
26930
  "packages/cleo/src/dispatch/domains/playbook.ts"() {
26370
26931
  "use strict";
@@ -26488,8 +27049,8 @@ var init_playbook2 = __esm({
26488
27049
  projectRoot = __playbookRuntimeOverrides.projectRoot;
26489
27050
  } else {
26490
27051
  try {
26491
- const { getProjectRoot: getProjectRoot43 } = await import("@cleocode/core/internal");
26492
- projectRoot = getProjectRoot43();
27052
+ const { getProjectRoot: getProjectRoot44 } = await import("@cleocode/core/internal");
27053
+ projectRoot = getProjectRoot44();
26493
27054
  } catch {
26494
27055
  projectRoot = void 0;
26495
27056
  }
@@ -26553,14 +27114,14 @@ var init_playbook2 = __esm({
26553
27114
  const dispatcher = await buildDefaultDispatcher();
26554
27115
  let result;
26555
27116
  try {
26556
- const { getProjectRoot: getProjectRoot43 } = await import("@cleocode/core/internal");
27117
+ const { getProjectRoot: getProjectRoot44 } = await import("@cleocode/core/internal");
26557
27118
  const opts = {
26558
27119
  db,
26559
27120
  playbook: parsed.definition,
26560
27121
  playbookHash: parsed.sourceHash,
26561
27122
  initialContext,
26562
27123
  dispatcher,
26563
- projectRoot: getProjectRoot43()
27124
+ projectRoot: getProjectRoot44()
26564
27125
  };
26565
27126
  if (__playbookRuntimeOverrides.approvalSecret !== void 0) {
26566
27127
  opts.approvalSecret = __playbookRuntimeOverrides.approvalSecret;
@@ -26667,7 +27228,7 @@ var init_playbook2 = __esm({
26667
27228
  }
26668
27229
  }
26669
27230
  });
26670
- QUERY_OPS6 = /* @__PURE__ */ new Set(["status", "list", "validate", "catalog"]);
27231
+ QUERY_OPS7 = /* @__PURE__ */ new Set(["status", "list", "validate", "catalog"]);
26671
27232
  MUTATE_OPS6 = /* @__PURE__ */ new Set(["run", "resume"]);
26672
27233
  PlaybookHandler = class {
26673
27234
  /**
@@ -26675,7 +27236,7 @@ var init_playbook2 = __esm({
26675
27236
  */
26676
27237
  async query(operation, params) {
26677
27238
  const startTime = Date.now();
26678
- if (!QUERY_OPS6.has(operation)) {
27239
+ if (!QUERY_OPS7.has(operation)) {
26679
27240
  return unsupportedOp("query", "playbook", operation, startTime);
26680
27241
  }
26681
27242
  try {
@@ -26742,7 +27303,7 @@ var init_playbook2 = __esm({
26742
27303
  // packages/cleo/src/dispatch/domains/orchestrate.ts
26743
27304
  import {
26744
27305
  getLogger as getLogger9,
26745
- getProjectRoot as getProjectRoot10,
27306
+ getProjectRoot as getProjectRoot11,
26746
27307
  instantiateTessera,
26747
27308
  listTesseraTemplates,
26748
27309
  paginate as paginate2,
@@ -26756,25 +27317,25 @@ function evictFanoutManifest() {
26756
27317
  }
26757
27318
  }
26758
27319
  async function orchestrateStatusOp(params) {
26759
- return orchestrateStatus(params.epicId, getProjectRoot10());
27320
+ return orchestrateStatus(params.epicId, getProjectRoot11());
26760
27321
  }
26761
27322
  async function orchestrateNextOp(params) {
26762
- return orchestrateNext(params.epicId, getProjectRoot10());
27323
+ return orchestrateNext(params.epicId, getProjectRoot11());
26763
27324
  }
26764
27325
  async function orchestrateReadyOp(params) {
26765
- return orchestrateReady(params.epicId, getProjectRoot10(), {
27326
+ return orchestrateReady(params.epicId, getProjectRoot11(), {
26766
27327
  ignoreDepsValidate: params.ignoreDepsValidate,
26767
27328
  via: params.via
26768
27329
  });
26769
27330
  }
26770
27331
  async function orchestrateAnalyzeOp(params) {
26771
27332
  if (params.mode === "parallel-safety") {
26772
- return orchestrateAnalyzeParallelSafety(params.taskIds ?? [], getProjectRoot10());
27333
+ return orchestrateAnalyzeParallelSafety(params.taskIds ?? [], getProjectRoot11());
26773
27334
  }
26774
- return orchestrateAnalyze(params.epicId, getProjectRoot10(), params.mode);
27335
+ return orchestrateAnalyze(params.epicId, getProjectRoot11(), params.mode);
26775
27336
  }
26776
27337
  async function orchestrateClassifyOp(params) {
26777
- return orchestrateClassify(params.request, params.context, getProjectRoot10());
27338
+ return orchestrateClassify(params.request, params.context, getProjectRoot11());
26778
27339
  }
26779
27340
  function orchestrateFanoutStatusOp(params) {
26780
27341
  const entry = fanoutManifestStore.get(params.manifestEntryId);
@@ -26807,23 +27368,23 @@ function orchestrateFanoutStatusOp(params) {
26807
27368
  });
26808
27369
  }
26809
27370
  async function orchestrateContextOp(params) {
26810
- return orchestrateContext(params.epicId, getProjectRoot10());
27371
+ return orchestrateContext(params.epicId, getProjectRoot11());
26811
27372
  }
26812
27373
  async function orchestrateWavesOp(params) {
26813
- return orchestrateWaves(params.epicId, getProjectRoot10(), { via: params.via });
27374
+ return orchestrateWaves(params.epicId, getProjectRoot11(), { via: params.via });
26814
27375
  }
26815
27376
  async function orchestratePlanOp(params) {
26816
27377
  return orchestratePlan({
26817
27378
  epicId: params.epicId,
26818
- projectRoot: getProjectRoot10(),
27379
+ projectRoot: getProjectRoot11(),
26819
27380
  preferTier: params.preferTier
26820
27381
  });
26821
27382
  }
26822
27383
  async function orchestrateBootstrapOp(params) {
26823
- return orchestrateBootstrap(getProjectRoot10(), { speed: params.speed });
27384
+ return orchestrateBootstrap(getProjectRoot11(), { speed: params.speed });
26824
27385
  }
26825
27386
  async function orchestrateUnblockOp(_params) {
26826
- return orchestrateUnblockOpportunities(getProjectRoot10());
27387
+ return orchestrateUnblockOpportunities(getProjectRoot11());
26827
27388
  }
26828
27389
  async function orchestrateTesseraListOp(params) {
26829
27390
  return Promise.resolve({ success: true, data: params });
@@ -26835,13 +27396,13 @@ async function orchestratePendingOp(_params) {
26835
27396
  return Promise.resolve({ success: true, data: {} });
26836
27397
  }
26837
27398
  async function orchestrateStartOp(params) {
26838
- return orchestrateStartup(params.epicId, getProjectRoot10());
27399
+ return orchestrateStartup(params.epicId, getProjectRoot11());
26839
27400
  }
26840
27401
  async function orchestrateSpawnOp(params) {
26841
27402
  return orchestrateSpawn(
26842
27403
  params.taskId,
26843
27404
  params.protocolType,
26844
- getProjectRoot10(),
27405
+ getProjectRoot11(),
26845
27406
  params.tier,
26846
27407
  params.noWorktree,
26847
27408
  params.spawnScope
@@ -26860,7 +27421,7 @@ async function orchestrateHandoffOp(params) {
26860
27421
  },
26861
27422
  // Inject cleo session ops to avoid core→cleo import cycle (T1570 ADR-057)
26862
27423
  { sessionStatus, sessionEnd, sessionContextInject },
26863
- getProjectRoot10()
27424
+ getProjectRoot11()
26864
27425
  );
26865
27426
  }
26866
27427
  async function orchestrateSpawnExecuteOp(params) {
@@ -26868,19 +27429,19 @@ async function orchestrateSpawnExecuteOp(params) {
26868
27429
  params.taskId,
26869
27430
  params.adapterId,
26870
27431
  params.protocolType,
26871
- getProjectRoot10(),
27432
+ getProjectRoot11(),
26872
27433
  params.tier
26873
27434
  );
26874
27435
  }
26875
27436
  async function orchestrateValidateOp(params) {
26876
- return orchestrateValidate(params.taskId, getProjectRoot10());
27437
+ return orchestrateValidate(params.taskId, getProjectRoot11());
26877
27438
  }
26878
27439
  async function orchestratePivotOp(params) {
26879
27440
  try {
26880
27441
  const result = await pivotTask(params.fromTaskId, params.toTaskId, {
26881
27442
  reason: params.reason,
26882
27443
  blocksFrom: params.blocksFrom,
26883
- projectRoot: getProjectRoot10()
27444
+ projectRoot: getProjectRoot11()
26884
27445
  });
26885
27446
  return { success: true, data: result };
26886
27447
  } catch (err) {
@@ -26898,19 +27459,19 @@ async function orchestratePivotOp(params) {
26898
27459
  }
26899
27460
  }
26900
27461
  async function orchestrateWorktreeCompleteOp(params) {
26901
- return handleWorktreeComplete(params.taskId, getProjectRoot10(), params.resolve);
27462
+ return handleWorktreeComplete(params.taskId, getProjectRoot11(), params.resolve);
26902
27463
  }
26903
27464
  async function orchestrateWorktreeCleanupOp(params) {
26904
- return handleWorktreeCleanup(getProjectRoot10(), params.taskIds);
27465
+ return handleWorktreeCleanup(getProjectRoot11(), params.taskIds);
26905
27466
  }
26906
27467
  async function orchestrateWorktreePruneOp(params) {
26907
- return handleWorktreePrune(getProjectRoot10(), params.taskId);
27468
+ return handleWorktreePrune(getProjectRoot11(), params.taskId);
26908
27469
  }
26909
27470
  async function orchestrateParallelOp(params) {
26910
27471
  return Promise.resolve({ success: true, data: params });
26911
27472
  }
26912
27473
  async function orchestrateFanoutOp(params) {
26913
- return orchestrateFanoutImpl(params.items, getProjectRoot10());
27474
+ return orchestrateFanoutImpl(params.items, getProjectRoot11());
26914
27475
  }
26915
27476
  async function orchestrateTesseraInstantiateOp(params) {
26916
27477
  return Promise.resolve({ success: true, data: params });
@@ -27887,7 +28448,7 @@ var init_orchestrate2 = __esm({
27887
28448
  startTime
27888
28449
  );
27889
28450
  return wrapResult(
27890
- await orchestrateParallelStart(epicId, wave, getProjectRoot10()),
28451
+ await orchestrateParallelStart(epicId, wave, getProjectRoot11()),
27891
28452
  "mutate",
27892
28453
  "orchestrate",
27893
28454
  "parallel",
@@ -27916,7 +28477,7 @@ var init_orchestrate2 = __esm({
27916
28477
  startTime
27917
28478
  );
27918
28479
  return wrapResult(
27919
- await orchestrateParallelEnd(epicId, wave, getProjectRoot10()),
28480
+ await orchestrateParallelEnd(epicId, wave, getProjectRoot11()),
27920
28481
  "mutate",
27921
28482
  "orchestrate",
27922
28483
  "parallel",
@@ -27983,7 +28544,7 @@ var init_orchestrate2 = __esm({
27983
28544
  epicId,
27984
28545
  variables: { epicId, ...variables }
27985
28546
  },
27986
- getProjectRoot10()
28547
+ getProjectRoot11()
27987
28548
  );
27988
28549
  return {
27989
28550
  meta: dispatchMeta("mutate", "orchestrate", operation, startTime),
@@ -28076,7 +28637,7 @@ import {
28076
28637
  describeChannel,
28077
28638
  formatStageGuidance,
28078
28639
  getLogger as getLogger10,
28079
- getProjectRoot as getProjectRoot11,
28640
+ getProjectRoot as getProjectRoot12,
28080
28641
  isValidStage,
28081
28642
  listChains,
28082
28643
  paginate as paginate3,
@@ -28084,19 +28645,19 @@ import {
28084
28645
  showChain
28085
28646
  } from "@cleocode/core/internal";
28086
28647
  async function stageValidateOp(params) {
28087
- return lifecycleCheck(params.epicId, params.targetStage, getProjectRoot11());
28648
+ return lifecycleCheck(params.epicId, params.targetStage, getProjectRoot12());
28088
28649
  }
28089
28650
  async function stageStatusOp(params) {
28090
- return lifecycleStatus(params.epicId, getProjectRoot11());
28651
+ return lifecycleStatus(params.epicId, getProjectRoot12());
28091
28652
  }
28092
28653
  async function stageHistoryOp(params) {
28093
- return lifecycleHistory(params.taskId, getProjectRoot11());
28654
+ return lifecycleHistory(params.taskId, getProjectRoot12());
28094
28655
  }
28095
28656
  async function stageGuidanceOp(params) {
28096
28657
  let stage = params.stage;
28097
28658
  const epicId = params.epicId;
28098
28659
  const format = params.format ?? "markdown";
28099
- const projectRoot = getProjectRoot11();
28660
+ const projectRoot = getProjectRoot12();
28100
28661
  if (!stage && epicId) {
28101
28662
  const statusResult = await lifecycleStatus(epicId, projectRoot);
28102
28663
  if (statusResult.success) {
@@ -28112,14 +28673,14 @@ async function stageRecordOp(params) {
28112
28673
  params.stage,
28113
28674
  params.status,
28114
28675
  params.notes,
28115
- getProjectRoot11()
28676
+ getProjectRoot12()
28116
28677
  );
28117
28678
  }
28118
28679
  async function stageSkipOp(params) {
28119
- return lifecycleSkip(params.taskId, params.stage, params.reason, getProjectRoot11());
28680
+ return lifecycleSkip(params.taskId, params.stage, params.reason, getProjectRoot12());
28120
28681
  }
28121
28682
  async function stageResetOp(params) {
28122
- return lifecycleReset(params.taskId, params.stage, params.reason, getProjectRoot11());
28683
+ return lifecycleReset(params.taskId, params.stage, params.reason, getProjectRoot12());
28123
28684
  }
28124
28685
  async function stageGatePassOp(params) {
28125
28686
  return lifecycleGatePass(
@@ -28127,24 +28688,24 @@ async function stageGatePassOp(params) {
28127
28688
  params.gateName,
28128
28689
  params.agent,
28129
28690
  params.notes,
28130
- getProjectRoot11()
28691
+ getProjectRoot12()
28131
28692
  );
28132
28693
  }
28133
28694
  async function stageGateFailOp(params) {
28134
- return lifecycleGateFail(params.taskId, params.gateName, params.reason, getProjectRoot11());
28695
+ return lifecycleGateFail(params.taskId, params.gateName, params.reason, getProjectRoot12());
28135
28696
  }
28136
28697
  async function releaseListOp(params) {
28137
28698
  return releaseList(
28138
28699
  { status: params.status, limit: params.limit, offset: params.offset },
28139
- getProjectRoot11()
28700
+ getProjectRoot12()
28140
28701
  );
28141
28702
  }
28142
28703
  async function releaseShowOp(params) {
28143
- return releaseShow(params.version, getProjectRoot11());
28704
+ return releaseShow(params.version, getProjectRoot12());
28144
28705
  }
28145
28706
  async function releaseChannelShowOp(_params) {
28146
28707
  let currentBranch = "unknown";
28147
- const projectRoot = getProjectRoot11();
28708
+ const projectRoot = getProjectRoot12();
28148
28709
  try {
28149
28710
  currentBranch = execFileSync("git", ["rev-parse", "--abbrev-ref", "HEAD"], {
28150
28711
  encoding: "utf-8",
@@ -28162,52 +28723,52 @@ async function releaseChannelShowOp(_params) {
28162
28723
  };
28163
28724
  }
28164
28725
  async function releasePrStatusOp(params) {
28165
- return releasePrStatus(params.version, getProjectRoot11());
28726
+ return releasePrStatus(params.version, getProjectRoot12());
28166
28727
  }
28167
28728
  async function releaseCancelOp(params) {
28168
- return releaseCancel(params.version, getProjectRoot11());
28729
+ return releaseCancel(params.version, getProjectRoot12());
28169
28730
  }
28170
28731
  async function releaseRollbackOp(params) {
28171
- return releaseRollback(params.version, params.reason, getProjectRoot11());
28732
+ return releaseRollback(params.version, params.reason, getProjectRoot12());
28172
28733
  }
28173
28734
  async function releaseRollbackFullOp(params) {
28174
28735
  return releaseRollbackFull(
28175
28736
  params.version,
28176
28737
  { reason: params.reason, force: params.force, unpublish: params.unpublish },
28177
- getProjectRoot11()
28738
+ getProjectRoot12()
28178
28739
  );
28179
28740
  }
28180
28741
  async function manifestShowOp(params) {
28181
- return pipelineManifestShow(params.entryId, getProjectRoot11());
28742
+ return pipelineManifestShow(params.entryId, getProjectRoot12());
28182
28743
  }
28183
28744
  async function manifestListOp(params) {
28184
- return pipelineManifestList(params, getProjectRoot11());
28745
+ return pipelineManifestList(params, getProjectRoot12());
28185
28746
  }
28186
28747
  async function manifestFindOp(params) {
28187
28748
  return pipelineManifestFind(
28188
28749
  params.query,
28189
28750
  { confidence: params.confidence, limit: params.limit },
28190
- getProjectRoot11()
28751
+ getProjectRoot12()
28191
28752
  );
28192
28753
  }
28193
28754
  async function manifestStatsOp(params) {
28194
- return pipelineManifestStats(params.epicId, getProjectRoot11());
28755
+ return pipelineManifestStats(params.epicId, getProjectRoot12());
28195
28756
  }
28196
28757
  async function manifestAppendOp(params) {
28197
- return pipelineManifestAppend(params.entry, getProjectRoot11());
28758
+ return pipelineManifestAppend(params.entry, getProjectRoot12());
28198
28759
  }
28199
28760
  async function manifestArchiveOp(params) {
28200
- return pipelineManifestArchive(params.beforeDate, getProjectRoot11());
28761
+ return pipelineManifestArchive(params.beforeDate, getProjectRoot12());
28201
28762
  }
28202
28763
  async function phaseShowOp(params) {
28203
- return phaseShow(params.phaseId, getProjectRoot11());
28764
+ return phaseShow(params.phaseId, getProjectRoot12());
28204
28765
  }
28205
28766
  async function phaseListOp(_params) {
28206
- return phaseList(getProjectRoot11());
28767
+ return phaseList(getProjectRoot12());
28207
28768
  }
28208
28769
  async function phaseSetOp(params) {
28209
28770
  const { phaseId, action, rollback, force, dryRun } = params;
28210
- const projectRoot = getProjectRoot11();
28771
+ const projectRoot = getProjectRoot12();
28211
28772
  if (action === "start") {
28212
28773
  return phaseStart(phaseId, projectRoot);
28213
28774
  }
@@ -28217,28 +28778,28 @@ async function phaseSetOp(params) {
28217
28778
  return phaseSet({ phaseId, rollback, force, dryRun }, projectRoot);
28218
28779
  }
28219
28780
  async function phaseAdvanceOp(params) {
28220
- return phaseAdvance(params.force, getProjectRoot11());
28781
+ return phaseAdvance(params.force, getProjectRoot12());
28221
28782
  }
28222
28783
  async function phaseRenameOp(params) {
28223
- return phaseRename(params.oldName, params.newName, getProjectRoot11());
28784
+ return phaseRename(params.oldName, params.newName, getProjectRoot12());
28224
28785
  }
28225
28786
  async function phaseDeleteOp(params) {
28226
28787
  return phaseDelete(
28227
28788
  params.phaseId,
28228
28789
  { reassignTo: params.reassignTo, force: params.force },
28229
- getProjectRoot11()
28790
+ getProjectRoot12()
28230
28791
  );
28231
28792
  }
28232
28793
  async function chainShowOp(params) {
28233
- const chain = await showChain(params.chainId, getProjectRoot11());
28794
+ const chain = await showChain(params.chainId, getProjectRoot12());
28234
28795
  return { _chain: chain, _chainId: params.chainId };
28235
28796
  }
28236
28797
  async function chainListOp(_params) {
28237
- const chains = await listChains(getProjectRoot11());
28798
+ const chains = await listChains(getProjectRoot12());
28238
28799
  return { _chains: chains };
28239
28800
  }
28240
28801
  async function chainAddOp(params) {
28241
- await addChain(params.chain, getProjectRoot11());
28802
+ await addChain(params.chain, getProjectRoot12());
28242
28803
  return { id: params.chain.id };
28243
28804
  }
28244
28805
  async function chainInstantiateOp(params) {
@@ -28249,7 +28810,7 @@ async function chainInstantiateOp(params) {
28249
28810
  variables: params.variables,
28250
28811
  stageToTask: params.stageToTask
28251
28812
  },
28252
- getProjectRoot11()
28813
+ getProjectRoot12()
28253
28814
  );
28254
28815
  }
28255
28816
  async function chainAdvanceOp(params) {
@@ -28257,7 +28818,7 @@ async function chainAdvanceOp(params) {
28257
28818
  params.instanceId,
28258
28819
  params.nextStage,
28259
28820
  params.gateResults ?? [],
28260
- getProjectRoot11()
28821
+ getProjectRoot12()
28261
28822
  );
28262
28823
  }
28263
28824
  function pipelinePhaseListResponse(envelope, params, operation, startTime) {
@@ -28775,7 +29336,7 @@ var init_pipeline3 = __esm({
28775
29336
  // packages/cleo/src/dispatch/domains/provenance.ts
28776
29337
  import {
28777
29338
  getLogger as getLogger11,
28778
- getProjectRoot as getProjectRoot12,
29339
+ getProjectRoot as getProjectRoot13,
28779
29340
  provenanceBackfill,
28780
29341
  verifyProvenance
28781
29342
  } from "@cleocode/core/internal";
@@ -28820,7 +29381,7 @@ var init_provenance = __esm({
28820
29381
  ...version ? { version } : {},
28821
29382
  all,
28822
29383
  ...limit !== void 0 ? { limit } : {},
28823
- projectRoot: getProjectRoot12()
29384
+ projectRoot: getProjectRoot13()
28824
29385
  });
28825
29386
  return wrapResult(result, "query", "provenance", operation, startTime);
28826
29387
  }
@@ -28866,7 +29427,7 @@ var init_provenance = __esm({
28866
29427
  const resetCheckpoint = typeof params?.["resetCheckpoint"] === "boolean" ? params["resetCheckpoint"] : false;
28867
29428
  const result = await provenanceBackfill({
28868
29429
  since,
28869
- projectRoot: getProjectRoot12(),
29430
+ projectRoot: getProjectRoot13(),
28870
29431
  forceOverwrite,
28871
29432
  dryRun,
28872
29433
  resetCheckpoint
@@ -28896,12 +29457,12 @@ var init_provenance = __esm({
28896
29457
  });
28897
29458
 
28898
29459
  // packages/cleo/src/dispatch/domains/release.ts
28899
- import { getLogger as getLogger12, getProjectRoot as getProjectRoot13 } from "@cleocode/core/internal";
29460
+ import { getLogger as getLogger12, getProjectRoot as getProjectRoot14 } from "@cleocode/core/internal";
28900
29461
  async function releaseGateOp(params) {
28901
- return releaseGateCheck(params.epicId, params.force ?? false, getProjectRoot13());
29462
+ return releaseGateCheck(params.epicId, params.force ?? false, getProjectRoot14());
28902
29463
  }
28903
29464
  async function releaseIvtrSuggestOp(params) {
28904
- return releaseIvtrAutoSuggest(params.taskId, getProjectRoot13());
29465
+ return releaseIvtrAutoSuggest(params.taskId, getProjectRoot14());
28905
29466
  }
28906
29467
  var log3, coreOps4, ReleaseHandler;
28907
29468
  var init_release2 = __esm({
@@ -29078,7 +29639,7 @@ var init_release2 = __esm({
29078
29639
  hotfix: typeof params?.hotfix === "boolean" ? params.hotfix : false,
29079
29640
  dryRun: typeof params?.dryRun === "boolean" ? params.dryRun : false,
29080
29641
  writeChangelog: typeof params?.writeChangelog === "boolean" ? params.writeChangelog : true,
29081
- projectRoot: getProjectRoot13()
29642
+ projectRoot: getProjectRoot14()
29082
29643
  };
29083
29644
  return wrapResult(await releasePlan(typed), "mutate", "release", operation, startTime);
29084
29645
  }
@@ -29100,7 +29661,7 @@ var init_release2 = __esm({
29100
29661
  workflow: typeof params?.workflow === "string" ? params.workflow : void 0,
29101
29662
  watch: typeof params?.watch === "boolean" ? params.watch : false,
29102
29663
  commitPlan: typeof params?.commitPlan === "boolean" ? params.commitPlan : false,
29103
- projectRoot: getProjectRoot13()
29664
+ projectRoot: getProjectRoot14()
29104
29665
  };
29105
29666
  return wrapResult(await releaseOpen(typed), "mutate", "release", operation, startTime);
29106
29667
  }
@@ -29117,7 +29678,7 @@ var init_release2 = __esm({
29117
29678
  startTime
29118
29679
  );
29119
29680
  const result = await releaseReconcileV2(version, {
29120
- projectRoot: getProjectRoot13(),
29681
+ projectRoot: getProjectRoot14(),
29121
29682
  fromWorkflow: typeof params?.fromWorkflow === "boolean" ? params.fromWorkflow : false,
29122
29683
  rollback: typeof params?.rollback === "boolean" ? params.rollback : false
29123
29684
  });
@@ -29146,7 +29707,7 @@ var init_release2 = __esm({
29146
29707
  });
29147
29708
 
29148
29709
  // packages/cleo/src/dispatch/domains/sentient.ts
29149
- import { getProjectRoot as getProjectRoot14 } from "@cleocode/core";
29710
+ import { getProjectRoot as getProjectRoot15 } from "@cleocode/core";
29150
29711
  import {
29151
29712
  sentientAllowlistAdd,
29152
29713
  sentientAllowlistList,
@@ -29159,23 +29720,23 @@ import {
29159
29720
  sentientProposeReject,
29160
29721
  sentientProposeRun
29161
29722
  } from "@cleocode/core/sentient";
29162
- var coreOps5, _sentientTypedHandler, QUERY_OPS7, MUTATE_OPS7, SentientHandler;
29723
+ var coreOps5, _sentientTypedHandler, QUERY_OPS8, MUTATE_OPS7, SentientHandler;
29163
29724
  var init_sentient2 = __esm({
29164
29725
  "packages/cleo/src/dispatch/domains/sentient.ts"() {
29165
29726
  "use strict";
29166
29727
  init_typed();
29167
29728
  init_base();
29168
29729
  coreOps5 = {
29169
- "propose.list": (params) => sentientProposeList(getProjectRoot14(), params),
29170
- "propose.diff": (params) => sentientProposeDiff(getProjectRoot14(), params),
29171
- "allowlist.list": (params) => sentientAllowlistList(getProjectRoot14(), params),
29172
- "propose.accept": (params) => sentientProposeAccept(getProjectRoot14(), params),
29173
- "propose.reject": (params) => sentientProposeReject(getProjectRoot14(), params),
29174
- "propose.run": (params) => sentientProposeRun(getProjectRoot14(), params),
29175
- "propose.enable": (params) => sentientProposeEnable(getProjectRoot14(), params),
29176
- "propose.disable": (params) => sentientProposeDisable(getProjectRoot14(), params),
29177
- "allowlist.add": (params) => sentientAllowlistAdd(getProjectRoot14(), params),
29178
- "allowlist.remove": (params) => sentientAllowlistRemove(getProjectRoot14(), params)
29730
+ "propose.list": (params) => sentientProposeList(getProjectRoot15(), params),
29731
+ "propose.diff": (params) => sentientProposeDiff(getProjectRoot15(), params),
29732
+ "allowlist.list": (params) => sentientAllowlistList(getProjectRoot15(), params),
29733
+ "propose.accept": (params) => sentientProposeAccept(getProjectRoot15(), params),
29734
+ "propose.reject": (params) => sentientProposeReject(getProjectRoot15(), params),
29735
+ "propose.run": (params) => sentientProposeRun(getProjectRoot15(), params),
29736
+ "propose.enable": (params) => sentientProposeEnable(getProjectRoot15(), params),
29737
+ "propose.disable": (params) => sentientProposeDisable(getProjectRoot15(), params),
29738
+ "allowlist.add": (params) => sentientAllowlistAdd(getProjectRoot15(), params),
29739
+ "allowlist.remove": (params) => sentientAllowlistRemove(getProjectRoot15(), params)
29179
29740
  };
29180
29741
  _sentientTypedHandler = defineTypedHandler("sentient", {
29181
29742
  // -------------------------------------------------------------------------
@@ -29279,7 +29840,7 @@ var init_sentient2 = __esm({
29279
29840
  }
29280
29841
  }
29281
29842
  });
29282
- QUERY_OPS7 = /* @__PURE__ */ new Set(["propose.list", "propose.diff", "allowlist.list"]);
29843
+ QUERY_OPS8 = /* @__PURE__ */ new Set(["propose.list", "propose.diff", "allowlist.list"]);
29283
29844
  MUTATE_OPS7 = /* @__PURE__ */ new Set([
29284
29845
  "propose.accept",
29285
29846
  "propose.reject",
@@ -29313,7 +29874,7 @@ var init_sentient2 = __esm({
29313
29874
  */
29314
29875
  async query(operation, params) {
29315
29876
  const startTime = Date.now();
29316
- if (!QUERY_OPS7.has(operation)) {
29877
+ if (!QUERY_OPS8.has(operation)) {
29317
29878
  return unsupportedOp("query", "sentient", operation, startTime);
29318
29879
  }
29319
29880
  try {
@@ -29408,31 +29969,31 @@ var init_session_context = __esm({
29408
29969
  import {
29409
29970
  getDb,
29410
29971
  getLogger as getLogger13,
29411
- getProjectRoot as getProjectRoot15,
29972
+ getProjectRoot as getProjectRoot16,
29412
29973
  lintSessionForCanonViolations,
29413
29974
  sessions
29414
29975
  } from "@cleocode/core/internal";
29415
29976
  import { eq } from "drizzle-orm";
29416
29977
  async function sessionStatusOp() {
29417
- return sessionStatus(getProjectRoot15());
29978
+ return sessionStatus(getProjectRoot16());
29418
29979
  }
29419
29980
  async function sessionListOp(params) {
29420
- return sessionList(getProjectRoot15(), params);
29981
+ return sessionList(getProjectRoot16(), params);
29421
29982
  }
29422
29983
  async function sessionShowOp(params) {
29423
29984
  if (params.include === "debrief") {
29424
- return sessionDebriefShow(getProjectRoot15(), params.sessionId);
29985
+ return sessionDebriefShow(getProjectRoot16(), params.sessionId);
29425
29986
  }
29426
- return sessionShow(getProjectRoot15(), params.sessionId);
29987
+ return sessionShow(getProjectRoot16(), params.sessionId);
29427
29988
  }
29428
29989
  async function sessionFindOp(params) {
29429
- return sessionFind(getProjectRoot15(), params);
29990
+ return sessionFind(getProjectRoot16(), params);
29430
29991
  }
29431
29992
  async function sessionDecisionLogOp(params) {
29432
- return sessionDecisionLog(getProjectRoot15(), params);
29993
+ return sessionDecisionLog(getProjectRoot16(), params);
29433
29994
  }
29434
29995
  async function sessionContextDriftOp(params) {
29435
- return sessionContextDrift(getProjectRoot15(), params);
29996
+ return sessionContextDrift(getProjectRoot16(), params);
29436
29997
  }
29437
29998
  async function sessionHandoffShowOp(params) {
29438
29999
  let scopeFilter;
@@ -29443,33 +30004,36 @@ async function sessionHandoffShowOp(params) {
29443
30004
  scopeFilter = { type: "epic", epicId: params.scope.replace("epic:", "") };
29444
30005
  }
29445
30006
  }
29446
- return sessionHandoff(getProjectRoot15(), scopeFilter);
30007
+ return sessionHandoff(getProjectRoot16(), scopeFilter);
29447
30008
  }
29448
30009
  async function sessionBriefingShowOp(params) {
29449
- return sessionBriefing(getProjectRoot15(), params);
30010
+ return sessionBriefing(getProjectRoot16(), params);
29450
30011
  }
29451
30012
  async function sessionStartOp(params) {
29452
- return sessionStart(getProjectRoot15(), params);
30013
+ return sessionStart(getProjectRoot16(), params);
29453
30014
  }
29454
30015
  async function sessionEndOp(params) {
29455
- return sessionEnd(getProjectRoot15(), params.note, {
30016
+ return sessionEnd(getProjectRoot16(), params.note, {
29456
30017
  sessionSummary: params.sessionSummary
29457
30018
  });
29458
30019
  }
29459
30020
  async function sessionResumeOp(params) {
29460
- return sessionResume(getProjectRoot15(), params.sessionId);
30021
+ return sessionResume(getProjectRoot16(), params.sessionId);
29461
30022
  }
29462
30023
  async function sessionSuspendOp(params) {
29463
- return sessionSuspend(getProjectRoot15(), params.sessionId, params.reason);
30024
+ return sessionSuspend(getProjectRoot16(), params.sessionId, params.reason);
29464
30025
  }
29465
30026
  async function sessionGcOp(params) {
29466
- return sessionGc(getProjectRoot15(), params.maxAgeDays);
30027
+ return sessionGc(getProjectRoot16(), params.maxAgeDays);
29467
30028
  }
29468
30029
  async function sessionRecordDecisionOp(params) {
29469
- return sessionRecordDecision(getProjectRoot15(), params);
30030
+ return sessionRecordDecision(getProjectRoot16(), params);
29470
30031
  }
29471
30032
  async function sessionRecordAssumptionOp(params) {
29472
- return sessionRecordAssumption(getProjectRoot15(), params);
30033
+ return sessionRecordAssumption(getProjectRoot16(), params);
30034
+ }
30035
+ async function sessionAdoptOp(params) {
30036
+ return sessionAdopt(getProjectRoot16(), params.sessionId);
29473
30037
  }
29474
30038
  async function sessionLintOp(params) {
29475
30039
  if (!params.transcript) {
@@ -29481,7 +30045,7 @@ async function sessionLintOp(params) {
29481
30045
  try {
29482
30046
  const result = lintSessionForCanonViolations({
29483
30047
  transcriptPath: params.transcript,
29484
- projectRoot: getProjectRoot15()
30048
+ projectRoot: getProjectRoot16()
29485
30049
  });
29486
30050
  const wireResult = {
29487
30051
  transcriptPath: result.transcriptPath,
@@ -29518,7 +30082,7 @@ async function storeSessionOwnerAuthToken(projectRoot, sessionId, token) {
29518
30082
  const db = await getDb(projectRoot);
29519
30083
  db.update(sessions).set({ ownerAuthToken: token }).where(eq(sessions.id, sessionId)).run();
29520
30084
  }
29521
- var coreOps6, _sessionTypedHandler, QUERY_OPS8, MUTATE_OPS8, SessionHandler;
30085
+ var coreOps6, _sessionTypedHandler, QUERY_OPS9, MUTATE_OPS8, SessionHandler;
29522
30086
  var init_session3 = __esm({
29523
30087
  "packages/cleo/src/dispatch/domains/session.ts"() {
29524
30088
  "use strict";
@@ -29542,7 +30106,9 @@ var init_session3 = __esm({
29542
30106
  gc: sessionGcOp,
29543
30107
  "record.decision": sessionRecordDecisionOp,
29544
30108
  "record.assumption": sessionRecordAssumptionOp,
29545
- lint: sessionLintOp
30109
+ lint: sessionLintOp,
30110
+ // T9975 — per-agent session isolation
30111
+ adopt: sessionAdoptOp
29546
30112
  };
29547
30113
  _sessionTypedHandler = defineTypedHandler("session", {
29548
30114
  // -------------------------------------------------------------------------
@@ -29602,7 +30168,7 @@ var init_session3 = __esm({
29602
30168
  // SSoT-EXEMPT: storeOwnerAuthToken (DB side-effect requiring post-create sessionId),
29603
30169
  // bindSession (process-scoped context, requires scope-string parsing) — ADR-058
29604
30170
  start: async (params) => {
29605
- const projectRoot = getProjectRoot15();
30171
+ const projectRoot = getProjectRoot16();
29606
30172
  if (!params.scope) {
29607
30173
  return lafsError("E_INVALID_INPUT", "scope is required", "start");
29608
30174
  }
@@ -29651,7 +30217,7 @@ var init_session3 = __esm({
29651
30217
  // SSoT-EXEMPT: orchestrated post-op pipeline — sessionComputeDebrief, persistSessionMemory,
29652
30218
  // unbindSession (process-context teardown), refreshMemoryBridge — ADR-058
29653
30219
  end: async (params) => {
29654
- const projectRoot = getProjectRoot15();
30220
+ const projectRoot = getProjectRoot16();
29655
30221
  const endResult = await coreOps6.end(params);
29656
30222
  if (!endResult.success) {
29657
30223
  return lafsError(
@@ -29750,9 +30316,27 @@ var init_session3 = __esm({
29750
30316
  return lafsError("E_INTERNAL", "session.lint returned no data", "lint");
29751
30317
  }
29752
30318
  return lafsSuccess(result.data, "lint");
30319
+ },
30320
+ // T9975 — per-agent session isolation: adopt rebinds env to a specific session.
30321
+ adopt: async (params) => {
30322
+ if (!params.sessionId) {
30323
+ return lafsError("E_INVALID_INPUT", "sessionId is required", "adopt");
30324
+ }
30325
+ const result = await coreOps6.adopt(params);
30326
+ if (!result.success) {
30327
+ return lafsError(
30328
+ String(result.error?.code ?? "E_INTERNAL"),
30329
+ result.error?.message ?? "Unknown error",
30330
+ "adopt"
30331
+ );
30332
+ }
30333
+ if (!result.data) {
30334
+ return lafsError("E_INTERNAL", "session.adopt returned no data", "adopt");
30335
+ }
30336
+ return lafsSuccess(result.data, "adopt");
29753
30337
  }
29754
30338
  });
29755
- QUERY_OPS8 = /* @__PURE__ */ new Set([
30339
+ QUERY_OPS9 = /* @__PURE__ */ new Set([
29756
30340
  "status",
29757
30341
  "list",
29758
30342
  "show",
@@ -29770,7 +30354,9 @@ var init_session3 = __esm({
29770
30354
  "suspend",
29771
30355
  "gc",
29772
30356
  "record.decision",
29773
- "record.assumption"
30357
+ "record.assumption",
30358
+ // T9975 — per-agent session isolation
30359
+ "adopt"
29774
30360
  ]);
29775
30361
  SessionHandler = class {
29776
30362
  // -----------------------------------------------------------------------
@@ -29784,7 +30370,7 @@ var init_session3 = __esm({
29784
30370
  */
29785
30371
  async query(operation, params) {
29786
30372
  const startTime = Date.now();
29787
- if (!QUERY_OPS8.has(operation)) {
30373
+ if (!QUERY_OPS9.has(operation)) {
29788
30374
  return unsupportedOp("query", "session", operation, startTime);
29789
30375
  }
29790
30376
  try {
@@ -29861,7 +30447,7 @@ var init_session3 = __esm({
29861
30447
  });
29862
30448
 
29863
30449
  // packages/cleo/src/dispatch/domains/sticky.ts
29864
- import { getLogger as getLogger14, getProjectRoot as getProjectRoot16 } from "@cleocode/core";
30450
+ import { getLogger as getLogger14, getProjectRoot as getProjectRoot17 } from "@cleocode/core";
29865
30451
  import {
29866
30452
  stickyAdd,
29867
30453
  stickyArchive,
@@ -29875,7 +30461,7 @@ import {
29875
30461
  } from "@cleocode/core/internal";
29876
30462
  async function stickyListOp(params) {
29877
30463
  return stickyListFiltered(
29878
- getProjectRoot16(),
30464
+ getProjectRoot17(),
29879
30465
  {
29880
30466
  status: params.status,
29881
30467
  color: params.color,
@@ -29887,10 +30473,10 @@ async function stickyListOp(params) {
29887
30473
  );
29888
30474
  }
29889
30475
  async function stickyShowOp(params) {
29890
- return stickyShow(getProjectRoot16(), params.stickyId);
30476
+ return stickyShow(getProjectRoot17(), params.stickyId);
29891
30477
  }
29892
30478
  async function stickyAddOp(params) {
29893
- return stickyAdd(getProjectRoot16(), {
30479
+ return stickyAdd(getProjectRoot17(), {
29894
30480
  content: params.content,
29895
30481
  tags: params.tags,
29896
30482
  color: params.color,
@@ -29898,24 +30484,24 @@ async function stickyAddOp(params) {
29898
30484
  });
29899
30485
  }
29900
30486
  async function stickyArchiveOp(params) {
29901
- return stickyArchive(getProjectRoot16(), params.stickyId);
30487
+ return stickyArchive(getProjectRoot17(), params.stickyId);
29902
30488
  }
29903
30489
  async function stickyPurgeOp(params) {
29904
- return stickyPurge(getProjectRoot16(), params.stickyId);
30490
+ return stickyPurge(getProjectRoot17(), params.stickyId);
29905
30491
  }
29906
30492
  async function stickyConvertTaskOp(params) {
29907
- const result = await stickyConvertToTask(getProjectRoot16(), params.stickyId, params.title);
30493
+ const result = await stickyConvertToTask(getProjectRoot17(), params.stickyId, params.title);
29908
30494
  if (!result.success) return { taskId: void 0 };
29909
30495
  return { taskId: result.data.taskId };
29910
30496
  }
29911
30497
  async function stickyConvertMemoryOp(params) {
29912
- const result = await stickyConvertToMemory(getProjectRoot16(), params.stickyId, params.memoryType);
30498
+ const result = await stickyConvertToMemory(getProjectRoot17(), params.stickyId, params.memoryType);
29913
30499
  if (!result.success) return { memoryId: void 0 };
29914
30500
  return { memoryId: result.data.memoryId };
29915
30501
  }
29916
30502
  async function stickyConvertSessionNoteOp(params) {
29917
30503
  const result = await stickyConvertToSessionNote(
29918
- getProjectRoot16(),
30504
+ getProjectRoot17(),
29919
30505
  params.stickyId,
29920
30506
  params.sessionId
29921
30507
  );
@@ -29923,7 +30509,7 @@ async function stickyConvertSessionNoteOp(params) {
29923
30509
  return { sessionId: result.data.sessionId };
29924
30510
  }
29925
30511
  async function stickyConvertTaskNoteOp(params) {
29926
- const result = await stickyConvertToTaskNote(getProjectRoot16(), params.stickyId, params.taskId);
30512
+ const result = await stickyConvertToTaskNote(getProjectRoot17(), params.stickyId, params.taskId);
29927
30513
  if (!result.success) return { taskId: void 0 };
29928
30514
  return { taskId: result.data.taskId };
29929
30515
  }
@@ -29946,7 +30532,7 @@ function envelopeToDispatch(envelope, gateway, operation, startTime) {
29946
30532
  }
29947
30533
  };
29948
30534
  }
29949
- var log4, stickyCoreOps, _stickyTypedHandler, QUERY_OPS9, MUTATE_OPS9, CONVERT_TARGET_TO_KEY, StickyHandler;
30535
+ var log4, stickyCoreOps, _stickyTypedHandler, QUERY_OPS10, MUTATE_OPS9, CONVERT_TARGET_TO_KEY, StickyHandler;
29950
30536
  var init_sticky2 = __esm({
29951
30537
  "packages/cleo/src/dispatch/domains/sticky.ts"() {
29952
30538
  "use strict";
@@ -30024,7 +30610,7 @@ var init_sticky2 = __esm({
30024
30610
  return data.taskId ? lafsSuccess(data, "convert.task_note") : lafsError("E_CONVERT_FAILED", "convert to task note failed", "convert.task_note");
30025
30611
  }
30026
30612
  });
30027
- QUERY_OPS9 = /* @__PURE__ */ new Set(["list", "show"]);
30613
+ QUERY_OPS10 = /* @__PURE__ */ new Set(["list", "show"]);
30028
30614
  MUTATE_OPS9 = /* @__PURE__ */ new Set(["add", "convert", "archive", "purge"]);
30029
30615
  CONVERT_TARGET_TO_KEY = {
30030
30616
  task: "convert.task",
@@ -30035,7 +30621,7 @@ var init_sticky2 = __esm({
30035
30621
  StickyHandler = class {
30036
30622
  async query(operation, params) {
30037
30623
  const startTime = Date.now();
30038
- if (!QUERY_OPS9.has(operation)) {
30624
+ if (!QUERY_OPS10.has(operation)) {
30039
30625
  return unsupportedOp("query", "sticky", operation, startTime);
30040
30626
  }
30041
30627
  try {
@@ -30094,9 +30680,30 @@ var init_sticky2 = __esm({
30094
30680
  });
30095
30681
 
30096
30682
  // packages/cleo/src/dispatch/domains/tasks.ts
30097
- import { getLogger as getLogger15, getProjectRoot as getProjectRoot17 } from "@cleocode/core";
30683
+ import { getLogger as getLogger15, getProjectRoot as getProjectRoot18 } from "@cleocode/core";
30684
+ import { createAttachmentStore as createAttachmentStore4 } from "@cleocode/core/internal";
30685
+ async function fetchTaskAttachments(projectRoot, taskId) {
30686
+ try {
30687
+ const store = createAttachmentStore4();
30688
+ const metas = await store.listByOwner("task", taskId, projectRoot);
30689
+ const entries = [];
30690
+ for (const meta of metas) {
30691
+ const extras = await store.getExtras(meta.id, projectRoot);
30692
+ const entry = {
30693
+ attachmentId: meta.id,
30694
+ kind: meta.attachment.kind,
30695
+ ...extras?.slug != null ? { slug: extras.slug } : {},
30696
+ ...extras?.type != null ? { type: extras.type } : {}
30697
+ };
30698
+ entries.push(entry);
30699
+ }
30700
+ return entries;
30701
+ } catch {
30702
+ return [];
30703
+ }
30704
+ }
30098
30705
  async function sagaCreate(params) {
30099
- const projectRoot = getProjectRoot17();
30706
+ const projectRoot = getProjectRoot18();
30100
30707
  const title = typeof params.title === "string" ? params.title : "";
30101
30708
  const description = typeof params.description === "string" ? params.description : void 0;
30102
30709
  const acceptance = Array.isArray(params.acceptance) ? params.acceptance : void 0;
@@ -30112,7 +30719,7 @@ async function sagaCreate(params) {
30112
30719
  );
30113
30720
  }
30114
30721
  async function sagaAdd(params) {
30115
- const projectRoot = getProjectRoot17();
30722
+ const projectRoot = getProjectRoot18();
30116
30723
  const sagaId = typeof params.sagaId === "string" ? params.sagaId : "";
30117
30724
  const epicId = typeof params.epicId === "string" ? params.epicId : "";
30118
30725
  if (!sagaId || !epicId) {
@@ -30150,7 +30757,7 @@ async function sagaAdd(params) {
30150
30757
  return lafsSuccess({ sagaId, epicId, added: relResult.data?.added ?? true }, "saga.add");
30151
30758
  }
30152
30759
  async function sagaList() {
30153
- const projectRoot = getProjectRoot17();
30760
+ const projectRoot = getProjectRoot18();
30154
30761
  const result = await taskList(projectRoot, { type: "epic", label: "saga" });
30155
30762
  if (!result.success) {
30156
30763
  return lafsError("E_GENERAL", result.error?.message ?? "Failed to list Sagas", "saga.list");
@@ -30163,7 +30770,7 @@ async function sagaList() {
30163
30770
  return lafsSuccess({ sagas: topLevel, total: topLevel.length }, "saga.list");
30164
30771
  }
30165
30772
  async function sagaMembers(params) {
30166
- const projectRoot = getProjectRoot17();
30773
+ const projectRoot = getProjectRoot18();
30167
30774
  const sagaId = typeof params.sagaId === "string" ? params.sagaId : "";
30168
30775
  if (!sagaId) {
30169
30776
  return lafsError("E_INVALID_INPUT", "sagaId is required", "saga.members");
@@ -30188,7 +30795,7 @@ async function sagaMembers(params) {
30188
30795
  );
30189
30796
  }
30190
30797
  async function sagaRollup(params) {
30191
- const projectRoot = getProjectRoot17();
30798
+ const projectRoot = getProjectRoot18();
30192
30799
  const sagaId = typeof params.sagaId === "string" ? params.sagaId : "";
30193
30800
  if (!sagaId) {
30194
30801
  return lafsError("E_INVALID_INPUT", "sagaId is required", "saga.rollup");
@@ -30228,7 +30835,7 @@ async function sagaRollup(params) {
30228
30835
  "saga.rollup"
30229
30836
  );
30230
30837
  }
30231
- var _tasksTypedHandler, QUERY_OPS10, MUTATE_OPS10, TasksHandler;
30838
+ var _tasksTypedHandler, QUERY_OPS11, MUTATE_OPS10, TasksHandler;
30232
30839
  var init_tasks3 = __esm({
30233
30840
  "packages/cleo/src/dispatch/domains/tasks.ts"() {
30234
30841
  "use strict";
@@ -30240,17 +30847,29 @@ var init_tasks3 = __esm({
30240
30847
  // Query ops
30241
30848
  // -------------------------------------------------------------------------
30242
30849
  show: async (params) => {
30243
- const projectRoot = getProjectRoot17();
30850
+ const projectRoot = getProjectRoot18();
30244
30851
  if (params.ivtrHistory) {
30245
30852
  return wrapCoreResult(await taskShowIvtrHistory(projectRoot, params.taskId), "show");
30246
30853
  }
30247
30854
  if (params.history) {
30248
30855
  return wrapCoreResult(await taskShowWithHistory(projectRoot, params.taskId, true), "show");
30249
30856
  }
30250
- return wrapCoreResult(await taskShow(projectRoot, params.taskId), "show");
30857
+ const [coreResult, attachments] = await Promise.all([
30858
+ taskShow(projectRoot, params.taskId),
30859
+ fetchTaskAttachments(projectRoot, params.taskId)
30860
+ ]);
30861
+ if (!coreResult.success) {
30862
+ return wrapCoreResult(coreResult, "show");
30863
+ }
30864
+ const showResult = {
30865
+ task: coreResult.data.task,
30866
+ view: coreResult.data.view,
30867
+ attachments
30868
+ };
30869
+ return { success: true, data: showResult };
30251
30870
  },
30252
30871
  list: async (params) => {
30253
- const projectRoot = getProjectRoot17();
30872
+ const projectRoot = getProjectRoot18();
30254
30873
  const result = await taskList(projectRoot, {
30255
30874
  parent: params.parent,
30256
30875
  status: params.status,
@@ -30276,7 +30895,7 @@ var init_tasks3 = __esm({
30276
30895
  return lafsSuccess(result.data, "list");
30277
30896
  },
30278
30897
  find: async (params) => {
30279
- const projectRoot = getProjectRoot17();
30898
+ const projectRoot = getProjectRoot18();
30280
30899
  return wrapCoreResult(
30281
30900
  await taskFind(projectRoot, params.query, params.limit, {
30282
30901
  id: params.id,
@@ -30293,15 +30912,15 @@ var init_tasks3 = __esm({
30293
30912
  );
30294
30913
  },
30295
30914
  tree: async (params) => {
30296
- const projectRoot = getProjectRoot17();
30915
+ const projectRoot = getProjectRoot18();
30297
30916
  return wrapCoreResult(await taskTree(projectRoot, params.taskId, params.withBlockers), "tree");
30298
30917
  },
30299
30918
  blockers: async (params) => {
30300
- const projectRoot = getProjectRoot17();
30919
+ const projectRoot = getProjectRoot18();
30301
30920
  return wrapCoreResult(await taskBlockers(projectRoot, params), "blockers");
30302
30921
  },
30303
30922
  depends: async (params) => {
30304
- const projectRoot = getProjectRoot17();
30923
+ const projectRoot = getProjectRoot18();
30305
30924
  if (params.action === "overview") {
30306
30925
  return wrapCoreResult(await taskDepsOverview(projectRoot), "depends");
30307
30926
  }
@@ -30321,14 +30940,14 @@ var init_tasks3 = __esm({
30321
30940
  );
30322
30941
  },
30323
30942
  "deps.validate": async (params) => {
30324
- const projectRoot = getProjectRoot17();
30943
+ const projectRoot = getProjectRoot18();
30325
30944
  return wrapCoreResult(
30326
30945
  await taskDepsValidate(projectRoot, params.epicId, params.scope),
30327
30946
  "deps.validate"
30328
30947
  );
30329
30948
  },
30330
30949
  "deps.tree": async (params) => {
30331
- const projectRoot = getProjectRoot17();
30950
+ const projectRoot = getProjectRoot18();
30332
30951
  if (!params.epicId) {
30333
30952
  return lafsError("E_INVALID_INPUT", "epicId is required for deps.tree", "deps.tree");
30334
30953
  }
@@ -30338,29 +30957,29 @@ var init_tasks3 = __esm({
30338
30957
  );
30339
30958
  },
30340
30959
  analyze: async (params) => {
30341
- const projectRoot = getProjectRoot17();
30960
+ const projectRoot = getProjectRoot18();
30342
30961
  return wrapCoreResult(
30343
30962
  await taskAnalyze(projectRoot, params.taskId, { tierLimit: params.tierLimit }),
30344
30963
  "analyze"
30345
30964
  );
30346
30965
  },
30347
30966
  impact: async (params) => {
30348
- const projectRoot = getProjectRoot17();
30967
+ const projectRoot = getProjectRoot18();
30349
30968
  return wrapCoreResult(
30350
30969
  await taskImpact(projectRoot, params.change, params.matchLimit),
30351
30970
  "impact"
30352
30971
  );
30353
30972
  },
30354
30973
  next: async (params) => {
30355
- const projectRoot = getProjectRoot17();
30974
+ const projectRoot = getProjectRoot18();
30356
30975
  return wrapCoreResult(await taskNext(projectRoot, params), "next");
30357
30976
  },
30358
30977
  plan: async (_params) => {
30359
- const projectRoot = getProjectRoot17();
30978
+ const projectRoot = getProjectRoot18();
30360
30979
  return wrapCoreResult(await taskPlan(projectRoot), "plan");
30361
30980
  },
30362
30981
  relates: async (params) => {
30363
- const projectRoot = getProjectRoot17();
30982
+ const projectRoot = getProjectRoot18();
30364
30983
  if (params.mode) {
30365
30984
  return wrapCoreResult(
30366
30985
  await taskRelatesFind(projectRoot, params.taskId, {
@@ -30373,36 +30992,36 @@ var init_tasks3 = __esm({
30373
30992
  return wrapCoreResult(await taskRelates(projectRoot, params.taskId), "relates");
30374
30993
  },
30375
30994
  "complexity.estimate": async (params) => {
30376
- const projectRoot = getProjectRoot17();
30995
+ const projectRoot = getProjectRoot18();
30377
30996
  return wrapCoreResult(
30378
30997
  await taskComplexityEstimate(projectRoot, { taskId: params.taskId }),
30379
30998
  "complexity.estimate"
30380
30999
  );
30381
31000
  },
30382
31001
  history: async (params) => {
30383
- const projectRoot = getProjectRoot17();
31002
+ const projectRoot = getProjectRoot18();
30384
31003
  if (params.taskId) {
30385
31004
  return wrapCoreResult(await taskHistory(projectRoot, params.taskId, params.limit), "history");
30386
31005
  }
30387
31006
  return wrapCoreResult(await taskWorkHistory(projectRoot), "history");
30388
31007
  },
30389
31008
  current: async (_params) => {
30390
- const projectRoot = getProjectRoot17();
31009
+ const projectRoot = getProjectRoot18();
30391
31010
  return wrapCoreResult(await taskCurrentGet(projectRoot), "current");
30392
31011
  },
30393
31012
  "label.list": async (_params) => {
30394
- const projectRoot = getProjectRoot17();
31013
+ const projectRoot = getProjectRoot18();
30395
31014
  return wrapCoreResult(await taskLabelList(projectRoot), "label.list");
30396
31015
  },
30397
31016
  "sync.links": async (params) => {
30398
- const projectRoot = getProjectRoot17();
31017
+ const projectRoot = getProjectRoot18();
30399
31018
  return wrapCoreResult(await taskSyncLinks(projectRoot, params), "sync.links");
30400
31019
  },
30401
31020
  // -------------------------------------------------------------------------
30402
31021
  // Mutate ops
30403
31022
  // -------------------------------------------------------------------------
30404
31023
  "add-batch": async (params) => {
30405
- const projectRoot = getProjectRoot17();
31024
+ const projectRoot = getProjectRoot18();
30406
31025
  return wrapCoreResult(
30407
31026
  await tasksAddBatchOp(projectRoot, {
30408
31027
  tasks: params.tasks ?? [],
@@ -30413,7 +31032,7 @@ var init_tasks3 = __esm({
30413
31032
  );
30414
31033
  },
30415
31034
  add: async (params) => {
30416
- const projectRoot = getProjectRoot17();
31035
+ const projectRoot = getProjectRoot18();
30417
31036
  return wrapCoreResult(
30418
31037
  await addTaskWithSessionScope(projectRoot, {
30419
31038
  title: params.title,
@@ -30441,7 +31060,7 @@ var init_tasks3 = __esm({
30441
31060
  );
30442
31061
  },
30443
31062
  update: async (params) => {
30444
- const projectRoot = getProjectRoot17();
31063
+ const projectRoot = getProjectRoot18();
30445
31064
  return wrapCoreResult(
30446
31065
  await taskUpdate(projectRoot, params.taskId, {
30447
31066
  title: params.title,
@@ -30484,7 +31103,7 @@ var init_tasks3 = __esm({
30484
31103
  );
30485
31104
  },
30486
31105
  complete: async (params) => {
30487
- const projectRoot = getProjectRoot17();
31106
+ const projectRoot = getProjectRoot18();
30488
31107
  if (params.force !== void 0) {
30489
31108
  return lafsError(
30490
31109
  "E_FLAG_REMOVED",
@@ -30507,15 +31126,15 @@ var init_tasks3 = __esm({
30507
31126
  return wrapCoreResult(result, "complete");
30508
31127
  },
30509
31128
  cancel: async (params) => {
30510
- const projectRoot = getProjectRoot17();
31129
+ const projectRoot = getProjectRoot18();
30511
31130
  return wrapCoreResult(await taskCancel(projectRoot, params.taskId, params.reason), "cancel");
30512
31131
  },
30513
31132
  delete: async (params) => {
30514
- const projectRoot = getProjectRoot17();
31133
+ const projectRoot = getProjectRoot18();
30515
31134
  return wrapCoreResult(await taskDelete(projectRoot, params.taskId, params.force), "delete");
30516
31135
  },
30517
31136
  archive: async (params) => {
30518
- const projectRoot = getProjectRoot17();
31137
+ const projectRoot = getProjectRoot18();
30519
31138
  return wrapCoreResult(
30520
31139
  await taskArchive(projectRoot, params.taskId, params.before, {
30521
31140
  taskIds: params.taskIds,
@@ -30526,7 +31145,7 @@ var init_tasks3 = __esm({
30526
31145
  );
30527
31146
  },
30528
31147
  restore: async (params) => {
30529
- const projectRoot = getProjectRoot17();
31148
+ const projectRoot = getProjectRoot18();
30530
31149
  if (params.from === "done") {
30531
31150
  return wrapCoreResult(
30532
31151
  await taskReopen(projectRoot, params.taskId, {
@@ -30554,21 +31173,21 @@ var init_tasks3 = __esm({
30554
31173
  );
30555
31174
  },
30556
31175
  reparent: async (params) => {
30557
- const projectRoot = getProjectRoot17();
31176
+ const projectRoot = getProjectRoot18();
30558
31177
  return wrapCoreResult(
30559
31178
  await taskReparent(projectRoot, params.taskId, params.newParentId ?? null),
30560
31179
  "reparent"
30561
31180
  );
30562
31181
  },
30563
31182
  reorder: async (params) => {
30564
- const projectRoot = getProjectRoot17();
31183
+ const projectRoot = getProjectRoot18();
30565
31184
  return wrapCoreResult(
30566
31185
  await taskReorder(projectRoot, params.taskId, params.position),
30567
31186
  "reorder"
30568
31187
  );
30569
31188
  },
30570
31189
  "relates.add": async (params) => {
30571
- const projectRoot = getProjectRoot17();
31190
+ const projectRoot = getProjectRoot18();
30572
31191
  const relatedId = params.relatedId ?? params.targetId;
30573
31192
  if (!relatedId) {
30574
31193
  return lafsError("E_INVALID_INPUT", "relatedId (or targetId) is required", "relates.add");
@@ -30579,7 +31198,7 @@ var init_tasks3 = __esm({
30579
31198
  );
30580
31199
  },
30581
31200
  "relates.remove": async (params) => {
30582
- const projectRoot = getProjectRoot17();
31201
+ const projectRoot = getProjectRoot18();
30583
31202
  if (!params.relatedId) {
30584
31203
  return lafsError("E_INVALID_INPUT", "relatedId is required", "relates.remove");
30585
31204
  }
@@ -30589,15 +31208,15 @@ var init_tasks3 = __esm({
30589
31208
  );
30590
31209
  },
30591
31210
  start: async (params) => {
30592
- const projectRoot = getProjectRoot17();
31211
+ const projectRoot = getProjectRoot18();
30593
31212
  return wrapCoreResult(await taskStart(projectRoot, params.taskId), "start");
30594
31213
  },
30595
31214
  stop: async (_params) => {
30596
- const projectRoot = getProjectRoot17();
31215
+ const projectRoot = getProjectRoot18();
30597
31216
  return wrapCoreResult(await taskStop(projectRoot), "stop");
30598
31217
  },
30599
31218
  "sync.reconcile": async (params) => {
30600
- const projectRoot = getProjectRoot17();
31219
+ const projectRoot = getProjectRoot18();
30601
31220
  return wrapCoreResult(
30602
31221
  await taskSyncReconcile(projectRoot, {
30603
31222
  providerId: params.providerId,
@@ -30611,22 +31230,22 @@ var init_tasks3 = __esm({
30611
31230
  );
30612
31231
  },
30613
31232
  "sync.links.remove": async (params) => {
30614
- const projectRoot = getProjectRoot17();
31233
+ const projectRoot = getProjectRoot18();
30615
31234
  return wrapCoreResult(
30616
31235
  await taskSyncLinksRemove(projectRoot, params.providerId),
30617
31236
  "sync.links.remove"
30618
31237
  );
30619
31238
  },
30620
31239
  claim: async (params) => {
30621
- const projectRoot = getProjectRoot17();
31240
+ const projectRoot = getProjectRoot18();
30622
31241
  return wrapCoreResult(await taskClaim(projectRoot, params.taskId, params.agentId), "claim");
30623
31242
  },
30624
31243
  unclaim: async (params) => {
30625
- const projectRoot = getProjectRoot17();
31244
+ const projectRoot = getProjectRoot18();
30626
31245
  return wrapCoreResult(await taskUnclaim(projectRoot, params.taskId), "unclaim");
30627
31246
  }
30628
31247
  });
30629
- QUERY_OPS10 = /* @__PURE__ */ new Set([
31248
+ QUERY_OPS11 = /* @__PURE__ */ new Set([
30630
31249
  "show",
30631
31250
  "list",
30632
31251
  "find",
@@ -30685,7 +31304,7 @@ var init_tasks3 = __esm({
30685
31304
  */
30686
31305
  async query(operation, params) {
30687
31306
  const startTime = Date.now();
30688
- if (!QUERY_OPS10.has(operation)) {
31307
+ if (!QUERY_OPS11.has(operation)) {
30689
31308
  return unsupportedOp("query", "tasks", operation, startTime);
30690
31309
  }
30691
31310
  if (operation === "impact" && !params?.change) {
@@ -30849,7 +31468,7 @@ var init_tasks3 = __esm({
30849
31468
  });
30850
31469
 
30851
31470
  // packages/cleo/src/dispatch/domains/tools.ts
30852
- import { getLogger as getLogger16, getProjectRoot as getProjectRoot18 } from "@cleocode/core";
31471
+ import { getLogger as getLogger16, getProjectRoot as getProjectRoot19 } from "@cleocode/core";
30853
31472
  import {
30854
31473
  codeOutline,
30855
31474
  codeParse,
@@ -30900,7 +31519,7 @@ var init_tools = __esm({
30900
31519
  init_routing();
30901
31520
  ToolsHandler = class {
30902
31521
  get projectRoot() {
30903
- return getProjectRoot18();
31522
+ return getProjectRoot19();
30904
31523
  }
30905
31524
  // -----------------------------------------------------------------------
30906
31525
  // DomainHandler interface
@@ -31482,7 +32101,7 @@ var init_tools = __esm({
31482
32101
  // packages/cleo/src/dispatch/domains/upgrade.ts
31483
32102
  import { dirname as dirname3, resolve as resolve3 } from "node:path";
31484
32103
  import { fileURLToPath as fileURLToPath2 } from "node:url";
31485
- import { getLogger as getLogger17, getProjectRoot as getProjectRoot19 } from "@cleocode/core";
32104
+ import { getLogger as getLogger17, getProjectRoot as getProjectRoot20 } from "@cleocode/core";
31486
32105
  import { upgradeWorkflows } from "@cleocode/core/internal";
31487
32106
  function resolveTemplatesDir() {
31488
32107
  const here = dirname3(fileURLToPath2(import.meta.url));
@@ -31522,7 +32141,7 @@ var init_upgrade = __esm({
31522
32141
  case "workflows": {
31523
32142
  const includeRendered = params?.["includeRendered"] === true;
31524
32143
  const result = await upgradeWorkflows({
31525
- projectRoot: getProjectRoot19(),
32144
+ projectRoot: getProjectRoot20(),
31526
32145
  templatesDir: resolveTemplatesDir(),
31527
32146
  dryRun: true
31528
32147
  });
@@ -31565,7 +32184,7 @@ var init_upgrade = __esm({
31565
32184
  const dryRun = params?.["dryRun"] === true;
31566
32185
  const includeRendered = params?.["includeRendered"] === true;
31567
32186
  const result = await upgradeWorkflows({
31568
- projectRoot: getProjectRoot19(),
32187
+ projectRoot: getProjectRoot20(),
31569
32188
  templatesDir: resolveTemplatesDir(),
31570
32189
  force,
31571
32190
  dryRun
@@ -31607,7 +32226,7 @@ import {
31607
32226
  adoptWorktree,
31608
32227
  forceUnlockWorktree,
31609
32228
  getLogger as getLogger18,
31610
- getProjectRoot as getProjectRoot20,
32229
+ getProjectRoot as getProjectRoot21,
31611
32230
  listWorktrees,
31612
32231
  pruneOrphanedWorktreesByStatus
31613
32232
  } from "@cleocode/core/internal";
@@ -31659,7 +32278,7 @@ var init_worktree2 = __esm({
31659
32278
  switch (operation) {
31660
32279
  case "list": {
31661
32280
  const opts = {
31662
- projectRoot: getProjectRoot20(),
32281
+ projectRoot: getProjectRoot21(),
31663
32282
  statusFilter: coerceStatusFilter(params?.["statusFilter"]),
31664
32283
  staleDays: typeof params?.["staleDays"] === "number" ? params["staleDays"] : void 0
31665
32284
  };
@@ -31722,7 +32341,7 @@ var init_worktree2 = __esm({
31722
32341
  const rawTaskId = params?.["taskId"];
31723
32342
  const taskId = rawTaskId === null ? null : typeof rawTaskId === "string" && rawTaskId.length > 0 ? rawTaskId : void 0;
31724
32343
  const opts = {
31725
- projectRoot: getProjectRoot20(),
32344
+ projectRoot: getProjectRoot21(),
31726
32345
  worktreePath,
31727
32346
  ...source !== void 0 ? { source } : {},
31728
32347
  ...taskId !== void 0 ? { taskId } : {},
@@ -31755,7 +32374,7 @@ var init_worktree2 = __esm({
31755
32374
  deleteBranch: params?.["deleteBranch"] !== false,
31756
32375
  ...typeof params?.["reason"] === "string" && params["reason"].length > 0 ? { reason: params["reason"] } : {}
31757
32376
  };
31758
- const result = await destroyWorktree(getProjectRoot20(), opts);
32377
+ const result = await destroyWorktree(getProjectRoot21(), opts);
31759
32378
  const engineResult = result.error !== void 0 ? {
31760
32379
  success: false,
31761
32380
  error: {
@@ -31774,7 +32393,7 @@ var init_worktree2 = __esm({
31774
32393
  }
31775
32394
  case "prune": {
31776
32395
  const opts = {
31777
- projectRoot: getProjectRoot20(),
32396
+ projectRoot: getProjectRoot21(),
31778
32397
  dryRun: params?.["dryRun"] === true,
31779
32398
  ...typeof params?.["staleDays"] === "number" ? { staleDays: params["staleDays"] } : {},
31780
32399
  ...typeof params?.["idleDays"] === "number" ? { staleDays: params["idleDays"] } : {},
@@ -31803,7 +32422,7 @@ var init_worktree2 = __esm({
31803
32422
  );
31804
32423
  }
31805
32424
  const opts = {
31806
- projectRoot: getProjectRoot20(),
32425
+ projectRoot: getProjectRoot21(),
31807
32426
  taskId,
31808
32427
  ...typeof params?.["actor"] === "string" && params["actor"].length > 0 ? { actor: params["actor"] } : {}
31809
32428
  };
@@ -31856,6 +32475,7 @@ function createDomainHandlers() {
31856
32475
  handlers.set("sticky", new StickyHandler());
31857
32476
  handlers.set("diagnostics", new DiagnosticsHandler());
31858
32477
  handlers.set("docs", new DocsHandler());
32478
+ handlers.set("focus", new FocusHandler());
31859
32479
  handlers.set("playbook", new PlaybookHandler());
31860
32480
  handlers.set("conduit", new ConduitHandler());
31861
32481
  handlers.set("sentient", new SentientHandler());
@@ -31874,6 +32494,7 @@ var init_domains = __esm({
31874
32494
  init_conduit2();
31875
32495
  init_diagnostics();
31876
32496
  init_docs2();
32497
+ init_focus2();
31877
32498
  init_intelligence2();
31878
32499
  init_llm2();
31879
32500
  init_memory2();
@@ -32326,11 +32947,11 @@ var init_security = __esm({
32326
32947
  });
32327
32948
 
32328
32949
  // packages/cleo/src/dispatch/middleware/sanitizer.ts
32329
- function createSanitizer(getProjectRoot43) {
32950
+ function createSanitizer(getProjectRoot44) {
32330
32951
  return async (req, next) => {
32331
32952
  if (req.params) {
32332
32953
  try {
32333
- const root = getProjectRoot43 ? getProjectRoot43() : void 0;
32954
+ const root = getProjectRoot44 ? getProjectRoot44() : void 0;
32334
32955
  req.params = sanitizeParams(req.params, root, {
32335
32956
  domain: req.domain,
32336
32957
  operation: req.operation
@@ -32455,7 +33076,7 @@ import { createRequire } from "node:module";
32455
33076
  import { dirname as dirname4, join as join8 } from "node:path";
32456
33077
  import { fileURLToPath as fileURLToPath3 } from "node:url";
32457
33078
  import { catalog, registerSkillLibraryFromPath } from "@cleocode/caamp";
32458
- import { autoRecordDispatchTokenUsage, getProjectRoot as getProjectRoot21, hooks } from "@cleocode/core/internal";
33079
+ import { autoRecordDispatchTokenUsage, getProjectRoot as getProjectRoot22, hooks } from "@cleocode/core/internal";
32459
33080
  function ensureCaampLibrary() {
32460
33081
  if (catalog.isCatalogAvailable()) return;
32461
33082
  try {
@@ -32506,7 +33127,7 @@ function createCliDispatcher() {
32506
33127
  middlewares: [
32507
33128
  createSessionResolver(lookupCliSession),
32508
33129
  // T4959: session identity first
32509
- createSanitizer(() => getProjectRoot21()),
33130
+ createSanitizer(() => getProjectRoot22()),
32510
33131
  createFieldFilter(),
32511
33132
  createAudit(),
32512
33133
  // T4959: CLI now gets audit trail
@@ -32520,7 +33141,7 @@ function resetCliDispatcher() {
32520
33141
  }
32521
33142
  async function dispatchFromCli(gateway, domain, operation, params, outputOpts) {
32522
33143
  const dispatcher = getCliDispatcher();
32523
- const projectRoot = getProjectRoot21();
33144
+ const projectRoot = getProjectRoot22();
32524
33145
  const dispatchStart = Date.now();
32525
33146
  hooks.dispatch("PromptSubmit", projectRoot, {
32526
33147
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -32565,7 +33186,7 @@ async function dispatchFromCli(gateway, domain, operation, params, outputOpts) {
32565
33186
  operation,
32566
33187
  sessionId: response.meta.sessionId,
32567
33188
  requestId: response.meta.requestId,
32568
- cwd: getProjectRoot21()
33189
+ cwd: getProjectRoot22()
32569
33190
  });
32570
33191
  const opts = {
32571
33192
  command: outputOpts?.command ?? operation,
@@ -32627,7 +33248,7 @@ function handleRawError(response, _opts) {
32627
33248
  }
32628
33249
  async function dispatchRaw(gateway, domain, operation, params) {
32629
33250
  const dispatcher = getCliDispatcher();
32630
- const projectRoot = getProjectRoot21();
33251
+ const projectRoot = getProjectRoot22();
32631
33252
  const dispatchStart = Date.now();
32632
33253
  hooks.dispatch("PromptSubmit", projectRoot, {
32633
33254
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -32982,7 +33603,7 @@ __export(add_exports, {
32982
33603
  });
32983
33604
  import {
32984
33605
  appendSignedSeverityAttestation,
32985
- getProjectRoot as getProjectRoot22,
33606
+ getProjectRoot as getProjectRoot23,
32986
33607
  inferTaskAddParams
32987
33608
  } from "@cleocode/core";
32988
33609
  var addCommand;
@@ -33211,7 +33832,7 @@ For 2+ tasks at once: cleo add-batch --file tasks.json (single transaction, atom
33211
33832
  return;
33212
33833
  }
33213
33834
  if (args["depends-waiver"] !== void 0) params["dependsWaiver"] = args["depends-waiver"];
33214
- const inferred = await inferTaskAddParams(getProjectRoot22(), {
33835
+ const inferred = await inferTaskAddParams(getProjectRoot23(), {
33215
33836
  title: args.title,
33216
33837
  description: args.description ?? args.desc,
33217
33838
  filesInfer: args["files-infer"],
@@ -33835,7 +34456,7 @@ var agent_exports = {};
33835
34456
  __export(agent_exports, {
33836
34457
  agentCommand: () => agentCommand
33837
34458
  });
33838
- import { getProjectRoot as getProjectRoot23 } from "@cleocode/core";
34459
+ import { getProjectRoot as getProjectRoot24 } from "@cleocode/core";
33839
34460
  import {
33840
34461
  checkAgentHealth,
33841
34462
  detectCrashedAgents,
@@ -34228,7 +34849,7 @@ var init_agent = __esm({
34228
34849
  const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
34229
34850
  const { getDb: getDb3 } = await import("@cleocode/core/internal");
34230
34851
  await getDb3();
34231
- const registry = new AgentRegistryAccessor(getProjectRoot23());
34852
+ const registry = new AgentRegistryAccessor(getProjectRoot24());
34232
34853
  const agentId = args.id;
34233
34854
  const displayName = args.name;
34234
34855
  const classification = args.classification;
@@ -34346,7 +34967,7 @@ agent ${agentId}:
34346
34967
  const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
34347
34968
  const { getDb: getDb3 } = await import("@cleocode/core/internal");
34348
34969
  await getDb3();
34349
- const registry = new AgentRegistryAccessor(getProjectRoot23());
34970
+ const registry = new AgentRegistryAccessor(getProjectRoot24());
34350
34971
  const credential = await registry.get(args.agentId);
34351
34972
  if (!credential) {
34352
34973
  cliOutput(
@@ -34434,7 +35055,7 @@ agent ${agentId}:
34434
35055
  const { existsSync: existsSync18, readFileSync: readFileSync19 } = await import("node:fs");
34435
35056
  const { join: join35 } = await import("node:path");
34436
35057
  await getDb3();
34437
- const registry = new AgentRegistryAccessor(getProjectRoot23());
35058
+ const registry = new AgentRegistryAccessor(getProjectRoot24());
34438
35059
  const credential = await registry.get(args.agentId);
34439
35060
  if (!credential) {
34440
35061
  cliOutput(
@@ -34553,7 +35174,7 @@ agent ${agentId}:
34553
35174
  const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
34554
35175
  const { getDb: getDb3 } = await import("@cleocode/core/internal");
34555
35176
  await getDb3();
34556
- const registry = new AgentRegistryAccessor(getProjectRoot23());
35177
+ const registry = new AgentRegistryAccessor(getProjectRoot24());
34557
35178
  const credential = await registry.get(args.agentId);
34558
35179
  if (!credential) {
34559
35180
  cliOutput(
@@ -34610,7 +35231,7 @@ agent ${agentId}:
34610
35231
  const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
34611
35232
  const { getDb: getDb3 } = await import("@cleocode/core/internal");
34612
35233
  await getDb3();
34613
- const registry = new AgentRegistryAccessor(getProjectRoot23());
35234
+ const registry = new AgentRegistryAccessor(getProjectRoot24());
34614
35235
  if (args.agentId) {
34615
35236
  const credential = await registry.get(args.agentId);
34616
35237
  if (!credential) {
@@ -34686,7 +35307,7 @@ agent ${agentId}:
34686
35307
  const { AgentRegistryAccessor, createConduit } = await import("@cleocode/core/agents");
34687
35308
  const { getDb: getDb3 } = await import("@cleocode/core/internal");
34688
35309
  await getDb3();
34689
- const registry = new AgentRegistryAccessor(getProjectRoot23());
35310
+ const registry = new AgentRegistryAccessor(getProjectRoot24());
34690
35311
  const active = await registry.getActive();
34691
35312
  if (!active) {
34692
35313
  cliOutput(
@@ -34743,7 +35364,7 @@ Assigned task ${args.taskId}. Run: cleo show ${args.taskId} && cleo start ${args
34743
35364
  const { AgentRegistryAccessor, createConduit } = await import("@cleocode/core/agents");
34744
35365
  const { getDb: getDb3 } = await import("@cleocode/core/internal");
34745
35366
  await getDb3();
34746
- const registry = new AgentRegistryAccessor(getProjectRoot23());
35367
+ const registry = new AgentRegistryAccessor(getProjectRoot24());
34747
35368
  const active = await registry.getActive();
34748
35369
  if (!active) {
34749
35370
  cliOutput(
@@ -34809,7 +35430,7 @@ You are idle. Check your queue: cleo current || cleo next. Report status immedia
34809
35430
  const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
34810
35431
  const { getDb: getDb3 } = await import("@cleocode/core/internal");
34811
35432
  await getDb3();
34812
- const registry = new AgentRegistryAccessor(getProjectRoot23());
35433
+ const registry = new AgentRegistryAccessor(getProjectRoot24());
34813
35434
  const role = args.role;
34814
35435
  const taskId = args.task;
34815
35436
  const model = args.model ?? "sonnet";
@@ -34874,7 +35495,7 @@ You are idle. Check your queue: cleo current || cleo next. Report status immedia
34874
35495
  const { AgentRegistryAccessor, createConduit } = await import("@cleocode/core/agents");
34875
35496
  const { getDb: getDb3 } = await import("@cleocode/core/internal");
34876
35497
  await getDb3();
34877
- const registry = new AgentRegistryAccessor(getProjectRoot23());
35498
+ const registry = new AgentRegistryAccessor(getProjectRoot24());
34878
35499
  const active = await registry.getActive();
34879
35500
  if (!active) {
34880
35501
  cliOutput(
@@ -34918,7 +35539,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
34918
35539
  const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
34919
35540
  const { getDb: getDb3 } = await import("@cleocode/core/internal");
34920
35541
  await getDb3();
34921
- const registry = new AgentRegistryAccessor(getProjectRoot23());
35542
+ const registry = new AgentRegistryAccessor(getProjectRoot24());
34922
35543
  const agents = await registry.list({ active: true });
34923
35544
  let stopped = 0;
34924
35545
  for (const a of agents) {
@@ -34991,7 +35612,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
34991
35612
  const { promisify: promisify2 } = await import("node:util");
34992
35613
  const execFileAsync = promisify2(execFile2);
34993
35614
  await getDb3();
34994
- const registry = new AgentRegistryAccessor(getProjectRoot23());
35615
+ const registry = new AgentRegistryAccessor(getProjectRoot24());
34995
35616
  const credential = await registry.get(args.agentId);
34996
35617
  if (!credential) {
34997
35618
  cliOutput(
@@ -35148,7 +35769,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
35148
35769
  await getDb3();
35149
35770
  const includeGlobal = args.global === true;
35150
35771
  const includeDisabled = args["include-disabled"] === true;
35151
- const agents = listAgentsForProject(getProjectRoot23(), {
35772
+ const agents = listAgentsForProject(getProjectRoot24(), {
35152
35773
  includeGlobal,
35153
35774
  includeDisabled
35154
35775
  });
@@ -35199,7 +35820,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
35199
35820
  const { getDb: getDb3 } = await import("@cleocode/core/internal");
35200
35821
  await getDb3();
35201
35822
  const includeGlobal = args.global === true;
35202
- const agent = lookupAgent(getProjectRoot23(), args.agentId, { includeGlobal });
35823
+ const agent = lookupAgent(getProjectRoot24(), args.agentId, { includeGlobal });
35203
35824
  if (!agent) {
35204
35825
  cliOutput(
35205
35826
  {
@@ -35265,7 +35886,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
35265
35886
  const { AgentRegistryAccessor, attachAgentToProject, lookupAgent } = await import("@cleocode/core/agents");
35266
35887
  const { getDb: getDb3 } = await import("@cleocode/core/internal");
35267
35888
  await getDb3();
35268
- const projectRoot = getProjectRoot23();
35889
+ const projectRoot = getProjectRoot24();
35269
35890
  const _registry = new AgentRegistryAccessor(projectRoot);
35270
35891
  void _registry;
35271
35892
  const globalAgent = lookupAgent(projectRoot, args.agentId, { includeGlobal: true });
@@ -35321,7 +35942,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
35321
35942
  const { AgentRegistryAccessor, detachAgentFromProject, getProjectAgentRef } = await import("@cleocode/core/agents");
35322
35943
  const { getDb: getDb3 } = await import("@cleocode/core/internal");
35323
35944
  await getDb3();
35324
- const projectRoot = getProjectRoot23();
35945
+ const projectRoot = getProjectRoot24();
35325
35946
  const _registry = new AgentRegistryAccessor(projectRoot);
35326
35947
  void _registry;
35327
35948
  const ref = getProjectAgentRef(projectRoot, args.agentId);
@@ -35378,7 +35999,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
35378
35999
  const { AgentRegistryAccessor, detachAgentFromProject, getProjectAgentRef } = await import("@cleocode/core/agents");
35379
36000
  const { getDb: getDb3 } = await import("@cleocode/core/internal");
35380
36001
  await getDb3();
35381
- const projectRoot = getProjectRoot23();
36002
+ const projectRoot = getProjectRoot24();
35382
36003
  if (!args.global) {
35383
36004
  const _registry = new AgentRegistryAccessor(projectRoot);
35384
36005
  void _registry;
@@ -35460,7 +36081,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
35460
36081
  const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
35461
36082
  const { getDb: getDb3 } = await import("@cleocode/core/internal");
35462
36083
  await getDb3();
35463
- const registry = new AgentRegistryAccessor(getProjectRoot23());
36084
+ const registry = new AgentRegistryAccessor(getProjectRoot24());
35464
36085
  const result = await registry.rotateKey(args.agentId);
35465
36086
  cliOutput(
35466
36087
  {
@@ -35499,7 +36120,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
35499
36120
  const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
35500
36121
  const { getDb: getDb3 } = await import("@cleocode/core/internal");
35501
36122
  await getDb3();
35502
- const registry = new AgentRegistryAccessor(getProjectRoot23());
36123
+ const registry = new AgentRegistryAccessor(getProjectRoot24());
35503
36124
  const credential = await registry.get(args.agentId);
35504
36125
  if (!credential) {
35505
36126
  cliOutput(
@@ -35574,7 +36195,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
35574
36195
  const { getDb: getDb3 } = await import("@cleocode/core/internal");
35575
36196
  const { createRuntime } = await import("@cleocode/runtime");
35576
36197
  await getDb3();
35577
- const registry = new AgentRegistryAccessor(getProjectRoot23());
36198
+ const registry = new AgentRegistryAccessor(getProjectRoot24());
35578
36199
  const groupIds = args.group ? args.group.split(",").map((s) => s.trim()) : void 0;
35579
36200
  const handle = await createRuntime(registry, {
35580
36201
  agentId: args.agent,
@@ -35657,7 +36278,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
35657
36278
  const { AgentRegistryAccessor, createConduit } = await import("@cleocode/core/agents");
35658
36279
  const { getDb: getDb3 } = await import("@cleocode/core/internal");
35659
36280
  await getDb3();
35660
- const registry = new AgentRegistryAccessor(getProjectRoot23());
36281
+ const registry = new AgentRegistryAccessor(getProjectRoot24());
35661
36282
  const agentId = args.agent;
35662
36283
  const conduit = await createConduit(registry, agentId);
35663
36284
  const limit = Number(args.limit) || 20;
@@ -35709,7 +36330,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
35709
36330
  const { AgentRegistryAccessor, createConduit } = await import("@cleocode/core/agents");
35710
36331
  const { getDb: getDb3 } = await import("@cleocode/core/internal");
35711
36332
  await getDb3();
35712
- const registry = new AgentRegistryAccessor(getProjectRoot23());
36333
+ const registry = new AgentRegistryAccessor(getProjectRoot24());
35713
36334
  const agentId = args.agent;
35714
36335
  const to = args.to;
35715
36336
  const conv = args.conv;
@@ -35987,7 +36608,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
35987
36608
  const db = _sdDb;
35988
36609
  const isGlobal = args.global === true;
35989
36610
  const targetTier = isGlobal ? "global" : "project";
35990
- const projectRoot = getProjectRoot23();
36611
+ const projectRoot = getProjectRoot24();
35991
36612
  try {
35992
36613
  if (args.resync) {
35993
36614
  const parsedName = basename(cantPath, ".cant");
@@ -36284,7 +36905,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
36284
36905
  const xdgData = process.env["XDG_DATA_HOME"] ?? join35(home, ".local", "share");
36285
36906
  targetRoot = join35(xdgData, "cleo", "cant", "agents");
36286
36907
  } else {
36287
- targetRoot = join35(getProjectRoot23(), CLEO_DIR_NAME, CANT_AGENTS_SUBDIR);
36908
+ targetRoot = join35(getProjectRoot24(), CLEO_DIR_NAME, CANT_AGENTS_SUBDIR);
36288
36909
  }
36289
36910
  const agentDir = join35(targetRoot, name);
36290
36911
  if (existsSync18(agentDir)) {
@@ -36357,7 +36978,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
36357
36978
  const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
36358
36979
  const { getDb: getDb3 } = await import("@cleocode/core/internal");
36359
36980
  await getDb3();
36360
- const registry = new AgentRegistryAccessor(getProjectRoot23());
36981
+ const registry = new AgentRegistryAccessor(getProjectRoot24());
36361
36982
  const existing = await registry.get(name);
36362
36983
  if (!existing) {
36363
36984
  const descMatch = personaContent.match(/description:\s*"([^"]+)"/);
@@ -36441,7 +37062,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
36441
37062
  return;
36442
37063
  }
36443
37064
  const specContent = readFileSync19(specPath, "utf-8");
36444
- const projectRoot = getProjectRoot23();
37065
+ const projectRoot = getProjectRoot24();
36445
37066
  const outputDir = args["output-dir"] ? resolve9(args["output-dir"]) : join35(projectRoot, ".cleo", "cant", "agents");
36446
37067
  mkdirSync6(outputDir, { recursive: true });
36447
37068
  if (args["dry-run"]) {
@@ -36572,7 +37193,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
36572
37193
  const { db: _sdDb3 } = await openCleoDb2("signaldock");
36573
37194
  const db = _sdDb3;
36574
37195
  try {
36575
- const report = await buildDoctorReport(db, { projectRoot: getProjectRoot23() });
37196
+ const report = await buildDoctorReport(db, { projectRoot: getProjectRoot24() });
36576
37197
  const repairFlag = args.repair === true;
36577
37198
  let reconciled;
36578
37199
  if (repairFlag) {
@@ -36840,7 +37461,7 @@ var audit_exports = {};
36840
37461
  __export(audit_exports, {
36841
37462
  auditCommand: () => auditCommand
36842
37463
  });
36843
- import { getProjectRoot as getProjectRoot24, reconstructLineage } from "@cleocode/core/internal";
37464
+ import { getProjectRoot as getProjectRoot25, reconstructLineage } from "@cleocode/core/internal";
36844
37465
  var reconstructCommand, auditCommand;
36845
37466
  var init_audit2 = __esm({
36846
37467
  "packages/cleo/src/cli/commands/audit.ts"() {
@@ -36884,7 +37505,7 @@ var init_audit2 = __esm({
36884
37505
  repoRoot = args["repo-root"];
36885
37506
  } else {
36886
37507
  try {
36887
- repoRoot = getProjectRoot24(process.cwd()) ?? process.cwd();
37508
+ repoRoot = getProjectRoot25(process.cwd()) ?? process.cwd();
36888
37509
  } catch {
36889
37510
  repoRoot = process.cwd();
36890
37511
  }
@@ -37508,7 +38129,7 @@ var backfill_exports = {};
37508
38129
  __export(backfill_exports, {
37509
38130
  backfillCommand: () => backfillCommand
37510
38131
  });
37511
- import { backfillTasks, getProjectRoot as getProjectRoot25, populateEmbeddings } from "@cleocode/core/internal";
38132
+ import { backfillTasks, getProjectRoot as getProjectRoot26, populateEmbeddings } from "@cleocode/core/internal";
37512
38133
  var backfillCommand;
37513
38134
  var init_backfill = __esm({
37514
38135
  "packages/cleo/src/cli/commands/backfill.ts"() {
@@ -37542,7 +38163,7 @@ var init_backfill = __esm({
37542
38163
  }
37543
38164
  },
37544
38165
  async run({ args }) {
37545
- const root = getProjectRoot25();
38166
+ const root = getProjectRoot26();
37546
38167
  if (args.embeddings) {
37547
38168
  try {
37548
38169
  let lastLine = "";
@@ -38060,9 +38681,9 @@ var init_backup = __esm({
38060
38681
  async run({ args }) {
38061
38682
  const scope = args.scope;
38062
38683
  const { packBundle } = await import("@cleocode/core/store/backup-pack.js");
38063
- const { getProjectRoot: getProjectRoot43 } = await import("@cleocode/core");
38684
+ const { getProjectRoot: getProjectRoot44 } = await import("@cleocode/core");
38064
38685
  const includesProject = scope === "project" || scope === "all";
38065
- const projectRoot = includesProject ? getProjectRoot43() : void 0;
38686
+ const projectRoot = includesProject ? getProjectRoot44() : void 0;
38066
38687
  let passphrase;
38067
38688
  if (args.encrypt === true) {
38068
38689
  passphrase = process.env["CLEO_BACKUP_PASSPHRASE"];
@@ -38138,12 +38759,12 @@ var init_backup = __esm({
38138
38759
  },
38139
38760
  async run({ args }) {
38140
38761
  const bundlePath = args.bundle;
38141
- const { getProjectRoot: getProjectRoot43, getCleoHome: getCleoHome6, getCleoVersion } = await import("@cleocode/core");
38762
+ const { getProjectRoot: getProjectRoot44, getCleoHome: getCleoHome6, getCleoVersion } = await import("@cleocode/core");
38142
38763
  const { BundleError, cleanupStaging, unpackBundle } = await import("@cleocode/core/store/backup-unpack.js");
38143
38764
  const { regenerateConfigJson, regenerateProjectContextJson, regenerateProjectInfoJson } = await import("@cleocode/core/store/regenerators.js");
38144
38765
  const { regenerateAndCompare } = await import("@cleocode/core/store/restore-json-merge.js");
38145
38766
  const { buildConflictReport, writeConflictReport } = await import("@cleocode/core/store/restore-conflict-report.js");
38146
- const projectRoot = getProjectRoot43();
38767
+ const projectRoot = getProjectRoot44();
38147
38768
  if (args.force !== true) {
38148
38769
  const existing = checkForExistingData(projectRoot, getCleoHome6());
38149
38770
  if (existing.length > 0) {
@@ -38361,7 +38982,7 @@ var brain_exports = {};
38361
38982
  __export(brain_exports, {
38362
38983
  brainCommand: () => brainCommand
38363
38984
  });
38364
- import { getProjectRoot as getProjectRoot26 } from "@cleocode/core";
38985
+ import { getProjectRoot as getProjectRoot27 } from "@cleocode/core";
38365
38986
  import {
38366
38987
  backfillBrainGraph,
38367
38988
  exportBrainAsGexf,
@@ -38406,7 +39027,7 @@ var init_brain2 = __esm({
38406
39027
  json: { type: "boolean", description: "Output results as JSON" }
38407
39028
  },
38408
39029
  async run({ args }) {
38409
- const root = getProjectRoot26();
39030
+ const root = getProjectRoot27();
38410
39031
  try {
38411
39032
  const result = await runBrainMaintenance(root, {
38412
39033
  skipDecay: !!args["skip-decay"],
@@ -38477,7 +39098,7 @@ var init_brain2 = __esm({
38477
39098
  json: { type: "boolean", description: "Output results as JSON" }
38478
39099
  },
38479
39100
  async run({ args: _args }) {
38480
- const root = getProjectRoot26();
39101
+ const root = getProjectRoot27();
38481
39102
  try {
38482
39103
  const result = await backfillBrainGraph(root);
38483
39104
  cliOutput(
@@ -38518,7 +39139,7 @@ var init_brain2 = __esm({
38518
39139
  json: { type: "boolean", description: "Output results as JSON" }
38519
39140
  },
38520
39141
  async run({ args: _args }) {
38521
- const root = getProjectRoot26();
39142
+ const root = getProjectRoot27();
38522
39143
  try {
38523
39144
  const result = await purgeBrainNoise(root);
38524
39145
  cliOutput(
@@ -38564,7 +39185,7 @@ var init_brain2 = __esm({
38564
39185
  json: { type: "boolean", description: "Output results as JSON" }
38565
39186
  },
38566
39187
  async run({ args }) {
38567
- const root = getProjectRoot26();
39188
+ const root = getProjectRoot27();
38568
39189
  const limit = Number.parseInt(args.limit, 10) || 20;
38569
39190
  try {
38570
39191
  const stats = await getPlasticityStats(root, limit);
@@ -38614,7 +39235,7 @@ var init_brain2 = __esm({
38614
39235
  json: { type: "boolean", description: "Output results as JSON" }
38615
39236
  },
38616
39237
  async run({ args: _args }) {
38617
- const root = getProjectRoot26();
39238
+ const root = getProjectRoot27();
38618
39239
  try {
38619
39240
  const report = await getMemoryQualityReport(root);
38620
39241
  cliOutput(
@@ -38663,7 +39284,7 @@ var init_brain2 = __esm({
38663
39284
  }
38664
39285
  },
38665
39286
  async run({ args }) {
38666
- const root = getProjectRoot26();
39287
+ const root = getProjectRoot27();
38667
39288
  const format = args.format ?? "gexf";
38668
39289
  if (format !== "gexf" && format !== "json") {
38669
39290
  cliError(`Invalid format: ${format}. Use 'gexf' or 'json'.`, "E_VALIDATION", {
@@ -38880,7 +39501,7 @@ var init_briefing = __esm({
38880
39501
  "max-next": {
38881
39502
  type: "string",
38882
39503
  description: "Maximum next tasks to show",
38883
- default: "5"
39504
+ default: "3"
38884
39505
  },
38885
39506
  "max-bugs": {
38886
39507
  type: "string",
@@ -38908,6 +39529,36 @@ var init_briefing = __esm({
38908
39529
  type: "boolean",
38909
39530
  description: "Exit non-zero when briefing contract violations are detected (T1905)",
38910
39531
  alias: "x"
39532
+ },
39533
+ /**
39534
+ * T9974: debug mode — surface peerPatterns and other verbose fields
39535
+ * suppressed by default. Passing --debug --with-profile --max-next 5
39536
+ * restores the ~pre-T9974 output shape.
39537
+ */
39538
+ debug: {
39539
+ type: "boolean",
39540
+ description: "Include verbose debug fields (peerPatterns etc.) suppressed by default",
39541
+ default: false
39542
+ },
39543
+ /**
39544
+ * T9974: include cold.userProfile traits in the bundle.
39545
+ * Off by default — large trait dump rarely needed at session start.
39546
+ */
39547
+ "with-profile": {
39548
+ type: "boolean",
39549
+ description: "Include user profile traits in the bundle (suppressed by default)",
39550
+ default: false
39551
+ },
39552
+ /**
39553
+ * T9964: restore full text fields on peerLearnings and decisions.
39554
+ * By default these are truncated to 80-char previews with a `_next.fetch`
39555
+ * hint. Pass --memory-detail to restore the full `insight` and `decision`
39556
+ * body fields (equivalent to pre-T9964 output for those fields).
39557
+ */
39558
+ "memory-detail": {
39559
+ type: "boolean",
39560
+ description: "Restore full peerLearnings/decisions body text (suppressed by default for token budget)",
39561
+ default: false
38911
39562
  }
38912
39563
  },
38913
39564
  async run({ args, cmd, rawArgs }) {
@@ -38933,7 +39584,10 @@ var init_briefing = __esm({
38933
39584
  maxNextTasks: parseInt(args["max-next"], 10),
38934
39585
  maxBugs: parseInt(args["max-bugs"], 10),
38935
39586
  maxBlocked: parseInt(args["max-blocked"], 10),
38936
- maxEpics: parseInt(args["max-epics"], 10)
39587
+ maxEpics: parseInt(args["max-epics"], 10),
39588
+ debug: args.debug,
39589
+ withProfile: args["with-profile"],
39590
+ memoryDetail: args["memory-detail"]
38937
39591
  },
38938
39592
  { command: "briefing" }
38939
39593
  );
@@ -39448,7 +40102,7 @@ __export(changeset_exports, {
39448
40102
  });
39449
40103
  import { existsSync as existsSync11 } from "node:fs";
39450
40104
  import { join as join14 } from "node:path";
39451
- import { changesets, getProjectRoot as getProjectRoot27 } from "@cleocode/core";
40105
+ import { changesets, getProjectRoot as getProjectRoot28 } from "@cleocode/core";
39452
40106
  function isValidKind(raw) {
39453
40107
  return typeof raw === "string" && CHANGESET_KINDS.includes(raw);
39454
40108
  }
@@ -39543,7 +40197,7 @@ var init_changeset = __esm({
39543
40197
  ...typeof args.notes === "string" && args.notes.length > 0 ? { notes: args.notes } : {},
39544
40198
  ...typeof args.breaking === "string" && args.breaking.length > 0 ? { breaking: args.breaking } : {}
39545
40199
  };
39546
- const projectRoot = getProjectRoot27();
40200
+ const projectRoot = getProjectRoot28();
39547
40201
  const outcome = await changesets.writeChangesetEntry(entry, {
39548
40202
  projectRoot,
39549
40203
  ...typeof args["attached-by"] === "string" && args["attached-by"].length > 0 ? { attachedBy: args["attached-by"] } : {}
@@ -39570,7 +40224,7 @@ var init_changeset = __esm({
39570
40224
  },
39571
40225
  args: {},
39572
40226
  async run() {
39573
- const projectRoot = getProjectRoot27();
40227
+ const projectRoot = getProjectRoot28();
39574
40228
  const dir = join14(projectRoot, ".changeset");
39575
40229
  if (!existsSync11(dir)) {
39576
40230
  const empty = { entries: [], count: 0, dir, note: "no .changeset/ dir" };
@@ -39959,7 +40613,7 @@ var init_check2 = __esm({
39959
40613
  }
39960
40614
  },
39961
40615
  async run({ args }) {
39962
- const { execSync: execSync2 } = await import("node:child_process");
40616
+ const { execSync: execSync3 } = await import("node:child_process");
39963
40617
  const since = args.since;
39964
40618
  const branch = args.branch || "HEAD";
39965
40619
  const strict = Boolean(args.strict);
@@ -39967,7 +40621,7 @@ var init_check2 = __esm({
39967
40621
  const range = since ? `${since}..${branch}` : branch;
39968
40622
  let logOutput;
39969
40623
  try {
39970
- logOutput = execSync2(`git log --no-merges --pretty=format:"%H %s" -n ${limit} ${range}`, {
40624
+ logOutput = execSync3(`git log --no-merges --pretty=format:"%H %s" -n ${limit} ${range}`, {
39971
40625
  encoding: "utf8",
39972
40626
  stdio: ["pipe", "pipe", "pipe"]
39973
40627
  });
@@ -39980,7 +40634,7 @@ var init_check2 = __esm({
39980
40634
  process.exit(1);
39981
40635
  }
39982
40636
  const lines = logOutput.trim().split("\n").filter(Boolean);
39983
- const TASK_ID_RE2 = /T[0-9]+/;
40637
+ const TASK_ID_RE3 = /T[0-9]+/;
39984
40638
  const EXEMPT_RE = /^(Merge |Revert |fixup! |squash! |amend! )/;
39985
40639
  const untagged = [];
39986
40640
  const total = lines.length;
@@ -39990,7 +40644,7 @@ var init_check2 = __esm({
39990
40644
  const sha = line.slice(0, tabIdx).trim();
39991
40645
  const subject = line.slice(tabIdx + 1).trim();
39992
40646
  if (EXEMPT_RE.test(subject)) continue;
39993
- if (!TASK_ID_RE2.test(subject)) {
40647
+ if (!TASK_ID_RE3.test(subject)) {
39994
40648
  untagged.push({ sha: sha.slice(0, 12), subject });
39995
40649
  }
39996
40650
  }
@@ -43006,8 +43660,8 @@ import { stat } from "node:fs/promises";
43006
43660
  import { dirname as dirname8, join as join19, normalize, resolve as resolve5 } from "node:path";
43007
43661
  import { fileURLToPath as fileURLToPath5 } from "node:url";
43008
43662
  import {
43009
- createAttachmentStore as createAttachmentStore2,
43010
- getProjectRoot as getProjectRoot28,
43663
+ createAttachmentStore as createAttachmentStore5,
43664
+ getProjectRoot as getProjectRoot29,
43011
43665
  searchAllProjectDocs
43012
43666
  } from "@cleocode/core/internal";
43013
43667
  function getViewerAssetsDir() {
@@ -43067,9 +43721,9 @@ async function serveStatic(res, assetsDir, relPath) {
43067
43721
  }
43068
43722
  }
43069
43723
  function buildViewerHandler(opts = {}) {
43070
- const projectRoot = opts.projectRoot ?? getProjectRoot28();
43724
+ const projectRoot = opts.projectRoot ?? getProjectRoot29();
43071
43725
  const assetsDir = getViewerAssetsDir();
43072
- const store = createAttachmentStore2();
43726
+ const store = createAttachmentStore5();
43073
43727
  return async (req, res) => {
43074
43728
  try {
43075
43729
  const method = (req.method ?? "GET").toUpperCase();
@@ -43245,7 +43899,7 @@ import { spawn } from "node:child_process";
43245
43899
  import { open as fsOpen } from "node:fs/promises";
43246
43900
  import { join as join20 } from "node:path";
43247
43901
  import { fileURLToPath as fileURLToPath6 } from "node:url";
43248
- import { getCleoHome as getCleoHome3, getProjectRoot as getProjectRoot29 } from "@cleocode/core";
43902
+ import { getCleoHome as getCleoHome3, getProjectRoot as getProjectRoot30 } from "@cleocode/core";
43249
43903
  function getCleoBinPath() {
43250
43904
  const thisFile = fileURLToPath6(import.meta.url);
43251
43905
  return join20(thisFile, "..", "..", "index.js");
@@ -43296,7 +43950,7 @@ async function spawnDetachedServer(opts) {
43296
43950
  detached: true,
43297
43951
  stdio,
43298
43952
  env: { ...process.env, [DETACHED_CHILD_ENV]: "1" },
43299
- cwd: getProjectRoot29()
43953
+ cwd: getProjectRoot30()
43300
43954
  });
43301
43955
  child.unref();
43302
43956
  if (handle) await handle.close();
@@ -43448,7 +44102,7 @@ var init_docs_viewer = __esm({
43448
44102
  pid: process.pid,
43449
44103
  port: handle.port,
43450
44104
  host: handle.host,
43451
- projectRoot: getProjectRoot29(),
44105
+ projectRoot: getProjectRoot30(),
43452
44106
  startedAt: Date.now()
43453
44107
  };
43454
44108
  await writeViewerPidFile(record);
@@ -43732,7 +44386,7 @@ import {
43732
44386
  createAttachmentStoreDocsAccessor,
43733
44387
  exportDocument,
43734
44388
  getAgentOutputsAbsolute,
43735
- getProjectRoot as getProjectRoot30,
44389
+ getProjectRoot as getProjectRoot31,
43736
44390
  listDocVersions,
43737
44391
  makeClassifierForScanRoot,
43738
44392
  mergeDocs,
@@ -44118,7 +44772,7 @@ var init_docs3 = __esm({
44118
44772
  const taskId = String(args.task);
44119
44773
  const includeAttachments = args["include-attachments"] !== false;
44120
44774
  const includeMemoryRefs = args["include-memory-refs"] === true;
44121
- const projectRoot = getProjectRoot30();
44775
+ const projectRoot = getProjectRoot31();
44122
44776
  try {
44123
44777
  const result = await exportDocument({
44124
44778
  taskId,
@@ -44184,7 +44838,7 @@ var init_docs3 = __esm({
44184
44838
  }
44185
44839
  },
44186
44840
  async run({ args }) {
44187
- const projectRoot = getProjectRoot30();
44841
+ const projectRoot = getProjectRoot31();
44188
44842
  const limit = args.limit ? Number.parseInt(String(args.limit), 10) : 10;
44189
44843
  try {
44190
44844
  const result = args.owner ? await searchDocs2(String(args.query), {
@@ -44240,7 +44894,7 @@ var init_docs3 = __esm({
44240
44894
  }
44241
44895
  },
44242
44896
  async run({ args }) {
44243
- const projectRoot = getProjectRoot30();
44897
+ const projectRoot = getProjectRoot31();
44244
44898
  const rawStrategy = args.strategy ?? "three-way";
44245
44899
  const strategy = rawStrategy === "cherry-pick" || rawStrategy === "multi-diff" ? rawStrategy : "three-way";
44246
44900
  try {
@@ -44289,7 +44943,7 @@ var init_docs3 = __esm({
44289
44943
  }
44290
44944
  },
44291
44945
  async run({ args }) {
44292
- const projectRoot = getProjectRoot30();
44946
+ const projectRoot = getProjectRoot31();
44293
44947
  const fmt = args.format ?? "mermaid";
44294
44948
  try {
44295
44949
  const result = await buildDocsGraph({ ownerId: String(args.for), projectRoot });
@@ -44358,7 +45012,7 @@ var init_docs3 = __esm({
44358
45012
  }
44359
45013
  },
44360
45014
  async run({ args }) {
44361
- const projectRoot = getProjectRoot30();
45015
+ const projectRoot = getProjectRoot31();
44362
45016
  try {
44363
45017
  const result = await rankDocs({
44364
45018
  ownerId: String(args.for),
@@ -44396,7 +45050,7 @@ var init_docs3 = __esm({
44396
45050
  }
44397
45051
  },
44398
45052
  async run({ args }) {
44399
- const projectRoot = getProjectRoot30();
45053
+ const projectRoot = getProjectRoot31();
44400
45054
  try {
44401
45055
  const result = await listDocVersions({
44402
45056
  ownerId: String(args.for),
@@ -44439,7 +45093,7 @@ var init_docs3 = __esm({
44439
45093
  }
44440
45094
  },
44441
45095
  async run({ args }) {
44442
- const projectRoot = getProjectRoot30();
45096
+ const projectRoot = getProjectRoot31();
44443
45097
  try {
44444
45098
  const result = await publishDocs({
44445
45099
  ownerId: String(args.for),
@@ -44563,7 +45217,7 @@ var init_docs3 = __esm({
44563
45217
  },
44564
45218
  async run({ args }) {
44565
45219
  if (args.from) {
44566
- const projectRoot = getProjectRoot30();
45220
+ const projectRoot = getProjectRoot31();
44567
45221
  const ownerId = args.for ?? void 0;
44568
45222
  if (!ownerId) {
44569
45223
  cliError(
@@ -44630,7 +45284,7 @@ var init_docs3 = __esm({
44630
45284
  }
44631
45285
  },
44632
45286
  async run() {
44633
- const projectRoot = getProjectRoot30();
45287
+ const projectRoot = getProjectRoot31();
44634
45288
  try {
44635
45289
  const result = await statusDocs({ projectRoot });
44636
45290
  cliOutput(result, { command: "docs status", operation: "docs.status" });
@@ -44715,7 +45369,7 @@ var init_docs3 = __esm({
44715
45369
  }
44716
45370
  },
44717
45371
  async run({ args }) {
44718
- const projectRoot = getProjectRoot30();
45372
+ const projectRoot = getProjectRoot31();
44719
45373
  const dirArg = String(args.dir);
44720
45374
  const scanRoot = isAbsolute2(dirArg) ? dirArg : resolve6(projectRoot, dirArg);
44721
45375
  const dryRun = args["dry-run"] === true;
@@ -44789,15 +45443,15 @@ var init_docs3 = __esm({
44789
45443
  }
44790
45444
  },
44791
45445
  async run({ args }) {
44792
- const projectRoot = getProjectRoot30();
45446
+ const projectRoot = getProjectRoot31();
44793
45447
  const { registry, configError } = loadCliRegistry(projectRoot);
44794
45448
  const kinds = registry.list().map(toWireKind);
44795
45449
  const extensionsCount = kinds.filter((k) => k.isExtension).length;
44796
45450
  let counts2;
44797
45451
  if (args["include-counts"]) {
44798
45452
  counts2 = {};
44799
- const { createAttachmentStore: createAttachmentStore3 } = await import("@cleocode/core/internal");
44800
- const store = createAttachmentStore3();
45453
+ const { createAttachmentStore: createAttachmentStore6 } = await import("@cleocode/core/internal");
45454
+ const store = createAttachmentStore6();
44801
45455
  for (const k of kinds) counts2[k.kind] = 0;
44802
45456
  try {
44803
45457
  const rows = await store.listAllInProject(projectRoot);
@@ -44833,14 +45487,14 @@ var init_docs3 = __esm({
44833
45487
  }
44834
45488
  },
44835
45489
  async run({ args }) {
44836
- const projectRoot = getProjectRoot30();
45490
+ const projectRoot = getProjectRoot31();
44837
45491
  const { registry, configError } = loadCliRegistry(projectRoot);
44838
45492
  const kinds = registry.list().map(toWireKind);
44839
45493
  let counts2;
44840
45494
  if (args.counts) {
44841
45495
  counts2 = {};
44842
- const { createAttachmentStore: createAttachmentStore3 } = await import("@cleocode/core/internal");
44843
- const store = createAttachmentStore3();
45496
+ const { createAttachmentStore: createAttachmentStore6 } = await import("@cleocode/core/internal");
45497
+ const store = createAttachmentStore6();
44844
45498
  for (const k of kinds) counts2[k.kind] = 0;
44845
45499
  try {
44846
45500
  const rows2 = await store.listAllInProject(projectRoot);
@@ -45187,7 +45841,7 @@ __export(migrate_agents_v2_exports, {
45187
45841
  import { createHash as createHash2 } from "node:crypto";
45188
45842
  import { appendFileSync as appendFileSync2, existsSync as existsSync14, mkdirSync as mkdirSync3, readdirSync as readdirSync2, readFileSync as readFileSync14 } from "node:fs";
45189
45843
  import { join as join22 } from "node:path";
45190
- import { getProjectRoot as getProjectRoot31, installAgentFromCant } from "@cleocode/core/internal";
45844
+ import { getProjectRoot as getProjectRoot32, installAgentFromCant } from "@cleocode/core/internal";
45191
45845
  import { openCleoDb } from "@cleocode/core/store/open-cleo-db";
45192
45846
  function sha256Hex(bytes) {
45193
45847
  return createHash2("sha256").update(bytes).digest("hex");
@@ -45374,7 +46028,7 @@ var init_migrate_agents_v2 = __esm({
45374
46028
  }
45375
46029
  },
45376
46030
  async run({ args }) {
45377
- const projectRoot = getProjectRoot31();
46031
+ const projectRoot = getProjectRoot32();
45378
46032
  const verbose = args.quiet !== true;
45379
46033
  if (verbose) {
45380
46034
  humanInfo("Scanning .cleo/cant/agents/ and .cleo/agents/ for unregistered agents...");
@@ -45418,7 +46072,7 @@ __export(doctor_exports, {
45418
46072
  });
45419
46073
  import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync4 } from "node:fs";
45420
46074
  import { join as join23 } from "node:path";
45421
- import { getProjectRoot as getProjectRoot32 } from "@cleocode/core";
46075
+ import { getProjectRoot as getProjectRoot33, pushWarning as pushWarning2 } from "@cleocode/core";
45422
46076
  import {
45423
46077
  quarantineRogueCleoDir,
45424
46078
  scanRogueCleoDirs
@@ -45595,6 +46249,23 @@ var init_doctor = __esm({
45595
46249
  type: "boolean",
45596
46250
  description: "List orphan .cleo/ directories under .claude/worktrees/ (T9790, fallout from T9550/T9580)"
45597
46251
  },
46252
+ /**
46253
+ * T9962: timeout in seconds for --audit-worktree-orphans and
46254
+ * --prune-worktree-orphans. On expiry the scan returns a partial result.
46255
+ * Default: 30 seconds.
46256
+ */
46257
+ timeout: {
46258
+ type: "string",
46259
+ description: "Timeout in seconds for worktree-orphan audit/prune scan (default: 30). Partial results are returned on expiry."
46260
+ },
46261
+ /**
46262
+ * T9962: per-level fan-out cap for --audit-worktree-orphans.
46263
+ * Default: 500.
46264
+ */
46265
+ "max-entries-per-level": {
46266
+ type: "string",
46267
+ description: "Per-level entry hard-stop for worktree-orphan scan (default: 500). Scan aborts with partial result when exceeded."
46268
+ },
45598
46269
  /**
45599
46270
  * T9790: archive then remove every orphan reported by
45600
46271
  * `--audit-worktree-orphans`. Combine with `--dry-run` to preview
@@ -45661,7 +46332,7 @@ var init_doctor = __esm({
45661
46332
  try {
45662
46333
  if (args.brain) {
45663
46334
  const { computeBrainHealthDashboard } = await import("@cleocode/core/memory/brain-health-dashboard.js");
45664
- const projectRoot = getProjectRoot32();
46335
+ const projectRoot = getProjectRoot33();
45665
46336
  const dashboard = await computeBrainHealthDashboard(projectRoot);
45666
46337
  cliOutput(dashboard, { command: "doctor", operation: "doctor.brain" });
45667
46338
  if (dashboard.hasP0Failure) {
@@ -45670,7 +46341,7 @@ var init_doctor = __esm({
45670
46341
  return;
45671
46342
  }
45672
46343
  if (args["scan-test-fixtures-in-prod"]) {
45673
- const projectRoot = getProjectRoot32();
46344
+ const projectRoot = getProjectRoot33();
45674
46345
  const matches = await scanTestFixturesInProd(projectRoot);
45675
46346
  const dryRun = args["dry-run"] !== false && args.quarantine !== true;
45676
46347
  const quarantined = !dryRun && matches.length > 0 ? await quarantineTestFixtures(projectRoot, matches) : void 0;
@@ -45758,7 +46429,7 @@ var init_doctor = __esm({
45758
46429
  progress.complete("Comprehensive diagnostics complete");
45759
46430
  } else if (args["scan-rogue-cleo-dirs"]) {
45760
46431
  progress.step(0, "Scanning for rogue .cleo/ directories");
45761
- const projectRoot = getProjectRoot32();
46432
+ const projectRoot = getProjectRoot33();
45762
46433
  const reports = scanRogueCleoDirs(projectRoot);
45763
46434
  progress.complete(
45764
46435
  `Found ${reports.length} rogue .cleo/ director${reports.length === 1 ? "y" : "ies"}`
@@ -45767,7 +46438,7 @@ var init_doctor = __esm({
45767
46438
  } else if (args["quarantine-rogue-cleo-dirs"]) {
45768
46439
  const isDryRun = args["dry-run"] === true;
45769
46440
  progress.step(0, `${isDryRun ? "[DRY RUN] " : ""}Scanning for rogue .cleo/ directories`);
45770
- const projectRoot = getProjectRoot32();
46441
+ const projectRoot = getProjectRoot33();
45771
46442
  const reports = scanRogueCleoDirs(projectRoot);
45772
46443
  if (reports.length === 0) {
45773
46444
  progress.complete("No rogue .cleo/ directories found \u2014 nothing to quarantine");
@@ -45821,7 +46492,7 @@ var init_doctor = __esm({
45821
46492
  const { detectAndRemoveLegacyGlobalFiles, detectAndRemoveStrayProjectNexus } = await import("@cleocode/core/store/cleanup-legacy.js");
45822
46493
  const { getCleoHome: getCleoHome6 } = await import("@cleocode/core");
45823
46494
  const cleoHome = getCleoHome6();
45824
- const projectRoot = getProjectRoot32();
46495
+ const projectRoot = getProjectRoot33();
45825
46496
  const legacyResult = detectAndRemoveLegacyGlobalFiles(cleoHome);
45826
46497
  const strayResult = detectAndRemoveStrayProjectNexus(projectRoot);
45827
46498
  const isDryRun = args["dry-run"] === true;
@@ -45853,21 +46524,50 @@ var init_doctor = __esm({
45853
46524
  }
45854
46525
  } else if (args["audit-worktree-orphans"]) {
45855
46526
  progress.step(0, "Comprehensive worktree anomaly audit (T9808 / council D009)");
45856
- const { auditWorktreeOrphansComprehensive, scanWorktreeOrphans } = await import("@cleocode/core/doctor/worktree-orphans.js");
45857
- const projectRoot = getProjectRoot32();
45858
- const [comprehensive, legacyOrphans] = await Promise.all([
46527
+ const { auditWorktreeOrphansComprehensive, scanWorktreeOrphansBudgeted } = await import("@cleocode/core/doctor/worktree-orphans.js");
46528
+ const projectRoot = getProjectRoot33();
46529
+ const timeoutSecs = args["timeout"] !== void 0 ? Number.parseInt(String(args["timeout"]), 10) : 30;
46530
+ const timeoutMs = Number.isFinite(timeoutSecs) && timeoutSecs > 0 ? timeoutSecs * 1e3 : 3e4;
46531
+ const maxEntriesPerLevel = args["max-entries-per-level"] !== void 0 ? Number.parseInt(String(args["max-entries-per-level"]), 10) : 500;
46532
+ const [comprehensive, legacyScanResult] = await Promise.all([
45859
46533
  auditWorktreeOrphansComprehensive(projectRoot),
45860
- scanWorktreeOrphans(projectRoot)
46534
+ scanWorktreeOrphansBudgeted(projectRoot, {
46535
+ timeoutMs,
46536
+ maxEntriesPerLevel: Number.isFinite(maxEntriesPerLevel) ? maxEntriesPerLevel : 500
46537
+ })
45861
46538
  ]);
46539
+ const legacyOrphans = legacyScanResult.orphans;
45862
46540
  const totalAnomalies = comprehensive.count;
46541
+ if (legacyScanResult.softWarnMessage) {
46542
+ pushWarning2({
46543
+ code: "W_DOCTOR_SCAN_SOFT_WARN",
46544
+ message: legacyScanResult.softWarnMessage,
46545
+ severity: "warn"
46546
+ });
46547
+ }
46548
+ if (legacyScanResult.isPartial) {
46549
+ const reason = legacyScanResult.partialReason === "timeout" ? `timed out after ${timeoutSecs}s (use --timeout <seconds> to adjust)` : `per-level entry cap of ${maxEntriesPerLevel} exceeded (use --max-entries-per-level <n> to adjust)`;
46550
+ pushWarning2({
46551
+ code: "W_DOCTOR_SCAN_PARTIAL",
46552
+ message: `legacy orphan scan is PARTIAL \u2014 ${reason}. Results may be incomplete.`,
46553
+ severity: "warn",
46554
+ context: {
46555
+ partialReason: legacyScanResult.partialReason,
46556
+ timeoutSecs,
46557
+ maxEntriesPerLevel
46558
+ }
46559
+ });
46560
+ }
45863
46561
  progress.complete(
45864
- `Found ${totalAnomalies} anomal${totalAnomalies === 1 ? "y" : "ies"}` + (legacyOrphans.length > 0 ? ` (${legacyOrphans.length} legacy orphan(s))` : "")
46562
+ `Found ${totalAnomalies} anomal${totalAnomalies === 1 ? "y" : "ies"}` + (legacyOrphans.length > 0 ? ` (${legacyOrphans.length} legacy orphan(s))` : "") + (legacyScanResult.isPartial ? " [PARTIAL]" : "")
45865
46563
  );
45866
46564
  cliOutput(
45867
46565
  {
45868
46566
  projectRoot,
45869
46567
  comprehensive,
45870
46568
  legacyOrphans,
46569
+ legacyScanPartial: legacyScanResult.isPartial,
46570
+ legacyScanPartialReason: legacyScanResult.partialReason,
45871
46571
  count: totalAnomalies
45872
46572
  },
45873
46573
  { command: "doctor", operation: "doctor.audit-worktree-orphans" }
@@ -45881,11 +46581,40 @@ var init_doctor = __esm({
45881
46581
  0,
45882
46582
  `${isDryRun ? "[DRY RUN] " : ""}Scanning + pruning worktree-orphan .cleo/ directories`
45883
46583
  );
45884
- const { pruneWorktreeOrphans, scanWorktreeOrphans } = await import("@cleocode/core/doctor/worktree-orphans.js");
45885
- const projectRoot = getProjectRoot32();
45886
- const orphans = await scanWorktreeOrphans(projectRoot);
46584
+ const { pruneWorktreeOrphans, scanWorktreeOrphansBudgeted } = await import("@cleocode/core/doctor/worktree-orphans.js");
46585
+ const projectRoot = getProjectRoot33();
46586
+ const timeoutSecs = args["timeout"] !== void 0 ? Number.parseInt(String(args["timeout"]), 10) : 30;
46587
+ const timeoutMs = Number.isFinite(timeoutSecs) && timeoutSecs > 0 ? timeoutSecs * 1e3 : 3e4;
46588
+ const maxEntriesPerLevel = args["max-entries-per-level"] !== void 0 ? Number.parseInt(String(args["max-entries-per-level"]), 10) : 500;
46589
+ const scanResult = await scanWorktreeOrphansBudgeted(projectRoot, {
46590
+ timeoutMs,
46591
+ maxEntriesPerLevel: Number.isFinite(maxEntriesPerLevel) ? maxEntriesPerLevel : 500
46592
+ });
46593
+ if (scanResult.softWarnMessage) {
46594
+ pushWarning2({
46595
+ code: "W_DOCTOR_SCAN_SOFT_WARN",
46596
+ message: scanResult.softWarnMessage,
46597
+ severity: "warn"
46598
+ });
46599
+ }
46600
+ if (scanResult.isPartial) {
46601
+ const reason = scanResult.partialReason === "timeout" ? `timed out after ${timeoutSecs}s (use --timeout <seconds> to adjust)` : `per-level entry cap of ${maxEntriesPerLevel} exceeded (use --max-entries-per-level <n> to adjust)`;
46602
+ pushWarning2({
46603
+ code: "W_DOCTOR_SCAN_PARTIAL",
46604
+ message: `orphan scan is PARTIAL \u2014 ${reason}. Only orphans found before abort will be pruned.`,
46605
+ severity: "warn",
46606
+ context: {
46607
+ partialReason: scanResult.partialReason,
46608
+ timeoutSecs,
46609
+ maxEntriesPerLevel
46610
+ }
46611
+ });
46612
+ }
46613
+ const orphans = scanResult.orphans;
45887
46614
  if (orphans.length === 0) {
45888
- progress.complete("No worktree orphans found \u2014 nothing to prune");
46615
+ progress.complete(
46616
+ `No worktree orphans found \u2014 nothing to prune${scanResult.isPartial ? " [PARTIAL SCAN]" : ""}`
46617
+ );
45889
46618
  cliOutput(
45890
46619
  {
45891
46620
  projectRoot,
@@ -45893,7 +46622,9 @@ var init_doctor = __esm({
45893
46622
  archivePath: null,
45894
46623
  pruned: [],
45895
46624
  rejected: [],
45896
- totalSizeBytes: 0
46625
+ totalSizeBytes: 0,
46626
+ scanPartial: scanResult.isPartial,
46627
+ scanPartialReason: scanResult.partialReason
45897
46628
  },
45898
46629
  { command: "doctor", operation: "doctor.prune-worktree-orphans" }
45899
46630
  );
@@ -45909,10 +46640,15 @@ var init_doctor = __esm({
45909
46640
  });
45910
46641
  const verb = isDryRun ? "Would prune" : "Pruned";
45911
46642
  progress.complete(
45912
- `${verb} ${result.pruned.length} orphan${result.pruned.length === 1 ? "" : "s"}${result.rejected.length > 0 ? `, ${result.rejected.length} rejected` : ""}`
46643
+ `${verb} ${result.pruned.length} orphan${result.pruned.length === 1 ? "" : "s"}${result.rejected.length > 0 ? `, ${result.rejected.length} rejected` : ""}${scanResult.isPartial ? " [PARTIAL SCAN]" : ""}`
45913
46644
  );
45914
46645
  cliOutput(
45915
- { projectRoot, ...result },
46646
+ {
46647
+ projectRoot,
46648
+ ...result,
46649
+ scanPartial: scanResult.isPartial,
46650
+ scanPartialReason: scanResult.partialReason
46651
+ },
45916
46652
  { command: "doctor", operation: "doctor.prune-worktree-orphans" }
45917
46653
  );
45918
46654
  if (result.rejected.length > 0) {
@@ -45937,7 +46673,7 @@ var init_doctor = __esm({
45937
46673
  { command: "doctor", operation: "admin.health" }
45938
46674
  );
45939
46675
  try {
45940
- const projectRoot = getProjectRoot32();
46676
+ const projectRoot = getProjectRoot33();
45941
46677
  const conflicts = readMigrationConflicts(projectRoot);
45942
46678
  if (conflicts.length > 0) {
45943
46679
  progress.complete(
@@ -46756,6 +47492,42 @@ var init_find = __esm({
46756
47492
  }
46757
47493
  });
46758
47494
 
47495
+ // packages/cleo/src/cli/commands/focus.ts
47496
+ var focus_exports = {};
47497
+ __export(focus_exports, {
47498
+ focusCommand: () => focusCommand
47499
+ });
47500
+ var focusCommand;
47501
+ var init_focus3 = __esm({
47502
+ "packages/cleo/src/cli/commands/focus.ts"() {
47503
+ "use strict";
47504
+ init_dist();
47505
+ init_cli();
47506
+ focusCommand = defineCommand({
47507
+ meta: {
47508
+ name: "focus",
47509
+ description: "Single-envelope orientation for a task, epic, or saga \u2014 replaces 8 separate calls with one"
47510
+ },
47511
+ args: {
47512
+ id: {
47513
+ type: "positional",
47514
+ description: "Task, Epic, or Saga ID to orient on (e.g. T9973, T9831)",
47515
+ required: true
47516
+ }
47517
+ },
47518
+ async run({ args }) {
47519
+ await dispatchFromCli(
47520
+ "query",
47521
+ "focus",
47522
+ "show",
47523
+ { id: args["id"] },
47524
+ { command: "focus" }
47525
+ );
47526
+ }
47527
+ });
47528
+ }
47529
+ });
47530
+
46759
47531
  // packages/cleo/src/cli/commands/gc.ts
46760
47532
  var gc_exports = {};
46761
47533
  __export(gc_exports, {
@@ -49052,7 +49824,7 @@ var llm_cost_exports = {};
49052
49824
  __export(llm_cost_exports, {
49053
49825
  costCommand: () => costCommand
49054
49826
  });
49055
- import { getProjectRoot as getProjectRoot33 } from "@cleocode/core/internal";
49827
+ import { getProjectRoot as getProjectRoot34 } from "@cleocode/core/internal";
49056
49828
  import { computeCost } from "@cleocode/core/llm/usage-pricing";
49057
49829
  function resolveSessionId(raw) {
49058
49830
  if (raw === "current") {
@@ -49125,7 +49897,7 @@ var init_llm_cost = __esm({
49125
49897
  process.exit(6);
49126
49898
  }
49127
49899
  const sessionId = resolveSessionId(rawSessionId);
49128
- const projectRoot = getProjectRoot33(process.cwd());
49900
+ const projectRoot = getProjectRoot34(process.cwd());
49129
49901
  let breakdown;
49130
49902
  try {
49131
49903
  breakdown = await loadSessionCostBreakdown(projectRoot, sessionId);
@@ -49766,7 +50538,7 @@ var llm_exports = {};
49766
50538
  __export(llm_exports, {
49767
50539
  llmCommand: () => llmCommand
49768
50540
  });
49769
- import { pushWarning as pushWarning2 } from "@cleocode/core";
50541
+ import { pushWarning as pushWarning3 } from "@cleocode/core";
49770
50542
  async function getListProviders() {
49771
50543
  const { listProviders } = await import(
49772
50544
  /* webpackIgnore: true */
@@ -49897,7 +50669,7 @@ var init_llm3 = __esm({
49897
50669
  apiKey = envValue;
49898
50670
  source = "env";
49899
50671
  } else if (typeof a["api-key"] === "string" && a["api-key"]) {
49900
- pushWarning2({
50672
+ pushWarning3({
49901
50673
  code: "W_DEPRECATED_FLAG",
49902
50674
  message: API_KEY_FLAG_DEPRECATION,
49903
50675
  deprecated: "--api-key=<value>",
@@ -50676,7 +51448,7 @@ import { createHash as createHash3 } from "node:crypto";
50676
51448
  import { existsSync as existsSync16, mkdirSync as mkdirSync5, readdirSync as readdirSync3, readFileSync as readFileSync16, writeFileSync as writeFileSync5 } from "node:fs";
50677
51449
  import { homedir as homedir5 } from "node:os";
50678
51450
  import { join as join27 } from "node:path";
50679
- import { getProjectRoot as getProjectRoot34 } from "@cleocode/core";
51451
+ import { getProjectRoot as getProjectRoot35 } from "@cleocode/core";
50680
51452
  import {
50681
51453
  getBrainDb as getBrainDb2,
50682
51454
  getDreamStatus,
@@ -51643,7 +52415,7 @@ var init_memory3 = __esm({
51643
52415
  },
51644
52416
  args: {},
51645
52417
  async run() {
51646
- const root = getProjectRoot34();
52418
+ const root = getProjectRoot35();
51647
52419
  try {
51648
52420
  const result = await runConsolidation(root);
51649
52421
  cliOutput(result, { command: "memory-consolidate", operation: "memory.consolidate" });
@@ -51667,7 +52439,7 @@ var init_memory3 = __esm({
51667
52439
  }
51668
52440
  },
51669
52441
  async run({ args }) {
51670
- const root = getProjectRoot34();
52442
+ const root = getProjectRoot35();
51671
52443
  if (args.status) {
51672
52444
  try {
51673
52445
  const status = await getDreamStatus(root);
@@ -51704,7 +52476,7 @@ var init_memory3 = __esm({
51704
52476
  }
51705
52477
  },
51706
52478
  async run({ args }) {
51707
- const root = getProjectRoot34();
52479
+ const root = getProjectRoot35();
51708
52480
  try {
51709
52481
  const { runObserver, runReflector } = await import("@cleocode/core/memory");
51710
52482
  const observerResult = await runObserver(root, args.session, {
@@ -51744,7 +52516,7 @@ var init_memory3 = __esm({
51744
52516
  }
51745
52517
  },
51746
52518
  async run({ args }) {
51747
- const root = getProjectRoot34();
52519
+ const root = getProjectRoot35();
51748
52520
  try {
51749
52521
  await getBrainDb2(root);
51750
52522
  const { totalDuplicateRows, groups } = await scanDuplicateEntries();
@@ -51790,7 +52562,7 @@ var init_memory3 = __esm({
51790
52562
  async run({ args }) {
51791
52563
  const sourceDir = args.from ?? join27(homedir5(), ".claude", "projects", "-mnt-projects-cleocode", "memory");
51792
52564
  const isDryRun = !!args["dry-run"];
51793
- const projectRoot = getProjectRoot34();
52565
+ const projectRoot = getProjectRoot35();
51794
52566
  const stateFile = join27(projectRoot, CLEO_DIR_NAME, MIGRATE_MEMORY_HASHES_JSON);
51795
52567
  if (!existsSync16(sourceDir)) {
51796
52568
  cliError(`Source directory not found: ${sourceDir}`, "E_NOT_FOUND", { name: "E_NOT_FOUND" });
@@ -52003,7 +52775,7 @@ var init_memory3 = __esm({
52003
52775
  },
52004
52776
  args: {},
52005
52777
  async run() {
52006
- const root = getProjectRoot34();
52778
+ const root = getProjectRoot35();
52007
52779
  try {
52008
52780
  await getBrainDb2(root);
52009
52781
  const result = await getTierStats(root);
@@ -52046,7 +52818,7 @@ var init_memory3 = __esm({
52046
52818
  }
52047
52819
  },
52048
52820
  async run({ args }) {
52049
- const root = getProjectRoot34();
52821
+ const root = getProjectRoot35();
52050
52822
  const targetTier = args.to;
52051
52823
  const reason = args.reason;
52052
52824
  const validTiers = ["medium", "long"];
@@ -52112,7 +52884,7 @@ var init_memory3 = __esm({
52112
52884
  }
52113
52885
  },
52114
52886
  async run({ args }) {
52115
- const root = getProjectRoot34();
52887
+ const root = getProjectRoot35();
52116
52888
  const targetTier = args.to;
52117
52889
  const reason = args.reason;
52118
52890
  const validTiers = ["short", "medium"];
@@ -52580,7 +53352,7 @@ var migrate_claude_mem_exports = {};
52580
53352
  __export(migrate_claude_mem_exports, {
52581
53353
  migrateClaudeMemCommand: () => migrateClaudeMemCommand
52582
53354
  });
52583
- import { getProjectRoot as getProjectRoot35, migrateClaudeMem } from "@cleocode/core/internal";
53355
+ import { getProjectRoot as getProjectRoot36, migrateClaudeMem } from "@cleocode/core/internal";
52584
53356
  import { ingestLooseAgentOutputs, ingestRcasdDirectories } from "@cleocode/core/memory";
52585
53357
  import { getDb as getDb2 } from "@cleocode/core/store/sqlite";
52586
53358
  var storageCommand, claudeMemCommand, manifestIngestCommand, migrateClaudeMemCommand;
@@ -52643,7 +53415,7 @@ var init_migrate_claude_mem = __esm({
52643
53415
  }
52644
53416
  },
52645
53417
  async run({ args }) {
52646
- const root = getProjectRoot35();
53418
+ const root = getProjectRoot36();
52647
53419
  try {
52648
53420
  const result = await migrateClaudeMem(root, {
52649
53421
  sourcePath: args.source,
@@ -52692,7 +53464,7 @@ var init_migrate_claude_mem = __esm({
52692
53464
  }
52693
53465
  },
52694
53466
  async run({ args }) {
52695
- const projectRoot = getProjectRoot35();
53467
+ const projectRoot = getProjectRoot36();
52696
53468
  try {
52697
53469
  const db = await getDb2(projectRoot);
52698
53470
  const rcasdFlag = Boolean(args.rcasd);
@@ -52796,7 +53568,7 @@ __export(nexus_exports, {
52796
53568
  import { appendFile as appendFile2, mkdir as mkdir3 } from "node:fs/promises";
52797
53569
  import { homedir as homedir6 } from "node:os";
52798
53570
  import path4 from "node:path";
52799
- import { getProjectRoot as getProjectRoot36 } from "@cleocode/core";
53571
+ import { getProjectRoot as getProjectRoot37 } from "@cleocode/core";
52800
53572
  import { generateGexf, getSymbolImpact } from "@cleocode/core/nexus";
52801
53573
  async function appendDeprecationTelemetry(op, replacement) {
52802
53574
  try {
@@ -52908,7 +53680,7 @@ var init_nexus4 = __esm({
52908
53680
  async run({ args }) {
52909
53681
  applyJsonFlag2(args.json);
52910
53682
  const projectIdOverride = args["project-id"];
52911
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot36();
53683
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot37();
52912
53684
  const startTime = Date.now();
52913
53685
  try {
52914
53686
  const [{ getNexusDb, nexusSchema }, { getIndexStats }] = await Promise.all([
@@ -53423,7 +54195,7 @@ var init_nexus4 = __esm({
53423
54195
  applyJsonFlag2(args.json);
53424
54196
  const startTime = Date.now();
53425
54197
  const projectIdOverride = args["project-id"];
53426
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot36();
54198
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot37();
53427
54199
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
53428
54200
  const response = await dispatchRaw("query", "nexus", "clusters", { projectId, repoPath });
53429
54201
  const durationMs = Date.now() - startTime;
@@ -53467,7 +54239,7 @@ var init_nexus4 = __esm({
53467
54239
  applyJsonFlag2(args.json);
53468
54240
  const startTime = Date.now();
53469
54241
  const projectIdOverride = args["project-id"];
53470
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot36();
54242
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot37();
53471
54243
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
53472
54244
  const response = await dispatchRaw("query", "nexus", "flows", { projectId, repoPath });
53473
54245
  const durationMs = Date.now() - startTime;
@@ -53510,7 +54282,7 @@ var init_nexus4 = __esm({
53510
54282
  void appendDeprecationTelemetry("nexus.context", "cleo graph context");
53511
54283
  const startTime = Date.now();
53512
54284
  const projectIdOverride = args["project-id"];
53513
- const repoPath = getProjectRoot36();
54285
+ const repoPath = getProjectRoot37();
53514
54286
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
53515
54287
  const limit = parseInt(args.limit, 10);
53516
54288
  const symbolName = args.symbol;
@@ -53573,7 +54345,7 @@ var init_nexus4 = __esm({
53573
54345
  const startTime = Date.now();
53574
54346
  const whyFlag = !!args.why;
53575
54347
  const projectIdOverride = args["project-id"];
53576
- const repoPath = getProjectRoot36();
54348
+ const repoPath = getProjectRoot37();
53577
54349
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
53578
54350
  const maxDepth = Math.min(parseInt(args.depth, 10), 5);
53579
54351
  const symbolName = args.symbol;
@@ -53645,7 +54417,7 @@ var init_nexus4 = __esm({
53645
54417
  const projectIdOverride = args["project-id"];
53646
54418
  const isIncremental = !!args.incremental;
53647
54419
  const ctx = getFormatContext();
53648
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot36();
54420
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot37();
53649
54421
  humanInfo(`[nexus] Analyzing: ${repoPath}${isIncremental ? " (incremental)" : ""}`);
53650
54422
  try {
53651
54423
  const [{ getNexusDb, nexusSchema }, { runPipeline }, { eq: eq2 }] = await Promise.all([
@@ -53797,7 +54569,7 @@ var init_nexus4 = __esm({
53797
54569
  async run({ args }) {
53798
54570
  applyJsonFlag2(args.json);
53799
54571
  const startTime = Date.now();
53800
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot36();
54572
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot37();
53801
54573
  const name = args.name;
53802
54574
  const response = await dispatchRaw("mutate", "nexus", "projects.register", {
53803
54575
  path: repoPath,
@@ -54155,7 +54927,7 @@ var init_nexus4 = __esm({
54155
54927
  applyJsonFlag2(args.json);
54156
54928
  const startTime = Date.now();
54157
54929
  const projectIdOverride = args["project-id"];
54158
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot36();
54930
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot37();
54159
54931
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
54160
54932
  const response = await dispatchRaw("mutate", "nexus", "refresh-bridge", {
54161
54933
  repoPath,
@@ -54304,7 +55076,7 @@ var init_nexus4 = __esm({
54304
55076
  async run({ args }) {
54305
55077
  applyJsonFlag2(args.json);
54306
55078
  const startTime = Date.now();
54307
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot36();
55079
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot37();
54308
55080
  const projectIdOverride = args["project-id"];
54309
55081
  const beforeRef = args.before ?? "HEAD~1";
54310
55082
  const afterRef = args.after ?? "HEAD";
@@ -54422,7 +55194,7 @@ var init_nexus4 = __esm({
54422
55194
  applyJsonFlag2(args.json);
54423
55195
  const startTime = Date.now();
54424
55196
  const projectIdOverride = args["project-id"];
54425
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot36();
55197
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot37();
54426
55198
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
54427
55199
  const response = await dispatchRaw("query", "nexus", "route-map", { projectId });
54428
55200
  const durationMs = Date.now() - startTime;
@@ -54478,7 +55250,7 @@ var init_nexus4 = __esm({
54478
55250
  const startTime = Date.now();
54479
55251
  const routeSymbol = args.routeSymbol;
54480
55252
  const projectIdOverride = args["project-id"];
54481
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot36();
55253
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot37();
54482
55254
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
54483
55255
  const response = await dispatchRaw("query", "nexus", "shape-check", { routeSymbol, projectId });
54484
55256
  const durationMs = Date.now() - startTime;
@@ -54868,7 +55640,7 @@ var init_nexus4 = __esm({
54868
55640
  async run({ args }) {
54869
55641
  applyJsonFlag2(args.json);
54870
55642
  const startTime = Date.now();
54871
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot36();
55643
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot37();
54872
55644
  const projectIdOverride = args["project-id"];
54873
55645
  const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
54874
55646
  const response = await dispatchRaw("mutate", "nexus", "contracts-sync", {
@@ -54972,7 +55744,7 @@ var init_nexus4 = __esm({
54972
55744
  async run({ args }) {
54973
55745
  applyJsonFlag2(args.json);
54974
55746
  const startTime = Date.now();
54975
- const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot36();
55747
+ const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot37();
54976
55748
  const projectId = Buffer.from(repoPath).toString("base64url").slice(0, 32);
54977
55749
  const response = await dispatchRaw("mutate", "nexus", "contracts-link-tasks", {
54978
55750
  projectId,
@@ -55048,7 +55820,7 @@ var init_nexus4 = __esm({
55048
55820
  async run({ args }) {
55049
55821
  applyJsonFlag2(args.json);
55050
55822
  const startTime = Date.now();
55051
- const outputDir = args.output ?? path4.join(getProjectRoot36(), ".cleo", "wiki");
55823
+ const outputDir = args.output ?? path4.join(getProjectRoot37(), ".cleo", "wiki");
55052
55824
  const communityFilter = args.community ?? void 0;
55053
55825
  const isIncremental = !!args.incremental;
55054
55826
  let loomProvider = null;
@@ -55072,11 +55844,11 @@ var init_nexus4 = __esm({
55072
55844
  }
55073
55845
  try {
55074
55846
  const { generateNexusWikiIndex } = await import("@cleocode/core/nexus/wiki-index.js");
55075
- const result = await generateNexusWikiIndex(outputDir, getProjectRoot36(), {
55847
+ const result = await generateNexusWikiIndex(outputDir, getProjectRoot37(), {
55076
55848
  communityFilter,
55077
55849
  incremental: isIncremental,
55078
55850
  loomProvider,
55079
- projectRoot: getProjectRoot36()
55851
+ projectRoot: getProjectRoot37()
55080
55852
  });
55081
55853
  const durationMs = Date.now() - startTime;
55082
55854
  if (!result.success) {
@@ -57497,7 +58269,7 @@ var refresh_memory_exports = {};
57497
58269
  __export(refresh_memory_exports, {
57498
58270
  refreshMemoryCommand: () => refreshMemoryCommand
57499
58271
  });
57500
- import { getProjectRoot as getProjectRoot37 } from "@cleocode/core";
58272
+ import { getProjectRoot as getProjectRoot38 } from "@cleocode/core";
57501
58273
  var refreshMemoryCommand;
57502
58274
  var init_refresh_memory = __esm({
57503
58275
  "packages/cleo/src/cli/commands/refresh-memory.ts"() {
@@ -57510,7 +58282,7 @@ var init_refresh_memory = __esm({
57510
58282
  description: "Regenerate .cleo/memory-bridge.md from brain.db"
57511
58283
  },
57512
58284
  async run() {
57513
- const projectDir = getProjectRoot37();
58285
+ const projectDir = getProjectRoot38();
57514
58286
  const { writeMemoryBridge } = await import("@cleocode/core/internal");
57515
58287
  const result = await writeMemoryBridge(projectDir);
57516
58288
  if (result.written) {
@@ -57692,7 +58464,7 @@ __export(release_exports, {
57692
58464
  SHIP_DEPRECATION_NOTICE: () => SHIP_DEPRECATION_NOTICE,
57693
58465
  releaseCommand: () => releaseCommand
57694
58466
  });
57695
- import { pushWarning as pushWarning3, release as release2 } from "@cleocode/core";
58467
+ import { pushWarning as pushWarning4, release as release2 } from "@cleocode/core";
57696
58468
  var SHIP_DEPRECATION_NOTICE, shipCommand, listCommand19, showCommand10, cancelCommand2, rollbackCommand, rollbackFullCommand, prStatusCommand, channelCommand, planCommand3, openCommand2, reconcileCommand4, releaseCommand;
57697
58469
  var init_release3 = __esm({
57698
58470
  "packages/cleo/src/cli/commands/release.ts"() {
@@ -57723,7 +58495,7 @@ var init_release3 = __esm({
57723
58495
  }
57724
58496
  },
57725
58497
  async run({ args }) {
57726
- pushWarning3({
58498
+ pushWarning4({
57727
58499
  code: "W_DEPRECATED_COMMAND",
57728
58500
  message: SHIP_DEPRECATION_NOTICE,
57729
58501
  deprecated: "cleo release ship",
@@ -58898,7 +59670,7 @@ __export(restore_exports, {
58898
59670
  });
58899
59671
  import fs3 from "node:fs";
58900
59672
  import path5 from "node:path";
58901
- import { CleoError as CleoError7, getProjectRoot as getProjectRoot38, getTaskAccessor as getTaskAccessor3 } from "@cleocode/core";
59673
+ import { CleoError as CleoError7, getProjectRoot as getProjectRoot39, getTaskAccessor as getTaskAccessor3 } from "@cleocode/core";
58902
59674
  function parseMarkdownValue(raw) {
58903
59675
  const trimmed = raw.trim();
58904
59676
  if (trimmed === "_(not present)_" || trimmed === "") return void 0;
@@ -59018,7 +59790,7 @@ var init_restore = __esm({
59018
59790
  description: "Apply manually-resolved conflicts from .cleo/restore-conflicts.md"
59019
59791
  },
59020
59792
  async run() {
59021
- const projectRoot = getProjectRoot38();
59793
+ const projectRoot = getProjectRoot39();
59022
59794
  const reportPath = path5.join(projectRoot, CLEO_DIR_NAME, RESTORE_CONFLICTS_MD);
59023
59795
  if (!fs3.existsSync(reportPath)) {
59024
59796
  humanLine("No pending restore conflicts. Nothing to finalize.");
@@ -61424,7 +62196,7 @@ var sequence_exports = {};
61424
62196
  __export(sequence_exports, {
61425
62197
  sequenceCommand: () => sequenceCommand
61426
62198
  });
61427
- import { getProjectRoot as getProjectRoot39 } from "@cleocode/core/internal";
62199
+ import { getProjectRoot as getProjectRoot40 } from "@cleocode/core/internal";
61428
62200
  var showCommand12, checkCommand6, repairCommand, sequenceCommand;
61429
62201
  var init_sequence = __esm({
61430
62202
  "packages/cleo/src/cli/commands/sequence.ts"() {
@@ -61460,7 +62232,7 @@ var init_sequence = __esm({
61460
62232
  meta: { name: "repair", description: "Reset counter to max + 1 if behind" },
61461
62233
  async run() {
61462
62234
  const { repairSequence } = await import("@cleocode/core/internal");
61463
- const projectRoot = getProjectRoot39();
62235
+ const projectRoot = getProjectRoot40();
61464
62236
  const repair = await repairSequence(projectRoot);
61465
62237
  const result = {
61466
62238
  repaired: repair.repaired,
@@ -61549,7 +62321,7 @@ async function promptOwnerAuthPassword(sessionName) {
61549
62321
  const token = deriveOwnerAuthToken(sessionName, password);
61550
62322
  return token;
61551
62323
  }
61552
- var startCommand7, endCommand, handoffCommand2, statusCommand14, resumeCommand2, findCommand6, listCommand23, gcCommand2, showCommand13, driftCommand, contextDriftCommand, suspendCommand, recordAssumptionCommand, recordDecisionCommand, decisionLogCommand, lintCommand, sessionCommand;
62324
+ var startCommand7, endCommand, handoffCommand2, statusCommand14, resumeCommand2, findCommand6, listCommand23, gcCommand2, showCommand13, driftCommand, contextDriftCommand, suspendCommand, recordAssumptionCommand, recordDecisionCommand, decisionLogCommand, adoptCommand, lintCommand, sessionCommand;
61553
62325
  var init_session4 = __esm({
61554
62326
  "packages/cleo/src/cli/commands/session.ts"() {
61555
62327
  "use strict";
@@ -61624,7 +62396,9 @@ var init_session4 = __esm({
61624
62396
  // CLI-level alias normalization: --focus and --start-task both map to startTask (ADR-057 D2)
61625
62397
  startTask: args["start-task"] ?? args.focus,
61626
62398
  grade: args.grade,
61627
- ownerAuthToken
62399
+ ownerAuthToken,
62400
+ // T9975: per-agent handle for multi-agent isolation
62401
+ agentHandle: args.agent
61628
62402
  },
61629
62403
  { command: "session", operation: "session.start" }
61630
62404
  );
@@ -61829,6 +62603,15 @@ var init_session4 = __esm({
61829
62603
  offset: {
61830
62604
  type: "string",
61831
62605
  description: "Skip first n results"
62606
+ },
62607
+ /**
62608
+ * T9975: surface all per-agent columns (agent, scope, lastActivity).
62609
+ * When set, the result includes agentHandle, scopeKind, scopeId, and
62610
+ * lastActivity for each session — useful for multi-agent dashboards.
62611
+ */
62612
+ all: {
62613
+ type: "boolean",
62614
+ description: "Show all columns including per-agent fields (agent, scope, lastActivity) \u2014 T9975"
61832
62615
  }
61833
62616
  },
61834
62617
  async run({ args }) {
@@ -61839,7 +62622,8 @@ var init_session4 = __esm({
61839
62622
  {
61840
62623
  status: args.status,
61841
62624
  limit: args.limit ? Number.parseInt(args.limit, 10) : void 0,
61842
- offset: args.offset ? Number.parseInt(args.offset, 10) : void 0
62625
+ offset: args.offset ? Number.parseInt(args.offset, 10) : void 0,
62626
+ all: args.all
61843
62627
  },
61844
62628
  { command: "session", operation: "session.list" }
61845
62629
  );
@@ -61903,8 +62687,8 @@ var init_session4 = __esm({
61903
62687
  "audit-scope": { type: "string", description: "Audit log scope (global|local)" }
61904
62688
  },
61905
62689
  async run({ args }) {
61906
- const { detectSessionDrift, getProjectRoot: getProjectRoot43 } = await import("@cleocode/core");
61907
- const projectRoot = await getProjectRoot43();
62690
+ const { detectSessionDrift, getProjectRoot: getProjectRoot44 } = await import("@cleocode/core");
62691
+ const projectRoot = await getProjectRoot44();
61908
62692
  const scope = args["audit-scope"] === "local" ? "local" : "global";
61909
62693
  const report = await detectSessionDrift({ projectRoot, auditScope: scope });
61910
62694
  cliOutput(report, { command: "session drift", operation: "session.drift" });
@@ -62070,6 +62854,35 @@ var init_session4 = __esm({
62070
62854
  );
62071
62855
  }
62072
62856
  });
62857
+ adoptCommand = defineCommand({
62858
+ meta: {
62859
+ name: "adopt",
62860
+ description: "Rebind env to a specific session \u2014 prints export command to eval (T9975)"
62861
+ },
62862
+ args: {
62863
+ sessionId: {
62864
+ type: "positional",
62865
+ description: "Session ID to adopt",
62866
+ required: true
62867
+ }
62868
+ },
62869
+ async run({ args }) {
62870
+ const response = await dispatchRaw("mutate", "session", "adopt", {
62871
+ sessionId: args.sessionId
62872
+ });
62873
+ if (!response.success) {
62874
+ handleRawError(response, { command: "session adopt", operation: "session.adopt" });
62875
+ return;
62876
+ }
62877
+ const data = response.data;
62878
+ if (data?.exportCommand) {
62879
+ process.stdout.write(`${data.exportCommand}
62880
+ `);
62881
+ } else {
62882
+ cliOutput(data ?? {}, { command: "session adopt", operation: "session.adopt" });
62883
+ }
62884
+ }
62885
+ });
62073
62886
  lintCommand = defineCommand({
62074
62887
  meta: {
62075
62888
  name: "lint",
@@ -62111,7 +62924,9 @@ var init_session4 = __esm({
62111
62924
  "record-assumption": recordAssumptionCommand,
62112
62925
  "record-decision": recordDecisionCommand,
62113
62926
  "decision-log": decisionLogCommand,
62114
- lint: lintCommand
62927
+ lint: lintCommand,
62928
+ // T9975 — per-agent session isolation
62929
+ adopt: adoptCommand
62115
62930
  },
62116
62931
  async run({ cmd, rawArgs }) {
62117
62932
  const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
@@ -64757,7 +65572,7 @@ __export(token_exports, {
64757
65572
  tokenCommand: () => tokenCommand
64758
65573
  });
64759
65574
  import { readFileSync as readFileSync17 } from "node:fs";
64760
- import { getProjectRoot as getProjectRoot40, measureTokenExchange, recordTokenExchange as recordTokenExchange2 } from "@cleocode/core/internal";
65575
+ import { getProjectRoot as getProjectRoot41, measureTokenExchange, recordTokenExchange as recordTokenExchange2 } from "@cleocode/core/internal";
64761
65576
  function readPayload(args, textKey, fileKey) {
64762
65577
  const text = args[textKey];
64763
65578
  const file = args[fileKey];
@@ -64921,7 +65736,7 @@ var init_token = __esm({
64921
65736
  domain: args.domain,
64922
65737
  operation: args.operation
64923
65738
  };
64924
- const result = args.record ? await recordTokenExchange2(getProjectRoot40(), input2) : await measureTokenExchange(input2);
65739
+ const result = args.record ? await recordTokenExchange2(getProjectRoot41(), input2) : await measureTokenExchange(input2);
64925
65740
  cliOutput(result, {
64926
65741
  command: "token",
64927
65742
  operation: args.record ? "admin.token.record" : "token.estimate"
@@ -64957,7 +65772,7 @@ __export(transcript_exports, {
64957
65772
  });
64958
65773
  import { homedir as homedir7 } from "node:os";
64959
65774
  import { join as join31 } from "node:path";
64960
- import { getProjectRoot as getProjectRoot41 } from "@cleocode/core";
65775
+ import { getProjectRoot as getProjectRoot42 } from "@cleocode/core";
64961
65776
  import {
64962
65777
  parseDurationMs,
64963
65778
  pruneTranscripts,
@@ -64987,7 +65802,7 @@ var init_transcript = __esm({
64987
65802
  async run({ args }) {
64988
65803
  if (args.pending) {
64989
65804
  try {
64990
- const projectRoot = getProjectRoot41();
65805
+ const projectRoot = getProjectRoot42();
64991
65806
  const { scanPendingTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
64992
65807
  const pending = await scanPendingTranscripts(projectRoot);
64993
65808
  cliOutput(
@@ -65084,7 +65899,7 @@ var init_transcript = __esm({
65084
65899
  async run({ args }) {
65085
65900
  const tier = args.tier ?? "warm";
65086
65901
  const dryRun = args["dry-run"] ?? false;
65087
- const projectRoot = getProjectRoot41();
65902
+ const projectRoot = getProjectRoot42();
65088
65903
  try {
65089
65904
  const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
65090
65905
  const { findSessionTranscriptPath, listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
@@ -65196,7 +66011,7 @@ var init_transcript = __esm({
65196
66011
  const dryRun = args["dry-run"] ?? false;
65197
66012
  const olderThanHours = args["older-than-hours"] ? Number.parseInt(args["older-than-hours"], 10) : 24;
65198
66013
  const limit = args.limit ? Number.parseInt(args.limit, 10) : void 0;
65199
- const projectRoot = getProjectRoot41();
66014
+ const projectRoot = getProjectRoot42();
65200
66015
  try {
65201
66016
  const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
65202
66017
  const { listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
@@ -66323,7 +67138,7 @@ __export(worktree_exports, {
66323
67138
  worktreeCommand: () => worktreeCommand
66324
67139
  });
66325
67140
  import readline4 from "node:readline";
66326
- import { getProjectRoot as getProjectRoot42, listWorktrees as listWorktrees2 } from "@cleocode/core/internal";
67141
+ import { getProjectRoot as getProjectRoot43, listWorktrees as listWorktrees2 } from "@cleocode/core/internal";
66327
67142
  async function promptYesNo2(question) {
66328
67143
  return new Promise((resolve9) => {
66329
67144
  const rl = readline4.createInterface({ input: process.stdin, output: process.stdout });
@@ -66344,7 +67159,7 @@ function renderOrphanPreamble(wt) {
66344
67159
  ""
66345
67160
  ].join("\n");
66346
67161
  }
66347
- var VALID_STATUS_VALUES, listCommand27, pruneCommand3, destroyCommand, forceUnlockCommand, VALID_ADOPT_SOURCES, adoptCommand, worktreeCommand;
67162
+ var VALID_STATUS_VALUES, listCommand27, pruneCommand3, destroyCommand, forceUnlockCommand, VALID_ADOPT_SOURCES, adoptCommand2, worktreeCommand;
66348
67163
  var init_worktree3 = __esm({
66349
67164
  "packages/cleo/src/cli/commands/worktree.ts"() {
66350
67165
  "use strict";
@@ -66428,7 +67243,7 @@ var init_worktree3 = __esm({
66428
67243
  const staleDays = staleDaysRaw !== void 0 ? Number.parseInt(staleDaysRaw, 10) : void 0;
66429
67244
  const idleDaysRaw = typeof args["idle-days"] === "string" ? args["idle-days"] : void 0;
66430
67245
  const idleDays = idleDaysRaw !== void 0 ? Number.parseInt(idleDaysRaw, 10) : void 0;
66431
- const projectRoot = getProjectRoot42();
67246
+ const projectRoot = getProjectRoot43();
66432
67247
  const listResult = await listWorktrees2({
66433
67248
  projectRoot,
66434
67249
  ...staleDays !== void 0 && !Number.isNaN(staleDays) ? { staleDays } : {}
@@ -66585,7 +67400,7 @@ var init_worktree3 = __esm({
66585
67400
  }
66586
67401
  });
66587
67402
  VALID_ADOPT_SOURCES = ["claude-agent", "manual", "adopted"];
66588
- adoptCommand = defineCommand({
67403
+ adoptCommand2 = defineCommand({
66589
67404
  meta: {
66590
67405
  name: "adopt",
66591
67406
  description: "Register an externally-created worktree (e.g. Claude Code Agent isolation:worktree) in the CLEO SSoT so it surfaces in `cleo worktree list`."
@@ -66641,7 +67456,7 @@ var init_worktree3 = __esm({
66641
67456
  },
66642
67457
  subCommands: {
66643
67458
  list: listCommand27,
66644
- adopt: adoptCommand,
67459
+ adopt: adoptCommand2,
66645
67460
  prune: pruneCommand3,
66646
67461
  destroy: destroyCommand,
66647
67462
  "force-unlock": forceUnlockCommand
@@ -67017,6 +67832,12 @@ var COMMAND_MANIFEST = [
67017
67832
  description: "Fuzzy search tasks by title/description",
67018
67833
  load: async () => (await Promise.resolve().then(() => (init_find(), find_exports))).findCommand
67019
67834
  },
67835
+ {
67836
+ exportName: "focusCommand",
67837
+ name: "focus",
67838
+ description: "Single-envelope orientation for a task, epic, or saga \u2014 replaces 8 separate calls with one",
67839
+ load: async () => (await Promise.resolve().then(() => (init_focus3(), focus_exports))).focusCommand
67840
+ },
67020
67841
  {
67021
67842
  exportName: "gcCommand",
67022
67843
  name: "gc",
@@ -67955,7 +68776,7 @@ async function runStartupMaintenance() {
67955
68776
  detectAndRemoveStrayProjectNexus,
67956
68777
  getGlobalSalt,
67957
68778
  getLogger: getLogger20,
67958
- getProjectRoot: getProjectRoot43,
68779
+ getProjectRoot: getProjectRoot44,
67959
68780
  isCleanupMarkerSet,
67960
68781
  migrateSignaldockToConduit,
67961
68782
  needsSignaldockToConduitMigration,
@@ -67964,7 +68785,7 @@ async function runStartupMaintenance() {
67964
68785
  } = await import("@cleocode/core/internal");
67965
68786
  let projectRootForCleanup = "";
67966
68787
  try {
67967
- projectRootForCleanup = getProjectRoot43();
68788
+ projectRootForCleanup = getProjectRoot44();
67968
68789
  } catch {
67969
68790
  }
67970
68791
  if (!isCleanupMarkerSet(CLI_VERSION, projectRootForCleanup)) {
@@ -67984,7 +68805,7 @@ async function runStartupMaintenance() {
67984
68805
  const isInitInvocation = process.argv.slice(2).some((a) => a === "init");
67985
68806
  if (!isInitInvocation) {
67986
68807
  try {
67987
- const _projectRootForMigration = getProjectRoot43();
68808
+ const _projectRootForMigration = getProjectRoot44();
67988
68809
  if (needsSignaldockToConduitMigration(_projectRootForMigration)) {
67989
68810
  const migrationResult = migrateSignaldockToConduit(_projectRootForMigration);
67990
68811
  if (migrationResult.status === "failed") {