@rulemetric/cli 0.6.8 → 0.7.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 (280) hide show
  1. package/dist/base-command.js +4 -3
  2. package/dist/{chunk-SZ7VDCD6.js → chunk-2HK7RGZB.js} +22 -3
  3. package/dist/chunk-2HK7RGZB.js.map +7 -0
  4. package/dist/{chunk-RUCSRN7F.js → chunk-2ORJWTNZ.js} +2 -2
  5. package/dist/{chunk-SLL3OBKN.js → chunk-37LN5O7M.js} +2 -2
  6. package/dist/{chunk-RCMXTLQF.js → chunk-3LKVS6W5.js} +5 -5
  7. package/dist/{chunk-XN23W5HL.js → chunk-4KRMZLQV.js} +91 -7
  8. package/dist/chunk-4KRMZLQV.js.map +7 -0
  9. package/dist/{chunk-DAJNO4OI.js → chunk-4LYCDS2N.js} +28 -16
  10. package/dist/chunk-4LYCDS2N.js.map +7 -0
  11. package/dist/{chunk-UPXIO7CG.js → chunk-4XAWK6S2.js} +8 -8
  12. package/dist/{chunk-N5A2IQAK.js → chunk-4YAP7RT7.js} +5 -5
  13. package/dist/{chunk-QD6X4L4L.js → chunk-5BAOGNUH.js} +4 -4
  14. package/dist/chunk-5EDMGK3W.js +39 -0
  15. package/dist/chunk-5EDMGK3W.js.map +7 -0
  16. package/dist/{chunk-5ADHO5QF.js → chunk-6NBS5XFS.js} +6 -6
  17. package/dist/chunk-7LVVKQMZ.js +98 -0
  18. package/dist/chunk-7LVVKQMZ.js.map +7 -0
  19. package/dist/{chunk-PXVQLD7S.js → chunk-7NNFYWKK.js} +48 -1
  20. package/dist/chunk-7NNFYWKK.js.map +7 -0
  21. package/dist/{chunk-BBLTN35F.js → chunk-7UDETV3P.js} +49 -20
  22. package/dist/chunk-7UDETV3P.js.map +7 -0
  23. package/dist/{chunk-DTFXCHHI.js → chunk-DNKSVWMD.js} +4 -4
  24. package/dist/{chunk-6EMZI4Y3.js → chunk-EI5BHWXA.js} +437 -401
  25. package/dist/chunk-EI5BHWXA.js.map +7 -0
  26. package/dist/{chunk-HNZLEEG2.js → chunk-EJ3YAFDP.js} +4 -4
  27. package/dist/{chunk-HNZLEEG2.js.map → chunk-EJ3YAFDP.js.map} +2 -2
  28. package/dist/{chunk-YSEQWCN4.js → chunk-EYPAAGN5.js} +2 -2
  29. package/dist/{chunk-JEJ3J5J6.js → chunk-GIUBARWS.js} +2 -2
  30. package/dist/chunk-GQNJO2P2.js +102 -0
  31. package/dist/chunk-GQNJO2P2.js.map +7 -0
  32. package/dist/{chunk-CNMWYYSV.js → chunk-HZK43UCF.js} +6 -6
  33. package/dist/chunk-ILYDELUE.js +46 -0
  34. package/dist/chunk-ILYDELUE.js.map +7 -0
  35. package/dist/chunk-J6QFW4LD.js +55 -0
  36. package/dist/chunk-J6QFW4LD.js.map +7 -0
  37. package/dist/{chunk-OTOWLUOJ.js → chunk-JULOLTZS.js} +2 -2
  38. package/dist/{chunk-DR5WLIOU.js → chunk-KJKBDQ4D.js} +2 -2
  39. package/dist/{chunk-AHDRN6NE.js → chunk-OO7JDFS4.js} +5 -5
  40. package/dist/{chunk-N2X35ITW.js → chunk-OQBBVTDG.js} +11 -1
  41. package/dist/{chunk-N2X35ITW.js.map → chunk-OQBBVTDG.js.map} +2 -2
  42. package/dist/{chunk-3QH73QOQ.js → chunk-PED7L5GX.js} +2 -2
  43. package/dist/{chunk-VBGUNFKY.js → chunk-PMI56ED5.js} +5 -5
  44. package/dist/{chunk-XNNOXGP6.js → chunk-POFTPB33.js} +38 -19
  45. package/dist/chunk-POFTPB33.js.map +7 -0
  46. package/dist/{chunk-W4MZXKZ2.js → chunk-UKMLICWS.js} +2 -2
  47. package/dist/{chunk-3POYC5NA.js → chunk-XK42ZBDE.js} +3 -3
  48. package/dist/{chunk-ZSGKRCKD.js → chunk-XUV6DDBF.js} +2 -2
  49. package/dist/{chunk-LAKZUE35.js → chunk-Y3WD5CSW.js} +2 -2
  50. package/dist/{chunk-3QVMIJUL.js → chunk-YOBA3NAM.js} +5 -5
  51. package/dist/{chunk-ZRLYHBPN.js → chunk-ZUJBM6HE.js} +20 -2
  52. package/dist/chunk-ZUJBM6HE.js.map +7 -0
  53. package/dist/commands/antigravity/backfill.js +5 -4
  54. package/dist/commands/antigravity/backfill.js.map +1 -1
  55. package/dist/commands/auth/create-key.js +4 -3
  56. package/dist/commands/auth/create-key.js.map +1 -1
  57. package/dist/commands/auth/login.js +13 -9
  58. package/dist/commands/auth/login.js.map +2 -2
  59. package/dist/commands/auth/logout.js +4 -3
  60. package/dist/commands/auth/logout.js.map +1 -1
  61. package/dist/commands/auth/revoke-key.js +4 -3
  62. package/dist/commands/auth/revoke-key.js.map +1 -1
  63. package/dist/commands/auth/signup.js +13 -9
  64. package/dist/commands/auth/signup.js.map +2 -2
  65. package/dist/commands/auth/status.js +4 -3
  66. package/dist/commands/auth/status.js.map +1 -1
  67. package/dist/commands/catalog/index.js +4 -3
  68. package/dist/commands/catalog/index.js.map +1 -1
  69. package/dist/commands/catalog/recommend.js +4 -3
  70. package/dist/commands/catalog/recommend.js.map +1 -1
  71. package/dist/commands/convert.js +4 -3
  72. package/dist/commands/convert.js.map +1 -1
  73. package/dist/commands/converters.js +4 -3
  74. package/dist/commands/converters.js.map +1 -1
  75. package/dist/commands/crons/list.js +4 -3
  76. package/dist/commands/crons/list.js.map +1 -1
  77. package/dist/commands/crons/run.js +4 -3
  78. package/dist/commands/crons/run.js.map +1 -1
  79. package/dist/commands/dashboard.js +4 -3
  80. package/dist/commands/dashboard.js.map +1 -1
  81. package/dist/commands/diagnostics.js +117 -0
  82. package/dist/commands/diagnostics.js.map +7 -0
  83. package/dist/commands/eval-targets/create.js +4 -3
  84. package/dist/commands/eval-targets/create.js.map +1 -1
  85. package/dist/commands/eval-targets/list.js +4 -3
  86. package/dist/commands/eval-targets/list.js.map +1 -1
  87. package/dist/commands/evals/agent.js +44 -23
  88. package/dist/commands/evals/agent.js.map +2 -2
  89. package/dist/commands/evals/benchmark.js +5 -4
  90. package/dist/commands/evals/benchmark.js.map +1 -1
  91. package/dist/commands/evals/compare.js +4 -3
  92. package/dist/commands/evals/compare.js.map +1 -1
  93. package/dist/commands/evals/create.js +4 -3
  94. package/dist/commands/evals/create.js.map +1 -1
  95. package/dist/commands/evals/optimize-description.js +4 -3
  96. package/dist/commands/evals/optimize-description.js.map +1 -1
  97. package/dist/commands/evals/optimize.js +4 -3
  98. package/dist/commands/evals/optimize.js.map +1 -1
  99. package/dist/commands/evals/run.js +4 -3
  100. package/dist/commands/evals/run.js.map +1 -1
  101. package/dist/commands/gateway/ensure.js +58 -5
  102. package/dist/commands/gateway/ensure.js.map +2 -2
  103. package/dist/commands/hooks/install.js +76 -23
  104. package/dist/commands/hooks/install.js.map +2 -2
  105. package/dist/commands/hooks/run.js +9 -5
  106. package/dist/commands/hooks/run.js.map +2 -2
  107. package/dist/commands/hooks/uninstall.js +31 -40
  108. package/dist/commands/hooks/uninstall.js.map +2 -2
  109. package/dist/commands/import.js +4 -3
  110. package/dist/commands/import.js.map +1 -1
  111. package/dist/commands/instructions/create.js +4 -3
  112. package/dist/commands/instructions/create.js.map +1 -1
  113. package/dist/commands/instructions/delete.js +4 -3
  114. package/dist/commands/instructions/delete.js.map +1 -1
  115. package/dist/commands/instructions/fork.js +4 -3
  116. package/dist/commands/instructions/fork.js.map +1 -1
  117. package/dist/commands/instructions/get.js +4 -3
  118. package/dist/commands/instructions/get.js.map +1 -1
  119. package/dist/commands/instructions/list.js +4 -3
  120. package/dist/commands/instructions/list.js.map +1 -1
  121. package/dist/commands/instructions/promote.js +4 -3
  122. package/dist/commands/instructions/promote.js.map +1 -1
  123. package/dist/commands/instructions/pull.js +4 -3
  124. package/dist/commands/instructions/pull.js.map +1 -1
  125. package/dist/commands/instructions/upstream.js +4 -3
  126. package/dist/commands/instructions/upstream.js.map +1 -1
  127. package/dist/commands/instructions/versions.js +4 -3
  128. package/dist/commands/instructions/versions.js.map +1 -1
  129. package/dist/commands/launcher.js +4 -3
  130. package/dist/commands/launcher.js.map +1 -1
  131. package/dist/commands/org/current.js +4 -3
  132. package/dist/commands/org/current.js.map +1 -1
  133. package/dist/commands/org/list.js +4 -3
  134. package/dist/commands/org/list.js.map +1 -1
  135. package/dist/commands/org/switch.js +4 -3
  136. package/dist/commands/org/switch.js.map +1 -1
  137. package/dist/commands/packs/add-instruction.js +4 -3
  138. package/dist/commands/packs/add-instruction.js.map +1 -1
  139. package/dist/commands/packs/apply.js +4 -3
  140. package/dist/commands/packs/apply.js.map +1 -1
  141. package/dist/commands/packs/create.js +4 -3
  142. package/dist/commands/packs/create.js.map +1 -1
  143. package/dist/commands/packs/fork.js +4 -3
  144. package/dist/commands/packs/fork.js.map +1 -1
  145. package/dist/commands/packs/get.js +4 -3
  146. package/dist/commands/packs/get.js.map +1 -1
  147. package/dist/commands/packs/list.js +4 -3
  148. package/dist/commands/packs/list.js.map +1 -1
  149. package/dist/commands/packs/remove-instruction.js +4 -3
  150. package/dist/commands/packs/remove-instruction.js.map +1 -1
  151. package/dist/commands/proxy/env.js +7 -4
  152. package/dist/commands/proxy/env.js.map +1 -1
  153. package/dist/commands/proxy/logs.js +4 -3
  154. package/dist/commands/proxy/logs.js.map +1 -1
  155. package/dist/commands/proxy/restart.js +4 -3
  156. package/dist/commands/proxy/restart.js.map +1 -1
  157. package/dist/commands/proxy/setup.js +20 -14
  158. package/dist/commands/proxy/setup.js.map +2 -2
  159. package/dist/commands/proxy/start.js +18 -14
  160. package/dist/commands/proxy/start.js.map +2 -2
  161. package/dist/commands/proxy/status.js +16 -13
  162. package/dist/commands/proxy/status.js.map +2 -2
  163. package/dist/commands/proxy/stop.js +21 -12
  164. package/dist/commands/proxy/stop.js.map +2 -2
  165. package/dist/commands/research/backfill.js +5 -4
  166. package/dist/commands/research/backfill.js.map +1 -1
  167. package/dist/commands/research/tail-transcript.js +5 -4
  168. package/dist/commands/research/tail-transcript.js.map +1 -1
  169. package/dist/commands/service/install.js +6 -6
  170. package/dist/commands/service/status.js +4 -3
  171. package/dist/commands/service/status.js.map +1 -1
  172. package/dist/commands/service/uninstall.js +4 -3
  173. package/dist/commands/service/uninstall.js.map +1 -1
  174. package/dist/commands/sessions/analyze.js +4 -3
  175. package/dist/commands/sessions/analyze.js.map +1 -1
  176. package/dist/commands/sessions/end.js +4 -3
  177. package/dist/commands/sessions/end.js.map +1 -1
  178. package/dist/commands/sessions/import.js +4 -3
  179. package/dist/commands/sessions/import.js.map +1 -1
  180. package/dist/commands/sessions/list.js +4 -3
  181. package/dist/commands/sessions/list.js.map +1 -1
  182. package/dist/commands/sessions/start.js +4 -3
  183. package/dist/commands/sessions/start.js.map +1 -1
  184. package/dist/commands/setup.js +10 -6
  185. package/dist/commands/setup.js.map +1 -1
  186. package/dist/commands/skills/export-approved.js +4 -3
  187. package/dist/commands/skills/export-approved.js.map +1 -1
  188. package/dist/commands/skills/install.js +4 -3
  189. package/dist/commands/skills/install.js.map +1 -1
  190. package/dist/commands/skills/list.js +4 -3
  191. package/dist/commands/skills/list.js.map +1 -1
  192. package/dist/commands/skills/publish.js +4 -3
  193. package/dist/commands/skills/publish.js.map +1 -1
  194. package/dist/commands/skills/search.js +4 -3
  195. package/dist/commands/skills/search.js.map +1 -1
  196. package/dist/commands/skills/update.js +4 -3
  197. package/dist/commands/skills/update.js.map +1 -1
  198. package/dist/commands/suggestions/accept.js +4 -3
  199. package/dist/commands/suggestions/accept.js.map +1 -1
  200. package/dist/commands/suggestions/dismiss.js +4 -3
  201. package/dist/commands/suggestions/dismiss.js.map +1 -1
  202. package/dist/commands/suggestions/list.js +4 -3
  203. package/dist/commands/suggestions/list.js.map +1 -1
  204. package/dist/commands/suggestions/refresh.js +4 -3
  205. package/dist/commands/suggestions/refresh.js.map +1 -1
  206. package/dist/dashboard/Dashboard.js +16 -16
  207. package/dist/dashboard/data.js +2 -2
  208. package/dist/dashboard/launcher/ActiveJobsList.js +2 -2
  209. package/dist/dashboard/launcher/LauncherOverlay.js +7 -7
  210. package/dist/dashboard/launcher/NewLaunchForm.js +2 -2
  211. package/dist/dashboard/launcher/api.js +2 -2
  212. package/dist/dashboard/launcher/useLaunchJobs.js +3 -3
  213. package/dist/lib/active-org-refresh.js +2 -2
  214. package/dist/lib/agent-loop.js +20 -18
  215. package/dist/lib/antigravity-transcript.js +2 -2
  216. package/dist/lib/api-client.js +1 -1
  217. package/dist/lib/diagnostics.js +12 -0
  218. package/dist/lib/diagnostics.js.map +7 -0
  219. package/dist/lib/ensure-api-key.js +3 -3
  220. package/dist/lib/eval-benchmark.js +2 -2
  221. package/dist/lib/eval-conversation-handler.js +2 -2
  222. package/dist/lib/gateway-entry.js +39 -1
  223. package/dist/lib/gateway-entry.js.map +2 -2
  224. package/dist/lib/gateway-identity.js +16 -0
  225. package/dist/lib/gateway-identity.js.map +7 -0
  226. package/dist/lib/gateway-lifecycle.js +9 -3
  227. package/dist/lib/gateway.js +3 -1
  228. package/dist/lib/handlers/cron-suggest-instructions.js +3 -3
  229. package/dist/lib/handlers/process-announcement.js +3 -3
  230. package/dist/lib/handlers/process-changelog.js +3 -3
  231. package/dist/lib/handlers/process-conversation.js +3 -3
  232. package/dist/lib/handlers/process-eval.js +3 -3
  233. package/dist/lib/handlers/process-insights.js +3 -3
  234. package/dist/lib/handlers/process-launch.js +2 -2
  235. package/dist/lib/handlers/process-run-cleanup.js +2 -2
  236. package/dist/lib/handlers/process-session-goal.js +2 -2
  237. package/dist/lib/hooks-config.js +14 -1
  238. package/dist/lib/manual-tasks.js +6 -6
  239. package/dist/lib/pid-identity.js +14 -0
  240. package/dist/lib/pid-identity.js.map +7 -0
  241. package/dist/lib/proxy-respawn.js +12 -0
  242. package/dist/lib/proxy-respawn.js.map +7 -0
  243. package/dist/lib/research-client.js +2 -2
  244. package/dist/lib/setup-steps.js +7 -4
  245. package/dist/lib/statusline-shim.js +3 -1
  246. package/dist/lib/telemetry.js +4 -2
  247. package/dist/lib/terminal-target-heartbeat.js +2 -2
  248. package/oclif.manifest.json +34 -1
  249. package/package.json +6 -6
  250. package/dist/chunk-6EMZI4Y3.js.map +0 -7
  251. package/dist/chunk-BBLTN35F.js.map +0 -7
  252. package/dist/chunk-DAJNO4OI.js.map +0 -7
  253. package/dist/chunk-PXVQLD7S.js.map +0 -7
  254. package/dist/chunk-SZ7VDCD6.js.map +0 -7
  255. package/dist/chunk-TX2HKJLA.js +0 -55
  256. package/dist/chunk-TX2HKJLA.js.map +0 -7
  257. package/dist/chunk-XN23W5HL.js.map +0 -7
  258. package/dist/chunk-XNNOXGP6.js.map +0 -7
  259. package/dist/chunk-ZRLYHBPN.js.map +0 -7
  260. /package/dist/{chunk-RUCSRN7F.js.map → chunk-2ORJWTNZ.js.map} +0 -0
  261. /package/dist/{chunk-SLL3OBKN.js.map → chunk-37LN5O7M.js.map} +0 -0
  262. /package/dist/{chunk-RCMXTLQF.js.map → chunk-3LKVS6W5.js.map} +0 -0
  263. /package/dist/{chunk-UPXIO7CG.js.map → chunk-4XAWK6S2.js.map} +0 -0
  264. /package/dist/{chunk-N5A2IQAK.js.map → chunk-4YAP7RT7.js.map} +0 -0
  265. /package/dist/{chunk-QD6X4L4L.js.map → chunk-5BAOGNUH.js.map} +0 -0
  266. /package/dist/{chunk-5ADHO5QF.js.map → chunk-6NBS5XFS.js.map} +0 -0
  267. /package/dist/{chunk-DTFXCHHI.js.map → chunk-DNKSVWMD.js.map} +0 -0
  268. /package/dist/{chunk-YSEQWCN4.js.map → chunk-EYPAAGN5.js.map} +0 -0
  269. /package/dist/{chunk-JEJ3J5J6.js.map → chunk-GIUBARWS.js.map} +0 -0
  270. /package/dist/{chunk-CNMWYYSV.js.map → chunk-HZK43UCF.js.map} +0 -0
  271. /package/dist/{chunk-OTOWLUOJ.js.map → chunk-JULOLTZS.js.map} +0 -0
  272. /package/dist/{chunk-DR5WLIOU.js.map → chunk-KJKBDQ4D.js.map} +0 -0
  273. /package/dist/{chunk-AHDRN6NE.js.map → chunk-OO7JDFS4.js.map} +0 -0
  274. /package/dist/{chunk-3QH73QOQ.js.map → chunk-PED7L5GX.js.map} +0 -0
  275. /package/dist/{chunk-VBGUNFKY.js.map → chunk-PMI56ED5.js.map} +0 -0
  276. /package/dist/{chunk-W4MZXKZ2.js.map → chunk-UKMLICWS.js.map} +0 -0
  277. /package/dist/{chunk-3POYC5NA.js.map → chunk-XK42ZBDE.js.map} +0 -0
  278. /package/dist/{chunk-ZSGKRCKD.js.map → chunk-XUV6DDBF.js.map} +0 -0
  279. /package/dist/{chunk-LAKZUE35.js.map → chunk-Y3WD5CSW.js.map} +0 -0
  280. /package/dist/{chunk-3QVMIJUL.js.map → chunk-YOBA3NAM.js.map} +0 -0
