@schema-weaver/pg-connector 0.0.0-stage → 2.0.1

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 (1065) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/LICENSE +21 -0
  3. package/README.md +457 -2
  4. package/dist/cjs/audit/chain.d.ts +365 -0
  5. package/dist/cjs/audit/chain.d.ts.map +1 -0
  6. package/dist/cjs/audit/chain.js +959 -0
  7. package/dist/cjs/audit/chain.js.map +1 -0
  8. package/dist/cjs/audit/cloud-client.d.ts +142 -0
  9. package/dist/cjs/audit/cloud-client.d.ts.map +1 -0
  10. package/dist/cjs/audit/cloud-client.js +364 -0
  11. package/dist/cjs/audit/cloud-client.js.map +1 -0
  12. package/dist/cjs/audit/cloud-writer.d.ts +57 -0
  13. package/dist/cjs/audit/cloud-writer.d.ts.map +1 -0
  14. package/dist/cjs/audit/cloud-writer.js +95 -0
  15. package/dist/cjs/audit/cloud-writer.js.map +1 -0
  16. package/dist/cjs/audit/context.d.ts +51 -0
  17. package/dist/cjs/audit/context.d.ts.map +1 -0
  18. package/dist/cjs/audit/context.js +75 -0
  19. package/dist/cjs/audit/context.js.map +1 -0
  20. package/dist/cjs/audit/files.d.ts +111 -0
  21. package/dist/cjs/audit/files.d.ts.map +1 -0
  22. package/dist/cjs/audit/files.js +406 -0
  23. package/dist/cjs/audit/files.js.map +1 -0
  24. package/dist/cjs/audit/index.d.ts +9 -0
  25. package/dist/cjs/audit/index.d.ts.map +1 -0
  26. package/dist/cjs/audit/index.js +68 -0
  27. package/dist/cjs/audit/index.js.map +1 -0
  28. package/dist/cjs/audit/local-writer.d.ts +255 -0
  29. package/dist/cjs/audit/local-writer.d.ts.map +1 -0
  30. package/dist/cjs/audit/local-writer.js +829 -0
  31. package/dist/cjs/audit/local-writer.js.map +1 -0
  32. package/dist/cjs/audit/redact.d.ts +151 -0
  33. package/dist/cjs/audit/redact.d.ts.map +1 -0
  34. package/dist/cjs/audit/redact.js +549 -0
  35. package/dist/cjs/audit/redact.js.map +1 -0
  36. package/dist/cjs/audit/sanitize.d.ts +78 -0
  37. package/dist/cjs/audit/sanitize.d.ts.map +1 -0
  38. package/dist/cjs/audit/sanitize.js +315 -0
  39. package/dist/cjs/audit/sanitize.js.map +1 -0
  40. package/dist/cjs/audit/sink.d.ts +278 -0
  41. package/dist/cjs/audit/sink.d.ts.map +1 -0
  42. package/dist/cjs/audit/sink.js +819 -0
  43. package/dist/cjs/audit/sink.js.map +1 -0
  44. package/dist/cjs/audit/types.d.ts +226 -0
  45. package/dist/cjs/audit/types.d.ts.map +1 -0
  46. package/dist/cjs/audit/types.js +3 -0
  47. package/dist/cjs/audit/types.js.map +1 -0
  48. package/dist/cjs/audit/verify-cache.d.ts +127 -0
  49. package/dist/cjs/audit/verify-cache.d.ts.map +1 -0
  50. package/dist/cjs/audit/verify-cache.js +668 -0
  51. package/dist/cjs/audit/verify-cache.js.map +1 -0
  52. package/dist/cjs/channels/agent-session.d.ts +228 -0
  53. package/dist/cjs/channels/agent-session.d.ts.map +1 -0
  54. package/dist/cjs/channels/agent-session.js +604 -0
  55. package/dist/cjs/channels/agent-session.js.map +1 -0
  56. package/dist/cjs/channels/data-channel.d.ts +181 -0
  57. package/dist/cjs/channels/data-channel.d.ts.map +1 -0
  58. package/dist/cjs/channels/data-channel.js +607 -0
  59. package/dist/cjs/channels/data-channel.js.map +1 -0
  60. package/dist/cjs/channels/reconnect.d.ts +142 -0
  61. package/dist/cjs/channels/reconnect.d.ts.map +1 -0
  62. package/dist/cjs/channels/reconnect.js +247 -0
  63. package/dist/cjs/channels/reconnect.js.map +1 -0
  64. package/dist/cjs/channels/types.d.ts +112 -0
  65. package/dist/cjs/channels/types.d.ts.map +1 -0
  66. package/dist/cjs/channels/types.js +3 -0
  67. package/dist/cjs/channels/types.js.map +1 -0
  68. package/dist/cjs/channels/wake-channel.d.ts +232 -0
  69. package/dist/cjs/channels/wake-channel.d.ts.map +1 -0
  70. package/dist/cjs/channels/wake-channel.js +752 -0
  71. package/dist/cjs/channels/wake-channel.js.map +1 -0
  72. package/dist/cjs/cli/banner.d.ts +2 -0
  73. package/dist/cjs/cli/banner.d.ts.map +1 -0
  74. package/dist/cjs/cli/banner.js +150 -0
  75. package/dist/cjs/cli/banner.js.map +1 -0
  76. package/dist/cjs/cli/commands/agent.d.ts +30 -0
  77. package/dist/cjs/cli/commands/agent.d.ts.map +1 -0
  78. package/dist/cjs/cli/commands/agent.js +214 -0
  79. package/dist/cjs/cli/commands/agent.js.map +1 -0
  80. package/dist/cjs/cli/commands/audit-verify.d.ts +19 -0
  81. package/dist/cjs/cli/commands/audit-verify.d.ts.map +1 -0
  82. package/dist/cjs/cli/commands/audit-verify.js +382 -0
  83. package/dist/cjs/cli/commands/audit-verify.js.map +1 -0
  84. package/dist/cjs/cli/commands/clean.d.ts +23 -0
  85. package/dist/cjs/cli/commands/clean.d.ts.map +1 -0
  86. package/dist/cjs/cli/commands/clean.js +272 -0
  87. package/dist/cjs/cli/commands/clean.js.map +1 -0
  88. package/dist/cjs/cli/commands/config-show.d.ts +2 -0
  89. package/dist/cjs/cli/commands/config-show.d.ts.map +1 -0
  90. package/dist/cjs/cli/commands/config-show.js +10 -0
  91. package/dist/cjs/cli/commands/config-show.js.map +1 -0
  92. package/dist/cjs/cli/commands/config.d.ts +6 -0
  93. package/dist/cjs/cli/commands/config.d.ts.map +1 -0
  94. package/dist/cjs/cli/commands/config.js +266 -0
  95. package/dist/cjs/cli/commands/config.js.map +1 -0
  96. package/dist/cjs/cli/commands/db-add.d.ts +16 -0
  97. package/dist/cjs/cli/commands/db-add.d.ts.map +1 -0
  98. package/dist/cjs/cli/commands/db-add.js +613 -0
  99. package/dist/cjs/cli/commands/db-add.js.map +1 -0
  100. package/dist/cjs/cli/commands/db-edit.d.ts +2 -0
  101. package/dist/cjs/cli/commands/db-edit.d.ts.map +1 -0
  102. package/dist/cjs/cli/commands/db-edit.js +388 -0
  103. package/dist/cjs/cli/commands/db-edit.js.map +1 -0
  104. package/dist/cjs/cli/commands/db-logs.d.ts +3 -0
  105. package/dist/cjs/cli/commands/db-logs.d.ts.map +1 -0
  106. package/dist/cjs/cli/commands/db-logs.js +67 -0
  107. package/dist/cjs/cli/commands/db-logs.js.map +1 -0
  108. package/dist/cjs/cli/commands/db-ls.d.ts +2 -0
  109. package/dist/cjs/cli/commands/db-ls.d.ts.map +1 -0
  110. package/dist/cjs/cli/commands/db-ls.js +118 -0
  111. package/dist/cjs/cli/commands/db-ls.js.map +1 -0
  112. package/dist/cjs/cli/commands/db-query.d.ts +121 -0
  113. package/dist/cjs/cli/commands/db-query.d.ts.map +1 -0
  114. package/dist/cjs/cli/commands/db-query.js +802 -0
  115. package/dist/cjs/cli/commands/db-query.js.map +1 -0
  116. package/dist/cjs/cli/commands/db-remove.d.ts +2 -0
  117. package/dist/cjs/cli/commands/db-remove.d.ts.map +1 -0
  118. package/dist/cjs/cli/commands/db-remove.js +51 -0
  119. package/dist/cjs/cli/commands/db-remove.js.map +1 -0
  120. package/dist/cjs/cli/commands/db-show.d.ts +2 -0
  121. package/dist/cjs/cli/commands/db-show.d.ts.map +1 -0
  122. package/dist/cjs/cli/commands/db-show.js +134 -0
  123. package/dist/cjs/cli/commands/db-show.js.map +1 -0
  124. package/dist/cjs/cli/commands/db-test.d.ts +3 -0
  125. package/dist/cjs/cli/commands/db-test.d.ts.map +1 -0
  126. package/dist/cjs/cli/commands/db-test.js +311 -0
  127. package/dist/cjs/cli/commands/db-test.js.map +1 -0
  128. package/dist/cjs/cli/commands/db.d.ts +11 -0
  129. package/dist/cjs/cli/commands/db.d.ts.map +1 -0
  130. package/dist/cjs/cli/commands/db.js +90 -0
  131. package/dist/cjs/cli/commands/db.js.map +1 -0
  132. package/dist/cjs/cli/commands/debug.d.ts +2 -0
  133. package/dist/cjs/cli/commands/debug.d.ts.map +1 -0
  134. package/dist/cjs/cli/commands/debug.js +241 -0
  135. package/dist/cjs/cli/commands/debug.js.map +1 -0
  136. package/dist/cjs/cli/commands/doctor.d.ts +5 -0
  137. package/dist/cjs/cli/commands/doctor.d.ts.map +1 -0
  138. package/dist/cjs/cli/commands/doctor.js +117 -0
  139. package/dist/cjs/cli/commands/doctor.js.map +1 -0
  140. package/dist/cjs/cli/commands/index.d.ts +10 -0
  141. package/dist/cjs/cli/commands/index.d.ts.map +1 -0
  142. package/dist/cjs/cli/commands/index.js +30 -0
  143. package/dist/cjs/cli/commands/index.js.map +1 -0
  144. package/dist/cjs/cli/commands/init.d.ts +2 -0
  145. package/dist/cjs/cli/commands/init.d.ts.map +1 -0
  146. package/dist/cjs/cli/commands/init.js +199 -0
  147. package/dist/cjs/cli/commands/init.js.map +1 -0
  148. package/dist/cjs/cli/commands/link.d.ts +5 -0
  149. package/dist/cjs/cli/commands/link.d.ts.map +1 -0
  150. package/dist/cjs/cli/commands/link.js +44 -0
  151. package/dist/cjs/cli/commands/link.js.map +1 -0
  152. package/dist/cjs/cli/commands/logs.d.ts +17 -0
  153. package/dist/cjs/cli/commands/logs.d.ts.map +1 -0
  154. package/dist/cjs/cli/commands/logs.js +314 -0
  155. package/dist/cjs/cli/commands/logs.js.map +1 -0
  156. package/dist/cjs/cli/commands/project-show.d.ts +2 -0
  157. package/dist/cjs/cli/commands/project-show.d.ts.map +1 -0
  158. package/dist/cjs/cli/commands/project-show.js +105 -0
  159. package/dist/cjs/cli/commands/project-show.js.map +1 -0
  160. package/dist/cjs/cli/commands/project.d.ts +3 -0
  161. package/dist/cjs/cli/commands/project.d.ts.map +1 -0
  162. package/dist/cjs/cli/commands/project.js +64 -0
  163. package/dist/cjs/cli/commands/project.js.map +1 -0
  164. package/dist/cjs/cli/commands/service.d.ts +123 -0
  165. package/dist/cjs/cli/commands/service.d.ts.map +1 -0
  166. package/dist/cjs/cli/commands/service.js +554 -0
  167. package/dist/cjs/cli/commands/service.js.map +1 -0
  168. package/dist/cjs/cli/commands/start.d.ts +6 -0
  169. package/dist/cjs/cli/commands/start.d.ts.map +1 -0
  170. package/dist/cjs/cli/commands/start.js +308 -0
  171. package/dist/cjs/cli/commands/start.js.map +1 -0
  172. package/dist/cjs/cli/commands/status.d.ts +2 -0
  173. package/dist/cjs/cli/commands/status.d.ts.map +1 -0
  174. package/dist/cjs/cli/commands/status.js +225 -0
  175. package/dist/cjs/cli/commands/status.js.map +1 -0
  176. package/dist/cjs/cli/commands/stop.d.ts +6 -0
  177. package/dist/cjs/cli/commands/stop.d.ts.map +1 -0
  178. package/dist/cjs/cli/commands/stop.js +99 -0
  179. package/dist/cjs/cli/commands/stop.js.map +1 -0
  180. package/dist/cjs/cli/daemon/error-tracker.d.ts +119 -0
  181. package/dist/cjs/cli/daemon/error-tracker.d.ts.map +1 -0
  182. package/dist/cjs/cli/daemon/error-tracker.js +500 -0
  183. package/dist/cjs/cli/daemon/error-tracker.js.map +1 -0
  184. package/dist/cjs/cli/daemon/fault-shutdown.d.ts +144 -0
  185. package/dist/cjs/cli/daemon/fault-shutdown.d.ts.map +1 -0
  186. package/dist/cjs/cli/daemon/fault-shutdown.js +312 -0
  187. package/dist/cjs/cli/daemon/fault-shutdown.js.map +1 -0
  188. package/dist/cjs/cli/daemon/index.d.ts +12 -0
  189. package/dist/cjs/cli/daemon/index.d.ts.map +1 -0
  190. package/dist/cjs/cli/daemon/index.js +23 -0
  191. package/dist/cjs/cli/daemon/index.js.map +1 -0
  192. package/dist/cjs/cli/daemon/pid-file.d.ts +13 -0
  193. package/dist/cjs/cli/daemon/pid-file.d.ts.map +1 -0
  194. package/dist/cjs/cli/daemon/pid-file.js +90 -0
  195. package/dist/cjs/cli/daemon/pid-file.js.map +1 -0
  196. package/dist/cjs/cli/daemon/readiness.d.ts +30 -0
  197. package/dist/cjs/cli/daemon/readiness.d.ts.map +1 -0
  198. package/dist/cjs/cli/daemon/readiness.js +74 -0
  199. package/dist/cjs/cli/daemon/readiness.js.map +1 -0
  200. package/dist/cjs/cli/daemon/runtime.d.ts +366 -0
  201. package/dist/cjs/cli/daemon/runtime.d.ts.map +1 -0
  202. package/dist/cjs/cli/daemon/runtime.js +1343 -0
  203. package/dist/cjs/cli/daemon/runtime.js.map +1 -0
  204. package/dist/cjs/cli/daemon/shutdown.d.ts +7 -0
  205. package/dist/cjs/cli/daemon/shutdown.d.ts.map +1 -0
  206. package/dist/cjs/cli/daemon/shutdown.js +66 -0
  207. package/dist/cjs/cli/daemon/shutdown.js.map +1 -0
  208. package/dist/cjs/cli/daemon/signal-handlers.d.ts +3 -0
  209. package/dist/cjs/cli/daemon/signal-handlers.d.ts.map +1 -0
  210. package/dist/cjs/cli/daemon/signal-handlers.js +27 -0
  211. package/dist/cjs/cli/daemon/signal-handlers.js.map +1 -0
  212. package/dist/cjs/cli/daemon/state.d.ts +157 -0
  213. package/dist/cjs/cli/daemon/state.d.ts.map +1 -0
  214. package/dist/cjs/cli/daemon/state.js +397 -0
  215. package/dist/cjs/cli/daemon/state.js.map +1 -0
  216. package/dist/cjs/cli/daemon/status-file.d.ts +139 -0
  217. package/dist/cjs/cli/daemon/status-file.d.ts.map +1 -0
  218. package/dist/cjs/cli/daemon/status-file.js +88 -0
  219. package/dist/cjs/cli/daemon/status-file.js.map +1 -0
  220. package/dist/cjs/cli/doctor/checks.d.ts +133 -0
  221. package/dist/cjs/cli/doctor/checks.d.ts.map +1 -0
  222. package/dist/cjs/cli/doctor/checks.js +677 -0
  223. package/dist/cjs/cli/doctor/checks.js.map +1 -0
  224. package/dist/cjs/cli/doctor/fixes.d.ts +9 -0
  225. package/dist/cjs/cli/doctor/fixes.d.ts.map +1 -0
  226. package/dist/cjs/cli/doctor/fixes.js +199 -0
  227. package/dist/cjs/cli/doctor/fixes.js.map +1 -0
  228. package/dist/cjs/cli/doctor/index.d.ts +7 -0
  229. package/dist/cjs/cli/doctor/index.d.ts.map +1 -0
  230. package/dist/cjs/cli/doctor/index.js +27 -0
  231. package/dist/cjs/cli/doctor/index.js.map +1 -0
  232. package/dist/cjs/cli/index.d.ts +3 -0
  233. package/dist/cjs/cli/index.d.ts.map +1 -0
  234. package/dist/cjs/cli/index.js +336 -0
  235. package/dist/cjs/cli/index.js.map +1 -0
  236. package/dist/cjs/cli/interactive.d.ts +8 -0
  237. package/dist/cjs/cli/interactive.d.ts.map +1 -0
  238. package/dist/cjs/cli/interactive.js +670 -0
  239. package/dist/cjs/cli/interactive.js.map +1 -0
  240. package/dist/cjs/cli/logs/format.d.ts +13 -0
  241. package/dist/cjs/cli/logs/format.d.ts.map +1 -0
  242. package/dist/cjs/cli/logs/format.js +178 -0
  243. package/dist/cjs/cli/logs/format.js.map +1 -0
  244. package/dist/cjs/cli/logs/index.d.ts +3 -0
  245. package/dist/cjs/cli/logs/index.d.ts.map +1 -0
  246. package/dist/cjs/cli/logs/index.js +13 -0
  247. package/dist/cjs/cli/logs/index.js.map +1 -0
  248. package/dist/cjs/cli/logs/viewer.d.ts +41 -0
  249. package/dist/cjs/cli/logs/viewer.d.ts.map +1 -0
  250. package/dist/cjs/cli/logs/viewer.js +417 -0
  251. package/dist/cjs/cli/logs/viewer.js.map +1 -0
  252. package/dist/cjs/cli/ops/operation-logger.d.ts +63 -0
  253. package/dist/cjs/cli/ops/operation-logger.d.ts.map +1 -0
  254. package/dist/cjs/cli/ops/operation-logger.js +183 -0
  255. package/dist/cjs/cli/ops/operation-logger.js.map +1 -0
  256. package/dist/cjs/cli/palette.d.ts +11 -0
  257. package/dist/cjs/cli/palette.d.ts.map +1 -0
  258. package/dist/cjs/cli/palette.js +243 -0
  259. package/dist/cjs/cli/palette.js.map +1 -0
  260. package/dist/cjs/cli/prompt.d.ts +186 -0
  261. package/dist/cjs/cli/prompt.d.ts.map +1 -0
  262. package/dist/cjs/cli/prompt.js +541 -0
  263. package/dist/cjs/cli/prompt.js.map +1 -0
  264. package/dist/cjs/cli/ui/box.d.ts +21 -0
  265. package/dist/cjs/cli/ui/box.d.ts.map +1 -0
  266. package/dist/cjs/cli/ui/box.js +72 -0
  267. package/dist/cjs/cli/ui/box.js.map +1 -0
  268. package/dist/cjs/cli/ui/clipboard.d.ts +6 -0
  269. package/dist/cjs/cli/ui/clipboard.d.ts.map +1 -0
  270. package/dist/cjs/cli/ui/clipboard.js +78 -0
  271. package/dist/cjs/cli/ui/clipboard.js.map +1 -0
  272. package/dist/cjs/cli/ui/colors.d.ts +57 -0
  273. package/dist/cjs/cli/ui/colors.d.ts.map +1 -0
  274. package/dist/cjs/cli/ui/colors.js +151 -0
  275. package/dist/cjs/cli/ui/colors.js.map +1 -0
  276. package/dist/cjs/cli/ui/index.d.ts +9 -0
  277. package/dist/cjs/cli/ui/index.d.ts.map +1 -0
  278. package/dist/cjs/cli/ui/index.js +55 -0
  279. package/dist/cjs/cli/ui/index.js.map +1 -0
  280. package/dist/cjs/cli/ui/spinner.d.ts +12 -0
  281. package/dist/cjs/cli/ui/spinner.d.ts.map +1 -0
  282. package/dist/cjs/cli/ui/spinner.js +82 -0
  283. package/dist/cjs/cli/ui/spinner.js.map +1 -0
  284. package/dist/cjs/cli/ui/symbols.d.ts +47 -0
  285. package/dist/cjs/cli/ui/symbols.d.ts.map +1 -0
  286. package/dist/cjs/cli/ui/symbols.js +112 -0
  287. package/dist/cjs/cli/ui/symbols.js.map +1 -0
  288. package/dist/cjs/cli/ui/table.d.ts +23 -0
  289. package/dist/cjs/cli/ui/table.d.ts.map +1 -0
  290. package/dist/cjs/cli/ui/table.js +160 -0
  291. package/dist/cjs/cli/ui/table.js.map +1 -0
  292. package/dist/cjs/cli/ui/terminal.d.ts +7 -0
  293. package/dist/cjs/cli/ui/terminal.d.ts.map +1 -0
  294. package/dist/cjs/cli/ui/terminal.js +40 -0
  295. package/dist/cjs/cli/ui/terminal.js.map +1 -0
  296. package/dist/cjs/config/atomic-write.d.ts +69 -0
  297. package/dist/cjs/config/atomic-write.d.ts.map +1 -0
  298. package/dist/cjs/config/atomic-write.js +289 -0
  299. package/dist/cjs/config/atomic-write.js.map +1 -0
  300. package/dist/cjs/config/db-config.d.ts +134 -0
  301. package/dist/cjs/config/db-config.d.ts.map +1 -0
  302. package/dist/cjs/config/db-config.js +594 -0
  303. package/dist/cjs/config/db-config.js.map +1 -0
  304. package/dist/cjs/config/machine-config.d.ts +85 -0
  305. package/dist/cjs/config/machine-config.d.ts.map +1 -0
  306. package/dist/cjs/config/machine-config.js +232 -0
  307. package/dist/cjs/config/machine-config.js.map +1 -0
  308. package/dist/cjs/config/paths.d.ts +64 -0
  309. package/dist/cjs/config/paths.d.ts.map +1 -0
  310. package/dist/cjs/config/paths.js +155 -0
  311. package/dist/cjs/config/paths.js.map +1 -0
  312. package/dist/cjs/config/schema.d.ts +72 -0
  313. package/dist/cjs/config/schema.d.ts.map +1 -0
  314. package/dist/cjs/config/schema.js +197 -0
  315. package/dist/cjs/config/schema.js.map +1 -0
  316. package/dist/cjs/config/token.d.ts +63 -0
  317. package/dist/cjs/config/token.d.ts.map +1 -0
  318. package/dist/cjs/config/token.js +146 -0
  319. package/dist/cjs/config/token.js.map +1 -0
  320. package/dist/cjs/execution/canceller.d.ts +41 -0
  321. package/dist/cjs/execution/canceller.d.ts.map +1 -0
  322. package/dist/cjs/execution/canceller.js +209 -0
  323. package/dist/cjs/execution/canceller.js.map +1 -0
  324. package/dist/cjs/execution/database-lookup.d.ts +56 -0
  325. package/dist/cjs/execution/database-lookup.d.ts.map +1 -0
  326. package/dist/cjs/execution/database-lookup.js +43 -0
  327. package/dist/cjs/execution/database-lookup.js.map +1 -0
  328. package/dist/cjs/execution/dispatcher.d.ts +181 -0
  329. package/dist/cjs/execution/dispatcher.d.ts.map +1 -0
  330. package/dist/cjs/execution/dispatcher.js +1296 -0
  331. package/dist/cjs/execution/dispatcher.js.map +1 -0
  332. package/dist/cjs/execution/function-effects.d.ts +209 -0
  333. package/dist/cjs/execution/function-effects.d.ts.map +1 -0
  334. package/dist/cjs/execution/function-effects.js +596 -0
  335. package/dist/cjs/execution/function-effects.js.map +1 -0
  336. package/dist/cjs/execution/introspection.d.ts +76 -0
  337. package/dist/cjs/execution/introspection.d.ts.map +1 -0
  338. package/dist/cjs/execution/introspection.js +448 -0
  339. package/dist/cjs/execution/introspection.js.map +1 -0
  340. package/dist/cjs/execution/migration-runner.d.ts +128 -0
  341. package/dist/cjs/execution/migration-runner.d.ts.map +1 -0
  342. package/dist/cjs/execution/migration-runner.js +798 -0
  343. package/dist/cjs/execution/migration-runner.js.map +1 -0
  344. package/dist/cjs/execution/non-tx-detector.d.ts +23 -0
  345. package/dist/cjs/execution/non-tx-detector.d.ts.map +1 -0
  346. package/dist/cjs/execution/non-tx-detector.js +218 -0
  347. package/dist/cjs/execution/non-tx-detector.js.map +1 -0
  348. package/dist/cjs/execution/pool.d.ts +229 -0
  349. package/dist/cjs/execution/pool.d.ts.map +1 -0
  350. package/dist/cjs/execution/pool.js +738 -0
  351. package/dist/cjs/execution/pool.js.map +1 -0
  352. package/dist/cjs/execution/query-runner.d.ts +88 -0
  353. package/dist/cjs/execution/query-runner.d.ts.map +1 -0
  354. package/dist/cjs/execution/query-runner.js +751 -0
  355. package/dist/cjs/execution/query-runner.js.map +1 -0
  356. package/dist/cjs/execution/rate-limiter.d.ts +120 -0
  357. package/dist/cjs/execution/rate-limiter.d.ts.map +1 -0
  358. package/dist/cjs/execution/rate-limiter.js +273 -0
  359. package/dist/cjs/execution/rate-limiter.js.map +1 -0
  360. package/dist/cjs/execution/search-path.d.ts +161 -0
  361. package/dist/cjs/execution/search-path.d.ts.map +1 -0
  362. package/dist/cjs/execution/search-path.js +279 -0
  363. package/dist/cjs/execution/search-path.js.map +1 -0
  364. package/dist/cjs/execution/sql-parser.d.ts +195 -0
  365. package/dist/cjs/execution/sql-parser.d.ts.map +1 -0
  366. package/dist/cjs/execution/sql-parser.js +704 -0
  367. package/dist/cjs/execution/sql-parser.js.map +1 -0
  368. package/dist/cjs/execution/statement-classifier.d.ts +103 -0
  369. package/dist/cjs/execution/statement-classifier.d.ts.map +1 -0
  370. package/dist/cjs/execution/statement-classifier.js +535 -0
  371. package/dist/cjs/execution/statement-classifier.js.map +1 -0
  372. package/dist/cjs/execution/types.d.ts +189 -0
  373. package/dist/cjs/execution/types.d.ts.map +1 -0
  374. package/dist/cjs/execution/types.js +28 -0
  375. package/dist/cjs/execution/types.js.map +1 -0
  376. package/dist/cjs/index.d.ts +34 -0
  377. package/dist/cjs/index.d.ts.map +1 -0
  378. package/dist/cjs/index.js +98 -0
  379. package/dist/cjs/index.js.map +1 -0
  380. package/dist/cjs/permissions/auto-upgrade.d.ts +40 -0
  381. package/dist/cjs/permissions/auto-upgrade.d.ts.map +1 -0
  382. package/dist/cjs/permissions/auto-upgrade.js +168 -0
  383. package/dist/cjs/permissions/auto-upgrade.js.map +1 -0
  384. package/dist/cjs/permissions/checker.d.ts +53 -0
  385. package/dist/cjs/permissions/checker.d.ts.map +1 -0
  386. package/dist/cjs/permissions/checker.js +326 -0
  387. package/dist/cjs/permissions/checker.js.map +1 -0
  388. package/dist/cjs/permissions/manual-approval.d.ts +213 -0
  389. package/dist/cjs/permissions/manual-approval.d.ts.map +1 -0
  390. package/dist/cjs/permissions/manual-approval.js +541 -0
  391. package/dist/cjs/permissions/manual-approval.js.map +1 -0
  392. package/dist/cjs/permissions/plan-registry.d.ts +274 -0
  393. package/dist/cjs/permissions/plan-registry.d.ts.map +1 -0
  394. package/dist/cjs/permissions/plan-registry.js +454 -0
  395. package/dist/cjs/permissions/plan-registry.js.map +1 -0
  396. package/dist/cjs/permissions/role-policy.d.ts +217 -0
  397. package/dist/cjs/permissions/role-policy.d.ts.map +1 -0
  398. package/dist/cjs/permissions/role-policy.js +584 -0
  399. package/dist/cjs/permissions/role-policy.js.map +1 -0
  400. package/dist/cjs/permissions/types.d.ts +126 -0
  401. package/dist/cjs/permissions/types.d.ts.map +1 -0
  402. package/dist/cjs/permissions/types.js +3 -0
  403. package/dist/cjs/permissions/types.js.map +1 -0
  404. package/dist/cjs/protocol/constants.d.ts +72 -0
  405. package/dist/cjs/protocol/constants.d.ts.map +1 -0
  406. package/dist/cjs/protocol/constants.js +107 -0
  407. package/dist/cjs/protocol/constants.js.map +1 -0
  408. package/dist/cjs/protocol/envelope.d.ts +165 -0
  409. package/dist/cjs/protocol/envelope.d.ts.map +1 -0
  410. package/dist/cjs/protocol/envelope.js +309 -0
  411. package/dist/cjs/protocol/envelope.js.map +1 -0
  412. package/dist/cjs/protocol/errors.d.ts +33 -0
  413. package/dist/cjs/protocol/errors.d.ts.map +1 -0
  414. package/dist/cjs/protocol/errors.js +391 -0
  415. package/dist/cjs/protocol/errors.js.map +1 -0
  416. package/dist/cjs/protocol/messages.d.ts +327 -0
  417. package/dist/cjs/protocol/messages.d.ts.map +1 -0
  418. package/dist/cjs/protocol/messages.js +3 -0
  419. package/dist/cjs/protocol/messages.js.map +1 -0
  420. package/dist/cjs/protocol/serialize.d.ts +26 -0
  421. package/dist/cjs/protocol/serialize.d.ts.map +1 -0
  422. package/dist/cjs/protocol/serialize.js +71 -0
  423. package/dist/cjs/protocol/serialize.js.map +1 -0
  424. package/dist/cjs/protocol/validate.d.ts +135 -0
  425. package/dist/cjs/protocol/validate.d.ts.map +1 -0
  426. package/dist/cjs/protocol/validate.js +852 -0
  427. package/dist/cjs/protocol/validate.js.map +1 -0
  428. package/dist/esm/audit/chain.d.ts +365 -0
  429. package/dist/esm/audit/chain.d.ts.map +1 -0
  430. package/dist/esm/audit/chain.js +895 -0
  431. package/dist/esm/audit/chain.js.map +1 -0
  432. package/dist/esm/audit/cloud-client.d.ts +142 -0
  433. package/dist/esm/audit/cloud-client.d.ts.map +1 -0
  434. package/dist/esm/audit/cloud-client.js +326 -0
  435. package/dist/esm/audit/cloud-client.js.map +1 -0
  436. package/dist/esm/audit/cloud-writer.d.ts +57 -0
  437. package/dist/esm/audit/cloud-writer.d.ts.map +1 -0
  438. package/dist/esm/audit/cloud-writer.js +91 -0
  439. package/dist/esm/audit/cloud-writer.js.map +1 -0
  440. package/dist/esm/audit/context.d.ts +51 -0
  441. package/dist/esm/audit/context.d.ts.map +1 -0
  442. package/dist/esm/audit/context.js +69 -0
  443. package/dist/esm/audit/context.js.map +1 -0
  444. package/dist/esm/audit/files.d.ts +111 -0
  445. package/dist/esm/audit/files.d.ts.map +1 -0
  446. package/dist/esm/audit/files.js +361 -0
  447. package/dist/esm/audit/files.js.map +1 -0
  448. package/dist/esm/audit/index.d.ts +9 -0
  449. package/dist/esm/audit/index.d.ts.map +1 -0
  450. package/dist/esm/audit/index.js +8 -0
  451. package/dist/esm/audit/index.js.map +1 -0
  452. package/dist/esm/audit/local-writer.d.ts +255 -0
  453. package/dist/esm/audit/local-writer.d.ts.map +1 -0
  454. package/dist/esm/audit/local-writer.js +785 -0
  455. package/dist/esm/audit/local-writer.js.map +1 -0
  456. package/dist/esm/audit/redact.d.ts +151 -0
  457. package/dist/esm/audit/redact.d.ts.map +1 -0
  458. package/dist/esm/audit/redact.js +506 -0
  459. package/dist/esm/audit/redact.js.map +1 -0
  460. package/dist/esm/audit/sanitize.d.ts +78 -0
  461. package/dist/esm/audit/sanitize.d.ts.map +1 -0
  462. package/dist/esm/audit/sanitize.js +307 -0
  463. package/dist/esm/audit/sanitize.js.map +1 -0
  464. package/dist/esm/audit/sink.d.ts +278 -0
  465. package/dist/esm/audit/sink.d.ts.map +1 -0
  466. package/dist/esm/audit/sink.js +782 -0
  467. package/dist/esm/audit/sink.js.map +1 -0
  468. package/dist/esm/audit/types.d.ts +226 -0
  469. package/dist/esm/audit/types.d.ts.map +1 -0
  470. package/dist/esm/audit/types.js +2 -0
  471. package/dist/esm/audit/types.js.map +1 -0
  472. package/dist/esm/audit/verify-cache.d.ts +127 -0
  473. package/dist/esm/audit/verify-cache.d.ts.map +1 -0
  474. package/dist/esm/audit/verify-cache.js +628 -0
  475. package/dist/esm/audit/verify-cache.js.map +1 -0
  476. package/dist/esm/channels/agent-session.d.ts +228 -0
  477. package/dist/esm/channels/agent-session.d.ts.map +1 -0
  478. package/dist/esm/channels/agent-session.js +566 -0
  479. package/dist/esm/channels/agent-session.js.map +1 -0
  480. package/dist/esm/channels/data-channel.d.ts +181 -0
  481. package/dist/esm/channels/data-channel.d.ts.map +1 -0
  482. package/dist/esm/channels/data-channel.js +567 -0
  483. package/dist/esm/channels/data-channel.js.map +1 -0
  484. package/dist/esm/channels/reconnect.d.ts +142 -0
  485. package/dist/esm/channels/reconnect.d.ts.map +1 -0
  486. package/dist/esm/channels/reconnect.js +234 -0
  487. package/dist/esm/channels/reconnect.js.map +1 -0
  488. package/dist/esm/channels/types.d.ts +112 -0
  489. package/dist/esm/channels/types.d.ts.map +1 -0
  490. package/dist/esm/channels/types.js +2 -0
  491. package/dist/esm/channels/types.js.map +1 -0
  492. package/dist/esm/channels/wake-channel.d.ts +232 -0
  493. package/dist/esm/channels/wake-channel.d.ts.map +1 -0
  494. package/dist/esm/channels/wake-channel.js +715 -0
  495. package/dist/esm/channels/wake-channel.js.map +1 -0
  496. package/dist/esm/cli/banner.d.ts +2 -0
  497. package/dist/esm/cli/banner.d.ts.map +1 -0
  498. package/dist/esm/cli/banner.js +114 -0
  499. package/dist/esm/cli/banner.js.map +1 -0
  500. package/dist/esm/cli/commands/agent.d.ts +30 -0
  501. package/dist/esm/cli/commands/agent.d.ts.map +1 -0
  502. package/dist/esm/cli/commands/agent.js +204 -0
  503. package/dist/esm/cli/commands/agent.js.map +1 -0
  504. package/dist/esm/cli/commands/audit-verify.d.ts +19 -0
  505. package/dist/esm/cli/commands/audit-verify.d.ts.map +1 -0
  506. package/dist/esm/cli/commands/audit-verify.js +345 -0
  507. package/dist/esm/cli/commands/audit-verify.js.map +1 -0
  508. package/dist/esm/cli/commands/clean.d.ts +23 -0
  509. package/dist/esm/cli/commands/clean.d.ts.map +1 -0
  510. package/dist/esm/cli/commands/clean.js +235 -0
  511. package/dist/esm/cli/commands/clean.js.map +1 -0
  512. package/dist/esm/cli/commands/config-show.d.ts +2 -0
  513. package/dist/esm/cli/commands/config-show.d.ts.map +1 -0
  514. package/dist/esm/cli/commands/config-show.js +2 -0
  515. package/dist/esm/cli/commands/config-show.js.map +1 -0
  516. package/dist/esm/cli/commands/config.d.ts +6 -0
  517. package/dist/esm/cli/commands/config.d.ts.map +1 -0
  518. package/dist/esm/cli/commands/config.js +259 -0
  519. package/dist/esm/cli/commands/config.js.map +1 -0
  520. package/dist/esm/cli/commands/db-add.d.ts +16 -0
  521. package/dist/esm/cli/commands/db-add.d.ts.map +1 -0
  522. package/dist/esm/cli/commands/db-add.js +576 -0
  523. package/dist/esm/cli/commands/db-add.js.map +1 -0
  524. package/dist/esm/cli/commands/db-edit.d.ts +2 -0
  525. package/dist/esm/cli/commands/db-edit.d.ts.map +1 -0
  526. package/dist/esm/cli/commands/db-edit.js +352 -0
  527. package/dist/esm/cli/commands/db-edit.js.map +1 -0
  528. package/dist/esm/cli/commands/db-logs.d.ts +3 -0
  529. package/dist/esm/cli/commands/db-logs.d.ts.map +1 -0
  530. package/dist/esm/cli/commands/db-logs.js +64 -0
  531. package/dist/esm/cli/commands/db-logs.js.map +1 -0
  532. package/dist/esm/cli/commands/db-ls.d.ts +2 -0
  533. package/dist/esm/cli/commands/db-ls.d.ts.map +1 -0
  534. package/dist/esm/cli/commands/db-ls.js +115 -0
  535. package/dist/esm/cli/commands/db-ls.js.map +1 -0
  536. package/dist/esm/cli/commands/db-query.d.ts +121 -0
  537. package/dist/esm/cli/commands/db-query.d.ts.map +1 -0
  538. package/dist/esm/cli/commands/db-query.js +754 -0
  539. package/dist/esm/cli/commands/db-query.js.map +1 -0
  540. package/dist/esm/cli/commands/db-remove.d.ts +2 -0
  541. package/dist/esm/cli/commands/db-remove.d.ts.map +1 -0
  542. package/dist/esm/cli/commands/db-remove.js +48 -0
  543. package/dist/esm/cli/commands/db-remove.js.map +1 -0
  544. package/dist/esm/cli/commands/db-show.d.ts +2 -0
  545. package/dist/esm/cli/commands/db-show.d.ts.map +1 -0
  546. package/dist/esm/cli/commands/db-show.js +131 -0
  547. package/dist/esm/cli/commands/db-show.js.map +1 -0
  548. package/dist/esm/cli/commands/db-test.d.ts +3 -0
  549. package/dist/esm/cli/commands/db-test.d.ts.map +1 -0
  550. package/dist/esm/cli/commands/db-test.js +307 -0
  551. package/dist/esm/cli/commands/db-test.js.map +1 -0
  552. package/dist/esm/cli/commands/db.d.ts +11 -0
  553. package/dist/esm/cli/commands/db.d.ts.map +1 -0
  554. package/dist/esm/cli/commands/db.js +76 -0
  555. package/dist/esm/cli/commands/db.js.map +1 -0
  556. package/dist/esm/cli/commands/debug.d.ts +2 -0
  557. package/dist/esm/cli/commands/debug.d.ts.map +1 -0
  558. package/dist/esm/cli/commands/debug.js +205 -0
  559. package/dist/esm/cli/commands/debug.js.map +1 -0
  560. package/dist/esm/cli/commands/doctor.d.ts +5 -0
  561. package/dist/esm/cli/commands/doctor.d.ts.map +1 -0
  562. package/dist/esm/cli/commands/doctor.js +114 -0
  563. package/dist/esm/cli/commands/doctor.js.map +1 -0
  564. package/dist/esm/cli/commands/index.d.ts +10 -0
  565. package/dist/esm/cli/commands/index.d.ts.map +1 -0
  566. package/dist/esm/cli/commands/index.js +10 -0
  567. package/dist/esm/cli/commands/index.js.map +1 -0
  568. package/dist/esm/cli/commands/init.d.ts +2 -0
  569. package/dist/esm/cli/commands/init.d.ts.map +1 -0
  570. package/dist/esm/cli/commands/init.js +163 -0
  571. package/dist/esm/cli/commands/init.js.map +1 -0
  572. package/dist/esm/cli/commands/link.d.ts +5 -0
  573. package/dist/esm/cli/commands/link.d.ts.map +1 -0
  574. package/dist/esm/cli/commands/link.js +41 -0
  575. package/dist/esm/cli/commands/link.js.map +1 -0
  576. package/dist/esm/cli/commands/logs.d.ts +17 -0
  577. package/dist/esm/cli/commands/logs.d.ts.map +1 -0
  578. package/dist/esm/cli/commands/logs.js +278 -0
  579. package/dist/esm/cli/commands/logs.js.map +1 -0
  580. package/dist/esm/cli/commands/project-show.d.ts +2 -0
  581. package/dist/esm/cli/commands/project-show.d.ts.map +1 -0
  582. package/dist/esm/cli/commands/project-show.js +69 -0
  583. package/dist/esm/cli/commands/project-show.js.map +1 -0
  584. package/dist/esm/cli/commands/project.d.ts +3 -0
  585. package/dist/esm/cli/commands/project.d.ts.map +1 -0
  586. package/dist/esm/cli/commands/project.js +60 -0
  587. package/dist/esm/cli/commands/project.js.map +1 -0
  588. package/dist/esm/cli/commands/service.d.ts +123 -0
  589. package/dist/esm/cli/commands/service.d.ts.map +1 -0
  590. package/dist/esm/cli/commands/service.js +505 -0
  591. package/dist/esm/cli/commands/service.js.map +1 -0
  592. package/dist/esm/cli/commands/start.d.ts +6 -0
  593. package/dist/esm/cli/commands/start.d.ts.map +1 -0
  594. package/dist/esm/cli/commands/start.js +272 -0
  595. package/dist/esm/cli/commands/start.js.map +1 -0
  596. package/dist/esm/cli/commands/status.d.ts +2 -0
  597. package/dist/esm/cli/commands/status.d.ts.map +1 -0
  598. package/dist/esm/cli/commands/status.js +222 -0
  599. package/dist/esm/cli/commands/status.js.map +1 -0
  600. package/dist/esm/cli/commands/stop.d.ts +6 -0
  601. package/dist/esm/cli/commands/stop.d.ts.map +1 -0
  602. package/dist/esm/cli/commands/stop.js +96 -0
  603. package/dist/esm/cli/commands/stop.js.map +1 -0
  604. package/dist/esm/cli/daemon/error-tracker.d.ts +119 -0
  605. package/dist/esm/cli/daemon/error-tracker.d.ts.map +1 -0
  606. package/dist/esm/cli/daemon/error-tracker.js +451 -0
  607. package/dist/esm/cli/daemon/error-tracker.js.map +1 -0
  608. package/dist/esm/cli/daemon/fault-shutdown.d.ts +144 -0
  609. package/dist/esm/cli/daemon/fault-shutdown.d.ts.map +1 -0
  610. package/dist/esm/cli/daemon/fault-shutdown.js +273 -0
  611. package/dist/esm/cli/daemon/fault-shutdown.js.map +1 -0
  612. package/dist/esm/cli/daemon/index.d.ts +12 -0
  613. package/dist/esm/cli/daemon/index.d.ts.map +1 -0
  614. package/dist/esm/cli/daemon/index.js +7 -0
  615. package/dist/esm/cli/daemon/index.js.map +1 -0
  616. package/dist/esm/cli/daemon/pid-file.d.ts +13 -0
  617. package/dist/esm/cli/daemon/pid-file.d.ts.map +1 -0
  618. package/dist/esm/cli/daemon/pid-file.js +51 -0
  619. package/dist/esm/cli/daemon/pid-file.js.map +1 -0
  620. package/dist/esm/cli/daemon/readiness.d.ts +30 -0
  621. package/dist/esm/cli/daemon/readiness.d.ts.map +1 -0
  622. package/dist/esm/cli/daemon/readiness.js +70 -0
  623. package/dist/esm/cli/daemon/readiness.js.map +1 -0
  624. package/dist/esm/cli/daemon/runtime.d.ts +366 -0
  625. package/dist/esm/cli/daemon/runtime.d.ts.map +1 -0
  626. package/dist/esm/cli/daemon/runtime.js +1284 -0
  627. package/dist/esm/cli/daemon/runtime.js.map +1 -0
  628. package/dist/esm/cli/daemon/shutdown.d.ts +7 -0
  629. package/dist/esm/cli/daemon/shutdown.d.ts.map +1 -0
  630. package/dist/esm/cli/daemon/shutdown.js +63 -0
  631. package/dist/esm/cli/daemon/shutdown.js.map +1 -0
  632. package/dist/esm/cli/daemon/signal-handlers.d.ts +3 -0
  633. package/dist/esm/cli/daemon/signal-handlers.d.ts.map +1 -0
  634. package/dist/esm/cli/daemon/signal-handlers.js +24 -0
  635. package/dist/esm/cli/daemon/signal-handlers.js.map +1 -0
  636. package/dist/esm/cli/daemon/state.d.ts +157 -0
  637. package/dist/esm/cli/daemon/state.d.ts.map +1 -0
  638. package/dist/esm/cli/daemon/state.js +352 -0
  639. package/dist/esm/cli/daemon/state.js.map +1 -0
  640. package/dist/esm/cli/daemon/status-file.d.ts +139 -0
  641. package/dist/esm/cli/daemon/status-file.d.ts.map +1 -0
  642. package/dist/esm/cli/daemon/status-file.js +50 -0
  643. package/dist/esm/cli/daemon/status-file.js.map +1 -0
  644. package/dist/esm/cli/doctor/checks.d.ts +133 -0
  645. package/dist/esm/cli/doctor/checks.d.ts.map +1 -0
  646. package/dist/esm/cli/doctor/checks.js +624 -0
  647. package/dist/esm/cli/doctor/checks.js.map +1 -0
  648. package/dist/esm/cli/doctor/fixes.d.ts +9 -0
  649. package/dist/esm/cli/doctor/fixes.d.ts.map +1 -0
  650. package/dist/esm/cli/doctor/fixes.js +163 -0
  651. package/dist/esm/cli/doctor/fixes.js.map +1 -0
  652. package/dist/esm/cli/doctor/index.d.ts +7 -0
  653. package/dist/esm/cli/doctor/index.d.ts.map +1 -0
  654. package/dist/esm/cli/doctor/index.js +5 -0
  655. package/dist/esm/cli/doctor/index.js.map +1 -0
  656. package/dist/esm/cli/index.d.ts +3 -0
  657. package/dist/esm/cli/index.d.ts.map +1 -0
  658. package/dist/esm/cli/index.js +333 -0
  659. package/dist/esm/cli/index.js.map +1 -0
  660. package/dist/esm/cli/interactive.d.ts +8 -0
  661. package/dist/esm/cli/interactive.d.ts.map +1 -0
  662. package/dist/esm/cli/interactive.js +665 -0
  663. package/dist/esm/cli/interactive.js.map +1 -0
  664. package/dist/esm/cli/logs/format.d.ts +13 -0
  665. package/dist/esm/cli/logs/format.d.ts.map +1 -0
  666. package/dist/esm/cli/logs/format.js +169 -0
  667. package/dist/esm/cli/logs/format.js.map +1 -0
  668. package/dist/esm/cli/logs/index.d.ts +3 -0
  669. package/dist/esm/cli/logs/index.d.ts.map +1 -0
  670. package/dist/esm/cli/logs/index.js +3 -0
  671. package/dist/esm/cli/logs/index.js.map +1 -0
  672. package/dist/esm/cli/logs/viewer.d.ts +41 -0
  673. package/dist/esm/cli/logs/viewer.d.ts.map +1 -0
  674. package/dist/esm/cli/logs/viewer.js +412 -0
  675. package/dist/esm/cli/logs/viewer.js.map +1 -0
  676. package/dist/esm/cli/ops/operation-logger.d.ts +63 -0
  677. package/dist/esm/cli/ops/operation-logger.d.ts.map +1 -0
  678. package/dist/esm/cli/ops/operation-logger.js +142 -0
  679. package/dist/esm/cli/ops/operation-logger.js.map +1 -0
  680. package/dist/esm/cli/palette.d.ts +11 -0
  681. package/dist/esm/cli/palette.d.ts.map +1 -0
  682. package/dist/esm/cli/palette.js +240 -0
  683. package/dist/esm/cli/palette.js.map +1 -0
  684. package/dist/esm/cli/prompt.d.ts +186 -0
  685. package/dist/esm/cli/prompt.d.ts.map +1 -0
  686. package/dist/esm/cli/prompt.js +483 -0
  687. package/dist/esm/cli/prompt.js.map +1 -0
  688. package/dist/esm/cli/ui/box.d.ts +21 -0
  689. package/dist/esm/cli/ui/box.d.ts.map +1 -0
  690. package/dist/esm/cli/ui/box.js +60 -0
  691. package/dist/esm/cli/ui/box.js.map +1 -0
  692. package/dist/esm/cli/ui/clipboard.d.ts +6 -0
  693. package/dist/esm/cli/ui/clipboard.d.ts.map +1 -0
  694. package/dist/esm/cli/ui/clipboard.js +42 -0
  695. package/dist/esm/cli/ui/clipboard.js.map +1 -0
  696. package/dist/esm/cli/ui/colors.d.ts +57 -0
  697. package/dist/esm/cli/ui/colors.d.ts.map +1 -0
  698. package/dist/esm/cli/ui/colors.js +126 -0
  699. package/dist/esm/cli/ui/colors.js.map +1 -0
  700. package/dist/esm/cli/ui/index.d.ts +9 -0
  701. package/dist/esm/cli/ui/index.d.ts.map +1 -0
  702. package/dist/esm/cli/ui/index.js +7 -0
  703. package/dist/esm/cli/ui/index.js.map +1 -0
  704. package/dist/esm/cli/ui/spinner.d.ts +12 -0
  705. package/dist/esm/cli/ui/spinner.d.ts.map +1 -0
  706. package/dist/esm/cli/ui/spinner.js +78 -0
  707. package/dist/esm/cli/ui/spinner.js.map +1 -0
  708. package/dist/esm/cli/ui/symbols.d.ts +47 -0
  709. package/dist/esm/cli/ui/symbols.d.ts.map +1 -0
  710. package/dist/esm/cli/ui/symbols.js +109 -0
  711. package/dist/esm/cli/ui/symbols.js.map +1 -0
  712. package/dist/esm/cli/ui/table.d.ts +23 -0
  713. package/dist/esm/cli/ui/table.d.ts.map +1 -0
  714. package/dist/esm/cli/ui/table.js +156 -0
  715. package/dist/esm/cli/ui/table.js.map +1 -0
  716. package/dist/esm/cli/ui/terminal.d.ts +7 -0
  717. package/dist/esm/cli/ui/terminal.d.ts.map +1 -0
  718. package/dist/esm/cli/ui/terminal.js +32 -0
  719. package/dist/esm/cli/ui/terminal.js.map +1 -0
  720. package/dist/esm/config/atomic-write.d.ts +69 -0
  721. package/dist/esm/config/atomic-write.d.ts.map +1 -0
  722. package/dist/esm/config/atomic-write.js +246 -0
  723. package/dist/esm/config/atomic-write.js.map +1 -0
  724. package/dist/esm/config/db-config.d.ts +134 -0
  725. package/dist/esm/config/db-config.d.ts.map +1 -0
  726. package/dist/esm/config/db-config.js +542 -0
  727. package/dist/esm/config/db-config.js.map +1 -0
  728. package/dist/esm/config/machine-config.d.ts +85 -0
  729. package/dist/esm/config/machine-config.d.ts.map +1 -0
  730. package/dist/esm/config/machine-config.js +190 -0
  731. package/dist/esm/config/machine-config.js.map +1 -0
  732. package/dist/esm/config/paths.d.ts +64 -0
  733. package/dist/esm/config/paths.d.ts.map +1 -0
  734. package/dist/esm/config/paths.js +108 -0
  735. package/dist/esm/config/paths.js.map +1 -0
  736. package/dist/esm/config/schema.d.ts +72 -0
  737. package/dist/esm/config/schema.d.ts.map +1 -0
  738. package/dist/esm/config/schema.js +180 -0
  739. package/dist/esm/config/schema.js.map +1 -0
  740. package/dist/esm/config/token.d.ts +63 -0
  741. package/dist/esm/config/token.d.ts.map +1 -0
  742. package/dist/esm/config/token.js +104 -0
  743. package/dist/esm/config/token.js.map +1 -0
  744. package/dist/esm/execution/canceller.d.ts +41 -0
  745. package/dist/esm/execution/canceller.d.ts.map +1 -0
  746. package/dist/esm/execution/canceller.js +205 -0
  747. package/dist/esm/execution/canceller.js.map +1 -0
  748. package/dist/esm/execution/database-lookup.d.ts +56 -0
  749. package/dist/esm/execution/database-lookup.d.ts.map +1 -0
  750. package/dist/esm/execution/database-lookup.js +38 -0
  751. package/dist/esm/execution/database-lookup.js.map +1 -0
  752. package/dist/esm/execution/dispatcher.d.ts +181 -0
  753. package/dist/esm/execution/dispatcher.d.ts.map +1 -0
  754. package/dist/esm/execution/dispatcher.js +1258 -0
  755. package/dist/esm/execution/dispatcher.js.map +1 -0
  756. package/dist/esm/execution/function-effects.d.ts +209 -0
  757. package/dist/esm/execution/function-effects.d.ts.map +1 -0
  758. package/dist/esm/execution/function-effects.js +586 -0
  759. package/dist/esm/execution/function-effects.js.map +1 -0
  760. package/dist/esm/execution/introspection.d.ts +76 -0
  761. package/dist/esm/execution/introspection.d.ts.map +1 -0
  762. package/dist/esm/execution/introspection.js +442 -0
  763. package/dist/esm/execution/introspection.js.map +1 -0
  764. package/dist/esm/execution/migration-runner.d.ts +128 -0
  765. package/dist/esm/execution/migration-runner.d.ts.map +1 -0
  766. package/dist/esm/execution/migration-runner.js +754 -0
  767. package/dist/esm/execution/migration-runner.js.map +1 -0
  768. package/dist/esm/execution/non-tx-detector.d.ts +23 -0
  769. package/dist/esm/execution/non-tx-detector.d.ts.map +1 -0
  770. package/dist/esm/execution/non-tx-detector.js +215 -0
  771. package/dist/esm/execution/non-tx-detector.js.map +1 -0
  772. package/dist/esm/execution/pool.d.ts +229 -0
  773. package/dist/esm/execution/pool.d.ts.map +1 -0
  774. package/dist/esm/execution/pool.js +685 -0
  775. package/dist/esm/execution/pool.js.map +1 -0
  776. package/dist/esm/execution/query-runner.d.ts +88 -0
  777. package/dist/esm/execution/query-runner.d.ts.map +1 -0
  778. package/dist/esm/execution/query-runner.js +743 -0
  779. package/dist/esm/execution/query-runner.js.map +1 -0
  780. package/dist/esm/execution/rate-limiter.d.ts +120 -0
  781. package/dist/esm/execution/rate-limiter.d.ts.map +1 -0
  782. package/dist/esm/execution/rate-limiter.js +269 -0
  783. package/dist/esm/execution/rate-limiter.js.map +1 -0
  784. package/dist/esm/execution/search-path.d.ts +161 -0
  785. package/dist/esm/execution/search-path.d.ts.map +1 -0
  786. package/dist/esm/execution/search-path.js +270 -0
  787. package/dist/esm/execution/search-path.js.map +1 -0
  788. package/dist/esm/execution/sql-parser.d.ts +195 -0
  789. package/dist/esm/execution/sql-parser.d.ts.map +1 -0
  790. package/dist/esm/execution/sql-parser.js +683 -0
  791. package/dist/esm/execution/sql-parser.js.map +1 -0
  792. package/dist/esm/execution/statement-classifier.d.ts +103 -0
  793. package/dist/esm/execution/statement-classifier.d.ts.map +1 -0
  794. package/dist/esm/execution/statement-classifier.js +526 -0
  795. package/dist/esm/execution/statement-classifier.js.map +1 -0
  796. package/dist/esm/execution/types.d.ts +189 -0
  797. package/dist/esm/execution/types.d.ts.map +1 -0
  798. package/dist/esm/execution/types.js +22 -0
  799. package/dist/esm/execution/types.js.map +1 -0
  800. package/dist/esm/index.d.ts +34 -0
  801. package/dist/esm/index.d.ts.map +1 -0
  802. package/dist/esm/index.js +38 -0
  803. package/dist/esm/index.js.map +1 -0
  804. package/dist/esm/permissions/auto-upgrade.d.ts +40 -0
  805. package/dist/esm/permissions/auto-upgrade.d.ts.map +1 -0
  806. package/dist/esm/permissions/auto-upgrade.js +164 -0
  807. package/dist/esm/permissions/auto-upgrade.js.map +1 -0
  808. package/dist/esm/permissions/checker.d.ts +53 -0
  809. package/dist/esm/permissions/checker.d.ts.map +1 -0
  810. package/dist/esm/permissions/checker.js +322 -0
  811. package/dist/esm/permissions/checker.js.map +1 -0
  812. package/dist/esm/permissions/manual-approval.d.ts +213 -0
  813. package/dist/esm/permissions/manual-approval.d.ts.map +1 -0
  814. package/dist/esm/permissions/manual-approval.js +503 -0
  815. package/dist/esm/permissions/manual-approval.js.map +1 -0
  816. package/dist/esm/permissions/plan-registry.d.ts +274 -0
  817. package/dist/esm/permissions/plan-registry.d.ts.map +1 -0
  818. package/dist/esm/permissions/plan-registry.js +450 -0
  819. package/dist/esm/permissions/plan-registry.js.map +1 -0
  820. package/dist/esm/permissions/role-policy.d.ts +217 -0
  821. package/dist/esm/permissions/role-policy.d.ts.map +1 -0
  822. package/dist/esm/permissions/role-policy.js +570 -0
  823. package/dist/esm/permissions/role-policy.js.map +1 -0
  824. package/dist/esm/permissions/types.d.ts +126 -0
  825. package/dist/esm/permissions/types.d.ts.map +1 -0
  826. package/dist/esm/permissions/types.js +2 -0
  827. package/dist/esm/permissions/types.js.map +1 -0
  828. package/dist/esm/protocol/constants.d.ts +72 -0
  829. package/dist/esm/protocol/constants.d.ts.map +1 -0
  830. package/dist/esm/protocol/constants.js +104 -0
  831. package/dist/esm/protocol/constants.js.map +1 -0
  832. package/dist/esm/protocol/envelope.d.ts +165 -0
  833. package/dist/esm/protocol/envelope.d.ts.map +1 -0
  834. package/dist/esm/protocol/envelope.js +263 -0
  835. package/dist/esm/protocol/envelope.js.map +1 -0
  836. package/dist/esm/protocol/errors.d.ts +33 -0
  837. package/dist/esm/protocol/errors.d.ts.map +1 -0
  838. package/dist/esm/protocol/errors.js +384 -0
  839. package/dist/esm/protocol/errors.js.map +1 -0
  840. package/dist/esm/protocol/messages.d.ts +327 -0
  841. package/dist/esm/protocol/messages.d.ts.map +1 -0
  842. package/dist/esm/protocol/messages.js +2 -0
  843. package/dist/esm/protocol/messages.js.map +1 -0
  844. package/dist/esm/protocol/serialize.d.ts +26 -0
  845. package/dist/esm/protocol/serialize.d.ts.map +1 -0
  846. package/dist/esm/protocol/serialize.js +63 -0
  847. package/dist/esm/protocol/serialize.js.map +1 -0
  848. package/dist/esm/protocol/validate.d.ts +135 -0
  849. package/dist/esm/protocol/validate.d.ts.map +1 -0
  850. package/dist/esm/protocol/validate.js +830 -0
  851. package/dist/esm/protocol/validate.js.map +1 -0
  852. package/dist/types/audit/chain.d.ts +365 -0
  853. package/dist/types/audit/chain.d.ts.map +1 -0
  854. package/dist/types/audit/cloud-client.d.ts +142 -0
  855. package/dist/types/audit/cloud-client.d.ts.map +1 -0
  856. package/dist/types/audit/cloud-writer.d.ts +57 -0
  857. package/dist/types/audit/cloud-writer.d.ts.map +1 -0
  858. package/dist/types/audit/context.d.ts +51 -0
  859. package/dist/types/audit/context.d.ts.map +1 -0
  860. package/dist/types/audit/files.d.ts +111 -0
  861. package/dist/types/audit/files.d.ts.map +1 -0
  862. package/dist/types/audit/index.d.ts +9 -0
  863. package/dist/types/audit/index.d.ts.map +1 -0
  864. package/dist/types/audit/local-writer.d.ts +255 -0
  865. package/dist/types/audit/local-writer.d.ts.map +1 -0
  866. package/dist/types/audit/redact.d.ts +151 -0
  867. package/dist/types/audit/redact.d.ts.map +1 -0
  868. package/dist/types/audit/sanitize.d.ts +78 -0
  869. package/dist/types/audit/sanitize.d.ts.map +1 -0
  870. package/dist/types/audit/sink.d.ts +278 -0
  871. package/dist/types/audit/sink.d.ts.map +1 -0
  872. package/dist/types/audit/types.d.ts +226 -0
  873. package/dist/types/audit/types.d.ts.map +1 -0
  874. package/dist/types/audit/verify-cache.d.ts +127 -0
  875. package/dist/types/audit/verify-cache.d.ts.map +1 -0
  876. package/dist/types/channels/agent-session.d.ts +228 -0
  877. package/dist/types/channels/agent-session.d.ts.map +1 -0
  878. package/dist/types/channels/data-channel.d.ts +181 -0
  879. package/dist/types/channels/data-channel.d.ts.map +1 -0
  880. package/dist/types/channels/reconnect.d.ts +142 -0
  881. package/dist/types/channels/reconnect.d.ts.map +1 -0
  882. package/dist/types/channels/types.d.ts +112 -0
  883. package/dist/types/channels/types.d.ts.map +1 -0
  884. package/dist/types/channels/wake-channel.d.ts +232 -0
  885. package/dist/types/channels/wake-channel.d.ts.map +1 -0
  886. package/dist/types/cli/banner.d.ts +2 -0
  887. package/dist/types/cli/banner.d.ts.map +1 -0
  888. package/dist/types/cli/commands/agent.d.ts +30 -0
  889. package/dist/types/cli/commands/agent.d.ts.map +1 -0
  890. package/dist/types/cli/commands/audit-verify.d.ts +19 -0
  891. package/dist/types/cli/commands/audit-verify.d.ts.map +1 -0
  892. package/dist/types/cli/commands/clean.d.ts +23 -0
  893. package/dist/types/cli/commands/clean.d.ts.map +1 -0
  894. package/dist/types/cli/commands/config-show.d.ts +2 -0
  895. package/dist/types/cli/commands/config-show.d.ts.map +1 -0
  896. package/dist/types/cli/commands/config.d.ts +6 -0
  897. package/dist/types/cli/commands/config.d.ts.map +1 -0
  898. package/dist/types/cli/commands/db-add.d.ts +16 -0
  899. package/dist/types/cli/commands/db-add.d.ts.map +1 -0
  900. package/dist/types/cli/commands/db-edit.d.ts +2 -0
  901. package/dist/types/cli/commands/db-edit.d.ts.map +1 -0
  902. package/dist/types/cli/commands/db-logs.d.ts +3 -0
  903. package/dist/types/cli/commands/db-logs.d.ts.map +1 -0
  904. package/dist/types/cli/commands/db-ls.d.ts +2 -0
  905. package/dist/types/cli/commands/db-ls.d.ts.map +1 -0
  906. package/dist/types/cli/commands/db-query.d.ts +121 -0
  907. package/dist/types/cli/commands/db-query.d.ts.map +1 -0
  908. package/dist/types/cli/commands/db-remove.d.ts +2 -0
  909. package/dist/types/cli/commands/db-remove.d.ts.map +1 -0
  910. package/dist/types/cli/commands/db-show.d.ts +2 -0
  911. package/dist/types/cli/commands/db-show.d.ts.map +1 -0
  912. package/dist/types/cli/commands/db-test.d.ts +3 -0
  913. package/dist/types/cli/commands/db-test.d.ts.map +1 -0
  914. package/dist/types/cli/commands/db.d.ts +11 -0
  915. package/dist/types/cli/commands/db.d.ts.map +1 -0
  916. package/dist/types/cli/commands/debug.d.ts +2 -0
  917. package/dist/types/cli/commands/debug.d.ts.map +1 -0
  918. package/dist/types/cli/commands/doctor.d.ts +5 -0
  919. package/dist/types/cli/commands/doctor.d.ts.map +1 -0
  920. package/dist/types/cli/commands/index.d.ts +10 -0
  921. package/dist/types/cli/commands/index.d.ts.map +1 -0
  922. package/dist/types/cli/commands/init.d.ts +2 -0
  923. package/dist/types/cli/commands/init.d.ts.map +1 -0
  924. package/dist/types/cli/commands/link.d.ts +5 -0
  925. package/dist/types/cli/commands/link.d.ts.map +1 -0
  926. package/dist/types/cli/commands/logs.d.ts +17 -0
  927. package/dist/types/cli/commands/logs.d.ts.map +1 -0
  928. package/dist/types/cli/commands/project-show.d.ts +2 -0
  929. package/dist/types/cli/commands/project-show.d.ts.map +1 -0
  930. package/dist/types/cli/commands/project.d.ts +3 -0
  931. package/dist/types/cli/commands/project.d.ts.map +1 -0
  932. package/dist/types/cli/commands/service.d.ts +123 -0
  933. package/dist/types/cli/commands/service.d.ts.map +1 -0
  934. package/dist/types/cli/commands/start.d.ts +6 -0
  935. package/dist/types/cli/commands/start.d.ts.map +1 -0
  936. package/dist/types/cli/commands/status.d.ts +2 -0
  937. package/dist/types/cli/commands/status.d.ts.map +1 -0
  938. package/dist/types/cli/commands/stop.d.ts +6 -0
  939. package/dist/types/cli/commands/stop.d.ts.map +1 -0
  940. package/dist/types/cli/daemon/error-tracker.d.ts +119 -0
  941. package/dist/types/cli/daemon/error-tracker.d.ts.map +1 -0
  942. package/dist/types/cli/daemon/fault-shutdown.d.ts +144 -0
  943. package/dist/types/cli/daemon/fault-shutdown.d.ts.map +1 -0
  944. package/dist/types/cli/daemon/index.d.ts +12 -0
  945. package/dist/types/cli/daemon/index.d.ts.map +1 -0
  946. package/dist/types/cli/daemon/pid-file.d.ts +13 -0
  947. package/dist/types/cli/daemon/pid-file.d.ts.map +1 -0
  948. package/dist/types/cli/daemon/readiness.d.ts +30 -0
  949. package/dist/types/cli/daemon/readiness.d.ts.map +1 -0
  950. package/dist/types/cli/daemon/runtime.d.ts +366 -0
  951. package/dist/types/cli/daemon/runtime.d.ts.map +1 -0
  952. package/dist/types/cli/daemon/shutdown.d.ts +7 -0
  953. package/dist/types/cli/daemon/shutdown.d.ts.map +1 -0
  954. package/dist/types/cli/daemon/signal-handlers.d.ts +3 -0
  955. package/dist/types/cli/daemon/signal-handlers.d.ts.map +1 -0
  956. package/dist/types/cli/daemon/state.d.ts +157 -0
  957. package/dist/types/cli/daemon/state.d.ts.map +1 -0
  958. package/dist/types/cli/daemon/status-file.d.ts +139 -0
  959. package/dist/types/cli/daemon/status-file.d.ts.map +1 -0
  960. package/dist/types/cli/doctor/checks.d.ts +133 -0
  961. package/dist/types/cli/doctor/checks.d.ts.map +1 -0
  962. package/dist/types/cli/doctor/fixes.d.ts +9 -0
  963. package/dist/types/cli/doctor/fixes.d.ts.map +1 -0
  964. package/dist/types/cli/doctor/index.d.ts +7 -0
  965. package/dist/types/cli/doctor/index.d.ts.map +1 -0
  966. package/dist/types/cli/index.d.ts +3 -0
  967. package/dist/types/cli/index.d.ts.map +1 -0
  968. package/dist/types/cli/interactive.d.ts +8 -0
  969. package/dist/types/cli/interactive.d.ts.map +1 -0
  970. package/dist/types/cli/logs/format.d.ts +13 -0
  971. package/dist/types/cli/logs/format.d.ts.map +1 -0
  972. package/dist/types/cli/logs/index.d.ts +3 -0
  973. package/dist/types/cli/logs/index.d.ts.map +1 -0
  974. package/dist/types/cli/logs/viewer.d.ts +41 -0
  975. package/dist/types/cli/logs/viewer.d.ts.map +1 -0
  976. package/dist/types/cli/ops/operation-logger.d.ts +63 -0
  977. package/dist/types/cli/ops/operation-logger.d.ts.map +1 -0
  978. package/dist/types/cli/palette.d.ts +11 -0
  979. package/dist/types/cli/palette.d.ts.map +1 -0
  980. package/dist/types/cli/prompt.d.ts +186 -0
  981. package/dist/types/cli/prompt.d.ts.map +1 -0
  982. package/dist/types/cli/ui/box.d.ts +21 -0
  983. package/dist/types/cli/ui/box.d.ts.map +1 -0
  984. package/dist/types/cli/ui/clipboard.d.ts +6 -0
  985. package/dist/types/cli/ui/clipboard.d.ts.map +1 -0
  986. package/dist/types/cli/ui/colors.d.ts +57 -0
  987. package/dist/types/cli/ui/colors.d.ts.map +1 -0
  988. package/dist/types/cli/ui/index.d.ts +9 -0
  989. package/dist/types/cli/ui/index.d.ts.map +1 -0
  990. package/dist/types/cli/ui/spinner.d.ts +12 -0
  991. package/dist/types/cli/ui/spinner.d.ts.map +1 -0
  992. package/dist/types/cli/ui/symbols.d.ts +47 -0
  993. package/dist/types/cli/ui/symbols.d.ts.map +1 -0
  994. package/dist/types/cli/ui/table.d.ts +23 -0
  995. package/dist/types/cli/ui/table.d.ts.map +1 -0
  996. package/dist/types/cli/ui/terminal.d.ts +7 -0
  997. package/dist/types/cli/ui/terminal.d.ts.map +1 -0
  998. package/dist/types/config/atomic-write.d.ts +69 -0
  999. package/dist/types/config/atomic-write.d.ts.map +1 -0
  1000. package/dist/types/config/db-config.d.ts +134 -0
  1001. package/dist/types/config/db-config.d.ts.map +1 -0
  1002. package/dist/types/config/machine-config.d.ts +85 -0
  1003. package/dist/types/config/machine-config.d.ts.map +1 -0
  1004. package/dist/types/config/paths.d.ts +64 -0
  1005. package/dist/types/config/paths.d.ts.map +1 -0
  1006. package/dist/types/config/schema.d.ts +72 -0
  1007. package/dist/types/config/schema.d.ts.map +1 -0
  1008. package/dist/types/config/token.d.ts +63 -0
  1009. package/dist/types/config/token.d.ts.map +1 -0
  1010. package/dist/types/execution/canceller.d.ts +41 -0
  1011. package/dist/types/execution/canceller.d.ts.map +1 -0
  1012. package/dist/types/execution/database-lookup.d.ts +56 -0
  1013. package/dist/types/execution/database-lookup.d.ts.map +1 -0
  1014. package/dist/types/execution/dispatcher.d.ts +181 -0
  1015. package/dist/types/execution/dispatcher.d.ts.map +1 -0
  1016. package/dist/types/execution/function-effects.d.ts +209 -0
  1017. package/dist/types/execution/function-effects.d.ts.map +1 -0
  1018. package/dist/types/execution/introspection.d.ts +76 -0
  1019. package/dist/types/execution/introspection.d.ts.map +1 -0
  1020. package/dist/types/execution/migration-runner.d.ts +128 -0
  1021. package/dist/types/execution/migration-runner.d.ts.map +1 -0
  1022. package/dist/types/execution/non-tx-detector.d.ts +23 -0
  1023. package/dist/types/execution/non-tx-detector.d.ts.map +1 -0
  1024. package/dist/types/execution/pool.d.ts +229 -0
  1025. package/dist/types/execution/pool.d.ts.map +1 -0
  1026. package/dist/types/execution/query-runner.d.ts +88 -0
  1027. package/dist/types/execution/query-runner.d.ts.map +1 -0
  1028. package/dist/types/execution/rate-limiter.d.ts +120 -0
  1029. package/dist/types/execution/rate-limiter.d.ts.map +1 -0
  1030. package/dist/types/execution/search-path.d.ts +161 -0
  1031. package/dist/types/execution/search-path.d.ts.map +1 -0
  1032. package/dist/types/execution/sql-parser.d.ts +195 -0
  1033. package/dist/types/execution/sql-parser.d.ts.map +1 -0
  1034. package/dist/types/execution/statement-classifier.d.ts +103 -0
  1035. package/dist/types/execution/statement-classifier.d.ts.map +1 -0
  1036. package/dist/types/execution/types.d.ts +189 -0
  1037. package/dist/types/execution/types.d.ts.map +1 -0
  1038. package/dist/types/index.d.ts +34 -0
  1039. package/dist/types/index.d.ts.map +1 -0
  1040. package/dist/types/permissions/auto-upgrade.d.ts +40 -0
  1041. package/dist/types/permissions/auto-upgrade.d.ts.map +1 -0
  1042. package/dist/types/permissions/checker.d.ts +53 -0
  1043. package/dist/types/permissions/checker.d.ts.map +1 -0
  1044. package/dist/types/permissions/manual-approval.d.ts +213 -0
  1045. package/dist/types/permissions/manual-approval.d.ts.map +1 -0
  1046. package/dist/types/permissions/plan-registry.d.ts +274 -0
  1047. package/dist/types/permissions/plan-registry.d.ts.map +1 -0
  1048. package/dist/types/permissions/role-policy.d.ts +217 -0
  1049. package/dist/types/permissions/role-policy.d.ts.map +1 -0
  1050. package/dist/types/permissions/types.d.ts +126 -0
  1051. package/dist/types/permissions/types.d.ts.map +1 -0
  1052. package/dist/types/protocol/constants.d.ts +72 -0
  1053. package/dist/types/protocol/constants.d.ts.map +1 -0
  1054. package/dist/types/protocol/envelope.d.ts +165 -0
  1055. package/dist/types/protocol/envelope.d.ts.map +1 -0
  1056. package/dist/types/protocol/errors.d.ts +33 -0
  1057. package/dist/types/protocol/errors.d.ts.map +1 -0
  1058. package/dist/types/protocol/messages.d.ts +327 -0
  1059. package/dist/types/protocol/messages.d.ts.map +1 -0
  1060. package/dist/types/protocol/serialize.d.ts +26 -0
  1061. package/dist/types/protocol/serialize.d.ts.map +1 -0
  1062. package/dist/types/protocol/validate.d.ts +135 -0
  1063. package/dist/types/protocol/validate.d.ts.map +1 -0
  1064. package/package.json +116 -4
  1065. package/scripts/generate-systemd-service.mjs +117 -0
