@aligndottech/cli 0.49.0 → 0.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (825) hide show
  1. package/README.md +5 -3
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +32 -8
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/agents.d.ts.map +1 -1
  6. package/dist/commands/agents.js +4 -1
  7. package/dist/commands/agents.js.map +1 -1
  8. package/dist/commands/check.d.ts.map +1 -1
  9. package/dist/commands/check.js +18 -2
  10. package/dist/commands/check.js.map +1 -1
  11. package/dist/commands/config.d.ts +8 -0
  12. package/dist/commands/config.d.ts.map +1 -0
  13. package/dist/commands/config.js +33 -0
  14. package/dist/commands/config.js.map +1 -0
  15. package/dist/commands/connect-agents.d.ts.map +1 -1
  16. package/dist/commands/connect-agents.js +3 -1
  17. package/dist/commands/connect-agents.js.map +1 -1
  18. package/dist/commands/connect.d.ts +5 -0
  19. package/dist/commands/connect.d.ts.map +1 -1
  20. package/dist/commands/connect.js +24 -0
  21. package/dist/commands/connect.js.map +1 -1
  22. package/dist/commands/env.d.ts.map +1 -1
  23. package/dist/commands/env.js +11 -0
  24. package/dist/commands/env.js.map +1 -1
  25. package/dist/commands/import/confluence.d.ts.map +1 -1
  26. package/dist/commands/import/confluence.js +24 -5
  27. package/dist/commands/import/confluence.js.map +1 -1
  28. package/dist/commands/import/docs.js +2 -2
  29. package/dist/commands/import/git.d.ts.map +1 -1
  30. package/dist/commands/import/git.js +15 -5
  31. package/dist/commands/import/git.js.map +1 -1
  32. package/dist/commands/import/github.d.ts.map +1 -1
  33. package/dist/commands/import/github.js +34 -7
  34. package/dist/commands/import/github.js.map +1 -1
  35. package/dist/commands/import/gitlab.d.ts.map +1 -1
  36. package/dist/commands/import/gitlab.js +10 -5
  37. package/dist/commands/import/gitlab.js.map +1 -1
  38. package/dist/commands/import/jira.d.ts.map +1 -1
  39. package/dist/commands/import/jira.js +10 -5
  40. package/dist/commands/import/jira.js.map +1 -1
  41. package/dist/commands/import/linear.d.ts.map +1 -1
  42. package/dist/commands/import/linear.js +10 -5
  43. package/dist/commands/import/linear.js.map +1 -1
  44. package/dist/commands/import/notion.d.ts.map +1 -1
  45. package/dist/commands/import/notion.js +10 -5
  46. package/dist/commands/import/notion.js.map +1 -1
  47. package/dist/commands/import/sessions.js +2 -2
  48. package/dist/commands/import/slack.d.ts.map +1 -1
  49. package/dist/commands/import/slack.js +12 -7
  50. package/dist/commands/import/slack.js.map +1 -1
  51. package/dist/commands/import/teams.d.ts.map +1 -1
  52. package/dist/commands/import/teams.js +10 -5
  53. package/dist/commands/import/teams.js.map +1 -1
  54. package/dist/commands/import/zoom.d.ts.map +1 -1
  55. package/dist/commands/import/zoom.js +10 -5
  56. package/dist/commands/import/zoom.js.map +1 -1
  57. package/dist/commands/import.d.ts.map +1 -1
  58. package/dist/commands/import.js +43 -1
  59. package/dist/commands/import.js.map +1 -1
  60. package/dist/commands/invite.d.ts +8 -18
  61. package/dist/commands/invite.d.ts.map +1 -1
  62. package/dist/commands/invite.js +23 -46
  63. package/dist/commands/invite.js.map +1 -1
  64. package/dist/commands/join.d.ts +5 -0
  65. package/dist/commands/join.d.ts.map +1 -0
  66. package/dist/commands/join.js +49 -0
  67. package/dist/commands/join.js.map +1 -0
  68. package/dist/commands/local-relink.d.ts +35 -0
  69. package/dist/commands/local-relink.d.ts.map +1 -0
  70. package/dist/commands/local-relink.js +72 -0
  71. package/dist/commands/local-relink.js.map +1 -0
  72. package/dist/commands/local.d.ts.map +1 -1
  73. package/dist/commands/local.js +113 -4
  74. package/dist/commands/local.js.map +1 -1
  75. package/dist/commands/login.d.ts.map +1 -1
  76. package/dist/commands/login.js +21 -2
  77. package/dist/commands/login.js.map +1 -1
  78. package/dist/commands/mark.d.ts +37 -0
  79. package/dist/commands/mark.d.ts.map +1 -0
  80. package/dist/commands/mark.js +105 -0
  81. package/dist/commands/mark.js.map +1 -0
  82. package/dist/commands/mcp.d.ts +149 -2
  83. package/dist/commands/mcp.d.ts.map +1 -1
  84. package/dist/commands/mcp.js +80 -15
  85. package/dist/commands/mcp.js.map +1 -1
  86. package/dist/commands/registry.d.ts.map +1 -1
  87. package/dist/commands/registry.js +12 -2
  88. package/dist/commands/registry.js.map +1 -1
  89. package/dist/commands/setup.d.ts +39 -0
  90. package/dist/commands/setup.d.ts.map +1 -1
  91. package/dist/commands/setup.js +65 -50
  92. package/dist/commands/setup.js.map +1 -1
  93. package/dist/commands/share.d.ts +7 -0
  94. package/dist/commands/share.d.ts.map +1 -0
  95. package/dist/commands/share.js +129 -0
  96. package/dist/commands/share.js.map +1 -0
  97. package/dist/commands/status.d.ts.map +1 -1
  98. package/dist/commands/status.js +10 -0
  99. package/dist/commands/status.js.map +1 -1
  100. package/dist/commands/sync.d.ts +55 -0
  101. package/dist/commands/sync.d.ts.map +1 -0
  102. package/dist/commands/sync.js +278 -0
  103. package/dist/commands/sync.js.map +1 -0
  104. package/dist/commands/telemetry.d.ts +3 -3
  105. package/dist/commands/telemetry.js +6 -6
  106. package/dist/commands/telemetry.js.map +1 -1
  107. package/dist/commands/why.d.ts.map +1 -1
  108. package/dist/commands/why.js +6 -1
  109. package/dist/commands/why.js.map +1 -1
  110. package/dist/detector/detector-version.d.ts +16 -0
  111. package/dist/detector/detector-version.d.ts.map +1 -0
  112. package/dist/detector/detector-version.js +36 -0
  113. package/dist/detector/detector-version.js.map +1 -0
  114. package/dist/detector/relationship-contract.d.ts +30 -0
  115. package/dist/detector/relationship-contract.d.ts.map +1 -0
  116. package/dist/detector/relationship-contract.js +120 -0
  117. package/dist/detector/relationship-contract.js.map +1 -0
  118. package/dist/detector/relationship-contract.v1.json +53 -0
  119. package/dist/detector/relationship-prompt.d.ts +20 -0
  120. package/dist/detector/relationship-prompt.d.ts.map +1 -0
  121. package/dist/detector/relationship-prompt.js +55 -0
  122. package/dist/detector/relationship-prompt.js.map +1 -0
  123. package/dist/detector/relationship-prompt.v1.json +13 -0
  124. package/dist/detector/resolve-pair.d.ts +39 -0
  125. package/dist/detector/resolve-pair.d.ts.map +1 -0
  126. package/dist/detector/resolve-pair.js +345 -0
  127. package/dist/detector/resolve-pair.js.map +1 -0
  128. package/dist/detector/similar-item.d.ts +20 -0
  129. package/dist/detector/similar-item.d.ts.map +1 -0
  130. package/dist/detector/similar-item.js +16 -0
  131. package/dist/detector/similar-item.js.map +1 -0
  132. package/dist/index.d.ts +2 -0
  133. package/dist/index.d.ts.map +1 -1
  134. package/dist/index.js +31 -11
  135. package/dist/index.js.map +1 -1
  136. package/dist/lib/advisory-dedup.d.ts.map +1 -1
  137. package/dist/lib/advisory-dedup.js +16 -8
  138. package/dist/lib/advisory-dedup.js.map +1 -1
  139. package/dist/lib/advisory-verdict.d.ts +19 -0
  140. package/dist/lib/advisory-verdict.d.ts.map +1 -1
  141. package/dist/lib/advisory-verdict.js +6 -3
  142. package/dist/lib/advisory-verdict.js.map +1 -1
  143. package/dist/lib/backfill-state.d.ts +116 -0
  144. package/dist/lib/backfill-state.d.ts.map +1 -0
  145. package/dist/lib/backfill-state.js +342 -0
  146. package/dist/lib/backfill-state.js.map +1 -0
  147. package/dist/lib/backup-copy.d.ts +17 -0
  148. package/dist/lib/backup-copy.d.ts.map +1 -0
  149. package/dist/lib/backup-copy.js +13 -0
  150. package/dist/lib/backup-copy.js.map +1 -0
  151. package/dist/lib/backup-exclusion.d.ts +10 -0
  152. package/dist/lib/backup-exclusion.d.ts.map +1 -0
  153. package/dist/lib/backup-exclusion.js +58 -0
  154. package/dist/lib/backup-exclusion.js.map +1 -0
  155. package/dist/lib/capture-report.d.ts +22 -18
  156. package/dist/lib/capture-report.d.ts.map +1 -1
  157. package/dist/lib/capture-report.js +64 -2
  158. package/dist/lib/capture-report.js.map +1 -1
  159. package/dist/lib/cli-oauth.d.ts +2 -0
  160. package/dist/lib/cli-oauth.d.ts.map +1 -1
  161. package/dist/lib/cli-oauth.js +61 -10
  162. package/dist/lib/cli-oauth.js.map +1 -1
  163. package/dist/lib/config.d.ts +72 -1
  164. package/dist/lib/config.d.ts.map +1 -1
  165. package/dist/lib/config.js +245 -1
  166. package/dist/lib/config.js.map +1 -1
  167. package/dist/lib/confirm-timeout.d.ts +8 -0
  168. package/dist/lib/confirm-timeout.d.ts.map +1 -0
  169. package/dist/lib/confirm-timeout.js +18 -0
  170. package/dist/lib/confirm-timeout.js.map +1 -0
  171. package/dist/lib/curation/check-marks.d.ts +48 -0
  172. package/dist/lib/curation/check-marks.d.ts.map +1 -0
  173. package/dist/lib/curation/check-marks.js +81 -0
  174. package/dist/lib/curation/check-marks.js.map +1 -0
  175. package/dist/lib/curation/guardrail.d.ts +39 -0
  176. package/dist/lib/curation/guardrail.d.ts.map +1 -0
  177. package/dist/lib/curation/guardrail.js +95 -0
  178. package/dist/lib/curation/guardrail.js.map +1 -0
  179. package/dist/lib/curation/judge.d.ts +3 -0
  180. package/dist/lib/curation/judge.d.ts.map +1 -0
  181. package/dist/lib/curation/judge.js +9 -0
  182. package/dist/lib/curation/judge.js.map +1 -0
  183. package/dist/lib/curation/judgements-db.d.ts +97 -0
  184. package/dist/lib/curation/judgements-db.d.ts.map +1 -0
  185. package/dist/lib/curation/judgements-db.js +206 -0
  186. package/dist/lib/curation/judgements-db.js.map +1 -0
  187. package/dist/lib/curation/last-check.d.ts +32 -0
  188. package/dist/lib/curation/last-check.d.ts.map +1 -0
  189. package/dist/lib/curation/last-check.js +81 -0
  190. package/dist/lib/curation/last-check.js.map +1 -0
  191. package/dist/lib/curation/mark.d.ts +76 -0
  192. package/dist/lib/curation/mark.d.ts.map +1 -0
  193. package/dist/lib/curation/mark.js +361 -0
  194. package/dist/lib/curation/mark.js.map +1 -0
  195. package/dist/lib/curation/text.d.ts +6 -0
  196. package/dist/lib/curation/text.d.ts.map +1 -0
  197. package/dist/lib/curation/text.js +35 -0
  198. package/dist/lib/curation/text.js.map +1 -0
  199. package/dist/lib/destination-name.d.ts +24 -0
  200. package/dist/lib/destination-name.d.ts.map +1 -0
  201. package/dist/lib/destination-name.js +39 -0
  202. package/dist/lib/destination-name.js.map +1 -0
  203. package/dist/lib/destination-summary.d.ts +6 -0
  204. package/dist/lib/destination-summary.d.ts.map +1 -0
  205. package/dist/lib/destination-summary.js +27 -0
  206. package/dist/lib/destination-summary.js.map +1 -0
  207. package/dist/lib/destination-trust.d.ts +54 -0
  208. package/dist/lib/destination-trust.d.ts.map +1 -0
  209. package/dist/lib/destination-trust.js +107 -0
  210. package/dist/lib/destination-trust.js.map +1 -0
  211. package/dist/lib/env-resolver.d.ts.map +1 -1
  212. package/dist/lib/env-resolver.js +3 -0
  213. package/dist/lib/env-resolver.js.map +1 -1
  214. package/dist/lib/fatal.d.ts +11 -0
  215. package/dist/lib/fatal.d.ts.map +1 -0
  216. package/dist/lib/fatal.js +22 -0
  217. package/dist/lib/fatal.js.map +1 -0
  218. package/dist/lib/fetchers/capture.d.ts +49 -2
  219. package/dist/lib/fetchers/capture.d.ts.map +1 -1
  220. package/dist/lib/fetchers/capture.js +7 -1
  221. package/dist/lib/fetchers/capture.js.map +1 -1
  222. package/dist/lib/fetchers/confluence.d.ts +2 -2
  223. package/dist/lib/fetchers/confluence.d.ts.map +1 -1
  224. package/dist/lib/fetchers/confluence.js.map +1 -1
  225. package/dist/lib/fetchers/git.d.ts +1 -0
  226. package/dist/lib/fetchers/git.d.ts.map +1 -1
  227. package/dist/lib/fetchers/git.js +3 -1
  228. package/dist/lib/fetchers/git.js.map +1 -1
  229. package/dist/lib/fetchers/github.d.ts +44 -5
  230. package/dist/lib/fetchers/github.d.ts.map +1 -1
  231. package/dist/lib/fetchers/github.js +122 -5
  232. package/dist/lib/fetchers/github.js.map +1 -1
  233. package/dist/lib/fetchers/gitlab.d.ts +2 -2
  234. package/dist/lib/fetchers/gitlab.d.ts.map +1 -1
  235. package/dist/lib/fetchers/gitlab.js.map +1 -1
  236. package/dist/lib/fetchers/jira.d.ts +2 -2
  237. package/dist/lib/fetchers/jira.d.ts.map +1 -1
  238. package/dist/lib/fetchers/jira.js.map +1 -1
  239. package/dist/lib/fetchers/linear.d.ts +2 -2
  240. package/dist/lib/fetchers/linear.d.ts.map +1 -1
  241. package/dist/lib/fetchers/linear.js.map +1 -1
  242. package/dist/lib/fetchers/notion.d.ts +2 -2
  243. package/dist/lib/fetchers/notion.d.ts.map +1 -1
  244. package/dist/lib/fetchers/notion.js.map +1 -1
  245. package/dist/lib/fetchers/slack.d.ts +2 -3
  246. package/dist/lib/fetchers/slack.d.ts.map +1 -1
  247. package/dist/lib/fetchers/slack.js.map +1 -1
  248. package/dist/lib/fetchers/teams.d.ts +2 -2
  249. package/dist/lib/fetchers/teams.d.ts.map +1 -1
  250. package/dist/lib/fetchers/teams.js.map +1 -1
  251. package/dist/lib/fetchers/zoom.d.ts +2 -2
  252. package/dist/lib/fetchers/zoom.d.ts.map +1 -1
  253. package/dist/lib/fetchers/zoom.js.map +1 -1
  254. package/dist/lib/gateway-client.d.ts +40 -14
  255. package/dist/lib/gateway-client.d.ts.map +1 -1
  256. package/dist/lib/gateway-client.js +47 -19
  257. package/dist/lib/gateway-client.js.map +1 -1
  258. package/dist/lib/github-text.d.ts +3 -0
  259. package/dist/lib/github-text.d.ts.map +1 -0
  260. package/dist/lib/github-text.js +18 -0
  261. package/dist/lib/github-text.js.map +1 -0
  262. package/dist/lib/hook-context.d.ts +10 -0
  263. package/dist/lib/hook-context.d.ts.map +1 -1
  264. package/dist/lib/hook-context.js +14 -0
  265. package/dist/lib/hook-context.js.map +1 -1
  266. package/dist/lib/import-defaults.d.ts +39 -23
  267. package/dist/lib/import-defaults.d.ts.map +1 -1
  268. package/dist/lib/import-defaults.js +28 -26
  269. package/dist/lib/import-defaults.js.map +1 -1
  270. package/dist/lib/invite-prompt.d.ts +4 -4
  271. package/dist/lib/invite-prompt.d.ts.map +1 -1
  272. package/dist/lib/invite-prompt.js +4 -4
  273. package/dist/lib/invite-prompt.js.map +1 -1
  274. package/dist/lib/invite-settings.d.ts +18 -0
  275. package/dist/lib/invite-settings.d.ts.map +1 -0
  276. package/dist/lib/invite-settings.js +29 -0
  277. package/dist/lib/invite-settings.js.map +1 -0
  278. package/dist/lib/join-flow.d.ts +60 -0
  279. package/dist/lib/join-flow.d.ts.map +1 -0
  280. package/dist/lib/join-flow.js +282 -0
  281. package/dist/lib/join-flow.js.map +1 -0
  282. package/dist/lib/launch/adapters/aider.d.ts +17 -0
  283. package/dist/lib/launch/adapters/aider.d.ts.map +1 -0
  284. package/dist/lib/launch/adapters/aider.js +30 -0
  285. package/dist/lib/launch/adapters/aider.js.map +1 -0
  286. package/dist/lib/launch/adapters/auggie.d.ts +18 -0
  287. package/dist/lib/launch/adapters/auggie.d.ts.map +1 -0
  288. package/dist/lib/launch/adapters/auggie.js +34 -0
  289. package/dist/lib/launch/adapters/auggie.js.map +1 -0
  290. package/dist/lib/launch/adapters/cline.d.ts +10 -0
  291. package/dist/lib/launch/adapters/cline.d.ts.map +1 -0
  292. package/dist/lib/launch/adapters/cline.js +41 -0
  293. package/dist/lib/launch/adapters/cline.js.map +1 -0
  294. package/dist/lib/launch/adapters/continue.d.ts +22 -0
  295. package/dist/lib/launch/adapters/continue.d.ts.map +1 -0
  296. package/dist/lib/launch/adapters/continue.js +46 -0
  297. package/dist/lib/launch/adapters/continue.js.map +1 -0
  298. package/dist/lib/launch/adapters/gemini-cli.d.ts +13 -14
  299. package/dist/lib/launch/adapters/gemini-cli.d.ts.map +1 -1
  300. package/dist/lib/launch/adapters/gemini-cli.js +38 -53
  301. package/dist/lib/launch/adapters/gemini-cli.js.map +1 -1
  302. package/dist/lib/launch/adapters/goose.d.ts +20 -0
  303. package/dist/lib/launch/adapters/goose.d.ts.map +1 -0
  304. package/dist/lib/launch/adapters/goose.js +47 -0
  305. package/dist/lib/launch/adapters/goose.js.map +1 -0
  306. package/dist/lib/launch/adapters/notes.d.ts +7 -0
  307. package/dist/lib/launch/adapters/notes.d.ts.map +1 -0
  308. package/dist/lib/launch/adapters/notes.js +5 -0
  309. package/dist/lib/launch/adapters/notes.js.map +1 -0
  310. package/dist/lib/launch/agents.d.ts +2 -0
  311. package/dist/lib/launch/agents.d.ts.map +1 -1
  312. package/dist/lib/launch/agents.js +3 -1
  313. package/dist/lib/launch/agents.js.map +1 -1
  314. package/dist/lib/launch/auggie-state.d.ts +25 -0
  315. package/dist/lib/launch/auggie-state.d.ts.map +1 -0
  316. package/dist/lib/launch/auggie-state.js +74 -0
  317. package/dist/lib/launch/auggie-state.js.map +1 -0
  318. package/dist/lib/launch/cline-state.d.ts +32 -0
  319. package/dist/lib/launch/cline-state.d.ts.map +1 -0
  320. package/dist/lib/launch/cline-state.js +108 -0
  321. package/dist/lib/launch/cline-state.js.map +1 -0
  322. package/dist/lib/launch/config-writes.d.ts +4 -0
  323. package/dist/lib/launch/config-writes.d.ts.map +1 -1
  324. package/dist/lib/launch/config-writes.js +8 -3
  325. package/dist/lib/launch/config-writes.js.map +1 -1
  326. package/dist/lib/launch/continue-state.d.ts +41 -0
  327. package/dist/lib/launch/continue-state.d.ts.map +1 -0
  328. package/dist/lib/launch/continue-state.js +142 -0
  329. package/dist/lib/launch/continue-state.js.map +1 -0
  330. package/dist/lib/launch/detect.d.ts.map +1 -1
  331. package/dist/lib/launch/detect.js +3 -1
  332. package/dist/lib/launch/detect.js.map +1 -1
  333. package/dist/lib/launch/gemini-state.d.ts +26 -20
  334. package/dist/lib/launch/gemini-state.d.ts.map +1 -1
  335. package/dist/lib/launch/gemini-state.js +95 -37
  336. package/dist/lib/launch/gemini-state.js.map +1 -1
  337. package/dist/lib/launch/gemini-system-file.d.ts +17 -0
  338. package/dist/lib/launch/gemini-system-file.d.ts.map +1 -0
  339. package/dist/lib/launch/gemini-system-file.js +55 -0
  340. package/dist/lib/launch/gemini-system-file.js.map +1 -0
  341. package/dist/lib/launch/gemini-trust.d.ts +3 -1
  342. package/dist/lib/launch/gemini-trust.d.ts.map +1 -1
  343. package/dist/lib/launch/gemini-trust.js +10 -3
  344. package/dist/lib/launch/gemini-trust.js.map +1 -1
  345. package/dist/lib/launch/goose-state.d.ts +53 -0
  346. package/dist/lib/launch/goose-state.d.ts.map +1 -0
  347. package/dist/lib/launch/goose-state.js +137 -0
  348. package/dist/lib/launch/goose-state.js.map +1 -0
  349. package/dist/lib/launch/launch-files.d.ts.map +1 -1
  350. package/dist/lib/launch/launch-files.js +3 -2
  351. package/dist/lib/launch/launch-files.js.map +1 -1
  352. package/dist/lib/launch/launch.d.ts +17 -2
  353. package/dist/lib/launch/launch.d.ts.map +1 -1
  354. package/dist/lib/launch/launch.js +36 -3
  355. package/dist/lib/launch/launch.js.map +1 -1
  356. package/dist/lib/launch/mcp-child-env.d.ts +30 -0
  357. package/dist/lib/launch/mcp-child-env.d.ts.map +1 -0
  358. package/dist/lib/launch/mcp-child-env.js +154 -0
  359. package/dist/lib/launch/mcp-child-env.js.map +1 -0
  360. package/dist/lib/launch/pick-agent.d.ts.map +1 -1
  361. package/dist/lib/launch/pick-agent.js +4 -4
  362. package/dist/lib/launch/pick-agent.js.map +1 -1
  363. package/dist/lib/launch/picker-options.d.ts.map +1 -1
  364. package/dist/lib/launch/picker-options.js +7 -2
  365. package/dist/lib/launch/picker-options.js.map +1 -1
  366. package/dist/lib/launch/registry/agents/aider.d.ts +3 -0
  367. package/dist/lib/launch/registry/agents/aider.d.ts.map +1 -0
  368. package/dist/lib/launch/registry/agents/aider.js +13 -0
  369. package/dist/lib/launch/registry/agents/aider.js.map +1 -0
  370. package/dist/lib/launch/registry/agents/auggie.d.ts +3 -0
  371. package/dist/lib/launch/registry/agents/auggie.d.ts.map +1 -0
  372. package/dist/lib/launch/registry/agents/auggie.js +11 -0
  373. package/dist/lib/launch/registry/agents/auggie.js.map +1 -0
  374. package/dist/lib/launch/registry/agents/cline.d.ts +3 -0
  375. package/dist/lib/launch/registry/agents/cline.d.ts.map +1 -0
  376. package/dist/lib/launch/registry/agents/cline.js +19 -0
  377. package/dist/lib/launch/registry/agents/cline.js.map +1 -0
  378. package/dist/lib/launch/registry/agents/continue.d.ts +3 -0
  379. package/dist/lib/launch/registry/agents/continue.d.ts.map +1 -0
  380. package/dist/lib/launch/registry/agents/continue.js +20 -0
  381. package/dist/lib/launch/registry/agents/continue.js.map +1 -0
  382. package/dist/lib/launch/registry/agents/gemini-cli.js +2 -2
  383. package/dist/lib/launch/registry/agents/gemini-cli.js.map +1 -1
  384. package/dist/lib/launch/registry/agents/goose.d.ts +3 -0
  385. package/dist/lib/launch/registry/agents/goose.d.ts.map +1 -0
  386. package/dist/lib/launch/registry/agents/goose.js +20 -0
  387. package/dist/lib/launch/registry/agents/goose.js.map +1 -0
  388. package/dist/lib/launch/registry/index.d.ts +1 -1
  389. package/dist/lib/launch/registry/index.d.ts.map +1 -1
  390. package/dist/lib/launch/registry/index.js +7 -2
  391. package/dist/lib/launch/registry/index.js.map +1 -1
  392. package/dist/lib/launch/registry/types.d.ts +12 -1
  393. package/dist/lib/launch/registry/types.d.ts.map +1 -1
  394. package/dist/lib/launch/strict-entry.d.ts +22 -2
  395. package/dist/lib/launch/strict-entry.d.ts.map +1 -1
  396. package/dist/lib/launch/strict-entry.js +80 -2
  397. package/dist/lib/launch/strict-entry.js.map +1 -1
  398. package/dist/lib/launch/yaml-scan.d.ts +59 -0
  399. package/dist/lib/launch/yaml-scan.d.ts.map +1 -0
  400. package/dist/lib/launch/yaml-scan.js +275 -0
  401. package/dist/lib/launch/yaml-scan.js.map +1 -0
  402. package/dist/lib/lead-prompt.d.ts +106 -0
  403. package/dist/lib/lead-prompt.d.ts.map +1 -0
  404. package/dist/lib/lead-prompt.js +175 -0
  405. package/dist/lib/lead-prompt.js.map +1 -0
  406. package/dist/lib/local-candidate-classify.d.ts +26 -0
  407. package/dist/lib/local-candidate-classify.d.ts.map +1 -0
  408. package/dist/lib/local-candidate-classify.js +53 -0
  409. package/dist/lib/local-candidate-classify.js.map +1 -0
  410. package/dist/lib/local-db-epoch.d.ts +4 -0
  411. package/dist/lib/local-db-epoch.d.ts.map +1 -0
  412. package/dist/lib/local-db-epoch.js +19 -0
  413. package/dist/lib/local-db-epoch.js.map +1 -0
  414. package/dist/lib/local-db-migrate.d.ts +85 -0
  415. package/dist/lib/local-db-migrate.d.ts.map +1 -0
  416. package/dist/lib/local-db-migrate.js +528 -0
  417. package/dist/lib/local-db-migrate.js.map +1 -0
  418. package/dist/lib/local-db-v10.d.ts +28 -0
  419. package/dist/lib/local-db-v10.d.ts.map +1 -0
  420. package/dist/lib/local-db-v10.js +49 -0
  421. package/dist/lib/local-db-v10.js.map +1 -0
  422. package/dist/lib/local-db-v11.d.ts +24 -0
  423. package/dist/lib/local-db-v11.d.ts.map +1 -0
  424. package/dist/lib/local-db-v11.js +25 -0
  425. package/dist/lib/local-db-v11.js.map +1 -0
  426. package/dist/lib/local-db-v12.d.ts +17 -0
  427. package/dist/lib/local-db-v12.d.ts.map +1 -0
  428. package/dist/lib/local-db-v12.js +8 -0
  429. package/dist/lib/local-db-v12.js.map +1 -0
  430. package/dist/lib/local-db-v7.d.ts +30 -0
  431. package/dist/lib/local-db-v7.d.ts.map +1 -0
  432. package/dist/lib/local-db-v7.js +285 -0
  433. package/dist/lib/local-db-v7.js.map +1 -0
  434. package/dist/lib/local-db-v8.d.ts +22 -0
  435. package/dist/lib/local-db-v8.d.ts.map +1 -0
  436. package/dist/lib/local-db-v8.js +33 -0
  437. package/dist/lib/local-db-v8.js.map +1 -0
  438. package/dist/lib/local-db-v9.d.ts +10 -0
  439. package/dist/lib/local-db-v9.d.ts.map +1 -0
  440. package/dist/lib/local-db-v9.js +8 -0
  441. package/dist/lib/local-db-v9.js.map +1 -0
  442. package/dist/lib/local-db.d.ts +73 -23
  443. package/dist/lib/local-db.d.ts.map +1 -1
  444. package/dist/lib/local-db.js +225 -375
  445. package/dist/lib/local-db.js.map +1 -1
  446. package/dist/lib/local-embeddings.d.ts.map +1 -1
  447. package/dist/lib/local-embeddings.js +2 -2
  448. package/dist/lib/local-embeddings.js.map +1 -1
  449. package/dist/lib/local-gateway-client.d.ts +31 -87
  450. package/dist/lib/local-gateway-client.d.ts.map +1 -1
  451. package/dist/lib/local-gateway-client.js +209 -187
  452. package/dist/lib/local-gateway-client.js.map +1 -1
  453. package/dist/lib/local-ingest.d.ts +131 -0
  454. package/dist/lib/local-ingest.d.ts.map +1 -0
  455. package/dist/lib/local-ingest.js +81 -0
  456. package/dist/lib/local-ingest.js.map +1 -0
  457. package/dist/lib/local-link-pass.d.ts +15 -0
  458. package/dist/lib/local-link-pass.d.ts.map +1 -0
  459. package/dist/lib/local-link-pass.js +57 -0
  460. package/dist/lib/local-link-pass.js.map +1 -0
  461. package/dist/lib/local-llm.d.ts +1 -1
  462. package/dist/lib/local-llm.d.ts.map +1 -1
  463. package/dist/lib/local-llm.js +3 -2
  464. package/dist/lib/local-llm.js.map +1 -1
  465. package/dist/lib/local-mode.d.ts +9 -2
  466. package/dist/lib/local-mode.d.ts.map +1 -1
  467. package/dist/lib/local-mode.js +27 -7
  468. package/dist/lib/local-mode.js.map +1 -1
  469. package/dist/lib/local-provenance.d.ts +14 -0
  470. package/dist/lib/local-provenance.d.ts.map +1 -0
  471. package/dist/lib/local-provenance.js +14 -0
  472. package/dist/lib/local-provenance.js.map +1 -0
  473. package/dist/lib/local-relationship-classifier.d.ts +4 -0
  474. package/dist/lib/local-relationship-classifier.d.ts.map +1 -1
  475. package/dist/lib/local-relationship-classifier.js +9 -4
  476. package/dist/lib/local-relationship-classifier.js.map +1 -1
  477. package/dist/lib/local-relink.d.ts +59 -0
  478. package/dist/lib/local-relink.d.ts.map +1 -0
  479. package/dist/lib/local-relink.js +171 -0
  480. package/dist/lib/local-relink.js.map +1 -0
  481. package/dist/lib/local-set-classifier.d.ts +36 -0
  482. package/dist/lib/local-set-classifier.d.ts.map +1 -0
  483. package/dist/lib/local-set-classifier.js +81 -0
  484. package/dist/lib/local-set-classifier.js.map +1 -0
  485. package/dist/lib/local-snapshot-loader.d.ts +29 -0
  486. package/dist/lib/local-snapshot-loader.d.ts.map +1 -0
  487. package/dist/lib/local-snapshot-loader.js +108 -0
  488. package/dist/lib/local-snapshot-loader.js.map +1 -0
  489. package/dist/lib/local-thresholds.d.ts +70 -0
  490. package/dist/lib/local-thresholds.d.ts.map +1 -0
  491. package/dist/lib/local-thresholds.js +79 -0
  492. package/dist/lib/local-thresholds.js.map +1 -0
  493. package/dist/lib/login-flow.d.ts +15 -0
  494. package/dist/lib/login-flow.d.ts.map +1 -1
  495. package/dist/lib/login-flow.js +80 -4
  496. package/dist/lib/login-flow.js.map +1 -1
  497. package/dist/lib/mcp/mark-tool.d.ts +27 -0
  498. package/dist/lib/mcp/mark-tool.d.ts.map +1 -0
  499. package/dist/lib/mcp/mark-tool.js +103 -0
  500. package/dist/lib/mcp/mark-tool.js.map +1 -0
  501. package/dist/lib/mcp/share-status-tool.d.ts +13 -0
  502. package/dist/lib/mcp/share-status-tool.d.ts.map +1 -0
  503. package/dist/lib/mcp/share-status-tool.js +116 -0
  504. package/dist/lib/mcp/share-status-tool.js.map +1 -0
  505. package/dist/lib/mcp/share-tool.d.ts +50 -0
  506. package/dist/lib/mcp/share-tool.d.ts.map +1 -0
  507. package/dist/lib/mcp/share-tool.js +174 -0
  508. package/dist/lib/mcp/share-tool.js.map +1 -0
  509. package/dist/lib/mcp/tool-rules.d.ts +30 -0
  510. package/dist/lib/mcp/tool-rules.d.ts.map +1 -0
  511. package/dist/lib/mcp/tool-rules.js +84 -0
  512. package/dist/lib/mcp/tool-rules.js.map +1 -0
  513. package/dist/lib/mcp-backfill.d.ts +89 -0
  514. package/dist/lib/mcp-backfill.d.ts.map +1 -0
  515. package/dist/lib/mcp-backfill.js +194 -0
  516. package/dist/lib/mcp-backfill.js.map +1 -0
  517. package/dist/lib/mcp-scope.d.ts +90 -0
  518. package/dist/lib/mcp-scope.d.ts.map +1 -0
  519. package/dist/lib/mcp-scope.js +125 -0
  520. package/dist/lib/mcp-scope.js.map +1 -0
  521. package/dist/lib/mcp-sync.d.ts +64 -0
  522. package/dist/lib/mcp-sync.d.ts.map +1 -0
  523. package/dist/lib/mcp-sync.js +183 -0
  524. package/dist/lib/mcp-sync.js.map +1 -0
  525. package/dist/lib/model-cache.d.ts +10 -0
  526. package/dist/lib/model-cache.d.ts.map +1 -0
  527. package/dist/lib/model-cache.js +35 -0
  528. package/dist/lib/model-cache.js.map +1 -0
  529. package/dist/lib/next-step.d.ts.map +1 -1
  530. package/dist/lib/next-step.js +2 -1
  531. package/dist/lib/next-step.js.map +1 -1
  532. package/dist/lib/personal-import.d.ts +7 -0
  533. package/dist/lib/personal-import.d.ts.map +1 -1
  534. package/dist/lib/personal-import.js +13 -1
  535. package/dist/lib/personal-import.js.map +1 -1
  536. package/dist/lib/private-files.d.ts +33 -0
  537. package/dist/lib/private-files.d.ts.map +1 -0
  538. package/dist/lib/private-files.js +96 -0
  539. package/dist/lib/private-files.js.map +1 -0
  540. package/dist/lib/redaction-notice.d.ts +7 -0
  541. package/dist/lib/redaction-notice.d.ts.map +1 -0
  542. package/dist/lib/redaction-notice.js +32 -0
  543. package/dist/lib/redaction-notice.js.map +1 -0
  544. package/dist/lib/relink-estimate.d.ts +16 -0
  545. package/dist/lib/relink-estimate.d.ts.map +1 -0
  546. package/dist/lib/relink-estimate.js +30 -0
  547. package/dist/lib/relink-estimate.js.map +1 -0
  548. package/dist/lib/resolve-env.d.ts +15 -1
  549. package/dist/lib/resolve-env.d.ts.map +1 -1
  550. package/dist/lib/resolve-env.js +27 -7
  551. package/dist/lib/resolve-env.js.map +1 -1
  552. package/dist/lib/safe-config-write.d.ts.map +1 -1
  553. package/dist/lib/safe-config-write.js +39 -2
  554. package/dist/lib/safe-config-write.js.map +1 -1
  555. package/dist/lib/scope-choices.d.ts +51 -0
  556. package/dist/lib/scope-choices.d.ts.map +1 -0
  557. package/dist/lib/scope-choices.js +193 -0
  558. package/dist/lib/scope-choices.js.map +1 -0
  559. package/dist/lib/scope-connect.d.ts +82 -0
  560. package/dist/lib/scope-connect.d.ts.map +1 -0
  561. package/dist/lib/scope-connect.js +258 -0
  562. package/dist/lib/scope-connect.js.map +1 -0
  563. package/dist/lib/scope-defaults.d.ts +3 -0
  564. package/dist/lib/scope-defaults.d.ts.map +1 -0
  565. package/dist/lib/scope-defaults.js +44 -0
  566. package/dist/lib/scope-defaults.js.map +1 -0
  567. package/dist/lib/scope-real.d.ts +280 -0
  568. package/dist/lib/scope-real.d.ts.map +1 -0
  569. package/dist/lib/scope-real.js +58 -0
  570. package/dist/lib/scope-real.js.map +1 -0
  571. package/dist/lib/scope-values.d.ts +76 -0
  572. package/dist/lib/scope-values.d.ts.map +1 -0
  573. package/dist/lib/scope-values.js +169 -0
  574. package/dist/lib/scope-values.js.map +1 -0
  575. package/dist/lib/scope.d.ts +161 -0
  576. package/dist/lib/scope.d.ts.map +1 -0
  577. package/dist/lib/scope.js +323 -0
  578. package/dist/lib/scope.js.map +1 -0
  579. package/dist/lib/setup-route.d.ts +4 -2
  580. package/dist/lib/setup-route.d.ts.map +1 -1
  581. package/dist/lib/setup-route.js +12 -6
  582. package/dist/lib/setup-route.js.map +1 -1
  583. package/dist/lib/share/approval.d.ts +71 -0
  584. package/dist/lib/share/approval.d.ts.map +1 -0
  585. package/dist/lib/share/approval.js +139 -0
  586. package/dist/lib/share/approval.js.map +1 -0
  587. package/dist/lib/share/approve-link.d.ts +31 -0
  588. package/dist/lib/share/approve-link.d.ts.map +1 -0
  589. package/dist/lib/share/approve-link.js +46 -0
  590. package/dist/lib/share/approve-link.js.map +1 -0
  591. package/dist/lib/share/browser-flow.d.ts +85 -0
  592. package/dist/lib/share/browser-flow.d.ts.map +1 -0
  593. package/dist/lib/share/browser-flow.js +168 -0
  594. package/dist/lib/share/browser-flow.js.map +1 -0
  595. package/dist/lib/share/command.d.ts +65 -0
  596. package/dist/lib/share/command.d.ts.map +1 -0
  597. package/dist/lib/share/command.js +278 -0
  598. package/dist/lib/share/command.js.map +1 -0
  599. package/dist/lib/share/delivery-options.d.ts +15 -0
  600. package/dist/lib/share/delivery-options.d.ts.map +1 -0
  601. package/dist/lib/share/delivery-options.js +16 -0
  602. package/dist/lib/share/delivery-options.js.map +1 -0
  603. package/dist/lib/share/delivery.d.ts +83 -0
  604. package/dist/lib/share/delivery.d.ts.map +1 -0
  605. package/dist/lib/share/delivery.js +134 -0
  606. package/dist/lib/share/delivery.js.map +1 -0
  607. package/dist/lib/share/envelope.d.ts +61 -0
  608. package/dist/lib/share/envelope.d.ts.map +1 -0
  609. package/dist/lib/share/envelope.js +99 -0
  610. package/dist/lib/share/envelope.js.map +1 -0
  611. package/dist/lib/share/ledger.d.ts +59 -0
  612. package/dist/lib/share/ledger.d.ts.map +1 -0
  613. package/dist/lib/share/ledger.js +137 -0
  614. package/dist/lib/share/ledger.js.map +1 -0
  615. package/dist/lib/share/payload.d.ts +101 -0
  616. package/dist/lib/share/payload.d.ts.map +1 -0
  617. package/dist/lib/share/payload.js +147 -0
  618. package/dist/lib/share/payload.js.map +1 -0
  619. package/dist/lib/share/pending.d.ts +94 -0
  620. package/dist/lib/share/pending.d.ts.map +1 -0
  621. package/dist/lib/share/pending.js +256 -0
  622. package/dist/lib/share/pending.js.map +1 -0
  623. package/dist/lib/share/preview.d.ts +22 -0
  624. package/dist/lib/share/preview.d.ts.map +1 -0
  625. package/dist/lib/share/preview.js +74 -0
  626. package/dist/lib/share/preview.js.map +1 -0
  627. package/dist/lib/share/qr.d.ts +13 -0
  628. package/dist/lib/share/qr.d.ts.map +1 -0
  629. package/dist/lib/share/qr.js +77 -0
  630. package/dist/lib/share/qr.js.map +1 -0
  631. package/dist/lib/share/requests-client.d.ts +63 -0
  632. package/dist/lib/share/requests-client.d.ts.map +1 -0
  633. package/dist/lib/share/requests-client.js +69 -0
  634. package/dist/lib/share/requests-client.js.map +1 -0
  635. package/dist/lib/share/run.d.ts +134 -0
  636. package/dist/lib/share/run.d.ts.map +1 -0
  637. package/dist/lib/share/run.js +278 -0
  638. package/dist/lib/share/run.js.map +1 -0
  639. package/dist/lib/share/salt.d.ts +2 -0
  640. package/dist/lib/share/salt.d.ts.map +1 -0
  641. package/dist/lib/share/salt.js +44 -0
  642. package/dist/lib/share/salt.js.map +1 -0
  643. package/dist/lib/share/secret-patterns.json +100 -0
  644. package/dist/lib/share/secret-scan.d.ts +24 -0
  645. package/dist/lib/share/secret-scan.d.ts.map +1 -0
  646. package/dist/lib/share/secret-scan.js +116 -0
  647. package/dist/lib/share/secret-scan.js.map +1 -0
  648. package/dist/lib/share/target.d.ts +38 -0
  649. package/dist/lib/share/target.d.ts.map +1 -0
  650. package/dist/lib/share/target.js +80 -0
  651. package/dist/lib/share/target.js.map +1 -0
  652. package/dist/lib/share/tty.d.ts +12 -0
  653. package/dist/lib/share/tty.d.ts.map +1 -0
  654. package/dist/lib/share/tty.js +102 -0
  655. package/dist/lib/share/tty.js.map +1 -0
  656. package/dist/lib/share/visible.d.ts +4 -0
  657. package/dist/lib/share/visible.d.ts.map +1 -0
  658. package/dist/lib/share/visible.js +30 -0
  659. package/dist/lib/share/visible.js.map +1 -0
  660. package/dist/lib/share/wire.d.ts +98 -0
  661. package/dist/lib/share/wire.d.ts.map +1 -0
  662. package/dist/lib/share/wire.js +43 -0
  663. package/dist/lib/share/wire.js.map +1 -0
  664. package/dist/lib/similarity/embedding-matrix.d.ts +64 -0
  665. package/dist/lib/similarity/embedding-matrix.d.ts.map +1 -0
  666. package/dist/lib/similarity/embedding-matrix.js +119 -0
  667. package/dist/lib/similarity/embedding-matrix.js.map +1 -0
  668. package/dist/lib/since-flag.d.ts +11 -0
  669. package/dist/lib/since-flag.d.ts.map +1 -0
  670. package/dist/lib/since-flag.js +24 -0
  671. package/dist/lib/since-flag.js.map +1 -0
  672. package/dist/lib/since.d.ts +59 -0
  673. package/dist/lib/since.d.ts.map +1 -0
  674. package/dist/lib/since.js +86 -0
  675. package/dist/lib/since.js.map +1 -0
  676. package/dist/lib/source-key.d.ts +13 -0
  677. package/dist/lib/source-key.d.ts.map +1 -0
  678. package/dist/lib/source-key.js +60 -0
  679. package/dist/lib/source-key.js.map +1 -0
  680. package/dist/lib/source-sync-state.d.ts +12 -0
  681. package/dist/lib/source-sync-state.d.ts.map +1 -0
  682. package/dist/lib/source-sync-state.js +45 -0
  683. package/dist/lib/source-sync-state.js.map +1 -0
  684. package/dist/lib/startup-backfill-track.d.ts +2 -0
  685. package/dist/lib/startup-backfill-track.d.ts.map +1 -0
  686. package/dist/lib/startup-backfill-track.js +6 -0
  687. package/dist/lib/startup-backfill-track.js.map +1 -0
  688. package/dist/lib/startup-xdg.d.ts +2 -0
  689. package/dist/lib/startup-xdg.d.ts.map +1 -0
  690. package/dist/lib/startup-xdg.js +9 -0
  691. package/dist/lib/startup-xdg.js.map +1 -0
  692. package/dist/lib/sync/after-connect.d.ts +2 -0
  693. package/dist/lib/sync/after-connect.d.ts.map +1 -0
  694. package/dist/lib/sync/after-connect.js +18 -0
  695. package/dist/lib/sync/after-connect.js.map +1 -0
  696. package/dist/lib/sync/bg-claim.d.ts +14 -0
  697. package/dist/lib/sync/bg-claim.d.ts.map +1 -0
  698. package/dist/lib/sync/bg-claim.js +97 -0
  699. package/dist/lib/sync/bg-claim.js.map +1 -0
  700. package/dist/lib/sync/blocked.d.ts +8 -0
  701. package/dist/lib/sync/blocked.d.ts.map +1 -0
  702. package/dist/lib/sync/blocked.js +45 -0
  703. package/dist/lib/sync/blocked.js.map +1 -0
  704. package/dist/lib/sync/classify.d.ts +34 -0
  705. package/dist/lib/sync/classify.d.ts.map +1 -0
  706. package/dist/lib/sync/classify.js +93 -0
  707. package/dist/lib/sync/classify.js.map +1 -0
  708. package/dist/lib/sync/drain.d.ts +16 -0
  709. package/dist/lib/sync/drain.d.ts.map +1 -0
  710. package/dist/lib/sync/drain.js +33 -0
  711. package/dist/lib/sync/drain.js.map +1 -0
  712. package/dist/lib/sync/forget.d.ts +12 -0
  713. package/dist/lib/sync/forget.d.ts.map +1 -0
  714. package/dist/lib/sync/forget.js +32 -0
  715. package/dist/lib/sync/forget.js.map +1 -0
  716. package/dist/lib/sync/launch-hook.d.ts +42 -0
  717. package/dist/lib/sync/launch-hook.d.ts.map +1 -0
  718. package/dist/lib/sync/launch-hook.js +117 -0
  719. package/dist/lib/sync/launch-hook.js.map +1 -0
  720. package/dist/lib/sync/lock.d.ts +35 -0
  721. package/dist/lib/sync/lock.d.ts.map +1 -0
  722. package/dist/lib/sync/lock.js +175 -0
  723. package/dist/lib/sync/lock.js.map +1 -0
  724. package/dist/lib/sync/purge.d.ts +38 -0
  725. package/dist/lib/sync/purge.d.ts.map +1 -0
  726. package/dist/lib/sync/purge.js +61 -0
  727. package/dist/lib/sync/purge.js.map +1 -0
  728. package/dist/lib/sync/real-env.d.ts +265 -0
  729. package/dist/lib/sync/real-env.d.ts.map +1 -0
  730. package/dist/lib/sync/real-env.js +47 -0
  731. package/dist/lib/sync/real-env.js.map +1 -0
  732. package/dist/lib/sync/relink.d.ts +14 -0
  733. package/dist/lib/sync/relink.d.ts.map +1 -0
  734. package/dist/lib/sync/relink.js +36 -0
  735. package/dist/lib/sync/relink.js.map +1 -0
  736. package/dist/lib/sync/report.d.ts +3 -0
  737. package/dist/lib/sync/report.d.ts.map +1 -0
  738. package/dist/lib/sync/report.js +54 -0
  739. package/dist/lib/sync/report.js.map +1 -0
  740. package/dist/lib/sync/run-all.d.ts +23 -0
  741. package/dist/lib/sync/run-all.d.ts.map +1 -0
  742. package/dist/lib/sync/run-all.js +30 -0
  743. package/dist/lib/sync/run-all.js.map +1 -0
  744. package/dist/lib/sync/run-source.d.ts +73 -0
  745. package/dist/lib/sync/run-source.d.ts.map +1 -0
  746. package/dist/lib/sync/run-source.js +262 -0
  747. package/dist/lib/sync/run-source.js.map +1 -0
  748. package/dist/lib/sync/safe-read.d.ts +4 -0
  749. package/dist/lib/sync/safe-read.d.ts.map +1 -0
  750. package/dist/lib/sync/safe-read.js +40 -0
  751. package/dist/lib/sync/safe-read.js.map +1 -0
  752. package/dist/lib/sync/should-background-sync.d.ts +31 -0
  753. package/dist/lib/sync/should-background-sync.d.ts.map +1 -0
  754. package/dist/lib/sync/should-background-sync.js +69 -0
  755. package/dist/lib/sync/should-background-sync.js.map +1 -0
  756. package/dist/lib/sync/source-ids.d.ts +10 -0
  757. package/dist/lib/sync/source-ids.d.ts.map +1 -0
  758. package/dist/lib/sync/source-ids.js +9 -0
  759. package/dist/lib/sync/source-ids.js.map +1 -0
  760. package/dist/lib/sync/sources.d.ts +33 -0
  761. package/dist/lib/sync/sources.d.ts.map +1 -0
  762. package/dist/lib/sync/sources.js +37 -0
  763. package/dist/lib/sync/sources.js.map +1 -0
  764. package/dist/lib/sync/spawn-background.d.ts +27 -0
  765. package/dist/lib/sync/spawn-background.d.ts.map +1 -0
  766. package/dist/lib/sync/spawn-background.js +66 -0
  767. package/dist/lib/sync/spawn-background.js.map +1 -0
  768. package/dist/lib/sync/status.d.ts +57 -0
  769. package/dist/lib/sync/status.d.ts.map +1 -0
  770. package/dist/lib/sync/status.js +166 -0
  771. package/dist/lib/sync/status.js.map +1 -0
  772. package/dist/lib/sync/summary-read.d.ts +19 -0
  773. package/dist/lib/sync/summary-read.d.ts.map +1 -0
  774. package/dist/lib/sync/summary-read.js +39 -0
  775. package/dist/lib/sync/summary-read.js.map +1 -0
  776. package/dist/lib/sync/summary.d.ts +10 -0
  777. package/dist/lib/sync/summary.d.ts.map +1 -0
  778. package/dist/lib/sync/summary.js +80 -0
  779. package/dist/lib/sync/summary.js.map +1 -0
  780. package/dist/lib/sync/sync-state.d.ts +128 -0
  781. package/dist/lib/sync/sync-state.d.ts.map +1 -0
  782. package/dist/lib/sync/sync-state.js +255 -0
  783. package/dist/lib/sync/sync-state.js.map +1 -0
  784. package/dist/lib/sync/telemetry.d.ts +20 -0
  785. package/dist/lib/sync/telemetry.d.ts.map +1 -0
  786. package/dist/lib/sync/telemetry.js +31 -0
  787. package/dist/lib/sync/telemetry.js.map +1 -0
  788. package/dist/lib/sync/threads.d.ts +48 -0
  789. package/dist/lib/sync/threads.d.ts.map +1 -0
  790. package/dist/lib/sync/threads.js +82 -0
  791. package/dist/lib/sync/threads.js.map +1 -0
  792. package/dist/lib/sync/window.d.ts +72 -0
  793. package/dist/lib/sync/window.d.ts.map +1 -0
  794. package/dist/lib/sync/window.js +112 -0
  795. package/dist/lib/sync/window.js.map +1 -0
  796. package/dist/lib/team-cta.d.ts +11 -0
  797. package/dist/lib/team-cta.d.ts.map +1 -0
  798. package/dist/lib/team-cta.js +16 -0
  799. package/dist/lib/team-cta.js.map +1 -0
  800. package/dist/lib/telemetry-ci.d.ts +2 -0
  801. package/dist/lib/telemetry-ci.d.ts.map +1 -0
  802. package/dist/lib/telemetry-ci.js +21 -0
  803. package/dist/lib/telemetry-ci.js.map +1 -0
  804. package/dist/lib/telemetry-consent.d.ts +44 -23
  805. package/dist/lib/telemetry-consent.d.ts.map +1 -1
  806. package/dist/lib/telemetry-consent.js +74 -35
  807. package/dist/lib/telemetry-consent.js.map +1 -1
  808. package/dist/lib/telemetry-env.d.ts +1 -1
  809. package/dist/lib/usage-telemetry.d.ts +89 -24
  810. package/dist/lib/usage-telemetry.d.ts.map +1 -1
  811. package/dist/lib/usage-telemetry.js +283 -76
  812. package/dist/lib/usage-telemetry.js.map +1 -1
  813. package/dist/lib/xdg.d.ts +27 -0
  814. package/dist/lib/xdg.d.ts.map +1 -0
  815. package/dist/lib/xdg.js +56 -0
  816. package/dist/lib/xdg.js.map +1 -0
  817. package/package.json +6 -3
  818. package/dist/commands/push.d.ts +0 -25
  819. package/dist/commands/push.d.ts.map +0 -1
  820. package/dist/commands/push.js +0 -98
  821. package/dist/commands/push.js.map +0 -1
  822. package/dist/lib/personal-email-domains.d.ts +0 -8
  823. package/dist/lib/personal-email-domains.d.ts.map +0 -1
  824. package/dist/lib/personal-email-domains.js +0 -39
  825. package/dist/lib/personal-email-domains.js.map +0 -1