@@ -480,137 +480,157 @@ var cliSetupEvents = pgTable15("cli_setup_events", {
480
480
  index12("idx_cli_setup_events_device").on(table.deviceId, table.createdAt)
481
481
  ]);
482
482
 
483
- // ../../packages/db/dist/schema/tables/eval-targets.js
484
- import { pgTable as pgTable16, text as text16, timestamp as timestamp16, jsonb as jsonb14, uuid as uuid16, integer as integer7, index as index13 } from "drizzle-orm/pg-core";
485
- var evalTargets = pgTable16("eval_targets", {
486
- id: uuid16("id").primaryKey().defaultRandom(),
487
- userId: uuid16("user_id").notNull(),
488
- name: text16("name").notNull(),
489
- type: text16("type").notNull(),
490
- content: text16("content").notNull(),
491
- description: text16("description").notNull().default(""),
492
- metadata: jsonb14("metadata").notNull().default({}),
493
- version: integer7("version").notNull().default(1),
494
- parentId: uuid16("parent_id").references(() => evalTargets.id, { onDelete: "set null" }),
495
- createdAt: timestamp16("created_at", { withTimezone: true }).defaultNow(),
496
- updatedAt: timestamp16("updated_at", { withTimezone: true }).defaultNow()
497
- }, (table) => [
498
- index13("eval_targets_name_user_idx").on(table.name, table.userId),
499
- index13("idx_eval_targets_user").on(table.userId),
500
- index13("idx_eval_targets_type").on(table.type),
501
- index13("idx_eval_targets_parent").on(table.parentId)
502
- ]);
503
- var evals = pgTable16("evals", {
504
- id: uuid16("id").primaryKey().defaultRandom(),
505
- evalTargetId: uuid16("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
506
- name: text16("name").notNull(),
507
- prompt: text16("prompt").notNull(),
508
- expectedOutput: text16("expected_output").notNull().default(""),
509
- files: jsonb14("files").notNull().default([]),
510
- expectations: jsonb14("expectations").notNull().default([]),
511
- createdAt: timestamp16("created_at", { withTimezone: true }).defaultNow(),
512
- updatedAt: timestamp16("updated_at", { withTimezone: true }).defaultNow()
513
- }, (table) => [
514
- index13("idx_evals_target").on(table.evalTargetId)
515
- ]);
516
- var evalRuns = pgTable16("eval_runs", {
483
+ // ../../packages/db/dist/schema/tables/cli-error-events.js
484
+ import { pgTable as pgTable16, text as text16, integer as integer7, boolean as boolean8, timestamp as timestamp16, jsonb as jsonb14, uuid as uuid16, index as index13 } from "drizzle-orm/pg-core";
485
+ var cliErrorEvents = pgTable16("cli_error_events", {
517
486
  id: uuid16("id").primaryKey().defaultRandom(),
518
- evalId: uuid16("eval_id").notNull().references(() => evals.id, { onDelete: "cascade" }),
519
- evalTargetId: uuid16("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
520
- evalTargetVersion: integer7("eval_target_version").notNull(),
521
- configuration: text16("configuration").notNull(),
522
- runNumber: integer7("run_number").notNull().default(1),
523
- iteration: integer7("iteration").notNull().default(1),
524
- status: text16("status").notNull().default("completed"),
525
- outputs: jsonb14("outputs").notNull().default({}),
526
- timing: jsonb14("timing").notNull().default({}),
527
- grading: jsonb14("grading").notNull().default({}),
528
- comparison: jsonb14("comparison"),
529
- createdAt: timestamp16("created_at", { withTimezone: true }).defaultNow()
487
+ deviceId: text16("device_id"),
488
+ event: text16("event").notNull(),
489
+ command: text16("command"),
490
+ statusCode: integer7("status_code"),
491
+ message: text16("message"),
492
+ cliVersion: text16("cli_version"),
493
+ os: text16("os"),
494
+ nodeVersion: text16("node_version"),
495
+ proxied: boolean8("proxied"),
496
+ props: jsonb14("props").notNull().default({}),
497
+ createdAt: timestamp16("created_at", { withTimezone: true }).notNull().defaultNow()
530
498
  }, (table) => [
531
- index13("idx_eval_runs_eval").on(table.evalId),
532
- index13("idx_eval_runs_target").on(table.evalTargetId),
533
- index13("idx_eval_runs_iteration").on(table.evalTargetId, table.iteration)
499
+ index13("idx_cli_error_events_created").on(table.createdAt),
500
+ index13("idx_cli_error_events_device").on(table.deviceId, table.createdAt)
534
501
  ]);
535
- var benchmarks = pgTable16("benchmarks", {
536
- id: uuid16("id").primaryKey().defaultRandom(),
537
- evalTargetId: uuid16("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
538
- iteration: integer7("iteration").notNull().default(1),
539
- runSummary: jsonb14("run_summary").notNull().default({}),
540
- notes: jsonb14("notes").notNull().default([]),
541
- feedback: jsonb14("feedback"),
542
- createdAt: timestamp16("created_at", { withTimezone: true }).defaultNow()
502
+
503
+ // ../../packages/db/dist/schema/tables/eval-targets.js
504
+ import { pgTable as pgTable17, text as text17, timestamp as timestamp17, jsonb as jsonb15, uuid as uuid17, integer as integer8, index as index14 } from "drizzle-orm/pg-core";
505
+ var evalTargets = pgTable17("eval_targets", {
506
+ id: uuid17("id").primaryKey().defaultRandom(),
507
+ userId: uuid17("user_id").notNull(),
508
+ name: text17("name").notNull(),
509
+ type: text17("type").notNull(),
510
+ content: text17("content").notNull(),
511
+ description: text17("description").notNull().default(""),
512
+ metadata: jsonb15("metadata").notNull().default({}),
513
+ version: integer8("version").notNull().default(1),
514
+ parentId: uuid17("parent_id").references(() => evalTargets.id, { onDelete: "set null" }),
515
+ createdAt: timestamp17("created_at", { withTimezone: true }).defaultNow(),
516
+ updatedAt: timestamp17("updated_at", { withTimezone: true }).defaultNow()
543
517
  }, (table) => [
544
- index13("idx_benchmarks_target").on(table.evalTargetId)
518
+ index14("eval_targets_name_user_idx").on(table.name, table.userId),
519
+ index14("idx_eval_targets_user").on(table.userId),
520
+ index14("idx_eval_targets_type").on(table.type),
521
+ index14("idx_eval_targets_parent").on(table.parentId)
545
522
  ]);
546
-
547
- // ../../packages/db/dist/schema/tables/optimization.js
548
- import { pgTable as pgTable17, text as text17, timestamp as timestamp17, jsonb as jsonb15, uuid as uuid17, integer as integer8, index as index14, real } from "drizzle-orm/pg-core";
549
- var triggerEvals = pgTable17("trigger_evals", {
523
+ var evals = pgTable17("evals", {
550
524
  id: uuid17("id").primaryKey().defaultRandom(),
551
525
  evalTargetId: uuid17("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
552
- userId: uuid17("user_id").notNull(),
553
- queries: jsonb15("queries").notNull().default([]),
554
- status: text17("status").notNull().default("pending_review"),
555
- trainIndices: integer8("train_indices").array().default([]),
556
- testIndices: integer8("test_indices").array().default([]),
526
+ name: text17("name").notNull(),
527
+ prompt: text17("prompt").notNull(),
528
+ expectedOutput: text17("expected_output").notNull().default(""),
529
+ files: jsonb15("files").notNull().default([]),
530
+ expectations: jsonb15("expectations").notNull().default([]),
557
531
  createdAt: timestamp17("created_at", { withTimezone: true }).defaultNow(),
558
532
  updatedAt: timestamp17("updated_at", { withTimezone: true }).defaultNow()
559
533
  }, (table) => [
560
- index14("idx_trigger_evals_target").on(table.evalTargetId),
561
- index14("idx_trigger_evals_user").on(table.userId)
534
+ index14("idx_evals_target").on(table.evalTargetId)
562
535
  ]);
563
- var optimizationRuns = pgTable17("optimization_runs", {
536
+ var evalRuns = pgTable17("eval_runs", {
564
537
  id: uuid17("id").primaryKey().defaultRandom(),
538
+ evalId: uuid17("eval_id").notNull().references(() => evals.id, { onDelete: "cascade" }),
565
539
  evalTargetId: uuid17("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
566
- userId: uuid17("user_id").notNull(),
567
- type: text17("type").notNull(),
568
- iteration: integer8("iteration").notNull(),
569
- inputVersion: integer8("input_version").notNull(),
570
- outputVersion: integer8("output_version"),
540
+ evalTargetVersion: integer8("eval_target_version").notNull(),
541
+ configuration: text17("configuration").notNull(),
542
+ runNumber: integer8("run_number").notNull().default(1),
543
+ iteration: integer8("iteration").notNull().default(1),
544
+ status: text17("status").notNull().default("completed"),
545
+ outputs: jsonb15("outputs").notNull().default({}),
546
+ timing: jsonb15("timing").notNull().default({}),
547
+ grading: jsonb15("grading").notNull().default({}),
548
+ comparison: jsonb15("comparison"),
549
+ createdAt: timestamp17("created_at", { withTimezone: true }).defaultNow()
550
+ }, (table) => [
551
+ index14("idx_eval_runs_eval").on(table.evalId),
552
+ index14("idx_eval_runs_target").on(table.evalTargetId),
553
+ index14("idx_eval_runs_iteration").on(table.evalTargetId, table.iteration)
554
+ ]);
555
+ var benchmarks = pgTable17("benchmarks", {
556
+ id: uuid17("id").primaryKey().defaultRandom(),
557
+ evalTargetId: uuid17("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
558
+ iteration: integer8("iteration").notNull().default(1),
559
+ runSummary: jsonb15("run_summary").notNull().default({}),
560
+ notes: jsonb15("notes").notNull().default([]),
561
+ feedback: jsonb15("feedback"),
562
+ createdAt: timestamp17("created_at", { withTimezone: true }).defaultNow()
563
+ }, (table) => [
564
+ index14("idx_benchmarks_target").on(table.evalTargetId)
565
+ ]);
566
+
567
+ // ../../packages/db/dist/schema/tables/optimization.js
568
+ import { pgTable as pgTable18, text as text18, timestamp as timestamp18, jsonb as jsonb16, uuid as uuid18, integer as integer9, index as index15, real } from "drizzle-orm/pg-core";
569
+ var triggerEvals = pgTable18("trigger_evals", {
570
+ id: uuid18("id").primaryKey().defaultRandom(),
571
+ evalTargetId: uuid18("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
572
+ userId: uuid18("user_id").notNull(),
573
+ queries: jsonb16("queries").notNull().default([]),
574
+ status: text18("status").notNull().default("pending_review"),
575
+ trainIndices: integer9("train_indices").array().default([]),
576
+ testIndices: integer9("test_indices").array().default([]),
577
+ createdAt: timestamp18("created_at", { withTimezone: true }).defaultNow(),
578
+ updatedAt: timestamp18("updated_at", { withTimezone: true }).defaultNow()
579
+ }, (table) => [
580
+ index15("idx_trigger_evals_target").on(table.evalTargetId),
581
+ index15("idx_trigger_evals_user").on(table.userId)
582
+ ]);
583
+ var optimizationRuns = pgTable18("optimization_runs", {
584
+ id: uuid18("id").primaryKey().defaultRandom(),
585
+ evalTargetId: uuid18("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
586
+ userId: uuid18("user_id").notNull(),
587
+ type: text18("type").notNull(),
588
+ iteration: integer9("iteration").notNull(),
589
+ inputVersion: integer9("input_version").notNull(),
590
+ outputVersion: integer9("output_version"),
571
591
  trainScore: real("train_score"),
572
592
  testScore: real("test_score"),
573
- analysis: jsonb15("analysis").notNull().default({}),
574
- status: text17("status").notNull().default("running"),
575
- createdAt: timestamp17("created_at", { withTimezone: true }).defaultNow()
593
+ analysis: jsonb16("analysis").notNull().default({}),
594
+ status: text18("status").notNull().default("running"),
595
+ createdAt: timestamp18("created_at", { withTimezone: true }).defaultNow()
576
596
  }, (table) => [
577
- index14("idx_optimization_runs_target").on(table.evalTargetId),
578
- index14("idx_optimization_runs_user").on(table.userId)
597
+ index15("idx_optimization_runs_target").on(table.evalTargetId),
598
+ index15("idx_optimization_runs_user").on(table.userId)
579
599
  ]);
580
600
 
581
601
  // ../../packages/db/dist/schema/tables/context-snapshots.js
582
- import { pgTable as pgTable18, text as text18, timestamp as timestamp18, jsonb as jsonb16, uuid as uuid18, integer as integer9, real as real2, index as index15, uniqueIndex as uniqueIndex7 } from "drizzle-orm/pg-core";
583
- var contextSnapshots = pgTable18("context_snapshots", {
584
- id: uuid18("id").primaryKey().defaultRandom(),
585
- sessionId: uuid18("session_id").references(() => sessions.id, { onDelete: "cascade" }),
586
- userId: uuid18("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
587
- sequence: integer9("sequence").notNull().default(0),
588
- provider: text18("provider").notNull(),
589
- model: text18("model").notNull(),
590
- systemPrompt: text18("system_prompt").notNull(),
591
- injectedInstructions: jsonb16("injected_instructions").notNull().default([]),
592
- messagesSummary: jsonb16("messages_summary").notNull(),
593
- tools: jsonb16("tools").notNull().default([]),
602
+ import { pgTable as pgTable19, text as text19, timestamp as timestamp19, jsonb as jsonb17, uuid as uuid19, integer as integer10, real as real2, index as index16, uniqueIndex as uniqueIndex7 } from "drizzle-orm/pg-core";
603
+ var contextSnapshots = pgTable19("context_snapshots", {
604
+ id: uuid19("id").primaryKey().defaultRandom(),
605
+ sessionId: uuid19("session_id").references(() => sessions.id, { onDelete: "cascade" }),
606
+ userId: uuid19("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
607
+ sequence: integer10("sequence").notNull().default(0),
608
+ provider: text19("provider").notNull(),
609
+ model: text19("model").notNull(),
610
+ systemPrompt: text19("system_prompt").notNull(),
611
+ injectedInstructions: jsonb17("injected_instructions").notNull().default([]),
612
+ messagesSummary: jsonb17("messages_summary").notNull(),
613
+ tools: jsonb17("tools").notNull().default([]),
594
614
  // Deprecated: use content_blobs via tools_hash
595
- systemHash: text18("system_hash").notNull(),
596
- requestHash: text18("request_hash").notNull().default(""),
597
- toolsHash: text18("tools_hash"),
598
- injectedHash: text18("injected_hash"),
599
- messagesDelta: jsonb16("messages_delta").default([]),
615
+ systemHash: text19("system_hash").notNull(),
616
+ requestHash: text19("request_hash").notNull().default(""),
617
+ toolsHash: text19("tools_hash"),
618
+ injectedHash: text19("injected_hash"),
619
+ messagesDelta: jsonb17("messages_delta").default([]),
600
620
  // Storage pointer set when messages_delta is offloaded to the snapshot-deltas
601
621
  // bucket (Stage 1+). NULL = inline (messages_delta populated) OR pruned (both
602
622
  // NULL — see 00101). docs/plans/2026-06-24-messages-delta-object-storage-offload.md
603
- messagesDeltaRef: text18("messages_delta_ref"),
604
- maxTokens: integer9("max_tokens"),
623
+ messagesDeltaRef: text19("messages_delta_ref"),
624
+ maxTokens: integer10("max_tokens"),
605
625
  temperature: real2("temperature"),
606
- estimatedTokens: integer9("estimated_tokens"),
607
- capturedAt: timestamp18("captured_at", { withTimezone: true }).notNull().defaultNow(),
608
- metadata: jsonb16("metadata").default({})
626
+ estimatedTokens: integer10("estimated_tokens"),
627
+ capturedAt: timestamp19("captured_at", { withTimezone: true }).notNull().defaultNow(),
628
+ metadata: jsonb17("metadata").default({})
609
629
  }, (table) => [
610
- index15("idx_context_snapshots_session").on(table.sessionId),
611
- index15("idx_context_snapshots_user").on(table.userId),
612
- index15("idx_context_snapshots_hash").on(table.systemHash),
613
- index15("idx_context_snapshots_request_hash").on(table.requestHash),
630
+ index16("idx_context_snapshots_session").on(table.sessionId),
631
+ index16("idx_context_snapshots_user").on(table.userId),
632
+ index16("idx_context_snapshots_hash").on(table.systemHash),
633
+ index16("idx_context_snapshots_request_hash").on(table.requestHash),
614
634
  uniqueIndex7("idx_snapshots_session_request").on(table.sessionId, table.requestHash),
615
635
  // Concurrent snapshot POSTs for one session must not reuse a sequence — stops
616
636
  // the live duplicate-sequence corruption. Built via migration 00095.
@@ -620,416 +640,416 @@ var contextSnapshots = pgTable18("context_snapshots", {
620
640
  // WHERE user_id ORDER BY session_id, captured_at DESC). Matches the ORDER BY so
621
641
  // the planner drops the Incremental Sort (the ~11s-max, temp-spill-prone step);
622
642
  // verified 60.6ms -> 26.3ms. Built CONCURRENTLY via migration 00106.
623
- index15("idx_context_snapshots_user_session_captured").on(table.userId, table.sessionId, table.capturedAt.desc())
643
+ index16("idx_context_snapshots_user_session_captured").on(table.userId, table.sessionId, table.capturedAt.desc())
624
644
  ]);
625
645
 
626
646
  // ../../packages/db/dist/schema/tables/content-blobs.js
627
- import { pgTable as pgTable19, text as text19, timestamp as timestamp19, jsonb as jsonb17, integer as integer10, index as index16 } from "drizzle-orm/pg-core";
628
- var contentBlobs = pgTable19("content_blobs", {
629
- hash: text19("hash").primaryKey(),
630
- contentType: text19("content_type").notNull(),
631
- content: jsonb17("content").notNull(),
632
- sizeBytes: integer10("size_bytes").notNull().default(0),
633
- createdAt: timestamp19("created_at", { withTimezone: true }).defaultNow()
647
+ import { pgTable as pgTable20, text as text20, timestamp as timestamp20, jsonb as jsonb18, integer as integer11, index as index17 } from "drizzle-orm/pg-core";
648
+ var contentBlobs = pgTable20("content_blobs", {
649
+ hash: text20("hash").primaryKey(),
650
+ contentType: text20("content_type").notNull(),
651
+ content: jsonb18("content").notNull(),
652
+ sizeBytes: integer11("size_bytes").notNull().default(0),
653
+ createdAt: timestamp20("created_at", { withTimezone: true }).defaultNow()
634
654
  }, (table) => [
635
- index16("idx_content_blobs_type").on(table.contentType)
655
+ index17("idx_content_blobs_type").on(table.contentType)
636
656
  ]);
637
657
 
638
658
  // ../../packages/db/dist/schema/tables/eval-jobs.js
639
- import { pgTable as pgTable20, text as text20, timestamp as timestamp20, jsonb as jsonb18, uuid as uuid19, index as index17, integer as integer11, bigint as bigint2 } from "drizzle-orm/pg-core";
640
- var evalJobs = pgTable20("eval_jobs", {
641
- id: uuid19("id").primaryKey().defaultRandom(),
642
- userId: uuid19("user_id").notNull(),
643
- evalTargetId: uuid19("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
644
- status: text20("status").notNull().default("pending"),
645
- config: jsonb18("config").notNull().default({}),
646
- progress: jsonb18("progress").notNull().default({}),
647
- result: jsonb18("result"),
648
- error: text20("error"),
649
- attempts: integer11("attempts").notNull().default(0),
650
- graphileJobId: bigint2("graphile_job_id", { mode: "number" }),
651
- taskKind: text20("task_kind"),
652
- payload: jsonb18("payload"),
653
- claimedBy: text20("claimed_by"),
654
- claimedAt: timestamp20("claimed_at", { withTimezone: true }),
655
- leaseExpiresAt: timestamp20("lease_expires_at", { withTimezone: true }),
656
- createdAt: timestamp20("created_at", { withTimezone: true }).defaultNow(),
657
- updatedAt: timestamp20("updated_at", { withTimezone: true }).defaultNow(),
658
- completedAt: timestamp20("completed_at", { withTimezone: true })
659
- }, (table) => [
660
- index17("idx_eval_jobs_user").on(table.userId),
661
- index17("idx_eval_jobs_target").on(table.evalTargetId),
662
- index17("idx_eval_jobs_status").on(table.status),
663
- index17("idx_eval_jobs_pending").on(table.userId, table.status)
664
- ]);
665
-
666
- // ../../packages/db/dist/schema/tables/agent-jobs.js
667
- import { pgTable as pgTable21, text as text21, timestamp as timestamp21, jsonb as jsonb19, uuid as uuid20, integer as integer12, index as index18 } from "drizzle-orm/pg-core";
668
- var agentJobs = pgTable21("agent_jobs", {
659
+ import { pgTable as pgTable21, text as text21, timestamp as timestamp21, jsonb as jsonb19, uuid as uuid20, index as index18, integer as integer12, bigint as bigint2 } from "drizzle-orm/pg-core";
660
+ var evalJobs = pgTable21("eval_jobs", {
669
661
  id: uuid20("id").primaryKey().defaultRandom(),
670
662
  userId: uuid20("user_id").notNull(),
671
- taskKind: text21("task_kind").notNull(),
663
+ evalTargetId: uuid20("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
672
664
  status: text21("status").notNull().default("pending"),
673
- payload: jsonb19("payload").notNull(),
674
- dedupeKey: text21("dedupe_key"),
665
+ config: jsonb19("config").notNull().default({}),
666
+ progress: jsonb19("progress").notNull().default({}),
675
667
  result: jsonb19("result"),
676
668
  error: text21("error"),
677
669
  attempts: integer12("attempts").notNull().default(0),
670
+ graphileJobId: bigint2("graphile_job_id", { mode: "number" }),
671
+ taskKind: text21("task_kind"),
672
+ payload: jsonb19("payload"),
678
673
  claimedBy: text21("claimed_by"),
679
674
  claimedAt: timestamp21("claimed_at", { withTimezone: true }),
680
675
  leaseExpiresAt: timestamp21("lease_expires_at", { withTimezone: true }),
681
- createdAt: timestamp21("created_at", { withTimezone: true }).notNull().defaultNow(),
682
- updatedAt: timestamp21("updated_at", { withTimezone: true }).notNull().defaultNow(),
676
+ createdAt: timestamp21("created_at", { withTimezone: true }).defaultNow(),
677
+ updatedAt: timestamp21("updated_at", { withTimezone: true }).defaultNow(),
683
678
  completedAt: timestamp21("completed_at", { withTimezone: true })
684
679
  }, (table) => [
685
- index18("idx_agent_jobs_claim").on(table.userId, table.status, table.taskKind, table.createdAt),
686
- index18("idx_agent_jobs_dedupe").on(table.userId, table.taskKind, table.dedupeKey)
680
+ index18("idx_eval_jobs_user").on(table.userId),
681
+ index18("idx_eval_jobs_target").on(table.evalTargetId),
682
+ index18("idx_eval_jobs_status").on(table.status),
683
+ index18("idx_eval_jobs_pending").on(table.userId, table.status)
687
684
  ]);
688
685
 
689
- // ../../packages/db/dist/schema/tables/insights.js
690
- import { pgTable as pgTable22, text as text22, timestamp as timestamp22, jsonb as jsonb20, uuid as uuid21, index as index19, uniqueIndex as uniqueIndex8, integer as integer13, bigint as bigint3 } from "drizzle-orm/pg-core";
691
- var insightsJobs = pgTable22("insights_jobs", {
686
+ // ../../packages/db/dist/schema/tables/agent-jobs.js
687
+ import { pgTable as pgTable22, text as text22, timestamp as timestamp22, jsonb as jsonb20, uuid as uuid21, integer as integer13, index as index19 } from "drizzle-orm/pg-core";
688
+ var agentJobs = pgTable22("agent_jobs", {
692
689
  id: uuid21("id").primaryKey().defaultRandom(),
693
690
  userId: uuid21("user_id").notNull(),
691
+ taskKind: text22("task_kind").notNull(),
694
692
  status: text22("status").notNull().default("pending"),
695
- projectPath: text22("project_path"),
696
- // Canonical project identity (project_path-keying fragments one project across
697
- // worktrees/subdirs/cwds — migration 00104). Nullable: legacy/unlinked rows fall
698
- // back to project_path. Stamped at enqueue when resolvable.
699
- projectId: uuid21("project_id").references(() => projects.id, { onDelete: "set null" }),
700
- config: jsonb20("config").notNull().default({}),
701
- progress: jsonb20("progress").notNull().default({}),
693
+ payload: jsonb20("payload").notNull(),
694
+ dedupeKey: text22("dedupe_key"),
702
695
  result: jsonb20("result"),
703
696
  error: text22("error"),
704
697
  attempts: integer13("attempts").notNull().default(0),
705
- graphileJobId: bigint3("graphile_job_id", { mode: "number" }),
706
- taskKind: text22("task_kind"),
707
- payload: jsonb20("payload"),
708
698
  claimedBy: text22("claimed_by"),
709
699
  claimedAt: timestamp22("claimed_at", { withTimezone: true }),
710
700
  leaseExpiresAt: timestamp22("lease_expires_at", { withTimezone: true }),
711
- createdAt: timestamp22("created_at", { withTimezone: true }).defaultNow(),
712
- updatedAt: timestamp22("updated_at", { withTimezone: true }).defaultNow(),
701
+ createdAt: timestamp22("created_at", { withTimezone: true }).notNull().defaultNow(),
702
+ updatedAt: timestamp22("updated_at", { withTimezone: true }).notNull().defaultNow(),
713
703
  completedAt: timestamp22("completed_at", { withTimezone: true })
714
704
  }, (table) => [
715
- index19("idx_insights_jobs_user").on(table.userId),
716
- index19("idx_insights_jobs_status").on(table.status),
717
- index19("idx_insights_jobs_pending").on(table.userId, table.status),
718
- index19("idx_insights_jobs_project").on(table.projectId)
705
+ index19("idx_agent_jobs_claim").on(table.userId, table.status, table.taskKind, table.createdAt),
706
+ index19("idx_agent_jobs_dedupe").on(table.userId, table.taskKind, table.dedupeKey)
719
707
  ]);
720
- var insightsReports = pgTable22("insights_reports", {
721
- id: uuid21("id").primaryKey().defaultRandom(),
722
- userId: uuid21("user_id").notNull(),
723
- projectPath: text22("project_path"),
724
- data: jsonb20("data").notNull(),
725
- reportHtml: text22("report_html"),
726
- createdAt: timestamp22("created_at", { withTimezone: true }).defaultNow()
708
+
709
+ // ../../packages/db/dist/schema/tables/insights.js
710
+ import { pgTable as pgTable23, text as text23, timestamp as timestamp23, jsonb as jsonb21, uuid as uuid22, index as index20, uniqueIndex as uniqueIndex8, integer as integer14, bigint as bigint3 } from "drizzle-orm/pg-core";
711
+ var insightsJobs = pgTable23("insights_jobs", {
712
+ id: uuid22("id").primaryKey().defaultRandom(),
713
+ userId: uuid22("user_id").notNull(),
714
+ status: text23("status").notNull().default("pending"),
715
+ projectPath: text23("project_path"),
716
+ // Canonical project identity (project_path-keying fragments one project across
717
+ // worktrees/subdirs/cwds — migration 00104). Nullable: legacy/unlinked rows fall
718
+ // back to project_path. Stamped at enqueue when resolvable.
719
+ projectId: uuid22("project_id").references(() => projects.id, { onDelete: "set null" }),
720
+ config: jsonb21("config").notNull().default({}),
721
+ progress: jsonb21("progress").notNull().default({}),
722
+ result: jsonb21("result"),
723
+ error: text23("error"),
724
+ attempts: integer14("attempts").notNull().default(0),
725
+ graphileJobId: bigint3("graphile_job_id", { mode: "number" }),
726
+ taskKind: text23("task_kind"),
727
+ payload: jsonb21("payload"),
728
+ claimedBy: text23("claimed_by"),
729
+ claimedAt: timestamp23("claimed_at", { withTimezone: true }),
730
+ leaseExpiresAt: timestamp23("lease_expires_at", { withTimezone: true }),
731
+ createdAt: timestamp23("created_at", { withTimezone: true }).defaultNow(),
732
+ updatedAt: timestamp23("updated_at", { withTimezone: true }).defaultNow(),
733
+ completedAt: timestamp23("completed_at", { withTimezone: true })
727
734
  }, (table) => [
728
- index19("idx_insights_user").on(table.userId),
729
- index19("idx_insights_created").on(table.createdAt),
730
- uniqueIndex8("idx_insights_user_project").on(table.userId, table.projectPath)
735
+ index20("idx_insights_jobs_user").on(table.userId),
736
+ index20("idx_insights_jobs_status").on(table.status),
737
+ index20("idx_insights_jobs_pending").on(table.userId, table.status),
738
+ index20("idx_insights_jobs_project").on(table.projectId)
731
739
  ]);
732
-
733
- // ../../packages/db/dist/schema/tables/api-keys.js
734
- import { pgTable as pgTable23, text as text23, timestamp as timestamp23, uuid as uuid22, index as index20, uniqueIndex as uniqueIndex9 } from "drizzle-orm/pg-core";
735
- var apiKeys = pgTable23("api_keys", {
740
+ var insightsReports = pgTable23("insights_reports", {
736
741
  id: uuid22("id").primaryKey().defaultRandom(),
737
- userId: uuid22("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
738
- name: text23("name").notNull(),
739
- keyHash: text23("key_hash").notNull(),
740
- keyPrefix: text23("key_prefix").notNull(),
741
- lastUsedAt: timestamp23("last_used_at", { withTimezone: true }),
742
- expiresAt: timestamp23("expires_at", { withTimezone: true }),
743
- revokedAt: timestamp23("revoked_at", { withTimezone: true }),
742
+ userId: uuid22("user_id").notNull(),
743
+ projectPath: text23("project_path"),
744
+ data: jsonb21("data").notNull(),
745
+ reportHtml: text23("report_html"),
744
746
  createdAt: timestamp23("created_at", { withTimezone: true }).defaultNow()
745
747
  }, (table) => [
746
- index20("idx_api_keys_user").on(table.userId),
747
- uniqueIndex9("idx_api_keys_hash").on(table.keyHash)
748
+ index20("idx_insights_user").on(table.userId),
749
+ index20("idx_insights_created").on(table.createdAt),
750
+ uniqueIndex8("idx_insights_user_project").on(table.userId, table.projectPath)
748
751
  ]);
749
752
 
750
- // ../../packages/db/dist/schema/tables/extension-auth-codes.js
751
- import { pgTable as pgTable24, text as text24, timestamp as timestamp24, uuid as uuid23, index as index21 } from "drizzle-orm/pg-core";
752
- var extensionAuthCodes = pgTable24("extension_auth_codes", {
753
- code: text24("code").primaryKey(),
753
+ // ../../packages/db/dist/schema/tables/api-keys.js
754
+ import { pgTable as pgTable24, text as text24, timestamp as timestamp24, uuid as uuid23, index as index21, uniqueIndex as uniqueIndex9 } from "drizzle-orm/pg-core";
755
+ var apiKeys = pgTable24("api_keys", {
756
+ id: uuid23("id").primaryKey().defaultRandom(),
754
757
  userId: uuid23("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
755
- editor: text24("editor"),
756
- email: text24("email"),
757
- expiresAt: timestamp24("expires_at", { withTimezone: true }).notNull(),
758
+ name: text24("name").notNull(),
759
+ keyHash: text24("key_hash").notNull(),
760
+ keyPrefix: text24("key_prefix").notNull(),
761
+ lastUsedAt: timestamp24("last_used_at", { withTimezone: true }),
762
+ expiresAt: timestamp24("expires_at", { withTimezone: true }),
763
+ revokedAt: timestamp24("revoked_at", { withTimezone: true }),
758
764
  createdAt: timestamp24("created_at", { withTimezone: true }).defaultNow()
759
765
  }, (table) => [
760
- index21("idx_ext_auth_codes_expiry").on(table.expiresAt)
766
+ index21("idx_api_keys_user").on(table.userId),
767
+ uniqueIndex9("idx_api_keys_hash").on(table.keyHash)
761
768
  ]);
762
769
 
763
- // ../../packages/db/dist/schema/tables/eval-conversations.js
764
- import { pgTable as pgTable25, text as text25, timestamp as timestamp25, jsonb as jsonb21, uuid as uuid24, index as index22 } from "drizzle-orm/pg-core";
765
- var evalConversations = pgTable25("eval_conversations", {
766
- id: uuid24("id").primaryKey().defaultRandom(),
767
- evalTargetId: uuid24("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
768
- userId: uuid24("user_id").notNull(),
769
- messages: jsonb21("messages").notNull().default([]),
770
- status: text25("status").notNull().default("active"),
771
- createdAt: timestamp25("created_at", { withTimezone: true }).defaultNow(),
772
- updatedAt: timestamp25("updated_at", { withTimezone: true }).defaultNow()
770
+ // ../../packages/db/dist/schema/tables/extension-auth-codes.js
771
+ import { pgTable as pgTable25, text as text25, timestamp as timestamp25, uuid as uuid24, index as index22 } from "drizzle-orm/pg-core";
772
+ var extensionAuthCodes = pgTable25("extension_auth_codes", {
773
+ code: text25("code").primaryKey(),
774
+ userId: uuid24("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
775
+ editor: text25("editor"),
776
+ email: text25("email"),
777
+ expiresAt: timestamp25("expires_at", { withTimezone: true }).notNull(),
778
+ createdAt: timestamp25("created_at", { withTimezone: true }).defaultNow()
773
779
  }, (table) => [
774
- index22("idx_eval_conversations_target").on(table.evalTargetId),
775
- index22("idx_eval_conversations_user").on(table.userId)
780
+ index22("idx_ext_auth_codes_expiry").on(table.expiresAt)
776
781
  ]);
777
782
 
778
- // ../../packages/db/dist/schema/tables/security-events.js
779
- import { pgTable as pgTable26, uuid as uuid25, text as text26, jsonb as jsonb22, timestamp as timestamp26, index as index23 } from "drizzle-orm/pg-core";
780
- var securityEvents = pgTable26("security_events", {
783
+ // ../../packages/db/dist/schema/tables/eval-conversations.js
784
+ import { pgTable as pgTable26, text as text26, timestamp as timestamp26, jsonb as jsonb22, uuid as uuid25, index as index23 } from "drizzle-orm/pg-core";
785
+ var evalConversations = pgTable26("eval_conversations", {
781
786
  id: uuid25("id").primaryKey().defaultRandom(),
782
- eventType: text26("event_type").notNull(),
783
- severity: text26("severity").notNull(),
784
- category: text26("category").notNull(),
785
- source: text26("source").notNull(),
786
- entityType: text26("entity_type"),
787
- entityId: uuid25("entity_id"),
788
- userId: uuid25("user_id"),
789
- details: jsonb22("details").notNull().default({}),
790
- createdAt: timestamp26("created_at", { withTimezone: true }).notNull().defaultNow()
787
+ evalTargetId: uuid25("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
788
+ userId: uuid25("user_id").notNull(),
789
+ messages: jsonb22("messages").notNull().default([]),
790
+ status: text26("status").notNull().default("active"),
791
+ createdAt: timestamp26("created_at", { withTimezone: true }).defaultNow(),
792
+ updatedAt: timestamp26("updated_at", { withTimezone: true }).defaultNow()
791
793
  }, (table) => [
792
- index23("idx_security_events_type").on(table.eventType),
793
- index23("idx_security_events_user").on(table.userId),
794
- index23("idx_security_events_created").on(table.createdAt),
795
- index23("idx_security_events_severity").on(table.severity),
796
- index23("idx_security_events_source").on(table.source)
794
+ index23("idx_eval_conversations_target").on(table.evalTargetId),
795
+ index23("idx_eval_conversations_user").on(table.userId)
797
796
  ]);
798
797
 
799
- // ../../packages/db/dist/schema/tables/tasks.js
800
- import { pgTable as pgTable27, text as text27, timestamp as timestamp27, uuid as uuid26, index as index24 } from "drizzle-orm/pg-core";
801
- var tasks = pgTable27("tasks", {
798
+ // ../../packages/db/dist/schema/tables/security-events.js
799
+ import { pgTable as pgTable27, uuid as uuid26, text as text27, jsonb as jsonb23, timestamp as timestamp27, index as index24 } from "drizzle-orm/pg-core";
800
+ var securityEvents = pgTable27("security_events", {
802
801
  id: uuid26("id").primaryKey().defaultRandom(),
803
- title: text27("title").notNull(),
804
- description: text27("description"),
805
- status: text27("status").notNull().default("pending"),
806
- createdBy: uuid26("created_by"),
807
- createdAt: timestamp27("created_at", { withTimezone: true }).defaultNow(),
808
- updatedAt: timestamp27("updated_at", { withTimezone: true }).defaultNow()
802
+ eventType: text27("event_type").notNull(),
803
+ severity: text27("severity").notNull(),
804
+ category: text27("category").notNull(),
805
+ source: text27("source").notNull(),
806
+ entityType: text27("entity_type"),
807
+ entityId: uuid26("entity_id"),
808
+ userId: uuid26("user_id"),
809
+ details: jsonb23("details").notNull().default({}),
810
+ createdAt: timestamp27("created_at", { withTimezone: true }).notNull().defaultNow()
809
811
  }, (table) => [
810
- index24("tasks_created_by_idx").on(table.createdBy),
811
- index24("tasks_status_idx").on(table.status)
812
+ index24("idx_security_events_type").on(table.eventType),
813
+ index24("idx_security_events_user").on(table.userId),
814
+ index24("idx_security_events_created").on(table.createdAt),
815
+ index24("idx_security_events_severity").on(table.severity),
816
+ index24("idx_security_events_source").on(table.source)
812
817
  ]);
813
818
 
814
- // ../../packages/db/dist/schema/tables/skill-submissions.js
815
- import { pgTable as pgTable28, text as text28, timestamp as timestamp28, jsonb as jsonb23, uuid as uuid27 } from "drizzle-orm/pg-core";
816
- var skillSubmissions = pgTable28("skill_submissions", {
819
+ // ../../packages/db/dist/schema/tables/tasks.js
820
+ import { pgTable as pgTable28, text as text28, timestamp as timestamp28, uuid as uuid27, index as index25 } from "drizzle-orm/pg-core";
821
+ var tasks = pgTable28("tasks", {
817
822
  id: uuid27("id").primaryKey().defaultRandom(),
818
- skillId: text28("skill_id").notNull(),
819
- name: text28("name").notNull(),
820
- description: text28("description").notNull(),
821
- category: text28("category").notNull(),
822
- tools: text28("tools").array().notNull(),
823
- tags: text28("tags").array().default([]),
824
- content: text28("content").notNull(),
823
+ title: text28("title").notNull(),
824
+ description: text28("description"),
825
825
  status: text28("status").notNull().default("pending"),
826
- // pending | approved | rejected
827
- submittedBy: uuid27("submitted_by").notNull(),
828
- reviewedBy: uuid27("reviewed_by"),
829
- reviewNote: text28("review_note"),
830
- metadata: jsonb23("metadata"),
826
+ createdBy: uuid27("created_by"),
831
827
  createdAt: timestamp28("created_at", { withTimezone: true }).defaultNow(),
832
828
  updatedAt: timestamp28("updated_at", { withTimezone: true }).defaultNow()
829
+ }, (table) => [
830
+ index25("tasks_created_by_idx").on(table.createdBy),
831
+ index25("tasks_status_idx").on(table.status)
832
+ ]);
833
+
834
+ // ../../packages/db/dist/schema/tables/skill-submissions.js
835
+ import { pgTable as pgTable29, text as text29, timestamp as timestamp29, jsonb as jsonb24, uuid as uuid28 } from "drizzle-orm/pg-core";
836
+ var skillSubmissions = pgTable29("skill_submissions", {
837
+ id: uuid28("id").primaryKey().defaultRandom(),
838
+ skillId: text29("skill_id").notNull(),
839
+ name: text29("name").notNull(),
840
+ description: text29("description").notNull(),
841
+ category: text29("category").notNull(),
842
+ tools: text29("tools").array().notNull(),
843
+ tags: text29("tags").array().default([]),
844
+ content: text29("content").notNull(),
845
+ status: text29("status").notNull().default("pending"),
846
+ // pending | approved | rejected
847
+ submittedBy: uuid28("submitted_by").notNull(),
848
+ reviewedBy: uuid28("reviewed_by"),
849
+ reviewNote: text29("review_note"),
850
+ metadata: jsonb24("metadata"),
851
+ createdAt: timestamp29("created_at", { withTimezone: true }).defaultNow(),
852
+ updatedAt: timestamp29("updated_at", { withTimezone: true }).defaultNow()
833
853
  });
834
854
 
835
855
  // ../../packages/db/dist/schema/tables/harness-releases.js
836
- import { pgTable as pgTable29, text as text29, timestamp as timestamp29, jsonb as jsonb24, uuid as uuid28, uniqueIndex as uniqueIndex10, index as index25 } from "drizzle-orm/pg-core";
837
- var harnessReleases = pgTable29("harness_releases", {
838
- id: uuid28("id").primaryKey().defaultRandom(),
839
- harness: text29("harness").notNull(),
856
+ import { pgTable as pgTable30, text as text30, timestamp as timestamp30, jsonb as jsonb25, uuid as uuid29, uniqueIndex as uniqueIndex10, index as index26 } from "drizzle-orm/pg-core";
857
+ var harnessReleases = pgTable30("harness_releases", {
858
+ id: uuid29("id").primaryKey().defaultRandom(),
859
+ harness: text30("harness").notNull(),
840
860
  // "claude_code", "cursor", "copilot"
841
- version: text29("version").notNull(),
861
+ version: text30("version").notNull(),
842
862
  // "v2.1.119"
843
- publishedAt: timestamp29("published_at", { withTimezone: true }).notNull(),
844
- title: text29("title"),
863
+ publishedAt: timestamp30("published_at", { withTimezone: true }).notNull(),
864
+ title: text30("title"),
845
865
  // release name
846
- body: text29("body"),
866
+ body: text30("body"),
847
867
  // raw markdown
848
- categories: jsonb24("categories").default({}),
868
+ categories: jsonb25("categories").default({}),
849
869
  // { features: string[], fixes: string[], security: string[] }
850
- url: text29("url"),
870
+ url: text30("url"),
851
871
  // link to release page
852
- createdAt: timestamp29("created_at", { withTimezone: true }).defaultNow()
872
+ createdAt: timestamp30("created_at", { withTimezone: true }).defaultNow()
853
873
  }, (table) => [
854
874
  uniqueIndex10("idx_harness_releases_unique").on(table.harness, table.version),
855
- index25("idx_harness_releases_harness").on(table.harness),
856
- index25("idx_harness_releases_published").on(table.publishedAt)
875
+ index26("idx_harness_releases_harness").on(table.harness),
876
+ index26("idx_harness_releases_published").on(table.publishedAt)
857
877
  ]);
858
878
 
859
879
  // ../../packages/db/dist/schema/tables/notifications.js
860
- import { pgTable as pgTable30, text as text30, timestamp as timestamp30, jsonb as jsonb25, uuid as uuid29, index as index26, uniqueIndex as uniqueIndex11 } from "drizzle-orm/pg-core";
861
- var notifications = pgTable30("notifications", {
862
- id: uuid29("id").primaryKey().defaultRandom(),
863
- userId: uuid29("user_id").notNull(),
864
- type: text30("type").notNull(),
865
- title: text30("title").notNull(),
866
- body: text30("body"),
867
- url: text30("url"),
868
- sourceTable: text30("source_table"),
869
- sourceId: text30("source_id"),
870
- metadata: jsonb25("metadata").notNull().default({}),
871
- readAt: timestamp30("read_at", { withTimezone: true }),
872
- createdAt: timestamp30("created_at", { withTimezone: true }).notNull().defaultNow()
880
+ import { pgTable as pgTable31, text as text31, timestamp as timestamp31, jsonb as jsonb26, uuid as uuid30, index as index27, uniqueIndex as uniqueIndex11 } from "drizzle-orm/pg-core";
881
+ var notifications = pgTable31("notifications", {
882
+ id: uuid30("id").primaryKey().defaultRandom(),
883
+ userId: uuid30("user_id").notNull(),
884
+ type: text31("type").notNull(),
885
+ title: text31("title").notNull(),
886
+ body: text31("body"),
887
+ url: text31("url"),
888
+ sourceTable: text31("source_table"),
889
+ sourceId: text31("source_id"),
890
+ metadata: jsonb26("metadata").notNull().default({}),
891
+ readAt: timestamp31("read_at", { withTimezone: true }),
892
+ createdAt: timestamp31("created_at", { withTimezone: true }).notNull().defaultNow()
873
893
  }, (table) => [
874
- index26("idx_notifications_user_created").on(table.userId, table.createdAt),
875
- index26("idx_notifications_user_unread").on(table.userId),
894
+ index27("idx_notifications_user_created").on(table.userId, table.createdAt),
895
+ index27("idx_notifications_user_unread").on(table.userId),
876
896
  uniqueIndex11("idx_notifications_source_dedup").on(table.userId, table.sourceTable, table.sourceId)
877
897
  ]);
878
898
 
879
899
  // ../../packages/db/dist/schema/tables/launch-jobs.js
880
- import { pgTable as pgTable31, text as text31, timestamp as timestamp31, jsonb as jsonb26, uuid as uuid30, index as index27, integer as integer14, bigint as bigint4 } from "drizzle-orm/pg-core";
881
- var launchJobs = pgTable31("launch_jobs", {
882
- id: uuid30("id").primaryKey().defaultRandom(),
883
- userId: uuid30("user_id").notNull(),
884
- tool: text31("tool").notNull(),
885
- status: text31("status").notNull().default("pending"),
886
- config: jsonb26("config").notNull().default({}),
887
- result: jsonb26("result"),
888
- error: text31("error"),
889
- attempts: integer14("attempts").notNull().default(0),
900
+ import { pgTable as pgTable32, text as text32, timestamp as timestamp32, jsonb as jsonb27, uuid as uuid31, index as index28, integer as integer15, bigint as bigint4 } from "drizzle-orm/pg-core";
901
+ var launchJobs = pgTable32("launch_jobs", {
902
+ id: uuid31("id").primaryKey().defaultRandom(),
903
+ userId: uuid31("user_id").notNull(),
904
+ tool: text32("tool").notNull(),
905
+ status: text32("status").notNull().default("pending"),
906
+ config: jsonb27("config").notNull().default({}),
907
+ result: jsonb27("result"),
908
+ error: text32("error"),
909
+ attempts: integer15("attempts").notNull().default(0),
890
910
  graphileJobId: bigint4("graphile_job_id", { mode: "number" }),
891
- taskKind: text31("task_kind"),
892
- payload: jsonb26("payload"),
893
- claimedBy: text31("claimed_by"),
894
- claimedAt: timestamp31("claimed_at", { withTimezone: true }),
895
- leaseExpiresAt: timestamp31("lease_expires_at", { withTimezone: true }),
896
- createdAt: timestamp31("created_at", { withTimezone: true }).defaultNow(),
897
- updatedAt: timestamp31("updated_at", { withTimezone: true }).defaultNow(),
898
- completedAt: timestamp31("completed_at", { withTimezone: true }),
899
- runId: uuid30("run_id").references(() => agentRuns.id, { onDelete: "set null" })
911
+ taskKind: text32("task_kind"),
912
+ payload: jsonb27("payload"),
913
+ claimedBy: text32("claimed_by"),
914
+ claimedAt: timestamp32("claimed_at", { withTimezone: true }),
915
+ leaseExpiresAt: timestamp32("lease_expires_at", { withTimezone: true }),
916
+ createdAt: timestamp32("created_at", { withTimezone: true }).defaultNow(),
917
+ updatedAt: timestamp32("updated_at", { withTimezone: true }).defaultNow(),
918
+ completedAt: timestamp32("completed_at", { withTimezone: true }),
919
+ runId: uuid31("run_id").references(() => agentRuns.id, { onDelete: "set null" })
900
920
  }, (table) => [
901
- index27("idx_launch_jobs_user").on(table.userId),
902
- index27("idx_launch_jobs_status").on(table.status),
903
- index27("idx_launch_jobs_pending").on(table.userId, table.status),
904
- index27("idx_launch_jobs_run").on(table.runId)
921
+ index28("idx_launch_jobs_user").on(table.userId),
922
+ index28("idx_launch_jobs_status").on(table.status),
923
+ index28("idx_launch_jobs_pending").on(table.userId, table.status),
924
+ index28("idx_launch_jobs_run").on(table.runId)
905
925
  ]);
906
926
 
907
927
  // ../../packages/db/dist/schema/tables/instruction-suggestions.js
908
- import { pgTable as pgTable32, uuid as uuid31, text as text32, real as real3, timestamp as timestamp32, boolean as boolean8, uniqueIndex as uniqueIndex12, index as index28 } from "drizzle-orm/pg-core";
909
- var instructionSuggestions = pgTable32("instruction_suggestions", {
910
- id: uuid31("id").primaryKey().defaultRandom(),
911
- userId: uuid31("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
912
- instructionId: uuid31("instruction_id").notNull().references(() => instructions.id, { onDelete: "cascade" }),
913
- projectPath: text32("project_path").notNull(),
928
+ import { pgTable as pgTable33, uuid as uuid32, text as text33, real as real3, timestamp as timestamp33, boolean as boolean9, uniqueIndex as uniqueIndex12, index as index29 } from "drizzle-orm/pg-core";
929
+ var instructionSuggestions = pgTable33("instruction_suggestions", {
930
+ id: uuid32("id").primaryKey().defaultRandom(),
931
+ userId: uuid32("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
932
+ instructionId: uuid32("instruction_id").notNull().references(() => instructions.id, { onDelete: "cascade" }),
933
+ projectPath: text33("project_path").notNull(),
914
934
  // Canonical project identity (migration 00104). Additive + nullable; the
915
935
  // unique index below stays on project_path (NOT NULL) so upserts are
916
936
  // unchanged. Readers prefer project_id to aggregate across path variants.
917
- projectId: uuid31("project_id").references(() => projects.id, { onDelete: "set null" }),
937
+ projectId: uuid32("project_id").references(() => projects.id, { onDelete: "set null" }),
918
938
  score: real3("score").notNull(),
919
- reason: text32("reason").notNull(),
920
- generatedAt: timestamp32("generated_at", { withTimezone: true }).notNull().defaultNow(),
921
- isStale: boolean8("is_stale").notNull().default(false),
922
- dismissedAt: timestamp32("dismissed_at", { withTimezone: true }),
923
- acceptedAt: timestamp32("accepted_at", { withTimezone: true }),
924
- promotedToInstructionId: uuid31("promoted_to_instruction_id").references(() => instructions.id, { onDelete: "set null" })
939
+ reason: text33("reason").notNull(),
940
+ generatedAt: timestamp33("generated_at", { withTimezone: true }).notNull().defaultNow(),
941
+ isStale: boolean9("is_stale").notNull().default(false),
942
+ dismissedAt: timestamp33("dismissed_at", { withTimezone: true }),
943
+ acceptedAt: timestamp33("accepted_at", { withTimezone: true }),
944
+ promotedToInstructionId: uuid32("promoted_to_instruction_id").references(() => instructions.id, { onDelete: "set null" })
925
945
  }, (table) => [
926
946
  uniqueIndex12("idx_instruction_suggestions_user_project_instruction").on(table.userId, table.projectPath, table.instructionId),
927
- index28("idx_instruction_suggestions_user_project").on(table.userId, table.projectPath),
928
- index28("idx_instruction_suggestions_user_proj_id").on(table.userId, table.projectId),
929
- index28("idx_instruction_suggestions_generated_at").on(table.generatedAt)
947
+ index29("idx_instruction_suggestions_user_project").on(table.userId, table.projectPath),
948
+ index29("idx_instruction_suggestions_user_proj_id").on(table.userId, table.projectId),
949
+ index29("idx_instruction_suggestions_generated_at").on(table.generatedAt)
930
950
  ]);
931
- var instructionSuggestionEvents = pgTable32("instruction_suggestion_events", {
932
- id: uuid31("id").primaryKey().defaultRandom(),
933
- suggestionId: uuid31("suggestion_id").notNull().references(() => instructionSuggestions.id, { onDelete: "cascade" }),
934
- userId: uuid31("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
935
- eventType: text32("event_type").notNull(),
936
- tool: text32("tool"),
937
- sessionId: uuid31("session_id"),
938
- projectPath: text32("project_path").notNull(),
939
- createdAt: timestamp32("created_at", { withTimezone: true }).notNull().defaultNow()
951
+ var instructionSuggestionEvents = pgTable33("instruction_suggestion_events", {
952
+ id: uuid32("id").primaryKey().defaultRandom(),
953
+ suggestionId: uuid32("suggestion_id").notNull().references(() => instructionSuggestions.id, { onDelete: "cascade" }),
954
+ userId: uuid32("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
955
+ eventType: text33("event_type").notNull(),
956
+ tool: text33("tool"),
957
+ sessionId: uuid32("session_id"),
958
+ projectPath: text33("project_path").notNull(),
959
+ createdAt: timestamp33("created_at", { withTimezone: true }).notNull().defaultNow()
940
960
  }, (table) => [
941
- index28("idx_instruction_suggestion_events_suggestion_id").on(table.suggestionId),
942
- index28("idx_instruction_suggestion_events_user_id").on(table.userId)
961
+ index29("idx_instruction_suggestion_events_suggestion_id").on(table.suggestionId),
962
+ index29("idx_instruction_suggestion_events_user_id").on(table.userId)
943
963
  ]);
944
964
 
945
965
  // ../../packages/db/dist/schema/tables/model-pricing.js
946
- import { pgTable as pgTable33, text as text33, integer as integer15, numeric, timestamp as timestamp33, index as index29, primaryKey as primaryKey4 } from "drizzle-orm/pg-core";
947
- var modelPricing = pgTable33("model_pricing", {
948
- provider: text33("provider").notNull(),
949
- modelId: text33("model_id").notNull(),
966
+ import { pgTable as pgTable34, text as text34, integer as integer16, numeric, timestamp as timestamp34, index as index30, primaryKey as primaryKey4 } from "drizzle-orm/pg-core";
967
+ var modelPricing = pgTable34("model_pricing", {
968
+ provider: text34("provider").notNull(),
969
+ modelId: text34("model_id").notNull(),
950
970
  inputPerM: numeric("input_per_m").notNull(),
951
971
  outputPerM: numeric("output_per_m").notNull(),
952
972
  cacheReadPerM: numeric("cache_read_per_m").notNull(),
953
973
  cacheWrite5mPerM: numeric("cache_write_5m_per_m").notNull(),
954
974
  cacheWrite1hPerM: numeric("cache_write_1h_per_m").notNull(),
955
- contextWindow: integer15("context_window"),
956
- effectiveFrom: timestamp33("effective_from", { withTimezone: true }).notNull(),
957
- effectiveUntil: timestamp33("effective_until", { withTimezone: true }),
958
- source: text33("source").notNull()
975
+ contextWindow: integer16("context_window"),
976
+ effectiveFrom: timestamp34("effective_from", { withTimezone: true }).notNull(),
977
+ effectiveUntil: timestamp34("effective_until", { withTimezone: true }),
978
+ source: text34("source").notNull()
959
979
  }, (table) => [
960
980
  primaryKey4({ columns: [table.provider, table.modelId, table.effectiveFrom] }),
961
- index29("idx_model_pricing_active").on(table.provider, table.modelId, table.effectiveFrom.desc())
981
+ index30("idx_model_pricing_active").on(table.provider, table.modelId, table.effectiveFrom.desc())
962
982
  ]);
963
983
 
964
984
  // ../../packages/db/dist/schema/tables/limit-observations.js
965
- import { pgTable as pgTable34, text as text34, numeric as numeric2, timestamp as timestamp34, uuid as uuid32, jsonb as jsonb27, index as index30 } from "drizzle-orm/pg-core";
966
- var limitObservations = pgTable34("limit_observations", {
967
- id: uuid32("id").primaryKey().defaultRandom(),
968
- observedAt: timestamp34("observed_at", { withTimezone: true }).notNull().defaultNow(),
969
- provider: text34("provider").notNull(),
970
- plan: text34("plan").notNull(),
971
- limitType: text34("limit_type").notNull(),
985
+ import { pgTable as pgTable35, text as text35, numeric as numeric2, timestamp as timestamp35, uuid as uuid33, jsonb as jsonb28, index as index31 } from "drizzle-orm/pg-core";
986
+ var limitObservations = pgTable35("limit_observations", {
987
+ id: uuid33("id").primaryKey().defaultRandom(),
988
+ observedAt: timestamp35("observed_at", { withTimezone: true }).notNull().defaultNow(),
989
+ provider: text35("provider").notNull(),
990
+ plan: text35("plan").notNull(),
991
+ limitType: text35("limit_type").notNull(),
972
992
  value: numeric2("value").notNull(),
973
- unit: text34("unit").notNull(),
974
- comparator: text34("comparator").notNull().default("="),
975
- resetsAt: timestamp34("resets_at", { withTimezone: true }),
976
- sourceType: text34("source_type").notNull(),
977
- sourceUrl: text34("source_url"),
978
- sourceEvidence: jsonb27("source_evidence"),
993
+ unit: text35("unit").notNull(),
994
+ comparator: text35("comparator").notNull().default("="),
995
+ resetsAt: timestamp35("resets_at", { withTimezone: true }),
996
+ sourceType: text35("source_type").notNull(),
997
+ sourceUrl: text35("source_url"),
998
+ sourceEvidence: jsonb28("source_evidence"),
979
999
  confidence: numeric2("confidence").notNull(),
980
- userId: uuid32("user_id")
1000
+ userId: uuid33("user_id")
981
1001
  }, (table) => [
982
- index30("idx_limit_obs_lookup").on(table.provider, table.plan, table.limitType, table.observedAt.desc()),
983
- index30("idx_limit_obs_user").on(table.userId, table.observedAt.desc())
1002
+ index31("idx_limit_obs_lookup").on(table.provider, table.plan, table.limitType, table.observedAt.desc()),
1003
+ index31("idx_limit_obs_user").on(table.userId, table.observedAt.desc())
984
1004
  ]);
985
1005
 
986
1006
  // ../../packages/db/dist/schema/tables/provider-docs-snapshots.js
987
- import { pgTable as pgTable35, text as text35, timestamp as timestamp35, uuid as uuid33, jsonb as jsonb28, boolean as boolean9, uniqueIndex as uniqueIndex13 } from "drizzle-orm/pg-core";
988
- var providerDocsSnapshots = pgTable35("provider_docs_snapshots", {
989
- id: uuid33("id").primaryKey().defaultRandom(),
990
- fetchedAt: timestamp35("fetched_at", { withTimezone: true }).notNull().defaultNow(),
991
- provider: text35("provider").notNull(),
992
- docUrl: text35("doc_url").notNull(),
993
- contentHash: text35("content_hash").notNull(),
994
- content: text35("content").notNull(),
995
- parseSuccess: boolean9("parse_success").notNull(),
996
- parseErrors: jsonb28("parse_errors")
1007
+ import { pgTable as pgTable36, text as text36, timestamp as timestamp36, uuid as uuid34, jsonb as jsonb29, boolean as boolean10, uniqueIndex as uniqueIndex13 } from "drizzle-orm/pg-core";
1008
+ var providerDocsSnapshots = pgTable36("provider_docs_snapshots", {
1009
+ id: uuid34("id").primaryKey().defaultRandom(),
1010
+ fetchedAt: timestamp36("fetched_at", { withTimezone: true }).notNull().defaultNow(),
1011
+ provider: text36("provider").notNull(),
1012
+ docUrl: text36("doc_url").notNull(),
1013
+ contentHash: text36("content_hash").notNull(),
1014
+ content: text36("content").notNull(),
1015
+ parseSuccess: boolean10("parse_success").notNull(),
1016
+ parseErrors: jsonb29("parse_errors")
997
1017
  }, (table) => [
998
1018
  uniqueIndex13("idx_docs_dedup").on(table.provider, table.docUrl, table.contentHash)
999
1019
  ]);
1000
1020
 
1001
1021
  // ../../packages/db/dist/schema/tables/plan-limits-active.js
1002
- import { pgTable as pgTable36, text as text36, numeric as numeric3, timestamp as timestamp36, uuid as uuid34, primaryKey as primaryKey5, index as index31 } from "drizzle-orm/pg-core";
1003
- var planLimitsActive = pgTable36("plan_limits_active", {
1004
- provider: text36("provider").notNull(),
1005
- plan: text36("plan").notNull(),
1006
- limitType: text36("limit_type").notNull(),
1022
+ import { pgTable as pgTable37, text as text37, numeric as numeric3, timestamp as timestamp37, uuid as uuid35, primaryKey as primaryKey5, index as index32 } from "drizzle-orm/pg-core";
1023
+ var planLimitsActive = pgTable37("plan_limits_active", {
1024
+ provider: text37("provider").notNull(),
1025
+ plan: text37("plan").notNull(),
1026
+ limitType: text37("limit_type").notNull(),
1007
1027
  value: numeric3("value").notNull(),
1008
- unit: text36("unit").notNull(),
1009
- effectiveFrom: timestamp36("effective_from", { withTimezone: true }).notNull(),
1010
- effectiveUntil: timestamp36("effective_until", { withTimezone: true }),
1028
+ unit: text37("unit").notNull(),
1029
+ effectiveFrom: timestamp37("effective_from", { withTimezone: true }).notNull(),
1030
+ effectiveUntil: timestamp37("effective_until", { withTimezone: true }),
1011
1031
  confidence: numeric3("confidence").notNull(),
1012
- sourceObservationIds: uuid34("source_observation_ids").array().notNull()
1032
+ sourceObservationIds: uuid35("source_observation_ids").array().notNull()
1013
1033
  }, (table) => [
1014
1034
  primaryKey5({ columns: [table.provider, table.plan, table.limitType, table.effectiveFrom] }),
1015
- index31("idx_plan_limits_lookup").on(table.provider, table.plan, table.limitType, table.effectiveFrom.desc())
1035
+ index32("idx_plan_limits_lookup").on(table.provider, table.plan, table.limitType, table.effectiveFrom.desc())
1016
1036
  ]);
1017
1037
 
1018
1038
  // ../../packages/db/dist/schema/tables/alert-dispatches.js
1019
- import { pgTable as pgTable37, text as text37, timestamp as timestamp37, uuid as uuid35, jsonb as jsonb29, index as index32 } from "drizzle-orm/pg-core";
1020
- var alertDispatches = pgTable37("alert_dispatches", {
1021
- id: uuid35("id").primaryKey().defaultRandom(),
1022
- userId: uuid35("user_id").notNull(),
1023
- alertKey: text37("alert_key").notNull(),
1039
+ import { pgTable as pgTable38, text as text38, timestamp as timestamp38, uuid as uuid36, jsonb as jsonb30, index as index33 } from "drizzle-orm/pg-core";
1040
+ var alertDispatches = pgTable38("alert_dispatches", {
1041
+ id: uuid36("id").primaryKey().defaultRandom(),
1042
+ userId: uuid36("user_id").notNull(),
1043
+ alertKey: text38("alert_key").notNull(),
1024
1044
  // 'soft' | 'approaching' | 'imminent' | 'hit'
1025
- severity: text37("severity").notNull(),
1026
- lastDispatchedAt: timestamp37("last_dispatched_at", { withTimezone: true }).notNull().defaultNow(),
1045
+ severity: text38("severity").notNull(),
1046
+ lastDispatchedAt: timestamp38("last_dispatched_at", { withTimezone: true }).notNull().defaultNow(),
1027
1047
  // { used_percentage, resets_at, ... } — snapshot of the input that fired this alert.
1028
- lastState: jsonb29("last_state").notNull(),
1048
+ lastState: jsonb30("last_state").notNull(),
1029
1049
  // 'in_app' | 'vscode' | 'banner'
1030
- channel: text37("channel").notNull()
1050
+ channel: text38("channel").notNull()
1031
1051
  }, (table) => [
1032
- index32("idx_alert_user_key").on(table.userId, table.alertKey, table.lastDispatchedAt.desc())
1052
+ index33("idx_alert_user_key").on(table.userId, table.alertKey, table.lastDispatchedAt.desc())
1033
1053
  ]);
1034
1054
 
1035
1055
  // ../../packages/db/dist/client.js
@@ -1049,6 +1069,7 @@ __export(schema_exports, {
1049
1069
  apiKeysRelations: () => apiKeysRelations,
1050
1070
  benchmarks: () => benchmarks,
1051
1071
  benchmarksRelations: () => benchmarksRelations,
1072
+ cliErrorEvents: () => cliErrorEvents,
1052
1073
  cliSetupEvents: () => cliSetupEvents,
1053
1074
  contentBlobs: () => contentBlobs,
1054
1075
  contextSnapshots: () => contextSnapshots,
@@ -1371,6 +1392,8 @@ var contextSnapshotsRelations = relations(contextSnapshots, ({ one }) => ({
1371
1392
  // ../../packages/db/dist/db-load.js
1372
1393
  var _inFlight = 0;
1373
1394
  var _peak = 0;
1395
+ var _heavyInFlight = 0;
1396
+ var _heavyPeak = 0;
1374
1397
  function trackDbOpStart() {
1375
1398
  _inFlight++;
1376
1399
  if (_inFlight > _peak)
@@ -1380,6 +1403,15 @@ function trackDbOpEnd() {
1380
1403
  if (_inFlight > 0)
1381
1404
  _inFlight--;
1382
1405
  }
1406
+ function trackHeavyDbOpStart() {
1407
+ _heavyInFlight++;
1408
+ if (_heavyInFlight > _heavyPeak)
1409
+ _heavyPeak = _heavyInFlight;
1410
+ }
1411
+ function trackHeavyDbOpEnd() {
1412
+ if (_heavyInFlight > 0)
1413
+ _heavyInFlight--;
1414
+ }
1383
1415
 
1384
1416
  // ../../packages/db/dist/client.js
1385
1417
  var _db;
@@ -1548,7 +1580,7 @@ var READ_ONLY_ENTRY_METHODS = /* @__PURE__ */ new Set([
1548
1580
  "selectDistinctOn",
1549
1581
  "$count"
1550
1582
  ]);
1551
- function wrapBuilder(value, readSafe = false, deadlineMs = 0) {
1583
+ function wrapBuilder(value, readSafe = false, deadlineMs = 0, heavyPool = false) {
1552
1584
  if (value === null || typeof value !== "object" && typeof value !== "function") {
1553
1585
  return value;
1554
1586
  }
@@ -1559,26 +1591,30 @@ function wrapBuilder(value, readSafe = false, deadlineMs = 0) {
1559
1591
  if (typeof then !== "function")
1560
1592
  return then;
1561
1593
  return (onFulfilled, onRejected) => {
1562
- trackDbOpStart();
1594
+ const opStart = heavyPool ? trackHeavyDbOpStart : trackDbOpStart;
1595
+ const opEnd = heavyPool ? trackHeavyDbOpEnd : trackDbOpEnd;
1596
+ opStart();
1563
1597
  const exec = withDbRetry(() => new Promise((resolve, reject) => then.call(target, resolve, reject)), { retryResets: readSafe });
1564
1598
  const guarded = deadlineMs > 0 ? raceWithDeadline(exec, deadlineMs) : exec;
1565
- return guarded.finally(trackDbOpEnd).then(onFulfilled, onRejected);
1599
+ return guarded.finally(opEnd).then(onFulfilled, onRejected);
1566
1600
  };
1567
1601
  }
1568
1602
  const v = Reflect.get(target, prop, receiver);
1569
1603
  if (typeof v === "function") {
1570
- return (...args) => wrapBuilder(v.apply(target, args), readSafe, deadlineMs);
1604
+ return (...args) => wrapBuilder(v.apply(target, args), readSafe, deadlineMs, heavyPool);
1571
1605
  }
1572
1606
  return v;
1573
1607
  }
1574
1608
  });
1575
1609
  }
1576
- function gaugeTransaction(run) {
1577
- trackDbOpStart();
1610
+ function gaugeTransaction(run, heavyPool = false) {
1611
+ const opStart = heavyPool ? trackHeavyDbOpStart : trackDbOpStart;
1612
+ const opEnd = heavyPool ? trackHeavyDbOpEnd : trackDbOpEnd;
1613
+ opStart();
1578
1614
  try {
1579
- return Promise.resolve(run()).finally(trackDbOpEnd);
1615
+ return Promise.resolve(run()).finally(opEnd);
1580
1616
  } catch (err) {
1581
- trackDbOpEnd();
1617
+ opEnd();
1582
1618
  throw err;
1583
1619
  }
1584
1620
  }
@@ -1603,10 +1639,10 @@ var heavyDb = new Proxy({}, {
1603
1639
  const value = real4[prop];
1604
1640
  if (typeof prop === "string" && RETRY_ENTRY_METHODS.has(prop) && typeof value === "function") {
1605
1641
  const readSafe = READ_ONLY_ENTRY_METHODS.has(prop);
1606
- return (...args) => wrapBuilder(value.apply(real4, args), readSafe);
1642
+ return (...args) => wrapBuilder(value.apply(real4, args), readSafe, 0, true);
1607
1643
  }
1608
1644
  if (prop === "transaction" && typeof value === "function") {
1609
- return (...args) => gaugeTransaction(() => value.apply(real4, args));
1645
+ return (...args) => gaugeTransaction(() => value.apply(real4, args), true);
1610
1646
  }
1611
1647
  return value;
1612
1648
  }
@@ -1623,4 +1659,4 @@ export {
1623
1659
  getDb,
1624
1660
  closeDb
1625
1661
  };
1626
- //# sourceMappingURL=chunk-6EMZI4Y3.js.map
1662
+ //# sourceMappingURL=chunk-EI5BHWXA.js.map