@cleocode/core 2026.9.23 → 2026.9.25

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 (865) hide show
  1. package/dist/admin/import-tasks.d.ts.map +1 -1
  2. package/dist/admin/import-tasks.js +35 -6
  3. package/dist/admin/import-tasks.js.map +1 -1
  4. package/dist/admin/import.d.ts.map +1 -1
  5. package/dist/admin/import.js +25 -6
  6. package/dist/admin/import.js.map +1 -1
  7. package/dist/audit-prune.d.ts +32 -0
  8. package/dist/audit-prune.d.ts.map +1 -1
  9. package/dist/audit-prune.js +37 -3
  10. package/dist/audit-prune.js.map +1 -1
  11. package/dist/build-provenance.json +2 -2
  12. package/dist/cloud/crypto.d.ts +1 -2
  13. package/dist/cloud/crypto.d.ts.map +1 -1
  14. package/dist/cloud/crypto.js +1 -11
  15. package/dist/cloud/crypto.js.map +1 -1
  16. package/dist/cloud/http.d.ts +8 -0
  17. package/dist/cloud/http.d.ts.map +1 -1
  18. package/dist/cloud/http.js +8 -1
  19. package/dist/cloud/http.js.map +1 -1
  20. package/dist/cloud/index.d.ts +6 -1
  21. package/dist/cloud/index.d.ts.map +1 -1
  22. package/dist/cloud/index.js +6 -1
  23. package/dist/cloud/index.js.map +1 -1
  24. package/dist/cloud/nexus-auth.d.ts +169 -0
  25. package/dist/cloud/nexus-auth.d.ts.map +1 -0
  26. package/dist/cloud/nexus-auth.js +372 -0
  27. package/dist/cloud/nexus-auth.js.map +1 -0
  28. package/dist/cloud/nexus-credentials.d.ts +188 -0
  29. package/dist/cloud/nexus-credentials.d.ts.map +1 -0
  30. package/dist/cloud/nexus-credentials.js +323 -0
  31. package/dist/cloud/nexus-credentials.js.map +1 -0
  32. package/dist/cloud/nexus-link.d.ts +85 -0
  33. package/dist/cloud/nexus-link.d.ts.map +1 -0
  34. package/dist/cloud/nexus-link.js +226 -0
  35. package/dist/cloud/nexus-link.js.map +1 -0
  36. package/dist/cloud/presence.d.ts +88 -0
  37. package/dist/cloud/presence.d.ts.map +1 -0
  38. package/dist/cloud/presence.js +137 -0
  39. package/dist/cloud/presence.js.map +1 -0
  40. package/dist/cloud/projects.d.ts +3 -1
  41. package/dist/cloud/projects.d.ts.map +1 -1
  42. package/dist/cloud/projects.js +4 -2
  43. package/dist/cloud/projects.js.map +1 -1
  44. package/dist/cloud/uuidv7.d.ts +9 -0
  45. package/dist/cloud/uuidv7.d.ts.map +1 -0
  46. package/dist/cloud/uuidv7.js +19 -0
  47. package/dist/cloud/uuidv7.js.map +1 -0
  48. package/dist/crypto/credentials.d.ts +14 -4
  49. package/dist/crypto/credentials.d.ts.map +1 -1
  50. package/dist/crypto/credentials.js +15 -1
  51. package/dist/crypto/credentials.js.map +1 -1
  52. package/dist/decide/bench/dataset.d.ts +125 -0
  53. package/dist/decide/bench/dataset.d.ts.map +1 -0
  54. package/dist/decide/bench/dataset.js +457 -0
  55. package/dist/decide/bench/dataset.js.map +1 -0
  56. package/dist/decide/bench/index.d.ts +23 -0
  57. package/dist/decide/bench/index.d.ts.map +1 -0
  58. package/dist/decide/bench/index.js +23 -0
  59. package/dist/decide/bench/index.js.map +1 -0
  60. package/dist/decide/bench/metrics.d.ts +55 -0
  61. package/dist/decide/bench/metrics.d.ts.map +1 -0
  62. package/dist/decide/bench/metrics.js +100 -0
  63. package/dist/decide/bench/metrics.js.map +1 -0
  64. package/dist/decide/bench/operation.d.ts +119 -0
  65. package/dist/decide/bench/operation.d.ts.map +1 -0
  66. package/dist/decide/bench/operation.js +171 -0
  67. package/dist/decide/bench/operation.js.map +1 -0
  68. package/dist/decide/bench/profiles.d.ts +102 -0
  69. package/dist/decide/bench/profiles.d.ts.map +1 -0
  70. package/dist/decide/bench/profiles.js +175 -0
  71. package/dist/decide/bench/profiles.js.map +1 -0
  72. package/dist/decide/bench/questions.d.ts +40 -0
  73. package/dist/decide/bench/questions.d.ts.map +1 -0
  74. package/dist/decide/bench/questions.js +107 -0
  75. package/dist/decide/bench/questions.js.map +1 -0
  76. package/dist/decide/bench/report.d.ts +21 -0
  77. package/dist/decide/bench/report.d.ts.map +1 -0
  78. package/dist/decide/bench/report.js +125 -0
  79. package/dist/decide/bench/report.js.map +1 -0
  80. package/dist/decide/bench/runner.d.ts +208 -0
  81. package/dist/decide/bench/runner.d.ts.map +1 -0
  82. package/dist/decide/bench/runner.js +336 -0
  83. package/dist/decide/bench/runner.js.map +1 -0
  84. package/dist/decide/bench/source.d.ts +21 -0
  85. package/dist/decide/bench/source.d.ts.map +1 -0
  86. package/dist/decide/bench/source.js +67 -0
  87. package/dist/decide/bench/source.js.map +1 -0
  88. package/dist/decide/bench/spot-check.d.ts +117 -0
  89. package/dist/decide/bench/spot-check.d.ts.map +1 -0
  90. package/dist/decide/bench/spot-check.js +221 -0
  91. package/dist/decide/bench/spot-check.js.map +1 -0
  92. package/dist/decide/bench/stats.d.ts +57 -0
  93. package/dist/decide/bench/stats.d.ts.map +1 -0
  94. package/dist/decide/bench/stats.js +82 -0
  95. package/dist/decide/bench/stats.js.map +1 -0
  96. package/dist/decide/bench/types.d.ts +216 -0
  97. package/dist/decide/bench/types.d.ts.map +1 -0
  98. package/dist/decide/bench/types.js +104 -0
  99. package/dist/decide/bench/types.js.map +1 -0
  100. package/dist/decide/client.d.ts +35 -1
  101. package/dist/decide/client.d.ts.map +1 -1
  102. package/dist/decide/client.js +135 -35
  103. package/dist/decide/client.js.map +1 -1
  104. package/dist/decide/credentials.d.ts +177 -17
  105. package/dist/decide/credentials.d.ts.map +1 -1
  106. package/dist/decide/credentials.js +505 -41
  107. package/dist/decide/credentials.js.map +1 -1
  108. package/dist/decide/index.d.ts +8 -8
  109. package/dist/decide/index.d.ts.map +1 -1
  110. package/dist/decide/index.js +8 -8
  111. package/dist/decide/index.js.map +1 -1
  112. package/dist/decide/jev-wire.d.ts +55 -19
  113. package/dist/decide/jev-wire.d.ts.map +1 -1
  114. package/dist/decide/jev-wire.js +116 -37
  115. package/dist/decide/jev-wire.js.map +1 -1
  116. package/dist/decide/operations.d.ts +63 -12
  117. package/dist/decide/operations.d.ts.map +1 -1
  118. package/dist/decide/operations.js +116 -58
  119. package/dist/decide/operations.js.map +1 -1
  120. package/dist/decide/provider-state.d.ts +85 -12
  121. package/dist/decide/provider-state.d.ts.map +1 -1
  122. package/dist/decide/provider-state.js +154 -21
  123. package/dist/decide/provider-state.js.map +1 -1
  124. package/dist/decide/provider.d.ts +5 -0
  125. package/dist/decide/provider.d.ts.map +1 -1
  126. package/dist/decide/provider.js.map +1 -1
  127. package/dist/decide/providers.d.ts +15 -2
  128. package/dist/decide/providers.d.ts.map +1 -1
  129. package/dist/decide/providers.js +22 -6
  130. package/dist/decide/providers.js.map +1 -1
  131. package/dist/decide/sites/registry.d.ts +22 -0
  132. package/dist/decide/sites/registry.d.ts.map +1 -1
  133. package/dist/decide/sites/registry.js +23 -0
  134. package/dist/decide/sites/registry.js.map +1 -1
  135. package/dist/decide/wizard.d.ts +12 -4
  136. package/dist/decide/wizard.d.ts.map +1 -1
  137. package/dist/decide/wizard.js +79 -26
  138. package/dist/decide/wizard.js.map +1 -1
  139. package/dist/dispatch/mvi-projection.d.ts +15 -2
  140. package/dist/dispatch/mvi-projection.d.ts.map +1 -1
  141. package/dist/dispatch/mvi-projection.js +73 -12
  142. package/dist/dispatch/mvi-projection.js.map +1 -1
  143. package/dist/docs/adr-allocator.d.ts +2 -2
  144. package/dist/docs/adr-allocator.d.ts.map +1 -1
  145. package/dist/docs/adr-allocator.js +17 -4
  146. package/dist/docs/adr-allocator.js.map +1 -1
  147. package/dist/docs/blob-consolidation.js +1 -1
  148. package/dist/docs/blob-consolidation.js.map +1 -1
  149. package/dist/docs/display-alias.d.ts +1 -1
  150. package/dist/docs/display-alias.d.ts.map +1 -1
  151. package/dist/docs/display-alias.js +7 -4
  152. package/dist/docs/display-alias.js.map +1 -1
  153. package/dist/docs/docs-inconsistency-detector.js +1 -1
  154. package/dist/docs/docs-inconsistency-detector.js.map +1 -1
  155. package/dist/docs/docs-update.d.ts.map +1 -1
  156. package/dist/docs/docs-update.js +6 -1
  157. package/dist/docs/docs-update.js.map +1 -1
  158. package/dist/docs/export-document.js +18058 -14538
  159. package/dist/docs/export-document.js.map +3 -3
  160. package/dist/docs/numbering.js +1 -1
  161. package/dist/docs/numbering.js.map +1 -1
  162. package/dist/docs/supersede.d.ts.map +1 -1
  163. package/dist/docs/supersede.js +6 -3
  164. package/dist/docs/supersede.js.map +1 -1
  165. package/dist/docs/version-ssot.js +1 -1
  166. package/dist/docs/version-ssot.js.map +1 -1
  167. package/dist/doctor/db-substrate.d.ts.map +1 -1
  168. package/dist/doctor/db-substrate.js +39 -24
  169. package/dist/doctor/db-substrate.js.map +1 -1
  170. package/dist/doctor/knowledge-summary.d.ts +10 -3
  171. package/dist/doctor/knowledge-summary.d.ts.map +1 -1
  172. package/dist/doctor/knowledge-summary.js +10 -3
  173. package/dist/doctor/knowledge-summary.js.map +1 -1
  174. package/dist/doctor/orphan-ac-bindings.d.ts +64 -0
  175. package/dist/doctor/orphan-ac-bindings.d.ts.map +1 -0
  176. package/dist/doctor/orphan-ac-bindings.js +59 -0
  177. package/dist/doctor/orphan-ac-bindings.js.map +1 -0
  178. package/dist/doctor/project-identity.d.ts +128 -37
  179. package/dist/doctor/project-identity.d.ts.map +1 -1
  180. package/dist/doctor/project-identity.js +476 -63
  181. package/dist/doctor/project-identity.js.map +1 -1
  182. package/dist/doctor/projects.d.ts.map +1 -1
  183. package/dist/doctor/projects.js +43 -29
  184. package/dist/doctor/projects.js.map +1 -1
  185. package/dist/doctor/row-identity.d.ts +31 -0
  186. package/dist/doctor/row-identity.d.ts.map +1 -0
  187. package/dist/doctor/row-identity.js +93 -0
  188. package/dist/doctor/row-identity.js.map +1 -0
  189. package/dist/doctor/twin-collapse.d.ts +108 -2
  190. package/dist/doctor/twin-collapse.d.ts.map +1 -1
  191. package/dist/doctor/twin-collapse.js +309 -7
  192. package/dist/doctor/twin-collapse.js.map +1 -1
  193. package/dist/error-catalog.js +2 -2
  194. package/dist/error-catalog.js.map +1 -1
  195. package/dist/error-registry.js +1 -1
  196. package/dist/error-registry.js.map +1 -1
  197. package/dist/gateway-client/generated/types.gen.d.ts +22 -2
  198. package/dist/gateway-client/generated/types.gen.d.ts.map +1 -1
  199. package/dist/index.d.ts +1 -1
  200. package/dist/index.d.ts.map +1 -1
  201. package/dist/index.js +1 -1
  202. package/dist/index.js.map +1 -1
  203. package/dist/init.d.ts.map +1 -1
  204. package/dist/init.js +20 -11
  205. package/dist/init.js.map +1 -1
  206. package/dist/inject/index.d.ts.map +1 -1
  207. package/dist/inject/index.js +2 -3
  208. package/dist/inject/index.js.map +1 -1
  209. package/dist/internal.d.ts +5 -4
  210. package/dist/internal.d.ts.map +1 -1
  211. package/dist/internal.js +6 -4
  212. package/dist/internal.js.map +1 -1
  213. package/dist/lifecycle/verification/satisfies-validator.d.ts.map +1 -1
  214. package/dist/lifecycle/verification/satisfies-validator.js +10 -0
  215. package/dist/lifecycle/verification/satisfies-validator.js.map +1 -1
  216. package/dist/llm/credential-remove-entry.d.ts +59 -0
  217. package/dist/llm/credential-remove-entry.d.ts.map +1 -0
  218. package/dist/llm/credential-remove-entry.js +101 -0
  219. package/dist/llm/credential-remove-entry.js.map +1 -0
  220. package/dist/llm/oauth/device-code.d.ts +26 -6
  221. package/dist/llm/oauth/device-code.d.ts.map +1 -1
  222. package/dist/llm/oauth/device-code.js +44 -12
  223. package/dist/llm/oauth/device-code.js.map +1 -1
  224. package/dist/llm/plugin-facade.js +18202 -14682
  225. package/dist/llm/plugin-facade.js.map +3 -3
  226. package/dist/memory/attention.d.ts.map +1 -1
  227. package/dist/memory/attention.js +5 -3
  228. package/dist/memory/attention.js.map +1 -1
  229. package/dist/memory/decisions.d.ts +48 -3
  230. package/dist/memory/decisions.d.ts.map +1 -1
  231. package/dist/memory/decisions.js +98 -14
  232. package/dist/memory/decisions.js.map +1 -1
  233. package/dist/memory/index.d.ts.map +1 -1
  234. package/dist/memory/index.js +19 -10
  235. package/dist/memory/index.js.map +1 -1
  236. package/dist/memory/learnings.d.ts +6 -6
  237. package/dist/memory/manifest-identity.d.ts +171 -0
  238. package/dist/memory/manifest-identity.d.ts.map +1 -0
  239. package/dist/memory/manifest-identity.js +345 -0
  240. package/dist/memory/manifest-identity.js.map +1 -0
  241. package/dist/memory/mental-model-queue.d.ts +14 -4
  242. package/dist/memory/mental-model-queue.d.ts.map +1 -1
  243. package/dist/memory/mental-model-queue.js +64 -35
  244. package/dist/memory/mental-model-queue.js.map +1 -1
  245. package/dist/memory/patterns.d.ts +4 -4
  246. package/dist/memory/pipeline-manifest-sqlite.d.ts +47 -5
  247. package/dist/memory/pipeline-manifest-sqlite.d.ts.map +1 -1
  248. package/dist/memory/pipeline-manifest-sqlite.js +130 -14
  249. package/dist/memory/pipeline-manifest-sqlite.js.map +1 -1
  250. package/dist/memory/retrieval/observe.d.ts.map +1 -1
  251. package/dist/memory/retrieval/observe.js +2 -0
  252. package/dist/memory/retrieval/observe.js.map +1 -1
  253. package/dist/memory/transcript-scanner.js +1 -1
  254. package/dist/migration/manual/T10165-backfill-adr-index.d.ts.map +1 -1
  255. package/dist/migration/manual/T10165-backfill-adr-index.js +5 -1
  256. package/dist/migration/manual/T10165-backfill-adr-index.js.map +1 -1
  257. package/dist/nexus/deps.d.ts.map +1 -1
  258. package/dist/nexus/deps.js +7 -14
  259. package/dist/nexus/deps.js.map +1 -1
  260. package/dist/nexus/discover.d.ts.map +1 -1
  261. package/dist/nexus/discover.js +6 -9
  262. package/dist/nexus/discover.js.map +1 -1
  263. package/dist/nexus/fleet-status.d.ts +83 -0
  264. package/dist/nexus/fleet-status.d.ts.map +1 -0
  265. package/dist/nexus/fleet-status.js +414 -0
  266. package/dist/nexus/fleet-status.js.map +1 -0
  267. package/dist/nexus/git-state.d.ts +15 -0
  268. package/dist/nexus/git-state.d.ts.map +1 -1
  269. package/dist/nexus/git-state.js +77 -3
  270. package/dist/nexus/git-state.js.map +1 -1
  271. package/dist/nexus/identity.d.ts.map +1 -1
  272. package/dist/nexus/identity.js +4 -0
  273. package/dist/nexus/identity.js.map +1 -1
  274. package/dist/nexus/index.d.ts +4 -1
  275. package/dist/nexus/index.d.ts.map +1 -1
  276. package/dist/nexus/index.js +7 -1
  277. package/dist/nexus/index.js.map +1 -1
  278. package/dist/nexus/migrate-json-to-sqlite.d.ts +3 -2
  279. package/dist/nexus/migrate-json-to-sqlite.d.ts.map +1 -1
  280. package/dist/nexus/migrate-json-to-sqlite.js +9 -17
  281. package/dist/nexus/migrate-json-to-sqlite.js.map +1 -1
  282. package/dist/nexus/ops.d.ts +1 -0
  283. package/dist/nexus/ops.d.ts.map +1 -1
  284. package/dist/nexus/project-activity.d.ts +104 -0
  285. package/dist/nexus/project-activity.d.ts.map +1 -0
  286. package/dist/nexus/project-activity.js +150 -0
  287. package/dist/nexus/project-activity.js.map +1 -0
  288. package/dist/nexus/projects-clean.d.ts.map +1 -1
  289. package/dist/nexus/projects-clean.js +22 -11
  290. package/dist/nexus/projects-clean.js.map +1 -1
  291. package/dist/nexus/projects-scan.d.ts.map +1 -1
  292. package/dist/nexus/projects-scan.js +8 -13
  293. package/dist/nexus/projects-scan.js.map +1 -1
  294. package/dist/nexus/query.d.ts +2 -2
  295. package/dist/nexus/query.d.ts.map +1 -1
  296. package/dist/nexus/query.js +8 -31
  297. package/dist/nexus/query.js.map +1 -1
  298. package/dist/nexus/registry-errors.d.ts +61 -0
  299. package/dist/nexus/registry-errors.d.ts.map +1 -0
  300. package/dist/nexus/registry-errors.js +85 -0
  301. package/dist/nexus/registry-errors.js.map +1 -0
  302. package/dist/nexus/registry-roots.d.ts +5 -2
  303. package/dist/nexus/registry-roots.d.ts.map +1 -1
  304. package/dist/nexus/registry-roots.js +8 -10
  305. package/dist/nexus/registry-roots.js.map +1 -1
  306. package/dist/nexus/registry.d.ts +48 -5
  307. package/dist/nexus/registry.d.ts.map +1 -1
  308. package/dist/nexus/registry.js +151 -85
  309. package/dist/nexus/registry.js.map +1 -1
  310. package/dist/orchestrate/pivot.d.ts +4 -0
  311. package/dist/orchestrate/pivot.d.ts.map +1 -1
  312. package/dist/orchestrate/pivot.js +75 -12
  313. package/dist/orchestrate/pivot.js.map +1 -1
  314. package/dist/orchestrate/query-ops.d.ts.map +1 -1
  315. package/dist/orchestrate/query-ops.js +29 -27
  316. package/dist/orchestrate/query-ops.js.map +1 -1
  317. package/dist/orchestrate/spawn-ops.d.ts.map +1 -1
  318. package/dist/orchestrate/spawn-ops.js +29 -3
  319. package/dist/orchestrate/spawn-ops.js.map +1 -1
  320. package/dist/orchestrate/worktree-complete.d.ts.map +1 -1
  321. package/dist/orchestrate/worktree-complete.js +40 -2
  322. package/dist/orchestrate/worktree-complete.js.map +1 -1
  323. package/dist/orchestration/bootstrap.d.ts.map +1 -1
  324. package/dist/orchestration/bootstrap.js +20 -14
  325. package/dist/orchestration/bootstrap.js.map +1 -1
  326. package/dist/orchestration/index.d.ts +15 -1
  327. package/dist/orchestration/index.d.ts.map +1 -1
  328. package/dist/orchestration/index.js +25 -6
  329. package/dist/orchestration/index.js.map +1 -1
  330. package/dist/orchestration/lead-rollup.d.ts +7 -1
  331. package/dist/orchestration/lead-rollup.d.ts.map +1 -1
  332. package/dist/orchestration/lead-rollup.js +6 -3
  333. package/dist/orchestration/lead-rollup.js.map +1 -1
  334. package/dist/orchestration/spawn-prompt.d.ts +26 -0
  335. package/dist/orchestration/spawn-prompt.d.ts.map +1 -1
  336. package/dist/orchestration/spawn-prompt.js +63 -92
  337. package/dist/orchestration/spawn-prompt.js.map +1 -1
  338. package/dist/orchestration/waves.d.ts +21 -10
  339. package/dist/orchestration/waves.d.ts.map +1 -1
  340. package/dist/orchestration/waves.js +38 -35
  341. package/dist/orchestration/waves.js.map +1 -1
  342. package/dist/paths.d.ts +9 -2
  343. package/dist/paths.d.ts.map +1 -1
  344. package/dist/paths.js +30 -13
  345. package/dist/paths.js.map +1 -1
  346. package/dist/phases/index.d.ts +1 -1
  347. package/dist/phases/index.d.ts.map +1 -1
  348. package/dist/phases/index.js +3 -4
  349. package/dist/phases/index.js.map +1 -1
  350. package/dist/project-info.d.ts +40 -3
  351. package/dist/project-info.d.ts.map +1 -1
  352. package/dist/project-info.js +74 -6
  353. package/dist/project-info.js.map +1 -1
  354. package/dist/project-lifecycle.d.ts +28 -7
  355. package/dist/project-lifecycle.d.ts.map +1 -1
  356. package/dist/project-lifecycle.js +114 -47
  357. package/dist/project-lifecycle.js.map +1 -1
  358. package/dist/project-scope.d.ts +70 -3
  359. package/dist/project-scope.d.ts.map +1 -1
  360. package/dist/project-scope.js +154 -15
  361. package/dist/project-scope.js.map +1 -1
  362. package/dist/release/ci-evidence.d.ts +190 -0
  363. package/dist/release/ci-evidence.d.ts.map +1 -1
  364. package/dist/release/ci-evidence.js +436 -4
  365. package/dist/release/ci-evidence.js.map +1 -1
  366. package/dist/release/open.d.ts +12 -2
  367. package/dist/release/open.d.ts.map +1 -1
  368. package/dist/release/open.js +32 -3
  369. package/dist/release/open.js.map +1 -1
  370. package/dist/release/preflight-skip.d.ts +73 -0
  371. package/dist/release/preflight-skip.d.ts.map +1 -0
  372. package/dist/release/preflight-skip.js +254 -0
  373. package/dist/release/preflight-skip.js.map +1 -0
  374. package/dist/render/decide/index.d.ts +51 -0
  375. package/dist/render/decide/index.d.ts.map +1 -0
  376. package/dist/render/decide/index.js +289 -0
  377. package/dist/render/decide/index.js.map +1 -0
  378. package/dist/render/index.d.ts +1 -0
  379. package/dist/render/index.d.ts.map +1 -1
  380. package/dist/render/index.js +1 -0
  381. package/dist/render/index.js.map +1 -1
  382. package/dist/render/nexus/graph/index.d.ts +5 -0
  383. package/dist/render/nexus/graph/index.d.ts.map +1 -1
  384. package/dist/render/nexus/graph/index.js +53 -0
  385. package/dist/render/nexus/graph/index.js.map +1 -1
  386. package/dist/scaffold/ensure-config.d.ts +14 -6
  387. package/dist/scaffold/ensure-config.d.ts.map +1 -1
  388. package/dist/scaffold/ensure-config.js +39 -17
  389. package/dist/scaffold/ensure-config.js.map +1 -1
  390. package/dist/scaffold/project-identity.d.ts +115 -23
  391. package/dist/scaffold/project-identity.d.ts.map +1 -1
  392. package/dist/scaffold/project-identity.js +196 -44
  393. package/dist/scaffold/project-identity.js.map +1 -1
  394. package/dist/sdk/validator-ac-pull.d.ts.map +1 -1
  395. package/dist/sdk/validator-ac-pull.js +2 -1
  396. package/dist/sdk/validator-ac-pull.js.map +1 -1
  397. package/dist/selfimprove/fix-gen.js +18221 -14701
  398. package/dist/selfimprove/fix-gen.js.map +3 -3
  399. package/dist/sentient/cross-project-hygiene.d.ts +17 -6
  400. package/dist/sentient/cross-project-hygiene.d.ts.map +1 -1
  401. package/dist/sentient/cross-project-hygiene.js +22 -11
  402. package/dist/sentient/cross-project-hygiene.js.map +1 -1
  403. package/dist/sentient/propose-tick.d.ts.map +1 -1
  404. package/dist/sentient/propose-tick.js +2 -3
  405. package/dist/sentient/propose-tick.js.map +1 -1
  406. package/dist/sentient/stage-drift-tick.d.ts.map +1 -1
  407. package/dist/sentient/stage-drift-tick.js +2 -3
  408. package/dist/sentient/stage-drift-tick.js.map +1 -1
  409. package/dist/session/engine-ops.d.ts +13 -4
  410. package/dist/session/engine-ops.d.ts.map +1 -1
  411. package/dist/session/engine-ops.js +38 -45
  412. package/dist/session/engine-ops.js.map +1 -1
  413. package/dist/sessions/briefing.d.ts +7 -3
  414. package/dist/sessions/briefing.d.ts.map +1 -1
  415. package/dist/sessions/briefing.js +10 -10
  416. package/dist/sessions/briefing.js.map +1 -1
  417. package/dist/sessions/drift-watchdog.d.ts.map +1 -1
  418. package/dist/sessions/drift-watchdog.js +11 -19
  419. package/dist/sessions/drift-watchdog.js.map +1 -1
  420. package/dist/sessions/focus-state-store.d.ts +103 -26
  421. package/dist/sessions/focus-state-store.d.ts.map +1 -1
  422. package/dist/sessions/focus-state-store.js +166 -37
  423. package/dist/sessions/focus-state-store.js.map +1 -1
  424. package/dist/sessions/handoff.d.ts.map +1 -1
  425. package/dist/sessions/handoff.js +9 -18
  426. package/dist/sessions/handoff.js.map +1 -1
  427. package/dist/sessions/index.d.ts +4 -2
  428. package/dist/sessions/index.d.ts.map +1 -1
  429. package/dist/sessions/index.js +35 -6
  430. package/dist/sessions/index.js.map +1 -1
  431. package/dist/sessions/session-drift.d.ts.map +1 -1
  432. package/dist/sessions/session-drift.js +4 -2
  433. package/dist/sessions/session-drift.js.map +1 -1
  434. package/dist/sessions/session-view.d.ts +8 -1
  435. package/dist/sessions/session-view.d.ts.map +1 -1
  436. package/dist/sessions/session-view.js +9 -2
  437. package/dist/sessions/session-view.js.map +1 -1
  438. package/dist/setup/config-json-merge.d.ts.map +1 -1
  439. package/dist/setup/config-json-merge.js +1 -0
  440. package/dist/setup/config-json-merge.js.map +1 -1
  441. package/dist/setup/index.d.ts +4 -2
  442. package/dist/setup/index.d.ts.map +1 -1
  443. package/dist/setup/index.js +6 -2
  444. package/dist/setup/index.js.map +1 -1
  445. package/dist/setup/sections/nexus-account.d.ts +32 -0
  446. package/dist/setup/sections/nexus-account.d.ts.map +1 -0
  447. package/dist/setup/sections/nexus-account.js +64 -0
  448. package/dist/setup/sections/nexus-account.js.map +1 -0
  449. package/dist/setup/wizard.d.ts +1 -1
  450. package/dist/setup/wizard.d.ts.map +1 -1
  451. package/dist/setup/wizard.js.map +1 -1
  452. package/dist/skills/manifests/research.js +2 -0
  453. package/dist/skills/manifests/research.js.map +1 -1
  454. package/dist/skills/orchestrator/startup.d.ts.map +1 -1
  455. package/dist/skills/orchestrator/startup.js +18 -31
  456. package/dist/skills/orchestrator/startup.js.map +1 -1
  457. package/dist/skills/orchestrator/validator.d.ts.map +1 -1
  458. package/dist/skills/orchestrator/validator.js +9 -2
  459. package/dist/skills/orchestrator/validator.js.map +1 -1
  460. package/dist/skills/validation.d.ts +4 -1
  461. package/dist/skills/validation.d.ts.map +1 -1
  462. package/dist/skills/validation.js +11 -3
  463. package/dist/skills/validation.js.map +1 -1
  464. package/dist/snapshot/index.d.ts.map +1 -1
  465. package/dist/snapshot/index.js +60 -53
  466. package/dist/snapshot/index.js.map +1 -1
  467. package/dist/spawn/agent-identity.d.ts +33 -1
  468. package/dist/spawn/agent-identity.d.ts.map +1 -1
  469. package/dist/spawn/agent-identity.js +53 -1
  470. package/dist/spawn/agent-identity.js.map +1 -1
  471. package/dist/spawn/branch-lock.d.ts +111 -7
  472. package/dist/spawn/branch-lock.d.ts.map +1 -1
  473. package/dist/spawn/branch-lock.js +296 -8
  474. package/dist/spawn/branch-lock.js.map +1 -1
  475. package/dist/spawn/index.d.ts +1 -1
  476. package/dist/spawn/index.d.ts.map +1 -1
  477. package/dist/spawn/index.js +1 -1
  478. package/dist/spawn/index.js.map +1 -1
  479. package/dist/stats/index.d.ts.map +1 -1
  480. package/dist/stats/index.js +3 -4
  481. package/dist/stats/index.js.map +1 -1
  482. package/dist/status/index.d.ts +12 -3
  483. package/dist/status/index.d.ts.map +1 -1
  484. package/dist/status/index.js +47 -5
  485. package/dist/status/index.js.map +1 -1
  486. package/dist/store/ac-binding-prune.d.ts +144 -0
  487. package/dist/store/ac-binding-prune.d.ts.map +1 -0
  488. package/dist/store/ac-binding-prune.js +293 -0
  489. package/dist/store/ac-binding-prune.js.map +1 -0
  490. package/dist/store/agent-registry-store.d.ts.map +1 -1
  491. package/dist/store/agent-registry-store.js +3 -2
  492. package/dist/store/agent-registry-store.js.map +1 -1
  493. package/dist/store/attachment-repair.d.ts.map +1 -1
  494. package/dist/store/attachment-repair.js +42 -3
  495. package/dist/store/attachment-repair.js.map +1 -1
  496. package/dist/store/attachment-store.d.ts.map +1 -1
  497. package/dist/store/attachment-store.js +30 -46
  498. package/dist/store/attachment-store.js.map +1 -1
  499. package/dist/store/backup-recover-brain.d.ts +4 -0
  500. package/dist/store/backup-recover-brain.d.ts.map +1 -1
  501. package/dist/store/backup-recover-brain.js +2 -0
  502. package/dist/store/backup-recover-brain.js.map +1 -1
  503. package/dist/store/backup-recover.d.ts +9 -0
  504. package/dist/store/backup-recover.d.ts.map +1 -1
  505. package/dist/store/backup-recover.js +28 -1
  506. package/dist/store/backup-recover.js.map +1 -1
  507. package/dist/store/backup-sidecar.d.ts +115 -2
  508. package/dist/store/backup-sidecar.d.ts.map +1 -1
  509. package/dist/store/backup-sidecar.js +263 -3
  510. package/dist/store/backup-sidecar.js.map +1 -1
  511. package/dist/store/blob-keep.d.ts +135 -0
  512. package/dist/store/blob-keep.d.ts.map +1 -0
  513. package/dist/store/blob-keep.js +283 -0
  514. package/dist/store/blob-keep.js.map +1 -0
  515. package/dist/store/conduit-sqlite.d.ts.map +1 -1
  516. package/dist/store/conduit-sqlite.js +3 -2
  517. package/dist/store/conduit-sqlite.js.map +1 -1
  518. package/dist/store/converters.d.ts.map +1 -1
  519. package/dist/store/converters.js +11 -0
  520. package/dist/store/converters.js.map +1 -1
  521. package/dist/store/credential-transfer.d.ts +37 -5
  522. package/dist/store/credential-transfer.d.ts.map +1 -1
  523. package/dist/store/credential-transfer.js +76 -18
  524. package/dist/store/credential-transfer.js.map +1 -1
  525. package/dist/store/data-accessor.d.ts +1 -1
  526. package/dist/store/data-accessor.d.ts.map +1 -1
  527. package/dist/store/data-accessor.js.map +1 -1
  528. package/dist/store/db-helpers.d.ts +35 -11
  529. package/dist/store/db-helpers.d.ts.map +1 -1
  530. package/dist/store/db-helpers.js +107 -38
  531. package/dist/store/db-helpers.js.map +1 -1
  532. package/dist/store/display-id-alias.d.ts +529 -0
  533. package/dist/store/display-id-alias.d.ts.map +1 -0
  534. package/dist/store/display-id-alias.js +1063 -0
  535. package/dist/store/display-id-alias.js.map +1 -0
  536. package/dist/store/dual-scope-db.d.ts.map +1 -1
  537. package/dist/store/dual-scope-db.js +21 -0
  538. package/dist/store/dual-scope-db.js.map +1 -1
  539. package/dist/store/exodus/on-open.d.ts.map +1 -1
  540. package/dist/store/exodus/on-open.js +35 -0
  541. package/dist/store/exodus/on-open.js.map +1 -1
  542. package/dist/store/exodus/reconcile.d.ts.map +1 -1
  543. package/dist/store/exodus/reconcile.js +7 -2
  544. package/dist/store/exodus/reconcile.js.map +1 -1
  545. package/dist/store/exodus/recovery.d.ts.map +1 -1
  546. package/dist/store/exodus/recovery.js +20 -1
  547. package/dist/store/exodus/recovery.js.map +1 -1
  548. package/dist/store/exodus/runtime-targets.d.ts +3 -3
  549. package/dist/store/exodus/runtime-targets.js +3 -3
  550. package/dist/store/import-remap.d.ts +12 -1
  551. package/dist/store/import-remap.d.ts.map +1 -1
  552. package/dist/store/import-remap.js +14 -0
  553. package/dist/store/import-remap.js.map +1 -1
  554. package/dist/store/legacy-tasks-lineage.d.ts +3 -1
  555. package/dist/store/legacy-tasks-lineage.d.ts.map +1 -1
  556. package/dist/store/legacy-tasks-lineage.js +22 -3
  557. package/dist/store/legacy-tasks-lineage.js.map +1 -1
  558. package/dist/store/memory-accessor.js +1 -1
  559. package/dist/store/memory-accessor.js.map +1 -1
  560. package/dist/store/migration-manager.d.ts +61 -0
  561. package/dist/store/migration-manager.d.ts.map +1 -1
  562. package/dist/store/migration-manager.js +102 -4
  563. package/dist/store/migration-manager.js.map +1 -1
  564. package/dist/store/nexus-validation-schemas.d.ts +64 -0
  565. package/dist/store/nexus-validation-schemas.d.ts.map +1 -1
  566. package/dist/store/portable-bundle-import.d.ts +8 -0
  567. package/dist/store/portable-bundle-import.d.ts.map +1 -1
  568. package/dist/store/portable-bundle-import.js +10 -0
  569. package/dist/store/portable-bundle-import.js.map +1 -1
  570. package/dist/store/portable-bundle-scan.d.ts.map +1 -1
  571. package/dist/store/portable-bundle-scan.js +1 -0
  572. package/dist/store/portable-bundle-scan.js.map +1 -1
  573. package/dist/store/portable-bundle.d.ts.map +1 -1
  574. package/dist/store/portable-bundle.js +15 -14
  575. package/dist/store/portable-bundle.js.map +1 -1
  576. package/dist/store/pre-repair-snapshot.d.ts +4 -1
  577. package/dist/store/pre-repair-snapshot.d.ts.map +1 -1
  578. package/dist/store/pre-repair-snapshot.js +5 -1
  579. package/dist/store/pre-repair-snapshot.js.map +1 -1
  580. package/dist/store/regenerators.d.ts +4 -2
  581. package/dist/store/regenerators.d.ts.map +1 -1
  582. package/dist/store/regenerators.js +7 -3
  583. package/dist/store/regenerators.js.map +1 -1
  584. package/dist/store/repair-malformed-dbs.d.ts +4 -0
  585. package/dist/store/repair-malformed-dbs.d.ts.map +1 -1
  586. package/dist/store/repair-malformed-dbs.js +3 -0
  587. package/dist/store/repair-malformed-dbs.js.map +1 -1
  588. package/dist/store/row-identity-flag.d.ts +26 -0
  589. package/dist/store/row-identity-flag.d.ts.map +1 -0
  590. package/dist/store/row-identity-flag.js +31 -0
  591. package/dist/store/row-identity-flag.js.map +1 -0
  592. package/dist/store/row-identity-registry.d.ts +61 -0
  593. package/dist/store/row-identity-registry.d.ts.map +1 -0
  594. package/dist/store/row-identity-registry.js +198 -0
  595. package/dist/store/row-identity-registry.js.map +1 -0
  596. package/dist/store/row-identity.d.ts +390 -0
  597. package/dist/store/row-identity.d.ts.map +1 -0
  598. package/dist/store/row-identity.js +1240 -0
  599. package/dist/store/row-identity.js.map +1 -0
  600. package/dist/store/safety-data-accessor.d.ts +10 -3
  601. package/dist/store/safety-data-accessor.d.ts.map +1 -1
  602. package/dist/store/safety-data-accessor.js +15 -4
  603. package/dist/store/safety-data-accessor.js.map +1 -1
  604. package/dist/store/schema/attachments.d.ts +1 -1
  605. package/dist/store/schema/audit.d.ts +4 -4
  606. package/dist/store/schema/background-jobs.d.ts +1 -1
  607. package/dist/store/schema/cleo-global/nexus.d.ts +49 -1
  608. package/dist/store/schema/cleo-global/nexus.d.ts.map +1 -1
  609. package/dist/store/schema/cleo-global/nexus.js +17 -0
  610. package/dist/store/schema/cleo-global/nexus.js.map +1 -1
  611. package/dist/store/schema/cleo-global/skills.d.ts +2 -2
  612. package/dist/store/schema/cleo-project/audit.d.ts +4 -4
  613. package/dist/store/schema/cleo-project/docs.d.ts +17 -1
  614. package/dist/store/schema/cleo-project/docs.d.ts.map +1 -1
  615. package/dist/store/schema/cleo-project/docs.js +10 -0
  616. package/dist/store/schema/cleo-project/docs.js.map +1 -1
  617. package/dist/store/schema/cleo-project/lifecycle.d.ts +4 -4
  618. package/dist/store/schema/cleo-project/nexus-graph.d.ts +3 -3
  619. package/dist/store/schema/cleo-project/provenance-commits.d.ts +2 -2
  620. package/dist/store/schema/cleo-project/provenance-rest.d.ts +3 -3
  621. package/dist/store/schema/cleo-project/runtime.d.ts +3 -3
  622. package/dist/store/schema/cleo-project/tasks-core-batch2.d.ts +87 -1
  623. package/dist/store/schema/cleo-project/tasks-core-batch2.d.ts.map +1 -1
  624. package/dist/store/schema/cleo-project/tasks-core-batch2.js +35 -0
  625. package/dist/store/schema/cleo-project/tasks-core-batch2.js.map +1 -1
  626. package/dist/store/schema/cleo-project/tasks-core.d.ts +263 -7
  627. package/dist/store/schema/cleo-project/tasks-core.d.ts.map +1 -1
  628. package/dist/store/schema/cleo-project/tasks-core.js +77 -2
  629. package/dist/store/schema/cleo-project/tasks-core.js.map +1 -1
  630. package/dist/store/schema/cleo-shared/brain.d.ts +7 -7
  631. package/dist/store/schema/lifecycle.d.ts +4 -4
  632. package/dist/store/schema/manifest.d.ts +1 -1
  633. package/dist/store/schema/memory-schema.d.ts +6 -6
  634. package/dist/store/schema/nexus-schema.d.ts +51 -3
  635. package/dist/store/schema/nexus-schema.d.ts.map +1 -1
  636. package/dist/store/schema/nexus-schema.js +28 -7
  637. package/dist/store/schema/nexus-schema.js.map +1 -1
  638. package/dist/store/schema/provenance/releases.d.ts +1 -1
  639. package/dist/store/schema/skills-schema.d.ts +2 -2
  640. package/dist/store/schema/tasks.d.ts +6 -6
  641. package/dist/store/session-store.d.ts +65 -0
  642. package/dist/store/session-store.d.ts.map +1 -1
  643. package/dist/store/session-store.js +108 -7
  644. package/dist/store/session-store.js.map +1 -1
  645. package/dist/store/split-brain-import.d.ts +2 -14
  646. package/dist/store/split-brain-import.d.ts.map +1 -1
  647. package/dist/store/split-brain-import.js +4 -19
  648. package/dist/store/split-brain-import.js.map +1 -1
  649. package/dist/store/sqlite-data-accessor.d.ts +279 -2
  650. package/dist/store/sqlite-data-accessor.d.ts.map +1 -1
  651. package/dist/store/sqlite-data-accessor.js +789 -91
  652. package/dist/store/sqlite-data-accessor.js.map +1 -1
  653. package/dist/store/sqlite.d.ts +15 -3
  654. package/dist/store/sqlite.d.ts.map +1 -1
  655. package/dist/store/sqlite.js +52 -20
  656. package/dist/store/sqlite.js.map +1 -1
  657. package/dist/store/store-write-guard.d.ts +9 -3
  658. package/dist/store/store-write-guard.d.ts.map +1 -1
  659. package/dist/store/store-write-guard.js +25 -4
  660. package/dist/store/store-write-guard.js.map +1 -1
  661. package/dist/store/sync/clock-store.d.ts +67 -0
  662. package/dist/store/sync/clock-store.d.ts.map +1 -0
  663. package/dist/store/sync/clock-store.js +117 -0
  664. package/dist/store/sync/clock-store.js.map +1 -0
  665. package/dist/store/sync/flags.d.ts +51 -0
  666. package/dist/store/sync/flags.d.ts.map +1 -0
  667. package/dist/store/sync/flags.js +81 -0
  668. package/dist/store/sync/flags.js.map +1 -0
  669. package/dist/store/sync/hlc.d.ts +115 -0
  670. package/dist/store/sync/hlc.d.ts.map +1 -0
  671. package/dist/store/sync/hlc.js +172 -0
  672. package/dist/store/sync/hlc.js.map +1 -0
  673. package/dist/store/sync/index.d.ts +20 -0
  674. package/dist/store/sync/index.d.ts.map +1 -0
  675. package/dist/store/sync/index.js +20 -0
  676. package/dist/store/sync/index.js.map +1 -0
  677. package/dist/store/sync/replica-registry.d.ts +85 -0
  678. package/dist/store/sync/replica-registry.d.ts.map +1 -0
  679. package/dist/store/sync/replica-registry.js +147 -0
  680. package/dist/store/sync/replica-registry.js.map +1 -0
  681. package/dist/store/sync/replica.d.ts +181 -0
  682. package/dist/store/sync/replica.d.ts.map +1 -0
  683. package/dist/store/sync/replica.js +305 -0
  684. package/dist/store/sync/replica.js.map +1 -0
  685. package/dist/store/sync/schema.d.ts +68 -0
  686. package/dist/store/sync/schema.d.ts.map +1 -0
  687. package/dist/store/sync/schema.js +130 -0
  688. package/dist/store/sync/schema.js.map +1 -0
  689. package/dist/store/sync/skew-hold.d.ts +71 -0
  690. package/dist/store/sync/skew-hold.d.ts.map +1 -0
  691. package/dist/store/sync/skew-hold.js +89 -0
  692. package/dist/store/sync/skew-hold.js.map +1 -0
  693. package/dist/store/table-classification.d.ts +11 -9
  694. package/dist/store/table-classification.d.ts.map +1 -1
  695. package/dist/store/table-classification.js +127 -33
  696. package/dist/store/table-classification.js.map +1 -1
  697. package/dist/store/task-claim.d.ts +144 -0
  698. package/dist/store/task-claim.d.ts.map +1 -0
  699. package/dist/store/task-claim.js +195 -0
  700. package/dist/store/task-claim.js.map +1 -0
  701. package/dist/store/task-version.d.ts +43 -5
  702. package/dist/store/task-version.d.ts.map +1 -1
  703. package/dist/store/task-version.js +113 -17
  704. package/dist/store/task-version.js.map +1 -1
  705. package/dist/store/tasks-schema.d.ts +2 -0
  706. package/dist/store/tasks-schema.d.ts.map +1 -1
  707. package/dist/store/tasks-schema.js +1 -0
  708. package/dist/store/tasks-schema.js.map +1 -1
  709. package/dist/store/tasks-sqlite.d.ts.map +1 -1
  710. package/dist/store/tasks-sqlite.js +10 -2
  711. package/dist/store/tasks-sqlite.js.map +1 -1
  712. package/dist/store/twin-collapse.d.ts +450 -22
  713. package/dist/store/twin-collapse.d.ts.map +1 -1
  714. package/dist/store/twin-collapse.js +1552 -49
  715. package/dist/store/twin-collapse.js.map +1 -1
  716. package/dist/store/umbrella-data-accessor.d.ts +10 -3
  717. package/dist/store/umbrella-data-accessor.d.ts.map +1 -1
  718. package/dist/store/umbrella-data-accessor.js +14 -4
  719. package/dist/store/umbrella-data-accessor.js.map +1 -1
  720. package/dist/store/validation-schemas.d.ts +402 -50
  721. package/dist/store/validation-schemas.d.ts.map +1 -1
  722. package/dist/store/with-retry.d.ts +36 -0
  723. package/dist/store/with-retry.d.ts.map +1 -1
  724. package/dist/store/with-retry.js +51 -0
  725. package/dist/store/with-retry.js.map +1 -1
  726. package/dist/store/worktree-build-guard.d.ts +13 -4
  727. package/dist/store/worktree-build-guard.d.ts.map +1 -1
  728. package/dist/store/worktree-build-guard.js +21 -10
  729. package/dist/store/worktree-build-guard.js.map +1 -1
  730. package/dist/store/worktree-isolation-guard.d.ts +121 -10
  731. package/dist/store/worktree-isolation-guard.d.ts.map +1 -1
  732. package/dist/store/worktree-isolation-guard.js +155 -34
  733. package/dist/store/worktree-isolation-guard.js.map +1 -1
  734. package/dist/system/backup.d.ts +7 -0
  735. package/dist/system/backup.d.ts.map +1 -1
  736. package/dist/system/backup.js +5 -0
  737. package/dist/system/backup.js.map +1 -1
  738. package/dist/system/health.d.ts.map +1 -1
  739. package/dist/system/health.js +6 -1
  740. package/dist/system/health.js.map +1 -1
  741. package/dist/system/inject-generate.d.ts.map +1 -1
  742. package/dist/system/inject-generate.js +23 -10
  743. package/dist/system/inject-generate.js.map +1 -1
  744. package/dist/system/project-health.d.ts +17 -2
  745. package/dist/system/project-health.d.ts.map +1 -1
  746. package/dist/system/project-health.js +19 -6
  747. package/dist/system/project-health.js.map +1 -1
  748. package/dist/task-tools/index.d.ts +1 -1
  749. package/dist/task-tools/index.d.ts.map +1 -1
  750. package/dist/task-tools/index.js +1 -1
  751. package/dist/task-tools/index.js.map +1 -1
  752. package/dist/task-tools/score-task-priority.d.ts +38 -0
  753. package/dist/task-tools/score-task-priority.d.ts.map +1 -1
  754. package/dist/task-tools/score-task-priority.js +51 -0
  755. package/dist/task-tools/score-task-priority.js.map +1 -1
  756. package/dist/task-work/claims.d.ts +215 -0
  757. package/dist/task-work/claims.d.ts.map +1 -0
  758. package/dist/task-work/claims.js +272 -0
  759. package/dist/task-work/claims.js.map +1 -0
  760. package/dist/task-work/index.d.ts +47 -3
  761. package/dist/task-work/index.d.ts.map +1 -1
  762. package/dist/task-work/index.js +74 -41
  763. package/dist/task-work/index.js.map +1 -1
  764. package/dist/tasks/ac-coverage-gate.d.ts.map +1 -1
  765. package/dist/tasks/ac-coverage-gate.js +3 -0
  766. package/dist/tasks/ac-coverage-gate.js.map +1 -1
  767. package/dist/tasks/ac-table.d.ts +35 -7
  768. package/dist/tasks/ac-table.d.ts.map +1 -1
  769. package/dist/tasks/ac-table.js +119 -14
  770. package/dist/tasks/ac-table.js.map +1 -1
  771. package/dist/tasks/add.d.ts.map +1 -1
  772. package/dist/tasks/add.js +51 -4
  773. package/dist/tasks/add.js.map +1 -1
  774. package/dist/tasks/analyze.d.ts.map +1 -1
  775. package/dist/tasks/analyze.js +3 -4
  776. package/dist/tasks/analyze.js.map +1 -1
  777. package/dist/tasks/backfill-child-projections.js +47 -6
  778. package/dist/tasks/backfill-child-projections.js.map +1 -1
  779. package/dist/tasks/change-set.d.ts +5 -0
  780. package/dist/tasks/change-set.d.ts.map +1 -1
  781. package/dist/tasks/change-set.js +59 -3
  782. package/dist/tasks/change-set.js.map +1 -1
  783. package/dist/tasks/complete.d.ts +16 -0
  784. package/dist/tasks/complete.d.ts.map +1 -1
  785. package/dist/tasks/complete.js +33 -8
  786. package/dist/tasks/complete.js.map +1 -1
  787. package/dist/tasks/completion-evaluation.d.ts.map +1 -1
  788. package/dist/tasks/completion-evaluation.js +3 -0
  789. package/dist/tasks/completion-evaluation.js.map +1 -1
  790. package/dist/tasks/component-pr.d.ts +162 -1
  791. package/dist/tasks/component-pr.d.ts.map +1 -1
  792. package/dist/tasks/component-pr.js +560 -59
  793. package/dist/tasks/component-pr.js.map +1 -1
  794. package/dist/tasks/done-record.d.ts +14 -1
  795. package/dist/tasks/done-record.d.ts.map +1 -1
  796. package/dist/tasks/done-record.js +37 -0
  797. package/dist/tasks/done-record.js.map +1 -1
  798. package/dist/tasks/duplicate-detector.d.ts +20 -1
  799. package/dist/tasks/duplicate-detector.d.ts.map +1 -1
  800. package/dist/tasks/duplicate-detector.js +10 -2
  801. package/dist/tasks/duplicate-detector.js.map +1 -1
  802. package/dist/tasks/engine-wrap-ops.d.ts +19 -10
  803. package/dist/tasks/engine-wrap-ops.d.ts.map +1 -1
  804. package/dist/tasks/engine-wrap-ops.js +38 -10
  805. package/dist/tasks/engine-wrap-ops.js.map +1 -1
  806. package/dist/tasks/evidence.d.ts.map +1 -1
  807. package/dist/tasks/evidence.js +14 -3
  808. package/dist/tasks/evidence.js.map +1 -1
  809. package/dist/tasks/graph-ops.d.ts +9 -2
  810. package/dist/tasks/graph-ops.d.ts.map +1 -1
  811. package/dist/tasks/graph-ops.js +24 -32
  812. package/dist/tasks/graph-ops.js.map +1 -1
  813. package/dist/tasks/plan.d.ts.map +1 -1
  814. package/dist/tasks/plan.js +16 -60
  815. package/dist/tasks/plan.js.map +1 -1
  816. package/dist/tasks/task-context.d.ts.map +1 -1
  817. package/dist/tasks/task-context.js +13 -0
  818. package/dist/tasks/task-context.js.map +1 -1
  819. package/dist/tasks/task-import.d.ts.map +1 -1
  820. package/dist/tasks/task-import.js +21 -12
  821. package/dist/tasks/task-import.js.map +1 -1
  822. package/dist/tasks/task-next.d.ts +25 -2
  823. package/dist/tasks/task-next.d.ts.map +1 -1
  824. package/dist/tasks/task-next.js +32 -13
  825. package/dist/tasks/task-next.js.map +1 -1
  826. package/dist/tasks/update.d.ts.map +1 -1
  827. package/dist/tasks/update.js +7 -5
  828. package/dist/tasks/update.js.map +1 -1
  829. package/dist/upgrade.d.ts +1 -1
  830. package/dist/upgrade.d.ts.map +1 -1
  831. package/dist/upgrade.js +48 -9
  832. package/dist/upgrade.js.map +1 -1
  833. package/dist/validation/compliance.d.ts +5 -1
  834. package/dist/validation/compliance.d.ts.map +1 -1
  835. package/dist/validation/compliance.js +24 -3
  836. package/dist/validation/compliance.js.map +1 -1
  837. package/dist/validation/doctor/checks.d.ts +20 -6
  838. package/dist/validation/doctor/checks.d.ts.map +1 -1
  839. package/dist/validation/doctor/checks.js +51 -8
  840. package/dist/validation/doctor/checks.js.map +1 -1
  841. package/dist/validation/index.d.ts +1 -1
  842. package/dist/validation/index.d.ts.map +1 -1
  843. package/dist/validation/index.js +1 -1
  844. package/dist/validation/index.js.map +1 -1
  845. package/dist/validation/protocol-common.d.ts +47 -2
  846. package/dist/validation/protocol-common.d.ts.map +1 -1
  847. package/dist/validation/protocol-common.js +86 -21
  848. package/dist/validation/protocol-common.js.map +1 -1
  849. package/dist/validation/validate-ops.d.ts.map +1 -1
  850. package/dist/validation/validate-ops.js +2 -3
  851. package/dist/validation/validate-ops.js.map +1 -1
  852. package/migrations/README.md +12 -0
  853. package/migrations/drizzle-cleo-global/20260929010000_t12512-registry-probed-opened/migration.sql +35 -0
  854. package/migrations/drizzle-cleo-global/20260929020000_t12721-git-state-head-committed-at/migration.sql +25 -0
  855. package/migrations/drizzle-cleo-project/20260928120000_t12341-row-uids/migration.sql +169 -0
  856. package/migrations/drizzle-cleo-project/20260929000000_t12535-docs-attachments-union-shape/migration.sql +21 -0
  857. package/migrations/drizzle-cleo-project/20260929120000_t12502-task-claim-leases/migration.sql +77 -0
  858. package/migrations/drizzle-cleo-project/20260929130000_t12736-claim-lease-iso-repair/migration.sql +37 -0
  859. package/migrations/sync-journal/20260929140000_t12342-sync-clock/migration.sql +42 -0
  860. package/package.json +23 -13
  861. package/schemas/project-info.schema.json +10 -4
  862. package/templates/CLEO-INJECTION.md +1 -1
  863. package/templates/CLEO-REFERENCE.md +7 -3
  864. package/templates/cleo-gitignore +11 -0
  865. package/templates/workflows/release-prepare.yml.tmpl +156 -10