@@ -1,66 +1,14 @@
1
1
  import { DatabaseSync } from 'node:sqlite';
2
2
  import { randomUUID } from 'node:crypto';
3
3
  import { mkdirSync } from 'node:fs';
4
- import { dirname } from 'node:path';
5
- import { repoFromSourceUrl } from './repo-identity.js';
6
- const SCHEMA = `
7
- CREATE TABLE IF NOT EXISTS decisions (
8
- id TEXT PRIMARY KEY,
9
- title TEXT NOT NULL,
10
- summary TEXT NOT NULL,
11
- source_url TEXT,
12
- platform TEXT NOT NULL DEFAULT 'cli',
13
- created_at TEXT NOT NULL DEFAULT (datetime('now')),
14
- repo TEXT,
15
- decided_at TEXT,
16
- decider_kind TEXT,
17
- confirmed_by TEXT,
18
- confirmed_at TEXT,
19
- ratified_by TEXT,
20
- ratified_at TEXT
21
- );
22
-
23
- CREATE TABLE IF NOT EXISTS decision_audit (
24
- id TEXT PRIMARY KEY,
25
- decision_id TEXT NOT NULL,
26
- action TEXT NOT NULL,
27
- actor TEXT,
28
- detail TEXT,
29
- created_at TEXT NOT NULL DEFAULT (datetime('now'))
30
- );
31
-
32
- CREATE TABLE IF NOT EXISTS decision_embeddings (
33
- decision_id TEXT PRIMARY KEY REFERENCES decisions(id) ON DELETE CASCADE,
34
- embedding BLOB NOT NULL,
35
- model TEXT
36
- );
37
-
38
- CREATE TABLE IF NOT EXISTS decision_links (
39
- id TEXT PRIMARY KEY,
40
- source_id TEXT NOT NULL REFERENCES decisions(id) ON DELETE CASCADE,
41
- target_id TEXT NOT NULL REFERENCES decisions(id) ON DELETE CASCADE,
42
- relation TEXT NOT NULL,
43
- confidence REAL NOT NULL DEFAULT 1.0,
44
- created_at TEXT NOT NULL DEFAULT (datetime('now'))
45
- );
46
-
47
- CREATE TABLE IF NOT EXISTS decision_refs (
48
- decision_id TEXT NOT NULL REFERENCES decisions(id) ON DELETE CASCADE,
49
- ref TEXT NOT NULL,
50
- platform TEXT NOT NULL,
51
- PRIMARY KEY (decision_id, ref)
52
- );
53
- `;
54
- /**
55
- * Schema version this build expects. Bump when adding a step to `migrate`.
56
- *
57
- * Exported so a test can assert the migration WROTE the version it claims, without hardcoding
58
- * the number - a test pinning a literal 1 had to be edited by this change rather than passing
59
- * or failing on its own merits. A parity test also derives the highest `version <` branch in
60
- * `migrate` from the source and compares it here, because forgetting the bump leaves the new
61
- * branch running destructively on every open with nothing to stop it.
62
- */
63
- export const SCHEMA_VERSION = 6;
4
+ import { dirname, resolve } from 'node:path';
5
+ import { deleteDecisionWithDependents, migrate, SCHEMA, SLACK_TOMBSTONE_TITLE } from './local-db-migrate.js';
6
+ import { bumpRowSetEpoch, rowSetEpoch } from './local-db-epoch.js';
7
+ import { foldKeylessTwin } from './local-db-v7.js';
8
+ import { discussionStart } from './github-text.js';
9
+ import { connectorItemKey, KEYED_PLATFORMS } from './source-key.js';
10
+ import { alignConfigDir, ensurePrivateDir, precreatePrivateFile, tightenGraphFiles } from './private-files.js';
11
+ export { SCHEMA_VERSION } from './local-db-migrate.js';
64
12
  /**
65
13
  * ALI-829: a source timestamp as this database stores it - ISO-8601 Z - or null.
66
14
  *
@@ -92,10 +40,6 @@ export function normaliseDecidedAt(value) {
92
40
  return null;
93
41
  return new Date(ms).toISOString();
94
42
  }
95
- /** The title connector-core 0.5.0 gave every Slack thread whose root was deleted. The 0.6.0
96
- * fetcher titles such a thread from its first human message, or drops it; either way this
97
- * row is a duplicate-to-be under the (source_url, title) key, or noise. */
98
- const SLACK_TOMBSTONE_TITLE = 'This message was deleted.';
99
43
  /**
100
44
  * A `source_url` is only an identity if it points at ONE thing. Some fetchers substitute a
101
45
  * constant when the per-item link is missing, and connector-core ships one:
@@ -136,329 +80,60 @@ export function identifyingSourceUrl(raw) {
136
80
  }
137
81
  return value;
138
82
  }
139
- /** The five ALI-831 columns, named exactly as the shared contract spells them. One list,
140
- * read by the migration; SCHEMA above spells them a second time because a fresh CREATE
141
- * TABLE cannot read a constant, and the provenance test pins both against each other. */
142
- const PROVENANCE_COLUMNS = ['decider_kind', 'confirmed_by', 'confirmed_at', 'ratified_by', 'ratified_at'];
143
- /**
144
- * ALI-787: the only embedding model this graph has ever written before the `model` column
145
- * existed. Verified, not assumed - `git log --all -p` on local-embeddings.ts and
146
- * local-embeddings-wasm.ts shows exactly one HF model id was ever hardcoded there, across
147
- * every commit. So backfilling every pre-column row with this is a true historical fact,
148
- * unlike `decided_at` (step 4 below), which genuinely cannot be derived from an existing row.
149
- *
150
- * A deliberate LITERAL, not an import of local-embeddings.ts's EMBEDDING_MODEL_ID: this
151
- * constant names what was true when the column was added, and must stay that value even
152
- * after a future model swap changes EMBEDDING_MODEL_ID. Migrations are a historical record.
153
- */
154
- const LEGACY_EMBEDDING_MODEL = 'Xenova/all-MiniLM-L6-v2';
155
- /**
156
- * One-time data migrations, tracked in SQLite's built-in `user_version`.
157
- *
158
- * 1. ALI-503: relabel the cosine-similarity links that were written as `conflicts_with`.
159
- * Every such row at version 0 is provably an artefact, because `insertLink` had exactly
160
- * one caller and it hardcoded that relation for any pair over 0.65 cosine. No classifier
161
- * verdict was ever persisted, so there is no earned row to damage.
162
- *
163
- * 2. A decision's `source_url` identifies it, and nothing enforced that: `insertDecision` minted
164
- * a fresh UUID per call, so re-importing the same commit added a second copy. The documented
165
- * first run does exactly that - `setup --local` seeds from git, then its own outro tells you
166
- * to run `align connect git` - so a graph goes from 2 decisions to 4 by following the tips.
167
- * Collapse the existing duplicates, then make them unrepresentable with a unique index.
168
- *
169
- * 3. ALI-798: add the `repo` column (missing on any graph that predates it) and backfill it
170
- * for every existing row from `source_url`, via the same `repoFromSourceUrl` the importer
171
- * now stamps new rows with - one reader of the URL shape, used for both. A row whose
172
- * source is not code (Jira, Slack, a bare capture) stays NULL, which is "unattributed",
173
- * not "wrong": `--repo` scoping always includes unattributed rows alongside the named
174
- * repo (see local-gateway-client.ts), so nothing existing becomes invisible.
175
- *
176
- * 4. ALI-829: add `decided_at` - when the decision was MADE, from the source's own
177
- * timestamp, as distinct from `created_at`, the minute this CLI imported it. Every one
178
- * of the 684 rows in the 2026-09-02 measurement carried the ingest minute and nothing
179
- * else, so "what changed since March" was unanswerable offline. No backfill, unlike
180
- * `repo`: a repo is derivable from a stored source_url, and a decision date is not
181
- * derivable from anything already in the row. A re-import fills it in; inventing one
182
- * from created_at would write the exact wrong fact this column exists to correct.
183
- *
184
- * Same bump, second step: drop the Slack rows titled by a deleted root. The 0.6.0
185
- * fetcher titles a thread from its first human message, and the dedup key is
186
- * (source_url, title), so each of those rows would otherwise be re-inserted BESIDE its
187
- * tombstone twin on the next import (35 of 39 on the 2026-09-02 graph). The next import
188
- * recreates the real ones with real titles; the ones that were only bot output on a
189
- * deleted root do not come back, which is the point. Foreign keys are off in this
190
- * database (see step 2), so the dependent rows are deleted explicitly - including any
191
- * link a human adjudicated on such a row. That is a real loss, accepted: the row's
192
- * identity is changing under it, and the re-import classifies the retitled thread
193
- * afresh. Scoped to platform = 'slack': a git commit or a captured note that happens to
194
- * carry the same words is not a tombstone and is left alone.
195
- *
196
- * 5. ALI-831: add the decider/ratified columns (`decider_kind`, `confirmed_by`,
197
- * `confirmed_at`, `ratified_by`, `ratified_at`) so an agent-made decision can enter as a
198
- * CLAIM a human later stands behind, and the `decision_audit` table the human act is
199
- * recorded in. No backfill, on purpose: a row captured before the column reads as
200
- * 'unknown', and stamping 'human' on it from its platform would be the retroactive
201
- * guess align-stack's migration 113 refuses. The columns are added here rather than only
202
- * in SCHEMA because CREATE TABLE IF NOT EXISTS never alters an existing table.
203
- *
204
- * The version guard is load-bearing rather than tidiness. The same UPDATE run on every open
205
- * is indistinguishable from this one today, and starts silently eating genuine conflicts the
206
- * moment anything writes one.
207
- */
208
- /**
209
- * Remove a decision and everything hanging off it. Foreign keys are off in this database
210
- * (see migrate, step 2), so the dependents are named explicitly rather than cascaded. One
211
- * writer for the v4 tombstone sweep and the ingest-time twin removal (ALI-829).
212
- */
213
- function deleteDecisionWithDependents(db, id) {
214
- db.prepare('DELETE FROM decision_links WHERE source_id = ? OR target_id = ?').run(id, id);
215
- db.prepare('DELETE FROM decision_refs WHERE decision_id = ?').run(id);
216
- db.prepare('DELETE FROM decision_embeddings WHERE decision_id = ?').run(id);
217
- db.prepare('DELETE FROM decision_audit WHERE decision_id = ?').run(id);
218
- db.prepare('DELETE FROM decisions WHERE id = ?').run(id);
219
- }
220
- function migrate(db) {
221
- const version = db.prepare('PRAGMA user_version').get().user_version;
222
- if (version < 1) {
223
- db.exec(`UPDATE decision_links SET relation = 'relates' WHERE relation = 'conflicts_with'`);
224
- }
225
- if (version < 2) {
226
- // IMMEDIATE, not the default DEFERRED: this transaction reads (the survivor scan) before it
227
- // writes, and under WAL another writer arriving in between makes the first write fail with
228
- // SQLITE_BUSY_SNAPSHOT, which busy_timeout does not retry. Every local command opens the DB
229
- // and the advisory hook fires on every agent edit, so a concurrent open is the normal case.
230
- db.exec('BEGIN IMMEDIATE');
231
- try {
232
- // The survivor is the row inserted FIRST. `rowid` rather than `id` breaks a created_at
233
- // tie: created_at has one-second granularity so rows written in one import tie routinely,
234
- // and ordering by a random UUID would keep an arbitrary one while this comment claimed to
235
- // keep the long-standing id. rowid is insertion order (the table is not WITHOUT ROWID).
236
- //
237
- // Keyed on (source_url, title), not source_url alone. Some fetchers emit a CONSTANT
238
- // source_url when the per-item link is missing - connector-core's Teams fallback is
239
- // literally 'https://teams.microsoft.com' - and collapsing on the URL alone deleted every
240
- // such message but one. Two rows sharing a URL AND a title are duplicates by any reading;
241
- // two sharing only the URL are not.
242
- db.exec(`
243
- CREATE TEMP TABLE dedup_survivor AS
244
- SELECT source_url, title, id FROM (
245
- SELECT source_url, title, id,
246
- ROW_NUMBER() OVER (PARTITION BY source_url, title ORDER BY created_at, rowid) AS rn
247
- FROM decisions WHERE source_url IS NOT NULL
248
- ) WHERE rn = 1;
249
-
250
- CREATE TEMP TABLE dedup_dropped AS
251
- SELECT d.id AS id, s.id AS survivor_id
252
- FROM decisions d JOIN dedup_survivor s
253
- ON d.source_url = s.source_url AND d.title = s.title
254
- WHERE d.id <> s.id;
255
- `);
256
- // Repoint edges rather than dropping them: an edge naming a duplicate is a real edge that
257
- // happened to name the copy. Dropping it would lose a relationship the user earned.
258
- db.exec(`
259
- UPDATE decision_links SET source_id = (
260
- SELECT survivor_id FROM dedup_dropped WHERE id = decision_links.source_id
261
- ) WHERE source_id IN (SELECT id FROM dedup_dropped);
262
- UPDATE decision_links SET target_id = (
263
- SELECT survivor_id FROM dedup_dropped WHERE id = decision_links.target_id
264
- ) WHERE target_id IN (SELECT id FROM dedup_dropped);
265
- `);
266
- // Both cleanups are scoped to the pairs repointing actually touched. An earlier version
267
- // deduplicated decision_links table-wide, which deleted user-earned edges that had nothing
268
- // to do with duplication - and kept the lowest UUID rather than the highest confidence.
269
- db.exec(`
270
- DELETE FROM decision_links
271
- WHERE source_id = target_id
272
- AND (source_id IN (SELECT survivor_id FROM dedup_dropped)
273
- OR target_id IN (SELECT survivor_id FROM dedup_dropped));
274
- `);
275
- // Explicitly, not by CASCADE: SQLite leaves foreign_keys OFF unless asked, so the
276
- // ON DELETE CASCADE in the schema does not fire and these would be orphaned.
277
- db.exec(`DELETE FROM decision_embeddings WHERE decision_id IN (SELECT id FROM dedup_dropped)`);
278
- db.exec(`DELETE FROM decisions WHERE id IN (SELECT id FROM dedup_dropped)`);
279
- db.exec(`DROP TABLE dedup_dropped; DROP TABLE dedup_survivor;`);
280
- // Created here rather than in SCHEMA on purpose: SCHEMA runs before this function, so on
281
- // any already-duplicated graph the index would fail to build before the collapse could
282
- // run. A fresh database passes through the same path with nothing to collapse.
283
- //
284
- // A distinct name from any previous attempt, because IF NOT EXISTS matches on the NAME
285
- // only: an index of the same name with different columns would be silently kept, and
286
- // every later insert would then fail with "ON CONFLICT clause does not match".
287
- db.exec(`CREATE UNIQUE INDEX IF NOT EXISTS decisions_source_title_unique ON decisions(source_url, title)`);
288
- // Same story for edges: insertLink's `OR IGNORE` was decorative without a unique index, so
289
- // a re-import stacked an identical relates row every time. Collapse, then constrain.
290
- //
291
- // This one IS table-wide, unavoidably: the index cannot be created while any duplicate
292
- // triple remains anywhere. Every row it removes duplicates another by definition - same
293
- // source, same target, same relation. It keeps the HIGHEST confidence rather than the
294
- // lowest uuid, so the survivor is the best score rather than an arbitrary one.
295
- db.exec(`
296
- DELETE FROM decision_links WHERE id NOT IN (
297
- SELECT id FROM (
298
- SELECT id, ROW_NUMBER() OVER (
299
- PARTITION BY source_id, target_id, relation ORDER BY confidence DESC, rowid
300
- ) AS rn FROM decision_links
301
- ) WHERE rn = 1
302
- );
303
- `);
304
- db.exec(`CREATE UNIQUE INDEX IF NOT EXISTS decision_links_triple_unique ON decision_links(source_id, target_id, relation)`);
305
- // Stamped INSIDE the transaction. Outside it, a process killed between COMMIT and the
306
- // pragma replays the version-1 relabel on the next open, which turns an adjudicated
307
- // conflicts_with edge into relates - the exact silent loss the docstring above warns of.
308
- //
309
- // Stamps this step's OWN number (2), not SCHEMA_VERSION: a later step (3, below) runs
310
- // after this one commits, and if a crash lands between the two, `user_version` must
311
- // still read 2 so the version-3 step is not skipped on the next open.
312
- db.exec('PRAGMA user_version = 2');
313
- db.exec('COMMIT');
314
- }
315
- catch (err) {
316
- // Guarded: SQLITE_FULL, IOERR, BUSY, NOMEM and INTERRUPT auto-roll-back, and an
317
- // unconditional ROLLBACK then throws "no transaction is active" and buries the real
318
- // cause - so a user whose disk filled mid-migration would be told the wrong thing.
319
- if (db.isTransaction)
320
- db.exec('ROLLBACK');
321
- throw err;
322
- }
323
- }
324
- if (version < 3) {
325
- // The column may already exist: a brand-new database's CREATE TABLE (SCHEMA, above)
326
- // declares `repo` directly, so on a fresh install this ALTER would fail with "duplicate
327
- // column name" if run unconditionally. A legacy database predates the column entirely.
328
- const hasRepoColumn = db.prepare('PRAGMA table_info(decisions)').all()
329
- .some((c) => c.name === 'repo');
330
- if (!hasRepoColumn) {
331
- db.exec('ALTER TABLE decisions ADD COLUMN repo TEXT');
332
- }
333
- // Backfill every row with no repo yet. JS-side because SQLite has no regex function to
334
- // apply `repoFromSourceUrl`'s pattern in SQL - and it must be the SAME function the
335
- // importer stamps new rows with, or a backfilled row and a freshly-imported one for the
336
- // same URL could disagree about which repo they belong to.
337
- const rows = db.prepare('SELECT id, source_url FROM decisions WHERE repo IS NULL')
338
- .all();
339
- if (rows.length) {
340
- db.exec('BEGIN IMMEDIATE');
341
- try {
342
- const update = db.prepare('UPDATE decisions SET repo = ? WHERE id = ?');
343
- for (const row of rows) {
344
- const repo = repoFromSourceUrl(row.source_url);
345
- // Only WRITE when a repo was found: leaving a non-code row NULL is the correct
346
- // outcome (unattributed, not "wrong"), and writing NULL over NULL is a no-op
347
- // this loop can just skip.
348
- if (repo)
349
- update.run(repo, row.id);
350
- }
351
- db.exec('PRAGMA user_version = 3');
352
- db.exec('COMMIT');
353
- }
354
- catch (err) {
355
- if (db.isTransaction)
356
- db.exec('ROLLBACK');
357
- throw err;
358
- }
359
- }
360
- else {
361
- db.exec('PRAGMA user_version = 3');
362
- }
363
- }
364
- if (version < 4) {
365
- db.exec('BEGIN IMMEDIATE');
366
- try {
367
- // Same shape as the `repo` step: a fresh database's CREATE TABLE already declares the
368
- // column, and a legacy one predates it, so the ALTER is conditional. Checked INSIDE
369
- // the write lock, unlike step 3: two processes opening a v3 file at once (the
370
- // advisory hook is the normal concurrent case) could otherwise both read "no column"
371
- // and the second would die on "duplicate column name". SQLite DDL is transactional.
372
- const hasDecidedAt = db.prepare('PRAGMA table_info(decisions)').all()
373
- .some((c) => c.name === 'decided_at');
374
- if (!hasDecidedAt) {
375
- db.exec('ALTER TABLE decisions ADD COLUMN decided_at TEXT');
376
- }
377
- const tombstones = db.prepare(`SELECT id FROM decisions WHERE platform = 'slack' AND title = ?`).all(SLACK_TOMBSTONE_TITLE);
378
- for (const { id } of tombstones)
379
- deleteDecisionWithDependents(db, id);
380
- // Stamped inside the transaction, for the reason step 2 gives.
381
- db.exec('PRAGMA user_version = 4');
382
- db.exec('COMMIT');
383
- }
384
- catch (err) {
385
- if (db.isTransaction)
386
- db.exec('ROLLBACK');
387
- throw err;
388
- }
389
- }
390
- if (version < 5) {
391
- // Inside the write lock, for the reason step 4 gives: two concurrent opens of a v4
392
- // file must not both read "no column" and race the ALTER.
393
- db.exec('BEGIN IMMEDIATE');
394
- try {
395
- const existing = new Set(db.prepare('PRAGMA table_info(decisions)').all().map((c) => c.name));
396
- for (const column of PROVENANCE_COLUMNS) {
397
- if (!existing.has(column))
398
- db.exec(`ALTER TABLE decisions ADD COLUMN ${column} TEXT`);
399
- }
400
- db.exec('PRAGMA user_version = 5');
401
- db.exec('COMMIT');
402
- }
403
- catch (err) {
404
- if (db.isTransaction)
405
- db.exec('ROLLBACK');
406
- throw err;
407
- }
408
- }
409
- if (version < 6) {
410
- // Inside the write lock, for the reason step 4/5 give: two concurrent opens of a v5
411
- // file must not both read "no column" and race the ALTER.
412
- db.exec('BEGIN IMMEDIATE');
413
- try {
414
- const hasModel = db.prepare('PRAGMA table_info(decision_embeddings)').all()
415
- .some((c) => c.name === 'model');
416
- if (!hasModel) {
417
- db.exec('ALTER TABLE decision_embeddings ADD COLUMN model TEXT');
418
- }
419
- // Every row that predates the column was written by LEGACY_EMBEDDING_MODEL - see its
420
- // doc comment for how that is verified rather than assumed. Only rows with no tag yet
421
- // are touched, so re-running this on an already-migrated database is a no-op.
422
- db.prepare('UPDATE decision_embeddings SET model = ? WHERE model IS NULL').run(LEGACY_EMBEDDING_MODEL);
423
- db.exec('PRAGMA user_version = 6');
424
- db.exec('COMMIT');
425
- }
426
- catch (err) {
427
- if (db.isTransaction)
428
- db.exec('ROLLBACK');
429
- throw err;
430
- }
431
- }
432
- if (version < SCHEMA_VERSION) {
433
- db.exec(`PRAGMA user_version = ${SCHEMA_VERSION}`);
434
- }
435
- }
436
83
  /** Every column a DecisionRow carries, aliased to its camelCase name. One writer, read by
437
84
  * both row readers, so a new column cannot be added to one SELECT and missed by the other. */
