constella 0.1.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 (747) hide show
  1. package/.next/BUILD_ID +1 -0
  2. package/.next/app-path-routes-manifest.json +53 -0
  3. package/.next/build-manifest.json +20 -0
  4. package/.next/diagnostics/build-diagnostics.json +6 -0
  5. package/.next/diagnostics/framework.json +1 -0
  6. package/.next/export-marker.json +6 -0
  7. package/.next/images-manifest.json +68 -0
  8. package/.next/next-minimal-server.js.nft.json +1 -0
  9. package/.next/next-server.js.nft.json +1 -0
  10. package/.next/package.json +1 -0
  11. package/.next/prerender-manifest.json +36 -0
  12. package/.next/react-loadable-manifest.json +14 -0
  13. package/.next/required-server-files.js +343 -0
  14. package/.next/required-server-files.json +343 -0
  15. package/.next/routes-manifest.json +362 -0
  16. package/.next/server/app/(app)/activity/page.js +2 -0
  17. package/.next/server/app/(app)/activity/page.js.nft.json +1 -0
  18. package/.next/server/app/(app)/activity/page_client-reference-manifest.js +1 -0
  19. package/.next/server/app/(app)/agents/[handle]/page.js +18 -0
  20. package/.next/server/app/(app)/agents/[handle]/page.js.nft.json +1 -0
  21. package/.next/server/app/(app)/agents/[handle]/page_client-reference-manifest.js +1 -0
  22. package/.next/server/app/(app)/code/page.js +2 -0
  23. package/.next/server/app/(app)/code/page.js.nft.json +1 -0
  24. package/.next/server/app/(app)/code/page_client-reference-manifest.js +1 -0
  25. package/.next/server/app/(app)/config/page.js +2 -0
  26. package/.next/server/app/(app)/config/page.js.nft.json +1 -0
  27. package/.next/server/app/(app)/config/page_client-reference-manifest.js +1 -0
  28. package/.next/server/app/(app)/costs/page.js +2 -0
  29. package/.next/server/app/(app)/costs/page.js.nft.json +1 -0
  30. package/.next/server/app/(app)/costs/page_client-reference-manifest.js +1 -0
  31. package/.next/server/app/(app)/cron/page.js +2 -0
  32. package/.next/server/app/(app)/cron/page.js.nft.json +1 -0
  33. package/.next/server/app/(app)/cron/page_client-reference-manifest.js +1 -0
  34. package/.next/server/app/(app)/dashboard/page.js +2 -0
  35. package/.next/server/app/(app)/dashboard/page.js.nft.json +1 -0
  36. package/.next/server/app/(app)/dashboard/page_client-reference-manifest.js +1 -0
  37. package/.next/server/app/(app)/docs/[id]/page.js +2 -0
  38. package/.next/server/app/(app)/docs/[id]/page.js.nft.json +1 -0
  39. package/.next/server/app/(app)/docs/[id]/page_client-reference-manifest.js +1 -0
  40. package/.next/server/app/(app)/docs/page.js +2 -0
  41. package/.next/server/app/(app)/docs/page.js.nft.json +1 -0
  42. package/.next/server/app/(app)/docs/page_client-reference-manifest.js +1 -0
  43. package/.next/server/app/(app)/github/page.js +2 -0
  44. package/.next/server/app/(app)/github/page.js.nft.json +1 -0
  45. package/.next/server/app/(app)/github/page_client-reference-manifest.js +1 -0
  46. package/.next/server/app/(app)/goals/page.js +2 -0
  47. package/.next/server/app/(app)/goals/page.js.nft.json +1 -0
  48. package/.next/server/app/(app)/goals/page_client-reference-manifest.js +1 -0
  49. package/.next/server/app/(app)/inbox/page.js +2 -0
  50. package/.next/server/app/(app)/inbox/page.js.nft.json +1 -0
  51. package/.next/server/app/(app)/inbox/page_client-reference-manifest.js +1 -0
  52. package/.next/server/app/(app)/knowledge/page.js +3 -0
  53. package/.next/server/app/(app)/knowledge/page.js.nft.json +1 -0
  54. package/.next/server/app/(app)/knowledge/page_client-reference-manifest.js +1 -0
  55. package/.next/server/app/(app)/models/page.js +2 -0
  56. package/.next/server/app/(app)/models/page.js.nft.json +1 -0
  57. package/.next/server/app/(app)/models/page_client-reference-manifest.js +1 -0
  58. package/.next/server/app/(app)/notifications/page.js +2 -0
  59. package/.next/server/app/(app)/notifications/page.js.nft.json +1 -0
  60. package/.next/server/app/(app)/notifications/page_client-reference-manifest.js +1 -0
  61. package/.next/server/app/(app)/org/page.js +2 -0
  62. package/.next/server/app/(app)/org/page.js.nft.json +1 -0
  63. package/.next/server/app/(app)/org/page_client-reference-manifest.js +1 -0
  64. package/.next/server/app/(app)/organizations/page.js +2 -0
  65. package/.next/server/app/(app)/organizations/page.js.nft.json +1 -0
  66. package/.next/server/app/(app)/organizations/page_client-reference-manifest.js +1 -0
  67. package/.next/server/app/(app)/page.js +3 -0
  68. package/.next/server/app/(app)/page.js.nft.json +1 -0
  69. package/.next/server/app/(app)/page_client-reference-manifest.js +1 -0
  70. package/.next/server/app/(app)/planner/page.js +2 -0
  71. package/.next/server/app/(app)/planner/page.js.nft.json +1 -0
  72. package/.next/server/app/(app)/planner/page_client-reference-manifest.js +1 -0
  73. package/.next/server/app/(app)/plugins/page.js +2 -0
  74. package/.next/server/app/(app)/plugins/page.js.nft.json +1 -0
  75. package/.next/server/app/(app)/plugins/page_client-reference-manifest.js +1 -0
  76. package/.next/server/app/(app)/pm/page.js +2 -0
  77. package/.next/server/app/(app)/pm/page.js.nft.json +1 -0
  78. package/.next/server/app/(app)/pm/page_client-reference-manifest.js +1 -0
  79. package/.next/server/app/(app)/prepare-deploy/page.js +19 -0
  80. package/.next/server/app/(app)/prepare-deploy/page.js.nft.json +1 -0
  81. package/.next/server/app/(app)/prepare-deploy/page_client-reference-manifest.js +1 -0
  82. package/.next/server/app/(app)/profile/page.js +2 -0
  83. package/.next/server/app/(app)/profile/page.js.nft.json +1 -0
  84. package/.next/server/app/(app)/profile/page_client-reference-manifest.js +1 -0
  85. package/.next/server/app/(app)/pulse/page.js +2 -0
  86. package/.next/server/app/(app)/pulse/page.js.nft.json +1 -0
  87. package/.next/server/app/(app)/pulse/page_client-reference-manifest.js +1 -0
  88. package/.next/server/app/(app)/reports/[id]/page.js +3 -0
  89. package/.next/server/app/(app)/reports/[id]/page.js.nft.json +1 -0
  90. package/.next/server/app/(app)/reports/[id]/page_client-reference-manifest.js +1 -0
  91. package/.next/server/app/(app)/reports/page.js +5 -0
  92. package/.next/server/app/(app)/reports/page.js.nft.json +1 -0
  93. package/.next/server/app/(app)/reports/page_client-reference-manifest.js +1 -0
  94. package/.next/server/app/(app)/routines/page.js +2 -0
  95. package/.next/server/app/(app)/routines/page.js.nft.json +1 -0
  96. package/.next/server/app/(app)/routines/page_client-reference-manifest.js +1 -0
  97. package/.next/server/app/(app)/search/page.js +2 -0
  98. package/.next/server/app/(app)/search/page.js.nft.json +1 -0
  99. package/.next/server/app/(app)/search/page_client-reference-manifest.js +1 -0
  100. package/.next/server/app/(app)/security/page.js +2 -0
  101. package/.next/server/app/(app)/security/page.js.nft.json +1 -0
  102. package/.next/server/app/(app)/security/page_client-reference-manifest.js +1 -0
  103. package/.next/server/app/(app)/skills/page.js +18 -0
  104. package/.next/server/app/(app)/skills/page.js.nft.json +1 -0
  105. package/.next/server/app/(app)/skills/page_client-reference-manifest.js +1 -0
  106. package/.next/server/app/(app)/tasks/page.js +2 -0
  107. package/.next/server/app/(app)/tasks/page.js.nft.json +1 -0
  108. package/.next/server/app/(app)/tasks/page_client-reference-manifest.js +1 -0
  109. package/.next/server/app/(app)/test-dev/page.js +2 -0
  110. package/.next/server/app/(app)/test-dev/page.js.nft.json +1 -0
  111. package/.next/server/app/(app)/test-dev/page_client-reference-manifest.js +1 -0
  112. package/.next/server/app/(app)/update/page.js +2 -0
  113. package/.next/server/app/(app)/update/page.js.nft.json +1 -0
  114. package/.next/server/app/(app)/update/page_client-reference-manifest.js +1 -0
  115. package/.next/server/app/(auth)/login/page.js +2 -0
  116. package/.next/server/app/(auth)/login/page.js.nft.json +1 -0
  117. package/.next/server/app/(auth)/login/page_client-reference-manifest.js +1 -0
  118. package/.next/server/app/(auth)/onboarding/page.js +18 -0
  119. package/.next/server/app/(auth)/onboarding/page.js.nft.json +1 -0
  120. package/.next/server/app/(auth)/onboarding/page_client-reference-manifest.js +1 -0
  121. package/.next/server/app/_global-error/page.js +32 -0
  122. package/.next/server/app/_global-error/page.js.nft.json +1 -0
  123. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -0
  124. package/.next/server/app/_global-error.html +1 -0
  125. package/.next/server/app/_global-error.meta +16 -0
  126. package/.next/server/app/_global-error.rsc +15 -0
  127. package/.next/server/app/_global-error.segments/_full.segment.rsc +15 -0
  128. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +5 -0
  129. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +5 -0
  130. package/.next/server/app/_global-error.segments/_head.segment.rsc +5 -0
  131. package/.next/server/app/_global-error.segments/_index.segment.rsc +6 -0
  132. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -0
  133. package/.next/server/app/_not-found/page.js +2 -0
  134. package/.next/server/app/_not-found/page.js.nft.json +1 -0
  135. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -0
  136. package/.next/server/app/api/auth/[...all]/route.js +1 -0
  137. package/.next/server/app/api/auth/[...all]/route.js.nft.json +1 -0
  138. package/.next/server/app/api/auth/[...all]/route_client-reference-manifest.js +1 -0
  139. package/.next/server/app/api/cron/tick/route.js +52 -0
  140. package/.next/server/app/api/cron/tick/route.js.nft.json +1 -0
  141. package/.next/server/app/api/cron/tick/route_client-reference-manifest.js +1 -0
  142. package/.next/server/app/api/dev-login/route.js +1 -0
  143. package/.next/server/app/api/dev-login/route.js.nft.json +1 -0
  144. package/.next/server/app/api/dev-login/route_client-reference-manifest.js +1 -0
  145. package/.next/server/app/api/locks/acquire/route.js +1 -0
  146. package/.next/server/app/api/locks/acquire/route.js.nft.json +1 -0
  147. package/.next/server/app/api/locks/acquire/route_client-reference-manifest.js +1 -0
  148. package/.next/server/app/api/models/progress/route.js +1 -0
  149. package/.next/server/app/api/models/progress/route.js.nft.json +1 -0
  150. package/.next/server/app/api/models/progress/route_client-reference-manifest.js +1 -0
  151. package/.next/server/app/api/passkey/authenticate/options/route.js +1 -0
  152. package/.next/server/app/api/passkey/authenticate/options/route.js.nft.json +1 -0
  153. package/.next/server/app/api/passkey/authenticate/options/route_client-reference-manifest.js +1 -0
  154. package/.next/server/app/api/passkey/authenticate/verify/route.js +1 -0
  155. package/.next/server/app/api/passkey/authenticate/verify/route.js.nft.json +1 -0
  156. package/.next/server/app/api/passkey/authenticate/verify/route_client-reference-manifest.js +1 -0
  157. package/.next/server/app/api/passkey/register/options/route.js +1 -0
  158. package/.next/server/app/api/passkey/register/options/route.js.nft.json +1 -0
  159. package/.next/server/app/api/passkey/register/options/route_client-reference-manifest.js +1 -0
  160. package/.next/server/app/api/passkey/register/verify/route.js +1 -0
  161. package/.next/server/app/api/passkey/register/verify/route.js.nft.json +1 -0
  162. package/.next/server/app/api/passkey/register/verify/route_client-reference-manifest.js +1 -0
  163. package/.next/server/app/api/stream/route.js +4 -0
  164. package/.next/server/app/api/stream/route.js.nft.json +1 -0
  165. package/.next/server/app/api/stream/route_client-reference-manifest.js +1 -0
  166. package/.next/server/app/api/sync/file/route.js +2 -0
  167. package/.next/server/app/api/sync/file/route.js.nft.json +1 -0
  168. package/.next/server/app/api/sync/file/route_client-reference-manifest.js +1 -0
  169. package/.next/server/app/api/telegram/poll/route.js +15 -0
  170. package/.next/server/app/api/telegram/poll/route.js.nft.json +1 -0
  171. package/.next/server/app/api/telegram/poll/route_client-reference-manifest.js +1 -0
  172. package/.next/server/app/api/upload/route.js +1 -0
  173. package/.next/server/app/api/upload/route.js.nft.json +1 -0
  174. package/.next/server/app/api/upload/route_client-reference-manifest.js +1 -0
  175. package/.next/server/app/api/v1/[[...path]]/route.js +1 -0
  176. package/.next/server/app/api/v1/[[...path]]/route.js.nft.json +1 -0
  177. package/.next/server/app/api/v1/[[...path]]/route_client-reference-manifest.js +1 -0
  178. package/.next/server/app-paths-manifest.json +53 -0
  179. package/.next/server/chunks/1003.js +1 -0
  180. package/.next/server/chunks/127.js +26 -0
  181. package/.next/server/chunks/1388.js +1 -0
  182. package/.next/server/chunks/1408.js +21 -0
  183. package/.next/server/chunks/1572.js +1 -0
  184. package/.next/server/chunks/1591.js +24 -0
  185. package/.next/server/chunks/1619.js +188 -0
  186. package/.next/server/chunks/162.js +1 -0
  187. package/.next/server/chunks/1881.js +1 -0
  188. package/.next/server/chunks/1968.js +1 -0
  189. package/.next/server/chunks/2297.js +348 -0
  190. package/.next/server/chunks/2341.js +1 -0
  191. package/.next/server/chunks/2517.js +1 -0
  192. package/.next/server/chunks/2549.js +1 -0
  193. package/.next/server/chunks/259.js +14 -0
  194. package/.next/server/chunks/2599.js +1 -0
  195. package/.next/server/chunks/260.js +1 -0
  196. package/.next/server/chunks/2867.js +147 -0
  197. package/.next/server/chunks/3018.js +1 -0
  198. package/.next/server/chunks/3050.js +18 -0
  199. package/.next/server/chunks/3085.js +12 -0
  200. package/.next/server/chunks/3131.js +1 -0
  201. package/.next/server/chunks/3242.js +1 -0
  202. package/.next/server/chunks/3266.js +15 -0
  203. package/.next/server/chunks/3524.js +1 -0
  204. package/.next/server/chunks/3527.js +479 -0
  205. package/.next/server/chunks/3533.js +869 -0
  206. package/.next/server/chunks/3550.js +1 -0
  207. package/.next/server/chunks/3609.js +2 -0
  208. package/.next/server/chunks/3667.js +462 -0
  209. package/.next/server/chunks/3760.js +4 -0
  210. package/.next/server/chunks/4679.js +1 -0
  211. package/.next/server/chunks/4804.js +1 -0
  212. package/.next/server/chunks/4832.js +2 -0
  213. package/.next/server/chunks/4853.js +1 -0
  214. package/.next/server/chunks/4979.js +67 -0
  215. package/.next/server/chunks/5060.js +1 -0
  216. package/.next/server/chunks/5278.js +1 -0
  217. package/.next/server/chunks/5614.js +1 -0
  218. package/.next/server/chunks/5818.js +1 -0
  219. package/.next/server/chunks/6479.js +1 -0
  220. package/.next/server/chunks/6658.js +1 -0
  221. package/.next/server/chunks/6706.js +1 -0
  222. package/.next/server/chunks/6719.js +1 -0
  223. package/.next/server/chunks/678.js +1 -0
  224. package/.next/server/chunks/683.js +1 -0
  225. package/.next/server/chunks/6862.js +1 -0
  226. package/.next/server/chunks/6882.js +1 -0
  227. package/.next/server/chunks/7037.js +1 -0
  228. package/.next/server/chunks/7107.js +741 -0
  229. package/.next/server/chunks/73.js +17 -0
  230. package/.next/server/chunks/7327.js +1 -0
  231. package/.next/server/chunks/7514.js +1 -0
  232. package/.next/server/chunks/7622.js +1 -0
  233. package/.next/server/chunks/7778.js +1 -0
  234. package/.next/server/chunks/7912.js +1 -0
  235. package/.next/server/chunks/7949.js +1 -0
  236. package/.next/server/chunks/7971.js +1 -0
  237. package/.next/server/chunks/7989.js +1 -0
  238. package/.next/server/chunks/842.js +22 -0
  239. package/.next/server/chunks/8762.js +15 -0
  240. package/.next/server/chunks/8823.js +77 -0
  241. package/.next/server/chunks/9146.js +4 -0
  242. package/.next/server/chunks/9676.js +1 -0
  243. package/.next/server/chunks/9783.js +22 -0
  244. package/.next/server/chunks/9969.js +3 -0
  245. package/.next/server/functions-config-manifest.json +18 -0
  246. package/.next/server/instrumentation.js +1 -0
  247. package/.next/server/instrumentation.js.nft.json +1 -0
  248. package/.next/server/interception-route-rewrite-manifest.js +1 -0
  249. package/.next/server/middleware-build-manifest.js +1 -0
  250. package/.next/server/middleware-manifest.json +6 -0
  251. package/.next/server/middleware-react-loadable-manifest.js +1 -0
  252. package/.next/server/middleware.js +18 -0
  253. package/.next/server/middleware.js.nft.json +1 -0
  254. package/.next/server/next-font-manifest.js +1 -0
  255. package/.next/server/next-font-manifest.json +1 -0
  256. package/.next/server/pages/500.html +1 -0
  257. package/.next/server/pages-manifest.json +3 -0
  258. package/.next/server/prefetch-hints.json +1 -0
  259. package/.next/server/server-reference-manifest.js +1 -0
  260. package/.next/server/server-reference-manifest.json +1 -0
  261. package/.next/server/webpack-runtime.js +1 -0
  262. package/.next/static/chunks/1858-339516f78a4b00da.js +1 -0
  263. package/.next/static/chunks/2320-fc8b39380e69d465.js +2 -0
  264. package/.next/static/chunks/23550918-ff694f70f4b0648c.js +1 -0
  265. package/.next/static/chunks/3219-ebb3c23be38c838d.js +1 -0
  266. package/.next/static/chunks/4263-adecb5b466380b6e.js +1 -0
  267. package/.next/static/chunks/5479-0cceab68cd0ca9c7.js +1 -0
  268. package/.next/static/chunks/5701-665b927b06158b76.js +1 -0
  269. package/.next/static/chunks/5920.6451a68b63918988.js +1 -0
  270. package/.next/static/chunks/6575-5c9139720bb0f5bf.js +4 -0
  271. package/.next/static/chunks/6834-4759af1ce7d95fb6.js +32 -0
  272. package/.next/static/chunks/7509.721cd47a931c5518.js +1 -0
  273. package/.next/static/chunks/8264-1ca011989ee2b231.js +1 -0
  274. package/.next/static/chunks/9219-4a39a98b5502d9d1.js +1 -0
  275. package/.next/static/chunks/9690-53d5222618cbeddb.js +1 -0
  276. package/.next/static/chunks/app/(app)/activity/page-3973534281ecea81.js +1 -0
  277. package/.next/static/chunks/app/(app)/agents/[handle]/page-83662a175c098282.js +1 -0
  278. package/.next/static/chunks/app/(app)/code/page-33979545192cd137.js +1 -0
  279. package/.next/static/chunks/app/(app)/config/page-9933aed1ca8a85c1.js +1 -0
  280. package/.next/static/chunks/app/(app)/costs/page-131c4dc580efcc19.js +1 -0
  281. package/.next/static/chunks/app/(app)/cron/page-53ea1aff998a87ca.js +1 -0
  282. package/.next/static/chunks/app/(app)/dashboard/page-deed83aaa9d0d447.js +1 -0
  283. package/.next/static/chunks/app/(app)/docs/[id]/page-38c993d73c0eab4f.js +1 -0
  284. package/.next/static/chunks/app/(app)/docs/page-bf463b55d0554e86.js +1 -0
  285. package/.next/static/chunks/app/(app)/error-988cd28480809861.js +1 -0
  286. package/.next/static/chunks/app/(app)/github/page-62678b4e82dfecb6.js +1 -0
  287. package/.next/static/chunks/app/(app)/goals/page-4adb426fe1c96106.js +1 -0
  288. package/.next/static/chunks/app/(app)/inbox/page-e347dc55ab467310.js +1 -0
  289. package/.next/static/chunks/app/(app)/knowledge/page-65393a045b4349be.js +1 -0
  290. package/.next/static/chunks/app/(app)/layout-7f65675705b011d8.js +1 -0
  291. package/.next/static/chunks/app/(app)/models/page-e01f1dd7e49a2951.js +1 -0
  292. package/.next/static/chunks/app/(app)/notifications/page-56548ac87aef00da.js +1 -0
  293. package/.next/static/chunks/app/(app)/org/page-699e6a6dc0db7d81.js +1 -0
  294. package/.next/static/chunks/app/(app)/organizations/page-36051a380a7e8eb7.js +1 -0
  295. package/.next/static/chunks/app/(app)/page-7d1011a566f81520.js +1 -0
  296. package/.next/static/chunks/app/(app)/planner/page-dab7ced94083373a.js +1 -0
  297. package/.next/static/chunks/app/(app)/plugins/page-5b5a1f53389be42e.js +1 -0
  298. package/.next/static/chunks/app/(app)/pm/page-0de5c08c0b227bb0.js +1 -0
  299. package/.next/static/chunks/app/(app)/prepare-deploy/page-e426038552df8d41.js +1 -0
  300. package/.next/static/chunks/app/(app)/profile/page-608dfcaf8aae0a69.js +1 -0
  301. package/.next/static/chunks/app/(app)/pulse/page-309ccaca91de1faa.js +1 -0
  302. package/.next/static/chunks/app/(app)/reports/[id]/page-53ea1aff998a87ca.js +1 -0
  303. package/.next/static/chunks/app/(app)/reports/page-68cdc6dcfa472d86.js +1 -0
  304. package/.next/static/chunks/app/(app)/routines/page-bcc55550b197a9fa.js +1 -0
  305. package/.next/static/chunks/app/(app)/search/page-5c5f67558d0dbf0d.js +1 -0
  306. package/.next/static/chunks/app/(app)/security/page-a7d41e36aa366b45.js +1 -0
  307. package/.next/static/chunks/app/(app)/skills/page-c5b21e89593b8336.js +1 -0
  308. package/.next/static/chunks/app/(app)/tasks/page-08ae079e3e54d2ce.js +1 -0
  309. package/.next/static/chunks/app/(app)/test-dev/page-633f82dfd9c3ce23.js +1 -0
  310. package/.next/static/chunks/app/(app)/update/page-4be019054351bfac.js +1 -0
  311. package/.next/static/chunks/app/(auth)/login/page-6e85d3377062acae.js +1 -0
  312. package/.next/static/chunks/app/(auth)/onboarding/page-ebb10c175abf3b85.js +1 -0
  313. package/.next/static/chunks/app/_global-error/page-23fe50a6bf589c97.js +1 -0
  314. package/.next/static/chunks/app/_not-found/page-dc38b02aebeab535.js +1 -0
  315. package/.next/static/chunks/app/api/auth/[...all]/route-23fe50a6bf589c97.js +1 -0
  316. package/.next/static/chunks/app/api/cron/tick/route-23fe50a6bf589c97.js +1 -0
  317. package/.next/static/chunks/app/api/dev-login/route-23fe50a6bf589c97.js +1 -0
  318. package/.next/static/chunks/app/api/locks/acquire/route-23fe50a6bf589c97.js +1 -0
  319. package/.next/static/chunks/app/api/models/progress/route-23fe50a6bf589c97.js +1 -0
  320. package/.next/static/chunks/app/api/passkey/authenticate/options/route-23fe50a6bf589c97.js +1 -0
  321. package/.next/static/chunks/app/api/passkey/authenticate/verify/route-23fe50a6bf589c97.js +1 -0
  322. package/.next/static/chunks/app/api/passkey/register/options/route-23fe50a6bf589c97.js +1 -0
  323. package/.next/static/chunks/app/api/passkey/register/verify/route-23fe50a6bf589c97.js +1 -0
  324. package/.next/static/chunks/app/api/stream/route-23fe50a6bf589c97.js +1 -0
  325. package/.next/static/chunks/app/api/sync/file/route-23fe50a6bf589c97.js +1 -0
  326. package/.next/static/chunks/app/api/telegram/poll/route-23fe50a6bf589c97.js +1 -0
  327. package/.next/static/chunks/app/api/upload/route-23fe50a6bf589c97.js +1 -0
  328. package/.next/static/chunks/app/api/v1/[[...path]]/route-23fe50a6bf589c97.js +1 -0
  329. package/.next/static/chunks/app/error-09899a13c38b6e89.js +1 -0
  330. package/.next/static/chunks/app/global-error-b8050d4d886f448c.js +1 -0
  331. package/.next/static/chunks/app/layout-ab9deed1e7e2e9df.js +1 -0
  332. package/.next/static/chunks/framework-4b2c6b6043dd203f.js +1 -0
  333. package/.next/static/chunks/main-722e16032e7764d1.js +5 -0
  334. package/.next/static/chunks/main-app-761880af2b6f1962.js +1 -0
  335. package/.next/static/chunks/next/dist/client/components/builtin/app-error-23fe50a6bf589c97.js +1 -0
  336. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-23fe50a6bf589c97.js +1 -0
  337. package/.next/static/chunks/next/dist/client/components/builtin/not-found-23fe50a6bf589c97.js +1 -0
  338. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-23fe50a6bf589c97.js +1 -0
  339. package/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
  340. package/.next/static/chunks/webpack-222e3894b78c67db.js +1 -0
  341. package/.next/static/css/0a9b5805594444e3.css +1 -0
  342. package/.next/static/yztMvBwyrWWkSqP6jfXoa/_buildManifest.js +1 -0
  343. package/.next/static/yztMvBwyrWWkSqP6jfXoa/_ssgManifest.js +1 -0
  344. package/.next/trace-build +1 -0
  345. package/.next/types/app/(app)/activity/page.ts +87 -0
  346. package/.next/types/app/(app)/agents/[handle]/page.ts +87 -0
  347. package/.next/types/app/(app)/code/page.ts +87 -0
  348. package/.next/types/app/(app)/config/page.ts +87 -0
  349. package/.next/types/app/(app)/costs/page.ts +87 -0
  350. package/.next/types/app/(app)/cron/page.ts +87 -0
  351. package/.next/types/app/(app)/dashboard/page.ts +87 -0
  352. package/.next/types/app/(app)/docs/[id]/page.ts +87 -0
  353. package/.next/types/app/(app)/docs/page.ts +87 -0
  354. package/.next/types/app/(app)/github/page.ts +87 -0
  355. package/.next/types/app/(app)/goals/page.ts +87 -0
  356. package/.next/types/app/(app)/inbox/page.ts +87 -0
  357. package/.next/types/app/(app)/knowledge/page.ts +87 -0
  358. package/.next/types/app/(app)/models/page.ts +87 -0
  359. package/.next/types/app/(app)/notifications/page.ts +87 -0
  360. package/.next/types/app/(app)/org/page.ts +87 -0
  361. package/.next/types/app/(app)/organizations/page.ts +87 -0
  362. package/.next/types/app/(app)/page.ts +87 -0
  363. package/.next/types/app/(app)/planner/page.ts +87 -0
  364. package/.next/types/app/(app)/plugins/page.ts +87 -0
  365. package/.next/types/app/(app)/pm/page.ts +87 -0
  366. package/.next/types/app/(app)/prepare-deploy/page.ts +87 -0
  367. package/.next/types/app/(app)/profile/page.ts +87 -0
  368. package/.next/types/app/(app)/pulse/page.ts +87 -0
  369. package/.next/types/app/(app)/reports/[id]/page.ts +87 -0
  370. package/.next/types/app/(app)/reports/page.ts +87 -0
  371. package/.next/types/app/(app)/routines/page.ts +87 -0
  372. package/.next/types/app/(app)/search/page.ts +87 -0
  373. package/.next/types/app/(app)/security/page.ts +87 -0
  374. package/.next/types/app/(app)/skills/page.ts +87 -0
  375. package/.next/types/app/(app)/tasks/page.ts +87 -0
  376. package/.next/types/app/(app)/test-dev/page.ts +87 -0
  377. package/.next/types/app/(app)/update/page.ts +87 -0
  378. package/.next/types/app/(auth)/login/page.ts +87 -0
  379. package/.next/types/app/(auth)/onboarding/page.ts +87 -0
  380. package/.next/types/app/api/auth/[...all]/route.ts +351 -0
  381. package/.next/types/app/api/cron/tick/route.ts +351 -0
  382. package/.next/types/app/api/dev-login/route.ts +351 -0
  383. package/.next/types/app/api/locks/acquire/route.ts +351 -0
  384. package/.next/types/app/api/models/progress/route.ts +351 -0
  385. package/.next/types/app/api/passkey/authenticate/options/route.ts +351 -0
  386. package/.next/types/app/api/passkey/authenticate/verify/route.ts +351 -0
  387. package/.next/types/app/api/passkey/register/options/route.ts +351 -0
  388. package/.next/types/app/api/passkey/register/verify/route.ts +351 -0
  389. package/.next/types/app/api/stream/route.ts +351 -0
  390. package/.next/types/app/api/sync/file/route.ts +351 -0
  391. package/.next/types/app/api/telegram/poll/route.ts +351 -0
  392. package/.next/types/app/api/upload/route.ts +351 -0
  393. package/.next/types/app/api/v1/[[...path]]/route.ts +351 -0
  394. package/.next/types/cache-life.d.ts +145 -0
  395. package/.next/types/link.d.ts +210 -0
  396. package/.next/types/package.json +1 -0
  397. package/.next/types/routes.d.ts +120 -0
  398. package/.next/types/validator.ts +511 -0
  399. package/CHANGELOG.md +312 -0
  400. package/LICENSE +21 -0
  401. package/README.md +382 -0
  402. package/README.pt-BR.md +391 -0
  403. package/bin/constella.mjs +329 -0
  404. package/bin/guard-hook.mjs +44 -0
  405. package/bin/lock-hook.mjs +49 -0
  406. package/bin/worker.mjs +142 -0
  407. package/docs/assets/arch-orbit.svg +56 -0
  408. package/docs/assets/blackhole.svg +37 -0
  409. package/docs/assets/divider-orbit.svg +23 -0
  410. package/docs/assets/hero-constella.svg +72 -0
  411. package/docs/en/AGENTS.md +279 -0
  412. package/docs/en/AI_ARCHITECTURE.md +373 -0
  413. package/docs/en/ARCHITECTURE.md +334 -0
  414. package/docs/en/AUTH_MODE.md +247 -0
  415. package/docs/en/CHAT_COMMANDS.md +305 -0
  416. package/docs/en/CONFIGURATION.md +340 -0
  417. package/docs/en/DEPLOY.md +331 -0
  418. package/docs/en/DM.md +297 -0
  419. package/docs/en/FAQ.md +258 -0
  420. package/docs/en/GITHUB.md +341 -0
  421. package/docs/en/GOALS_SPECS_ISSUES.md +303 -0
  422. package/docs/en/INBOX.md +340 -0
  423. package/docs/en/INSTALLATION.md +329 -0
  424. package/docs/en/KB_AGENT.md +305 -0
  425. package/docs/en/KB_RAG.md +356 -0
  426. package/docs/en/MCP.md +313 -0
  427. package/docs/en/MEMORY_RAG.md +289 -0
  428. package/docs/en/MODELS.md +341 -0
  429. package/docs/en/ONBOARDING.md +327 -0
  430. package/docs/en/PLUGINS.md +290 -0
  431. package/docs/en/PORTABLE_MODE.md +387 -0
  432. package/docs/en/PO_AGENT.md +379 -0
  433. package/docs/en/PREPARE_DEPLOY.md +308 -0
  434. package/docs/en/PROJECT_STACKS.md +258 -0
  435. package/docs/en/PUBLIC_API.md +315 -0
  436. package/docs/en/PUBLISHING.md +343 -0
  437. package/docs/en/README.md +95 -0
  438. package/docs/en/SECURITY.md +280 -0
  439. package/docs/en/SKILLS.md +349 -0
  440. package/docs/en/START_MODE.md +340 -0
  441. package/docs/en/SYNCED_BLOCKS.md +320 -0
  442. package/docs/en/TEAM_ROOM.md +285 -0
  443. package/docs/en/TELEGRAM.md +294 -0
  444. package/docs/en/TEST_DEV.md +321 -0
  445. package/docs/en/TROUBLESHOOTING.md +294 -0
  446. package/docs/en/UPDATE.md +301 -0
  447. package/docs/en/VPS_MODE.md +334 -0
  448. package/docs/en/WORKFLOW.md +321 -0
  449. package/docs/pt/AGENTS.md +279 -0
  450. package/docs/pt/AI_ARCHITECTURE.md +373 -0
  451. package/docs/pt/ARCHITECTURE.md +334 -0
  452. package/docs/pt/AUTH_MODE.md +247 -0
  453. package/docs/pt/CHAT_COMMANDS.md +307 -0
  454. package/docs/pt/CONFIGURATION.md +340 -0
  455. package/docs/pt/DEPLOY.md +331 -0
  456. package/docs/pt/DM.md +297 -0
  457. package/docs/pt/FAQ.md +258 -0
  458. package/docs/pt/GITHUB.md +341 -0
  459. package/docs/pt/GOALS_SPECS_ISSUES.md +303 -0
  460. package/docs/pt/INBOX.md +340 -0
  461. package/docs/pt/INSTALLATION.md +329 -0
  462. package/docs/pt/KB_AGENT.md +305 -0
  463. package/docs/pt/KB_RAG.md +356 -0
  464. package/docs/pt/MCP.md +313 -0
  465. package/docs/pt/MEMORY_RAG.md +289 -0
  466. package/docs/pt/MODELS.md +341 -0
  467. package/docs/pt/ONBOARDING.md +327 -0
  468. package/docs/pt/PLUGINS.md +290 -0
  469. package/docs/pt/PORTABLE_MODE.md +387 -0
  470. package/docs/pt/PO_AGENT.md +379 -0
  471. package/docs/pt/PREPARE_DEPLOY.md +308 -0
  472. package/docs/pt/PROJECT_STACKS.md +258 -0
  473. package/docs/pt/PUBLIC_API.md +315 -0
  474. package/docs/pt/PUBLISHING.md +343 -0
  475. package/docs/pt/README.md +95 -0
  476. package/docs/pt/SECURITY.md +280 -0
  477. package/docs/pt/SKILLS.md +349 -0
  478. package/docs/pt/START_MODE.md +340 -0
  479. package/docs/pt/SYNCED_BLOCKS.md +320 -0
  480. package/docs/pt/TEAM_ROOM.md +285 -0
  481. package/docs/pt/TELEGRAM.md +294 -0
  482. package/docs/pt/TEST_DEV.md +321 -0
  483. package/docs/pt/TROUBLESHOOTING.md +294 -0
  484. package/docs/pt/UPDATE.md +301 -0
  485. package/docs/pt/VPS_MODE.md +334 -0
  486. package/docs/pt/WORKFLOW.md +321 -0
  487. package/drizzle/0000_regular_nightshade.sql +644 -0
  488. package/drizzle/0001_mixed_zombie.sql +106 -0
  489. package/drizzle/meta/0000_snapshot.json +4650 -0
  490. package/drizzle/meta/0001_snapshot.json +5418 -0
  491. package/drizzle/meta/_journal.json +20 -0
  492. package/drizzle.config.mjs +16 -0
  493. package/next.config.mjs +18 -0
  494. package/package.json +130 -0
  495. package/scripts/clean-repo.mjs +20 -0
  496. package/scripts/dev-all.mjs +46 -0
  497. package/scripts/i18n-parity.mjs +57 -0
  498. package/scripts/mcp-server.mjs +100 -0
  499. package/scripts/postbuild.mjs +11 -0
  500. package/scripts/publish-public.mjs +116 -0
  501. package/scripts/start-all.mjs +45 -0
  502. package/scripts/trim-next.mjs +23 -0
  503. package/scripts/vps-install.sh +39 -0
  504. package/skills/CONTRIBUTING.md +122 -0
  505. package/skills/COVERAGE.md +129 -0
  506. package/skills/INDEX.json +3443 -0
  507. package/skills/README.md +57 -0
  508. package/skills/design/animation-motion/SKILL.md +60 -0
  509. package/skills/design/color-and-typography/SKILL.md +60 -0
  510. package/skills/design/css-techniques/SKILL.md +58 -0
  511. package/skills/design/design-systems/SKILL.md +60 -0
  512. package/skills/design/gradients/SKILL.md +59 -0
  513. package/skills/design/graphic-design-basics/SKILL.md +55 -0
  514. package/skills/design/microinteractions/SKILL.md +58 -0
  515. package/skills/design/responsive-layout/SKILL.md +59 -0
  516. package/skills/design/ui-ux-principles/SKILL.md +58 -0
  517. package/skills/engineering/architecture/api-design-rest-graphql/SKILL.md +67 -0
  518. package/skills/engineering/architecture/caching-strategies/SKILL.md +59 -0
  519. package/skills/engineering/architecture/data-modeling/SKILL.md +64 -0
  520. package/skills/engineering/architecture/message-queues-async/SKILL.md +58 -0
  521. package/skills/engineering/architecture/scalability-reliability/SKILL.md +62 -0
  522. package/skills/engineering/architecture/software-architecture-patterns/SKILL.md +56 -0
  523. package/skills/engineering/architecture/system-design-fundamentals/SKILL.md +56 -0
  524. package/skills/engineering/backend/auth-and-authorization/SKILL.md +62 -0
  525. package/skills/engineering/backend/backend-fundamentals/SKILL.md +65 -0
  526. package/skills/engineering/backend/observability-logging/SKILL.md +60 -0
  527. package/skills/engineering/frontend/accessibility-wcag/SKILL.md +57 -0
  528. package/skills/engineering/frontend/frontend-architecture/SKILL.md +65 -0
  529. package/skills/engineering/frontend/rendering-strategies-ssr-csr/SKILL.md +60 -0
  530. package/skills/engineering/frontend/state-management/SKILL.md +69 -0
  531. package/skills/engineering/performance/backend-performance/SKILL.md +69 -0
  532. package/skills/engineering/performance/database-query-optimization/SKILL.md +64 -0
  533. package/skills/engineering/performance/profiling-and-benchmarking/SKILL.md +60 -0
  534. package/skills/engineering/performance/web-performance-core-vitals/SKILL.md +72 -0
  535. package/skills/engineering/practices/clean-code/SKILL.md +61 -0
  536. package/skills/engineering/practices/code-optimization/SKILL.md +60 -0
  537. package/skills/engineering/practices/code-review-practices/SKILL.md +58 -0
  538. package/skills/engineering/practices/git-workflow/SKILL.md +62 -0
  539. package/skills/engineering/practices/refactoring/SKILL.md +58 -0
  540. package/skills/engineering/security/appsec-fundamentals/SKILL.md +70 -0
  541. package/skills/engineering/security/dependency-supply-chain/SKILL.md +77 -0
  542. package/skills/engineering/security/owasp-asvs/SKILL.md +54 -0
  543. package/skills/engineering/security/owasp-top-10/SKILL.md +63 -0
  544. package/skills/engineering/security/secrets-management/SKILL.md +58 -0
  545. package/skills/engineering/security/secure-auth-sessions/SKILL.md +56 -0
  546. package/skills/engineering/testing/tdd-and-coverage/SKILL.md +62 -0
  547. package/skills/engineering/testing/testing-strategy-pyramid/SKILL.md +56 -0
  548. package/skills/engineering/testing/unit-integration-e2e/SKILL.md +75 -0
  549. package/skills/languages/c/SKILL.md +74 -0
  550. package/skills/languages/clojure/SKILL.md +73 -0
  551. package/skills/languages/cpp/SKILL.md +75 -0
  552. package/skills/languages/csharp/SKILL.md +75 -0
  553. package/skills/languages/dart/SKILL.md +82 -0
  554. package/skills/languages/elixir/SKILL.md +74 -0
  555. package/skills/languages/erlang/SKILL.md +76 -0
  556. package/skills/languages/go/SKILL.md +83 -0
  557. package/skills/languages/haskell/SKILL.md +70 -0
  558. package/skills/languages/java/SKILL.md +71 -0
  559. package/skills/languages/javascript/SKILL.md +62 -0
  560. package/skills/languages/kotlin/SKILL.md +68 -0
  561. package/skills/languages/lua/SKILL.md +79 -0
  562. package/skills/languages/objectivec/SKILL.md +83 -0
  563. package/skills/languages/php/SKILL.md +74 -0
  564. package/skills/languages/python/SKILL.md +68 -0
  565. package/skills/languages/r/SKILL.md +70 -0
  566. package/skills/languages/ruby/SKILL.md +67 -0
  567. package/skills/languages/rust/SKILL.md +72 -0
  568. package/skills/languages/scala/SKILL.md +73 -0
  569. package/skills/languages/swift/SKILL.md +73 -0
  570. package/skills/languages/typescript/SKILL.md +69 -0
  571. package/skills/meta/authoring-agent-skills/SKILL.md +73 -0
  572. package/skills/meta/progressive-disclosure/SKILL.md +65 -0
  573. package/skills/meta/skill-frontmatter-spec/SKILL.md +65 -0
  574. package/skills/process/adr-technical-decisions/SKILL.md +59 -0
  575. package/skills/process/app-planning/SKILL.md +63 -0
  576. package/skills/process/architecture-before-code/SKILL.md +52 -0
  577. package/skills/process/breaking-work-into-sprints/SKILL.md +53 -0
  578. package/skills/process/idea-to-product/SKILL.md +50 -0
  579. package/skills/process/mocks-and-screen-flows/SKILL.md +52 -0
  580. package/skills/process/prioritization-moscow-rice/SKILL.md +64 -0
  581. package/skills/process/problem-framing/SKILL.md +51 -0
  582. package/skills/process/product-discovery/SKILL.md +53 -0
  583. package/skills/process/readme-generation/SKILL.md +90 -0
  584. package/skills/process/requirements-to-specs/SKILL.md +53 -0
  585. package/skills/process/research-official-docs/SKILL.md +58 -0
  586. package/skills/process/review-code-perf-security/SKILL.md +65 -0
  587. package/skills/process/security-by-design/SKILL.md +68 -0
  588. package/skills/process/specs-to-issues/SKILL.md +53 -0
  589. package/skills/process/testing-before-done/SKILL.md +61 -0
  590. package/skills/process/validating-ux-navigation/SKILL.md +63 -0
  591. package/skills/references/ai-attachments-ui/SKILL.md +66 -0
  592. package/skills/references/ai-in-browser-webllm/SKILL.md +74 -0
  593. package/skills/references/ai-tool-ui-patterns/SKILL.md +63 -0
  594. package/skills/references/component-patterns-gallery/SKILL.md +62 -0
  595. package/skills/references/gradient-resources/SKILL.md +66 -0
  596. package/skills/references/react-component-libraries/SKILL.md +61 -0
  597. package/skills/references/saas-landing-patterns/SKILL.md +67 -0
  598. package/skills/references/shadcn-tailwind-theming/SKILL.md +74 -0
  599. package/skills/references/vercel-ai-sdk-elements/SKILL.md +66 -0
  600. package/skills/references/web-animation-codrops/SKILL.md +68 -0
  601. package/skills/stacks/aiml/jupyter/SKILL.md +68 -0
  602. package/skills/stacks/aiml/keras/SKILL.md +77 -0
  603. package/skills/stacks/aiml/numpy/SKILL.md +69 -0
  604. package/skills/stacks/aiml/pandas/SKILL.md +72 -0
  605. package/skills/stacks/aiml/pytorch/SKILL.md +77 -0
  606. package/skills/stacks/aiml/scikit-learn/SKILL.md +74 -0
  607. package/skills/stacks/aiml/tensorflow/SKILL.md +79 -0
  608. package/skills/stacks/auth/auth0/SKILL.md +63 -0
  609. package/skills/stacks/auth/authjs/SKILL.md +69 -0
  610. package/skills/stacks/auth/clerk/SKILL.md +72 -0
  611. package/skills/stacks/auth/keycloak/SKILL.md +63 -0
  612. package/skills/stacks/auth/lucia/SKILL.md +56 -0
  613. package/skills/stacks/auth/passport/SKILL.md +70 -0
  614. package/skills/stacks/auth/supabase-auth/SKILL.md +66 -0
  615. package/skills/stacks/baas/amplify/SKILL.md +71 -0
  616. package/skills/stacks/baas/appwrite/SKILL.md +79 -0
  617. package/skills/stacks/baas/firebase/SKILL.md +73 -0
  618. package/skills/stacks/baas/heroku/SKILL.md +71 -0
  619. package/skills/stacks/backend/actix/SKILL.md +77 -0
  620. package/skills/stacks/backend/adonisjs/SKILL.md +65 -0
  621. package/skills/stacks/backend/aspnet-core/SKILL.md +75 -0
  622. package/skills/stacks/backend/codeigniter/SKILL.md +76 -0
  623. package/skills/stacks/backend/django/SKILL.md +62 -0
  624. package/skills/stacks/backend/express/SKILL.md +65 -0
  625. package/skills/stacks/backend/fastapi/SKILL.md +64 -0
  626. package/skills/stacks/backend/fastify/SKILL.md +64 -0
  627. package/skills/stacks/backend/fiber/SKILL.md +68 -0
  628. package/skills/stacks/backend/flask/SKILL.md +71 -0
  629. package/skills/stacks/backend/gin/SKILL.md +68 -0
  630. package/skills/stacks/backend/graphql/SKILL.md +70 -0
  631. package/skills/stacks/backend/hono/SKILL.md +64 -0
  632. package/skills/stacks/backend/koa/SKILL.md +63 -0
  633. package/skills/stacks/backend/laravel/SKILL.md +73 -0
  634. package/skills/stacks/backend/nestjs/SKILL.md +70 -0
  635. package/skills/stacks/backend/nginx/SKILL.md +77 -0
  636. package/skills/stacks/backend/phoenix/SKILL.md +68 -0
  637. package/skills/stacks/backend/rails/SKILL.md +67 -0
  638. package/skills/stacks/backend/spring/SKILL.md +70 -0
  639. package/skills/stacks/backend/spring-boot/SKILL.md +70 -0
  640. package/skills/stacks/backend/symfony/SKILL.md +77 -0
  641. package/skills/stacks/container/containerd/SKILL.md +75 -0
  642. package/skills/stacks/container/docker/SKILL.md +90 -0
  643. package/skills/stacks/container/podman/SKILL.md +93 -0
  644. package/skills/stacks/database/cassandra/SKILL.md +74 -0
  645. package/skills/stacks/database/cockroachdb/SKILL.md +69 -0
  646. package/skills/stacks/database/dynamodb/SKILL.md +62 -0
  647. package/skills/stacks/database/mariadb/SKILL.md +71 -0
  648. package/skills/stacks/database/mongodb/SKILL.md +71 -0
  649. package/skills/stacks/database/mysql/SKILL.md +72 -0
  650. package/skills/stacks/database/neon/SKILL.md +68 -0
  651. package/skills/stacks/database/planetscale/SKILL.md +70 -0
  652. package/skills/stacks/database/postgresql/SKILL.md +81 -0
  653. package/skills/stacks/database/redis/SKILL.md +78 -0
  654. package/skills/stacks/database/sqlite/SKILL.md +70 -0
  655. package/skills/stacks/database/supabase/SKILL.md +79 -0
  656. package/skills/stacks/dataviz/chart-js/SKILL.md +72 -0
  657. package/skills/stacks/dataviz/d3/SKILL.md +77 -0
  658. package/skills/stacks/dataviz/grafana/SKILL.md +69 -0
  659. package/skills/stacks/dataviz/plotly/SKILL.md +71 -0
  660. package/skills/stacks/frontend/alpine/SKILL.md +75 -0
  661. package/skills/stacks/frontend/angular/SKILL.md +75 -0
  662. package/skills/stacks/frontend/backbone/SKILL.md +82 -0
  663. package/skills/stacks/frontend/ember/SKILL.md +85 -0
  664. package/skills/stacks/frontend/htmx/SKILL.md +73 -0
  665. package/skills/stacks/frontend/lit/SKILL.md +76 -0
  666. package/skills/stacks/frontend/preact/SKILL.md +74 -0
  667. package/skills/stacks/frontend/qwik/SKILL.md +65 -0
  668. package/skills/stacks/frontend/react/SKILL.md +77 -0
  669. package/skills/stacks/frontend/solidjs/SKILL.md +75 -0
  670. package/skills/stacks/frontend/svelte/SKILL.md +70 -0
  671. package/skills/stacks/frontend/vue/SKILL.md +69 -0
  672. package/skills/stacks/infra/ansible/SKILL.md +76 -0
  673. package/skills/stacks/infra/aws/SKILL.md +66 -0
  674. package/skills/stacks/infra/azure/SKILL.md +72 -0
  675. package/skills/stacks/infra/circleci/SKILL.md +78 -0
  676. package/skills/stacks/infra/cloudflare/SKILL.md +65 -0
  677. package/skills/stacks/infra/fly-io/SKILL.md +63 -0
  678. package/skills/stacks/infra/gcp/SKILL.md +66 -0
  679. package/skills/stacks/infra/jenkins/SKILL.md +73 -0
  680. package/skills/stacks/infra/kubernetes/SKILL.md +64 -0
  681. package/skills/stacks/infra/netlify/SKILL.md +60 -0
  682. package/skills/stacks/infra/railway/SKILL.md +63 -0
  683. package/skills/stacks/infra/tailscale/SKILL.md +65 -0
  684. package/skills/stacks/infra/terraform/SKILL.md +75 -0
  685. package/skills/stacks/infra/vagrant/SKILL.md +70 -0
  686. package/skills/stacks/infra/vercel/SKILL.md +60 -0
  687. package/skills/stacks/meta/astro/SKILL.md +64 -0
  688. package/skills/stacks/meta/docusaurus/SKILL.md +71 -0
  689. package/skills/stacks/meta/eleventy/SKILL.md +69 -0
  690. package/skills/stacks/meta/gatsby/SKILL.md +63 -0
  691. package/skills/stacks/meta/hugo/SKILL.md +73 -0
  692. package/skills/stacks/meta/jekyll/SKILL.md +70 -0
  693. package/skills/stacks/meta/nextjs/SKILL.md +62 -0
  694. package/skills/stacks/meta/nuxt/SKILL.md +66 -0
  695. package/skills/stacks/meta/remix/SKILL.md +67 -0
  696. package/skills/stacks/meta/sveltekit/SKILL.md +70 -0
  697. package/skills/stacks/meta/vite/SKILL.md +63 -0
  698. package/skills/stacks/mobile/android/SKILL.md +77 -0
  699. package/skills/stacks/mobile/flutter/SKILL.md +77 -0
  700. package/skills/stacks/mobile/ionic/SKILL.md +72 -0
  701. package/skills/stacks/mobile/nativescript/SKILL.md +71 -0
  702. package/skills/stacks/mobile/react-native/SKILL.md +75 -0
  703. package/skills/stacks/mobile/xamarin/SKILL.md +73 -0
  704. package/skills/stacks/orm/diesel/SKILL.md +72 -0
  705. package/skills/stacks/orm/django-orm/SKILL.md +58 -0
  706. package/skills/stacks/orm/drizzle/SKILL.md +67 -0
  707. package/skills/stacks/orm/gorm/SKILL.md +73 -0
  708. package/skills/stacks/orm/knex/SKILL.md +64 -0
  709. package/skills/stacks/orm/mongoose/SKILL.md +64 -0
  710. package/skills/stacks/orm/prisma/SKILL.md +64 -0
  711. package/skills/stacks/orm/sequelize/SKILL.md +65 -0
  712. package/skills/stacks/orm/sqlalchemy/SKILL.md +71 -0
  713. package/skills/stacks/orm/typeorm/SKILL.md +70 -0
  714. package/skills/stacks/queue/bullmq/SKILL.md +69 -0
  715. package/skills/stacks/queue/celery/SKILL.md +68 -0
  716. package/skills/stacks/queue/kafka/SKILL.md +66 -0
  717. package/skills/stacks/queue/nats/SKILL.md +66 -0
  718. package/skills/stacks/queue/rabbitmq/SKILL.md +64 -0
  719. package/skills/stacks/queue/redis/SKILL.md +66 -0
  720. package/skills/stacks/runtime/beam/SKILL.md +72 -0
  721. package/skills/stacks/runtime/bun/SKILL.md +80 -0
  722. package/skills/stacks/runtime/deno/SKILL.md +74 -0
  723. package/skills/stacks/runtime/dotnet/SKILL.md +64 -0
  724. package/skills/stacks/runtime/jvm/SKILL.md +66 -0
  725. package/skills/stacks/runtime/node/SKILL.md +70 -0
  726. package/skills/stacks/runtime/pypy/SKILL.md +69 -0
  727. package/skills/stacks/runtime/python3/SKILL.md +70 -0
  728. package/skills/stacks/styling/bootstrap/SKILL.md +74 -0
  729. package/skills/stacks/styling/bulma/SKILL.md +80 -0
  730. package/skills/stacks/styling/chakra-ui/SKILL.md +61 -0
  731. package/skills/stacks/styling/css-modules/SKILL.md +54 -0
  732. package/skills/stacks/styling/mui/SKILL.md +60 -0
  733. package/skills/stacks/styling/sass/SKILL.md +63 -0
  734. package/skills/stacks/styling/shadcn-ui/SKILL.md +58 -0
  735. package/skills/stacks/styling/styled-components/SKILL.md +62 -0
  736. package/skills/stacks/styling/tailwind/SKILL.md +59 -0
  737. package/skills/stacks/styling/unocss/SKILL.md +64 -0
  738. package/skills/stacks/styling/vanilla-extract/SKILL.md +64 -0
  739. package/skills/stacks/styling/vuetify/SKILL.md +89 -0
  740. package/skills/stacks/testing/cypress/SKILL.md +68 -0
  741. package/skills/stacks/testing/jasmine/SKILL.md +67 -0
  742. package/skills/stacks/testing/jest/SKILL.md +67 -0
  743. package/skills/stacks/testing/mocha/SKILL.md +71 -0
  744. package/skills/stacks/testing/playwright/SKILL.md +68 -0
  745. package/skills/stacks/testing/puppeteer/SKILL.md +70 -0
  746. package/skills/stacks/testing/selenium/SKILL.md +70 -0
  747. package/skills/stacks/testing/vitest/SKILL.md +68 -0
