dreamcontext 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/dist/dashboard/assets/{BrainCanvas3D-BG5EC27O.js → BrainCanvas3D-mZCAQwGS.js} +1 -1
  2. package/dist/dashboard/assets/{_baseUniq-BBdAvxIr.js → _baseUniq-BUxsWVsL.js} +1 -1
  3. package/dist/dashboard/assets/{ar-SA-G6X2FPQ2-Cr8uJAl3.js → ar-SA-G6X2FPQ2-CccKfvbE.js} +1 -1
  4. package/dist/dashboard/assets/{arc-DehvUlnl.js → arc-DKUqFYZl.js} +1 -1
  5. package/dist/dashboard/assets/{architectureDiagram-Q4EWVU46-DocWLhJ3.js → architectureDiagram-Q4EWVU46-4WGtSdey.js} +1 -1
  6. package/dist/dashboard/assets/{az-AZ-76LH7QW2-UlZ4eYCI.js → az-AZ-76LH7QW2-C-NroZco.js} +1 -1
  7. package/dist/dashboard/assets/{bg-BG-XCXSNQG7-Er9YEeCL.js → bg-BG-XCXSNQG7-rQaoynHO.js} +1 -1
  8. package/dist/dashboard/assets/{blockDiagram-DXYQGD6D-Cg9oDuzC.js → blockDiagram-DXYQGD6D-DFuSTaR5.js} +1 -1
  9. package/dist/dashboard/assets/{bn-BD-2XOGV67Q-Cho39eqB.js → bn-BD-2XOGV67Q-D7R-v0tl.js} +1 -1
  10. package/dist/dashboard/assets/{c4Diagram-AHTNJAMY-BUm8oDH_.js → c4Diagram-AHTNJAMY-BJ_6YYYT.js} +1 -1
  11. package/dist/dashboard/assets/{ca-ES-6MX7JW3Y-CMkem7bw.js → ca-ES-6MX7JW3Y-dsbdYGPx.js} +1 -1
  12. package/dist/dashboard/assets/channel-CIIBmX-d.js +1 -0
  13. package/dist/dashboard/assets/{chunk-4BX2VUAB-5zNAwkrB.js → chunk-4BX2VUAB-HJLHjOrd.js} +1 -1
  14. package/dist/dashboard/assets/{chunk-4TB4RGXK-Bolly_uT.js → chunk-4TB4RGXK-DjvoLiQ0.js} +1 -1
  15. package/dist/dashboard/assets/{chunk-55IACEB6-DYdXQ_w1.js → chunk-55IACEB6-D-m72jvC.js} +1 -1
  16. package/dist/dashboard/assets/{chunk-EDXVE4YY-BcDcaZ9P.js → chunk-EDXVE4YY-BCjmEpM7.js} +1 -1
  17. package/dist/dashboard/assets/{chunk-FMBD7UC4-BIVvJRKA.js → chunk-FMBD7UC4-DDlvS1yz.js} +1 -1
  18. package/dist/dashboard/assets/{chunk-OYMX7WX6-Dsp-XPYC.js → chunk-OYMX7WX6-DYJRxE9t.js} +1 -1
  19. package/dist/dashboard/assets/{chunk-QZHKN3VN-DHQlULoN.js → chunk-QZHKN3VN-B76yDzg6.js} +1 -1
  20. package/dist/dashboard/assets/{chunk-YZCP3GAM-nfLb4HWe.js → chunk-YZCP3GAM-CZjAdM3g.js} +1 -1
  21. package/dist/dashboard/assets/classDiagram-6PBFFD2Q-BmFrdEQk.js +1 -0
  22. package/dist/dashboard/assets/classDiagram-v2-HSJHXN6E-BmFrdEQk.js +1 -0
  23. package/dist/dashboard/assets/clone-CNozcEzk.js +1 -0
  24. package/dist/dashboard/assets/{cose-bilkent-S5V4N54A-DCIbVeFN.js → cose-bilkent-S5V4N54A-CbVNpzeg.js} +1 -1
  25. package/dist/dashboard/assets/{cs-CZ-2BRQDIVT-DyFbnAib.js → cs-CZ-2BRQDIVT-J9uouZQt.js} +1 -1
  26. package/dist/dashboard/assets/{da-DK-5WZEPLOC-BHXqHOuV.js → da-DK-5WZEPLOC-CEwRNThM.js} +1 -1
  27. package/dist/dashboard/assets/{dagre-KV5264BT-CL9d19L-.js → dagre-KV5264BT-bTITGm1T.js} +1 -1
  28. package/dist/dashboard/assets/{de-DE-XR44H4JA-CJTodYJe.js → de-DE-XR44H4JA-__KY_QPB.js} +1 -1
  29. package/dist/dashboard/assets/{diagram-5BDNPKRD-BKw8TLKP.js → diagram-5BDNPKRD-CMb_WZII.js} +1 -1
  30. package/dist/dashboard/assets/{diagram-G4DWMVQ6-DgG0hw4A.js → diagram-G4DWMVQ6-ebqTPDMj.js} +1 -1
  31. package/dist/dashboard/assets/{diagram-MMDJMWI5-BJo4X0Wn.js → diagram-MMDJMWI5-dtIkfYIv.js} +1 -1
  32. package/dist/dashboard/assets/{diagram-TYMM5635-CcR6aJeo.js → diagram-TYMM5635-BhtWl36c.js} +1 -1
  33. package/dist/dashboard/assets/{el-GR-BZB4AONW-CBB6l2Bg.js → el-GR-BZB4AONW-CYkyOlmf.js} +1 -1
  34. package/dist/dashboard/assets/{erDiagram-SMLLAGMA-B6KYcAaM.js → erDiagram-SMLLAGMA-DcDH5wz0.js} +1 -1
  35. package/dist/dashboard/assets/{es-ES-U4NZUMDT-B1QetQmg.js → es-ES-U4NZUMDT-Bu5LUk6U.js} +1 -1
  36. package/dist/dashboard/assets/{eu-ES-A7QVB2H4-0kZWTDZ_.js → eu-ES-A7QVB2H4-IlNi4UGh.js} +1 -1
  37. package/dist/dashboard/assets/{fa-IR-HGAKTJCU-BV_G972f.js → fa-IR-HGAKTJCU-Jyt7rkFV.js} +1 -1
  38. package/dist/dashboard/assets/{fi-FI-Z5N7JZ37-4uRqjpqj.js → fi-FI-Z5N7JZ37-Cqcoli78.js} +1 -1
  39. package/dist/dashboard/assets/{flowDiagram-DWJPFMVM-3-llVL4u.js → flowDiagram-DWJPFMVM-B3iy-L85.js} +1 -1
  40. package/dist/dashboard/assets/{fr-FR-RHASNOE6-oiuA60jk.js → fr-FR-RHASNOE6-IKVJ17C4.js} +1 -1
  41. package/dist/dashboard/assets/{ganttDiagram-T4ZO3ILL-CS8zsjp0.js → ganttDiagram-T4ZO3ILL-UKhI0SVC.js} +1 -1
  42. package/dist/dashboard/assets/{gitGraphDiagram-UUTBAWPF-B0eMvQC7.js → gitGraphDiagram-UUTBAWPF-D-GWZW87.js} +1 -1
  43. package/dist/dashboard/assets/{gl-ES-HMX3MZ6V-CRxgAbK5.js → gl-ES-HMX3MZ6V-C3efiprZ.js} +1 -1
  44. package/dist/dashboard/assets/{graph-DqQ_drOx.js → graph-BFYZl1aj.js} +1 -1
  45. package/dist/dashboard/assets/{he-IL-6SHJWFNN-BToDYgJ7.js → he-IL-6SHJWFNN-BsFohTT8.js} +1 -1
  46. package/dist/dashboard/assets/{hi-IN-IWLTKZ5I-o-ioqjhK.js → hi-IN-IWLTKZ5I-Cdag_2yp.js} +1 -1
  47. package/dist/dashboard/assets/{hu-HU-A5ZG7DT2-CDW6wTqV.js → hu-HU-A5ZG7DT2-CybG-BTD.js} +1 -1
  48. package/dist/dashboard/assets/{id-ID-SAP4L64H-ResY2pug.js → id-ID-SAP4L64H-sH8BmLkx.js} +1 -1
  49. package/dist/dashboard/assets/{index-DKts-kEI.js → index-C2R7Is0-.js} +196 -196
  50. package/dist/dashboard/assets/{index-D71-76eF.js → index-D724s9RT.js} +1 -1
  51. package/dist/dashboard/assets/{index-BelyM9a_.css → index-d0njwauj.css} +1 -1
  52. package/dist/dashboard/assets/{infoDiagram-42DDH7IO-C2THbOkD.js → infoDiagram-42DDH7IO-D4tIVELa.js} +1 -1
  53. package/dist/dashboard/assets/{ishikawaDiagram-UXIWVN3A-CM5Uqs__.js → ishikawaDiagram-UXIWVN3A-C3kfQJPs.js} +1 -1
  54. package/dist/dashboard/assets/{it-IT-JPQ66NNP-fJefQ0PG.js → it-IT-JPQ66NNP-BUL9bA1N.js} +1 -1
  55. package/dist/dashboard/assets/{ja-JP-DBVTYXUO-CX5o3NDj.js → ja-JP-DBVTYXUO-D5RAsuhQ.js} +1 -1
  56. package/dist/dashboard/assets/{journeyDiagram-VCZTEJTY-8Y11-EOo.js → journeyDiagram-VCZTEJTY-DhXdAiRb.js} +1 -1
  57. package/dist/dashboard/assets/{kaa-6HZHGXH3-C2vaD2tX.js → kaa-6HZHGXH3-BFnf-Ufc.js} +1 -1
  58. package/dist/dashboard/assets/{kab-KAB-ZGHBKWFO-VKTEWRZv.js → kab-KAB-ZGHBKWFO-DiGK_ZTh.js} +1 -1
  59. package/dist/dashboard/assets/{kanban-definition-6JOO6SKY-fdXdNyv1.js → kanban-definition-6JOO6SKY-Cx5laNH2.js} +1 -1
  60. package/dist/dashboard/assets/{kk-KZ-P5N5QNE5-B2fu3rFx.js → kk-KZ-P5N5QNE5-DxsR0KaB.js} +1 -1
  61. package/dist/dashboard/assets/{km-KH-HSX4SM5Z-WkZWPeXS.js → km-KH-HSX4SM5Z-CvoPabo9.js} +1 -1
  62. package/dist/dashboard/assets/{ko-KR-MTYHY66A-CqdCI7AW.js → ko-KR-MTYHY66A-B9c5NmSl.js} +1 -1
  63. package/dist/dashboard/assets/{ku-TR-6OUDTVRD-Dao-7Eyh.js → ku-TR-6OUDTVRD-DG055kJy.js} +1 -1
  64. package/dist/dashboard/assets/{layout-NO-i8A2F.js → layout-DwwzFzt3.js} +1 -1
  65. package/dist/dashboard/assets/{linear-DfqSzNjQ.js → linear-CCkgZ20z.js} +1 -1
  66. package/dist/dashboard/assets/{lt-LT-XHIRWOB4-BT-wFvV7.js → lt-LT-XHIRWOB4-CToLILNS.js} +1 -1
  67. package/dist/dashboard/assets/{lv-LV-5QDEKY6T-DU4U7Z9Y.js → lv-LV-5QDEKY6T-RFiS8ekQ.js} +1 -1
  68. package/dist/dashboard/assets/{min-CEcHmSlm.js → min-Dc2FnahZ.js} +1 -1
  69. package/dist/dashboard/assets/{mindmap-definition-QFDTVHPH-BJw02kFe.js → mindmap-definition-QFDTVHPH-LUttOfMV.js} +1 -1
  70. package/dist/dashboard/assets/{mr-IN-CRQNXWMA-1qeodviH.js → mr-IN-CRQNXWMA-CnEWhejt.js} +1 -1
  71. package/dist/dashboard/assets/{my-MM-5M5IBNSE-CrvbSOvz.js → my-MM-5M5IBNSE-Bf6P8QZs.js} +1 -1
  72. package/dist/dashboard/assets/{nb-NO-T6EIAALU-B_1bglU7.js → nb-NO-T6EIAALU-Cr7PzKgs.js} +1 -1
  73. package/dist/dashboard/assets/{nl-NL-IS3SIHDZ-CSkrTKk7.js → nl-NL-IS3SIHDZ-D9Gjqrcc.js} +1 -1
  74. package/dist/dashboard/assets/{nn-NO-6E72VCQL-BZk5efFe.js → nn-NO-6E72VCQL-SGn5Xm7M.js} +1 -1
  75. package/dist/dashboard/assets/{oc-FR-POXYY2M6-Bv7XOHck.js → oc-FR-POXYY2M6-BJrKiOwj.js} +1 -1
  76. package/dist/dashboard/assets/{pa-IN-N4M65BXN-CqwtWDAw.js → pa-IN-N4M65BXN-CAMb13rV.js} +1 -1
  77. package/dist/dashboard/assets/{percentages-BXMCSKIN-FEVpi1aK.js → percentages-BXMCSKIN-DYtyPGCn.js} +7 -7
  78. package/dist/dashboard/assets/{pica-By0ke6np.js → pica-CsfxH0Em.js} +1 -1
  79. package/dist/dashboard/assets/{pieDiagram-DEJITSTG-CGiIN9rP.js → pieDiagram-DEJITSTG-C3G7iSyy.js} +1 -1
  80. package/dist/dashboard/assets/{pl-PL-T2D74RX3-BPL4bpVg.js → pl-PL-T2D74RX3-D6RD-xuv.js} +1 -1
  81. package/dist/dashboard/assets/{pt-BR-5N22H2LF-LrCGDR4f.js → pt-BR-5N22H2LF-BubaEA_3.js} +1 -1
  82. package/dist/dashboard/assets/{pt-PT-UZXXM6DQ-MzDeZ8io.js → pt-PT-UZXXM6DQ-CdM_0BZc.js} +1 -1
  83. package/dist/dashboard/assets/{quadrantDiagram-34T5L4WZ-6_OTN0xX.js → quadrantDiagram-34T5L4WZ-CVEg1LD9.js} +1 -1
  84. package/dist/dashboard/assets/{requirementDiagram-MS252O5E-Ck8soX2R.js → requirementDiagram-MS252O5E-DnXTKVKA.js} +1 -1
  85. package/dist/dashboard/assets/{ro-RO-JPDTUUEW-Be8UTIAL.js → ro-RO-JPDTUUEW-5i2wmUHd.js} +1 -1
  86. package/dist/dashboard/assets/{ru-RU-B4JR7IUQ-D6wZSeLr.js → ru-RU-B4JR7IUQ-HtCIg5-6.js} +1 -1
  87. package/dist/dashboard/assets/{sankeyDiagram-XADWPNL6-BDl2kRaQ.js → sankeyDiagram-XADWPNL6-D-Q3LUMx.js} +1 -1
  88. package/dist/dashboard/assets/{sequenceDiagram-FGHM5R23-u0Lxjo21.js → sequenceDiagram-FGHM5R23-D8wOCFBc.js} +1 -1
  89. package/dist/dashboard/assets/{si-LK-N5RQ5JYF-BcvqeVKa.js → si-LK-N5RQ5JYF-gdNFoVlI.js} +1 -1
  90. package/dist/dashboard/assets/{sk-SK-C5VTKIMK-BKBcl8fa.js → sk-SK-C5VTKIMK-Eag9tQA5.js} +1 -1
  91. package/dist/dashboard/assets/{sl-SI-NN7IZMDC-CH8BpLHn.js → sl-SI-NN7IZMDC-BFlQuwpN.js} +1 -1
  92. package/dist/dashboard/assets/{stateDiagram-FHFEXIEX-p6FESVEx.js → stateDiagram-FHFEXIEX-Do9qEX6W.js} +1 -1
  93. package/dist/dashboard/assets/stateDiagram-v2-QKLJ7IA2-D7FDMEq6.js +1 -0
  94. package/dist/dashboard/assets/{subset-shared.chunk-B4Hz462f.js → subset-shared.chunk-Cm4V9KkI.js} +1 -1
  95. package/dist/dashboard/assets/{subset-worker.chunk-B7VKgsUg.js → subset-worker.chunk-DbIuMVFm.js} +1 -1
  96. package/dist/dashboard/assets/{sv-SE-XGPEYMSR-ClNuCh1A.js → sv-SE-XGPEYMSR-ZEKrtqFc.js} +1 -1
  97. package/dist/dashboard/assets/{ta-IN-2NMHFXQM-CAnDI3eq.js → ta-IN-2NMHFXQM-gchwtW9r.js} +1 -1
  98. package/dist/dashboard/assets/{th-TH-HPSO5L25-Dz-3ZPUJ.js → th-TH-HPSO5L25-DohfXasj.js} +1 -1
  99. package/dist/dashboard/assets/{timeline-definition-GMOUNBTQ-CIac4xXn.js → timeline-definition-GMOUNBTQ-Czx9VG5g.js} +1 -1
  100. package/dist/dashboard/assets/{tr-TR-DEFEU3FU-BDzr5oow.js → tr-TR-DEFEU3FU-DYV95LVI.js} +1 -1
  101. package/dist/dashboard/assets/{uk-UA-QMV73CPH-Da9cYKW9.js → uk-UA-QMV73CPH-Bpxsn2xS.js} +1 -1
  102. package/dist/dashboard/assets/{vennDiagram-DHZGUBPP-BrX9xqo7.js → vennDiagram-DHZGUBPP-Ce_Sxxfx.js} +1 -1
  103. package/dist/dashboard/assets/{vi-VN-M7AON7JQ-e-doFs6_.js → vi-VN-M7AON7JQ-BK8ew4LX.js} +1 -1
  104. package/dist/dashboard/assets/{wardley-RL74JXVD-Ca-_RvNV.js → wardley-RL74JXVD-DPv1FABO.js} +1 -1
  105. package/dist/dashboard/assets/{wardleyDiagram-NUSXRM2D-WO1s20SP.js → wardleyDiagram-NUSXRM2D-CCn43KWG.js} +1 -1
  106. package/dist/dashboard/assets/{xychartDiagram-5P7HB3ND-BcKK53PD.js → xychartDiagram-5P7HB3ND-D8jqISXa.js} +1 -1
  107. package/dist/dashboard/assets/{zh-CN-LNUGB5OW-C2WmUiS8.js → zh-CN-LNUGB5OW-MHsVZfMi.js} +1 -1
  108. package/dist/dashboard/assets/{zh-HK-E62DVLB3-CdwVKtJe.js → zh-HK-E62DVLB3-vWPe0Xiq.js} +1 -1
  109. package/dist/dashboard/assets/{zh-TW-RAJ6MFWO-B_UG5PdF.js → zh-TW-RAJ6MFWO-D1qdXP-0.js} +1 -1
  110. package/dist/dashboard/index.html +2 -2
  111. package/dist/index.js +238 -293
  112. package/package.json +1 -1
  113. package/dist/dashboard/assets/channel-Sgeb6qBc.js +0 -1
  114. package/dist/dashboard/assets/classDiagram-6PBFFD2Q-DCtc4HRg.js +0 -1
  115. package/dist/dashboard/assets/classDiagram-v2-HSJHXN6E-DCtc4HRg.js +0 -1
  116. package/dist/dashboard/assets/clone-C1gU65sS.js +0 -1
  117. package/dist/dashboard/assets/stateDiagram-v2-QKLJ7IA2-s6Ql63bp.js +0 -1