438
85
  const DECISION_COLUMNS = 'id, title, summary, source_url as sourceUrl, platform, created_at as createdAt, repo, decided_at as decidedAt, ' +
439
86
  'decider_kind as deciderKind, confirmed_by as confirmedBy, confirmed_at as confirmedAt, ' +
440
87
  'ratified_by as ratifiedBy, ratified_at as ratifiedAt';
88
+ /** A person's ratification or confirmation covers the text they read (review finding 4). */
89
+ const ATTESTED = 'decisions.ratified_at IS NOT NULL OR decisions.confirmed_at IS NOT NULL';
441
90
  export function createLocalDb(dbPath) {
442
91
  // SQLite creates the DB file but not its parent directory, so on a clean machine
443
92
  // (~/.config/align-cli absent) `align setup --local` crashed with "unable to open
444
93
  // database file". Create the directory first. ':memory:' has no parent.
445
94
  //
446
95
  // Still true after the move off better-sqlite3: node:sqlite does not mkdir either.
96
+ //
97
+ // The directory is created 0700 and the file 0600 before SQLite opens it (whose own default for a
98
+ // new file is 0644). The file is tightened on every open, and so is the folder when it is align's own
99
+ // config folder (private-files.ts). SQLite gives the
100
+ // -wal and -shm it creates the main file's mode, so they follow it.
447
101
  if (dbPath !== ':memory:') {
448
- mkdirSync(dirname(dbPath), { recursive: true });
102
+ const dir = dirname(dbPath);
103
+ // Throws the real reason (ENOTDIR, EACCES) rather than SQLite's "unable to open database file".
104
+ mkdirSync(dir, { recursive: true, mode: 0o700 });
105
+ if (resolve(dir) === resolve(alignConfigDir()))
106
+ ensurePrivateDir(dir);
107
+ precreatePrivateFile(dbPath);
108
+ tightenGraphFiles(dbPath);
449
109
  }
450
110
  const db = new DatabaseSync(dbPath);
451
- db.exec('PRAGMA journal_mode = WAL');
452
- db.exec(SCHEMA);
453
- migrate(db);
111
+ // 30s: the longest measured v7 migration (100k rows, 33k merges) takes about 5s, so a waiting
112
+ // opener outlasts it with margin. First, before anything that needs a lock: every local command and the advisory hook open
113
+ // this file, so a concurrent opener is normal, and without a timeout it fails at once with
114
+ // "database is locked" instead of waiting for the migration in progress.
115
+ db.exec('PRAGMA busy_timeout = 30000');
116
+ try {
117
+ db.exec('PRAGMA journal_mode = WAL');
118
+ db.exec(SCHEMA);
119
+ migrate(db);
120
+ }
121
+ catch (err) {
122
+ db.close();
123
+ throw err;
124
+ }
454
125
  // Shared by insertLink and resolveRefs (ALI-796), so there is one writer of the
455
126
  // decision_links insert rather than two copies of the same ON CONFLICT clause.
127
+ // `detectorVersion` (schema v12): which detector wrote the edge. Omitted means 'v0'; only the
128
+ // v1 detector passes 'v1'. A conflict on the triple keeps the stored version: same relation,
129
+ // nothing re-typed.
456
130
  function insertLinkRow(link) {
457
- db.prepare(`INSERT INTO decision_links (id, source_id, target_id, relation, confidence) VALUES (?, ?, ?, ?, ?)
131
+ db.prepare(`INSERT INTO decision_links (id, source_id, target_id, relation, confidence, detector_version) VALUES (?, ?, ?, ?, ?, ?)
458
132
  ON CONFLICT(source_id, target_id, relation)
459
- DO UPDATE SET confidence = MAX(confidence, excluded.confidence)`).run(randomUUID(), link.sourceId, link.targetId, link.relation, link.confidence);
133
+ DO UPDATE SET confidence = MAX(confidence, excluded.confidence)`).run(link.id ?? randomUUID(), link.sourceId, link.targetId, link.relation, link.confidence, link.detectorVersion ?? 'v0');
460
134
  }
461
- return {
135
+ let dataVersionStmt;
136
+ const api = {
462
137
  /**
463
138
  * Insert, or refresh the decision that already carries this `source_url`, returning the id
464
139
  * that now holds it.
@@ -484,15 +159,39 @@ export function createLocalDb(dbPath) {
484
159
  * change which repo it points at between imports.
485
160
  */
486
161
  insertDecision(row) {
487
- const inserted = db.prepare(`INSERT INTO decisions (id, title, summary, source_url, platform, repo, decided_at, decider_kind) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
162
+ // L2: a one-item-per-URL connector item upserts on its source_key, and that branch takes
163
+ // the new title, so an edited PR title updates the row instead of adding a twin. Every
164
+ // other row (sessions, captures, docs) keeps the (source_url, title) identity.
165
+ //
166
+ // Both branches clear enriched_at: the row's text may have changed, so its links are not
167
+ // known to be current until ingestOne's link pass marks it again (Decision 30).
168
+ const sourceUrl = identifyingSourceUrl(row.sourceUrl);
169
+ const key = (row.keyed ? connectorItemKey(row.platform, sourceUrl) : undefined) ?? null;
170
+ api.foldPendingTwin(sourceUrl, row.title, row.platform, row.keyed);
171
+ const inserted = db.prepare(`INSERT INTO decisions (id, title, summary, source_url, platform, repo, decided_at, decider_kind, source_key, detail_pending) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
172
+ ON CONFLICT(source_key) WHERE source_key IS NOT NULL DO UPDATE SET
173
+ title = CASE WHEN ${ATTESTED} THEN decisions.title ELSE excluded.title END,
174
+ summary = CASE WHEN ${ATTESTED} THEN decisions.summary ELSE excluded.summary END,
175
+ platform = excluded.platform,
176
+ repo = COALESCE(excluded.repo, decisions.repo),
177
+ decided_at = COALESCE(excluded.decided_at, decisions.decided_at),
178
+ -- An attested row keeps its text, so it keeps the flag that describes that text (review 8).
179
+ -- A thin arrival whose body IS the stored body (ingestOne passed the stored text on
180
+ -- because the stored one is richer) must not turn a complete row pending again.
181
+ detail_pending = CASE
182
+ WHEN ${ATTESTED} THEN decisions.detail_pending
183
+ WHEN excluded.detail_pending = 1 AND decisions.detail_pending = 0 AND excluded.summary = decisions.summary THEN 0
184
+ ELSE excluded.detail_pending END,
185
+ enriched_at = CASE WHEN ${ATTESTED} THEN decisions.enriched_at ELSE NULL END
488
186
  ON CONFLICT(source_url, title) DO UPDATE SET
489
187
  summary = excluded.summary, platform = excluded.platform,
490
188
  repo = COALESCE(excluded.repo, decisions.repo),
491
- decided_at = COALESCE(excluded.decided_at, decisions.decided_at)
492
- RETURNING id`).get(randomUUID(), row.title, row.summary, identifyingSourceUrl(row.sourceUrl), row.platform, row.repo ?? null,
189
+ decided_at = COALESCE(excluded.decided_at, decisions.decided_at),
190
+ enriched_at = NULL
191
+ RETURNING id`).get(randomUUID(), row.title, row.summary, sourceUrl, row.platform, row.repo ?? null,
493
192
  // `||`, not `??`: COALESCE('', old) is '', so an empty string would blank a stored
494
193
  // date. Callers normalise, but this is the one place the column is written.
495
- row.decidedAt || null, row.deciderKind ?? null);
194
+ row.decidedAt || null, row.deciderKind ?? null, key, row.detailPending ? 1 : 0);
496
195
  return inserted.id;
497
196
  },
498
197
  /**
@@ -519,13 +218,95 @@ export function createLocalDb(dbPath) {
519
218
  * A null `sourceUrl` is always null here: SQLite treats each NULL in a unique index as
520
219
  * distinct, so those rows never conflict and every one of them really is new.
521
220
  */
522
- findIdBySource(sourceUrl, title) {
221
+ findIdBySource(sourceUrl, title, platform, keyed) {
523
222
  const identity = identifyingSourceUrl(sourceUrl);
524
223
  if (identity === null)
525
224
  return null;
225
+ // L2: with the platform, a one-item-per-URL item is found by its source_key, so a retitled
226
+ // PR is recognised as the row insertDecision is about to update, not as a new one.
227
+ const key = platform === undefined || !keyed ? undefined : connectorItemKey(platform, identity);
228
+ if (key !== undefined) {
229
+ const byKey = db.prepare(`SELECT id FROM decisions WHERE source_key = ?`).get(key);
230
+ if (byKey)
231
+ return byKey.id;
232
+ }
526
233
  const row = db.prepare(`SELECT id FROM decisions WHERE source_url = ? AND title = ?`).get(identity, title);
527
234
  return row?.id ?? null;
528
235
  },
236
+ /**
237
+ * Review finding 4: what a keyed re-import may write over row `id`. A ratified or confirmed
238
+ * row keeps the text a person attested; the incoming text is recorded once as a
239
+ * `text_revision_pending` audit note and the stored text is returned. Any other row (or an
240
+ * unknown id) gets the incoming text back unchanged.
241
+ */
242
+ keepProtectedText(id, title, summary, thin = false) {
243
+ const row = db.prepare(`SELECT title, summary, detail_pending, ratified_at, confirmed_at FROM decisions WHERE id = ?`).get(id);
244
+ if (row && row.ratified_at === null && row.confirmed_at === null && thin && row.detail_pending === 0) {
245
+ // L3: `thin` is an items-first arrival (discussion not fetched). The stored row is complete
246
+ // and has a discussion block: keep the BLOCK and take everything else from the arrival
247
+ // (title, body, Status, Repo), so a merge, a rename or an edit still lands. The result
248
+ // equals the stored text when nothing changed, which makes the caller's unchanged-skip fire.
249
+ const keep = discussionStart(row.summary);
250
+ if (keep !== -1 && discussionStart(summary) === -1) {
251
+ return { title, summary: summary + row.summary.slice(keep), keptDiscussion: true };
252
+ }
253
+ }
254
+ if (!row || (row.ratified_at === null && row.confirmed_at === null))
255
+ return { title, summary };
256
+ if (row.title !== title || row.summary !== summary) {
257
+ const detail = JSON.stringify({ title, summary });
258
+ const seen = db.prepare(`SELECT 1 AS hit FROM decision_audit WHERE decision_id = ? AND action = 'text_revision_pending' AND detail = ?`).get(id, detail);
259
+ if (!seen) {
260
+ api.insertAudit({ decisionId: id, action: 'text_revision_pending', actor: null, detail });
261
+ // Bounded: an upstream that changes every sync would otherwise add a row per sync.
262
+ db.prepare(`DELETE FROM decision_audit WHERE decision_id = ? AND action = 'text_revision_pending' AND rowid NOT IN
263
+ (SELECT rowid FROM decision_audit WHERE decision_id = ? AND action = 'text_revision_pending' ORDER BY rowid DESC LIMIT 5)`).run(id, id);
264
+ }
265
+ }
266
+ return { title: row.title, summary: row.summary };
267
+ },
268
+ /** The id of the connector-imported item `url` names, under any platform, or null. A capture
269
+ * of that URL must not rewrite the imported text (L2 review finding 1). */
270
+ findKeyedIdByUrl(url) {
271
+ const identity = identifyingSourceUrl(url);
272
+ if (identity === null)
273
+ return null;
274
+ for (const platform of KEYED_PLATFORMS) {
275
+ const key = connectorItemKey(platform, identity);
276
+ const hit = key === undefined ? undefined : db.prepare(`SELECT id FROM decisions WHERE source_key = ?`).get(key);
277
+ if (hit)
278
+ return hit.id;
279
+ }
280
+ return null;
281
+ },
282
+ /**
283
+ * A keyless row at this (source_url, title) is a twin an older binary wrote beside the keyed
284
+ * one. Adopt it as the keyed row, or fold it with the row that already holds the key (the
285
+ * attested one survives). ingestOne calls this BEFORE it looks the item up, so the text it
286
+ * protects and embeds is the survivor's. No-op for an unkeyed call.
287
+ */
288
+ foldPendingTwin(sourceUrl, title, platform, keyed) {
289
+ const key = keyed ? connectorItemKey(platform, sourceUrl) : undefined;
290
+ if (key === undefined)
291
+ return;
292
+ const twin = db.prepare(`SELECT id FROM decisions WHERE source_url = ? AND title = ? AND source_key IS NULL`).get(sourceUrl, title);
293
+ if (!twin)
294
+ return;
295
+ const holder = db.prepare(`SELECT id FROM decisions WHERE source_key = ?`).get(key);
296
+ if (holder)
297
+ foldKeylessTwin(db, twin.id, holder.id, key);
298
+ else
299
+ db.prepare(`UPDATE decisions SET source_key = ? WHERE id = ?`).run(key, twin.id);
300
+ },
301
+ /** A capture of a URL a connector already imported: audit it, change nothing, return the row. */
302
+ noteCaptureOfHeldItem(url) {
303
+ const id = api.findKeyedIdByUrl(url);
304
+ const row = id === null ? null : api.getDecisionById(id);
305
+ const today = id === null ? undefined : db.prepare(`SELECT 1 AS hit FROM decision_audit WHERE decision_id = ? AND action = 'capture_seen' AND date(created_at) = date('now')`).get(id);
306
+ if (row && !today)
307
+ api.insertAudit({ decisionId: row.id, action: 'capture_seen', actor: null, detail: url });
308
+ return row;
309
+ },
529
310
  /**
530
311
  * `filter.repo` scopes to one repo's rows. `includeUnattributed` (ALI-798's own rule:
531
312
  * "repo = ? OR repo IS NULL") also returns rows with no repo at all - a Jira ticket, a
@@ -585,6 +366,19 @@ export function createLocalDb(dbPath) {
585
366
  RETURNING confirmed_at AS confirmedAt`).get(confirmedBy, confirmedAt, id);
586
367
  return row ?? null;
587
368
  },
369
+ /**
370
+ * L2, Decision 30: the decision's ingest finished, link pass included. ingestOne is the one
371
+ * caller, and calls it as its last write; insertDecision clears it whenever it rewrites the
372
+ * row. NULL therefore means "links not known to be current", and the unchanged-skip will
373
+ * not skip such a row.
374
+ */
375
+ markEnriched(id) {
376
+ db.prepare(`UPDATE decisions SET enriched_at = ? WHERE id = ?`).run(new Date().toISOString(), id);
377
+ },
378
+ getEnrichedAt(id) {
379
+ const row = db.prepare(`SELECT enriched_at AS e FROM decisions WHERE id = ?`).get(id);
380
+ return row?.e ?? null;
381
+ },
588
382
  /** ALI-831: one row per human act on a decision (ratified, pushed), so "who stood behind
589
383
  * this, and when" is answerable after the fact. Append-only by construction. */
590
384
  insertAudit(entry) {
@@ -656,6 +450,10 @@ export function createLocalDb(dbPath) {
656
450
  * (local-gateway-client.ts's ingestOne) always passes EMBEDDING_MODEL_ID.
657
451
  */
658
452
  setEmbedding(decisionId, embedding, model) {
453
+ // Replacing a vector changes what a copy of the embeddings should hold; a first write
454
+ // only adds a row, which the writer appends itself. (rowSetEpoch's contract.)
455
+ if (db.prepare('SELECT 1 FROM decision_embeddings WHERE decision_id = ?').get(decisionId))
456
+ bumpRowSetEpoch(db);
659
457
  db.prepare(`INSERT OR REPLACE INTO decision_embeddings (decision_id, embedding, model) VALUES (?, ?, ?)`).run(decisionId, Buffer.from(embedding.buffer, embedding.byteOffset, embedding.byteLength), model ?? null);
660
458
  },
661
459
  getEmbedding(decisionId) {
@@ -746,6 +544,16 @@ export function createLocalDb(dbPath) {
746
544
  insertLink(link) {
747
545
  insertLinkRow(link);
748
546
  },
547
+ /**
548
+ * LM: the ONE way a link is deleted on behalf of a person's mark. `align mark <a> replaces <b>`
549
+ * writes its supersedes link under the id `mark:<judgement id>` (when the classifier had not
550
+ * already written that edge, in which case the edge keeps its own id and is not ours), and
551
+ * `--undo` removes exactly that row here. The id is built inside this method, so no caller can
552
+ * name another link: a classifier edge, or a link another mark owns, cannot be reached from here.
553
+ */
554
+ deleteMarkLink(judgementId) {
555
+ return Number(db.prepare(`DELETE FROM decision_links WHERE id = ? AND relation = 'supersedes'`).run(`mark:${judgementId}`).changes);
556
+ },
749
557
  /**
750
558
  * ALI-1065: a pair gets ONE edge, never two. `insertLinkRow`'s unique index is on
751
559
  * (source_id, target_id, relation), so writing `supersedes` for a pair that already
@@ -755,8 +563,26 @@ export function createLocalDb(dbPath) {
755
563
  * classification can upgrade a cosine `relates` edge into a typed one atomically.
756
564
  */
757
565
  replaceLink(link) {
758
- db.prepare('DELETE FROM decision_links WHERE (source_id = ? AND target_id = ?) OR (source_id = ? AND target_id = ?)').run(link.sourceId, link.targetId, link.targetId, link.sourceId);
759
- insertLinkRow(link);
566
+ // LM: an edge a person's `align mark ... replaces` wrote (id `mark:<judgement id>`) is theirs, not
567
+ // the classifier's to upgrade away: deleting it would orphan the judgement, and `--undo` could
568
+ // no longer find its link. The pair may then carry that edge beside the new one.
569
+ // One unit (review F8): a failure after the delete must not leave the pair unlinked. A
570
+ // SAVEPOINT, not BEGIN, so a caller already inside a transaction can still call this.
571
+ db.exec('SAVEPOINT replace_link');
572
+ try {
573
+ // Review F1: a `replaces` mark written over an existing classifier row keeps that row's id,
574
+ // so the judgement itself is what protects it, not only the `mark:` id.
575
+ db.prepare(`DELETE FROM decision_links WHERE ((source_id = ? AND target_id = ?) OR (source_id = ? AND target_id = ?)) AND id NOT LIKE 'mark:%'
576
+ AND NOT (relation = 'supersedes' AND EXISTS (SELECT 1 FROM local_judgements j
577
+ WHERE j.kind = 'supersede' AND j.decision_id = decision_links.source_id AND j.counterpart_id = decision_links.target_id))`).run(link.sourceId, link.targetId, link.targetId, link.sourceId);
578
+ insertLinkRow(link);
579
+ db.exec('RELEASE replace_link');
580
+ }
581
+ catch (err) {
582
+ db.exec('ROLLBACK TO replace_link');
583
+ db.exec('RELEASE replace_link');
584
+ throw err;
585
+ }
760
586
  },
761
587
  /**
762
588
  * ALI-792: what this decision's text points at (ticket keys, #N, tool URLs).
@@ -851,6 +677,11 @@ export function createLocalDb(dbPath) {
851
677
  }
852
678
  return db.prepare(sql).all(...params);
853
679
  },
680
+ /** True when another stored decision supersedes this one: the v1 detector shows it RETIRED and refuses a verdict edge (review F5). */
681
+ isSuperseded(decisionId) {
682
+ return db.prepare(`SELECT 1 FROM decision_links l JOIN decisions s ON s.id = l.source_id
683
+ WHERE l.target_id = ? AND l.relation IN ('supersedes', 'partially_supersedes') LIMIT 1`).get(decisionId) !== undefined;
684
+ },
854
685
  getStats() {
855
686
  const decisions = db.prepare(`SELECT COUNT(*) as n FROM decisions`).get().n;
856
687
  const embeddings = db.prepare(`SELECT COUNT(*) as n FROM decision_embeddings`).get().n;
@@ -862,11 +693,30 @@ export function createLocalDb(dbPath) {
862
693
  // decision_refs listed explicitly: SQLite leaves foreign_keys OFF unless asked,
863
694
  // so the schema's ON DELETE CASCADE never fires (same fact the v2 migration
864
695
  // documents above).
696
+ bumpRowSetEpoch(db);
865
697
  db.exec(`DELETE FROM decision_refs; DELETE FROM decision_links; DELETE FROM decision_embeddings; DELETE FROM decisions;`);
866
698
  },
699
+ /** Goes up whenever a decision is deleted or re-id'd or an embedding is deleted or replaced
700
+ * on this connection (see local-db-epoch.ts). A holder of a copy of the embeddings
701
+ * compares it to the value it built at. */
702
+ rowSetEpoch() {
703
+ return rowSetEpoch(db);
704
+ },
705
+ /** SQLite's data_version: changes when ANOTHER connection commits (another process, an
706
+ * MCP server, a second CLI), never for this connection's own writes. The cross-process
707
+ * half of "has the graph moved under my copy of it". */
708
+ dataVersion() {
709
+ return (dataVersionStmt ??= db.prepare('PRAGMA data_version')).get()['data_version'];
710
+ },
711
+ /** Stored embeddings of every model: an upper bound on what a matrix would hold, read
712
+ * before building one so a huge graph is never loaded just to be refused. */
713
+ countEmbeddings() {
714
+ return db.prepare('SELECT COUNT(*) AS n FROM decision_embeddings').get().n;
715
+ },
867
716
  close() {
868
717
  db.close();
869
718
  },
870
719
  };
720
+ return api;
871
721
  }
872
722
  //# sourceMappingURL=local-db.js.map