@@ -0,0 +1,188 @@
1
+ /**
2
+ * Cleo Nexus session-token store.
3
+ *
4
+ * Stored at `<cleoHome>/nexus-credentials.json` (resolved through
5
+ * `@cleocode/paths`, arch gate 2) with 0600 permissions, one session per API
6
+ * origin. Modelled on `../decide/credentials.ts`:
7
+ *
8
+ * - Writes go through `withLock` and `writeJsonFileAtomic({ mode: 0o600 })`,
9
+ * so neither the live file, the temp file nor a rotated backup is ever
10
+ * looser than owner-only. Deleting a session also purges the rotated
11
+ * backups, which would otherwise keep a copy of the token.
12
+ * - Reads return a {@link SealedNexusSession}: the token sits in a private
13
+ * field, so `JSON.stringify`, `util.inspect` and template strings of the
14
+ * handle show a masked preview only. {@link SealedNexusSession.bearer} is the
15
+ * one accessor, called where the HTTP request is built.
16
+ *
17
+ * Everything goes through the {@link NexusTokenStore} interface, so an OS
18
+ * keychain store can replace the file later without touching the callers.
19
+ *
20
+ * @task T12712
21
+ * @epic T12322
22
+ */
23
+ import { inspect } from 'node:util';
24
+ import { type NexusAccountOrganization, type NexusAccountUser } from '@cleocode/contracts';
25
+ import { z } from 'zod';
26
+ /** File name of the store, directly under the CLEO home. */
27
+ export declare const NEXUS_CREDENTIALS_FILE = "nexus-credentials.json";
28
+ declare const sessionSchema: z.ZodObject<{
29
+ token: z.ZodString;
30
+ tokenType: z.ZodString;
31
+ expiresAt: z.ZodNullable<z.ZodString>;
32
+ user: z.ZodNullable<z.ZodObject<{
33
+ id: z.ZodString;
34
+ email: z.ZodString;
35
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
36
+ }, z.core.$strip>>;
37
+ organization: z.ZodNullable<z.ZodObject<{
38
+ id: z.ZodString;
39
+ name: z.ZodString;
40
+ slug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
41
+ role: z.ZodOptional<z.ZodString>;
42
+ personal: z.ZodOptional<z.ZodBoolean>;
43
+ }, z.core.$strip>>;
44
+ createdAt: z.ZodString;
45
+ }, z.core.$strip>;
46
+ /** A session to store. The token is the only secret. */
47
+ export interface NexusSessionInput {
48
+ /** Bearer session token issued by the device-code grant. */
49
+ readonly token: string;
50
+ /** Token type the server reported (`Bearer`). */
51
+ readonly tokenType: string;
52
+ /** ISO expiry, when the server reported one. */
53
+ readonly expiresAt: string | null;
54
+ /** The signed-in user, when known. */
55
+ readonly user: NexusAccountUser | null;
56
+ /** Primary organization, when known. */
57
+ readonly organization: NexusAccountOrganization | null;
58
+ }
59
+ /**
60
+ * Pluggable storage for Nexus session tokens, keyed by API origin.
61
+ *
62
+ * The file store below is the default. A keychain-backed store implements the
63
+ * same four methods.
64
+ */
65
+ export interface NexusTokenStore {
66
+ /** Absolute location shown to the user (a path, or a keychain service name). */
67
+ readonly location: string;
68
+ /** The session for `apiUrl`'s origin, or `null`. */
69
+ get(apiUrl: string): Promise<SealedNexusSession | null>;
70
+ /** Store (replace) the session for `apiUrl`'s origin. */
71
+ put(apiUrl: string, session: NexusSessionInput): Promise<void>;
72
+ /**
73
+ * Delete the session for `apiUrl`'s origin. With `expected`, delete only if
74
+ * the stored token is still that session's token (checked under the store's
75
+ * lock), so a login that finished meanwhile is not wiped. Returns `true` when
76
+ * a session was deleted.
77
+ */
78
+ delete(apiUrl: string, expected?: SealedNexusSession): Promise<boolean>;
79
+ /** Every stored session. */
80
+ list(): Promise<SealedNexusSession[]>;
81
+ }
82
+ /**
83
+ * Mask a token down to a short, non-reversible preview.
84
+ *
85
+ * @param token - Plaintext token (read transiently, not retained).
86
+ * @returns `…` plus at most the last 4 characters.
87
+ */
88
+ export declare function maskNexusToken(token: string): string;
89
+ /**
90
+ * Opaque handle to a stored session. The token is held in a private field;
91
+ * serialising or inspecting the handle yields the masked preview only.
92
+ */
93
+ export declare class SealedNexusSession {
94
+ #private;
95
+ /** API origin the session belongs to. */
96
+ readonly apiUrl: string;
97
+ /** Token type (`Bearer`). */
98
+ readonly tokenType: string;
99
+ /** ISO expiry, when known. */
100
+ readonly expiresAt: string | null;
101
+ /** Signed-in user, when known. */
102
+ readonly user: NexusAccountUser | null;
103
+ /** Primary organization, when known. */
104
+ readonly organization: NexusAccountOrganization | null;
105
+ /** ISO time the session was stored. */
106
+ readonly createdAt: string;
107
+ /** Masked token preview. */
108
+ readonly tokenPreview: string;
109
+ /**
110
+ * @param apiUrl - API origin.
111
+ * @param record - Stored record; the token is captured privately.
112
+ */
113
+ constructor(apiUrl: string, record: z.infer<typeof sessionSchema>);
114
+ /**
115
+ * The plaintext token. Call only where the `Authorization` header is built.
116
+ *
117
+ * @returns The bearer token.
118
+ */
119
+ bearer(): string;
120
+ /** Secret-free JSON form. */
121
+ toJSON(): Record<string, unknown>;
122
+ /** Secret-free string form. */
123
+ toString(): string;
124
+ /** Secret-free `util.inspect` form. */
125
+ [inspect.custom](): string;
126
+ }
127
+ /** Thrown when the store cannot be written safely. */
128
+ export declare class NexusCredentialsError extends Error {
129
+ constructor(message: string);
130
+ }
131
+ /**
132
+ * The storage key for an API URL: its origin (scheme, host and port).
133
+ *
134
+ * @param apiUrl - Any URL on the API host.
135
+ * @returns The origin, e.g. `https://api.cleocode.dev`.
136
+ */
137
+ export declare function nexusOriginKey(apiUrl: string): string;
138
+ /**
139
+ * Absolute path of the default file store.
140
+ *
141
+ * @returns `<cleoHome>/nexus-credentials.json`.
142
+ */
143
+ export declare function nexusCredentialsPath(): string;
144
+ /**
145
+ * File-backed {@link NexusTokenStore}: `<cleoHome>/nexus-credentials.json`,
146
+ * mode 0600, one entry per API origin.
147
+ */
148
+ export declare class FileNexusTokenStore implements NexusTokenStore {
149
+ /** Absolute path of the store file. */
150
+ readonly location: string;
151
+ /** @param path - Store path; defaults to {@link nexusCredentialsPath}. */
152
+ constructor(path?: string);
153
+ get(apiUrl: string): Promise<SealedNexusSession | null>;
154
+ put(apiUrl: string, session: NexusSessionInput): Promise<void>;
155
+ delete(apiUrl: string, expected?: SealedNexusSession): Promise<boolean>;
156
+ list(): Promise<SealedNexusSession[]>;
157
+ /**
158
+ * Read and validate the file; a missing or malformed file reads as empty. A
159
+ * file readable or writable by group/others, or owned by another user, is
160
+ * refused: its token may already be exposed or planted.
161
+ */
162
+ private read;
163
+ /** Locked, atomic, owner-only read-modify-write. */
164
+ private write;
165
+ /**
166
+ * Create the store file owner-only if it does not exist. `O_EXCL` plus
167
+ * `O_NOFOLLOW` close the window between the symlink check and the create: a
168
+ * symlink planted meanwhile makes the open fail instead of being followed.
169
+ * On `EEXIST` the existing entry is re-opened with `O_NOFOLLOW`, which fails
170
+ * (`ELOOP`) on a symlink, so a planted link is refused before the locked
171
+ * write can touch it.
172
+ */
173
+ private seed;
174
+ /**
175
+ * Throw when the store exists with a mode wider than 0600 or another owner.
176
+ * Skipped on Windows, where Node reports every file as 0o666 and uids do not
177
+ * apply; the file lives in the user's profile, protected by its ACL.
178
+ */
179
+ private assertPrivate;
180
+ /** Refuse to write a token through a symlink (it could point anywhere). */
181
+ private assertNoSymlinks;
182
+ /** Rotated backups of the store file. */
183
+ private backupFiles;
184
+ /** Delete every rotated backup (best effort). */
185
+ private purgeBackups;
186
+ }
187
+ export {};
188
+ //# sourceMappingURL=nexus-credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nexus-credentials.d.ts","sourceRoot":"","sources":["../../src/cloud/nexus-credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAeH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EAGtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,4DAA4D;AAC5D,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAE/D,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;iBAOjB,CAAC;AAcH,wDAAwD;AACxD,MAAM,WAAW,iBAAiB;IAChC,4DAA4D;IAC5D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,iDAAiD;IACjD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,gDAAgD;IAChD,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,sCAAsC;IACtC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACvC,wCAAwC;IACxC,QAAQ,CAAC,YAAY,EAAE,wBAAwB,GAAG,IAAI,CAAC;CACxD;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,gFAAgF;IAChF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,oDAAoD;IACpD,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG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AI,MAAM;CAG3B;AAED,sDAAsD;AACtD,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED;;;GAGG;AACH,qBAAa,mBAAoB,YAAW,eAAe;IACzD,uCAAuC;IACvC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,0EAA0E;gBAC9D,IAAI,GAAE,MAA+B;IAI3C,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAMvD,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB9D,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAoBvE,IAAI,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAM3C;;;;OAIG;IACH,OAAO,CAAC,IAAI;IAiBZ,oDAAoD;YACtC,KAAK;IAenB;;;;;;;OAOG;IACH,OAAO,CAAC,IAAI;IA2BZ;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAgBrB,2EAA2E;IAC3E,OAAO,CAAC,gBAAgB;IAgBxB,yCAAyC;IACzC,OAAO,CAAC,WAAW;IAYnB,iDAAiD;IACjD,OAAO,CAAC,YAAY;CASrB"}
@@ -0,0 +1,323 @@
1
+ /**
2
+ * Cleo Nexus session-token store.
3
+ *
4
+ * Stored at `<cleoHome>/nexus-credentials.json` (resolved through
5
+ * `@cleocode/paths`, arch gate 2) with 0600 permissions, one session per API
6
+ * origin. Modelled on `../decide/credentials.ts`:
7
+ *
8
+ * - Writes go through `withLock` and `writeJsonFileAtomic({ mode: 0o600 })`,
9
+ * so neither the live file, the temp file nor a rotated backup is ever
10
+ * looser than owner-only. Deleting a session also purges the rotated
11
+ * backups, which would otherwise keep a copy of the token.
12
+ * - Reads return a {@link SealedNexusSession}: the token sits in a private
13
+ * field, so `JSON.stringify`, `util.inspect` and template strings of the
14
+ * handle show a masked preview only. {@link SealedNexusSession.bearer} is the
15
+ * one accessor, called where the HTTP request is built.
16
+ *
17
+ * Everything goes through the {@link NexusTokenStore} interface, so an OS
18
+ * keychain store can replace the file later without touching the callers.
19
+ *
20
+ * @task T12712
21
+ * @epic T12322
22
+ */
23
+ import { closeSync, constants as fsConstants, lstatSync, mkdirSync, openSync, readdirSync, readFileSync, statSync, unlinkSync, writeSync, } from 'node:fs';
24
+ import { basename, dirname, join } from 'node:path';
25
+ import { inspect } from 'node:util';
26
+ import { nexusAccountOrganizationSchema, nexusAccountUserSchema, } from '@cleocode/contracts';
27
+ import { getCleoHome } from '@cleocode/paths';
28
+ import { z } from 'zod';
29
+ import { withLock } from '../store/file-utils.js';
30
+ /** File name of the store, directly under the CLEO home. */
31
+ export const NEXUS_CREDENTIALS_FILE = 'nexus-credentials.json';
32
+ const sessionSchema = z.object({
33
+ token: z.string().min(1),
34
+ tokenType: z.string(),
35
+ expiresAt: z.string().nullable(),
36
+ user: nexusAccountUserSchema.nullable(),
37
+ organization: nexusAccountOrganizationSchema.nullable(),
38
+ createdAt: z.string(),
39
+ });
40
+ const storeSchema = z.object({
41
+ version: z.literal(1),
42
+ sessions: z.record(z.string(), sessionSchema),
43
+ });
44
+ const EMPTY_STORE = { version: 1, sessions: {} };
45
+ /** `O_NOFOLLOW` where the platform has it (not on Windows). */
46
+ const NO_FOLLOW = fsConstants.O_NOFOLLOW ?? 0;
47
+ /**
48
+ * Mask a token down to a short, non-reversible preview.
49
+ *
50
+ * @param token - Plaintext token (read transiently, not retained).
51
+ * @returns `…` plus at most the last 4 characters.
52
+ */
53
+ export function maskNexusToken(token) {
54
+ return token.length > 12 ? `…${token.slice(-4)}` : '…';
55
+ }
56
+ /**
57
+ * Opaque handle to a stored session. The token is held in a private field;
58
+ * serialising or inspecting the handle yields the masked preview only.
59
+ */
60
+ export class SealedNexusSession {
61
+ /** API origin the session belongs to. */
62
+ apiUrl;
63
+ /** Token type (`Bearer`). */
64
+ tokenType;
65
+ /** ISO expiry, when known. */
66
+ expiresAt;
67
+ /** Signed-in user, when known. */
68
+ user;
69
+ /** Primary organization, when known. */
70
+ organization;
71
+ /** ISO time the session was stored. */
72
+ createdAt;
73
+ /** Masked token preview. */
74
+ tokenPreview;
75
+ #token;
76
+ /**
77
+ * @param apiUrl - API origin.
78
+ * @param record - Stored record; the token is captured privately.
79
+ */
80
+ constructor(apiUrl, record) {
81
+ this.apiUrl = apiUrl;
82
+ this.tokenType = record.tokenType;
83
+ this.expiresAt = record.expiresAt;
84
+ this.user = record.user;
85
+ this.organization = record.organization;
86
+ this.createdAt = record.createdAt;
87
+ this.#token = record.token;
88
+ this.tokenPreview = maskNexusToken(record.token);
89
+ }
90
+ /**
91
+ * The plaintext token. Call only where the `Authorization` header is built.
92
+ *
93
+ * @returns The bearer token.
94
+ */
95
+ bearer() {
96
+ return this.#token;
97
+ }
98
+ /** Secret-free JSON form. */
99
+ toJSON() {
100
+ return {
101
+ apiUrl: this.apiUrl,
102
+ tokenType: this.tokenType,
103
+ expiresAt: this.expiresAt,
104
+ user: this.user,
105
+ organization: this.organization,
106
+ createdAt: this.createdAt,
107
+ tokenPreview: this.tokenPreview,
108
+ };
109
+ }
110
+ /** Secret-free string form. */
111
+ toString() {
112
+ return `SealedNexusSession(${this.apiUrl}, token ${this.tokenPreview})`;
113
+ }
114
+ /** Secret-free `util.inspect` form. */
115
+ [inspect.custom]() {
116
+ return this.toString();
117
+ }
118
+ }
119
+ /** Thrown when the store cannot be written safely. */
120
+ export class NexusCredentialsError extends Error {
121
+ constructor(message) {
122
+ super(message);
123
+ this.name = 'NexusCredentialsError';
124
+ }
125
+ }
126
+ /**
127
+ * The storage key for an API URL: its origin (scheme, host and port).
128
+ *
129
+ * @param apiUrl - Any URL on the API host.
130
+ * @returns The origin, e.g. `https://api.cleocode.dev`.
131
+ */
132
+ export function nexusOriginKey(apiUrl) {
133
+ return new URL(apiUrl).origin;
134
+ }
135
+ /**
136
+ * Absolute path of the default file store.
137
+ *
138
+ * @returns `<cleoHome>/nexus-credentials.json`.
139
+ */
140
+ export function nexusCredentialsPath() {
141
+ return join(getCleoHome(), NEXUS_CREDENTIALS_FILE);
142
+ }
143
+ /**
144
+ * File-backed {@link NexusTokenStore}: `<cleoHome>/nexus-credentials.json`,
145
+ * mode 0600, one entry per API origin.
146
+ */
147
+ export class FileNexusTokenStore {
148
+ /** Absolute path of the store file. */
149
+ location;
150
+ /** @param path - Store path; defaults to {@link nexusCredentialsPath}. */
151
+ constructor(path = nexusCredentialsPath()) {
152
+ this.location = path;
153
+ }
154
+ async get(apiUrl) {
155
+ const key = nexusOriginKey(apiUrl);
156
+ const record = this.read().sessions[key];
157
+ return record ? new SealedNexusSession(key, record) : null;
158
+ }
159
+ async put(apiUrl, session) {
160
+ const key = nexusOriginKey(apiUrl);
161
+ const record = sessionSchema.parse({
162
+ token: session.token,
163
+ tokenType: session.tokenType,
164
+ expiresAt: session.expiresAt,
165
+ user: session.user,
166
+ organization: session.organization,
167
+ createdAt: new Date().toISOString(),
168
+ });
169
+ await this.write((current) => ({
170
+ version: 1,
171
+ sessions: { ...current.sessions, [key]: record },
172
+ }));
173
+ }
174
+ async delete(apiUrl, expected) {
175
+ const key = nexusOriginKey(apiUrl);
176
+ let deleted = false;
177
+ if (key in this.read().sessions) {
178
+ await this.write((current) => {
179
+ const stored = current.sessions[key];
180
+ if (!stored || (expected !== undefined && stored.token !== expected.bearer())) {
181
+ return current;
182
+ }
183
+ deleted = true;
184
+ const sessions = { ...current.sessions };
185
+ delete sessions[key];
186
+ return { version: 1, sessions };
187
+ });
188
+ }
189
+ // Rotated backups hold earlier copies of the file, and so of the token.
190
+ this.purgeBackups();
191
+ return deleted;
192
+ }
193
+ async list() {
194
+ return Object.entries(this.read().sessions)
195
+ .sort(([a], [b]) => a.localeCompare(b))
196
+ .map(([key, record]) => new SealedNexusSession(key, record));
197
+ }
198
+ /**
199
+ * Read and validate the file; a missing or malformed file reads as empty. A
200
+ * file readable or writable by group/others, or owned by another user, is
201
+ * refused: its token may already be exposed or planted.
202
+ */
203
+ read() {
204
+ this.assertPrivate();
205
+ let raw;
206
+ try {
207
+ raw = readFileSync(this.location, 'utf-8');
208
+ }
209
+ catch {
210
+ return EMPTY_STORE;
211
+ }
212
+ if (!raw.trim())
213
+ return EMPTY_STORE;
214
+ try {
215
+ const parsed = storeSchema.safeParse(JSON.parse(raw));
216
+ return parsed.success ? parsed.data : EMPTY_STORE;
217
+ }
218
+ catch {
219
+ return EMPTY_STORE;
220
+ }
221
+ }
222
+ /** Locked, atomic, owner-only read-modify-write. */
223
+ async write(transform) {
224
+ this.assertNoSymlinks();
225
+ this.seed();
226
+ await withLock(this.location, (current) => {
227
+ const parsed = storeSchema.safeParse(current);
228
+ return transform(parsed.success ? parsed.data : EMPTY_STORE);
229
+ }, { mode: 0o600 });
230
+ }
231
+ /**
232
+ * Create the store file owner-only if it does not exist. `O_EXCL` plus
233
+ * `O_NOFOLLOW` close the window between the symlink check and the create: a
234
+ * symlink planted meanwhile makes the open fail instead of being followed.
235
+ * On `EEXIST` the existing entry is re-opened with `O_NOFOLLOW`, which fails
236
+ * (`ELOOP`) on a symlink, so a planted link is refused before the locked
237
+ * write can touch it.
238
+ */
239
+ seed() {
240
+ mkdirSync(dirname(this.location), { recursive: true, mode: 0o700 });
241
+ let fd;
242
+ try {
243
+ fd = openSync(this.location, fsConstants.O_CREAT | fsConstants.O_EXCL | fsConstants.O_WRONLY | NO_FOLLOW, 0o600);
244
+ }
245
+ catch (err) {
246
+ if (!(err instanceof Error && 'code' in err && err.code === 'EEXIST'))
247
+ throw err;
248
+ try {
249
+ closeSync(openSync(this.location, fsConstants.O_RDONLY | NO_FOLLOW));
250
+ }
251
+ catch {
252
+ throw new NexusCredentialsError(`refusing to write Nexus credentials through a symlink: ${this.location}`);
253
+ }
254
+ return;
255
+ }
256
+ try {
257
+ writeSync(fd, `${JSON.stringify(EMPTY_STORE)}\n`);
258
+ }
259
+ finally {
260
+ closeSync(fd);
261
+ }
262
+ }
263
+ /**
264
+ * Throw when the store exists with a mode wider than 0600 or another owner.
265
+ * Skipped on Windows, where Node reports every file as 0o666 and uids do not
266
+ * apply; the file lives in the user's profile, protected by its ACL.
267
+ */
268
+ assertPrivate() {
269
+ if (process.platform === 'win32')
270
+ return;
271
+ let st;
272
+ try {
273
+ st = statSync(this.location);
274
+ }
275
+ catch {
276
+ return; // absent: created 0600 on first write
277
+ }
278
+ const uid = typeof process.getuid === 'function' ? process.getuid() : null;
279
+ if ((st.mode & 0o077) !== 0 || (uid !== null && st.uid !== uid)) {
280
+ throw new NexusCredentialsError(`refusing to read ${this.location}: it must be owned by you with mode 0600 (it is ${(st.mode & 0o777).toString(8)}). Run: chmod 600 ${this.location}`);
281
+ }
282
+ }
283
+ /** Refuse to write a token through a symlink (it could point anywhere). */
284
+ assertNoSymlinks() {
285
+ for (const candidate of [this.location, ...this.backupFiles()]) {
286
+ let isLink = false;
287
+ try {
288
+ isLink = lstatSync(candidate).isSymbolicLink();
289
+ }
290
+ catch {
291
+ continue;
292
+ }
293
+ if (isLink) {
294
+ throw new NexusCredentialsError(`refusing to write Nexus credentials through a symlink: ${candidate}`);
295
+ }
296
+ }
297
+ }
298
+ /** Rotated backups of the store file. */
299
+ backupFiles() {
300
+ const backupDir = join(dirname(this.location), '.backups');
301
+ const prefix = `${basename(this.location)}.`;
302
+ try {
303
+ return readdirSync(backupDir)
304
+ .filter((entry) => entry.startsWith(prefix))
305
+ .map((entry) => join(backupDir, entry));
306
+ }
307
+ catch {
308
+ return [];
309
+ }
310
+ }
311
+ /** Delete every rotated backup (best effort). */
312
+ purgeBackups() {
313
+ for (const file of this.backupFiles()) {
314
+ try {
315
+ unlinkSync(file);
316
+ }
317
+ catch {
318
+ /* best effort */
319
+ }
320
+ }
321
+ }
322
+ }
323
+ //# sourceMappingURL=nexus-credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nexus-credentials.js","sourceRoot":"","sources":["../../src/cloud/nexus-credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EACL,SAAS,EACT,SAAS,IAAI,WAAW,EACxB,SAAS,EACT,SAAS,EACT,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,SAAS,GACV,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAGL,8BAA8B,EAC9B,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,4DAA4D;AAC5D,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAwB,CAAC;AAE/D,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,IAAI,EAAE,sBAAsB,CAAC,QAAQ,EAAE;IACvC,YAAY,EAAE,8BAA8B,CAAC,QAAQ,EAAE;IACvD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3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"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * `cleo project link`: register the current project with Cleo Nexus and bind
3
+ * the remote project to the local one.
4
+ *
5
+ * ## What is sent
6
+ *
7
+ * `POST /v1/projects` with `{ projectId, label }` only:
8
+ *
9
+ * - `projectId` is the tracked, immutable `.cleo/project-id`
10
+ * (`readDeclaredProjectIdentity`), the key the server stores projects under,
11
+ * so the remote id IS the local id.
12
+ * - `label` is the project's display name in plaintext
13
+ * ({@link getProjectDisplayName}), or `--label`. It must not look like a path.
14
+ *
15
+ * No filesystem path, git remote or directory layout is ever sent.
16
+ *
17
+ * ## Idempotency
18
+ *
19
+ * Registering the same id again answers 200 (201 on first registration) and
20
+ * sets the server label to the one sent, so re-linking after a rename updates
21
+ * the label. Linking twice is safe.
22
+ *
23
+ * ## Where the binding lives
24
+ *
25
+ * `<project>/.cleo/nexus-link.json`, keyed by API origin. It is machine-local:
26
+ * `.cleo/.gitignore` denies everything not allow-listed, so the binding (which
27
+ * names an account's organization) is never committed. It is not
28
+ * `project-context.json`, which is tracked in git and regenerated by
29
+ * `cleo upgrade`, and not the project `cleo.db`, so linking never opens or
30
+ * migrates the task store. Each clone links itself, the same way each machine
31
+ * signs itself in.
32
+ *
33
+ * @task T12712
34
+ * @epic T12322
35
+ */
36
+ import type { NexusProjectLink, NexusProjectLinkResult } from '@cleocode/contracts';
37
+ import { type NexusFlowOptions } from './nexus-auth.js';
38
+ /** File name of the binding, inside the project's `.cleo/` directory. */
39
+ export declare const NEXUS_LINK_FILE = "nexus-link.json";
40
+ /** Longest label the server accepts (`RegisterProjectRequest.label`). */
41
+ export declare const NEXUS_LABEL_MAX = 120;
42
+ /** Options for {@link linkProjectToNexus}. */
43
+ export interface NexusLinkOptions extends NexusFlowOptions {
44
+ /** Project root; defaults to the resolved current project. */
45
+ projectRoot?: string;
46
+ /** Label to register (`--label`); defaults to {@link getProjectDisplayName}. */
47
+ label?: string;
48
+ }
49
+ /**
50
+ * Validate a project label: 1-120 characters; no path separator or look-alike
51
+ * slash, no drive letter (`C:`), no leading `~`, no control characters; and
52
+ * not the OS username, which would leak the account name. A label is a name,
53
+ * never a path.
54
+ *
55
+ * @param raw - Candidate label.
56
+ * @returns The trimmed label.
57
+ * @throws {NexusAccountError} `E_NEXUS_INVALID_LABEL`.
58
+ */
59
+ export declare function validateNexusProjectLabel(raw: string): string;
60
+ /**
61
+ * Path of the binding file for a project.
62
+ *
63
+ * @param projectRoot - Project root.
64
+ * @returns `<project>/.cleo/nexus-link.json`.
65
+ */
66
+ export declare function nexusLinkPath(projectRoot: string): string;
67
+ /**
68
+ * The stored binding for a project and origin, if any.
69
+ *
70
+ * @param projectRoot - Project root.
71
+ * @param apiUrl - API URL (any URL on the origin).
72
+ * @returns The binding, or `null`.
73
+ */
74
+ export declare function readNexusProjectLink(projectRoot: string, apiUrl: string): NexusProjectLink | null;
75
+ /**
76
+ * Register the project with Nexus (label only, never a path) and persist the
77
+ * binding in `.cleo/nexus-link.json`. Idempotent.
78
+ *
79
+ * @param opts - Project root, label, API URL, store and test overrides.
80
+ * @returns The binding and whether it already existed.
81
+ * @throws {NexusAccountError} Not signed in, expired session, invalid label,
82
+ * not a CLEO project, or an API refusal (e.g. the id belongs to another account).
83
+ */
84
+ export declare function linkProjectToNexus(opts?: NexusLinkOptions): Promise<NexusProjectLinkResult>;
85
+ //# sourceMappingURL=nexus-link.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nexus-link.d.ts","sourceRoot":"","sources":["../../src/cloud/nexus-link.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAKH,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAOpF,OAAO,EAEL,KAAK,gBAAgB,EAGtB,MAAM,iBAAiB,CAAC;AAIzB,yEAAyE;AACzE,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAEjD,yEAAyE;AACzE,eAAO,MAAM,eAAe,MAAM,CAAC;AAmBnC,8CAA8C;AAC9C,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAmBD;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAmB7D;AAmBD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEzD;AAaD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAEjG;AAkBD;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,GAAE,gBAAqB,GAC1B,OAAO,CAAC,sBAAsB,CAAC,CAmEjC"}