@@ -0,0 +1,134 @@
1
+ import { PermissionLevel } from '../permissions/checker';
2
+ /**
3
+ * Database-level config: databases.config.json
4
+ * Array of DB entries. Each entry binds one DB to one project.
5
+ * One project = one DB (schema weaver constraint).
6
+ */
7
+ export interface DbEntry {
8
+ project_name: string;
9
+ db_alias: string;
10
+ host: string;
11
+ port: number;
12
+ database: string;
13
+ user: string;
14
+ password_env?: string;
15
+ /**
16
+ * Password in cleartext. Present only in memory: the on-disk form is an
17
+ * {@link EncryptedPassword} envelope (see `sealDbConfig`). A plain string is
18
+ * still accepted on read so configs written by earlier versions load, and is
19
+ * re-encrypted on the next write.
20
+ */
21
+ password_stored?: string;
22
+ ssl_mode: 'disable' | 'require' | 'verify-ca' | 'verify-full';
23
+ ssl_root_cert?: string | null;
24
+ permission_override: PermissionLevel | null;
25
+ created_at: string;
26
+ }
27
+ export type DbConfig = DbEntry[];
28
+ /**
29
+ * Envelope written to disk in place of a cleartext password.
30
+ * The plaintext never leaves the process; `ct` is AES-256-GCM output whose
31
+ * authentication tag also covers the entry identity (AAD), so a ciphertext
32
+ * cannot be moved between entries.
33
+ */
34
+ export interface EncryptedPassword {
35
+ v: 1;
36
+ kdf: 'scrypt';
37
+ iv: string;
38
+ tag: string;
39
+ ct: string;
40
+ }
41
+ /** Entry identity an encrypted password is bound to. */
42
+ export interface PasswordBinding {
43
+ db_alias: string;
44
+ host: string;
45
+ port: number;
46
+ database: string;
47
+ user: string;
48
+ }
49
+ /**
50
+ * Builds the additional authenticated data for a stored password: the entry
51
+ * identity. Serialised as a JSON array so no field value can shift the
52
+ * boundaries of another one.
53
+ */
54
+ export declare function buildPasswordAad(binding: PasswordBinding): string;
55
+ /**
56
+ * True when a value is an encrypted-password envelope rather than cleartext.
57
+ */
58
+ export declare function isEncryptedPassword(value: unknown): value is EncryptedPassword;
59
+ /**
60
+ * Loads the key file, creating it on first use. The derived key is cached for
61
+ * the life of the process so repeated config reads cost one KDF run.
62
+ */
63
+ export declare function loadCredentialKey(): Buffer;
64
+ /**
65
+ * Encrypts a database password for storage. Generates a fresh random 96-bit
66
+ * IV and authenticates the entry identity as AAD.
67
+ */
68
+ export declare function encryptDbPassword(binding: PasswordBinding, plaintext: string): EncryptedPassword;
69
+ /**
70
+ * Decrypts a stored database password. Throws when the envelope fails
71
+ * authentication, which includes a ciphertext copied from another entry.
72
+ */
73
+ export declare function decryptDbPassword(binding: PasswordBinding, env: EncryptedPassword): string;
74
+ /**
75
+ * Encrypts every cleartext password in the config for storage.
76
+ * Entries that already hold an envelope are passed through unchanged, so a
77
+ * load/save round trip never double-encrypts.
78
+ */
79
+ export declare function sealDbConfig(config: DbConfig): unknown[];
80
+ /**
81
+ * Checks if the databases.config.json file exists.
82
+ */
83
+ export declare function dbConfigExists(): boolean;
84
+ /**
85
+ * Validates the database config.
86
+ * Accepts a cleartext `password_stored` (pre-encryption on-disk shape) or an
87
+ * encrypted envelope; both are narrowed to cleartext in memory by
88
+ * {@link loadDbConfig} and re-sealed by {@link saveDbConfig}.
89
+ */
90
+ export declare function validateDbConfig(raw: unknown): DbConfig;
91
+ /**
92
+ * Loads the database config. Returns empty array if file does not exist.
93
+ * Encrypted `password_stored` envelopes are decrypted in memory; a config
94
+ * written by an earlier version (cleartext) is returned as-is and is upgraded
95
+ * on the next save.
96
+ */
97
+ export declare function loadDbConfig(): DbConfig;
98
+ /**
99
+ * Saves the database config to disk with 0o600 permissions on POSIX.
100
+ * Every cleartext `password_stored` is replaced by an encrypted envelope bound
101
+ * to that entry's identity before anything is written.
102
+ */
103
+ export declare function saveDbConfig(config: DbConfig): void;
104
+ /**
105
+ * Runs a load → mutate → save cycle over databases.config.json under an
106
+ * advisory lock, so two concurrent CLI invocations cannot lose one another's
107
+ * update. `mutate` edits the array in place; its return value is passed back.
108
+ */
109
+ export declare function mutateDbConfig<T>(mutate: (config: DbConfig) => T): T;
110
+ /**
111
+ * Adds a database entry to config and saves it. Enforces one DB per project.
112
+ */
113
+ export declare function addDbEntry(entry: Omit<DbEntry, 'created_at'>): DbEntry;
114
+ /**
115
+ * Removes a database entry by its alias. Returns true if removed, false if not found.
116
+ */
117
+ export declare function removeDbEntry(dbAlias: string): boolean;
118
+ /**
119
+ * Finds a database entry by its alias.
120
+ */
121
+ export declare function findDbEntry(dbAlias: string): DbEntry | null;
122
+ /**
123
+ * Finds a database entry by its project name.
124
+ */
125
+ export declare function findDbByProject(projectName: string): DbEntry | null;
126
+ /**
127
+ * Lists unique project names across all configured databases, sorted alphabetically.
128
+ */
129
+ export declare function listProjects(): string[];
130
+ export interface DatabasesConfig {
131
+ databases: DbEntry[];
132
+ }
133
+ export declare function loadDatabasesConfig(): DatabasesConfig;
134
+ //# sourceMappingURL=db-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-config.d.ts","sourceRoot":"","sources":["../../../src/config/db-config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAazD;;;;GAIG;AACH,MAAM,WAAW,OAAO;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,aAAa,CAAC;IAC9D,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,mBAAmB,EAAE,eAAe,GAAG,IAAI,CAAC;IAC5C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,QAAQ,GAAG,OAAO,EAAE,CAAC;AAEjC;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,CAAC,EAAE,CAAC,CAAC;IACL,GAAG,EAAE,QAAQ,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,wDAAwD;AACxD,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AA+CD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAQjE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAW9E;AA6JD;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAU1C;AAwBD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,GAAG,iBAAiB,CAehG;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,iBAAiB,GAAG,MAAM,CAmB1F;AA4CD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,CAExD;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAMxC;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,QAAQ,CAsIvD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,QAAQ,CAoBvC;AAMD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CASnD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,QAAQ,KAAK,CAAC,GAAG,CAAC,CAOpE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,GAAG,OAAO,CAuBtE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAStD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAG3D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAGnE;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAIvC;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,OAAO,EAAE,CAAC;CACtB;AAED,wBAAgB,mBAAmB,IAAI,eAAe,CAIrD"}
@@ -0,0 +1,542 @@
1
+ import * as fs from 'fs';
2
+ import * as crypto from 'crypto';
3
+ import { getDbConfigPath, getCredentialKeyPath } from './paths';
4
+ import { atomicWriteFile, assertNotSymlink, withFileLock } from './atomic-write';
5
+ import { ConfigError, ConfigInvalidError, isValidIdentifier, isValidHostname, isValidIpv4, isValidIpv6, isValidEnvVarName, isValidIso8601, } from './schema';
6
+ const CIPHER = 'aes-256-gcm';
7
+ const KEY_BYTES = 32;
8
+ const SALT_BYTES = 16;
9
+ const IV_BYTES = 12;
10
+ const TAG_BYTES = 16;
11
+ const SCRYPT_N = 32768;
12
+ const SCRYPT_R = 8;
13
+ const SCRYPT_P = 1;
14
+ const SCRYPT_MAXMEM = 64 * 1024 * 1024;
15
+ const KEYFILE_MODE = 0o400;
16
+ const CONFIG_FILE_MODE = 0o600;
17
+ let derivedKeyCache = null;
18
+ function isErrno(err, code) {
19
+ return typeof err === 'object' && err !== null && err.code === code;
20
+ }
21
+ function encodeB64(buf) {
22
+ return buf.toString('base64');
23
+ }
24
+ function decodeB64(value, expectedBytes, field) {
25
+ if (typeof value !== 'string' || value.length === 0) {
26
+ throw new ConfigInvalidError(`Stored password field "${field}" is not valid base64`);
27
+ }
28
+ const buf = Buffer.from(value, 'base64');
29
+ if (buf.length !== expectedBytes || encodeB64(buf) !== value) {
30
+ throw new ConfigInvalidError(`Stored password field "${field}" must be ${expectedBytes} base64-encoded bytes`);
31
+ }
32
+ return buf;
33
+ }
34
+ /**
35
+ * Builds the additional authenticated data for a stored password: the entry
36
+ * identity. Serialised as a JSON array so no field value can shift the
37
+ * boundaries of another one.
38
+ */
39
+ export function buildPasswordAad(binding) {
40
+ return JSON.stringify([
41
+ binding.db_alias,
42
+ binding.host,
43
+ binding.port,
44
+ binding.database,
45
+ binding.user,
46
+ ]);
47
+ }
48
+ /**
49
+ * True when a value is an encrypted-password envelope rather than cleartext.
50
+ */
51
+ export function isEncryptedPassword(value) {
52
+ if (typeof value !== 'object' || value === null)
53
+ return false;
54
+ const env = value;
55
+ return (env.v === 1 &&
56
+ env.kdf === 'scrypt' &&
57
+ typeof env.iv === 'string' &&
58
+ typeof env.tag === 'string' &&
59
+ typeof env.ct === 'string' &&
60
+ env.ct.length > 0);
61
+ }
62
+ function parseKeyMaterial(raw) {
63
+ let parsed;
64
+ try {
65
+ parsed = JSON.parse(raw);
66
+ }
67
+ catch {
68
+ throw new ConfigError('invalid', 'Credential key file is not valid JSON');
69
+ }
70
+ if (typeof parsed !== 'object' || parsed === null) {
71
+ throw new ConfigError('invalid', 'Credential key file is malformed');
72
+ }
73
+ const m = parsed;
74
+ if (m.v !== 1 ||
75
+ m.kdf !== 'scrypt' ||
76
+ typeof m.n !== 'number' ||
77
+ typeof m.r !== 'number' ||
78
+ typeof m.p !== 'number' ||
79
+ typeof m.salt !== 'string' ||
80
+ typeof m.key !== 'string') {
81
+ throw new ConfigError('invalid', 'Credential key file has an unsupported format');
82
+ }
83
+ if (m.n < 2 || m.r < 1 || m.p < 1) {
84
+ throw new ConfigError('invalid', 'Credential key file has invalid KDF parameters');
85
+ }
86
+ decodeB64(m.salt, SALT_BYTES, 'salt');
87
+ decodeB64(m.key, KEY_BYTES, 'key');
88
+ return { v: 1, kdf: 'scrypt', n: m.n, r: m.r, p: m.p, salt: m.salt, key: m.key };
89
+ }
90
+ /**
91
+ * Verifies the key file is owner-only and repairs the mode when it is not.
92
+ * A key readable by other local users is a failed control, not a warning.
93
+ */
94
+ function enforceKeyFileMode(keyPath) {
95
+ if (process.platform === 'win32')
96
+ return;
97
+ let mode;
98
+ try {
99
+ mode = fs.statSync(keyPath).mode & 0o777;
100
+ }
101
+ catch (err) {
102
+ throw new ConfigError('invalid', `Failed to stat credential key file: ${errorText(err)}`);
103
+ }
104
+ if ((mode & 0o400) === 0o400 && (mode & 0o177) === 0)
105
+ return;
106
+ try {
107
+ fs.chmodSync(keyPath, KEYFILE_MODE);
108
+ }
109
+ catch (err) {
110
+ throw new ConfigError('invalid', `Credential key file is not owner-only (mode ${mode.toString(8)}) and could not be repaired: ${errorText(err)}`);
111
+ }
112
+ const repaired = fs.statSync(keyPath).mode & 0o777;
113
+ if ((repaired & 0o400) !== 0o400 || (repaired & 0o177) !== 0) {
114
+ throw new ConfigError('invalid', `Credential key file is not owner-only (mode ${repaired.toString(8)})`);
115
+ }
116
+ }
117
+ function errorText(err) {
118
+ return err instanceof Error ? err.message : String(err);
119
+ }
120
+ function deriveKey(material, keyPath) {
121
+ const fingerprint = `${keyPath}:${material.salt}:${material.key}:${material.n}:${material.r}:${material.p}`;
122
+ if (derivedKeyCache && derivedKeyCache.fingerprint === fingerprint) {
123
+ return derivedKeyCache.key;
124
+ }
125
+ const key = crypto.scryptSync(Buffer.from(material.key, 'base64'), Buffer.from(material.salt, 'base64'), KEY_BYTES, {
126
+ N: material.n,
127
+ r: material.r,
128
+ p: material.p,
129
+ maxmem: SCRYPT_MAXMEM,
130
+ });
131
+ derivedKeyCache = { fingerprint, key };
132
+ return key;
133
+ }
134
+ /**
135
+ * Creates the machine-local key file if it is absent, racing other processes
136
+ * safely: the file is created with O_EXCL, and a concurrent winner's file is
137
+ * used instead of overwriting it.
138
+ */
139
+ function createKeyFile(keyPath) {
140
+ const material = {
141
+ v: 1,
142
+ kdf: 'scrypt',
143
+ n: SCRYPT_N,
144
+ r: SCRYPT_R,
145
+ p: SCRYPT_P,
146
+ salt: encodeB64(crypto.randomBytes(SALT_BYTES)),
147
+ key: encodeB64(crypto.randomBytes(KEY_BYTES)),
148
+ };
149
+ let fd;
150
+ try {
151
+ fd = fs.openSync(keyPath, 'wx', KEYFILE_MODE);
152
+ }
153
+ catch (err) {
154
+ if (isErrno(err, 'EEXIST')) {
155
+ const existing = readKeyFile(keyPath);
156
+ if (!existing) {
157
+ throw new ConfigError('invalid', 'Credential key file disappeared while being created');
158
+ }
159
+ return existing;
160
+ }
161
+ throw new ConfigError('write_failed', `Failed to create credential key file: ${errorText(err)}`);
162
+ }
163
+ try {
164
+ fs.writeSync(fd, `${JSON.stringify(material, null, 2)}\n`, null, 'utf8');
165
+ fs.fsyncSync(fd);
166
+ }
167
+ finally {
168
+ fs.closeSync(fd);
169
+ }
170
+ try {
171
+ fs.chmodSync(keyPath, KEYFILE_MODE);
172
+ }
173
+ catch (err) {
174
+ if (process.platform !== 'win32') {
175
+ throw new ConfigError('write_failed', `Failed to restrict credential key file permissions: ${errorText(err)}`);
176
+ }
177
+ }
178
+ enforceKeyFileMode(keyPath);
179
+ return material;
180
+ }
181
+ function readKeyFile(keyPath) {
182
+ // A planted symlink would hand the key to whoever owns the link target, so
183
+ // refuse to follow one. Throws rather than returning null: the caller must
184
+ // not fall back to creating a new key over an existing path.
185
+ assertNotSymlink(keyPath);
186
+ let raw;
187
+ try {
188
+ raw = fs.readFileSync(keyPath, 'utf8');
189
+ }
190
+ catch {
191
+ return null;
192
+ }
193
+ const material = parseKeyMaterial(raw);
194
+ enforceKeyFileMode(keyPath);
195
+ return material;
196
+ }
197
+ /**
198
+ * Loads the key file, creating it on first use. The derived key is cached for
199
+ * the life of the process so repeated config reads cost one KDF run.
200
+ */
201
+ export function loadCredentialKey() {
202
+ const keyPath = getCredentialKeyPath();
203
+ if (!fs.existsSync(keyPath)) {
204
+ return deriveKey(createKeyFile(keyPath), keyPath);
205
+ }
206
+ const material = readKeyFile(keyPath);
207
+ if (!material) {
208
+ throw new ConfigError('invalid', 'Credential key file could not be read');
209
+ }
210
+ return deriveKey(material, keyPath);
211
+ }
212
+ /**
213
+ * Loads the key file for decryption only. Never creates it: a missing or
214
+ * unreadable key for an existing encrypted config fails closed instead of
215
+ * silently falling back to cleartext.
216
+ */
217
+ function loadCredentialKeyForDecryption(keyPath) {
218
+ if (!fs.existsSync(keyPath)) {
219
+ throw new ConfigError('invalid', `Credential key file is missing (${keyPath}). Stored database passwords cannot be decrypted.`);
220
+ }
221
+ const material = readKeyFile(keyPath);
222
+ if (!material) {
223
+ throw new ConfigError('invalid', `Credential key file is unreadable (${keyPath}). Stored database passwords cannot be decrypted.`);
224
+ }
225
+ return deriveKey(material, keyPath);
226
+ }
227
+ /**
228
+ * Encrypts a database password for storage. Generates a fresh random 96-bit
229
+ * IV and authenticates the entry identity as AAD.
230
+ */
231
+ export function encryptDbPassword(binding, plaintext) {
232
+ const key = loadCredentialKey();
233
+ const iv = crypto.randomBytes(IV_BYTES);
234
+ const cipher = crypto.createCipheriv(CIPHER, key, iv, { authTagLength: TAG_BYTES });
235
+ cipher.setAAD(Buffer.from(buildPasswordAad(binding), 'utf8'), {
236
+ plaintextLength: Buffer.byteLength(plaintext, 'utf8'),
237
+ });
238
+ const ct = Buffer.concat([cipher.update(plaintext, 'utf8'), cipher.final()]);
239
+ return {
240
+ v: 1,
241
+ kdf: 'scrypt',
242
+ iv: encodeB64(iv),
243
+ tag: encodeB64(cipher.getAuthTag()),
244
+ ct: encodeB64(ct),
245
+ };
246
+ }
247
+ /**
248
+ * Decrypts a stored database password. Throws when the envelope fails
249
+ * authentication, which includes a ciphertext copied from another entry.
250
+ */
251
+ export function decryptDbPassword(binding, env) {
252
+ // Envelope shape is checked before the key is touched so a corrupt file
253
+ // reports a corrupt file, not a missing key.
254
+ const iv = decodeB64(env.iv, IV_BYTES, 'iv');
255
+ const tag = decodeB64(env.tag, TAG_BYTES, 'tag');
256
+ const ct = decodeB64(env.ct, ctLength(env.ct), 'ct');
257
+ const key = loadCredentialKeyForDecryption(getCredentialKeyPath());
258
+ const decipher = crypto.createDecipheriv(CIPHER, key, iv, { authTagLength: TAG_BYTES });
259
+ decipher.setAAD(Buffer.from(buildPasswordAad(binding), 'utf8'));
260
+ decipher.setAuthTag(tag);
261
+ try {
262
+ return Buffer.concat([decipher.update(ct), decipher.final()]).toString('utf8');
263
+ }
264
+ catch {
265
+ throw new ConfigError('invalid', `Stored password for "${binding.db_alias}" failed authentication. The credential key does not match this entry, or the entry's host/port/database/user was changed outside the CLI. Re-set it with: sw-agent db edit ${binding.db_alias} --password <secret>`);
266
+ }
267
+ }
268
+ function ctLength(value) {
269
+ if (typeof value !== 'string' || value.length === 0) {
270
+ throw new ConfigInvalidError('Stored password field "ct" is empty');
271
+ }
272
+ return Buffer.from(value, 'base64').length;
273
+ }
274
+ function bindingOf(entry) {
275
+ return {
276
+ db_alias: entry.db_alias,
277
+ host: entry.host,
278
+ port: entry.port,
279
+ database: entry.database,
280
+ user: entry.user,
281
+ };
282
+ }
283
+ /**
284
+ * Replaces a stored cleartext password with its encrypted envelope. Returns the
285
+ * on-disk shape, which is wider than {@link DbEntry}: `password_stored` is an
286
+ * envelope on disk and cleartext only in memory.
287
+ */
288
+ function sealEntryPasswords(entry) {
289
+ const stored = entry.password_stored;
290
+ if (isEncryptedPassword(stored)) {
291
+ return { ...entry };
292
+ }
293
+ if (typeof stored !== 'string' || stored.length === 0) {
294
+ return { ...entry, password_stored: undefined };
295
+ }
296
+ return { ...entry, password_stored: encryptDbPassword(bindingOf(entry), stored) };
297
+ }
298
+ /** Replaces a stored envelope with its cleartext password, in memory only. */
299
+ function openEntryPasswords(entry) {
300
+ const stored = entry.password_stored;
301
+ if (isEncryptedPassword(stored)) {
302
+ return { ...entry, password_stored: decryptDbPassword(bindingOf(entry), stored) };
303
+ }
304
+ return entry;
305
+ }
306
+ /**
307
+ * Encrypts every cleartext password in the config for storage.
308
+ * Entries that already hold an envelope are passed through unchanged, so a
309
+ * load/save round trip never double-encrypts.
310
+ */
311
+ export function sealDbConfig(config) {
312
+ return config.map(sealEntryPasswords);
313
+ }
314
+ /**
315
+ * Checks if the databases.config.json file exists.
316
+ */
317
+ export function dbConfigExists() {
318
+ try {
319
+ return fs.existsSync(getDbConfigPath());
320
+ }
321
+ catch {
322
+ return false;
323
+ }
324
+ }
325
+ /**
326
+ * Validates the database config.
327
+ * Accepts a cleartext `password_stored` (pre-encryption on-disk shape) or an
328
+ * encrypted envelope; both are narrowed to cleartext in memory by
329
+ * {@link loadDbConfig} and re-sealed by {@link saveDbConfig}.
330
+ */
331
+ export function validateDbConfig(raw) {
332
+ if (!Array.isArray(raw)) {
333
+ throw new ConfigInvalidError('DB config must be a JSON array of database entries');
334
+ }
335
+ const projects = new Set();
336
+ const aliases = new Set();
337
+ for (let i = 0; i < raw.length; i++) {
338
+ const entry = raw[i];
339
+ if (typeof entry !== 'object' || entry === null) {
340
+ throw new ConfigInvalidError(`DB entry at index ${i} is not a valid JSON object`);
341
+ }
342
+ const data = entry;
343
+ const project = data.project_name;
344
+ if (typeof project !== 'string' || !isValidIdentifier(project, 64) || project.includes(' ')) {
345
+ throw new ConfigInvalidError(`Entry at index ${i} invalid: Project name can only contain letters, numbers, hyphens, and underscores.`);
346
+ }
347
+ if (projects.has(project)) {
348
+ const aliasName = data.db_alias || 'unknown';
349
+ throw new ConfigInvalidError(`Project "${project}" already has a database (${aliasName}). Schema Weaver enforces one database per project. Remove the existing entry first or use a different project name.`);
350
+ }
351
+ projects.add(project);
352
+ const alias = data.db_alias;
353
+ if (typeof alias !== 'string' || !isValidIdentifier(alias, 64) || alias.includes(' ')) {
354
+ throw new ConfigInvalidError(`Entry at index ${i} invalid: Database alias can only contain letters, numbers, hyphens, and underscores.`);
355
+ }
356
+ if (aliases.has(alias)) {
357
+ throw new ConfigInvalidError(`Database alias "${alias}" already exists in config`);
358
+ }
359
+ aliases.add(alias);
360
+ const host = data.host;
361
+ if (typeof host !== 'string' ||
362
+ host.trim().length === 0 ||
363
+ (!isValidHostname(host) && !isValidIpv4(host) && !isValidIpv6(host))) {
364
+ throw new ConfigInvalidError(`Entry at index ${i} invalid: Field "host" must be a valid hostname or IP address`);
365
+ }
366
+ const port = data.port;
367
+ if (typeof port !== 'number' || !Number.isInteger(port) || port < 1 || port > 65535) {
368
+ throw new ConfigInvalidError(`Entry at index ${i} invalid: Port must be between 1 and 65535.`);
369
+ }
370
+ const db = data.database;
371
+ if (typeof db !== 'string' || db.length === 0 || db.length > 63) {
372
+ throw new ConfigInvalidError(`Entry at index ${i} invalid: Database name must be 1-63 characters`);
373
+ }
374
+ const user = data.user;
375
+ if (typeof user !== 'string' || user.length === 0 || user.length > 63) {
376
+ throw new ConfigInvalidError(`Entry at index ${i} invalid: Username must be 1-63 characters`);
377
+ }
378
+ const pwEnv = data.password_env;
379
+ const pwStored = data.password_stored;
380
+ if (pwEnv !== undefined && pwEnv !== null) {
381
+ if (typeof pwEnv !== 'string' || !isValidEnvVarName(pwEnv)) {
382
+ throw new ConfigInvalidError(`Entry at index ${i} invalid: password_env must be uppercase letters, digits, and underscores, starting with a letter.`);
383
+ }
384
+ }
385
+ if (pwStored !== undefined && pwStored !== null) {
386
+ if (!isEncryptedPassword(pwStored)) {
387
+ if (typeof pwStored !== 'string' || pwStored.length === 0) {
388
+ throw new ConfigInvalidError(`Entry at index ${i} invalid: password_stored must be a non-empty string or an encrypted envelope.`);
389
+ }
390
+ }
391
+ }
392
+ if (!pwEnv && !pwStored) {
393
+ throw new ConfigInvalidError(`Entry at index ${i} invalid: Either password_env or password_stored is required.`);
394
+ }
395
+ const ssl = data.ssl_mode;
396
+ if (ssl !== 'disable' && ssl !== 'require' && ssl !== 'verify-ca' && ssl !== 'verify-full') {
397
+ throw new ConfigInvalidError(`Entry at index ${i} invalid: ssl_mode must be disable, require, verify-ca, or verify-full`);
398
+ }
399
+ const sslRoot = data.ssl_root_cert;
400
+ if (sslRoot !== undefined && sslRoot !== null) {
401
+ if (typeof sslRoot !== 'string') {
402
+ throw new ConfigInvalidError(`Entry at index ${i} invalid: ssl_root_cert must be a string path or null`);
403
+ }
404
+ if (!fs.existsSync(sslRoot)) {
405
+ throw new ConfigInvalidError(`Entry at index ${i} invalid: ssl_root_cert path does not exist: ${sslRoot}`);
406
+ }
407
+ }
408
+ const perm = data.permission_override;
409
+ if (perm !== undefined && perm !== null) {
410
+ if (perm !== 'read_only' && perm !== 'auto_upgrade' && perm !== 'manual' && perm !== 'full') {
411
+ throw new ConfigInvalidError(`Entry at index ${i} invalid: permission_override must be read_only, auto_upgrade, manual, full, or null`);
412
+ }
413
+ }
414
+ const created = data.created_at;
415
+ if (typeof created !== 'string' || !isValidIso8601(created)) {
416
+ throw new ConfigInvalidError(`Entry at index ${i} invalid: created_at must be a valid ISO 8601 string`);
417
+ }
418
+ }
419
+ return raw;
420
+ }
421
+ /**
422
+ * Loads the database config. Returns empty array if file does not exist.
423
+ * Encrypted `password_stored` envelopes are decrypted in memory; a config
424
+ * written by an earlier version (cleartext) is returned as-is and is upgraded
425
+ * on the next save.
426
+ */
427
+ export function loadDbConfig() {
428
+ const p = getDbConfigPath();
429
+ if (!fs.existsSync(p)) {
430
+ return [];
431
+ }
432
+ let fileContent;
433
+ try {
434
+ fileContent = fs.readFileSync(p, 'utf8');
435
+ }
436
+ catch (err) {
437
+ throw new ConfigError('invalid', `Failed to read DB config file: ${errorText(err)}`);
438
+ }
439
+ let json;
440
+ try {
441
+ json = JSON.parse(stripBom(fileContent));
442
+ }
443
+ catch (err) {
444
+ throw new ConfigInvalidError(`Config file is not valid JSON: ${errorText(err)}`);
445
+ }
446
+ return validateDbConfig(json).map(openEntryPasswords);
447
+ }
448
+ function stripBom(content) {
449
+ return content.charCodeAt(0) === 0xfeff ? content.slice(1) : content;
450
+ }
451
+ /**
452
+ * Saves the database config to disk with 0o600 permissions on POSIX.
453
+ * Every cleartext `password_stored` is replaced by an encrypted envelope bound
454
+ * to that entry's identity before anything is written.
455
+ */
456
+ export function saveDbConfig(config) {
457
+ const p = getDbConfigPath();
458
+ validateDbConfig(config);
459
+ const sealed = sealDbConfig(config);
460
+ try {
461
+ atomicWriteFile(p, JSON.stringify(sealed, null, 2), CONFIG_FILE_MODE);
462
+ }
463
+ catch (err) {
464
+ throw new ConfigError('write_failed', `Failed to write DB config: ${errorText(err)}`);
465
+ }
466
+ }
467
+ /**
468
+ * Runs a load → mutate → save cycle over databases.config.json under an
469
+ * advisory lock, so two concurrent CLI invocations cannot lose one another's
470
+ * update. `mutate` edits the array in place; its return value is passed back.
471
+ */
472
+ export function mutateDbConfig(mutate) {
473
+ return withFileLock(getDbConfigPath(), () => {
474
+ const config = loadDbConfig();
475
+ const result = mutate(config);
476
+ saveDbConfig(config);
477
+ return result;
478
+ });
479
+ }
480
+ /**
481
+ * Adds a database entry to config and saves it. Enforces one DB per project.
482
+ */
483
+ export function addDbEntry(entry) {
484
+ return mutateDbConfig((config) => {
485
+ // One-DB-Per-Project rule
486
+ const existingProj = config.find((e) => e.project_name === entry.project_name);
487
+ if (existingProj) {
488
+ throw new ConfigInvalidError(`Project "${entry.project_name}" already has a database (${existingProj.db_alias}). Schema Weaver enforces one database per project. Remove the existing entry first or use a different project name.`);
489
+ }
490
+ // Alias uniqueness rule
491
+ if (config.some((e) => e.db_alias === entry.db_alias)) {
492
+ throw new ConfigInvalidError(`Database alias "${entry.db_alias}" already exists in config`);
493
+ }
494
+ const newEntry = {
495
+ ...entry,
496
+ created_at: new Date().toISOString(),
497
+ };
498
+ config.push(newEntry);
499
+ return newEntry;
500
+ });
501
+ }
502
+ /**
503
+ * Removes a database entry by its alias. Returns true if removed, false if not found.
504
+ */
505
+ export function removeDbEntry(dbAlias) {
506
+ return mutateDbConfig((config) => {
507
+ const index = config.findIndex((e) => e.db_alias === dbAlias);
508
+ if (index === -1) {
509
+ return false;
510
+ }
511
+ config.splice(index, 1);
512
+ return true;
513
+ });
514
+ }
515
+ /**
516
+ * Finds a database entry by its alias.
517
+ */
518
+ export function findDbEntry(dbAlias) {
519
+ const config = loadDbConfig();
520
+ return config.find((e) => e.db_alias === dbAlias) || null;
521
+ }
522
+ /**
523
+ * Finds a database entry by its project name.
524
+ */
525
+ export function findDbByProject(projectName) {
526
+ const config = loadDbConfig();
527
+ return config.find((e) => e.project_name === projectName) || null;
528
+ }
529
+ /**
530
+ * Lists unique project names across all configured databases, sorted alphabetically.
531
+ */
532
+ export function listProjects() {
533
+ const config = loadDbConfig();
534
+ const projects = config.map((e) => e.project_name);
535
+ return Array.from(new Set(projects)).sort();
536
+ }
537
+ export function loadDatabasesConfig() {
538
+ return {
539
+ databases: loadDbConfig(),
540
+ };
541
+ }
542
+ //# sourceMappingURL=db-config.js.map