@@ -0,0 +1 @@
1
+ "use strict";exports.id=2341,exports.ids=[2341],exports.modules={16775:(a,b,c)=>{c.d(b,{n:()=>d,t:()=>e});let d="kysely_migration",e="kysely_migration_lock"},52341:(a,b,c)=>{c.d(b,{D1SqliteDialect:()=>l});var d=c(16775),e=c(31461),f=c(32582),g=class extends e.U{},h=class{#a;#b;constructor(a){this.#a={...a}}async init(){this.#b=new i(this.#a.database),this.#a.onCreateConnection&&await this.#a.onCreateConnection(this.#b)}async acquireConnection(){return this.#b}async beginTransaction(){throw Error("D1 does not support interactive transactions. Use the D1 batch() API instead.")}async commitTransaction(){throw Error("D1 does not support interactive transactions. Use the D1 batch() API instead.")}async rollbackTransaction(){throw Error("D1 does not support interactive transactions. Use the D1 batch() API instead.")}async releaseConnection(){}async destroy(){}},i=class{#c;constructor(a){this.#c=a}async executeQuery(a){let b=await this.#c.prepare(a.sql).bind(...a.parameters).all(),c=null!=b.meta.changes?BigInt(b.meta.changes):void 0;return{insertId:void 0===b.meta.last_row_id||null===b.meta.last_row_id?void 0:BigInt(b.meta.last_row_id),rows:b?.results||[],numAffectedRows:c}}async *streamQuery(){throw Error("D1 does not support streaming queries.")}},j=class{#c;#d;constructor(a,b){this.#c=a,this.#d=b}async getSchemas(){return[]}async getTables(a={withInternalKyselyTables:!1}){let b=this.#c.selectFrom("sqlite_master").where("type","in",["table","view"]).where("name","not like","sqlite_%").where("name","not like","_cf_%").select(["name","type","sql"]).$castTo();a.withInternalKyselyTables||(b=b.where("name","!=",d.n).where("name","!=",d.t));let c=await b.execute();if(0===c.length)return[];let e=c.map(a=>this.#d.prepare("SELECT * FROM pragma_table_info(?)").bind(a.name)),f=await this.#d.batch(e);return c.map((a,b)=>{let c=f[b]?.results??[],d=a.sql?.split(/[(),]/)?.find(a=>a.toLowerCase().includes("autoincrement"))?.split(/\s+/)?.filter(Boolean)?.[0]?.replace(/["`]/g,"");if(!d){let a=c.filter(a=>a.pk>0),b=1===a.length?a[0]:void 0;b&&"integer"===b.type.toLowerCase()&&(d=b.name)}return{name:a.name,isView:"view"===a.type,isForeign:!1,columns:c.map(a=>({name:a.name,dataType:a.type,isNullable:!a.notnull,isAutoIncrementing:a.name===d,hasDefaultValue:null!=a.dflt_value}))}})}},k=class extends f.s{},l=class{#a;constructor(a){this.#a={...a}}createDriver(){return new h(this.#a)}createQueryCompiler(){return new k}createAdapter(){return new g}createIntrospector(a){return new j(a,this.#a.database)}}}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=2517,exports.ids=[2517],exports.modules={11185:(a,b,c)=>{c.d(b,{Y:()=>h,r:()=>g});var d=c(73024),e=c(76760),f=c(28430);let g="constella";function h(){if(process.env.CONSTELLA_VERSION)return process.env.CONSTELLA_VERSION;try{let a=JSON.parse((0,d.readFileSync)((0,e.join)((0,f.v)(),"package.json"),"utf8"));if(a?.version)return a.version}catch{}return"0.0.0"}},22517:(a,b,c)=>{c.d(b,{checkForUpdate:()=>i});var d=c(11185);let e=null,f=a=>a.replace(/^v/,"").split("-")[0].split(".").map(a=>parseInt(a,10)||0);async function g(a){try{let b=new AbortController,c=setTimeout(()=>b.abort(),3e3),d=await fetch(a,{signal:b.signal,headers:{"user-agent":"constella"}});return clearTimeout(c),d.ok?await d.json():null}catch{return null}}async function h(a){try{let b=new AbortController,c=setTimeout(()=>b.abort(),3e3),d=await fetch(a,{signal:b.signal,headers:{"user-agent":"constella"}});return clearTimeout(c),d.ok?await d.text():null}catch{return null}}async function i(a=!1){let b,c,j=(0,d.Y)(),k=`npm install -g ${d.r}@latest`;if(!a&&e&&Date.now()-e.at<216e5)return e.info;let l=await g(`https://registry.npmjs.org/${d.r}/latest`),m=l?.version??null,n=!!m&&function(a,b){let c=f(a),d=f(b);for(let a=0;a<3;a++){if((c[a]||0)>(d[a]||0))return!0;if((c[a]||0)<(d[a]||0))break}return!1}(m,j),o=null;if(n&&m){let a=await h("https://raw.githubusercontent.com/gabriel7silva/constella/main/CHANGELOG.md");o=a?function(a,b){let c=b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),d=a.match(RegExp(`(^|\\n)##\\s*\\[?${c}\\]?[\\s\\S]*?(?=\\n##\\s|$)`));if(d)return d[0].trim();let e=a.split(/\n##\s/)[1];return e?"## "+e.trim():null}(a,m):null}let p={current:j,latest:m,updateAvailable:n,type:m?(b=f(m),c=f(j),b[0]>c[0]?"major":b[1]>c[1]?"minor":b[2]>c[2]?"patch":null):null,command:k,changelog:o};return e={at:Date.now(),info:p},p}}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=2549,exports.ids=[2549],exports.modules={42549:(a,b,c)=>{c.d(b,{createKyselyAdapter:()=>d.xA,kyselyAdapter:()=>d.rV});var d=c(46404)}};
@@ -0,0 +1,14 @@
1
+ "use strict";exports.id=259,exports.ids=[259],exports.modules={2562:(a,b,c)=>{c.d(b,{jo:()=>C,D:()=>D});var d=c(68369),e=c(94024),f=c(60917),g=c(99764);class h extends g.o{static [d.i]="SQLiteBigIntBuilder";constructor(a){super(a,"bigint","SQLiteBigInt")}build(a){return new i(a,this.config)}}class i extends g.v{static [d.i]="SQLiteBigInt";getSQLType(){return"blob"}mapFromDriverValue(a){return"u">typeof Buffer&&Buffer.from?BigInt((Buffer.isBuffer(a)?a:a instanceof ArrayBuffer?Buffer.from(a):a.buffer?Buffer.from(a.buffer,a.byteOffset,a.byteLength):Buffer.from(a)).toString("utf8")):BigInt(f.su.decode(a))}mapToDriverValue(a){return Buffer.from(a.toString())}}class j extends g.o{static [d.i]="SQLiteBlobJsonBuilder";constructor(a){super(a,"json","SQLiteBlobJson")}build(a){return new k(a,this.config)}}class k extends g.v{static [d.i]="SQLiteBlobJson";getSQLType(){return"blob"}mapFromDriverValue(a){return"u">typeof Buffer&&Buffer.from?JSON.parse((Buffer.isBuffer(a)?a:a instanceof ArrayBuffer?Buffer.from(a):a.buffer?Buffer.from(a.buffer,a.byteOffset,a.byteLength):Buffer.from(a)).toString("utf8")):JSON.parse(f.su.decode(a))}mapToDriverValue(a){return Buffer.from(JSON.stringify(a))}}class l extends g.o{static [d.i]="SQLiteBlobBufferBuilder";constructor(a){super(a,"buffer","SQLiteBlobBuffer")}build(a){return new m(a,this.config)}}class m extends g.v{static [d.i]="SQLiteBlobBuffer";mapFromDriverValue(a){return Buffer.isBuffer(a)?a:Buffer.from(a)}getSQLType(){return"blob"}}function n(a,b){let{name:c,config:d}=(0,f.Ll)(a,b);return d?.mode==="json"?new j(c):d?.mode==="bigint"?new h(c):new l(c)}class o extends g.o{static [d.i]="SQLiteCustomColumnBuilder";constructor(a,b,c){super(a,"custom","SQLiteCustomColumn"),this.config.fieldConfig=b,this.config.customTypeParams=c}build(a){return new p(a,this.config)}}class p extends g.v{static [d.i]="SQLiteCustomColumn";sqlName;mapTo;mapFrom;constructor(a,b){super(a,b),this.sqlName=b.customTypeParams.dataType(b.fieldConfig),this.mapTo=b.customTypeParams.toDriver,this.mapFrom=b.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(a){return"function"==typeof this.mapFrom?this.mapFrom(a):a}mapToDriverValue(a){return"function"==typeof this.mapTo?this.mapTo(a):a}}function q(a){return(b,c)=>{let{name:d,config:e}=(0,f.Ll)(b,c);return new o(d,e,a)}}var r=c(96421);class s extends g.o{static [d.i]="SQLiteNumericBuilder";constructor(a){super(a,"string","SQLiteNumeric")}build(a){return new t(a,this.config)}}class t extends g.v{static [d.i]="SQLiteNumeric";mapFromDriverValue(a){return"string"==typeof a?a:String(a)}getSQLType(){return"numeric"}}class u extends g.o{static [d.i]="SQLiteNumericNumberBuilder";constructor(a){super(a,"number","SQLiteNumericNumber")}build(a){return new v(a,this.config)}}class v extends g.v{static [d.i]="SQLiteNumericNumber";mapFromDriverValue(a){return"number"==typeof a?a:Number(a)}mapToDriverValue=String;getSQLType(){return"numeric"}}class w extends g.o{static [d.i]="SQLiteNumericBigIntBuilder";constructor(a){super(a,"bigint","SQLiteNumericBigInt")}build(a){return new x(a,this.config)}}class x extends g.v{static [d.i]="SQLiteNumericBigInt";mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return"numeric"}}function y(a,b){let{name:c,config:d}=(0,f.Ll)(a,b),e=d?.mode;return"number"===e?new u(c):"bigint"===e?new w(c):new s(c)}var z=c(44023),A=c(19020);let B=Symbol.for("drizzle:SQLiteInlineForeignKeys");class C extends e.XI{static [d.i]="SQLiteTable";static Symbol=Object.assign({},e.XI.Symbol,{InlineForeignKeys:B});[e.XI.Symbol.Columns];[B]=[];[e.XI.Symbol.ExtraConfigBuilder]=void 0}let D=(a,b,c)=>(function(a,b,c,d=a){let f=new C(a,void 0,d),g=Object.fromEntries(Object.entries("function"==typeof b?b({blob:n,customType:q,integer:r.nd,numeric:y,real:z.x,text:A.Qq}):b).map(([a,b])=>{b.setName(a);let c=b.build(f);return f[B].push(...b.buildForeignKeys(c,f)),[a,c]})),h=Object.assign(f,g);return h[e.XI.Symbol.Columns]=g,h[e.XI.Symbol.ExtraConfigColumns]=g,c&&(h[C.Symbol.ExtraConfigBuilder]=c),h})(a,b,c)},5443:(a,b,c)=>{c.d(b,{Y:()=>e,i:()=>f});var d=c(64429);function e(a){return(0,d.ll)`${a} asc`}function f(a){return(0,d.ll)`${a} desc`}},12787:(a,b,c)=>{c.d(b,{E:()=>d});let d=Symbol.for("drizzle:Name")},13490:(a,b,c)=>{c.d(b,{Q:()=>e});var d=c(68369);class e{static [d.i]="ColumnBuilder";config;constructor(a,b,c){this.config={name:a,keyAsName:""===a,notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:b,columnType:c,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(a){return this.config.default=a,this.config.hasDefault=!0,this}$defaultFn(a){return this.config.defaultFn=a,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(a){return this.config.onUpdateFn=a,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(a){""===this.config.name&&(this.config.name=a)}}},19020:(a,b,c)=>{c.d(b,{Qq:()=>k});var d=c(68369),e=c(60917),f=c(99764);class g extends f.o{static [d.i]="SQLiteTextBuilder";constructor(a,b){super(a,"string","SQLiteText"),this.config.enumValues=b.enum,this.config.length=b.length}build(a){return new h(a,this.config)}}class h extends f.v{static [d.i]="SQLiteText";enumValues=this.config.enumValues;length=this.config.length;constructor(a,b){super(a,b)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:""}`}}class i extends f.o{static [d.i]="SQLiteTextJsonBuilder";constructor(a){super(a,"json","SQLiteTextJson")}build(a){return new j(a,this.config)}}class j extends f.v{static [d.i]="SQLiteTextJson";getSQLType(){return"text"}mapFromDriverValue(a){return JSON.parse(a)}mapToDriverValue(a){return JSON.stringify(a)}}function k(a,b={}){let{name:c,config:d}=(0,e.Ll)(a,b);return"json"===d.mode?new i(c):new g(c,d)}},22124:(a,b,c)=>{c.d(b,{f:()=>aD});var d=c(87550),e=c(68369);class f{static [e.i]="ConsoleLogWriter";write(a){console.log(a)}}class g{static [e.i]="DefaultLogger";writer;constructor(a){this.writer=a?.writer??new f}logQuery(a,b){let c=b.map(a=>{try{return JSON.stringify(a)}catch{return String(a)}}),d=c.length?` -- params: [${c.join(", ")}]`:"";this.writer.write(`Query: ${a}${d}`)}}class h{static [e.i]="NoopLogger";logQuery(){}}var i=c(94024),j=c(46080);let k=Symbol.for("drizzle:PgInlineForeignKeys"),l=Symbol.for("drizzle:EnableRLS");class m extends i.XI{static [e.i]="PgTable";static Symbol=Object.assign({},i.XI.Symbol,{InlineForeignKeys:k,EnableRLS:l});[k]=[];[l]=!1;[i.XI.Symbol.ExtraConfigBuilder]=void 0;[i.XI.Symbol.ExtraConfigColumns]={}}class n{static [e.i]="PgPrimaryKeyBuilder";columns;name;constructor(a,b){this.columns=a,this.name=b}build(a){return new o(a,this.columns,this.name)}}class o{constructor(a,b,c){this.table=a,this.columns=b,this.name=c}static [e.i]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[m.Symbol.Name]}_${this.columns.map(a=>a.name).join("_")}_pk`}}var p=c(63933),q=c(5443),r=c(64429);class s{constructor(a,b,c){this.sourceTable=a,this.referencedTable=b,this.relationName=c,this.referencedTableName=b[i.XI.Symbol.Name]}static [e.i]="Relation";referencedTableName;fieldName}class t{constructor(a,b){this.table=a,this.config=b}static [e.i]="Relations"}class u extends s{constructor(a,b,c,d){super(a,b,c?.relationName),this.config=c,this.isNullable=d}static [e.i]="One";withFieldName(a){let b=new u(this.sourceTable,this.referencedTable,this.config,this.isNullable);return b.fieldName=a,b}}class v extends s{constructor(a,b,c){super(a,b,c?.relationName),this.config=c}static [e.i]="Many";withFieldName(a){let b=new v(this.sourceTable,this.referencedTable,this.config);return b.fieldName=a,b}}function w(a){return{one:function(b,c){return new u(a,b,c,c?.fields.reduce((a,b)=>a&&b.notNull,!0)??!1)},many:function(b,c){return new v(a,b,c)}}}var x=c(60109);class y{constructor(a){this.table=a}static [e.i]="ColumnAliasProxyHandler";get(a,b){return"table"===b?this.table:a[b]}}class z{constructor(a,b){this.alias=a,this.replaceOriginalName=b}static [e.i]="TableAliasProxyHandler";get(a,b){if(b===i.XI.Symbol.IsAlias)return!0;if(b===i.XI.Symbol.Name||this.replaceOriginalName&&b===i.XI.Symbol.OriginalName)return this.alias;if(b===x.n)return{...a[x.n],name:this.alias,isAlias:!0};if(b===i.XI.Symbol.Columns){let b=a[i.XI.Symbol.Columns];if(!b)return b;let c={};return Object.keys(b).map(d=>{c[d]=new Proxy(b[d],new y(new Proxy(a,this)))}),c}let c=a[b];return(0,e.is)(c,j.V)?new Proxy(c,new y(new Proxy(a,this))):c}}class A{constructor(a){this.alias=a}static [e.i]=null;get(a,b){return"sourceTable"===b?B(a.sourceTable,this.alias):a[b]}}function B(a,b){return new Proxy(a,new z(b,!1))}function C(a,b){return new Proxy(a,new y(new Proxy(a.table,new z(b,!1))))}function D(a,b){return new r.Xs.Aliased(E(a.sql,b),a.fieldAlias)}function E(a,b){return r.ll.join(a.queryChunks.map(a=>(0,e.is)(a,j.V)?C(a,b):(0,e.is)(a,r.Xs)?E(a,b):(0,e.is)(a,r.Xs.Aliased)?D(a,b):a))}var F=c(54748);class G{static [e.i]="SelectionProxyHandler";config;constructor(a){this.config={...a}}get(a,b){if("_"===b)return{...a._,selectedFields:new Proxy(a._.selectedFields,this)};if(b===x.n)return{...a[x.n],selectedFields:new Proxy(a[x.n].selectedFields,this)};if("symbol"==typeof b)return a[b];let c=((0,e.is)(a,F.n)?a._.selectedFields:(0,e.is)(a,r.Ss)?a[x.n].selectedFields:a)[b];if((0,e.is)(c,r.Xs.Aliased)){if("sql"===this.config.sqlAliasedBehavior&&!c.isSelectionField)return c.sql;let a=c.clone();return a.isSelectionField=!0,a}if((0,e.is)(c,r.Xs)){if("sql"===this.config.sqlBehavior)return c;throw Error(`You tried to reference "${b}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return(0,e.is)(c,j.V)?this.config.alias?new Proxy(c,new y(new Proxy(c.table,new z(this.config.alias,this.config.replaceOriginalName??!1)))):c:"object"!=typeof c||null===c?c:new Proxy(c,new G(this.config))}}function H(a){return(a.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map(a=>a.toLowerCase()).join("_")}function I(a){return(a.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((a,b,c)=>a+(0===c?b.toLowerCase():`${b[0].toUpperCase()}${b.slice(1)}`),"")}function J(a){return a}class K{static [e.i]="CasingCache";cache={};cachedTables={};convert;constructor(a){this.convert="snake_case"===a?H:"camelCase"===a?I:J}getColumnCasing(a){if(!a.keyAsName)return a.name;let b=a.table[i.XI.Symbol.Schema]??"public",c=a.table[i.XI.Symbol.OriginalName],d=`${b}.${c}.${a.name}`;return this.cache[d]||this.cacheTable(a.table),this.cache[d]}cacheTable(a){let b=a[i.XI.Symbol.Schema]??"public",c=a[i.XI.Symbol.OriginalName],d=`${b}.${c}`;if(!this.cachedTables[d]){for(let b of Object.values(a[i.XI.Symbol.Columns])){let a=`${d}.${b.name}`;this.cache[a]=this.convert(b.name)}this.cachedTables[d]=!0}}clearCache(){this.cache={},this.cachedTables={}}}class L extends Error{static [e.i]="DrizzleError";constructor({message:a,cause:b}){super(a),this.name="DrizzleError",this.cause=b}}class M extends Error{constructor(a,b,c){super(`Failed query: ${a}
2
+ params: ${b}`),this.query=a,this.params=b,this.cause=c,Error.captureStackTrace(this,M),c&&(this.cause=c)}}class N extends L{static [e.i]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}var O=c(99764),P=c(2562),Q=c(60917);class R extends r.Ss{static [e.i]="SQLiteViewBase"}class S{static [e.i]="SQLiteDialect";casing;constructor(a){this.casing=new K(a?.casing)}escapeName(a){return`"${a.replace(/"/g,'""')}"`}escapeParam(a){return"?"}escapeString(a){return`'${a.replace(/'/g,"''")}'`}buildWithCTE(a){if(!a?.length)return;let b=[(0,r.ll)`with `];for(let[c,d]of a.entries())b.push((0,r.ll)`${r.ll.identifier(d._.alias)} as (${d._.sql})`),c<a.length-1&&b.push((0,r.ll)`, `);return b.push((0,r.ll)` `),r.ll.join(b)}buildDeleteQuery({table:a,where:b,returning:c,withList:d,limit:e,orderBy:f}){let g=this.buildWithCTE(d),h=c?(0,r.ll)` returning ${this.buildSelection(c,{isSingleTable:!0})}`:void 0,i=b?(0,r.ll)` where ${b}`:void 0,j=this.buildOrderBy(f),k=this.buildLimit(e);return(0,r.ll)`${g}delete from ${a}${i}${h}${j}${k}`}buildUpdateSet(a,b){let c=a[i.XI.Symbol.Columns],d=Object.keys(c).filter(a=>void 0!==b[a]||c[a]?.onUpdateFn!==void 0),f=d.length;return r.ll.join(d.flatMap((a,d)=>{let g=c[a],h=g.onUpdateFn?.(),i=b[a]??((0,e.is)(h,r.Xs)?h:r.ll.param(h,g)),j=(0,r.ll)`${r.ll.identifier(this.casing.getColumnCasing(g))} = ${i}`;return d<f-1?[j,r.ll.raw(", ")]:[j]}))}buildUpdateQuery({table:a,set:b,where:c,returning:d,withList:e,joins:f,from:g,limit:h,orderBy:i}){let j=this.buildWithCTE(e),k=this.buildUpdateSet(a,b),l=g&&r.ll.join([r.ll.raw(" from "),this.buildFromTable(g)]),m=this.buildJoins(f),n=d?(0,r.ll)` returning ${this.buildSelection(d,{isSingleTable:!0})}`:void 0,o=c?(0,r.ll)` where ${c}`:void 0,p=this.buildOrderBy(i),q=this.buildLimit(h);return(0,r.ll)`${j}update ${a} set ${k}${l}${m}${o}${n}${p}${q}`}buildSelection(a,{isSingleTable:b=!1}={}){let c=a.length,d=a.flatMap(({field:a},d)=>{let f=[];if((0,e.is)(a,r.Xs.Aliased)&&a.isSelectionField)f.push(r.ll.identifier(a.fieldAlias));else if((0,e.is)(a,r.Xs.Aliased)||(0,e.is)(a,r.Xs)){let c=(0,e.is)(a,r.Xs.Aliased)?a.sql:a;b?f.push(new r.Xs(c.queryChunks.map(a=>(0,e.is)(a,j.V)?r.ll.identifier(this.casing.getColumnCasing(a)):a))):f.push(c),(0,e.is)(a,r.Xs.Aliased)&&f.push((0,r.ll)` as ${r.ll.identifier(a.fieldAlias)}`)}else if((0,e.is)(a,j.V)){let c=a.table[i.XI.Symbol.Name];"SQLiteNumericBigInt"===a.columnType?b?f.push((0,r.ll)`cast(${r.ll.identifier(this.casing.getColumnCasing(a))} as text)`):f.push((0,r.ll)`cast(${r.ll.identifier(c)}.${r.ll.identifier(this.casing.getColumnCasing(a))} as text)`):b?f.push(r.ll.identifier(this.casing.getColumnCasing(a))):f.push((0,r.ll)`${r.ll.identifier(c)}.${r.ll.identifier(this.casing.getColumnCasing(a))}`)}else if((0,e.is)(a,F.n)){let b=Object.entries(a._.selectedFields);if(1===b.length){let c=b[0][1],d=(0,e.is)(c,r.Xs)?c.decoder:(0,e.is)(c,j.V)?{mapFromDriverValue:a=>c.mapFromDriverValue(a)}:c.sql.decoder;d&&(a._.sql.decoder=d)}f.push(a)}return d<c-1&&f.push((0,r.ll)`, `),f});return r.ll.join(d)}buildJoins(a){if(!a||0===a.length)return;let b=[];if(a)for(let[c,d]of a.entries()){0===c&&b.push((0,r.ll)` `);let f=d.table,g=d.on?(0,r.ll)` on ${d.on}`:void 0;if((0,e.is)(f,P.jo)){let a=f[P.jo.Symbol.Name],c=f[P.jo.Symbol.Schema],e=f[P.jo.Symbol.OriginalName],h=a===e?void 0:d.alias;b.push((0,r.ll)`${r.ll.raw(d.joinType)} join ${c?(0,r.ll)`${r.ll.identifier(c)}.`:void 0}${r.ll.identifier(e)}${h&&(0,r.ll)` ${r.ll.identifier(h)}`}${g}`)}else b.push((0,r.ll)`${r.ll.raw(d.joinType)} join ${f}${g}`);c<a.length-1&&b.push((0,r.ll)` `)}return r.ll.join(b)}buildLimit(a){return"object"==typeof a||"number"==typeof a&&a>=0?(0,r.ll)` limit ${a}`:void 0}buildOrderBy(a){let b=[];if(a)for(let[c,d]of a.entries())b.push(d),c<a.length-1&&b.push((0,r.ll)`, `);return b.length>0?(0,r.ll)` order by ${r.ll.join(b)}`:void 0}buildFromTable(a){return(0,e.is)(a,i.XI)&&a[i.XI.Symbol.IsAlias]?(0,r.ll)`${(0,r.ll)`${r.ll.identifier(a[i.XI.Symbol.Schema]??"")}.`.if(a[i.XI.Symbol.Schema])}${r.ll.identifier(a[i.XI.Symbol.OriginalName])} ${r.ll.identifier(a[i.XI.Symbol.Name])}`:a}buildSelectQuery({withList:a,fields:b,fieldsFlat:c,where:d,having:f,table:g,joins:h,orderBy:k,groupBy:l,limit:m,offset:n,distinct:o,setOperators:p}){let q=c??(0,Q.He)(b);for(let a of q){let b;if((0,e.is)(a.field,j.V)&&(0,i.Io)(a.field.table)!==((0,e.is)(g,F.n)?g._.alias:(0,e.is)(g,R)?g[x.n].name:(0,e.is)(g,r.Xs)?void 0:(0,i.Io)(g))&&(b=a.field.table,!h?.some(({alias:a})=>a===(b[i.XI.Symbol.IsAlias]?(0,i.Io)(b):b[i.XI.Symbol.BaseName])))){let b=(0,i.Io)(a.field.table);throw Error(`Your "${a.path.join("->")}" field references a column "${b}"."${a.field.name}", but the table "${b}" is not part of the query! Did you forget to join it?`)}}let s=!h||0===h.length,t=this.buildWithCTE(a),u=o?(0,r.ll)` distinct`:void 0,v=this.buildSelection(q,{isSingleTable:s}),w=this.buildFromTable(g),y=this.buildJoins(h),z=d?(0,r.ll)` where ${d}`:void 0,A=f?(0,r.ll)` having ${f}`:void 0,B=[];if(l)for(let[a,b]of l.entries())B.push(b),a<l.length-1&&B.push((0,r.ll)`, `);let C=B.length>0?(0,r.ll)` group by ${r.ll.join(B)}`:void 0,D=this.buildOrderBy(k),E=this.buildLimit(m),G=n?(0,r.ll)` offset ${n}`:void 0,H=(0,r.ll)`${t}select${u} ${v} from ${w}${y}${z}${C}${A}${D}${E}${G}`;return p.length>0?this.buildSetOperations(H,p):H}buildSetOperations(a,b){let[c,...d]=b;if(!c)throw Error("Cannot pass undefined values to any set operator");return 0===d.length?this.buildSetOperationQuery({leftSelect:a,setOperator:c}):this.buildSetOperations(this.buildSetOperationQuery({leftSelect:a,setOperator:c}),d)}buildSetOperationQuery({leftSelect:a,setOperator:{type:b,isAll:c,rightSelect:d,limit:f,orderBy:g,offset:h}}){let i,j=(0,r.ll)`${a.getSQL()} `,k=(0,r.ll)`${d.getSQL()}`;if(g&&g.length>0){let a=[];for(let b of g)if((0,e.is)(b,O.v))a.push(r.ll.identifier(b.name));else if((0,e.is)(b,r.Xs)){for(let a=0;a<b.queryChunks.length;a++){let c=b.queryChunks[a];(0,e.is)(c,O.v)&&(b.queryChunks[a]=r.ll.identifier(this.casing.getColumnCasing(c)))}a.push((0,r.ll)`${b}`)}else a.push((0,r.ll)`${b}`);i=(0,r.ll)` order by ${r.ll.join(a,(0,r.ll)`, `)}`}let l="object"==typeof f||"number"==typeof f&&f>=0?(0,r.ll)` limit ${f}`:void 0,m=r.ll.raw(`${b} ${c?"all ":""}`),n=h?(0,r.ll)` offset ${h}`:void 0;return(0,r.ll)`${j}${m}${k}${i}${l}${n}`}buildInsertQuery({table:a,values:b,onConflict:c,returning:d,withList:f,select:g}){let h=[],j=Object.entries(a[i.XI.Symbol.Columns]).filter(([a,b])=>!b.shouldDisableInsert()),k=j.map(([,a])=>r.ll.identifier(this.casing.getColumnCasing(a)));if(g)(0,e.is)(b,r.Xs)?h.push(b):h.push(b.getSQL());else for(let[a,c]of(h.push(r.ll.raw("values ")),b.entries())){let d=[];for(let[a,b]of j){let f=c[a];if(void 0===f||(0,e.is)(f,r.Iw)&&void 0===f.value){let a;if(null!==b.default&&void 0!==b.default)a=(0,e.is)(b.default,r.Xs)?b.default:r.ll.param(b.default,b);else if(void 0!==b.defaultFn){let c=b.defaultFn();a=(0,e.is)(c,r.Xs)?c:r.ll.param(c,b)}else if(b.default||void 0===b.onUpdateFn)a=(0,r.ll)`null`;else{let c=b.onUpdateFn();a=(0,e.is)(c,r.Xs)?c:r.ll.param(c,b)}d.push(a)}else d.push(f)}h.push(d),a<b.length-1&&h.push((0,r.ll)`, `)}let l=this.buildWithCTE(f),m=r.ll.join(h),n=d?(0,r.ll)` returning ${this.buildSelection(d,{isSingleTable:!0})}`:void 0,o=c?.length?r.ll.join(c):void 0;return(0,r.ll)`${l}insert into ${a} ${k} ${m}${o}${n}`}sqlToQuery(a,b){return a.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,invokeSource:b})}buildRelationalQuery({fullSchema:a,schema:b,tableNamesMap:c,table:d,tableConfig:f,queryConfig:g,tableAlias:h,nestedQueryRelation:k,joinOn:l}){let m,n=[],o,s,t=[],w,x=[];if(!0===g)n=Object.entries(f.columns).map(([a,b])=>({dbKey:b.name,tsKey:a,field:C(b,h),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let d=Object.fromEntries(Object.entries(f.columns).map(([a,b])=>[a,C(b,h)]));if(g.where){let a="function"==typeof g.where?g.where(d,{and:p.Uo,between:p.Tq,eq:p.eq,exists:p.t2,gt:p.gt,gte:p.RO,ilike:p.B3,inArray:p.RV,isNull:p.kZ,isNotNull:p.Pe,like:p.mj,lt:p.lt,lte:p.wJ,ne:p.ne,not:p.AU,notBetween:p.o8,notExists:p.KJ,notLike:p.RK,notIlike:p.q1,notInArray:p.KL,or:p.or,sql:r.ll}):g.where;w=a&&E(a,h)}let k=[],l=[];if(g.columns){let a=!1;for(let[b,c]of Object.entries(g.columns))void 0!==c&&b in f.columns&&(a||!0!==c||(a=!0),l.push(b));l.length>0&&(l=a?l.filter(a=>g.columns?.[a]===!0):Object.keys(f.columns).filter(a=>!l.includes(a)))}else l=Object.keys(f.columns);for(let a of l){let b=f.columns[a];k.push({tsKey:a,value:b})}let m=[];if(g.with&&(m=Object.entries(g.with).filter(a=>!!a[1]).map(([a,b])=>({tsKey:a,queryConfig:b,relation:f.relations[a]}))),g.extras)for(let[a,b]of Object.entries("function"==typeof g.extras?g.extras(d,{sql:r.ll}):g.extras))k.push({tsKey:a,value:D(b,h)});for(let{tsKey:a,value:b}of k)n.push({dbKey:(0,e.is)(b,r.Xs.Aliased)?b.fieldAlias:f.columns[a].name,tsKey:a,field:(0,e.is)(b,j.V)?C(b,h):b,relationTableTsKey:void 0,isJson:!1,selection:[]});let v="function"==typeof g.orderBy?g.orderBy(d,{sql:r.ll,asc:q.Y,desc:q.i}):g.orderBy??[];for(let{tsKey:d,queryConfig:f,relation:k}of(Array.isArray(v)||(v=[v]),t=v.map(a=>(0,e.is)(a,j.V)?C(a,h):E(a,h)),o=g.limit,s=g.offset,m)){let g=function(a,b,c){if((0,e.is)(c,u)&&c.config)return{fields:c.config.fields,references:c.config.references};let d=b[(0,i.Lf)(c.referencedTable)];if(!d)throw Error(`Table "${c.referencedTable[i.XI.Symbol.Name]}" not found in schema`);let f=a[d];if(!f)throw Error(`Table "${d}" not found in schema`);let g=c.sourceTable,h=b[(0,i.Lf)(g)];if(!h)throw Error(`Table "${g[i.XI.Symbol.Name]}" not found in schema`);let j=[];for(let a of Object.values(f.relations))(c.relationName&&c!==a&&a.relationName===c.relationName||!c.relationName&&a.referencedTable===c.sourceTable)&&j.push(a);if(j.length>1)throw c.relationName?Error(`There are multiple relations with name "${c.relationName}" in table "${d}"`):Error(`There are multiple relations between "${d}" and "${c.sourceTable[i.XI.Symbol.Name]}". Please specify relation name`);if(j[0]&&(0,e.is)(j[0],u)&&j[0].config)return{fields:j[0].config.references,references:j[0].config.fields};throw Error(`There is not enough information to infer relation "${h}.${c.fieldName}"`)}(b,c,k),j=c[(0,i.Lf)(k.referencedTable)],l=`${h}_${d}`,m=(0,p.Uo)(...g.fields.map((a,b)=>(0,p.eq)(C(g.references[b],l),C(a,h)))),o=this.buildRelationalQuery({fullSchema:a,schema:b,tableNamesMap:c,table:a[j],tableConfig:b[j],queryConfig:(0,e.is)(k,u)?!0===f?{limit:1}:{...f,limit:1}:f,tableAlias:l,joinOn:m,nestedQueryRelation:k}),q=(0,r.ll)`(${o.sql})`.as(d);n.push({dbKey:d,tsKey:d,field:q,relationTableTsKey:j,isJson:!0,selection:o.selection})}}if(0===n.length)throw new L({message:`No fields selected for table "${f.tsName}" ("${h}"). You need to have at least one item in "columns", "with" or "extras". If you need to select all columns, omit the "columns" key or set it to undefined.`});if(w=(0,p.Uo)(l,w),k){let a=(0,r.ll)`json_array(${r.ll.join(n.map(({field:a})=>(0,e.is)(a,O.v)?r.ll.identifier(this.casing.getColumnCasing(a)):(0,e.is)(a,r.Xs.Aliased)?a.sql:a),(0,r.ll)`, `)})`;(0,e.is)(k,v)&&(a=(0,r.ll)`coalesce(json_group_array(${a}), json_array())`);let b=[{dbKey:"data",tsKey:"data",field:a.as("data"),isJson:!0,relationTableTsKey:f.tsName,selection:n}];void 0!==o||void 0!==s||t.length>0?(m=this.buildSelectQuery({table:B(d,h),fields:{},fieldsFlat:[{path:[],field:r.ll.raw("*")}],where:w,limit:o,offset:s,orderBy:t,setOperators:[]}),w=void 0,o=void 0,s=void 0,t=void 0):m=B(d,h),m=this.buildSelectQuery({table:(0,e.is)(m,P.jo)?m:new F.n(m,{},h),fields:{},fieldsFlat:b.map(({field:a})=>({path:[],field:(0,e.is)(a,j.V)?C(a,h):a})),joins:x,where:w,limit:o,offset:s,orderBy:t,setOperators:[]})}else m=this.buildSelectQuery({table:B(d,h),fields:{},fieldsFlat:n.map(({field:a})=>({path:[],field:(0,e.is)(a,j.V)?C(a,h):a})),joins:x,where:w,limit:o,offset:s,orderBy:t,setOperators:[]});return{tableTsKey:f.tsName,sql:m,selection:n}}}class T extends S{static [e.i]="SQLiteSyncDialect";migrate(a,b,c){let d=void 0===c||"string"==typeof c?"__drizzle_migrations":c.migrationsTable??"__drizzle_migrations",e=(0,r.ll)`
3
+ CREATE TABLE IF NOT EXISTS ${r.ll.identifier(d)} (
4
+ id SERIAL PRIMARY KEY,
5
+ hash text NOT NULL,
6
+ created_at numeric
7
+ )
8
+ `;b.run(e);let f=b.values((0,r.ll)`SELECT id, hash, created_at FROM ${r.ll.identifier(d)} ORDER BY created_at DESC LIMIT 1`)[0]??void 0;b.run((0,r.ll)`BEGIN`);try{for(let c of a)if(!f||Number(f[2])<c.folderMillis){for(let a of c.sql)b.run(r.ll.raw(a));b.run((0,r.ll)`INSERT INTO ${r.ll.identifier(d)} ("hash", "created_at") VALUES(${c.hash}, ${c.folderMillis})`)}b.run((0,r.ll)`COMMIT`)}catch(a){throw b.run((0,r.ll)`ROLLBACK`),a}}}class U extends null{static [e.i]=null;async migrate(a,b,c){let d=void 0===c||"string"==typeof c?"__drizzle_migrations":c.migrationsTable??"__drizzle_migrations",e=sql`
9
+ CREATE TABLE IF NOT EXISTS ${sql.identifier(d)} (
10
+ id SERIAL PRIMARY KEY,
11
+ hash text NOT NULL,
12
+ created_at numeric
13
+ )
14
+ `;await b.run(e);let f=(await b.values(sql`SELECT id, hash, created_at FROM ${sql.identifier(d)} ORDER BY created_at DESC LIMIT 1`))[0]??void 0;await b.transaction(async b=>{for(let c of a)if(!f||Number(f[2])<c.folderMillis){for(let a of c.sql)await b.run(sql.raw(a));await b.run(sql`INSERT INTO ${sql.identifier(d)} ("hash", "created_at") VALUES(${c.hash}, ${c.folderMillis})`)}})}}class V{static [e.i]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}class W{static [e.i]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(a){return this.then(void 0,a)}finally(a){return this.then(b=>(a?.(),b),b=>{throw a?.(),b})}then(a,b){return this.execute().then(a,b)}}function X(a){return(0,e.is)(a,P.jo)?[`${a[i.XI.Symbol.BaseName]}`]:(0,e.is)(a,F.n)?a._.usedTables??[]:(0,e.is)(a,r.Xs)?a.usedTables??[]:[]}class Y{static [e.i]="SQLiteSelectBuilder";fields;session;dialect;withList;distinct;constructor(a){this.fields=a.fields,this.session=a.session,this.dialect=a.dialect,this.withList=a.withList,this.distinct=a.distinct}from(a){let b,c=!!this.fields;return b=this.fields?this.fields:(0,e.is)(a,F.n)?Object.fromEntries(Object.keys(a._.selectedFields).map(b=>[b,a[b]])):(0,e.is)(a,R)?a[x.n].selectedFields:(0,e.is)(a,r.Xs)?{}:(0,Q.YD)(a),new $({table:a,fields:b,isPartialSelect:c,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct})}}class Z extends V{static [e.i]="SQLiteSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:a,fields:b,isPartialSelect:c,session:d,dialect:e,withList:f,distinct:g}){for(const h of(super(),this.config={withList:f,table:a,fields:{...b},distinct:g,setOperators:[]},this.isPartialSelect=c,this.session=d,this.dialect=e,this._={selectedFields:b,config:this.config},this.tableName=(0,Q.zN)(a),this.joinsNotNullableMap="string"==typeof this.tableName?{[this.tableName]:!0}:{},X(a)))this.usedTables.add(h)}getUsedTables(){return[...this.usedTables]}createJoin(a){return(b,c)=>{let d=this.tableName,f=(0,Q.zN)(b);for(let a of X(b))this.usedTables.add(a);if("string"==typeof f&&this.config.joins?.some(a=>a.alias===f))throw Error(`Alias "${f}" is already used in this query`);if(!this.isPartialSelect&&(1===Object.keys(this.joinsNotNullableMap).length&&"string"==typeof d&&(this.config.fields={[d]:this.config.fields}),"string"==typeof f&&!(0,e.is)(b,r.Xs))){let a=(0,e.is)(b,F.n)?b._.selectedFields:(0,e.is)(b,r.Ss)?b[x.n].selectedFields:b[i.XI.Symbol.Columns];this.config.fields[f]=a}if("function"==typeof c&&(c=c(new Proxy(this.config.fields,new G({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:c,table:b,joinType:a,alias:f}),"string"==typeof f)switch(a){case"left":this.joinsNotNullableMap[f]=!1;break;case"right":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([a])=>[a,!1])),this.joinsNotNullableMap[f]=!0;break;case"cross":case"inner":this.joinsNotNullableMap[f]=!0;break;case"full":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([a])=>[a,!1])),this.joinsNotNullableMap[f]=!1}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");crossJoin=this.createJoin("cross");createSetOperator(a,b){return c=>{let d="function"==typeof c?c(aa()):c;if(!(0,Q.DV)(this.getSelectedFields(),d.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:a,isAll:b,rightSelect:d}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);except=this.createSetOperator("except",!1);addSetOperators(a){return this.config.setOperators.push(...a),this}where(a){return"function"==typeof a&&(a=a(new Proxy(this.config.fields,new G({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.where=a,this}having(a){return"function"==typeof a&&(a=a(new Proxy(this.config.fields,new G({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.having=a,this}groupBy(...a){if("function"==typeof a[0]){let b=a[0](new Proxy(this.config.fields,new G({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(b)?b:[b]}else this.config.groupBy=a;return this}orderBy(...a){if("function"==typeof a[0]){let b=a[0](new Proxy(this.config.fields,new G({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),c=Array.isArray(b)?b:[b];this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=c:this.config.orderBy=c}else this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=a:this.config.orderBy=a;return this}limit(a){return this.config.setOperators.length>0?this.config.setOperators.at(-1).limit=a:this.config.limit=a,this}offset(a){return this.config.setOperators.length>0?this.config.setOperators.at(-1).offset=a:this.config.offset=a,this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:a,...b}=this.dialect.sqlToQuery(this.getSQL());return b}as(a){let b=[];if(b.push(...X(this.config.table)),this.config.joins)for(let a of this.config.joins)b.push(...X(a.table));return new Proxy(new F.n(this.getSQL(),this.config.fields,a,!1,[...new Set(b)]),new G({alias:a,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new G({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}}class $ extends Z{static [e.i]="SQLiteSelect";_prepare(a=!0){if(!this.session)throw Error("Cannot execute a query on a query builder. Please use a database instance instead.");let b=(0,Q.He)(this.config.fields),c=this.session[a?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),b,"all",!0,void 0,{type:"select",tables:[...this.usedTables]},this.cacheConfig);return c.joinsNotNullableMap=this.joinsNotNullableMap,c}$withCache(a){return this.cacheConfig=void 0===a?{config:{},enable:!0,autoInvalidate:!0}:!1===a?{enable:!1}:{enable:!0,autoInvalidate:!0,...a},this}prepare(){return this._prepare(!1)}run=a=>this._prepare().run(a);all=a=>this._prepare().all(a);get=a=>this._prepare().get(a);values=a=>this._prepare().values(a);async execute(){return this.all()}}function _(a,b){return(c,d,...e)=>{let f=[d,...e].map(c=>({type:a,isAll:b,rightSelect:c}));for(let a of f)if(!(0,Q.DV)(c.getSelectedFields(),a.rightSelect.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return c.addSetOperators(f)}}(0,Q.XJ)($,[W]);let aa=()=>({union:ab,unionAll:ac,intersect:ad,except:ae}),ab=_("union",!1),ac=_("union",!0),ad=_("intersect",!1),ae=_("except",!1);class af{static [e.i]="SQLiteQueryBuilder";dialect;dialectConfig;constructor(a){this.dialect=(0,e.is)(a,S)?a:void 0,this.dialectConfig=(0,e.is)(a,S)?void 0:a}$with=(a,b)=>{let c=this;return{as:d=>("function"==typeof d&&(d=d(c)),new Proxy(new F.J(d.getSQL(),b??("getSelectedFields"in d?d.getSelectedFields()??{}:{}),a,!0),new G({alias:a,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}};with(...a){let b=this;return{select:function(c){return new Y({fields:c??void 0,session:void 0,dialect:b.getDialect(),withList:a})},selectDistinct:function(c){return new Y({fields:c??void 0,session:void 0,dialect:b.getDialect(),withList:a,distinct:!0})}}}select(a){return new Y({fields:a??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(a){return new Y({fields:a??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}getDialect(){return this.dialect||(this.dialect=new T(this.dialectConfig)),this.dialect}}class ag{constructor(a,b,c,d){this.table=a,this.session=b,this.dialect=c,this.withList=d}static [e.i]="SQLiteUpdateBuilder";set(a){return new ah(this.table,(0,Q.q)(this.table,a),this.session,this.dialect,this.withList)}}class ah extends W{constructor(a,b,c,d,e){super(),this.session=c,this.dialect=d,this.config={set:b,table:a,withList:e,joins:[]}}static [e.i]="SQLiteUpdate";config;from(a){return this.config.from=a,this}createJoin(a){return(b,c)=>{let d=(0,Q.zN)(b);if("string"==typeof d&&this.config.joins.some(a=>a.alias===d))throw Error(`Alias "${d}" is already used in this query`);if("function"==typeof c){let a=this.config.from?(0,e.is)(b,P.jo)?b[i.XI.Symbol.Columns]:(0,e.is)(b,F.n)?b._.selectedFields:(0,e.is)(b,R)?b[x.n].selectedFields:void 0:void 0;c=c(new Proxy(this.config.table[i.XI.Symbol.Columns],new G({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),a&&new Proxy(a,new G({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}return this.config.joins.push({on:c,table:b,joinType:a,alias:d}),this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where(a){return this.config.where=a,this}orderBy(...a){if("function"==typeof a[0]){let b=a[0](new Proxy(this.config.table[i.XI.Symbol.Columns],new G({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),c=Array.isArray(b)?b:[b];this.config.orderBy=c}else this.config.orderBy=a;return this}limit(a){return this.config.limit=a,this}returning(a=this.config.table[P.jo.Symbol.Columns]){return this.config.returning=(0,Q.He)(a),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:a,...b}=this.dialect.sqlToQuery(this.getSQL());return b}_prepare(a=!0){return this.session[a?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"insert",tables:X(this.config.table)})}prepare(){return this._prepare(!1)}run=a=>this._prepare().run(a);all=a=>this._prepare().all(a);get=a=>this._prepare().get(a);values=a=>this._prepare().values(a);async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}}class ai{constructor(a,b,c,d){this.table=a,this.session=b,this.dialect=c,this.withList=d}static [e.i]="SQLiteInsertBuilder";values(a){if(0===(a=Array.isArray(a)?a:[a]).length)throw Error("values() must be called with at least one value");let b=a.map(a=>{let b={},c=this.table[i.XI.Symbol.Columns];for(let d of Object.keys(a)){let f=a[d];b[d]=(0,e.is)(f,r.Xs)?f:new r.Iw(f,c[d])}return b});return new aj(this.table,b,this.session,this.dialect,this.withList)}select(a){let b="function"==typeof a?a(new af):a;if(!(0,e.is)(b,r.Xs)&&!(0,Q.DV)(this.table[i.e],b._.selectedFields))throw Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");return new aj(this.table,b,this.session,this.dialect,this.withList,!0)}}class aj extends W{constructor(a,b,c,d,e,f){super(),this.session=c,this.dialect=d,this.config={table:a,values:b,withList:e,select:f}}static [e.i]="SQLiteInsert";config;returning(a=this.config.table[P.jo.Symbol.Columns]){return this.config.returning=(0,Q.He)(a),this}onConflictDoNothing(a={}){if(this.config.onConflict||(this.config.onConflict=[]),void 0===a.target)this.config.onConflict.push((0,r.ll)` on conflict do nothing`);else{let b=Array.isArray(a.target)?(0,r.ll)`${a.target}`:(0,r.ll)`${[a.target]}`,c=a.where?(0,r.ll)` where ${a.where}`:(0,r.ll)``;this.config.onConflict.push((0,r.ll)` on conflict ${b} do nothing${c}`)}return this}onConflictDoUpdate(a){if(a.where&&(a.targetWhere||a.setWhere))throw Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');this.config.onConflict||(this.config.onConflict=[]);let b=a.where?(0,r.ll)` where ${a.where}`:void 0,c=a.targetWhere?(0,r.ll)` where ${a.targetWhere}`:void 0,d=a.setWhere?(0,r.ll)` where ${a.setWhere}`:void 0,e=Array.isArray(a.target)?(0,r.ll)`${a.target}`:(0,r.ll)`${[a.target]}`,f=this.dialect.buildUpdateSet(this.config.table,(0,Q.q)(this.config.table,a.set));return this.config.onConflict.push((0,r.ll)` on conflict ${e}${c} do update set ${f}${b}${d}`),this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:a,...b}=this.dialect.sqlToQuery(this.getSQL());return b}_prepare(a=!0){return this.session[a?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"insert",tables:X(this.config.table)})}prepare(){return this._prepare(!1)}run=a=>this._prepare().run(a);all=a=>this._prepare().all(a);get=a=>this._prepare().get(a);values=a=>this._prepare().values(a);async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}}class ak extends W{constructor(a,b,c,d){super(),this.table=a,this.session=b,this.dialect=c,this.config={table:a,withList:d}}static [e.i]="SQLiteDelete";config;where(a){return this.config.where=a,this}orderBy(...a){if("function"==typeof a[0]){let b=a[0](new Proxy(this.config.table[i.XI.Symbol.Columns],new G({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),c=Array.isArray(b)?b:[b];this.config.orderBy=c}else this.config.orderBy=a;return this}limit(a){return this.config.limit=a,this}returning(a=this.table[P.jo.Symbol.Columns]){return this.config.returning=(0,Q.He)(a),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:a,...b}=this.dialect.sqlToQuery(this.getSQL());return b}_prepare(a=!0){return this.session[a?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"delete",tables:X(this.config.table)})}prepare(){return this._prepare(!1)}run=a=>this._prepare().run(a);all=a=>this._prepare().all(a);get=a=>this._prepare().get(a);values=a=>this._prepare().values(a);async execute(a){return this._prepare().execute(a)}$dynamic(){return this}}class al extends r.Xs{constructor(a){super(al.buildEmbeddedCount(a.source,a.filters).queryChunks),this.params=a,this.session=a.session,this.sql=al.buildCount(a.source,a.filters)}sql;static [e.i]="SQLiteCountBuilderAsync";[Symbol.toStringTag]="SQLiteCountBuilderAsync";session;static buildEmbeddedCount(a,b){return(0,r.ll)`(select count(*) from ${a}${r.ll.raw(" where ").if(b)}${b})`}static buildCount(a,b){return(0,r.ll)`select count(*) from ${a}${r.ll.raw(" where ").if(b)}${b}`}then(a,b){return Promise.resolve(this.session.count(this.sql)).then(a,b)}catch(a){return this.then(void 0,a)}finally(a){return this.then(b=>(a?.(),b),b=>{throw a?.(),b})}}class am{constructor(a,b,c,d,e,f,g,h){this.mode=a,this.fullSchema=b,this.schema=c,this.tableNamesMap=d,this.table=e,this.tableConfig=f,this.dialect=g,this.session=h}static [e.i]="SQLiteAsyncRelationalQueryBuilder";findMany(a){return"sync"===this.mode?new ao(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,a||{},"many"):new an(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,a||{},"many")}findFirst(a){return"sync"===this.mode?new ao(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,a?{...a,limit:1}:{limit:1},"first"):new an(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,a?{...a,limit:1}:{limit:1},"first")}}class an extends W{constructor(a,b,c,d,e,f,g,h,i){super(),this.fullSchema=a,this.schema=b,this.tableNamesMap=c,this.table=d,this.tableConfig=e,this.dialect=f,this.session=g,this.config=h,this.mode=i}static [e.i]="SQLiteAsyncRelationalQuery";mode;getSQL(){return this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}).sql}_prepare(a=!1){let{query:b,builtQuery:c}=this._toSQL();return this.session[a?"prepareOneTimeQuery":"prepareQuery"](c,void 0,"first"===this.mode?"get":"all",!0,(a,c)=>{let d=a.map(a=>(function a(b,c,d,f,g=a=>a){let h={};for(let[i,k]of f.entries())if(k.isJson){let f=c.relations[k.tsKey],j=d[i],l="string"==typeof j?JSON.parse(j):j;h[k.tsKey]=(0,e.is)(f,u)?l&&a(b,b[k.relationTableTsKey],l,k.selection,g):l.map(c=>a(b,b[k.relationTableTsKey],c,k.selection,g))}else{let a,b=g(d[i]),c=k.field;a=(0,e.is)(c,j.V)?c:(0,e.is)(c,r.Xs)?c.decoder:c.sql.decoder,h[k.tsKey]=null===b?null:a.mapFromDriverValue(b)}return h})(this.schema,this.tableConfig,a,b.selection,c));return"first"===this.mode?d[0]:d})}prepare(){return this._prepare(!1)}_toSQL(){let a=this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}),b=this.dialect.sqlToQuery(a.sql);return{query:a,builtQuery:b}}toSQL(){return this._toSQL().builtQuery}executeRaw(){return"first"===this.mode?this._prepare(!1).get():this._prepare(!1).all()}async execute(){return this.executeRaw()}}class ao extends an{static [e.i]="SQLiteSyncRelationalQuery";sync(){return this.executeRaw()}}class ap extends W{constructor(a,b,c,d,e){super(),this.execute=a,this.getSQL=b,this.dialect=d,this.mapBatchResult=e,this.config={action:c}}static [e.i]="SQLiteRaw";config;getQuery(){return{...this.dialect.sqlToQuery(this.getSQL()),method:this.config.action}}mapResult(a,b){return b?this.mapBatchResult(a):a}_prepare(){return this}isResponseInArrayMode(){return!1}}class aq{constructor(a,b,c,d){this.resultKind=a,this.dialect=b,this.session=c,this._=d?{schema:d.schema,fullSchema:d.fullSchema,tableNamesMap:d.tableNamesMap}:{schema:void 0,fullSchema:{},tableNamesMap:{}},this.query={};const e=this.query;if(this._.schema)for(const[f,g]of Object.entries(this._.schema))e[f]=new am(a,d.fullSchema,this._.schema,this._.tableNamesMap,d.fullSchema[f],g,b,c);this.$cache={invalidate:async a=>{}}}static [e.i]="BaseSQLiteDatabase";query;$with=(a,b)=>{let c=this;return{as:d=>("function"==typeof d&&(d=d(new af(c.dialect))),new Proxy(new F.J(d.getSQL(),b??("getSelectedFields"in d?d.getSelectedFields()??{}:{}),a,!0),new G({alias:a,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}};$count(a,b){return new al({source:a,filters:b,session:this.session})}with(...a){let b=this;return{select:function(c){return new Y({fields:c??void 0,session:b.session,dialect:b.dialect,withList:a})},selectDistinct:function(c){return new Y({fields:c??void 0,session:b.session,dialect:b.dialect,withList:a,distinct:!0})},update:function(c){return new ag(c,b.session,b.dialect,a)},insert:function(c){return new ai(c,b.session,b.dialect,a)},delete:function(c){return new ak(c,b.session,b.dialect,a)}}}select(a){return new Y({fields:a??void 0,session:this.session,dialect:this.dialect})}selectDistinct(a){return new Y({fields:a??void 0,session:this.session,dialect:this.dialect,distinct:!0})}update(a){return new ag(a,this.session,this.dialect)}$cache;insert(a){return new ai(a,this.session,this.dialect)}delete(a){return new ak(a,this.session,this.dialect)}run(a){let b="string"==typeof a?r.ll.raw(a):a.getSQL();return"async"===this.resultKind?new ap(async()=>this.session.run(b),()=>b,"run",this.dialect,this.session.extractRawRunValueFromBatchResult.bind(this.session)):this.session.run(b)}all(a){let b="string"==typeof a?r.ll.raw(a):a.getSQL();return"async"===this.resultKind?new ap(async()=>this.session.all(b),()=>b,"all",this.dialect,this.session.extractRawAllValueFromBatchResult.bind(this.session)):this.session.all(b)}get(a){let b="string"==typeof a?r.ll.raw(a):a.getSQL();return"async"===this.resultKind?new ap(async()=>this.session.get(b),()=>b,"get",this.dialect,this.session.extractRawGetValueFromBatchResult.bind(this.session)):this.session.get(b)}values(a){let b="string"==typeof a?r.ll.raw(a):a.getSQL();return"async"===this.resultKind?new ap(async()=>this.session.values(b),()=>b,"values",this.dialect,this.session.extractRawValuesValueFromBatchResult.bind(this.session)):this.session.values(b)}transaction(a,b){return this.session.transaction(a,b)}}class ar{static [e.i]="Cache"}class as extends ar{strategy(){return"all"}static [e.i]="NoopCache";async get(a){}async put(a,b,c,d){}async onMutate(a){}}async function at(a,b){let c=`${a}-${JSON.stringify(b)}`,d=new TextEncoder().encode(c);return[...new Uint8Array(await crypto.subtle.digest("SHA-256",d))].map(a=>a.toString(16).padStart(2,"0")).join("")}class au extends W{constructor(a){super(),this.resultCb=a}static [e.i]="ExecuteResultSync";async execute(){return this.resultCb()}sync(){return this.resultCb()}}class av{constructor(a,b,c,d,e,f){this.mode=a,this.executeMethod=b,this.query=c,this.cache=d,this.queryMetadata=e,this.cacheConfig=f,d&&"all"===d.strategy()&&void 0===f&&(this.cacheConfig={enable:!0,autoInvalidate:!0}),this.cacheConfig?.enable||(this.cacheConfig=void 0)}static [e.i]="PreparedQuery";joinsNotNullableMap;async queryWithCache(a,b,c){if(void 0===this.cache||(0,e.is)(this.cache,as)||void 0===this.queryMetadata||this.cacheConfig&&!this.cacheConfig.enable)try{return await c()}catch(c){throw new M(a,b,c)}if(("insert"===this.queryMetadata.type||"update"===this.queryMetadata.type||"delete"===this.queryMetadata.type)&&this.queryMetadata.tables.length>0)try{let[a]=await Promise.all([c(),this.cache.onMutate({tables:this.queryMetadata.tables})]);return a}catch(c){throw new M(a,b,c)}if(!this.cacheConfig)try{return await c()}catch(c){throw new M(a,b,c)}if("select"===this.queryMetadata.type){let d=await this.cache.get(this.cacheConfig.tag??await at(a,b),this.queryMetadata.tables,void 0!==this.cacheConfig.tag,this.cacheConfig.autoInvalidate);if(void 0===d){let d;try{d=await c()}catch(c){throw new M(a,b,c)}return await this.cache.put(this.cacheConfig.tag??await at(a,b),d,this.cacheConfig.autoInvalidate?this.queryMetadata.tables:[],void 0!==this.cacheConfig.tag,this.cacheConfig.config),d}return d}try{return await c()}catch(c){throw new M(a,b,c)}}getQuery(){return this.query}mapRunResult(a,b){return a}mapAllResult(a,b){throw Error("Not implemented")}mapGetResult(a,b){throw Error("Not implemented")}execute(a){return"async"===this.mode?this[this.executeMethod](a):new au(()=>this[this.executeMethod](a))}mapResult(a,b){switch(this.executeMethod){case"run":return this.mapRunResult(a,b);case"all":return this.mapAllResult(a,b);case"get":return this.mapGetResult(a,b)}}}class aw{constructor(a){this.dialect=a}static [e.i]="SQLiteSession";prepareOneTimeQuery(a,b,c,d,e,f,g){return this.prepareQuery(a,b,c,d,e,f,g)}run(a){let b=this.dialect.sqlToQuery(a);try{return this.prepareOneTimeQuery(b,void 0,"run",!1).run()}catch(a){throw new L({cause:a,message:`Failed to run the query '${b.sql}'`})}}extractRawRunValueFromBatchResult(a){return a}all(a){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(a),void 0,"run",!1).all()}extractRawAllValueFromBatchResult(a){throw Error("Not implemented")}get(a){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(a),void 0,"run",!1).get()}extractRawGetValueFromBatchResult(a){throw Error("Not implemented")}values(a){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(a),void 0,"run",!1).values()}async count(a){return(await this.values(a))[0][0]}extractRawValuesValueFromBatchResult(a){throw Error("Not implemented")}}class ax extends aq{constructor(a,b,c,d,e=0){super(a,b,c,d),this.schema=d,this.nestedIndex=e}static [e.i]="SQLiteTransaction";rollback(){throw new N}}class ay extends aw{constructor(a,b,c,d={}){super(b),this.client=a,this.schema=c,this.logger=d.logger??new h,this.cache=d.cache??new as}static [e.i]="BetterSQLiteSession";logger;cache;prepareQuery(a,b,c,d,e,f,g){return new aA(this.client.prepare(a.sql),a,this.logger,this.cache,f,g,b,c,d,e)}transaction(a,b={}){let c=new az("sync",this.dialect,this,this.schema);return this.client.transaction(a)[b.behavior??"deferred"](c)}}class az extends ax{static [e.i]="BetterSQLiteTransaction";transaction(a){let b=`sp${this.nestedIndex}`,c=new az("sync",this.dialect,this.session,this.schema,this.nestedIndex+1);this.session.run(r.ll.raw(`savepoint ${b}`));try{let d=a(c);return this.session.run(r.ll.raw(`release savepoint ${b}`)),d}catch(a){throw this.session.run(r.ll.raw(`rollback to savepoint ${b}`)),a}}}class aA extends av{constructor(a,b,c,d,e,f,g,h,i,j){super("sync",h,b,d,e,f),this.stmt=a,this.logger=c,this.fields=g,this._isResponseInArrayMode=i,this.customResultMapper=j}static [e.i]="BetterSQLitePreparedQuery";run(a){let b=(0,r.Ct)(this.query.params,a??{});return this.logger.logQuery(this.query.sql,b),this.stmt.run(...b)}all(a){let{fields:b,joinsNotNullableMap:c,query:d,logger:e,stmt:f,customResultMapper:g}=this;if(!b&&!g){let b=(0,r.Ct)(d.params,a??{});return e.logQuery(d.sql,b),f.all(...b)}let h=this.values(a);return g?g(h):h.map(a=>(0,Q.a6)(b,a,c))}get(a){let b=(0,r.Ct)(this.query.params,a??{});this.logger.logQuery(this.query.sql,b);let{fields:c,stmt:d,joinsNotNullableMap:e,customResultMapper:f}=this;if(!c&&!f)return d.get(...b);let g=d.raw().get(...b);if(g)return f?f([g]):(0,Q.a6)(c,g,e)}values(a){let b=(0,r.Ct)(this.query.params,a??{});return this.logger.logQuery(this.query.sql,b),this.stmt.raw().all(...b)}isResponseInArrayMode(){return this._isResponseInArrayMode}}class aB extends aq{static [e.i]="BetterSQLite3Database"}function aC(a,b={}){let c,d,f=new T({casing:b.casing});if(!0===b.logger?c=new g:!1!==b.logger&&(c=b.logger),b.schema){let a=function(a,b){1===Object.keys(a).length&&"default"in a&&!(0,e.is)(a.default,i.XI)&&(a=a.default);let c={},d={},f={};for(let[g,h]of Object.entries(a))if((0,e.is)(h,i.XI)){let a=(0,i.Lf)(h),b=d[a];for(let d of(c[a]=g,f[g]={tsName:g,dbName:h[i.XI.Symbol.Name],schema:h[i.XI.Symbol.Schema],columns:h[i.XI.Symbol.Columns],relations:b?.relations??{},primaryKey:b?.primaryKey??[]},Object.values(h[i.XI.Symbol.Columns])))d.primary&&f[g].primaryKey.push(d);let j=h[i.XI.Symbol.ExtraConfigBuilder]?.(h[i.XI.Symbol.ExtraConfigColumns]);if(j)for(let a of Object.values(j))(0,e.is)(a,n)&&f[g].primaryKey.push(...a.columns)}else if((0,e.is)(h,t)){let a,e=(0,i.Lf)(h.table),g=c[e];for(let[c,i]of Object.entries(h.config(b(h.table))))if(g){let b=f[g];b.relations[c]=i,a&&b.primaryKey.push(...a)}else e in d||(d[e]={relations:{},primaryKey:a}),d[e].relations[c]=i}return{tables:f,tableNamesMap:c}}(b.schema,w);d={fullSchema:b.schema,schema:a.tables,tableNamesMap:a.tableNamesMap}}let h=new ay(a,f,d,{logger:c}),j=new aB("sync",f,h,d);return j.$client=a,j}function aD(...a){if(void 0===a[0]||"string"==typeof a[0])return aC(void 0===a[0]?new d:new d(a[0]),a[1]);if((0,Q.Lq)(a[0])){let{connection:b,client:c,...e}=a[0];if(c)return aC(c,e);if("object"==typeof b){let{source:a,...c}=b;return aC(new d(a,c),e)}return aC(new d(b),e)}return aC(a[0],a[1])}(aD||(aD={})).mock=function(a){return aC({},a)}},44023:(a,b,c)=>{c.d(b,{x:()=>h});var d=c(68369),e=c(99764);class f extends e.o{static [d.i]="SQLiteRealBuilder";constructor(a){super(a,"number","SQLiteReal")}build(a){return new g(a,this.config)}}class g extends e.v{static [d.i]="SQLiteReal";getSQLType(){return"real"}}function h(a){return new f(a??"")}},46080:(a,b,c)=>{c.d(b,{V:()=>e});var d=c(68369);class e{constructor(a,b){this.table=a,this.config=b,this.name=b.name,this.keyAsName=b.keyAsName,this.notNull=b.notNull,this.default=b.default,this.defaultFn=b.defaultFn,this.onUpdateFn=b.onUpdateFn,this.hasDefault=b.hasDefault,this.primary=b.primaryKey,this.isUnique=b.isUnique,this.uniqueName=b.uniqueName,this.uniqueType=b.uniqueType,this.dataType=b.dataType,this.columnType=b.columnType,this.generated=b.generated,this.generatedIdentity=b.generatedIdentity}static [d.i]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(a){return a}mapToDriverValue(a){return a}shouldDisableInsert(){return void 0!==this.config.generated&&"byDefault"!==this.config.generated.type}}},52866:(a,b,c)=>{c.d(b,{ie:()=>f});var d=c(68369),e=c(2562);function f(...a){return a[0].columns?new g(a[0].columns,a[0].name):new g(a)}class g{static [d.i]="SQLitePrimaryKeyBuilder";columns;name;constructor(a,b){this.columns=a,this.name=b}build(a){return new h(a,this.columns,this.name)}}class h{constructor(a,b,c){this.table=a,this.columns=b,this.name=c}static [d.i]="SQLitePrimaryKey";columns;name;getName(){return this.name??`${this.table[e.jo.Symbol.Name]}_${this.columns.map(a=>a.name).join("_")}_pk`}}},54748:(a,b,c)=>{c.d(b,{J:()=>f,n:()=>e});var d=c(68369);class e{static [d.i]="Subquery";constructor(a,b,c,d=!1,e=[]){this._={brand:"Subquery",sql:a,selectedFields:b,alias:c,isWith:d,usedTables:e}}}class f extends e{static [d.i]="WithSubquery"}},60109:(a,b,c)=>{c.d(b,{n:()=>d});let d=Symbol.for("drizzle:ViewBaseConfig")},60917:(a,b,c)=>{c.d(b,{DV:()=>k,He:()=>function a(b,c){return Object.entries(b).reduce((b,[i,j])=>{if("string"!=typeof i)return b;let k=c?[...c,i]:[i];return(0,e.is)(j,d.V)||(0,e.is)(j,f.Xs)||(0,e.is)(j,f.Xs.Aliased)||(0,e.is)(j,g.n)?b.push({path:k,field:j}):(0,e.is)(j,h.XI)?b.push(...a(j[h.XI.Symbol.Columns],k)):b.push(...a(j,k)),b},[])},Ll:()=>p,Lq:()=>q,XJ:()=>m,YD:()=>n,a6:()=>j,q:()=>l,su:()=>r,zN:()=>o});var d=c(46080),e=c(68369),f=c(64429),g=c(54748),h=c(94024),i=c(60109);function j(a,b,c){let i={},j=a.reduce((a,{path:j,field:k},l)=>{let m;m=(0,e.is)(k,d.V)?k:(0,e.is)(k,f.Xs)?k.decoder:(0,e.is)(k,g.n)?k._.sql.decoder:k.sql.decoder;let n=a;for(let[a,f]of j.entries())if(a<j.length-1)f in n||(n[f]={}),n=n[f];else{let a=b[l],g=n[f]=null===a?null:m.mapFromDriverValue(a);if(c&&(0,e.is)(k,d.V)&&2===j.length){let a=j[0];a in i?"string"==typeof i[a]&&i[a]!==(0,h.Io)(k.table)&&(i[a]=!1):i[a]=null===g&&(0,h.Io)(k.table)}}return a},{});if(c&&Object.keys(i).length>0)for(let[a,b]of Object.entries(i))"string"!=typeof b||c[b]||(j[a]=null);return j}function k(a,b){let c=Object.keys(a),d=Object.keys(b);if(c.length!==d.length)return!1;for(let[a,b]of c.entries())if(b!==d[a])return!1;return!0}function l(a,b){let c=Object.entries(b).filter(([,a])=>void 0!==a).map(([b,c])=>(0,e.is)(c,f.Xs)||(0,e.is)(c,d.V)?[b,c]:[b,new f.Iw(c,a[h.XI.Symbol.Columns][b])]);if(0===c.length)throw Error("No values to set");return Object.fromEntries(c)}function m(a,b){for(let c of b)for(let b of Object.getOwnPropertyNames(c.prototype))"constructor"!==b&&Object.defineProperty(a.prototype,b,Object.getOwnPropertyDescriptor(c.prototype,b)||Object.create(null))}function n(a){return a[h.XI.Symbol.Columns]}function o(a){return(0,e.is)(a,g.n)?a._.alias:(0,e.is)(a,f.Ss)?a[i.n].name:(0,e.is)(a,f.Xs)?void 0:a[h.XI.Symbol.IsAlias]?a[h.XI.Symbol.Name]:a[h.XI.Symbol.BaseName]}function p(a,b){return{name:"string"==typeof a&&a.length>0?a:"",config:"object"==typeof a?a:b}}function q(a){if("object"!=typeof a||null===a||"Object"!==a.constructor.name)return!1;if("logger"in a){let b=typeof a.logger;return"boolean"===b||"object"===b&&"function"==typeof a.logger.logQuery||"undefined"===b}if("schema"in a){let b=typeof a.schema;return"object"===b||"undefined"===b}if("casing"in a){let b=typeof a.casing;return"string"===b||"undefined"===b}if("mode"in a)return"default"===a.mode&&"planetscale"===a.mode&&void 0===a.mode;if("connection"in a){let b=typeof a.connection;return"string"===b||"object"===b||"undefined"===b}if("client"in a){let b=typeof a.client;return"object"===b||"function"===b||"undefined"===b}return 0===Object.keys(a).length}let r="u"<typeof TextDecoder?null:new TextDecoder},63933:(a,b,c)=>{c.d(b,{AU:()=>m,B3:()=>B,KJ:()=>w,KL:()=>s,Pe:()=>u,RK:()=>A,RO:()=>o,RV:()=>r,Tq:()=>x,Uo:()=>k,eq:()=>i,gt:()=>n,kZ:()=>t,lt:()=>p,mj:()=>z,ne:()=>j,o8:()=>y,or:()=>l,q1:()=>C,t2:()=>v,wJ:()=>q});var d=c(46080),e=c(68369),f=c(94024),g=c(64429);function h(a,b){return!(0,g.eG)(b)||(0,g.qt)(a)||(0,e.is)(a,g.Iw)||(0,e.is)(a,g.Or)||(0,e.is)(a,d.V)||(0,e.is)(a,f.XI)||(0,e.is)(a,g.Ss)?a:new g.Iw(a,b)}let i=(a,b)=>(0,g.ll)`${a} = ${h(b,a)}`,j=(a,b)=>(0,g.ll)`${a} <> ${h(b,a)}`;function k(...a){let b=a.filter(a=>void 0!==a);if(0!==b.length)return new g.Xs(1===b.length?b:[new g.DJ("("),g.ll.join(b,new g.DJ(" and ")),new g.DJ(")")])}function l(...a){let b=a.filter(a=>void 0!==a);if(0!==b.length)return new g.Xs(1===b.length?b:[new g.DJ("("),g.ll.join(b,new g.DJ(" or ")),new g.DJ(")")])}function m(a){return(0,g.ll)`not ${a}`}let n=(a,b)=>(0,g.ll)`${a} > ${h(b,a)}`,o=(a,b)=>(0,g.ll)`${a} >= ${h(b,a)}`,p=(a,b)=>(0,g.ll)`${a} < ${h(b,a)}`,q=(a,b)=>(0,g.ll)`${a} <= ${h(b,a)}`;function r(a,b){return Array.isArray(b)?0===b.length?(0,g.ll)`false`:(0,g.ll)`${a} in ${b.map(b=>h(b,a))}`:(0,g.ll)`${a} in ${h(b,a)}`}function s(a,b){return Array.isArray(b)?0===b.length?(0,g.ll)`true`:(0,g.ll)`${a} not in ${b.map(b=>h(b,a))}`:(0,g.ll)`${a} not in ${h(b,a)}`}function t(a){return(0,g.ll)`${a} is null`}function u(a){return(0,g.ll)`${a} is not null`}function v(a){return(0,g.ll)`exists ${a}`}function w(a){return(0,g.ll)`not exists ${a}`}function x(a,b,c){return(0,g.ll)`${a} between ${h(b,a)} and ${h(c,a)}`}function y(a,b,c){return(0,g.ll)`${a} not between ${h(b,a)} and ${h(c,a)}`}function z(a,b){return(0,g.ll)`${a} like ${b}`}function A(a,b){return(0,g.ll)`${a} not like ${b}`}function B(a,b){return(0,g.ll)`${a} ilike ${b}`}function C(a,b){return(0,g.ll)`${a} not ilike ${b}`}},64429:(a,b,c)=>{let d,e;c.d(b,{Iw:()=>P,Or:()=>T,Xs:()=>K,DJ:()=>J,Ss:()=>W,Ct:()=>U,eG:()=>M,qt:()=>I,ll:()=>Q});var f,g=c(68369),h=c(13490),i=c(46080),j=c(12787);class k{static [g.i]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor(a,b){this.reference=()=>{let{name:b,columns:c,foreignColumns:d}=a();return{name:b,columns:c,foreignTable:d[0].table,foreignColumns:d}},b&&(this._onUpdate=b.onUpdate,this._onDelete=b.onDelete)}onUpdate(a){return this._onUpdate=void 0===a?"no action":a,this}onDelete(a){return this._onDelete=void 0===a?"no action":a,this}build(a){return new l(a,this)}}class l{constructor(a,b){this.table=a,this.reference=b.reference,this.onUpdate=b._onUpdate,this.onDelete=b._onDelete}static [g.i]="PgForeignKey";reference;onUpdate;onDelete;getName(){let{name:a,columns:b,foreignColumns:c}=this.reference(),d=b.map(a=>a.name),e=c.map(a=>a.name),f=[this.table[j.E],...d,c[0].table[j.E],...e];return a??`${f.join("_")}_fk`}}function m(a,...b){return a(...b)}function n(a,b){return`${a[j.E]}_${b.join("_")}_unique`}class o{constructor(a,b){this.name=b,this.columns=a}static [g.i]=null;columns;nullsNotDistinctConfig=!1;nullsNotDistinct(){return this.nullsNotDistinctConfig=!0,this}build(a){return new q(a,this.columns,this.nullsNotDistinctConfig,this.name)}}class p{static [g.i]=null;name;constructor(a){this.name=a}on(...a){return new o(a,this.name)}}class q{constructor(a,b,c,d){this.table=a,this.columns=b,this.name=d??n(this.table,this.columns.map(a=>a.name)),this.nullsNotDistinct=c}static [g.i]=null;columns;name;nullsNotDistinct=!1;getName(){return this.name}}function r(a,b,c){for(let d=b;d<a.length;d++){let e=a[d];if("\\"===e){d++;continue}if('"'===e)return[a.slice(b,d).replace(/\\/g,""),d+1];if(!c&&(","===e||"}"===e))return[a.slice(b,d).replace(/\\/g,""),d]}return[a.slice(b).replace(/\\/g,""),a.length]}class s extends h.Q{foreignKeyConfigs=[];static [g.i]="PgColumnBuilder";array(a){return new w(this.config.name,this,a)}references(a,b={}){return this.foreignKeyConfigs.push({ref:a,actions:b}),this}unique(a,b){return this.config.isUnique=!0,this.config.uniqueName=a,this.config.uniqueType=b?.nulls,this}generatedAlwaysAs(a){return this.config.generated={as:a,type:"always",mode:"stored"},this}buildForeignKeys(a,b){return this.foreignKeyConfigs.map(({ref:c,actions:d})=>m((c,d)=>{let e=new k(()=>({columns:[a],foreignColumns:[c()]}));return d.onUpdate&&e.onUpdate(d.onUpdate),d.onDelete&&e.onDelete(d.onDelete),e.build(b)},c,d))}buildExtraConfigColumn(a){return new u(a,this.config)}}class t extends i.V{constructor(a,b){b.uniqueName||(b.uniqueName=n(a,[b.name])),super(a,b),this.table=a}static [g.i]="PgColumn"}class u extends t{static [g.i]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(a){return this.indexConfig.opClass=a,this}}class v{static [g.i]=null;constructor(a,b,c,d){this.name=a,this.keyAsName=b,this.type=c,this.indexConfig=d}name;keyAsName;type;indexConfig}class w extends s{static [g.i]="PgArrayBuilder";constructor(a,b,c){super(a,"array","PgArray"),this.config.baseBuilder=b,this.config.size=c}build(a){let b=this.config.baseBuilder.build(a);return new x(a,this.config,b)}}class x extends t{constructor(a,b,c,d){super(a,b),this.baseColumn=c,this.range=d,this.size=b.size}size;static [g.i]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${"number"==typeof this.size?this.size:""}]`}mapFromDriverValue(a){return"string"==typeof a&&(a=function(a){let[b]=function a(b,c=0){let d=[],e=c,f=!1;for(;e<b.length;){let g=b[e];if(","===g){(f||e===c)&&d.push(""),f=!0,e++;continue}if(f=!1,"\\"===g){e+=2;continue}if('"'===g){let[a,c]=r(b,e+1,!0);d.push(a),e=c;continue}if("}"===g)return[d,e+1];if("{"===g){let[c,f]=a(b,e+1);d.push(c),e=f;continue}let[h,i]=r(b,e,!1);d.push(h),e=i}return[d,e]}(a,1);return b}(a)),a.map(a=>this.baseColumn.mapFromDriverValue(a))}mapToDriverValue(a,b=!1){let c=a.map(a=>null===a?null:(0,g.is)(this.baseColumn,x)?this.baseColumn.mapToDriverValue(a,!0):this.baseColumn.mapToDriverValue(a));return b?c:function a(b){return`{${b.map(b=>Array.isArray(b)?a(b):"string"==typeof b?`"${b.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:`${b}`).join(",")}}`}(c)}}class y extends s{static [g.i]="PgEnumObjectColumnBuilder";constructor(a,b){super(a,"string","PgEnumObjectColumn"),this.config.enum=b}build(a){return new z(a,this.config)}}class z extends t{static [g.i]="PgEnumObjectColumn";enum;enumValues=this.config.enum.enumValues;constructor(a,b){super(a,b),this.enum=b.enum}getSQLType(){return this.enum.enumName}}let A=Symbol.for("drizzle:isPgEnum");class B extends s{static [g.i]="PgEnumColumnBuilder";constructor(a,b){super(a,"string","PgEnumColumn"),this.config.enum=b}build(a){return new C(a,this.config)}}class C extends t{static [g.i]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor(a,b){super(a,b),this.enum=b.enum}getSQLType(){return this.enum.enumName}}var D=c(54748);let E=(a,b)=>d?(e||(e=d.trace.getTracer("drizzle-orm","0.45.2")),m((c,d)=>d.startActiveSpan(a,a=>{try{return b(a)}catch(b){throw a.setStatus({code:c.SpanStatusCode.ERROR,message:b instanceof Error?b.message:"Unknown error"}),b}finally{a.end()}}),d,e)):b();var F=c(60109),G=c(94024);class H{static [g.i]=null}function I(a){return null!=a&&"function"==typeof a.getSQL}class J{static [g.i]="StringChunk";value;constructor(a){this.value=Array.isArray(a)?a:[a]}getSQL(){return new K([this])}}class K{constructor(a){for(const b of(this.queryChunks=a,a))if((0,g.is)(b,G.XI)){const a=b[G.XI.Symbol.Schema];this.usedTables.push(void 0===a?b[G.XI.Symbol.Name]:a+"."+b[G.XI.Symbol.Name])}}static [g.i]="SQL";decoder=N;shouldInlineParams=!1;usedTables=[];append(a){return this.queryChunks.push(...a.queryChunks),this}toQuery(a){return E("drizzle.buildSQL",b=>{let c=this.buildQueryFromSourceParams(this.queryChunks,a);return b?.setAttributes({"drizzle.query.text":c.sql,"drizzle.query.params":JSON.stringify(c.params)}),c})}buildQueryFromSourceParams(a,b){let c=Object.assign({},b,{inlineParams:b.inlineParams||this.shouldInlineParams,paramStartIndex:b.paramStartIndex||{value:0}}),{casing:d,escapeName:e,escapeParam:f,prepareTyping:h,inlineParams:j,paramStartIndex:k}=c;var l=a.map(a=>{if((0,g.is)(a,J))return{sql:a.value.join(""),params:[]};if((0,g.is)(a,L))return{sql:e(a.value),params:[]};if(void 0===a)return{sql:"",params:[]};if(Array.isArray(a)){let b=[new J("(")];for(let[c,d]of a.entries())b.push(d),c<a.length-1&&b.push(new J(", "));return b.push(new J(")")),this.buildQueryFromSourceParams(b,c)}if((0,g.is)(a,K))return this.buildQueryFromSourceParams(a.queryChunks,{...c,inlineParams:j||a.shouldInlineParams});if((0,g.is)(a,G.XI)){let b=a[G.XI.Symbol.Schema],c=a[G.XI.Symbol.Name];return{sql:void 0===b||a[G.HE]?e(c):e(b)+"."+e(c),params:[]}}if((0,g.is)(a,i.V)){let c=d.getColumnCasing(a);if("indexes"===b.invokeSource)return{sql:e(c),params:[]};let f=a.table[G.XI.Symbol.Schema];return{sql:a.table[G.HE]||void 0===f?e(a.table[G.XI.Symbol.Name])+"."+e(c):e(f)+"."+e(a.table[G.XI.Symbol.Name])+"."+e(c),params:[]}}if((0,g.is)(a,W)){let b=a[F.n].schema,c=a[F.n].name;return{sql:void 0===b||a[F.n].isAlias?e(c):e(b)+"."+e(c),params:[]}}if((0,g.is)(a,P)){if((0,g.is)(a.value,T))return{sql:f(k.value++,a),params:[a],typings:["none"]};let b=null===a.value?null:a.encoder.mapToDriverValue(a.value);if((0,g.is)(b,K))return this.buildQueryFromSourceParams([b],c);if(j)return{sql:this.mapInlineParam(b,c),params:[]};let d=["none"];return h&&(d=[h(a.encoder)]),{sql:f(k.value++,b),params:[b],typings:d}}return(0,g.is)(a,T)?{sql:f(k.value++,a),params:[a],typings:["none"]}:(0,g.is)(a,K.Aliased)&&void 0!==a.fieldAlias?{sql:e(a.fieldAlias),params:[]}:(0,g.is)(a,D.n)?a._.isWith?{sql:e(a._.alias),params:[]}:this.buildQueryFromSourceParams([new J("("),a._.sql,new J(") "),new L(a._.alias)],c):a&&"function"==typeof a&&A in a&&!0===a[A]?a.schema?{sql:e(a.schema)+"."+e(a.enumName),params:[]}:{sql:e(a.enumName),params:[]}:I(a)?a.shouldOmitSQLParens?.()?this.buildQueryFromSourceParams([a.getSQL()],c):this.buildQueryFromSourceParams([new J("("),a.getSQL(),new J(")")],c):j?{sql:this.mapInlineParam(a,c),params:[]}:{sql:f(k.value++,a),params:[a],typings:["none"]}});let m={sql:"",params:[]};for(let a of l)m.sql+=a.sql,m.params.push(...a.params),a.typings?.length&&(m.typings||(m.typings=[]),m.typings.push(...a.typings));return m}mapInlineParam(a,{escapeString:b}){if(null===a)return"null";if("number"==typeof a||"boolean"==typeof a)return a.toString();if("string"==typeof a)return b(a);if("object"==typeof a){let c=a.toString();return"[object Object]"===c?b(JSON.stringify(a)):b(c)}throw Error("Unexpected param value: "+a)}getSQL(){return this}as(a){return void 0===a?this:new K.Aliased(this,a)}mapWith(a){return this.decoder="function"==typeof a?{mapFromDriverValue:a}:a,this}inlineParams(){return this.shouldInlineParams=!0,this}if(a){return a?this:void 0}}class L{constructor(a){this.value=a}static [g.i]="Name";brand;getSQL(){return new K([this])}}function M(a){return"object"==typeof a&&null!==a&&"mapToDriverValue"in a&&"function"==typeof a.mapToDriverValue}let N={mapFromDriverValue:a=>a},O={mapToDriverValue:a=>a};({...N,...O});class P{constructor(a,b=O){this.value=a,this.encoder=b}static [g.i]="Param";brand;getSQL(){return new K([this])}}function Q(a,...b){let c=[];for(let[d,e]of((b.length>0||a.length>0&&""!==a[0])&&c.push(new J(a[0])),b.entries()))c.push(e,new J(a[d+1]));return new K(c)}(f=Q||(Q={})).empty=function(){return new K([])},f.fromList=function(a){return new K(a)},f.raw=function(a){return new K([new J(a)])},f.join=function(a,b){let c=[];for(let[d,e]of a.entries())d>0&&void 0!==b&&c.push(b),c.push(e);return new K(c)},f.identifier=function(a){return new L(a)},f.placeholder=function(a){return new T(a)},f.param=function(a,b){return new P(a,b)};var R=K||(K={});class S{constructor(a,b){this.sql=a,this.fieldAlias=b}static [g.i]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new S(this.sql,this.fieldAlias)}}R.Aliased=S;class T{constructor(a){this.name=a}static [g.i]="Placeholder";getSQL(){return new K([this])}}function U(a,b){return a.map(a=>{if((0,g.is)(a,T)){if(!(a.name in b))throw Error(`No value for placeholder "${a.name}" was provided`);return b[a.name]}if((0,g.is)(a,P)&&(0,g.is)(a.value,T)){if(!(a.value.name in b))throw Error(`No value for placeholder "${a.value.name}" was provided`);return a.encoder.mapToDriverValue(b[a.value.name])}return a})}let V=Symbol.for("drizzle:IsDrizzleView");class W{static [g.i]="View";[F.n];[V]=!0;constructor({name:a,schema:b,selectedFields:c,query:d}){this[F.n]={name:a,originalName:a,schema:b,selectedFields:c,query:d,isExisting:!d,isAlias:!1}}getSQL(){return new K([this])}}i.V.prototype.getSQL=function(){return new K([this])},G.XI.prototype.getSQL=function(){return new K([this])},D.n.prototype.getSQL=function(){return new K([this])}},68369:(a,b,c)=>{c.d(b,{i:()=>d,is:()=>e});let d=Symbol.for("drizzle:entityKind");function e(a,b){if(!a||"object"!=typeof a)return!1;if(a instanceof b)return!0;if(!Object.prototype.hasOwnProperty.call(b,d))throw Error(`Class "${b.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let c=Object.getPrototypeOf(a).constructor;if(c)for(;c;){if(d in c&&c[d]===b[d])return!0;c=Object.getPrototypeOf(c)}return!1}Symbol.for("drizzle:hasOwnEntityKind")},88679:(a,b,c)=>{c.d(b,{Pe:()=>h});var d=c(68369);class e{constructor(a,b){this.name=a,this.unique=b}static [d.i]="SQLiteIndexBuilderOn";on(...a){return new f(this.name,a,this.unique)}}class f{static [d.i]="SQLiteIndexBuilder";config;constructor(a,b,c){this.config={name:a,columns:b,unique:c,where:void 0}}where(a){return this.config.where=a,this}build(a){return new g(this.config,a)}}class g{static [d.i]="SQLiteIndex";config;constructor(a,b){this.config={...a,table:b}}}function h(a){return new e(a,!1)}},94024:(a,b,c)=>{c.d(b,{HE:()=>k,Io:()=>o,Lf:()=>p,XI:()=>n,e:()=>g});var d=c(68369),e=c(12787);let f=Symbol.for("drizzle:Schema"),g=Symbol.for("drizzle:Columns"),h=Symbol.for("drizzle:ExtraConfigColumns"),i=Symbol.for("drizzle:OriginalName"),j=Symbol.for("drizzle:BaseName"),k=Symbol.for("drizzle:IsAlias"),l=Symbol.for("drizzle:ExtraConfigBuilder"),m=Symbol.for("drizzle:IsDrizzleTable");class n{static [d.i]="Table";static Symbol={Name:e.E,Schema:f,OriginalName:i,Columns:g,ExtraConfigColumns:h,BaseName:j,IsAlias:k,ExtraConfigBuilder:l};[e.E];[i];[f];[g];[h];[j];[k]=!1;[m]=!0;[l]=void 0;constructor(a,b,c){this[e.E]=this[i]=a,this[f]=b,this[j]=c}}function o(a){return a[e.E]}function p(a){return`${a[f]??"public"}.${a[e.E]}`}},96421:(a,b,c)=>{c.d(b,{nd:()=>p});var d=c(68369),e=c(64429),f=c(60917),g=c(99764);class h extends g.o{static [d.i]="SQLiteBaseIntegerBuilder";constructor(a,b,c){super(a,b,c),this.config.autoIncrement=!1}primaryKey(a){return a?.autoIncrement&&(this.config.autoIncrement=!0),this.config.hasDefault=!0,super.primaryKey()}}class i extends g.v{static [d.i]="SQLiteBaseInteger";autoIncrement=this.config.autoIncrement;getSQLType(){return"integer"}}class j extends h{static [d.i]="SQLiteIntegerBuilder";constructor(a){super(a,"number","SQLiteInteger")}build(a){return new k(a,this.config)}}class k extends i{static [d.i]="SQLiteInteger"}class l extends h{static [d.i]="SQLiteTimestampBuilder";constructor(a,b){super(a,"date","SQLiteTimestamp"),this.config.mode=b}defaultNow(){return this.default((0,e.ll)`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build(a){return new m(a,this.config)}}class m extends i{static [d.i]="SQLiteTimestamp";mode=this.config.mode;mapFromDriverValue(a){return new Date("timestamp"===this.config.mode?1e3*a:a)}mapToDriverValue(a){let b=a.getTime();return"timestamp"===this.config.mode?Math.floor(b/1e3):b}}class n extends h{static [d.i]="SQLiteBooleanBuilder";constructor(a,b){super(a,"boolean","SQLiteBoolean"),this.config.mode=b}build(a){return new o(a,this.config)}}class o extends i{static [d.i]="SQLiteBoolean";mode=this.config.mode;mapFromDriverValue(a){return 1===Number(a)}mapToDriverValue(a){return+!!a}}function p(a,b){let{name:c,config:d}=(0,f.Ll)(a,b);return d?.mode==="timestamp"||d?.mode==="timestamp_ms"?new l(c,d.mode):d?.mode==="boolean"?new n(c,d.mode):new j(c)}},99764:(a,b,c)=>{c.d(b,{v:()=>o,o:()=>n});var d=c(13490),e=c(46080),f=c(68369),g=c(12787);class h{static [f.i]="SQLiteForeignKeyBuilder";reference;_onUpdate;_onDelete;constructor(a,b){this.reference=()=>{let{name:b,columns:c,foreignColumns:d}=a();return{name:b,columns:c,foreignTable:d[0].table,foreignColumns:d}},b&&(this._onUpdate=b.onUpdate,this._onDelete=b.onDelete)}onUpdate(a){return this._onUpdate=a,this}onDelete(a){return this._onDelete=a,this}build(a){return new i(a,this)}}class i{constructor(a,b){this.table=a,this.reference=b.reference,this.onUpdate=b._onUpdate,this.onDelete=b._onDelete}static [f.i]="SQLiteForeignKey";reference;onUpdate;onDelete;getName(){let{name:a,columns:b,foreignColumns:c}=this.reference(),d=b.map(a=>a.name),e=c.map(a=>a.name),f=[this.table[g.E],...d,c[0].table[g.E],...e];return a??`${f.join("_")}_fk`}}function j(a,b){return`${a[g.E]}_${b.join("_")}_unique`}class k{constructor(a,b){this.name=b,this.columns=a}static [f.i]=null;columns;build(a){return new m(a,this.columns,this.name)}}class l{static [f.i]=null;name;constructor(a){this.name=a}on(...a){return new k(a,this.name)}}class m{constructor(a,b,c){this.table=a,this.columns=b,this.name=c??j(this.table,this.columns.map(a=>a.name))}static [f.i]=null;columns;name;getName(){return this.name}}class n extends d.Q{static [f.i]="SQLiteColumnBuilder";foreignKeyConfigs=[];references(a,b={}){return this.foreignKeyConfigs.push({ref:a,actions:b}),this}unique(a){return this.config.isUnique=!0,this.config.uniqueName=a,this}generatedAlwaysAs(a,b){return this.config.generated={as:a,type:"always",mode:b?.mode??"virtual"},this}buildForeignKeys(a,b){return this.foreignKeyConfigs.map(({ref:c,actions:d})=>{let e;return e=new h(()=>({columns:[a],foreignColumns:[c()]})),d.onUpdate&&e.onUpdate(d.onUpdate),d.onDelete&&e.onDelete(d.onDelete),e.build(b)})}}class o extends e.V{constructor(a,b){b.uniqueName||(b.uniqueName=j(a,[b.name])),super(a,b),this.table=a}static [f.i]="SQLiteColumn"}}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=2599,exports.ids=[2599],exports.modules={62599:(a,b,c)=>{c.d(b,{memoryAdapter:()=>i});var d=c(37807),e=c(15214);function f(a,b){return"string"==typeof a&&"string"==typeof b?a.toLowerCase()===b.toLowerCase():a===b}function g(a,b){return"string"!=typeof a?b.includes(a):b.some(b=>"string"==typeof b&&a.toLowerCase()===b.toLowerCase())}function h(a){let b=new Map;for(let c of a)b.set(c.id,c);return b}let i=(a,b)=>{let c=null,i=a=>(0,d.I)({config:{adapterId:"memory",adapterName:"Memory Adapter",usePlural:!1,debugLogs:b?.debugLogs||!1,supportsArrays:!0,customTransformInput:b=>b.options.advanced?.database?.generateId==="serial"&&"id"===b.field&&"create"===b.action?a[b.model].length+1:b.data,transaction:async b=>{let d=structuredClone(a),e=structuredClone(a),f=await b(i(e)(c));return!function(a,b,c){for(let f of new Set([...Object.keys(b),...Object.keys(c)])){if(!(f in c)){delete a[f];continue}let g=h(b[f]??[]),i=c[f]??[],j=h(i),k=a[f]??[],l=[],m=new Set;for(let a of k){var d,e;let b=a.id,c=g.get(b),f=j.get(b);(void 0===c||void 0!==f)&&(void 0!==f&&(d=c,e=f,void 0===d||JSON.stringify(d)!==JSON.stringify(e))?l.push(f):l.push(a),m.add(b))}for(let a of i)g.has(a.id)||m.has(a.id)||l.push(a);a[f]=l}}(a,d,e),f}},adapter:({getFieldName:b,getDefaultFieldName:c,options:d,getModelName:h})=>{let i=(a,c,d)=>c?a.sort((a,e)=>{let f=b({model:d,field:c.field}),g=a[f],h=e[f],i=0;return i=null==g&&null==h?0:null==g?-1:null==h?1:"string"==typeof g&&"string"==typeof h?g.localeCompare(h):g instanceof Date&&h instanceof Date?g.getTime()-h.getTime():"number"==typeof g&&"number"==typeof h?g-h:"boolean"==typeof g&&"boolean"==typeof h?g===h?0:g?1:-1:String(g).localeCompare(String(h)),"asc"===c.direction?i:-i}):a;function j(b,d,i,j){let k=(()=>{let h=a[d];if(!h)throw e.vF.error(`[MemoryAdapter] Model ${d} not found in the DB`,Object.keys(a)),Error(`Model ${d} not found`);let i=(a,b)=>{var c,d,e;let{field:h,value:i,operator:j,mode:k="sensitive"}=b,l="insensitive"===k&&("string"==typeof i||Array.isArray(i)&&i.every(a=>"string"==typeof a));switch(j){case"in":if(!Array.isArray(i))throw Error("Value must be an array");if(l)return g(a[h],i);return i.includes(a[h]);case"not_in":if(!Array.isArray(i))throw Error("Value must be an array");if(l)return!g(a[h],i);return!i.includes(a[h]);case"contains":if(l)return c=a[h],"string"==typeof c&&"string"==typeof i&&c.toLowerCase().includes(i.toLowerCase());return a[h]?.includes(i);case"starts_with":if(l)return d=a[h],"string"==typeof d&&"string"==typeof i&&d.toLowerCase().startsWith(i.toLowerCase());return a[h].startsWith(i);case"ends_with":if(l)return e=a[h],"string"==typeof e&&"string"==typeof i&&e.toLowerCase().endsWith(i.toLowerCase());return a[h].endsWith(i);case"ne":return l?!f(a[h],i):a[h]!==i;case"gt":return null!=i&&a[h]>i;case"gte":return null!=i&&a[h]>=i;case"lt":return null!=i&&a[h]<i;case"lte":return null!=i&&a[h]<=i;default:if(l)return f(a[h],i);if(null===i)return null==a[h];return a[h]===i}},k=h.filter(a=>{if(!b.length||0===b.length)return!0;let c=i(a,b[0]);for(let d of b){let b=i(a,d);c="OR"===d.connector?c||b:c&&b}return c});return j?.length&&j.length>0&&(k=k.map(a=>Object.fromEntries(Object.entries(a).filter(([a])=>j.includes(c({model:d,field:a})))))),k})();if(!i)return k;let l=new Map,m=new Map;for(let b of k){let c=String(b.id);if(!l.has(c)){let a={...b};for(let[b,d]of Object.entries(i)){let e=h(b);"one-to-one"===d.relation?a[e]=null:(a[e]=[],m.set(`${c}-${b}`,new Set))}l.set(c,a)}let d=l.get(c);for(let[f,g]of Object.entries(i)){let i=h(f),j=a[i];if(!j)throw e.vF.error(`[MemoryAdapter] JoinOption model ${i} not found in the DB`,Object.keys(a)),Error(`JoinOption model ${i} not found`);let k=j.filter(a=>a[g.on.to]===b[g.on.from]);if("one-to-one"===g.relation)d[i]=k[0]||null;else{let a=m.get(`${c}-${f}`),b=g.limit??100,e=0;for(let c of k){if(e>=b)break;!a.has(c.id)&&(d[i].push(c),a.add(c.id),e++)}}}}return Array.from(l.values())}return{create:async({model:b,data:c})=>(d.advanced?.database?.generateId==="serial"&&(c.id=a[h(b)].length+1),a[b]||(a[b]=[]),a[b].push(c),c),findOne:async({model:a,where:b,select:c,join:d})=>{let e=j(b,a,d,c);return d?e.length?e[0]:null:e[0]||null},findMany:async({model:a,where:b,sortBy:c,limit:d,select:e,offset:f,join:g})=>{let h=j(b||[],a,g,e);if(g){if(!h.length)return[];i(h,c,a);let b=h;return void 0!==f&&(b=b.slice(f)),void 0!==d&&(b=b.slice(0,d)),b}let k=i(h,c,a);return void 0!==f&&(k=k.slice(f)),void 0!==d&&(k=k.slice(0,d)),k||[]},count:async({model:b,where:c})=>c?j(c,b).length:a[b].length,update:async({model:a,where:b,update:c})=>{if(0===b.length)return null;let d=j(b,a);return d.forEach(a=>{Object.assign(a,c)}),d[0]||null},delete:async({model:b,where:c})=>{if(0===c.length)return;let d=a[b],e=j(c,b);a[b]=d.filter(a=>!e.includes(a))},deleteMany:async({model:b,where:c})=>{let d=a[b],e=j(c,b),f=0;return a[b]=d.filter(a=>e.includes(a)?(f++,!1):!e.includes(a)),f},consumeOne:async({model:b,where:c})=>{let d=a[b],e=j(c,b)[0];return e?(a[b]=d.filter(a=>a!==e),e):null},incrementOne:async({model:a,where:b,increment:c,set:d})=>{let e=j(b,a)[0];if(!e)return null;for(let[a,b]of Object.entries(c))e[a]=("number"==typeof e[a]?e[a]:0)+b;return d&&Object.assign(e,d),e},updateMany:async({model:a,where:b,update:c})=>{let d=j(b,a);return d.forEach(a=>{Object.assign(a,c)}),d.length}}}}),j=i(a);return a=>(c=a,j(a))}}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=260,exports.ids=[260],exports.modules={22362:(a,b,c)=>{c.d(b,{n:()=>d,t:()=>e});let d="kysely_migration",e="kysely_migration_lock"},80260:(a,b,c)=>{c.d(b,{D1SqliteDialect:()=>l});var d=c(22362),e=c(55060),f=c(30017),g=class extends e.U{},h=class{#a;#b;constructor(a){this.#a={...a}}async init(){this.#b=new i(this.#a.database),this.#a.onCreateConnection&&await this.#a.onCreateConnection(this.#b)}async acquireConnection(){return this.#b}async beginTransaction(){throw Error("D1 does not support interactive transactions. Use the D1 batch() API instead.")}async commitTransaction(){throw Error("D1 does not support interactive transactions. Use the D1 batch() API instead.")}async rollbackTransaction(){throw Error("D1 does not support interactive transactions. Use the D1 batch() API instead.")}async releaseConnection(){}async destroy(){}},i=class{#c;constructor(a){this.#c=a}async executeQuery(a){let b=await this.#c.prepare(a.sql).bind(...a.parameters).all(),c=null!=b.meta.changes?BigInt(b.meta.changes):void 0;return{insertId:void 0===b.meta.last_row_id||null===b.meta.last_row_id?void 0:BigInt(b.meta.last_row_id),rows:b?.results||[],numAffectedRows:c}}async *streamQuery(){throw Error("D1 does not support streaming queries.")}},j=class{#c;#d;constructor(a,b){this.#c=a,this.#d=b}async getSchemas(){return[]}async getTables(a={withInternalKyselyTables:!1}){let b=this.#c.selectFrom("sqlite_master").where("type","in",["table","view"]).where("name","not like","sqlite_%").where("name","not like","_cf_%").select(["name","type","sql"]).$castTo();a.withInternalKyselyTables||(b=b.where("name","!=",d.n).where("name","!=",d.t));let c=await b.execute();if(0===c.length)return[];let e=c.map(a=>this.#d.prepare("SELECT * FROM pragma_table_info(?)").bind(a.name)),f=await this.#d.batch(e);return c.map((a,b)=>{let c=f[b]?.results??[],d=a.sql?.split(/[(),]/)?.find(a=>a.toLowerCase().includes("autoincrement"))?.split(/\s+/)?.filter(Boolean)?.[0]?.replace(/["`]/g,"");if(!d){let a=c.filter(a=>a.pk>0),b=1===a.length?a[0]:void 0;b&&"integer"===b.type.toLowerCase()&&(d=b.name)}return{name:a.name,isView:"view"===a.type,isForeign:!1,columns:c.map(a=>({name:a.name,dataType:a.type,isNullable:!a.notnull,isAutoIncrementing:a.name===d,hasDefaultValue:null!=a.dflt_value}))}})}},k=class extends f.s{},l=class{#a;constructor(a){this.#a={...a}}createDriver(){return new h(this.#a)}createQueryCompiler(){return new k}createAdapter(){return new g}createIntrospector(a){return new j(a,this.#a.database)}}}};
@@ -0,0 +1,147 @@
1
+ "use strict";exports.id=2867,exports.ids=[2867],exports.modules={863:(a,b,c)=>{c.d(b,{g:()=>f});var d=c(78698),e=c(76862);async function f(a,b,c){(0,d.dx)(a,b,c),await (0,e.LV)(a,b)}},12867:(a,b,c)=>{c.d(b,{uJ:()=>v,V1:()=>z,c5:()=>t,ru:()=>E,ed:()=>N,NV:()=>L,yY:()=>F,Mn:()=>I,QU:()=>x});var d=c(77598),e=c(63933),f=c(5443),g=c(37898),h=c(80280),i=c(25533),j=c(64619),k=c(3188),l=c(14024),m=c(27989);c(78698);var n=c(863),o=c(90860),p=c(48938);let q=`You are Vannevar, the Knowledge agent — Constella's CENTRAL SOURCE OF TRUTH. You own the Knowledge Base (KB): a curated, classified, state-aware layer over the semantic RAG index.
2
+
3
+ ## What the KB is for
4
+ Agents must not leave reusable knowledge scattered in chat. When anything important is created, changed, discovered, reviewed or completed, it is captured into a typed kb_entry, deduped, lifecycle-tracked (active → superseded → obsolete → archived), embedded, and made retrievable. You keep it organised, current and trustworthy.
5
+
6
+ ## Where each kind of knowledge lives (taxonomy → kb_entry.type)
7
+ - decision — technical/architectural decisions and their rationale.
8
+ - spec / issue / goal / plan — the work artifacts and their intent.
9
+ - architecture — system structure, boundaries, data flow.
10
+ - business-rule — product/domain rules that constrain implementation.
11
+ - code-change — what a task produced (files touched + summary).
12
+ - dependency / integration — libraries, services, external systems and how they connect.
13
+ - bug / fix — defects found and the corrections applied.
14
+ - test — test runs and their verdicts.
15
+ - review — code-review outcomes; vuln — security findings and risks.
16
+ - doc — documentation written or updated.
17
+ - user-context — what the operator/user wants, their constraints and preferences.
18
+ - history — milestones and important project history (deliveries, pivots).
19
+ - command — useful executed commands / runbook steps.
20
+ - file-structure — where things live in the workspace.
21
+ - ui-pattern — UI/UX conventions to keep consistent.
22
+ - stack — the official technology stack.
23
+ - env-config — environment and configuration facts.
24
+ Classify every entry by organisation, workspace, goal, spec, issue, task, agent, module and file where known.
25
+
26
+ ## Ingestion (when knowledge comes in)
27
+ 1. Receive the new information. 2. Identify its type. 3. Classify it by goal/spec/issue/module/file/agent. 4. Check for duplicates (same content or same source). 5. Decide: new, an update, a replacement, or obsolete. 6. Write a tight technical summary. 7. Keep a reference to the original source. 8. Generate/refresh embeddings. 9. Update the RAG index. 10. Make it available to every agent.
28
+
29
+ ## Curation (keep it true)
30
+ - Merge near-duplicates into one canonical entry; mark the rest superseded.
31
+ - When new knowledge contradicts old, the newest active truth wins; mark the old obsolete.
32
+ - Never present knowledge from a cancelled/archived/done goal as current without saying so.
33
+ - Surface coverage GAPS: modules with code but no knowledge, claims with no source.
34
+
35
+ ## Answering a query (when an agent or the operator asks)
36
+ 1. Understand the intent. 2. Search the KB/RAG and the structured sources. 3. Filter out obsolete, cancelled and archived knowledge. 4. Prefer the most recent, active, confident facts. 5. Answer objectively and briefly. 6. ALWAYS include internal references (goal, spec, issue, file, decision, plan). 7. If there isn't enough to answer, say so plainly — do not guess.
37
+
38
+ You are authoritative but honest: cite where each fact comes from, and flag when knowledge is missing rather than inventing it.`,r=new Set(["decision","architecture","business-rule","integration","dependency","bug","fix","test","review","vuln","ui-pattern","stack","env-config","command","note"]),s=/\[\[REMEMBER(?:\s+type=([a-z-]+))?\s*:?\s*([\s\S]*?)\]\]/gi;function t(a,b){let c=[];for(let d of a.matchAll(s)){let a=d[1]&&r.has(d[1])?d[1]:"note",e=d[2].trim();e.length>=8&&c.push({type:a,title:e.split("\n")[0].slice(0,80),summary:e.slice(0,1200),goalId:b.goalId??null,issueId:b.issueId??null,taskId:b.taskId??null,agentHandle:b.agentHandle,sourceKind:b.sourceKind,sourceRef:`${b.sourceRef}:${c.length}`})}return{items:c,stripped:a.replace(s,"").replace(/\n{3,}/g,"\n\n").trim()}}let u=/\[\[CONSULT:\s*([\s\S]*?)\]\]/gi;async function v(a,b,c){let d=[];for(let e of b.matchAll(u)){let b=e[1].trim();if(!(b.length<4))try{let e=await F(a,b,{agentHandle:c,k:6});d.push({q:b,a:e.context?.trim()?e.context:"(no relevant knowledge in the KB yet)",sources:e.sources??[]})}catch{}}return{answers:d,stripped:b.replace(u,"").replace(/\n{3,}/g,"\n\n").trim()}}let w=/\[\[KB:\s*([a-z-]+)\s*\]\]/gi;async function x(a,b){let c=[];for(let d of b.matchAll(w)){let b=d[1].toLowerCase();try{if("reindex"===b){let b=await (0,j.xV)(a);c.push(`reindex → ${b.chunks} chunk(s)${b.embedded?" (semantic)":""}`)}else if("index-chat"===b||"indexchat"===b){let b=await (0,j.hu)(a);c.push(`index-chat → ${b} chunk(s)`)}else if("health"===b){let a=await (0,m.LU)();c.push(`embed health → ${a.up?`up${a.model?` (${a.model})`:""}`:"down"}`)}}catch{}}return{results:c,stripped:b.replace(w,"").replace(/\n{3,}/g,"\n\n").trim()}}let y=!1;function z(){if(y)return;y=!0,h.F.exec(`
39
+ CREATE TABLE IF NOT EXISTS kb_entry (
40
+ id TEXT PRIMARY KEY,
41
+ workspace_id TEXT NOT NULL REFERENCES workspace(id) ON DELETE CASCADE,
42
+ type TEXT NOT NULL DEFAULT 'note',
43
+ title TEXT NOT NULL,
44
+ summary TEXT NOT NULL DEFAULT '',
45
+ body TEXT NOT NULL DEFAULT '',
46
+ status TEXT NOT NULL DEFAULT 'active',
47
+ goal_id TEXT,
48
+ spec_id TEXT,
49
+ issue_id TEXT,
50
+ task_id TEXT,
51
+ module TEXT NOT NULL DEFAULT '',
52
+ paths TEXT,
53
+ agent_handle TEXT NOT NULL DEFAULT '',
54
+ source_kind TEXT NOT NULL DEFAULT '',
55
+ source_ref TEXT NOT NULL DEFAULT '',
56
+ supersedes_id TEXT,
57
+ hash TEXT NOT NULL DEFAULT '',
58
+ confidence INTEGER NOT NULL DEFAULT 70,
59
+ created_at INTEGER NOT NULL DEFAULT (unixepoch()),
60
+ updated_at INTEGER NOT NULL DEFAULT (unixepoch())
61
+ );
62
+ CREATE INDEX IF NOT EXISTS kb_ws_type_idx ON kb_entry (workspace_id, type);
63
+ CREATE INDEX IF NOT EXISTS kb_ws_goal_idx ON kb_entry (workspace_id, goal_id);
64
+ CREATE TABLE IF NOT EXISTS kb_query_log (
65
+ id TEXT PRIMARY KEY,
66
+ workspace_id TEXT NOT NULL REFERENCES workspace(id) ON DELETE CASCADE,
67
+ agent_handle TEXT NOT NULL DEFAULT '',
68
+ query TEXT NOT NULL DEFAULT '',
69
+ hits INTEGER NOT NULL DEFAULT 0,
70
+ mode TEXT NOT NULL DEFAULT '',
71
+ refs TEXT,
72
+ answered_at INTEGER NOT NULL DEFAULT (unixepoch())
73
+ );
74
+ CREATE INDEX IF NOT EXISTS kb_query_ws_idx ON kb_query_log (workspace_id, answered_at);
75
+ `);let a=new Set(h.F.prepare("PRAGMA table_info(rag_chunk)").all().map(a=>a.name));a.has("kb_entry_id")||h.F.exec("ALTER TABLE rag_chunk ADD COLUMN kb_entry_id TEXT"),a.has("obsolete")||h.F.exec("ALTER TABLE rag_chunk ADD COLUMN obsolete INTEGER NOT NULL DEFAULT 0");let b=new Set(h.F.prepare("PRAGMA table_info(message)").all().map(a=>a.name));b.has("task_id")||h.F.exec("ALTER TABLE message ADD COLUMN task_id TEXT"),b.has("kind")||h.F.exec("ALTER TABLE message ADD COLUMN kind TEXT"),b.has("blocks")||h.F.exec("ALTER TABLE message ADD COLUMN blocks TEXT"),new Set(h.F.prepare("PRAGMA table_info(agent_skill)").all().map(a=>a.name)).has("auto")||h.F.exec("ALTER TABLE agent_skill ADD COLUMN auto INTEGER NOT NULL DEFAULT 1"),new Set(h.F.prepare("PRAGMA table_info(skill)").all().map(a=>a.name)).has("proposed_role")||h.F.exec("ALTER TABLE skill ADD COLUMN proposed_role TEXT"),new Set(h.F.prepare("PRAGMA table_info(notification_pref)").all().map(a=>a.name)).has("reduced_motion")||h.F.exec("ALTER TABLE notification_pref ADD COLUMN reduced_motion INTEGER NOT NULL DEFAULT 0"),h.F.exec(`
76
+ CREATE TABLE IF NOT EXISTS file_lock (
77
+ workspace_id TEXT NOT NULL,
78
+ path TEXT NOT NULL,
79
+ task_id TEXT NOT NULL DEFAULT '',
80
+ agent_id TEXT NOT NULL DEFAULT '',
81
+ agent_handle TEXT NOT NULL DEFAULT '',
82
+ acquired_at INTEGER NOT NULL DEFAULT (unixepoch()),
83
+ heartbeat_at INTEGER NOT NULL DEFAULT (unixepoch()),
84
+ PRIMARY KEY (workspace_id, path)
85
+ );
86
+ `),h.F.exec(`
87
+ CREATE TABLE IF NOT EXISTS synced_block (
88
+ workspace_id TEXT NOT NULL,
89
+ slug TEXT NOT NULL,
90
+ kind TEXT NOT NULL DEFAULT 'note',
91
+ title TEXT NOT NULL DEFAULT '',
92
+ body TEXT NOT NULL DEFAULT '',
93
+ version INTEGER NOT NULL DEFAULT 1,
94
+ updated_by TEXT NOT NULL DEFAULT '',
95
+ created_at INTEGER NOT NULL DEFAULT (unixepoch()),
96
+ updated_at INTEGER NOT NULL DEFAULT (unixepoch()),
97
+ PRIMARY KEY (workspace_id, slug)
98
+ );
99
+ CREATE TABLE IF NOT EXISTS block_proposal (
100
+ id TEXT PRIMARY KEY,
101
+ workspace_id TEXT NOT NULL,
102
+ slug TEXT NOT NULL,
103
+ kind TEXT NOT NULL DEFAULT 'note',
104
+ title TEXT NOT NULL DEFAULT '',
105
+ body TEXT NOT NULL DEFAULT '',
106
+ by_agent_handle TEXT NOT NULL DEFAULT '',
107
+ status TEXT NOT NULL DEFAULT 'pending',
108
+ created_at INTEGER NOT NULL DEFAULT (unixepoch()),
109
+ decided_at INTEGER,
110
+ decided_by TEXT NOT NULL DEFAULT ''
111
+ );
112
+ CREATE INDEX IF NOT EXISTS block_prop_ws_idx ON block_proposal (workspace_id, status);
113
+ `)}let A=a=>(0,d.createHash)("sha256").update(a.join("\n")).digest("hex"),B=(a,b)=>`kb/${a}/${b}`;async function C(a){let[b]=await h.db.select({id:i.workspace.id}).from(i.workspace).where((0,e.eq)(i.workspace.orgId,a));return b?.id??null}async function D(a,b){let c=B(b.type,b.id);await h.db.delete(i.ragChunk).where((0,e.Uo)((0,e.eq)(i.ragChunk.workspaceId,a),(0,e.eq)(i.ragChunk.path,c)));let f=`# ${b.title}
114
+ ${(b.summary||b.body||"").trim()}`.slice(0,6e3);for(let e of(0,j.U_)(f)){let f=await (0,j.E6)(e);await h.db.insert(i.ragChunk).values({id:(0,d.randomUUID)(),workspaceId:a,path:c,chunk:e,vector:f?JSON.stringify(f):null,kbEntryId:b.id,obsolete:!1})}}async function E(a,b){if(!b.length)return{ingested:0};let c=null;try{z(),c=await C(a)}catch{return{ingested:0}}if(!c)return{ingested:0};let f=0;for(let a of b){let b=(a.title||"").trim().slice(0,200);if(!b)continue;let g=(a.summary||"").trim().slice(0,1200),j=(a.body||"").trim().slice(0,8e3),k=`${b}
115
+ ${g}
116
+ ${j}`;if((0,p.Z)(k)!==k){console.warn(`[kb] refused to ingest secret-shaped content (type=${a.type}, source=${a.sourceKind})`);continue}let l=A([a.type,b,g||j]);try{let[k]=await h.db.select({id:i.kbEntry.id}).from(i.kbEntry).where((0,e.Uo)((0,e.eq)(i.kbEntry.workspaceId,c),(0,e.eq)(i.kbEntry.hash,l))).limit(1);if(k){await h.db.update(i.kbEntry).set({updatedAt:new Date}).where((0,e.eq)(i.kbEntry.id,k.id));continue}let[m]=a.sourceRef?await h.db.select({id:i.kbEntry.id}).from(i.kbEntry).where((0,e.Uo)((0,e.eq)(i.kbEntry.workspaceId,c),(0,e.eq)(i.kbEntry.type,a.type),(0,e.eq)(i.kbEntry.sourceKind,a.sourceKind),(0,e.eq)(i.kbEntry.sourceRef,a.sourceRef))).limit(1):[],n={type:a.type,title:b,summary:g,body:j,status:"active",goalId:a.goalId??null,specId:a.specId??null,issueId:a.issueId??null,taskId:a.taskId??null,module:(a.module||"").slice(0,120),paths:a.paths?.length?a.paths.slice(0,40):null,agentHandle:(a.agentHandle||"").slice(0,60),sourceKind:a.sourceKind,sourceRef:a.sourceRef,hash:l,confidence:Math.max(0,Math.min(100,a.confidence??70))},o=m?.id??(0,d.randomUUID)();m?await h.db.update(i.kbEntry).set({...n,updatedAt:new Date}).where((0,e.eq)(i.kbEntry.id,o)):await h.db.insert(i.kbEntry).values({id:o,workspaceId:c,...n}),await D(c,{id:o,type:a.type,title:b,summary:g,body:j}),f++}catch{}}return f&&function(a){if("0"===process.env.CONSTELLA_KB_CURATION)return;let b=U.get(a);b&&clearTimeout(b),U.set(a,setTimeout(()=>{U.delete(a);let b=V.get(a)??0,c=Date.now();c-b<18e5||(V.set(a,c),T(a).catch(()=>{}))},24e4))}(a),{ingested:f}}async function F(a,b,c={}){let d=c.k??6,f={context:"",sources:[],refs:[],mode:"none",sufficient:!1},g=null;try{z(),g=await C(a)}catch{return f}if(!g)return f;let k=()=>h.db.select().from(i.ragChunk).where((0,e.Uo)((0,e.eq)(i.ragChunk.workspaceId,g),(0,e.eq)(i.ragChunk.obsolete,!1))),l=await k();if(0===l.length){try{await (0,j.xV)(a)}catch{}l=await k()}if(0===l.length)return H(g,b,c.agentHandle,f);let m=[],n="heuristic",o=await (0,j.E6)(b,"query");if(o){let a=l.filter(a=>a.vector);a.length&&(m=a.map(a=>({r:a,s:(0,j.sw)(o,JSON.parse(a.vector))})).sort((a,b)=>b.s-a.s).slice(0,d).map(a=>a.r),n="semantic")}if(0===m.length){let a=b.toLowerCase().split(/\W+/).filter(a=>a.length>3);m=l.map(b=>({r:b,s:a.reduce((a,c)=>a+ +!!b.chunk.toLowerCase().includes(c),0)})).sort((a,b)=>b.s-a.s).filter(a=>a.s>0).slice(0,d).map(a=>a.r)}if(0===m.length)return H(g,b,c.agentHandle,{...f,mode:n});let p=[...new Set(m.map(a=>a.path))],q={context:m.map(a=>`# ${a.path}
117
+ ${a.chunk}`).join("\n\n").slice(0,4e3),sources:p,refs:await G(g,m.map(a=>a.kbEntryId).filter(a=>!!a)),mode:n,sufficient:!0};return H(g,b,c.agentHandle,q)}async function G(a,b){if(!b.length)return[];let c=await h.db.select().from(i.kbEntry).where((0,e.Uo)((0,e.eq)(i.kbEntry.workspaceId,a),(0,e.RV)(i.kbEntry.id,[...new Set(b)]))),d=[],f=new Set,g=(a,b)=>{let c=`${a}:${b}`;b&&!f.has(c)&&(f.add(c),d.push({kind:a,ref:b}))};for(let a of c)for(let b of(a.specId&&g("spec",a.specId),a.issueId&&g("issue",a.issueId),a.goalId&&g("goal",a.goalId),a.sourceRef&&g(a.sourceKind||a.type,a.sourceRef),a.paths??[]))g("file",b);return d.slice(0,20)}async function H(a,b,c,e){try{await h.db.insert(i.kbQueryLog).values({id:(0,d.randomUUID)(),workspaceId:a,agentHandle:(c||"").slice(0,60),query:b.slice(0,500),hits:e.sources.length,mode:e.mode,refs:e.refs.length?e.refs.map(a=>`${a.kind}:${a.ref}`):null})}catch{}return e}async function I(a,b,c=2){let d=null;try{z(),d=await C(a)}catch{return null}if(!d)return null;let f=b.goalId||b.specId||b.issueId;if(!f)return null;let g=await h.db.select().from(i.kbEntry).where((0,e.Uo)((0,e.eq)(i.kbEntry.workspaceId,d),(0,e.eq)(i.kbEntry.status,"active"))),j=new Map(g.map(a=>[a.id,a])),k=new Map,l=new Set(b.goalId?[b.goalId]:[]),m=new Set(b.specId?[b.specId]:[]),n=new Set(b.issueId?[b.issueId]:[]);for(let a=0;a<c;a++){let a=new Set,b=new Set,c=new Set;for(let d of g)!k.has(d.id)&&(d.goalId&&l.has(d.goalId)||d.specId&&m.has(d.specId)||d.issueId&&n.has(d.issueId))&&(k.set(d.id,d),d.goalId&&a.add(d.goalId),d.specId&&b.add(d.specId),d.issueId&&c.add(d.issueId),d.supersedesId&&j.has(d.supersedesId)&&k.set(d.supersedesId,j.get(d.supersedesId)));if(l=a,m=b,n=c,!a.size&&!b.size&&!c.size)break}let o=[...k.values()].sort((a,b)=>b.confidence-a.confidence).slice(0,40).map(a=>({id:a.id,type:a.type,title:a.title,confidence:a.confidence})),p={};for(let a of o)(p[a.type]??=[]).push(a);return{seed:{kind:b.goalId?"goal":b.specId?"spec":"issue",id:f},nodes:o,byType:p}}async function J(a){try{z();let b=await h.db.select({status:i.kbEntry.status}).from(i.kbEntry).where((0,e.eq)(i.kbEntry.workspaceId,a));return{entries:b.length,active:b.filter(a=>"active"===a.status).length,obsolete:b.filter(a=>"obsolete"===a.status||"superseded"===a.status).length}}catch{return{entries:0,active:0,obsolete:0}}}let K=a=>(a||"").replace(/\\/g,"/").split("/")[0]||"";async function L(a){z();let[b,c,d,g,j,k,l]=await Promise.all([h.db.select().from(i.kbEntry).where((0,e.eq)(i.kbEntry.workspaceId,a)),h.db.select({path:i.ragChunk.path,vector:i.ragChunk.vector,obsolete:i.ragChunk.obsolete,kbEntryId:i.ragChunk.kbEntryId,updatedAt:i.ragChunk.updatedAt}).from(i.ragChunk).where((0,e.eq)(i.ragChunk.workspaceId,a)),h.db.select().from(i.kbQueryLog).where((0,e.eq)(i.kbQueryLog.workspaceId,a)).orderBy((0,f.i)(i.kbQueryLog.answeredAt)).limit(20),h.db.select({id:i.goal.id,title:i.goal.title,status:i.goal.status}).from(i.goal).where((0,e.eq)(i.goal.workspaceId,a)),h.db.select({goalId:i.spec.goalId}).from(i.spec).where((0,e.eq)(i.spec.workspaceId,a)),h.db.select({goalId:i.issue.goalId}).from(i.issue).where((0,e.eq)(i.issue.workspaceId,a)),h.db.select({goalId:i.goalFile.goalId,path:i.goalFile.path}).from(i.goalFile).where((0,e.eq)(i.goalFile.workspaceId,a))]),m=c.filter(a=>a.vector),n=0;try{m[0]?.vector&&(n=JSON.parse(m[0].vector).length)}catch{n=0}let o=c.filter(a=>!a.obsolete).length,p=c.reduce((a,b)=>Math.max(a,b.updatedAt?new Date(b.updatedAt).getTime():0),0)||null,q={active:0,superseded:0,obsolete:0,archived:0},r=new Map,s=new Set;for(let a of b){a.status in q&&q[a.status]++;let b=r.get(a.type)??{total:0,active:0};if(b.total++,"active"===a.status&&b.active++,r.set(a.type,b),"active"===a.status)for(let b of a.paths??[])s.add(K(b))}let t=[...r.entries()].map(([a,b])=>({type:a,...b})).sort((a,b)=>b.total-a.total),u=a=>{let b=new Map;for(let c of a)c.goalId&&b.set(c.goalId,(b.get(c.goalId)??0)+1);return b},v=u(j),w=u(k),x=u(l),y=u(b),A=a=>"active"===a?0:"done"===a?1:2,B=g.map(a=>({id:a.id,title:a.title,status:a.status,specs:v.get(a.id)??0,issues:w.get(a.id)??0,files:x.get(a.id)??0,entries:y.get(a.id)??0})).sort((a,b)=>A(a.status)-A(b.status)||b.entries-a.entries).slice(0,14),C=new Set;for(let a of l){let b=K(a.path);b&&C.add(b)}let D=[...C].filter(a=>!s.has(a)).slice(0,20).map(a=>`Module “${a}/” has produced files but no captured knowledge yet`);return{index:{chunks:c.length,embedded:m.length,kbChunks:c.filter(a=>a.kbEntryId).length,active:o,obsolete:c.length-o,dim:n,lastUpdated:p,semantic:m.length>0},lifecycle:q,byType:t,goals:B,queries:d.map(a=>({agentHandle:a.agentHandle,query:a.query,hits:a.hits,mode:a.mode,refs:a.refs??[],answeredAt:a.answeredAt?new Date(a.answeredAt).getTime():null})),gaps:D,total:b.length}}let M=/\b(knowledge[ -]?base|base de conhecimento|the kb|kb status|status do kb|what do we (?:already )?know|o que (?:j[áa] )?sabemos|coverage|cobertura|gaps?|lacunas|how is the kb|como est[áa] (?:a|o) (?:base|kb))\b/i;async function N(a,b){let c=null;try{z(),c=await C(a)}catch{c=null}if(c&&M.test(b))try{let[a,b]=await Promise.all([L(c),h.db.select({slug:i.syncedBlock.slug}).from(i.syncedBlock).where((0,e.eq)(i.syncedBlock.workspaceId,c))]);return{text:function(a,b){let c=["mission","official-stack","business-rules"].filter(a=>!b.includes(a)),d=[];if(d.push(a.total>0?`The Knowledge Base has **${a.total}** curated entr${1===a.total?"y":"ies"}.`:"The Knowledge Base layer is still empty — knowledge fills in as agents complete work."),d.push(""),d.push("**What exists**"),d.push(`- ${a.index.chunks} indexed chunk(s) (${a.index.embedded} embedded \xb7 ${a.index.semantic?"semantic":"keyword"} search)`),d.push(`- ${b.length} central knowledge block(s)`),d.push(`- ${a.queries.length} recent quer${1===a.queries.length?"y":"ies"}`),c.length&&(d.push(""),d.push("**What's missing**"),d.push(`- Central blocks: ${c.join(", ")} — create them so every agent shares the same canon.`)),a.gaps.length)for(let b of(d.push(""),d.push("**Coverage gaps**"),a.gaps.slice(0,4)))d.push(`- ${b}`);return d.push(""),d.push("**Next steps**"),c.length&&d.push("- Create the missing central blocks in Knowledge."),a.total>=4&&d.push("- Run `/curate` to dedupe and tighten the KB."),d.push("- Ask me a specific question and I'll answer from the indexed knowledge."),d.join("\n")}(a,b.map(a=>a.slug)),mode:"overview",sources:[]}}catch{}let d=await F(a,b,{agentHandle:"operator",k:6});if(!d.sufficient||!d.context)return{text:"I don't have enough in the Knowledge Base to answer that yet. It fills in as agents complete work — or run `/reindex` to (re)index the project docs.",mode:"none"};let f=(d.refs.length?d.refs.map(a=>`${a.kind}:${a.ref}`):d.sources).slice(0,6),g=await Q(a,b,d.context);return g?{text:g,mode:"answer",sources:f}:{text:"Here's what I found in the Knowledge Base (the writer model is offline — open the sources below for detail).",mode:"answer",sources:f}}let O=process.env.LLAMACPP_URL??"http://127.0.0.1:8082";async function P(a,b){let c=await (0,m.LU)().catch(()=>({up:!1,model:null}));if(!c.up)return null;let d=await (0,l._)(a,{provider:"openai",baseUrl:`${O}/v1`,apiKey:"",model:c.model||"local"},{timeoutMs:b},()=>{}).catch(()=>null);return d&&d.ok&&d.text.trim()?(d.text=d.text.replace(/<think>[\s\S]*?<\/think>/gi,"").trim(),d.binary="local",d):null}async function Q(a,b,c){try{let[f]=await h.db.select().from(i.workspace).where((0,e.eq)(i.workspace.orgId,a));if(!f)return"";let g=await h.db.select().from(i.agent).where((0,e.eq)(i.agent.workspaceId,f.id)),j=g.find(a=>"vannevar"===a.handle)??g.find(a=>/knowledge/i.test(a.role));if(!j||await R(j.id,j.dailyCapUsd))return"";let l=`You are Vannevar, the Knowledge agent. Answer the operator's question using ONLY the context below.
118
+ Be concise and clear — a few sentences or short bullets. Reply in the same language as the question.
119
+ Cite the relevant source file/ref names inline when useful. If the context does not contain the answer, say so plainly — do NOT invent.
120
+ Do NOT repeat, paste, or echo the raw context; write a real answer.
121
+
122
+ QUESTION: ${b}
123
+
124
+ CONTEXT:
125
+ ${c}`,m=await P(l,6e4);if(!m){let b=(0,k.hW)(j.adapter,j.model);m=await (0,k.JN)(l,{orgId:a,binary:b,model:S(b,j.model),timeoutMs:6e4})}return(m.usd>0||m.inputTokens+m.outputTokens>0)&&await h.db.insert(i.costEntry).values({id:(0,d.randomUUID)(),workspaceId:f.id,agentId:j.id,provider:m.binary,model:m.model??j.model,usd:m.usd,tokens:m.inputTokens+m.outputTokens,at:new Date}),(m.text||"").trim().slice(0,3500)}catch{return""}}async function R(a,b){if(!b)return!1;let c=new Date;c.setHours(0,0,0,0);let[d]=await h.db.select({total:(0,g.cz)(i.costEntry.usd)}).from(i.costEntry).where((0,e.Uo)((0,e.eq)(i.costEntry.agentId,a),(0,e.RO)(i.costEntry.at,c)));return Number(d?.total??0)>=b}function S(a,b){if("claude"===a){let a=(b||"").toLowerCase();return a.includes("opus")?"opus":a.includes("haiku")?"haiku":"sonnet"}if("codex"!==a)return b||void 0}async function T(a){let b={ok:!1,merged:0,retired:0,summarized:0,gaps:0};try{z();let[c]=await h.db.select().from(i.workspace).where((0,e.eq)(i.workspace.orgId,a));if(!c)return b;let g=await h.db.select().from(i.agent).where((0,e.eq)(i.agent.workspaceId,c.id)),j=g.find(a=>"vannevar"===a.handle)??g.find(a=>/knowledge/i.test(a.role));if(!j||await R(j.id,j.dailyCapUsd))return b;let l=await h.db.select().from(i.kbEntry).where((0,e.Uo)((0,e.eq)(i.kbEntry.workspaceId,c.id),(0,e.RV)(i.kbEntry.status,["active","superseded"]))).orderBy((0,f.i)(i.kbEntry.updatedAt)).limit(60);if(l.length<4)return b;let m=new Set(l.map(a=>a.id)),p=l.map(a=>({id:a.id,type:a.type,title:a.title,summary:(a.summary||a.body).slice(0,300),ref:a.sourceRef,goalId:a.goalId,status:a.status})),r=`${q}
126
+
127
+ ## Curate the knowledge base
128
+ Below are this workspace's recent KB entries (JSON). Find near-duplicates, contradictions and weak summaries.
129
+ Output ONLY a JSON object (no prose, no markdown fences):
130
+ {
131
+ "merges": [{ "keep": "<id>", "drop": ["<id>", ...] }], // canonical entry to keep + duplicates to supersede
132
+ "obsolete": ["<id>", ...], // entries no longer true / contradicted
133
+ "summaries":[{ "id": "<id>", "summary": "<tighter technical summary>" }],
134
+ "gaps": ["<short description of missing knowledge>"]
135
+ }
136
+ Use ONLY ids present below. If nothing needs changing, output {"merges":[],"obsolete":[],"summaries":[],"gaps":[]}.
137
+
138
+ ENTRIES:
139
+ ${JSON.stringify(p)}`,s=await P(r,18e4);if(!s){let b=(0,k.hW)(j.adapter,j.model);s=await (0,k.JN)(r,{orgId:a,binary:b,model:S(b,j.model),timeoutMs:18e4})}(s.usd>0||s.inputTokens+s.outputTokens>0)&&await h.db.insert(i.costEntry).values({id:(0,d.randomUUID)(),workspaceId:c.id,agentId:j.id,provider:s.binary,model:s.model??j.model,usd:s.usd,tokens:s.inputTokens+s.outputTokens,at:new Date});let t={},u=s.text.match(/\{[\s\S]*\}/);if(u)try{t=JSON.parse(u[0])}catch{t={}}let v=0,w=0,x=0;for(let a of t.merges??[])if(m.has(a.keep))for(let b of a.drop??[]){if(b===a.keep||!m.has(b))continue;let[d]=await h.db.select({type:i.kbEntry.type}).from(i.kbEntry).where((0,e.eq)(i.kbEntry.id,b));d&&(await h.db.update(i.kbEntry).set({status:"superseded",supersedesId:a.keep,updatedAt:new Date}).where((0,e.eq)(i.kbEntry.id,b)),await h.db.update(i.ragChunk).set({obsolete:!0}).where((0,e.Uo)((0,e.eq)(i.ragChunk.workspaceId,c.id),(0,e.eq)(i.ragChunk.path,B(d.type,b)))),v++)}for(let a of t.obsolete??[]){if(!m.has(a))continue;let[b]=await h.db.select({type:i.kbEntry.type}).from(i.kbEntry).where((0,e.eq)(i.kbEntry.id,a));b&&(await h.db.update(i.kbEntry).set({status:"obsolete",updatedAt:new Date}).where((0,e.eq)(i.kbEntry.id,a)),await h.db.update(i.ragChunk).set({obsolete:!0}).where((0,e.Uo)((0,e.eq)(i.ragChunk.workspaceId,c.id),(0,e.eq)(i.ragChunk.path,B(b.type,a)))),w++)}for(let a of t.summaries??[]){if(!m.has(a.id)||!a.summary?.trim())continue;let[b]=await h.db.select().from(i.kbEntry).where((0,e.eq)(i.kbEntry.id,a.id));b&&"active"===b.status&&(await h.db.update(i.kbEntry).set({summary:a.summary.slice(0,1200),updatedAt:new Date}).where((0,e.eq)(i.kbEntry.id,a.id)),await D(c.id,{id:b.id,type:b.type,title:b.title,summary:a.summary,body:b.body}),x++)}let y=(t.gaps??[]).filter(a=>"string"==typeof a&&a.trim()).slice(0,30),A=await J(c.id),C=`# KB health
140
+
141
+ _Curated by @${j.handle} \xb7 ${A.active} active \xb7 ${A.obsolete} retired entr(y/ies)_
142
+
143
+ This pass: merged ${v}, retired ${w}, re-summarised ${x}.
144
+
145
+ `+(y.length?`## Coverage gaps
146
+ ${y.map(a=>`- ${a}`).join("\n")}
147
+ `:"No coverage gaps reported.\n");try{await (0,n.g)(c.orgId,"Reports/kb-health.md",C)}catch{}return v+w+x+y.length>0&&await (0,o.I)(c.id,{kind:"report",text:"KB curated",detail:`merged ${v}, retired ${w}, re-summarised ${x}, ${y.length} gap(s).`,agentId:j.id}),{ok:s.ok,merged:v,retired:w,summarized:x,gaps:y.length}}catch{return b}}let U=new Map,V=new Map},14024:(a,b,c)=>{c.d(b,{_:()=>g});let d={"gpt-4o":[2.5,10],"gpt-4o-mini":[.15,.6],"o4-mini":[1.1,4.4],"gemini-2.0-flash":[.1,.4],"gemini-1.5-pro":[1.25,5],"gemini-1.5-flash":[.075,.3]};function e(a,b,c){let e=Object.keys(d).find(b=>a.toLowerCase().startsWith(b));if(!e)return 0;let[f,g]=d[e];return b/1e6*f+c/1e6*g}function f(a,b,c,d){return{ok:!1,text:"",usd:0,inputTokens:0,outputTokens:0,durationMs:c,binary:a,model:b,error:d}}async function g(a,b,c,d){let g,h=Date.now(),i=b.baseUrl.replace(/\/$/,""),j="google"===b.provider,k=j?`${i}/models/${encodeURIComponent(b.model)}:streamGenerateContent?alt=sse&key=${encodeURIComponent(b.apiKey)}`:`${i}/chat/completions`,l={"content-type":"application/json"};!j&&b.apiKey&&(l.authorization=`Bearer ${b.apiKey}`);let m=j?{contents:[{role:"user",parts:[{text:a}]}]}:{model:b.model,messages:[{role:"user",content:a}],stream:!0,stream_options:{include_usage:!0}};try{g=await fetch(k,{method:"POST",headers:l,body:JSON.stringify(m),signal:AbortSignal.timeout(c.timeoutMs??18e4)})}catch(a){return f(b.provider,b.model,Date.now()-h,String(a instanceof Error?a.message:a))}if(!g.ok||!g.body){let a=await g.text().catch(()=>"");return f(b.provider,b.model,Date.now()-h,`http ${g.status} ${a.slice(0,200)}`)}let n=g.body.getReader(),o=new TextDecoder,p="",q="",r=0,s=0,t=0,u=()=>{q.length>r&&(d({kind:"text",detail:q.slice(r,r+8e3)}),r=q.length)};try{for(;;){let a,{value:b,done:c}=await n.read();if(c)break;for(p+=o.decode(b,{stream:!0});(a=p.indexOf("\n"))>=0;){let b=p.slice(0,a).trim();if(p=p.slice(a+1),!b.startsWith("data:"))continue;let c=b.slice(5).trim();if("[DONE]"!==c)try{let a=JSON.parse(c);if(j){let b=a.candidates?.[0]?.content?.parts?.map(a=>a.text??"").join("")??"";b&&(q+=b).length-r>=120&&u();let c=a.usageMetadata;c&&(s=c.promptTokenCount??s,t=c.candidatesTokenCount??t)}else{let b=a.choices?.[0]?.delta?.content??"";b&&(q+=b).length-r>=120&&u(),a.usage&&(s=a.usage.prompt_tokens??s,t=a.usage.completion_tokens??t)}}catch{}}}}catch(a){return u(),d({kind:"done"}),{ok:!!q,text:q,usd:e(b.model,s,t),inputTokens:s,outputTokens:t,durationMs:Date.now()-h,binary:b.provider,model:b.model,error:q?void 0:String(a instanceof Error?a.message:a)}}return u(),d({kind:"done"}),{ok:!!q.trim(),text:q,usd:e(b.model,s,t),inputTokens:s,outputTokens:t,durationMs:Date.now()-h,binary:b.provider,model:b.model,error:q.trim()?void 0:"empty response"}}},48938:(a,b,c)=>{c.d(b,{Z:()=>f});let d=["CONSTELLA_VAULT_KEY","BETTER_AUTH_SECRET","CONSTELLA_WORKER_SECRET"],e=RegExp("sk-[A-Za-z0-9_-]{16,}|gh[posru]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{40,}|AKIA[0-9A-Z]{16}|AIza[0-9A-Za-z_-]{30,}|xox[baprs]-[A-Za-z0-9-]{10,}|eyJ[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{6,}|-----BEGIN[\\s\\S]*?PRIVATE KEY-----[\\s\\S]*?-----END[\\s\\S]*?-----|\\bcn_[A-Za-z0-9_-]{24,}\\b|\\b\\d{6,}:[A-Za-z0-9_-]{30,}\\b","g");function f(a,b=[]){if(!a)return a;let c=a;for(let a of[...b,...d.map(a=>process.env[a])])a&&a.length>=8&&(c=c.split(a).join("[redacted]"));return c.replace(e,"[redacted]")}}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=3018,exports.ids=[3018],exports.modules={2345:(a,b,c)=>{c.d(b,{B:()=>e});var d=c(2910);let e=(0,d.createServerReference)("4092700ba435c925678f2d627e88e5e971326a5e5e",d.callServer,void 0,d.findSourceMapURL,"approveSpec")},25228:(a,b,c)=>{c.d(b,{e:()=>e});var d=c(61576);function e({name:a,color:b,size:c=24,health:f,image:g}){let h=Math.max(6,Math.round(.3*c)),i=Math.round(.28*c),j=g?/^(data:|https?:|\/)/.test(g)?g:`/api/upload?path=${encodeURIComponent(g)}`:null;return(0,d.jsxs)("span",{style:{position:"relative",width:c,height:c,flex:`0 0 ${c}px`,display:"inline-block"},children:[j?(0,d.jsx)("img",{src:j,alt:a,width:c,height:c,style:{width:c,height:c,borderRadius:i,objectFit:"cover",display:"block"}}):(0,d.jsx)("span",{style:{width:c,height:c,borderRadius:i,background:b,color:"#fff",display:"grid",placeItems:"center",fontSize:Math.round(.42*c),fontWeight:700},children:(a[0]||"?").toUpperCase()}),f&&(0,d.jsx)("span",{style:{position:"absolute",right:-1,bottom:-1,width:h,height:h,borderRadius:"50%",background:"alive"===f?"var(--sx-string)":"stale"===f?"var(--sx-number)":"var(--text-faint)",border:"1.5px solid var(--bg-elevated)"}})]})}},25543:(a,b,c)=>{c.d(b,{IssueApprove:()=>g,PlanGate:()=>f,PlanGateLive:()=>e,Run247Button:()=>h});var d=c(62060);let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call PlanGateLive() from the server but PlanGateLive is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"C:\\Users\\Usuario\\Documents\\constella\\src\\components\\modules\\plan-gate.tsx","PlanGateLive");(0,d.registerClientReference)(function(){throw Error("Attempted to call GeneratePlanButton() from the server but GeneratePlanButton is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"C:\\Users\\Usuario\\Documents\\constella\\src\\components\\modules\\plan-gate.tsx","GeneratePlanButton");let f=(0,d.registerClientReference)(function(){throw Error("Attempted to call PlanGate() from the server but PlanGate is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"C:\\Users\\Usuario\\Documents\\constella\\src\\components\\modules\\plan-gate.tsx","PlanGate");(0,d.registerClientReference)(function(){throw Error("Attempted to call SpecApprove() from the server but SpecApprove is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"C:\\Users\\Usuario\\Documents\\constella\\src\\components\\modules\\plan-gate.tsx","SpecApprove");let g=(0,d.registerClientReference)(function(){throw Error("Attempted to call IssueApprove() from the server but IssueApprove is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"C:\\Users\\Usuario\\Documents\\constella\\src\\components\\modules\\plan-gate.tsx","IssueApprove"),h=(0,d.registerClientReference)(function(){throw Error("Attempted to call Run247Button() from the server but Run247Button is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"C:\\Users\\Usuario\\Documents\\constella\\src\\components\\modules\\plan-gate.tsx","Run247Button")},58032:(a,b,c)=>{c.d(b,{J:()=>e});var d=c(2910);let e=(0,d.createServerReference)("4084456b8f373168599967a95f1f6074ca5ed265cc",d.callServer,void 0,d.findSourceMapURL,"rejectSpec")},66689:(a,b,c)=>{c.d(b,{P:()=>e});var d=c(2910);let e=(0,d.createServerReference)("00e45bb09a28ac696d2f5a9503f7648f4e490d9007",d.callServer,void 0,d.findSourceMapURL,"approvePlan")},84591:(a,b,c)=>{c.d(b,{d:()=>e});var d=c(2910);let e=(0,d.createServerReference)("409a00fb6112f1d61b785f1dcab141214f82cad748",d.callServer,void 0,d.findSourceMapURL,"rejectIssue")},85e3:(a,b,c)=>{c.r(b),c.d(b,{"0006c83f98a39c792e0e4f9308d6a0a4dcb79d85be":()=>d.Kd,"00fc5afdbe976eadb41fe4c0da95be8f839807864d":()=>d.cT,"40876c9349d33b0e9a1d168488c37033e01dd39add":()=>d.j0,"40ceed5e4f09fc2768af58245e12a4c9dbdefeb1f3":()=>d.OD});var d=c(14565)},88418:(a,b,c)=>{c.d(b,{t:()=>e});var d=c(2910);let e=(0,d.createServerReference)("4054b0647abaaa37034f58a7515bb92956b1c1075c",d.callServer,void 0,d.findSourceMapURL,"approveIssue")},97490:(a,b,c)=>{c.d(b,{IssueApprove:()=>w,PlanGate:()=>u,PlanGateLive:()=>t,Run247Button:()=>x,p:()=>v});var d=c(4374),e=c(74679),f=c(47104),g=c(43526),h=c(31819),i=c(73134),j=c(2910);let k=(0,j.createServerReference)("40d4495591c4f0c211bbbbc777aa080521893681ba",j.callServer,void 0,j.findSourceMapURL,"generatePlan"),l=(0,j.createServerReference)("00c91dc39ccc68d15fb0f0f1b170a819b17be7523b",j.callServer,void 0,j.findSourceMapURL,"requestPlanChanges");var m=c(66689),n=c(2345),o=c(58032),p=c(88418),q=c(84591);let r=(0,j.createServerReference)("40c0818db6a6d0dc733e343a692e8b27655fcea0ba",j.callServer,void 0,j.findSourceMapURL,"setAuto247");function s(a,b){window.dispatchEvent(new CustomEvent("constella:open-dm",{detail:{handle:a,text:b}}))}function t({planning:a,planSince:b}){let c=(0,h.k)(),[j,l]=(0,e.useTransition)(),m=(0,f.useRouter)(),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(""),r=a||n;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i.AgentRunLive,{channel:"planner",resume:a,sinceSeq:a?b-1:0,onFinish:()=>o(!1)}),r?(0,d.jsxs)("div",{className:"plan-gate",children:[(0,d.jsx)("div",{className:"plan-gate-bar","aria-hidden":!0}),(0,d.jsx)("div",{className:"pg-ic",children:(0,d.jsx)(g.I,{name:"bot",size:20})}),(0,d.jsxs)("div",{className:"pg-main",children:[(0,d.jsx)("div",{className:"pg-t",children:c("planner.gate.drafting.t")}),(0,d.jsx)("div",{className:"pg-d",children:c("planner.gate.drafting.d")})]})]}):(0,d.jsxs)("div",{className:"plan-gate",children:[(0,d.jsx)("div",{className:"plan-gate-bar","aria-hidden":!0}),(0,d.jsx)("div",{className:"pg-ic",children:(0,d.jsx)(g.I,{name:"bot",size:20})}),(0,d.jsxs)("div",{className:"pg-main",children:[(0,d.jsx)("div",{className:"pg-t",children:c("planner.gate.noPlan.t")}),(0,d.jsx)("div",{className:"pg-d",children:c("planner.gate.noPlan.d")}),p&&(0,d.jsx)("div",{className:"pg-d",style:{color:"var(--sx-keyword)",marginTop:6},children:p})]}),(0,d.jsxs)("div",{className:"pg-actions",children:[(0,d.jsxs)("div",{className:"plan-hint",children:[(0,d.jsx)("div",{className:"plan-hint-t",children:c("planner.gate.hint.t")}),(0,d.jsx)("div",{className:"plan-hint-d",children:c("planner.gate.hint.d")})]}),(0,d.jsxs)("button",{className:"btn-accent",disabled:j,onClick:function(){q(""),o(!0),window.dispatchEvent(new CustomEvent("constella:agent-run",{detail:{channel:"planner"}})),l(async()=>{try{let a=await k();(!a?.ok||!1===a.started)&&(o(!1),a?.error&&q(a.error)),m.refresh()}catch{o(!1),q(c("planner.gate.staleTab"))}})},children:[(0,d.jsx)(g.I,{name:j?"refresh":"bot",size:14,className:j?"sync-spin":""})," ",j?c("planner.gate.analyzing"):c("planner.gate.generate")]})]})]})]})}function u({specs:a,total:b}){let c=(0,h.k)(),[f,i]=(0,e.useTransition)();return(0,d.jsxs)("div",{className:"plan-gate",children:[(0,d.jsx)("div",{className:"pg-ic",children:(0,d.jsx)(g.I,{name:"bot",size:20})}),(0,d.jsxs)("div",{className:"pg-main",children:[(0,d.jsx)("div",{className:"pg-t",children:c("planner.gate.ready.t")}),(0,d.jsx)("div",{className:"pg-d",children:c("planner.gate.ready.d",{specs:a,total:b})})]}),(0,d.jsxs)("div",{className:"pg-actions",children:[(0,d.jsxs)("button",{className:"btn-ghost",disabled:f,onClick:()=>i(async()=>{await l(),s("ada",c("planner.gate.rejectPlanDm"))}),children:[(0,d.jsx)(g.I,{name:"refresh",size:13})," ",c("planner.gate.requestChanges")]}),(0,d.jsxs)("button",{className:"btn-accent",disabled:f,onClick:()=>i(()=>(0,m.P)()),children:[(0,d.jsx)(g.I,{name:"check",size:14})," ",c("planner.gate.approvePlan")]})]})]})}function v({specId:a,specKey:b,approved:c}){let f=(0,h.k)(),[i,j]=(0,e.useTransition)();return c?(0,d.jsxs)("span",{className:"pill",style:{background:"var(--sx-string)22",color:"var(--sx-string)"},children:[(0,d.jsx)(g.I,{name:"check",size:11})," ",f("planner.approved")]}):(0,d.jsxs)("span",{style:{display:"inline-flex",gap:6},children:[(0,d.jsxs)("button",{className:"sc2-btn",disabled:i,onClick:()=>j(()=>(0,n.B)(a)),children:[(0,d.jsx)(g.I,{name:"check",size:11})," ",f("planner.approve")]}),(0,d.jsxs)("button",{className:"sc2-btn danger",disabled:i,onClick:()=>j(async()=>{s((await (0,o.J)(a)).handle,f("planner.rejectItemDm",{key:b}))}),children:[(0,d.jsx)(g.I,{name:"refresh",size:11})," ",f("planner.reject")]})]})}function w({issueId:a,issueKey:b,approved:c}){let f=(0,h.k)(),[i,j]=(0,e.useTransition)();return c?(0,d.jsxs)("span",{className:"pill",style:{background:"var(--sx-string)22",color:"var(--sx-string)"},children:[(0,d.jsx)(g.I,{name:"check",size:11})," ",f("planner.approved")]}):(0,d.jsxs)("span",{style:{display:"inline-flex",gap:6},children:[(0,d.jsxs)("button",{className:"sc2-btn",disabled:i,onClick:()=>j(()=>(0,p.t)(a)),children:[(0,d.jsx)(g.I,{name:"check",size:11})," ",f("planner.approve")]}),(0,d.jsxs)("button",{className:"sc2-btn danger",disabled:i,onClick:()=>j(async()=>{s((await (0,q.d)(a)).handle,f("planner.rejectItemDm",{key:b}))}),children:[(0,d.jsx)(g.I,{name:"refresh",size:11})," ",f("planner.reject")]})]})}function x({auto:a,approved:b,state:c}){let f=(0,h.k)(),[i,j]=(0,e.useTransition)(),k=f(i?a?"planner.run247.pausing":"planner.run247.starting":"waiting-approval"===c?"planner.run247.approveToRun":"all-done"===c?"planner.run247.allDone":a?"planner.run247.pause":"planner.run247.run"),l="blocked"===c?f("planner.run247.blockedTip"):void 0,m="off"===c&&!i;return(0,d.jsxs)("button",{className:"btn-"+(a?"ghost":"accent")+(m?" run-attn":""),disabled:!b||"all-done"===c||i,title:l,onClick:()=>j(()=>r(!a)),children:[(0,d.jsx)(g.I,{name:i?"refresh":"waiting-approval"===c?"bot":"all-done"===c?"check":a?"close":"play",size:14,className:i?"sync-spin":""})," ",k,("running"===c||m)&&(0,d.jsx)("span",{className:"dotpulse",style:{marginLeft:6}})]})}}};