@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,169 @@
1
+ /**
2
+ * Cleo Nexus account engine: device-code login, logout and session status.
3
+ *
4
+ * The Nexus API is a better-auth app (cleo-nexus `apps/api/src/auth.ts`):
5
+ *
6
+ * - `POST /api/auth/device/code` and `POST /api/auth/device/token` run the
7
+ * RFC 8628 grant for the single allowed client id `cleo-cli`, with RFC form
8
+ * bodies (cleo-nexus #11). The access token it returns is a better-auth
9
+ * session token.
10
+ * - The bearer plugin accepts that token as `Authorization: Bearer <token>` on
11
+ * every `/v1` route and on `POST /api/auth/sign-out`, which deletes the
12
+ * session server-side.
13
+ * - `GET /v1/account/me` names the user and their organizations; a dead
14
+ * session answers 401 `E_UNAUTHENTICATED`.
15
+ *
16
+ * The device-code protocol itself is NOT implemented here: it is the shared
17
+ * runner in `../llm/oauth/device-code.ts` (also used by the kimi-code LLM
18
+ * login). This module adds the Nexus endpoints, token storage and account
19
+ * lookup. The CLI (`cleo login nexus`, `cleo logout`, `cleo status`) and the
20
+ * `nexus-account` setup section are thin callers.
21
+ *
22
+ * No function here logs, and no result carries the token.
23
+ *
24
+ * @task T12712
25
+ * @epic T12322
26
+ */
27
+ import { type NexusAccountErrorCode, type NexusAccountMe, type NexusAccountOrganization, type NexusAccountStatus, type NexusLoginResult, type NexusLogoutResult } from '@cleocode/contracts';
28
+ import { type DeviceCodeConfig, type DeviceCodeStartResponse } from '../llm/oauth/device-code.js';
29
+ import { type FetchLike } from './http.js';
30
+ import { type NexusTokenStore, type SealedNexusSession } from './nexus-credentials.js';
31
+ /** Environment override for the default API origin (e.g. staging). */
32
+ export declare const NEXUS_API_URL_ENV = "CLEO_NEXUS_API_URL";
33
+ /** Default time budget for the server-side revocation at logout. */
34
+ export declare const NEXUS_REVOKE_TIMEOUT_MS = 5000;
35
+ /** Default time budget for a live status check. */
36
+ export declare const NEXUS_STATUS_TIMEOUT_MS = 1500;
37
+ /** A Nexus account flow failure with a stable code. Never carries a token. */
38
+ export declare class NexusAccountError extends Error {
39
+ readonly code: NexusAccountErrorCode;
40
+ readonly fix?: string | undefined;
41
+ /**
42
+ * @param code - Stable error code.
43
+ * @param message - Human message.
44
+ * @param fix - Optional remedy for the user.
45
+ */
46
+ constructor(code: NexusAccountErrorCode, message: string, fix?: string | undefined);
47
+ }
48
+ /** Dependencies shared by every flow; all optional (tests inject them). */
49
+ export interface NexusFlowOptions {
50
+ /** API URL; defaults to `$CLEO_NEXUS_API_URL`, then {@link NEXUS_DEFAULT_API_URL}. */
51
+ apiUrl?: string;
52
+ /** Token store; defaults to the 0600 file store. */
53
+ store?: NexusTokenStore;
54
+ /** `fetch` override. */
55
+ fetch?: FetchLike;
56
+ }
57
+ /** Options for {@link logoutFromNexus}. */
58
+ export interface NexusLogoutOptions extends NexusFlowOptions {
59
+ /** Budget for the revocation call; default {@link NEXUS_REVOKE_TIMEOUT_MS}. */
60
+ revokeTimeoutMs?: number;
61
+ }
62
+ /** Options for {@link loginToNexus}. */
63
+ export interface NexusLoginOptions extends NexusFlowOptions {
64
+ /** Called once with the user code and verification URL to show the user. */
65
+ onCode?: (code: DeviceCodeStartResponse) => void;
66
+ /** Called on every pending poll with elapsed and total seconds. */
67
+ onPending?: (elapsed: number, expiresIn: number) => void;
68
+ /** Cancels polling. */
69
+ signal?: AbortSignal;
70
+ /** Wait override for polling (tests). */
71
+ sleep?: (ms: number) => Promise<void>;
72
+ }
73
+ /** Options for {@link getNexusAccountStatus}. */
74
+ export interface NexusStatusOptions {
75
+ /** Report only this origin. Default: every stored origin, else the default origin. */
76
+ apiUrl?: string;
77
+ /** Token store. */
78
+ store?: NexusTokenStore;
79
+ /** `fetch` override. */
80
+ fetch?: FetchLike;
81
+ /** Check each session against the API (default `true`). */
82
+ live?: boolean;
83
+ /** Time budget per live check. */
84
+ timeoutMs?: number;
85
+ }
86
+ /**
87
+ * Resolve and validate the API URL to its origin.
88
+ *
89
+ * @param raw - `--api-url`, or `undefined` for `$CLEO_NEXUS_API_URL` / the default.
90
+ * @returns The origin, e.g. `https://api.cleocode.dev`.
91
+ * @throws {NexusAccountError} `E_NEXUS_INVALID_API_URL` for anything but an
92
+ * https URL (http only on loopback) without credentials in it.
93
+ */
94
+ export declare function resolveNexusApiUrl(raw?: string): string;
95
+ /**
96
+ * The shared device-code runner's config for a Nexus origin.
97
+ *
98
+ * @param apiUrl - Resolved API origin.
99
+ * @param fetchImpl - Optional `fetch` override.
100
+ * @returns A {@link DeviceCodeConfig} for the better-auth device endpoints.
101
+ */
102
+ export declare function nexusDeviceCodeConfig(apiUrl: string, fetchImpl?: FetchLike): DeviceCodeConfig;
103
+ /**
104
+ * Refuse a server-supplied verification URL unless it is safe to print and to
105
+ * hand to the OS browser opener:
106
+ *
107
+ * - no control characters or whitespace (terminal injection: ESC, CR, LF, CSI);
108
+ * - no leading `-` (option injection into `open` / `xdg-open`);
109
+ * - `https:` (plain `http:` only when the API itself is a loopback http origin);
110
+ * - no `user:pass@`;
111
+ * - the host is the API's web origin or a subdomain of it: the API host minus a
112
+ * leading `api.` label (`api.cleocode.dev` → `cleocode.dev`,
113
+ * `api.staging.cleocode.dev` → `staging.cleocode.dev`). A phishing host, a
114
+ * `file:` URL or a custom scheme never reaches the screen or the opener.
115
+ *
116
+ * @param uri - `verification_uri` or `verification_uri_complete` as received.
117
+ * @param apiUrl - Resolved API origin.
118
+ * @returns The normalised URL (`new URL(uri).href`): the exact form that was
119
+ * validated, and the only one to print or open.
120
+ * @throws {NexusAccountError} `E_NEXUS_UNTRUSTED_VERIFICATION_URI`.
121
+ */
122
+ export declare function assertTrustedVerificationUri(uri: string, apiUrl: string): string;
123
+ /**
124
+ * The organization to show for an account: the personal one, else the first.
125
+ *
126
+ * @param me - Parsed `/v1/account/me`.
127
+ * @returns The primary organization, or `null`.
128
+ */
129
+ export declare function primaryNexusOrganization(me: NexusAccountMe): NexusAccountOrganization | null;
130
+ /**
131
+ * Sign in to a Cleo Nexus account with the device-code grant and store the
132
+ * session token (0600, keyed by API origin).
133
+ *
134
+ * @param opts - API URL, store, UI hooks and test overrides.
135
+ * @returns The secret-free login result.
136
+ * @throws {NexusAccountError} On a start, poll, denial or expiry failure.
137
+ */
138
+ export declare function loginToNexus(opts?: NexusLoginOptions): Promise<NexusLoginResult>;
139
+ /**
140
+ * Sign out: delete the session locally FIRST, then revoke it server-side
141
+ * (`POST /api/auth/sign-out` with the bearer token) within
142
+ * {@link NEXUS_REVOKE_TIMEOUT_MS}. A slow or hung server can delay logout by
143
+ * at most that budget and can never keep the token on disk; a failed
144
+ * revocation is reported. The delete only removes the session that was read,
145
+ * so a login that finished concurrently for the same origin survives.
146
+ *
147
+ * @param opts - API URL, store, revoke budget and test overrides.
148
+ * @returns The logout result.
149
+ */
150
+ export declare function logoutFromNexus(opts?: NexusLogoutOptions): Promise<NexusLogoutResult>;
151
+ /**
152
+ * Secret-free status rows for `cleo status` and `cleo auth list`: one per
153
+ * stored session, or one "not signed in" row for the default origin. Makes a
154
+ * network call only when a token is stored.
155
+ *
156
+ * @param opts - Origin filter, store, liveness and test overrides.
157
+ * @returns Status rows, sorted by origin.
158
+ */
159
+ export declare function getNexusAccountStatus(opts?: NexusStatusOptions): Promise<NexusAccountStatus[]>;
160
+ /**
161
+ * The stored session for an origin, or a `E_NEXUS_NOT_SIGNED_IN` error.
162
+ *
163
+ * @param apiUrl - Resolved API origin.
164
+ * @param store - Token store.
165
+ * @returns The sealed session.
166
+ * @throws {NexusAccountError} When no session is stored.
167
+ */
168
+ export declare function requireNexusSession(apiUrl: string, store: NexusTokenStore): Promise<SealedNexusSession>;
169
+ //# sourceMappingURL=nexus-auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nexus-auth.d.ts","sourceRoot":"","sources":["../../src/cloud/nexus-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EAEvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAI7B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,KAAK,SAAS,EAAiC,MAAM,WAAW,CAAC;AAC1E,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACxB,MAAM,wBAAwB,CAAC;AAEhC,sEAAsE;AACtE,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAEtD,oEAAoE;AACpE,eAAO,MAAM,uBAAuB,OAAQ,CAAC;AAE7C,mDAAmD;AACnD,eAAO,MAAM,uBAAuB,O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IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAevD;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,gBAAgB,CAQ7F;AAaD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAwBhF;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,cAAc,GAAG,wBAAwB,GAAG,IAAI,CAE5F;AAgDD;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,IAAI,GAAE,iBAAsB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAwE1F;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CAAC,IAAI,GAAE,kBAAuB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAyB/F;AA8ED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,GAAE,kBAAuB,GAC5B,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAQ/B;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,kBAAkB,CAAC,CAY7B"}
@@ -0,0 +1,372 @@
1
+ /**
2
+ * Cleo Nexus account engine: device-code login, logout and session status.
3
+ *
4
+ * The Nexus API is a better-auth app (cleo-nexus `apps/api/src/auth.ts`):
5
+ *
6
+ * - `POST /api/auth/device/code` and `POST /api/auth/device/token` run the
7
+ * RFC 8628 grant for the single allowed client id `cleo-cli`, with RFC form
8
+ * bodies (cleo-nexus #11). The access token it returns is a better-auth
9
+ * session token.
10
+ * - The bearer plugin accepts that token as `Authorization: Bearer <token>` on
11
+ * every `/v1` route and on `POST /api/auth/sign-out`, which deletes the
12
+ * session server-side.
13
+ * - `GET /v1/account/me` names the user and their organizations; a dead
14
+ * session answers 401 `E_UNAUTHENTICATED`.
15
+ *
16
+ * The device-code protocol itself is NOT implemented here: it is the shared
17
+ * runner in `../llm/oauth/device-code.ts` (also used by the kimi-code LLM
18
+ * login). This module adds the Nexus endpoints, token storage and account
19
+ * lookup. The CLI (`cleo login nexus`, `cleo logout`, `cleo status`) and the
20
+ * `nexus-account` setup section are thin callers.
21
+ *
22
+ * No function here logs, and no result carries the token.
23
+ *
24
+ * @task T12712
25
+ * @epic T12322
26
+ */
27
+ import { NEXUS_CLI_CLIENT_ID, NEXUS_DEFAULT_API_URL, nexusAccountMeSchema, } from '@cleocode/contracts';
28
+ import { DeviceCodeAuthError, DeviceCodeTimeoutError, pollForToken, startDeviceCodeFlow, } from '../llm/oauth/device-code.js';
29
+ import { Http, isSecureUrl, NexusError } from './http.js';
30
+ import { FileNexusTokenStore, } from './nexus-credentials.js';
31
+ /** Environment override for the default API origin (e.g. staging). */
32
+ export const NEXUS_API_URL_ENV = 'CLEO_NEXUS_API_URL';
33
+ /** Default time budget for the server-side revocation at logout. */
34
+ export const NEXUS_REVOKE_TIMEOUT_MS = 5_000;
35
+ /** Default time budget for a live status check. */
36
+ export const NEXUS_STATUS_TIMEOUT_MS = 1_500;
37
+ /** A Nexus account flow failure with a stable code. Never carries a token. */
38
+ export class NexusAccountError extends Error {
39
+ code;
40
+ fix;
41
+ /**
42
+ * @param code - Stable error code.
43
+ * @param message - Human message.
44
+ * @param fix - Optional remedy for the user.
45
+ */
46
+ constructor(code, message, fix) {
47
+ super(message);
48
+ this.code = code;
49
+ this.fix = fix;
50
+ this.name = 'NexusAccountError';
51
+ }
52
+ }
53
+ /**
54
+ * Resolve and validate the API URL to its origin.
55
+ *
56
+ * @param raw - `--api-url`, or `undefined` for `$CLEO_NEXUS_API_URL` / the default.
57
+ * @returns The origin, e.g. `https://api.cleocode.dev`.
58
+ * @throws {NexusAccountError} `E_NEXUS_INVALID_API_URL` for anything but an
59
+ * https URL (http only on loopback) without credentials in it.
60
+ */
61
+ export function resolveNexusApiUrl(raw) {
62
+ const candidate = (raw ?? process.env[NEXUS_API_URL_ENV] ?? NEXUS_DEFAULT_API_URL).trim();
63
+ let url;
64
+ try {
65
+ url = new URL(candidate);
66
+ }
67
+ catch {
68
+ throw new NexusAccountError('E_NEXUS_INVALID_API_URL', `invalid Nexus API URL: ${candidate}`);
69
+ }
70
+ if (url.username || url.password || !isSecureUrl(url.origin)) {
71
+ throw new NexusAccountError('E_NEXUS_INVALID_API_URL', 'the Nexus API URL must be https:// (http:// only for localhost) with no user:password');
72
+ }
73
+ return url.origin;
74
+ }
75
+ /**
76
+ * The shared device-code runner's config for a Nexus origin.
77
+ *
78
+ * @param apiUrl - Resolved API origin.
79
+ * @param fetchImpl - Optional `fetch` override.
80
+ * @returns A {@link DeviceCodeConfig} for the better-auth device endpoints.
81
+ */
82
+ export function nexusDeviceCodeConfig(apiUrl, fetchImpl) {
83
+ return {
84
+ provider: 'cleo-nexus',
85
+ deviceCodeUrl: `${apiUrl}/api/auth/device/code`,
86
+ tokenUrl: `${apiUrl}/api/auth/device/token`,
87
+ clientId: NEXUS_CLI_CLIENT_ID,
88
+ ...(fetchImpl ? { fetch: fetchImpl } : {}),
89
+ };
90
+ }
91
+ /**
92
+ * C0/C1 control characters (ESC, CR, LF, CSI, …), any whitespace, bidi
93
+ * embeddings/overrides/isolates (U+202A–202E, U+2066–2069), zero-width
94
+ * characters (U+200B–200D, U+FEFF) and `\` (which WHATWG URL parsing turns
95
+ * into `/`, so the host a user reads could differ from the one opened).
96
+ */
97
+ const UNSAFE_URI_CHARS = /[\u0000-\u0020\u007f-\u009f\s\u202a-\u202e\u2066-\u2069\u200b-\u200d\ufeff\\]/;
98
+ const LOOPBACK_HOSTS = new Set(['localhost', '127.0.0.1', '[::1]']);
99
+ /**
100
+ * Refuse a server-supplied verification URL unless it is safe to print and to
101
+ * hand to the OS browser opener:
102
+ *
103
+ * - no control characters or whitespace (terminal injection: ESC, CR, LF, CSI);
104
+ * - no leading `-` (option injection into `open` / `xdg-open`);
105
+ * - `https:` (plain `http:` only when the API itself is a loopback http origin);
106
+ * - no `user:pass@`;
107
+ * - the host is the API's web origin or a subdomain of it: the API host minus a
108
+ * leading `api.` label (`api.cleocode.dev` → `cleocode.dev`,
109
+ * `api.staging.cleocode.dev` → `staging.cleocode.dev`). A phishing host, a
110
+ * `file:` URL or a custom scheme never reaches the screen or the opener.
111
+ *
112
+ * @param uri - `verification_uri` or `verification_uri_complete` as received.
113
+ * @param apiUrl - Resolved API origin.
114
+ * @returns The normalised URL (`new URL(uri).href`): the exact form that was
115
+ * validated, and the only one to print or open.
116
+ * @throws {NexusAccountError} `E_NEXUS_UNTRUSTED_VERIFICATION_URI`.
117
+ */
118
+ export function assertTrustedVerificationUri(uri, apiUrl) {
119
+ const refuse = (why) => {
120
+ throw new NexusAccountError('E_NEXUS_UNTRUSTED_VERIFICATION_URI', `the server sent an untrusted verification URL (${why}); the login was stopped`, 'check --api-url; only sign in through the Cleo Nexus web app');
121
+ };
122
+ if (UNSAFE_URI_CHARS.test(uri))
123
+ refuse('control characters or whitespace');
124
+ if (uri.startsWith('-'))
125
+ refuse('leading "-"');
126
+ const url = URL.canParse(uri) ? new URL(uri) : refuse('not a URL');
127
+ const api = new URL(apiUrl);
128
+ const loopbackHttp = url.protocol === 'http:' &&
129
+ api.protocol === 'http:' &&
130
+ LOOPBACK_HOSTS.has(url.hostname) &&
131
+ LOOPBACK_HOSTS.has(api.hostname);
132
+ if (url.protocol !== 'https:' && !loopbackHttp)
133
+ refuse(`scheme ${url.protocol}`);
134
+ if (url.username || url.password)
135
+ refuse('credentials in the URL');
136
+ const web = api.hostname.startsWith('api.') ? api.hostname.slice(4) : api.hostname;
137
+ if (url.hostname !== web && !url.hostname.endsWith(`.${web}`)) {
138
+ refuse(`host ${url.hostname} is not ${web}`);
139
+ }
140
+ return url.href;
141
+ }
142
+ /**
143
+ * The organization to show for an account: the personal one, else the first.
144
+ *
145
+ * @param me - Parsed `/v1/account/me`.
146
+ * @returns The primary organization, or `null`.
147
+ */
148
+ export function primaryNexusOrganization(me) {
149
+ return me.organizations.find((o) => o.personal) ?? me.organizations[0] ?? null;
150
+ }
151
+ /** `GET /v1/account/me` with a bearer token. */
152
+ async function fetchAccountMe(apiUrl, token, opts = {}) {
153
+ const http = new Http({
154
+ baseUrl: apiUrl,
155
+ token,
156
+ ...(opts.fetch ? { fetch: opts.fetch } : {}),
157
+ maxAttempts: opts.maxAttempts ?? 2,
158
+ });
159
+ return http.request('GET', '/v1/account/me', nexusAccountMeSchema);
160
+ }
161
+ /** Map a device-code runner failure to a Nexus error. */
162
+ function toLoginError(err) {
163
+ if (err instanceof DeviceCodeTimeoutError) {
164
+ return new NexusAccountError('E_NEXUS_DEVICE_CODE_EXPIRED', 'the device code expired before it was approved', 'run `cleo login nexus` again and approve the code sooner');
165
+ }
166
+ if (err instanceof DeviceCodeAuthError) {
167
+ if (err.errorCode === 'expired_token') {
168
+ return new NexusAccountError('E_NEXUS_DEVICE_CODE_EXPIRED', 'the device code expired before it was approved', 'run `cleo login nexus` again and approve the code sooner');
169
+ }
170
+ if (err.errorCode === 'access_denied') {
171
+ return new NexusAccountError('E_NEXUS_ACCESS_DENIED', 'the sign-in request was denied in the browser');
172
+ }
173
+ return new NexusAccountError('E_NEXUS_DEVICE_CODE_FAILED', err.message);
174
+ }
175
+ return new NexusAccountError('E_NEXUS_DEVICE_CODE_FAILED', `polling for the Nexus token failed: ${err instanceof Error ? err.message : String(err)}`);
176
+ }
177
+ /**
178
+ * Sign in to a Cleo Nexus account with the device-code grant and store the
179
+ * session token (0600, keyed by API origin).
180
+ *
181
+ * @param opts - API URL, store, UI hooks and test overrides.
182
+ * @returns The secret-free login result.
183
+ * @throws {NexusAccountError} On a start, poll, denial or expiry failure.
184
+ */
185
+ export async function loginToNexus(opts = {}) {
186
+ const apiUrl = resolveNexusApiUrl(opts.apiUrl);
187
+ const store = opts.store ?? new FileNexusTokenStore();
188
+ const cfg = nexusDeviceCodeConfig(apiUrl, opts.fetch);
189
+ let start;
190
+ try {
191
+ start = await startDeviceCodeFlow(cfg);
192
+ }
193
+ catch (err) {
194
+ throw new NexusAccountError('E_NEXUS_DEVICE_CODE_START_FAILED', `could not start the Nexus sign-in at ${apiUrl}: ${err instanceof Error ? err.message : String(err)}`, 'check the API URL and your network, then retry');
195
+ }
196
+ // Validate, then show and open only the normalised forms that were checked.
197
+ const shown = {
198
+ ...start,
199
+ verificationUri: assertTrustedVerificationUri(start.verificationUri, apiUrl),
200
+ ...(start.verificationUriComplete !== undefined
201
+ ? {
202
+ verificationUriComplete: assertTrustedVerificationUri(start.verificationUriComplete, apiUrl),
203
+ }
204
+ : {}),
205
+ };
206
+ opts.onCode?.(shown);
207
+ let token;
208
+ try {
209
+ token = await pollForToken(cfg, start, {
210
+ ...(opts.onPending ? { onPending: opts.onPending } : {}),
211
+ ...(opts.signal ? { signal: opts.signal } : {}),
212
+ ...(opts.sleep ? { sleep: opts.sleep } : {}),
213
+ });
214
+ }
215
+ catch (err) {
216
+ throw toLoginError(err);
217
+ }
218
+ const warnings = [];
219
+ let me = null;
220
+ try {
221
+ me = await fetchAccountMe(apiUrl, token.accessToken, opts.fetch ? { fetch: opts.fetch } : {});
222
+ }
223
+ catch (err) {
224
+ warnings.push(`signed in, but the account lookup failed: ${err instanceof Error ? err.message : String(err)}`);
225
+ }
226
+ const organization = me ? primaryNexusOrganization(me) : null;
227
+ const expiresAt = typeof token.expiresIn === 'number'
228
+ ? new Date(Date.now() + token.expiresIn * 1000).toISOString()
229
+ : null;
230
+ await store.put(apiUrl, {
231
+ token: token.accessToken,
232
+ tokenType: token.tokenType,
233
+ expiresAt,
234
+ user: me?.user ?? null,
235
+ organization,
236
+ });
237
+ return {
238
+ apiUrl,
239
+ user: me?.user ?? null,
240
+ organization,
241
+ expiresAt,
242
+ credentialsPath: store.location,
243
+ warnings,
244
+ };
245
+ }
246
+ /**
247
+ * Sign out: delete the session locally FIRST, then revoke it server-side
248
+ * (`POST /api/auth/sign-out` with the bearer token) within
249
+ * {@link NEXUS_REVOKE_TIMEOUT_MS}. A slow or hung server can delay logout by
250
+ * at most that budget and can never keep the token on disk; a failed
251
+ * revocation is reported. The delete only removes the session that was read,
252
+ * so a login that finished concurrently for the same origin survives.
253
+ *
254
+ * @param opts - API URL, store, revoke budget and test overrides.
255
+ * @returns The logout result.
256
+ */
257
+ export async function logoutFromNexus(opts = {}) {
258
+ const apiUrl = resolveNexusApiUrl(opts.apiUrl);
259
+ const store = opts.store ?? new FileNexusTokenStore();
260
+ const session = await store.get(apiUrl);
261
+ if (!session) {
262
+ return { apiUrl, removedLocally: false, revocation: 'skipped', warnings: [] };
263
+ }
264
+ const removedLocally = await store.delete(apiUrl, session);
265
+ const warnings = [];
266
+ let revocation;
267
+ try {
268
+ revocation = await revokeSession(apiUrl, session, opts.revokeTimeoutMs ?? NEXUS_REVOKE_TIMEOUT_MS, opts.fetch);
269
+ }
270
+ catch (err) {
271
+ revocation = 'failed';
272
+ warnings.push(`server-side sign-out failed (${err instanceof Error ? err.message : String(err)}); the local token was deleted`);
273
+ }
274
+ return { apiUrl, removedLocally, revocation, warnings };
275
+ }
276
+ /** `POST /api/auth/sign-out` with the bearer token, within `timeoutMs`. Never follows redirects. */
277
+ async function revokeSession(apiUrl, session, timeoutMs, fetchImpl) {
278
+ const doFetch = fetchImpl ?? ((input, init) => fetch(input, init));
279
+ const res = await doFetch(`${apiUrl}/api/auth/sign-out`, {
280
+ method: 'POST',
281
+ headers: {
282
+ authorization: `Bearer ${session.bearer()}`,
283
+ 'content-type': 'application/json',
284
+ accept: 'application/json',
285
+ },
286
+ body: '{}',
287
+ redirect: 'error',
288
+ signal: AbortSignal.timeout(timeoutMs),
289
+ });
290
+ if (res.status === 401)
291
+ return 'already-invalid';
292
+ if (!res.ok)
293
+ throw new Error(`HTTP ${res.status}`);
294
+ return 'revoked';
295
+ }
296
+ /** Build one status row from a stored session and an optional live check. */
297
+ function statusRow(apiUrl, state, session, me) {
298
+ const email = me?.user.email ?? session?.user?.email ?? null;
299
+ const org = (me ? primaryNexusOrganization(me) : session?.organization)?.name ?? null;
300
+ const who = `${email ?? 'unknown user'}${org ? ` (${org})` : ''}`;
301
+ const summary = state === 'signed-in'
302
+ ? `signed in as ${who}`
303
+ : state === 'unverified'
304
+ ? `signed in as ${who}; not verified (API unreachable)`
305
+ : state === 'expired'
306
+ ? 'session expired; run `cleo login nexus`'
307
+ : 'not signed in';
308
+ return {
309
+ apiUrl,
310
+ state,
311
+ email: state === 'not-signed-in' ? null : email,
312
+ organization: state === 'not-signed-in' ? null : org,
313
+ expiresAt: session?.expiresAt ?? null,
314
+ summary,
315
+ };
316
+ }
317
+ /** Check one stored session against the API. 401 means expired, never a crash. */
318
+ async function checkSession(session, opts) {
319
+ if (opts.live === false)
320
+ return statusRow(session.apiUrl, 'unverified', session, null);
321
+ const timeoutMs = opts.timeoutMs ?? NEXUS_STATUS_TIMEOUT_MS;
322
+ const base = opts.fetch ?? ((input, init) => fetch(input, init));
323
+ const timed = (input, init) => base(input, { ...init, signal: AbortSignal.timeout(timeoutMs) });
324
+ try {
325
+ const me = await fetchAccountMe(session.apiUrl, session.bearer(), {
326
+ fetch: timed,
327
+ maxAttempts: 1,
328
+ });
329
+ return statusRow(session.apiUrl, 'signed-in', session, me);
330
+ }
331
+ catch (err) {
332
+ if (err instanceof NexusError && err.status === 401) {
333
+ return statusRow(session.apiUrl, 'expired', session, null);
334
+ }
335
+ return statusRow(session.apiUrl, 'unverified', session, null);
336
+ }
337
+ }
338
+ /**
339
+ * Secret-free status rows for `cleo status` and `cleo auth list`: one per
340
+ * stored session, or one "not signed in" row for the default origin. Makes a
341
+ * network call only when a token is stored.
342
+ *
343
+ * @param opts - Origin filter, store, liveness and test overrides.
344
+ * @returns Status rows, sorted by origin.
345
+ */
346
+ export async function getNexusAccountStatus(opts = {}) {
347
+ const store = opts.store ?? new FileNexusTokenStore();
348
+ const only = opts.apiUrl !== undefined ? resolveNexusApiUrl(opts.apiUrl) : null;
349
+ const sessions = (await store.list()).filter((s) => only === null || s.apiUrl === only);
350
+ if (sessions.length === 0) {
351
+ return [statusRow(only ?? resolveNexusApiUrl(), 'not-signed-in', null, null)];
352
+ }
353
+ return Promise.all(sessions.map((s) => checkSession(s, opts)));
354
+ }
355
+ /**
356
+ * The stored session for an origin, or a `E_NEXUS_NOT_SIGNED_IN` error.
357
+ *
358
+ * @param apiUrl - Resolved API origin.
359
+ * @param store - Token store.
360
+ * @returns The sealed session.
361
+ * @throws {NexusAccountError} When no session is stored.
362
+ */
363
+ export async function requireNexusSession(apiUrl, store) {
364
+ const session = await store.get(apiUrl);
365
+ if (!session) {
366
+ throw new NexusAccountError('E_NEXUS_NOT_SIGNED_IN', `not signed in to Cleo Nexus at ${apiUrl}`, apiUrl === NEXUS_DEFAULT_API_URL
367
+ ? 'run `cleo login nexus`'
368
+ : `run \`cleo login nexus --api-url ${apiUrl}\``);
369
+ }
370
+ return session;
371
+ }
372
+ //# sourceMappingURL=nexus-auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nexus-auth.js","sourceRoot":"","sources":["../../src/cloud/nexus-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EAOrB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,mBAAmB,EAGnB,sBAAsB,EACtB,YAAY,EACZ,mBAAmB,GACpB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAkB,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC1E,OAAO,EACL,mBAAmB,GAGpB,MAAM,wBAAwB,CAAC;AAEhC,sEAAsE;AACtE,MAAM,CAAC,MAAM,iBAAiB,GAAG,oBAAoB,CAAC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