package/dist/index.js CHANGED
@@ -26456,8 +26456,8 @@ var require_pattern = __commonJS({
26456
26456
  }
26457
26457
  exports2.endsWithSlashGlobStar = endsWithSlashGlobStar;
26458
26458
  function isAffectDepthOfReadingPattern(pattern) {
26459
- const basename33 = path2.basename(pattern);
26460
- return endsWithSlashGlobStar(pattern) || isStaticPattern(basename33);
26459
+ const basename32 = path2.basename(pattern);
26460
+ return endsWithSlashGlobStar(pattern) || isStaticPattern(basename32);
26461
26461
  }
26462
26462
  exports2.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
26463
26463
  function expandPatternsWithBraceExpansion(patterns) {
@@ -28920,7 +28920,7 @@ var init_excalidraw_text = __esm({
28920
28920
  // src/lib/knowledge-index.ts
28921
28921
  import { existsSync as existsSync10, statSync as statSync2 } from "fs";
28922
28922
  import { join as join10, relative } from "path";
28923
- function buildKnowledgeIndex(contextRoot) {
28923
+ function buildKnowledgeIndex(contextRoot, options2 = {}) {
28924
28924
  const knowledgeDir = join10(contextRoot, "knowledge");
28925
28925
  if (!existsSync10(knowledgeDir)) return [];
28926
28926
  const files = import_fast_glob.default.sync("**/*.md", { cwd: knowledgeDir, absolute: true });
@@ -28932,7 +28932,7 @@ function buildKnowledgeIndex(contextRoot) {
28932
28932
  const isIndexableKnowledge = typeof data.name === "string" && data.name.trim() !== "";
28933
28933
  if (isDarkDiagramSibling(file, boardDirs, isIndexableKnowledge)) continue;
28934
28934
  const slug = relative(knowledgeDir, file).replace(/\\/g, "/").replace(/\.md$/, "");
28935
- if (slug === "features" || slug.startsWith("features/")) continue;
28935
+ if (!options2.includeFeatures && (slug === "features" || slug.startsWith("features/"))) continue;
28936
28936
  const indexedContent = isExcalidrawPath(file) ? extractExcalidrawText(content) : content.trim();
28937
28937
  const entry = {
28938
28938
  slug,
@@ -28944,6 +28944,12 @@ function buildKnowledgeIndex(contextRoot) {
28944
28944
  content: indexedContent,
28945
28945
  mtime: statSync2(file).mtimeMs
28946
28946
  };
28947
+ if (typeof data.type === "string" && data.type.trim() !== "") {
28948
+ entry.type = data.type;
28949
+ }
28950
+ if (typeof data.status === "string" && data.status.trim() !== "") {
28951
+ entry.status = data.status;
28952
+ }
28947
28953
  if (typeof data.pinned_preview_lines === "number" && data.pinned_preview_lines > 0) {
28948
28954
  entry.pinnedPreviewLines = data.pinned_preview_lines;
28949
28955
  }
@@ -56969,7 +56975,7 @@ async function loadAssetDataURL(abs, maxDim, quality) {
56969
56975
  }
56970
56976
  }
56971
56977
  async function handleKnowledgeList(_req, res, _params, contextRoot) {
56972
- const entries = buildKnowledgeIndex(contextRoot);
56978
+ const entries = buildKnowledgeIndex(contextRoot, { includeFeatures: true });
56973
56979
  sendJson(res, 200, { entries });
56974
56980
  }
56975
56981
  async function handleKnowledgeGet(_req, res, params, contextRoot) {
@@ -57126,93 +57132,12 @@ var init_knowledge2 = __esm({
57126
57132
  }
57127
57133
  });
57128
57134
 
57129
- // src/server/routes/features.ts
57130
- import { existsSync as existsSync78 } from "fs";
57131
- import { basename as basename25 } from "path";
57132
- function getFeaturesDir2(contextRoot) {
57133
- return featuresDir(contextRoot);
57134
- }
57135
- async function handleFeaturesList(_req, res, _params, contextRoot) {
57136
- const featuresDir2 = getFeaturesDir2(contextRoot);
57137
- if (!existsSync78(featuresDir2)) {
57138
- sendJson(res, 200, { features: [] });
57139
- return;
57140
- }
57141
- const files = import_fast_glob19.default.sync("*.md", { cwd: featuresDir2, absolute: true });
57142
- const features = files.map((file) => {
57143
- const slug = basename25(file, ".md");
57144
- const { data } = readFrontmatter(file);
57145
- return {
57146
- slug,
57147
- id: data.id ?? "",
57148
- status: data.status ?? "planning",
57149
- created: data.created ?? "",
57150
- updated: data.updated ?? "",
57151
- tags: Array.isArray(data.tags) ? data.tags : [],
57152
- related_tasks: Array.isArray(data.related_tasks) ? data.related_tasks : [],
57153
- freshness: computeFeatureFreshness(
57154
- String(data.created ?? ""),
57155
- String(data.updated ?? "")
57156
- )
57157
- };
57158
- });
57159
- sendJson(res, 200, { features });
57160
- }
57161
- async function handleFeaturesGet(_req, res, params, contextRoot) {
57162
- const { slug } = params;
57163
- const filePath = safeChildPath2(getFeaturesDir2(contextRoot), `${slug}.md`);
57164
- if (!filePath) {
57165
- sendError(res, 400, "invalid_path", `Invalid feature slug: ${slug}`);
57166
- return;
57167
- }
57168
- if (!existsSync78(filePath)) {
57169
- sendError(res, 404, "not_found", `Feature not found: ${slug}`);
57170
- return;
57171
- }
57172
- const { data, content } = readFrontmatter(filePath);
57173
- let sections = [];
57174
- try {
57175
- sections = listSections(filePath);
57176
- } catch {
57177
- }
57178
- const sectionContents = {};
57179
- for (const section2 of sections) {
57180
- try {
57181
- const sectionContent = readSection(filePath, section2);
57182
- if (sectionContent) sectionContents[section2] = sectionContent;
57183
- } catch {
57184
- }
57185
- }
57186
- sendJson(res, 200, {
57187
- feature: {
57188
- slug,
57189
- ...data,
57190
- content,
57191
- sections,
57192
- sectionContents
57193
- }
57194
- });
57195
- }
57196
- var import_fast_glob19;
57197
- var init_features2 = __esm({
57198
- "src/server/routes/features.ts"() {
57199
- "use strict";
57200
- import_fast_glob19 = __toESM(require_out4(), 1);
57201
- init_frontmatter();
57202
- init_markdown();
57203
- init_middleware();
57204
- init_safe_path();
57205
- init_feature_freshness();
57206
- init_features_path();
57207
- }
57208
- });
57209
-
57210
57135
  // src/server/routes/changelog.ts
57211
- import { existsSync as existsSync79 } from "fs";
57136
+ import { existsSync as existsSync78 } from "fs";
57212
57137
  import { join as join76 } from "path";
57213
57138
  async function handleChangelogGet(_req, res, _params, contextRoot) {
57214
57139
  const filePath = join76(contextRoot, "core", "CHANGELOG.json");
57215
- if (!existsSync79(filePath)) {
57140
+ if (!existsSync78(filePath)) {
57216
57141
  sendJson(res, 200, { entries: [] });
57217
57142
  return;
57218
57143
  }
@@ -57225,7 +57150,7 @@ async function handleChangelogGet(_req, res, _params, contextRoot) {
57225
57150
  }
57226
57151
  async function handleReleasesGet(_req, res, _params, contextRoot) {
57227
57152
  const filePath = join76(contextRoot, "core", "RELEASES.json");
57228
- if (!existsSync79(filePath)) {
57153
+ if (!existsSync78(filePath)) {
57229
57154
  sendJson(res, 200, { entries: [] });
57230
57155
  return;
57231
57156
  }
@@ -57363,7 +57288,7 @@ async function handleReleasesUpdate(req, res, params, contextRoot) {
57363
57288
  return;
57364
57289
  }
57365
57290
  const filePath = join76(contextRoot, "core", "RELEASES.json");
57366
- if (!existsSync79(filePath)) {
57291
+ if (!existsSync78(filePath)) {
57367
57292
  sendError(res, 404, "not_found", `Release not found: ${params.version}`);
57368
57293
  return;
57369
57294
  }
@@ -57445,7 +57370,7 @@ async function handleReleasesDelete(_req, res, params, contextRoot) {
57445
57370
  const filePath = join76(contextRoot, "core", "RELEASES.json");
57446
57371
  const wasActive = getActivePlanningVersion(contextRoot) === params.version;
57447
57372
  let wasRegistered = false;
57448
- if (existsSync79(filePath)) {
57373
+ if (existsSync78(filePath)) {
57449
57374
  const entries = readJsonArray(filePath);
57450
57375
  for (const entry of entries) {
57451
57376
  if (!entry.status) entry.status = "released";
@@ -57486,8 +57411,8 @@ var init_changelog = __esm({
57486
57411
  });
57487
57412
 
57488
57413
  // src/lib/graph.ts
57489
- import { existsSync as existsSync80, readFileSync as readFileSync56 } from "fs";
57490
- import { join as join77, basename as basename26 } from "path";
57414
+ import { existsSync as existsSync79, readFileSync as readFileSync56 } from "fs";
57415
+ import { join as join77, basename as basename25 } from "path";
57491
57416
  function buildGraph(contextRoot) {
57492
57417
  const nodes = [];
57493
57418
  const links = [];
@@ -57508,15 +57433,15 @@ function buildGraph(contextRoot) {
57508
57433
  { prefix: "2", group: "memory" }
57509
57434
  ];
57510
57435
  for (const { prefix, group } of foundational) {
57511
- if (!existsSync80(coreDir)) continue;
57512
- const matches = import_fast_glob20.default.sync(`${prefix}.*.md`, { cwd: coreDir, absolute: true });
57436
+ if (!existsSync79(coreDir)) continue;
57437
+ const matches = import_fast_glob19.default.sync(`${prefix}.*.md`, { cwd: coreDir, absolute: true });
57513
57438
  for (const file of matches) {
57514
57439
  try {
57515
57440
  const { data } = readFrontmatter(file);
57516
- const filename = basename26(file);
57441
+ const filename = basename25(file);
57517
57442
  addNode({
57518
57443
  id: `core/${filename}`,
57519
- label: basename26(filename, ".md"),
57444
+ label: basename25(filename, ".md"),
57520
57445
  group,
57521
57446
  path: `core/${filename}`,
57522
57447
  meta: {
@@ -57528,15 +57453,15 @@ function buildGraph(contextRoot) {
57528
57453
  }
57529
57454
  }
57530
57455
  }
57531
- if (existsSync80(coreDir)) {
57532
- const others = import_fast_glob20.default.sync("[3-9]*.md", { cwd: coreDir, absolute: true });
57456
+ if (existsSync79(coreDir)) {
57457
+ const others = import_fast_glob19.default.sync("[3-9]*.md", { cwd: coreDir, absolute: true });
57533
57458
  for (const file of others) {
57534
- const filename = basename26(file);
57459
+ const filename = basename25(file);
57535
57460
  try {
57536
57461
  const { data } = readFrontmatter(file);
57537
57462
  addNode({
57538
57463
  id: `core/${filename}`,
57539
- label: basename26(filename, ".md"),
57464
+ label: basename25(filename, ".md"),
57540
57465
  group: "core",
57541
57466
  path: `core/${filename}`,
57542
57467
  meta: {
@@ -57549,10 +57474,10 @@ function buildGraph(contextRoot) {
57549
57474
  }
57550
57475
  }
57551
57476
  const featuresPath = featuresDir(contextRoot);
57552
- if (existsSync80(featuresPath)) {
57553
- const files = import_fast_glob20.default.sync("*.md", { cwd: featuresPath, absolute: true });
57477
+ if (existsSync79(featuresPath)) {
57478
+ const files = import_fast_glob19.default.sync("*.md", { cwd: featuresPath, absolute: true });
57554
57479
  for (const file of files) {
57555
- const fileSlug = basename26(file, ".md");
57480
+ const fileSlug = basename25(file, ".md");
57556
57481
  try {
57557
57482
  const { data } = readFrontmatter(file);
57558
57483
  const id = data.id ? String(data.id) : `feature/${fileSlug}`;
@@ -57580,10 +57505,10 @@ function buildGraph(contextRoot) {
57580
57505
  }
57581
57506
  }
57582
57507
  const stateDir = join77(contextRoot, "state");
57583
- if (existsSync80(stateDir)) {
57584
- const files = import_fast_glob20.default.sync("*.md", { cwd: stateDir, absolute: true });
57508
+ if (existsSync79(stateDir)) {
57509
+ const files = import_fast_glob19.default.sync("*.md", { cwd: stateDir, absolute: true });
57585
57510
  for (const file of files) {
57586
- const fileSlug = basename26(file, ".md");
57511
+ const fileSlug = basename25(file, ".md");
57587
57512
  try {
57588
57513
  const { data } = readFrontmatter(file);
57589
57514
  const id = data.id ? String(data.id) : `task/${fileSlug}`;
@@ -57632,10 +57557,10 @@ function buildGraph(contextRoot) {
57632
57557
  );
57633
57558
  }
57634
57559
  const inboxDir2 = join77(contextRoot, "inbox");
57635
- if (existsSync80(inboxDir2)) {
57636
- const files = import_fast_glob20.default.sync("*.md", { cwd: inboxDir2, absolute: true });
57560
+ if (existsSync79(inboxDir2)) {
57561
+ const files = import_fast_glob19.default.sync("*.md", { cwd: inboxDir2, absolute: true });
57637
57562
  for (const file of files) {
57638
- const slug = basename26(file, ".md");
57563
+ const slug = basename25(file, ".md");
57639
57564
  let label = slug;
57640
57565
  let description = "";
57641
57566
  try {
@@ -57655,7 +57580,7 @@ function buildGraph(contextRoot) {
57655
57580
  }
57656
57581
  const releasesPath = join77(coreDir, "RELEASES.json");
57657
57582
  let releases = [];
57658
- if (existsSync80(releasesPath)) {
57583
+ if (existsSync79(releasesPath)) {
57659
57584
  try {
57660
57585
  const parsed = JSON.parse(readFileSync56(releasesPath, "utf-8"));
57661
57586
  if (Array.isArray(parsed)) releases = parsed;
@@ -57742,11 +57667,11 @@ function buildGraph(contextRoot) {
57742
57667
  }
57743
57668
  return { nodes, links };
57744
57669
  }
57745
- var import_fast_glob20;
57670
+ var import_fast_glob19;
57746
57671
  var init_graph = __esm({
57747
57672
  "src/lib/graph.ts"() {
57748
57673
  "use strict";
57749
- import_fast_glob20 = __toESM(require_out4(), 1);
57674
+ import_fast_glob19 = __toESM(require_out4(), 1);
57750
57675
  init_frontmatter();
57751
57676
  init_knowledge_index();
57752
57677
  init_features_path();
@@ -57754,7 +57679,7 @@ var init_graph = __esm({
57754
57679
  });
57755
57680
 
57756
57681
  // src/server/routes/graph.ts
57757
- import { existsSync as existsSync81, readFileSync as readFileSync57 } from "fs";
57682
+ import { existsSync as existsSync80, readFileSync as readFileSync57 } from "fs";
57758
57683
  import { normalize, resolve as resolve16, sep as sep11 } from "path";
57759
57684
  async function handleGraphGet(_req, res, _params, contextRoot) {
57760
57685
  try {
@@ -57778,7 +57703,7 @@ async function handleGraphContentGet(req, res, _params, contextRoot) {
57778
57703
  sendError(res, 400, "invalid_path", "Path escapes context root.");
57779
57704
  return;
57780
57705
  }
57781
- if (!existsSync81(absTarget)) {
57706
+ if (!existsSync80(absTarget)) {
57782
57707
  sendError(res, 404, "not_found", `Path not found: ${rawPath}`);
57783
57708
  return;
57784
57709
  }
@@ -57829,7 +57754,7 @@ var init_graph2 = __esm({
57829
57754
  });
57830
57755
 
57831
57756
  // src/lib/council.ts
57832
- import { existsSync as existsSync82, mkdirSync as mkdirSync38, readFileSync as readFileSync58 } from "fs";
57757
+ import { existsSync as existsSync81, mkdirSync as mkdirSync38, readFileSync as readFileSync58 } from "fs";
57833
57758
  import { join as join78, resolve as resolve17, sep as sep12 } from "path";
57834
57759
  import { fileURLToPath as fileURLToPath7 } from "url";
57835
57760
  function getCouncilDir() {
@@ -57872,14 +57797,14 @@ function ensureCouncilDir() {
57872
57797
  const dir = getCouncilDir();
57873
57798
  mkdirSync38(dir, { recursive: true });
57874
57799
  const indexPath2 = getCouncilIndexPath();
57875
- if (!existsSync82(indexPath2)) {
57800
+ if (!existsSync81(indexPath2)) {
57876
57801
  writeJsonArray(indexPath2, []);
57877
57802
  }
57878
57803
  return dir;
57879
57804
  }
57880
57805
  function ensureDebateExists(debateId) {
57881
57806
  const dir = getDebateDir(debateId);
57882
- if (!existsSync82(dir)) {
57807
+ if (!existsSync81(dir)) {
57883
57808
  throw new Error(`Debate not found: ${debateId}`);
57884
57809
  }
57885
57810
  return dir;
@@ -57887,7 +57812,7 @@ function ensureDebateExists(debateId) {
57887
57812
  function ensurePersonaExists(debateId, personaSlug) {
57888
57813
  ensureDebateExists(debateId);
57889
57814
  const dir = getPersonaDir(debateId, personaSlug);
57890
- if (!existsSync82(dir)) {
57815
+ if (!existsSync81(dir)) {
57891
57816
  throw new Error(`Persona not found in ${debateId}: ${personaSlug}`);
57892
57817
  }
57893
57818
  return dir;
@@ -57899,7 +57824,7 @@ function readDebateFrontmatter(debateId) {
57899
57824
  }
57900
57825
  function loadCouncilIndex() {
57901
57826
  const indexPath2 = getCouncilIndexPath();
57902
- if (!existsSync82(indexPath2)) return [];
57827
+ if (!existsSync81(indexPath2)) return [];
57903
57828
  return readJsonArray(indexPath2);
57904
57829
  }
57905
57830
  function saveCouncilIndex(entries) {
@@ -57926,7 +57851,7 @@ function loadTemplate(filename) {
57926
57851
  join78(__dirname6, "..", "..", "src", "templates", filename)
57927
57852
  ];
57928
57853
  for (const path2 of candidates) {
57929
- if (existsSync82(path2)) {
57854
+ if (existsSync81(path2)) {
57930
57855
  return readFileSync58(path2, "utf-8");
57931
57856
  }
57932
57857
  }
@@ -58002,7 +57927,7 @@ function parseReportRounds(reportContent) {
58002
57927
  }
58003
57928
  function getPersonaRoundSummary(debateId, personaSlug, round) {
58004
57929
  const reportPath2 = join78(getPersonaDir(debateId, personaSlug), "report.md");
58005
- if (!existsSync82(reportPath2)) return null;
57930
+ if (!existsSync81(reportPath2)) return null;
58006
57931
  const { content } = readFrontmatter(reportPath2);
58007
57932
  const entries = parseReportRounds(content);
58008
57933
  const entry = entries.find((e) => e.round === round);
@@ -58036,7 +57961,7 @@ var init_council = __esm({
58036
57961
  });
58037
57962
 
58038
57963
  // src/server/routes/council.ts
58039
- import { existsSync as existsSync83 } from "fs";
57964
+ import { existsSync as existsSync82 } from "fs";
58040
57965
  import { join as join79, resolve as resolve18, sep as sep13 } from "path";
58041
57966
  function getCouncilDir2(contextRoot) {
58042
57967
  return join79(contextRoot, "council");
@@ -58093,13 +58018,13 @@ function toParsedRound(entry) {
58093
58018
  }
58094
58019
  function loadPersonaDetail(debateDir, slug) {
58095
58020
  const personaDir = join79(debateDir, slug);
58096
- if (!existsSync83(personaDir)) return null;
58021
+ if (!existsSync82(personaDir)) return null;
58097
58022
  const personaFile = join79(personaDir, "context-and-persona.md");
58098
58023
  const reportFile = join79(personaDir, "report.md");
58099
58024
  let fm = { name: slug, model: "unknown", aspects: [], round_entries: 0 };
58100
58025
  let persona = "";
58101
58026
  let crossContext = {};
58102
- if (existsSync83(personaFile)) {
58027
+ if (existsSync82(personaFile)) {
58103
58028
  const parsed = readFrontmatter(personaFile);
58104
58029
  fm = {
58105
58030
  name: parsed.data.name ?? slug,
@@ -58112,13 +58037,13 @@ function loadPersonaDetail(debateDir, slug) {
58112
58037
  crossContext = split.crossContext;
58113
58038
  }
58114
58039
  let rounds = [];
58115
- if (existsSync83(reportFile)) {
58040
+ if (existsSync82(reportFile)) {
58116
58041
  const { content } = readFrontmatter(reportFile);
58117
58042
  rounds = parseReportRounds(content).map(toParsedRound);
58118
58043
  }
58119
58044
  const researchIndex = join79(personaDir, "researches", "index.json");
58120
58045
  let researches = [];
58121
- if (existsSync83(researchIndex)) {
58046
+ if (existsSync82(researchIndex)) {
58122
58047
  try {
58123
58048
  researches = readJsonArray(researchIndex);
58124
58049
  } catch {
@@ -58129,7 +58054,7 @@ function loadPersonaDetail(debateDir, slug) {
58129
58054
  }
58130
58055
  async function handleCouncilList(_req, res, _params, contextRoot) {
58131
58056
  const indexPath2 = join79(getCouncilDir2(contextRoot), "index.json");
58132
- if (!existsSync83(indexPath2)) {
58057
+ if (!existsSync82(indexPath2)) {
58133
58058
  sendJson(res, 200, { debates: [] });
58134
58059
  return;
58135
58060
  }
@@ -58138,7 +58063,7 @@ async function handleCouncilList(_req, res, _params, contextRoot) {
58138
58063
  const enriched = debates.map((d) => {
58139
58064
  const debateFile = join79(getCouncilDir2(contextRoot), d.id, "debate.md");
58140
58065
  let personaSlugs = [];
58141
- if (existsSync83(debateFile)) {
58066
+ if (existsSync82(debateFile)) {
58142
58067
  try {
58143
58068
  const fm = readFrontmatter(debateFile).data;
58144
58069
  if (Array.isArray(fm.personas)) personaSlugs = fm.personas;
@@ -58163,12 +58088,12 @@ async function handleCouncilGet(_req, res, params, contextRoot) {
58163
58088
  const councilDir = getCouncilDir2(contextRoot);
58164
58089
  const debateDirUnchecked = join79(councilDir, debateId);
58165
58090
  const debateDir = assertWithin(councilDir, debateDirUnchecked);
58166
- if (!debateDir || !existsSync83(debateDir)) {
58091
+ if (!debateDir || !existsSync82(debateDir)) {
58167
58092
  sendError(res, 404, "not_found", `Debate not found: ${debateId}`);
58168
58093
  return;
58169
58094
  }
58170
58095
  const debateFile = join79(debateDir, "debate.md");
58171
- if (!existsSync83(debateFile)) {
58096
+ if (!existsSync82(debateFile)) {
58172
58097
  sendError(res, 404, "not_found", `Debate metadata missing: ${debateId}`);
58173
58098
  return;
58174
58099
  }
@@ -58186,10 +58111,10 @@ async function handleCouncilGet(_req, res, params, contextRoot) {
58186
58111
  updated_at: String(fmRaw.updated_at ?? "")
58187
58112
  };
58188
58113
  const roundLogFile = join79(debateDir, "round-log.md");
58189
- const roundLog = existsSync83(roundLogFile) ? readFrontmatter(roundLogFile).content : null;
58114
+ const roundLog = existsSync82(roundLogFile) ? readFrontmatter(roundLogFile).content : null;
58190
58115
  const finalReportFile = join79(debateDir, "final-report.md");
58191
58116
  let finalReport = null;
58192
- if (existsSync83(finalReportFile)) {
58117
+ if (existsSync82(finalReportFile)) {
58193
58118
  const parsed = readFrontmatter(finalReportFile);
58194
58119
  finalReport = { frontmatter: parsed.data, content: parsed.content };
58195
58120
  }
@@ -58219,7 +58144,7 @@ async function handleCouncilResearchGet(_req, res, params, contextRoot) {
58219
58144
  councilDir,
58220
58145
  join79(councilDir, debateId, personaSlug, "researches", `${researchSlug}.md`)
58221
58146
  );
58222
- if (!researchFile || !existsSync83(researchFile)) {
58147
+ if (!researchFile || !existsSync82(researchFile)) {
58223
58148
  sendError(res, 404, "not_found", `Research not found: ${researchSlug}`);
58224
58149
  return;
58225
58150
  }
@@ -58384,9 +58309,9 @@ var init_config = __esm({
58384
58309
 
58385
58310
  // src/server/routes/vaults.ts
58386
58311
  import { dirname as dirname47, resolve as resolve19 } from "path";
58387
- import { existsSync as existsSync84 } from "fs";
58312
+ import { existsSync as existsSync83 } from "fs";
58388
58313
  async function handleVaultsGet(_req, res, _params, contextRoot) {
58389
- const vaults = listVaults().map((v) => ({ ...v, exists: existsSync84(resolve19(v.path)) }));
58314
+ const vaults = listVaults().map((v) => ({ ...v, exists: existsSync83(resolve19(v.path)) }));
58390
58315
  const current = contextRoot ? vaults.find((v) => resolve19(v.path) === resolve19(dirname47(contextRoot)))?.name ?? null : null;
58391
58316
  sendJson(res, 200, { vaults, current });
58392
58317
  }
@@ -58401,7 +58326,7 @@ var init_vaults2 = __esm({
58401
58326
  // src/lib/vault-discovery.ts
58402
58327
  import { dirname as dirname48 } from "path";
58403
58328
  function discoverVaults(root) {
58404
- const matches = import_fast_glob21.default.sync("**/_dream_context", {
58329
+ const matches = import_fast_glob20.default.sync("**/_dream_context", {
58405
58330
  cwd: root,
58406
58331
  absolute: true,
58407
58332
  onlyDirectories: true,
@@ -58414,7 +58339,7 @@ function discoverVaults(root) {
58414
58339
  return Array.from(projects).sort();
58415
58340
  }
58416
58341
  async function discoverVaultsAsync(root) {
58417
- const matches = await (0, import_fast_glob21.default)("**/_dream_context", {
58342
+ const matches = await (0, import_fast_glob20.default)("**/_dream_context", {
58418
58343
  cwd: root,
58419
58344
  absolute: true,
58420
58345
  onlyDirectories: true,
@@ -58426,11 +58351,11 @@ async function discoverVaultsAsync(root) {
58426
58351
  for (const ctx of matches) projects.add(dirname48(ctx));
58427
58352
  return Array.from(projects).sort();
58428
58353
  }
58429
- var import_fast_glob21;
58354
+ var import_fast_glob20;
58430
58355
  var init_vault_discovery = __esm({
58431
58356
  "src/lib/vault-discovery.ts"() {
58432
58357
  "use strict";
58433
- import_fast_glob21 = __toESM(require_out4(), 1);
58358
+ import_fast_glob20 = __toESM(require_out4(), 1);
58434
58359
  }
58435
58360
  });
58436
58361
 
@@ -58481,8 +58406,8 @@ var init_ensure_cli = __esm({
58481
58406
  });
58482
58407
 
58483
58408
  // src/server/routes/launcher.ts
58484
- import { basename as basename27, isAbsolute as isAbsolute3, join as join80, resolve as resolve20, sep as sep14 } from "path";
58485
- import { existsSync as existsSync85, mkdirSync as mkdirSync39, readdirSync as readdirSync18, statSync as statSync16, createReadStream, readFileSync as readFileSync59, writeFileSync as writeFileSync47 } from "fs";
58409
+ import { basename as basename26, isAbsolute as isAbsolute3, join as join80, resolve as resolve20, sep as sep14 } from "path";
58410
+ import { existsSync as existsSync84, mkdirSync as mkdirSync39, readdirSync as readdirSync18, statSync as statSync16, createReadStream, readFileSync as readFileSync59, writeFileSync as writeFileSync47 } from "fs";
58486
58411
  import { homedir as homedir5 } from "os";
58487
58412
  import { execFile as execFile2, spawn as spawn4 } from "child_process";
58488
58413
  import { promisify as promisify2 } from "util";
@@ -58506,14 +58431,14 @@ async function handleLauncherDiscover(req, res, _params, _contextRoot) {
58506
58431
  return;
58507
58432
  }
58508
58433
  const resolvedRoot = resolve20(root);
58509
- if (!existsSync85(resolvedRoot)) {
58434
+ if (!existsSync84(resolvedRoot)) {
58510
58435
  sendError(res, 400, "invalid_root", `Path does not exist: ${resolvedRoot}`);
58511
58436
  return;
58512
58437
  }
58513
58438
  const registeredPaths = new Set(listVaults().map((v) => resolve20(v.path)));
58514
58439
  const discovered = await discoverVaultsAsync(resolvedRoot);
58515
58440
  const projects = discovered.map((path2) => ({
58516
- name: basename27(path2),
58441
+ name: basename26(path2),
58517
58442
  path: path2,
58518
58443
  registered: registeredPaths.has(resolve20(path2))
58519
58444
  }));
@@ -58574,14 +58499,14 @@ async function scaffoldProject(a, runner = defaultCliRunner, home) {
58574
58499
  throw new ScaffoldError("parentDir must be an absolute path.");
58575
58500
  }
58576
58501
  const resolvedParent = resolve20(parentDir);
58577
- if (!existsSync85(resolvedParent) || !statSync16(resolvedParent).isDirectory()) {
58502
+ if (!existsSync84(resolvedParent) || !statSync16(resolvedParent).isDirectory()) {
58578
58503
  throw new ScaffoldError(`Parent directory does not exist: ${resolvedParent}`);
58579
58504
  }
58580
58505
  target = resolve20(resolvedParent, name);
58581
58506
  if (target !== join80(resolvedParent, name) || !target.startsWith(resolvedParent + sep14)) {
58582
58507
  throw new ScaffoldError("Resolved project path escapes the parent directory.");
58583
58508
  }
58584
- if (isNonEmptyDir(target) && !existsSync85(join80(target, "_dream_context"))) {
58509
+ if (isNonEmptyDir(target) && !existsSync84(join80(target, "_dream_context"))) {
58585
58510
  throw new ScaffoldError(`A non-empty folder already exists at ${target}.`);
58586
58511
  }
58587
58512
  mkdirSync39(target, { recursive: true });
@@ -58591,13 +58516,13 @@ async function scaffoldProject(a, runner = defaultCliRunner, home) {
58591
58516
  throw new ScaffoldError("projectPath must be an absolute path.");
58592
58517
  }
58593
58518
  target = resolve20(projectPath);
58594
- if (!existsSync85(target) || !statSync16(target).isDirectory()) {
58519
+ if (!existsSync84(target) || !statSync16(target).isDirectory()) {
58595
58520
  throw new ScaffoldError(`Folder does not exist: ${target}`);
58596
58521
  }
58597
58522
  } else {
58598
58523
  throw new ScaffoldError("mode must be 'new' or 'existing'.");
58599
58524
  }
58600
- const alreadyProject = existsSync85(join80(target, "_dream_context"));
58525
+ const alreadyProject = existsSync84(join80(target, "_dream_context"));
58601
58526
  if (!alreadyProject) {
58602
58527
  const initArgs = ["init", "--yes", "--platforms", platformArg, "--name", name];
58603
58528
  if (a.description?.trim()) initArgs.push("--description", a.description.trim());
@@ -58652,14 +58577,14 @@ async function handleLauncherDetect(req, res, _params, _contextRoot) {
58652
58577
  return;
58653
58578
  }
58654
58579
  const resolved = resolve20(path2);
58655
- if (!existsSync85(resolved)) {
58580
+ if (!existsSync84(resolved)) {
58656
58581
  sendError(res, 400, "invalid_path", `Path does not exist: ${resolved}`);
58657
58582
  return;
58658
58583
  }
58659
58584
  sendJson(res, 200, {
58660
58585
  stack: detectTechStack(resolved) ?? "",
58661
- hasContext: existsSync85(join80(resolved, "_dream_context")),
58662
- name: basename27(resolved)
58586
+ hasContext: existsSync84(join80(resolved, "_dream_context")),
58587
+ name: basename26(resolved)
58663
58588
  });
58664
58589
  }
58665
58590
  async function handleLauncherCatalog(_req, res, _params, _contextRoot) {
@@ -58685,7 +58610,7 @@ async function handleSleepyConfigGet(_req, res, _params, _contextRoot) {
58685
58610
  let hotkey = "Alt+Cmd+S";
58686
58611
  try {
58687
58612
  const p = sleepyConfigPath();
58688
- if (existsSync85(p)) {
58613
+ if (existsSync84(p)) {
58689
58614
  const raw = JSON.parse(readFileSync59(p, "utf-8"));
58690
58615
  enabled = raw.enabled === true;
58691
58616
  if (typeof raw.hotkey === "string" && raw.hotkey.trim()) hotkey = raw.hotkey;
@@ -58730,7 +58655,7 @@ async function handleAgentSettingsGet(_req, res, _params, _contextRoot) {
58730
58655
  let settings = { ...AGENT_UI_DEFAULTS };
58731
58656
  try {
58732
58657
  const p = agentSettingsPath();
58733
- if (existsSync85(p)) {
58658
+ if (existsSync84(p)) {
58734
58659
  settings = coerceAgentSettings(JSON.parse(readFileSync59(p, "utf-8")));
58735
58660
  }
58736
58661
  } catch {
@@ -58767,7 +58692,7 @@ async function handleSleepyVideo(req, res, _params, _contextRoot) {
58767
58692
  return;
58768
58693
  }
58769
58694
  const file = join80(dir, `${mode}.mp4`);
58770
- if (!existsSync85(file)) {
58695
+ if (!existsSync84(file)) {
58771
58696
  res.writeHead(404);
58772
58697
  res.end();
58773
58698
  return;
@@ -58799,7 +58724,7 @@ async function handleSleepyAnim(req, res, _params, _contextRoot) {
58799
58724
  }
58800
58725
  const dir = process.env.DREAMCONTEXT_SLEEPY_DIR;
58801
58726
  const file = dir ? join80(dir, `${mode}.webp`) : "";
58802
- if (!file || !existsSync85(file)) {
58727
+ if (!file || !existsSync84(file)) {
58803
58728
  res.writeHead(404);
58804
58729
  res.end();
58805
58730
  return;
@@ -58851,14 +58776,14 @@ async function handleLauncherCapture(req, res, _params, _contextRoot) {
58851
58776
  return;
58852
58777
  }
58853
58778
  const cwd = resolve20(vault.path);
58854
- if (!existsSync85(cwd)) {
58779
+ if (!existsSync84(cwd)) {
58855
58780
  sendError(res, 400, "missing_vault", `Vault path no longer exists: ${cwd}`);
58856
58781
  return;
58857
58782
  }
58858
58783
  if (mode === "learn") {
58859
58784
  try {
58860
58785
  const changelogPath = join80(cwd, "_dream_context", "core", "CHANGELOG.json");
58861
- if (!existsSync85(changelogPath)) {
58786
+ if (!existsSync84(changelogPath)) {
58862
58787
  sendError(res, 400, "not_initialized", `"${vaultName}" has no _dream_context \u2014 run init first.`);
58863
58788
  return;
58864
58789
  }
@@ -58978,7 +58903,7 @@ async function handleLauncherDefaults(_req, res, _params, _contextRoot) {
58978
58903
  sendJson(res, 200, { home, defaultParent: join80(home, "projects") });
58979
58904
  }
58980
58905
  function computeVaultStatus(v, latest) {
58981
- const exists = existsSync85(resolve20(v.path));
58906
+ const exists = existsSync84(resolve20(v.path));
58982
58907
  let setupVersion = "0.0.0";
58983
58908
  let shareable = false;
58984
58909
  if (exists) {
@@ -59030,7 +58955,7 @@ async function handleLauncherUpdate(req, res, _params, _contextRoot) {
59030
58955
  return;
59031
58956
  }
59032
58957
  const target = resolve20(vault.path);
59033
- if (!existsSync85(target)) {
58958
+ if (!existsSync84(target)) {
59034
58959
  sendError(res, 400, "missing_vault", `Vault path no longer exists: ${target}`);
59035
58960
  return;
59036
58961
  }
@@ -59109,7 +59034,7 @@ async function handleLauncherUpgradeStatus(_req, res, _params, _contextRoot) {
59109
59034
  async function handleLauncherRelaunch(_req, res, _params, _contextRoot) {
59110
59035
  const manifest = readAppManifest();
59111
59036
  const appPath = manifest?.path;
59112
- if (!appPath || !existsSync85(appPath)) {
59037
+ if (!appPath || !existsSync84(appPath)) {
59113
59038
  sendJson(res, 200, { ok: false, reason: "app_not_installed" });
59114
59039
  return;
59115
59040
  }
@@ -59136,7 +59061,7 @@ async function handleLauncherFederationGraph(_req, res, _params, _contextRoot) {
59136
59061
  const connections = [];
59137
59062
  const seen = /* @__PURE__ */ new Set();
59138
59063
  for (const v of vaults) {
59139
- if (!existsSync85(resolve20(v.path))) continue;
59064
+ if (!existsSync84(resolve20(v.path))) continue;
59140
59065
  const conns = listConnections(join80(resolve20(v.path), "_dream_context"));
59141
59066
  for (const c of conns) {
59142
59067
  if (!known.has(c.vault)) continue;
@@ -59295,7 +59220,7 @@ async function handleLauncherShareable(req, res, _params, _contextRoot) {
59295
59220
  return;
59296
59221
  }
59297
59222
  const root = resolve20(vault.path);
59298
- if (!existsSync85(root)) {
59223
+ if (!existsSync84(root)) {
59299
59224
  sendError(res, 400, "missing_vault", `Vault path no longer exists: ${root}`);
59300
59225
  return;
59301
59226
  }
@@ -59371,13 +59296,13 @@ var init_launcher = __esm({
59371
59296
 
59372
59297
  // src/server/routes/ui-settings.ts
59373
59298
  import { dirname as dirname49, join as join81 } from "path";
59374
- import { existsSync as existsSync86, mkdirSync as mkdirSync40, readFileSync as readFileSync60, writeFileSync as writeFileSync48 } from "fs";
59299
+ import { existsSync as existsSync85, mkdirSync as mkdirSync40, readFileSync as readFileSync60, writeFileSync as writeFileSync48 } from "fs";
59375
59300
  function settingsPath(contextRoot) {
59376
59301
  return join81(contextRoot, BRAIN_SETTINGS_REL_PATH);
59377
59302
  }
59378
59303
  async function handleBrainSettingsGet(_req, res, _params, contextRoot) {
59379
59304
  const path2 = settingsPath(contextRoot);
59380
- if (!existsSync86(path2)) {
59305
+ if (!existsSync85(path2)) {
59381
59306
  sendJson(res, 200, { settings: {} });
59382
59307
  return;
59383
59308
  }
@@ -59419,7 +59344,7 @@ function makeSettingsHandlers(relPath, logTag) {
59419
59344
  const pathFor = (contextRoot) => join81(contextRoot, relPath);
59420
59345
  const get = async (_req, res, _params, contextRoot) => {
59421
59346
  const path2 = pathFor(contextRoot);
59422
- if (!existsSync86(path2)) {
59347
+ if (!existsSync85(path2)) {
59423
59348
  sendJson(res, 200, { settings: {} });
59424
59349
  return;
59425
59350
  }
@@ -59827,7 +59752,7 @@ var init_lab2 = __esm({
59827
59752
 
59828
59753
  // src/server/routes/board.ts
59829
59754
  import { dirname as dirname50, join as join82 } from "path";
59830
- import { existsSync as existsSync87, mkdirSync as mkdirSync41, readFileSync as readFileSync61, writeFileSync as writeFileSync49 } from "fs";
59755
+ import { existsSync as existsSync86, mkdirSync as mkdirSync41, readFileSync as readFileSync61, writeFileSync as writeFileSync49 } from "fs";
59831
59756
  function sharedPath(contextRoot) {
59832
59757
  return join82(contextRoot, SHARED_REL_PATH);
59833
59758
  }
@@ -59835,7 +59760,7 @@ function localPath(contextRoot) {
59835
59760
  return join82(contextRoot, LOCAL_REL_PATH);
59836
59761
  }
59837
59762
  function readBlob(path2) {
59838
- if (!existsSync87(path2)) return {};
59763
+ if (!existsSync86(path2)) return {};
59839
59764
  try {
59840
59765
  const raw = JSON.parse(readFileSync61(path2, "utf-8"));
59841
59766
  return raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
@@ -59916,7 +59841,7 @@ var init_board = __esm({
59916
59841
  // src/server/routes/sleepy-chat.ts
59917
59842
  import { spawn as spawn5 } from "child_process";
59918
59843
  import { dirname as dirname51, join as join83 } from "path";
59919
- import { existsSync as existsSync88, mkdirSync as mkdirSync42, readFileSync as readFileSync62, writeFileSync as writeFileSync50 } from "fs";
59844
+ import { existsSync as existsSync87, mkdirSync as mkdirSync42, readFileSync as readFileSync62, writeFileSync as writeFileSync50 } from "fs";
59920
59845
  import { randomUUID as randomUUID4 } from "crypto";
59921
59846
  function modelFor(tier) {
59922
59847
  return tier === "intelligent" ? "opus" : "sonnet";
@@ -59960,7 +59885,7 @@ function readStore(contextRoot) {
59960
59885
  function writeStore(contextRoot, store) {
59961
59886
  try {
59962
59887
  const dir = join83(contextRoot, "state");
59963
- if (!existsSync88(dir)) mkdirSync42(dir, { recursive: true });
59888
+ if (!existsSync87(dir)) mkdirSync42(dir, { recursive: true });
59964
59889
  store.messages = store.messages.slice(-MESSAGES_MAX);
59965
59890
  writeFileSync50(storePath(contextRoot), JSON.stringify(store, null, 2), "utf-8");
59966
59891
  } catch (err) {
@@ -64031,7 +63956,7 @@ import { spawn as spawn6 } from "child_process";
64031
63956
  import { randomUUID as randomUUID5 } from "crypto";
64032
63957
  import { createRequire } from "module";
64033
63958
  import { dirname as dirname52, join as join84 } from "path";
64034
- import { existsSync as existsSync89, readdirSync as readdirSync19, statSync as statSync17, chmodSync as chmodSync6, readFileSync as readFileSync63 } from "fs";
63959
+ import { existsSync as existsSync88, readdirSync as readdirSync19, statSync as statSync17, chmodSync as chmodSync6, readFileSync as readFileSync63 } from "fs";
64035
63960
  import { homedir as homedir6 } from "os";
64036
63961
  function ensurePtyHelperExecutable() {
64037
63962
  try {
@@ -64039,11 +63964,11 @@ function ensurePtyHelperExecutable() {
64039
63964
  const root = dirname52(dirname52(require2.resolve("node-pty")));
64040
63965
  const candidates = [join84(root, "build", "Release", "spawn-helper")];
64041
63966
  const prebuilds = join84(root, "prebuilds");
64042
- if (existsSync89(prebuilds)) {
63967
+ if (existsSync88(prebuilds)) {
64043
63968
  for (const d of readdirSync19(prebuilds)) candidates.push(join84(prebuilds, d, "spawn-helper"));
64044
63969
  }
64045
63970
  for (const p of candidates) {
64046
- if (!existsSync89(p)) continue;
63971
+ if (!existsSync88(p)) continue;
64047
63972
  const mode = statSync17(p).mode;
64048
63973
  if ((mode & 73) !== 73) chmodSync6(p, mode | 493);
64049
63974
  }
@@ -64098,7 +64023,7 @@ function resolveVaultProjectRoot(name) {
64098
64023
  if (!name) return null;
64099
64024
  if (/[/\\:.\x00]/.test(name)) return null;
64100
64025
  const v = listVaults().find((x) => x.name === name);
64101
- if (!v || !existsSync89(v.path)) return null;
64026
+ if (!v || !existsSync88(v.path)) return null;
64102
64027
  return v.path;
64103
64028
  }
64104
64029
  async function handleAgentCapabilities(_req, res) {
@@ -64170,7 +64095,7 @@ function cliPackageRoot() {
64170
64095
  let dir = process.argv[1] ? dirname52(process.argv[1]) : "";
64171
64096
  if (!dir) return null;
64172
64097
  for (let i = 0; i < 8; i++) {
64173
- if (existsSync89(join84(dir, "package.json"))) return dir;
64098
+ if (existsSync88(join84(dir, "package.json"))) return dir;
64174
64099
  const parent = dirname52(dir);
64175
64100
  if (parent === dir) break;
64176
64101
  dir = parent;
@@ -64338,10 +64263,10 @@ function findTranscriptPath(id) {
64338
64263
  if (!id) return null;
64339
64264
  try {
64340
64265
  const base = join84(homedir6(), ".claude", "projects");
64341
- if (!existsSync89(base)) return null;
64266
+ if (!existsSync88(base)) return null;
64342
64267
  for (const dir of readdirSync19(base)) {
64343
64268
  const p = join84(base, dir, `${id}.jsonl`);
64344
- if (existsSync89(p)) return p;
64269
+ if (existsSync88(p)) return p;
64345
64270
  }
64346
64271
  } catch {
64347
64272
  }
@@ -64709,14 +64634,14 @@ var init_agent_terminal = __esm({
64709
64634
  // src/server/routes/agent-drop.ts
64710
64635
  import { randomUUID as randomUUID6 } from "crypto";
64711
64636
  import { mkdirSync as mkdirSync43, writeFileSync as writeFileSync51, readdirSync as readdirSync20, statSync as statSync18, unlinkSync as unlinkSync9 } from "fs";
64712
- import { join as join85, basename as basename28 } from "path";
64637
+ import { join as join85, basename as basename27 } from "path";
64713
64638
  function sniffImageType2(buf) {
64714
64639
  return sniffImageType(buf);
64715
64640
  }
64716
64641
  function sanitizeDropFilename(raw, ext) {
64717
64642
  let base = "";
64718
64643
  try {
64719
- base = basename28(String(raw ?? "").replace(/\\/g, "/").trim());
64644
+ base = basename27(String(raw ?? "").replace(/\\/g, "/").trim());
64720
64645
  } catch {
64721
64646
  base = "";
64722
64647
  }
@@ -64828,7 +64753,7 @@ var init_agent_drop = __esm({
64828
64753
 
64829
64754
  // src/server/routes/agent-sessions.ts
64830
64755
  import { join as join86, dirname as dirname53 } from "path";
64831
- import { existsSync as existsSync90, mkdirSync as mkdirSync44, readFileSync as readFileSync64, writeFileSync as writeFileSync52, renameSync as renameSync14 } from "fs";
64756
+ import { existsSync as existsSync89, mkdirSync as mkdirSync44, readFileSync as readFileSync64, writeFileSync as writeFileSync52, renameSync as renameSync14 } from "fs";
64832
64757
  import { randomUUID as randomUUID7 } from "crypto";
64833
64758
  function storePath2(contextRoot) {
64834
64759
  return join86(contextRoot, ROSTER_REL_PATH);
@@ -64868,7 +64793,7 @@ function writeRoster(contextRoot, sessions) {
64868
64793
  } catch {
64869
64794
  }
64870
64795
  const dir = join86(contextRoot, "state");
64871
- if (!existsSync90(dir)) mkdirSync44(dir, { recursive: true });
64796
+ if (!existsSync89(dir)) mkdirSync44(dir, { recursive: true });
64872
64797
  const path2 = storePath2(contextRoot);
64873
64798
  const tmp = `${path2}.${randomUUID7()}.tmp`;
64874
64799
  writeFileSync52(tmp, JSON.stringify({ sessions }, null, 2) + "\n", "utf-8");
@@ -65006,7 +64931,7 @@ var init_connections2 = __esm({
65006
64931
  });
65007
64932
 
65008
64933
  // src/lib/federation-digest.ts
65009
- import { existsSync as existsSync91 } from "fs";
64934
+ import { existsSync as existsSync90 } from "fs";
65010
64935
  import { join as join87 } from "path";
65011
64936
  function buildInterestProfile(peerRoot, topics) {
65012
64937
  if (topics && topics.length > 0) {
@@ -65027,10 +64952,10 @@ function buildInterestProfile(peerRoot, topics) {
65027
64952
  }
65028
64953
  function activeTaskTerms(peerRoot) {
65029
64954
  const stateDir = join87(peerRoot, "state");
65030
- if (!existsSync91(stateDir)) return [];
64955
+ if (!existsSync90(stateDir)) return [];
65031
64956
  let files;
65032
64957
  try {
65033
- files = import_fast_glob22.default.sync("*.md", { cwd: stateDir, absolute: true });
64958
+ files = import_fast_glob21.default.sync("*.md", { cwd: stateDir, absolute: true });
65034
64959
  } catch {
65035
64960
  return [];
65036
64961
  }
@@ -65116,11 +65041,11 @@ function slugFromTitle(title) {
65116
65041
  const slug = String(title).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
65117
65042
  return slug || "untitled";
65118
65043
  }
65119
- var import_fast_glob22;
65044
+ var import_fast_glob21;
65120
65045
  var init_federation_digest = __esm({
65121
65046
  "src/lib/federation-digest.ts"() {
65122
65047
  "use strict";
65123
- import_fast_glob22 = __toESM(require_out4(), 1);
65048
+ import_fast_glob21 = __toESM(require_out4(), 1);
65124
65049
  init_recall();
65125
65050
  init_frontmatter();
65126
65051
  init_federation_inbox();
@@ -65445,6 +65370,13 @@ var init_recall2 = __esm({
65445
65370
  });
65446
65371
 
65447
65372
  // src/lib/git-sync/oauth.ts
65373
+ function resolveBrainOAuthClientId() {
65374
+ return (process.env.DREAMCONTEXT_GITHUB_CLIENT_ID || "").trim() || DEFAULT_BRAIN_OAUTH_CLIENT_ID;
65375
+ }
65376
+ function isOAuthAppConfigured(clientId = resolveBrainOAuthClientId()) {
65377
+ const id = clientId.trim();
65378
+ return id.length > 0 && id !== PLACEHOLDER_CLIENT_ID;
65379
+ }
65448
65380
  async function startDeviceFlow(clientId = BRAIN_OAUTH_CLIENT_ID, fetchImpl2 = globalThis.fetch) {
65449
65381
  const body = new URLSearchParams({ client_id: clientId, scope: BRAIN_OAUTH_SCOPE });
65450
65382
  const res = await fetchImpl2(GITHUB_DEVICE_CODE_URL, {
@@ -65506,7 +65438,7 @@ async function fetchAuthenticatedLogin(token, fetchImpl2 = globalThis.fetch) {
65506
65438
  const json = await res.json();
65507
65439
  return json.login ?? null;
65508
65440
  }
65509
- var GITHUB_DEVICE_CODE_URL, GITHUB_ACCESS_TOKEN_URL, GITHUB_USER_URL, BRAIN_OAUTH_SCOPE, PLACEHOLDER_CLIENT_ID, BRAIN_OAUTH_CLIENT_ID;
65441
+ var GITHUB_DEVICE_CODE_URL, GITHUB_ACCESS_TOKEN_URL, GITHUB_USER_URL, BRAIN_OAUTH_SCOPE, PLACEHOLDER_CLIENT_ID, DEFAULT_BRAIN_OAUTH_CLIENT_ID, BRAIN_OAUTH_CLIENT_ID;
65510
65442
  var init_oauth = __esm({
65511
65443
  "src/lib/git-sync/oauth.ts"() {
65512
65444
  "use strict";
@@ -65515,7 +65447,8 @@ var init_oauth = __esm({
65515
65447
  GITHUB_USER_URL = "https://api.github.com/user";
65516
65448
  BRAIN_OAUTH_SCOPE = "repo";
65517
65449
  PLACEHOLDER_CLIENT_ID = "Iv1.dreamcontext-placeholder";
65518
- BRAIN_OAUTH_CLIENT_ID = (process.env.DREAMCONTEXT_GITHUB_CLIENT_ID || "").trim() || PLACEHOLDER_CLIENT_ID;
65450
+ DEFAULT_BRAIN_OAUTH_CLIENT_ID = "Ov23lisakBMDeqzsr6Xg";
65451
+ BRAIN_OAUTH_CLIENT_ID = resolveBrainOAuthClientId();
65519
65452
  }
65520
65453
  });
65521
65454
 
@@ -65541,9 +65474,18 @@ function gate(res) {
65541
65474
  }
65542
65475
  async function handleBrainAuthDeviceStart(req, res) {
65543
65476
  if (!gate(res)) return;
65477
+ if (!isOAuthAppConfigured()) {
65478
+ sendError(
65479
+ res,
65480
+ 501,
65481
+ "oauth_not_configured",
65482
+ "One-click GitHub sign-in is not available in this build. Connect with a personal access token instead."
65483
+ );
65484
+ return;
65485
+ }
65544
65486
  pruneDeviceSessions();
65545
65487
  try {
65546
- const started = await startDeviceFlow(BRAIN_OAUTH_CLIENT_ID, fetchImpl);
65488
+ const started = await startDeviceFlow(resolveBrainOAuthClientId(), fetchImpl);
65547
65489
  const sessionId = randomUUID8();
65548
65490
  deviceSessions.set(sessionId, {
65549
65491
  deviceCode: started.deviceCode,
@@ -65587,7 +65529,7 @@ async function handleBrainAuthDevicePoll(req, res) {
65587
65529
  }
65588
65530
  session.lastPolledAt = now;
65589
65531
  try {
65590
- const result = await pollDeviceFlow(BRAIN_OAUTH_CLIENT_ID, session.deviceCode, fetchImpl);
65532
+ const result = await pollDeviceFlow(resolveBrainOAuthClientId(), session.deviceCode, fetchImpl);
65591
65533
  switch (result.status) {
65592
65534
  case "authorized": {
65593
65535
  writeGlobalGitHubToken(result.token, authHome);
@@ -65627,19 +65569,25 @@ async function handleBrainAuthDevicePoll(req, res) {
65627
65569
  }
65628
65570
  async function handleBrainAuthStatus(req, res) {
65629
65571
  if (!gate(res)) return;
65572
+ const oauthConfigured = isOAuthAppConfigured();
65630
65573
  const global3 = readGlobalGitHubToken(authHome);
65631
65574
  if (global3) {
65632
- sendJson(res, 200, { connected: true, login: readGlobalGitHubLogin(authHome) ?? void 0, source: "global" });
65575
+ sendJson(res, 200, {
65576
+ connected: true,
65577
+ login: readGlobalGitHubLogin(authHome) ?? void 0,
65578
+ source: "global",
65579
+ oauthConfigured
65580
+ });
65633
65581
  return;
65634
65582
  }
65635
65583
  for (const envVar of ["GITHUB_TOKEN", "GH_TOKEN"]) {
65636
65584
  const v = process.env[envVar];
65637
65585
  if (v && v.trim()) {
65638
- sendJson(res, 200, { connected: true, source: "env" });
65586
+ sendJson(res, 200, { connected: true, source: "env", oauthConfigured });
65639
65587
  return;
65640
65588
  }
65641
65589
  }
65642
- sendJson(res, 200, { connected: false, source: null });
65590
+ sendJson(res, 200, { connected: false, source: null, oauthConfigured });
65643
65591
  }
65644
65592
  async function handleBrainAuthToken(req, res) {
65645
65593
  if (!gate(res)) return;
@@ -66011,8 +65959,6 @@ function buildRouter() {
66011
65959
  router.get("/api/knowledge-assets/*slug", handleKnowledgeAssets);
66012
65960
  router.get("/api/knowledge/*slug", handleKnowledgeGet);
66013
65961
  router.patch("/api/knowledge/*slug", handleKnowledgeUpdate);
66014
- router.get("/api/features", handleFeaturesList);
66015
- router.get("/api/features/:slug", handleFeaturesGet);
66016
65962
  router.get("/api/recall/haiku", handleRecallHaikuGet);
66017
65963
  router.get("/api/recall", handleRecallGet);
66018
65964
  router.post("/api/brain/auth/device/start", handleBrainAuthDeviceStart);
@@ -66228,7 +66174,6 @@ var init_server = __esm({
66228
66174
  init_sleep2();
66229
66175
  init_core2();
66230
66176
  init_knowledge2();
66231
- init_features2();
66232
66177
  init_changelog();
66233
66178
  init_graph2();
66234
66179
  init_council2();
@@ -66438,7 +66383,7 @@ var init_trigger = __esm({
66438
66383
  });
66439
66384
 
66440
66385
  // src/lib/reflection.ts
66441
- import { existsSync as existsSync92, mkdirSync as mkdirSync45, writeFileSync as writeFileSync53 } from "fs";
66386
+ import { existsSync as existsSync91, mkdirSync as mkdirSync45, writeFileSync as writeFileSync53 } from "fs";
66442
66387
  import { join as join90, dirname as dirname60 } from "path";
66443
66388
  function buildExclusionSet(corpus, excludedExtra) {
66444
66389
  const excluded = new Set(excludedExtra);
@@ -66620,7 +66565,7 @@ function reflectionPath(root) {
66620
66565
  function writeReflection(root, md) {
66621
66566
  const outPath = reflectionPath(root);
66622
66567
  const dir = dirname60(outPath);
66623
- if (!existsSync92(dir)) {
66568
+ if (!existsSync91(dir)) {
66624
66569
  mkdirSync45(dir, { recursive: true });
66625
66570
  }
66626
66571
  const tsMatch = md.match(/Generated: ([^\n]+)/);
@@ -66808,12 +66753,12 @@ var init_reflection = __esm({
66808
66753
  });
66809
66754
 
66810
66755
  // src/cli/commands/reflect.ts
66811
- import { existsSync as existsSync93, readFileSync as readFileSync67 } from "fs";
66756
+ import { existsSync as existsSync92, readFileSync as readFileSync67 } from "fs";
66812
66757
  import { join as join91 } from "path";
66813
66758
  function buildBookmarkSessions(root) {
66814
66759
  const sleepPath = join91(root, "state", ".sleep.json");
66815
66760
  const result = /* @__PURE__ */ new Map();
66816
- if (!existsSync93(sleepPath)) return result;
66761
+ if (!existsSync92(sleepPath)) return result;
66817
66762
  try {
66818
66763
  const parsed = JSON.parse(readFileSync67(sleepPath, "utf-8"));
66819
66764
  const bookmarks = parsed.bookmarks ?? [];
@@ -66833,7 +66778,7 @@ function buildExcludedExtra(root) {
66833
66778
  join91(root, "core", "1.user.md")
66834
66779
  ];
66835
66780
  for (const filePath of coreFiles) {
66836
- if (!existsSync93(filePath)) continue;
66781
+ if (!existsSync92(filePath)) continue;
66837
66782
  try {
66838
66783
  const content = readFileSync67(filePath, "utf-8");
66839
66784
  for (const tok of tokenize(content)) {
@@ -66886,7 +66831,7 @@ var init_reflect = __esm({
66886
66831
  });
66887
66832
 
66888
66833
  // src/cli/commands/council.ts
66889
- import { existsSync as existsSync94, mkdirSync as mkdirSync46, readFileSync as readFileSync68, writeFileSync as writeFileSync54 } from "fs";
66834
+ import { existsSync as existsSync93, mkdirSync as mkdirSync46, readFileSync as readFileSync68, writeFileSync as writeFileSync54 } from "fs";
66890
66835
  import { join as join92 } from "path";
66891
66836
  function roundRunningStatus(n) {
66892
66837
  return `round_${n}_running`;
@@ -66977,7 +66922,7 @@ function registerAgent(council) {
66977
66922
  }
66978
66923
  const personaDir = getPersonaDir(debateId, slug);
66979
66924
  const personaFile = join92(personaDir, "context-and-persona.md");
66980
- if (existsSync94(personaFile) && !opts.force) {
66925
+ if (existsSync93(personaFile) && !opts.force) {
66981
66926
  error(`Persona already exists: ${slug}`, "Use --force to overwrite.");
66982
66927
  process.exit(1);
66983
66928
  }
@@ -67033,7 +66978,7 @@ function registerRound(council) {
67033
66978
  if (n >= 2) {
67034
66979
  for (const persona of personas) {
67035
66980
  const personaFile = join92(getPersonaDir(debateId, persona), "context-and-persona.md");
67036
- if (!existsSync94(personaFile)) continue;
66981
+ if (!existsSync93(personaFile)) continue;
67037
66982
  const existing = readFileSync68(personaFile, "utf-8");
67038
66983
  if (existing.includes(crossContextHeader)) {
67039
66984
  continue;
@@ -67065,7 +67010,7 @@ ${peerLines.join("\n\n")}`;
67065
67010
  updated_at: today()
67066
67011
  });
67067
67012
  const logFile = join92(getDebateDir(debateId), "round-log.md");
67068
- const logExisting = existsSync94(logFile) ? readFileSync68(logFile, "utf-8") : "";
67013
+ const logExisting = existsSync93(logFile) ? readFileSync68(logFile, "utf-8") : "";
67069
67014
  const logEntry = `
67070
67015
  ## Round ${n} started \u2014 ${today()}
67071
67016
  - Personas: ${formatPersonaList(personas)}
@@ -67110,7 +67055,7 @@ ${peerLines.join("\n\n")}`;
67110
67055
  updated_at: today()
67111
67056
  });
67112
67057
  const logFile = join92(getDebateDir(debateId), "round-log.md");
67113
- const logExisting = existsSync94(logFile) ? readFileSync68(logFile, "utf-8") : "";
67058
+ const logExisting = existsSync93(logFile) ? readFileSync68(logFile, "utf-8") : "";
67114
67059
  const logEntry = `
67115
67060
  ## Round ${n} complete \u2014 ${today()}
67116
67061
  - All ${personas.length} personas submitted reports.
@@ -67260,10 +67205,10 @@ function registerResearch(council) {
67260
67205
  const researchesDir = join92(getPersonaDir(debateId, personaSlug), "researches");
67261
67206
  mkdirSync46(researchesDir, { recursive: true });
67262
67207
  const indexPath2 = join92(researchesDir, "index.json");
67263
- if (!existsSync94(indexPath2)) writeJsonArray(indexPath2, []);
67208
+ if (!existsSync93(indexPath2)) writeJsonArray(indexPath2, []);
67264
67209
  const slug = slugify(topic);
67265
67210
  const file = join92(researchesDir, `${slug}.md`);
67266
- if (existsSync94(file)) {
67211
+ if (existsSync93(file)) {
67267
67212
  error(`Research note already exists: ${slug}.md`);
67268
67213
  process.exit(1);
67269
67214
  }
@@ -67295,7 +67240,7 @@ ${body.trim()}
67295
67240
  ensurePersonaExists(debateId, personaSlug);
67296
67241
  const researchesDir = join92(getPersonaDir(debateId, personaSlug), "researches");
67297
67242
  const indexPath2 = join92(researchesDir, "index.json");
67298
- if (!existsSync94(indexPath2)) {
67243
+ if (!existsSync93(indexPath2)) {
67299
67244
  console.log(source_default.dim("(no researches)"));
67300
67245
  return;
67301
67246
  }
@@ -67340,7 +67285,7 @@ function registerSynthesize(council) {
67340
67285
  manifest.push(`_dream_context/council/${debateId}/${persona}/context-and-persona.md`);
67341
67286
  manifest.push(`_dream_context/council/${debateId}/${persona}/report.md`);
67342
67287
  const researchesIndex = join92(personaDir, "researches", "index.json");
67343
- if (existsSync94(researchesIndex)) {
67288
+ if (existsSync93(researchesIndex)) {
67344
67289
  manifest.push(`_dream_context/council/${debateId}/${persona}/researches/`);
67345
67290
  }
67346
67291
  }
@@ -67359,7 +67304,7 @@ function registerComplete(council) {
67359
67304
  try {
67360
67305
  const data = readDebateFrontmatter(debateId);
67361
67306
  const finalReport = join92(getDebateDir(debateId), "final-report.md");
67362
- if (!existsSync94(finalReport)) {
67307
+ if (!existsSync93(finalReport)) {
67363
67308
  error("final-report.md not found.", "Synthesizer must write it before calling `council complete`.");
67364
67309
  process.exit(1);
67365
67310
  }
@@ -67396,7 +67341,7 @@ function registerPromote(council) {
67396
67341
  process.exit(1);
67397
67342
  }
67398
67343
  const finalReport = join92(getDebateDir(debateId), "final-report.md");
67399
- if (!existsSync94(finalReport)) {
67344
+ if (!existsSync93(finalReport)) {
67400
67345
  error("final-report.md not found.");
67401
67346
  process.exit(1);
67402
67347
  }
@@ -67414,7 +67359,7 @@ ${sec.body.trim()}` : null;
67414
67359
  const slug = slugify(data.topic).slice(0, 80) || debateId;
67415
67360
  const filename = `decision-${slug}.md`;
67416
67361
  const target = join92(knowledgeDir, filename);
67417
- if (existsSync94(target) && !opts.force) {
67362
+ if (existsSync93(target) && !opts.force) {
67418
67363
  error(`Knowledge file exists: ${filename}`, "Use --force to overwrite.");
67419
67364
  process.exit(1);
67420
67365
  }
@@ -67501,7 +67446,7 @@ function registerShow(council) {
67501
67446
  console.log(` created: ${data.created_at}`);
67502
67447
  console.log(` updated: ${data.updated_at}`);
67503
67448
  const logFile = join92(getDebateDir(debateId), "round-log.md");
67504
- if (existsSync94(logFile)) {
67449
+ if (existsSync93(logFile)) {
67505
67450
  console.log("\n" + source_default.dim("\u2500\u2500\u2500 Round log \u2500\u2500\u2500"));
67506
67451
  console.log(readFileSync68(logFile, "utf-8"));
67507
67452
  }
@@ -67695,11 +67640,11 @@ var init_env_loader = __esm({
67695
67640
  });
67696
67641
 
67697
67642
  // src/lib/marketing/config.ts
67698
- import { existsSync as existsSync95, readFileSync as readFileSync69, writeFileSync as writeFileSync55, mkdirSync as mkdirSync47 } from "fs";
67643
+ import { existsSync as existsSync94, readFileSync as readFileSync69, writeFileSync as writeFileSync55, mkdirSync as mkdirSync47 } from "fs";
67699
67644
  import { dirname as dirname61 } from "path";
67700
67645
  function readEnvFile() {
67701
67646
  const path2 = MARKETING_PATHS.envFile();
67702
- if (!existsSync95(path2)) return {};
67647
+ if (!existsSync94(path2)) return {};
67703
67648
  const raw = readFileSync69(path2, "utf8");
67704
67649
  const parsed = parseEnv(raw);
67705
67650
  if (parsed.errors.length > 0) {
@@ -67744,7 +67689,7 @@ function requireEnv(keys = REQUIRED_KEYS) {
67744
67689
  }
67745
67690
  function loadConfig() {
67746
67691
  const path2 = MARKETING_PATHS.configFile();
67747
- if (!existsSync95(path2)) return { ...EMPTY_CONFIG, feature_flags: { ...EMPTY_CONFIG.feature_flags } };
67692
+ if (!existsSync94(path2)) return { ...EMPTY_CONFIG, feature_flags: { ...EMPTY_CONFIG.feature_flags } };
67748
67693
  try {
67749
67694
  const raw = readFileSync69(path2, "utf8");
67750
67695
  const parsed = JSON.parse(raw);
@@ -67766,14 +67711,14 @@ function writeConfig(cfg) {
67766
67711
  }
67767
67712
  function ensureConfigFile() {
67768
67713
  const path2 = MARKETING_PATHS.configFile();
67769
- if (existsSync95(path2)) return loadConfig();
67714
+ if (existsSync94(path2)) return loadConfig();
67770
67715
  const cfg = { ...EMPTY_CONFIG, feature_flags: { ...EMPTY_CONFIG.feature_flags } };
67771
67716
  writeConfig(cfg);
67772
67717
  return cfg;
67773
67718
  }
67774
67719
  function ensureEnvFile() {
67775
67720
  const path2 = MARKETING_PATHS.envFile();
67776
- if (existsSync95(path2)) return;
67721
+ if (existsSync94(path2)) return;
67777
67722
  mkdirSync47(marketingRoot(), { recursive: true });
67778
67723
  writeFileSync55(path2, ENV_TEMPLATE, { encoding: "utf8", mode: 384 });
67779
67724
  }
@@ -67816,7 +67761,7 @@ REINFLUENCE_BIN= # optional override; default uses .venv
67816
67761
 
67817
67762
  // src/lib/marketing/bootstrap.ts
67818
67763
  import { spawn as spawn7, spawnSync as spawnSync2 } from "child_process";
67819
- import { existsSync as existsSync96, mkdirSync as mkdirSync48, cpSync as cpSync3 } from "fs";
67764
+ import { existsSync as existsSync95, mkdirSync as mkdirSync48, cpSync as cpSync3 } from "fs";
67820
67765
  import { fileURLToPath as fileURLToPath9 } from "url";
67821
67766
  import { dirname as dirname62, resolve as resolve22, join as join93 } from "path";
67822
67767
  function findBundledReinfluence() {
@@ -67828,7 +67773,7 @@ function findBundledReinfluence() {
67828
67773
  resolve22(__dirname7, "..", "..", "..", "tools", "reinfluence")
67829
67774
  ];
67830
67775
  for (const c of candidates) {
67831
- if (existsSync96(join93(c, "__main__.py"))) return c;
67776
+ if (existsSync95(join93(c, "__main__.py"))) return c;
67832
67777
  }
67833
67778
  throw new Error(
67834
67779
  "Bundled reinfluence not found. Reinstall dreamcontext or set REINFLUENCE_BIN."
@@ -67870,7 +67815,7 @@ async function bootstrapMarketing(opts = {}) {
67870
67815
  throw new Error("python3 not found on PATH. Install Python 3.10+ and retry.");
67871
67816
  }
67872
67817
  const venv = MARKETING_PATHS.venvDir();
67873
- if (!existsSync96(MARKETING_PATHS.venvPython())) {
67818
+ if (!existsSync95(MARKETING_PATHS.venvPython())) {
67874
67819
  log(`creating venv \u2192 ${venv}`);
67875
67820
  const r2 = runBlocking(py, ["-m", "venv", venv]);
67876
67821
  if (r2.code !== 0) {
@@ -67941,7 +67886,7 @@ function subprocessEnv() {
67941
67886
  };
67942
67887
  }
67943
67888
  function isBootstrapped() {
67944
- return existsSync96(MARKETING_PATHS.venvPython()) && existsSync96(join93(MARKETING_PATHS.reinfluenceDir(), "__main__.py"));
67889
+ return existsSync95(MARKETING_PATHS.venvPython()) && existsSync95(join93(MARKETING_PATHS.reinfluenceDir(), "__main__.py"));
67945
67890
  }
67946
67891
  var __filename, __dirname7;
67947
67892
  var init_bootstrap = __esm({
@@ -68018,7 +67963,7 @@ var init_init2 = __esm({
68018
67963
  });
68019
67964
 
68020
67965
  // src/lib/marketing/vision.ts
68021
- import { existsSync as existsSync97, readFileSync as readFileSync70, writeFileSync as writeFileSync56 } from "fs";
67966
+ import { existsSync as existsSync96, readFileSync as readFileSync70, writeFileSync as writeFileSync56 } from "fs";
68022
67967
  import { dirname as dirname63, join as join94 } from "path";
68023
67968
  function pickVisionProvider(env2 = process.env) {
68024
67969
  const oai = env2.OPENAI_VISION_API_KEY;
@@ -68062,7 +68007,7 @@ async function readImageAsBase64(framePath) {
68062
68007
  return buf.toString("base64");
68063
68008
  }
68064
68009
  async function labelHookFrame(framePath, opts) {
68065
- if (!existsSync97(framePath)) return [];
68010
+ if (!existsSync96(framePath)) return [];
68066
68011
  const fetcher = opts.fetcher ?? defaultFetcher;
68067
68012
  const prompt = opts.promptOverride ?? PROMPT;
68068
68013
  const b64 = await readImageAsBase64(framePath);
@@ -68155,7 +68100,7 @@ async function runVisionPassOnPost(postJsonPath, opts = {}) {
68155
68100
  const fs = await import("fs");
68156
68101
  fs.renameSync(tmp, postJsonPath);
68157
68102
  const mdPath = join94(dirname63(postJsonPath), `${shortcode}.md`);
68158
- if (existsSync97(mdPath)) {
68103
+ if (existsSync96(mdPath)) {
68159
68104
  try {
68160
68105
  const md = readFileSync70(mdPath, "utf-8");
68161
68106
  const refreshed = updatePatternTagsInBridge(md, post.pattern_tags);
@@ -68234,8 +68179,8 @@ Example output: ["talking-head","prop-driven"]`;
68234
68179
  // src/lib/marketing/competitors.ts
68235
68180
  import { spawn as spawn8 } from "child_process";
68236
68181
  import { spawnSync as spawnSync3 } from "child_process";
68237
- import { existsSync as existsSync98, mkdirSync as mkdirSync50, statfsSync } from "fs";
68238
- import { dirname as dirname64, join as join95, basename as basename29, extname as extname6 } from "path";
68182
+ import { existsSync as existsSync97, mkdirSync as mkdirSync50, statfsSync } from "fs";
68183
+ import { dirname as dirname64, join as join95, basename as basename28, extname as extname6 } from "path";
68239
68184
  function which(cmd) {
68240
68185
  const r = spawnSync3(process.platform === "win32" ? "where" : "which", [cmd], { encoding: "utf8" });
68241
68186
  if (r.status === 0) return (r.stdout || "").trim().split("\n")[0] || null;
@@ -68418,10 +68363,10 @@ function persistPost(evt) {
68418
68363
  const mediaDir = join95(handleDir, "_media", evt.shortcode);
68419
68364
  mkdirSync50(postsDir, { recursive: true });
68420
68365
  mkdirSync50(mediaDir, { recursive: true });
68421
- const finalVideoPath = evt.video_path ? moveAsset(evt.video_path, join95(mediaDir, basename29(evt.video_path))) : null;
68366
+ const finalVideoPath = evt.video_path ? moveAsset(evt.video_path, join95(mediaDir, basename28(evt.video_path))) : null;
68422
68367
  const finalFramePaths = [];
68423
68368
  for (const fr of evt.frames) {
68424
- const finalP = moveAsset(fr.path, join95(mediaDir, "frames", basename29(fr.path)));
68369
+ const finalP = moveAsset(fr.path, join95(mediaDir, "frames", basename28(fr.path)));
68425
68370
  finalFramePaths.push(finalP);
68426
68371
  }
68427
68372
  const id = `${evt.handle}__${evt.shortcode}`;
@@ -68445,7 +68390,7 @@ function persistPost(evt) {
68445
68390
  const bridgePath = join95(postsDir, `${evt.shortcode}.md`);
68446
68391
  writeJsonWithBridge(jsonPath, bridgePath, json, renderPostBridge(json));
68447
68392
  const metaPath = join95(handleDir, "meta.json");
68448
- if (!existsSync98(metaPath)) {
68393
+ if (!existsSync97(metaPath)) {
68449
68394
  writeJsonWithBridge(
68450
68395
  metaPath,
68451
68396
  join95(handleDir, "meta.md"),
@@ -68465,7 +68410,7 @@ First seen: ${(/* @__PURE__ */ new Date()).toISOString()}
68465
68410
  return jsonPath;
68466
68411
  }
68467
68412
  function moveAsset(src, dest) {
68468
- if (!existsSync98(src)) return dest;
68413
+ if (!existsSync97(src)) return dest;
68469
68414
  mkdirSync50(dirname64(dest), { recursive: true });
68470
68415
  const fs = __require("fs");
68471
68416
  try {
@@ -68527,7 +68472,7 @@ var init_competitors = __esm({
68527
68472
  });
68528
68473
 
68529
68474
  // src/cli/commands/marketing/competitor.ts
68530
- import { existsSync as existsSync99, readdirSync as readdirSync21, statSync as statSync19 } from "fs";
68475
+ import { existsSync as existsSync98, readdirSync as readdirSync21, statSync as statSync19 } from "fs";
68531
68476
  import { join as join96 } from "path";
68532
68477
  function registerMarketingCompetitor(parent) {
68533
68478
  const cmd = parent.command("competitor").description("Ingest competitor IG / YouTube content (Reinfluence pipeline).");
@@ -68578,7 +68523,7 @@ function registerMarketingCompetitor(parent) {
68578
68523
  });
68579
68524
  cmd.command("list").description("List ingested competitor handles.").action(() => {
68580
68525
  const dir = MARKETING_PATHS.competitorsDir();
68581
- if (!existsSync99(dir)) {
68526
+ if (!existsSync98(dir)) {
68582
68527
  info("No competitors ingested yet.");
68583
68528
  return;
68584
68529
  }
@@ -68598,7 +68543,7 @@ function registerMarketingCompetitor(parent) {
68598
68543
  console.log(header("Competitors"));
68599
68544
  for (const handle of handles) {
68600
68545
  const postsDir = join96(dir, handle, "posts");
68601
- const postCount = existsSync99(postsDir) ? readdirSync21(postsDir).filter((f) => f.endsWith(".json")).length : 0;
68546
+ const postCount = existsSync98(postsDir) ? readdirSync21(postsDir).filter((f) => f.endsWith(".json")).length : 0;
68602
68547
  console.log(` ${source_default.cyan("@" + handle)} ${source_default.dim(`${postCount} post(s)`)}`);
68603
68548
  }
68604
68549
  });
@@ -68611,11 +68556,11 @@ function registerMarketingCompetitor(parent) {
68611
68556
  }
68612
68557
  info(`Provider: ${provider.provider}`);
68613
68558
  const competitorsDir = MARKETING_PATHS.competitorsDir();
68614
- const handles = opts.handle ? [opts.handle] : existsSync99(competitorsDir) ? readdirSync21(competitorsDir).filter((h) => !h.startsWith("_") && statSync19(join96(competitorsDir, h)).isDirectory()) : [];
68559
+ const handles = opts.handle ? [opts.handle] : existsSync98(competitorsDir) ? readdirSync21(competitorsDir).filter((h) => !h.startsWith("_") && statSync19(join96(competitorsDir, h)).isDirectory()) : [];
68615
68560
  const matches = [];
68616
68561
  for (const h of handles) {
68617
68562
  const candidate = join96(competitorsDir, h, "posts", `${shortcode}.json`);
68618
- if (existsSync99(candidate)) matches.push(candidate);
68563
+ if (existsSync98(candidate)) matches.push(candidate);
68619
68564
  }
68620
68565
  if (matches.length === 0) {
68621
68566
  error(`No post JSON found for shortcode "${shortcode}".`);
@@ -68650,7 +68595,7 @@ function registerMarketingCompetitor(parent) {
68650
68595
  process.exit(1);
68651
68596
  }
68652
68597
  const competitorsDir = MARKETING_PATHS.competitorsDir();
68653
- if (!existsSync99(competitorsDir)) {
68598
+ if (!existsSync98(competitorsDir)) {
68654
68599
  warn("No competitors directory yet \u2014 nothing to relabel.");
68655
68600
  return;
68656
68601
  }
@@ -68659,7 +68604,7 @@ function registerMarketingCompetitor(parent) {
68659
68604
  let skipped = 0;
68660
68605
  for (const h of handles) {
68661
68606
  const postsDir = join96(competitorsDir, h, "posts");
68662
- if (!existsSync99(postsDir)) continue;
68607
+ if (!existsSync98(postsDir)) continue;
68663
68608
  for (const f of readdirSync21(postsDir).filter((n) => n.endsWith(".json"))) {
68664
68609
  const path2 = join96(postsDir, f);
68665
68610
  if (opts.dryRun) {
@@ -68708,8 +68653,8 @@ var init_competitor = __esm({
68708
68653
  });
68709
68654
 
68710
68655
  // src/lib/marketing/meta-fetch.ts
68711
- import { existsSync as existsSync100, mkdirSync as mkdirSync51, readFileSync as readFileSync71, writeFileSync as writeFileSync57, statSync as statSync20, openSync as openSync2, readSync, closeSync as closeSync2 } from "fs";
68712
- import { dirname as dirname65, basename as basename30 } from "path";
68656
+ import { existsSync as existsSync99, mkdirSync as mkdirSync51, readFileSync as readFileSync71, writeFileSync as writeFileSync57, statSync as statSync20, openSync as openSync2, readSync, closeSync as closeSync2 } from "fs";
68657
+ import { dirname as dirname65, basename as basename29 } from "path";
68713
68658
  import { randomUUID as randomUUID9 } from "crypto";
68714
68659
  function getQueue(accountId) {
68715
68660
  let q = writeQueues.get(accountId);
@@ -68759,7 +68704,7 @@ function idemCachePath(key2) {
68759
68704
  }
68760
68705
  function readIdem(key2) {
68761
68706
  const p = idemCachePath(key2);
68762
- if (!existsSync100(p)) return null;
68707
+ if (!existsSync99(p)) return null;
68763
68708
  try {
68764
68709
  return JSON.parse(readFileSync71(p, "utf8"));
68765
68710
  } catch {
@@ -69002,12 +68947,12 @@ async function uploadVideoFile(ctx, filepath, fields = {}) {
69002
68947
  form.set("upload_session_id", sessionId);
69003
68948
  form.set("start_offset", String(startOffset));
69004
68949
  const blob = new Blob([new Uint8Array(buf)], { type: "application/octet-stream" });
69005
- form.set("video_file_chunk", blob, basename30(filepath));
68950
+ form.set("video_file_chunk", blob, basename29(filepath));
69006
68951
  const transfer = await uploadFormDataChunked(ctx, path2, form);
69007
68952
  const next = transfer;
69008
68953
  startOffset = Number(next.start_offset);
69009
68954
  endOffset = Number(next.end_offset);
69010
- logLine(ctx, `[upload] ${basename30(filepath)} progress: ${startOffset}/${fileSize}`);
68955
+ logLine(ctx, `[upload] ${basename29(filepath)} progress: ${startOffset}/${fileSize}`);
69011
68956
  }
69012
68957
  } finally {
69013
68958
  closeSync2(fd);
@@ -69039,7 +68984,7 @@ async function singleShotVideoUpload(ctx, filepath, fields) {
69039
68984
  if (fields.description) form.set("description", fields.description);
69040
68985
  const buffer = readFileSync71(filepath);
69041
68986
  const blob = new Blob([new Uint8Array(buffer)], { type: "video/mp4" });
69042
- form.set("source", blob, basename30(filepath));
68987
+ form.set("source", blob, basename29(filepath));
69043
68988
  const resp = await fetch(url, {
69044
68989
  method: "POST",
69045
68990
  headers: { Authorization: `Bearer ${ctx.accessToken}` },
@@ -69088,7 +69033,7 @@ async function uploadImageFile(ctx, filepath) {
69088
69033
  const form = new FormData();
69089
69034
  const buffer = readFileSync71(filepath);
69090
69035
  const blob = new Blob([new Uint8Array(buffer)], { type: "image/png" });
69091
- form.set("filename", blob, basename30(filepath));
69036
+ form.set("filename", blob, basename29(filepath));
69092
69037
  const resp = await fetch(url, {
69093
69038
  method: "POST",
69094
69039
  headers: { Authorization: `Bearer ${ctx.accessToken}` },
@@ -69505,7 +69450,7 @@ var init_account = __esm({
69505
69450
  });
69506
69451
 
69507
69452
  // src/lib/marketing/hypothesis.ts
69508
- import { existsSync as existsSync101, readFileSync as readFileSync72 } from "fs";
69453
+ import { existsSync as existsSync100, readFileSync as readFileSync72 } from "fs";
69509
69454
  function validateHypothesis(raw, options2 = {}) {
69510
69455
  const errors = [];
69511
69456
  const fieldErrors = {};
@@ -69572,7 +69517,7 @@ function validateHypothesis(raw, options2 = {}) {
69572
69517
  };
69573
69518
  }
69574
69519
  function loadHypothesisFile(path2, options2 = {}) {
69575
- if (!existsSync101(path2)) {
69520
+ if (!existsSync100(path2)) {
69576
69521
  return { ok: false, errors: [`Hypothesis file not found: ${path2}`] };
69577
69522
  }
69578
69523
  let parsed;
@@ -69765,7 +69710,7 @@ var init_cohort2 = __esm({
69765
69710
  });
69766
69711
 
69767
69712
  // src/lib/marketing/insights-cache.ts
69768
- import { existsSync as existsSync102, readFileSync as readFileSync73, mkdirSync as mkdirSync52, writeFileSync as writeFileSync58, readdirSync as readdirSync22, statSync as statSync21 } from "fs";
69713
+ import { existsSync as existsSync101, readFileSync as readFileSync73, mkdirSync as mkdirSync52, writeFileSync as writeFileSync58, readdirSync as readdirSync22, statSync as statSync21 } from "fs";
69769
69714
  import { join as join97 } from "path";
69770
69715
  import { randomBytes as randomBytes4 } from "crypto";
69771
69716
  function snapshotFilename(entityId, pulledAt) {
@@ -69781,7 +69726,7 @@ function indexPath() {
69781
69726
  }
69782
69727
  function readIndex() {
69783
69728
  const p = indexPath();
69784
- if (!existsSync102(p)) return { latest: {}, updated_at: "1970-01-01T00:00:00Z" };
69729
+ if (!existsSync101(p)) return { latest: {}, updated_at: "1970-01-01T00:00:00Z" };
69785
69730
  try {
69786
69731
  return JSON.parse(readFileSync73(p, "utf8"));
69787
69732
  } catch {
@@ -69813,7 +69758,7 @@ function getCachedInsights(entityId) {
69813
69758
  const filename = idx.latest[entityId];
69814
69759
  if (!filename) return null;
69815
69760
  const fullPath = join97(MARKETING_PATHS.insightsDir(), filename);
69816
- if (!existsSync102(fullPath)) return null;
69761
+ if (!existsSync101(fullPath)) return null;
69817
69762
  try {
69818
69763
  const snap = JSON.parse(readFileSync73(fullPath, "utf8"));
69819
69764
  const ageMs = Date.now() - new Date(snap.pulled_at).getTime();
@@ -69828,7 +69773,7 @@ function getLatestSnapshot(entityId) {
69828
69773
  const filename = idx.latest[entityId];
69829
69774
  if (!filename) return null;
69830
69775
  const fullPath = join97(MARKETING_PATHS.insightsDir(), filename);
69831
- if (!existsSync102(fullPath)) return null;
69776
+ if (!existsSync101(fullPath)) return null;
69832
69777
  try {
69833
69778
  return JSON.parse(readFileSync73(fullPath, "utf8"));
69834
69779
  } catch {
@@ -69837,7 +69782,7 @@ function getLatestSnapshot(entityId) {
69837
69782
  }
69838
69783
  function getPriorSnapshot(entityId, beforeMs) {
69839
69784
  const dir = MARKETING_PATHS.insightsDir();
69840
- if (!existsSync102(dir)) return null;
69785
+ if (!existsSync101(dir)) return null;
69841
69786
  const safe = entityId.replace(/[^A-Za-z0-9_-]/g, "_");
69842
69787
  const candidates = readdirSync22(dir).filter((f) => f.startsWith(`${safe}__`) && f.endsWith(".json")).map((f) => {
69843
69788
  const p = join97(dir, f);
@@ -70631,7 +70576,7 @@ var init_doctor2 = __esm({
70631
70576
  });
70632
70577
 
70633
70578
  // src/lib/marketing/entity-store.ts
70634
- import { existsSync as existsSync104, readFileSync as readFileSync75, readdirSync as readdirSync24 } from "fs";
70579
+ import { existsSync as existsSync103, readFileSync as readFileSync75, readdirSync as readdirSync24 } from "fs";
70635
70580
  import { join as join99 } from "path";
70636
70581
  function dirFor(kind) {
70637
70582
  switch (kind) {
@@ -70655,7 +70600,7 @@ function entityPaths(kind, id) {
70655
70600
  }
70656
70601
  function loadEntity(kind, id) {
70657
70602
  const { json } = entityPaths(kind, id);
70658
- if (!existsSync104(json)) return null;
70603
+ if (!existsSync103(json)) return null;
70659
70604
  try {
70660
70605
  return JSON.parse(readFileSync75(json, "utf8"));
70661
70606
  } catch {
@@ -70664,7 +70609,7 @@ function loadEntity(kind, id) {
70664
70609
  }
70665
70610
  function listEntities(kind) {
70666
70611
  const d = dirFor(kind);
70667
- if (!existsSync104(d)) return [];
70612
+ if (!existsSync103(d)) return [];
70668
70613
  const out = [];
70669
70614
  for (const f of readdirSync24(d).filter((x) => x.endsWith(".json"))) {
70670
70615
  try {
@@ -70862,7 +70807,7 @@ var init_campaign = __esm({
70862
70807
  });
70863
70808
 
70864
70809
  // src/cli/commands/marketing/adset.ts
70865
- import { existsSync as existsSync105, readFileSync as readFileSync76 } from "fs";
70810
+ import { existsSync as existsSync104, readFileSync as readFileSync76 } from "fs";
70866
70811
  function registerMarketingAdSet(parent) {
70867
70812
  const cmd = parent.command("adset").description("Manage adsets.");
70868
70813
  cmd.command("create").description("Create an adset (PAUSED). --daily-budget required (no fallback).").requiredOption("--campaign <id>", "parent campaign local id").requiredOption("--name <name>", "adset name").requiredOption("--daily-budget <amount>", "daily budget (major-currency units)").requiredOption("--targeting <file>", "JSON file with Meta targeting spec").option("--currency <code>", "currency code", "TRY").option("--optimization-goal <goal>", "OFFSITE_CONVERSIONS|LINK_CLICKS|...", "OFFSITE_CONVERSIONS").option("--billing-event <event>", "IMPRESSIONS|LINK_CLICKS|THRUPLAY", "IMPRESSIONS").option("--custom-event-type <evt>", "e.g. PURCHASE, COMPLETE_REGISTRATION (for OFFSITE_CONVERSIONS)").option("--no-dry-run", "Actually create on Meta").action(async (opts) => {
@@ -70882,7 +70827,7 @@ function registerMarketingAdSet(parent) {
70882
70827
  }
70883
70828
  throw e;
70884
70829
  }
70885
- if (!existsSync105(opts.targeting)) {
70830
+ if (!existsSync104(opts.targeting)) {
70886
70831
  error(`Targeting file not found: ${opts.targeting}`);
70887
70832
  process.exit(1);
70888
70833
  }
@@ -71145,12 +71090,12 @@ var init_creative = __esm({
71145
71090
  });
71146
71091
 
71147
71092
  // src/cli/commands/marketing/asset.ts
71148
- import { existsSync as existsSync106, statSync as statSync23 } from "fs";
71093
+ import { existsSync as existsSync105, statSync as statSync23 } from "fs";
71149
71094
  import { extname as extname7 } from "path";
71150
71095
  function registerMarketingAsset(parent) {
71151
71096
  const cmd = parent.command("asset").description("Upload creative assets to Meta.");
71152
71097
  cmd.command("upload <path>").description("Upload a video (>50MB \u2192 chunked) or image to Meta. Returns id/hash.").option("--type <type>", "override auto-detection (video|image)").option("--name <name>", "asset name (videos)").option("--no-dry-run", "Actually upload to Meta").action(async (path2, opts) => {
71153
- if (!existsSync106(path2)) {
71098
+ if (!existsSync105(path2)) {
71154
71099
  error(`File not found: ${path2}`);
71155
71100
  process.exit(1);
71156
71101
  }
@@ -71318,8 +71263,8 @@ var init_ad = __esm({
71318
71263
  });
71319
71264
 
71320
71265
  // src/lib/marketing/launch.ts
71321
- import { existsSync as existsSync107, readFileSync as readFileSync77, writeFileSync as writeFileSync59, mkdirSync as mkdirSync53, renameSync as renameSync15, readdirSync as readdirSync25 } from "fs";
71322
- import { dirname as dirname66, join as join100, basename as basename31 } from "path";
71266
+ import { existsSync as existsSync106, readFileSync as readFileSync77, writeFileSync as writeFileSync59, mkdirSync as mkdirSync53, renameSync as renameSync15, readdirSync as readdirSync25 } from "fs";
71267
+ import { dirname as dirname66, join as join100, basename as basename30 } from "path";
71323
71268
  import { randomBytes as randomBytes5 } from "crypto";
71324
71269
  function buildLaunchSummary(cohortId) {
71325
71270
  const cohort = loadCohort(cohortId);
@@ -71369,7 +71314,7 @@ function atomicWriteFile3(path2, data) {
71369
71314
  renameSync15(tmp, path2);
71370
71315
  }
71371
71316
  function readWal(path2) {
71372
- if (!existsSync107(path2)) return null;
71317
+ if (!existsSync106(path2)) return null;
71373
71318
  try {
71374
71319
  return JSON.parse(readFileSync77(path2, "utf8"));
71375
71320
  } catch {
@@ -71381,12 +71326,12 @@ function writeWal(path2, wal) {
71381
71326
  }
71382
71327
  function findWalByRunId(runId) {
71383
71328
  const dir = MARKETING_PATHS.runsDir();
71384
- if (!existsSync107(dir)) return null;
71329
+ if (!existsSync106(dir)) return null;
71385
71330
  for (const f of readdirSync25(dir)) {
71386
71331
  if (!f.endsWith(".json")) continue;
71387
71332
  if (f.startsWith("by-idem")) continue;
71388
71333
  const stem = f.replace(/\.json$/, "");
71389
- if (stem === runId || f === runId || basename31(f, ".json") === runId) {
71334
+ if (stem === runId || f === runId || basename30(f, ".json") === runId) {
71390
71335
  return join100(dir, f);
71391
71336
  }
71392
71337
  }
@@ -71658,7 +71603,7 @@ var init_launch2 = __esm({
71658
71603
  });
71659
71604
 
71660
71605
  // src/cli/commands/marketing/learnings.ts
71661
- import { existsSync as existsSync108, readFileSync as readFileSync78 } from "fs";
71606
+ import { existsSync as existsSync107, readFileSync as readFileSync78 } from "fs";
71662
71607
  function registerMarketingLearnings(parent) {
71663
71608
  const cmd = parent.command("learnings").description("Performance Monitor learnings ledger (per-day .md + index).");
71664
71609
  cmd.command("show").description("Show today's (or specified day's) learnings file.").option("--date <YYYY-MM-DD>", "Day to show (default: today UTC)").option("--id <id>", "Show a single entry by id").action((opts) => {
@@ -71801,7 +71746,7 @@ async function resolveBody(body, bodyFile) {
71801
71746
  if (body) return body;
71802
71747
  if (bodyFile === "-") return readStdin3();
71803
71748
  if (bodyFile) {
71804
- if (!existsSync108(bodyFile)) throw new Error(`Body file not found: ${bodyFile}`);
71749
+ if (!existsSync107(bodyFile)) throw new Error(`Body file not found: ${bodyFile}`);
71805
71750
  return readFileSync78(bodyFile, "utf8");
71806
71751
  }
71807
71752
  return null;
@@ -71832,7 +71777,7 @@ var init_learnings2 = __esm({
71832
71777
 
71833
71778
  // src/lib/marketing/rem-sleep.ts
71834
71779
  import {
71835
- existsSync as existsSync109,
71780
+ existsSync as existsSync108,
71836
71781
  mkdirSync as mkdirSync54,
71837
71782
  readFileSync as readFileSync79,
71838
71783
  writeFileSync as writeFileSync60,
@@ -71852,7 +71797,7 @@ function atomicWriteFile4(path2, data) {
71852
71797
  function pruneRuns2(opts = {}) {
71853
71798
  const keepLast = opts.keepLast ?? 100;
71854
71799
  const dir = MARKETING_PATHS.runsDir();
71855
- if (!existsSync109(dir)) return { scanned: 0, kept: 0, deleted: 0, deletedFiles: [] };
71800
+ if (!existsSync108(dir)) return { scanned: 0, kept: 0, deleted: 0, deletedFiles: [] };
71856
71801
  const files = readdirSync26(dir).filter((f) => f.endsWith(".json")).map((f) => {
71857
71802
  const p = join101(dir, f);
71858
71803
  try {
@@ -71888,7 +71833,7 @@ function compactInsights(opts = {}) {
71888
71833
  const weeklyAfterDays = opts.weeklyAfterDays ?? 14;
71889
71834
  const now = opts.now ?? /* @__PURE__ */ new Date();
71890
71835
  const dir = MARKETING_PATHS.insightsDir();
71891
- if (!existsSync109(dir)) return { scanned: 0, kept: 0, deleted: 0, deletedFiles: [] };
71836
+ if (!existsSync108(dir)) return { scanned: 0, kept: 0, deleted: 0, deletedFiles: [] };
71892
71837
  const files = [];
71893
71838
  for (const f of readdirSync26(dir)) {
71894
71839
  if (!f.endsWith(".json") || f.startsWith("_")) continue;
@@ -71960,7 +71905,7 @@ function mergeDailyLearnings(opts = {}) {
71960
71905
  const retainDays = opts.retainDays ?? 7;
71961
71906
  const now = opts.now ?? /* @__PURE__ */ new Date();
71962
71907
  const dir = MARKETING_PATHS.learningsDir();
71963
- if (!existsSync109(dir)) {
71908
+ if (!existsSync108(dir)) {
71964
71909
  return { scanned: 0, merged: 0, archivePath: null, droppedRejected: 0, mergedFiles: [] };
71965
71910
  }
71966
71911
  const dayMs = 24 * 60 * 60 * 1e3;
@@ -71988,7 +71933,7 @@ function mergeDailyLearnings(opts = {}) {
71988
71933
  const archivePath = join101(dir, `_archive-${q}.md`);
71989
71934
  list.sort((a, b) => a.date.localeCompare(b.date));
71990
71935
  for (const c of list) {
71991
- const existingArchive = existsSync109(archivePath) ? readFileSync79(archivePath, "utf8") : `# Marketing learnings archive \u2014 ${q}
71936
+ const existingArchive = existsSync108(archivePath) ? readFileSync79(archivePath, "utf8") : `# Marketing learnings archive \u2014 ${q}
71992
71937
  `;
71993
71938
  const dateMarker = `# Marketing learnings \u2014 ${c.date}`;
71994
71939
  const alreadyMerged = existingArchive.includes(dateMarker);
@@ -72040,7 +71985,7 @@ function quarterKey(yyyymmdd) {
72040
71985
  }
72041
71986
  function redactRunsSweep(opts = {}) {
72042
71987
  const dir = MARKETING_PATHS.runsDir();
72043
- if (!existsSync109(dir)) return { scanned: 0, rewritten: 0, rewrittenFiles: [] };
71988
+ if (!existsSync108(dir)) return { scanned: 0, rewritten: 0, rewrittenFiles: [] };
72044
71989
  const files = readdirSync26(dir).filter((f) => f.endsWith(".json"));
72045
71990
  const rewrittenFiles = [];
72046
71991
  for (const f of files) {
@@ -72069,7 +72014,7 @@ function redactRunsSweep(opts = {}) {
72069
72014
  function runRemSleep(opts = {}) {
72070
72015
  const ranAt = (opts.now ?? /* @__PURE__ */ new Date()).toISOString();
72071
72016
  const root = marketingRootIfExists();
72072
- if (!root || !existsSync109(root)) {
72017
+ if (!root || !existsSync108(root)) {
72073
72018
  return {
72074
72019
  ranAt,
72075
72020
  marketingPresent: false,
@@ -72150,7 +72095,7 @@ var init_rem_sleep2 = __esm({
72150
72095
  });
72151
72096
 
72152
72097
  // src/cli/commands/marketing/hooks.ts
72153
- import { existsSync as existsSync110, readFileSync as readFileSync80, writeFileSync as writeFileSync61, chmodSync as chmodSync7, mkdirSync as mkdirSync55, statSync as statSync25 } from "fs";
72098
+ import { existsSync as existsSync109, readFileSync as readFileSync80, writeFileSync as writeFileSync61, chmodSync as chmodSync7, mkdirSync as mkdirSync55, statSync as statSync25 } from "fs";
72154
72099
  import { execFileSync as execFileSync10 } from "child_process";
72155
72100
  import { join as join102 } from "path";
72156
72101
  function findGitDir(cwd = process.cwd()) {
@@ -72195,7 +72140,7 @@ function registerMarketingHooks(parent) {
72195
72140
  const hooksDir = join102(gitDir, "hooks");
72196
72141
  mkdirSync55(hooksDir, { recursive: true });
72197
72142
  const target = join102(hooksDir, "pre-commit");
72198
- if (existsSync110(target)) {
72143
+ if (existsSync109(target)) {
72199
72144
  const existing = readFileSync80(target, "utf-8");
72200
72145
  if (existing.includes(MANAGED_MARKER)) {
72201
72146
  info("pre-commit hook already managed by dreamcontext \u2014 refreshing.");
@@ -72247,7 +72192,7 @@ exec dreamcontext mk hooks check-staged
72247
72192
  });
72248
72193
 
72249
72194
  // src/lib/marketing/council-personas.ts
72250
- import { existsSync as existsSync111, readFileSync as readFileSync81, readdirSync as readdirSync27 } from "fs";
72195
+ import { existsSync as existsSync110, readFileSync as readFileSync81, readdirSync as readdirSync27 } from "fs";
72251
72196
  import { fileURLToPath as fileURLToPath10 } from "url";
72252
72197
  import { join as join103, dirname as dirname68 } from "path";
72253
72198
  function findPersonasDir() {
@@ -72261,7 +72206,7 @@ function findPersonasDir() {
72261
72206
  join103(__dirname_local, "..", "..", PERSONA_SUBPATH)
72262
72207
  ];
72263
72208
  for (const candidate of candidates) {
72264
- if (existsSync111(candidate)) return candidate;
72209
+ if (existsSync110(candidate)) return candidate;
72265
72210
  }
72266
72211
  return null;
72267
72212
  }
@@ -72286,7 +72231,7 @@ function parsePersonaFile(filePath) {
72286
72231
  }
72287
72232
  function loadAllPersonas(personasDir) {
72288
72233
  const dir = personasDir ?? findPersonasDir();
72289
- if (!dir || !existsSync111(dir)) return [];
72234
+ if (!dir || !existsSync110(dir)) return [];
72290
72235
  const files = readdirSync27(dir).filter((n) => n.endsWith(".md")).sort();
72291
72236
  return files.map((name) => parsePersonaFile(join103(dir, name)));
72292
72237
  }
@@ -72319,11 +72264,11 @@ var init_council_personas = __esm({
72319
72264
 
72320
72265
  // src/cli/commands/marketing/council.ts
72321
72266
  import { spawnSync as spawnSync4 } from "child_process";
72322
- import { existsSync as existsSync112 } from "fs";
72267
+ import { existsSync as existsSync111 } from "fs";
72323
72268
  function resolveDreamcontextEntry() {
72324
72269
  const node = process.argv[0];
72325
72270
  const script = process.argv[1];
72326
- if (script && existsSync112(script)) {
72271
+ if (script && existsSync111(script)) {
72327
72272
  return { node, script };
72328
72273
  }
72329
72274
  return { node, script: null };
@@ -72495,7 +72440,7 @@ var init_marketing = __esm({
72495
72440
  });
72496
72441
 
72497
72442
  // src/cli/commands/memory.ts
72498
- import { existsSync as existsSync113, unlinkSync as unlinkSync11 } from "fs";
72443
+ import { existsSync as existsSync112, unlinkSync as unlinkSync11 } from "fs";
72499
72444
  import { join as join104, dirname as dirname69 } from "path";
72500
72445
  function collectVault(value, previous) {
72501
72446
  return [...previous, value];
@@ -72687,7 +72632,7 @@ function registerMemoryCommand(program2) {
72687
72632
  async (slug, opts) => {
72688
72633
  const root = ensureContextRoot();
72689
72634
  const filePath = join104(root, "knowledge", `${slug}.md`);
72690
- if (!existsSync113(filePath)) {
72635
+ if (!existsSync112(filePath)) {
72691
72636
  error(`Knowledge file not found: ${slug}.md`);
72692
72637
  return;
72693
72638
  }
@@ -72735,7 +72680,7 @@ ${opts.append}
72735
72680
  memory.command("delete").argument("<slug>", "Knowledge file slug to delete (without .md)").option("-f, --force", "Skip confirmation prompt").description("Delete a knowledge file (irreversible; use git to recover)").action(async (slug, opts) => {
72736
72681
  const root = ensureContextRoot();
72737
72682
  const filePath = join104(root, "knowledge", `${slug}.md`);
72738
- if (!existsSync113(filePath)) {
72683
+ if (!existsSync112(filePath)) {
72739
72684
  error(`Knowledge file not found: ${slug}.md`);
72740
72685
  return;
72741
72686
  }
@@ -72852,12 +72797,12 @@ var init_memory = __esm({
72852
72797
  // src/cli/commands/upgrade.ts
72853
72798
  import { execFileSync as execFileSync12 } from "child_process";
72854
72799
  import { dirname as dirname70 } from "path";
72855
- import { existsSync as existsSync114 } from "fs";
72800
+ import { existsSync as existsSync113 } from "fs";
72856
72801
  function defaultInstaller(args) {
72857
72802
  execFileSync12("npm", args, { stdio: "inherit" });
72858
72803
  }
72859
72804
  function defaultProjectUpdater(vault) {
72860
- if (!existsSync114(vault.path)) {
72805
+ if (!existsSync113(vault.path)) {
72861
72806
  return { vault, ok: false, error: "project folder no longer exists" };
72862
72807
  }
72863
72808
  try {
@@ -73259,7 +73204,7 @@ var init_taxonomy3 = __esm({
73259
73204
  });
73260
73205
 
73261
73206
  // src/cli/commands/vaults.ts
73262
- import { basename as basename32, resolve as resolve23 } from "path";
73207
+ import { basename as basename31, resolve as resolve23 } from "path";
73263
73208
  function registerVaultsCommand(program2) {
73264
73209
  const vaults = program2.command("vaults").description("Manage the global vault registry (multi-project)");
73265
73210
  vaults.command("add").argument("<name>", "Vault name (unique identifier)").argument("<path>", "Path to the project directory (must contain _dream_context/)").description("Register a project directory as a vault").action((name, dirPath) => {
@@ -73296,7 +73241,7 @@ function registerVaultsCommand(program2) {
73296
73241
  if (!opts.register) {
73297
73242
  console.log(header(`Discovered ${found.length} project${found.length === 1 ? "" : "s"}`));
73298
73243
  for (const projectPath of found) {
73299
- console.log(` ${source_default.magentaBright(basename32(projectPath))} ${source_default.dim(projectPath)}`);
73244
+ console.log(` ${source_default.magentaBright(basename31(projectPath))} ${source_default.dim(projectPath)}`);
73300
73245
  }
73301
73246
  info(source_default.dim("Re-run with --register to add the new ones to the vault registry."));
73302
73247
  return;
@@ -73310,7 +73255,7 @@ function registerVaultsCommand(program2) {
73310
73255
  skipped++;
73311
73256
  continue;
73312
73257
  }
73313
- const base = slugify(basename32(projectPath)) || "vault";
73258
+ const base = slugify(basename31(projectPath)) || "vault";
73314
73259
  let name = base;
73315
73260
  let suffix = 2;
73316
73261
  while (takenNames.has(name)) name = `${base}-${suffix++}`;
@@ -73544,7 +73489,7 @@ function findFederatedCopies(contextRoot, originVault) {
73544
73489
  const knowledgeDir = join105(contextRoot, "knowledge");
73545
73490
  let files;
73546
73491
  try {
73547
- files = import_fast_glob23.default.sync("**/*.md", { cwd: knowledgeDir, absolute: true, followSymbolicLinks: false });
73492
+ files = import_fast_glob22.default.sync("**/*.md", { cwd: knowledgeDir, absolute: true, followSymbolicLinks: false });
73548
73493
  } catch {
73549
73494
  return [];
73550
73495
  }
@@ -73572,12 +73517,12 @@ function findFederatedCopies(contextRoot, originVault) {
73572
73517
  }
73573
73518
  return out;
73574
73519
  }
73575
- var import_fast_glob23, SYNC_DISABLED_NOTE;
73520
+ var import_fast_glob22, SYNC_DISABLED_NOTE;
73576
73521
  var init_federation2 = __esm({
73577
73522
  "src/cli/commands/federation.ts"() {
73578
73523
  "use strict";
73579
73524
  init_source();
73580
- import_fast_glob23 = __toESM(require_out4(), 1);
73525
+ import_fast_glob22 = __toESM(require_out4(), 1);
73581
73526
  init_context_path();
73582
73527
  init_connections();
73583
73528
  init_frontmatter();
@@ -73652,7 +73597,7 @@ var init_people = __esm({
73652
73597
 
73653
73598
  // src/cli/commands/config.ts
73654
73599
  import { dirname as dirname72 } from "path";
73655
- import { existsSync as existsSync115, readFileSync as readFileSync83, writeFileSync as writeFileSync63 } from "fs";
73600
+ import { existsSync as existsSync114, readFileSync as readFileSync83, writeFileSync as writeFileSync63 } from "fs";
73656
73601
  import { join as join106 } from "path";
73657
73602
  function resolveProjectRoot() {
73658
73603
  const contextRoot = resolveContextRoot();
@@ -74008,7 +73953,7 @@ function registerConfigCommand(program2) {
74008
73953
  let userMdSynced = false;
74009
73954
  if (contextRoot) {
74010
73955
  const userMdPath = join106(contextRoot, "core", "1.user.md");
74011
- if (existsSync115(userMdPath)) {
73956
+ if (existsSync114(userMdPath)) {
74012
73957
  try {
74013
73958
  const before = readFileSync83(userMdPath, "utf-8");
74014
73959
  const after = ensurePeopleSection(before, roster);